From c9ac7629508ce4b96af9582fb8168666c9635dd8 Mon Sep 17 00:00:00 2001 From: Michel Weststrate Date: Tue, 24 Sep 2019 10:56:20 +0100 Subject: [PATCH] Published version 1.5.2 --- CHANGELOG.md | 3 +++ README.md | 46 +++++++++++++++++++++++----------------------- package.json | 4 ++-- publish.js | 4 ++-- 4 files changed, 30 insertions(+), 27 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index dc5d39c..89489a3 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,6 @@ +# 1.5.2 +* Fixed potential memory leak, fixes #95 through #100 by @svennergr + # 1.5.1 * Fixed make beforeDeserialize, afterDeserialize optional, see #94 by zeevl diff --git a/README.md b/README.md index a0d518a..372ad7d 100644 --- a/README.md +++ b/README.md @@ -411,7 +411,7 @@ A more detailed example can be found in [test/typescript/ts.ts](test/typescript/ ## ModelSchema -[src/serializr.js:52-52](https://github.com/mobxjs/serializr/blob/f3d8441271009ff1818c2893e7a18da92bbde541/src/serializr.js#L5-L51 "Source code on GitHub") +[src/serializr.js:52-52](https://git@github.com/:mobxjs/serializr/blob/132a653e346444c53e17679fcef07f389da1d939/src/serializr.js#L5-L51 "Source code on GitHub") JSDOC type defintions for usage w/o typescript. @@ -457,7 +457,7 @@ Returns **any** void ## createSimpleSchema -[src/api/createSimpleSchema.js:17-24](https://github.com/mobxjs/serializr/blob/f3d8441271009ff1818c2893e7a18da92bbde541/src/api/createSimpleSchema.js#L17-L24 "Source code on GitHub") +[src/api/createSimpleSchema.js:17-24](https://git@github.com/:mobxjs/serializr/blob/132a653e346444c53e17679fcef07f389da1d939/src/api/createSimpleSchema.js#L17-L24 "Source code on GitHub") Creates a model schema that (de)serializes from / to plain javascript objects. Its factory method is: `() => ({})` @@ -482,7 +482,7 @@ Returns **[object](#object)** model schema ## createModelSchema -[src/api/createModelSchema.js:29-47](https://github.com/mobxjs/serializr/blob/f3d8441271009ff1818c2893e7a18da92bbde541/src/api/createModelSchema.js#L29-L47 "Source code on GitHub") +[src/api/createModelSchema.js:29-47](https://git@github.com/:mobxjs/serializr/blob/132a653e346444c53e17679fcef07f389da1d939/src/api/createModelSchema.js#L29-L47 "Source code on GitHub") Creates a model schema that (de)serializes an object created by a constructor function (class). The created model schema is associated by the targeted type as default model schema, see setDefaultModelSchema. @@ -515,7 +515,7 @@ Returns **[object](#object)** model schema ## getDefaultModelSchema -[src/api/getDefaultModelSchema.js:9-18](https://github.com/mobxjs/serializr/blob/f3d8441271009ff1818c2893e7a18da92bbde541/src/api/getDefaultModelSchema.js#L9-L18 "Source code on GitHub") +[src/api/getDefaultModelSchema.js:9-18](https://git@github.com/:mobxjs/serializr/blob/132a653e346444c53e17679fcef07f389da1d939/src/api/getDefaultModelSchema.js#L9-L18 "Source code on GitHub") Returns the standard model schema associated with a class / constructor function @@ -527,7 +527,7 @@ Returns **[ModelSchema](#modelschema)** model schema ## setDefaultModelSchema -[src/api/setDefaultModelSchema.js:15-18](https://github.com/mobxjs/serializr/blob/f3d8441271009ff1818c2893e7a18da92bbde541/src/api/setDefaultModelSchema.js#L15-L18 "Source code on GitHub") +[src/api/setDefaultModelSchema.js:15-18](https://git@github.com/:mobxjs/serializr/blob/132a653e346444c53e17679fcef07f389da1d939/src/api/setDefaultModelSchema.js#L15-L18 "Source code on GitHub") Sets the default model schema for class / constructor function. Everywhere where a model schema is required as argument, this class / constructor function @@ -545,7 +545,7 @@ Returns **[ModelSchema](#modelschema)** model schema ## serializable -[src/api/serializable.js:93-103](https://github.com/mobxjs/serializr/blob/f3d8441271009ff1818c2893e7a18da92bbde541/src/api/serializable.js#L93-L103 "Source code on GitHub") +[src/api/serializable.js:93-103](https://git@github.com/:mobxjs/serializr/blob/132a653e346444c53e17679fcef07f389da1d939/src/api/serializable.js#L93-L103 "Source code on GitHub") Decorator that defines a new property mapping on the default model schema for the class it is used in. @@ -569,7 +569,7 @@ Returns **PropertyDescriptor** ## serialize -[src/core/serialize.js:16-34](https://github.com/mobxjs/serializr/blob/f3d8441271009ff1818c2893e7a18da92bbde541/src/core/serialize.js#L16-L34 "Source code on GitHub") +[src/core/serialize.js:16-34](https://git@github.com/:mobxjs/serializr/blob/132a653e346444c53e17679fcef07f389da1d939/src/core/serialize.js#L16-L34 "Source code on GitHub") Serializes an object (graph) into json using the provided model schema. The model schema can be omitted if the object type has a default model schema associated with it. @@ -584,7 +584,7 @@ Returns **[object](#object)** serialized representation of the object ## serializeAll -[src/core/serialize.js:89-100](https://github.com/mobxjs/serializr/blob/f3d8441271009ff1818c2893e7a18da92bbde541/src/core/serialize.js#L89-L100 "Source code on GitHub") +[src/core/serialize.js:89-100](https://git@github.com/:mobxjs/serializr/blob/132a653e346444c53e17679fcef07f389da1d939/src/core/serialize.js#L89-L100 "Source code on GitHub") The `serializeAll` decorator can be used on a class to signal that all primitive properties should be serialized automatically. @@ -594,7 +594,7 @@ The `serializeAll` decorator can be used on a class to signal that all primitive ## cancelDeserialize -[src/core/cancelDeserialize.js:12-18](https://github.com/mobxjs/serializr/blob/f3d8441271009ff1818c2893e7a18da92bbde541/src/core/cancelDeserialize.js#L12-L18 "Source code on GitHub") +[src/core/cancelDeserialize.js:12-18](https://git@github.com/:mobxjs/serializr/blob/132a653e346444c53e17679fcef07f389da1d939/src/core/cancelDeserialize.js#L12-L18 "Source code on GitHub") Cancels an asynchronous deserialization or update operation for the specified target object. @@ -604,7 +604,7 @@ Cancels an asynchronous deserialization or update operation for the specified ta ## deserialize -[src/core/deserialize.js:45-63](https://github.com/mobxjs/serializr/blob/f3d8441271009ff1818c2893e7a18da92bbde541/src/core/deserialize.js#L45-L63 "Source code on GitHub") +[src/core/deserialize.js:45-63](https://git@github.com/:mobxjs/serializr/blob/132a653e346444c53e17679fcef07f389da1d939/src/core/deserialize.js#L45-L63 "Source code on GitHub") Deserializes a json structure into an object graph. @@ -627,7 +627,7 @@ Returns **([object](#object) \| [array](https://developer.mozilla.org/docs/Web/J ## update -[src/core/update.js:22-44](https://github.com/mobxjs/serializr/blob/f3d8441271009ff1818c2893e7a18da92bbde541/src/core/update.js#L22-L44 "Source code on GitHub") +[src/core/update.js:22-44](https://git@github.com/:mobxjs/serializr/blob/132a653e346444c53e17679fcef07f389da1d939/src/core/update.js#L22-L44 "Source code on GitHub") Similar to deserialize, but updates an existing object instance. Properties will always updated entirely, but properties not present in the json will be kept as is. @@ -645,7 +645,7 @@ Returns **([object](#object) \| [array](https://developer.mozilla.org/docs/Web/J ## primitive -[src/types/primitive.js:18-32](https://github.com/mobxjs/serializr/blob/f3d8441271009ff1818c2893e7a18da92bbde541/src/types/primitive.js#L18-L32 "Source code on GitHub") +[src/types/primitive.js:18-32](https://git@github.com/:mobxjs/serializr/blob/132a653e346444c53e17679fcef07f389da1d939/src/types/primitive.js#L18-L32 "Source code on GitHub") Indicates that this field contains a primitive value (or Date) which should be serialized literally to json. @@ -668,7 +668,7 @@ Returns **[ModelSchema](#modelschema)** ## identifier -[src/types/identifier.js:43-66](https://github.com/mobxjs/serializr/blob/f3d8441271009ff1818c2893e7a18da92bbde541/src/types/identifier.js#L43-L66 "Source code on GitHub") +[src/types/identifier.js:43-66](https://git@github.com/:mobxjs/serializr/blob/132a653e346444c53e17679fcef07f389da1d939/src/types/identifier.js#L43-L66 "Source code on GitHub") Similar to primitive, but this field will be marked as the identifier for the given Model type. This is used by for example `reference()` to serialize the reference @@ -709,7 +709,7 @@ Returns **PropSchema** ## date -[src/types/date.js:9-26](https://github.com/mobxjs/serializr/blob/f3d8441271009ff1818c2893e7a18da92bbde541/src/types/date.js#L9-L26 "Source code on GitHub") +[src/types/date.js:9-26](https://git@github.com/:mobxjs/serializr/blob/132a653e346444c53e17679fcef07f389da1d939/src/types/date.js#L9-L26 "Source code on GitHub") Similar to primitive, serializes instances of Date objects @@ -721,7 +721,7 @@ Returns **PropSchema** ## alias -[src/types/alias.js:20-33](https://github.com/mobxjs/serializr/blob/f3d8441271009ff1818c2893e7a18da92bbde541/src/types/alias.js#L20-L33 "Source code on GitHub") +[src/types/alias.js:20-33](https://git@github.com/:mobxjs/serializr/blob/132a653e346444c53e17679fcef07f389da1d939/src/types/alias.js#L20-L33 "Source code on GitHub") Alias indicates that this model property should be named differently in the generated json. Alias should be the outermost propschema. @@ -746,7 +746,7 @@ Returns **PropSchema** ## custom -[src/types/custom.js:60-75](https://github.com/mobxjs/serializr/blob/f3d8441271009ff1818c2893e7a18da92bbde541/src/types/custom.js#L60-L75 "Source code on GitHub") +[src/types/custom.js:60-75](https://git@github.com/:mobxjs/serializr/blob/132a653e346444c53e17679fcef07f389da1d939/src/types/custom.js#L60-L75 "Source code on GitHub") Can be used to create simple custom propSchema. Multiple things can be done inside of a custom propSchema, like deserializing and serializing other (polymorphic) objects, skipping the serialization of something or checking the context of the obj being (de)serialized. @@ -811,7 +811,7 @@ Returns **PropSchema** ## object -[src/types/object.js:35-55](https://github.com/mobxjs/serializr/blob/f3d8441271009ff1818c2893e7a18da92bbde541/src/types/object.js#L35-L55 "Source code on GitHub") +[src/types/object.js:35-55](https://git@github.com/:mobxjs/serializr/blob/132a653e346444c53e17679fcef07f389da1d939/src/types/object.js#L35-L55 "Source code on GitHub") `object` indicates that this property contains an object that needs to be (de)serialized using its own model schema. @@ -849,7 +849,7 @@ Returns **PropSchema** ## reference -[src/types/reference.js:66-105](https://github.com/mobxjs/serializr/blob/f3d8441271009ff1818c2893e7a18da92bbde541/src/types/reference.js#L66-L105 "Source code on GitHub") +[src/types/reference.js:66-105](https://git@github.com/:mobxjs/serializr/blob/132a653e346444c53e17679fcef07f389da1d939/src/types/reference.js#L66-L105 "Source code on GitHub") `reference` can be used to (de)serialize references that point to other models. @@ -914,7 +914,7 @@ Returns **PropSchema** ## list -[src/types/list.js:43-105](https://github.com/mobxjs/serializr/blob/f3d8441271009ff1818c2893e7a18da92bbde541/src/types/list.js#L43-L105 "Source code on GitHub") +[src/types/list.js:43-105](https://git@github.com/:mobxjs/serializr/blob/132a653e346444c53e17679fcef07f389da1d939/src/types/list.js#L43-L105 "Source code on GitHub") List indicates that this property contains a list of things. Accepts a sub model schema to serialize the contents @@ -953,7 +953,7 @@ Returns **PropSchema** ## map -[src/types/map.js:14-65](https://github.com/mobxjs/serializr/blob/f3d8441271009ff1818c2893e7a18da92bbde541/src/types/map.js#L14-L65 "Source code on GitHub") +[src/types/map.js:14-65](https://git@github.com/:mobxjs/serializr/blob/132a653e346444c53e17679fcef07f389da1d939/src/types/map.js#L14-L65 "Source code on GitHub") Similar to list, but map represents a string keyed dynamic collection. This can be both plain objects (default) or ES6 Map like structures. @@ -968,7 +968,7 @@ Returns **PropSchema** ## mapAsArray -[src/types/mapAsArray.js:19-66](https://github.com/mobxjs/serializr/blob/f3d8441271009ff1818c2893e7a18da92bbde541/src/types/mapAsArray.js#L19-L66 "Source code on GitHub") +[src/types/mapAsArray.js:19-66](https://git@github.com/:mobxjs/serializr/blob/132a653e346444c53e17679fcef07f389da1d939/src/types/mapAsArray.js#L19-L66 "Source code on GitHub") Similar to map, mapAsArray can be used to serialize a map-like collection where the key is contained in the 'value object'. Example: consider Map<id: number, customer: Customer> where the @@ -988,7 +988,7 @@ Returns **PropSchema** ## raw -[src/types/raw.js:18-29](https://github.com/mobxjs/serializr/blob/f3d8441271009ff1818c2893e7a18da92bbde541/src/types/raw.js#L18-L29 "Source code on GitHub") +[src/types/raw.js:18-29](https://git@github.com/:mobxjs/serializr/blob/132a653e346444c53e17679fcef07f389da1d939/src/types/raw.js#L18-L29 "Source code on GitHub") Indicates that this field is only need to putted in the serialized json or deserialized instance, without any transformations. Stay with its original value @@ -1012,7 +1012,7 @@ Returns **[ModelSchema](#modelschema)** ## SKIP -[src/constants.js:20-20](https://github.com/mobxjs/serializr/blob/f3d8441271009ff1818c2893e7a18da92bbde541/src/constants.js#L20-L20 "Source code on GitHub") +[src/constants.js:20-20](https://git@github.com/:mobxjs/serializr/blob/132a653e346444c53e17679fcef07f389da1d939/src/constants.js#L20-L20 "Source code on GitHub") In the event that a property needs to be deserialized, but not serialized, you can use the SKIP symbol to omit the property. This has to be used with the custom serializer. diff --git a/package.json b/package.json index fb3bffc..3a1e3be 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "serializr", - "version": "1.5.1", + "version": "1.5.2", "description": "Serialize and deserialize complex object graphs to JSON", "main": "lib/serializr.js", "module": "lib/es/serializr.js", @@ -56,4 +56,4 @@ "tape": "^4.9.2", "typescript": "^3.3.3" } -} +} \ No newline at end of file diff --git a/publish.js b/publish.js index 64482ff..bd0c311 100755 --- a/publish.js +++ b/publish.js @@ -1,4 +1,4 @@ -#!/usr/local/bin/nscript +#!/usr/bin/env nscript /* To run this script, nscript is needed: [sudo] npm install -g nscript /* Publish.js, publish a new version of the npm package as found in the current directory */ /* Run this file from the root of the repository */ @@ -32,4 +32,4 @@ module.exports = function(shell, npm, git) { } else shell.exit(1, pkg.name + " is not an existing npm package"); -}; \ No newline at end of file +};