@aguacerowx/javascript-sdk 0.0.1 → 0.0.3

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.
@@ -387,9 +387,14 @@ class AguaceroCore extends _events.EventEmitter {
387
387
  throw new Error('API key is not configured.');
388
388
  }
389
389
  try {
390
- const directUrl = `${this.baseGridUrl}${resourcePath}`;
390
+ const baseUrl = `${this.baseGridUrl}${resourcePath}`;
391
391
 
392
- // --- START OF LOGGING CODE ---
392
+ // NEW: Construct the URL with the apiKey as a query parameter
393
+ const urlWithApiKeyParam = `${baseUrl}?apiKey=${this.apiKey}`;
394
+
395
+ // --- END OF MODIFICATION ---
396
+
397
+ // The headers object remains the same, sending the key in the header as well
393
398
  const headers = {
394
399
  'x-api-key': this.apiKey
395
400
  };
@@ -397,13 +402,12 @@ class AguaceroCore extends _events.EventEmitter {
397
402
  headers['x-app-identifier'] = this.bundleId;
398
403
  }
399
404
 
400
- // Use the headers object we just logged
401
- const response = await fetch(directUrl, {
405
+ // Use the NEW url variable in the fetch call
406
+ const response = await fetch(urlWithApiKeyParam, {
402
407
  headers: headers,
403
408
  signal: abortController.signal
404
409
  });
405
410
  if (!response.ok) {
406
- // This is where your error is being thrown from
407
411
  throw new Error(`Failed to fetch grid data: ${response.status} ${response.statusText}`);
408
412
  }
409
413
  const {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@aguacerowx/javascript-sdk",
3
- "version": "0.0.1",
3
+ "version": "0.0.3",
4
4
  "private": false,
5
5
  "publishConfig": {
6
6
  "access": "public"
@@ -343,22 +343,27 @@ export class AguaceroCore extends EventEmitter {
343
343
  throw new Error('API key is not configured.');
344
344
  }
345
345
  try {
346
- const directUrl = `${this.baseGridUrl}${resourcePath}`;
346
+ const baseUrl = `${this.baseGridUrl}${resourcePath}`;
347
+
348
+ // NEW: Construct the URL with the apiKey as a query parameter
349
+ const urlWithApiKeyParam = `${baseUrl}?apiKey=${this.apiKey}`;
350
+
351
+ // --- END OF MODIFICATION ---
352
+
347
353
 
348
- // --- START OF LOGGING CODE ---
354
+ // The headers object remains the same, sending the key in the header as well
349
355
  const headers = { 'x-api-key': this.apiKey };
350
356
  if (this.bundleId) {
351
357
  headers['x-app-identifier'] = this.bundleId;
352
358
  }
353
359
 
354
- // Use the headers object we just logged
355
- const response = await fetch(directUrl, {
360
+ // Use the NEW url variable in the fetch call
361
+ const response = await fetch(urlWithApiKeyParam, {
356
362
  headers: headers,
357
363
  signal: abortController.signal
358
364
  });
359
365
 
360
366
  if (!response.ok) {
361
- // This is where your error is being thrown from
362
367
  throw new Error(`Failed to fetch grid data: ${response.status} ${response.statusText}`);
363
368
  }
364
369
  const { data: b64Data, encoding } = await response.json();