@nrfcloud/models
Advanced tools
Comparing version 1.4.1 to 1.5.0
@@ -35,8 +35,3 @@ "use strict"; | ||
var _this = _super.call(this, ApiIndex.$context, ApiIndex.$contextVersion) || this; | ||
links.forEach(function (l) { | ||
if (!(l instanceof Link_1.Link)) { | ||
throw new TypeError("APIIndex: provided links must contain \"Link\" instances: \"" + typeof l + "\" provided!"); | ||
} | ||
}); | ||
_this.links = links; | ||
_this.links = links.map(function (l) { return Link_1.LinkType(l, ['ApiIndex()', 'links:Link[]']); }); | ||
return _this; | ||
@@ -43,0 +38,0 @@ } |
@@ -24,1 +24,3 @@ import { URLValue } from '../value/URLValue'; | ||
} | ||
export declare const LinkType: any; | ||
export declare const MaybeLinkType: any; |
@@ -23,2 +23,3 @@ "use strict"; | ||
var VersionedContext_1 = require("./VersionedContext"); | ||
var t = require('tcomb'); | ||
/** | ||
@@ -37,10 +38,4 @@ * Describes a link. | ||
var _this = _super.call(this, Link.$context, Link.$contextVersion) || this; | ||
if (!(href instanceof URLValue_1.URLValue)) { | ||
throw new TypeError("Link: provided href is not an URI: \"" + href + "\"!"); | ||
} | ||
if (!(subject instanceof URLValue_1.URLValue)) { | ||
throw new TypeError("Link: provided subject is not an URI: \"" + subject + "\"!"); | ||
} | ||
_this.href = href; | ||
_this.subject = subject; | ||
_this.href = URLValue_1.URLValueType(href, ['Link()', 'href:URLValue']); | ||
_this.subject = URLValue_1.URLValueType(subject, ['Link()', 'subject:URLValue']); | ||
_this.rel = rel; | ||
@@ -63,2 +58,4 @@ return _this; | ||
exports.Link = Link; | ||
exports.LinkType = t.irreducible('LinkType', function (x) { return x && x instanceof Link; }); | ||
exports.MaybeLinkType = t.maybe(exports.LinkType); | ||
//# sourceMappingURL=Link.js.map |
@@ -38,8 +38,3 @@ "use strict"; | ||
var _this = _super.call(this, $context, $contextVersion) || this; | ||
$links.map(function (l) { | ||
if (!(l instanceof Link_1.Link)) { | ||
throw new TypeError("ModelContext: provided $links must contain \"Link\" instances: \"" + typeof l + "\" provided!"); | ||
} | ||
}); | ||
_this.$links = $links; | ||
_this.$links = $links.map(function (l) { return Link_1.LinkType(l, ['LinkedEntity()', '$links:Link[]']); }); | ||
return _this; | ||
@@ -46,0 +41,0 @@ } |
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
var URLValue_1 = require("../value/URLValue"); | ||
var t = require('tcomb'); | ||
var PositiveIntegerType = t.refinement(t.Integer, function (n) { return n >= 1; }, 'PositiveIntegerType'); | ||
/** | ||
@@ -15,10 +17,4 @@ * Describes JSON data | ||
function VersionedContext($context, $contextVersion) { | ||
if (!($context instanceof URLValue_1.URLValue)) { | ||
throw new TypeError("VersionedContext: provided $context is not an URI: \"" + $context + "\"!"); | ||
} | ||
if ($contextVersion % 1 !== 0 || $contextVersion <= 0) { | ||
throw new TypeError("VersionedContext: provided $contextVersion is not an integer > 0: \"" + $contextVersion + "\"!"); | ||
} | ||
this.$context = $context; | ||
this.$contextVersion = $contextVersion; | ||
this.$context = URLValue_1.URLValueType($context, ['VersionedContext()', '$context:URLValue']); | ||
this.$contextVersion = PositiveIntegerType($contextVersion, ['VersionedContext()', '$contextVersion:int>=1']); | ||
} | ||
@@ -25,0 +21,0 @@ VersionedContext.prototype.toJSON = function () { |
@@ -37,1 +37,3 @@ /** | ||
} | ||
export declare const URLValueType: any; | ||
export declare const MaybeURLValueType: any; |
@@ -69,2 +69,4 @@ "use strict"; | ||
exports.URLValue = URLValue; | ||
exports.URLValueType = t.irreducible('URLValueType', function (x) { return x && x instanceof URLValue; }); | ||
exports.MaybeURLValueType = t.maybe(exports.URLValueType); | ||
//# sourceMappingURL=URLValue.js.map |
@@ -1,1 +0,1 @@ | ||
{"name":"@nrfcloud/models","version":"1.4.1","description":"Contains model definitions for the REST API","main":"dist/index.js","typings":"dist/index.d.ts","scripts":{"test":"make test-prepare && jest","test:coverage":"make test-prepare && jest --coverage","lint":"tslint --project ./tsconfig.json","precommit":"npm run lint && npm test","commitmsg":"commitlint -e","semantic-release":"semantic-release pre && npm publish && semantic-release post"},"repository":{"type":"git","url":"https://github.com/nRFCloud/models.git"},"keywords":["nRFCloud","IoT","NordicSemiconductor"],"author":"Nordic Semiconductor ASA | nordicsemi.no","license":"BSD-3-Clause","bugs":{"url":"https://github.com/nRFCloud/models/issues"},"homepage":"https://github.com/NordicSemiconductor/nrfcloud-models#readme","dependencies":{"tcomb":"^3.2.24"},"devDependencies":{"@commitlint/cli":"^4.2.2","@commitlint/config-angular":"^4.2.1","@types/jest":"^21.1.5","@types/node":"^8.0.47","husky":"^0.14.3","jest":"^21.2.1","json-schema-to-typescript":"^5.0.0","semantic-release":"^8.2.0","ts-jest":"^21.1.4","tslint":"^5.8.0","typescript":"^2.6.1"},"jest":{"moduleFileExtensions":["ts","tsx","js","json"],"transform":{"^.+\\.tsx?$":"<rootDir>/node_modules/ts-jest/preprocessor.js"},"testRegex":"(/__tests__/.*|\\.(test|spec))\\.(ts|tsx|js)$","coverageReporters":["html"],"mapCoverage":true},"files":["dist","scripts","README.md"],"publishConfig":{"access":"public"}} | ||
{"name":"@nrfcloud/models","version":"1.5.0","description":"Contains model definitions for the REST API","main":"dist/index.js","typings":"dist/index.d.ts","scripts":{"test":"make test-prepare && jest","test:coverage":"make test-prepare && jest --coverage","lint":"tslint --project ./tsconfig.json","precommit":"npm run lint && npm test","commitmsg":"commitlint -e","semantic-release":"semantic-release pre && npm publish && semantic-release post"},"repository":{"type":"git","url":"https://github.com/nRFCloud/models.git"},"keywords":["nRFCloud","IoT","NordicSemiconductor"],"author":"Nordic Semiconductor ASA | nordicsemi.no","license":"BSD-3-Clause","bugs":{"url":"https://github.com/nRFCloud/models/issues"},"homepage":"https://github.com/NordicSemiconductor/nrfcloud-models#readme","dependencies":{"tcomb":"^3.2.24"},"devDependencies":{"@commitlint/cli":"^4.2.2","@commitlint/config-angular":"^4.2.1","@types/jest":"^21.1.5","@types/node":"^8.0.47","husky":"^0.14.3","jest":"^21.2.1","json-schema-to-typescript":"^5.0.0","semantic-release":"^8.2.0","ts-jest":"^21.1.4","tslint":"^5.8.0","typescript":"^2.6.1"},"jest":{"moduleFileExtensions":["ts","tsx","js","json"],"transform":{"^.+\\.tsx?$":"<rootDir>/node_modules/ts-jest/preprocessor.js"},"testRegex":"(/__tests__/.*|\\.(test|spec))\\.(ts|tsx|js)$","coverageReporters":["html"],"mapCoverage":true},"files":["dist","scripts","README.md"],"publishConfig":{"access":"public"}} |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
81322
1594