nicot 1.1.31 → 1.1.32
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/index.cjs +50 -5
- package/dist/index.cjs.map +3 -3
- package/dist/index.mjs +50 -5
- package/dist/index.mjs.map +3 -3
- package/dist/src/utility/non-transformable-types.d.ts +1 -0
- package/package.json +1 -1
package/dist/index.cjs
CHANGED
|
@@ -202,16 +202,60 @@ var BigintTransformer = class {
|
|
|
202
202
|
// src/decorators/property.ts
|
|
203
203
|
var import_nesties4 = require("nesties");
|
|
204
204
|
|
|
205
|
+
// src/utility/non-transformable-types.ts
|
|
206
|
+
var nonTransformableTypes = /* @__PURE__ */ new Set([
|
|
207
|
+
// Primitive wrappers
|
|
208
|
+
String,
|
|
209
|
+
Number,
|
|
210
|
+
Boolean,
|
|
211
|
+
BigInt,
|
|
212
|
+
Symbol,
|
|
213
|
+
// Built-ins
|
|
214
|
+
Date,
|
|
215
|
+
RegExp,
|
|
216
|
+
Error,
|
|
217
|
+
Array,
|
|
218
|
+
Object,
|
|
219
|
+
Function,
|
|
220
|
+
Promise,
|
|
221
|
+
// Collections
|
|
222
|
+
Map,
|
|
223
|
+
Set,
|
|
224
|
+
WeakMap,
|
|
225
|
+
WeakSet,
|
|
226
|
+
// Node / Buffer
|
|
227
|
+
Buffer,
|
|
228
|
+
ArrayBuffer,
|
|
229
|
+
SharedArrayBuffer,
|
|
230
|
+
DataView,
|
|
231
|
+
Int8Array,
|
|
232
|
+
Uint8Array,
|
|
233
|
+
Uint8ClampedArray,
|
|
234
|
+
Int16Array,
|
|
235
|
+
Uint16Array,
|
|
236
|
+
Int32Array,
|
|
237
|
+
Uint32Array,
|
|
238
|
+
Float32Array,
|
|
239
|
+
Float64Array,
|
|
240
|
+
BigInt64Array,
|
|
241
|
+
BigUint64Array,
|
|
242
|
+
// URL stuff
|
|
243
|
+
URL,
|
|
244
|
+
URLSearchParams
|
|
245
|
+
]);
|
|
246
|
+
|
|
205
247
|
// src/utility/type-transformer.ts
|
|
206
|
-
var nonTransformableTypes = /* @__PURE__ */ new Set([String, Number, Boolean]);
|
|
207
248
|
var toValue = (cl, value) => {
|
|
208
|
-
if (nonTransformableTypes.has(cl)) {
|
|
209
|
-
return value;
|
|
210
|
-
}
|
|
211
249
|
if (cl === Date) {
|
|
212
250
|
return new Date(value);
|
|
213
251
|
}
|
|
214
|
-
|
|
252
|
+
if (nonTransformableTypes.has(cl) || value instanceof cl) {
|
|
253
|
+
return value;
|
|
254
|
+
}
|
|
255
|
+
if (typeof value === "object") {
|
|
256
|
+
return Object.assign(new cl(), value);
|
|
257
|
+
}
|
|
258
|
+
return value;
|
|
215
259
|
};
|
|
216
260
|
var TypeTransformer = class {
|
|
217
261
|
constructor(definition) {
|
|
@@ -1870,6 +1914,7 @@ var RestfulFactory = class _RestfulFactory {
|
|
|
1870
1914
|
const resultDto = (0, import_swagger6.OmitType)(this.entityClass, [...outputFieldsToOmit]);
|
|
1871
1915
|
for (const relation of relations) {
|
|
1872
1916
|
if (outputFieldsToOmit.has(relation.propertyName)) continue;
|
|
1917
|
+
if (nonTransformableTypes.has(relation.propertyClass)) continue;
|
|
1873
1918
|
const replace = (useClass) => {
|
|
1874
1919
|
const oldApiProperty = Reflect.getMetadata(
|
|
1875
1920
|
import_constants.DECORATORS.API_MODEL_PROPERTIES,
|