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.EdmInt64 = void 0; const constants_1 = require("../utils/constants"); const EntityProperty_1 = require("./EntityProperty"); class EdmInt64 { static validate(value) { if (typeof value !== "string") { throw TypeError(`Not a valid EdmInt64 string.`); } // TODO: Check base64 return value; } constructor(value) { this.value = value; this.typedValue = EdmInt64.validate(value); } toJsonPropertyValuePair(name) { return [name, this.typedValue]; } toJsonPropertyValueString(name) { return `"${name}":${JSON.stringify(this.typedValue)}`; } toJsonPropertyTypePair(name, annotationLevel, isSystemProperty) { if (isSystemProperty) { throw RangeError(`EdmInt64 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.Int64"]; } } toJsonPropertyTypeString(name, annotationLevel, isSystemProperty) { const res = this.toJsonPropertyTypePair(name, annotationLevel, isSystemProperty); if (!res) { return; } const [key, value] = res; return `"${key}":"${value}"`; } } exports.EdmInt64 = EdmInt64; //# sourceMappingURL=EdmInt64.js.map