@edifice.io/rest-client-base 2.5.23 → 2.5.24
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 +6 -6
- package/dist/node/index.cjs +1 -1
- package/dist/node/index.js +5 -5
- package/dist/react-native/index.js +6 -6
- package/package.json +2 -2
package/dist/browser/index.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
var
|
|
2
|
-
var o = (a, t, e) => t in a ?
|
|
1
|
+
var u = Object.defineProperty;
|
|
2
|
+
var o = (a, t, e) => t in a ? u(a, t, { enumerable: !0, configurable: !0, writable: !0, value: e }) : a[t] = e;
|
|
3
3
|
var h = (a, t, e) => o(a, typeof t != "symbol" ? t + "" : t, e);
|
|
4
4
|
class c extends Error {
|
|
5
5
|
/**
|
|
@@ -170,7 +170,7 @@ class f {
|
|
|
170
170
|
return this.httpService.deleteJson(t, e);
|
|
171
171
|
}
|
|
172
172
|
}
|
|
173
|
-
class
|
|
173
|
+
class U {
|
|
174
174
|
/**
|
|
175
175
|
* Creates a new API client instance
|
|
176
176
|
*
|
|
@@ -310,8 +310,8 @@ class m {
|
|
|
310
310
|
if (!URL.canParse(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.
|
|
313
|
+
return i.pathname = b(i.pathname, t), e && e.forEach((d, p) => {
|
|
314
|
+
i.searchParams.append(p, d);
|
|
315
315
|
}), s ? i.pathname + i.search : i.toString();
|
|
316
316
|
}
|
|
317
317
|
/**
|
|
@@ -344,7 +344,7 @@ export {
|
|
|
344
344
|
c as ApiError,
|
|
345
345
|
_ as ApiProperty,
|
|
346
346
|
g as ApiPropertyOptional,
|
|
347
|
-
|
|
347
|
+
U as BaseApiClient,
|
|
348
348
|
y as FetchAdapter,
|
|
349
349
|
f as HttpServiceAdapter,
|
|
350
350
|
A as Type
|
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){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=
|
|
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=v(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 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,7 +1,7 @@
|
|
|
1
1
|
var y = Object.defineProperty;
|
|
2
2
|
var g = (a, t, e) => t in a ? y(a, t, { enumerable: !0, configurable: !0, writable: !0, value: e }) : a[t] = e;
|
|
3
3
|
var d = (a, t, e) => g(a, typeof t != "symbol" ? t + "" : t, e);
|
|
4
|
-
import { ApiProperty as
|
|
4
|
+
import { ApiProperty as T, ApiPropertyOptional as b } from "@nestjs/swagger";
|
|
5
5
|
class f extends Error {
|
|
6
6
|
/**
|
|
7
7
|
* Create a new API error
|
|
@@ -311,8 +311,8 @@ class O {
|
|
|
311
311
|
if (!URL.canParse(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 =
|
|
315
|
-
i.searchParams.
|
|
314
|
+
return i.pathname = A(i.pathname, t), e && e.forEach((c, u) => {
|
|
315
|
+
i.searchParams.append(u, c);
|
|
316
316
|
}), r ? i.pathname + i.search : i.toString();
|
|
317
317
|
}
|
|
318
318
|
/**
|
|
@@ -446,8 +446,8 @@ function L(a, t) {
|
|
|
446
446
|
}
|
|
447
447
|
export {
|
|
448
448
|
f as ApiError,
|
|
449
|
-
|
|
450
|
-
|
|
449
|
+
T as ApiProperty,
|
|
450
|
+
b as ApiPropertyOptional,
|
|
451
451
|
O as BaseApiClient,
|
|
452
452
|
_ as FetchAdapter,
|
|
453
453
|
M as HttpServiceAdapter,
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
var
|
|
2
|
-
var o = (a, t, e) => t in a ?
|
|
1
|
+
var u = Object.defineProperty;
|
|
2
|
+
var o = (a, t, e) => t in a ? u(a, t, { enumerable: !0, configurable: !0, writable: !0, value: e }) : a[t] = e;
|
|
3
3
|
var h = (a, t, e) => o(a, typeof t != "symbol" ? t + "" : t, e);
|
|
4
4
|
class c extends Error {
|
|
5
5
|
/**
|
|
@@ -170,7 +170,7 @@ class f {
|
|
|
170
170
|
return this.httpService.deleteJson(t, e);
|
|
171
171
|
}
|
|
172
172
|
}
|
|
173
|
-
class
|
|
173
|
+
class U {
|
|
174
174
|
/**
|
|
175
175
|
* Creates a new API client instance
|
|
176
176
|
*
|
|
@@ -310,8 +310,8 @@ class m {
|
|
|
310
310
|
if (!URL.canParse(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.
|
|
313
|
+
return i.pathname = b(i.pathname, t), e && e.forEach((d, p) => {
|
|
314
|
+
i.searchParams.append(p, d);
|
|
315
315
|
}), s ? i.pathname + i.search : i.toString();
|
|
316
316
|
}
|
|
317
317
|
/**
|
|
@@ -344,7 +344,7 @@ export {
|
|
|
344
344
|
c as ApiError,
|
|
345
345
|
_ as ApiProperty,
|
|
346
346
|
g as ApiPropertyOptional,
|
|
347
|
-
|
|
347
|
+
U as BaseApiClient,
|
|
348
348
|
y as FetchAdapter,
|
|
349
349
|
f as HttpServiceAdapter,
|
|
350
350
|
A as Type
|
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.24",
|
|
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.
|
|
46
|
+
"@edifice.io/client": "2.5.24"
|
|
47
47
|
},
|
|
48
48
|
"scripts": {
|
|
49
49
|
"clean": "rm -rf dist node_modules",
|