UNPKG

@pebula/metap

Version:
88 lines 5.49 kB
/** * @fileoverview added by tsickle * @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc */ import { PlainObjectMapper } from './plain-object-mapper'; /** * @record * @template TTarget, TSource */ export function SerializerClass() { } /** * @record * @template TTarget, TSource */ export function Serializer() { } if (false) { /** * @param {?} context * @return {?} */ Serializer.prototype.serialize = function (context) { }; } /** * Represents the contract a Serializer needs to implements. * A Serializer should handle both a collection and a single item and should be able to identify them. * * Since Serialization transforms a KNOWN document to an UNKNOWN document the serializer is gets * free control over the output. * The library provides the instance and a container of property metadata for the instance and the * serializer should do the rest. * * Since the output schema is now known to the library the whole process is managed by the serializer. * The library helps with metadata. * @abstract * @template TTarget, TSource */ var /** * Represents the contract a Serializer needs to implements. * A Serializer should handle both a collection and a single item and should be able to identify them. * * Since Serialization transforms a KNOWN document to an UNKNOWN document the serializer is gets * free control over the output. * The library provides the instance and a container of property metadata for the instance and the * serializer should do the rest. * * Since the output schema is now known to the library the whole process is managed by the serializer. * The library helps with metadata. * @abstract * @template TTarget, TSource */ BaseSerializer = /** @class */ (function () { function BaseSerializer(source, plainMapper) { this.source = source; this.plainMapper = plainMapper || new PlainObjectMapper(); } return BaseSerializer; }()); /** * Represents the contract a Serializer needs to implements. * A Serializer should handle both a collection and a single item and should be able to identify them. * * Since Serialization transforms a KNOWN document to an UNKNOWN document the serializer is gets * free control over the output. * The library provides the instance and a container of property metadata for the instance and the * serializer should do the rest. * * Since the output schema is now known to the library the whole process is managed by the serializer. * The library helps with metadata. * @abstract * @template TTarget, TSource */ export { BaseSerializer }; if (false) { /** * @type {?} * @protected */ BaseSerializer.prototype.plainMapper; /** @type {?} */ BaseSerializer.prototype.source; /** * @abstract * @param {?} container * @return {?} */ BaseSerializer.prototype.serialize = function (container) { }; } //# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoic2VyaWFsaXplci5qcyIsInNvdXJjZVJv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