@omen.dog/sdk 1.1.0 → 1.2.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -182,6 +182,43 @@ Trait ids are `category/file.svg` paths and double as public preview SVGs at
182
182
  `https://omen.dog/avatar/{traitId}`. Common traits are free for everyone and
183
183
  can't be awarded.
184
184
 
185
+ ### App-owned assets & image generation
186
+
187
+ Host content art your **app** owns (shared across all your users, not a single
188
+ user's upload) and serve it from a public, immutable, CDN-cacheable URL — exempt
189
+ from the per-user asset cap. Bring your own bytes, or generate them on Omen
190
+ billed to your prepaid Sparks pool.
191
+
192
+ ```ts
193
+ // Host bytes you already have (Buffer / Uint8Array / base64). Max 10 MB.
194
+ const asset = await omen.assets.upload(pngBuffer, { name: 'Apple', contentType: 'image/png' });
195
+ console.log(asset.url); // /api/v1/assets/…/file — embed anywhere
196
+
197
+ // List / fetch / evict (eviction is yours to control — never purged on a timer)
198
+ const { assets, nextCursor } = await omen.assets.list({ limit: 50 });
199
+ await omen.assets.delete(asset.id);
200
+
201
+ // Generate one image, billed to your pool, hosted app-owned. Requires an
202
+ // approved Partner App + a funded pool. Output is child-safety-filtered.
203
+ const { asset: img, cost, poolBalance } = await omen.images.generate({
204
+ prompt: 'a friendly red apple with a smiling face',
205
+ aspectRatio: '4:3', // 1:1 | 4:3 | 3:4 | 16:9 | 9:16
206
+ style: 'storybook', // optional preset; omit for raw-prompt mode
207
+ idempotencyKey: `apple:${pageId}`,
208
+ });
209
+
210
+ // Keep a recurring character consistent across story pages — pass an identity ref
211
+ await omen.images.generate({
212
+ prompt: 'the same fox, now jumping over a log',
213
+ aspectRatio: '3:4',
214
+ referenceImages: [{ data: foxPngBase64, tag: 'identity' }], // up to 4, ≤4 MB each
215
+ });
216
+ ```
217
+
218
+ A depleted pool fails closed (`402`, throws `OmenError`); a rejected prompt or
219
+ blocked image throws `OmenValidationError` (`400 content_rejected`) and your pool
220
+ is not charged.
221
+
185
222
  ## Creation Runtime Types
186
223
 
187
224
  For creation developers — get autocomplete for the `omen.*` global:
package/dist/index.d.mts CHANGED
@@ -436,6 +436,79 @@ interface Webhook {
436
436
  createdAt: string;
437
437
  updatedAt: string;
438
438
  }
439
+ /** A content asset owned by your app (not a user), served by a public immutable URL. */
440
+ interface AppAsset {
441
+ id: string;
442
+ name: string;
443
+ /** Public, immutable, CDN-cacheable file URL (relative to the API base). */
444
+ url: string;
445
+ width: number;
446
+ height: number;
447
+ fileSize: number;
448
+ contentType: string | null;
449
+ /** 'upload' (you sent the bytes) or 'generated' (app-pool generation). */
450
+ source: 'upload' | 'generated';
451
+ /** The generation prompt, for generated assets. */
452
+ prompt?: string | null;
453
+ createdAt: string;
454
+ }
455
+ interface UploadAssetOptions {
456
+ /** Display name. Defaults to a slug of the filename. */
457
+ name?: string;
458
+ /** MIME type of the bytes (e.g. 'image/png'). Inferred from a data: URL if omitted. */
459
+ contentType?: string;
460
+ /** Original filename — used to derive the stored extension if contentType is absent. */
461
+ filename?: string;
462
+ }
463
+ interface AppAssetListOptions {
464
+ /** Page size (1–100, default 50). */
465
+ limit?: number;
466
+ /** Pagination cursor — pass the previous response's `nextCursor`. */
467
+ cursor?: string;
468
+ }
469
+ interface AppAssetListResponse {
470
+ assets: AppAsset[];
471
+ nextCursor: string | null;
472
+ }
473
+ /** Curated model-native aspect ratios (Decision 7). */
474
+ type ImageAspectRatio = '1:1' | '4:3' | '3:4' | '16:9' | '9:16';
475
+ /** Optional illustration style presets. Omit for raw-prompt mode. */
476
+ type ContentImageStyle = 'storybook' | 'watercolor' | 'flat-vector' | 'cartoon' | 'crayon' | '3d-clay';
477
+ /**
478
+ * A reference image passed natively to the model. `tag: 'style'` matches palette
479
+ * / line / rendering; `tag: 'identity'` keeps a recurring character consistent
480
+ * across pages. `data` is base64 (raw or a data: URL).
481
+ */
482
+ interface ReferenceImage {
483
+ data: string;
484
+ tag?: 'style' | 'identity';
485
+ contentType?: string;
486
+ }
487
+ interface GenerateImageOptions {
488
+ /** What to draw. Mandatory; always passes the child-safety filter (output is child-facing). */
489
+ prompt: string;
490
+ /** Curated native aspect ratio. Default '1:1'. */
491
+ aspectRatio?: ImageAspectRatio;
492
+ /** Optional illustration style preset. Omit for raw-prompt mode. */
493
+ style?: ContentImageStyle;
494
+ /** Cut the subject out onto transparency (chroma-key). Default false. */
495
+ transparent?: boolean;
496
+ /** Up to 4 reference images (base64 string or { data, tag }). */
497
+ referenceImages?: Array<string | ReferenceImage>;
498
+ /** Display name for the stored asset. */
499
+ name?: string;
500
+ /** Make retries safe — the same key produces one asset and is charged once. */
501
+ idempotencyKey?: string;
502
+ }
503
+ interface GeneratedImageResult {
504
+ asset: AppAsset;
505
+ /** Sparks debited from your pool for this image. */
506
+ cost: number;
507
+ /** Pool balance after the debit (null on an idempotent replay). */
508
+ poolBalance: number | null;
509
+ /** True when an idempotent replay returned an already-generated asset. */
510
+ idempotent?: boolean;
511
+ }
439
512
 
440
513
  /** Read-only access to Omen user profiles and friend lists. */
441
514
  declare class UsersNamespace {
@@ -976,6 +1049,88 @@ declare class AvatarNamespace {
976
1049
  }): Promise<AvatarCatalogResult>;
977
1050
  }
