UNPKG

azurite

Version:

An open source Azure Storage API compatible server

43 lines 1.51 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.EdmBinary = void 0; const constants_1 = require("../utils/constants"); const EntityProperty_1 = require("./EntityProperty"); class EdmBinary { static validate(value) { if (typeof value !== "string") { throw TypeError(`Not a valid EdmBinary string.`); } // TODO: Check base64 return value; } constructor(value) { this.value = value; this.typedValue = EdmBinary.validate(value); } toJsonPropertyValuePair(name) { return [name, this.value]; } toJsonPropertyValueString(name) { return `"${name}":${JSON.stringify(this.typedValue)}`; } toJsonPropertyTypePair(name, annotationLevel, isSystemProperty) { if (isSystemProperty) { throw RangeError(`EdmBinary type shouldn't be a system property.`); } if (annotationLevel === EntityProperty_1.AnnotationLevel.MINIMAL || annotationLevel === EntityProperty_1.AnnotationLevel.FULL) { return [`${name}${constants_1.ODATA_TYPE}`, "Edm.Binary"]; } } toJsonPropertyTypeString(name, annotationLevel, isSystemProperty) { const res = this.toJsonPropertyTypePair(name, annotationLevel, isSystemProperty); if (!res) { return; } const [key, value] = res; return `"${key}":"${value}"`; } } exports.EdmBinary = EdmBinary; //# sourceMappingURL=EdmBinary.js.map