post-engineer-mcp 1.52.601 → 1.52.615
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 -1
- package/dist/client-batch.d.ts +3 -1
- package/dist/client-batch.js +4 -1
- package/dist/client-batch.js.map +1 -1
- package/dist/client-billing.d.ts +5 -0
- package/dist/client-billing.js +34 -0
- package/dist/client-billing.js.map +1 -0
- package/dist/client-experiments.d.ts +5 -14
- package/dist/client-experiments.js +17 -3
- package/dist/client-experiments.js.map +1 -1
- package/dist/client-posts.d.ts +12 -6
- package/dist/client-posts.js +22 -11
- package/dist/client-posts.js.map +1 -1
- package/dist/client-prompts.d.ts +4 -8
- package/dist/client-prompts.js +7 -24
- package/dist/client-prompts.js.map +1 -1
- package/dist/client-publish-uploaded.d.ts +8 -1
- package/dist/client-publish-uploaded.js +121 -49
- package/dist/client-publish-uploaded.js.map +1 -1
- package/dist/client-publishing-accounts.d.ts +4 -2
- package/dist/client-publishing-accounts.js +6 -2
- package/dist/client-publishing-accounts.js.map +1 -1
- package/dist/client-types.d.ts +5 -4
- package/dist/client-user-media.d.ts +4 -3
- package/dist/client-user-media.js +17 -47
- package/dist/client-user-media.js.map +1 -1
- package/dist/client-video-task.d.ts +3 -1
- package/dist/client-video-task.js +4 -1
- package/dist/client-video-task.js.map +1 -1
- package/dist/client.d.ts +40 -39
- package/dist/client.js +80 -148
- package/dist/client.js.map +1 -1
- package/dist/cloned-voice-client.d.ts +7 -5
- package/dist/cloned-voice-client.js +10 -4
- package/dist/cloned-voice-client.js.map +1 -1
- package/dist/connect-account.js +14 -6
- package/dist/connect-account.js.map +1 -1
- package/dist/contract-response.d.ts +8 -0
- package/dist/contract-response.js +24 -0
- package/dist/contract-response.js.map +1 -0
- package/dist/contracts/accounts.d.ts +844 -0
- package/dist/contracts/accounts.js +346 -0
- package/dist/contracts/accounts.js.map +1 -0
- package/dist/contracts/billing.d.ts +109 -0
- package/dist/contracts/billing.js +88 -0
- package/dist/contracts/billing.js.map +1 -0
- package/dist/contracts/endpoint.d.ts +45 -0
- package/dist/contracts/endpoint.js +8 -0
- package/dist/contracts/endpoint.js.map +1 -0
- package/dist/contracts/experiments.d.ts +271 -0
- package/dist/contracts/experiments.js +170 -0
- package/dist/contracts/experiments.js.map +1 -0
- package/dist/contracts/media.d.ts +165 -0
- package/dist/contracts/media.js +139 -0
- package/dist/contracts/media.js.map +1 -0
- package/dist/contracts/metrics.d.ts +351 -0
- package/dist/contracts/metrics.js +256 -0
- package/dist/contracts/metrics.js.map +1 -0
- package/dist/contracts/personas.d.ts +560 -0
- package/dist/contracts/personas.js +346 -0
- package/dist/contracts/personas.js.map +1 -0
- package/dist/contracts/posts.d.ts +485 -0
- package/dist/contracts/posts.js +153 -0
- package/dist/contracts/posts.js.map +1 -0
- package/dist/contracts/prompts.d.ts +90 -0
- package/dist/contracts/prompts.js +48 -0
- package/dist/contracts/prompts.js.map +1 -0
- package/dist/contracts/schedule.d.ts +691 -0
- package/dist/contracts/schedule.js +264 -0
- package/dist/contracts/schedule.js.map +1 -0
- package/dist/contracts/video-tasks.d.ts +181 -0
- package/dist/contracts/video-tasks.js +121 -0
- package/dist/contracts/video-tasks.js.map +1 -0
- package/dist/contracts/videos.d.ts +693 -0
- package/dist/contracts/videos.js +443 -0
- package/dist/contracts/videos.js.map +1 -0
- package/dist/contracts/voices.d.ts +237 -0
- package/dist/contracts/voices.js +118 -0
- package/dist/contracts/voices.js.map +1 -0
- package/dist/generate-video.d.ts +34 -34
- package/dist/generate-video.js +14 -2
- package/dist/generate-video.js.map +1 -1
- package/dist/intent-content.js +1 -1
- package/dist/intent-personas.js +17 -7
- package/dist/intent-personas.js.map +1 -1
- package/dist/limits.d.ts +27 -44
- package/dist/limits.js +27 -45
- package/dist/limits.js.map +1 -1
- package/dist/persona-delete.js +9 -9
- package/dist/persona-delete.js.map +1 -1
- package/dist/persona-update.js +3 -2
- package/dist/persona-update.js.map +1 -1
- package/dist/script-segments.d.ts +1 -1
- package/dist/script-segments.js +1 -1
- package/dist/single-video-shape.d.ts +5 -5
- package/dist/single-video-shape.js +1 -1
- package/dist/tools-batch.d.ts +42 -42
- package/dist/tools-batch.js +12 -36
- package/dist/tools-batch.js.map +1 -1
- package/dist/tools-experiments.d.ts +11 -11
- package/dist/tools-experiments.js +17 -9
- package/dist/tools-experiments.js.map +1 -1
- package/dist/tools-pinterest.js +5 -15
- package/dist/tools-pinterest.js.map +1 -1
- package/dist/tools-single-video.js +14 -51
- package/dist/tools-single-video.js.map +1 -1
- package/dist/tools-user-media.js +3 -1
- package/dist/tools-user-media.js.map +1 -1
- package/dist/tools.d.ts +0 -25
- package/dist/tools.js +56 -96
- package/dist/tools.js.map +1 -1
- package/dist/voice-filters.js +2 -1
- package/dist/voice-filters.js.map +1 -1
- package/package.json +1 -1
|
@@ -0,0 +1,139 @@
|
|
|
1
|
+
// GENERATED from shared/contracts — do not edit.
|
|
2
|
+
// Run `node scripts/sync-contracts.mjs` from the repo root to regenerate.
|
|
3
|
+
//---------------
|
|
4
|
+
// media — the segment-media and direct-publish contract, shared by the
|
|
5
|
+
// web routes and the MCP media / direct-publish calls.
|
|
6
|
+
//
|
|
7
|
+
// POST /api/media/upload is multipart (FormData with a `file`): the
|
|
8
|
+
// contract owns only its response. POST /api/media/check takes JSON;
|
|
9
|
+
// its route validation stays hand-rolled (the 400 messages are part of
|
|
10
|
+
// the route's behaviour — see below) and the contract body schema
|
|
11
|
+
// mirrors it, pinned by the MCP tool-schema equivalence test.
|
|
12
|
+
// POST /api/upload-content is multipart FormData dispatched per
|
|
13
|
+
// provider; its response is the direct-publish result shared with
|
|
14
|
+
// POST /api/videos/publish-by-id (which reuses the same response
|
|
15
|
+
// schema from here).
|
|
16
|
+
//---------------
|
|
17
|
+
import { z } from 'zod';
|
|
18
|
+
/** Define one endpoint contract. The literal path is preserved in the type
|
|
19
|
+
* so ParamsOf can read its `:param` segments. `Body`/`Query` default to
|
|
20
|
+
* `undefined` so an omitted optional schema stays `undefined` (not the
|
|
21
|
+
* bare `ZodType`) in the returned definition. */
|
|
22
|
+
export function defineEndpoint(config) {
|
|
23
|
+
return config;
|
|
24
|
+
}
|
|
25
|
+
/** The engine-minted temp-asset filename: 32 hex chars + an image
|
|
26
|
+
* extension. Mirrors apps/web/app/api/media/upload/route.ts
|
|
27
|
+
* (MEDIA_ID_PATTERN): the full URL is never returned, only this id. */
|
|
28
|
+
export const MEDIA_ID_PATTERN = /^[0-9a-f]{32}\.(jpg|jpeg|png|webp)$/;
|
|
29
|
+
/** Mechanical check outcomes from the engine. Mirrors
|
|
30
|
+
* apps/web/app/api/media/check/route.ts (CHECK_CODES). */
|
|
31
|
+
export const CHECK_MEDIA_CODES = [
|
|
32
|
+
'ok',
|
|
33
|
+
'blocked_403',
|
|
34
|
+
'not_image',
|
|
35
|
+
'too_small',
|
|
36
|
+
'too_large',
|
|
37
|
+
'timeout',
|
|
38
|
+
'wrong_aspect',
|
|
39
|
+
'media_expired',
|
|
40
|
+
];
|
|
41
|
+
/** Video aspects a photo can be checked against. Mirrors
|
|
42
|
+
* apps/web/app/api/media/check/route.ts (VIDEO_ASPECTS) and the engine
|
|
43
|
+
* VideoAspect enum. */
|
|
44
|
+
export const VIDEO_ASPECTS = ['9:16', '16:9', '1:1'];
|
|
45
|
+
export function isHttpUrl(value) {
|
|
46
|
+
try {
|
|
47
|
+
const parsed = new URL(value);
|
|
48
|
+
return parsed.protocol === 'http:' || parsed.protocol === 'https:';
|
|
49
|
+
}
|
|
50
|
+
catch {
|
|
51
|
+
return false;
|
|
52
|
+
}
|
|
53
|
+
}
|
|
54
|
+
//---------------
|
|
55
|
+
// POST /api/media/check body — mirrors the route's hand-rolled
|
|
56
|
+
// validation exactly: url is required (empty counts as missing), must
|
|
57
|
+
// be an http(s) URL, and videoAspect is one of the three aspects when
|
|
58
|
+
// given. The route ignores unknown fields, so the schema is a plain
|
|
59
|
+
// object, not strict.
|
|
60
|
+
//---------------
|
|
61
|
+
export const MediaCheckBodySchema = z.object({
|
|
62
|
+
url: z
|
|
63
|
+
.string()
|
|
64
|
+
.min(1, 'url is required.')
|
|
65
|
+
.refine((value) => isHttpUrl(value), { message: 'url must be an http(s) URL.' }),
|
|
66
|
+
videoAspect: z.enum(VIDEO_ASPECTS).optional(),
|
|
67
|
+
});
|
|
68
|
+
//---------------
|
|
69
|
+
// Response views.
|
|
70
|
+
//---------------
|
|
71
|
+
export const MediaCheckResponseSchema = z.object({
|
|
72
|
+
success: z.literal(true),
|
|
73
|
+
code: z.enum(CHECK_MEDIA_CODES),
|
|
74
|
+
width: z.number().optional(),
|
|
75
|
+
height: z.number().optional(),
|
|
76
|
+
// The engine's face verdict (issue #589, hook photo): true when a face
|
|
77
|
+
// is detectable, false when not, null when there is no file to check or
|
|
78
|
+
// the detector is unavailable. Deliberately `unknown`: a non-boolean
|
|
79
|
+
// value is dropped by the projection (older engines omit the key
|
|
80
|
+
// entirely), never a malformed-response error — the route does the same
|
|
81
|
+
// drop on its side.
|
|
82
|
+
has_face: z.unknown().optional(),
|
|
83
|
+
});
|
|
84
|
+
export const UploadMediaResponseSchema = z.object({
|
|
85
|
+
success: z.literal(true),
|
|
86
|
+
mediaId: z.string().regex(MEDIA_ID_PATTERN),
|
|
87
|
+
expiresInSeconds: z.number(),
|
|
88
|
+
});
|
|
89
|
+
// One per-account outcome of a direct publish — mirrors
|
|
90
|
+
// apps/web/lib/upload/content-upload-result.ts
|
|
91
|
+
// (ContentUploadAccountResult). The MCP drops uploadDuration/mediaId;
|
|
92
|
+
// the schema lists the fields the agent acts on (errorCode especially:
|
|
93
|
+
// publish_unknown means the post may already be live — do not retry).
|
|
94
|
+
export const DirectPublishAccountResultSchema = z.object({
|
|
95
|
+
accountId: z.string(),
|
|
96
|
+
success: z.boolean(),
|
|
97
|
+
videoId: z.string().optional(),
|
|
98
|
+
videoUrl: z.string().optional(),
|
|
99
|
+
postId: z.string().optional(),
|
|
100
|
+
// Ready-made post URL (Pinterest pin URL, Instagram/Threads/Facebook permalink).
|
|
101
|
+
permalink: z.string().optional(),
|
|
102
|
+
error: z.string().optional(),
|
|
103
|
+
// Stable per-account failure code from classifyUploadAccountError.
|
|
104
|
+
errorCode: z.string().optional(),
|
|
105
|
+
});
|
|
106
|
+
// The 200 body of POST /api/upload-content (and of
|
|
107
|
+
// POST /api/videos/publish-by-id, which dispatches to the same provider
|
|
108
|
+
// handlers). success is a plain boolean: a multi-account publish can
|
|
109
|
+
// succeed on some accounts and fail on others. provider/logId/error
|
|
110
|
+
// flow through from the handler responses when the handler sets them.
|
|
111
|
+
export const UploadContentResponseSchema = z.object({
|
|
112
|
+
success: z.boolean(),
|
|
113
|
+
provider: z.string().optional(),
|
|
114
|
+
results: z.array(DirectPublishAccountResultSchema),
|
|
115
|
+
successCount: z.number().optional(),
|
|
116
|
+
logId: z.string().optional(),
|
|
117
|
+
error: z.string().optional(),
|
|
118
|
+
});
|
|
119
|
+
//---------------
|
|
120
|
+
// Endpoints. upload and upload-content are multipart FormData, so they
|
|
121
|
+
// declare no JSON body schema.
|
|
122
|
+
//---------------
|
|
123
|
+
export const uploadMedia = defineEndpoint({
|
|
124
|
+
method: 'POST',
|
|
125
|
+
path: '/api/media/upload',
|
|
126
|
+
response: UploadMediaResponseSchema,
|
|
127
|
+
});
|
|
128
|
+
export const checkMedia = defineEndpoint({
|
|
129
|
+
method: 'POST',
|
|
130
|
+
path: '/api/media/check',
|
|
131
|
+
body: MediaCheckBodySchema,
|
|
132
|
+
response: MediaCheckResponseSchema,
|
|
133
|
+
});
|
|
134
|
+
export const uploadContent = defineEndpoint({
|
|
135
|
+
method: 'POST',
|
|
136
|
+
path: '/api/upload-content',
|
|
137
|
+
response: UploadContentResponseSchema,
|
|
138
|
+
});
|
|
139
|
+
//# sourceMappingURL=media.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"media.js","sourceRoot":"","sources":["../../src/contracts/media.ts"],"names":[],"mappings":"AAAA,iDAAiD;AACjD,0EA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EH,MAAM,CAAC,MAAM,aAAa,GAAG,cAAc,CAAC;IAC1C,MAAM,EAAE,MAAM;IACd,IAAI,EAAE,qBAAqB;IAC3B,QAAQ,EAAE,2BAA2B;CACtC,CAAC,CAAC"}
|
|
@@ -0,0 +1,351 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
export type EndpointMethod = 'GET' | 'POST' | 'PUT' | 'PATCH' | 'DELETE';
|
|
3
|
+
export interface EndpointDefinition<Body extends z.ZodType | undefined, Query extends z.ZodType | undefined, Response extends z.ZodType, Path extends string> {
|
|
4
|
+
method: EndpointMethod;
|
|
5
|
+
path: Path;
|
|
6
|
+
body?: Body;
|
|
7
|
+
query?: Query;
|
|
8
|
+
response: Response;
|
|
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
|
+
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
|
+
method: EndpointMethod;
|
|
16
|
+
path: Path;
|
|
17
|
+
body?: Body;
|
|
18
|
+
query?: Query;
|
|
19
|
+
response: Response;
|
|
20
|
+
}): 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
|
+
export type BodyOf<Endpoint extends {
|
|
25
|
+
body?: z.ZodType | undefined;
|
|
26
|
+
}> = [
|
|
27
|
+
Exclude<Endpoint['body'], undefined>
|
|
28
|
+
] 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
|
+
export type QueryOf<Endpoint extends {
|
|
31
|
+
query?: z.ZodType | undefined;
|
|
32
|
+
}> = [
|
|
33
|
+
Exclude<Endpoint['query'], undefined>
|
|
34
|
+
] 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
|
+
export type ResponseOf<Endpoint extends {
|
|
37
|
+
response: z.ZodType;
|
|
38
|
+
}> = 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
|
+
export type ParamsOf<Path extends string> = Path extends `${string}:${infer Rest}` ? Rest extends `${infer Name}/${infer After}` ? {
|
|
42
|
+
[Key in Name]: string;
|
|
43
|
+
} & ParamsOf<`/${After}`> : {
|
|
44
|
+
[Key in Rest]: string;
|
|
45
|
+
} : Record<never, never>;
|
|
46
|
+
import { METRICS_WINDOWS, type MetricsWindow } from './experiments.js';
|
|
47
|
+
export { METRICS_WINDOWS };
|
|
48
|
+
export declare const METRICS_NONE = "^@none";
|
|
49
|
+
export declare const METRICS_FILTER_MAX_LENGTH = 200;
|
|
50
|
+
/** The networks a metrics row can belong to. Mirrors
|
|
51
|
+
* apps/web/lib/providers/registry.ts (SOCIAL_PROVIDERS). */
|
|
52
|
+
export declare const SOCIAL_PROVIDERS: readonly ["youtube", "instagram", "bluesky", "linkedin", "threads", "facebook", "pinterest", "3speak", "rumble", "fanvue"];
|
|
53
|
+
export type SocialProvider = (typeof SOCIAL_PROVIDERS)[number];
|
|
54
|
+
export declare function isSocialProvider(value: unknown): value is SocialProvider;
|
|
55
|
+
/** YouTube video id (11 chars, base64url). Mirrors
|
|
56
|
+
* apps/web/lib/youtube-analytics.ts (VIDEO_ID). */
|
|
57
|
+
export declare const YOUTUBE_VIDEO_ID: RegExp;
|
|
58
|
+
export declare const ANALYTICS_STATUSES: readonly ["ok", "scope_missing", "not_owned", "no_data"];
|
|
59
|
+
export type AnalyticsStatus = (typeof ANALYTICS_STATUSES)[number];
|
|
60
|
+
export declare function isAnalyticsStatus(value: unknown): value is AnalyticsStatus;
|
|
61
|
+
export declare const COVERAGE_REASONS: readonly ["pending", "retrying", "missed", "no-target", "publish-failed"];
|
|
62
|
+
export type CoverageReason = (typeof COVERAGE_REASONS)[number];
|
|
63
|
+
export declare function isCoverageReason(value: unknown): value is CoverageReason;
|
|
64
|
+
export declare function isMetricsWindow(value: unknown): value is MetricsWindow;
|
|
65
|
+
export declare const UUID: RegExp;
|
|
66
|
+
export interface MetricsQuery {
|
|
67
|
+
window: MetricsWindow;
|
|
68
|
+
personaId: string | null;
|
|
69
|
+
accountId: string | null;
|
|
70
|
+
provider: SocialProvider | null;
|
|
71
|
+
angle: string | null;
|
|
72
|
+
}
|
|
73
|
+
type MetricsParseResult = {
|
|
74
|
+
ok: true;
|
|
75
|
+
query: MetricsQuery;
|
|
76
|
+
} | {
|
|
77
|
+
ok: false;
|
|
78
|
+
error: string;
|
|
79
|
+
};
|
|
80
|
+
export declare function parseMetricsQuery(params: URLSearchParams): MetricsParseResult;
|
|
81
|
+
export declare function metricsSearchParams(query: MetricsQuery): URLSearchParams;
|
|
82
|
+
/** `?account=&video=` for the retention-curve read: each exactly once,
|
|
83
|
+
* a non-empty account within the filter length, a YouTube video id. */
|
|
84
|
+
export declare function parseRetentionCurveQuery(params: URLSearchParams): {
|
|
85
|
+
account: string;
|
|
86
|
+
video: string;
|
|
87
|
+
} | {
|
|
88
|
+
error: string;
|
|
89
|
+
};
|
|
90
|
+
export declare const MetricsQueryParamsSchema: z.ZodObject<{
|
|
91
|
+
window: z.ZodOptional<z.ZodString>;
|
|
92
|
+
persona: z.ZodOptional<z.ZodString>;
|
|
93
|
+
account: z.ZodOptional<z.ZodString>;
|
|
94
|
+
provider: z.ZodOptional<z.ZodString>;
|
|
95
|
+
angle: z.ZodOptional<z.ZodString>;
|
|
96
|
+
}, z.core.$strict>;
|
|
97
|
+
export declare const RetentionCurveQuerySchema: z.ZodObject<{
|
|
98
|
+
account: z.ZodString;
|
|
99
|
+
video: z.ZodString;
|
|
100
|
+
}, z.core.$strict>;
|
|
101
|
+
export declare const MetricsRowSchema: z.ZodObject<{
|
|
102
|
+
postId: z.ZodString;
|
|
103
|
+
personaId: z.ZodNullable<z.ZodString>;
|
|
104
|
+
provider: z.ZodEnum<{
|
|
105
|
+
youtube: "youtube";
|
|
106
|
+
instagram: "instagram";
|
|
107
|
+
linkedin: "linkedin";
|
|
108
|
+
bluesky: "bluesky";
|
|
109
|
+
threads: "threads";
|
|
110
|
+
facebook: "facebook";
|
|
111
|
+
pinterest: "pinterest";
|
|
112
|
+
fanvue: "fanvue";
|
|
113
|
+
"3speak": "3speak";
|
|
114
|
+
rumble: "rumble";
|
|
115
|
+
}>;
|
|
116
|
+
accountId: z.ZodString;
|
|
117
|
+
externalId: z.ZodString;
|
|
118
|
+
scriptAngle: z.ZodNullable<z.ZodString>;
|
|
119
|
+
views: z.ZodNullable<z.ZodNumber>;
|
|
120
|
+
likes: z.ZodNullable<z.ZodNumber>;
|
|
121
|
+
comments: z.ZodNullable<z.ZodNumber>;
|
|
122
|
+
saves: z.ZodNullable<z.ZodNumber>;
|
|
123
|
+
analyticsViews: z.ZodNullable<z.ZodNumber>;
|
|
124
|
+
engagedViews: z.ZodNullable<z.ZodNumber>;
|
|
125
|
+
stayedToWatchPct: z.ZodNullable<z.ZodNumber>;
|
|
126
|
+
averageViewDurationSeconds: z.ZodNullable<z.ZodNumber>;
|
|
127
|
+
averageViewPercentage: z.ZodNullable<z.ZodNumber>;
|
|
128
|
+
contentType: z.ZodNullable<z.ZodString>;
|
|
129
|
+
analyticsStatus: z.ZodNullable<z.ZodEnum<{
|
|
130
|
+
ok: "ok";
|
|
131
|
+
scope_missing: "scope_missing";
|
|
132
|
+
not_owned: "not_owned";
|
|
133
|
+
no_data: "no_data";
|
|
134
|
+
}>>;
|
|
135
|
+
provisional: z.ZodBoolean;
|
|
136
|
+
collectedAt: z.ZodString;
|
|
137
|
+
}, z.core.$strip>;
|
|
138
|
+
export type MetricsRowView = z.infer<typeof MetricsRowSchema>;
|
|
139
|
+
export declare const CoverageItemSchema: z.ZodObject<{
|
|
140
|
+
postId: z.ZodString;
|
|
141
|
+
personaId: z.ZodNullable<z.ZodString>;
|
|
142
|
+
provider: z.ZodEnum<{
|
|
143
|
+
youtube: "youtube";
|
|
144
|
+
instagram: "instagram";
|
|
145
|
+
linkedin: "linkedin";
|
|
146
|
+
bluesky: "bluesky";
|
|
147
|
+
threads: "threads";
|
|
148
|
+
facebook: "facebook";
|
|
149
|
+
pinterest: "pinterest";
|
|
150
|
+
fanvue: "fanvue";
|
|
151
|
+
"3speak": "3speak";
|
|
152
|
+
rumble: "rumble";
|
|
153
|
+
}>;
|
|
154
|
+
accountId: z.ZodString;
|
|
155
|
+
externalId: z.ZodNullable<z.ZodString>;
|
|
156
|
+
scriptAngle: z.ZodNullable<z.ZodString>;
|
|
157
|
+
reason: z.ZodEnum<{
|
|
158
|
+
pending: "pending";
|
|
159
|
+
retrying: "retrying";
|
|
160
|
+
missed: "missed";
|
|
161
|
+
"no-target": "no-target";
|
|
162
|
+
"publish-failed": "publish-failed";
|
|
163
|
+
}>;
|
|
164
|
+
publishedAt: z.ZodString;
|
|
165
|
+
windowOpensAt: z.ZodString;
|
|
166
|
+
windowClosesAt: z.ZodString;
|
|
167
|
+
}, z.core.$strip>;
|
|
168
|
+
export type CoverageItem = z.infer<typeof CoverageItemSchema>;
|
|
169
|
+
export declare const MetricsResponseSchema: z.ZodObject<{
|
|
170
|
+
success: z.ZodLiteral<true>;
|
|
171
|
+
rows: z.ZodArray<z.ZodObject<{
|
|
172
|
+
postId: z.ZodString;
|
|
173
|
+
personaId: z.ZodNullable<z.ZodString>;
|
|
174
|
+
provider: z.ZodEnum<{
|
|
175
|
+
youtube: "youtube";
|
|
176
|
+
instagram: "instagram";
|
|
177
|
+
linkedin: "linkedin";
|
|
178
|
+
bluesky: "bluesky";
|
|
179
|
+
threads: "threads";
|
|
180
|
+
facebook: "facebook";
|
|
181
|
+
pinterest: "pinterest";
|
|
182
|
+
fanvue: "fanvue";
|
|
183
|
+
"3speak": "3speak";
|
|
184
|
+
rumble: "rumble";
|
|
185
|
+
}>;
|
|
186
|
+
accountId: z.ZodString;
|
|
187
|
+
externalId: z.ZodString;
|
|
188
|
+
scriptAngle: z.ZodNullable<z.ZodString>;
|
|
189
|
+
views: z.ZodNullable<z.ZodNumber>;
|
|
190
|
+
likes: z.ZodNullable<z.ZodNumber>;
|
|
191
|
+
comments: z.ZodNullable<z.ZodNumber>;
|
|
192
|
+
saves: z.ZodNullable<z.ZodNumber>;
|
|
193
|
+
analyticsViews: z.ZodNullable<z.ZodNumber>;
|
|
194
|
+
engagedViews: z.ZodNullable<z.ZodNumber>;
|
|
195
|
+
stayedToWatchPct: z.ZodNullable<z.ZodNumber>;
|
|
196
|
+
averageViewDurationSeconds: z.ZodNullable<z.ZodNumber>;
|
|
197
|
+
averageViewPercentage: z.ZodNullable<z.ZodNumber>;
|
|
198
|
+
contentType: z.ZodNullable<z.ZodString>;
|
|
199
|
+
analyticsStatus: z.ZodNullable<z.ZodEnum<{
|
|
200
|
+
ok: "ok";
|
|
201
|
+
scope_missing: "scope_missing";
|
|
202
|
+
not_owned: "not_owned";
|
|
203
|
+
no_data: "no_data";
|
|
204
|
+
}>>;
|
|
205
|
+
provisional: z.ZodBoolean;
|
|
206
|
+
collectedAt: z.ZodString;
|
|
207
|
+
}, z.core.$strip>>;
|
|
208
|
+
truncated: z.ZodBoolean;
|
|
209
|
+
coverage: z.ZodArray<z.ZodObject<{
|
|
210
|
+
postId: z.ZodString;
|
|
211
|
+
personaId: z.ZodNullable<z.ZodString>;
|
|
212
|
+
provider: z.ZodEnum<{
|
|
213
|
+
youtube: "youtube";
|
|
214
|
+
instagram: "instagram";
|
|
215
|
+
linkedin: "linkedin";
|
|
216
|
+
bluesky: "bluesky";
|
|
217
|
+
threads: "threads";
|
|
218
|
+
facebook: "facebook";
|
|
219
|
+
pinterest: "pinterest";
|
|
220
|
+
fanvue: "fanvue";
|
|
221
|
+
"3speak": "3speak";
|
|
222
|
+
rumble: "rumble";
|
|
223
|
+
}>;
|
|
224
|
+
accountId: z.ZodString;
|
|
225
|
+
externalId: z.ZodNullable<z.ZodString>;
|
|
226
|
+
scriptAngle: z.ZodNullable<z.ZodString>;
|
|
227
|
+
reason: z.ZodEnum<{
|
|
228
|
+
pending: "pending";
|
|
229
|
+
retrying: "retrying";
|
|
230
|
+
missed: "missed";
|
|
231
|
+
"no-target": "no-target";
|
|
232
|
+
"publish-failed": "publish-failed";
|
|
233
|
+
}>;
|
|
234
|
+
publishedAt: z.ZodString;
|
|
235
|
+
windowOpensAt: z.ZodString;
|
|
236
|
+
windowClosesAt: z.ZodString;
|
|
237
|
+
}, z.core.$strip>>;
|
|
238
|
+
coverageTruncated: z.ZodBoolean;
|
|
239
|
+
asOf: z.ZodNullable<z.ZodString>;
|
|
240
|
+
}, z.core.$strip>;
|
|
241
|
+
export type MetricsResponse = z.infer<typeof MetricsResponseSchema>;
|
|
242
|
+
export declare const RetentionPointSchema: z.ZodObject<{
|
|
243
|
+
ratio: z.ZodNumber;
|
|
244
|
+
audienceWatchRatio: z.ZodNumber;
|
|
245
|
+
relativeRetentionPerformance: z.ZodNullable<z.ZodNumber>;
|
|
246
|
+
}, z.core.$strip>;
|
|
247
|
+
export type RetentionPoint = z.infer<typeof RetentionPointSchema>;
|
|
248
|
+
export declare const RetentionCurveResponseSchema: z.ZodObject<{
|
|
249
|
+
success: z.ZodLiteral<true>;
|
|
250
|
+
points: z.ZodArray<z.ZodObject<{
|
|
251
|
+
ratio: z.ZodNumber;
|
|
252
|
+
audienceWatchRatio: z.ZodNumber;
|
|
253
|
+
relativeRetentionPerformance: z.ZodNullable<z.ZodNumber>;
|
|
254
|
+
}, z.core.$strip>>;
|
|
255
|
+
startDate: z.ZodString;
|
|
256
|
+
endDate: z.ZodString;
|
|
257
|
+
provisional: z.ZodBoolean;
|
|
258
|
+
}, z.core.$strip>;
|
|
259
|
+
export type RetentionCurveResponse = z.infer<typeof RetentionCurveResponseSchema>;
|
|
260
|
+
export declare const listMetrics: EndpointDefinition<undefined, z.ZodObject<{
|
|
261
|
+
window: z.ZodOptional<z.ZodString>;
|
|
262
|
+
persona: z.ZodOptional<z.ZodString>;
|
|
263
|
+
account: z.ZodOptional<z.ZodString>;
|
|
264
|
+
provider: z.ZodOptional<z.ZodString>;
|
|
265
|
+
angle: z.ZodOptional<z.ZodString>;
|
|
266
|
+
}, z.core.$strict>, z.ZodObject<{
|
|
267
|
+
success: z.ZodLiteral<true>;
|
|
268
|
+
rows: z.ZodArray<z.ZodObject<{
|
|
269
|
+
postId: z.ZodString;
|
|
270
|
+
personaId: z.ZodNullable<z.ZodString>;
|
|
271
|
+
provider: z.ZodEnum<{
|
|
272
|
+
youtube: "youtube";
|
|
273
|
+
instagram: "instagram";
|
|
274
|
+
linkedin: "linkedin";
|
|
275
|
+
bluesky: "bluesky";
|
|
276
|
+
threads: "threads";
|
|
277
|
+
facebook: "facebook";
|
|
278
|
+
pinterest: "pinterest";
|
|
279
|
+
fanvue: "fanvue";
|
|
280
|
+
"3speak": "3speak";
|
|
281
|
+
rumble: "rumble";
|
|
282
|
+
}>;
|
|
283
|
+
accountId: z.ZodString;
|
|
284
|
+
externalId: z.ZodString;
|
|
285
|
+
scriptAngle: z.ZodNullable<z.ZodString>;
|
|
286
|
+
views: z.ZodNullable<z.ZodNumber>;
|
|
287
|
+
likes: z.ZodNullable<z.ZodNumber>;
|
|
288
|
+
comments: z.ZodNullable<z.ZodNumber>;
|
|
289
|
+
saves: z.ZodNullable<z.ZodNumber>;
|
|
290
|
+
analyticsViews: z.ZodNullable<z.ZodNumber>;
|
|
291
|
+
engagedViews: z.ZodNullable<z.ZodNumber>;
|
|
292
|
+
stayedToWatchPct: z.ZodNullable<z.ZodNumber>;
|
|
293
|
+
averageViewDurationSeconds: z.ZodNullable<z.ZodNumber>;
|
|
294
|
+
averageViewPercentage: z.ZodNullable<z.ZodNumber>;
|
|
295
|
+
contentType: z.ZodNullable<z.ZodString>;
|
|
296
|
+
analyticsStatus: z.ZodNullable<z.ZodEnum<{
|
|
297
|
+
ok: "ok";
|
|
298
|
+
scope_missing: "scope_missing";
|
|
299
|
+
not_owned: "not_owned";
|
|
300
|
+
no_data: "no_data";
|
|
301
|
+
}>>;
|
|
302
|
+
provisional: z.ZodBoolean;
|
|
303
|
+
collectedAt: z.ZodString;
|
|
304
|
+
}, z.core.$strip>>;
|
|
305
|
+
truncated: z.ZodBoolean;
|
|
306
|
+
coverage: z.ZodArray<z.ZodObject<{
|
|
307
|
+
postId: z.ZodString;
|
|
308
|
+
personaId: z.ZodNullable<z.ZodString>;
|
|
309
|
+
provider: z.ZodEnum<{
|
|
310
|
+
youtube: "youtube";
|
|
311
|
+
instagram: "instagram";
|
|
312
|
+
linkedin: "linkedin";
|
|
313
|
+
bluesky: "bluesky";
|
|
314
|
+
threads: "threads";
|
|
315
|
+
facebook: "facebook";
|
|
316
|
+
pinterest: "pinterest";
|
|
317
|
+
fanvue: "fanvue";
|
|
318
|
+
"3speak": "3speak";
|
|
319
|
+
rumble: "rumble";
|
|
320
|
+
}>;
|
|
321
|
+
accountId: z.ZodString;
|
|
322
|
+
externalId: z.ZodNullable<z.ZodString>;
|
|
323
|
+
scriptAngle: z.ZodNullable<z.ZodString>;
|
|
324
|
+
reason: z.ZodEnum<{
|
|
325
|
+
pending: "pending";
|
|
326
|
+
retrying: "retrying";
|
|
327
|
+
missed: "missed";
|
|
328
|
+
"no-target": "no-target";
|
|
329
|
+
"publish-failed": "publish-failed";
|
|
330
|
+
}>;
|
|
331
|
+
publishedAt: z.ZodString;
|
|
332
|
+
windowOpensAt: z.ZodString;
|
|
333
|
+
windowClosesAt: z.ZodString;
|
|
334
|
+
}, z.core.$strip>>;
|
|
335
|
+
coverageTruncated: z.ZodBoolean;
|
|
336
|
+
asOf: z.ZodNullable<z.ZodString>;
|
|
337
|
+
}, z.core.$strip>, "/api/metrics">;
|
|
338
|
+
export declare const getRetentionCurve: EndpointDefinition<undefined, z.ZodObject<{
|
|
339
|
+
account: z.ZodString;
|
|
340
|
+
video: z.ZodString;
|
|
341
|
+
}, z.core.$strict>, z.ZodObject<{
|
|
342
|
+
success: z.ZodLiteral<true>;
|
|
343
|
+
points: z.ZodArray<z.ZodObject<{
|
|
344
|
+
ratio: z.ZodNumber;
|
|
345
|
+
audienceWatchRatio: z.ZodNumber;
|
|
346
|
+
relativeRetentionPerformance: z.ZodNullable<z.ZodNumber>;
|
|
347
|
+
}, z.core.$strip>>;
|
|
348
|
+
startDate: z.ZodString;
|
|
349
|
+
endDate: z.ZodString;
|
|
350
|
+
provisional: z.ZodBoolean;
|
|
351
|
+
}, z.core.$strip>, "/api/metrics/retention-curve">;
|