978
1051
 
1052
+ /**
1053
+ * App-owned content hosting (Tier 3, F264 Phase 1).
1054
+ *
1055
+ * Host images your **app** owns — content art shared across all your users (a
1056
+ * vocabulary item's picture, a story-page illustration), not a single user's
1057
+ * upload. App-owned assets are server-to-server, owned by the app, **exempt from
1058
+ * the per-user asset cap**, and served by a public, immutable, CDN-cacheable URL.
1059
+ *
1060
+ * Build the bytes with your own provider and host them here, or generate them on
1061
+ * Omen with {@link ImagesNamespace.generate}.
1062
+ */
1063
+ declare class AssetsNamespace {
1064
+ private readonly http;
1065
+ private readonly appId;
1066
+ constructor(http: HttpClient, appId: string);
1067
+ /**
1068
+ * Upload bytes and get back a public, immutable file URL. Accepts a Buffer /
1069
+ * Uint8Array (raw bytes) or a base64 string (raw or a `data:` URL). Supported:
1070
+ * PNG, JPG, SVG, GIF (SVGs are sanitized). Max 10 MB.
1071
+ *
1072
+ * @example
1073
+ * ```ts
1074
+ * const { url } = await omen.assets.upload(pngBuffer, { name: 'Apple', contentType: 'image/png' });
1075
+ * ```
1076
+ */
1077
+ upload(data: Buffer | Uint8Array | string, options?: UploadAssetOptions): Promise<AppAsset>;
1078
+ /** List the app's assets, newest first. Paginate with `nextCursor`. */
1079
+ list(options?: AppAssetListOptions): Promise<AppAssetListResponse>;
1080
+ /** Get one asset's metadata. */
1081
+ get(id: string): Promise<AppAsset>;
1082
+ /** Evict an asset (hard delete — row + bytes). Never purged on a timer; deletion is yours to control. */
1083
+ delete(id: string): Promise<{
1084
+ deleted: boolean;
1085
+ id: string;
1086
+ }>;
1087
+ }
1088
+
1089
+ /**
1090
+ * App-pool image generation (Tier 3, F264 Phase 2).
1091
+ *
1092
+ * Generate content art on your app's behalf, **billed to your prepaid Sparks
1093
+ * pool** (never an end user), stored **app-owned**, and served by the same public
1094
+ * immutable URL as every other Omen asset. Built for content-time / overnight
1095
+ * pre-builds — no user, no spinner.
1096
+ *
1097
+ * Requires an **approved Partner App** (Developer Portal → Partner Program) and a
1098
+ * funded pool. A depleted pool fails closed (`402 pool_insufficient`). The output
1099
+ * is child-facing, so generation always runs the safety filter; a rejected prompt
1100
+ * or blocked image returns `400 content_rejected` (the SDK throws `OmenError`
1101
+ * with `.status === 400`; inspect the response body's `code`/`reason`) and your
1102
+ * pool is **not** charged.
1103
+ */
1104
+ declare class ImagesNamespace {
1105
+ private readonly http;
1106
+ private readonly appId;
1107
+ constructor(http: HttpClient, appId: string);
1108
+ /**
1109
+ * Generate one image and host it app-owned.
1110
+ *
1111
+ * @example
1112
+ * ```ts
1113
+ * const { asset, cost, poolBalance } = await omen.images.generate({
1114
+ * prompt: 'a friendly red apple with a smiling face',
1115
+ * aspectRatio: '4:3',
1116
+ * style: 'storybook',
1117
+ * idempotencyKey: `apple:${pageId}`,
1118
+ * });
1119
+ * console.log(asset.url); // embed anywhere
1120
+ * ```
1121
+ *
1122
+ * @example Recurring character across story pages — pass an identity reference:
1123
+ * ```ts
1124
+ * await omen.images.generate({
1125
+ * prompt: 'the same fox, now jumping over a log',
1126
+ * aspectRatio: '3:4',
1127
+ * referenceImages: [{ data: foxPngBase64, tag: 'identity' }],
1128
+ * });
1129
+ * ```
1130
+ */
1131
+ generate(options: GenerateImageOptions): Promise<GeneratedImageResult>;
1132
+ }
1133
+
979
1134
  /** Base error for all Omen SDK errors. */
