UNPKG

alcaeus-model

Version:

rdfine models for Alcaeus, Hydra client

47 lines (46 loc) 1.95 kB
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) { var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d; if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc); else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r; return c > 3 && r && Object.defineProperty(target, key, r), r; }; var __metadata = (this && this.__metadata) || function (k, v) { if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v); }; import { property } from '@tpluscode/rdfine'; import { hydra, rdf, rdfs } from '@tpluscode/rdf-ns-builders'; import { ClassMixin } from './Class.js'; import { OperationMixin } from './Operation.js'; export function RdfPropertyMixin(Base) { class RdfPropertyClass extends Base { get isLink() { return this.types.has(hydra.Link); } } __decorate([ property.resource({ path: rdfs.range, as: [ClassMixin], values: 'array', }), __metadata("design:type", Array) ], RdfPropertyClass.prototype, "range", void 0); __decorate([ property.resource({ path: rdfs.domain, as: [ClassMixin], values: 'array', }), __metadata("design:type", Array) ], RdfPropertyClass.prototype, "domain", void 0); __decorate([ property.resource({ path: hydra.supportedOperation, values: 'array', as: [OperationMixin], }), __metadata("design:type", Array) ], RdfPropertyClass.prototype, "supportedOperations", void 0); return RdfPropertyClass; } RdfPropertyMixin.appliesTo = rdf.Property;