post-engineer-mcp 1.52.671 → 1.53.662
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 +1 -2
- package/dist/account-shapes.d.ts +2 -0
- package/dist/account-shapes.js +0 -12
- package/dist/account-shapes.js.map +1 -1
- package/dist/action-tool.d.ts +0 -15
- package/dist/action-tool.js +0 -15
- package/dist/action-tool.js.map +1 -1
- package/dist/analytics.js +0 -39
- package/dist/analytics.js.map +1 -1
- package/dist/client-base-url.d.ts +2 -0
- package/dist/client-base-url.js +23 -0
- package/dist/client-base-url.js.map +1 -0
- package/dist/client-batch.js.map +1 -1
- package/dist/client-billing.js +0 -11
- package/dist/client-billing.js.map +1 -1
- package/dist/client-experiments.js +0 -9
- package/dist/client-experiments.js.map +1 -1
- package/dist/client-posts.js +0 -7
- package/dist/client-posts.js.map +1 -1
- package/dist/client-prompts.js +0 -2
- package/dist/client-prompts.js.map +1 -1
- package/dist/client-publish-existing.js +0 -13
- package/dist/client-publish-existing.js.map +1 -1
- package/dist/client-publish-uploaded.d.ts +0 -5
- package/dist/client-publish-uploaded.js +0 -48
- package/dist/client-publish-uploaded.js.map +1 -1
- package/dist/client-publishing-accounts.js +0 -7
- package/dist/client-publishing-accounts.js.map +1 -1
- package/dist/client-telegram.d.ts +4 -0
- package/dist/client-telegram.js +13 -0
- package/dist/client-telegram.js.map +1 -0
- package/dist/client-tool-config.js +0 -7
- package/dist/client-tool-config.js.map +1 -1
- package/dist/client-types.d.ts +11 -87
- package/dist/client-user-media.d.ts +0 -28
- package/dist/client-user-media.js +0 -42
- package/dist/client-user-media.js.map +1 -1
- package/dist/client-video-task.js +0 -5
- package/dist/client-video-task.js.map +1 -1
- package/dist/client.js +6 -119
- package/dist/client.js.map +1 -1
- package/dist/cloned-voice-client.d.ts +0 -8
- package/dist/cloned-voice-client.js +0 -49
- package/dist/cloned-voice-client.js.map +1 -1
- package/dist/cloned-voice-tools.d.ts +0 -5
- package/dist/cloned-voice-tools.js +0 -7
- package/dist/cloned-voice-tools.js.map +1 -1
- package/dist/connect-account.d.ts +14 -0
- package/dist/connect-account.js +47 -26
- package/dist/connect-account.js.map +1 -1
- package/dist/contract-response.js +0 -12
- package/dist/contract-response.js.map +1 -1
- package/dist/contracts/accounts.d.ts +114 -11
- package/dist/contracts/accounts.js +32 -56
- package/dist/contracts/accounts.js.map +1 -1
- package/dist/contracts/billing.d.ts +0 -14
- package/dist/contracts/billing.js +0 -26
- package/dist/contracts/billing.js.map +1 -1
- package/dist/contracts/endpoint.d.ts +0 -11
- package/dist/contracts/endpoint.js +0 -4
- package/dist/contracts/endpoint.js.map +1 -1
- package/dist/contracts/experiments.d.ts +0 -20
- package/dist/contracts/experiments.js +0 -34
- package/dist/contracts/experiments.js.map +1 -1
- package/dist/contracts/media.d.ts +0 -19
- package/dist/contracts/media.js +0 -58
- package/dist/contracts/media.js.map +1 -1
- package/dist/contracts/metrics.d.ts +6 -15
- package/dist/contracts/metrics.js +0 -74
- package/dist/contracts/metrics.js.map +1 -1
- package/dist/contracts/personas.d.ts +98 -19
- package/dist/contracts/personas.js +24 -93
- package/dist/contracts/personas.js.map +1 -1
- package/dist/contracts/posts.d.ts +9 -11
- package/dist/contracts/posts.js +1 -17
- package/dist/contracts/posts.js.map +1 -1
- package/dist/contracts/prompts.d.ts +0 -11
- package/dist/contracts/prompts.js +0 -15
- package/dist/contracts/prompts.js.map +1 -1
- package/dist/contracts/providers.d.ts +4 -17
- package/dist/contracts/providers.js +5 -30
- package/dist/contracts/providers.js.map +1 -1
- package/dist/contracts/schedule-warnings.d.ts +2 -0
- package/dist/contracts/schedule-warnings.js +0 -3
- package/dist/contracts/schedule-warnings.js.map +1 -1
- package/dist/contracts/schedule.d.ts +7 -14
- package/dist/contracts/schedule.js +1 -46
- package/dist/contracts/schedule.js.map +1 -1
- package/dist/contracts/tool-config.d.ts +0 -11
- package/dist/contracts/tool-config.js +0 -26
- package/dist/contracts/tool-config.js.map +1 -1
- package/dist/contracts/upload-types.d.ts +0 -3
- package/dist/contracts/upload-types.js +0 -10
- package/dist/contracts/upload-types.js.map +1 -1
- package/dist/contracts/video-tasks.d.ts +0 -23
- package/dist/contracts/video-tasks.js +0 -42
- package/dist/contracts/video-tasks.js.map +1 -1
- package/dist/contracts/videos.d.ts +40 -38
- package/dist/contracts/videos.js +3 -137
- package/dist/contracts/videos.js.map +1 -1
- package/dist/contracts/voices.d.ts +0 -24
- package/dist/contracts/voices.js +0 -34
- package/dist/contracts/voices.js.map +1 -1
- package/dist/direct-publish-form.js +0 -15
- package/dist/direct-publish-form.js.map +1 -1
- package/dist/direct-publish-narrowing.js +0 -5
- package/dist/direct-publish-narrowing.js.map +1 -1
- package/dist/errors.d.ts +0 -35
- package/dist/errors.js +0 -48
- package/dist/errors.js.map +1 -1
- package/dist/generate-video.d.ts +48 -4
- package/dist/generate-video.js +2 -6
- package/dist/generate-video.js.map +1 -1
- package/dist/http-auth.d.ts +0 -1
- package/dist/http-auth.js +0 -37
- package/dist/http-auth.js.map +1 -1
- package/dist/http-rate-limit.d.ts +0 -1
- package/dist/http-rate-limit.js +0 -18
- package/dist/http-rate-limit.js.map +1 -1
- package/dist/http-transport.js +0 -95
- package/dist/http-transport.js.map +1 -1
- package/dist/http-web.js +0 -16
- package/dist/http-web.js.map +1 -1
- package/dist/image-guards.d.ts +0 -4
- package/dist/image-guards.js +0 -11
- package/dist/image-guards.js.map +1 -1
- package/dist/index.js +0 -20
- package/dist/index.js.map +1 -1
- package/dist/intent-accounts.js +1 -6
- package/dist/intent-accounts.js.map +1 -1
- package/dist/intent-content.js +0 -7
- package/dist/intent-content.js.map +1 -1
- package/dist/intent-library.js +0 -4
- package/dist/intent-library.js.map +1 -1
- package/dist/intent-personas.js +0 -10
- package/dist/intent-personas.js.map +1 -1
- package/dist/intent-tool-config.js +0 -5
- package/dist/intent-tool-config.js.map +1 -1
- package/dist/intent-video.js +0 -5
- package/dist/intent-video.js.map +1 -1
- package/dist/intent-voices.js +0 -6
- package/dist/intent-voices.js.map +1 -1
- package/dist/language.d.ts +0 -8
- package/dist/language.js +0 -11
- package/dist/language.js.map +1 -1
- package/dist/limits.d.ts +1 -79
- package/dist/limits.js +1 -79
- package/dist/limits.js.map +1 -1
- package/dist/music-mood-field.js +0 -25
- package/dist/music-mood-field.js.map +1 -1
- package/dist/persona-avatar.d.ts +0 -13
- package/dist/persona-avatar.js +0 -40
- package/dist/persona-avatar.js.map +1 -1
- package/dist/persona-create.d.ts +96 -0
- package/dist/persona-create.js +39 -0
- package/dist/persona-create.js.map +1 -0
- package/dist/persona-cta-shape.d.ts +16 -0
- package/dist/persona-cta-shape.js +45 -0
- package/dist/persona-cta-shape.js.map +1 -0
- package/dist/persona-delete.js +0 -1
- package/dist/persona-delete.js.map +1 -1
- package/dist/persona-update.d.ts +26 -0
- package/dist/persona-update.js +2 -6
- package/dist/persona-update.js.map +1 -1
- package/dist/progress-poll-hint.d.ts +0 -6
- package/dist/progress-poll-hint.js +0 -15
- package/dist/progress-poll-hint.js.map +1 -1
- package/dist/prompts.js +0 -12
- package/dist/prompts.js.map +1 -1
- package/dist/public-ip.js +25 -58
- package/dist/public-ip.js.map +1 -1
- package/dist/publish-direct-shape.d.ts +2 -0
- package/dist/publish-direct-shape.js +0 -4
- package/dist/publish-direct-shape.js.map +1 -1
- package/dist/publish-existing-shape.d.ts +0 -7
- package/dist/publish-existing-shape.js +0 -26
- package/dist/publish-existing-shape.js.map +1 -1
- package/dist/publish-notices.js +0 -2
- package/dist/publish-notices.js.map +1 -1
- package/dist/publish-uploaded-shape.d.ts +2 -0
- package/dist/publish-uploaded-shape.js +0 -7
- package/dist/publish-uploaded-shape.js.map +1 -1
- package/dist/recipe-session.d.ts +0 -4
- package/dist/recipe-session.js +0 -17
- package/dist/recipe-session.js.map +1 -1
- package/dist/refs.d.ts +0 -11
- package/dist/refs.js +1 -15
- package/dist/refs.js.map +1 -1
- package/dist/remote-shapes.d.ts +52 -2
- package/dist/remote-shapes.js +2 -16
- package/dist/remote-shapes.js.map +1 -1
- package/dist/require-api-key.js +0 -2
- package/dist/require-api-key.js.map +1 -1
- package/dist/require-publishing-accounts.js +0 -7
- package/dist/require-publishing-accounts.js.map +1 -1
- package/dist/require-title.js +0 -4
- package/dist/require-title.js.map +1 -1
- package/dist/schedule-shapes.js +0 -19
- package/dist/schedule-shapes.js.map +1 -1
- package/dist/script-segments.d.ts +1 -5
- package/dist/script-segments.js +1 -54
- package/dist/script-segments.js.map +1 -1
- package/dist/secret-redaction.js +0 -4
- package/dist/secret-redaction.js.map +1 -1
- package/dist/segment-media.js +0 -22
- package/dist/segment-media.js.map +1 -1
- package/dist/segment-text.js +0 -18
- package/dist/segment-text.js.map +1 -1
- package/dist/single-video-shape.d.ts +35 -1
- package/dist/single-video-shape.js +7 -18
- package/dist/single-video-shape.js.map +1 -1
- package/dist/slot-detail-present.d.ts +67 -0
- package/dist/slot-detail-present.js +47 -0
- package/dist/slot-detail-present.js.map +1 -0
- package/dist/tool-annotations.js.map +1 -1
- package/dist/tools-batch.d.ts +51 -3
- package/dist/tools-batch.js +0 -17
- package/dist/tools-batch.js.map +1 -1
- package/dist/tools-call.d.ts +0 -1
- package/dist/tools-call.js +0 -1
- package/dist/tools-call.js.map +1 -1
- package/dist/tools-experiments.d.ts +6 -3
- package/dist/tools-experiments.js +1 -31
- package/dist/tools-experiments.js.map +1 -1
- package/dist/tools-list-stats.d.ts +0 -4
- package/dist/tools-list-stats.js +0 -5
- package/dist/tools-list-stats.js.map +1 -1
- package/dist/tools-pinterest.js +0 -10
- package/dist/tools-pinterest.js.map +1 -1
- package/dist/tools-posts.d.ts +2 -0
- package/dist/tools-posts.js +0 -9
- package/dist/tools-posts.js.map +1 -1
- package/dist/tools-prompts.js +0 -23
- package/dist/tools-prompts.js.map +1 -1
- package/dist/tools-publish-existing.js +0 -17
- package/dist/tools-publish-existing.js.map +1 -1
- package/dist/tools-publish-uploaded.js +0 -8
- package/dist/tools-publish-uploaded.js.map +1 -1
- package/dist/tools-publishing-accounts.js +1 -11
- package/dist/tools-publishing-accounts.js.map +1 -1
- package/dist/tools-single-video.d.ts +2 -4
- package/dist/tools-single-video.js +2 -55
- package/dist/tools-single-video.js.map +1 -1
- package/dist/tools-tool-config.js +0 -13
- package/dist/tools-tool-config.js.map +1 -1
- package/dist/tools-user-media.js +0 -5
- package/dist/tools-user-media.js.map +1 -1
- package/dist/tools.d.ts +2 -76
- package/dist/tools.js +5 -131
- package/dist/tools.js.map +1 -1
- package/dist/video-task-tools.d.ts +0 -2
- package/dist/video-task-tools.js +0 -43
- package/dist/video-task-tools.js.map +1 -1
- package/dist/video-type.d.ts +0 -10
- package/dist/video-type.js +0 -17
- package/dist/video-type.js.map +1 -1
- package/dist/voice-filters.d.ts +0 -27
- package/dist/voice-filters.js +0 -62
- package/dist/voice-filters.js.map +1 -1
- package/package.json +1 -1
|
@@ -7,10 +7,6 @@ export interface EndpointDefinition<Body extends z.ZodType | undefined, Query ex
|
|
|
7
7
|
query?: Query;
|
|
8
8
|
response: Response;
|
|
9
9
|
}
|
|
10
|
-
/** Define one endpoint contract. The literal path is preserved in the type
|
|
11
|
-
* so ParamsOf can read its `:param` segments. `Body`/`Query` default to
|
|
12
|
-
* `undefined` so an omitted optional schema stays `undefined` (not the
|
|
13
|
-
* bare `ZodType`) in the returned definition. */
|
|
14
10
|
export declare function defineEndpoint<Body extends z.ZodType | undefined = undefined, Query extends z.ZodType | undefined = undefined, Response extends z.ZodType = z.ZodType, Path extends string = string>(config: {
|
|
15
11
|
method: EndpointMethod;
|
|
16
12
|
path: Path;
|
|
@@ -18,26 +14,19 @@ export declare function defineEndpoint<Body extends z.ZodType | undefined = unde
|
|
|
18
14
|
query?: Query;
|
|
19
15
|
response: Response;
|
|
20
16
|
}): EndpointDefinition<Body, Query, Response, Path>;
|
|
21
|
-
/** Request body input type (`z.input` of the `body` schema). Indexed
|
|
22
|
-
* access is used (not infer) so an optional `body?` property keeps its
|
|
23
|
-
* schema type instead of widening to `unknown`. */
|
|
24
17
|
export type BodyOf<Endpoint extends {
|
|
25
18
|
body?: z.ZodType | undefined;
|
|
26
19
|
}> = [
|
|
27
20
|
Exclude<Endpoint['body'], undefined>
|
|
28
21
|
] extends [never] ? never : Exclude<Endpoint['body'], undefined> extends z.ZodType ? z.input<Exclude<Endpoint['body'], undefined>> : never;
|
|
29
|
-
/** Query input type (`z.input` of the `query` schema). */
|
|
30
22
|
export type QueryOf<Endpoint extends {
|
|
31
23
|
query?: z.ZodType | undefined;
|
|
32
24
|
}> = [
|
|
33
25
|
Exclude<Endpoint['query'], undefined>
|
|
34
26
|
] extends [never] ? never : Exclude<Endpoint['query'], undefined> extends z.ZodType ? z.input<Exclude<Endpoint['query'], undefined>> : never;
|
|
35
|
-
/** Response output type (`z.output` of the `response` schema). */
|
|
36
27
|
export type ResponseOf<Endpoint extends {
|
|
37
28
|
response: z.ZodType;
|
|
38
29
|
}> = Endpoint['response'] extends z.ZodType ? z.output<Endpoint['response']> : never;
|
|
39
|
-
/** Path params from a path template: each `:name` segment becomes a
|
|
40
|
-
* `string` field. A path without segments is an empty record. */
|
|
41
30
|
export type ParamsOf<Path extends string> = Path extends `${string}:${infer Rest}` ? Rest extends `${infer Name}/${infer After}` ? {
|
|
42
31
|
[Key in Name]: string;
|
|
43
32
|
} & ParamsOf<`/${After}`> : {
|
|
@@ -48,8 +37,6 @@ import { METRICS_WINDOWS, type MetricsWindow } from './experiments.js';
|
|
|
48
37
|
export { METRICS_WINDOWS };
|
|
49
38
|
export declare const METRICS_NONE = "^@none";
|
|
50
39
|
export declare const METRICS_FILTER_MAX_LENGTH = 200;
|
|
51
|
-
/** YouTube video id (11 chars, base64url). Mirrors
|
|
52
|
-
* apps/web/lib/youtube-analytics.ts (VIDEO_ID). */
|
|
53
40
|
export declare const YOUTUBE_VIDEO_ID: RegExp;
|
|
54
41
|
export declare const ANALYTICS_STATUSES: readonly ["ok", "scope_missing", "not_owned", "no_data"];
|
|
55
42
|
export type AnalyticsStatus = (typeof ANALYTICS_STATUSES)[number];
|
|
@@ -75,8 +62,6 @@ type MetricsParseResult = {
|
|
|
75
62
|
};
|
|
76
63
|
export declare function parseMetricsQuery(params: URLSearchParams): MetricsParseResult;
|
|
77
64
|
export declare function metricsSearchParams(query: MetricsQuery): URLSearchParams;
|
|
78
|
-
/** `?account=&video=` for the retention-curve read: each exactly once,
|
|
79
|
-
* a non-empty account within the filter length, a YouTube video id. */
|
|
80
65
|
export declare function parseRetentionCurveQuery(params: URLSearchParams): {
|
|
81
66
|
account: string;
|
|
82
67
|
video: string;
|
|
@@ -108,6 +93,7 @@ export declare const MetricsRowSchema: z.ZodObject<{
|
|
|
108
93
|
"3speak": "3speak";
|
|
109
94
|
rumble: "rumble";
|
|
110
95
|
fanvue: "fanvue";
|
|
96
|
+
telegram: "telegram";
|
|
111
97
|
}>;
|
|
112
98
|
accountId: z.ZodString;
|
|
113
99
|
externalId: z.ZodString;
|
|
@@ -147,6 +133,7 @@ export declare const CoverageItemSchema: z.ZodObject<{
|
|
|
147
133
|
"3speak": "3speak";
|
|
148
134
|
rumble: "rumble";
|
|
149
135
|
fanvue: "fanvue";
|
|
136
|
+
telegram: "telegram";
|
|
150
137
|
}>;
|
|
151
138
|
accountId: z.ZodString;
|
|
152
139
|
externalId: z.ZodNullable<z.ZodString>;
|
|
@@ -179,6 +166,7 @@ export declare const MetricsResponseSchema: z.ZodObject<{
|
|
|
179
166
|
"3speak": "3speak";
|
|
180
167
|
rumble: "rumble";
|
|
181
168
|
fanvue: "fanvue";
|
|
169
|
+
telegram: "telegram";
|
|
182
170
|
}>;
|
|
183
171
|
accountId: z.ZodString;
|
|
184
172
|
externalId: z.ZodString;
|
|
@@ -218,6 +206,7 @@ export declare const MetricsResponseSchema: z.ZodObject<{
|
|
|
218
206
|
"3speak": "3speak";
|
|
219
207
|
rumble: "rumble";
|
|
220
208
|
fanvue: "fanvue";
|
|
209
|
+
telegram: "telegram";
|
|
221
210
|
}>;
|
|
222
211
|
accountId: z.ZodString;
|
|
223
212
|
externalId: z.ZodNullable<z.ZodString>;
|
|
@@ -277,6 +266,7 @@ export declare const listMetrics: EndpointDefinition<undefined, z.ZodObject<{
|
|
|
277
266
|
"3speak": "3speak";
|
|
278
267
|
rumble: "rumble";
|
|
279
268
|
fanvue: "fanvue";
|
|
269
|
+
telegram: "telegram";
|
|
280
270
|
}>;
|
|
281
271
|
accountId: z.ZodString;
|
|
282
272
|
externalId: z.ZodString;
|
|
@@ -316,6 +306,7 @@ export declare const listMetrics: EndpointDefinition<undefined, z.ZodObject<{
|
|
|
316
306
|
"3speak": "3speak";
|
|
317
307
|
rumble: "rumble";
|
|
318
308
|
fanvue: "fanvue";
|
|
309
|
+
telegram: "telegram";
|
|
319
310
|
}>;
|
|
320
311
|
accountId: z.ZodString;
|
|
321
312
|
externalId: z.ZodNullable<z.ZodString>;
|
|
@@ -1,53 +1,19 @@
|
|
|
1
1
|
// GENERATED from shared/contracts — do not edit.
|
|
2
2
|
// Run `node scripts/sync-contracts.mjs` from the repo root to regenerate.
|
|
3
|
-
//---------------
|
|
4
|
-
// metrics — the GET /api/metrics + GET /api/metrics/retention-curve
|
|
5
|
-
// contract, shared by the web routes and the MCP insights tools.
|
|
6
|
-
//
|
|
7
|
-
// The query parsing (parseMetricsQuery / parseRetentionCurveQuery) lives
|
|
8
|
-
// here, not in the routes: the MCP tools validate their arguments locally
|
|
9
|
-
// against the same rules, so a one-sided edit would make the MCP reject
|
|
10
|
-
// what the route accepts (or forward what it rejects). The route keeps
|
|
11
|
-
// the same 400 messages — the parsers moved verbatim out of
|
|
12
|
-
// apps/web/lib/metrics/metrics-query.ts and
|
|
13
|
-
// apps/web/app/api/metrics/retention-curve/route.ts.
|
|
14
|
-
//---------------
|
|
15
3
|
import { z } from 'zod';
|
|
16
|
-
/** Define one endpoint contract. The literal path is preserved in the type
|
|
17
|
-
* so ParamsOf can read its `:param` segments. `Body`/`Query` default to
|
|
18
|
-
* `undefined` so an omitted optional schema stays `undefined` (not the
|
|
19
|
-
* bare `ZodType`) in the returned definition. */
|
|
20
4
|
export function defineEndpoint(config) {
|
|
21
5
|
return config;
|
|
22
6
|
}
|
|
23
7
|
import { SOCIAL_PROVIDERS, isSocialProvider } from './providers.js';
|
|
24
8
|
import { METRICS_WINDOWS } from './experiments.js';
|
|
25
|
-
// The window values live in the experiments contract (its results read
|
|
26
|
-
// takes the same ?window=); re-exported so the metrics query contract
|
|
27
|
-
// is the one place the MCP and the web read them from.
|
|
28
9
|
export { METRICS_WINDOWS };
|
|
29
|
-
// Null-filter sentinel. Not a plain word: script angles are unvalidated
|
|
30
|
-
// engine-generated text, so a literal like 'none' could be a real angle
|
|
31
|
-
// and would become unfilterable (selecting it would filter for null rows
|
|
32
|
-
// instead). Persona ids are uuids, so the sentinel is safe for them too.
|
|
33
10
|
export const METRICS_NONE = '^@none';
|
|
34
11
|
export const METRICS_FILTER_MAX_LENGTH = 200;
|
|
35
|
-
/** YouTube video id (11 chars, base64url). Mirrors
|
|
36
|
-
* apps/web/lib/youtube-analytics.ts (VIDEO_ID). */
|
|
37
12
|
export const YOUTUBE_VIDEO_ID = /^[A-Za-z0-9_-]{1,64}$/;
|
|
38
|
-
// post_metrics.analytics_status (migration 039 check, pinned by a sync test).
|
|
39
13
|
export const ANALYTICS_STATUSES = ['ok', 'scope_missing', 'not_owned', 'no_data'];
|
|
40
14
|
export function isAnalyticsStatus(value) {
|
|
41
15
|
return typeof value === 'string' && ANALYTICS_STATUSES.includes(value);
|
|
42
16
|
}
|
|
43
|
-
// Coverage reasons (issue #525): why a published video has no snapshot
|
|
44
|
-
// for the selected window. pending = the window has not opened yet;
|
|
45
|
-
// retrying = the window is open and the collector keeps trying; missed =
|
|
46
|
-
// the window closed while collection kept failing; no-target = the window
|
|
47
|
-
// closed and the collector finished the post without ever seeing this
|
|
48
|
-
// video (it was published late, after the post was marked done);
|
|
49
|
-
// publish-failed = the publish outcome is 'failed', so there is no video
|
|
50
|
-
// id to measure.
|
|
51
17
|
export const COVERAGE_REASONS = ['pending', 'retrying', 'missed', 'no-target', 'publish-failed'];
|
|
52
18
|
export function isCoverageReason(value) {
|
|
53
19
|
return typeof value === 'string' && COVERAGE_REASONS.includes(value);
|
|
@@ -55,9 +21,6 @@ export function isCoverageReason(value) {
|
|
|
55
21
|
export function isMetricsWindow(value) {
|
|
56
22
|
return typeof value === 'string' && METRICS_WINDOWS.includes(value);
|
|
57
23
|
}
|
|
58
|
-
// Exported for the metrics route, which validates stored API-key
|
|
59
|
-
// persona ids with the same pattern before interpolating them into a
|
|
60
|
-
// PostgREST filter string.
|
|
61
24
|
export const UUID = /^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i;
|
|
62
25
|
const KNOWN_PARAMS = new Set(['window', 'persona', 'account', 'provider', 'angle']);
|
|
63
26
|
function readOptional(params, key) {
|
|
@@ -73,10 +36,6 @@ function readOptional(params, key) {
|
|
|
73
36
|
return { error: `${key} is too long.` };
|
|
74
37
|
return value;
|
|
75
38
|
}
|
|
76
|
-
//---------------
|
|
77
|
-
// parseMetricsQuery — strict: unknown, duplicate, empty, over-length or
|
|
78
|
-
// malformed params are rejected (400), never ignored or coerced.
|
|
79
|
-
//---------------
|
|
80
39
|
export function parseMetricsQuery(params) {
|
|
81
40
|
for (const key of params.keys()) {
|
|
82
41
|
if (!KNOWN_PARAMS.has(key))
|
|
@@ -110,9 +69,6 @@ export function parseMetricsQuery(params) {
|
|
|
110
69
|
},
|
|
111
70
|
};
|
|
112
71
|
}
|
|
113
|
-
//---------------
|
|
114
|
-
// metricsSearchParams — the inverse, for the client fetch.
|
|
115
|
-
//---------------
|
|
116
72
|
export function metricsSearchParams(query) {
|
|
117
73
|
const params = new URLSearchParams({ window: query.window });
|
|
118
74
|
if (query.personaId !== null)
|
|
@@ -125,8 +81,6 @@ export function metricsSearchParams(query) {
|
|
|
125
81
|
params.set('angle', query.angle);
|
|
126
82
|
return params;
|
|
127
83
|
}
|
|
128
|
-
/** `?account=&video=` for the retention-curve read: each exactly once,
|
|
129
|
-
* a non-empty account within the filter length, a YouTube video id. */
|
|
130
84
|
export function parseRetentionCurveQuery(params) {
|
|
131
85
|
for (const key of params.keys()) {
|
|
132
86
|
if (key !== 'account' && key !== 'video')
|
|
@@ -142,11 +96,6 @@ export function parseRetentionCurveQuery(params) {
|
|
|
142
96
|
return { error: 'Invalid video.' };
|
|
143
97
|
return { account: account[0], video: video[0] };
|
|
144
98
|
}
|
|
145
|
-
//---------------
|
|
146
|
-
// Query params as the routes receive them (raw strings; the parsers
|
|
147
|
-
// above are the validators). The endpoints declare them so the MCP
|
|
148
|
-
// client and the route share one shape.
|
|
149
|
-
//---------------
|
|
150
99
|
export const MetricsQueryParamsSchema = z.strictObject({
|
|
151
100
|
window: z.string().optional(),
|
|
152
101
|
persona: z.string().optional(),
|
|
@@ -158,12 +107,6 @@ export const RetentionCurveQuerySchema = z.strictObject({
|
|
|
158
107
|
account: z.string(),
|
|
159
108
|
video: z.string(),
|
|
160
109
|
});
|
|
161
|
-
//---------------
|
|
162
|
-
// Response views, mirroring apps/web/lib/metrics/metrics-query.ts
|
|
163
|
-
// (MetricsRowView / CoverageItem) and apps/web/lib/youtube-analytics.ts
|
|
164
|
-
// (RetentionPoint). The MCP reads these rows; app field names are the
|
|
165
|
-
// contract one rename away from breaking both typechecks.
|
|
166
|
-
//---------------
|
|
167
110
|
export const MetricsRowSchema = z.object({
|
|
168
111
|
postId: z.string(),
|
|
169
112
|
personaId: z.string().nullable(),
|
|
@@ -171,22 +114,11 @@ export const MetricsRowSchema = z.object({
|
|
|
171
114
|
accountId: z.string(),
|
|
172
115
|
externalId: z.string(),
|
|
173
116
|
scriptAngle: z.string().nullable(),
|
|
174
|
-
// When the slot was published, from scheduled_posts.published_at (the
|
|
175
|
-
// publish date every date chart buckets by, #647). Required, not
|
|
176
|
-
// nullable: post_metrics rows are only ever created for published slots
|
|
177
|
-
// with a non-null published_at — find_post_metrics_due (migrations 025
|
|
178
|
-
// and 039) requires status 'published' plus published_at window
|
|
179
|
-
// comparisons that NULL never satisfies, the re-open scan requires a
|
|
180
|
-
// string published_at, and the engine sets published_at once on publish
|
|
181
|
-
// and never clears it. A missing parent at read time (a concurrent
|
|
182
|
-
// delete race) is a read failure (500), never a null row.
|
|
183
117
|
publishedAt: z.string(),
|
|
184
118
|
views: z.number().nullable(),
|
|
185
119
|
likes: z.number().nullable(),
|
|
186
120
|
comments: z.number().nullable(),
|
|
187
121
|
saves: z.number().nullable(),
|
|
188
|
-
// YouTube Analytics (own videos only); null on other providers or when
|
|
189
|
-
// not collected. analyticsStatus 'scope_missing' = reconnect YouTube.
|
|
190
122
|
analyticsViews: z.number().nullable(),
|
|
191
123
|
engagedViews: z.number().nullable(),
|
|
192
124
|
stayedToWatchPct: z.number().nullable(),
|
|
@@ -202,7 +134,6 @@ export const CoverageItemSchema = z.object({
|
|
|
202
134
|
personaId: z.string().nullable(),
|
|
203
135
|
provider: z.enum(SOCIAL_PROVIDERS),
|
|
204
136
|
accountId: z.string(),
|
|
205
|
-
// Null for publish-failed items: a failed publish records no video id.
|
|
206
137
|
externalId: z.string().nullable(),
|
|
207
138
|
scriptAngle: z.string().nullable(),
|
|
208
139
|
reason: z.enum(COVERAGE_REASONS),
|
|
@@ -216,11 +147,9 @@ export const MetricsResponseSchema = z.object({
|
|
|
216
147
|
truncated: z.boolean(),
|
|
217
148
|
coverage: z.array(CoverageItemSchema),
|
|
218
149
|
coverageTruncated: z.boolean(),
|
|
219
|
-
// The newest snapshot in the response: the page dates its data by it.
|
|
220
150
|
asOf: z.string().nullable(),
|
|
221
151
|
});
|
|
222
152
|
export const RetentionPointSchema = z.object({
|
|
223
|
-
// elapsedVideoTimeRatio: exclusive end of the interval, 0.01..1.0.
|
|
224
153
|
ratio: z.number(),
|
|
225
154
|
audienceWatchRatio: z.number(),
|
|
226
155
|
relativeRetentionPerformance: z.number().nullable(),
|
|
@@ -232,9 +161,6 @@ export const RetentionCurveResponseSchema = z.object({
|
|
|
232
161
|
endDate: z.string(),
|
|
233
162
|
provisional: z.boolean(),
|
|
234
163
|
});
|
|
235
|
-
//---------------
|
|
236
|
-
// Endpoints.
|
|
237
|
-
//---------------
|
|
238
164
|
export const listMetrics = defineEndpoint({
|
|
239
165
|
method: 'GET',
|
|
240
166
|
path: '/api/metrics',
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"metrics.js","sourceRoot":"","sources":["../../src/contracts/metrics.ts"],"names":[],"mappings":"AAAA,iDAAiD;AACjD,0EAA0E;AAC1E,
|
|
1
|
+
{"version":3,"file":"metrics.js","sourceRoot":"","sources":["../../src/contracts/metrics.ts"],"names":[],"mappings":"AAAA,iDAAiD;AACjD,0EAA0E;AAC1E,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAiBxB,MAAM,UAAU,cAAc,CAK5B,MAMD;IACC,OAAO,MAAM,CAAC;AAChB,CAAC;AAyBD,OAAO,EAAE,gBAAgB,EAAE,gBAAgB,EAAuB,MAAM,gBAAgB,CAAC;AACzF,OAAO,EAAE,eAAe,EAAsB,MAAM,kBAAkB,CAAC;AAEvE,OAAO,EAAE,eAAe,EAAE,CAAC;AAE3B,MAAM,CAAC,MAAM,YAAY,GAAG,QAAQ,CAAC;AAErC,MAAM,CAAC,MAAM,yBAAyB,GAAG,GAAG,CAAC;AAG7C,MAAM,CAAC,MAAM,gBAAgB,GAAG,uBAAuB,CAAC;AAExD,MAAM,CAAC,MAAM,kBAAkB,GAAG,CAAC,IAAI,EAAE,eAAe,EAAE,WAAW,EAAE,SAAS,CAAU,CAAC;AAG3F,MAAM,UAAU,iBAAiB,CAAC,KAAc;IAC9C,OAAO,OAAO,KAAK,KAAK,QAAQ,IAAK,kBAAwC,CAAC,QAAQ,CAAC,KAAK,CAAC,CAAC;AAChG,CAAC;AAED,MAAM,CAAC,MAAM,gBAAgB,GAAG,CAAC,SAAS,EAAE,UAAU,EAAE,QAAQ,EAAE,WAAW,EA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MAAM,EAAE,CAAC,QAAQ,EAAE;CACpD,CAAC,CAAC;AAGH,MAAM,CAAC,MAAM,4BAA4B,GAAG,CAAC,CAAC,MAAM,CAAC;IACnD,OAAO,EAAE,CAAC,CAAC,OAAO,CAAC,IAAI,CAAC;IACxB,MAAM,EAAE,CAAC,CAAC,KAAK,CAAC,oBAAoB,CAAC;IACrC,SAAS,EAAE,CAAC,CAAC,MAAM,EAAE;IACrB,OAAO,EAAE,CAAC,CAAC,MAAM,EAAE;IACnB,WAAW,EAAE,CAAC,CAAC,OAAO,EAAE;CACzB,CAAC,CAAC;AAGH,MAAM,CAAC,MAAM,WAAW,GAAG,cAAc,CAAC;IACxC,MAAM,EAAE,KAAK;IACb,IAAI,EAAE,cAAc;IACpB,KAAK,EAAE,wBAAwB;IAC/B,QAAQ,EAAE,qBAAqB;CAChC,CAAC,CAAC;AAEH,MAAM,CAAC,MAAM,iBAAiB,GAAG,cAAc,CAAC;IAC9C,MAAM,EAAE,KAAK;IACb,IAAI,EAAE,8BAA8B;IACpC,KAAK,EAAE,yBAAyB;IAChC,QAAQ,EAAE,4BAA4B;CACvC,CAAC,CAAC"}
|
|
@@ -7,10 +7,6 @@ export interface EndpointDefinition<Body extends z.ZodType | undefined, Query ex
|
|
|
7
7
|
query?: Query;
|
|
8
8
|
response: Response;
|
|
9
9
|
}
|
|
10
|
-
/** Define one endpoint contract. The literal path is preserved in the type
|
|
11
|
-
* so ParamsOf can read its `:param` segments. `Body`/`Query` default to
|
|
12
|
-
* `undefined` so an omitted optional schema stays `undefined` (not the
|
|
13
|
-
* bare `ZodType`) in the returned definition. */
|
|
14
10
|
export declare function defineEndpoint<Body extends z.ZodType | undefined = undefined, Query extends z.ZodType | undefined = undefined, Response extends z.ZodType = z.ZodType, Path extends string = string>(config: {
|
|
15
11
|
method: EndpointMethod;
|
|
16
12
|
path: Path;
|
|
@@ -18,26 +14,19 @@ export declare function defineEndpoint<Body extends z.ZodType | undefined = unde
|
|
|
18
14
|
query?: Query;
|
|
19
15
|
response: Response;
|
|
20
16
|
}): EndpointDefinition<Body, Query, Response, Path>;
|
|
21
|
-
/** Request body input type (`z.input` of the `body` schema). Indexed
|
|
22
|
-
* access is used (not infer) so an optional `body?` property keeps its
|
|
23
|
-
* schema type instead of widening to `unknown`. */
|
|
24
17
|
export type BodyOf<Endpoint extends {
|
|
25
18
|
body?: z.ZodType | undefined;
|
|
26
19
|
}> = [
|
|
27
20
|
Exclude<Endpoint['body'], undefined>
|
|
28
21
|
] extends [never] ? never : Exclude<Endpoint['body'], undefined> extends z.ZodType ? z.input<Exclude<Endpoint['body'], undefined>> : never;
|
|
29
|
-
/** Query input type (`z.input` of the `query` schema). */
|
|
30
22
|
export type QueryOf<Endpoint extends {
|
|
31
23
|
query?: z.ZodType | undefined;
|
|
32
24
|
}> = [
|
|
33
25
|
Exclude<Endpoint['query'], undefined>
|
|
34
26
|
] extends [never] ? never : Exclude<Endpoint['query'], undefined> extends z.ZodType ? z.input<Exclude<Endpoint['query'], undefined>> : never;
|
|
35
|
-
/** Response output type (`z.output` of the `response` schema). */
|
|
36
27
|
export type ResponseOf<Endpoint extends {
|
|
37
28
|
response: z.ZodType;
|
|
38
29
|
}> = Endpoint['response'] extends z.ZodType ? z.output<Endpoint['response']> : never;
|
|
39
|
-
/** Path params from a path template: each `:name` segment becomes a
|
|
40
|
-
* `string` field. A path without segments is an empty record. */
|
|
41
30
|
export type ParamsOf<Path extends string> = Path extends `${string}:${infer Rest}` ? Rest extends `${infer Name}/${infer After}` ? {
|
|
42
31
|
[Key in Name]: string;
|
|
43
32
|
} & ParamsOf<`/${After}`> : {
|
|
@@ -50,7 +39,24 @@ export declare const VIDEO_LAYOUTS: readonly ["standard", "react"];
|
|
|
50
39
|
export type VideoLayout = (typeof VIDEO_LAYOUTS)[number];
|
|
51
40
|
export declare const FACE_QUALITIES: readonly ["ok", "very_good"];
|
|
52
41
|
export type FaceQuality = (typeof FACE_QUALITIES)[number];
|
|
53
|
-
export declare const
|
|
42
|
+
export declare const PERSONA_CTA_TYPES: readonly ["follow", "comment", "share", "save", "link", "buy", "other"];
|
|
43
|
+
export type PersonaCtaType = (typeof PERSONA_CTA_TYPES)[number];
|
|
44
|
+
export declare const PERSONA_CTA_URL_MAX_LENGTH = 2048;
|
|
45
|
+
export declare const PERSONA_CTA_INSTRUCTION_MAX_LENGTH = 500;
|
|
46
|
+
export declare const PersonaCtaSchema: z.ZodObject<{
|
|
47
|
+
type: z.ZodEnum<{
|
|
48
|
+
link: "link";
|
|
49
|
+
follow: "follow";
|
|
50
|
+
comment: "comment";
|
|
51
|
+
share: "share";
|
|
52
|
+
save: "save";
|
|
53
|
+
buy: "buy";
|
|
54
|
+
other: "other";
|
|
55
|
+
}>;
|
|
56
|
+
url: z.ZodOptional<z.ZodString>;
|
|
57
|
+
instruction: z.ZodOptional<z.ZodString>;
|
|
58
|
+
}, z.core.$strip>;
|
|
59
|
+
export type PersonaCta = z.infer<typeof PersonaCtaSchema>;
|
|
54
60
|
export declare const MAX_LIBRARY_IMAGES = 10;
|
|
55
61
|
export declare const MAX_TAG_LENGTH = 100;
|
|
56
62
|
export declare const MAX_DESCRIPTION_LENGTH = 500;
|
|
@@ -73,7 +79,17 @@ export declare const PersonaListItemSchema: z.ZodObject<{
|
|
|
73
79
|
videoAspect: z.ZodOptional<z.ZodString>;
|
|
74
80
|
videoLayout: z.ZodOptional<z.ZodString>;
|
|
75
81
|
scriptPrompt: z.ZodOptional<z.ZodString>;
|
|
76
|
-
|
|
82
|
+
ctaType: z.ZodOptional<z.ZodEnum<{
|
|
83
|
+
link: "link";
|
|
84
|
+
follow: "follow";
|
|
85
|
+
comment: "comment";
|
|
86
|
+
share: "share";
|
|
87
|
+
save: "save";
|
|
88
|
+
buy: "buy";
|
|
89
|
+
other: "other";
|
|
90
|
+
}>>;
|
|
91
|
+
ctaUrl: z.ZodOptional<z.ZodString>;
|
|
92
|
+
ctaInstruction: z.ZodOptional<z.ZodString>;
|
|
77
93
|
paragraphNumber: z.ZodOptional<z.ZodNumber>;
|
|
78
94
|
niche: z.ZodOptional<z.ZodString>;
|
|
79
95
|
faceQuality: z.ZodOptional<z.ZodString>;
|
|
@@ -88,6 +104,7 @@ export declare const PersonaListItemSchema: z.ZodObject<{
|
|
|
88
104
|
'3speak': z.ZodArray<z.ZodString>;
|
|
89
105
|
rumble: z.ZodArray<z.ZodString>;
|
|
90
106
|
fanvue: z.ZodArray<z.ZodString>;
|
|
107
|
+
telegram: z.ZodArray<z.ZodString>;
|
|
91
108
|
}, z.core.$strip>;
|
|
92
109
|
}, z.core.$strip>;
|
|
93
110
|
export type PersonaListItem = z.infer<typeof PersonaListItemSchema>;
|
|
@@ -106,7 +123,17 @@ export declare const ListPersonasResponseSchema: z.ZodObject<{
|
|
|
106
123
|
videoAspect: z.ZodOptional<z.ZodString>;
|
|
107
124
|
videoLayout: z.ZodOptional<z.ZodString>;
|
|
108
125
|
scriptPrompt: z.ZodOptional<z.ZodString>;
|
|
109
|
-
|
|
126
|
+
ctaType: z.ZodOptional<z.ZodEnum<{
|
|
127
|
+
link: "link";
|
|
128
|
+
follow: "follow";
|
|
129
|
+
comment: "comment";
|
|
130
|
+
share: "share";
|
|
131
|
+
save: "save";
|
|
132
|
+
buy: "buy";
|
|
133
|
+
other: "other";
|
|
134
|
+
}>>;
|
|
135
|
+
ctaUrl: z.ZodOptional<z.ZodString>;
|
|
136
|
+
ctaInstruction: z.ZodOptional<z.ZodString>;
|
|
110
137
|
paragraphNumber: z.ZodOptional<z.ZodNumber>;
|
|
111
138
|
niche: z.ZodOptional<z.ZodString>;
|
|
112
139
|
faceQuality: z.ZodOptional<z.ZodString>;
|
|
@@ -121,6 +148,7 @@ export declare const ListPersonasResponseSchema: z.ZodObject<{
|
|
|
121
148
|
'3speak': z.ZodArray<z.ZodString>;
|
|
122
149
|
rumble: z.ZodArray<z.ZodString>;
|
|
123
150
|
fanvue: z.ZodArray<z.ZodString>;
|
|
151
|
+
telegram: z.ZodArray<z.ZodString>;
|
|
124
152
|
}, z.core.$strip>;
|
|
125
153
|
}, z.core.$strip>>;
|
|
126
154
|
}, z.core.$strip>;
|
|
@@ -286,7 +314,17 @@ export declare const CreatePersonaBodySchema: z.ZodObject<{
|
|
|
286
314
|
react: "react";
|
|
287
315
|
}>>;
|
|
288
316
|
scriptPrompt: z.ZodOptional<z.ZodString>;
|
|
289
|
-
|
|
317
|
+
ctaType: z.ZodOptional<z.ZodEnum<{
|
|
318
|
+
link: "link";
|
|
319
|
+
follow: "follow";
|
|
320
|
+
comment: "comment";
|
|
321
|
+
share: "share";
|
|
322
|
+
save: "save";
|
|
323
|
+
buy: "buy";
|
|
324
|
+
other: "other";
|
|
325
|
+
}>>;
|
|
326
|
+
ctaUrl: z.ZodOptional<z.ZodString>;
|
|
327
|
+
ctaInstruction: z.ZodOptional<z.ZodString>;
|
|
290
328
|
niche: z.ZodOptional<z.ZodString>;
|
|
291
329
|
paragraphNumber: z.ZodOptional<z.ZodCoercedNumber<unknown>>;
|
|
292
330
|
faceQuality: z.ZodOptional<z.ZodEnum<{
|
|
@@ -314,7 +352,17 @@ export declare const UpdatePersonaBodySchema: z.ZodObject<{
|
|
|
314
352
|
react: "react";
|
|
315
353
|
}>>, unknown>;
|
|
316
354
|
scriptPrompt: z.ZodPreprocess<z.ZodOptional<z.ZodString>, unknown>;
|
|
317
|
-
|
|
355
|
+
ctaType: z.ZodOptional<z.ZodEnum<{
|
|
356
|
+
link: "link";
|
|
357
|
+
follow: "follow";
|
|
358
|
+
comment: "comment";
|
|
359
|
+
share: "share";
|
|
360
|
+
save: "save";
|
|
361
|
+
buy: "buy";
|
|
362
|
+
other: "other";
|
|
363
|
+
}>>;
|
|
364
|
+
ctaUrl: z.ZodOptional<z.ZodString>;
|
|
365
|
+
ctaInstruction: z.ZodOptional<z.ZodString>;
|
|
318
366
|
paragraphNumber: z.ZodPreprocess<z.ZodOptional<z.ZodString>, unknown>;
|
|
319
367
|
niche: z.ZodPreprocess<z.ZodOptional<z.ZodString>, unknown>;
|
|
320
368
|
faceQuality: z.ZodPreprocess<z.ZodOptional<z.ZodEnum<{
|
|
@@ -379,7 +427,17 @@ export declare const createPersona: EndpointDefinition<z.ZodObject<{
|
|
|
379
427
|
react: "react";
|
|
380
428
|
}>>;
|
|
381
429
|
scriptPrompt: z.ZodOptional<z.ZodString>;
|
|
382
|
-
|
|
430
|
+
ctaType: z.ZodOptional<z.ZodEnum<{
|
|
431
|
+
link: "link";
|
|
432
|
+
follow: "follow";
|
|
433
|
+
comment: "comment";
|
|
434
|
+
share: "share";
|
|
435
|
+
save: "save";
|
|
436
|
+
buy: "buy";
|
|
437
|
+
other: "other";
|
|
438
|
+
}>>;
|
|
439
|
+
ctaUrl: z.ZodOptional<z.ZodString>;
|
|
440
|
+
ctaInstruction: z.ZodOptional<z.ZodString>;
|
|
383
441
|
niche: z.ZodOptional<z.ZodString>;
|
|
384
442
|
paragraphNumber: z.ZodOptional<z.ZodCoercedNumber<unknown>>;
|
|
385
443
|
faceQuality: z.ZodOptional<z.ZodEnum<{
|
|
@@ -416,7 +474,17 @@ export declare const listPersonas: EndpointDefinition<undefined, undefined, z.Zo
|
|
|
416
474
|
videoAspect: z.ZodOptional<z.ZodString>;
|
|
417
475
|
videoLayout: z.ZodOptional<z.ZodString>;
|
|
418
476
|
scriptPrompt: z.ZodOptional<z.ZodString>;
|
|
419
|
-
|
|
477
|
+
ctaType: z.ZodOptional<z.ZodEnum<{
|
|
478
|
+
link: "link";
|
|
479
|
+
follow: "follow";
|
|
480
|
+
comment: "comment";
|
|
481
|
+
share: "share";
|
|
482
|
+
save: "save";
|
|
483
|
+
buy: "buy";
|
|
484
|
+
other: "other";
|
|
485
|
+
}>>;
|
|
486
|
+
ctaUrl: z.ZodOptional<z.ZodString>;
|
|
487
|
+
ctaInstruction: z.ZodOptional<z.ZodString>;
|
|
420
488
|
paragraphNumber: z.ZodOptional<z.ZodNumber>;
|
|
421
489
|
niche: z.ZodOptional<z.ZodString>;
|
|
422
490
|
faceQuality: z.ZodOptional<z.ZodString>;
|
|
@@ -431,6 +499,7 @@ export declare const listPersonas: EndpointDefinition<undefined, undefined, z.Zo
|
|
|
431
499
|
'3speak': z.ZodArray<z.ZodString>;
|
|
432
500
|
rumble: z.ZodArray<z.ZodString>;
|
|
433
501
|
fanvue: z.ZodArray<z.ZodString>;
|
|
502
|
+
telegram: z.ZodArray<z.ZodString>;
|
|
434
503
|
}, z.core.$strip>;
|
|
435
504
|
}, z.core.$strip>>;
|
|
436
505
|
}, z.core.$strip>, "/api/persona/list">;
|
|
@@ -464,7 +533,17 @@ export declare const updatePersona: EndpointDefinition<z.ZodObject<{
|
|
|
464
533
|
react: "react";
|
|
465
534
|
}>>, unknown>;
|
|
466
535
|
scriptPrompt: z.ZodPreprocess<z.ZodOptional<z.ZodString>, unknown>;
|
|
467
|
-
|
|
536
|
+
ctaType: z.ZodOptional<z.ZodEnum<{
|
|
537
|
+
link: "link";
|
|
538
|
+
follow: "follow";
|
|
539
|
+
comment: "comment";
|
|
540
|
+
share: "share";
|
|
541
|
+
save: "save";
|
|
542
|
+
buy: "buy";
|
|
543
|
+
other: "other";
|
|
544
|
+
}>>;
|
|
545
|
+
ctaUrl: z.ZodOptional<z.ZodString>;
|
|
546
|
+
ctaInstruction: z.ZodOptional<z.ZodString>;
|
|
468
547
|
paragraphNumber: z.ZodPreprocess<z.ZodOptional<z.ZodString>, unknown>;
|
|
469
548
|
niche: z.ZodPreprocess<z.ZodOptional<z.ZodString>, unknown>;
|
|
470
549
|
faceQuality: z.ZodPreprocess<z.ZodOptional<z.ZodEnum<{
|