@edifice.io/rest-client-base 2.5.22 → 2.5.23
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 +30 -22
- package/dist/node/index.cjs +1 -1
- package/dist/node/index.js +170 -162
- package/dist/react-native/index.js +30 -22
- package/package.json +4 -3
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 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
|
|
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
|
-
|
|
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))
|
|
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
|
-
|
|
330
|
+
const b = (a, t) => `${a.replace(/\/$/, "")}/${t.replace(/^\//, "")}`;
|
|
331
|
+
function A(...a) {
|
|
324
332
|
return () => {
|
|
325
333
|
};
|
|
326
334
|
}
|
|
327
|
-
function
|
|
335
|
+
function _(...a) {
|
|
328
336
|
return () => {
|
|
329
337
|
};
|
|
330
338
|
}
|
|
331
|
-
function
|
|
339
|
+
function g(...a) {
|
|
332
340
|
return () => {
|
|
333
341
|
};
|
|
334
342
|
}
|
|
335
343
|
export {
|
|
336
|
-
|
|
337
|
-
|
|
338
|
-
|
|
339
|
-
|
|
340
|
-
|
|
341
|
-
|
|
342
|
-
|
|
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/dist/node/index.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";var M=Object.defineProperty;var A=(
|
|
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;
|
package/dist/node/index.js
CHANGED
|
@@ -1,21 +1,21 @@
|
|
|
1
1
|
var y = Object.defineProperty;
|
|
2
|
-
var g = (
|
|
3
|
-
var
|
|
4
|
-
import { ApiProperty as
|
|
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(
|
|
11
|
+
constructor(e, r) {
|
|
12
12
|
super(
|
|
13
|
-
|
|
13
|
+
r || `API request failed: ${e.status} ${e.statusText}`
|
|
14
14
|
);
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
this.name = "ApiError", this._response =
|
|
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
|
|
50
|
-
this._jsonData = await
|
|
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
|
|
64
|
-
this._textData = await
|
|
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
|
|
79
|
-
return
|
|
78
|
+
const e = t.headers.get("content-type");
|
|
79
|
+
return e && e.includes("application/json") ? await t.json() : {};
|
|
80
80
|
}
|
|
81
|
-
async get(t,
|
|
82
|
-
const
|
|
81
|
+
async get(t, e) {
|
|
82
|
+
const r = await this.fetchImpl(t, {
|
|
83
83
|
method: "GET",
|
|
84
|
-
headers:
|
|
84
|
+
headers: e,
|
|
85
85
|
credentials: "include"
|
|
86
86
|
});
|
|
87
|
-
return this.handleResponse(
|
|
87
|
+
return this.handleResponse(r);
|
|
88
88
|
}
|
|
89
|
-
async post(t,
|
|
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
|
-
...
|
|
94
|
+
...r
|
|
95
95
|
},
|
|
96
|
-
body: JSON.stringify(
|
|
96
|
+
body: JSON.stringify(e),
|
|
97
97
|
credentials: "include"
|
|
98
98
|
});
|
|
99
99
|
return this.handleResponse(s);
|
|
100
100
|
}
|
|
101
|
-
async put(t,
|
|
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
|
-
...
|
|
106
|
+
...r
|
|
107
107
|
},
|
|
108
|
-
body: JSON.stringify(
|
|
108
|
+
body: JSON.stringify(e),
|
|
109
109
|
credentials: "include"
|
|
110
110
|
});
|
|
111
111
|
return this.handleResponse(s);
|
|
112
112
|
}
|
|
113
|
-
async patch(t,
|
|
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
|
-
...
|
|
118
|
+
...r
|
|
119
119
|
},
|
|
120
|
-
body: JSON.stringify(
|
|
120
|
+
body: JSON.stringify(e),
|
|
121
121
|
credentials: "include"
|
|
122
122
|
});
|
|
123
123
|
return this.handleResponse(s);
|
|
124
124
|
}
|
|
125
|
-
async delete(t,
|
|
126
|
-
const
|
|
125
|
+
async delete(t, e) {
|
|
126
|
+
const r = await this.fetchImpl(t, {
|
|
127
127
|
method: "DELETE",
|
|
128
|
-
headers:
|
|
128
|
+
headers: e,
|
|
129
129
|
credentials: "include"
|
|
130
130
|
});
|
|
131
|
-
return this.handleResponse(
|
|
131
|
+
return this.handleResponse(r);
|
|
132
132
|
}
|
|
133
|
-
async deleteWithBody(t,
|
|
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
|
-
...
|
|
138
|
+
...r
|
|
139
139
|
},
|
|
140
|
-
body: JSON.stringify(
|
|
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,
|
|
151
|
-
const
|
|
152
|
-
return this.httpService.get(t,
|
|
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,
|
|
155
|
-
const s =
|
|
156
|
-
return this.httpService.postJson(t,
|
|
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,
|
|
159
|
-
const s =
|
|
160
|
-
return this.httpService.putJson(t,
|
|
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,
|
|
163
|
-
const s =
|
|
164
|
-
return this.httpService.patchJson(t,
|
|
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,
|
|
167
|
-
const
|
|
168
|
-
return this.httpService.delete(t,
|
|
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,
|
|
171
|
-
return this.httpService.deleteJson(t,
|
|
170
|
+
async deleteWithBody(t, e, r) {
|
|
171
|
+
return this.httpService.deleteJson(t, e);
|
|
172
172
|
}
|
|
173
173
|
}
|
|
174
|
-
class
|
|
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
|
-
|
|
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
|
-
|
|
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,
|
|
222
|
-
const s = this.buildUrl(t,
|
|
223
|
-
return this.httpAdapter.get(s, this.buildHeaders(
|
|
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,
|
|
234
|
-
const
|
|
233
|
+
async post(t, e, r, s) {
|
|
234
|
+
const n = this.buildUrl(t, r);
|
|
235
235
|
return this.httpAdapter.post(
|
|
236
|
-
|
|
237
|
-
|
|
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,
|
|
250
|
-
const
|
|
249
|
+
async put(t, e, r, s) {
|
|
250
|
+
const n = this.buildUrl(t, r);
|
|
251
251
|
return this.httpAdapter.put(
|
|
252
|
-
|
|
253
|
-
|
|
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,
|
|
266
|
-
const
|
|
265
|
+
async patch(t, e, r, s) {
|
|
266
|
+
const n = this.buildUrl(t, r);
|
|
267
267
|
return this.httpAdapter.patch(
|
|
268
|
-
|
|
269
|
-
|
|
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,
|
|
281
|
-
const s = this.buildUrl(t,
|
|
282
|
-
return this.httpAdapter.delete(s, this.buildHeaders(
|
|
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,
|
|
293
|
-
const
|
|
292
|
+
async deleteWithBody(t, e, r, s) {
|
|
293
|
+
const n = this.buildUrl(t, r);
|
|
294
294
|
return this.httpAdapter.deleteWithBody(
|
|
295
|
-
|
|
296
|
-
|
|
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,
|
|
308
|
-
|
|
309
|
-
|
|
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
|
-
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
|
|
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
|
|
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
|
|
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
|
-
},
|
|
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
|
-
},
|
|
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
|
-
},
|
|
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
|
-
},
|
|
343
|
-
return this.findMetadatas(this._transformMetadatas, t,
|
|
344
|
-
return !s.options || s.options.toClassOnly === !0 && s.options.toPlainOnly === !0 ? !0 : s.options.toClassOnly === !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
|
-
},
|
|
347
|
-
return this.findMetadata(this._excludeMetadatas, t,
|
|
348
|
-
},
|
|
349
|
-
return this.findMetadata(this._exposeMetadatas, t,
|
|
350
|
-
},
|
|
351
|
-
return this.getExposedMetadatas(t).find(function(
|
|
352
|
-
return
|
|
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
|
-
},
|
|
355
|
-
return this.findMetadata(this._typeMetadatas, t,
|
|
356
|
-
},
|
|
357
|
-
var
|
|
358
|
-
return
|
|
359
|
-
},
|
|
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
|
-
},
|
|
369
|
+
}, a.prototype.getExcludedMetadatas = function(t) {
|
|
362
370
|
return this.getMetadata(this._excludeMetadatas, t);
|
|
363
|
-
},
|
|
364
|
-
return this.getExposedMetadatas(t).filter(function(
|
|
365
|
-
return !
|
|
366
|
-
}).map(function(
|
|
367
|
-
return
|
|
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
|
-
},
|
|
370
|
-
return this.getExcludedMetadatas(t).filter(function(
|
|
371
|
-
return !
|
|
372
|
-
}).map(function(
|
|
373
|
-
return
|
|
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
|
-
},
|
|
383
|
+
}, a.prototype.clear = function() {
|
|
376
384
|
this._typeMetadatas.clear(), this._exposeMetadatas.clear(), this._excludeMetadatas.clear(), this._ancestorsMap.clear();
|
|
377
|
-
},
|
|
378
|
-
var
|
|
379
|
-
|
|
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
|
|
383
|
-
var c =
|
|
384
|
-
if (
|
|
385
|
-
var
|
|
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
|
-
|
|
396
|
+
n.push.apply(n, h);
|
|
389
397
|
}
|
|
390
398
|
}
|
|
391
|
-
return
|
|
392
|
-
},
|
|
393
|
-
var s = t.get(
|
|
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
|
|
396
|
-
if (
|
|
397
|
-
return
|
|
403
|
+
var n = s.get(r);
|
|
404
|
+
if (n)
|
|
405
|
+
return n;
|
|
398
406
|
}
|
|
399
|
-
for (var i = 0,
|
|
400
|
-
var c =
|
|
401
|
-
if (
|
|
402
|
-
var
|
|
403
|
-
if (
|
|
404
|
-
return
|
|
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
|
-
},
|
|
408
|
-
var s = t.get(
|
|
409
|
-
s && (
|
|
410
|
-
for (var i = [],
|
|
411
|
-
var
|
|
412
|
-
|
|
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((
|
|
415
|
-
},
|
|
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
|
|
420
|
-
|
|
421
|
-
this._ancestorsMap.set(t,
|
|
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
|
-
},
|
|
432
|
+
}, a;
|
|
425
433
|
}()
|
|
426
|
-
),
|
|
427
|
-
function
|
|
428
|
-
return t === void 0 && (t = {}), function(
|
|
429
|
-
var s = Reflect.getMetadata("design:type",
|
|
430
|
-
|
|
431
|
-
target:
|
|
432
|
-
propertyName:
|
|
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:
|
|
442
|
+
typeFunction: a,
|
|
435
443
|
options: t
|
|
436
444
|
});
|
|
437
445
|
};
|
|
438
446
|
}
|
|
439
447
|
export {
|
|
440
448
|
f as ApiError,
|
|
441
|
-
|
|
442
|
-
|
|
443
|
-
|
|
449
|
+
b as ApiProperty,
|
|
450
|
+
T as ApiPropertyOptional,
|
|
451
|
+
O as BaseApiClient,
|
|
444
452
|
_ as FetchAdapter,
|
|
445
453
|
M as HttpServiceAdapter,
|
|
446
|
-
|
|
454
|
+
L as Type
|
|
447
455
|
};
|
|
@@ -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 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
|
|
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
|
-
|
|
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))
|
|
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
|
-
|
|
330
|
+
const b = (a, t) => `${a.replace(/\/$/, "")}/${t.replace(/^\//, "")}`;
|
|
331
|
+
function A(...a) {
|
|
324
332
|
return () => {
|
|
325
333
|
};
|
|
326
334
|
}
|
|
327
|
-
function
|
|
335
|
+
function _(...a) {
|
|
328
336
|
return () => {
|
|
329
337
|
};
|
|
330
338
|
}
|
|
331
|
-
function
|
|
339
|
+
function g(...a) {
|
|
332
340
|
return () => {
|
|
333
341
|
};
|
|
334
342
|
}
|
|
335
343
|
export {
|
|
336
|
-
|
|
337
|
-
|
|
338
|
-
|
|
339
|
-
|
|
340
|
-
|
|
341
|
-
|
|
342
|
-
|
|
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.
|
|
3
|
+
"version": "2.5.23",
|
|
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.
|
|
46
|
+
"@edifice.io/client": "2.5.23"
|
|
47
47
|
},
|
|
48
48
|
"scripts": {
|
|
49
49
|
"clean": "rm -rf dist node_modules",
|
|
50
|
-
"format": "prettier --
|
|
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",
|