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.mjs CHANGED
@@ -140,16 +140,60 @@ var BigintTransformer = class {
140
140
  // src/decorators/property.ts
141
141
  import { getClassFromClassOrArray as getClassFromClassOrArray2 } from "nesties";
142
142
 
143
+ // src/utility/non-transformable-types.ts
144
+ var nonTransformableTypes = /* @__PURE__ */ new Set([
145
+ // Primitive wrappers
146
+ String,
147
+ Number,
148
+ Boolean,
149
+ BigInt,
150
+ Symbol,
151
+ // Built-ins
152
+ Date,
153
+ RegExp,
154
+ Error,
155
+ Array,
156
+ Object,
157
+ Function,
158
+ Promise,
159
+ // Collections
160
+ Map,
161
+ Set,
162
+ WeakMap,
163
+ WeakSet,
164
+ // Node / Buffer
165
+ Buffer,
166
+ ArrayBuffer,
167
+ SharedArrayBuffer,
168
+ DataView,
169
+ Int8Array,
170
+ Uint8Array,
171
+ Uint8ClampedArray,
172
+ Int16Array,
173
+ Uint16Array,
174
+ Int32Array,
175
+ Uint32Array,
176
+ Float32Array,
177
+ Float64Array,
178
+ BigInt64Array,
179
+ BigUint64Array,
180
+ // URL stuff
181
+ URL,
182
+ URLSearchParams
183
+ ]);
184
+
143
185
  // src/utility/type-transformer.ts
144
- var nonTransformableTypes = /* @__PURE__ */ new Set([String, Number, Boolean]);
145
186
  var toValue = (cl, value) => {
146
- if (nonTransformableTypes.has(cl)) {
147
- return value;
148
- }
149
187
  if (cl === Date) {
150
188
  return new Date(value);
151
189
  }
152
- return Object.assign(new cl(), value);
190
+ if (nonTransformableTypes.has(cl) || value instanceof cl) {
191
+ return value;
192
+ }
193
+ if (typeof value === "object") {
194
+ return Object.assign(new cl(), value);
195
+ }
196
+ return value;
153
197
  };
154
198
  var TypeTransformer = class {
155
199
  constructor(definition) {
@@ -1845,6 +1889,7 @@ var RestfulFactory = class _RestfulFactory {
1845
1889
  const resultDto = OmitType2(this.entityClass, [...outputFieldsToOmit]);
1846
1890
  for (const relation of relations) {
1847
1891
  if (outputFieldsToOmit.has(relation.propertyName)) continue;
1892
+ if (nonTransformableTypes.has(relation.propertyClass)) continue;
1848
1893
  const replace = (useClass) => {
1849
1894
  const oldApiProperty = Reflect.getMetadata(
1850
1895
  DECORATORS.API_MODEL_PROPERTIES,