@sogni-ai/sogni-client 4.0.0-alpha.11 → 4.0.0-alpha.13
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/CHANGELOG.md +14 -0
- package/dist/Account/index.d.ts +1 -0
- package/dist/Account/index.js +11 -2
- package/dist/Account/index.js.map +1 -1
- package/dist/ApiClient/WebSocketClient/BrowserWebSocketClient/BrowserWebSocketClient.d.ts +34 -0
- package/dist/ApiClient/WebSocketClient/BrowserWebSocketClient/BrowserWebSocketClient.js +195 -0
- package/dist/ApiClient/WebSocketClient/BrowserWebSocketClient/BrowserWebSocketClient.js.map +1 -0
- package/dist/ApiClient/WebSocketClient/BrowserWebSocketClient/WSCoordinator.d.ts +101 -0
- package/dist/ApiClient/WebSocketClient/BrowserWebSocketClient/WSCoordinator.js +359 -0
- package/dist/ApiClient/WebSocketClient/BrowserWebSocketClient/WSCoordinator.js.map +1 -0
- package/dist/ApiClient/WebSocketClient/BrowserWebSocketClient/types.d.ts +101 -0
- package/dist/ApiClient/WebSocketClient/BrowserWebSocketClient/types.js +3 -0
- package/dist/ApiClient/WebSocketClient/BrowserWebSocketClient/types.js.map +1 -0
- package/dist/ApiClient/WebSocketClient/events.d.ts +1 -0
- package/dist/ApiClient/WebSocketClient/index.d.ts +2 -2
- package/dist/ApiClient/WebSocketClient/types.d.ts +13 -0
- package/dist/ApiClient/index.d.ts +2 -3
- package/dist/ApiClient/index.js +20 -2
- package/dist/ApiClient/index.js.map +1 -1
- package/dist/Projects/Job.d.ts +1 -1
- package/dist/Projects/index.d.ts +3 -9
- package/dist/Projects/index.js +3 -1
- package/dist/Projects/index.js.map +1 -1
- package/dist/Projects/types/EstimationResponse.d.ts +2 -0
- package/dist/Projects/types/index.d.ts +13 -0
- package/dist/index.d.ts +1 -1
- package/dist/index.js +6 -2
- package/dist/index.js.map +1 -1
- package/dist/lib/DataEntity.js +4 -2
- package/dist/lib/DataEntity.js.map +1 -1
- package/package.json +1 -1
- package/src/Account/index.ts +11 -2
- package/src/ApiClient/WebSocketClient/BrowserWebSocketClient/BrowserWebSocketClient.ts +206 -0
- package/src/ApiClient/WebSocketClient/BrowserWebSocketClient/WSCoordinator.ts +425 -0
- package/src/ApiClient/WebSocketClient/BrowserWebSocketClient/types.ts +107 -0
- package/src/ApiClient/WebSocketClient/events.ts +2 -0
- package/src/ApiClient/WebSocketClient/index.ts +2 -2
- package/src/ApiClient/WebSocketClient/types.ts +16 -0
- package/src/ApiClient/index.ts +25 -6
- package/src/Projects/index.ts +5 -2
- package/src/Projects/types/EstimationResponse.ts +2 -0
- package/src/Projects/types/index.ts +14 -0
- package/src/index.ts +7 -3
- package/src/lib/DataEntity.ts +4 -2
|
@@ -208,4 +208,18 @@ export interface EstimateRequest {
|
|
|
208
208
|
contextImages?: number;
|
|
209
209
|
}
|
|
210
210
|
|
|
211
|
+
/**
|
|
212
|
+
* Represents estimation of project cost in different currency formats
|
|
213
|
+
*/
|
|
214
|
+
export interface CostEstimation {
|
|
215
|
+
/** Cost in selected token type */
|
|
216
|
+
token: string;
|
|
217
|
+
/** Cost in USD */
|
|
218
|
+
usd: string;
|
|
219
|
+
/** Cost in Spark Points */
|
|
220
|
+
spark: string;
|
|
221
|
+
/** Cost in Sogni tokens */
|
|
222
|
+
sogni: string;
|
|
223
|
+
}
|
|
224
|
+
|
|
211
225
|
export type EnhancementStrength = 'light' | 'medium' | 'heavy';
|
package/src/index.ts
CHANGED
|
@@ -63,7 +63,7 @@ export interface SogniClientConfig {
|
|
|
63
63
|
socketEndpoint?: string;
|
|
64
64
|
/**
|
|
65
65
|
* Disable WebSocket connection. Useful for testing or when WebSocket is not needed.
|
|
66
|
-
* Note that many may not work without WebSocket connection.
|
|
66
|
+
* Note that many APIs may not work without WebSocket connection.
|
|
67
67
|
* @experimental
|
|
68
68
|
* @internal
|
|
69
69
|
*/
|
|
@@ -141,9 +141,13 @@ export class SogniClient {
|
|
|
141
141
|
throw Error('This method should only be called when using cookie auth');
|
|
142
142
|
}
|
|
143
143
|
try {
|
|
144
|
-
await this.apiClient.rest.get<ApiResponse<MeData>>('/v1/account/me');
|
|
144
|
+
const res = await this.apiClient.rest.get<ApiResponse<MeData>>('/v1/account/me');
|
|
145
145
|
await auth.authenticate();
|
|
146
|
-
|
|
146
|
+
this.currentAccount._update({
|
|
147
|
+
username: res.data.username,
|
|
148
|
+
email: res.data.currentEmail,
|
|
149
|
+
walletAddress: res.data.walletAddress
|
|
150
|
+
});
|
|
147
151
|
return true;
|
|
148
152
|
} catch (e) {
|
|
149
153
|
this.apiClient.logger.info('Client is not authenticated');
|
package/src/lib/DataEntity.ts
CHANGED
|
@@ -25,9 +25,11 @@ abstract class DataEntity<D, E extends EntityEvents = EntityEvents> extends Type
|
|
|
25
25
|
_update(delta: Partial<D>) {
|
|
26
26
|
//@ts-ignore
|
|
27
27
|
const changedKeys = Object.keys(delta).filter((key) => this.data[key] !== delta[key]);
|
|
28
|
-
this.data = { ...this.data, ...delta };
|
|
29
28
|
this.lastUpdated = new Date();
|
|
30
|
-
|
|
29
|
+
if (changedKeys.length > 0) {
|
|
30
|
+
this.data = { ...this.data, ...delta };
|
|
31
|
+
this.emit('updated', changedKeys);
|
|
32
|
+
}
|
|
31
33
|
}
|
|
32
34
|
|
|
33
35
|
/**
|