@bitmagic/asset-core 0.2.30-dev.0 → 0.2.31-dev.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,92 @@
1
+ /**
2
+ * The ad package: what `bitmagic ads` builds and api-server accepts (docs/creator-ads.md).
3
+ *
4
+ * One source of truth for both ends. The CLI checks a package against these rules before anything
5
+ * is uploaded (`bitmagic ads check`), and api-server checks the manifest again when it arrives, so a
6
+ * stale or hand-built package is refused in the same words. The numbers are Google Ads Demand Gen's
7
+ * (video ads and image ads), the format the team runs creator orders in.
8
+ *
9
+ * Pure: no filesystem, no network.
10
+ */
11
+ export declare const AD_PACKAGE_VERSION = 1;
12
+ export interface AdCopy {
13
+ headlines: string[];
14
+ longHeadlines: string[];
15
+ descriptions: string[];
16
+ }
17
+ export type AdCopyField = keyof AdCopy;
18
+ /** How many of each, and how long. Demand Gen allows five of each; one is enough to run. */
19
+ export declare const AD_COPY_RULES: Record<AdCopyField, {
20
+ min: number;
21
+ max: number;
22
+ chars: number;
23
+ label: string;
24
+ }>;
25
+ export type AdVideoSlot = 'landscape' | 'portrait' | 'square';
26
+ export type AdImageSlot = 'landscape' | 'square' | 'portrait';
27
+ export interface AdSlotSpec {
28
+ /** The size `bitmagic ads render` writes. */
29
+ width: number;
30
+ height: number;
31
+ /** The smallest short side accepted, for a package rendered some other way. */
32
+ minShortSide: number;
33
+ /** The file name inside `.bitmagic/ads/`. */
34
+ file: string;
35
+ /** How the slot is named to people: the aspect ratio. */
36
+ label: string;
37
+ }
38
+ export declare const AD_VIDEO_SLOTS: Record<AdVideoSlot, AdSlotSpec>;
39
+ export declare const AD_IMAGE_SLOTS: Record<AdImageSlot, AdSlotSpec>;
40
+ export declare const AD_VIDEO_SLOT_NAMES: readonly AdVideoSlot[];
41
+ export declare const AD_IMAGE_SLOT_NAMES: readonly AdImageSlot[];
42
+ /** Ad length. Google takes longer, but a game ad that has not landed by 15 s rarely does at 60. */
43
+ export declare const AD_VIDEO_SECONDS: {
44
+ readonly min: 6;
45
+ readonly max: 60;
46
+ readonly recommended: 15;
47
+ };
48
+ /** api-server's game-media caps (post-media-rules.ts), checked here before anything is uploaded. */
49
+ export declare const AD_VIDEO_MAX_BYTES: number;
50
+ export declare const AD_IMAGE_MAX_BYTES: number;
51
+ /** The file holding the copy, inside `.bitmagic/ads/`. */
52
+ export declare const AD_COPY_FILE = "ads.json";
53
+ export interface AdVideoAsset {
54
+ url: string;
55
+ width: number;
56
+ height: number;
57
+ durationSec: number;
58
+ bytes: number;
59
+ }
60
+ export interface AdImageAsset {
61
+ url: string;
62
+ width: number;
63
+ height: number;
64
+ bytes: number;
65
+ }
66
+ export interface AdPackageManifest {
67
+ version: typeof AD_PACKAGE_VERSION;
68
+ gameName: string;
69
+ copy: AdCopy;
70
+ videos: Record<AdVideoSlot, AdVideoAsset>;
71
+ images: Record<AdImageSlot, AdImageAsset>;
72
+ }
73
+ /**
74
+ * The copy, trimmed, or null when it is not even shaped like copy. The CLI writes what this
75
+ * returns, so stray whitespace from an agent's edit never reaches Google.
76
+ */
77
+ export declare function normalizeAdCopy(copy: unknown): AdCopy | null;
78
+ /**
79
+ * What is wrong with the copy, as sentences an agent can act on — empty when it would pass. The
80
+ * rules are Google's limits plus the editorial rules most likely to get a game ad disapproved:
81
+ * emoji, repeated punctuation, an exclamation mark in a headline, and words in capitals.
82
+ */
83
+ export declare function adCopyProblems(copy: unknown): string[];
84
+ /** Same shape as the slot, within 2%: a renderer that rounds a dimension is not refused for it. */
85
+ export declare function matchesSlotAspect(width: number, height: number, slot: AdSlotSpec): boolean;
86
+ /**
87
+ * What is wrong with a whole package manifest — empty when api-server would accept it.
88
+ * `assetUrlPrefix` is where every asset must live: the game's own `game-media/<gameId>/` folder,
89
+ * so a package can only ever point at files uploaded for that game.
90
+ */
91
+ export declare function adManifestProblems(manifest: unknown, assetUrlPrefix: string): string[];
92
+ //# sourceMappingURL=ad-package.d.ts.map
@@ -0,0 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+ * One source of truth for both ends. The CLI checks a package against these rules before anything
5
+ * is uploaded (`bitmagic ads check`), and api-server checks the manifest again when it arrives, so a
6
+ * stale or hand-built package is refused in the same words. The numbers are Google Ads Demand Gen's
7
+ * (video ads and image ads), the format the team runs creator orders in.
8
+ *
9
+ * Pure: no filesystem, no network.
10
+ */
11
+ export const AD_PACKAGE_VERSION = 1;
12
+ /** How many of each, and how long. Demand Gen allows five of each; one is enough to run. */
13
+ export const AD_COPY_RULES = {
14
+ headlines: { min: 1, max: 5, chars: 40, label: 'headline' },
15
+ longHeadlines: { min: 1, max: 5, chars: 90, label: 'long headline' },
16
+ descriptions: { min: 1, max: 5, chars: 90, label: 'description' },
17
+ };
18
+ export const AD_VIDEO_SLOTS = {
19
+ landscape: { width: 1920, height: 1080, minShortSide: 720, file: 'video-16x9.mp4', label: '16:9' },
20
+ portrait: { width: 1080, height: 1920, minShortSide: 720, file: 'video-9x16.mp4', label: '9:16' },
21
+ square: { width: 1080, height: 1080, minShortSide: 720, file: 'video-1x1.mp4', label: '1:1' },
22
+ };
23
+ export const AD_IMAGE_SLOTS = {
24
+ landscape: { width: 1200, height: 628, minShortSide: 314, file: 'image-1.91x1.jpg', label: '1.91:1' },
25
+ square: { width: 1200, height: 1200, minShortSide: 300, file: 'image-1x1.jpg', label: '1:1' },
26
+ portrait: { width: 960, height: 1200, minShortSide: 480, file: 'image-4x5.jpg', label: '4:5' },
27
+ };
28
+ export const AD_VIDEO_SLOT_NAMES = ['landscape', 'portrait', 'square'];
29
+ export const AD_IMAGE_SLOT_NAMES = ['landscape', 'square', 'portrait'];
30
+ /** Ad length. Google takes longer, but a game ad that has not landed by 15 s rarely does at 60. */
31
+ export const AD_VIDEO_SECONDS = { min: 6, max: 60, recommended: 15 };
32
+ /** api-server's game-media caps (post-media-rules.ts), checked here before anything is uploaded. */
33
+ export const AD_VIDEO_MAX_BYTES = 200 * 1024 * 1024;
34
+ export const AD_IMAGE_MAX_BYTES = 10 * 1024 * 1024;
35
+ /** The file holding the copy, inside `.bitmagic/ads/`. */
36
+ export const AD_COPY_FILE = 'ads.json';
37
+ function isRecord(value) {
38
+ return typeof value === 'object' && value !== null && !Array.isArray(value);
39
+ }
40
+ const EMOJI = /\p{Extended_Pictographic}/u;
41
+ /** A run of the same punctuation mark: Google rejects "Play now!!" as gimmicky. */
42
+ const REPEATED_PUNCTUATION = /([!?.,])\1/;
43
+ /**
44
+ * A word Google would call excessive capitalization: letters only, more than four of them, all
45
+ * capitals. Short ones (RPG, FPS, NPC) and anything with a digit (3D, WELCOME50) are fine.
46
+ */
47
+ function shoutingWord(text) {
48
+ for (const word of text.split(/[^\p{L}\p{N}]+/u)) {
49
+ if (word.length > 4 && /^\p{Lu}+$/u.test(word))
50
+ return word;
51
+ }
52
+ return null;
53
+ }
54
+ /**
55
+ * The copy, trimmed, or null when it is not even shaped like copy. The CLI writes what this
56
+ * returns, so stray whitespace from an agent's edit never reaches Google.
57
+ */
58
+ export function normalizeAdCopy(copy) {
59
+ if (!isRecord(copy))
60
+ return null;
61
+ const field = (name) => {
62
+ const value = copy[name];
63
+ if (!Array.isArray(value) || !value.every((item) => typeof item === 'string'))
64
+ return null;
65
+ return value.map((item) => item.trim());
66
+ };
67
+ const headlines = field('headlines');
68
+ const longHeadlines = field('longHeadlines');
69
+ const descriptions = field('descriptions');
70
+ if (!headlines || !longHeadlines || !descriptions)
71
+ return null;
72
+ return { headlines, longHeadlines, descriptions };
73
+ }
74
+ /**
75
+ * What is wrong with the copy, as sentences an agent can act on — empty when it would pass. The
76
+ * rules are Google's limits plus the editorial rules most likely to get a game ad disapproved:
77
+ * emoji, repeated punctuation, an exclamation mark in a headline, and words in capitals.
78
+ */
79
+ export function adCopyProblems(copy) {
80
+ const normalized = normalizeAdCopy(copy);
81
+ if (!normalized) {
82
+ return ['The copy must be an object with "headlines", "longHeadlines" and "descriptions", each a list of strings.'];
83
+ }
84
+ const problems = [];
85
+ for (const name of Object.keys(AD_COPY_RULES)) {
86
+ const rule = AD_COPY_RULES[name];
87
+ const items = normalized[name];
88
+ if (items.length < rule.min || items.length > rule.max) {
89
+ problems.push(`Write ${rule.min}–${rule.max} ${rule.label}s (found ${items.length}).`);
90
+ }
91
+ const seen = new Set();
92
+ items.forEach((item, index) => {
93
+ const where = `${rule.label} ${index + 1}`;
94
+ if (item === '') {
95
+ problems.push(`The ${where} is empty.`);
96
+ return;
97
+ }
98
+ if (item.length > rule.chars) {
99
+ problems.push(`The ${where} is ${item.length} characters; the limit is ${rule.chars}: "${item}".`);
100
+ }
101
+ if (EMOJI.test(item))
102
+ problems.push(`The ${where} has an emoji, which Google does not allow: "${item}".`);
103
+ if (REPEATED_PUNCTUATION.test(item))
104
+ problems.push(`The ${where} repeats punctuation: "${item}".`);
105
+ if (name === 'headlines' && item.includes('!')) {
106
+ problems.push(`The ${where} has an exclamation mark, which Google does not allow in headlines: "${item}".`);
107
+ }
108
+ const shout = shoutingWord(item);
109
+ if (shout !== null) {
110
+ problems.push(`The ${where} writes "${shout}" in capitals; Google disapproves excessive capitalization.`);
111
+ }
112
+ const key = item.toLowerCase();
113
+ if (seen.has(key))
114
+ problems.push(`The ${where} repeats an earlier ${rule.label}; each one must differ.`);
115
+ seen.add(key);
116
+ });
117
+ }
118
+ return problems;
119
+ }
120
+ /** Same shape as the slot, within 2%: a renderer that rounds a dimension is not refused for it. */
121
+ export function matchesSlotAspect(width, height, slot) {
122
+ if (!(width > 0 && height > 0))
123
+ return false;
124
+ return Math.abs(width / height - slot.width / slot.height) / (slot.width / slot.height) <= 0.02;
125
+ }
126
+ function sizeProblem(kind, label, width, height, slot) {
127
+ if (typeof width !== 'number' || typeof height !== 'number')
128
+ return `The ${label} ${kind} has no size.`;
129
+ if (!matchesSlotAspect(width, height, slot)) {
130
+ return `The ${label} ${kind} is ${width}×${height}; it must be ${slot.label} (${slot.width}×${slot.height}).`;
131
+ }
132
+ if (Math.min(width, height) < slot.minShortSide) {
133
+ return `The ${label} ${kind} is ${width}×${height}; its short side must be at least ${slot.minShortSide} px.`;
134
+ }
135
+ return null;
136
+ }
137
+ function urlProblem(kind, label, url, prefix, extensions) {
138
+ if (typeof url !== 'string' || url === '')
139
+ return `The ${label} ${kind} has no URL.`;
140
+ if (!url.startsWith(prefix))
141
+ return `The ${label} ${kind} is not one of this game's uploads.`;
142
+ const lower = url.toLowerCase();
143
+ if (!extensions.some((ext) => lower.endsWith(ext))) {
144
+ return `The ${label} ${kind} must be ${extensions.join(' or ')}.`;
145
+ }
146
+ return null;
147
+ }
148
+ /**
149
+ * What is wrong with a whole package manifest — empty when api-server would accept it.
150
+ * `assetUrlPrefix` is where every asset must live: the game's own `game-media/<gameId>/` folder,
151
+ * so a package can only ever point at files uploaded for that game.
152
+ */
153
+ export function adManifestProblems(manifest, assetUrlPrefix) {
154
+ if (!isRecord(manifest))
155
+ return ['The package must be a JSON object.'];
156
+ const problems = [];
157
+ if (manifest.version !== AD_PACKAGE_VERSION)
158
+ problems.push(`The package version must be ${AD_PACKAGE_VERSION}.`);
159
+ const name = manifest.gameName;
160
+ if (typeof name !== 'string' || name.trim() === '' || name.length > 80) {
161
+ problems.push('The package needs the game name (1–80 characters).');
162
+ }
163
+ problems.push(...adCopyProblems(manifest.copy));
164
+ const videos = isRecord(manifest.videos) ? manifest.videos : {};
165
+ for (const slotName of AD_VIDEO_SLOT_NAMES) {
166
+ const slot = AD_VIDEO_SLOTS[slotName];
167
+ const video = videos[slotName];
168
+ if (!isRecord(video)) {
169
+ problems.push(`The package is missing its ${slot.label} video.`);
170
+ continue;
171
+ }
172
+ const url = urlProblem('video', slot.label, video.url, assetUrlPrefix, ['.mp4']);
173
+ if (url)
174
+ problems.push(url);
175
+ const size = sizeProblem('video', slot.label, video.width, video.height, slot);
176
+ if (size)
177
+ problems.push(size);
178
+ const seconds = video.durationSec;
179
+ if (typeof seconds !== 'number' || seconds < AD_VIDEO_SECONDS.min || seconds > AD_VIDEO_SECONDS.max) {
180
+ problems.push(`The ${slot.label} video must be ${AD_VIDEO_SECONDS.min}–${AD_VIDEO_SECONDS.max} seconds long.`);
181
+ }
182
+ const bytes = video.bytes;
183
+ if (typeof bytes !== 'number' || bytes < 1 || bytes > AD_VIDEO_MAX_BYTES) {
184
+ problems.push(`The ${slot.label} video must be 1 byte to ${AD_VIDEO_MAX_BYTES / (1024 * 1024)} MiB.`);
185
+ }
186
+ }
187
+ const images = isRecord(manifest.images) ? manifest.images : {};
188
+ for (const slotName of AD_IMAGE_SLOT_NAMES) {
189
+ const slot = AD_IMAGE_SLOTS[slotName];
190
+ const image = images[slotName];
191
+ if (!isRecord(image)) {
192
+ problems.push(`The package is missing its ${slot.label} image.`);
193
+ continue;
194
+ }
195
+ const url = urlProblem('image', slot.label, image.url, assetUrlPrefix, ['.jpg', '.jpeg', '.png']);
196
+ if (url)
197
+ problems.push(url);
198
+ const size = sizeProblem('image', slot.label, image.width, image.height, slot);
199
+ if (size)
200
+ problems.push(size);
201
+ const bytes = image.bytes;
202
+ if (typeof bytes !== 'number' || bytes < 1 || bytes > AD_IMAGE_MAX_BYTES) {
203
+ problems.push(`The ${slot.label} image must be 1 byte to ${AD_IMAGE_MAX_BYTES / (1024 * 1024)} MiB.`);
204
+ }
205
+ }
206
+ return problems;
207
+ }
208
+ //# sourceMappingURL=ad-package.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ad-package.js","sourceRoot":"","sources":["../src/ad-package.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AAEH,MAAM,CAAC,MAAM,kBAAkB,GAAG,CAAC,CAAC;AAUpC,4FAA4F;AAC5F,MAAM,CAAC,MAAM,aAAa,GAAoF;IAC5G,SAAS,EAAE,EAAE,GAAG,EAAE,CAAC,EAAE,GAAG,EAAE,CAAC,EAAE,KAAK,EAAE,EAAE,EAAE,KAAK,EAAE,UAAU,EAAE;IAC3D,aAAa,EAAE,EAAE,GAAG,EAAE,CAAC,EAAE,GAAG,EAAE,CAAC,EAAE,KAAK,EAAE,EAAE,EAAE,KAAK,EAAE,eAAe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9B,MAAM,KAAK,GAAG,KAAK,CAAC,KAAK,CAAC;QAC1B,IAAI,OAAO,KAAK,KAAK,QAAQ,IAAI,KAAK,GAAG,CAAC,IAAI,KAAK,GAAG,kBAAkB,EAAE,CAAC;YACzE,QAAQ,CAAC,IAAI,CAAC,OAAO,IAAI,CAAC,KAAK,4BAA4B,kBAAkB,GAAG,CAAC,IAAI,GAAG,IAAI,CAAC,OAAO,CAAC,CAAC;QACxG,CAAC;IACH,CAAC;IACD,OAAO,QAAQ,CAAC;AAClB,CAAC"}
@@ -11,14 +11,14 @@ export declare const blockTypeParamsSchema: z.ZodObject<{
11
11
  sideDescription: z.ZodOptional<z.ZodString>;
12
12
  referenceImageUrl: z.ZodOptional<z.ZodString>;
13
13
  }, "strict", z.ZodTypeAny, {
14
- name: string;
15
14
  description: string;
15
+ name: string;
16
16
  referenceImageUrl?: string | undefined;
17
17
  displayName?: string | undefined;
18
18
  sideDescription?: string | undefined;
19
19
  }, {
20
- name: string;
21
20
  description: string;
21
+ name: string;
22
22
  referenceImageUrl?: string | undefined;
23
23
  displayName?: string | undefined;
24
24
  sideDescription?: string | undefined;
@@ -9,19 +9,19 @@ export declare const imageAssetParamsSchema: z.ZodObject<{
9
9
  model: z.ZodOptional<z.ZodString>;
10
10
  assetId: z.ZodOptional<z.ZodString>;
11
11
  }, "strict", z.ZodTypeAny, {
12
+ width: number;
13
+ height: number;
12
14
  name: string;
13
15
  prompt: string;
14
- height: number;
15
- width: number;
16
16
  referenceImageUrl?: string | undefined;
17
17
  assetId?: string | undefined;
18
18
  model?: string | undefined;
19
19
  }, {
20
20
  name: string;
21
21
  prompt: string;
22
- referenceImageUrl?: string | undefined;
23
- height?: number | undefined;
24
22
  width?: number | undefined;
23
+ height?: number | undefined;
24
+ referenceImageUrl?: string | undefined;
25
25
  assetId?: string | undefined;
26
26
  model?: string | undefined;
27
27
  }>;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@bitmagic/asset-core",
3
- "version": "0.2.30-dev.0",
3
+ "version": "0.2.31-dev.0",
4
4
  "license": "SEE LICENSE IN LICENSE.md",
5
5
  "author": "Bitmagic Oy",
6
6
  "type": "module",
@@ -35,6 +35,10 @@
35
35
  "types": "./dist/art-style.d.ts",
36
36
  "default": "./dist/art-style.js"
37
37
  },
38
+ "./ad-package": {
39
+ "types": "./dist/ad-package.d.ts",
40
+ "default": "./dist/ad-package.js"
41
+ },
38
42
  "./reference-record": {
39
43
  "types": "./dist/reference-record.d.ts",
40
44
  "default": "./dist/reference-record.js"