domain-objects
Version:
A simple, convenient way to represent domain objects, leverage domain knowledge, and add runtime validation in your code base.
23 lines • 896 B
JavaScript
Object.defineProperty(exports, "__esModule", { value: true });
exports.getRef = exports.getReferenceTo = void 0;
const getUniqueIdentifier_1 = require("../manipulation/getUniqueIdentifier");
/**
* declares a reference to a domain.entity or domain.event
*
* note
* - if the shape of the unique and primary keys are not resolved, please manually annotate the type
* - e.g., `const ref = getRef<typeof SeaTurtle>(turtle)` instead of `const ref = getRef(turtle)`
* - automatic resolution of the relationship between instance and class.static properties is still a todo
*/
const getReferenceTo = (
// dobj: TShape,
dobj) => {
return {
_dobj: dobj.constructor.name,
...(0, getUniqueIdentifier_1.getUniqueIdentifier)(dobj),
};
};
exports.getReferenceTo = getReferenceTo;
exports.getRef = exports.getReferenceTo;
//# sourceMappingURL=getReferenceTo.js.map
;