980
1135
  declare class OmenError extends Error {
981
1136
  /** HTTP status code from the API. */
@@ -1056,9 +1211,13 @@ declare class OmenClient {
1056
1211
  readonly emails: EmailsNamespace;
1057
1212
  /** Shared Omen avatar in your app: editor tokens + render URLs (F262). */
1058
1213
  readonly avatar: AvatarNamespace;
1214
+ /** Host app-owned content art — upload + serve from a public immutable URL (F264). */
1215
+ readonly assets: AssetsNamespace;
1216
+ /** Generate content art billed to your prepaid Sparks pool, hosted app-owned (F264). */
1217
+ readonly images: ImagesNamespace;
1059
1218
  constructor(options: OmenClientOptions & {
1060
1219
  appId: string;
1061
1220
  });
1062
1221
  }
1063
1222
 
1064
- export { type AcquisitionType, type AwardBatchItem, type AwardBatchResponse, type AwardBatchResultItem, type AwardCatalogOptions, type AwardCatalogResult, type AwardResult, type AwardSparksOptions, type Badge, type BatchIssueResponse, type CatalogType, type Collection, type CreateCollectionOptions, type CreateProductOptions, type CreateWebhookOptions, type DisplayTokenOptions, type Document, type EditorTokenOptions, type EmailLogEntry, type EmailLogResponse, type FeaturedItem, type Friend, type FriendsListOptions, type FriendsListResponse, type IssueItemOptions, type Item, type ItemType, type MultiplayerConfig, type NotificationCategory, type NotificationResponse, OmenAuthError, OmenClient, type OmenClientOptions, OmenError, OmenNotFoundError, OmenRateLimitError, OmenValidationError, type PinnedCreation, type PoolBudget, type PoolStatus, type Product, type QueryDocumentsOptions, type QueryDocumentsResponse, type RoomLogicVersion, type SchemaFieldType, type SendEmailOptions, type SendEmailResult, type SendNotificationOptions, type StorageData, type TransactionOperation, type TransactionResponse, type UpdateMultiplayerConfigOptions, type UpdateProductOptions, type UserProfile, type UserProfileResponse, type Webhook };
1223
+ export { type AcquisitionType, type AppAsset, type AppAssetListOptions, type AppAssetListResponse, type AwardBatchItem, type AwardBatchResponse, type AwardBatchResultItem, type AwardCatalogOptions, type AwardCatalogResult, type AwardResult, type AwardSparksOptions, type Badge, type BatchIssueResponse, type CatalogType, type Collection, type ContentImageStyle, type CreateCollectionOptions, type CreateProductOptions, type CreateWebhookOptions, type DisplayTokenOptions, type Document, type EditorTokenOptions, type EmailLogEntry, type EmailLogResponse, type FeaturedItem, type Friend, type FriendsListOptions, type FriendsListResponse, type GenerateImageOptions, type GeneratedImageResult, type ImageAspectRatio, type IssueItemOptions, type Item, type ItemType, type MultiplayerConfig, type NotificationCategory, type NotificationResponse, OmenAuthError, OmenClient, type OmenClientOptions, OmenError, OmenNotFoundError, OmenRateLimitError, OmenValidationError, type PinnedCreation, type PoolBudget, type PoolStatus, type Product, type QueryDocumentsOptions, type QueryDocumentsResponse, type ReferenceImage, type RoomLogicVersion, type SchemaFieldType, type SendEmailOptions, type SendEmailResult, type SendNotificationOptions, type StorageData, type TransactionOperation, type TransactionResponse, type UpdateMultiplayerConfigOptions, type UpdateProductOptions, type UploadAssetOptions, type UserProfile, type UserProfileResponse, type Webhook };
package/dist/index.d.ts CHANGED
@@ -436,6 +436,79 @@ interface Webhook {
436
436
  createdAt: string;
437
437
  updatedAt: string;
438
438
  }
439
+ /** A content asset owned by your app (not a user), served by a public immutable URL. */
440
+ interface AppAsset {
441
+ id: string;
442
+ name: string;
443
+ /** Public, immutable, CDN-cacheable file URL (relative to the API base). */
444
+ url: string;
445
+ width: number;
446
+ height: number;
447
+ fileSize: number;
448
+ contentType: string | null;
449
+ /** 'upload' (you sent the bytes) or 'generated' (app-pool generation). */
450
+ source: 'upload' | 'generated';
451
+ /** The generation prompt, for generated assets. */
452
+ prompt?: string | null;
453
+ createdAt: string;
454
+ }
455
+ interface UploadAssetOptions {
456
+ /** Display name. Defaults to a slug of the filename. */
457
+ name?: string;
458
+ /** MIME type of the bytes (e.g. 'image/png'). Inferred from a data: URL if omitted. */
459
+ contentType?: string;
460
+ /** Original filename — used to derive the stored extension if contentType is absent. */
461
+ filename?: string;
462
+ }
463
+ interface AppAssetListOptions {
464
+ /** Page size (1–100, default 50). */
465
+ limit?: number;
466
+ /** Pagination cursor — pass the previous response's `nextCursor`. */
467
+ cursor?: string;
468
+ }
469
+ interface AppAssetListResponse {
470
+ assets: AppAsset[];
471
+ nextCursor: string | null;
472
+ }
473
+ /** Curated model-native aspect ratios (Decision 7). */
474
+ type ImageAspectRatio = '1:1' | '4:3' | '3:4' | '16:9' | '9:16';
475
+ /** Optional illustration style presets. Omit for raw-prompt mode. */
476
+ type ContentImageStyle = 'storybook' | 'watercolor' | 'flat-vector' | 'cartoon' | 'crayon' | '3d-clay';
477
+ /**
478
+ * A reference image passed natively to the model. `tag: 'style'` matches palette
479
+ * / line / rendering; `tag: 'identity'` keeps a recurring character consistent
480
+ * across pages. `data` is base64 (raw or a data: URL).
481
+ */
482
+ interface ReferenceImage {
483
+ data: string;
484
+ tag?: 'style' | 'identity';
485
+ contentType?: string;
486
+ }
487
+ interface GenerateImageOptions {
488
+ /** What to draw. Mandatory; always passes the child-safety filter (output is child-facing). */
489
+ prompt: string;
490
+ /** Curated native aspect ratio. Default '1:1'. */
491
+ aspectRatio?: ImageAspectRatio;
492
+ /** Optional illustration style preset. Omit for raw-prompt mode. */
493
+ style?: ContentImageStyle;
494
+ /** Cut the subject out onto transparency (chroma-key). Default false. */
495
+ transparent?: boolean;
496
+ /** Up to 4 reference images (base64 string or { data, tag }). */
497
+ referenceImages?: Array<string | ReferenceImage>;
498
+ /** Display name for the stored asset. */
499
+ name?: string;
500
+ /** Make retries safe — the same key produces one asset and is charged once. */
501
+ idempotencyKey?: string;
502
+ }
503
+ interface GeneratedImageResult {
504
+ asset: AppAsset;
505
+ /** Sparks debited from your pool for this image. */
506
+ cost: number;
507
+ /** Pool balance after the debit (null on an idempotent replay). */
508
+ poolBalance: number | null;
509
+ /** True when an idempotent replay returned an already-generated asset. */
510
+ idempotent?: boolean;
511
+ }
439
512
 
440
513
  /** Read-only access to Omen user profiles and friend lists. */
441
514
  declare class UsersNamespace {
@@ -976,6 +1049,88 @@ declare class AvatarNamespace {
976
1049
  }): Promise<AvatarCatalogResult>;
977
1050
  }
