@edifice.io/rest-client-base 2.5.22 → 2.5.23-develop.20260623093925

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,7 +1,7 @@
1
- var c = Object.defineProperty;
2
- var l = (a, t, e) => t in a ? c(a, t, { enumerable: !0, configurable: !0, writable: !0, value: e }) : a[t] = e;
3
- var h = (a, t, e) => l(a, typeof t != "symbol" ? t + "" : t, e);
4
- class i extends Error {
1
+ var p = Object.defineProperty;
2
+ var o = (a, t, e) => t in a ? p(a, t, { enumerable: !0, configurable: !0, writable: !0, value: e }) : a[t] = e;
3
+ var h = (a, t, e) => o(a, typeof t != "symbol" ? t + "" : t, e);
4
+ class c extends Error {
5
5
  /**
6
6
  * Create a new API error
7
7
  * @param response The original HTTP response
@@ -14,7 +14,7 @@ class i extends Error {
14
14
  h(this, "_response");
15
15
  h(this, "_jsonData", null);
16
16
  h(this, "_textData", null);
17
- this.name = "ApiError", this._response = e, Object.setPrototypeOf(this, i.prototype);
17
+ this.name = "ApiError", this._response = e, Object.setPrototypeOf(this, c.prototype);
18
18
  }
19
19
  /**
20
20
  * Get the original Response object
@@ -67,13 +67,13 @@ class i extends Error {
67
67
  return this._textData;
68
68
  }
69
69
  }
70
- class d {
70
+ class y {
71
71
  constructor(t = fetch) {
72
72
  this.fetchImpl = t;
73
73
  }
74
74
  async handleResponse(t) {
75
75
  if (!t.ok)
76
- throw new i(t);
76
+ throw new c(t);
77
77
  const e = t.headers.get("content-type");
78
78
  return e && e.includes("application/json") ? await t.json() : {};
79
79
  }
@@ -142,7 +142,7 @@ class d {
142
142
  return this.handleResponse(r);
143
143
  }
144
144
  }
145
- class u {
145
+ class f {
146
146
  constructor(t) {
147
147
  this.httpService = t;
148
148
  }
@@ -170,7 +170,7 @@ class u {
170
170
  return this.httpService.deleteJson(t, e);
171
171
  }
172
172
  }
173
- class o {
173
+ class m {
174
174
  /**
175
175
  * Creates a new API client instance
176
176
  *
@@ -208,7 +208,7 @@ class o {
208
208
  * @protected
209
209
  */
210
210
  h(this, "httpAdapter");
211
- this.baseUrl = t.baseUrl || "", this.defaultHeaders = t.defaultHeaders || {}, t.httpAdapter ? this.httpAdapter = t.httpAdapter : t.httpService ? this.httpAdapter = new u(t.httpService) : this.httpAdapter = new d(t.fetchImpl || fetch);
211
+ this.baseUrl = t.baseUrl || "", this.defaultHeaders = t.defaultHeaders || {}, t.httpAdapter ? this.httpAdapter = t.httpAdapter : t.httpService ? this.httpAdapter = new f(t.httpService) : this.httpAdapter = new y(t.fetchImpl || fetch);
212
212
  }
213
213
  /**
214
214
  * Performs a GET request
@@ -302,10 +302,17 @@ class o {
302
302
  * @param queryParams Optional query parameters
303
303
  * @returns Complete URL
304
304
  * @protected
305
+ * @throws {URIError} if the baseUrl attribute is not parsable
305
306
  */
306
307
  buildUrl(t, e) {
307
- let s = `${this.baseUrl}${t}`;
308
- return s.startsWith("//") && (s = s.replace(/^\/\//, "/")), e && e.toString() && (s += `?${e.toString()}`), s;
308
+ var l;
309
+ const s = !URL.canParse(this.baseUrl), r = ((l = globalThis.location) == null ? void 0 : l.origin) ?? "", n = s ? `${r}${this.baseUrl}` : this.baseUrl;
310
+ if (!URL.canParse(n))
311
+ throw new URIError(`{baseUrl: ${this.baseUrl}} is not a parsable URL.`);
312
+ const i = new URL(n);
313
+ return i.pathname = s ? b(this.baseUrl, t) : t, e && e.forEach((d, u) => {
314
+ i.searchParams.set(u, d);
315
+ }), s ? i.pathname + i.search : i.toString();
309
316
  }
310
317
  /**
311
318
  * Builds headers for a request by combining default and request-specific headers
@@ -320,24 +327,25 @@ class o {
320
327
  };
321
328
  }
322
329
  }
323
- function y(...a) {
330
+ const b = (a, t) => `${a.replace(/\/$/, "")}/${t.replace(/^\//, "")}`;
331
+ function A(...a) {
324
332
  return () => {
325
333
  };
326
334
  }
327
- function f(...a) {
335
+ function _(...a) {
328
336
  return () => {
329
337
  };
330
338
  }
331
- function b(...a) {
339
+ function g(...a) {
332
340
  return () => {
333
341
  };
334
342
  }
335
343
  export {
336
- i as ApiError,
337
- f as ApiProperty,
338
- b as ApiPropertyOptional,
339
- o as BaseApiClient,
340
- d as FetchAdapter,
341
- u as HttpServiceAdapter,
342
- y as Type
344
+ c as ApiError,
345
+ _ as ApiProperty,
346
+ g as ApiPropertyOptional,
347
+ m as BaseApiClient,
348
+ y as FetchAdapter,
349
+ f as HttpServiceAdapter,
350
+ A as Type
343
351
  };
@@ -1 +1 @@
1
- "use strict";var M=Object.defineProperty;var A=(n,t,r)=>t in n?M(n,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):n[t]=r;var c=(n,t,r)=>A(n,typeof t!="symbol"?t+"":t,r);Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const y=require("@nestjs/swagger");class l extends Error{constructor(r,e){super(e||`API request failed: ${r.status} ${r.statusText}`);c(this,"_response");c(this,"_jsonData",null);c(this,"_textData",null);this.name="ApiError",this._response=r,Object.setPrototypeOf(this,l.prototype)}response(){return this._response}status(){return this._response.status}statusText(){return this._response.statusText}async json(){if(this._jsonData===null)try{const r=this._response.clone();this._jsonData=await r.json()}catch{this._jsonData=null}return this._jsonData}async text(){if(this._textData===null)try{const r=this._response.clone();this._textData=await r.text()}catch{this._textData=""}return this._textData}}class g{constructor(t=fetch){this.fetchImpl=t}async handleResponse(t){if(!t.ok)throw new l(t);const r=t.headers.get("content-type");return r&&r.includes("application/json")?await t.json():{}}async get(t,r){const e=await this.fetchImpl(t,{method:"GET",headers:r,credentials:"include"});return this.handleResponse(e)}async post(t,r,e){const s=await this.fetchImpl(t,{method:"POST",headers:{"Content-Type":"application/json",...e},body:JSON.stringify(r),credentials:"include"});return this.handleResponse(s)}async put(t,r,e){const s=await this.fetchImpl(t,{method:"PUT",headers:{"Content-Type":"application/json",...e},body:JSON.stringify(r),credentials:"include"});return this.handleResponse(s)}async patch(t,r,e){const s=await this.fetchImpl(t,{method:"PATCH",headers:{"Content-Type":"application/json",...e},body:JSON.stringify(r),credentials:"include"});return this.handleResponse(s)}async delete(t,r){const e=await this.fetchImpl(t,{method:"DELETE",headers:r,credentials:"include"});return this.handleResponse(e)}async deleteWithBody(t,r,e){const s=await this.fetchImpl(t,{method:"DELETE",headers:{"Content-Type":"application/json",...e},body:JSON.stringify(r),credentials:"include"});return this.handleResponse(s)}}class _{constructor(t){this.httpService=t}async get(t,r){const e=r?{headers:r}:void 0;return this.httpService.get(t,e)}async post(t,r,e){const s=e?{headers:e}:void 0;return this.httpService.postJson(t,r,s)}async put(t,r,e){const s=e?{headers:e}:void 0;return this.httpService.putJson(t,r,s)}async patch(t,r,e){const s=e?{headers:e}:void 0;return this.httpService.patchJson(t,r,s)}async delete(t,r){const e=r?{headers:r}:void 0;return this.httpService.delete(t,e)}async deleteWithBody(t,r,e){return this.httpService.deleteJson(t,r)}}class S{constructor(t={}){c(this,"baseUrl");c(this,"defaultHeaders");c(this,"httpAdapter");this.baseUrl=t.baseUrl||"",this.defaultHeaders=t.defaultHeaders||{},t.httpAdapter?this.httpAdapter=t.httpAdapter:t.httpService?this.httpAdapter=new _(t.httpService):this.httpAdapter=new g(t.fetchImpl||fetch)}async get(t,r,e){const s=this.buildUrl(t,r);return this.httpAdapter.get(s,this.buildHeaders(e==null?void 0:e.headers))}async post(t,r,e,s){const a=this.buildUrl(t,e);return this.httpAdapter.post(a,r,this.buildHeaders(s==null?void 0:s.headers))}async put(t,r,e,s){const a=this.buildUrl(t,e);return this.httpAdapter.put(a,r,this.buildHeaders(s==null?void 0:s.headers))}async patch(t,r,e,s){const a=this.buildUrl(t,e);return this.httpAdapter.patch(a,r,this.buildHeaders(s==null?void 0:s.headers))}async delete(t,r,e){const s=this.buildUrl(t,r);return this.httpAdapter.delete(s,this.buildHeaders(e==null?void 0:e.headers))}async deleteWithBody(t,r,e,s){const a=this.buildUrl(t,e);return this.httpAdapter.deleteWithBody(a,r,this.buildHeaders(s==null?void 0:s.headers))}buildUrl(t,r){let e=`${this.baseUrl}${t}`;return e.startsWith("//")&&(e=e.replace(/^\/\//,"/")),r&&r.toString()&&(e+=`?${r.toString()}`),e}buildHeaders(t){return{...this.defaultHeaders,...t}}}var o;(function(n){n[n.PLAIN_TO_CLASS=0]="PLAIN_TO_CLASS",n[n.CLASS_TO_PLAIN=1]="CLASS_TO_PLAIN",n[n.CLASS_TO_CLASS=2]="CLASS_TO_CLASS"})(o||(o={}));var v=function(){function n(){this._typeMetadatas=new Map,this._transformMetadatas=new Map,this._exposeMetadatas=new Map,this._excludeMetadatas=new Map,this._ancestorsMap=new Map}return n.prototype.addTypeMetadata=function(t){this._typeMetadatas.has(t.target)||this._typeMetadatas.set(t.target,new Map),this._typeMetadatas.get(t.target).set(t.propertyName,t)},n.prototype.addTransformMetadata=function(t){this._transformMetadatas.has(t.target)||this._transformMetadatas.set(t.target,new Map),this._transformMetadatas.get(t.target).has(t.propertyName)||this._transformMetadatas.get(t.target).set(t.propertyName,[]),this._transformMetadatas.get(t.target).get(t.propertyName).push(t)},n.prototype.addExposeMetadata=function(t){this._exposeMetadatas.has(t.target)||this._exposeMetadatas.set(t.target,new Map),this._exposeMetadatas.get(t.target).set(t.propertyName,t)},n.prototype.addExcludeMetadata=function(t){this._excludeMetadatas.has(t.target)||this._excludeMetadatas.set(t.target,new Map),this._excludeMetadatas.get(t.target).set(t.propertyName,t)},n.prototype.findTransformMetadatas=function(t,r,e){return this.findMetadatas(this._transformMetadatas,t,r).filter(function(s){return!s.options||s.options.toClassOnly===!0&&s.options.toPlainOnly===!0?!0:s.options.toClassOnly===!0?e===o.CLASS_TO_CLASS||e===o.PLAIN_TO_CLASS:s.options.toPlainOnly===!0?e===o.CLASS_TO_PLAIN:!0})},n.prototype.findExcludeMetadata=function(t,r){return this.findMetadata(this._excludeMetadatas,t,r)},n.prototype.findExposeMetadata=function(t,r){return this.findMetadata(this._exposeMetadatas,t,r)},n.prototype.findExposeMetadataByCustomName=function(t,r){return this.getExposedMetadatas(t).find(function(e){return e.options&&e.options.name===r})},n.prototype.findTypeMetadata=function(t,r){return this.findMetadata(this._typeMetadatas,t,r)},n.prototype.getStrategy=function(t){var r=this._excludeMetadatas.get(t),e=r&&r.get(void 0),s=this._exposeMetadatas.get(t),a=s&&s.get(void 0);return e&&a||!e&&!a?"none":e?"excludeAll":"exposeAll"},n.prototype.getExposedMetadatas=function(t){return this.getMetadata(this._exposeMetadatas,t)},n.prototype.getExcludedMetadatas=function(t){return this.getMetadata(this._excludeMetadatas,t)},n.prototype.getExposedProperties=function(t,r){return this.getExposedMetadatas(t).filter(function(e){return!e.options||e.options.toClassOnly===!0&&e.options.toPlainOnly===!0?!0:e.options.toClassOnly===!0?r===o.CLASS_TO_CLASS||r===o.PLAIN_TO_CLASS:e.options.toPlainOnly===!0?r===o.CLASS_TO_PLAIN:!0}).map(function(e){return e.propertyName})},n.prototype.getExcludedProperties=function(t,r){return this.getExcludedMetadatas(t).filter(function(e){return!e.options||e.options.toClassOnly===!0&&e.options.toPlainOnly===!0?!0:e.options.toClassOnly===!0?r===o.CLASS_TO_CLASS||r===o.PLAIN_TO_CLASS:e.options.toPlainOnly===!0?r===o.CLASS_TO_PLAIN:!0}).map(function(e){return e.propertyName})},n.prototype.clear=function(){this._typeMetadatas.clear(),this._exposeMetadatas.clear(),this._excludeMetadatas.clear(),this._ancestorsMap.clear()},n.prototype.getMetadata=function(t,r){var e=t.get(r),s;e&&(s=Array.from(e.values()).filter(function(f){return f.propertyName!==void 0}));for(var a=[],i=0,p=this.getAncestors(r);i<p.length;i++){var h=p[i],d=t.get(h);if(d){var u=Array.from(d.values()).filter(function(f){return f.propertyName!==void 0});a.push.apply(a,u)}}return a.concat(s||[])},n.prototype.findMetadata=function(t,r,e){var s=t.get(r);if(s){var a=s.get(e);if(a)return a}for(var i=0,p=this.getAncestors(r);i<p.length;i++){var h=p[i],d=t.get(h);if(d){var u=d.get(e);if(u)return u}}},n.prototype.findMetadatas=function(t,r,e){var s=t.get(r),a;s&&(a=s.get(e));for(var i=[],p=0,h=this.getAncestors(r);p<h.length;p++){var d=h[p],u=t.get(d);u&&u.has(e)&&i.push.apply(i,u.get(e))}return i.slice().reverse().concat((a||[]).slice().reverse())},n.prototype.getAncestors=function(t){if(!t)return[];if(!this._ancestorsMap.has(t)){for(var r=[],e=Object.getPrototypeOf(t.prototype.constructor);typeof e.prototype<"u";e=Object.getPrototypeOf(e.prototype.constructor))r.push(e);this._ancestorsMap.set(t,r)}return this._ancestorsMap.get(t)},n}(),x=new v;function O(n,t){return t===void 0&&(t={}),function(r,e){var s=Reflect.getMetadata("design:type",r,e);x.addTypeMetadata({target:r.constructor,propertyName:e,reflectedType:s,typeFunction:n,options:t})}}Object.defineProperty(exports,"ApiProperty",{enumerable:!0,get:()=>y.ApiProperty});Object.defineProperty(exports,"ApiPropertyOptional",{enumerable:!0,get:()=>y.ApiPropertyOptional});exports.ApiError=l;exports.BaseApiClient=S;exports.FetchAdapter=g;exports.HttpServiceAdapter=_;exports.Type=O;
1
+ "use strict";var M=Object.defineProperty;var A=(a,t,e)=>t in a?M(a,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):a[t]=e;var d=(a,t,e)=>A(a,typeof t!="symbol"?t+"":t,e);Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const y=require("@nestjs/swagger");class l extends Error{constructor(e,r){super(r||`API request failed: ${e.status} ${e.statusText}`);d(this,"_response");d(this,"_jsonData",null);d(this,"_textData",null);this.name="ApiError",this._response=e,Object.setPrototypeOf(this,l.prototype)}response(){return this._response}status(){return this._response.status}statusText(){return this._response.statusText}async json(){if(this._jsonData===null)try{const e=this._response.clone();this._jsonData=await e.json()}catch{this._jsonData=null}return this._jsonData}async text(){if(this._textData===null)try{const e=this._response.clone();this._textData=await e.text()}catch{this._textData=""}return this._textData}}class g{constructor(t=fetch){this.fetchImpl=t}async handleResponse(t){if(!t.ok)throw new l(t);const e=t.headers.get("content-type");return e&&e.includes("application/json")?await t.json():{}}async get(t,e){const r=await this.fetchImpl(t,{method:"GET",headers:e,credentials:"include"});return this.handleResponse(r)}async post(t,e,r){const s=await this.fetchImpl(t,{method:"POST",headers:{"Content-Type":"application/json",...r},body:JSON.stringify(e),credentials:"include"});return this.handleResponse(s)}async put(t,e,r){const s=await this.fetchImpl(t,{method:"PUT",headers:{"Content-Type":"application/json",...r},body:JSON.stringify(e),credentials:"include"});return this.handleResponse(s)}async patch(t,e,r){const s=await this.fetchImpl(t,{method:"PATCH",headers:{"Content-Type":"application/json",...r},body:JSON.stringify(e),credentials:"include"});return this.handleResponse(s)}async delete(t,e){const r=await this.fetchImpl(t,{method:"DELETE",headers:e,credentials:"include"});return this.handleResponse(r)}async deleteWithBody(t,e,r){const s=await this.fetchImpl(t,{method:"DELETE",headers:{"Content-Type":"application/json",...r},body:JSON.stringify(e),credentials:"include"});return this.handleResponse(s)}}class _{constructor(t){this.httpService=t}async get(t,e){const r=e?{headers:e}:void 0;return this.httpService.get(t,r)}async post(t,e,r){const s=r?{headers:r}:void 0;return this.httpService.postJson(t,e,s)}async put(t,e,r){const s=r?{headers:r}:void 0;return this.httpService.putJson(t,e,s)}async patch(t,e,r){const s=r?{headers:r}:void 0;return this.httpService.patchJson(t,e,s)}async delete(t,e){const r=e?{headers:e}:void 0;return this.httpService.delete(t,r)}async deleteWithBody(t,e,r){return this.httpService.deleteJson(t,e)}}class S{constructor(t={}){d(this,"baseUrl");d(this,"defaultHeaders");d(this,"httpAdapter");this.baseUrl=t.baseUrl||"",this.defaultHeaders=t.defaultHeaders||{},t.httpAdapter?this.httpAdapter=t.httpAdapter:t.httpService?this.httpAdapter=new _(t.httpService):this.httpAdapter=new g(t.fetchImpl||fetch)}async get(t,e,r){const s=this.buildUrl(t,e);return this.httpAdapter.get(s,this.buildHeaders(r==null?void 0:r.headers))}async post(t,e,r,s){const n=this.buildUrl(t,r);return this.httpAdapter.post(n,e,this.buildHeaders(s==null?void 0:s.headers))}async put(t,e,r,s){const n=this.buildUrl(t,r);return this.httpAdapter.put(n,e,this.buildHeaders(s==null?void 0:s.headers))}async patch(t,e,r,s){const n=this.buildUrl(t,r);return this.httpAdapter.patch(n,e,this.buildHeaders(s==null?void 0:s.headers))}async delete(t,e,r){const s=this.buildUrl(t,e);return this.httpAdapter.delete(s,this.buildHeaders(r==null?void 0:r.headers))}async deleteWithBody(t,e,r,s){const n=this.buildUrl(t,r);return this.httpAdapter.deleteWithBody(n,e,this.buildHeaders(s==null?void 0:s.headers))}buildUrl(t,e){var o;const r=!URL.canParse(this.baseUrl),s=((o=globalThis.location)==null?void 0:o.origin)??"",n=r?`${s}${this.baseUrl}`:this.baseUrl;if(!URL.canParse(n))throw new URIError(`{baseUrl: ${this.baseUrl}} is not a parsable URL.`);const i=new URL(n);return i.pathname=r?v(this.baseUrl,t):t,e&&e.forEach((c,u)=>{i.searchParams.set(u,c)}),r?i.pathname+i.search:i.toString()}buildHeaders(t){return{...this.defaultHeaders,...t}}}const v=(a,t)=>`${a.replace(/\/$/,"")}/${t.replace(/^\//,"")}`;var p;(function(a){a[a.PLAIN_TO_CLASS=0]="PLAIN_TO_CLASS",a[a.CLASS_TO_PLAIN=1]="CLASS_TO_PLAIN",a[a.CLASS_TO_CLASS=2]="CLASS_TO_CLASS"})(p||(p={}));var x=function(){function a(){this._typeMetadatas=new Map,this._transformMetadatas=new Map,this._exposeMetadatas=new Map,this._excludeMetadatas=new Map,this._ancestorsMap=new Map}return a.prototype.addTypeMetadata=function(t){this._typeMetadatas.has(t.target)||this._typeMetadatas.set(t.target,new Map),this._typeMetadatas.get(t.target).set(t.propertyName,t)},a.prototype.addTransformMetadata=function(t){this._transformMetadatas.has(t.target)||this._transformMetadatas.set(t.target,new Map),this._transformMetadatas.get(t.target).has(t.propertyName)||this._transformMetadatas.get(t.target).set(t.propertyName,[]),this._transformMetadatas.get(t.target).get(t.propertyName).push(t)},a.prototype.addExposeMetadata=function(t){this._exposeMetadatas.has(t.target)||this._exposeMetadatas.set(t.target,new Map),this._exposeMetadatas.get(t.target).set(t.propertyName,t)},a.prototype.addExcludeMetadata=function(t){this._excludeMetadatas.has(t.target)||this._excludeMetadatas.set(t.target,new Map),this._excludeMetadatas.get(t.target).set(t.propertyName,t)},a.prototype.findTransformMetadatas=function(t,e,r){return this.findMetadatas(this._transformMetadatas,t,e).filter(function(s){return!s.options||s.options.toClassOnly===!0&&s.options.toPlainOnly===!0?!0:s.options.toClassOnly===!0?r===p.CLASS_TO_CLASS||r===p.PLAIN_TO_CLASS:s.options.toPlainOnly===!0?r===p.CLASS_TO_PLAIN:!0})},a.prototype.findExcludeMetadata=function(t,e){return this.findMetadata(this._excludeMetadatas,t,e)},a.prototype.findExposeMetadata=function(t,e){return this.findMetadata(this._exposeMetadatas,t,e)},a.prototype.findExposeMetadataByCustomName=function(t,e){return this.getExposedMetadatas(t).find(function(r){return r.options&&r.options.name===e})},a.prototype.findTypeMetadata=function(t,e){return this.findMetadata(this._typeMetadatas,t,e)},a.prototype.getStrategy=function(t){var e=this._excludeMetadatas.get(t),r=e&&e.get(void 0),s=this._exposeMetadatas.get(t),n=s&&s.get(void 0);return r&&n||!r&&!n?"none":r?"excludeAll":"exposeAll"},a.prototype.getExposedMetadatas=function(t){return this.getMetadata(this._exposeMetadatas,t)},a.prototype.getExcludedMetadatas=function(t){return this.getMetadata(this._excludeMetadatas,t)},a.prototype.getExposedProperties=function(t,e){return this.getExposedMetadatas(t).filter(function(r){return!r.options||r.options.toClassOnly===!0&&r.options.toPlainOnly===!0?!0:r.options.toClassOnly===!0?e===p.CLASS_TO_CLASS||e===p.PLAIN_TO_CLASS:r.options.toPlainOnly===!0?e===p.CLASS_TO_PLAIN:!0}).map(function(r){return r.propertyName})},a.prototype.getExcludedProperties=function(t,e){return this.getExcludedMetadatas(t).filter(function(r){return!r.options||r.options.toClassOnly===!0&&r.options.toPlainOnly===!0?!0:r.options.toClassOnly===!0?e===p.CLASS_TO_CLASS||e===p.PLAIN_TO_CLASS:r.options.toPlainOnly===!0?e===p.CLASS_TO_PLAIN:!0}).map(function(r){return r.propertyName})},a.prototype.clear=function(){this._typeMetadatas.clear(),this._exposeMetadatas.clear(),this._excludeMetadatas.clear(),this._ancestorsMap.clear()},a.prototype.getMetadata=function(t,e){var r=t.get(e),s;r&&(s=Array.from(r.values()).filter(function(f){return f.propertyName!==void 0}));for(var n=[],i=0,o=this.getAncestors(e);i<o.length;i++){var c=o[i],u=t.get(c);if(u){var h=Array.from(u.values()).filter(function(f){return f.propertyName!==void 0});n.push.apply(n,h)}}return n.concat(s||[])},a.prototype.findMetadata=function(t,e,r){var s=t.get(e);if(s){var n=s.get(r);if(n)return n}for(var i=0,o=this.getAncestors(e);i<o.length;i++){var c=o[i],u=t.get(c);if(u){var h=u.get(r);if(h)return h}}},a.prototype.findMetadatas=function(t,e,r){var s=t.get(e),n;s&&(n=s.get(r));for(var i=[],o=0,c=this.getAncestors(e);o<c.length;o++){var u=c[o],h=t.get(u);h&&h.has(r)&&i.push.apply(i,h.get(r))}return i.slice().reverse().concat((n||[]).slice().reverse())},a.prototype.getAncestors=function(t){if(!t)return[];if(!this._ancestorsMap.has(t)){for(var e=[],r=Object.getPrototypeOf(t.prototype.constructor);typeof r.prototype<"u";r=Object.getPrototypeOf(r.prototype.constructor))e.push(r);this._ancestorsMap.set(t,e)}return this._ancestorsMap.get(t)},a}(),O=new x;function L(a,t){return t===void 0&&(t={}),function(e,r){var s=Reflect.getMetadata("design:type",e,r);O.addTypeMetadata({target:e.constructor,propertyName:r,reflectedType:s,typeFunction:a,options:t})}}Object.defineProperty(exports,"ApiProperty",{enumerable:!0,get:()=>y.ApiProperty});Object.defineProperty(exports,"ApiPropertyOptional",{enumerable:!0,get:()=>y.ApiPropertyOptional});exports.ApiError=l;exports.BaseApiClient=S;exports.FetchAdapter=g;exports.HttpServiceAdapter=_;exports.Type=L;
@@ -1,21 +1,21 @@
1
1
  var y = Object.defineProperty;
2
- var g = (n, t, r) => t in n ? y(n, t, { enumerable: !0, configurable: !0, writable: !0, value: r }) : n[t] = r;
3
- var h = (n, t, r) => g(n, typeof t != "symbol" ? t + "" : t, r);
4
- import { ApiProperty as T, ApiPropertyOptional as P } from "@nestjs/swagger";
2
+ var g = (a, t, e) => t in a ? y(a, t, { enumerable: !0, configurable: !0, writable: !0, value: e }) : a[t] = e;
3
+ var d = (a, t, e) => g(a, typeof t != "symbol" ? t + "" : t, e);
4
+ import { ApiProperty as b, ApiPropertyOptional as T } from "@nestjs/swagger";
5
5
  class f extends Error {
6
6
  /**
7
7
  * Create a new API error
8
8
  * @param response The original HTTP response
9
9
  * @param message Optional custom error message
10
10
  */
11
- constructor(r, e) {
11
+ constructor(e, r) {
12
12
  super(
13
- e || `API request failed: ${r.status} ${r.statusText}`
13
+ r || `API request failed: ${e.status} ${e.statusText}`
14
14
  );
15
- h(this, "_response");
16
- h(this, "_jsonData", null);
17
- h(this, "_textData", null);
18
- this.name = "ApiError", this._response = r, Object.setPrototypeOf(this, f.prototype);
15
+ d(this, "_response");
16
+ d(this, "_jsonData", null);
17
+ d(this, "_textData", null);
18
+ this.name = "ApiError", this._response = e, Object.setPrototypeOf(this, f.prototype);
19
19
  }
20
20
  /**
21
21
  * Get the original Response object
@@ -46,8 +46,8 @@ class f extends Error {
46
46
  async json() {
47
47
  if (this._jsonData === null)
48
48
  try {
49
- const r = this._response.clone();
50
- this._jsonData = await r.json();
49
+ const e = this._response.clone();
50
+ this._jsonData = await e.json();
51
51
  } catch {
52
52
  this._jsonData = null;
53
53
  }
@@ -60,8 +60,8 @@ class f extends Error {
60
60
  async text() {
61
61
  if (this._textData === null)
62
62
  try {
63
- const r = this._response.clone();
64
- this._textData = await r.text();
63
+ const e = this._response.clone();
64
+ this._textData = await e.text();
65
65
  } catch {
66
66
  this._textData = "";
67
67
  }
@@ -75,69 +75,69 @@ class _ {
75
75
  async handleResponse(t) {
76
76
  if (!t.ok)
77
77
  throw new f(t);
78
- const r = t.headers.get("content-type");
79
- return r && r.includes("application/json") ? await t.json() : {};
78
+ const e = t.headers.get("content-type");
79
+ return e && e.includes("application/json") ? await t.json() : {};
80
80
  }
81
- async get(t, r) {
82
- const e = await this.fetchImpl(t, {
81
+ async get(t, e) {
82
+ const r = await this.fetchImpl(t, {
83
83
  method: "GET",
84
- headers: r,
84
+ headers: e,
85
85
  credentials: "include"
86
86
  });
87
- return this.handleResponse(e);
87
+ return this.handleResponse(r);
88
88
  }
89
- async post(t, r, e) {
89
+ async post(t, e, r) {
90
90
  const s = await this.fetchImpl(t, {
91
91
  method: "POST",
92
92
  headers: {
93
93
  "Content-Type": "application/json",
94
- ...e
94
+ ...r
95
95
  },
96
- body: JSON.stringify(r),
96
+ body: JSON.stringify(e),
97
97
  credentials: "include"
98
98
  });
99
99
  return this.handleResponse(s);
100
100
  }
101
- async put(t, r, e) {
101
+ async put(t, e, r) {
102
102
  const s = await this.fetchImpl(t, {
103
103
  method: "PUT",
104
104
  headers: {
105
105
  "Content-Type": "application/json",
106
- ...e
106
+ ...r
107
107
  },
108
- body: JSON.stringify(r),
108
+ body: JSON.stringify(e),
109
109
  credentials: "include"
110
110
  });
111
111
  return this.handleResponse(s);
112
112
  }
113
- async patch(t, r, e) {
113
+ async patch(t, e, r) {
114
114
  const s = await this.fetchImpl(t, {
115
115
  method: "PATCH",
116
116
  headers: {
117
117
  "Content-Type": "application/json",
118
- ...e
118
+ ...r
119
119
  },
120
- body: JSON.stringify(r),
120
+ body: JSON.stringify(e),
121
121
  credentials: "include"
122
122
  });
123
123
  return this.handleResponse(s);
124
124
  }
125
- async delete(t, r) {
126
- const e = await this.fetchImpl(t, {
125
+ async delete(t, e) {
126
+ const r = await this.fetchImpl(t, {
127
127
  method: "DELETE",
128
- headers: r,
128
+ headers: e,
129
129
  credentials: "include"
130
130
  });
131
- return this.handleResponse(e);
131
+ return this.handleResponse(r);
132
132
  }
133
- async deleteWithBody(t, r, e) {
133
+ async deleteWithBody(t, e, r) {
134
134
  const s = await this.fetchImpl(t, {
135
135
  method: "DELETE",
136
136
  headers: {
137
137
  "Content-Type": "application/json",
138
- ...e
138
+ ...r
139
139
  },
140
- body: JSON.stringify(r),
140
+ body: JSON.stringify(e),
141
141
  credentials: "include"
142
142
  });
143
143
  return this.handleResponse(s);
@@ -147,31 +147,31 @@ class M {
147
147
  constructor(t) {
148
148
  this.httpService = t;
149
149
  }
150
- async get(t, r) {
151
- const e = r ? { headers: r } : void 0;
152
- return this.httpService.get(t, e);
150
+ async get(t, e) {
151
+ const r = e ? { headers: e } : void 0;
152
+ return this.httpService.get(t, r);
153
153
  }
154
- async post(t, r, e) {
155
- const s = e ? { headers: e } : void 0;
156
- return this.httpService.postJson(t, r, s);
154
+ async post(t, e, r) {
155
+ const s = r ? { headers: r } : void 0;
156
+ return this.httpService.postJson(t, e, s);
157
157
  }
158
- async put(t, r, e) {
159
- const s = e ? { headers: e } : void 0;
160
- return this.httpService.putJson(t, r, s);
158
+ async put(t, e, r) {
159
+ const s = r ? { headers: r } : void 0;
160
+ return this.httpService.putJson(t, e, s);
161
161
  }
162
- async patch(t, r, e) {
163
- const s = e ? { headers: e } : void 0;
164
- return this.httpService.patchJson(t, r, s);
162
+ async patch(t, e, r) {
163
+ const s = r ? { headers: r } : void 0;
164
+ return this.httpService.patchJson(t, e, s);
165
165
  }
166
- async delete(t, r) {
167
- const e = r ? { headers: r } : void 0;
168
- return this.httpService.delete(t, e);
166
+ async delete(t, e) {
167
+ const r = e ? { headers: e } : void 0;
168
+ return this.httpService.delete(t, r);
169
169
  }
170
- async deleteWithBody(t, r, e) {
171
- return this.httpService.deleteJson(t, r);
170
+ async deleteWithBody(t, e, r) {
171
+ return this.httpService.deleteJson(t, e);
172
172
  }
173
173
  }
174
- class x {
174
+ class O {
175
175
  /**
176
176
  * Creates a new API client instance
177
177
  *
@@ -198,17 +198,17 @@ class x {
198
198
  * Base URL for all API requests
199
199
  * @protected
200
200
  */
201
- h(this, "baseUrl");
201
+ d(this, "baseUrl");
202
202
  /**
203
203
  * Default headers included with all requests
204
204
  * @protected
205
205
  */
206
- h(this, "defaultHeaders");
206
+ d(this, "defaultHeaders");
207
207
  /**
208
208
  * HTTP adapter for making requests
209
209
  * @protected
210
210
  */
211
- h(this, "httpAdapter");
211
+ d(this, "httpAdapter");
212
212
  this.baseUrl = t.baseUrl || "", this.defaultHeaders = t.defaultHeaders || {}, t.httpAdapter ? this.httpAdapter = t.httpAdapter : t.httpService ? this.httpAdapter = new M(t.httpService) : this.httpAdapter = new _(t.fetchImpl || fetch);
213
213
  }
214
214
  /**
@@ -218,9 +218,9 @@ class x {
218
218
  * @param options Request options
219
219
  * @returns Promise resolving to the response data
220
220
  */
221
- async get(t, r, e) {
222
- const s = this.buildUrl(t, r);
223
- return this.httpAdapter.get(s, this.buildHeaders(e == null ? void 0 : e.headers));
221
+ async get(t, e, r) {
222
+ const s = this.buildUrl(t, e);
223
+ return this.httpAdapter.get(s, this.buildHeaders(r == null ? void 0 : r.headers));
224
224
  }
225
225
  /**
226
226
  * Performs a POST request
@@ -230,11 +230,11 @@ class x {
230
230
  * @param options Request options
231
231
  * @returns Promise resolving to the response data
232
232
  */
233
- async post(t, r, e, s) {
234
- const a = this.buildUrl(t, e);
233
+ async post(t, e, r, s) {
234
+ const n = this.buildUrl(t, r);
235
235
  return this.httpAdapter.post(
236
- a,
237
- r,
236
+ n,
237
+ e,
238
238
  this.buildHeaders(s == null ? void 0 : s.headers)
239
239
  );
240
240
  }
@@ -246,11 +246,11 @@ class x {
246
246
  * @param options Request options
247
247
  * @returns Promise resolving to the response data
248
248
  */
249
- async put(t, r, e, s) {
250
- const a = this.buildUrl(t, e);
249
+ async put(t, e, r, s) {
250
+ const n = this.buildUrl(t, r);
251
251
  return this.httpAdapter.put(
252
- a,
253
- r,
252
+ n,
253
+ e,
254
254
  this.buildHeaders(s == null ? void 0 : s.headers)
255
255
  );
256
256
  }
@@ -262,11 +262,11 @@ class x {
262
262
  * @param options Request options
263
263
  * @returns Promise resolving to the response data
264
264
  */
265
- async patch(t, r, e, s) {
266
- const a = this.buildUrl(t, e);
265
+ async patch(t, e, r, s) {
266
+ const n = this.buildUrl(t, r);
267
267
  return this.httpAdapter.patch(
268
- a,
269
- r,
268
+ n,
269
+ e,
270
270
  this.buildHeaders(s == null ? void 0 : s.headers)
271
271
  );
272
272
  }
@@ -277,9 +277,9 @@ class x {
277
277
  * @param options Request options
278
278
  * @returns Promise resolving when the request is complete
279
279
  */
280
- async delete(t, r, e) {
281
- const s = this.buildUrl(t, r);
282
- return this.httpAdapter.delete(s, this.buildHeaders(e == null ? void 0 : e.headers));
280
+ async delete(t, e, r) {
281
+ const s = this.buildUrl(t, e);
282
+ return this.httpAdapter.delete(s, this.buildHeaders(r == null ? void 0 : r.headers));
283
283
  }
284
284
  /**
285
285
  * Performs a DELETE request with body
@@ -289,11 +289,11 @@ class x {
289
289
  * @param options Request options
290
290
  * @returns Promise resolving to the response data
291
291
  */
292
- async deleteWithBody(t, r, e, s) {
293
- const a = this.buildUrl(t, e);
292
+ async deleteWithBody(t, e, r, s) {
293
+ const n = this.buildUrl(t, r);
294
294
  return this.httpAdapter.deleteWithBody(
295
- a,
296
- r,
295
+ n,
296
+ e,
297
297
  this.buildHeaders(s == null ? void 0 : s.headers)
298
298
  );
299
299
  }
@@ -303,10 +303,17 @@ class x {
303
303
  * @param queryParams Optional query parameters
304
304
  * @returns Complete URL
305
305
  * @protected
306
+ * @throws {URIError} if the baseUrl attribute is not parsable
306
307
  */
307
- buildUrl(t, r) {
308
- let e = `${this.baseUrl}${t}`;
309
- return e.startsWith("//") && (e = e.replace(/^\/\//, "/")), r && r.toString() && (e += `?${r.toString()}`), e;
308
+ buildUrl(t, e) {
309
+ var o;
310
+ const r = !URL.canParse(this.baseUrl), s = ((o = globalThis.location) == null ? void 0 : o.origin) ?? "", n = r ? `${s}${this.baseUrl}` : this.baseUrl;
311
+ if (!URL.canParse(n))
312
+ throw new URIError(`{baseUrl: ${this.baseUrl}} is not a parsable URL.`);
313
+ const i = new URL(n);
314
+ return i.pathname = r ? A(this.baseUrl, t) : t, e && e.forEach((c, u) => {
315
+ i.searchParams.set(u, c);
316
+ }), r ? i.pathname + i.search : i.toString();
310
317
  }
311
318
  /**
312
319
  * Builds headers for a request by combining default and request-specific headers
@@ -321,127 +328,128 @@ class x {
321
328
  };
322
329
  }
323
330
  }
324
- var o;
325
- (function(n) {
326
- n[n.PLAIN_TO_CLASS = 0] = "PLAIN_TO_CLASS", n[n.CLASS_TO_PLAIN = 1] = "CLASS_TO_PLAIN", n[n.CLASS_TO_CLASS = 2] = "CLASS_TO_CLASS";
327
- })(o || (o = {}));
331
+ const A = (a, t) => `${a.replace(/\/$/, "")}/${t.replace(/^\//, "")}`;
332
+ var p;
333
+ (function(a) {
334
+ a[a.PLAIN_TO_CLASS = 0] = "PLAIN_TO_CLASS", a[a.CLASS_TO_PLAIN = 1] = "CLASS_TO_PLAIN", a[a.CLASS_TO_CLASS = 2] = "CLASS_TO_CLASS";
335
+ })(p || (p = {}));
328
336
  var S = (
329
337
  /** @class */
330
338
  function() {
331
- function n() {
339
+ function a() {
332
340
  this._typeMetadatas = /* @__PURE__ */ new Map(), this._transformMetadatas = /* @__PURE__ */ new Map(), this._exposeMetadatas = /* @__PURE__ */ new Map(), this._excludeMetadatas = /* @__PURE__ */ new Map(), this._ancestorsMap = /* @__PURE__ */ new Map();
333
341
  }
334
- return n.prototype.addTypeMetadata = function(t) {
342
+ return a.prototype.addTypeMetadata = function(t) {
335
343
  this._typeMetadatas.has(t.target) || this._typeMetadatas.set(t.target, /* @__PURE__ */ new Map()), this._typeMetadatas.get(t.target).set(t.propertyName, t);
336
- }, n.prototype.addTransformMetadata = function(t) {
344
+ }, a.prototype.addTransformMetadata = function(t) {
337
345
  this._transformMetadatas.has(t.target) || this._transformMetadatas.set(t.target, /* @__PURE__ */ new Map()), this._transformMetadatas.get(t.target).has(t.propertyName) || this._transformMetadatas.get(t.target).set(t.propertyName, []), this._transformMetadatas.get(t.target).get(t.propertyName).push(t);
338
- }, n.prototype.addExposeMetadata = function(t) {
346
+ }, a.prototype.addExposeMetadata = function(t) {
339
347
  this._exposeMetadatas.has(t.target) || this._exposeMetadatas.set(t.target, /* @__PURE__ */ new Map()), this._exposeMetadatas.get(t.target).set(t.propertyName, t);
340
- }, n.prototype.addExcludeMetadata = function(t) {
348
+ }, a.prototype.addExcludeMetadata = function(t) {
341
349
  this._excludeMetadatas.has(t.target) || this._excludeMetadatas.set(t.target, /* @__PURE__ */ new Map()), this._excludeMetadatas.get(t.target).set(t.propertyName, t);
342
- }, n.prototype.findTransformMetadatas = function(t, r, e) {
343
- return this.findMetadatas(this._transformMetadatas, t, r).filter(function(s) {
344
- return !s.options || s.options.toClassOnly === !0 && s.options.toPlainOnly === !0 ? !0 : s.options.toClassOnly === !0 ? e === o.CLASS_TO_CLASS || e === o.PLAIN_TO_CLASS : s.options.toPlainOnly === !0 ? e === o.CLASS_TO_PLAIN : !0;
350
+ }, a.prototype.findTransformMetadatas = function(t, e, r) {
351
+ return this.findMetadatas(this._transformMetadatas, t, e).filter(function(s) {
352
+ return !s.options || s.options.toClassOnly === !0 && s.options.toPlainOnly === !0 ? !0 : s.options.toClassOnly === !0 ? r === p.CLASS_TO_CLASS || r === p.PLAIN_TO_CLASS : s.options.toPlainOnly === !0 ? r === p.CLASS_TO_PLAIN : !0;
345
353
  });
346
- }, n.prototype.findExcludeMetadata = function(t, r) {
347
- return this.findMetadata(this._excludeMetadatas, t, r);
348
- }, n.prototype.findExposeMetadata = function(t, r) {
349
- return this.findMetadata(this._exposeMetadatas, t, r);
350
- }, n.prototype.findExposeMetadataByCustomName = function(t, r) {
351
- return this.getExposedMetadatas(t).find(function(e) {
352
- return e.options && e.options.name === r;
354
+ }, a.prototype.findExcludeMetadata = function(t, e) {
355
+ return this.findMetadata(this._excludeMetadatas, t, e);
356
+ }, a.prototype.findExposeMetadata = function(t, e) {
357
+ return this.findMetadata(this._exposeMetadatas, t, e);
358
+ }, a.prototype.findExposeMetadataByCustomName = function(t, e) {
359
+ return this.getExposedMetadatas(t).find(function(r) {
360
+ return r.options && r.options.name === e;
353
361
  });
354
- }, n.prototype.findTypeMetadata = function(t, r) {
355
- return this.findMetadata(this._typeMetadatas, t, r);
356
- }, n.prototype.getStrategy = function(t) {
357
- var r = this._excludeMetadatas.get(t), e = r && r.get(void 0), s = this._exposeMetadatas.get(t), a = s && s.get(void 0);
358
- return e && a || !e && !a ? "none" : e ? "excludeAll" : "exposeAll";
359
- }, n.prototype.getExposedMetadatas = function(t) {
362
+ }, a.prototype.findTypeMetadata = function(t, e) {
363
+ return this.findMetadata(this._typeMetadatas, t, e);
364
+ }, a.prototype.getStrategy = function(t) {
365
+ var e = this._excludeMetadatas.get(t), r = e && e.get(void 0), s = this._exposeMetadatas.get(t), n = s && s.get(void 0);
366
+ return r && n || !r && !n ? "none" : r ? "excludeAll" : "exposeAll";
367
+ }, a.prototype.getExposedMetadatas = function(t) {
360
368
  return this.getMetadata(this._exposeMetadatas, t);
361
- }, n.prototype.getExcludedMetadatas = function(t) {
369
+ }, a.prototype.getExcludedMetadatas = function(t) {
362
370
  return this.getMetadata(this._excludeMetadatas, t);
363
- }, n.prototype.getExposedProperties = function(t, r) {
364
- return this.getExposedMetadatas(t).filter(function(e) {
365
- return !e.options || e.options.toClassOnly === !0 && e.options.toPlainOnly === !0 ? !0 : e.options.toClassOnly === !0 ? r === o.CLASS_TO_CLASS || r === o.PLAIN_TO_CLASS : e.options.toPlainOnly === !0 ? r === o.CLASS_TO_PLAIN : !0;
366
- }).map(function(e) {
367
- return e.propertyName;
371
+ }, a.prototype.getExposedProperties = function(t, e) {
372
+ return this.getExposedMetadatas(t).filter(function(r) {
373
+ return !r.options || r.options.toClassOnly === !0 && r.options.toPlainOnly === !0 ? !0 : r.options.toClassOnly === !0 ? e === p.CLASS_TO_CLASS || e === p.PLAIN_TO_CLASS : r.options.toPlainOnly === !0 ? e === p.CLASS_TO_PLAIN : !0;
374
+ }).map(function(r) {
375
+ return r.propertyName;
368
376
  });
369
- }, n.prototype.getExcludedProperties = function(t, r) {
370
- return this.getExcludedMetadatas(t).filter(function(e) {
371
- return !e.options || e.options.toClassOnly === !0 && e.options.toPlainOnly === !0 ? !0 : e.options.toClassOnly === !0 ? r === o.CLASS_TO_CLASS || r === o.PLAIN_TO_CLASS : e.options.toPlainOnly === !0 ? r === o.CLASS_TO_PLAIN : !0;
372
- }).map(function(e) {
373
- return e.propertyName;
377
+ }, a.prototype.getExcludedProperties = function(t, e) {
378
+ return this.getExcludedMetadatas(t).filter(function(r) {
379
+ return !r.options || r.options.toClassOnly === !0 && r.options.toPlainOnly === !0 ? !0 : r.options.toClassOnly === !0 ? e === p.CLASS_TO_CLASS || e === p.PLAIN_TO_CLASS : r.options.toPlainOnly === !0 ? e === p.CLASS_TO_PLAIN : !0;
380
+ }).map(function(r) {
381
+ return r.propertyName;
374
382
  });
375
- }, n.prototype.clear = function() {
383
+ }, a.prototype.clear = function() {
376
384
  this._typeMetadatas.clear(), this._exposeMetadatas.clear(), this._excludeMetadatas.clear(), this._ancestorsMap.clear();
377
- }, n.prototype.getMetadata = function(t, r) {
378
- var e = t.get(r), s;
379
- e && (s = Array.from(e.values()).filter(function(l) {
385
+ }, a.prototype.getMetadata = function(t, e) {
386
+ var r = t.get(e), s;
387
+ r && (s = Array.from(r.values()).filter(function(l) {
380
388
  return l.propertyName !== void 0;
381
389
  }));
382
- for (var a = [], i = 0, p = this.getAncestors(r); i < p.length; i++) {
383
- var c = p[i], d = t.get(c);
384
- if (d) {
385
- var u = Array.from(d.values()).filter(function(l) {
390
+ for (var n = [], i = 0, o = this.getAncestors(e); i < o.length; i++) {
391
+ var c = o[i], u = t.get(c);
392
+ if (u) {
393
+ var h = Array.from(u.values()).filter(function(l) {
386
394
  return l.propertyName !== void 0;
387
395
  });
388
- a.push.apply(a, u);
396
+ n.push.apply(n, h);
389
397
  }
390
398
  }
391
- return a.concat(s || []);
392
- }, n.prototype.findMetadata = function(t, r, e) {
393
- var s = t.get(r);
399
+ return n.concat(s || []);
400
+ }, a.prototype.findMetadata = function(t, e, r) {
401
+ var s = t.get(e);
394
402
  if (s) {
395
- var a = s.get(e);
396
- if (a)
397
- return a;
403
+ var n = s.get(r);
404
+ if (n)
405
+ return n;
398
406
  }
399
- for (var i = 0, p = this.getAncestors(r); i < p.length; i++) {
400
- var c = p[i], d = t.get(c);
401
- if (d) {
402
- var u = d.get(e);
403
- if (u)
404
- return u;
407
+ for (var i = 0, o = this.getAncestors(e); i < o.length; i++) {
408
+ var c = o[i], u = t.get(c);
409
+ if (u) {
410
+ var h = u.get(r);
411
+ if (h)
412
+ return h;
405
413
  }
406
414
  }
407
- }, n.prototype.findMetadatas = function(t, r, e) {
408
- var s = t.get(r), a;
409
- s && (a = s.get(e));
410
- for (var i = [], p = 0, c = this.getAncestors(r); p < c.length; p++) {
411
- var d = c[p], u = t.get(d);
412
- u && u.has(e) && i.push.apply(i, u.get(e));
415
+ }, a.prototype.findMetadatas = function(t, e, r) {
416
+ var s = t.get(e), n;
417
+ s && (n = s.get(r));
418
+ for (var i = [], o = 0, c = this.getAncestors(e); o < c.length; o++) {
419
+ var u = c[o], h = t.get(u);
420
+ h && h.has(r) && i.push.apply(i, h.get(r));
413
421
  }
414
- return i.slice().reverse().concat((a || []).slice().reverse());
415
- }, n.prototype.getAncestors = function(t) {
422
+ return i.slice().reverse().concat((n || []).slice().reverse());
423
+ }, a.prototype.getAncestors = function(t) {
416
424
  if (!t)
417
425
  return [];
418
426
  if (!this._ancestorsMap.has(t)) {
419
- for (var r = [], e = Object.getPrototypeOf(t.prototype.constructor); typeof e.prototype < "u"; e = Object.getPrototypeOf(e.prototype.constructor))
420
- r.push(e);
421
- this._ancestorsMap.set(t, r);
427
+ for (var e = [], r = Object.getPrototypeOf(t.prototype.constructor); typeof r.prototype < "u"; r = Object.getPrototypeOf(r.prototype.constructor))
428
+ e.push(r);
429
+ this._ancestorsMap.set(t, e);
422
430
  }
423
431
  return this._ancestorsMap.get(t);
424
- }, n;
432
+ }, a;
425
433
  }()
426
- ), A = new S();
427
- function O(n, t) {
428
- return t === void 0 && (t = {}), function(r, e) {
429
- var s = Reflect.getMetadata("design:type", r, e);
430
- A.addTypeMetadata({
431
- target: r.constructor,
432
- propertyName: e,
434
+ ), v = new S();
435
+ function L(a, t) {
436
+ return t === void 0 && (t = {}), function(e, r) {
437
+ var s = Reflect.getMetadata("design:type", e, r);
438
+ v.addTypeMetadata({
439
+ target: e.constructor,
440
+ propertyName: r,
433
441
  reflectedType: s,
434
- typeFunction: n,
442
+ typeFunction: a,
435
443
  options: t
436
444
  });
437
445
  };
438
446
  }
439
447
  export {
440
448
  f as ApiError,
441
- T as ApiProperty,
442
- P as ApiPropertyOptional,
443
- x as BaseApiClient,
449
+ b as ApiProperty,
450
+ T as ApiPropertyOptional,
451
+ O as BaseApiClient,
444
452
  _ as FetchAdapter,
445
453
  M as HttpServiceAdapter,
446
- O as Type
454
+ L as Type
447
455
  };
@@ -1,7 +1,7 @@
1
- var c = Object.defineProperty;
2
- var l = (a, t, e) => t in a ? c(a, t, { enumerable: !0, configurable: !0, writable: !0, value: e }) : a[t] = e;
3
- var h = (a, t, e) => l(a, typeof t != "symbol" ? t + "" : t, e);
4
- class i extends Error {
1
+ var p = Object.defineProperty;
2
+ var o = (a, t, e) => t in a ? p(a, t, { enumerable: !0, configurable: !0, writable: !0, value: e }) : a[t] = e;
3
+ var h = (a, t, e) => o(a, typeof t != "symbol" ? t + "" : t, e);
4
+ class c extends Error {
5
5
  /**
6
6
  * Create a new API error
7
7
  * @param response The original HTTP response
@@ -14,7 +14,7 @@ class i extends Error {
14
14
  h(this, "_response");
15
15
  h(this, "_jsonData", null);
16
16
  h(this, "_textData", null);
17
- this.name = "ApiError", this._response = e, Object.setPrototypeOf(this, i.prototype);
17
+ this.name = "ApiError", this._response = e, Object.setPrototypeOf(this, c.prototype);
18
18
  }
19
19
  /**
20
20
  * Get the original Response object
@@ -67,13 +67,13 @@ class i extends Error {
67
67
  return this._textData;
68
68
  }
69
69
  }
70
- class d {
70
+ class y {
71
71
  constructor(t = fetch) {
72
72
  this.fetchImpl = t;
73
73
  }
74
74
  async handleResponse(t) {
75
75
  if (!t.ok)
76
- throw new i(t);
76
+ throw new c(t);
77
77
  const e = t.headers.get("content-type");
78
78
  return e && e.includes("application/json") ? await t.json() : {};
79
79
  }
@@ -142,7 +142,7 @@ class d {
142
142
  return this.handleResponse(r);
143
143
  }
144
144
  }
145
- class u {
145
+ class f {
146
146
  constructor(t) {
147
147
  this.httpService = t;
148
148
  }
@@ -170,7 +170,7 @@ class u {
170
170
  return this.httpService.deleteJson(t, e);
171
171
  }
172
172
  }
173
- class o {
173
+ class m {
174
174
  /**
175
175
  * Creates a new API client instance
176
176
  *
@@ -208,7 +208,7 @@ class o {
208
208
  * @protected
209
209
  */
210
210
  h(this, "httpAdapter");
211
- this.baseUrl = t.baseUrl || "", this.defaultHeaders = t.defaultHeaders || {}, t.httpAdapter ? this.httpAdapter = t.httpAdapter : t.httpService ? this.httpAdapter = new u(t.httpService) : this.httpAdapter = new d(t.fetchImpl || fetch);
211
+ this.baseUrl = t.baseUrl || "", this.defaultHeaders = t.defaultHeaders || {}, t.httpAdapter ? this.httpAdapter = t.httpAdapter : t.httpService ? this.httpAdapter = new f(t.httpService) : this.httpAdapter = new y(t.fetchImpl || fetch);
212
212
  }
213
213
  /**
214
214
  * Performs a GET request
@@ -302,10 +302,17 @@ class o {
302
302
  * @param queryParams Optional query parameters
303
303
  * @returns Complete URL
304
304
  * @protected
305
+ * @throws {URIError} if the baseUrl attribute is not parsable
305
306
  */
306
307
  buildUrl(t, e) {
307
- let s = `${this.baseUrl}${t}`;
308
- return s.startsWith("//") && (s = s.replace(/^\/\//, "/")), e && e.toString() && (s += `?${e.toString()}`), s;
308
+ var l;
309
+ const s = !URL.canParse(this.baseUrl), r = ((l = globalThis.location) == null ? void 0 : l.origin) ?? "", n = s ? `${r}${this.baseUrl}` : this.baseUrl;
310
+ if (!URL.canParse(n))
311
+ throw new URIError(`{baseUrl: ${this.baseUrl}} is not a parsable URL.`);
312
+ const i = new URL(n);
313
+ return i.pathname = s ? b(this.baseUrl, t) : t, e && e.forEach((d, u) => {
314
+ i.searchParams.set(u, d);
315
+ }), s ? i.pathname + i.search : i.toString();
309
316
  }
310
317
  /**
311
318
  * Builds headers for a request by combining default and request-specific headers
@@ -320,24 +327,25 @@ class o {
320
327
  };
321
328
  }
322
329
  }
323
- function y(...a) {
330
+ const b = (a, t) => `${a.replace(/\/$/, "")}/${t.replace(/^\//, "")}`;
331
+ function A(...a) {
324
332
  return () => {
325
333
  };
326
334
  }
327
- function f(...a) {
335
+ function _(...a) {
328
336
  return () => {
329
337
  };
330
338
  }
331
- function b(...a) {
339
+ function g(...a) {
332
340
  return () => {
333
341
  };
334
342
  }
335
343
  export {
336
- i as ApiError,
337
- f as ApiProperty,
338
- b as ApiPropertyOptional,
339
- o as BaseApiClient,
340
- d as FetchAdapter,
341
- u as HttpServiceAdapter,
342
- y as Type
344
+ c as ApiError,
345
+ _ as ApiProperty,
346
+ g as ApiPropertyOptional,
347
+ m as BaseApiClient,
348
+ y as FetchAdapter,
349
+ f as HttpServiceAdapter,
350
+ A as Type
343
351
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@edifice.io/rest-client-base",
3
- "version": "2.5.22",
3
+ "version": "2.5.23-develop.20260623093925",
4
4
  "description": "Abstract base for Edifice client SDKs (no application-specific logic)",
5
5
  "private": false,
6
6
  "license": "AGPL-3.0",
@@ -43,11 +43,12 @@
43
43
  "path": "0.12.7",
44
44
  "vite": "5.4.14",
45
45
  "vite-plugin-dts": "4.5.4",
46
- "@edifice.io/client": "2.5.22"
46
+ "@edifice.io/client": "2.5.23-develop.20260623093925"
47
47
  },
48
48
  "scripts": {
49
49
  "clean": "rm -rf dist node_modules",
50
- "format": "prettier --write src",
50
+ "format": "prettier --check src",
51
+ "format:write": "prettier --write src",
51
52
  "lint": "eslint src",
52
53
  "lint:fix": "eslint src --fix",
53
54
  "build": "pnpm run build:node && pnpm run build:browser && pnpm run build:react-native",