@edifice.io/rest-client-base 2.5.22-develop-b2school.20260608181736 → 2.5.22-develop.20260615185517
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 +15 -10
- package/dist/node/index.cjs +1 -1
- package/dist/node/index.js +164 -159
- package/dist/react-native/index.js +15 -10
- package/package.json +4 -3
package/dist/browser/index.js
CHANGED
|
@@ -170,7 +170,7 @@ class u {
|
|
|
170
170
|
return this.httpService.deleteJson(t, e);
|
|
171
171
|
}
|
|
172
172
|
}
|
|
173
|
-
class
|
|
173
|
+
class y {
|
|
174
174
|
/**
|
|
175
175
|
* Creates a new API client instance
|
|
176
176
|
*
|
|
@@ -302,10 +302,15 @@ 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
|
+
if (!URL.canParse(this.baseUrl))
|
|
309
|
+
throw new URIError(`{baseUrl: ${this.baseUrl}} is not a parsable URL.`);
|
|
310
|
+
const s = new URL(this.baseUrl);
|
|
311
|
+
return s.pathname = t, e && e.forEach((r, n, p) => {
|
|
312
|
+
s.searchParams.set(n, r);
|
|
313
|
+
}), s.toString();
|
|
309
314
|
}
|
|
310
315
|
/**
|
|
311
316
|
* Builds headers for a request by combining default and request-specific headers
|
|
@@ -320,24 +325,24 @@ class o {
|
|
|
320
325
|
};
|
|
321
326
|
}
|
|
322
327
|
}
|
|
323
|
-
function
|
|
328
|
+
function f(...a) {
|
|
324
329
|
return () => {
|
|
325
330
|
};
|
|
326
331
|
}
|
|
327
|
-
function
|
|
332
|
+
function b(...a) {
|
|
328
333
|
return () => {
|
|
329
334
|
};
|
|
330
335
|
}
|
|
331
|
-
function
|
|
336
|
+
function m(...a) {
|
|
332
337
|
return () => {
|
|
333
338
|
};
|
|
334
339
|
}
|
|
335
340
|
export {
|
|
336
341
|
i as ApiError,
|
|
337
|
-
|
|
338
|
-
|
|
339
|
-
|
|
342
|
+
b as ApiProperty,
|
|
343
|
+
m as ApiPropertyOptional,
|
|
344
|
+
y as BaseApiClient,
|
|
340
345
|
d as FetchAdapter,
|
|
341
346
|
u as HttpServiceAdapter,
|
|
342
|
-
|
|
347
|
+
f as Type
|
|
343
348
|
};
|
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){if(!URL.canParse(this.baseUrl))throw new URIError(`{baseUrl: ${this.baseUrl}} is not a parsable URL.`);const r=new URL(this.baseUrl);return r.pathname=t,e&&e.forEach((s,n,i)=>{r.searchParams.set(n,s)}),r.toString()}buildHeaders(t){return{...this.defaultHeaders,...t}}}var o;(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"})(o||(o={}));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===o.CLASS_TO_CLASS||r===o.PLAIN_TO_CLASS:s.options.toPlainOnly===!0?r===o.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===o.CLASS_TO_CLASS||e===o.PLAIN_TO_CLASS:r.options.toPlainOnly===!0?e===o.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===o.CLASS_TO_CLASS||e===o.PLAIN_TO_CLASS:r.options.toPlainOnly===!0?e===o.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,p=this.getAncestors(e);i<p.length;i++){var h=p[i],c=t.get(h);if(c){var u=Array.from(c.values()).filter(function(f){return f.propertyName!==void 0});n.push.apply(n,u)}}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,p=this.getAncestors(e);i<p.length;i++){var h=p[i],c=t.get(h);if(c){var u=c.get(r);if(u)return u}}},a.prototype.findMetadatas=function(t,e,r){var s=t.get(e),n;s&&(n=s.get(r));for(var i=[],p=0,h=this.getAncestors(e);p<h.length;p++){var c=h[p],u=t.get(c);u&&u.has(r)&&i.push.apply(i,u.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,21 +1,21 @@
|
|
|
1
1
|
var y = Object.defineProperty;
|
|
2
|
-
var
|
|
3
|
-
var
|
|
4
|
-
import { ApiProperty as
|
|
2
|
+
var _ = (a, t, e) => t in a ? y(a, t, { enumerable: !0, configurable: !0, writable: !0, value: e }) : a[t] = e;
|
|
3
|
+
var c = (a, t, e) => _(a, typeof t != "symbol" ? t + "" : t, e);
|
|
4
|
+
import { ApiProperty as P, 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
|
+
c(this, "_response");
|
|
16
|
+
c(this, "_jsonData", null);
|
|
17
|
+
c(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,84 +60,84 @@ 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
|
}
|
|
68
68
|
return this._textData;
|
|
69
69
|
}
|
|
70
70
|
}
|
|
71
|
-
class
|
|
71
|
+
class g {
|
|
72
72
|
constructor(t = fetch) {
|
|
73
73
|
this.fetchImpl = t;
|
|
74
74
|
}
|
|
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,28 +147,28 @@ 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
174
|
class x {
|
|
@@ -198,18 +198,18 @@ class x {
|
|
|
198
198
|
* Base URL for all API requests
|
|
199
199
|
* @protected
|
|
200
200
|
*/
|
|
201
|
-
|
|
201
|
+
c(this, "baseUrl");
|
|
202
202
|
/**
|
|
203
203
|
* Default headers included with all requests
|
|
204
204
|
* @protected
|
|
205
205
|
*/
|
|
206
|
-
|
|
206
|
+
c(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
|
+
c(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 g(t.fetchImpl || fetch);
|
|
213
213
|
}
|
|
214
214
|
/**
|
|
215
215
|
* Performs a GET request
|
|
@@ -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,15 @@ 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
|
+
if (!URL.canParse(this.baseUrl))
|
|
310
|
+
throw new URIError(`{baseUrl: ${this.baseUrl}} is not a parsable URL.`);
|
|
311
|
+
const r = new URL(this.baseUrl);
|
|
312
|
+
return r.pathname = t, e && e.forEach((s, n, i) => {
|
|
313
|
+
r.searchParams.set(n, s);
|
|
314
|
+
}), r.toString();
|
|
310
315
|
}
|
|
311
316
|
/**
|
|
312
317
|
* Builds headers for a request by combining default and request-specific headers
|
|
@@ -322,126 +327,126 @@ class x {
|
|
|
322
327
|
}
|
|
323
328
|
}
|
|
324
329
|
var o;
|
|
325
|
-
(function(
|
|
326
|
-
|
|
330
|
+
(function(a) {
|
|
331
|
+
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";
|
|
327
332
|
})(o || (o = {}));
|
|
328
|
-
var
|
|
333
|
+
var A = (
|
|
329
334
|
/** @class */
|
|
330
335
|
function() {
|
|
331
|
-
function
|
|
336
|
+
function a() {
|
|
332
337
|
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
338
|
}
|
|
334
|
-
return
|
|
339
|
+
return a.prototype.addTypeMetadata = function(t) {
|
|
335
340
|
this._typeMetadatas.has(t.target) || this._typeMetadatas.set(t.target, /* @__PURE__ */ new Map()), this._typeMetadatas.get(t.target).set(t.propertyName, t);
|
|
336
|
-
},
|
|
341
|
+
}, a.prototype.addTransformMetadata = function(t) {
|
|
337
342
|
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
|
-
},
|
|
343
|
+
}, a.prototype.addExposeMetadata = function(t) {
|
|
339
344
|
this._exposeMetadatas.has(t.target) || this._exposeMetadatas.set(t.target, /* @__PURE__ */ new Map()), this._exposeMetadatas.get(t.target).set(t.propertyName, t);
|
|
340
|
-
},
|
|
345
|
+
}, a.prototype.addExcludeMetadata = function(t) {
|
|
341
346
|
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 ?
|
|
347
|
+
}, a.prototype.findTransformMetadatas = function(t, e, r) {
|
|
348
|
+
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 === o.CLASS_TO_CLASS || r === o.PLAIN_TO_CLASS : s.options.toPlainOnly === !0 ? r === o.CLASS_TO_PLAIN : !0;
|
|
345
350
|
});
|
|
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
|
|
351
|
+
}, a.prototype.findExcludeMetadata = function(t, e) {
|
|
352
|
+
return this.findMetadata(this._excludeMetadatas, t, e);
|
|
353
|
+
}, a.prototype.findExposeMetadata = function(t, e) {
|
|
354
|
+
return this.findMetadata(this._exposeMetadatas, t, e);
|
|
355
|
+
}, a.prototype.findExposeMetadataByCustomName = function(t, e) {
|
|
356
|
+
return this.getExposedMetadatas(t).find(function(r) {
|
|
357
|
+
return r.options && r.options.name === e;
|
|
353
358
|
});
|
|
354
|
-
},
|
|
355
|
-
return this.findMetadata(this._typeMetadatas, t,
|
|
356
|
-
},
|
|
357
|
-
var
|
|
358
|
-
return
|
|
359
|
-
},
|
|
359
|
+
}, a.prototype.findTypeMetadata = function(t, e) {
|
|
360
|
+
return this.findMetadata(this._typeMetadatas, t, e);
|
|
361
|
+
}, a.prototype.getStrategy = function(t) {
|
|
362
|
+
var e = this._excludeMetadatas.get(t), r = e && e.get(void 0), s = this._exposeMetadatas.get(t), n = s && s.get(void 0);
|
|
363
|
+
return r && n || !r && !n ? "none" : r ? "excludeAll" : "exposeAll";
|
|
364
|
+
}, a.prototype.getExposedMetadatas = function(t) {
|
|
360
365
|
return this.getMetadata(this._exposeMetadatas, t);
|
|
361
|
-
},
|
|
366
|
+
}, a.prototype.getExcludedMetadatas = function(t) {
|
|
362
367
|
return this.getMetadata(this._excludeMetadatas, t);
|
|
363
|
-
},
|
|
364
|
-
return this.getExposedMetadatas(t).filter(function(
|
|
365
|
-
return !
|
|
366
|
-
}).map(function(
|
|
367
|
-
return
|
|
368
|
+
}, a.prototype.getExposedProperties = function(t, e) {
|
|
369
|
+
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 === o.CLASS_TO_CLASS || e === o.PLAIN_TO_CLASS : r.options.toPlainOnly === !0 ? e === o.CLASS_TO_PLAIN : !0;
|
|
371
|
+
}).map(function(r) {
|
|
372
|
+
return r.propertyName;
|
|
368
373
|
});
|
|
369
|
-
},
|
|
370
|
-
return this.getExcludedMetadatas(t).filter(function(
|
|
371
|
-
return !
|
|
372
|
-
}).map(function(
|
|
373
|
-
return
|
|
374
|
+
}, a.prototype.getExcludedProperties = function(t, e) {
|
|
375
|
+
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 === o.CLASS_TO_CLASS || e === o.PLAIN_TO_CLASS : r.options.toPlainOnly === !0 ? e === o.CLASS_TO_PLAIN : !0;
|
|
377
|
+
}).map(function(r) {
|
|
378
|
+
return r.propertyName;
|
|
374
379
|
});
|
|
375
|
-
},
|
|
380
|
+
}, a.prototype.clear = function() {
|
|
376
381
|
this._typeMetadatas.clear(), this._exposeMetadatas.clear(), this._excludeMetadatas.clear(), this._ancestorsMap.clear();
|
|
377
|
-
},
|
|
378
|
-
var
|
|
379
|
-
|
|
382
|
+
}, a.prototype.getMetadata = function(t, e) {
|
|
383
|
+
var r = t.get(e), s;
|
|
384
|
+
r && (s = Array.from(r.values()).filter(function(l) {
|
|
380
385
|
return l.propertyName !== void 0;
|
|
381
386
|
}));
|
|
382
|
-
for (var
|
|
383
|
-
var
|
|
384
|
-
if (
|
|
385
|
-
var u = Array.from(
|
|
387
|
+
for (var n = [], i = 0, p = this.getAncestors(e); i < p.length; i++) {
|
|
388
|
+
var d = p[i], h = t.get(d);
|
|
389
|
+
if (h) {
|
|
390
|
+
var u = Array.from(h.values()).filter(function(l) {
|
|
386
391
|
return l.propertyName !== void 0;
|
|
387
392
|
});
|
|
388
|
-
|
|
393
|
+
n.push.apply(n, u);
|
|
389
394
|
}
|
|
390
395
|
}
|
|
391
|
-
return
|
|
392
|
-
},
|
|
393
|
-
var s = t.get(
|
|
396
|
+
return n.concat(s || []);
|
|
397
|
+
}, a.prototype.findMetadata = function(t, e, r) {
|
|
398
|
+
var s = t.get(e);
|
|
394
399
|
if (s) {
|
|
395
|
-
var
|
|
396
|
-
if (
|
|
397
|
-
return
|
|
400
|
+
var n = s.get(r);
|
|
401
|
+
if (n)
|
|
402
|
+
return n;
|
|
398
403
|
}
|
|
399
|
-
for (var i = 0, p = this.getAncestors(
|
|
400
|
-
var
|
|
401
|
-
if (
|
|
402
|
-
var u =
|
|
404
|
+
for (var i = 0, p = this.getAncestors(e); i < p.length; i++) {
|
|
405
|
+
var d = p[i], h = t.get(d);
|
|
406
|
+
if (h) {
|
|
407
|
+
var u = h.get(r);
|
|
403
408
|
if (u)
|
|
404
409
|
return u;
|
|
405
410
|
}
|
|
406
411
|
}
|
|
407
|
-
},
|
|
408
|
-
var s = t.get(
|
|
409
|
-
s && (
|
|
410
|
-
for (var i = [], p = 0,
|
|
411
|
-
var
|
|
412
|
-
u && u.has(
|
|
412
|
+
}, a.prototype.findMetadatas = function(t, e, r) {
|
|
413
|
+
var s = t.get(e), n;
|
|
414
|
+
s && (n = s.get(r));
|
|
415
|
+
for (var i = [], p = 0, d = this.getAncestors(e); p < d.length; p++) {
|
|
416
|
+
var h = d[p], u = t.get(h);
|
|
417
|
+
u && u.has(r) && i.push.apply(i, u.get(r));
|
|
413
418
|
}
|
|
414
|
-
return i.slice().reverse().concat((
|
|
415
|
-
},
|
|
419
|
+
return i.slice().reverse().concat((n || []).slice().reverse());
|
|
420
|
+
}, a.prototype.getAncestors = function(t) {
|
|
416
421
|
if (!t)
|
|
417
422
|
return [];
|
|
418
423
|
if (!this._ancestorsMap.has(t)) {
|
|
419
|
-
for (var
|
|
420
|
-
|
|
421
|
-
this._ancestorsMap.set(t,
|
|
424
|
+
for (var e = [], r = Object.getPrototypeOf(t.prototype.constructor); typeof r.prototype < "u"; r = Object.getPrototypeOf(r.prototype.constructor))
|
|
425
|
+
e.push(r);
|
|
426
|
+
this._ancestorsMap.set(t, e);
|
|
422
427
|
}
|
|
423
428
|
return this._ancestorsMap.get(t);
|
|
424
|
-
},
|
|
429
|
+
}, a;
|
|
425
430
|
}()
|
|
426
|
-
),
|
|
427
|
-
function O(
|
|
428
|
-
return t === void 0 && (t = {}), function(
|
|
429
|
-
var s = Reflect.getMetadata("design:type",
|
|
430
|
-
|
|
431
|
-
target:
|
|
432
|
-
propertyName:
|
|
431
|
+
), S = new A();
|
|
432
|
+
function O(a, t) {
|
|
433
|
+
return t === void 0 && (t = {}), function(e, r) {
|
|
434
|
+
var s = Reflect.getMetadata("design:type", e, r);
|
|
435
|
+
S.addTypeMetadata({
|
|
436
|
+
target: e.constructor,
|
|
437
|
+
propertyName: r,
|
|
433
438
|
reflectedType: s,
|
|
434
|
-
typeFunction:
|
|
439
|
+
typeFunction: a,
|
|
435
440
|
options: t
|
|
436
441
|
});
|
|
437
442
|
};
|
|
438
443
|
}
|
|
439
444
|
export {
|
|
440
445
|
f as ApiError,
|
|
441
|
-
|
|
442
|
-
|
|
446
|
+
P as ApiProperty,
|
|
447
|
+
T as ApiPropertyOptional,
|
|
443
448
|
x as BaseApiClient,
|
|
444
|
-
|
|
449
|
+
g as FetchAdapter,
|
|
445
450
|
M as HttpServiceAdapter,
|
|
446
451
|
O as Type
|
|
447
452
|
};
|
|
@@ -170,7 +170,7 @@ class u {
|
|
|
170
170
|
return this.httpService.deleteJson(t, e);
|
|
171
171
|
}
|
|
172
172
|
}
|
|
173
|
-
class
|
|
173
|
+
class y {
|
|
174
174
|
/**
|
|
175
175
|
* Creates a new API client instance
|
|
176
176
|
*
|
|
@@ -302,10 +302,15 @@ 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
|
+
if (!URL.canParse(this.baseUrl))
|
|
309
|
+
throw new URIError(`{baseUrl: ${this.baseUrl}} is not a parsable URL.`);
|
|
310
|
+
const s = new URL(this.baseUrl);
|
|
311
|
+
return s.pathname = t, e && e.forEach((r, n, p) => {
|
|
312
|
+
s.searchParams.set(n, r);
|
|
313
|
+
}), s.toString();
|
|
309
314
|
}
|
|
310
315
|
/**
|
|
311
316
|
* Builds headers for a request by combining default and request-specific headers
|
|
@@ -320,24 +325,24 @@ class o {
|
|
|
320
325
|
};
|
|
321
326
|
}
|
|
322
327
|
}
|
|
323
|
-
function
|
|
328
|
+
function f(...a) {
|
|
324
329
|
return () => {
|
|
325
330
|
};
|
|
326
331
|
}
|
|
327
|
-
function
|
|
332
|
+
function b(...a) {
|
|
328
333
|
return () => {
|
|
329
334
|
};
|
|
330
335
|
}
|
|
331
|
-
function
|
|
336
|
+
function m(...a) {
|
|
332
337
|
return () => {
|
|
333
338
|
};
|
|
334
339
|
}
|
|
335
340
|
export {
|
|
336
341
|
i as ApiError,
|
|
337
|
-
|
|
338
|
-
|
|
339
|
-
|
|
342
|
+
b as ApiProperty,
|
|
343
|
+
m as ApiPropertyOptional,
|
|
344
|
+
y as BaseApiClient,
|
|
340
345
|
d as FetchAdapter,
|
|
341
346
|
u as HttpServiceAdapter,
|
|
342
|
-
|
|
347
|
+
f as Type
|
|
343
348
|
};
|
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.20260615185517",
|
|
4
4
|
"description": "Abstract base for Edifice client SDKs (no application-specific logic)",
|
|
5
5
|
"private": false,
|
|
6
6
|
"license": "AGPL-3.0",
|
|
@@ -43,11 +43,12 @@
|
|
|
43
43
|
"path": "0.12.7",
|
|
44
44
|
"vite": "5.4.14",
|
|
45
45
|
"vite-plugin-dts": "4.5.4",
|
|
46
|
-
"@edifice.io/client": "2.5.22-develop
|
|
46
|
+
"@edifice.io/client": "2.5.22-develop.20260615185517"
|
|
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",
|