978
1051
 
1052
+ /**
1053
+ * App-owned content hosting (Tier 3, F264 Phase 1).
1054
+ *
1055
+ * Host images your **app** owns — content art shared across all your users (a
1056
+ * vocabulary item's picture, a story-page illustration), not a single user's
1057
+ * upload. App-owned assets are server-to-server, owned by the app, **exempt from
1058
+ * the per-user asset cap**, and served by a public, immutable, CDN-cacheable URL.
1059
+ *
1060
+ * Build the bytes with your own provider and host them here, or generate them on
1061
+ * Omen with {@link ImagesNamespace.generate}.
1062
+ */
1063
+ declare class AssetsNamespace {
1064
+ private readonly http;
1065
+ private readonly appId;
1066
+ constructor(http: HttpClient, appId: string);
1067
+ /**
1068
+ * Upload bytes and get back a public, immutable file URL. Accepts a Buffer /
1069
+ * Uint8Array (raw bytes) or a base64 string (raw or a `data:` URL). Supported:
1070
+ * PNG, JPG, SVG, GIF (SVGs are sanitized). Max 10 MB.
1071
+ *
1072
+ * @example
1073
+ * ```ts
1074
+ * const { url } = await omen.assets.upload(pngBuffer, { name: 'Apple', contentType: 'image/png' });
1075
+ * ```
1076
+ */
1077
+ upload(data: Buffer | Uint8Array | string, options?: UploadAssetOptions): Promise<AppAsset>;
1078
+ /** List the app's assets, newest first. Paginate with `nextCursor`. */
1079
+ list(options?: AppAssetListOptions): Promise<AppAssetListResponse>;
1080
+ /** Get one asset's metadata. */
1081
+ get(id: string): Promise<AppAsset>;
1082
+ /** Evict an asset (hard delete — row + bytes). Never purged on a timer; deletion is yours to control. */
1083
+ delete(id: string): Promise<{
1084
+ deleted: boolean;
1085
+ id: string;
1086
+ }>;
1087
+ }
1088
+
1089
+ /**
1090
+ * App-pool image generation (Tier 3, F264 Phase 2).
1091
+ *
1092
+ * Generate content art on your app's behalf, **billed to your prepaid Sparks
1093
+ * pool** (never an end user), stored **app-owned**, and served by the same public
1094
+ * immutable URL as every other Omen asset. Built for content-time / overnight
1095
+ * pre-builds — no user, no spinner.
1096
+ *
1097
+ * Requires an **approved Partner App** (Developer Portal → Partner Program) and a
1098
+ * funded pool. A depleted pool fails closed (`402 pool_insufficient`). The output
1099
+ * is child-facing, so generation always runs the safety filter; a rejected prompt
1100
+ * or blocked image returns `400 content_rejected` (the SDK throws `OmenError`
1101
+ * with `.status === 400`; inspect the response body's `code`/`reason`) and your
1102
+ * pool is **not** charged.
1103
+ */
1104
+ declare class ImagesNamespace {
1105
+ private readonly http;
1106
+ private readonly appId;
1107
+ constructor(http: HttpClient, appId: string);
1108
+ /**
1109
+ * Generate one image and host it app-owned.
1110
+ *
1111
+ * @example
1112
+ * ```ts
1113
+ * const { asset, cost, poolBalance } = await omen.images.generate({
1114
+ * prompt: 'a friendly red apple with a smiling face',
1115
+ * aspectRatio: '4:3',
1116
+ * style: 'storybook',
1117
+ * idempotencyKey: `apple:${pageId}`,
1118
+ * });
1119
+ * console.log(asset.url); // embed anywhere
1120
+ * ```
1121
+ *
1122
+ * @example Recurring character across story pages — pass an identity reference:
1123
+ * ```ts
1124
+ * await omen.images.generate({
1125
+ * prompt: 'the same fox, now jumping over a log',
1126
+ * aspectRatio: '3:4',
1127
+ * referenceImages: [{ data: foxPngBase64, tag: 'identity' }],
1128
+ * });
1129
+ * ```
1130
+ */
1131
+ generate(options: GenerateImageOptions): Promise<GeneratedImageResult>;
1132
+ }
1133
+
979
1134
  /** Base error for all Omen SDK errors. */
