@edifice.io/rest-client-base 2.5.22-develop.20260615185517 → 2.5.22-develop.20260622094140
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/browser/index.js +27 -25
- package/dist/node/index.cjs +1 -1
- package/dist/node/index.js +37 -35
- package/dist/react-native/index.js +27 -25
- package/package.json +2 -2
package/dist/browser/index.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
var
|
|
2
|
-
var
|
|
3
|
-
var h = (a, t, e) =>
|
|
4
|
-
class
|
|
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,
|
|
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
|
|
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
|
|
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
|
|
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
|
|
173
|
+
class m {
|
|
174
174
|
/**
|
|
175
175
|
* Creates a new API client instance
|
|
176
176
|
*
|
|
@@ -208,7 +208,7 @@ class y {
|
|
|
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
|
|
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
|
|
@@ -305,12 +305,14 @@ class y {
|
|
|
305
305
|
* @throws {URIError} if the baseUrl attribute is not parsable
|
|
306
306
|
*/
|
|
307
307
|
buildUrl(t, e) {
|
|
308
|
-
|
|
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))
|
|
309
311
|
throw new URIError(`{baseUrl: ${this.baseUrl}} is not a parsable URL.`);
|
|
310
|
-
const
|
|
311
|
-
return
|
|
312
|
-
|
|
313
|
-
}), s.toString();
|
|
312
|
+
const i = new URL(n);
|
|
313
|
+
return i.pathname = t, e && e.forEach((d, u) => {
|
|
314
|
+
i.searchParams.set(u, d);
|
|
315
|
+
}), s ? i.pathname + i.search : i.toString();
|
|
314
316
|
}
|
|
315
317
|
/**
|
|
316
318
|
* Builds headers for a request by combining default and request-specific headers
|
|
@@ -325,24 +327,24 @@ class y {
|
|
|
325
327
|
};
|
|
326
328
|
}
|
|
327
329
|
}
|
|
328
|
-
function
|
|
330
|
+
function U(...a) {
|
|
329
331
|
return () => {
|
|
330
332
|
};
|
|
331
333
|
}
|
|
332
|
-
function
|
|
334
|
+
function A(...a) {
|
|
333
335
|
return () => {
|
|
334
336
|
};
|
|
335
337
|
}
|
|
336
|
-
function
|
|
338
|
+
function _(...a) {
|
|
337
339
|
return () => {
|
|
338
340
|
};
|
|
339
341
|
}
|
|
340
342
|
export {
|
|
341
|
-
|
|
342
|
-
|
|
343
|
-
|
|
344
|
-
|
|
345
|
-
|
|
346
|
-
|
|
347
|
-
|
|
343
|
+
c as ApiError,
|
|
344
|
+
A as ApiProperty,
|
|
345
|
+
_ as ApiPropertyOptional,
|
|
346
|
+
m as BaseApiClient,
|
|
347
|
+
y as FetchAdapter,
|
|
348
|
+
f as HttpServiceAdapter,
|
|
349
|
+
U as Type
|
|
348
350
|
};
|
package/dist/node/index.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
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){
|
|
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=t,e&&e.forEach((c,u)=>{i.searchParams.set(u,c)}),r?i.pathname+i.search:i.toString()}buildHeaders(t){return{...this.defaultHeaders,...t}}}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 v=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}(),x=new v;function O(a,t){return t===void 0&&(t={}),function(e,r){var s=Reflect.getMetadata("design:type",e,r);x.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=O;
|
package/dist/node/index.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
var y = Object.defineProperty;
|
|
2
|
-
var
|
|
3
|
-
var
|
|
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
4
|
import { ApiProperty as P, ApiPropertyOptional as T } from "@nestjs/swagger";
|
|
5
5
|
class f extends Error {
|
|
6
6
|
/**
|
|
@@ -12,9 +12,9 @@ class f extends Error {
|
|
|
12
12
|
super(
|
|
13
13
|
r || `API request failed: ${e.status} ${e.statusText}`
|
|
14
14
|
);
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
15
|
+
d(this, "_response");
|
|
16
|
+
d(this, "_jsonData", null);
|
|
17
|
+
d(this, "_textData", null);
|
|
18
18
|
this.name = "ApiError", this._response = e, Object.setPrototypeOf(this, f.prototype);
|
|
19
19
|
}
|
|
20
20
|
/**
|
|
@@ -68,7 +68,7 @@ class f extends Error {
|
|
|
68
68
|
return this._textData;
|
|
69
69
|
}
|
|
70
70
|
}
|
|
71
|
-
class
|
|
71
|
+
class _ {
|
|
72
72
|
constructor(t = fetch) {
|
|
73
73
|
this.fetchImpl = t;
|
|
74
74
|
}
|
|
@@ -198,18 +198,18 @@ class x {
|
|
|
198
198
|
* Base URL for all API requests
|
|
199
199
|
* @protected
|
|
200
200
|
*/
|
|
201
|
-
|
|
201
|
+
d(this, "baseUrl");
|
|
202
202
|
/**
|
|
203
203
|
* Default headers included with all requests
|
|
204
204
|
* @protected
|
|
205
205
|
*/
|
|
206
|
-
|
|
206
|
+
d(this, "defaultHeaders");
|
|
207
207
|
/**
|
|
208
208
|
* HTTP adapter for making requests
|
|
209
209
|
* @protected
|
|
210
210
|
*/
|
|
211
|
-
|
|
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
|
|
211
|
+
d(this, "httpAdapter");
|
|
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
|
/**
|
|
215
215
|
* Performs a GET request
|
|
@@ -306,12 +306,14 @@ class x {
|
|
|
306
306
|
* @throws {URIError} if the baseUrl attribute is not parsable
|
|
307
307
|
*/
|
|
308
308
|
buildUrl(t, e) {
|
|
309
|
-
|
|
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))
|
|
310
312
|
throw new URIError(`{baseUrl: ${this.baseUrl}} is not a parsable URL.`);
|
|
311
|
-
const
|
|
312
|
-
return
|
|
313
|
-
|
|
314
|
-
}), r.toString();
|
|
313
|
+
const i = new URL(n);
|
|
314
|
+
return i.pathname = t, e && e.forEach((h, u) => {
|
|
315
|
+
i.searchParams.set(u, h);
|
|
316
|
+
}), r ? i.pathname + i.search : i.toString();
|
|
315
317
|
}
|
|
316
318
|
/**
|
|
317
319
|
* Builds headers for a request by combining default and request-specific headers
|
|
@@ -326,10 +328,10 @@ class x {
|
|
|
326
328
|
};
|
|
327
329
|
}
|
|
328
330
|
}
|
|
329
|
-
var
|
|
331
|
+
var p;
|
|
330
332
|
(function(a) {
|
|
331
333
|
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";
|
|
332
|
-
})(
|
|
334
|
+
})(p || (p = {}));
|
|
333
335
|
var A = (
|
|
334
336
|
/** @class */
|
|
335
337
|
function() {
|
|
@@ -346,7 +348,7 @@ var A = (
|
|
|
346
348
|
this._excludeMetadatas.has(t.target) || this._excludeMetadatas.set(t.target, /* @__PURE__ */ new Map()), this._excludeMetadatas.get(t.target).set(t.propertyName, t);
|
|
347
349
|
}, a.prototype.findTransformMetadatas = function(t, e, r) {
|
|
348
350
|
return this.findMetadatas(this._transformMetadatas, t, e).filter(function(s) {
|
|
349
|
-
return !s.options || s.options.toClassOnly === !0 && s.options.toPlainOnly === !0 ? !0 : s.options.toClassOnly === !0 ? r ===
|
|
351
|
+
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;
|
|
350
352
|
});
|
|
351
353
|
}, a.prototype.findExcludeMetadata = function(t, e) {
|
|
352
354
|
return this.findMetadata(this._excludeMetadatas, t, e);
|
|
@@ -367,13 +369,13 @@ var A = (
|
|
|
367
369
|
return this.getMetadata(this._excludeMetadatas, t);
|
|
368
370
|
}, a.prototype.getExposedProperties = function(t, e) {
|
|
369
371
|
return this.getExposedMetadatas(t).filter(function(r) {
|
|
370
|
-
return !r.options || r.options.toClassOnly === !0 && r.options.toPlainOnly === !0 ? !0 : r.options.toClassOnly === !0 ? e ===
|
|
372
|
+
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;
|
|
371
373
|
}).map(function(r) {
|
|
372
374
|
return r.propertyName;
|
|
373
375
|
});
|
|
374
376
|
}, a.prototype.getExcludedProperties = function(t, e) {
|
|
375
377
|
return this.getExcludedMetadatas(t).filter(function(r) {
|
|
376
|
-
return !r.options || r.options.toClassOnly === !0 && r.options.toPlainOnly === !0 ? !0 : r.options.toClassOnly === !0 ? e ===
|
|
378
|
+
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;
|
|
377
379
|
}).map(function(r) {
|
|
378
380
|
return r.propertyName;
|
|
379
381
|
});
|
|
@@ -384,13 +386,13 @@ var A = (
|
|
|
384
386
|
r && (s = Array.from(r.values()).filter(function(l) {
|
|
385
387
|
return l.propertyName !== void 0;
|
|
386
388
|
}));
|
|
387
|
-
for (var n = [], i = 0,
|
|
388
|
-
var
|
|
389
|
-
if (
|
|
390
|
-
var
|
|
389
|
+
for (var n = [], i = 0, o = this.getAncestors(e); i < o.length; i++) {
|
|
390
|
+
var h = o[i], u = t.get(h);
|
|
391
|
+
if (u) {
|
|
392
|
+
var c = Array.from(u.values()).filter(function(l) {
|
|
391
393
|
return l.propertyName !== void 0;
|
|
392
394
|
});
|
|
393
|
-
n.push.apply(n,
|
|
395
|
+
n.push.apply(n, c);
|
|
394
396
|
}
|
|
395
397
|
}
|
|
396
398
|
return n.concat(s || []);
|
|
@@ -401,20 +403,20 @@ var A = (
|
|
|
401
403
|
if (n)
|
|
402
404
|
return n;
|
|
403
405
|
}
|
|
404
|
-
for (var i = 0,
|
|
405
|
-
var
|
|
406
|
-
if (
|
|
407
|
-
var
|
|
408
|
-
if (
|
|
409
|
-
return
|
|
406
|
+
for (var i = 0, o = this.getAncestors(e); i < o.length; i++) {
|
|
407
|
+
var h = o[i], u = t.get(h);
|
|
408
|
+
if (u) {
|
|
409
|
+
var c = u.get(r);
|
|
410
|
+
if (c)
|
|
411
|
+
return c;
|
|
410
412
|
}
|
|
411
413
|
}
|
|
412
414
|
}, a.prototype.findMetadatas = function(t, e, r) {
|
|
413
415
|
var s = t.get(e), n;
|
|
414
416
|
s && (n = s.get(r));
|
|
415
|
-
for (var i = [],
|
|
416
|
-
var
|
|
417
|
-
|
|
417
|
+
for (var i = [], o = 0, h = this.getAncestors(e); o < h.length; o++) {
|
|
418
|
+
var u = h[o], c = t.get(u);
|
|
419
|
+
c && c.has(r) && i.push.apply(i, c.get(r));
|
|
418
420
|
}
|
|
419
421
|
return i.slice().reverse().concat((n || []).slice().reverse());
|
|
420
422
|
}, a.prototype.getAncestors = function(t) {
|
|
@@ -446,7 +448,7 @@ export {
|
|
|
446
448
|
P as ApiProperty,
|
|
447
449
|
T as ApiPropertyOptional,
|
|
448
450
|
x as BaseApiClient,
|
|
449
|
-
|
|
451
|
+
_ as FetchAdapter,
|
|
450
452
|
M as HttpServiceAdapter,
|
|
451
453
|
O as Type
|
|
452
454
|
};
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
var
|
|
2
|
-
var
|
|
3
|
-
var h = (a, t, e) =>
|
|
4
|
-
class
|
|
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,
|
|
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
|
|
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
|
|
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
|
|
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
|
|
173
|
+
class m {
|
|
174
174
|
/**
|
|
175
175
|
* Creates a new API client instance
|
|
176
176
|
*
|
|
@@ -208,7 +208,7 @@ class y {
|
|
|
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
|
|
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
|
|
@@ -305,12 +305,14 @@ class y {
|
|
|
305
305
|
* @throws {URIError} if the baseUrl attribute is not parsable
|
|
306
306
|
*/
|
|
307
307
|
buildUrl(t, e) {
|
|
308
|
-
|
|
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))
|
|
309
311
|
throw new URIError(`{baseUrl: ${this.baseUrl}} is not a parsable URL.`);
|
|
310
|
-
const
|
|
311
|
-
return
|
|
312
|
-
|
|
313
|
-
}), s.toString();
|
|
312
|
+
const i = new URL(n);
|
|
313
|
+
return i.pathname = t, e && e.forEach((d, u) => {
|
|
314
|
+
i.searchParams.set(u, d);
|
|
315
|
+
}), s ? i.pathname + i.search : i.toString();
|
|
314
316
|
}
|
|
315
317
|
/**
|
|
316
318
|
* Builds headers for a request by combining default and request-specific headers
|
|
@@ -325,24 +327,24 @@ class y {
|
|
|
325
327
|
};
|
|
326
328
|
}
|
|
327
329
|
}
|
|
328
|
-
function
|
|
330
|
+
function U(...a) {
|
|
329
331
|
return () => {
|
|
330
332
|
};
|
|
331
333
|
}
|
|
332
|
-
function
|
|
334
|
+
function A(...a) {
|
|
333
335
|
return () => {
|
|
334
336
|
};
|
|
335
337
|
}
|
|
336
|
-
function
|
|
338
|
+
function _(...a) {
|
|
337
339
|
return () => {
|
|
338
340
|
};
|
|
339
341
|
}
|
|
340
342
|
export {
|
|
341
|
-
|
|
342
|
-
|
|
343
|
-
|
|
344
|
-
|
|
345
|
-
|
|
346
|
-
|
|
347
|
-
|
|
343
|
+
c as ApiError,
|
|
344
|
+
A as ApiProperty,
|
|
345
|
+
_ as ApiPropertyOptional,
|
|
346
|
+
m as BaseApiClient,
|
|
347
|
+
y as FetchAdapter,
|
|
348
|
+
f as HttpServiceAdapter,
|
|
349
|
+
U as Type
|
|
348
350
|
};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@edifice.io/rest-client-base",
|
|
3
|
-
"version": "2.5.22-develop.
|
|
3
|
+
"version": "2.5.22-develop.20260622094140",
|
|
4
4
|
"description": "Abstract base for Edifice client SDKs (no application-specific logic)",
|
|
5
5
|
"private": false,
|
|
6
6
|
"license": "AGPL-3.0",
|
|
@@ -43,7 +43,7 @@
|
|
|
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-develop.
|
|
46
|
+
"@edifice.io/client": "2.5.22-develop.20260622094140"
|
|
47
47
|
},
|
|
48
48
|
"scripts": {
|
|
49
49
|
"clean": "rm -rf dist node_modules",
|