UNPKG

@dolittle/sdk.artifacts

Version:

Dolittle is a decentralized, distributed, event-driven microservice platform built to harness the power of events.

43 lines 2.67 kB
"use strict"; // Copyright (c) Dolittle. All rights reserved. // Licensed under the MIT license. See LICENSE file in the project root for full license information. Object.defineProperty(exports, "__esModule", { value: true }); exports.isGeneration = exports.Generation = void 0; const concepts_1 = require("@dolittle/concepts"); const GenerationMustBePositiveInteger_1 = require("./GenerationMustBePositiveInteger"); /** * Represents the generation of an Artifact. */ class Generation extends concepts_1.ConceptAs { /** * Initialises a new instance of the {@link Generation} class. * @param {number} generation - The generation. */ constructor(generation) { if (!Number.isSafeInteger(generation) || generation < 0) throw new GenerationMustBePositiveInteger_1.GenerationMustBePositiveInteger(); super(generation, '@dolittle/sdk.artifacts.Generation'); } /** * Creates a {@link Generation} from a {@link GenerationLike}. * @param {GenerationLike} generation - The generation. * @returns {Generation} The created generation concept. */ static from(generation) { if (generation instanceof Generation) return generation; return new Generation(generation); } } exports.Generation = Generation; /**. * Represents the first {@link Generation} */ Generation.first = Generation.from(1); /** * Checks whether or not an object is an instance of {@link Generation}. * @param {any} object - The object to check. * @returns {boolean} True if the object is an {@link Generation}, false if not. */ exports.isGeneration = (0, concepts_1.createIsConceptAsNumber)(Generation, '@dolittle/sdk.artifacts.Generation'); //# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiR2VuZXJhdGlvbi5qcyIsInNvdXJjZVJvb3QiOiIuLi8iLCJzb3VyY2VzIjpbIkdlbmVyYXRpb24udHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6IjtBQUFBLCtDQUErQztBQUMvQyxxR0FBcUc7OztBQUVyRyxpREFBd0U7QUFDeEUsdUZBQW9GO0FBT3BGOztHQUVHO0FBQ0gsTUFBYSxVQUFXLFNBQVEsb0JBQXVEO0lBRW5GOzs7T0FHRztJQUNILFlBQVksVUFBa0I7UUFDMUIsSUFBSSxDQUFDLE1BQU0sQ0FBQyxhQUFhLENBQUMsVUFBVSxDQUFDLElBQUksVUFBVSxHQUFHLENBQUM7WUFBRSxNQUFNLElBQUksaUVBQStCLEVBQUUsQ0FBQztRQUNyRyxLQUFLLENBQUMsVUFBVSxFQUFFLG9DQUFvQyxDQUFDLENBQUM7SUFDNUQsQ0FBQztJQU9EOzs7O09BSUc7SUFDSCxNQUFNLENBQUMsSUFBSSxDQUFDLFVBQTBCO1FBQ2xDLElBQUksVUFBVSxZQUFZLFVBQVU7WUFBRSxPQUFPLFVBQVUsQ0FBQztRQUN4RCxPQUFPLElBQUksVUFBVSxDQUFDLFVBQVUsQ0FBQyxDQUFDO0lBQ3RDLENBQUM7O0FBeEJMLGdDQXlCQztBQWRHOztHQUVHO0FBQ0ksZ0JBQUssR0FBZSxVQUFVLENBQUMsSUFBSSxDQUFDLENBQUMsQ0FBQyxDQUFDO0FBYWxEOzs7O0dBSUc7QUFDVSxRQUFBLFlBQVksR0FBRyxJQUFBLGtDQUF1QixFQUFDLFVBQVUsRUFBRSxvQ0FBb0MsQ0FBQyxDQUFDIn0=