980
1135
  declare class OmenError extends Error {
981
1136
  /** HTTP status code from the API. */
@@ -1056,9 +1211,13 @@ declare class OmenClient {
1056
1211
  readonly emails: EmailsNamespace;
1057
1212
  /** Shared Omen avatar in your app: editor tokens + render URLs (F262). */
1058
1213
  readonly avatar: AvatarNamespace;
1214
+ /** Host app-owned content art — upload + serve from a public immutable URL (F264). */
1215
+ readonly assets: AssetsNamespace;
1216
+ /** Generate content art billed to your prepaid Sparks pool, hosted app-owned (F264). */
1217
+ readonly images: ImagesNamespace;
1059
1218
  constructor(options: OmenClientOptions & {
1060
1219
  appId: string;
1061
1220
  });
1062
1221
  }
1063
1222
 
1064
- export { type AcquisitionType, type AwardBatchItem, type AwardBatchResponse, type AwardBatchResultItem, type AwardCatalogOptions, type AwardCatalogResult, type AwardResult, type AwardSparksOptions, type Badge, type BatchIssueResponse, type CatalogType, type Collection, type CreateCollectionOptions, type CreateProductOptions, type CreateWebhookOptions, type DisplayTokenOptions, type Document, type EditorTokenOptions, type EmailLogEntry, type EmailLogResponse, type FeaturedItem, type Friend, type FriendsListOptions, type FriendsListResponse, type IssueItemOptions, type Item, type ItemType, type MultiplayerConfig, type NotificationCategory, type NotificationResponse, OmenAuthError, OmenClient, type OmenClientOptions, OmenError, OmenNotFoundError, OmenRateLimitError, OmenValidationError, type PinnedCreation, type PoolBudget, type PoolStatus, type Product, type QueryDocumentsOptions, type QueryDocumentsResponse, type RoomLogicVersion, type SchemaFieldType, type SendEmailOptions, type SendEmailResult, type SendNotificationOptions, type StorageData, type TransactionOperation, type TransactionResponse, type UpdateMultiplayerConfigOptions, type UpdateProductOptions, type UserProfile, type UserProfileResponse, type Webhook };
1223
+ export { type AcquisitionType, type AppAsset, type AppAssetListOptions, type AppAssetListResponse, type AwardBatchItem, type AwardBatchResponse, type AwardBatchResultItem, type AwardCatalogOptions, type AwardCatalogResult, type AwardResult, type AwardSparksOptions, type Badge, type BatchIssueResponse, type CatalogType, type Collection, type ContentImageStyle, type CreateCollectionOptions, type CreateProductOptions, type CreateWebhookOptions, type DisplayTokenOptions, type Document, type EditorTokenOptions, type EmailLogEntry, type EmailLogResponse, type FeaturedItem, type Friend, type FriendsListOptions, type FriendsListResponse, type GenerateImageOptions, type GeneratedImageResult, type ImageAspectRatio, type IssueItemOptions, type Item, type ItemType, type MultiplayerConfig, type NotificationCategory, type NotificationResponse, OmenAuthError, OmenClient, type OmenClientOptions, OmenError, OmenNotFoundError, OmenRateLimitError, OmenValidationError, type PinnedCreation, type PoolBudget, type PoolStatus, type Product, type QueryDocumentsOptions, type QueryDocumentsResponse, type ReferenceImage, type RoomLogicVersion, type SchemaFieldType, type SendEmailOptions, type SendEmailResult, type SendNotificationOptions, type StorageData, type TransactionOperation, type TransactionResponse, type UpdateMultiplayerConfigOptions, type UpdateProductOptions, type UploadAssetOptions, type UserProfile, type UserProfileResponse, type Webhook };
package/dist/index.js CHANGED
@@ -845,6 +845,86 @@ var AvatarNamespace = class {
845
845
  }
846
846
  };
