ts-jackson
Advanced tools
Comparing version 1.2.0 to 1.2.1
@@ -1,1 +0,1 @@ | ||
export default function assertSerializable(target: (new (...args: unknown[]) => unknown) | Function): void; | ||
export default function assertSerializable(target: (new (...args: any[]) => unknown) | Function): void; |
@@ -1,1 +0,1 @@ | ||
export default function checkSerializable(target: Object): boolean; | ||
export default function checkSerializable(target: (new (...params: any[]) => unknown) | Function): boolean; |
export default class SerializableError extends Error { | ||
constructor(target: (new (...args: unknown[]) => unknown) | Function); | ||
constructor(target: (new (...args: any[]) => unknown) | Function); | ||
} |
@@ -1,2 +0,2 @@ | ||
import Entity from '../spotify/Entity'; | ||
import Entity from '../Entity'; | ||
export default class Token extends Entity { | ||
@@ -3,0 +3,0 @@ readonly accessToken: string; |
@@ -31,3 +31,3 @@ "use strict"; | ||
var index_1 = require("../../../index"); | ||
var Entity_1 = __importDefault(require("../spotify/Entity")); | ||
var Entity_1 = __importDefault(require("../Entity")); | ||
var Token = (function (_super) { | ||
@@ -59,5 +59,6 @@ __extends(Token, _super); | ||
index_1.JsonProperty({ | ||
path: 'expires_in', | ||
afterDeserialize: function (_, propertyValue) { | ||
return new Date(Date.now() + propertyValue.getTime()); | ||
path: 'expires_at', | ||
afterDeserialize: function (deserializedInstance) { | ||
var expiresAtTimestamp = Date.now() + deserializedInstance.expiresIn; | ||
return new Date(expiresAtTimestamp); | ||
}, | ||
@@ -64,0 +65,0 @@ }), |
@@ -6,2 +6,3 @@ "use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
var index_1 = require("../../../index"); | ||
var Token_1 = __importDefault(require("./Token")); | ||
@@ -15,6 +16,6 @@ describe('Token', function () { | ||
refresh_token: '2fed2oekio2', | ||
expires_in: 2, | ||
expires_in: 3600, | ||
token_type: 'Bearer', | ||
}; | ||
it('should correctly deserialize to Token when proper data is provided', function () { | ||
test('deserialize', function () { | ||
var token = Token_1.default.deserialize(tokenJSON); | ||
@@ -28,2 +29,6 @@ expect(token).toMatchObject({ | ||
}); | ||
test('serialize', function () { | ||
var token = Token_1.default.deserialize(tokenJSON); | ||
expect(index_1.serialize(token)).toMatchObject(tokenJSON); | ||
}); | ||
}); |
@@ -0,3 +1,3 @@ | ||
import Entity from '../../Entity'; | ||
import { Artist } from '../artist'; | ||
import Entity from '../Entity'; | ||
import { Image } from '../image'; | ||
@@ -4,0 +4,0 @@ export default class Album extends Entity { |
@@ -31,3 +31,3 @@ "use strict"; | ||
var index_1 = require("../../../../index"); | ||
var Entity_1 = __importDefault(require("../Entity")); | ||
var Entity_1 = __importDefault(require("../../Entity")); | ||
var image_1 = require("../image"); | ||
@@ -34,0 +34,0 @@ var Album = (function (_super) { |
@@ -1,2 +0,2 @@ | ||
import Entity from '../Entity'; | ||
import Entity from '../../Entity'; | ||
export default class Artist extends Entity { | ||
@@ -3,0 +3,0 @@ readonly id: string; |
@@ -31,3 +31,3 @@ "use strict"; | ||
var index_1 = require("../../../../index"); | ||
var Entity_1 = __importDefault(require("../Entity")); | ||
var Entity_1 = __importDefault(require("../../Entity")); | ||
var Artist = (function (_super) { | ||
@@ -34,0 +34,0 @@ __extends(Artist, _super); |
@@ -1,2 +0,2 @@ | ||
import Entity from '../Entity'; | ||
import Entity from '../../Entity'; | ||
export default class Image extends Entity { | ||
@@ -3,0 +3,0 @@ readonly height?: number; |
@@ -31,3 +31,3 @@ "use strict"; | ||
var index_1 = require("../../../../index"); | ||
var Entity_1 = __importDefault(require("../Entity")); | ||
var Entity_1 = __importDefault(require("../../Entity")); | ||
var Image = (function (_super) { | ||
@@ -34,0 +34,0 @@ __extends(Image, _super); |
@@ -1,2 +0,2 @@ | ||
import Entity from '../Entity'; | ||
import Entity from '../../Entity'; | ||
import { Image } from '../image'; | ||
@@ -3,0 +3,0 @@ import { Track } from '../track'; |
@@ -31,3 +31,3 @@ "use strict"; | ||
var index_1 = require("../../../../index"); | ||
var Entity_1 = __importDefault(require("../Entity")); | ||
var Entity_1 = __importDefault(require("../../Entity")); | ||
var image_1 = require("../image"); | ||
@@ -34,0 +34,0 @@ var track_1 = require("../track"); |
@@ -1,2 +0,2 @@ | ||
import Entity from '../Entity'; | ||
import Entity from '../../Entity'; | ||
import { Image } from '../image'; | ||
@@ -3,0 +3,0 @@ export default class PlaylistPreview extends Entity { |
@@ -31,3 +31,3 @@ "use strict"; | ||
var index_1 = require("../../../../index"); | ||
var Entity_1 = __importDefault(require("../Entity")); | ||
var Entity_1 = __importDefault(require("../../Entity")); | ||
var image_1 = require("../image"); | ||
@@ -34,0 +34,0 @@ var PlaylistPreview = (function (_super) { |
@@ -0,4 +1,4 @@ | ||
import Entity from '../../Entity'; | ||
import { Album } from '../album'; | ||
import { Artist } from '../artist'; | ||
import Entity from '../Entity'; | ||
export default class Track extends Entity { | ||
@@ -5,0 +5,0 @@ readonly id: string; |
@@ -31,4 +31,4 @@ "use strict"; | ||
var index_1 = require("../../../../index"); | ||
var Entity_1 = __importDefault(require("../../Entity")); | ||
var album_1 = require("../album"); | ||
var Entity_1 = __importDefault(require("../Entity")); | ||
var Track = (function (_super) { | ||
@@ -35,0 +35,0 @@ __extends(Track, _super); |
@@ -6,7 +6,7 @@ import 'reflect-metadata'; | ||
type?: new (...params: Array<unknown>) => unknown; | ||
elementType?: new (...params: Array<unknown>) => unknown; | ||
elementType?: new (...args: any[]) => unknown; | ||
validate?: (property: P) => boolean; | ||
deserialize?: (jsonValue: unknown) => P; | ||
serialize?: (property: P) => unknown; | ||
afterDeserialize?: (deserializedInstance: InstanceType<new (...args: unknown[]) => unknown>, propertyValue: P) => P; | ||
afterDeserialize?: (deserializedInstance: InstanceType<new (...args: any[]) => unknown>, propertyValue: P) => P; | ||
}; | ||
@@ -16,5 +16,5 @@ export declare type JsonPropertyMetadata<P = unknown> = { | ||
path: string; | ||
type: new (...params: Array<unknown>) => unknown; | ||
type: new (...params: any[]) => unknown; | ||
} & Params<P>; | ||
export default function JsonProperty<P = unknown>(arg?: Params<P> | string): (object: Object, propertyName: string) => void; | ||
export {}; |
@@ -1,1 +0,1 @@ | ||
export default function serialize<T extends new (...args: unknown[]) => unknown>(instance: InstanceType<T>): Record<string, unknown>; | ||
export default function serialize<T extends new (...args: any[]) => unknown>(instance: InstanceType<T>): Record<string, unknown>; |
{ | ||
"name": "ts-jackson", | ||
"version": "1.2.0", | ||
"version": "1.2.1", | ||
"author": "Ilias Gazdaliev", | ||
"description": "", | ||
"main": "dist/index.js", | ||
"main": "dist/index.cjs.js", | ||
"module": "dist/index.esm.js", | ||
"types": "dist/index.d.ts", | ||
"scripts": { | ||
"build": "tsc", | ||
"prebuild": "rimraf dist", | ||
"build": "rollup -c", | ||
"postbuild": "npm run tsc-release", | ||
"tsc-release": "tsc --build ts-config.release.json", | ||
"test": "jest", | ||
@@ -47,5 +51,9 @@ "watch": "tsc --watch" | ||
"lodash.set": "^4.3.2", | ||
"reflect-metadata": "^0.1.13" | ||
"reflect-metadata": "^0.1.13", | ||
"tslib": "^1.14.1" | ||
}, | ||
"devDependencies": { | ||
"@rollup/plugin-commonjs": "^17.1.0", | ||
"@rollup/plugin-node-resolve": "^11.2.0", | ||
"@rollup/plugin-typescript": "^8.2.0", | ||
"@types/jest": "^26.0.23", | ||
@@ -60,4 +68,8 @@ "@typescript-eslint/eslint-plugin": "^4.22.1", | ||
"prettier-plugin-organize-imports": "^1.1.1", | ||
"rimraf": "^3.0.2", | ||
"rollup": "^2.48.0", | ||
"rollup-plugin-cleanup": "^3.2.1", | ||
"rollup-plugin-terser": "^7.0.2", | ||
"ts-jest": "^26.5.4", | ||
"typescript": "^4.2.4" | ||
"typescript": "^4.1.3" | ||
}, | ||
@@ -64,0 +76,0 @@ "husky": { |
Minified code
QualityThis package contains minified code. This may be harmless in some cases where minified code is included in packaged libraries, however packages on npm should not minify code.
Found 1 instance in 1 package
134703
4
18
89
2644
1
+ Addedtslib@^1.14.1
+ Addedtslib@1.14.1(transitive)