@kokimoki/app 1.11.0 → 1.12.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.
@@ -5,7 +5,6 @@ import type { Paginated } from "./types/common";
5
5
  import { KokimokiStore } from "./kokimoki-store";
6
6
  import { KokimokiAwareness } from "./kokimoki-awareness";
7
7
  import { KokimokiLocalStore } from "./kokimoki-local-store";
8
- import { ZodType } from "zod";
9
8
  declare const KokimokiClient_base: new () => TypedEmitter<KokimokiClientEvents>;
10
9
  export declare class KokimokiClient<ClientContextT = any> extends KokimokiClient_base {
11
10
  readonly host: string;
@@ -77,7 +76,7 @@ export declare class KokimokiClient<ClientContextT = any> extends KokimokiClient
77
76
  [K in keyof T]: KokimokiStore<T[K]>;
78
77
  }, handler: (proxies: T) => ReturnT | Promise<ReturnT>): Promise<ReturnT>;
79
78
  close(): Promise<void>;
80
- getRoomHash<T extends ZodType>(store: KokimokiStore<T>): number;
79
+ getRoomHash<T>(store: KokimokiStore<T>): number;
81
80
  /** Initializers */
82
81
  store<T>(name: string, defaultState: T, autoJoin?: boolean): KokimokiStore<T>;
83
82
  localStore<T>(name: string, defaultState: T): KokimokiLocalStore<T>;
@@ -132,5 +131,9 @@ export declare class KokimokiClient<ClientContextT = any> extends KokimokiClient
132
131
  sendWebhook<T>(event: string, data: T): Promise<{
133
132
  jobId: string;
134
133
  }>;
134
+ /**
135
+ * Use AI to apply prompt to an image
136
+ */
137
+ transformImage(baseImageUrl: string, prompt: string, tags?: string[]): Promise<Upload>;
135
138
  }
136
139
  export {};
@@ -711,4 +711,15 @@ export class KokimokiClient extends EventEmitter {
711
711
  });
712
712
  return await res.json();
713
713
  }
714
+ /**
715
+ * Use AI to apply prompt to an image
716
+ */
717
+ async transformImage(baseImageUrl, prompt, tags = []) {
718
+ const res = await fetch(`${this._apiUrl}/ai/images`, {
719
+ method: "POST",
720
+ headers: this.apiHeaders,
721
+ body: JSON.stringify({ baseImageUrl, prompt, tags }),
722
+ });
723
+ return await res.json();
724
+ }
714
725
  }
@@ -1,6 +1,5 @@
1
1
  import TypedEmitter from 'typed-emitter';
2
2
  import * as Y from 'yjs';
3
- import { ZodType } from 'zod';
4
3
 
5
4
  interface Paginated<T> {
6
5
  items: T[];
@@ -148,7 +147,7 @@ declare class KokimokiClient<ClientContextT = any> extends KokimokiClient_base {
148
147
  [K in keyof T]: KokimokiStore<T[K]>;
149
148
  }, handler: (proxies: T) => ReturnT | Promise<ReturnT>): Promise<ReturnT>;
150
149
  close(): Promise<void>;
151
- getRoomHash<T extends ZodType>(store: KokimokiStore<T>): number;
150
+ getRoomHash<T>(store: KokimokiStore<T>): number;
152
151
  /** Initializers */
153
152
  store<T>(name: string, defaultState: T, autoJoin?: boolean): KokimokiStore<T>;
154
153
  localStore<T>(name: string, defaultState: T): KokimokiLocalStore<T>;
@@ -203,6 +202,10 @@ declare class KokimokiClient<ClientContextT = any> extends KokimokiClient_base {
203
202
  sendWebhook<T>(event: string, data: T): Promise<{
204
203
  jobId: string;
205
204
  }>;
205
+ /**
206
+ * Use AI to apply prompt to an image
207
+ */
208
+ transformImage(baseImageUrl: string, prompt: string, tags?: string[]): Promise<Upload>;
206
209
  }
207
210
 
208
211
  declare class RoomSubscription {
@@ -486,7 +486,7 @@ function eventTargetAgnosticAddListener(emitter, name, listener, flags) {
486
486
  var eventsExports = events.exports;
487
487
  var EventEmitter$1 = /*@__PURE__*/getDefaultExportFromCjs(eventsExports);
488
488
 
489
- const KOKIMOKI_APP_VERSION = "1.11.0";
489
+ const KOKIMOKI_APP_VERSION = "1.12.0";
490
490
 
491
491
  /**
492
492
  * Utility module to work with key-value stores.
@@ -14934,6 +14934,17 @@ class KokimokiClient extends EventEmitter$1 {
14934
14934
  });
14935
14935
  return await res.json();
14936
14936
  }
14937
+ /**
14938
+ * Use AI to apply prompt to an image
14939
+ */
14940
+ async transformImage(baseImageUrl, prompt, tags = []) {
14941
+ const res = await fetch(`${this._apiUrl}/ai/images`, {
14942
+ method: "POST",
14943
+ headers: this.apiHeaders,
14944
+ body: JSON.stringify({ baseImageUrl, prompt, tags }),
14945
+ });
14946
+ return await res.json();
14947
+ }
14937
14948
  }
14938
14949
 
14939
14950
  export { KokimokiAwareness, KokimokiClient, KokimokiStore, RoomSubscription, RoomSubscriptionMode };