847
847
 
848
+ // src/namespaces/assets.ts
849
+ var AssetsNamespace = class {
850
+ constructor(http, appId) {
851
+ this.http = http;
852
+ this.appId = appId;
853
+ }
854
+ /**
855
+ * Upload bytes and get back a public, immutable file URL. Accepts a Buffer /
856
+ * Uint8Array (raw bytes) or a base64 string (raw or a `data:` URL). Supported:
857
+ * PNG, JPG, SVG, GIF (SVGs are sanitized). Max 10 MB.
858
+ *
859
+ * @example
860
+ * ```ts
861
+ * const { url } = await omen.assets.upload(pngBuffer, { name: 'Apple', contentType: 'image/png' });
862
+ * ```
863
+ */
864
+ async upload(data, options = {}) {
865
+ const fileData = typeof data === "string" ? data : Buffer.from(data).toString("base64");
866
+ const res = await this.http.request(`/api/v1/apps/${this.appId}/assets`, {
867
+ method: "POST",
868
+ body: { fileData, ...options }
869
+ });
870
+ return res.asset;
871
+ }
872
+ /** List the app's assets, newest first. Paginate with `nextCursor`. */
873
+ async list(options = {}) {
874
+ return this.http.request(`/api/v1/apps/${this.appId}/assets`, {
875
+ query: { limit: options.limit, cursor: options.cursor }
876
+ });
877
+ }
878
+ /** Get one asset's metadata. */
879
+ async get(id) {
880
+ const res = await this.http.request(`/api/v1/apps/${this.appId}/assets/${id}`);
881
+ return res.asset;
882
+ }
883
+ /** Evict an asset (hard delete — row + bytes). Never purged on a timer; deletion is yours to control. */
884
+ async delete(id) {
885
+ return this.http.request(`/api/v1/apps/${this.appId}/assets/${id}`, { method: "DELETE" });
886
+ }
887
+ };
888
+
889
+ // src/namespaces/images.ts
890
+ var ImagesNamespace = class {
891
+ constructor(http, appId) {
892
+ this.http = http;
893
+ this.appId = appId;
894
+ }
895
+ /**
896
+ * Generate one image and host it app-owned.
897
+ *
898
+ * @example
899
+ * ```ts
900
+ * const { asset, cost, poolBalance } = await omen.images.generate({
901
+ * prompt: 'a friendly red apple with a smiling face',
902
+ * aspectRatio: '4:3',
903
+ * style: 'storybook',
904
+ * idempotencyKey: `apple:${pageId}`,
905
+ * });
906
+ * console.log(asset.url); // embed anywhere
907
+ * ```
908
+ *
909
+ * @example Recurring character across story pages — pass an identity reference:
910
+ * ```ts
911
+ * await omen.images.generate({
912
+ * prompt: 'the same fox, now jumping over a log',
913
+ * aspectRatio: '3:4',
914
+ * referenceImages: [{ data: foxPngBase64, tag: 'identity' }],
915
+ * });
916
+ * ```
917
+ */
918
+ async generate(options) {
919
+ const { idempotencyKey, ...body } = options;
920
+ return this.http.request(`/api/v1/apps/${this.appId}/generate/image`, {
921
+ method: "POST",
922
+ body,
923
+ headers: idempotencyKey ? { "Idempotency-Key": idempotencyKey } : void 0
924
+ });
925
+ }
926
+ };
927
+
848
928
  // src/childLogin/rfc8628.js
