@realtimex/sdk 1.2.3 → 1.2.4

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/dist/index.js CHANGED
@@ -71,16 +71,16 @@ var ApiModule = class {
71
71
  this.apiKey = apiKey;
72
72
  }
73
73
  getHeaders() {
74
+ const headers = {
75
+ "Content-Type": "application/json"
76
+ };
74
77
  if (this.apiKey) {
75
- return {
76
- "Content-Type": "application/json",
77
- "Authorization": `Bearer ${this.apiKey}`
78
- };
78
+ headers["Authorization"] = `Bearer ${this.apiKey}`;
79
79
  }
80
- return {
81
- "Content-Type": "application/json",
82
- "x-app-id": this.appId
83
- };
80
+ if (this.appId) {
81
+ headers["x-app-id"] = this.appId;
82
+ }
83
+ return headers;
84
84
  }
85
85
  /**
86
86
  * Request a single permission from Electron via internal API
@@ -189,7 +189,8 @@ var ActivitiesModule = class {
189
189
  };
190
190
  if (this.apiKey) {
191
191
  headers["Authorization"] = `Bearer ${this.apiKey}`;
192
- } else if (this.appId) {
192
+ }
193
+ if (this.appId) {
193
194
  headers["x-app-id"] = this.appId;
194
195
  }
195
196
  const response = await fetch(url, {
@@ -312,7 +313,8 @@ var WebhookModule = class {
312
313
  };
313
314
  if (this.apiKey) {
314
315
  headers["Authorization"] = `Bearer ${this.apiKey}`;
315
- } else if (this.appId) {
316
+ }
317
+ if (this.appId) {
316
318
  headers["x-app-id"] = this.appId;
317
319
  }
318
320
  const response = await fetch(url, {
@@ -404,7 +406,8 @@ var TaskModule = class {
404
406
  const headers = { "Content-Type": "application/json" };
405
407
  if (this.apiKey) {
406
408
  headers["Authorization"] = `Bearer ${this.apiKey}`;
407
- } else if (this.appId) {
409
+ }
410
+ if (this.appId) {
408
411
  headers["x-app-id"] = this.appId;
409
412
  }
410
413
  const response = await fetch(`${this.realtimexUrl}/webhooks/realtimex`, {
@@ -525,16 +528,16 @@ var VectorStore = class {
525
528
  this.apiKey = apiKey;
526
529
  }
527
530
  get headers() {
531
+ const headers = {
532
+ "Content-Type": "application/json"
533
+ };
528
534
  if (this.apiKey) {
529
- return {
530
- "Content-Type": "application/json",
531
- "Authorization": `Bearer ${this.apiKey}`
532
- };
535
+ headers["Authorization"] = `Bearer ${this.apiKey}`;
533
536
  }
534
- return {
535
- "Content-Type": "application/json",
536
- "x-app-id": this.appId
537
- };
537
+ if (this.appId) {
538
+ headers["x-app-id"] = this.appId;
539
+ }
540
+ return headers;
538
541
  }
539
542
  /**
540
543
  * Request a single permission from Electron via internal API
@@ -686,16 +689,16 @@ var LLMModule = class {
686
689
  this.vectors = new VectorStore(baseUrl, appId, appName, apiKey);
687
690
  }
688
691
  get headers() {
692
+ const headers = {
693
+ "Content-Type": "application/json"
694
+ };
689
695
  if (this.apiKey) {
690
- return {
691
- "Content-Type": "application/json",
692
- "Authorization": `Bearer ${this.apiKey}`
693
- };
696
+ headers["Authorization"] = `Bearer ${this.apiKey}`;
694
697
  }
695
- return {
696
- "Content-Type": "application/json",
697
- "x-app-id": this.appId
698
- };
698
+ if (this.appId) {
699
+ headers["x-app-id"] = this.appId;
700
+ }
701
+ return headers;
699
702
  }
700
703
  /**
701
704
  * Request a single permission from Electron via internal API
@@ -990,16 +993,16 @@ var TTSModule = class {
990
993
  this.apiKey = apiKey;
991
994
  }
992
995
  get headers() {
996
+ const headers = {
997
+ "Content-Type": "application/json"
998
+ };
993
999
  if (this.apiKey) {
994
- return {
995
- "Content-Type": "application/json",
996
- "Authorization": `Bearer ${this.apiKey}`
997
- };
1000
+ headers["Authorization"] = `Bearer ${this.apiKey}`;
998
1001
  }
999
- return {
1000
- "Content-Type": "application/json",
1001
- "x-app-id": this.appId
1002
- };
1002
+ if (this.appId) {
1003
+ headers["x-app-id"] = this.appId;
1004
+ }
1005
+ return headers;
1003
1006
  }
1004
1007
  /**
1005
1008
  * Request a single permission from Electron via internal API
@@ -1234,7 +1237,8 @@ var _RealtimeXSDK = class _RealtimeXSDK {
1234
1237
  const headers = { "Content-Type": "application/json" };
1235
1238
  if (this.apiKey) {
1236
1239
  headers["Authorization"] = `Bearer ${this.apiKey}`;
1237
- } else if (this.appId) {
1240
+ }
1241
+ if (this.appId) {
1238
1242
  headers["x-app-id"] = this.appId;
1239
1243
  }
1240
1244
  const response = await fetch(`${this.realtimexUrl.replace(/\/$/, "")}/sdk/ping`, {
@@ -1259,7 +1263,8 @@ var _RealtimeXSDK = class _RealtimeXSDK {
1259
1263
  const headers = { "Content-Type": "application/json" };
1260
1264
  if (this.apiKey) {
1261
1265
  headers["Authorization"] = `Bearer ${this.apiKey}`;
1262
- } else if (this.appId) {
1266
+ }
1267
+ if (this.appId) {
1263
1268
  headers["x-app-id"] = this.appId;
1264
1269
  }
1265
1270
  const response = await fetch(`${this.realtimexUrl.replace(/\/$/, "")}/sdk/local-apps/data-dir`, {
package/dist/index.mjs CHANGED
@@ -23,16 +23,16 @@ var ApiModule = class {
23
23
  this.apiKey = apiKey;
24
24
  }
25
25
  getHeaders() {
26
+ const headers = {
27
+ "Content-Type": "application/json"
28
+ };
26
29
  if (this.apiKey) {
27
- return {
28
- "Content-Type": "application/json",
29
- "Authorization": `Bearer ${this.apiKey}`
30
- };
30
+ headers["Authorization"] = `Bearer ${this.apiKey}`;
31
31
  }
32
- return {
33
- "Content-Type": "application/json",
34
- "x-app-id": this.appId
35
- };
32
+ if (this.appId) {
33
+ headers["x-app-id"] = this.appId;
34
+ }
35
+ return headers;
36
36
  }
37
37
  /**
38
38
  * Request a single permission from Electron via internal API
@@ -141,7 +141,8 @@ var ActivitiesModule = class {
141
141
  };
142
142
  if (this.apiKey) {
143
143
  headers["Authorization"] = `Bearer ${this.apiKey}`;
144
- } else if (this.appId) {
144
+ }
145
+ if (this.appId) {
145
146
  headers["x-app-id"] = this.appId;
146
147
  }
147
148
  const response = await fetch(url, {
@@ -264,7 +265,8 @@ var WebhookModule = class {
264
265
  };
265
266
  if (this.apiKey) {
266
267
  headers["Authorization"] = `Bearer ${this.apiKey}`;
267
- } else if (this.appId) {
268
+ }
269
+ if (this.appId) {
268
270
  headers["x-app-id"] = this.appId;
269
271
  }
270
272
  const response = await fetch(url, {
@@ -356,7 +358,8 @@ var TaskModule = class {
356
358
  const headers = { "Content-Type": "application/json" };
357
359
  if (this.apiKey) {
358
360
  headers["Authorization"] = `Bearer ${this.apiKey}`;
359
- } else if (this.appId) {
361
+ }
362
+ if (this.appId) {
360
363
  headers["x-app-id"] = this.appId;
361
364
  }
362
365
  const response = await fetch(`${this.realtimexUrl}/webhooks/realtimex`, {
@@ -477,16 +480,16 @@ var VectorStore = class {
477
480
  this.apiKey = apiKey;
478
481
  }
479
482
  get headers() {
483
+ const headers = {
484
+ "Content-Type": "application/json"
485
+ };
480
486
  if (this.apiKey) {
481
- return {
482
- "Content-Type": "application/json",
483
- "Authorization": `Bearer ${this.apiKey}`
484
- };
487
+ headers["Authorization"] = `Bearer ${this.apiKey}`;
485
488
  }
486
- return {
487
- "Content-Type": "application/json",
488
- "x-app-id": this.appId
489
- };
489
+ if (this.appId) {
490
+ headers["x-app-id"] = this.appId;
491
+ }
492
+ return headers;
490
493
  }
491
494
  /**
492
495
  * Request a single permission from Electron via internal API
@@ -638,16 +641,16 @@ var LLMModule = class {
638
641
  this.vectors = new VectorStore(baseUrl, appId, appName, apiKey);
639
642
  }
640
643
  get headers() {
644
+ const headers = {
645
+ "Content-Type": "application/json"
646
+ };
641
647
  if (this.apiKey) {
642
- return {
643
- "Content-Type": "application/json",
644
- "Authorization": `Bearer ${this.apiKey}`
645
- };
648
+ headers["Authorization"] = `Bearer ${this.apiKey}`;
646
649
  }
647
- return {
648
- "Content-Type": "application/json",
649
- "x-app-id": this.appId
650
- };
650
+ if (this.appId) {
651
+ headers["x-app-id"] = this.appId;
652
+ }
653
+ return headers;
651
654
  }
652
655
  /**
653
656
  * Request a single permission from Electron via internal API
@@ -942,16 +945,16 @@ var TTSModule = class {
942
945
  this.apiKey = apiKey;
943
946
  }
944
947
  get headers() {
948
+ const headers = {
949
+ "Content-Type": "application/json"
950
+ };
945
951
  if (this.apiKey) {
946
- return {
947
- "Content-Type": "application/json",
948
- "Authorization": `Bearer ${this.apiKey}`
949
- };
952
+ headers["Authorization"] = `Bearer ${this.apiKey}`;
950
953
  }
951
- return {
952
- "Content-Type": "application/json",
953
- "x-app-id": this.appId
954
- };
954
+ if (this.appId) {
955
+ headers["x-app-id"] = this.appId;
956
+ }
957
+ return headers;
955
958
  }
956
959
  /**
957
960
  * Request a single permission from Electron via internal API
@@ -1186,7 +1189,8 @@ var _RealtimeXSDK = class _RealtimeXSDK {
1186
1189
  const headers = { "Content-Type": "application/json" };
1187
1190
  if (this.apiKey) {
1188
1191
  headers["Authorization"] = `Bearer ${this.apiKey}`;
1189
- } else if (this.appId) {
1192
+ }
1193
+ if (this.appId) {
1190
1194
  headers["x-app-id"] = this.appId;
1191
1195
  }
1192
1196
  const response = await fetch(`${this.realtimexUrl.replace(/\/$/, "")}/sdk/ping`, {
@@ -1211,7 +1215,8 @@ var _RealtimeXSDK = class _RealtimeXSDK {
1211
1215
  const headers = { "Content-Type": "application/json" };
1212
1216
  if (this.apiKey) {
1213
1217
  headers["Authorization"] = `Bearer ${this.apiKey}`;
1214
- } else if (this.appId) {
1218
+ }
1219
+ if (this.appId) {
1215
1220
  headers["x-app-id"] = this.appId;
1216
1221
  }
1217
1222
  const response = await fetch(`${this.realtimexUrl.replace(/\/$/, "")}/sdk/local-apps/data-dir`, {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@realtimex/sdk",
3
- "version": "1.2.3",
3
+ "version": "1.2.4",
4
4
  "description": "SDK for building Local Apps that integrate with RealtimeX",
5
5
  "main": "dist/index.js",
6
6
  "module": "dist/index.mjs",