@dolittle/sdk.execution
Version:
Dolittle is a decentralized, distributed, event-driven microservice platform built to harness the power of events.
44 lines • 2.46 kB
JavaScript
// 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.CorrelationId = void 0;
const rudiments_1 = require("@dolittle/rudiments");
const concepts_1 = require("@dolittle/concepts");
/**
* A unique identifier to allow us to trace actions and their consequences throughout the system.
*/
class CorrelationId extends concepts_1.ConceptAs {
/**
* Initialises a new instance of the {@link CorrelationId} class.
* @param {Guid} id - The correlation id.
*/
constructor(id) {
super(id, '@dolittle/sdk.execution.CorrelationId');
}
/**
* Creates a {@link CorrelationId} from a {@link Guid} or a {@link string}.
* @param {CorrelationId | Guid | string} id - The correlation id.
* @returns {CorrelationId} The created correlation id concept.
*/
static from(id) {
if (id instanceof CorrelationId) {
return id;
}
return new CorrelationId(rudiments_1.Guid.as(id));
}
;
/**.
* Generates a new {@link CorrelationId}
* @returns {CorrelationId} A new random correlation id.
*/
static new() {
return CorrelationId.from(rudiments_1.Guid.create());
}
}
exports.CorrelationId = CorrelationId;
/**
* Represents the system correlation identifier.
*/
CorrelationId.system = CorrelationId.from('868ff40f-a133-4d0f-bfdd-18d726181e01');
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiQ29ycmVsYXRpb25JZC5qcyIsInNvdXJjZVJvb3QiOiIuLi8iLCJzb3VyY2VzIjpbIkNvcnJlbGF0aW9uSWQudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6IjtBQUFBLCtDQUErQztBQUMvQyxxR0FBcUc7OztBQUVyRyxtREFBMkM7QUFDM0MsaURBQStDO0FBRS9DOztHQUVHO0FBQ0gsTUFBYSxhQUFjLFNBQVEsb0JBQXdEO0lBQ3ZGOzs7T0FHRztJQUNILFlBQVksRUFBUTtRQUNoQixLQUFLLENBQUMsRUFBRSxFQUFFLHVDQUF1QyxDQUFDLENBQUM7SUFDdkQsQ0FBQztJQU9EOzs7O09BSUc7SUFDSCxNQUFNLENBQUMsSUFBSSxDQUFDLEVBQWlDO1FBQ3pDLElBQUksRUFBRSxZQUFZLGFBQWEsRUFBRTtZQUM3QixPQUFPLEVBQUUsQ0FBQztTQUNiO1FBQ0QsT0FBTyxJQUFJLGFBQWEsQ0FBQyxnQkFBSSxDQUFDLEVBQUUsQ0FBQyxFQUFFLENBQUMsQ0FBQyxDQUFDO0lBQzFDLENBQUM7SUFBQSxDQUFDO0lBRUY7OztPQUdHO0lBQ0gsTUFBTSxDQUFDLEdBQUc7UUFDTixPQUFPLGFBQWEsQ0FBQyxJQUFJLENBQUMsZ0JBQUksQ0FBQyxNQUFNLEVBQUUsQ0FBQyxDQUFDO0lBQzdDLENBQUM7O0FBaENMLHNDQWlDQztBQXhCRzs7R0FFRztBQUNJLG9CQUFNLEdBQUcsYUFBYSxDQUFDLElBQUksQ0FBQyxzQ0FBc0MsQ0FBQyxDQUFDIn0=
;