849
929
  function mapPollResponse(httpStatus, body) {
850
930
  body = body || {};
@@ -1163,6 +1243,10 @@ var OmenClient = class {
1163
1243
  emails;
1164
1244
  /** Shared Omen avatar in your app: editor tokens + render URLs (F262). */
1165
1245
  avatar;
1246
+ /** Host app-owned content art — upload + serve from a public immutable URL (F264). */
1247
+ assets;
1248
+ /** Generate content art billed to your prepaid Sparks pool, hosted app-owned (F264). */
1249
+ images;
1166
1250
  constructor(options) {
1167
1251
  if (!options.token) throw new Error("OmenClient: token is required");
1168
1252
  if (!options.appId) throw new Error("OmenClient: appId is required");
@@ -1179,6 +1263,8 @@ var OmenClient = class {
1179
1263
  this.sparks = new SparksNamespace(http, options.appId);
1180
1264
  this.emails = new EmailsNamespace(http, options.appId);
1181
1265
  this.avatar = new AvatarNamespace(options.appId, baseUrl);
1266
+ this.assets = new AssetsNamespace(http, options.appId);
1267
+ this.images = new ImagesNamespace(http, options.appId);
1182
1268
  }
1183
1269
  };
1184
1270
  // Annotate the CommonJS export names for ESM import in node:
package/dist/index.mjs CHANGED
@@ -817,6 +817,86 @@ var AvatarNamespace = class {
817
817
  }
818
818
  };
819
819
 
820
+ // src/namespaces/assets.ts
821
+ var AssetsNamespace = class {
822
+ constructor(http, appId) {
823
+ this.http = http;
824
+ this.appId = appId;
825
+ }
826
+ /**
827
+ * Upload bytes and get back a public, immutable file URL. Accepts a Buffer /
828
+ * Uint8Array (raw bytes) or a base64 string (raw or a `data:` URL). Supported:
829
+ * PNG, JPG, SVG, GIF (SVGs are sanitized). Max 10 MB.
830
+ *
831
+ * @example
832
+ * ```ts
833
+ * const { url } = await omen.assets.upload(pngBuffer, { name: 'Apple', contentType: 'image/png' });
834
+ * ```
835
+ */
836
+ async upload(data, options = {}) {
837
+ const fileData = typeof data === "string" ? data : Buffer.from(data).toString("base64");
838
+ const res = await this.http.request(`/api/v1/apps/${this.appId}/assets`, {
839
+ method: "POST",
840
+ body: { fileData, ...options }
841
+ });
842
+ return res.asset;
843
+ }
844
+ /** List the app's assets, newest first. Paginate with `nextCursor`. */
845
+ async list(options = {}) {
846
+ return this.http.request(`/api/v1/apps/${this.appId}/assets`, {
847
+ query: { limit: options.limit, cursor: options.cursor }
848
+ });
849
+ }
850
+ /** Get one asset's metadata. */
851
+ async get(id) {
852
+ const res = await this.http.request(`/api/v1/apps/${this.appId}/assets/${id}`);
853
+ return res.asset;
854
+ }
855
+ /** Evict an asset (hard delete — row + bytes). Never purged on a timer; deletion is yours to control. */
856
+ async delete(id) {
857
+ return this.http.request(`/api/v1/apps/${this.appId}/assets/${id}`, { method: "DELETE" });
858
+ }
859
+ };
860
+
861
+ // src/namespaces/images.ts
862
+ var ImagesNamespace = class {
863
+ constructor(http, appId) {
864
+ this.http = http;
865
+ this.appId = appId;
866
+ }
867
+ /**
868
+ * Generate one image and host it app-owned.
869
+ *
870
+ * @example
871
+ * ```ts
872
+ * const { asset, cost, poolBalance } = await omen.images.generate({
873
+ * prompt: 'a friendly red apple with a smiling face',
874
+ * aspectRatio: '4:3',
875
+ * style: 'storybook',
876
+ * idempotencyKey: `apple:${pageId}`,
877
+ * });
878
+ * console.log(asset.url); // embed anywhere
879
+ * ```
880
+ *
881
+ * @example Recurring character across story pages — pass an identity reference:
882
+ * ```ts
883
+ * await omen.images.generate({
884
+ * prompt: 'the same fox, now jumping over a log',
885
+ * aspectRatio: '3:4',
886
+ * referenceImages: [{ data: foxPngBase64, tag: 'identity' }],
887
+ * });
888
+ * ```
889
+ */
890
+ async generate(options) {
891
+ const { idempotencyKey, ...body } = options;
892
+ return this.http.request(`/api/v1/apps/${this.appId}/generate/image`, {
893
+ method: "POST",
894
+ body,
895
+ headers: idempotencyKey ? { "Idempotency-Key": idempotencyKey } : void 0
896
+ });
897
+ }
898
+ };
899
+
820
900
  // src/index.ts
821
901
  var OmenClient = class {
822
902
  /** User profiles and friend lists. */
@@ -841,6 +921,10 @@ var OmenClient = class {
841
921
  emails;
842
922
  /** Shared Omen avatar in your app: editor tokens + render URLs (F262). */
843
923
  avatar;
924
+ /** Host app-owned content art — upload + serve from a public immutable URL (F264). */
925
+ assets;
926
+ /** Generate content art billed to your prepaid Sparks pool, hosted app-owned (F264). */
927
+ images;
844
928
  constructor(options) {
845
929
  if (!options.token) throw new Error("OmenClient: token is required");
846
930
  if (!options.appId) throw new Error("OmenClient: appId is required");
@@ -857,6 +941,8 @@ var OmenClient = class {
857
941
  this.sparks = new SparksNamespace(http, options.appId);
858
942
  this.emails = new EmailsNamespace(http, options.appId);
859
943
  this.avatar = new AvatarNamespace(options.appId, baseUrl);
944
+ this.assets = new AssetsNamespace(http, options.appId);
945
+ this.images = new ImagesNamespace(http, options.appId);
860
946
  }
861
947
  };
862
948
  export {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@omen.dog/sdk",
3
- "version": "1.1.0",
3
+ "version": "1.2.0",
4
4
  "description": "Official server-side TypeScript SDK for the Omen platform",
5
5
  "license": "MIT",
6
6
  "main": "./dist/index.js",