@edifice.io/rest-client-base 2.6.8-develop-pedago.20261008121224 → 2.6.8-develop-enabling.20261012145010
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 +199 -354
- package/dist/node/index.cjs +1 -1
- package/dist/node/index.js +302 -460
- package/dist/react-native/index.js +199 -354
- package/package.json +4 -4
package/dist/node/index.js
CHANGED
|
@@ -1,461 +1,303 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
var
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
1
|
+
import { ApiProperty as e, ApiPropertyOptional as t } from "@nestjs/swagger";
|
|
2
|
+
//#region src/client/errors/api-error.ts
|
|
3
|
+
var n = class e extends Error {
|
|
4
|
+
_response;
|
|
5
|
+
_jsonData = null;
|
|
6
|
+
_textData = null;
|
|
7
|
+
constructor(t, n) {
|
|
8
|
+
super(n || `API request failed: ${t.status} ${t.statusText}`), this.name = "ApiError", this._response = t, Object.setPrototypeOf(this, e.prototype);
|
|
9
|
+
}
|
|
10
|
+
response() {
|
|
11
|
+
return this._response;
|
|
12
|
+
}
|
|
13
|
+
status() {
|
|
14
|
+
return this._response.status;
|
|
15
|
+
}
|
|
16
|
+
statusText() {
|
|
17
|
+
return this._response.statusText;
|
|
18
|
+
}
|
|
19
|
+
async json() {
|
|
20
|
+
if (this._jsonData === null) try {
|
|
21
|
+
let e = this._response.clone();
|
|
22
|
+
this._jsonData = await e.json();
|
|
23
|
+
} catch {
|
|
24
|
+
this._jsonData = null;
|
|
25
|
+
}
|
|
26
|
+
return this._jsonData;
|
|
27
|
+
}
|
|
28
|
+
async text() {
|
|
29
|
+
if (this._textData === null) try {
|
|
30
|
+
let e = this._response.clone();
|
|
31
|
+
this._textData = await e.text();
|
|
32
|
+
} catch {
|
|
33
|
+
this._textData = "";
|
|
34
|
+
}
|
|
35
|
+
return this._textData;
|
|
36
|
+
}
|
|
37
|
+
}, r = class {
|
|
38
|
+
fetchImpl;
|
|
39
|
+
constructor(e = fetch) {
|
|
40
|
+
this.fetchImpl = e;
|
|
41
|
+
}
|
|
42
|
+
async handleResponse(e) {
|
|
43
|
+
if (!e.ok) throw new n(e);
|
|
44
|
+
let t = e.headers.get("content-type");
|
|
45
|
+
return t && t.includes("application/json") ? await e.json() : {};
|
|
46
|
+
}
|
|
47
|
+
async get(e, t) {
|
|
48
|
+
let n = await this.fetchImpl(e, {
|
|
49
|
+
method: "GET",
|
|
50
|
+
headers: t,
|
|
51
|
+
credentials: "include"
|
|
52
|
+
});
|
|
53
|
+
return this.handleResponse(n);
|
|
54
|
+
}
|
|
55
|
+
async post(e, t, n) {
|
|
56
|
+
let r = await this.fetchImpl(e, {
|
|
57
|
+
method: "POST",
|
|
58
|
+
headers: {
|
|
59
|
+
"Content-Type": "application/json",
|
|
60
|
+
...n
|
|
61
|
+
},
|
|
62
|
+
body: JSON.stringify(t),
|
|
63
|
+
credentials: "include"
|
|
64
|
+
});
|
|
65
|
+
return this.handleResponse(r);
|
|
66
|
+
}
|
|
67
|
+
async put(e, t, n) {
|
|
68
|
+
let r = await this.fetchImpl(e, {
|
|
69
|
+
method: "PUT",
|
|
70
|
+
headers: {
|
|
71
|
+
"Content-Type": "application/json",
|
|
72
|
+
...n
|
|
73
|
+
},
|
|
74
|
+
body: JSON.stringify(t),
|
|
75
|
+
credentials: "include"
|
|
76
|
+
});
|
|
77
|
+
return this.handleResponse(r);
|
|
78
|
+
}
|
|
79
|
+
async patch(e, t, n) {
|
|
80
|
+
let r = await this.fetchImpl(e, {
|
|
81
|
+
method: "PATCH",
|
|
82
|
+
headers: {
|
|
83
|
+
"Content-Type": "application/json",
|
|
84
|
+
...n
|
|
85
|
+
},
|
|
86
|
+
body: JSON.stringify(t),
|
|
87
|
+
credentials: "include"
|
|
88
|
+
});
|
|
89
|
+
return this.handleResponse(r);
|
|
90
|
+
}
|
|
91
|
+
async delete(e, t) {
|
|
92
|
+
let n = await this.fetchImpl(e, {
|
|
93
|
+
method: "DELETE",
|
|
94
|
+
headers: t,
|
|
95
|
+
credentials: "include"
|
|
96
|
+
});
|
|
97
|
+
return this.handleResponse(n);
|
|
98
|
+
}
|
|
99
|
+
async deleteWithBody(e, t, n) {
|
|
100
|
+
let r = await this.fetchImpl(e, {
|
|
101
|
+
method: "DELETE",
|
|
102
|
+
headers: {
|
|
103
|
+
"Content-Type": "application/json",
|
|
104
|
+
...n
|
|
105
|
+
},
|
|
106
|
+
body: JSON.stringify(t),
|
|
107
|
+
credentials: "include"
|
|
108
|
+
});
|
|
109
|
+
return this.handleResponse(r);
|
|
110
|
+
}
|
|
111
|
+
}, i = class {
|
|
112
|
+
httpService;
|
|
113
|
+
constructor(e) {
|
|
114
|
+
this.httpService = e;
|
|
115
|
+
}
|
|
116
|
+
async get(e, t) {
|
|
117
|
+
let n = t ? { headers: t } : void 0;
|
|
118
|
+
return this.httpService.get(e, n);
|
|
119
|
+
}
|
|
120
|
+
async post(e, t, n) {
|
|
121
|
+
let r = n ? { headers: n } : void 0;
|
|
122
|
+
return this.httpService.postJson(e, t, r);
|
|
123
|
+
}
|
|
124
|
+
async put(e, t, n) {
|
|
125
|
+
let r = n ? { headers: n } : void 0;
|
|
126
|
+
return this.httpService.putJson(e, t, r);
|
|
127
|
+
}
|
|
128
|
+
async patch(e, t, n) {
|
|
129
|
+
let r = n ? { headers: n } : void 0;
|
|
130
|
+
return this.httpService.patchJson(e, t, r);
|
|
131
|
+
}
|
|
132
|
+
async delete(e, t) {
|
|
133
|
+
let n = t ? { headers: t } : void 0;
|
|
134
|
+
return this.httpService.delete(e, n);
|
|
135
|
+
}
|
|
136
|
+
async deleteWithBody(e, t, n) {
|
|
137
|
+
return this.httpService.deleteJson(e, t);
|
|
138
|
+
}
|
|
139
|
+
}, a = class {
|
|
140
|
+
baseUrl;
|
|
141
|
+
defaultHeaders;
|
|
142
|
+
httpAdapter;
|
|
143
|
+
constructor(e = {}) {
|
|
144
|
+
this.baseUrl = e.baseUrl || "", this.defaultHeaders = e.defaultHeaders || {}, e.httpAdapter ? this.httpAdapter = e.httpAdapter : e.httpService ? this.httpAdapter = new i(e.httpService) : this.httpAdapter = new r(e.fetchImpl || fetch);
|
|
145
|
+
}
|
|
146
|
+
async get(e, t, n) {
|
|
147
|
+
let r = this.buildUrl(e, t);
|
|
148
|
+
return this.httpAdapter.get(r, this.buildHeaders(n?.headers));
|
|
149
|
+
}
|
|
150
|
+
async post(e, t, n, r) {
|
|
151
|
+
let i = this.buildUrl(e, n);
|
|
152
|
+
return this.httpAdapter.post(i, t, this.buildHeaders(r?.headers));
|
|
153
|
+
}
|
|
154
|
+
async put(e, t, n, r) {
|
|
155
|
+
let i = this.buildUrl(e, n);
|
|
156
|
+
return this.httpAdapter.put(i, t, this.buildHeaders(r?.headers));
|
|
157
|
+
}
|
|
158
|
+
async patch(e, t, n, r) {
|
|
159
|
+
let i = this.buildUrl(e, n);
|
|
160
|
+
return this.httpAdapter.patch(i, t, this.buildHeaders(r?.headers));
|
|
161
|
+
}
|
|
162
|
+
async delete(e, t, n) {
|
|
163
|
+
let r = this.buildUrl(e, t);
|
|
164
|
+
return this.httpAdapter.delete(r, this.buildHeaders(n?.headers));
|
|
165
|
+
}
|
|
166
|
+
async deleteWithBody(e, t, n, r) {
|
|
167
|
+
let i = this.buildUrl(e, n);
|
|
168
|
+
return this.httpAdapter.deleteWithBody(i, t, this.buildHeaders(r?.headers));
|
|
169
|
+
}
|
|
170
|
+
buildUrl(e, t) {
|
|
171
|
+
let n = !o(this.baseUrl), r = globalThis.location?.origin ?? "", i = n ? `${r}${this.baseUrl}` : this.baseUrl;
|
|
172
|
+
if (!o(i)) throw URIError(`{baseUrl: ${this.baseUrl}} is not a parsable URL.`);
|
|
173
|
+
let a = new URL(i);
|
|
174
|
+
return a.pathname = s(a.pathname, e), t && t.forEach((e, t) => {
|
|
175
|
+
a.searchParams.append(t, e);
|
|
176
|
+
}), n ? a.pathname + a.search : a.toString();
|
|
177
|
+
}
|
|
178
|
+
buildHeaders(e) {
|
|
179
|
+
return {
|
|
180
|
+
...this.defaultHeaders,
|
|
181
|
+
...e
|
|
182
|
+
};
|
|
183
|
+
}
|
|
184
|
+
}, o = (e) => {
|
|
185
|
+
try {
|
|
186
|
+
return new URL(e), !0;
|
|
187
|
+
} catch {
|
|
188
|
+
return !1;
|
|
189
|
+
}
|
|
190
|
+
}, s = (e, t) => `${e.replace(/\/$/, "")}/${t.replace(/^\//, "")}`, c;
|
|
191
|
+
(function(e) {
|
|
192
|
+
e[e.PLAIN_TO_CLASS = 0] = "PLAIN_TO_CLASS", e[e.CLASS_TO_PLAIN = 1] = "CLASS_TO_PLAIN", e[e.CLASS_TO_CLASS = 2] = "CLASS_TO_CLASS";
|
|
193
|
+
})(c ||= {});
|
|
194
|
+
//#endregion
|
|
195
|
+
//#region ../../node_modules/.pnpm/class-transformer@0.5.1/node_modules/class-transformer/esm5/storage.js
|
|
196
|
+
var l = new (function() {
|
|
197
|
+
function e() {
|
|
198
|
+
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();
|
|
199
|
+
}
|
|
200
|
+
return e.prototype.addTypeMetadata = function(e) {
|
|
201
|
+
this._typeMetadatas.has(e.target) || this._typeMetadatas.set(e.target, /* @__PURE__ */ new Map()), this._typeMetadatas.get(e.target).set(e.propertyName, e);
|
|
202
|
+
}, e.prototype.addTransformMetadata = function(e) {
|
|
203
|
+
this._transformMetadatas.has(e.target) || this._transformMetadatas.set(e.target, /* @__PURE__ */ new Map()), this._transformMetadatas.get(e.target).has(e.propertyName) || this._transformMetadatas.get(e.target).set(e.propertyName, []), this._transformMetadatas.get(e.target).get(e.propertyName).push(e);
|
|
204
|
+
}, e.prototype.addExposeMetadata = function(e) {
|
|
205
|
+
this._exposeMetadatas.has(e.target) || this._exposeMetadatas.set(e.target, /* @__PURE__ */ new Map()), this._exposeMetadatas.get(e.target).set(e.propertyName, e);
|
|
206
|
+
}, e.prototype.addExcludeMetadata = function(e) {
|
|
207
|
+
this._excludeMetadatas.has(e.target) || this._excludeMetadatas.set(e.target, /* @__PURE__ */ new Map()), this._excludeMetadatas.get(e.target).set(e.propertyName, e);
|
|
208
|
+
}, e.prototype.findTransformMetadatas = function(e, t, n) {
|
|
209
|
+
return this.findMetadatas(this._transformMetadatas, e, t).filter(function(e) {
|
|
210
|
+
return !e.options || e.options.toClassOnly === !0 && e.options.toPlainOnly === !0 ? !0 : e.options.toClassOnly === !0 ? n === c.CLASS_TO_CLASS || n === c.PLAIN_TO_CLASS : e.options.toPlainOnly === !0 ? n === c.CLASS_TO_PLAIN : !0;
|
|
211
|
+
});
|
|
212
|
+
}, e.prototype.findExcludeMetadata = function(e, t) {
|
|
213
|
+
return this.findMetadata(this._excludeMetadatas, e, t);
|
|
214
|
+
}, e.prototype.findExposeMetadata = function(e, t) {
|
|
215
|
+
return this.findMetadata(this._exposeMetadatas, e, t);
|
|
216
|
+
}, e.prototype.findExposeMetadataByCustomName = function(e, t) {
|
|
217
|
+
return this.getExposedMetadatas(e).find(function(e) {
|
|
218
|
+
return e.options && e.options.name === t;
|
|
219
|
+
});
|
|
220
|
+
}, e.prototype.findTypeMetadata = function(e, t) {
|
|
221
|
+
return this.findMetadata(this._typeMetadatas, e, t);
|
|
222
|
+
}, e.prototype.getStrategy = function(e) {
|
|
223
|
+
var t = this._excludeMetadatas.get(e), n = t && t.get(void 0), r = this._exposeMetadatas.get(e), i = r && r.get(void 0);
|
|
224
|
+
return n && i || !n && !i ? "none" : n ? "excludeAll" : "exposeAll";
|
|
225
|
+
}, e.prototype.getExposedMetadatas = function(e) {
|
|
226
|
+
return this.getMetadata(this._exposeMetadatas, e);
|
|
227
|
+
}, e.prototype.getExcludedMetadatas = function(e) {
|
|
228
|
+
return this.getMetadata(this._excludeMetadatas, e);
|
|
229
|
+
}, e.prototype.getExposedProperties = function(e, t) {
|
|
230
|
+
return this.getExposedMetadatas(e).filter(function(e) {
|
|
231
|
+
return !e.options || e.options.toClassOnly === !0 && e.options.toPlainOnly === !0 ? !0 : e.options.toClassOnly === !0 ? t === c.CLASS_TO_CLASS || t === c.PLAIN_TO_CLASS : e.options.toPlainOnly === !0 ? t === c.CLASS_TO_PLAIN : !0;
|
|
232
|
+
}).map(function(e) {
|
|
233
|
+
return e.propertyName;
|
|
234
|
+
});
|
|
235
|
+
}, e.prototype.getExcludedProperties = function(e, t) {
|
|
236
|
+
return this.getExcludedMetadatas(e).filter(function(e) {
|
|
237
|
+
return !e.options || e.options.toClassOnly === !0 && e.options.toPlainOnly === !0 ? !0 : e.options.toClassOnly === !0 ? t === c.CLASS_TO_CLASS || t === c.PLAIN_TO_CLASS : e.options.toPlainOnly === !0 ? t === c.CLASS_TO_PLAIN : !0;
|
|
238
|
+
}).map(function(e) {
|
|
239
|
+
return e.propertyName;
|
|
240
|
+
});
|
|
241
|
+
}, e.prototype.clear = function() {
|
|
242
|
+
this._typeMetadatas.clear(), this._exposeMetadatas.clear(), this._excludeMetadatas.clear(), this._ancestorsMap.clear();
|
|
243
|
+
}, e.prototype.getMetadata = function(e, t) {
|
|
244
|
+
var n = e.get(t), r;
|
|
245
|
+
n && (r = Array.from(n.values()).filter(function(e) {
|
|
246
|
+
return e.propertyName !== void 0;
|
|
247
|
+
}));
|
|
248
|
+
for (var i = [], a = 0, o = this.getAncestors(t); a < o.length; a++) {
|
|
249
|
+
var s = o[a], c = e.get(s);
|
|
250
|
+
if (c) {
|
|
251
|
+
var l = Array.from(c.values()).filter(function(e) {
|
|
252
|
+
return e.propertyName !== void 0;
|
|
253
|
+
});
|
|
254
|
+
i.push.apply(i, l);
|
|
255
|
+
}
|
|
256
|
+
}
|
|
257
|
+
return i.concat(r || []);
|
|
258
|
+
}, e.prototype.findMetadata = function(e, t, n) {
|
|
259
|
+
var r = e.get(t);
|
|
260
|
+
if (r) {
|
|
261
|
+
var i = r.get(n);
|
|
262
|
+
if (i) return i;
|
|
263
|
+
}
|
|
264
|
+
for (var a = 0, o = this.getAncestors(t); a < o.length; a++) {
|
|
265
|
+
var s = o[a], c = e.get(s);
|
|
266
|
+
if (c) {
|
|
267
|
+
var l = c.get(n);
|
|
268
|
+
if (l) return l;
|
|
269
|
+
}
|
|
270
|
+
}
|
|
271
|
+
}, e.prototype.findMetadatas = function(e, t, n) {
|
|
272
|
+
var r = e.get(t), i;
|
|
273
|
+
r && (i = r.get(n));
|
|
274
|
+
for (var a = [], o = 0, s = this.getAncestors(t); o < s.length; o++) {
|
|
275
|
+
var c = s[o], l = e.get(c);
|
|
276
|
+
l && l.has(n) && a.push.apply(a, l.get(n));
|
|
277
|
+
}
|
|
278
|
+
return a.slice().reverse().concat((i || []).slice().reverse());
|
|
279
|
+
}, e.prototype.getAncestors = function(e) {
|
|
280
|
+
if (!e) return [];
|
|
281
|
+
if (!this._ancestorsMap.has(e)) {
|
|
282
|
+
for (var t = [], n = Object.getPrototypeOf(e.prototype.constructor); n.prototype !== void 0; n = Object.getPrototypeOf(n.prototype.constructor)) t.push(n);
|
|
283
|
+
this._ancestorsMap.set(e, t);
|
|
284
|
+
}
|
|
285
|
+
return this._ancestorsMap.get(e);
|
|
286
|
+
}, e;
|
|
287
|
+
}())();
|
|
288
|
+
//#endregion
|
|
289
|
+
//#region ../../node_modules/.pnpm/class-transformer@0.5.1/node_modules/class-transformer/esm5/decorators/type.decorator.js
|
|
290
|
+
function u(e, t) {
|
|
291
|
+
return t === void 0 && (t = {}), function(n, r) {
|
|
292
|
+
var i = Reflect.getMetadata("design:type", n, r);
|
|
293
|
+
l.addTypeMetadata({
|
|
294
|
+
target: n.constructor,
|
|
295
|
+
propertyName: r,
|
|
296
|
+
reflectedType: i,
|
|
297
|
+
typeFunction: e,
|
|
298
|
+
options: t
|
|
299
|
+
});
|
|
300
|
+
};
|
|
70
301
|
}
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
this.fetchImpl = t;
|
|
74
|
-
}
|
|
75
|
-
async handleResponse(t) {
|
|
76
|
-
if (!t.ok)
|
|
77
|
-
throw new f(t);
|
|
78
|
-
const e = t.headers.get("content-type");
|
|
79
|
-
return e && e.includes("application/json") ? await t.json() : {};
|
|
80
|
-
}
|
|
81
|
-
async get(t, e) {
|
|
82
|
-
const r = await this.fetchImpl(t, {
|
|
83
|
-
method: "GET",
|
|
84
|
-
headers: e,
|
|
85
|
-
credentials: "include"
|
|
86
|
-
});
|
|
87
|
-
return this.handleResponse(r);
|
|
88
|
-
}
|
|
89
|
-
async post(t, e, r) {
|
|
90
|
-
const s = await this.fetchImpl(t, {
|
|
91
|
-
method: "POST",
|
|
92
|
-
headers: {
|
|
93
|
-
"Content-Type": "application/json",
|
|
94
|
-
...r
|
|
95
|
-
},
|
|
96
|
-
body: JSON.stringify(e),
|
|
97
|
-
credentials: "include"
|
|
98
|
-
});
|
|
99
|
-
return this.handleResponse(s);
|
|
100
|
-
}
|
|
101
|
-
async put(t, e, r) {
|
|
102
|
-
const s = await this.fetchImpl(t, {
|
|
103
|
-
method: "PUT",
|
|
104
|
-
headers: {
|
|
105
|
-
"Content-Type": "application/json",
|
|
106
|
-
...r
|
|
107
|
-
},
|
|
108
|
-
body: JSON.stringify(e),
|
|
109
|
-
credentials: "include"
|
|
110
|
-
});
|
|
111
|
-
return this.handleResponse(s);
|
|
112
|
-
}
|
|
113
|
-
async patch(t, e, r) {
|
|
114
|
-
const s = await this.fetchImpl(t, {
|
|
115
|
-
method: "PATCH",
|
|
116
|
-
headers: {
|
|
117
|
-
"Content-Type": "application/json",
|
|
118
|
-
...r
|
|
119
|
-
},
|
|
120
|
-
body: JSON.stringify(e),
|
|
121
|
-
credentials: "include"
|
|
122
|
-
});
|
|
123
|
-
return this.handleResponse(s);
|
|
124
|
-
}
|
|
125
|
-
async delete(t, e) {
|
|
126
|
-
const r = await this.fetchImpl(t, {
|
|
127
|
-
method: "DELETE",
|
|
128
|
-
headers: e,
|
|
129
|
-
credentials: "include"
|
|
130
|
-
});
|
|
131
|
-
return this.handleResponse(r);
|
|
132
|
-
}
|
|
133
|
-
async deleteWithBody(t, e, r) {
|
|
134
|
-
const s = await this.fetchImpl(t, {
|
|
135
|
-
method: "DELETE",
|
|
136
|
-
headers: {
|
|
137
|
-
"Content-Type": "application/json",
|
|
138
|
-
...r
|
|
139
|
-
},
|
|
140
|
-
body: JSON.stringify(e),
|
|
141
|
-
credentials: "include"
|
|
142
|
-
});
|
|
143
|
-
return this.handleResponse(s);
|
|
144
|
-
}
|
|
145
|
-
}
|
|
146
|
-
class A {
|
|
147
|
-
constructor(t) {
|
|
148
|
-
this.httpService = t;
|
|
149
|
-
}
|
|
150
|
-
async get(t, e) {
|
|
151
|
-
const r = e ? { headers: e } : void 0;
|
|
152
|
-
return this.httpService.get(t, r);
|
|
153
|
-
}
|
|
154
|
-
async post(t, e, r) {
|
|
155
|
-
const s = r ? { headers: r } : void 0;
|
|
156
|
-
return this.httpService.postJson(t, e, s);
|
|
157
|
-
}
|
|
158
|
-
async put(t, e, r) {
|
|
159
|
-
const s = r ? { headers: r } : void 0;
|
|
160
|
-
return this.httpService.putJson(t, e, s);
|
|
161
|
-
}
|
|
162
|
-
async patch(t, e, r) {
|
|
163
|
-
const s = r ? { headers: r } : void 0;
|
|
164
|
-
return this.httpService.patchJson(t, e, s);
|
|
165
|
-
}
|
|
166
|
-
async delete(t, e) {
|
|
167
|
-
const r = e ? { headers: e } : void 0;
|
|
168
|
-
return this.httpService.delete(t, r);
|
|
169
|
-
}
|
|
170
|
-
async deleteWithBody(t, e, r) {
|
|
171
|
-
return this.httpService.deleteJson(t, e);
|
|
172
|
-
}
|
|
173
|
-
}
|
|
174
|
-
class L {
|
|
175
|
-
/**
|
|
176
|
-
* Creates a new API client instance
|
|
177
|
-
*
|
|
178
|
-
* @param options Configuration options
|
|
179
|
-
* @param options.baseUrl Base URL for API requests
|
|
180
|
-
* @param options.defaultHeaders Default headers for all requests
|
|
181
|
-
* @param options.fetchImpl Custom fetch implementation (deprecated, use httpAdapter)
|
|
182
|
-
* @param options.httpService Edifice HttpService instance (from odeServices.http())
|
|
183
|
-
* @param options.httpAdapter Custom HTTP adapter implementation
|
|
184
|
-
*
|
|
185
|
-
* @example
|
|
186
|
-
* // With Edifice HttpService
|
|
187
|
-
* import { odeServices } from '@edifice.io/client';
|
|
188
|
-
*
|
|
189
|
-
* const client = new CommunityClient({
|
|
190
|
-
* httpService: odeServices.http(),
|
|
191
|
-
* defaultHeaders: {
|
|
192
|
-
* 'X-Custom-Header': 'value'
|
|
193
|
-
* }
|
|
194
|
-
* });
|
|
195
|
-
*/
|
|
196
|
-
constructor(t = {}) {
|
|
197
|
-
/**
|
|
198
|
-
* Base URL for all API requests
|
|
199
|
-
* @protected
|
|
200
|
-
*/
|
|
201
|
-
d(this, "baseUrl");
|
|
202
|
-
/**
|
|
203
|
-
* Default headers included with all requests
|
|
204
|
-
* @protected
|
|
205
|
-
*/
|
|
206
|
-
d(this, "defaultHeaders");
|
|
207
|
-
/**
|
|
208
|
-
* HTTP adapter for making requests
|
|
209
|
-
* @protected
|
|
210
|
-
*/
|
|
211
|
-
d(this, "httpAdapter");
|
|
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
|
-
}
|
|
214
|
-
/**
|
|
215
|
-
* Performs a GET request
|
|
216
|
-
* @param endpoint API endpoint path
|
|
217
|
-
* @param queryParams URL query parameters
|
|
218
|
-
* @param options Request options
|
|
219
|
-
* @returns Promise resolving to the response data
|
|
220
|
-
*/
|
|
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
|
-
}
|
|
225
|
-
/**
|
|
226
|
-
* Performs a POST request
|
|
227
|
-
* @param endpoint API endpoint path
|
|
228
|
-
* @param body Request body
|
|
229
|
-
* @param queryParams Optional URL query parameters
|
|
230
|
-
* @param options Request options
|
|
231
|
-
* @returns Promise resolving to the response data
|
|
232
|
-
*/
|
|
233
|
-
async post(t, e, r, s) {
|
|
234
|
-
const n = this.buildUrl(t, r);
|
|
235
|
-
return this.httpAdapter.post(
|
|
236
|
-
n,
|
|
237
|
-
e,
|
|
238
|
-
this.buildHeaders(s == null ? void 0 : s.headers)
|
|
239
|
-
);
|
|
240
|
-
}
|
|
241
|
-
/**
|
|
242
|
-
* Performs a PUT request
|
|
243
|
-
* @param endpoint API endpoint path
|
|
244
|
-
* @param body Request body
|
|
245
|
-
* @param queryParams Optional URL query parameters
|
|
246
|
-
* @param options Request options
|
|
247
|
-
* @returns Promise resolving to the response data
|
|
248
|
-
*/
|
|
249
|
-
async put(t, e, r, s) {
|
|
250
|
-
const n = this.buildUrl(t, r);
|
|
251
|
-
return this.httpAdapter.put(
|
|
252
|
-
n,
|
|
253
|
-
e,
|
|
254
|
-
this.buildHeaders(s == null ? void 0 : s.headers)
|
|
255
|
-
);
|
|
256
|
-
}
|
|
257
|
-
/**
|
|
258
|
-
* Performs a PATCH request
|
|
259
|
-
* @param endpoint API endpoint path
|
|
260
|
-
* @param body Request body
|
|
261
|
-
* @param queryParams Optional URL query parameters
|
|
262
|
-
* @param options Request options
|
|
263
|
-
* @returns Promise resolving to the response data
|
|
264
|
-
*/
|
|
265
|
-
async patch(t, e, r, s) {
|
|
266
|
-
const n = this.buildUrl(t, r);
|
|
267
|
-
return this.httpAdapter.patch(
|
|
268
|
-
n,
|
|
269
|
-
e,
|
|
270
|
-
this.buildHeaders(s == null ? void 0 : s.headers)
|
|
271
|
-
);
|
|
272
|
-
}
|
|
273
|
-
/**
|
|
274
|
-
* Performs a DELETE request
|
|
275
|
-
* @param endpoint API endpoint path
|
|
276
|
-
* @param queryParams Optional URL query parameters
|
|
277
|
-
* @param options Request options
|
|
278
|
-
* @returns Promise resolving when the request is complete
|
|
279
|
-
*/
|
|
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
|
-
}
|
|
284
|
-
/**
|
|
285
|
-
* Performs a DELETE request with body
|
|
286
|
-
* @param endpoint API endpoint path
|
|
287
|
-
* @param body Request body
|
|
288
|
-
* @param queryParams Optional URL query parameters
|
|
289
|
-
* @param options Request options
|
|
290
|
-
* @returns Promise resolving to the response data
|
|
291
|
-
*/
|
|
292
|
-
async deleteWithBody(t, e, r, s) {
|
|
293
|
-
const n = this.buildUrl(t, r);
|
|
294
|
-
return this.httpAdapter.deleteWithBody(
|
|
295
|
-
n,
|
|
296
|
-
e,
|
|
297
|
-
this.buildHeaders(s == null ? void 0 : s.headers)
|
|
298
|
-
);
|
|
299
|
-
}
|
|
300
|
-
/**
|
|
301
|
-
* Builds complete URL from endpoint and query parameters
|
|
302
|
-
* @param endpoint API endpoint path
|
|
303
|
-
* @param queryParams Optional query parameters
|
|
304
|
-
* @returns Complete URL
|
|
305
|
-
* @protected
|
|
306
|
-
* @throws {URIError} if the baseUrl attribute is not parsable
|
|
307
|
-
*/
|
|
308
|
-
buildUrl(t, e) {
|
|
309
|
-
var o;
|
|
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
|
-
throw new URIError(`{baseUrl: ${this.baseUrl}} is not a parsable URL.`);
|
|
313
|
-
const i = new URL(n);
|
|
314
|
-
return i.pathname = S(i.pathname, t), e && e.forEach((c, u) => {
|
|
315
|
-
i.searchParams.append(u, c);
|
|
316
|
-
}), r ? i.pathname + i.search : i.toString();
|
|
317
|
-
}
|
|
318
|
-
/**
|
|
319
|
-
* Builds headers for a request by combining default and request-specific headers
|
|
320
|
-
* @param additionalHeaders Optional additional headers
|
|
321
|
-
* @returns Combined headers
|
|
322
|
-
* @protected
|
|
323
|
-
*/
|
|
324
|
-
buildHeaders(t) {
|
|
325
|
-
return {
|
|
326
|
-
...this.defaultHeaders,
|
|
327
|
-
...t
|
|
328
|
-
};
|
|
329
|
-
}
|
|
330
|
-
}
|
|
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(/^\//, "")}`;
|
|
338
|
-
var p;
|
|
339
|
-
(function(a) {
|
|
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";
|
|
341
|
-
})(p || (p = {}));
|
|
342
|
-
var v = (
|
|
343
|
-
/** @class */
|
|
344
|
-
function() {
|
|
345
|
-
function a() {
|
|
346
|
-
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();
|
|
347
|
-
}
|
|
348
|
-
return a.prototype.addTypeMetadata = function(t) {
|
|
349
|
-
this._typeMetadatas.has(t.target) || this._typeMetadatas.set(t.target, /* @__PURE__ */ new Map()), this._typeMetadatas.get(t.target).set(t.propertyName, t);
|
|
350
|
-
}, a.prototype.addTransformMetadata = function(t) {
|
|
351
|
-
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);
|
|
352
|
-
}, a.prototype.addExposeMetadata = function(t) {
|
|
353
|
-
this._exposeMetadatas.has(t.target) || this._exposeMetadatas.set(t.target, /* @__PURE__ */ new Map()), this._exposeMetadatas.get(t.target).set(t.propertyName, t);
|
|
354
|
-
}, a.prototype.addExcludeMetadata = function(t) {
|
|
355
|
-
this._excludeMetadatas.has(t.target) || this._excludeMetadatas.set(t.target, /* @__PURE__ */ new Map()), this._excludeMetadatas.get(t.target).set(t.propertyName, t);
|
|
356
|
-
}, a.prototype.findTransformMetadatas = function(t, e, r) {
|
|
357
|
-
return this.findMetadatas(this._transformMetadatas, t, e).filter(function(s) {
|
|
358
|
-
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;
|
|
359
|
-
});
|
|
360
|
-
}, a.prototype.findExcludeMetadata = function(t, e) {
|
|
361
|
-
return this.findMetadata(this._excludeMetadatas, t, e);
|
|
362
|
-
}, a.prototype.findExposeMetadata = function(t, e) {
|
|
363
|
-
return this.findMetadata(this._exposeMetadatas, t, e);
|
|
364
|
-
}, a.prototype.findExposeMetadataByCustomName = function(t, e) {
|
|
365
|
-
return this.getExposedMetadatas(t).find(function(r) {
|
|
366
|
-
return r.options && r.options.name === e;
|
|
367
|
-
});
|
|
368
|
-
}, a.prototype.findTypeMetadata = function(t, e) {
|
|
369
|
-
return this.findMetadata(this._typeMetadatas, t, e);
|
|
370
|
-
}, a.prototype.getStrategy = function(t) {
|
|
371
|
-
var e = this._excludeMetadatas.get(t), r = e && e.get(void 0), s = this._exposeMetadatas.get(t), n = s && s.get(void 0);
|
|
372
|
-
return r && n || !r && !n ? "none" : r ? "excludeAll" : "exposeAll";
|
|
373
|
-
}, a.prototype.getExposedMetadatas = function(t) {
|
|
374
|
-
return this.getMetadata(this._exposeMetadatas, t);
|
|
375
|
-
}, a.prototype.getExcludedMetadatas = function(t) {
|
|
376
|
-
return this.getMetadata(this._excludeMetadatas, t);
|
|
377
|
-
}, a.prototype.getExposedProperties = function(t, e) {
|
|
378
|
-
return this.getExposedMetadatas(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;
|
|
382
|
-
});
|
|
383
|
-
}, a.prototype.getExcludedProperties = function(t, e) {
|
|
384
|
-
return this.getExcludedMetadatas(t).filter(function(r) {
|
|
385
|
-
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;
|
|
386
|
-
}).map(function(r) {
|
|
387
|
-
return r.propertyName;
|
|
388
|
-
});
|
|
389
|
-
}, a.prototype.clear = function() {
|
|
390
|
-
this._typeMetadatas.clear(), this._exposeMetadatas.clear(), this._excludeMetadatas.clear(), this._ancestorsMap.clear();
|
|
391
|
-
}, a.prototype.getMetadata = function(t, e) {
|
|
392
|
-
var r = t.get(e), s;
|
|
393
|
-
r && (s = Array.from(r.values()).filter(function(l) {
|
|
394
|
-
return l.propertyName !== void 0;
|
|
395
|
-
}));
|
|
396
|
-
for (var n = [], i = 0, o = this.getAncestors(e); i < o.length; i++) {
|
|
397
|
-
var c = o[i], u = t.get(c);
|
|
398
|
-
if (u) {
|
|
399
|
-
var h = Array.from(u.values()).filter(function(l) {
|
|
400
|
-
return l.propertyName !== void 0;
|
|
401
|
-
});
|
|
402
|
-
n.push.apply(n, h);
|
|
403
|
-
}
|
|
404
|
-
}
|
|
405
|
-
return n.concat(s || []);
|
|
406
|
-
}, a.prototype.findMetadata = function(t, e, r) {
|
|
407
|
-
var s = t.get(e);
|
|
408
|
-
if (s) {
|
|
409
|
-
var n = s.get(r);
|
|
410
|
-
if (n)
|
|
411
|
-
return n;
|
|
412
|
-
}
|
|
413
|
-
for (var i = 0, o = this.getAncestors(e); i < o.length; i++) {
|
|
414
|
-
var c = o[i], u = t.get(c);
|
|
415
|
-
if (u) {
|
|
416
|
-
var h = u.get(r);
|
|
417
|
-
if (h)
|
|
418
|
-
return h;
|
|
419
|
-
}
|
|
420
|
-
}
|
|
421
|
-
}, a.prototype.findMetadatas = function(t, e, r) {
|
|
422
|
-
var s = t.get(e), n;
|
|
423
|
-
s && (n = s.get(r));
|
|
424
|
-
for (var i = [], o = 0, c = this.getAncestors(e); o < c.length; o++) {
|
|
425
|
-
var u = c[o], h = t.get(u);
|
|
426
|
-
h && h.has(r) && i.push.apply(i, h.get(r));
|
|
427
|
-
}
|
|
428
|
-
return i.slice().reverse().concat((n || []).slice().reverse());
|
|
429
|
-
}, a.prototype.getAncestors = function(t) {
|
|
430
|
-
if (!t)
|
|
431
|
-
return [];
|
|
432
|
-
if (!this._ancestorsMap.has(t)) {
|
|
433
|
-
for (var e = [], r = Object.getPrototypeOf(t.prototype.constructor); typeof r.prototype < "u"; r = Object.getPrototypeOf(r.prototype.constructor))
|
|
434
|
-
e.push(r);
|
|
435
|
-
this._ancestorsMap.set(t, e);
|
|
436
|
-
}
|
|
437
|
-
return this._ancestorsMap.get(t);
|
|
438
|
-
}, a;
|
|
439
|
-
}()
|
|
440
|
-
), x = new v();
|
|
441
|
-
function C(a, t) {
|
|
442
|
-
return t === void 0 && (t = {}), function(e, r) {
|
|
443
|
-
var s = Reflect.getMetadata("design:type", e, r);
|
|
444
|
-
x.addTypeMetadata({
|
|
445
|
-
target: e.constructor,
|
|
446
|
-
propertyName: r,
|
|
447
|
-
reflectedType: s,
|
|
448
|
-
typeFunction: a,
|
|
449
|
-
options: t
|
|
450
|
-
});
|
|
451
|
-
};
|
|
452
|
-
}
|
|
453
|
-
export {
|
|
454
|
-
f as ApiError,
|
|
455
|
-
b as ApiProperty,
|
|
456
|
-
w as ApiPropertyOptional,
|
|
457
|
-
L as BaseApiClient,
|
|
458
|
-
M as FetchAdapter,
|
|
459
|
-
A as HttpServiceAdapter,
|
|
460
|
-
C as Type
|
|
461
|
-
};
|
|
302
|
+
//#endregion
|
|
303
|
+
export { n as ApiError, e as ApiProperty, t as ApiPropertyOptional, a as BaseApiClient, r as FetchAdapter, i as HttpServiceAdapter, u as Type };
|