merchi_sdk_ts 1.0.72-test → 1.0.72-test-b

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/merchi.js CHANGED
@@ -194,10 +194,17 @@ var Merchi = /** @class */ (function () {
194
194
  if (!determinedBaseUri) {
195
195
  determinedBaseUri = 'https://api.merchi.co/';
196
196
  }
197
+ // Ensure determinedBaseUri ends with a slash before appending version
197
198
  if (!determinedBaseUri.endsWith('/')) {
198
199
  determinedBaseUri += '/';
199
200
  }
200
- this.backendUri = determinedBaseUri + API_VERSION + '/';
201
+ // Check if the URI already includes the API version
202
+ var versionPattern = new RegExp("/".concat(API_VERSION, "/?$"));
203
+ if (!versionPattern.test(determinedBaseUri)) {
204
+ determinedBaseUri += API_VERSION + '/';
205
+ }
206
+ console.log('what is determinedBaseUri', determinedBaseUri);
207
+ this.backendUri = determinedBaseUri;
201
208
  // re-export configured versions of all classes
202
209
  this.AutomaticPaymentRelationship = this.setupClass(AutomaticPaymentRelationship);
203
210
  this.Variation = this.setupClass(Variation);
package/dist/request.js CHANGED
@@ -48,6 +48,7 @@ export var version = 'v6';
48
48
  export function backendFetch(baseUrl, resource, options) {
49
49
  var e_1, _a;
50
50
  var url = new URL(resource, baseUrl);
51
+ console.log(url, 'what is the url here?');
51
52
  if (options && options.query) {
52
53
  try {
53
54
  for (var _b = __values(options.query), _c = _b.next(); !_c.done; _c = _b.next()) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "merchi_sdk_ts",
3
- "version": "1.0.72-test",
3
+ "version": "1.0.72-test-b",
4
4
  "main": "dist/index.js",
5
5
  "type": "module",
6
6
  "repository": "git@github.com:merchisdk/merchi_sdk_ts.git",
package/src/merchi.ts CHANGED
@@ -240,10 +240,19 @@ export class Merchi {
240
240
  determinedBaseUri = 'https://api.merchi.co/';
241
241
  }
242
242
 
243
+ // Ensure determinedBaseUri ends with a slash before appending version
243
244
  if (!determinedBaseUri.endsWith('/')) {
244
245
  determinedBaseUri += '/';
245
246
  }
246
- this.backendUri = determinedBaseUri + API_VERSION + '/';
247
+
248
+ // Check if the URI already includes the API version
249
+ const versionPattern = new RegExp(`/${API_VERSION}/?$`);
250
+ if (!versionPattern.test(determinedBaseUri)) {
251
+ determinedBaseUri += API_VERSION + '/';
252
+ }
253
+
254
+ console.log('what is determinedBaseUri', determinedBaseUri);
255
+ this.backendUri = determinedBaseUri;
247
256
 
248
257
  // re-export configured versions of all classes
249
258
  this.AutomaticPaymentRelationship = this.setupClass(
package/src/request.ts CHANGED
@@ -27,6 +27,7 @@ export const version = 'v6';
27
27
 
28
28
  export function backendFetch(baseUrl: string, resource: string, options?: RequestOptions) {
29
29
  const url = new URL(resource, baseUrl);
30
+ console.log(url, 'what is the url here?');
30
31
  if (options && options.query) {
31
32
  for (const entry of options.query) {
32
33
  url.searchParams.append(entry[0], entry[1]);