whio-api-sdk 1.0.212-beta-staging → 1.0.213-beta-staging

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.
@@ -1,6 +1,7 @@
1
1
  import { BaseClient } from './base-client';
2
- import { AudioFile, UpdateAudioFileDto, Base64AudioFile, CreateBase64AudioFileDto, UpdateBase64AudioFileDto, AddBase64ChunkResponse } from '../types';
2
+ import { AudioFile, UpdateAudioFileDto, Base64AudioFile, CreateBase64AudioFileDto, UpdateBase64AudioFileDto, AddBase64ChunkResponse, SDKConfig } from '../types';
3
3
  export declare class AudioModule extends BaseClient {
4
+ constructor(config?: SDKConfig, parentEventEmitter?: BaseClient);
4
5
  uploadAudioFileToSession(sessionId: string, file: File | Blob, fileName?: string, culturalTranscription?: string): Promise<AudioFile>;
5
6
  uploadAudioFileWithTranscriptionQueue(sessionId: string, file: File | Blob, options?: {
6
7
  fileName?: string;
@@ -11,6 +11,9 @@ import { BaseClient } from './base-client';
11
11
  import { AudioFileStatus, } from '../types';
12
12
  import urls from '../urls';
13
13
  export class AudioModule extends BaseClient {
14
+ constructor(config = {}, parentEventEmitter) {
15
+ super(config, parentEventEmitter);
16
+ }
14
17
  // ======================
15
18
  // AUDIO FILE METHODS
16
19
  // ======================
@@ -10,7 +10,8 @@ export declare class BaseClient {
10
10
  protected refreshToken: string | null;
11
11
  protected user: User | null;
12
12
  private baseEventHandlers;
13
- constructor(config?: SDKConfig);
13
+ protected parentEventEmitter?: BaseClient;
14
+ constructor(config?: SDKConfig, parentEventEmitter?: BaseClient);
14
15
  protected initialize(): Promise<void>;
15
16
  fetchConfig(url: string): Promise<void>;
16
17
  protected getToken(): Promise<void>;
@@ -12,13 +12,14 @@ import { jwtDecode } from 'jwt-decode';
12
12
  * Base HTTP client for making authenticated requests
13
13
  */
14
14
  export class BaseClient {
15
- constructor(config = {}) {
15
+ constructor(config = {}, parentEventEmitter) {
16
16
  this.accessToken = null;
17
17
  this.refreshToken = null;
18
18
  this.user = null;
19
19
  this.baseEventHandlers = new Map();
20
20
  this.baseUrl = config.baseUrl || '/api';
21
21
  this.storage = config.storage;
22
+ this.parentEventEmitter = parentEventEmitter;
22
23
  this.initialize();
23
24
  }
24
25
  initialize() {
@@ -237,5 +238,9 @@ export class BaseClient {
237
238
  }
238
239
  });
239
240
  }
241
+ // Forward event to parent emitter if available
242
+ if (this.parentEventEmitter) {
243
+ this.parentEventEmitter.emitEvent(event, ...args);
244
+ }
240
245
  }
241
246
  }
@@ -1,6 +1,7 @@
1
1
  import { BaseClient } from './base-client';
2
- import { Template, TemplateCategory, UserTemplate, TranscriptionAudioUploadResponse } from '../types';
2
+ import { Template, TemplateCategory, UserTemplate, TranscriptionAudioUploadResponse, SDKConfig } from '../types';
3
3
  export declare class TemplateModule extends BaseClient {
4
+ constructor(config?: SDKConfig, parentEventEmitter?: BaseClient);
4
5
  createTemplate(title: string, content: string, categoryId?: string, workflowId?: string, agentId?: string): Promise<Template>;
5
6
  updateTemplate(title: string, content: string, id: string, workflowId?: string, agentId?: string): Promise<Template>;
6
7
  getTemplates(): Promise<Template[]>;
@@ -10,6 +10,9 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
10
10
  import { BaseClient } from './base-client';
11
11
  import urls from '../urls';
12
12
  export class TemplateModule extends BaseClient {
13
+ constructor(config = {}, parentEventEmitter) {
14
+ super(config, parentEventEmitter);
15
+ }
13
16
  // ======================
14
17
  // TEMPLATE METHODS
15
18
  // ======================
@@ -28,16 +28,16 @@ import { WebSocketModule } from './modules/websocket.module';
28
28
  export class ApiSDK extends BaseClient {
29
29
  constructor(config = {}) {
30
30
  super(config);
31
- // Initialize all domain modules with the same config
31
+ // Initialize all domain modules with the same config and this as parent event emitter
32
32
  this.auth = new AuthModule(config);
33
33
  this.users = new UserModule(config);
34
34
  this.organizations = new OrganizationModule(config);
35
35
  this.teams = new TeamModule(config);
36
- this.templates = new TemplateModule(config);
36
+ this.templates = new TemplateModule(config, this);
37
37
  this.transcriptionSummaries = new TranscriptionSummaryModule(config);
38
38
  this.sessions = new SessionModule(config);
39
39
  this.agents = new AgentModule(config);
40
- this.audio = new AudioModule(config);
40
+ this.audio = new AudioModule(config, this);
41
41
  this.workflows = new WorkflowModule(config);
42
42
  this.logs = new LogModule(config);
43
43
  this.debug = new DebugModule(config);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "whio-api-sdk",
3
- "version": "1.0.212-beta-staging",
3
+ "version": "1.0.213-beta-staging",
4
4
  "main": "dist/index.js",
5
5
  "types": "dist/index.d.ts",
6
6
  "type": "module",
@@ -7,10 +7,14 @@ import {
7
7
  CreateBase64AudioFileDto,
8
8
  UpdateBase64AudioFileDto,
9
9
  AddBase64ChunkResponse,
10
+ SDKConfig,
10
11
  } from '../types';
11
12
  import urls from '../urls';
12
13
 
13
14
  export class AudioModule extends BaseClient {
15
+ constructor(config: SDKConfig = {}, parentEventEmitter?: BaseClient) {
16
+ super(config, parentEventEmitter);
17
+ }
14
18
  // ======================
15
19
  // AUDIO FILE METHODS
16
20
  // ======================
@@ -12,10 +12,12 @@ export class BaseClient {
12
12
  protected refreshToken: string | null = null;
13
13
  protected user: User | null = null;
14
14
  private baseEventHandlers: Map<keyof BaseClientEvents, Function[]> = new Map();
15
+ protected parentEventEmitter?: BaseClient;
15
16
 
16
- constructor(config: SDKConfig = {}) {
17
+ constructor(config: SDKConfig = {}, parentEventEmitter?: BaseClient) {
17
18
  this.baseUrl = config.baseUrl || '/api';
18
19
  this.storage = config.storage;
20
+ this.parentEventEmitter = parentEventEmitter;
19
21
  this.initialize();
20
22
  }
21
23
 
@@ -273,5 +275,10 @@ export class BaseClient {
273
275
  }
274
276
  });
275
277
  }
278
+
279
+ // Forward event to parent emitter if available
280
+ if (this.parentEventEmitter) {
281
+ this.parentEventEmitter.emitEvent(event, ...args);
282
+ }
276
283
  }
277
284
  }
@@ -11,10 +11,14 @@ import {
11
11
  UpdateTemplateCategoryDto,
12
12
  AssignTeamTemplateDto,
13
13
  TranscriptionAudioUploadResponse,
14
+ SDKConfig,
14
15
  } from '../types';
15
16
  import urls from '../urls';
16
17
 
17
18
  export class TemplateModule extends BaseClient {
19
+ constructor(config: SDKConfig = {}, parentEventEmitter?: BaseClient) {
20
+ super(config, parentEventEmitter);
21
+ }
18
22
  // ======================
19
23
  // TEMPLATE METHODS
20
24
  // ======================
package/src/sdk/sdk.ts CHANGED
@@ -38,16 +38,16 @@ export class ApiSDK extends BaseClient {
38
38
  constructor(config: SDKConfig = {}) {
39
39
  super(config);
40
40
 
41
- // Initialize all domain modules with the same config
41
+ // Initialize all domain modules with the same config and this as parent event emitter
42
42
  this.auth = new AuthModule(config);
43
43
  this.users = new UserModule(config);
44
44
  this.organizations = new OrganizationModule(config);
45
45
  this.teams = new TeamModule(config);
46
- this.templates = new TemplateModule(config);
46
+ this.templates = new TemplateModule(config, this);
47
47
  this.transcriptionSummaries = new TranscriptionSummaryModule(config);
48
48
  this.sessions = new SessionModule(config);
49
49
  this.agents = new AgentModule(config);
50
- this.audio = new AudioModule(config);
50
+ this.audio = new AudioModule(config, this);
51
51
  this.workflows = new WorkflowModule(config);
52
52
  this.logs = new LogModule(config);
53
53
  this.debug = new DebugModule(config);