@edifice.io/rest-client-base 2.6.6 → 2.6.7-develop-b2school.20260928143952
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 +25 -19
- package/dist/node/index.cjs +1 -1
- package/dist/node/index.js +28 -22
- package/dist/react-native/index.js +25 -19
- package/package.json +2 -2
package/dist/browser/index.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
var
|
|
2
|
-
var
|
|
3
|
-
var h = (a, t, e) =>
|
|
1
|
+
var o = Object.defineProperty;
|
|
2
|
+
var y = (a, t, e) => t in a ? o(a, t, { enumerable: !0, configurable: !0, writable: !0, value: e }) : a[t] = e;
|
|
3
|
+
var h = (a, t, e) => y(a, typeof t != "symbol" ? t + "" : t, e);
|
|
4
4
|
class c extends Error {
|
|
5
5
|
/**
|
|
6
6
|
* Create a new API error
|
|
@@ -67,7 +67,7 @@ class c extends Error {
|
|
|
67
67
|
return this._textData;
|
|
68
68
|
}
|
|
69
69
|
}
|
|
70
|
-
class
|
|
70
|
+
class f {
|
|
71
71
|
constructor(t = fetch) {
|
|
72
72
|
this.fetchImpl = t;
|
|
73
73
|
}
|
|
@@ -142,7 +142,7 @@ class y {
|
|
|
142
142
|
return this.handleResponse(r);
|
|
143
143
|
}
|
|
144
144
|
}
|
|
145
|
-
class
|
|
145
|
+
class b {
|
|
146
146
|
constructor(t) {
|
|
147
147
|
this.httpService = t;
|
|
148
148
|
}
|
|
@@ -170,7 +170,7 @@ class f {
|
|
|
170
170
|
return this.httpService.deleteJson(t, e);
|
|
171
171
|
}
|
|
172
172
|
}
|
|
173
|
-
class
|
|
173
|
+
class A {
|
|
174
174
|
/**
|
|
175
175
|
* Creates a new API client instance
|
|
176
176
|
*
|
|
@@ -208,7 +208,7 @@ class U {
|
|
|
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 b(t.httpService) : this.httpAdapter = new f(t.fetchImpl || fetch);
|
|
212
212
|
}
|
|
213
213
|
/**
|
|
214
214
|
* Performs a GET request
|
|
@@ -306,12 +306,12 @@ class U {
|
|
|
306
306
|
*/
|
|
307
307
|
buildUrl(t, e) {
|
|
308
308
|
var l;
|
|
309
|
-
const s = !
|
|
310
|
-
if (!
|
|
309
|
+
const s = !d(this.baseUrl), r = ((l = globalThis.location) == null ? void 0 : l.origin) ?? "", n = s ? `${r}${this.baseUrl}` : this.baseUrl;
|
|
310
|
+
if (!d(n))
|
|
311
311
|
throw new URIError(`{baseUrl: ${this.baseUrl}} is not a parsable URL.`);
|
|
312
312
|
const i = new URL(n);
|
|
313
|
-
return i.pathname =
|
|
314
|
-
i.searchParams.append(
|
|
313
|
+
return i.pathname = m(i.pathname, t), e && e.forEach((p, u) => {
|
|
314
|
+
i.searchParams.append(u, p);
|
|
315
315
|
}), s ? i.pathname + i.search : i.toString();
|
|
316
316
|
}
|
|
317
317
|
/**
|
|
@@ -327,12 +327,18 @@ class U {
|
|
|
327
327
|
};
|
|
328
328
|
}
|
|
329
329
|
}
|
|
330
|
-
const
|
|
331
|
-
|
|
330
|
+
const d = (a) => {
|
|
331
|
+
try {
|
|
332
|
+
return new URL(a), !0;
|
|
333
|
+
} catch {
|
|
334
|
+
return !1;
|
|
335
|
+
}
|
|
336
|
+
}, m = (a, t) => `${a.replace(/\/$/, "")}/${t.replace(/^\//, "")}`;
|
|
337
|
+
function _(...a) {
|
|
332
338
|
return () => {
|
|
333
339
|
};
|
|
334
340
|
}
|
|
335
|
-
function
|
|
341
|
+
function w(...a) {
|
|
336
342
|
return () => {
|
|
337
343
|
};
|
|
338
344
|
}
|
|
@@ -342,10 +348,10 @@ function g(...a) {
|
|
|
342
348
|
}
|
|
343
349
|
export {
|
|
344
350
|
c as ApiError,
|
|
345
|
-
|
|
351
|
+
w as ApiProperty,
|
|
346
352
|
g as ApiPropertyOptional,
|
|
347
|
-
|
|
348
|
-
|
|
349
|
-
|
|
350
|
-
|
|
353
|
+
A as BaseApiClient,
|
|
354
|
+
f as FetchAdapter,
|
|
355
|
+
b as HttpServiceAdapter,
|
|
356
|
+
_ as Type
|
|
351
357
|
};
|
package/dist/node/index.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";var
|
|
1
|
+
"use strict";var A=Object.defineProperty;var S=(a,t,e)=>t in a?A(a,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):a[t]=e;var d=(a,t,e)=>S(a,typeof t!="symbol"?t+"":t,e);Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const g=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 _{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 M{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 v{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 M(t.httpService):this.httpAdapter=new _(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=!y(this.baseUrl),s=((o=globalThis.location)==null?void 0:o.origin)??"",n=r?`${s}${this.baseUrl}`:this.baseUrl;if(!y(n))throw new URIError(`{baseUrl: ${this.baseUrl}} is not a parsable URL.`);const i=new URL(n);return i.pathname=x(i.pathname,t),e&&e.forEach((c,u)=>{i.searchParams.append(u,c)}),r?i.pathname+i.search:i.toString()}buildHeaders(t){return{...this.defaultHeaders,...t}}}const y=a=>{try{return new URL(a),!0}catch{return!1}},x=(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 O=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}(),L=new O;function b(a,t){return t===void 0&&(t={}),function(e,r){var s=Reflect.getMetadata("design:type",e,r);L.addTypeMetadata({target:e.constructor,propertyName:r,reflectedType:s,typeFunction:a,options:t})}}Object.defineProperty(exports,"ApiProperty",{enumerable:!0,get:()=>g.ApiProperty});Object.defineProperty(exports,"ApiPropertyOptional",{enumerable:!0,get:()=>g.ApiPropertyOptional});exports.ApiError=l;exports.BaseApiClient=v;exports.FetchAdapter=_;exports.HttpServiceAdapter=M;exports.Type=b;
|
package/dist/node/index.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
var
|
|
2
|
-
var
|
|
3
|
-
var d = (a, t, e) =>
|
|
4
|
-
import { ApiProperty as
|
|
1
|
+
var g = Object.defineProperty;
|
|
2
|
+
var _ = (a, t, e) => t in a ? g(a, t, { enumerable: !0, configurable: !0, writable: !0, value: e }) : a[t] = e;
|
|
3
|
+
var d = (a, t, e) => _(a, typeof t != "symbol" ? t + "" : t, e);
|
|
4
|
+
import { ApiProperty as b, ApiPropertyOptional as w } from "@nestjs/swagger";
|
|
5
5
|
class f extends Error {
|
|
6
6
|
/**
|
|
7
7
|
* Create a new API error
|
|
@@ -68,7 +68,7 @@ class f extends Error {
|
|
|
68
68
|
return this._textData;
|
|
69
69
|
}
|
|
70
70
|
}
|
|
71
|
-
class
|
|
71
|
+
class M {
|
|
72
72
|
constructor(t = fetch) {
|
|
73
73
|
this.fetchImpl = t;
|
|
74
74
|
}
|
|
@@ -143,7 +143,7 @@ class _ {
|
|
|
143
143
|
return this.handleResponse(s);
|
|
144
144
|
}
|
|
145
145
|
}
|
|
146
|
-
class
|
|
146
|
+
class A {
|
|
147
147
|
constructor(t) {
|
|
148
148
|
this.httpService = t;
|
|
149
149
|
}
|
|
@@ -171,7 +171,7 @@ class M {
|
|
|
171
171
|
return this.httpService.deleteJson(t, e);
|
|
172
172
|
}
|
|
173
173
|
}
|
|
174
|
-
class
|
|
174
|
+
class L {
|
|
175
175
|
/**
|
|
176
176
|
* Creates a new API client instance
|
|
177
177
|
*
|
|
@@ -209,7 +209,7 @@ class O {
|
|
|
209
209
|
* @protected
|
|
210
210
|
*/
|
|
211
211
|
d(this, "httpAdapter");
|
|
212
|
-
this.baseUrl = t.baseUrl || "", this.defaultHeaders = t.defaultHeaders || {}, t.httpAdapter ? this.httpAdapter = t.httpAdapter : t.httpService ? this.httpAdapter = new
|
|
212
|
+
this.baseUrl = t.baseUrl || "", this.defaultHeaders = t.defaultHeaders || {}, t.httpAdapter ? this.httpAdapter = t.httpAdapter : t.httpService ? this.httpAdapter = new A(t.httpService) : this.httpAdapter = new M(t.fetchImpl || fetch);
|
|
213
213
|
}
|
|
214
214
|
/**
|
|
215
215
|
* Performs a GET request
|
|
@@ -307,11 +307,11 @@ class O {
|
|
|
307
307
|
*/
|
|
308
308
|
buildUrl(t, e) {
|
|
309
309
|
var o;
|
|
310
|
-
const r = !
|
|
311
|
-
if (!
|
|
310
|
+
const r = !y(this.baseUrl), s = ((o = globalThis.location) == null ? void 0 : o.origin) ?? "", n = r ? `${s}${this.baseUrl}` : this.baseUrl;
|
|
311
|
+
if (!y(n))
|
|
312
312
|
throw new URIError(`{baseUrl: ${this.baseUrl}} is not a parsable URL.`);
|
|
313
313
|
const i = new URL(n);
|
|
314
|
-
return i.pathname =
|
|
314
|
+
return i.pathname = S(i.pathname, t), e && e.forEach((c, u) => {
|
|
315
315
|
i.searchParams.append(u, c);
|
|
316
316
|
}), r ? i.pathname + i.search : i.toString();
|
|
317
317
|
}
|
|
@@ -328,12 +328,18 @@ class O {
|
|
|
328
328
|
};
|
|
329
329
|
}
|
|
330
330
|
}
|
|
331
|
-
const
|
|
331
|
+
const y = (a) => {
|
|
332
|
+
try {
|
|
333
|
+
return new URL(a), !0;
|
|
334
|
+
} catch {
|
|
335
|
+
return !1;
|
|
336
|
+
}
|
|
337
|
+
}, S = (a, t) => `${a.replace(/\/$/, "")}/${t.replace(/^\//, "")}`;
|
|
332
338
|
var p;
|
|
333
339
|
(function(a) {
|
|
334
340
|
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
341
|
})(p || (p = {}));
|
|
336
|
-
var
|
|
342
|
+
var v = (
|
|
337
343
|
/** @class */
|
|
338
344
|
function() {
|
|
339
345
|
function a() {
|
|
@@ -431,11 +437,11 @@ var S = (
|
|
|
431
437
|
return this._ancestorsMap.get(t);
|
|
432
438
|
}, a;
|
|
433
439
|
}()
|
|
434
|
-
),
|
|
435
|
-
function
|
|
440
|
+
), x = new v();
|
|
441
|
+
function C(a, t) {
|
|
436
442
|
return t === void 0 && (t = {}), function(e, r) {
|
|
437
443
|
var s = Reflect.getMetadata("design:type", e, r);
|
|
438
|
-
|
|
444
|
+
x.addTypeMetadata({
|
|
439
445
|
target: e.constructor,
|
|
440
446
|
propertyName: r,
|
|
441
447
|
reflectedType: s,
|
|
@@ -446,10 +452,10 @@ function L(a, t) {
|
|
|
446
452
|
}
|
|
447
453
|
export {
|
|
448
454
|
f as ApiError,
|
|
449
|
-
|
|
450
|
-
|
|
451
|
-
|
|
452
|
-
|
|
453
|
-
|
|
454
|
-
|
|
455
|
+
b as ApiProperty,
|
|
456
|
+
w as ApiPropertyOptional,
|
|
457
|
+
L as BaseApiClient,
|
|
458
|
+
M as FetchAdapter,
|
|
459
|
+
A as HttpServiceAdapter,
|
|
460
|
+
C as Type
|
|
455
461
|
};
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
var
|
|
2
|
-
var
|
|
3
|
-
var h = (a, t, e) =>
|
|
1
|
+
var o = Object.defineProperty;
|
|
2
|
+
var y = (a, t, e) => t in a ? o(a, t, { enumerable: !0, configurable: !0, writable: !0, value: e }) : a[t] = e;
|
|
3
|
+
var h = (a, t, e) => y(a, typeof t != "symbol" ? t + "" : t, e);
|
|
4
4
|
class c extends Error {
|
|
5
5
|
/**
|
|
6
6
|
* Create a new API error
|
|
@@ -67,7 +67,7 @@ class c extends Error {
|
|
|
67
67
|
return this._textData;
|
|
68
68
|
}
|
|
69
69
|
}
|
|
70
|
-
class
|
|
70
|
+
class f {
|
|
71
71
|
constructor(t = fetch) {
|
|
72
72
|
this.fetchImpl = t;
|
|
73
73
|
}
|
|
@@ -142,7 +142,7 @@ class y {
|
|
|
142
142
|
return this.handleResponse(r);
|
|
143
143
|
}
|
|
144
144
|
}
|
|
145
|
-
class
|
|
145
|
+
class b {
|
|
146
146
|
constructor(t) {
|
|
147
147
|
this.httpService = t;
|
|
148
148
|
}
|
|
@@ -170,7 +170,7 @@ class f {
|
|
|
170
170
|
return this.httpService.deleteJson(t, e);
|
|
171
171
|
}
|
|
172
172
|
}
|
|
173
|
-
class
|
|
173
|
+
class A {
|
|
174
174
|
/**
|
|
175
175
|
* Creates a new API client instance
|
|
176
176
|
*
|
|
@@ -208,7 +208,7 @@ class U {
|
|
|
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 b(t.httpService) : this.httpAdapter = new f(t.fetchImpl || fetch);
|
|
212
212
|
}
|
|
213
213
|
/**
|
|
214
214
|
* Performs a GET request
|
|
@@ -306,12 +306,12 @@ class U {
|
|
|
306
306
|
*/
|
|
307
307
|
buildUrl(t, e) {
|
|
308
308
|
var l;
|
|
309
|
-
const s = !
|
|
310
|
-
if (!
|
|
309
|
+
const s = !d(this.baseUrl), r = ((l = globalThis.location) == null ? void 0 : l.origin) ?? "", n = s ? `${r}${this.baseUrl}` : this.baseUrl;
|
|
310
|
+
if (!d(n))
|
|
311
311
|
throw new URIError(`{baseUrl: ${this.baseUrl}} is not a parsable URL.`);
|
|
312
312
|
const i = new URL(n);
|
|
313
|
-
return i.pathname =
|
|
314
|
-
i.searchParams.append(
|
|
313
|
+
return i.pathname = m(i.pathname, t), e && e.forEach((p, u) => {
|
|
314
|
+
i.searchParams.append(u, p);
|
|
315
315
|
}), s ? i.pathname + i.search : i.toString();
|
|
316
316
|
}
|
|
317
317
|
/**
|
|
@@ -327,12 +327,18 @@ class U {
|
|
|
327
327
|
};
|
|
328
328
|
}
|
|
329
329
|
}
|
|
330
|
-
const
|
|
331
|
-
|
|
330
|
+
const d = (a) => {
|
|
331
|
+
try {
|
|
332
|
+
return new URL(a), !0;
|
|
333
|
+
} catch {
|
|
334
|
+
return !1;
|
|
335
|
+
}
|
|
336
|
+
}, m = (a, t) => `${a.replace(/\/$/, "")}/${t.replace(/^\//, "")}`;
|
|
337
|
+
function _(...a) {
|
|
332
338
|
return () => {
|
|
333
339
|
};
|
|
334
340
|
}
|
|
335
|
-
function
|
|
341
|
+
function w(...a) {
|
|
336
342
|
return () => {
|
|
337
343
|
};
|
|
338
344
|
}
|
|
@@ -342,10 +348,10 @@ function g(...a) {
|
|
|
342
348
|
}
|
|
343
349
|
export {
|
|
344
350
|
c as ApiError,
|
|
345
|
-
|
|
351
|
+
w as ApiProperty,
|
|
346
352
|
g as ApiPropertyOptional,
|
|
347
|
-
|
|
348
|
-
|
|
349
|
-
|
|
350
|
-
|
|
353
|
+
A as BaseApiClient,
|
|
354
|
+
f as FetchAdapter,
|
|
355
|
+
b as HttpServiceAdapter,
|
|
356
|
+
_ as Type
|
|
351
357
|
};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@edifice.io/rest-client-base",
|
|
3
|
-
"version": "2.6.
|
|
3
|
+
"version": "2.6.7-develop-b2school.20260928143952",
|
|
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.6.
|
|
46
|
+
"@edifice.io/client": "2.6.7-develop-b2school.20260928143952"
|
|
47
47
|
},
|
|
48
48
|
"scripts": {
|
|
49
49
|
"clean": "rm -rf dist node_modules",
|