UNPKG

ts-japi

Version:

A highly-modular (typescript-friendly)-framework agnostic library for serializing data to the JSON:API specification

24 lines 847 B
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); class Relationship { links; data; meta; constructor(options) { // data can be explicitly set to null for empty to-one relationships if (typeof options.data !== "undefined") { this.data = options.data; } if (options.links) { this.links = options.links; } if (options.meta) { this.meta = options.meta; } if (typeof options.data === "undefined" && !this.links && !this.meta) { throw new Error("Relationships must contain at least a link, data, or meta. See https://jsonapi.org/format/#document-resource-object-relationships for more information."); } } } exports.default = Relationship; //# sourceMappingURL=relationship.model.js.map