Skip to content

Commit b9a1be7

Browse files
Lorenzo PichilliLorenzo Pichilli
authored andcommitted
v1.1.0
1 parent 0619b64 commit b9a1be7

File tree

179 files changed

+32602
-3457
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

179 files changed

+32602
-3457
lines changed

CHANGELOG.md

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
## 1.1.0
2+
3+
- Update bundle dependencies
4+
- Fixed `transform` methods when using Babel compiler
5+
- Added `dateLibrary` option to `@JsonFormat()` and `JsonStringifierContext`
6+
- Added `uuidLibrary` option to `@JsonIdentityInfo()` and `JsonStringifierContext`
7+
8+
### BREAKING CHANGES
9+
- To be able to use `@JsonFormat()` on class properties of type "Date" with `JsonFormatShape.STRING`, a date library needs to be set. Date libraries supported: "https://github.com/moment/moment", "https://github.com/iamkun/dayjs/"
10+
- To be able to use `@JsonIdentityInfo()` with any UUID `ObjectIdGenerator`, an UUID library needs to be set. UUID library supported: "https://github.com/uuidjs/uuid".
11+
12+
## 1.0.0
13+
14+
Initial release

dist/@types/index.d.ts

Lines changed: 24 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -258,6 +258,17 @@ export interface JsonStringifierForTypeContext extends JsonStringifierParserComm
258258
* Array of custom user-defined serializers.
259259
*/
260260
serializers?: CustomMapper<Serializer>[];
261+
/**
262+
* To be able to use {@link JsonFormat} on class properties of type `Date`
263+
* with {@link JsonFormatShape.STRING}, a date library needs to be set.
264+
* Date libraries supported: {@link https://github.com/moment/moment}, {@link https://github.com/iamkun/dayjs/}.
265+
*/
266+
dateLibrary?: any;
267+
/**
268+
* To be able to use {@link JsonIdentityInfo} with any UUID {@link ObjectIdGenerator}, an UUID library needs to be set.
269+
* UUID libraries supported: {@link https://github.com/uuidjs/uuid}.
270+
*/
271+
uuidLibrary?: any;
261272
}
262273
/**
263274
* Context properties used by {@link JsonStringifier.stringify} during serialization.
@@ -523,7 +534,8 @@ export interface JsonFormatScalar extends JsonFormatBaseOptions {
523534
/**
524535
* Decorator specific options for {@link JsonFormat} with {@link JsonFormatBaseOptions.shape} value {@link JsonFormatShape.STRING}.
525536
*
526-
* When formatting a `Date`, the {@link https://github.com/iamkun/dayjs} date library is used.
537+
* **IMPORTANT NOTE**: When formatting a `Date`, a date library needs to be set using the {@link dateLibrary} option.
538+
* Date libraries supported: {@link https://github.com/moment/moment}, {@link https://github.com/iamkun/dayjs/}.
527539
*/
528540
export interface JsonFormatString extends JsonFormatBaseOptions {
529541
/**
@@ -544,6 +556,12 @@ export interface JsonFormatString extends JsonFormatBaseOptions {
544556
* Timezone to be used to format a `Date` during serialization.
545557
*/
546558
timezone?: string;
559+
/**
560+
* To be able to use {@link JsonFormat} on class properties of type `Date`
561+
* with {@link JsonFormatShape.STRING}, a date library needs to be set.
562+
* Date libraries supported: {@link https://github.com/moment/moment}, {@link https://github.com/iamkun/dayjs/}.
563+
*/
564+
dateLibrary?: any;
547565
/**
548566
* Radix to be used to format an integer `Number` during serialization and using `parseInt()`.
549567
*/
@@ -942,6 +960,11 @@ export interface JsonIdentityInfoOptions extends JsonDecoratorOptions {
942960
* Options for version 1 UUID Generator (see {@link https://github.com/uuidjs/uuid#version-1-timestamp})
943961
*/
944962
uuidv1?: UUIDv1GeneratorOptions;
963+
/**
964+
* To be able to use {@link JsonIdentityInfo} with any UUID {@link ObjectIdGenerator}, an UUID library needs to be set.
965+
* UUID libraries supported: {@link https://github.com/uuidjs/uuid}.
966+
*/
967+
uuidLibrary?: any;
945968
}
946969
/**
947970
* Decorator options for {@link JsonIdentityReference}.

dist/decorators/JsonFormat.d.ts

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,10 @@ export declare enum JsonFormatShape {
4646
*
4747
* Iterables, such as `Array` and `Set`, can be serialized as JSON Objects if {@link JsonFormatShape.OBJECT} is used.
4848
*
49+
* **IMPORTANT NOTE**: To be able to use {@link JsonFormat} on class properties of type `Date`
50+
* with {@link JsonFormatShape.STRING}, a date library needs to be set.
51+
* Date libraries supported: {@link https://github.com/moment/moment}, {@link https://github.com/iamkun/dayjs/}.
52+
*
4953
* @example
5054
* ```typescript
5155
* class Event {

dist/decorators/JsonIdentityInfo.d.ts

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,9 @@
44
*/
55
import { JsonIdentityInfoDecorator } from '../@types';
66
/**
7-
* Generator to use for producing Object Identifier for objects
7+
* Generator to use for producing Object Identifier for objects.
8+
* To be able to use {@link JsonIdentityInfo} with any UUID {@link ObjectIdGenerator}, an UUID library needs to be set.
9+
* UUID library supported: {@link https://github.com/uuidjs/uuid}.
810
*/
911
export declare enum ObjectIdGenerator {
1012
/**
@@ -22,22 +24,18 @@ export declare enum ObjectIdGenerator {
2224
PropertyGenerator = 2,
2325
/**
2426
* Implementation that just uses version 5 UUIDs as reliably unique identifiers.
25-
* UUIDs are generated using the {@link https://github.com/uuidjs/uuid} library.
2627
*/
2728
UUIDv5Generator = 3,
2829
/**
2930
* Implementation that just uses version 4 UUIDs as reliably unique identifiers.
30-
* UUIDs are generated using the {@link https://github.com/uuidjs/uuid} library.
3131
*/
3232
UUIDv4Generator = 4,
3333
/**
3434
* Implementation that just uses version 3 UUIDs as reliably unique identifiers.
35-
* UUIDs are generated using the {@link https://github.com/uuidjs/uuid} library.
3635
*/
3736
UUIDv3Generator = 5,
3837
/**
3938
* Implementation that just uses version 1 UUIDs as reliably unique identifiers.
40-
* UUIDs are generated using the {@link https://github.com/uuidjs/uuid} library.
4139
*/
4240
UUIDv1Generator = 6
4341
}
@@ -48,6 +46,9 @@ export declare enum ObjectIdGenerator {
4846
* In practice this is done by serializing the first instance as full object and object identity,
4947
* and other references to the object as reference values.
5048
*
49+
* **IMPORTANT NOTE**: To be able to use {@link JsonIdentityInfo} with any UUID {@link ObjectIdGenerator}, an UUID library needs to be set.
50+
* UUID libraries supported: {@link https://github.com/uuidjs/uuid}.
51+
*
5152
* @example
5253
* ```typescript
5354
* @JsonIdentityInfo({generator: ObjectIdGenerator.PropertyGenerator, property: 'id', scope: 'User'})

dist/lib.js

Lines changed: 13 additions & 13 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

dist/lib.node.js

Lines changed: 13 additions & 13 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)