@koda-sl/baker-cli 0.121.0-dev.045b11c52 → 0.121.0-dev.3a1b48e85
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 +25 -0
- package/dist/cli.js +1303 -810
- package/dist/cli.js.map +1 -1
- package/package.json +1 -1
package/dist/cli.js
CHANGED
|
@@ -49,7 +49,7 @@ import {
|
|
|
49
49
|
import "./chunk-5WRI5ZAA.js";
|
|
50
50
|
|
|
51
51
|
// src/cli.ts
|
|
52
|
-
import { defineCommand as
|
|
52
|
+
import { defineCommand as defineCommand161, runMain } from "citty";
|
|
53
53
|
|
|
54
54
|
// src/commands/actions/index.ts
|
|
55
55
|
import { defineCommand as defineCommand18 } from "citty";
|
|
@@ -1916,142 +1916,307 @@ var imagesIngestResponseSchema = z4.object({
|
|
|
1916
1916
|
contentHash: z4.string()
|
|
1917
1917
|
});
|
|
1918
1918
|
|
|
1919
|
-
// ../api/src/
|
|
1919
|
+
// ../api/src/tags.ts
|
|
1920
1920
|
import { z as z5 } from "zod";
|
|
1921
|
-
var
|
|
1922
|
-
|
|
1923
|
-
|
|
1924
|
-
|
|
1925
|
-
|
|
1926
|
-
|
|
1927
|
-
|
|
1928
|
-
|
|
1921
|
+
var TAG_TYPES = [
|
|
1922
|
+
"meta",
|
|
1923
|
+
"amplitude",
|
|
1924
|
+
"googleAds",
|
|
1925
|
+
"tiktok",
|
|
1926
|
+
"vwo",
|
|
1927
|
+
"hotjar",
|
|
1928
|
+
"clarity",
|
|
1929
|
+
"pinterest",
|
|
1930
|
+
"code",
|
|
1931
|
+
"googleAnalytics",
|
|
1932
|
+
"googleTagManager",
|
|
1933
|
+
"hubspot",
|
|
1934
|
+
"linkedinInsightTag",
|
|
1935
|
+
"onetrust",
|
|
1936
|
+
"posthog",
|
|
1937
|
+
"datafast",
|
|
1938
|
+
"recaptcha",
|
|
1939
|
+
"twitterAds"
|
|
1940
|
+
];
|
|
1941
|
+
var tagTypeSchema = z5.enum(TAG_TYPES);
|
|
1942
|
+
var TAG_SECRET_FIELDS = {
|
|
1943
|
+
meta: ["accessToken"],
|
|
1944
|
+
amplitude: [],
|
|
1945
|
+
googleAds: ["oauthProviderId", "customerAccountId", "customerId", "loginCustomerId"],
|
|
1946
|
+
tiktok: ["accessToken"],
|
|
1947
|
+
vwo: [],
|
|
1948
|
+
hotjar: [],
|
|
1949
|
+
clarity: [],
|
|
1950
|
+
pinterest: ["conversionToken"],
|
|
1951
|
+
code: [],
|
|
1952
|
+
googleAnalytics: ["apiSecret"],
|
|
1953
|
+
googleTagManager: ["authorizationToken"],
|
|
1954
|
+
hubspot: [],
|
|
1955
|
+
linkedinInsightTag: ["oauthProviderId"],
|
|
1956
|
+
onetrust: [],
|
|
1957
|
+
posthog: [],
|
|
1958
|
+
datafast: ["apiKey"],
|
|
1959
|
+
recaptcha: [],
|
|
1960
|
+
twitterAds: ["oauthProviderId"]
|
|
1961
|
+
};
|
|
1962
|
+
var TAG_REQUESTABLE_SECRET_FIELDS = {
|
|
1963
|
+
meta: ["accessToken"],
|
|
1964
|
+
amplitude: [],
|
|
1965
|
+
googleAds: ["oauthProviderId", "customerAccountId"],
|
|
1966
|
+
tiktok: ["accessToken"],
|
|
1967
|
+
vwo: [],
|
|
1968
|
+
hotjar: [],
|
|
1969
|
+
clarity: [],
|
|
1970
|
+
pinterest: ["conversionToken"],
|
|
1971
|
+
code: [],
|
|
1972
|
+
googleAnalytics: ["apiSecret"],
|
|
1973
|
+
googleTagManager: ["authorizationToken"],
|
|
1974
|
+
hubspot: [],
|
|
1975
|
+
linkedinInsightTag: ["oauthProviderId"],
|
|
1976
|
+
onetrust: [],
|
|
1977
|
+
posthog: [],
|
|
1978
|
+
datafast: ["apiKey"],
|
|
1979
|
+
recaptcha: [],
|
|
1980
|
+
twitterAds: ["oauthProviderId"]
|
|
1981
|
+
};
|
|
1982
|
+
var tagDraftOpKindSchema = z5.enum(["create", "update", "delete"]);
|
|
1983
|
+
var tagDraftOpViewSchema = z5.object({
|
|
1984
|
+
/** `tag_temp_*` for staged creates; the real tag id for update/delete ops. */
|
|
1985
|
+
ref: z5.string(),
|
|
1986
|
+
kind: tagDraftOpKindSchema,
|
|
1987
|
+
type: tagTypeSchema,
|
|
1988
|
+
/** Present on update/delete ops — the real tag this op targets. */
|
|
1989
|
+
tagId: z5.string().optional(),
|
|
1990
|
+
/** Non-secret config (create: full; update: the staged patch). Secrets are structurally absent. */
|
|
1991
|
+
config: z5.record(z5.string(), z5.string()),
|
|
1992
|
+
/** Update only — fields the op explicitly clears. */
|
|
1993
|
+
clearFields: z5.array(z5.string()).optional(),
|
|
1994
|
+
/** Names of secret fields already provided via the dashboard secure form. Never values. */
|
|
1995
|
+
secretsSet: z5.array(z5.string()),
|
|
1996
|
+
/** Names of secret fields still awaiting user input. */
|
|
1997
|
+
secretsPending: z5.array(z5.string()),
|
|
1998
|
+
summary: z5.string(),
|
|
1999
|
+
stagedAt: z5.number()
|
|
2000
|
+
});
|
|
2001
|
+
var tagsEffectiveEntrySchema = z5.object({
|
|
2002
|
+
/** Real tag id, or `tag_temp_*` for staged creates. Use as flow side-effect `tagIds` value. */
|
|
2003
|
+
ref: z5.string(),
|
|
2004
|
+
tagId: z5.string().optional(),
|
|
2005
|
+
type: tagTypeSchema,
|
|
2006
|
+
/** Value of the type's identifying field, when set. */
|
|
2007
|
+
identifier: z5.string().optional(),
|
|
2008
|
+
/** Redacted config; for staged updates, production config with the patch merged. */
|
|
2009
|
+
config: z5.record(z5.string(), z5.string()),
|
|
2010
|
+
/** Absent = live production tag with no staged changes in this chat. */
|
|
2011
|
+
staged: tagDraftOpKindSchema.optional(),
|
|
2012
|
+
secretsSet: z5.array(z5.string()),
|
|
2013
|
+
secretsPending: z5.array(z5.string())
|
|
2014
|
+
});
|
|
2015
|
+
var tagsListRequestSchema = z5.object({ chatId: z5.string() });
|
|
2016
|
+
var tagsListResponseSchema = z5.object({ tags: z5.array(tagsEffectiveEntrySchema) });
|
|
2017
|
+
var tagsDraftStageRequestSchema = z5.discriminatedUnion("kind", [
|
|
2018
|
+
z5.object({
|
|
2019
|
+
kind: z5.literal("create"),
|
|
2020
|
+
chatId: z5.string(),
|
|
2021
|
+
type: tagTypeSchema,
|
|
2022
|
+
config: z5.record(z5.string(), z5.string()),
|
|
2023
|
+
requestSecrets: z5.array(z5.string()).optional(),
|
|
2024
|
+
summary: z5.string().optional()
|
|
2025
|
+
}),
|
|
2026
|
+
z5.object({
|
|
2027
|
+
kind: z5.literal("update"),
|
|
2028
|
+
chatId: z5.string(),
|
|
2029
|
+
ref: z5.string(),
|
|
2030
|
+
config: z5.record(z5.string(), z5.string()).optional(),
|
|
2031
|
+
clearFields: z5.array(z5.string()).optional(),
|
|
2032
|
+
requestSecrets: z5.array(z5.string()).optional(),
|
|
2033
|
+
summary: z5.string().optional()
|
|
2034
|
+
}),
|
|
2035
|
+
z5.object({
|
|
2036
|
+
kind: z5.literal("delete"),
|
|
2037
|
+
chatId: z5.string(),
|
|
2038
|
+
ref: z5.string()
|
|
2039
|
+
})
|
|
2040
|
+
]);
|
|
2041
|
+
var tagsDraftStageResponseSchema = z5.object({
|
|
2042
|
+
/** Null when the request dissolved a staged create (delete/clearing an unpublished temp ref). */
|
|
2043
|
+
op: tagDraftOpViewSchema.nullable(),
|
|
2044
|
+
/** True when a `delete <tag_temp_*>` dropped the staged create instead of staging a delete. */
|
|
2045
|
+
removedStagedCreate: z5.boolean().optional()
|
|
2046
|
+
});
|
|
2047
|
+
var tagsDraftListRequestSchema = z5.object({ chatId: z5.string() });
|
|
2048
|
+
var tagsDraftListResponseSchema = z5.object({
|
|
2049
|
+
status: z5.enum(["active", "publishing", "applied", "discarded", "none"]),
|
|
2050
|
+
ops: z5.array(tagDraftOpViewSchema)
|
|
2051
|
+
});
|
|
2052
|
+
var tagsDraftRemoveRequestSchema = z5.object({ chatId: z5.string(), ref: z5.string() });
|
|
2053
|
+
var tagsDraftRemoveResponseSchema = z5.object({ removed: z5.boolean() });
|
|
2054
|
+
var tagsDraftClearRequestSchema = z5.object({ chatId: z5.string() });
|
|
2055
|
+
var tagsDraftClearResponseSchema = z5.object({ cleared: z5.number() });
|
|
2056
|
+
var tagInputRequestSchema = z5.object({
|
|
2057
|
+
mode: z5.enum(["create", "edit"]),
|
|
2058
|
+
tagType: tagTypeSchema,
|
|
2059
|
+
/** Edit mode — the real tag id or `tag_temp_*` ref being edited. */
|
|
2060
|
+
ref: z5.string().optional(),
|
|
2061
|
+
/** Non-secret values the agent proposes to prefill. Secret keys are stripped at every boundary. */
|
|
2062
|
+
prefilledConfig: z5.record(z5.string(), z5.string()).optional(),
|
|
2063
|
+
/** Secret field names the agent asks the user to provide. */
|
|
2064
|
+
requestedSecretFields: z5.array(z5.string()).optional(),
|
|
2065
|
+
/** Short message shown above the form explaining why the input is needed. */
|
|
2066
|
+
message: z5.string().optional()
|
|
2067
|
+
});
|
|
2068
|
+
var tagInputResultSchema = z5.discriminatedUnion("status", [
|
|
2069
|
+
z5.object({
|
|
2070
|
+
status: z5.literal("submitted"),
|
|
2071
|
+
ref: z5.string(),
|
|
2072
|
+
type: tagTypeSchema,
|
|
2073
|
+
/** Identifying field name → value (non-secret), when the type has one. */
|
|
2074
|
+
identifier: z5.record(z5.string(), z5.string()).optional(),
|
|
2075
|
+
secretFieldsSet: z5.array(z5.string()),
|
|
2076
|
+
note: z5.string().optional()
|
|
2077
|
+
}),
|
|
2078
|
+
z5.object({
|
|
2079
|
+
status: z5.literal("declined"),
|
|
2080
|
+
reason: z5.string().optional()
|
|
2081
|
+
})
|
|
2082
|
+
]);
|
|
2083
|
+
|
|
2084
|
+
// ../api/src/testimonials.ts
|
|
2085
|
+
import { z as z6 } from "zod";
|
|
2086
|
+
var testimonialSourceTypeSchema = z6.enum(["google", "trustpilot"]);
|
|
2087
|
+
var testimonialStatusSchema = z6.enum(["pending", "processing", "ready", "error"]);
|
|
2088
|
+
var testimonialSentimentSchema = z6.enum(["positive", "neutral", "negative"]);
|
|
2089
|
+
var testimonialDocSchema = z6.object({
|
|
2090
|
+
_id: z6.string(),
|
|
2091
|
+
_creationTime: z6.number(),
|
|
2092
|
+
companyId: z6.string(),
|
|
2093
|
+
sourceId: z6.string(),
|
|
1929
2094
|
sourceType: testimonialSourceTypeSchema,
|
|
1930
|
-
reviewText:
|
|
1931
|
-
reviewTitle:
|
|
1932
|
-
searchText:
|
|
1933
|
-
reviewerName:
|
|
1934
|
-
reviewerImageUrl:
|
|
1935
|
-
reviewerImageId:
|
|
1936
|
-
reviewerLocation:
|
|
1937
|
-
rating:
|
|
1938
|
-
reviewDate:
|
|
1939
|
-
ownerAnswer:
|
|
1940
|
-
mediaUrls:
|
|
1941
|
-
imageIds:
|
|
1942
|
-
videoIds:
|
|
1943
|
-
sourceUrl:
|
|
1944
|
-
rawData:
|
|
1945
|
-
tags:
|
|
1946
|
-
highlight:
|
|
1947
|
-
language:
|
|
1948
|
-
summary:
|
|
2095
|
+
reviewText: z6.string(),
|
|
2096
|
+
reviewTitle: z6.string().optional(),
|
|
2097
|
+
searchText: z6.string().optional(),
|
|
2098
|
+
reviewerName: z6.string().optional(),
|
|
2099
|
+
reviewerImageUrl: z6.string().optional(),
|
|
2100
|
+
reviewerImageId: z6.string().optional(),
|
|
2101
|
+
reviewerLocation: z6.string().optional(),
|
|
2102
|
+
rating: z6.number().optional(),
|
|
2103
|
+
reviewDate: z6.number().optional(),
|
|
2104
|
+
ownerAnswer: z6.string().optional(),
|
|
2105
|
+
mediaUrls: z6.array(z6.string()).optional(),
|
|
2106
|
+
imageIds: z6.array(z6.string()).optional(),
|
|
2107
|
+
videoIds: z6.array(z6.string()).optional(),
|
|
2108
|
+
sourceUrl: z6.string().optional(),
|
|
2109
|
+
rawData: z6.unknown().optional(),
|
|
2110
|
+
tags: z6.array(z6.string()),
|
|
2111
|
+
highlight: z6.string().optional(),
|
|
2112
|
+
language: z6.string().optional(),
|
|
2113
|
+
summary: z6.string().optional(),
|
|
1949
2114
|
sentiment: testimonialSentimentSchema.optional(),
|
|
1950
|
-
textEmbedding:
|
|
1951
|
-
externalId:
|
|
1952
|
-
contentHash:
|
|
2115
|
+
textEmbedding: z6.array(z6.number()).optional(),
|
|
2116
|
+
externalId: z6.string().optional(),
|
|
2117
|
+
contentHash: z6.string().optional(),
|
|
1953
2118
|
status: testimonialStatusSchema,
|
|
1954
|
-
errorMessage:
|
|
1955
|
-
createdAt:
|
|
1956
|
-
updatedAt:
|
|
2119
|
+
errorMessage: z6.string().optional(),
|
|
2120
|
+
createdAt: z6.number(),
|
|
2121
|
+
updatedAt: z6.number()
|
|
1957
2122
|
});
|
|
1958
|
-
var testimonialsListRequestSchema =
|
|
2123
|
+
var testimonialsListRequestSchema = z6.object({
|
|
1959
2124
|
source: testimonialSourceTypeSchema.optional(),
|
|
1960
|
-
rating_min:
|
|
1961
|
-
rating_max:
|
|
1962
|
-
tags:
|
|
2125
|
+
rating_min: z6.coerce.number().int().min(1).max(5).optional(),
|
|
2126
|
+
rating_max: z6.coerce.number().int().min(1).max(5).optional(),
|
|
2127
|
+
tags: z6.string().transform((s) => s.split(",").filter(Boolean)).optional(),
|
|
1963
2128
|
status: testimonialStatusSchema.optional(),
|
|
1964
2129
|
sentiment: testimonialSentimentSchema.optional(),
|
|
1965
|
-
language:
|
|
1966
|
-
limit:
|
|
1967
|
-
});
|
|
1968
|
-
var testimonialsListResponseSchema =
|
|
1969
|
-
var testimonialsGetRequestSchema =
|
|
1970
|
-
var testimonialsSearchRequestSchema =
|
|
1971
|
-
query:
|
|
1972
|
-
limit:
|
|
2130
|
+
language: z6.string().min(2).max(5).optional(),
|
|
2131
|
+
limit: z6.coerce.number().int().positive().max(200).optional()
|
|
2132
|
+
});
|
|
2133
|
+
var testimonialsListResponseSchema = z6.array(testimonialDocSchema);
|
|
2134
|
+
var testimonialsGetRequestSchema = z6.object({ id: z6.string().min(1, "Missing id parameter") });
|
|
2135
|
+
var testimonialsSearchRequestSchema = z6.object({
|
|
2136
|
+
query: z6.string().min(1),
|
|
2137
|
+
limit: z6.coerce.number().int().positive().max(100).optional(),
|
|
1973
2138
|
source: testimonialSourceTypeSchema.optional(),
|
|
1974
|
-
rating_min:
|
|
1975
|
-
rating_max:
|
|
1976
|
-
tags:
|
|
2139
|
+
rating_min: z6.coerce.number().int().min(1).max(5).optional(),
|
|
2140
|
+
rating_max: z6.coerce.number().int().min(1).max(5).optional(),
|
|
2141
|
+
tags: z6.array(z6.string()).optional(),
|
|
1977
2142
|
status: testimonialStatusSchema.optional(),
|
|
1978
2143
|
sentiment: testimonialSentimentSchema.optional(),
|
|
1979
|
-
language:
|
|
2144
|
+
language: z6.string().min(2).max(5).optional()
|
|
1980
2145
|
}).refine(
|
|
1981
2146
|
(data) => data.rating_min === void 0 || data.rating_max === void 0 || data.rating_min <= data.rating_max,
|
|
1982
2147
|
{ message: "rating_min must be less than or equal to rating_max" }
|
|
1983
2148
|
);
|
|
1984
|
-
var testimonialsSearchResponseSchema =
|
|
1985
|
-
var testimonialsOutscraperWebhookResponseSchema =
|
|
1986
|
-
ok:
|
|
1987
|
-
note:
|
|
2149
|
+
var testimonialsSearchResponseSchema = z6.array(testimonialDocSchema);
|
|
2150
|
+
var testimonialsOutscraperWebhookResponseSchema = z6.object({
|
|
2151
|
+
ok: z6.literal(true),
|
|
2152
|
+
note: z6.string().optional()
|
|
1988
2153
|
});
|
|
1989
2154
|
|
|
1990
2155
|
// ../api/src/videos.ts
|
|
1991
|
-
import { z as
|
|
1992
|
-
var videoStatusSchema =
|
|
1993
|
-
var videoTranscriptSegmentSchema =
|
|
1994
|
-
text:
|
|
1995
|
-
startSecond:
|
|
1996
|
-
endSecond:
|
|
1997
|
-
});
|
|
1998
|
-
var videoSceneSchema =
|
|
1999
|
-
title:
|
|
2000
|
-
description:
|
|
2001
|
-
startSecond:
|
|
2002
|
-
endSecond:
|
|
2003
|
-
thumbnailTime:
|
|
2004
|
-
});
|
|
2005
|
-
var videoDocSchema =
|
|
2006
|
-
_id:
|
|
2007
|
-
_creationTime:
|
|
2008
|
-
companyId:
|
|
2009
|
-
muxAssetId:
|
|
2010
|
-
muxPlaybackId:
|
|
2011
|
-
muxUploadId:
|
|
2012
|
-
name:
|
|
2013
|
-
description:
|
|
2014
|
-
tags:
|
|
2015
|
-
source:
|
|
2016
|
-
externalId:
|
|
2017
|
-
sourceId:
|
|
2018
|
-
width:
|
|
2019
|
-
height:
|
|
2020
|
-
aspectRatio:
|
|
2021
|
-
duration:
|
|
2022
|
-
transcript:
|
|
2023
|
-
transcriptSegments:
|
|
2024
|
-
scenes:
|
|
2025
|
-
descriptionEmbedding:
|
|
2026
|
-
searchText:
|
|
2156
|
+
import { z as z7 } from "zod";
|
|
2157
|
+
var videoStatusSchema = z7.enum(["uploading", "uploaded", "processing", "ready", "error"]);
|
|
2158
|
+
var videoTranscriptSegmentSchema = z7.object({
|
|
2159
|
+
text: z7.string(),
|
|
2160
|
+
startSecond: z7.number(),
|
|
2161
|
+
endSecond: z7.number()
|
|
2162
|
+
});
|
|
2163
|
+
var videoSceneSchema = z7.object({
|
|
2164
|
+
title: z7.string(),
|
|
2165
|
+
description: z7.string(),
|
|
2166
|
+
startSecond: z7.number(),
|
|
2167
|
+
endSecond: z7.number(),
|
|
2168
|
+
thumbnailTime: z7.number()
|
|
2169
|
+
});
|
|
2170
|
+
var videoDocSchema = z7.object({
|
|
2171
|
+
_id: z7.string(),
|
|
2172
|
+
_creationTime: z7.number(),
|
|
2173
|
+
companyId: z7.string(),
|
|
2174
|
+
muxAssetId: z7.string(),
|
|
2175
|
+
muxPlaybackId: z7.string(),
|
|
2176
|
+
muxUploadId: z7.string(),
|
|
2177
|
+
name: z7.string(),
|
|
2178
|
+
description: z7.string(),
|
|
2179
|
+
tags: z7.array(z7.string()),
|
|
2180
|
+
source: z7.string(),
|
|
2181
|
+
externalId: z7.string().optional(),
|
|
2182
|
+
sourceId: z7.string().optional(),
|
|
2183
|
+
width: z7.number().optional(),
|
|
2184
|
+
height: z7.number().optional(),
|
|
2185
|
+
aspectRatio: z7.number().optional(),
|
|
2186
|
+
duration: z7.number().optional(),
|
|
2187
|
+
transcript: z7.string().optional(),
|
|
2188
|
+
transcriptSegments: z7.array(videoTranscriptSegmentSchema).optional(),
|
|
2189
|
+
scenes: z7.array(videoSceneSchema).optional(),
|
|
2190
|
+
descriptionEmbedding: z7.array(z7.number()).optional(),
|
|
2191
|
+
searchText: z7.string().optional(),
|
|
2027
2192
|
status: videoStatusSchema,
|
|
2028
|
-
errorMessage:
|
|
2029
|
-
createdAt:
|
|
2030
|
-
updatedAt:
|
|
2031
|
-
thumbnailUrl:
|
|
2032
|
-
});
|
|
2033
|
-
var videosWebhookResponseSchema =
|
|
2034
|
-
var videosGetRequestSchema =
|
|
2035
|
-
var videosSearchRequestSchema =
|
|
2036
|
-
query:
|
|
2037
|
-
limit:
|
|
2038
|
-
tags:
|
|
2039
|
-
});
|
|
2040
|
-
var videoSearchResultSchema =
|
|
2041
|
-
_id:
|
|
2042
|
-
thumbnailUrl:
|
|
2043
|
-
name:
|
|
2044
|
-
description:
|
|
2045
|
-
tags:
|
|
2046
|
-
status:
|
|
2047
|
-
duration:
|
|
2048
|
-
muxPlaybackId:
|
|
2049
|
-
createdAt:
|
|
2050
|
-
});
|
|
2051
|
-
var videosSearchResponseSchema =
|
|
2052
|
-
var videosUploadResponseSchema =
|
|
2053
|
-
var videosDeleteRequestSchema =
|
|
2054
|
-
var videosDeleteResponseSchema =
|
|
2193
|
+
errorMessage: z7.string().optional(),
|
|
2194
|
+
createdAt: z7.number(),
|
|
2195
|
+
updatedAt: z7.number(),
|
|
2196
|
+
thumbnailUrl: z7.string()
|
|
2197
|
+
});
|
|
2198
|
+
var videosWebhookResponseSchema = z7.object({ ok: z7.literal(true) });
|
|
2199
|
+
var videosGetRequestSchema = z7.object({ id: z7.string().min(1, "Missing id parameter") });
|
|
2200
|
+
var videosSearchRequestSchema = z7.object({
|
|
2201
|
+
query: z7.string().min(1),
|
|
2202
|
+
limit: z7.coerce.number().int().positive().max(100).optional(),
|
|
2203
|
+
tags: z7.array(z7.string()).optional()
|
|
2204
|
+
});
|
|
2205
|
+
var videoSearchResultSchema = z7.object({
|
|
2206
|
+
_id: z7.string(),
|
|
2207
|
+
thumbnailUrl: z7.string(),
|
|
2208
|
+
name: z7.string(),
|
|
2209
|
+
description: z7.string(),
|
|
2210
|
+
tags: z7.array(z7.string()),
|
|
2211
|
+
status: z7.string(),
|
|
2212
|
+
duration: z7.number().optional(),
|
|
2213
|
+
muxPlaybackId: z7.string(),
|
|
2214
|
+
createdAt: z7.number()
|
|
2215
|
+
});
|
|
2216
|
+
var videosSearchResponseSchema = z7.array(videoSearchResultSchema);
|
|
2217
|
+
var videosUploadResponseSchema = z7.object({ uploadUrl: z7.string(), videoId: z7.string() });
|
|
2218
|
+
var videosDeleteRequestSchema = z7.object({ id: z7.string().min(1, "Missing video ID") });
|
|
2219
|
+
var videosDeleteResponseSchema = z7.object({ ok: z7.literal(true) });
|
|
2055
2220
|
|
|
2056
2221
|
// src/commands/actions/complete.ts
|
|
2057
2222
|
import { defineCommand as defineCommand2 } from "citty";
|
|
@@ -3864,37 +4029,37 @@ var GEO_TARGET_CONSTANT_REGEX = /^geoTargetConstants\/\d+$/;
|
|
|
3864
4029
|
var LANGUAGE_CONSTANT_REGEX = /^languageConstants\/\d+$/;
|
|
3865
4030
|
|
|
3866
4031
|
// ../api/src/ads-google/ops.ts
|
|
3867
|
-
import { z as
|
|
3868
|
-
var tempRefSchema2 =
|
|
3869
|
-
var refSchema =
|
|
3870
|
-
|
|
3871
|
-
|
|
4032
|
+
import { z as z8 } from "zod";
|
|
4033
|
+
var tempRefSchema2 = z8.string().regex(TEMP_REF_REGEX2, "expected a g_temp_* reference");
|
|
4034
|
+
var refSchema = z8.union([
|
|
4035
|
+
z8.string().regex(RESOURCE_NAME_REGEX, "expected a customers/\u2026/\u2026/\u2026 resource name"),
|
|
4036
|
+
z8.string().regex(NUMERIC_ID_REGEX2, "expected a numeric id"),
|
|
3872
4037
|
tempRefSchema2
|
|
3873
4038
|
]);
|
|
3874
4039
|
var targetRefSchema = refSchema;
|
|
3875
|
-
var microsSchema =
|
|
3876
|
-
var httpsUrlSchema2 =
|
|
3877
|
-
var customerIdSchema =
|
|
3878
|
-
var stageableStatusSchema2 =
|
|
3879
|
-
var matchTypeSchema =
|
|
3880
|
-
var keywordTextSchema =
|
|
3881
|
-
var budgetCreateSchema =
|
|
3882
|
-
name:
|
|
4040
|
+
var microsSchema = z8.number().int().positive("expected a positive micros amount");
|
|
4041
|
+
var httpsUrlSchema2 = z8.string().url().refine((u) => u.startsWith("https://"), "final URLs must be https");
|
|
4042
|
+
var customerIdSchema = z8.string().regex(NUMERIC_ID_REGEX2, "customerId must be the bare numeric customer id");
|
|
4043
|
+
var stageableStatusSchema2 = z8.enum(STAGEABLE_CREATE_STATUSES2);
|
|
4044
|
+
var matchTypeSchema = z8.enum(KEYWORD_MATCH_TYPES);
|
|
4045
|
+
var keywordTextSchema = z8.string().min(1).max(GOOGLE_ADS_LIMITS.keyword.textMax).refine((t) => t.trim().split(/\s+/).length <= GOOGLE_ADS_LIMITS.keyword.wordsMax, "keyword exceeds 10 words");
|
|
4046
|
+
var budgetCreateSchema = z8.object({
|
|
4047
|
+
name: z8.string().min(1).max(GOOGLE_ADS_LIMITS.budget.nameMax),
|
|
3883
4048
|
amountMicros: microsSchema,
|
|
3884
|
-
deliveryMethod:
|
|
3885
|
-
explicitlyShared:
|
|
4049
|
+
deliveryMethod: z8.enum(BUDGET_DELIVERY_METHODS).default("STANDARD"),
|
|
4050
|
+
explicitlyShared: z8.boolean().default(false)
|
|
3886
4051
|
});
|
|
3887
|
-
var budgetUpdateSchema =
|
|
3888
|
-
name:
|
|
4052
|
+
var budgetUpdateSchema = z8.object({
|
|
4053
|
+
name: z8.string().min(1).max(GOOGLE_ADS_LIMITS.budget.nameMax).optional(),
|
|
3889
4054
|
amountMicros: microsSchema.optional(),
|
|
3890
|
-
deliveryMethod:
|
|
4055
|
+
deliveryMethod: z8.enum(BUDGET_DELIVERY_METHODS).optional()
|
|
3891
4056
|
}).refine((p) => Object.values(p).some((v) => v !== void 0), "update needs at least one field");
|
|
3892
|
-
var biddingConfigSchema =
|
|
3893
|
-
type:
|
|
4057
|
+
var biddingConfigSchema = z8.object({
|
|
4058
|
+
type: z8.enum(BIDDING_STRATEGY_TYPES),
|
|
3894
4059
|
targetCpaMicros: microsSchema.optional(),
|
|
3895
|
-
targetRoas:
|
|
4060
|
+
targetRoas: z8.number().positive().optional(),
|
|
3896
4061
|
cpcBidCeilingMicros: microsSchema.optional(),
|
|
3897
|
-
enhancedCpcEnabled:
|
|
4062
|
+
enhancedCpcEnabled: z8.boolean().optional()
|
|
3898
4063
|
}).superRefine((p, ctx) => {
|
|
3899
4064
|
if (p.type === "TARGET_CPA" && p.targetCpaMicros === void 0) {
|
|
3900
4065
|
ctx.addIssue({ code: "custom", path: ["targetCpaMicros"], message: "TARGET_CPA needs targetCpaMicros" });
|
|
@@ -3903,17 +4068,17 @@ var biddingConfigSchema = z7.object({
|
|
|
3903
4068
|
ctx.addIssue({ code: "custom", path: ["targetRoas"], message: "TARGET_ROAS needs targetRoas" });
|
|
3904
4069
|
}
|
|
3905
4070
|
});
|
|
3906
|
-
var networkSettingsSchema =
|
|
3907
|
-
targetGoogleSearch:
|
|
3908
|
-
targetSearchNetwork:
|
|
3909
|
-
targetContentNetwork:
|
|
3910
|
-
targetPartnerSearchNetwork:
|
|
4071
|
+
var networkSettingsSchema = z8.object({
|
|
4072
|
+
targetGoogleSearch: z8.boolean().optional(),
|
|
4073
|
+
targetSearchNetwork: z8.boolean().optional(),
|
|
4074
|
+
targetContentNetwork: z8.boolean().optional(),
|
|
4075
|
+
targetPartnerSearchNetwork: z8.boolean().optional()
|
|
3911
4076
|
});
|
|
3912
|
-
var dateSchema =
|
|
3913
|
-
var campaignCreateSchema2 =
|
|
3914
|
-
name:
|
|
3915
|
-
channelType:
|
|
3916
|
-
channelSubType:
|
|
4077
|
+
var dateSchema = z8.string().regex(/^\d{4}-\d{2}-\d{2}$/, "expected a YYYY-MM-DD date");
|
|
4078
|
+
var campaignCreateSchema2 = z8.object({
|
|
4079
|
+
name: z8.string().min(1).max(GOOGLE_ADS_LIMITS.campaign.nameMax),
|
|
4080
|
+
channelType: z8.enum(ADVERTISING_CHANNEL_TYPES),
|
|
4081
|
+
channelSubType: z8.enum(ADVERTISING_CHANNEL_SUB_TYPES).optional(),
|
|
3917
4082
|
budget: refSchema,
|
|
3918
4083
|
/** Inline standard bidding, or a portfolio strategy ref via biddingStrategy. */
|
|
3919
4084
|
bidding: biddingConfigSchema.optional(),
|
|
@@ -3922,7 +4087,7 @@ var campaignCreateSchema2 = z7.object({
|
|
|
3922
4087
|
startDate: dateSchema.optional(),
|
|
3923
4088
|
endDate: dateSchema.optional(),
|
|
3924
4089
|
/** Advisory Google Ads UI objective — drives warnings, not sent to the API. */
|
|
3925
|
-
objective:
|
|
4090
|
+
objective: z8.enum(CAMPAIGN_OBJECTIVES).optional(),
|
|
3926
4091
|
status: stageableStatusSchema2.default("PAUSED")
|
|
3927
4092
|
}).superRefine((p, ctx) => {
|
|
3928
4093
|
if (!p.bidding && !p.biddingStrategy) {
|
|
@@ -3946,129 +4111,129 @@ var campaignCreateSchema2 = z7.object({
|
|
|
3946
4111
|
ctx.addIssue({ code: "custom", path: ["endDate"], message: "endDate must be after startDate" });
|
|
3947
4112
|
}
|
|
3948
4113
|
});
|
|
3949
|
-
var campaignUpdateSchema2 =
|
|
3950
|
-
name:
|
|
4114
|
+
var campaignUpdateSchema2 = z8.object({
|
|
4115
|
+
name: z8.string().min(1).max(GOOGLE_ADS_LIMITS.campaign.nameMax).optional(),
|
|
3951
4116
|
budget: refSchema.optional(),
|
|
3952
4117
|
bidding: biddingConfigSchema.optional(),
|
|
3953
4118
|
networkSettings: networkSettingsSchema.optional(),
|
|
3954
4119
|
startDate: dateSchema.optional(),
|
|
3955
4120
|
endDate: dateSchema.optional(),
|
|
3956
|
-
status:
|
|
4121
|
+
status: z8.enum(["ENABLED", "PAUSED", "REMOVED"]).optional()
|
|
3957
4122
|
}).refine((p) => Object.values(p).some((v) => v !== void 0), "update needs at least one field");
|
|
3958
|
-
var adGroupCreateSchema =
|
|
3959
|
-
name:
|
|
4123
|
+
var adGroupCreateSchema = z8.object({
|
|
4124
|
+
name: z8.string().min(1).max(GOOGLE_ADS_LIMITS.adGroup.nameMax),
|
|
3960
4125
|
campaign: refSchema,
|
|
3961
|
-
type:
|
|
4126
|
+
type: z8.enum(AD_GROUP_TYPES).default("SEARCH_STANDARD"),
|
|
3962
4127
|
cpcBidMicros: microsSchema.optional(),
|
|
3963
4128
|
status: stageableStatusSchema2.default("PAUSED")
|
|
3964
4129
|
});
|
|
3965
|
-
var adGroupUpdateSchema =
|
|
3966
|
-
name:
|
|
4130
|
+
var adGroupUpdateSchema = z8.object({
|
|
4131
|
+
name: z8.string().min(1).max(GOOGLE_ADS_LIMITS.adGroup.nameMax).optional(),
|
|
3967
4132
|
cpcBidMicros: microsSchema.optional(),
|
|
3968
|
-
status:
|
|
4133
|
+
status: z8.enum(["ENABLED", "PAUSED", "REMOVED"]).optional()
|
|
3969
4134
|
}).refine((p) => Object.values(p).some((v) => v !== void 0), "update needs at least one field");
|
|
3970
|
-
var keywordAddSchema =
|
|
4135
|
+
var keywordAddSchema = z8.object({
|
|
3971
4136
|
adGroup: refSchema,
|
|
3972
4137
|
text: keywordTextSchema,
|
|
3973
4138
|
matchType: matchTypeSchema,
|
|
3974
4139
|
cpcBidMicros: microsSchema.optional(),
|
|
3975
|
-
finalUrls:
|
|
4140
|
+
finalUrls: z8.array(httpsUrlSchema2).optional(),
|
|
3976
4141
|
status: stageableStatusSchema2.default("ENABLED")
|
|
3977
4142
|
});
|
|
3978
|
-
var keywordUpdateSchema =
|
|
4143
|
+
var keywordUpdateSchema = z8.object({
|
|
3979
4144
|
cpcBidMicros: microsSchema.optional(),
|
|
3980
|
-
finalUrls:
|
|
3981
|
-
status:
|
|
4145
|
+
finalUrls: z8.array(httpsUrlSchema2).optional(),
|
|
4146
|
+
status: z8.enum(["ENABLED", "PAUSED", "REMOVED"]).optional()
|
|
3982
4147
|
}).refine((p) => Object.values(p).some((v) => v !== void 0), "update needs at least one field");
|
|
3983
|
-
var negativeKeywordAddSchema =
|
|
3984
|
-
level:
|
|
4148
|
+
var negativeKeywordAddSchema = z8.object({
|
|
4149
|
+
level: z8.enum(["adGroup", "campaign"]),
|
|
3985
4150
|
parent: refSchema,
|
|
3986
4151
|
text: keywordTextSchema,
|
|
3987
4152
|
matchType: matchTypeSchema
|
|
3988
4153
|
});
|
|
3989
|
-
var sharedSetCreateSchema =
|
|
3990
|
-
name:
|
|
3991
|
-
type:
|
|
4154
|
+
var sharedSetCreateSchema = z8.object({
|
|
4155
|
+
name: z8.string().min(1).max(GOOGLE_ADS_LIMITS.sharedSet.nameMax),
|
|
4156
|
+
type: z8.enum(SHARED_SET_TYPES).default("NEGATIVE_KEYWORDS")
|
|
3992
4157
|
});
|
|
3993
|
-
var sharedSetMemberAddSchema =
|
|
4158
|
+
var sharedSetMemberAddSchema = z8.object({
|
|
3994
4159
|
sharedSet: refSchema,
|
|
3995
4160
|
text: keywordTextSchema,
|
|
3996
4161
|
matchType: matchTypeSchema
|
|
3997
4162
|
});
|
|
3998
|
-
var campaignSharedSetAttachSchema =
|
|
4163
|
+
var campaignSharedSetAttachSchema = z8.object({
|
|
3999
4164
|
campaign: refSchema,
|
|
4000
4165
|
sharedSet: refSchema
|
|
4001
4166
|
});
|
|
4002
|
-
var adTextAssetSchema =
|
|
4003
|
-
text:
|
|
4004
|
-
pinnedField:
|
|
4167
|
+
var adTextAssetSchema = z8.object({
|
|
4168
|
+
text: z8.string().min(1),
|
|
4169
|
+
pinnedField: z8.enum(PINNED_FIELDS).optional()
|
|
4005
4170
|
});
|
|
4006
|
-
var responsiveSearchAdSchema =
|
|
4007
|
-
format:
|
|
4008
|
-
headlines:
|
|
4171
|
+
var responsiveSearchAdSchema = z8.object({
|
|
4172
|
+
format: z8.literal("responsiveSearch"),
|
|
4173
|
+
headlines: z8.array(
|
|
4009
4174
|
adTextAssetSchema.refine(
|
|
4010
4175
|
(a) => a.text.length <= GOOGLE_ADS_LIMITS.responsiveSearchAd.headlineTextMax,
|
|
4011
4176
|
"headline exceeds 30 chars"
|
|
4012
4177
|
)
|
|
4013
4178
|
).min(GOOGLE_ADS_LIMITS.responsiveSearchAd.headlinesMin).max(GOOGLE_ADS_LIMITS.responsiveSearchAd.headlinesMax),
|
|
4014
|
-
descriptions:
|
|
4179
|
+
descriptions: z8.array(
|
|
4015
4180
|
adTextAssetSchema.refine(
|
|
4016
4181
|
(a) => a.text.length <= GOOGLE_ADS_LIMITS.responsiveSearchAd.descriptionTextMax,
|
|
4017
4182
|
"description exceeds 90 chars"
|
|
4018
4183
|
)
|
|
4019
4184
|
).min(GOOGLE_ADS_LIMITS.responsiveSearchAd.descriptionsMin).max(GOOGLE_ADS_LIMITS.responsiveSearchAd.descriptionsMax),
|
|
4020
|
-
path1:
|
|
4021
|
-
path2:
|
|
4022
|
-
finalUrls:
|
|
4023
|
-
});
|
|
4024
|
-
var responsiveDisplayAdSchema =
|
|
4025
|
-
format:
|
|
4026
|
-
headlines:
|
|
4027
|
-
longHeadline:
|
|
4028
|
-
descriptions:
|
|
4029
|
-
businessName:
|
|
4185
|
+
path1: z8.string().max(GOOGLE_ADS_LIMITS.responsiveSearchAd.pathMax).optional(),
|
|
4186
|
+
path2: z8.string().max(GOOGLE_ADS_LIMITS.responsiveSearchAd.pathMax).optional(),
|
|
4187
|
+
finalUrls: z8.array(httpsUrlSchema2).min(1)
|
|
4188
|
+
});
|
|
4189
|
+
var responsiveDisplayAdSchema = z8.object({
|
|
4190
|
+
format: z8.literal("responsiveDisplay"),
|
|
4191
|
+
headlines: z8.array(z8.object({ text: z8.string().min(1).max(GOOGLE_ADS_LIMITS.responsiveDisplayAd.headlineTextMax) })).min(1).max(5),
|
|
4192
|
+
longHeadline: z8.object({ text: z8.string().min(1).max(GOOGLE_ADS_LIMITS.responsiveDisplayAd.longHeadlineTextMax) }),
|
|
4193
|
+
descriptions: z8.array(z8.object({ text: z8.string().min(1).max(GOOGLE_ADS_LIMITS.responsiveDisplayAd.descriptionTextMax) })).min(1).max(5),
|
|
4194
|
+
businessName: z8.string().min(1).max(GOOGLE_ADS_LIMITS.responsiveDisplayAd.businessNameMax),
|
|
4030
4195
|
// A Responsive Display Ad's images are fields on the ad's own content (never campaign-level
|
|
4031
4196
|
// asset links). Google requires ≥1 landscape marketing image (1.91:1) AND ≥1 square marketing
|
|
4032
4197
|
// image (1:1) to serve; the logo images are optional.
|
|
4033
|
-
marketingImageAssets:
|
|
4034
|
-
squareMarketingImageAssets:
|
|
4035
|
-
logoImageAssets:
|
|
4036
|
-
finalUrls:
|
|
4037
|
-
});
|
|
4038
|
-
var callAdSchema =
|
|
4039
|
-
format:
|
|
4040
|
-
countryCode:
|
|
4041
|
-
phoneNumber:
|
|
4042
|
-
headline1:
|
|
4043
|
-
headline2:
|
|
4044
|
-
description1:
|
|
4045
|
-
description2:
|
|
4046
|
-
businessName:
|
|
4047
|
-
finalUrls:
|
|
4048
|
-
});
|
|
4049
|
-
var appAdSchema =
|
|
4050
|
-
format:
|
|
4051
|
-
headlines:
|
|
4052
|
-
descriptions:
|
|
4053
|
-
});
|
|
4054
|
-
var videoAdSchema =
|
|
4055
|
-
format:
|
|
4198
|
+
marketingImageAssets: z8.array(refSchema).optional(),
|
|
4199
|
+
squareMarketingImageAssets: z8.array(refSchema).optional(),
|
|
4200
|
+
logoImageAssets: z8.array(refSchema).optional(),
|
|
4201
|
+
finalUrls: z8.array(httpsUrlSchema2).min(1)
|
|
4202
|
+
});
|
|
4203
|
+
var callAdSchema = z8.object({
|
|
4204
|
+
format: z8.literal("call"),
|
|
4205
|
+
countryCode: z8.string().length(2),
|
|
4206
|
+
phoneNumber: z8.string().min(3),
|
|
4207
|
+
headline1: z8.string().min(1).max(30),
|
|
4208
|
+
headline2: z8.string().min(1).max(30),
|
|
4209
|
+
description1: z8.string().min(1).max(90),
|
|
4210
|
+
description2: z8.string().min(1).max(90),
|
|
4211
|
+
businessName: z8.string().min(1).max(25),
|
|
4212
|
+
finalUrls: z8.array(httpsUrlSchema2).min(1)
|
|
4213
|
+
});
|
|
4214
|
+
var appAdSchema = z8.object({
|
|
4215
|
+
format: z8.literal("app"),
|
|
4216
|
+
headlines: z8.array(z8.object({ text: z8.string().min(1).max(30) })).min(1),
|
|
4217
|
+
descriptions: z8.array(z8.object({ text: z8.string().min(1).max(90) })).min(1)
|
|
4218
|
+
});
|
|
4219
|
+
var videoAdSchema = z8.object({
|
|
4220
|
+
format: z8.literal("video"),
|
|
4056
4221
|
// A raw YouTube id is not a publishable Google Ads reference — the video must be staged as
|
|
4057
4222
|
// its own `google.asset.create` (type: youtubeVideo) first, then referenced here by asset ref.
|
|
4058
|
-
videoAssets:
|
|
4059
|
-
finalUrls:
|
|
4060
|
-
});
|
|
4061
|
-
var demandGenAdSchema =
|
|
4062
|
-
format:
|
|
4063
|
-
headlines:
|
|
4064
|
-
descriptions:
|
|
4065
|
-
businessName:
|
|
4066
|
-
finalUrls:
|
|
4067
|
-
imageAssets:
|
|
4068
|
-
squareImageAssets:
|
|
4069
|
-
logoImageAssets:
|
|
4070
|
-
});
|
|
4071
|
-
var adContentSchema =
|
|
4223
|
+
videoAssets: z8.array(refSchema).min(1),
|
|
4224
|
+
finalUrls: z8.array(httpsUrlSchema2).min(1)
|
|
4225
|
+
});
|
|
4226
|
+
var demandGenAdSchema = z8.object({
|
|
4227
|
+
format: z8.literal("demandGen"),
|
|
4228
|
+
headlines: z8.array(z8.object({ text: z8.string().min(1).max(40) })).min(1).max(5),
|
|
4229
|
+
descriptions: z8.array(z8.object({ text: z8.string().min(1).max(90) })).min(1).max(5),
|
|
4230
|
+
businessName: z8.string().min(1).max(25),
|
|
4231
|
+
finalUrls: z8.array(httpsUrlSchema2).min(1),
|
|
4232
|
+
imageAssets: z8.array(refSchema).optional(),
|
|
4233
|
+
squareImageAssets: z8.array(refSchema).optional(),
|
|
4234
|
+
logoImageAssets: z8.array(refSchema).optional()
|
|
4235
|
+
});
|
|
4236
|
+
var adContentSchema = z8.discriminatedUnion("format", [
|
|
4072
4237
|
responsiveSearchAdSchema,
|
|
4073
4238
|
responsiveDisplayAdSchema,
|
|
4074
4239
|
callAdSchema,
|
|
@@ -4076,45 +4241,45 @@ var adContentSchema = z7.discriminatedUnion("format", [
|
|
|
4076
4241
|
videoAdSchema,
|
|
4077
4242
|
demandGenAdSchema
|
|
4078
4243
|
]);
|
|
4079
|
-
var adCreateSchema =
|
|
4244
|
+
var adCreateSchema = z8.object({
|
|
4080
4245
|
adGroup: refSchema,
|
|
4081
4246
|
status: stageableStatusSchema2.default("PAUSED"),
|
|
4082
4247
|
content: adContentSchema
|
|
4083
4248
|
});
|
|
4084
|
-
var adUpdateSchema =
|
|
4085
|
-
status:
|
|
4249
|
+
var adUpdateSchema = z8.object({
|
|
4250
|
+
status: z8.enum(["ENABLED", "PAUSED", "REMOVED"]).optional(),
|
|
4086
4251
|
/** Whole-content replacement for RSA-like formats; re-validated against adContentSchema. */
|
|
4087
|
-
content:
|
|
4252
|
+
content: z8.record(z8.string(), z8.unknown()).optional()
|
|
4088
4253
|
}).refine((p) => Object.values(p).some((v) => v !== void 0), "update needs at least one field");
|
|
4089
|
-
var textAssetSchema =
|
|
4090
|
-
var imageAssetSchema =
|
|
4091
|
-
type:
|
|
4092
|
-
imageId:
|
|
4093
|
-
name:
|
|
4094
|
-
});
|
|
4095
|
-
var youtubeVideoAssetSchema =
|
|
4096
|
-
type:
|
|
4097
|
-
youtubeVideoId:
|
|
4098
|
-
name:
|
|
4099
|
-
});
|
|
4100
|
-
var sitelinkAssetSchema =
|
|
4101
|
-
type:
|
|
4102
|
-
linkText:
|
|
4103
|
-
description1:
|
|
4104
|
-
description2:
|
|
4105
|
-
finalUrls:
|
|
4106
|
-
});
|
|
4107
|
-
var calloutAssetSchema =
|
|
4108
|
-
type:
|
|
4109
|
-
calloutText:
|
|
4110
|
-
});
|
|
4111
|
-
var structuredSnippetAssetSchema =
|
|
4112
|
-
type:
|
|
4113
|
-
header:
|
|
4114
|
-
values:
|
|
4115
|
-
});
|
|
4116
|
-
var callToActionAssetSchema =
|
|
4117
|
-
var assetCreateSchema =
|
|
4254
|
+
var textAssetSchema = z8.object({ type: z8.literal("text"), text: z8.string().min(1) });
|
|
4255
|
+
var imageAssetSchema = z8.object({
|
|
4256
|
+
type: z8.literal("image"),
|
|
4257
|
+
imageId: z8.string().min(1),
|
|
4258
|
+
name: z8.string().optional()
|
|
4259
|
+
});
|
|
4260
|
+
var youtubeVideoAssetSchema = z8.object({
|
|
4261
|
+
type: z8.literal("youtubeVideo"),
|
|
4262
|
+
youtubeVideoId: z8.string().min(1),
|
|
4263
|
+
name: z8.string().optional()
|
|
4264
|
+
});
|
|
4265
|
+
var sitelinkAssetSchema = z8.object({
|
|
4266
|
+
type: z8.literal("sitelink"),
|
|
4267
|
+
linkText: z8.string().min(1).max(GOOGLE_ADS_LIMITS.asset.sitelinkLinkTextMax),
|
|
4268
|
+
description1: z8.string().max(GOOGLE_ADS_LIMITS.asset.sitelinkDescriptionMax).optional(),
|
|
4269
|
+
description2: z8.string().max(GOOGLE_ADS_LIMITS.asset.sitelinkDescriptionMax).optional(),
|
|
4270
|
+
finalUrls: z8.array(httpsUrlSchema2).min(1)
|
|
4271
|
+
});
|
|
4272
|
+
var calloutAssetSchema = z8.object({
|
|
4273
|
+
type: z8.literal("callout"),
|
|
4274
|
+
calloutText: z8.string().min(1).max(GOOGLE_ADS_LIMITS.asset.calloutTextMax)
|
|
4275
|
+
});
|
|
4276
|
+
var structuredSnippetAssetSchema = z8.object({
|
|
4277
|
+
type: z8.literal("structuredSnippet"),
|
|
4278
|
+
header: z8.string().min(1).max(GOOGLE_ADS_LIMITS.asset.structuredSnippetHeaderMax),
|
|
4279
|
+
values: z8.array(z8.string().min(1)).min(GOOGLE_ADS_LIMITS.asset.structuredSnippetValuesMin).max(GOOGLE_ADS_LIMITS.asset.structuredSnippetValuesMax)
|
|
4280
|
+
});
|
|
4281
|
+
var callToActionAssetSchema = z8.object({ type: z8.literal("callToAction"), callToAction: z8.string().min(1) });
|
|
4282
|
+
var assetCreateSchema = z8.discriminatedUnion("type", [
|
|
4118
4283
|
textAssetSchema,
|
|
4119
4284
|
imageAssetSchema,
|
|
4120
4285
|
youtubeVideoAssetSchema,
|
|
@@ -4123,136 +4288,136 @@ var assetCreateSchema = z7.discriminatedUnion("type", [
|
|
|
4123
4288
|
structuredSnippetAssetSchema,
|
|
4124
4289
|
callToActionAssetSchema
|
|
4125
4290
|
]);
|
|
4126
|
-
var assetUpdateSchema =
|
|
4127
|
-
name:
|
|
4128
|
-
linkText:
|
|
4129
|
-
description1:
|
|
4130
|
-
description2:
|
|
4131
|
-
finalUrls:
|
|
4132
|
-
calloutText:
|
|
4133
|
-
header:
|
|
4134
|
-
values:
|
|
4135
|
-
callToAction:
|
|
4136
|
-
text:
|
|
4291
|
+
var assetUpdateSchema = z8.object({
|
|
4292
|
+
name: z8.string().min(1).optional(),
|
|
4293
|
+
linkText: z8.string().min(1).max(GOOGLE_ADS_LIMITS.asset.sitelinkLinkTextMax).optional(),
|
|
4294
|
+
description1: z8.string().max(GOOGLE_ADS_LIMITS.asset.sitelinkDescriptionMax).optional(),
|
|
4295
|
+
description2: z8.string().max(GOOGLE_ADS_LIMITS.asset.sitelinkDescriptionMax).optional(),
|
|
4296
|
+
finalUrls: z8.array(httpsUrlSchema2).min(1).optional(),
|
|
4297
|
+
calloutText: z8.string().min(1).max(GOOGLE_ADS_LIMITS.asset.calloutTextMax).optional(),
|
|
4298
|
+
header: z8.string().min(1).max(GOOGLE_ADS_LIMITS.asset.structuredSnippetHeaderMax).optional(),
|
|
4299
|
+
values: z8.array(z8.string().min(1)).min(GOOGLE_ADS_LIMITS.asset.structuredSnippetValuesMin).max(GOOGLE_ADS_LIMITS.asset.structuredSnippetValuesMax).optional(),
|
|
4300
|
+
callToAction: z8.string().min(1).optional(),
|
|
4301
|
+
text: z8.string().min(1).optional()
|
|
4137
4302
|
}).refine((p) => Object.values(p).some((v) => v !== void 0), "update needs at least one field");
|
|
4138
|
-
var assetLinkAttachSchema =
|
|
4139
|
-
level:
|
|
4303
|
+
var assetLinkAttachSchema = z8.object({
|
|
4304
|
+
level: z8.enum(["campaign", "adGroup", "customer"]),
|
|
4140
4305
|
parent: refSchema.optional(),
|
|
4141
4306
|
asset: refSchema,
|
|
4142
|
-
fieldType:
|
|
4307
|
+
fieldType: z8.enum(ASSET_FIELD_TYPES)
|
|
4143
4308
|
}).superRefine((value, ctx) => {
|
|
4144
4309
|
if (value.level !== "customer" && !value.parent) {
|
|
4145
4310
|
ctx.addIssue({
|
|
4146
|
-
code:
|
|
4311
|
+
code: z8.ZodIssueCode.custom,
|
|
4147
4312
|
path: ["parent"],
|
|
4148
4313
|
message: `parent is required for a ${value.level}-level asset link (--parent-ref)`
|
|
4149
4314
|
});
|
|
4150
4315
|
}
|
|
4151
4316
|
});
|
|
4152
|
-
var assetGroupCreateSchema =
|
|
4317
|
+
var assetGroupCreateSchema = z8.object({
|
|
4153
4318
|
campaign: refSchema,
|
|
4154
|
-
name:
|
|
4155
|
-
finalUrls:
|
|
4156
|
-
headlines:
|
|
4157
|
-
longHeadlines:
|
|
4158
|
-
descriptions:
|
|
4159
|
-
businessName:
|
|
4160
|
-
imageAssets:
|
|
4161
|
-
squareImageAssets:
|
|
4162
|
-
logoAssets:
|
|
4163
|
-
status:
|
|
4164
|
-
});
|
|
4165
|
-
var assetGroupUpdateSchema =
|
|
4166
|
-
name:
|
|
4167
|
-
finalUrls:
|
|
4168
|
-
status:
|
|
4319
|
+
name: z8.string().min(1).max(GOOGLE_ADS_LIMITS.assetGroup.nameMax),
|
|
4320
|
+
finalUrls: z8.array(httpsUrlSchema2).min(1),
|
|
4321
|
+
headlines: z8.array(z8.object({ text: z8.string().min(1).max(GOOGLE_ADS_LIMITS.assetGroup.headlineTextMax) })).min(GOOGLE_ADS_LIMITS.assetGroup.headlinesMin).max(GOOGLE_ADS_LIMITS.assetGroup.headlinesMax),
|
|
4322
|
+
longHeadlines: z8.array(z8.object({ text: z8.string().min(1).max(GOOGLE_ADS_LIMITS.assetGroup.longHeadlineTextMax) })).min(GOOGLE_ADS_LIMITS.assetGroup.longHeadlinesMin).max(GOOGLE_ADS_LIMITS.assetGroup.longHeadlinesMax),
|
|
4323
|
+
descriptions: z8.array(z8.object({ text: z8.string().min(1).max(GOOGLE_ADS_LIMITS.assetGroup.descriptionTextMax) })).min(GOOGLE_ADS_LIMITS.assetGroup.descriptionsMin).max(GOOGLE_ADS_LIMITS.assetGroup.descriptionsMax),
|
|
4324
|
+
businessName: z8.string().min(1).max(GOOGLE_ADS_LIMITS.assetGroup.businessNameMax),
|
|
4325
|
+
imageAssets: z8.array(refSchema).optional(),
|
|
4326
|
+
squareImageAssets: z8.array(refSchema).optional(),
|
|
4327
|
+
logoAssets: z8.array(refSchema).optional(),
|
|
4328
|
+
status: z8.enum(["ENABLED", "PAUSED"]).default("PAUSED")
|
|
4329
|
+
});
|
|
4330
|
+
var assetGroupUpdateSchema = z8.object({
|
|
4331
|
+
name: z8.string().min(1).max(GOOGLE_ADS_LIMITS.assetGroup.nameMax).optional(),
|
|
4332
|
+
finalUrls: z8.array(httpsUrlSchema2).min(1).optional(),
|
|
4333
|
+
status: z8.enum(["ENABLED", "PAUSED", "REMOVED"]).optional()
|
|
4169
4334
|
}).refine((p) => Object.values(p).some((v) => v !== void 0), "update needs at least one field");
|
|
4170
|
-
var audienceCreateSchema2 =
|
|
4171
|
-
name:
|
|
4172
|
-
type:
|
|
4173
|
-
description:
|
|
4335
|
+
var audienceCreateSchema2 = z8.object({
|
|
4336
|
+
name: z8.string().min(1).max(GOOGLE_ADS_LIMITS.audience.nameMax),
|
|
4337
|
+
type: z8.enum(USER_LIST_TYPES).default("BASIC"),
|
|
4338
|
+
description: z8.string().optional(),
|
|
4174
4339
|
/** Customer-match members (crm-based) — file-first for large lists. */
|
|
4175
|
-
members:
|
|
4176
|
-
sourceFileRef:
|
|
4340
|
+
members: z8.array(z8.record(z8.string(), z8.string())).optional(),
|
|
4341
|
+
sourceFileRef: z8.string().optional()
|
|
4177
4342
|
});
|
|
4178
|
-
var audienceCriterionAttachSchema =
|
|
4179
|
-
level:
|
|
4343
|
+
var audienceCriterionAttachSchema = z8.object({
|
|
4344
|
+
level: z8.enum(["campaign", "adGroup"]),
|
|
4180
4345
|
parent: refSchema,
|
|
4181
4346
|
userList: refSchema,
|
|
4182
|
-
negative:
|
|
4347
|
+
negative: z8.boolean().default(false)
|
|
4183
4348
|
});
|
|
4184
|
-
var conversionActionCreateSchema =
|
|
4185
|
-
name:
|
|
4186
|
-
type:
|
|
4187
|
-
category:
|
|
4188
|
-
countingType:
|
|
4349
|
+
var conversionActionCreateSchema = z8.object({
|
|
4350
|
+
name: z8.string().min(1).max(GOOGLE_ADS_LIMITS.conversionAction.nameMax),
|
|
4351
|
+
type: z8.enum(CONVERSION_ACTION_TYPES).default("WEBPAGE"),
|
|
4352
|
+
category: z8.enum(CONVERSION_ACTION_CATEGORIES).default("DEFAULT"),
|
|
4353
|
+
countingType: z8.enum(CONVERSION_COUNTING_TYPES).default("ONE_PER_CLICK"),
|
|
4189
4354
|
defaultValueMicros: microsSchema.optional(),
|
|
4190
|
-
defaultCurrencyCode:
|
|
4191
|
-
clickThroughLookbackWindowDays:
|
|
4192
|
-
viewThroughLookbackWindowDays:
|
|
4193
|
-
status:
|
|
4194
|
-
});
|
|
4195
|
-
var conversionActionUpdateSchema =
|
|
4196
|
-
name:
|
|
4197
|
-
category:
|
|
4198
|
-
countingType:
|
|
4355
|
+
defaultCurrencyCode: z8.string().length(3).optional(),
|
|
4356
|
+
clickThroughLookbackWindowDays: z8.number().int().positive().optional(),
|
|
4357
|
+
viewThroughLookbackWindowDays: z8.number().int().positive().optional(),
|
|
4358
|
+
status: z8.enum(["ENABLED", "PAUSED"]).default("ENABLED")
|
|
4359
|
+
});
|
|
4360
|
+
var conversionActionUpdateSchema = z8.object({
|
|
4361
|
+
name: z8.string().min(1).max(GOOGLE_ADS_LIMITS.conversionAction.nameMax).optional(),
|
|
4362
|
+
category: z8.enum(CONVERSION_ACTION_CATEGORIES).optional(),
|
|
4363
|
+
countingType: z8.enum(CONVERSION_COUNTING_TYPES).optional(),
|
|
4199
4364
|
defaultValueMicros: microsSchema.optional(),
|
|
4200
|
-
defaultCurrencyCode:
|
|
4201
|
-
clickThroughLookbackWindowDays:
|
|
4202
|
-
viewThroughLookbackWindowDays:
|
|
4203
|
-
status:
|
|
4365
|
+
defaultCurrencyCode: z8.string().length(3).optional(),
|
|
4366
|
+
clickThroughLookbackWindowDays: z8.number().int().positive().optional(),
|
|
4367
|
+
viewThroughLookbackWindowDays: z8.number().int().positive().optional(),
|
|
4368
|
+
status: z8.enum(["ENABLED", "REMOVED", "HIDDEN"]).optional()
|
|
4204
4369
|
}).refine((p) => Object.values(p).some((v) => v !== void 0), "update needs at least one field");
|
|
4205
|
-
var biddingStrategyCreateSchema =
|
|
4206
|
-
name:
|
|
4370
|
+
var biddingStrategyCreateSchema = z8.object({
|
|
4371
|
+
name: z8.string().min(1).max(GOOGLE_ADS_LIMITS.biddingStrategy.nameMax),
|
|
4207
4372
|
config: biddingConfigSchema
|
|
4208
4373
|
}).superRefine((p, ctx) => {
|
|
4209
4374
|
if (p.config.type === "MANUAL_CPC") {
|
|
4210
4375
|
ctx.addIssue({ code: "custom", path: ["config", "type"], message: "portfolio strategies cannot be Manual CPC" });
|
|
4211
4376
|
}
|
|
4212
4377
|
});
|
|
4213
|
-
var biddingStrategyUpdateSchema =
|
|
4214
|
-
name:
|
|
4378
|
+
var biddingStrategyUpdateSchema = z8.object({
|
|
4379
|
+
name: z8.string().min(1).max(GOOGLE_ADS_LIMITS.biddingStrategy.nameMax).optional(),
|
|
4215
4380
|
config: biddingConfigSchema.optional()
|
|
4216
4381
|
}).refine((p) => Object.values(p).some((v) => v !== void 0), "update needs at least one field");
|
|
4217
|
-
var labelCreateSchema =
|
|
4218
|
-
name:
|
|
4219
|
-
backgroundColor:
|
|
4220
|
-
description:
|
|
4382
|
+
var labelCreateSchema = z8.object({
|
|
4383
|
+
name: z8.string().min(1).max(GOOGLE_ADS_LIMITS.label.nameMax),
|
|
4384
|
+
backgroundColor: z8.string().regex(/^#[0-9A-Fa-f]{6}$/).optional(),
|
|
4385
|
+
description: z8.string().optional()
|
|
4221
4386
|
});
|
|
4222
|
-
var labelAttachSchema =
|
|
4223
|
-
level:
|
|
4387
|
+
var labelAttachSchema = z8.object({
|
|
4388
|
+
level: z8.enum(["campaign", "adGroup", "ad"]),
|
|
4224
4389
|
parent: refSchema,
|
|
4225
4390
|
label: refSchema
|
|
4226
4391
|
});
|
|
4227
|
-
var locationCriterionSchema =
|
|
4228
|
-
criterionType:
|
|
4229
|
-
geoTargetConstant:
|
|
4230
|
-
});
|
|
4231
|
-
var languageCriterionSchema =
|
|
4232
|
-
criterionType:
|
|
4233
|
-
languageConstant:
|
|
4234
|
-
});
|
|
4235
|
-
var adScheduleCriterionSchema =
|
|
4236
|
-
criterionType:
|
|
4237
|
-
dayOfWeek:
|
|
4238
|
-
startHour:
|
|
4239
|
-
startMinute:
|
|
4240
|
-
endHour:
|
|
4241
|
-
endMinute:
|
|
4242
|
-
});
|
|
4243
|
-
var deviceCriterionSchema =
|
|
4244
|
-
criterionType:
|
|
4245
|
-
device:
|
|
4392
|
+
var locationCriterionSchema = z8.object({
|
|
4393
|
+
criterionType: z8.literal("location"),
|
|
4394
|
+
geoTargetConstant: z8.union([z8.string().regex(GEO_TARGET_CONSTANT_REGEX), z8.string().regex(NUMERIC_ID_REGEX2)])
|
|
4395
|
+
});
|
|
4396
|
+
var languageCriterionSchema = z8.object({
|
|
4397
|
+
criterionType: z8.literal("language"),
|
|
4398
|
+
languageConstant: z8.union([z8.string().regex(LANGUAGE_CONSTANT_REGEX), z8.string().regex(NUMERIC_ID_REGEX2)])
|
|
4399
|
+
});
|
|
4400
|
+
var adScheduleCriterionSchema = z8.object({
|
|
4401
|
+
criterionType: z8.literal("adSchedule"),
|
|
4402
|
+
dayOfWeek: z8.enum(DAYS_OF_WEEK),
|
|
4403
|
+
startHour: z8.number().int().min(0).max(23),
|
|
4404
|
+
startMinute: z8.enum(["ZERO", "FIFTEEN", "THIRTY", "FORTY_FIVE"]).default("ZERO"),
|
|
4405
|
+
endHour: z8.number().int().min(0).max(24),
|
|
4406
|
+
endMinute: z8.enum(["ZERO", "FIFTEEN", "THIRTY", "FORTY_FIVE"]).default("ZERO")
|
|
4407
|
+
});
|
|
4408
|
+
var deviceCriterionSchema = z8.object({
|
|
4409
|
+
criterionType: z8.literal("device"),
|
|
4410
|
+
device: z8.enum(DEVICE_TYPES),
|
|
4246
4411
|
// Google's `CampaignCriterion.bid_modifier`: "The modifier must be in the range 0.1 - 10.0. Use 0
|
|
4247
4412
|
// to opt out of a Device type." So 0 (exclude the device) and 0.1–10.0 are valid; the (0, 0.1) gap is not.
|
|
4248
|
-
bidModifier:
|
|
4413
|
+
bidModifier: z8.number().min(0).max(10).optional().refine((v) => v === void 0 || v === 0 || v >= 0.1, {
|
|
4249
4414
|
message: "bid modifier must be 0 (exclude the device) or between 0.1 and 10.0"
|
|
4250
4415
|
})
|
|
4251
4416
|
});
|
|
4252
|
-
var campaignCriterionAddSchema =
|
|
4417
|
+
var campaignCriterionAddSchema = z8.object({
|
|
4253
4418
|
campaign: refSchema,
|
|
4254
|
-
negative:
|
|
4255
|
-
criterion:
|
|
4419
|
+
negative: z8.boolean().default(false),
|
|
4420
|
+
criterion: z8.discriminatedUnion("criterionType", [
|
|
4256
4421
|
locationCriterionSchema,
|
|
4257
4422
|
languageCriterionSchema,
|
|
4258
4423
|
adScheduleCriterionSchema,
|
|
@@ -4262,7 +4427,7 @@ var campaignCriterionAddSchema = z7.object({
|
|
|
4262
4427
|
const c = val.criterion;
|
|
4263
4428
|
if (c.criterionType === "adSchedule" && c.endHour === 24 && c.endMinute !== "ZERO") {
|
|
4264
4429
|
ctx.addIssue({
|
|
4265
|
-
code:
|
|
4430
|
+
code: z8.ZodIssueCode.custom,
|
|
4266
4431
|
message: "endHour 24 (midnight) cannot have a non-zero endMinute",
|
|
4267
4432
|
path: ["criterion", "endMinute"]
|
|
4268
4433
|
});
|
|
@@ -4314,17 +4479,17 @@ var GOOGLE_DRAFT_OP_KINDS = [
|
|
|
4314
4479
|
"google.campaignCriterion.add",
|
|
4315
4480
|
"google.campaignCriterion.remove"
|
|
4316
4481
|
];
|
|
4317
|
-
var googleDraftOpKindSchema =
|
|
4482
|
+
var googleDraftOpKindSchema = z8.enum(GOOGLE_DRAFT_OP_KINDS);
|
|
4318
4483
|
function createOp2(kind, payload) {
|
|
4319
|
-
return
|
|
4484
|
+
return z8.object({ kind: z8.literal(kind), customerId: customerIdSchema, payload });
|
|
4320
4485
|
}
|
|
4321
4486
|
function updateOp2(kind, payload) {
|
|
4322
|
-
return
|
|
4487
|
+
return z8.object({ kind: z8.literal(kind), customerId: customerIdSchema, target: targetRefSchema, payload });
|
|
4323
4488
|
}
|
|
4324
4489
|
function targetOp(kind) {
|
|
4325
|
-
return
|
|
4490
|
+
return z8.object({ kind: z8.literal(kind), customerId: customerIdSchema, target: targetRefSchema });
|
|
4326
4491
|
}
|
|
4327
|
-
var googleDraftOpInputSchema =
|
|
4492
|
+
var googleDraftOpInputSchema = z8.discriminatedUnion("kind", [
|
|
4328
4493
|
createOp2("google.budget.create", budgetCreateSchema),
|
|
4329
4494
|
updateOp2("google.budget.update", budgetUpdateSchema),
|
|
4330
4495
|
createOp2("google.campaign.create", campaignCreateSchema2),
|
|
@@ -4372,132 +4537,132 @@ var googleDraftOpInputSchema = z7.discriminatedUnion("kind", [
|
|
|
4372
4537
|
]);
|
|
4373
4538
|
|
|
4374
4539
|
// ../api/src/ads-google/wire.ts
|
|
4375
|
-
import { z as
|
|
4376
|
-
var googleWriteModeSchema =
|
|
4377
|
-
var googleDraftOpResultSchema =
|
|
4378
|
-
status:
|
|
4379
|
-
resourceName:
|
|
4380
|
-
error:
|
|
4381
|
-
skippedBecause:
|
|
4382
|
-
executedAt:
|
|
4383
|
-
});
|
|
4384
|
-
var googleDraftStageRequestSchema =
|
|
4385
|
-
chatId:
|
|
4540
|
+
import { z as z9 } from "zod";
|
|
4541
|
+
var googleWriteModeSchema = z9.enum(["live", "simulated"]);
|
|
4542
|
+
var googleDraftOpResultSchema = z9.object({
|
|
4543
|
+
status: z9.enum(["applied", "simulated", "failed", "skipped"]),
|
|
4544
|
+
resourceName: z9.string().optional(),
|
|
4545
|
+
error: z9.string().optional(),
|
|
4546
|
+
skippedBecause: z9.string().optional(),
|
|
4547
|
+
executedAt: z9.number().optional()
|
|
4548
|
+
});
|
|
4549
|
+
var googleDraftStageRequestSchema = z9.object({
|
|
4550
|
+
chatId: z9.string(),
|
|
4386
4551
|
op: googleDraftOpInputSchema
|
|
4387
4552
|
});
|
|
4388
|
-
var googleDraftStageResponseSchema =
|
|
4389
|
-
staged:
|
|
4390
|
-
ref:
|
|
4553
|
+
var googleDraftStageResponseSchema = z9.object({
|
|
4554
|
+
staged: z9.literal(true),
|
|
4555
|
+
ref: z9.string(),
|
|
4391
4556
|
kind: googleDraftOpKindSchema,
|
|
4392
4557
|
mode: googleWriteModeSchema,
|
|
4393
|
-
dependsOn:
|
|
4394
|
-
summary:
|
|
4395
|
-
warnings:
|
|
4558
|
+
dependsOn: z9.array(z9.string()),
|
|
4559
|
+
summary: z9.string(),
|
|
4560
|
+
warnings: z9.array(z9.string()),
|
|
4396
4561
|
/** True when the op amended an already-staged op in place instead of appending a new one. */
|
|
4397
|
-
amended:
|
|
4562
|
+
amended: z9.boolean().optional()
|
|
4398
4563
|
});
|
|
4399
|
-
var googleDraftAmendRequestSchema =
|
|
4400
|
-
chatId:
|
|
4401
|
-
ref:
|
|
4402
|
-
patch:
|
|
4564
|
+
var googleDraftAmendRequestSchema = z9.object({
|
|
4565
|
+
chatId: z9.string(),
|
|
4566
|
+
ref: z9.string(),
|
|
4567
|
+
patch: z9.record(z9.string(), z9.unknown())
|
|
4403
4568
|
});
|
|
4404
|
-
var googleDraftShowRequestSchema =
|
|
4405
|
-
chatId:
|
|
4406
|
-
ref:
|
|
4569
|
+
var googleDraftShowRequestSchema = z9.object({
|
|
4570
|
+
chatId: z9.string(),
|
|
4571
|
+
ref: z9.string()
|
|
4407
4572
|
});
|
|
4408
4573
|
var GOOGLE_DRAFT_BATCH_MAX = 500;
|
|
4409
|
-
var googleDraftStageBatchRequestSchema =
|
|
4410
|
-
chatId:
|
|
4411
|
-
ops:
|
|
4574
|
+
var googleDraftStageBatchRequestSchema = z9.object({
|
|
4575
|
+
chatId: z9.string(),
|
|
4576
|
+
ops: z9.array(googleDraftOpInputSchema).min(1).max(GOOGLE_DRAFT_BATCH_MAX)
|
|
4412
4577
|
});
|
|
4413
|
-
var googleDraftStageBatchResponseSchema =
|
|
4414
|
-
staged:
|
|
4578
|
+
var googleDraftStageBatchResponseSchema = z9.object({
|
|
4579
|
+
staged: z9.literal(true),
|
|
4415
4580
|
mode: googleWriteModeSchema,
|
|
4416
|
-
count:
|
|
4417
|
-
ops:
|
|
4418
|
-
|
|
4419
|
-
ref:
|
|
4581
|
+
count: z9.number(),
|
|
4582
|
+
ops: z9.array(
|
|
4583
|
+
z9.object({
|
|
4584
|
+
ref: z9.string(),
|
|
4420
4585
|
kind: googleDraftOpKindSchema,
|
|
4421
|
-
dependsOn:
|
|
4422
|
-
summary:
|
|
4423
|
-
warnings:
|
|
4586
|
+
dependsOn: z9.array(z9.string()),
|
|
4587
|
+
summary: z9.string(),
|
|
4588
|
+
warnings: z9.array(z9.string())
|
|
4424
4589
|
})
|
|
4425
4590
|
)
|
|
4426
4591
|
});
|
|
4427
|
-
var googleDraftOpViewSchema =
|
|
4428
|
-
ref:
|
|
4592
|
+
var googleDraftOpViewSchema = z9.object({
|
|
4593
|
+
ref: z9.string(),
|
|
4429
4594
|
kind: googleDraftOpKindSchema,
|
|
4430
|
-
customerId:
|
|
4431
|
-
target:
|
|
4432
|
-
dependsOn:
|
|
4433
|
-
summary:
|
|
4434
|
-
stagedAt:
|
|
4595
|
+
customerId: z9.string(),
|
|
4596
|
+
target: z9.string().optional(),
|
|
4597
|
+
dependsOn: z9.array(z9.string()),
|
|
4598
|
+
summary: z9.string(),
|
|
4599
|
+
stagedAt: z9.number(),
|
|
4435
4600
|
result: googleDraftOpResultSchema.optional()
|
|
4436
4601
|
});
|
|
4437
|
-
var googleDraftShowResponseSchema =
|
|
4602
|
+
var googleDraftShowResponseSchema = z9.object({
|
|
4438
4603
|
op: googleDraftOpViewSchema.extend({
|
|
4439
|
-
payload:
|
|
4440
|
-
warnings:
|
|
4441
|
-
annotations:
|
|
4604
|
+
payload: z9.unknown().optional(),
|
|
4605
|
+
warnings: z9.array(z9.string()).optional(),
|
|
4606
|
+
annotations: z9.unknown().optional()
|
|
4442
4607
|
})
|
|
4443
4608
|
});
|
|
4444
|
-
var googleDraftListRequestSchema =
|
|
4445
|
-
chatId:
|
|
4609
|
+
var googleDraftListRequestSchema = z9.object({
|
|
4610
|
+
chatId: z9.string()
|
|
4446
4611
|
});
|
|
4447
|
-
var googleDraftAdvisorySchema =
|
|
4448
|
-
scope:
|
|
4449
|
-
message:
|
|
4612
|
+
var googleDraftAdvisorySchema = z9.object({
|
|
4613
|
+
scope: z9.enum(["campaign", "adGroup"]),
|
|
4614
|
+
message: z9.string()
|
|
4450
4615
|
});
|
|
4451
|
-
var googleDraftStatusCollectionSchema =
|
|
4452
|
-
label:
|
|
4453
|
-
added:
|
|
4454
|
-
removed:
|
|
4455
|
-
existing:
|
|
4616
|
+
var googleDraftStatusCollectionSchema = z9.object({
|
|
4617
|
+
label: z9.string(),
|
|
4618
|
+
added: z9.number(),
|
|
4619
|
+
removed: z9.number(),
|
|
4620
|
+
existing: z9.number()
|
|
4456
4621
|
});
|
|
4457
|
-
var googleDraftChangeOperationSchema =
|
|
4458
|
-
var googleDraftStatusNodeSchema =
|
|
4459
|
-
() =>
|
|
4460
|
-
entity:
|
|
4461
|
-
name:
|
|
4622
|
+
var googleDraftChangeOperationSchema = z9.enum(["create", "update", "pause", "resume", "remove"]);
|
|
4623
|
+
var googleDraftStatusNodeSchema = z9.lazy(
|
|
4624
|
+
() => z9.object({
|
|
4625
|
+
entity: z9.string(),
|
|
4626
|
+
name: z9.string(),
|
|
4462
4627
|
operation: googleDraftChangeOperationSchema.optional(),
|
|
4463
|
-
existing:
|
|
4464
|
-
collections:
|
|
4465
|
-
children:
|
|
4466
|
-
warnings:
|
|
4628
|
+
existing: z9.boolean(),
|
|
4629
|
+
collections: z9.array(googleDraftStatusCollectionSchema),
|
|
4630
|
+
children: z9.array(googleDraftStatusNodeSchema),
|
|
4631
|
+
warnings: z9.array(z9.string()).optional()
|
|
4467
4632
|
})
|
|
4468
4633
|
);
|
|
4469
|
-
var googleDraftListResponseSchema =
|
|
4470
|
-
status:
|
|
4634
|
+
var googleDraftListResponseSchema = z9.object({
|
|
4635
|
+
status: z9.enum(["active", "publishing", "applied", "discarded", "none"]),
|
|
4471
4636
|
mode: googleWriteModeSchema,
|
|
4472
|
-
count:
|
|
4473
|
-
ops:
|
|
4637
|
+
count: z9.number(),
|
|
4638
|
+
ops: z9.array(googleDraftOpViewSchema),
|
|
4474
4639
|
/** Grouped campaign ▸ ad group ▸ ad tree for the readable CLI status view. */
|
|
4475
|
-
tree:
|
|
4640
|
+
tree: z9.array(googleDraftStatusNodeSchema).optional(),
|
|
4476
4641
|
/** Non-blocking completeness advisories for the whole draft. */
|
|
4477
|
-
advisories:
|
|
4642
|
+
advisories: z9.array(googleDraftAdvisorySchema).optional()
|
|
4478
4643
|
});
|
|
4479
|
-
var googleDraftRemoveRequestSchema =
|
|
4480
|
-
chatId:
|
|
4481
|
-
ref:
|
|
4644
|
+
var googleDraftRemoveRequestSchema = z9.object({
|
|
4645
|
+
chatId: z9.string(),
|
|
4646
|
+
ref: z9.string()
|
|
4482
4647
|
});
|
|
4483
|
-
var googleDraftRemoveResponseSchema =
|
|
4648
|
+
var googleDraftRemoveResponseSchema = z9.object({
|
|
4484
4649
|
/** The requested ref plus any dependents removed by cascade. */
|
|
4485
|
-
removed:
|
|
4650
|
+
removed: z9.array(z9.string())
|
|
4486
4651
|
});
|
|
4487
|
-
var googleDraftClearRequestSchema =
|
|
4488
|
-
chatId:
|
|
4652
|
+
var googleDraftClearRequestSchema = z9.object({
|
|
4653
|
+
chatId: z9.string()
|
|
4489
4654
|
});
|
|
4490
|
-
var googleDraftClearResponseSchema =
|
|
4491
|
-
cleared:
|
|
4655
|
+
var googleDraftClearResponseSchema = z9.object({
|
|
4656
|
+
cleared: z9.number()
|
|
4492
4657
|
});
|
|
4493
|
-
var googleFieldErrorSchema =
|
|
4494
|
-
path:
|
|
4495
|
-
message:
|
|
4658
|
+
var googleFieldErrorSchema = z9.object({
|
|
4659
|
+
path: z9.string(),
|
|
4660
|
+
message: z9.string()
|
|
4496
4661
|
});
|
|
4497
|
-
var googleDraftErrorResponseSchema =
|
|
4498
|
-
code:
|
|
4499
|
-
error:
|
|
4500
|
-
fields:
|
|
4662
|
+
var googleDraftErrorResponseSchema = z9.object({
|
|
4663
|
+
code: z9.string(),
|
|
4664
|
+
error: z9.string(),
|
|
4665
|
+
fields: z9.array(googleFieldErrorSchema).optional()
|
|
4501
4666
|
});
|
|
4502
4667
|
|
|
4503
4668
|
// src/commands/ads/google/draft-status.ts
|
|
@@ -10805,17 +10970,17 @@ var NUMERIC_ID_REGEX3 = /^\d+$/;
|
|
|
10805
10970
|
var IMAGE_HASH_REGEX = /^[A-Fa-f0-9]{16,}$/;
|
|
10806
10971
|
|
|
10807
10972
|
// ../api/src/ads-meta/ops.ts
|
|
10808
|
-
import { z as
|
|
10809
|
-
var tempRefSchema3 =
|
|
10810
|
-
var parentRefSchema2 =
|
|
10811
|
-
var moneySchema2 =
|
|
10812
|
-
amount:
|
|
10813
|
-
currencyCode:
|
|
10814
|
-
});
|
|
10815
|
-
var httpsUrlSchema3 =
|
|
10816
|
-
var bakerMediaIdSchema2 =
|
|
10817
|
-
var stageableStatusSchema3 =
|
|
10818
|
-
var updateStatusSchema =
|
|
10973
|
+
import { z as z10 } from "zod";
|
|
10974
|
+
var tempRefSchema3 = z10.string().regex(TEMP_REF_REGEX3, "expected a meta_temp_* reference");
|
|
10975
|
+
var parentRefSchema2 = z10.union([z10.string().regex(NUMERIC_ID_REGEX3, "expected a numeric id"), tempRefSchema3]);
|
|
10976
|
+
var moneySchema2 = z10.object({
|
|
10977
|
+
amount: z10.string().regex(/^\d+(\.\d{1,2})?$/, "expected a decimal amount like 50 or 50.00").refine((val) => Number(val) > 0, "amount must be greater than zero"),
|
|
10978
|
+
currencyCode: z10.string().length(3).optional()
|
|
10979
|
+
});
|
|
10980
|
+
var httpsUrlSchema3 = z10.string().url().refine((u) => u.startsWith("https://"), "destination URLs must be https");
|
|
10981
|
+
var bakerMediaIdSchema2 = z10.string().min(1);
|
|
10982
|
+
var stageableStatusSchema3 = z10.enum(STAGEABLE_CREATE_STATUSES3);
|
|
10983
|
+
var updateStatusSchema = z10.enum(UPDATE_STATUSES);
|
|
10819
10984
|
function currencyMinimums2(currencyCode) {
|
|
10820
10985
|
return CURRENCY_MINIMUMS2[currencyCode] ?? DEFAULT_CURRENCY_MINIMUM2;
|
|
10821
10986
|
}
|
|
@@ -10827,50 +10992,50 @@ function validateDailyBudgetFloor(money, ctx, path12) {
|
|
|
10827
10992
|
}
|
|
10828
10993
|
}
|
|
10829
10994
|
}
|
|
10830
|
-
var geoLocationsSchema =
|
|
10831
|
-
countries:
|
|
10832
|
-
regions:
|
|
10833
|
-
cities:
|
|
10834
|
-
zips:
|
|
10835
|
-
location_types:
|
|
10836
|
-
}).catchall(
|
|
10837
|
-
var idNameSchema =
|
|
10838
|
-
var metaTargetingSchema =
|
|
10995
|
+
var geoLocationsSchema = z10.object({
|
|
10996
|
+
countries: z10.array(z10.string().length(2)).optional(),
|
|
10997
|
+
regions: z10.array(z10.object({ key: z10.string() })).optional(),
|
|
10998
|
+
cities: z10.array(z10.object({ key: z10.string(), radius: z10.number().optional(), distance_unit: z10.string().optional() })).optional(),
|
|
10999
|
+
zips: z10.array(z10.object({ key: z10.string() })).optional(),
|
|
11000
|
+
location_types: z10.array(z10.string()).optional()
|
|
11001
|
+
}).catchall(z10.unknown());
|
|
11002
|
+
var idNameSchema = z10.object({ id: z10.string(), name: z10.string().optional() });
|
|
11003
|
+
var metaTargetingSchema = z10.object({
|
|
10839
11004
|
geo_locations: geoLocationsSchema.optional(),
|
|
10840
11005
|
excluded_geo_locations: geoLocationsSchema.optional(),
|
|
10841
|
-
age_min:
|
|
10842
|
-
age_max:
|
|
10843
|
-
genders:
|
|
10844
|
-
locales:
|
|
10845
|
-
interests:
|
|
10846
|
-
behaviors:
|
|
10847
|
-
custom_audiences:
|
|
10848
|
-
excluded_custom_audiences:
|
|
10849
|
-
flexible_spec:
|
|
10850
|
-
exclusions:
|
|
10851
|
-
publisher_platforms:
|
|
10852
|
-
facebook_positions:
|
|
10853
|
-
instagram_positions:
|
|
10854
|
-
audience_network_positions:
|
|
10855
|
-
messenger_positions:
|
|
10856
|
-
device_platforms:
|
|
10857
|
-
targeting_automation:
|
|
10858
|
-
}).catchall(
|
|
10859
|
-
var specialAdCategoriesSchema =
|
|
10860
|
-
var campaignCreateSchema3 =
|
|
10861
|
-
name:
|
|
10862
|
-
objective:
|
|
11006
|
+
age_min: z10.number().int().min(13).max(65).optional(),
|
|
11007
|
+
age_max: z10.number().int().min(13).max(65).optional(),
|
|
11008
|
+
genders: z10.array(z10.union([z10.literal(1), z10.literal(2)])).optional(),
|
|
11009
|
+
locales: z10.array(z10.number().int()).optional(),
|
|
11010
|
+
interests: z10.array(idNameSchema).optional(),
|
|
11011
|
+
behaviors: z10.array(idNameSchema).optional(),
|
|
11012
|
+
custom_audiences: z10.array(z10.object({ id: parentRefSchema2 })).optional(),
|
|
11013
|
+
excluded_custom_audiences: z10.array(z10.object({ id: parentRefSchema2 })).optional(),
|
|
11014
|
+
flexible_spec: z10.array(z10.record(z10.string(), z10.unknown())).optional(),
|
|
11015
|
+
exclusions: z10.record(z10.string(), z10.unknown()).optional(),
|
|
11016
|
+
publisher_platforms: z10.array(z10.string()).optional(),
|
|
11017
|
+
facebook_positions: z10.array(z10.string()).optional(),
|
|
11018
|
+
instagram_positions: z10.array(z10.string()).optional(),
|
|
11019
|
+
audience_network_positions: z10.array(z10.string()).optional(),
|
|
11020
|
+
messenger_positions: z10.array(z10.string()).optional(),
|
|
11021
|
+
device_platforms: z10.array(z10.string()).optional(),
|
|
11022
|
+
targeting_automation: z10.object({ advantage_audience: z10.union([z10.literal(0), z10.literal(1)]) }).partial().optional()
|
|
11023
|
+
}).catchall(z10.unknown());
|
|
11024
|
+
var specialAdCategoriesSchema = z10.array(z10.enum(SPECIAL_AD_CATEGORIES)).default(["NONE"]);
|
|
11025
|
+
var campaignCreateSchema3 = z10.object({
|
|
11026
|
+
name: z10.string().min(1).max(META_LIMITS.campaign.nameMax),
|
|
11027
|
+
objective: z10.enum(OBJECTIVES),
|
|
10863
11028
|
status: stageableStatusSchema3.default("PAUSED"),
|
|
10864
11029
|
special_ad_categories: specialAdCategoriesSchema,
|
|
10865
|
-
special_ad_category_country:
|
|
10866
|
-
buying_type:
|
|
10867
|
-
bid_strategy:
|
|
11030
|
+
special_ad_category_country: z10.array(z10.string().length(2)).optional(),
|
|
11031
|
+
buying_type: z10.enum(BUYING_TYPES).default("AUCTION"),
|
|
11032
|
+
bid_strategy: z10.enum(BID_STRATEGIES).optional(),
|
|
10868
11033
|
/** Campaign Budget Optimization (Advantage campaign budget) — mutually exclusive with ad-set budgets. */
|
|
10869
11034
|
dailyBudget: moneySchema2.optional(),
|
|
10870
11035
|
lifetimeBudget: moneySchema2.optional(),
|
|
10871
11036
|
spendCap: moneySchema2.optional(),
|
|
10872
|
-
start_time:
|
|
10873
|
-
stop_time:
|
|
11037
|
+
start_time: z10.number().int().positive().optional(),
|
|
11038
|
+
stop_time: z10.number().int().positive().optional()
|
|
10874
11039
|
}).superRefine((p, ctx) => {
|
|
10875
11040
|
if (p.dailyBudget && p.lifetimeBudget) {
|
|
10876
11041
|
ctx.addIssue({ code: "custom", path: ["dailyBudget"], message: "set only one of dailyBudget or lifetimeBudget" });
|
|
@@ -10880,15 +11045,15 @@ var campaignCreateSchema3 = z9.object({
|
|
|
10880
11045
|
ctx.addIssue({ code: "custom", path: ["stop_time"], message: "stop_time must be after start_time" });
|
|
10881
11046
|
}
|
|
10882
11047
|
});
|
|
10883
|
-
var campaignUpdateSchema3 =
|
|
10884
|
-
name:
|
|
11048
|
+
var campaignUpdateSchema3 = z10.object({
|
|
11049
|
+
name: z10.string().min(1).max(META_LIMITS.campaign.nameMax).optional(),
|
|
10885
11050
|
status: updateStatusSchema.optional(),
|
|
10886
|
-
bid_strategy:
|
|
11051
|
+
bid_strategy: z10.enum(BID_STRATEGIES).optional(),
|
|
10887
11052
|
dailyBudget: moneySchema2.optional(),
|
|
10888
11053
|
lifetimeBudget: moneySchema2.optional(),
|
|
10889
11054
|
spendCap: moneySchema2.optional(),
|
|
10890
|
-
start_time:
|
|
10891
|
-
stop_time:
|
|
11055
|
+
start_time: z10.number().int().positive().optional(),
|
|
11056
|
+
stop_time: z10.number().int().positive().optional()
|
|
10892
11057
|
}).superRefine((p, ctx) => {
|
|
10893
11058
|
if (!Object.values(p).some((val) => val !== void 0)) {
|
|
10894
11059
|
ctx.addIssue({ code: "custom", message: "update needs at least one field" });
|
|
@@ -10898,38 +11063,38 @@ var campaignUpdateSchema3 = z9.object({
|
|
|
10898
11063
|
}
|
|
10899
11064
|
validateDailyBudgetFloor(p.dailyBudget, ctx, ["dailyBudget", "amount"]);
|
|
10900
11065
|
});
|
|
10901
|
-
var promotedObjectSchema =
|
|
11066
|
+
var promotedObjectSchema = z10.object({
|
|
10902
11067
|
page_id: parentRefSchema2.optional(),
|
|
10903
|
-
pixel_id:
|
|
10904
|
-
custom_event_type:
|
|
10905
|
-
application_id:
|
|
10906
|
-
object_store_url:
|
|
10907
|
-
product_catalog_id:
|
|
10908
|
-
product_set_id:
|
|
10909
|
-
whatsapp_phone_number:
|
|
10910
|
-
offline_conversion_data_set_id:
|
|
11068
|
+
pixel_id: z10.string().regex(NUMERIC_ID_REGEX3).optional(),
|
|
11069
|
+
custom_event_type: z10.enum(CUSTOM_EVENT_TYPES).optional(),
|
|
11070
|
+
application_id: z10.string().regex(NUMERIC_ID_REGEX3).optional(),
|
|
11071
|
+
object_store_url: z10.string().url().optional(),
|
|
11072
|
+
product_catalog_id: z10.string().regex(NUMERIC_ID_REGEX3).optional(),
|
|
11073
|
+
product_set_id: z10.string().regex(NUMERIC_ID_REGEX3).optional(),
|
|
11074
|
+
whatsapp_phone_number: z10.string().optional(),
|
|
11075
|
+
offline_conversion_data_set_id: z10.string().regex(NUMERIC_ID_REGEX3).optional()
|
|
10911
11076
|
}).partial();
|
|
10912
|
-
var attributionSpecSchema =
|
|
10913
|
-
|
|
10914
|
-
event_type:
|
|
10915
|
-
window_days:
|
|
11077
|
+
var attributionSpecSchema = z10.array(
|
|
11078
|
+
z10.object({
|
|
11079
|
+
event_type: z10.enum(ATTRIBUTION_EVENT_TYPES),
|
|
11080
|
+
window_days: z10.union([z10.literal(1), z10.literal(7), z10.literal(28)])
|
|
10916
11081
|
})
|
|
10917
11082
|
);
|
|
10918
11083
|
var adSetFields = {
|
|
10919
|
-
name:
|
|
11084
|
+
name: z10.string().min(1).max(META_LIMITS.adSet.nameMax),
|
|
10920
11085
|
campaign_id: parentRefSchema2,
|
|
10921
11086
|
status: stageableStatusSchema3.default("PAUSED"),
|
|
10922
11087
|
dailyBudget: moneySchema2.optional(),
|
|
10923
11088
|
lifetimeBudget: moneySchema2.optional(),
|
|
10924
11089
|
bidAmount: moneySchema2.optional(),
|
|
10925
|
-
bid_strategy:
|
|
10926
|
-
billing_event:
|
|
10927
|
-
optimization_goal:
|
|
10928
|
-
destination_type:
|
|
11090
|
+
bid_strategy: z10.enum(BID_STRATEGIES).optional(),
|
|
11091
|
+
billing_event: z10.enum(BILLING_EVENTS),
|
|
11092
|
+
optimization_goal: z10.enum(OPTIMIZATION_GOALS),
|
|
11093
|
+
destination_type: z10.enum(DESTINATION_TYPES).optional(),
|
|
10929
11094
|
promoted_object: promotedObjectSchema.optional(),
|
|
10930
11095
|
attribution_spec: attributionSpecSchema.optional(),
|
|
10931
|
-
start_time:
|
|
10932
|
-
end_time:
|
|
11096
|
+
start_time: z10.number().int().positive().optional(),
|
|
11097
|
+
end_time: z10.number().int().positive().optional(),
|
|
10933
11098
|
targeting: metaTargetingSchema
|
|
10934
11099
|
};
|
|
10935
11100
|
function validateAdSetBudgetAndBid(p, ctx) {
|
|
@@ -10947,22 +11112,22 @@ function validateAdSetBudgetAndBid(p, ctx) {
|
|
|
10947
11112
|
ctx.addIssue({ code: "custom", path: ["end_time"], message: "end_time must be after start_time" });
|
|
10948
11113
|
}
|
|
10949
11114
|
}
|
|
10950
|
-
var adSetCreateSchema =
|
|
11115
|
+
var adSetCreateSchema = z10.object(adSetFields).superRefine((p, ctx) => {
|
|
10951
11116
|
validateAdSetBudgetAndBid(p, ctx);
|
|
10952
11117
|
});
|
|
10953
|
-
var adSetUpdateSchema =
|
|
11118
|
+
var adSetUpdateSchema = z10.object({
|
|
10954
11119
|
name: adSetFields.name.optional(),
|
|
10955
11120
|
status: updateStatusSchema.optional(),
|
|
10956
11121
|
dailyBudget: moneySchema2.optional(),
|
|
10957
11122
|
lifetimeBudget: moneySchema2.optional(),
|
|
10958
11123
|
bidAmount: moneySchema2.optional(),
|
|
10959
|
-
bid_strategy:
|
|
10960
|
-
optimization_goal:
|
|
10961
|
-
destination_type:
|
|
11124
|
+
bid_strategy: z10.enum(BID_STRATEGIES).optional(),
|
|
11125
|
+
optimization_goal: z10.enum(OPTIMIZATION_GOALS).optional(),
|
|
11126
|
+
destination_type: z10.enum(DESTINATION_TYPES).optional(),
|
|
10962
11127
|
promoted_object: promotedObjectSchema.optional(),
|
|
10963
11128
|
attribution_spec: attributionSpecSchema.optional(),
|
|
10964
|
-
start_time:
|
|
10965
|
-
end_time:
|
|
11129
|
+
start_time: z10.number().int().positive().optional(),
|
|
11130
|
+
end_time: z10.number().int().positive().optional(),
|
|
10966
11131
|
targeting: metaTargetingSchema.optional()
|
|
10967
11132
|
}).superRefine((p, ctx) => {
|
|
10968
11133
|
if (!Object.values(p).some((val) => val !== void 0)) {
|
|
@@ -10970,38 +11135,38 @@ var adSetUpdateSchema = z9.object({
|
|
|
10970
11135
|
}
|
|
10971
11136
|
validateAdSetBudgetAndBid(p, ctx);
|
|
10972
11137
|
});
|
|
10973
|
-
var messageSchema =
|
|
10974
|
-
var headlineSchema2 =
|
|
10975
|
-
var descriptionSchema =
|
|
10976
|
-
var callToActionSchema =
|
|
10977
|
-
type:
|
|
11138
|
+
var messageSchema = z10.string().min(1).max(META_LIMITS.creative.messageHardMax);
|
|
11139
|
+
var headlineSchema2 = z10.string().min(1).max(META_LIMITS.creative.headlineMax);
|
|
11140
|
+
var descriptionSchema = z10.string().min(1).max(META_LIMITS.creative.descriptionMax);
|
|
11141
|
+
var callToActionSchema = z10.object({
|
|
11142
|
+
type: z10.enum(CTA_TYPES2),
|
|
10978
11143
|
/** Overrides the base link for the CTA button; defaults to the ad's link. */
|
|
10979
11144
|
link: httpsUrlSchema3.optional()
|
|
10980
11145
|
});
|
|
10981
|
-
var creativeEnhancementsSchema =
|
|
10982
|
-
standardEnhancements:
|
|
10983
|
-
features:
|
|
11146
|
+
var creativeEnhancementsSchema = z10.object({
|
|
11147
|
+
standardEnhancements: z10.enum(ENROLL_STATUSES).optional(),
|
|
11148
|
+
features: z10.record(z10.string(), z10.enum(ENROLL_STATUSES)).optional()
|
|
10984
11149
|
});
|
|
10985
11150
|
var creativeSharedFields = {
|
|
10986
|
-
name:
|
|
11151
|
+
name: z10.string().max(META_LIMITS.creative.nameMax).optional(),
|
|
10987
11152
|
/** Facebook Page id backing the ad's identity. */
|
|
10988
11153
|
page_id: parentRefSchema2,
|
|
10989
11154
|
/** Instagram account id for IG placements (aka instagram_actor_id on read). */
|
|
10990
|
-
instagram_user_id:
|
|
11155
|
+
instagram_user_id: z10.string().regex(NUMERIC_ID_REGEX3).optional(),
|
|
10991
11156
|
/** URL tracking parameters appended to the destination, e.g. "utm_source=fb&utm_campaign=x". */
|
|
10992
|
-
url_tags:
|
|
11157
|
+
url_tags: z10.string().max(1e3).optional(),
|
|
10993
11158
|
enhancements: creativeEnhancementsSchema.optional()
|
|
10994
11159
|
};
|
|
10995
11160
|
var imageMediaFields = {
|
|
10996
|
-
imageHash:
|
|
11161
|
+
imageHash: z10.string().regex(IMAGE_HASH_REGEX).optional(),
|
|
10997
11162
|
imageRef: tempRefSchema3.optional()
|
|
10998
11163
|
};
|
|
10999
11164
|
var videoMediaFields = {
|
|
11000
|
-
videoId:
|
|
11165
|
+
videoId: z10.string().regex(NUMERIC_ID_REGEX3).optional(),
|
|
11001
11166
|
videoRef: tempRefSchema3.optional(),
|
|
11002
11167
|
/** Thumbnail for a video creative — image hash, ref, or public url. */
|
|
11003
|
-
thumbnailHash:
|
|
11004
|
-
imageUrl:
|
|
11168
|
+
thumbnailHash: z10.string().regex(IMAGE_HASH_REGEX).optional(),
|
|
11169
|
+
imageUrl: z10.string().url().optional()
|
|
11005
11170
|
};
|
|
11006
11171
|
function countImageRefs(p) {
|
|
11007
11172
|
return [p.imageHash, p.imageRef].filter(Boolean).length;
|
|
@@ -11009,8 +11174,8 @@ function countImageRefs(p) {
|
|
|
11009
11174
|
function countVideoRefs(p) {
|
|
11010
11175
|
return [p.videoId, p.videoRef].filter(Boolean).length;
|
|
11011
11176
|
}
|
|
11012
|
-
var singleCreativeSchema =
|
|
11013
|
-
creativeType:
|
|
11177
|
+
var singleCreativeSchema = z10.object({
|
|
11178
|
+
creativeType: z10.literal("single"),
|
|
11014
11179
|
...creativeSharedFields,
|
|
11015
11180
|
/** Primary text. */
|
|
11016
11181
|
message: messageSchema,
|
|
@@ -11019,7 +11184,7 @@ var singleCreativeSchema = z9.object({
|
|
|
11019
11184
|
headline: headlineSchema2.optional(),
|
|
11020
11185
|
description: descriptionSchema.optional(),
|
|
11021
11186
|
/** Display URL / caption shown under the headline. */
|
|
11022
|
-
caption:
|
|
11187
|
+
caption: z10.string().max(255).optional(),
|
|
11023
11188
|
call_to_action: callToActionSchema.optional(),
|
|
11024
11189
|
...imageMediaFields,
|
|
11025
11190
|
...videoMediaFields
|
|
@@ -11043,10 +11208,10 @@ var singleCreativeSchema = z9.object({
|
|
|
11043
11208
|
});
|
|
11044
11209
|
}
|
|
11045
11210
|
});
|
|
11046
|
-
var carouselCardSchema =
|
|
11211
|
+
var carouselCardSchema = z10.object({
|
|
11047
11212
|
link: httpsUrlSchema3,
|
|
11048
|
-
headline:
|
|
11049
|
-
description:
|
|
11213
|
+
headline: z10.string().max(META_LIMITS.creative.headlineMax).optional(),
|
|
11214
|
+
description: z10.string().max(META_LIMITS.creative.descriptionMax).optional(),
|
|
11050
11215
|
call_to_action: callToActionSchema.optional(),
|
|
11051
11216
|
...imageMediaFields,
|
|
11052
11217
|
...videoMediaFields
|
|
@@ -11066,35 +11231,35 @@ var carouselCardSchema = z9.object({
|
|
|
11066
11231
|
ctx.addIssue({ code: "custom", path: ["videoId"], message: "each card is an image OR a video, not both" });
|
|
11067
11232
|
}
|
|
11068
11233
|
});
|
|
11069
|
-
var carouselCreativeSchema2 =
|
|
11070
|
-
creativeType:
|
|
11234
|
+
var carouselCreativeSchema2 = z10.object({
|
|
11235
|
+
creativeType: z10.literal("carousel"),
|
|
11071
11236
|
...creativeSharedFields,
|
|
11072
11237
|
message: messageSchema,
|
|
11073
11238
|
/** Optional "see more" card destination applied when a card has no own link. */
|
|
11074
11239
|
link: httpsUrlSchema3.optional(),
|
|
11075
11240
|
call_to_action: callToActionSchema.optional(),
|
|
11076
|
-
cards:
|
|
11241
|
+
cards: z10.array(carouselCardSchema).min(META_LIMITS.creative.carouselCardsMin).max(META_LIMITS.creative.carouselCardsMax)
|
|
11077
11242
|
});
|
|
11078
|
-
var dynamicImageSchema =
|
|
11079
|
-
var dynamicVideoSchema =
|
|
11243
|
+
var dynamicImageSchema = z10.object({ ...imageMediaFields }).refine((p) => countImageRefs(p) === 1, "each dynamic image needs exactly one reference");
|
|
11244
|
+
var dynamicVideoSchema = z10.object({
|
|
11080
11245
|
videoId: videoMediaFields.videoId,
|
|
11081
11246
|
videoRef: videoMediaFields.videoRef,
|
|
11082
11247
|
thumbnailHash: videoMediaFields.thumbnailHash
|
|
11083
11248
|
}).refine((p) => countVideoRefs(p) === 1, "each dynamic video needs exactly one reference");
|
|
11084
11249
|
var DYN = META_LIMITS.creative;
|
|
11085
|
-
var dynamicCreativeSchema =
|
|
11086
|
-
creativeType:
|
|
11250
|
+
var dynamicCreativeSchema = z10.object({
|
|
11251
|
+
creativeType: z10.literal("dynamic"),
|
|
11087
11252
|
...creativeSharedFields,
|
|
11088
|
-
bodies:
|
|
11089
|
-
titles:
|
|
11090
|
-
descriptions:
|
|
11091
|
-
images:
|
|
11092
|
-
videos:
|
|
11093
|
-
ad_formats:
|
|
11094
|
-
call_to_action_types:
|
|
11095
|
-
link_urls:
|
|
11253
|
+
bodies: z10.array(z10.object({ text: messageSchema })).min(DYN.dynamicTextsMin).max(DYN.dynamicTextsMax),
|
|
11254
|
+
titles: z10.array(z10.object({ text: headlineSchema2 })).min(DYN.dynamicTextsMin).max(DYN.dynamicTextsMax),
|
|
11255
|
+
descriptions: z10.array(z10.object({ text: descriptionSchema })).max(DYN.dynamicTextsMax).optional(),
|
|
11256
|
+
images: z10.array(dynamicImageSchema).optional(),
|
|
11257
|
+
videos: z10.array(dynamicVideoSchema).optional(),
|
|
11258
|
+
ad_formats: z10.array(z10.enum(AD_FORMATS2)).min(1),
|
|
11259
|
+
call_to_action_types: z10.array(z10.enum(CTA_TYPES2)).optional(),
|
|
11260
|
+
link_urls: z10.array(z10.object({ website_url: httpsUrlSchema3, display_url: z10.string().optional() })).min(1),
|
|
11096
11261
|
/** Multi-language / placement customization — structural passthrough for v1. */
|
|
11097
|
-
asset_customization_rules:
|
|
11262
|
+
asset_customization_rules: z10.array(z10.record(z10.string(), z10.unknown())).optional()
|
|
11098
11263
|
}).superRefine((p, ctx) => {
|
|
11099
11264
|
if (!(p.images?.length || p.videos?.length)) {
|
|
11100
11265
|
ctx.addIssue({
|
|
@@ -11104,57 +11269,57 @@ var dynamicCreativeSchema = z9.object({
|
|
|
11104
11269
|
});
|
|
11105
11270
|
}
|
|
11106
11271
|
});
|
|
11107
|
-
var existingPostCreativeSchema =
|
|
11108
|
-
creativeType:
|
|
11272
|
+
var existingPostCreativeSchema = z10.object({
|
|
11273
|
+
creativeType: z10.literal("existing_post"),
|
|
11109
11274
|
name: creativeSharedFields.name,
|
|
11110
11275
|
/** "<page_id>_<post_id>" object story id of the post to promote. */
|
|
11111
|
-
object_story_id:
|
|
11276
|
+
object_story_id: z10.string().regex(/^\d+_\d+$/, 'expected "<page_id>_<post_id>"'),
|
|
11112
11277
|
instagram_user_id: creativeSharedFields.instagram_user_id,
|
|
11113
11278
|
url_tags: creativeSharedFields.url_tags,
|
|
11114
11279
|
enhancements: creativeSharedFields.enhancements
|
|
11115
11280
|
});
|
|
11116
|
-
var creativeContentSchema2 =
|
|
11281
|
+
var creativeContentSchema2 = z10.discriminatedUnion("creativeType", [
|
|
11117
11282
|
singleCreativeSchema,
|
|
11118
11283
|
carouselCreativeSchema2,
|
|
11119
11284
|
dynamicCreativeSchema,
|
|
11120
11285
|
existingPostCreativeSchema
|
|
11121
11286
|
]);
|
|
11122
11287
|
var adCreativeCreateSchema = creativeContentSchema2;
|
|
11123
|
-
var adCreativeUpdateSchema =
|
|
11124
|
-
name:
|
|
11288
|
+
var adCreativeUpdateSchema = z10.object({
|
|
11289
|
+
name: z10.string().max(META_LIMITS.creative.nameMax).optional(),
|
|
11125
11290
|
status: updateStatusSchema.optional(),
|
|
11126
11291
|
/** Content patch — only honored when the target is a staged meta_temp_* creative. */
|
|
11127
|
-
content:
|
|
11292
|
+
content: z10.record(z10.string(), z10.unknown()).optional()
|
|
11128
11293
|
}).refine((p) => Object.values(p).some((val) => val !== void 0), "update needs at least one field");
|
|
11129
|
-
var adCreateSchema2 =
|
|
11130
|
-
name:
|
|
11294
|
+
var adCreateSchema2 = z10.object({
|
|
11295
|
+
name: z10.string().min(1).max(META_LIMITS.ad.nameMax),
|
|
11131
11296
|
adset_id: parentRefSchema2,
|
|
11132
11297
|
status: stageableStatusSchema3.default("PAUSED"),
|
|
11133
|
-
creative:
|
|
11298
|
+
creative: z10.object({ creative_id: parentRefSchema2 }),
|
|
11134
11299
|
/** Conversion pixel / offline event set / view tags — structural passthrough. */
|
|
11135
|
-
tracking_specs:
|
|
11300
|
+
tracking_specs: z10.array(z10.record(z10.string(), z10.unknown())).optional()
|
|
11136
11301
|
});
|
|
11137
|
-
var adUpdateSchema2 =
|
|
11138
|
-
name:
|
|
11302
|
+
var adUpdateSchema2 = z10.object({
|
|
11303
|
+
name: z10.string().min(1).max(META_LIMITS.ad.nameMax).optional(),
|
|
11139
11304
|
status: updateStatusSchema.optional(),
|
|
11140
11305
|
/** Swapping the creative is the Meta way to "edit" an ad's creative. */
|
|
11141
|
-
creative:
|
|
11142
|
-
tracking_specs:
|
|
11306
|
+
creative: z10.object({ creative_id: parentRefSchema2 }).optional(),
|
|
11307
|
+
tracking_specs: z10.array(z10.record(z10.string(), z10.unknown())).optional()
|
|
11143
11308
|
}).refine((p) => Object.values(p).some((val) => val !== void 0), "update needs at least one field");
|
|
11144
|
-
var lookalikeSpecSchema =
|
|
11145
|
-
origin:
|
|
11146
|
-
ratio:
|
|
11147
|
-
country:
|
|
11148
|
-
});
|
|
11149
|
-
var customAudienceCreateSchema =
|
|
11150
|
-
name:
|
|
11151
|
-
subtype:
|
|
11152
|
-
description:
|
|
11153
|
-
customer_file_source:
|
|
11154
|
-
retention_days:
|
|
11309
|
+
var lookalikeSpecSchema = z10.object({
|
|
11310
|
+
origin: z10.array(z10.object({ id: parentRefSchema2 })).min(1),
|
|
11311
|
+
ratio: z10.number().min(0.01).max(0.2).optional(),
|
|
11312
|
+
country: z10.string().length(2).optional()
|
|
11313
|
+
});
|
|
11314
|
+
var customAudienceCreateSchema = z10.object({
|
|
11315
|
+
name: z10.string().min(1).max(META_LIMITS.audience.nameMax),
|
|
11316
|
+
subtype: z10.enum(CUSTOM_AUDIENCE_SUBTYPES),
|
|
11317
|
+
description: z10.string().max(500).optional(),
|
|
11318
|
+
customer_file_source: z10.string().optional(),
|
|
11319
|
+
retention_days: z10.number().int().min(1).max(META_LIMITS.audience.retentionDaysMax).optional(),
|
|
11155
11320
|
lookalike_spec: lookalikeSpecSchema.optional(),
|
|
11156
11321
|
/** Website/engagement rule — structural passthrough validated by Meta. */
|
|
11157
|
-
rule:
|
|
11322
|
+
rule: z10.record(z10.string(), z10.unknown()).optional()
|
|
11158
11323
|
}).superRefine((p, ctx) => {
|
|
11159
11324
|
if (p.subtype === "LOOKALIKE" && !p.lookalike_spec) {
|
|
11160
11325
|
ctx.addIssue({ code: "custom", path: ["lookalike_spec"], message: "LOOKALIKE audiences need a lookalike_spec" });
|
|
@@ -11163,16 +11328,16 @@ var customAudienceCreateSchema = z9.object({
|
|
|
11163
11328
|
ctx.addIssue({ code: "custom", path: ["rule"], message: `${p.subtype} audiences need a rule (use --file)` });
|
|
11164
11329
|
}
|
|
11165
11330
|
});
|
|
11166
|
-
var customAudienceUpdateSchema =
|
|
11167
|
-
name:
|
|
11168
|
-
description:
|
|
11331
|
+
var customAudienceUpdateSchema = z10.object({
|
|
11332
|
+
name: z10.string().min(1).max(META_LIMITS.audience.nameMax).optional(),
|
|
11333
|
+
description: z10.string().max(500).optional()
|
|
11169
11334
|
}).refine((p) => Object.values(p).some((val) => val !== void 0), "update needs at least one field");
|
|
11170
|
-
var mediaUploadSchema =
|
|
11171
|
-
kind:
|
|
11335
|
+
var mediaUploadSchema = z10.object({
|
|
11336
|
+
kind: z10.enum(MEDIA_KINDS),
|
|
11172
11337
|
bakerImageId: bakerMediaIdSchema2.optional(),
|
|
11173
11338
|
bakerVideoId: bakerMediaIdSchema2.optional(),
|
|
11174
11339
|
/** Optional display name / filename hint. */
|
|
11175
|
-
name:
|
|
11340
|
+
name: z10.string().max(255).optional()
|
|
11176
11341
|
}).superRefine((p, ctx) => {
|
|
11177
11342
|
if (p.kind === "image" && !p.bakerImageId) {
|
|
11178
11343
|
ctx.addIssue({ code: "custom", path: ["bakerImageId"], message: "image uploads need a bakerImageId" });
|
|
@@ -11194,16 +11359,16 @@ var META_DRAFT_OP_KINDS = [
|
|
|
11194
11359
|
"customAudience.update",
|
|
11195
11360
|
"media.upload"
|
|
11196
11361
|
];
|
|
11197
|
-
var metaDraftOpKindSchema =
|
|
11198
|
-
var accountIdSchema2 =
|
|
11199
|
-
var updateTargetSchema2 =
|
|
11362
|
+
var metaDraftOpKindSchema = z10.enum(META_DRAFT_OP_KINDS);
|
|
11363
|
+
var accountIdSchema2 = z10.string().regex(NUMERIC_ID_REGEX3, "accountId must be the bare numeric ad account id");
|
|
11364
|
+
var updateTargetSchema2 = z10.union([z10.string().regex(NUMERIC_ID_REGEX3), tempRefSchema3]);
|
|
11200
11365
|
function createOp3(kind, payload) {
|
|
11201
|
-
return
|
|
11366
|
+
return z10.object({ kind: z10.literal(kind), accountId: accountIdSchema2, payload });
|
|
11202
11367
|
}
|
|
11203
11368
|
function updateOp3(kind, payload) {
|
|
11204
|
-
return
|
|
11369
|
+
return z10.object({ kind: z10.literal(kind), accountId: accountIdSchema2, target: updateTargetSchema2, payload });
|
|
11205
11370
|
}
|
|
11206
|
-
var metaDraftOpInputSchema =
|
|
11371
|
+
var metaDraftOpInputSchema = z10.discriminatedUnion("kind", [
|
|
11207
11372
|
createOp3("campaign.create", campaignCreateSchema3),
|
|
11208
11373
|
updateOp3("campaign.update", campaignUpdateSchema3),
|
|
11209
11374
|
createOp3("adSet.create", adSetCreateSchema),
|
|
@@ -11218,89 +11383,89 @@ var metaDraftOpInputSchema = z9.discriminatedUnion("kind", [
|
|
|
11218
11383
|
]);
|
|
11219
11384
|
|
|
11220
11385
|
// ../api/src/ads-meta/wire.ts
|
|
11221
|
-
import { z as
|
|
11222
|
-
var metaWriteModeSchema =
|
|
11223
|
-
var metaDraftOpResultSchema =
|
|
11224
|
-
status:
|
|
11386
|
+
import { z as z11 } from "zod";
|
|
11387
|
+
var metaWriteModeSchema = z11.enum(["live", "simulated"]);
|
|
11388
|
+
var metaDraftOpResultSchema = z11.object({
|
|
11389
|
+
status: z11.enum(["applied", "simulated", "failed", "skipped"]),
|
|
11225
11390
|
/** The resulting Meta node id (campaign/adset/creative/ad/audience) or simulated id. */
|
|
11226
|
-
id:
|
|
11391
|
+
id: z11.string().optional(),
|
|
11227
11392
|
/** For media.upload ops: the resulting image hash. */
|
|
11228
|
-
hash:
|
|
11229
|
-
error:
|
|
11230
|
-
skippedBecause:
|
|
11231
|
-
executedAt:
|
|
11393
|
+
hash: z11.string().optional(),
|
|
11394
|
+
error: z11.string().optional(),
|
|
11395
|
+
skippedBecause: z11.string().optional(),
|
|
11396
|
+
executedAt: z11.number().optional()
|
|
11232
11397
|
});
|
|
11233
|
-
var metaDraftStageRequestSchema =
|
|
11234
|
-
chatId:
|
|
11398
|
+
var metaDraftStageRequestSchema = z11.object({
|
|
11399
|
+
chatId: z11.string(),
|
|
11235
11400
|
op: metaDraftOpInputSchema
|
|
11236
11401
|
});
|
|
11237
|
-
var metaDraftStageResponseSchema =
|
|
11238
|
-
staged:
|
|
11239
|
-
ref:
|
|
11402
|
+
var metaDraftStageResponseSchema = z11.object({
|
|
11403
|
+
staged: z11.literal(true),
|
|
11404
|
+
ref: z11.string(),
|
|
11240
11405
|
kind: metaDraftOpKindSchema,
|
|
11241
11406
|
mode: metaWriteModeSchema,
|
|
11242
|
-
dependsOn:
|
|
11243
|
-
summary:
|
|
11244
|
-
warnings:
|
|
11407
|
+
dependsOn: z11.array(z11.string()),
|
|
11408
|
+
summary: z11.string(),
|
|
11409
|
+
warnings: z11.array(z11.string()),
|
|
11245
11410
|
/** True when the op amended an already-staged op in place instead of appending a new one. */
|
|
11246
|
-
amended:
|
|
11247
|
-
});
|
|
11248
|
-
var metaDraftDuplicateRequestSchema =
|
|
11249
|
-
chatId:
|
|
11250
|
-
accountId:
|
|
11251
|
-
entity:
|
|
11252
|
-
sourceId:
|
|
11253
|
-
overrides:
|
|
11411
|
+
amended: z11.boolean().optional()
|
|
11412
|
+
});
|
|
11413
|
+
var metaDraftDuplicateRequestSchema = z11.object({
|
|
11414
|
+
chatId: z11.string(),
|
|
11415
|
+
accountId: z11.string(),
|
|
11416
|
+
entity: z11.enum(["campaign", "adSet", "ad"]),
|
|
11417
|
+
sourceId: z11.string(),
|
|
11418
|
+
overrides: z11.record(z11.string(), z11.unknown()).optional(),
|
|
11254
11419
|
/** Pause the original after the copy publishes. */
|
|
11255
|
-
replace:
|
|
11420
|
+
replace: z11.boolean().optional()
|
|
11256
11421
|
});
|
|
11257
|
-
var metaDraftOpViewSchema =
|
|
11258
|
-
ref:
|
|
11422
|
+
var metaDraftOpViewSchema = z11.object({
|
|
11423
|
+
ref: z11.string(),
|
|
11259
11424
|
kind: metaDraftOpKindSchema,
|
|
11260
|
-
accountId:
|
|
11261
|
-
target:
|
|
11262
|
-
dependsOn:
|
|
11263
|
-
summary:
|
|
11264
|
-
stagedAt:
|
|
11425
|
+
accountId: z11.string(),
|
|
11426
|
+
target: z11.string().optional(),
|
|
11427
|
+
dependsOn: z11.array(z11.string()),
|
|
11428
|
+
summary: z11.string(),
|
|
11429
|
+
stagedAt: z11.number(),
|
|
11265
11430
|
result: metaDraftOpResultSchema.optional()
|
|
11266
11431
|
});
|
|
11267
|
-
var metaDraftListRequestSchema =
|
|
11268
|
-
chatId:
|
|
11432
|
+
var metaDraftListRequestSchema = z11.object({
|
|
11433
|
+
chatId: z11.string()
|
|
11269
11434
|
});
|
|
11270
|
-
var metaDraftAdvisorySchema =
|
|
11271
|
-
ref:
|
|
11272
|
-
message:
|
|
11435
|
+
var metaDraftAdvisorySchema = z11.object({
|
|
11436
|
+
ref: z11.string(),
|
|
11437
|
+
message: z11.string()
|
|
11273
11438
|
});
|
|
11274
|
-
var metaDraftListResponseSchema =
|
|
11275
|
-
status:
|
|
11439
|
+
var metaDraftListResponseSchema = z11.object({
|
|
11440
|
+
status: z11.enum(["active", "publishing", "applied", "discarded", "none"]),
|
|
11276
11441
|
mode: metaWriteModeSchema,
|
|
11277
|
-
count:
|
|
11278
|
-
ops:
|
|
11442
|
+
count: z11.number(),
|
|
11443
|
+
ops: z11.array(metaDraftOpViewSchema),
|
|
11279
11444
|
/** Non-blocking cross-op quality advisories — "good campaign, not just valid". */
|
|
11280
|
-
advisories:
|
|
11445
|
+
advisories: z11.array(metaDraftAdvisorySchema)
|
|
11281
11446
|
});
|
|
11282
|
-
var metaDraftRemoveRequestSchema =
|
|
11283
|
-
chatId:
|
|
11284
|
-
ref:
|
|
11447
|
+
var metaDraftRemoveRequestSchema = z11.object({
|
|
11448
|
+
chatId: z11.string(),
|
|
11449
|
+
ref: z11.string()
|
|
11285
11450
|
});
|
|
11286
|
-
var metaDraftRemoveResponseSchema =
|
|
11451
|
+
var metaDraftRemoveResponseSchema = z11.object({
|
|
11287
11452
|
/** The requested ref plus any dependents removed by cascade. */
|
|
11288
|
-
removed:
|
|
11453
|
+
removed: z11.array(z11.string())
|
|
11289
11454
|
});
|
|
11290
|
-
var metaDraftClearRequestSchema =
|
|
11291
|
-
chatId:
|
|
11455
|
+
var metaDraftClearRequestSchema = z11.object({
|
|
11456
|
+
chatId: z11.string()
|
|
11292
11457
|
});
|
|
11293
|
-
var metaDraftClearResponseSchema =
|
|
11294
|
-
cleared:
|
|
11458
|
+
var metaDraftClearResponseSchema = z11.object({
|
|
11459
|
+
cleared: z11.number()
|
|
11295
11460
|
});
|
|
11296
|
-
var metaFieldErrorSchema =
|
|
11297
|
-
path:
|
|
11298
|
-
message:
|
|
11461
|
+
var metaFieldErrorSchema = z11.object({
|
|
11462
|
+
path: z11.string(),
|
|
11463
|
+
message: z11.string()
|
|
11299
11464
|
});
|
|
11300
|
-
var metaDraftErrorResponseSchema =
|
|
11301
|
-
code:
|
|
11302
|
-
error:
|
|
11303
|
-
fields:
|
|
11465
|
+
var metaDraftErrorResponseSchema = z11.object({
|
|
11466
|
+
code: z11.string(),
|
|
11467
|
+
error: z11.string(),
|
|
11468
|
+
fields: z11.array(metaFieldErrorSchema).optional()
|
|
11304
11469
|
});
|
|
11305
11470
|
|
|
11306
11471
|
// src/commands/ads/meta/write-shared.ts
|
|
@@ -14577,27 +14742,27 @@ import path6 from "path";
|
|
|
14577
14742
|
import { defineCommand as defineCommand89 } from "citty";
|
|
14578
14743
|
|
|
14579
14744
|
// src/engine/scaffold/staticAd.ts
|
|
14580
|
-
import { z as
|
|
14745
|
+
import { z as z12 } from "zod";
|
|
14581
14746
|
var GEN_ASPECT_RATIOS = /* @__PURE__ */ new Set(["1:1", "4:5", "9:16", "16:9", "4:3", "3:4", "2:3", "3:2", "21:9"]);
|
|
14582
14747
|
var DEFAULT_ASPECT_RATIO = "9:16";
|
|
14583
|
-
var Blueprint =
|
|
14584
|
-
meta:
|
|
14585
|
-
text_content:
|
|
14748
|
+
var Blueprint = z12.object({
|
|
14749
|
+
meta: z12.object({ estimated_aspect_ratio: z12.string().optional() }).loose().optional(),
|
|
14750
|
+
text_content: z12.array(z12.object({ text: z12.string().optional() }).loose()).optional()
|
|
14586
14751
|
}).loose();
|
|
14587
|
-
var ElementLocator =
|
|
14588
|
-
collection:
|
|
14589
|
-
index:
|
|
14752
|
+
var ElementLocator = z12.object({
|
|
14753
|
+
collection: z12.enum(["subjects", "people", "brands_logos"]),
|
|
14754
|
+
index: z12.number().int().nonnegative()
|
|
14590
14755
|
}).loose();
|
|
14591
|
-
var MainElement =
|
|
14756
|
+
var MainElement = z12.object({
|
|
14592
14757
|
// logo | product | person | animal | badge | other
|
|
14593
|
-
type:
|
|
14594
|
-
label:
|
|
14595
|
-
description:
|
|
14596
|
-
expression:
|
|
14597
|
-
reason:
|
|
14758
|
+
type: z12.string(),
|
|
14759
|
+
label: z12.string().optional(),
|
|
14760
|
+
description: z12.string().optional(),
|
|
14761
|
+
expression: z12.string().nullable().optional(),
|
|
14762
|
+
reason: z12.string().optional(),
|
|
14598
14763
|
locator: ElementLocator.optional()
|
|
14599
14764
|
}).loose();
|
|
14600
|
-
var MainElements =
|
|
14765
|
+
var MainElements = z12.array(MainElement);
|
|
14601
14766
|
function sanitizeId(raw, fallback) {
|
|
14602
14767
|
const id = raw.toLowerCase().replace(/[^a-z0-9]+/g, "_").replace(/^_+|_+$/g, "");
|
|
14603
14768
|
return /^[a-z]/.test(id) ? id : `${fallback}_${id}`.replace(/_+$/g, "") || fallback;
|
|
@@ -15133,7 +15298,7 @@ import { toCardinal as nwKo } from "n2words/ko-KR";
|
|
|
15133
15298
|
import { toCardinal as nwNl } from "n2words/nl-NL";
|
|
15134
15299
|
import { toCardinal as nwPl } from "n2words/pl-PL";
|
|
15135
15300
|
import { toCardinal as nwPt } from "n2words/pt-PT";
|
|
15136
|
-
import { z as
|
|
15301
|
+
import { z as z13 } from "zod";
|
|
15137
15302
|
|
|
15138
15303
|
// src/engine/scaffold/lib/shoot-modes.ts
|
|
15139
15304
|
var SHOOT_MODES = [
|
|
@@ -15446,71 +15611,71 @@ function trimArgs(durationS, offsetS = 0, dims) {
|
|
|
15446
15611
|
"{{out.video}}"
|
|
15447
15612
|
];
|
|
15448
15613
|
}
|
|
15449
|
-
var FrameAsset =
|
|
15450
|
-
var DialogueLine =
|
|
15451
|
-
speaker:
|
|
15452
|
-
line:
|
|
15614
|
+
var FrameAsset = z13.object({ url: z13.string().optional() }).loose().optional();
|
|
15615
|
+
var DialogueLine = z13.object({
|
|
15616
|
+
speaker: z13.string().optional(),
|
|
15617
|
+
line: z13.string().optional(),
|
|
15453
15618
|
// Absolute seconds on the source timeline (the deconstruct emits both).
|
|
15454
|
-
start_s:
|
|
15455
|
-
end_s:
|
|
15456
|
-
delivery:
|
|
15457
|
-
voice_description:
|
|
15619
|
+
start_s: z13.number().optional(),
|
|
15620
|
+
end_s: z13.number().optional(),
|
|
15621
|
+
delivery: z13.string().optional(),
|
|
15622
|
+
voice_description: z13.string().optional(),
|
|
15458
15623
|
// DECON-supplied: is this speaker's FACE visibly speaking in THIS scene? Element
|
|
15459
15624
|
// presence alone can't answer that — a founder pictured in a polaroid close-up is
|
|
15460
15625
|
// "present" yet the line is voiceover, and treating it as on-camera produced a
|
|
15461
15626
|
// native Seedance lip-sync clip of a still photograph. `false` pins the line to
|
|
15462
15627
|
// the VO path; absent keeps the presence-based decision (old blueprints).
|
|
15463
|
-
on_camera:
|
|
15628
|
+
on_camera: z13.boolean().optional()
|
|
15464
15629
|
}).loose();
|
|
15465
|
-
var Sfx =
|
|
15466
|
-
at_s:
|
|
15467
|
-
duration_s:
|
|
15468
|
-
sound_effect_prompt:
|
|
15469
|
-
description:
|
|
15630
|
+
var Sfx = z13.object({
|
|
15631
|
+
at_s: z13.number().optional(),
|
|
15632
|
+
duration_s: z13.number().optional(),
|
|
15633
|
+
sound_effect_prompt: z13.string().optional(),
|
|
15634
|
+
description: z13.string().optional()
|
|
15470
15635
|
}).loose();
|
|
15471
|
-
var CompositionRegion =
|
|
15636
|
+
var CompositionRegion = z13.object({
|
|
15472
15637
|
// full | top | bottom | left | right | inset
|
|
15473
|
-
panel:
|
|
15638
|
+
panel: z13.string().optional(),
|
|
15474
15639
|
// 9-grid anchor for an `inset` presenter box.
|
|
15475
|
-
position:
|
|
15476
|
-
is_presenter:
|
|
15640
|
+
position: z13.string().optional(),
|
|
15641
|
+
is_presenter: z13.boolean().optional(),
|
|
15477
15642
|
// The cast id shown/speaking in this region (routes lip-sync + element refs).
|
|
15478
|
-
cast_ref:
|
|
15643
|
+
cast_ref: z13.string().optional(),
|
|
15479
15644
|
// What the region's content IS: camera | screen_capture | static_graphic |
|
|
15480
15645
|
// generated. Authoritative for routing when present (regex-over-prose fallback
|
|
15481
15646
|
// otherwise): screen_capture/static_graphic are rebuilt from REAL surfaces on the
|
|
15482
15647
|
// overlay layer, never AI-generated.
|
|
15483
|
-
kind:
|
|
15648
|
+
kind: z13.string().optional(),
|
|
15484
15649
|
// Opaque id naming the SPECIFIC on-screen document/note/app-state this
|
|
15485
15650
|
// screen_capture region shows. Two scenes share it only when they show the SAME
|
|
15486
15651
|
// recording continuing (scrolling/typing/waiting within it) — a genuinely
|
|
15487
15652
|
// DIFFERENT document/note/recording (a source video splicing two screen captures)
|
|
15488
15653
|
// gets a different id. Breaks a persistent-layout run into separate surface stubs
|
|
15489
15654
|
// instead of asking the operator for one screenshot that can't cover both.
|
|
15490
|
-
surface_id:
|
|
15655
|
+
surface_id: z13.string().optional(),
|
|
15491
15656
|
// Camera bubble(s)/inset(s) embedded INSIDE this region's surface (a Loom-style
|
|
15492
15657
|
// presenter bubble inside a screen recording) — video-in-video the reproduction
|
|
15493
15658
|
// must re-composite, not paint into the surface.
|
|
15494
|
-
nested:
|
|
15495
|
-
summary:
|
|
15496
|
-
frame_prompt:
|
|
15497
|
-
motion_prompt:
|
|
15659
|
+
nested: z13.array(z13.object({}).loose()).optional(),
|
|
15660
|
+
summary: z13.string().optional(),
|
|
15661
|
+
frame_prompt: z13.string().optional(),
|
|
15662
|
+
motion_prompt: z13.string().optional()
|
|
15498
15663
|
}).loose();
|
|
15499
|
-
var SceneComposition =
|
|
15664
|
+
var SceneComposition = z13.object({
|
|
15500
15665
|
// full_frame (default) | split_screen | pip | keyed_overlay
|
|
15501
|
-
layout:
|
|
15666
|
+
layout: z13.string().optional(),
|
|
15502
15667
|
// split_screen only: vertical (top/bottom) | horizontal (left/right).
|
|
15503
|
-
split_axis:
|
|
15504
|
-
regions:
|
|
15668
|
+
split_axis: z13.string().optional(),
|
|
15669
|
+
regions: z13.array(CompositionRegion).optional()
|
|
15505
15670
|
}).loose();
|
|
15506
|
-
var CameraMotion =
|
|
15507
|
-
var TranscriptWord =
|
|
15508
|
-
var Scene =
|
|
15509
|
-
start_s:
|
|
15510
|
-
end_s:
|
|
15511
|
-
duration_s:
|
|
15512
|
-
summary:
|
|
15513
|
-
action_detail:
|
|
15671
|
+
var CameraMotion = z13.object({ movement: z13.string().optional(), detail: z13.string().optional() }).loose();
|
|
15672
|
+
var TranscriptWord = z13.object({ text: z13.string().optional() }).loose();
|
|
15673
|
+
var Scene = z13.object({
|
|
15674
|
+
start_s: z13.number().optional(),
|
|
15675
|
+
end_s: z13.number().optional(),
|
|
15676
|
+
duration_s: z13.number().optional(),
|
|
15677
|
+
summary: z13.string().optional(),
|
|
15678
|
+
action_detail: z13.string().optional(),
|
|
15514
15679
|
// The scene's spatial layout. Absent/full_frame ⇒ one uncut shot (default path).
|
|
15515
15680
|
// A layered layout (split_screen/pip/keyed_overlay) with regions ⇒ the scaffold
|
|
15516
15681
|
// builds one clip per region and stacks/overlays them into the scene picture.
|
|
@@ -15518,82 +15683,82 @@ var Scene = z12.object({
|
|
|
15518
15683
|
// The capture "look" for this scene — selected from the ad-native shoot-mode
|
|
15519
15684
|
// grammar (see lib/shoot-modes.ts). When absent the scaffold auto-derives a
|
|
15520
15685
|
// UGC/product mode; a human can override per scene by setting this.
|
|
15521
|
-
shoot_mode:
|
|
15686
|
+
shoot_mode: z13.string().optional(),
|
|
15522
15687
|
// Diegetic ambient the clip's native audio should carry (no music). When
|
|
15523
15688
|
// absent the scene falls back to its shoot mode's default ambience.
|
|
15524
|
-
ambient:
|
|
15689
|
+
ambient: z13.string().optional(),
|
|
15525
15690
|
camera_motion: CameraMotion.optional(),
|
|
15526
|
-
start_frame_prompt:
|
|
15527
|
-
end_frame_prompt:
|
|
15528
|
-
motion_prompt:
|
|
15691
|
+
start_frame_prompt: z13.string().optional(),
|
|
15692
|
+
end_frame_prompt: z13.string().optional(),
|
|
15693
|
+
motion_prompt: z13.string().optional(),
|
|
15529
15694
|
// The scene's role in the ad's persuasion arc (DECON-supplied); drives the
|
|
15530
15695
|
// script re-craft checklist. Inferred from position when absent.
|
|
15531
|
-
narrative_role:
|
|
15696
|
+
narrative_role: z13.string().optional(),
|
|
15532
15697
|
// DECON-supplied on the HOOK scene: the engineered physical/emotional state that
|
|
15533
15698
|
// makes the first frame stop the scroll (sweaty/breathless/urgent …). Injected
|
|
15534
15699
|
// into the hook's start-frame description so the generator renders that state,
|
|
15535
15700
|
// not a calm influencer (CCA-11).
|
|
15536
|
-
hook_mechanic:
|
|
15701
|
+
hook_mechanic: z13.object({ mechanic: z13.string().optional(), why_it_stops_scroll: z13.string().optional() }).loose().optional(),
|
|
15537
15702
|
// DECON-supplied per-scene location (so a gym hook isn't flattened to "home").
|
|
15538
|
-
scene_setting:
|
|
15703
|
+
scene_setting: z13.string().optional(),
|
|
15539
15704
|
// How this scene cuts to the next (DECON-supplied). A recognized non-cut type
|
|
15540
15705
|
// (fade/whip/zoom/dissolve/swipe) is reproduced as an ffmpeg xfade at the
|
|
15541
15706
|
// boundary; cut/match_cut/none/other stay hard cuts. The last scene's value is
|
|
15542
15707
|
// ignored (nothing follows it).
|
|
15543
|
-
transition_out:
|
|
15544
|
-
dialogue:
|
|
15545
|
-
sfx:
|
|
15546
|
-
overlays:
|
|
15547
|
-
floating_elements:
|
|
15708
|
+
transition_out: z13.object({ type: z13.string().optional(), description: z13.string().optional() }).loose().optional(),
|
|
15709
|
+
dialogue: z13.array(DialogueLine).optional(),
|
|
15710
|
+
sfx: z13.array(Sfx).optional(),
|
|
15711
|
+
overlays: z13.array(z13.unknown()).optional(),
|
|
15712
|
+
floating_elements: z13.array(z13.unknown()).optional(),
|
|
15548
15713
|
// DECON-supplied: how much the picture itself moves within the shot. Gates the
|
|
15549
15714
|
// flash-hold optimization — a sub-2s b-roll flash with REAL subject motion
|
|
15550
15715
|
// (pouring, spreading, hands working) must stay a real clip; freezing it turns
|
|
15551
15716
|
// a montage into a slideshow. Absent (old blueprints) keeps the cheap still.
|
|
15552
|
-
motion_level:
|
|
15553
|
-
transcript_slice:
|
|
15717
|
+
motion_level: z13.enum(["static", "subtle", "dynamic"]).optional(),
|
|
15718
|
+
transcript_slice: z13.array(TranscriptWord).optional(),
|
|
15554
15719
|
start_frame_asset: FrameAsset,
|
|
15555
15720
|
end_frame_asset: FrameAsset,
|
|
15556
15721
|
// DECON-supplied: true when this scene is a length-split CONTINUATION of the
|
|
15557
15722
|
// previous one (the SAME physical shot, broken up only because it exceeded the
|
|
15558
15723
|
// clip ceiling). The scaffold then shares the splice keyframe — this scene's
|
|
15559
15724
|
// start frame IS the previous scene's end frame — so the join is seamless.
|
|
15560
|
-
continues_previous:
|
|
15725
|
+
continues_previous: z13.boolean().optional()
|
|
15561
15726
|
}).loose();
|
|
15562
|
-
var VideoBlueprint =
|
|
15563
|
-
source:
|
|
15564
|
-
global:
|
|
15565
|
-
music:
|
|
15566
|
-
present:
|
|
15567
|
-
music_prompt:
|
|
15727
|
+
var VideoBlueprint = z13.object({
|
|
15728
|
+
source: z13.object({ aspect_ratio: z13.string().optional(), duration_s: z13.number().optional() }).loose().optional(),
|
|
15729
|
+
global: z13.object({
|
|
15730
|
+
music: z13.object({
|
|
15731
|
+
present: z13.boolean().optional(),
|
|
15732
|
+
music_prompt: z13.string().optional(),
|
|
15568
15733
|
// Absolute second the music enters in the reference (the bed often
|
|
15569
15734
|
// kicks in mid-ad, after the hook). We start the regenerated track here
|
|
15570
15735
|
// instead of at 0 so the timing matches.
|
|
15571
|
-
starts_at_s:
|
|
15736
|
+
starts_at_s: z13.number().optional(),
|
|
15572
15737
|
// Populated by the deconstruct when AudD (Shazam-style) recognizes the
|
|
15573
15738
|
// reference track. We never reuse it — only style the regenerated bed.
|
|
15574
|
-
identified_track:
|
|
15739
|
+
identified_track: z13.object({ title: z13.string().optional(), artist: z13.string().optional() }).loose().nullish()
|
|
15575
15740
|
}).loose().optional(),
|
|
15576
|
-
cast:
|
|
15577
|
-
|
|
15578
|
-
id:
|
|
15579
|
-
description:
|
|
15741
|
+
cast: z13.array(
|
|
15742
|
+
z13.object({
|
|
15743
|
+
id: z13.string().optional(),
|
|
15744
|
+
description: z13.string().optional(),
|
|
15580
15745
|
// The deconstruct's note on the target-market localization (e.g. "native
|
|
15581
15746
|
// French speaker") — read to derive the spoken-track language code.
|
|
15582
|
-
market_localization_note:
|
|
15747
|
+
market_localization_note: z13.string().optional()
|
|
15583
15748
|
}).loose()
|
|
15584
15749
|
).optional(),
|
|
15585
|
-
voiceover:
|
|
15750
|
+
voiceover: z13.object({
|
|
15586
15751
|
// on_camera | mixed → mouths are on screen (lip-sync candidates);
|
|
15587
15752
|
// voiceover | none → narration over the picture (no lip-sync).
|
|
15588
|
-
mode:
|
|
15589
|
-
voice_description:
|
|
15590
|
-
persona:
|
|
15753
|
+
mode: z13.string().optional(),
|
|
15754
|
+
voice_description: z13.string().optional(),
|
|
15755
|
+
persona: z13.string().optional()
|
|
15591
15756
|
}).loose().optional(),
|
|
15592
15757
|
// Visual palette — read only to colour a clean brand-card/CTA plate (the
|
|
15593
15758
|
// first hex is the dominant brand colour); never to drive frame generation.
|
|
15594
|
-
style:
|
|
15759
|
+
style: z13.object({ palette: z13.array(z13.object({ hex: z13.string().optional() }).loose()).optional() }).loose().optional()
|
|
15595
15760
|
}).loose().optional(),
|
|
15596
|
-
scenes:
|
|
15761
|
+
scenes: z13.array(Scene).min(1)
|
|
15597
15762
|
}).loose();
|
|
15598
15763
|
function injectHookPhysicality(blueprint) {
|
|
15599
15764
|
for (const scene of blueprint.scenes) {
|
|
@@ -15603,26 +15768,26 @@ function injectHookPhysicality(blueprint) {
|
|
|
15603
15768
|
scene.start_frame_prompt = `${prompt} The subject's physical state IS the scroll-stopper \u2014 render it explicitly, not a calm pose: ${why}.`;
|
|
15604
15769
|
}
|
|
15605
15770
|
}
|
|
15606
|
-
var AppearsItem =
|
|
15607
|
-
var RecurringElement =
|
|
15771
|
+
var AppearsItem = z13.union([z13.number(), z13.object({ scene: z13.number(), edge: z13.string().optional() }).loose()]);
|
|
15772
|
+
var RecurringElement = z13.object({
|
|
15608
15773
|
// person | animal | product | logo | badge | other
|
|
15609
|
-
type:
|
|
15610
|
-
label:
|
|
15611
|
-
description:
|
|
15612
|
-
expression:
|
|
15774
|
+
type: z13.string(),
|
|
15775
|
+
label: z13.string().optional(),
|
|
15776
|
+
description: z13.string().optional(),
|
|
15777
|
+
expression: z13.string().nullable().optional(),
|
|
15613
15778
|
// When the element maps to a global cast entry, its stable id (for annotation).
|
|
15614
|
-
cast_id:
|
|
15779
|
+
cast_id: z13.string().nullable().optional(),
|
|
15615
15780
|
// The label of another element that is the SAME individual as this one, shown
|
|
15616
15781
|
// in a DIFFERENT wardrobe/persona/state (e.g. one creator playing skeptic in a
|
|
15617
15782
|
// pink shirt and believer in a white shirt). Each look gets its own reference
|
|
15618
15783
|
// slot, but the face/identity must stay identical across them.
|
|
15619
|
-
same_as:
|
|
15784
|
+
same_as: z13.string().nullable().optional(),
|
|
15620
15785
|
// Scenes the element appears in. Either a bare list of scene indices (both
|
|
15621
15786
|
// edges) or per-{scene,edge} entries. Both forms are accepted and merged.
|
|
15622
|
-
scenes:
|
|
15623
|
-
appears_in:
|
|
15787
|
+
scenes: z13.array(z13.number()).optional(),
|
|
15788
|
+
appears_in: z13.array(AppearsItem).optional()
|
|
15624
15789
|
}).loose();
|
|
15625
|
-
var RecurringElements =
|
|
15790
|
+
var RecurringElements = z13.array(RecurringElement);
|
|
15626
15791
|
function sanitizeId2(raw, fallback) {
|
|
15627
15792
|
const id = raw.toLowerCase().replace(/[^a-z0-9]+/g, "_").replace(/^_+|_+$/g, "");
|
|
15628
15793
|
return /^[a-z]/.test(id) ? id : `${fallback}_${id}`.replace(/_+$/g, "") || fallback;
|
|
@@ -16040,7 +16205,7 @@ function scrubFloatSentences(text, floatDescs) {
|
|
|
16040
16205
|
return kept;
|
|
16041
16206
|
}
|
|
16042
16207
|
function sceneFloatDescs(scene) {
|
|
16043
|
-
const floats =
|
|
16208
|
+
const floats = z13.array(FloatingElement).safeParse(scene.floating_elements ?? []);
|
|
16044
16209
|
if (!floats.success) return [];
|
|
16045
16210
|
return floats.data.map((f) => f.description?.trim() ?? "").filter(Boolean);
|
|
16046
16211
|
}
|
|
@@ -17380,25 +17545,25 @@ function buildSfxMusic(blueprint, nodes) {
|
|
|
17380
17545
|
}
|
|
17381
17546
|
return tracks;
|
|
17382
17547
|
}
|
|
17383
|
-
var OverlayStyle =
|
|
17384
|
-
var Overlay =
|
|
17385
|
-
text:
|
|
17386
|
-
appears_at_s:
|
|
17387
|
-
duration_s:
|
|
17388
|
-
position:
|
|
17389
|
-
role:
|
|
17390
|
-
animation:
|
|
17391
|
-
animation_detail:
|
|
17548
|
+
var OverlayStyle = z13.object({ color_hex: z13.string().optional(), background: z13.string().optional(), size: z13.string().optional() }).loose();
|
|
17549
|
+
var Overlay = z13.object({
|
|
17550
|
+
text: z13.string().optional(),
|
|
17551
|
+
appears_at_s: z13.number().optional(),
|
|
17552
|
+
duration_s: z13.number().optional(),
|
|
17553
|
+
position: z13.string().optional(),
|
|
17554
|
+
role: z13.string().optional(),
|
|
17555
|
+
animation: z13.string().optional(),
|
|
17556
|
+
animation_detail: z13.string().optional(),
|
|
17392
17557
|
style: OverlayStyle.optional()
|
|
17393
17558
|
}).loose();
|
|
17394
|
-
var FloatingElement =
|
|
17395
|
-
kind:
|
|
17396
|
-
description:
|
|
17397
|
-
brand_name:
|
|
17398
|
-
what_it_represents:
|
|
17399
|
-
appears_at_s:
|
|
17400
|
-
duration_s:
|
|
17401
|
-
position:
|
|
17559
|
+
var FloatingElement = z13.object({
|
|
17560
|
+
kind: z13.string().optional(),
|
|
17561
|
+
description: z13.string().optional(),
|
|
17562
|
+
brand_name: z13.string().nullish(),
|
|
17563
|
+
what_it_represents: z13.string().optional(),
|
|
17564
|
+
appears_at_s: z13.number().optional(),
|
|
17565
|
+
duration_s: z13.number().optional(),
|
|
17566
|
+
position: z13.string().optional()
|
|
17402
17567
|
}).loose();
|
|
17403
17568
|
function escapeHtml(s) {
|
|
17404
17569
|
return s.replace(/&/g, "&").replace(/</g, "<").replace(/>/g, ">").replace(/"/g, """);
|
|
@@ -17430,7 +17595,7 @@ function positionClass(position) {
|
|
|
17430
17595
|
function collectCaptions(blueprint) {
|
|
17431
17596
|
return blueprint.scenes.flatMap((scene) => {
|
|
17432
17597
|
const sceneStart = scene.start_s ?? 0;
|
|
17433
|
-
const overlays =
|
|
17598
|
+
const overlays = z13.array(Overlay).safeParse(scene.overlays ?? []);
|
|
17434
17599
|
return overlays.success ? overlays.data.filter((ov) => Boolean(ov.text?.trim())).map((ov) => {
|
|
17435
17600
|
const at = ov.appears_at_s ?? sceneStart;
|
|
17436
17601
|
return { text: ov.text.trim(), at, end: at + (ov.duration_s ?? 2.5), ov };
|
|
@@ -17510,7 +17675,7 @@ function collectFloatWindows(blueprint, uiRouted) {
|
|
|
17510
17675
|
const windows = /* @__PURE__ */ new Map();
|
|
17511
17676
|
blueprint.scenes.forEach((scene, i) => {
|
|
17512
17677
|
const sceneStart = scene.start_s ?? 0;
|
|
17513
|
-
const floats =
|
|
17678
|
+
const floats = z13.array(FloatingElement).safeParse(scene.floating_elements ?? []);
|
|
17514
17679
|
if (!floats.success) return;
|
|
17515
17680
|
for (const fe of floats.data) {
|
|
17516
17681
|
const at = fe.appears_at_s ?? sceneStart;
|
|
@@ -17896,8 +18061,8 @@ function buildMotionBoard(blueprint) {
|
|
|
17896
18061
|
const end_s = scene.end_s ?? start_s + sceneDurationS(scene);
|
|
17897
18062
|
cursor = end_s;
|
|
17898
18063
|
const spoken = sceneSpokenText(scene);
|
|
17899
|
-
const overlays =
|
|
17900
|
-
const floats =
|
|
18064
|
+
const overlays = z13.array(Overlay).safeParse(scene.overlays ?? []);
|
|
18065
|
+
const floats = z13.array(FloatingElement).safeParse(scene.floating_elements ?? []);
|
|
17901
18066
|
const graphics = [
|
|
17902
18067
|
...(overlays.success ? overlays.data : []).filter((ov) => ov.text?.trim()).map((ov) => ({
|
|
17903
18068
|
kind: "text",
|
|
@@ -23813,11 +23978,338 @@ var schemaCommand = defineCommand147({
|
|
|
23813
23978
|
}
|
|
23814
23979
|
});
|
|
23815
23980
|
|
|
23981
|
+
// src/commands/tags/index.ts
|
|
23982
|
+
import { defineCommand as defineCommand148 } from "citty";
|
|
23983
|
+
|
|
23984
|
+
// src/commands/tags/shared.ts
|
|
23985
|
+
function failValidation3(message) {
|
|
23986
|
+
writeJson({ ok: false, error: { code: "VALIDATION_ERROR", message } });
|
|
23987
|
+
process.exit(1);
|
|
23988
|
+
}
|
|
23989
|
+
function failApi3(err) {
|
|
23990
|
+
if (err instanceof ApiError) {
|
|
23991
|
+
writeJson({ ok: false, error: { code: err.code, message: err.message } });
|
|
23992
|
+
process.exit(1);
|
|
23993
|
+
}
|
|
23994
|
+
if (err instanceof Error) {
|
|
23995
|
+
writeJson({ ok: false, error: { code: "INTERNAL_ERROR", message: err.message } });
|
|
23996
|
+
process.exit(1);
|
|
23997
|
+
}
|
|
23998
|
+
writeJson({ ok: false, error: { code: "INTERNAL_ERROR", message: "Unexpected error" } });
|
|
23999
|
+
process.exit(1);
|
|
24000
|
+
}
|
|
24001
|
+
function parseTagType(value) {
|
|
24002
|
+
const parsed = tagTypeSchema.safeParse(value);
|
|
24003
|
+
if (!parsed.success) {
|
|
24004
|
+
failValidation3(`Unknown tag type "${value}". Valid types: ${TAG_TYPES.join(", ")}.`);
|
|
24005
|
+
}
|
|
24006
|
+
return parsed.data;
|
|
24007
|
+
}
|
|
24008
|
+
function toArray(value) {
|
|
24009
|
+
if (value === void 0 || typeof value === "boolean") {
|
|
24010
|
+
return [];
|
|
24011
|
+
}
|
|
24012
|
+
return Array.isArray(value) ? value : [value];
|
|
24013
|
+
}
|
|
24014
|
+
function parseSetArgs(value) {
|
|
24015
|
+
const config = {};
|
|
24016
|
+
for (const entry of toArray(value)) {
|
|
24017
|
+
const eq = entry.indexOf("=");
|
|
24018
|
+
if (eq <= 0) {
|
|
24019
|
+
failValidation3(`--set expects key=value, got "${entry}".`);
|
|
24020
|
+
}
|
|
24021
|
+
config[entry.slice(0, eq)] = entry.slice(eq + 1);
|
|
24022
|
+
}
|
|
24023
|
+
return config;
|
|
24024
|
+
}
|
|
24025
|
+
function parseListArg(value) {
|
|
24026
|
+
return toArray(value).flatMap(
|
|
24027
|
+
(entry) => entry.split(",").map((item) => item.trim()).filter((item) => item !== "")
|
|
24028
|
+
);
|
|
24029
|
+
}
|
|
24030
|
+
function rejectSecretSets(type, config) {
|
|
24031
|
+
const secretFields = TAG_SECRET_FIELDS[type];
|
|
24032
|
+
const offending = Object.keys(config).filter((key) => secretFields.includes(key));
|
|
24033
|
+
if (offending.length > 0) {
|
|
24034
|
+
failValidation3(
|
|
24035
|
+
`${offending.join(", ")} ${offending.length === 1 ? "is a secret field" : "are secret fields"} \u2014 never pass secret values on the command line. Re-run with --request-secret ${offending[0]} and the user will provide it via the secure tag form in the chat.`
|
|
24036
|
+
);
|
|
24037
|
+
}
|
|
24038
|
+
}
|
|
24039
|
+
function validateRequestSecrets(type, fields) {
|
|
24040
|
+
const requestable = TAG_REQUESTABLE_SECRET_FIELDS[type];
|
|
24041
|
+
const invalid = fields.filter((field) => !requestable.includes(field));
|
|
24042
|
+
if (invalid.length > 0) {
|
|
24043
|
+
failValidation3(
|
|
24044
|
+
`Cannot request ${invalid.join(", ")} for a ${type} tag. Requestable secret fields: ${requestable.length > 0 ? requestable.join(", ") : "(none \u2014 this type has no secret fields)"}.`
|
|
24045
|
+
);
|
|
24046
|
+
}
|
|
24047
|
+
}
|
|
24048
|
+
function renderEffectiveEntry(entry) {
|
|
24049
|
+
const parts = [entry.ref, entry.type];
|
|
24050
|
+
if (entry.identifier !== void 0) {
|
|
24051
|
+
parts.push(entry.identifier);
|
|
24052
|
+
}
|
|
24053
|
+
if (entry.staged !== void 0) {
|
|
24054
|
+
parts.push(`[staged: ${entry.staged}]`);
|
|
24055
|
+
}
|
|
24056
|
+
const secretBits = [
|
|
24057
|
+
...entry.secretsSet.map((field) => `${field} \u2713 set`),
|
|
24058
|
+
...entry.secretsPending.map((field) => `${field} \u23F3 pending`)
|
|
24059
|
+
];
|
|
24060
|
+
if (secretBits.length > 0) {
|
|
24061
|
+
parts.push(`[secrets: ${secretBits.join(", ")}]`);
|
|
24062
|
+
}
|
|
24063
|
+
return parts.join(" ");
|
|
24064
|
+
}
|
|
24065
|
+
|
|
24066
|
+
// src/commands/tags/index.ts
|
|
24067
|
+
registerSchema({
|
|
24068
|
+
command: "tags.list",
|
|
24069
|
+
description: "Effective marketing tags for this chat: production tags overlaid with the ops staged in this chat's draft. The printed refs (tag ids or tag_temp_*) are exactly what flow side-effect tagIds should reference.",
|
|
24070
|
+
args: {
|
|
24071
|
+
json: { type: "boolean", description: "Print the raw JSON envelope instead of the readable list", required: false }
|
|
24072
|
+
}
|
|
24073
|
+
});
|
|
24074
|
+
registerSchema({
|
|
24075
|
+
command: "tags.add",
|
|
24076
|
+
description: "Stage creation of a marketing tag (applies when the chat publishes). Set every non-secret field with --set; request secret fields (API keys, tokens, OAuth connections) with --request-secret \u2014 the user provides them via the secure tag form in the chat, never through the CLI.",
|
|
24077
|
+
args: {
|
|
24078
|
+
type: {
|
|
24079
|
+
type: "positional",
|
|
24080
|
+
description: "Tag type (see `baker tags list` output / meta, googleAnalytics, clarity, \u2026)",
|
|
24081
|
+
required: true
|
|
24082
|
+
},
|
|
24083
|
+
set: { type: "string", description: "Repeatable key=value for non-secret config fields", required: false },
|
|
24084
|
+
"request-secret": {
|
|
24085
|
+
type: "string",
|
|
24086
|
+
description: "Repeatable secret field name to request from the user",
|
|
24087
|
+
required: false
|
|
24088
|
+
}
|
|
24089
|
+
}
|
|
24090
|
+
});
|
|
24091
|
+
registerSchema({
|
|
24092
|
+
command: "tags.update",
|
|
24093
|
+
description: "Stage an update to a tag by ref (real tag id, or tag_temp_* to amend a create staged in this chat). --set patches fields, --clear removes them, --request-secret asks the user for secret values.",
|
|
24094
|
+
args: {
|
|
24095
|
+
ref: { type: "positional", description: "Tag ref from `baker tags list`", required: true },
|
|
24096
|
+
set: { type: "string", description: "Repeatable key=value for non-secret config fields", required: false },
|
|
24097
|
+
clear: { type: "string", description: "Repeatable field name to clear", required: false },
|
|
24098
|
+
"request-secret": {
|
|
24099
|
+
type: "string",
|
|
24100
|
+
description: "Repeatable secret field name to request from the user",
|
|
24101
|
+
required: false
|
|
24102
|
+
}
|
|
24103
|
+
}
|
|
24104
|
+
});
|
|
24105
|
+
registerSchema({
|
|
24106
|
+
command: "tags.remove",
|
|
24107
|
+
description: "Stage deletion of a tag by ref (applies on publish). Removing a tag_temp_* ref drops the staged create instead.",
|
|
24108
|
+
args: { ref: { type: "positional", description: "Tag ref from `baker tags list`", required: true } }
|
|
24109
|
+
});
|
|
24110
|
+
async function listTags(json) {
|
|
24111
|
+
try {
|
|
24112
|
+
const chatId = requireChatId();
|
|
24113
|
+
const response = await apiPost("/api/tags/list", { chatId });
|
|
24114
|
+
if (json) {
|
|
24115
|
+
writeJson({ ok: true, data: response });
|
|
24116
|
+
return;
|
|
24117
|
+
}
|
|
24118
|
+
if (response.tags.length === 0) {
|
|
24119
|
+
process.stdout.write("No tags configured. Stage one with `baker tags add <type> --set key=value`.\n");
|
|
24120
|
+
return;
|
|
24121
|
+
}
|
|
24122
|
+
process.stdout.write(`${response.tags.map(renderEffectiveEntry).join("\n")}
|
|
24123
|
+
`);
|
|
24124
|
+
} catch (err) {
|
|
24125
|
+
failApi3(err);
|
|
24126
|
+
}
|
|
24127
|
+
}
|
|
24128
|
+
var listCommand7 = defineCommand148({
|
|
24129
|
+
meta: {
|
|
24130
|
+
name: "list",
|
|
24131
|
+
description: "Effective tags for this chat (production + staged). Refs printed here are what flow side-effect tagIds should use. Example: baker tags list"
|
|
24132
|
+
},
|
|
24133
|
+
args: { json: { type: "boolean", description: "Print the raw JSON envelope instead of the readable list" } },
|
|
24134
|
+
run: async ({ args }) => {
|
|
24135
|
+
await listTags(args.json === true);
|
|
24136
|
+
}
|
|
24137
|
+
});
|
|
24138
|
+
async function stage(body) {
|
|
24139
|
+
try {
|
|
24140
|
+
const response = await apiPost("/api/tags/draft/stage", body);
|
|
24141
|
+
writeJson({ ok: true, data: response });
|
|
24142
|
+
} catch (err) {
|
|
24143
|
+
failApi3(err);
|
|
24144
|
+
}
|
|
24145
|
+
}
|
|
24146
|
+
var addCommand2 = defineCommand148({
|
|
24147
|
+
meta: {
|
|
24148
|
+
name: "add",
|
|
24149
|
+
description: "Stage a new tag (applies on publish). Secret fields are never passed here \u2014 use --request-secret and the user fills them in the chat's secure tag form. Example: baker tags add meta --set pixelId=123456 --request-secret accessToken"
|
|
24150
|
+
},
|
|
24151
|
+
args: {
|
|
24152
|
+
type: {
|
|
24153
|
+
type: "positional",
|
|
24154
|
+
description: "Tag type (meta, googleAnalytics, googleAds, clarity, \u2026)",
|
|
24155
|
+
required: true
|
|
24156
|
+
},
|
|
24157
|
+
set: { type: "string", description: "key=value for a non-secret config field (repeatable)" },
|
|
24158
|
+
"request-secret": { type: "string", description: "Secret field name the user should provide (repeatable)" }
|
|
24159
|
+
},
|
|
24160
|
+
run: async ({ args }) => {
|
|
24161
|
+
const type = parseTagType(args.type);
|
|
24162
|
+
const config = parseSetArgs(args.set);
|
|
24163
|
+
const requestSecrets = parseListArg(args["request-secret"]);
|
|
24164
|
+
rejectSecretSets(type, config);
|
|
24165
|
+
validateRequestSecrets(type, requestSecrets);
|
|
24166
|
+
const chatId = requireChatId();
|
|
24167
|
+
await stage({
|
|
24168
|
+
kind: "create",
|
|
24169
|
+
chatId,
|
|
24170
|
+
type,
|
|
24171
|
+
config,
|
|
24172
|
+
...requestSecrets.length > 0 ? { requestSecrets } : {}
|
|
24173
|
+
});
|
|
24174
|
+
}
|
|
24175
|
+
});
|
|
24176
|
+
var updateCommand3 = defineCommand148({
|
|
24177
|
+
meta: {
|
|
24178
|
+
name: "update",
|
|
24179
|
+
description: "Stage an update to a tag. A tag_temp_* ref amends the create staged in this chat. Example: baker tags update <ref> --set pixelId=999 --clear testEventCode"
|
|
24180
|
+
},
|
|
24181
|
+
args: {
|
|
24182
|
+
ref: { type: "positional", description: "Tag ref from `baker tags list`", required: true },
|
|
24183
|
+
set: { type: "string", description: "key=value patch for a non-secret config field (repeatable)" },
|
|
24184
|
+
clear: { type: "string", description: "Field name to clear (repeatable)" },
|
|
24185
|
+
"request-secret": { type: "string", description: "Secret field name the user should provide (repeatable)" }
|
|
24186
|
+
},
|
|
24187
|
+
run: async ({ args }) => {
|
|
24188
|
+
const config = parseSetArgs(args.set);
|
|
24189
|
+
const clearFields = parseListArg(args.clear);
|
|
24190
|
+
const requestSecrets = parseListArg(args["request-secret"]);
|
|
24191
|
+
if (Object.keys(config).length === 0 && clearFields.length === 0 && requestSecrets.length === 0) {
|
|
24192
|
+
failValidation3("Nothing to update \u2014 pass --set, --clear, or --request-secret.");
|
|
24193
|
+
}
|
|
24194
|
+
const chatId = requireChatId();
|
|
24195
|
+
await stage({
|
|
24196
|
+
kind: "update",
|
|
24197
|
+
chatId,
|
|
24198
|
+
ref: args.ref,
|
|
24199
|
+
...Object.keys(config).length > 0 ? { config } : {},
|
|
24200
|
+
...clearFields.length > 0 ? { clearFields } : {},
|
|
24201
|
+
...requestSecrets.length > 0 ? { requestSecrets } : {}
|
|
24202
|
+
});
|
|
24203
|
+
}
|
|
24204
|
+
});
|
|
24205
|
+
var removeCommand5 = defineCommand148({
|
|
24206
|
+
meta: {
|
|
24207
|
+
name: "remove",
|
|
24208
|
+
description: "Stage deletion of a tag (applies on publish). Removing a tag_temp_* ref drops the staged create instead. Example: baker tags remove <ref>"
|
|
24209
|
+
},
|
|
24210
|
+
args: { ref: { type: "positional", description: "Tag ref from `baker tags list`", required: true } },
|
|
24211
|
+
run: async ({ args }) => {
|
|
24212
|
+
const chatId = requireChatId();
|
|
24213
|
+
await stage({ kind: "delete", chatId, ref: args.ref });
|
|
24214
|
+
}
|
|
24215
|
+
});
|
|
24216
|
+
async function listDraft3() {
|
|
24217
|
+
try {
|
|
24218
|
+
const chatId = requireChatId();
|
|
24219
|
+
const response = await apiPost("/api/tags/draft", { chatId });
|
|
24220
|
+
writeJson({ ok: true, data: response });
|
|
24221
|
+
} catch (err) {
|
|
24222
|
+
failApi3(err);
|
|
24223
|
+
}
|
|
24224
|
+
}
|
|
24225
|
+
var draftListCommand = defineCommand148({
|
|
24226
|
+
meta: { name: "list", description: "Review the tag ops staged in this chat. Example: baker tags draft" },
|
|
24227
|
+
run: async () => {
|
|
24228
|
+
await listDraft3();
|
|
24229
|
+
}
|
|
24230
|
+
});
|
|
24231
|
+
var draftRemoveCommand = defineCommand148({
|
|
24232
|
+
meta: {
|
|
24233
|
+
name: "remove",
|
|
24234
|
+
description: "Drop one staged tag op by ref. Example: baker tags draft remove tag_temp_abc123"
|
|
24235
|
+
},
|
|
24236
|
+
args: { ref: { type: "positional", description: "Staged op ref", required: true } },
|
|
24237
|
+
run: async ({ args }) => {
|
|
24238
|
+
try {
|
|
24239
|
+
const chatId = requireChatId();
|
|
24240
|
+
const response = await apiPost("/api/tags/draft/remove", {
|
|
24241
|
+
chatId,
|
|
24242
|
+
ref: args.ref
|
|
24243
|
+
});
|
|
24244
|
+
writeJson({ ok: true, data: response });
|
|
24245
|
+
} catch (err) {
|
|
24246
|
+
failApi3(err);
|
|
24247
|
+
}
|
|
24248
|
+
}
|
|
24249
|
+
});
|
|
24250
|
+
var draftClearCommand = defineCommand148({
|
|
24251
|
+
meta: {
|
|
24252
|
+
name: "clear",
|
|
24253
|
+
description: "Drop ALL tag ops staged in this chat \u2014 nothing will apply on publish. Example: baker tags draft clear"
|
|
24254
|
+
},
|
|
24255
|
+
run: async () => {
|
|
24256
|
+
try {
|
|
24257
|
+
const chatId = requireChatId();
|
|
24258
|
+
const response = await apiPost("/api/tags/draft/clear", { chatId });
|
|
24259
|
+
writeJson({ ok: true, data: response });
|
|
24260
|
+
} catch (err) {
|
|
24261
|
+
failApi3(err);
|
|
24262
|
+
}
|
|
24263
|
+
}
|
|
24264
|
+
});
|
|
24265
|
+
var draftCommand3 = defineCommand148({
|
|
24266
|
+
meta: {
|
|
24267
|
+
name: "draft",
|
|
24268
|
+
description: "Review and edit the tag ops staged in this chat BEFORE publish. Subcommands: list (default), remove, clear. Ops never touch production tags until the chat is published."
|
|
24269
|
+
},
|
|
24270
|
+
subCommands: {
|
|
24271
|
+
list: draftListCommand,
|
|
24272
|
+
remove: draftRemoveCommand,
|
|
24273
|
+
clear: draftClearCommand
|
|
24274
|
+
},
|
|
24275
|
+
run: async () => {
|
|
24276
|
+
await listDraft3();
|
|
24277
|
+
}
|
|
24278
|
+
});
|
|
24279
|
+
var tagsCommand3 = defineCommand148({
|
|
24280
|
+
meta: {
|
|
24281
|
+
name: "tags",
|
|
24282
|
+
description: `Manage the client's marketing/analytics tags (Meta pixel, GA4, Google Ads, GTM, Clarity, Hotjar, \u2026) as per-chat STAGED changes \u2014 nothing touches production until the chat is published.
|
|
24283
|
+
|
|
24284
|
+
Secrets: secret fields (accessToken, apiSecret, authorizationToken, apiKey, conversionToken, oauthProviderId) are NEVER typed into chat or passed to this CLI. Stage with --request-secret <field>, then invoke the request_tag_input tool (baker_ui) so the user fills them in the dashboard's secure tag form.
|
|
24285
|
+
|
|
24286
|
+
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.
|
|
24287
|
+
|
|
24288
|
+
Examples:
|
|
24289
|
+
baker tags list # production + staged, with secret status
|
|
24290
|
+
baker tags add clarity --set projectId=abcde12345 # client-only tag, no secrets needed
|
|
24291
|
+
baker tags add meta --set pixelId=123 --request-secret accessToken
|
|
24292
|
+
baker tags update <ref> --set pixelId=999 --clear testEventCode
|
|
24293
|
+
baker tags remove <ref> # stage deletion (temp ref = drop the create)
|
|
24294
|
+
baker tags draft # review staged ops before finishing`
|
|
24295
|
+
},
|
|
24296
|
+
subCommands: {
|
|
24297
|
+
list: listCommand7,
|
|
24298
|
+
add: addCommand2,
|
|
24299
|
+
update: updateCommand3,
|
|
24300
|
+
remove: removeCommand5,
|
|
24301
|
+
draft: draftCommand3
|
|
24302
|
+
},
|
|
24303
|
+
run: async () => {
|
|
24304
|
+
await listTags(false);
|
|
24305
|
+
}
|
|
24306
|
+
});
|
|
24307
|
+
|
|
23816
24308
|
// src/commands/testimonials/index.ts
|
|
23817
|
-
import { defineCommand as
|
|
24309
|
+
import { defineCommand as defineCommand152 } from "citty";
|
|
23818
24310
|
|
|
23819
24311
|
// src/commands/testimonials/get.ts
|
|
23820
|
-
import { defineCommand as
|
|
24312
|
+
import { defineCommand as defineCommand149 } from "citty";
|
|
23821
24313
|
registerSchema({
|
|
23822
24314
|
command: "testimonials.get",
|
|
23823
24315
|
description: "Get a single testimonial by ID",
|
|
@@ -23825,7 +24317,7 @@ registerSchema({
|
|
|
23825
24317
|
id: { type: "string", description: "Testimonial ID", required: true }
|
|
23826
24318
|
}
|
|
23827
24319
|
});
|
|
23828
|
-
var getCommand4 =
|
|
24320
|
+
var getCommand4 = defineCommand149({
|
|
23829
24321
|
meta: { name: "get", description: "Get a single testimonial by ID. Example: baker testimonials get j571abc123" },
|
|
23830
24322
|
args: {
|
|
23831
24323
|
id: { type: "positional", description: "Testimonial ID", required: false },
|
|
@@ -23862,7 +24354,7 @@ var getCommand4 = defineCommand148({
|
|
|
23862
24354
|
});
|
|
23863
24355
|
|
|
23864
24356
|
// src/commands/testimonials/list.ts
|
|
23865
|
-
import { defineCommand as
|
|
24357
|
+
import { defineCommand as defineCommand150 } from "citty";
|
|
23866
24358
|
registerSchema({
|
|
23867
24359
|
command: "testimonials.list",
|
|
23868
24360
|
description: "List testimonials with optional filters.",
|
|
@@ -23892,7 +24384,7 @@ registerSchema({
|
|
|
23892
24384
|
limit: { type: "number", description: "Max results (default 50)", required: false, default: 50 }
|
|
23893
24385
|
}
|
|
23894
24386
|
});
|
|
23895
|
-
var
|
|
24387
|
+
var listCommand8 = defineCommand150({
|
|
23896
24388
|
meta: {
|
|
23897
24389
|
name: "list",
|
|
23898
24390
|
description: "List testimonials with optional filters. Example: baker testimonials list --source google --sentiment positive"
|
|
@@ -23941,7 +24433,7 @@ var listCommand7 = defineCommand149({
|
|
|
23941
24433
|
});
|
|
23942
24434
|
|
|
23943
24435
|
// src/commands/testimonials/search.ts
|
|
23944
|
-
import { defineCommand as
|
|
24436
|
+
import { defineCommand as defineCommand151 } from "citty";
|
|
23945
24437
|
registerSchema({
|
|
23946
24438
|
command: "testimonials.search",
|
|
23947
24439
|
description: "Search testimonials by text query. Uses hybrid BM25 + vector + reranking.",
|
|
@@ -23972,7 +24464,7 @@ registerSchema({
|
|
|
23972
24464
|
tags: { type: "string", description: "Comma-separated tags to filter by", required: false }
|
|
23973
24465
|
}
|
|
23974
24466
|
});
|
|
23975
|
-
var searchCommand2 =
|
|
24467
|
+
var searchCommand2 = defineCommand151({
|
|
23976
24468
|
meta: {
|
|
23977
24469
|
name: "search",
|
|
23978
24470
|
description: "Semantic search testimonials by text query. Uses hybrid BM25 + vector + reranking. Example: baker testimonials search 'great service' --rating-min 4"
|
|
@@ -24043,10 +24535,10 @@ var searchCommand2 = defineCommand150({
|
|
|
24043
24535
|
});
|
|
24044
24536
|
|
|
24045
24537
|
// src/commands/testimonials/tags.ts
|
|
24046
|
-
var
|
|
24538
|
+
var tagsCommand4 = makeTagsCommand("testimonials", "testimonial", "/api/testimonials/tags");
|
|
24047
24539
|
|
|
24048
24540
|
// src/commands/testimonials/index.ts
|
|
24049
|
-
var testimonialsCommand =
|
|
24541
|
+
var testimonialsCommand = defineCommand152({
|
|
24050
24542
|
meta: {
|
|
24051
24543
|
name: "testimonials",
|
|
24052
24544
|
description: `Find and browse testimonials in Baker. Subcommands: search, get, list, tags.
|
|
@@ -24061,16 +24553,16 @@ Examples:
|
|
|
24061
24553
|
subCommands: {
|
|
24062
24554
|
get: getCommand4,
|
|
24063
24555
|
search: searchCommand2,
|
|
24064
|
-
list:
|
|
24065
|
-
tags:
|
|
24556
|
+
list: listCommand8,
|
|
24557
|
+
tags: tagsCommand4
|
|
24066
24558
|
}
|
|
24067
24559
|
});
|
|
24068
24560
|
|
|
24069
24561
|
// src/commands/videos/index.ts
|
|
24070
|
-
import { defineCommand as
|
|
24562
|
+
import { defineCommand as defineCommand157 } from "citty";
|
|
24071
24563
|
|
|
24072
24564
|
// src/commands/videos/delete.ts
|
|
24073
|
-
import { defineCommand as
|
|
24565
|
+
import { defineCommand as defineCommand153 } from "citty";
|
|
24074
24566
|
registerSchema({
|
|
24075
24567
|
command: "videos.delete",
|
|
24076
24568
|
description: "Delete a video by ID",
|
|
@@ -24084,7 +24576,7 @@ registerSchema({
|
|
|
24084
24576
|
}
|
|
24085
24577
|
}
|
|
24086
24578
|
});
|
|
24087
|
-
var deleteCommand3 =
|
|
24579
|
+
var deleteCommand3 = defineCommand153({
|
|
24088
24580
|
meta: {
|
|
24089
24581
|
name: "delete",
|
|
24090
24582
|
description: "Delete a video by ID. Use --dry-run to preview. Example: baker videos delete j571abc123 --dry-run"
|
|
@@ -24125,7 +24617,7 @@ var deleteCommand3 = defineCommand152({
|
|
|
24125
24617
|
});
|
|
24126
24618
|
|
|
24127
24619
|
// src/commands/videos/get.ts
|
|
24128
|
-
import { defineCommand as
|
|
24620
|
+
import { defineCommand as defineCommand154 } from "citty";
|
|
24129
24621
|
registerSchema({
|
|
24130
24622
|
command: "videos.get",
|
|
24131
24623
|
description: "Get a single video by ID",
|
|
@@ -24133,7 +24625,7 @@ registerSchema({
|
|
|
24133
24625
|
id: { type: "string", description: "Video ID", required: true }
|
|
24134
24626
|
}
|
|
24135
24627
|
});
|
|
24136
|
-
var getCommand5 =
|
|
24628
|
+
var getCommand5 = defineCommand154({
|
|
24137
24629
|
meta: { name: "get", description: "Get a single video by ID. Example: baker videos get j571abc123" },
|
|
24138
24630
|
args: {
|
|
24139
24631
|
id: { type: "positional", description: "Video ID", required: false },
|
|
@@ -24170,7 +24662,7 @@ var getCommand5 = defineCommand153({
|
|
|
24170
24662
|
});
|
|
24171
24663
|
|
|
24172
24664
|
// src/commands/videos/search.ts
|
|
24173
|
-
import { defineCommand as
|
|
24665
|
+
import { defineCommand as defineCommand155 } from "citty";
|
|
24174
24666
|
registerSchema({
|
|
24175
24667
|
command: "videos.search",
|
|
24176
24668
|
description: "Search videos by text query. Only returns ready videos.",
|
|
@@ -24180,7 +24672,7 @@ registerSchema({
|
|
|
24180
24672
|
tags: { type: "string", description: "Comma-separated tags to filter by", required: false }
|
|
24181
24673
|
}
|
|
24182
24674
|
});
|
|
24183
|
-
var searchCommand3 =
|
|
24675
|
+
var searchCommand3 = defineCommand155({
|
|
24184
24676
|
meta: {
|
|
24185
24677
|
name: "search",
|
|
24186
24678
|
description: "Semantic search videos by text query. Uses hybrid BM25 + vector + reranking. Example: baker videos search 'product demo' --tags tutorial"
|
|
@@ -24227,12 +24719,12 @@ var searchCommand3 = defineCommand154({
|
|
|
24227
24719
|
});
|
|
24228
24720
|
|
|
24229
24721
|
// src/commands/videos/tags.ts
|
|
24230
|
-
var
|
|
24722
|
+
var tagsCommand5 = makeTagsCommand("videos", "video", "/api/videos/tags");
|
|
24231
24723
|
|
|
24232
24724
|
// src/commands/videos/upload.ts
|
|
24233
24725
|
import { readFile as readFile12, stat as stat3 } from "fs/promises";
|
|
24234
24726
|
import { extname as extname3 } from "path";
|
|
24235
|
-
import { defineCommand as
|
|
24727
|
+
import { defineCommand as defineCommand156 } from "citty";
|
|
24236
24728
|
var MIME_MAP = {
|
|
24237
24729
|
".mp4": "video/mp4",
|
|
24238
24730
|
".mov": "video/quicktime",
|
|
@@ -24266,7 +24758,7 @@ function detectContentType(filePath) {
|
|
|
24266
24758
|
}
|
|
24267
24759
|
return mime;
|
|
24268
24760
|
}
|
|
24269
|
-
var uploadCommand2 =
|
|
24761
|
+
var uploadCommand2 = defineCommand156({
|
|
24270
24762
|
meta: {
|
|
24271
24763
|
name: "upload",
|
|
24272
24764
|
description: "Upload a video file to Baker via Mux direct upload. Auto-detects content type. Example: baker videos upload ./demo.mp4"
|
|
@@ -24320,7 +24812,7 @@ var uploadCommand2 = defineCommand155({
|
|
|
24320
24812
|
});
|
|
24321
24813
|
|
|
24322
24814
|
// src/commands/videos/index.ts
|
|
24323
|
-
var videosCommand =
|
|
24815
|
+
var videosCommand = defineCommand157({
|
|
24324
24816
|
meta: {
|
|
24325
24817
|
name: "videos",
|
|
24326
24818
|
description: `Find and manage videos in Baker. Subcommands: search, get, upload, delete, tags.
|
|
@@ -24338,15 +24830,15 @@ Examples:
|
|
|
24338
24830
|
search: searchCommand3,
|
|
24339
24831
|
upload: uploadCommand2,
|
|
24340
24832
|
delete: deleteCommand3,
|
|
24341
|
-
tags:
|
|
24833
|
+
tags: tagsCommand5
|
|
24342
24834
|
}
|
|
24343
24835
|
});
|
|
24344
24836
|
|
|
24345
24837
|
// src/commands/winning-ads/index.ts
|
|
24346
|
-
import { defineCommand as
|
|
24838
|
+
import { defineCommand as defineCommand160 } from "citty";
|
|
24347
24839
|
|
|
24348
24840
|
// src/commands/winning-ads/advertisers.ts
|
|
24349
|
-
import { defineCommand as
|
|
24841
|
+
import { defineCommand as defineCommand158 } from "citty";
|
|
24350
24842
|
registerSchema({
|
|
24351
24843
|
command: "winning-ads.advertisers",
|
|
24352
24844
|
description: "Resolve a brand name to advertiser_id(s) in the ad-dna corpus \u2014 to find your OWN advertiser (to --exclude-advertiser) or a competitor (to --advertiser-id).",
|
|
@@ -24359,7 +24851,7 @@ registerSchema({
|
|
|
24359
24851
|
function identity(record) {
|
|
24360
24852
|
return record;
|
|
24361
24853
|
}
|
|
24362
|
-
var advertisersCommand2 =
|
|
24854
|
+
var advertisersCommand2 = defineCommand158({
|
|
24363
24855
|
meta: {
|
|
24364
24856
|
name: "advertisers",
|
|
24365
24857
|
description: 'Resolve a brand name to advertiser_id(s). Use it to find your own advertiser for --exclude-advertiser, or a competitor for --advertiser-id. Example: baker winning-ads advertisers "Deel" --output md'
|
|
@@ -24410,7 +24902,7 @@ var advertisersCommand2 = defineCommand157({
|
|
|
24410
24902
|
});
|
|
24411
24903
|
|
|
24412
24904
|
// src/commands/winning-ads/search.ts
|
|
24413
|
-
import { defineCommand as
|
|
24905
|
+
import { defineCommand as defineCommand159 } from "citty";
|
|
24414
24906
|
registerSchema({
|
|
24415
24907
|
command: "winning-ads.search",
|
|
24416
24908
|
description: "Search the ad-dna corpus of scored winning ads. Returns a lean shortlist (advertiser, summary, scores, media_url) to pick a reference to reproduce.",
|
|
@@ -24518,7 +25010,7 @@ function buildSearchBody(args) {
|
|
|
24518
25010
|
}
|
|
24519
25011
|
return body;
|
|
24520
25012
|
}
|
|
24521
|
-
var searchCommand4 =
|
|
25013
|
+
var searchCommand4 = defineCommand159({
|
|
24522
25014
|
meta: {
|
|
24523
25015
|
name: "search",
|
|
24524
25016
|
description: "Search winning reference ads. Example: baker winning-ads search 'B2B SaaS before/after AI automation' --platform meta --format static --winner-category winner --exclude-advertiser adv_123 --output md"
|
|
@@ -24630,7 +25122,7 @@ var searchCommand4 = defineCommand158({
|
|
|
24630
25122
|
});
|
|
24631
25123
|
|
|
24632
25124
|
// src/commands/winning-ads/index.ts
|
|
24633
|
-
var winningAdsCommand =
|
|
25125
|
+
var winningAdsCommand = defineCommand160({
|
|
24634
25126
|
meta: {
|
|
24635
25127
|
name: "winning-ads",
|
|
24636
25128
|
description: `Search the ad-dna corpus of scored "winning" ads for reference creatives to reproduce. Proxied through the Baker backend (BAKER_API_KEY) \u2014 no separate token needed.
|
|
@@ -24670,11 +25162,11 @@ function getCliVersion() {
|
|
|
24670
25162
|
}
|
|
24671
25163
|
|
|
24672
25164
|
// src/cli.ts
|
|
24673
|
-
var main =
|
|
25165
|
+
var main = defineCommand161({
|
|
24674
25166
|
meta: {
|
|
24675
25167
|
name: "baker",
|
|
24676
25168
|
version: getCliVersion(),
|
|
24677
|
-
description: `AI-agent CLI for finding and managing images, videos, testimonials, action items, scheduled actions, and ad platform data in Baker.
|
|
25169
|
+
description: `AI-agent CLI for finding and managing images, videos, testimonials, action items, scheduled actions, marketing tags, and ad platform data in Baker.
|
|
24678
25170
|
|
|
24679
25171
|
Auth: Set BAKER_API_KEY (starts with bk_) and BAKER_API_URL environment variables.
|
|
24680
25172
|
Chat: Set BAKER_CHAT_ID for action and scheduled-action commands that stage changes against a chat.
|
|
@@ -24694,6 +25186,7 @@ Introspection: Run 'baker schema <command>' to inspect argument schemas.`
|
|
|
24694
25186
|
videos: videosCommand,
|
|
24695
25187
|
testimonials: testimonialsCommand,
|
|
24696
25188
|
canvas: canvasCommand,
|
|
25189
|
+
tags: tagsCommand3,
|
|
24697
25190
|
"winning-ads": winningAdsCommand,
|
|
24698
25191
|
mcp: mcpCommand,
|
|
24699
25192
|
schema: schemaCommand
|