UNPKG

@lcap/asl

Version:

NetEase Application Specific Language

77 lines 3.67 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.getBasicTypeDefaultValue = exports.getBasicTypeRef = exports.getBasicTypeName = exports.basicTypeMap = exports.basicTypeList = exports.BASIC_TYPE = void 0; var BASIC_TYPE; (function (BASIC_TYPE) { BASIC_TYPE["Boolean"] = "Boolean"; BASIC_TYPE["Integer"] = "Integer"; BASIC_TYPE["Long"] = "Long"; BASIC_TYPE["Decimal"] = "Decimal"; BASIC_TYPE["String"] = "String"; BASIC_TYPE["Text"] = "Text"; BASIC_TYPE["Binary"] = "Binary"; BASIC_TYPE["Date"] = "Date"; BASIC_TYPE["Time"] = "Time"; BASIC_TYPE["DateTime"] = "DateTime"; BASIC_TYPE["Email"] = "Email"; })(BASIC_TYPE = exports.BASIC_TYPE || (exports.BASIC_TYPE = {})); exports.basicTypeList = [ { kind: 'basicType', text: 'Boolean 布尔值', value: '#/basicTypes/Boolean' }, { kind: 'basicType', text: 'Integer 整数', value: '#/basicTypes/Integer' }, { kind: 'basicType', text: 'Long 长整数', value: '#/basicTypes/Long' }, { kind: 'basicType', text: 'Double 小数', value: '#/basicTypes/Decimal' }, { kind: 'basicType', text: 'String 字符串', value: '#/basicTypes/String' }, { kind: 'basicType', text: 'Text 长文本', value: '#/basicTypes/Text' }, { kind: 'basicType', text: 'Binary 二进制流', value: '#/basicTypes/Binary' }, { kind: 'basicType', text: 'Date 日期', value: '#/basicTypes/Date' }, { kind: 'basicType', text: 'Time 时间', value: '#/basicTypes/Time' }, { kind: 'basicType', text: 'DateTime 日期时间', value: '#/basicTypes/DateTime' }, { kind: 'basicType', text: 'Email 电子邮箱', value: '#/basicTypes/Email' }, ]; exports.basicTypeMap = { '#/basicTypes/Boolean': { type: 'boolean', format: '' }, '#/basicTypes/Integer': { type: 'integer', format: 'int' }, '#/basicTypes/Long': { type: 'integer', format: 'long' }, '#/basicTypes/Decimal': { type: 'number', format: 'double' }, '#/basicTypes/String': { type: 'string', format: '' }, '#/basicTypes/Text': { type: 'string', format: 'text' }, '#/basicTypes/Binary': { type: 'string', format: 'binary' }, '#/basicTypes/Date': { type: 'string', format: 'date' }, '#/basicTypes/Time': { type: 'string', format: 'time' }, '#/basicTypes/DateTime': { type: 'string', format: 'date-time' }, '#/basicTypes/Email': { type: 'string', format: 'email' }, }; function getBasicTypeName(type, format) { if (type === 'boolean') return BASIC_TYPE.Boolean; else if (type === 'integer' && format === 'long') return BASIC_TYPE.Long; else if (type === 'integer') return BASIC_TYPE.Integer; else if (type === 'number') return BASIC_TYPE.Decimal; else if (type === 'string' && format === 'text') return BASIC_TYPE.Text; else if (type === 'string' && format === 'binary') return BASIC_TYPE.Binary; else if (type === 'string' && format === 'date') return BASIC_TYPE.Date; else if (type === 'string' && format === 'time') return BASIC_TYPE.Time; else if (type === 'string' && format === 'date-time') return BASIC_TYPE.DateTime; else if (type === 'string' && format === 'email') return BASIC_TYPE.Email; else if (type === 'string') return BASIC_TYPE.String; } exports.getBasicTypeName = getBasicTypeName; function getBasicTypeRef(type, format) { return `#/basicTypes/${getBasicTypeName(type, format)}`; } exports.getBasicTypeRef = getBasicTypeRef; function getBasicTypeDefaultValue(value) { return undefined; } exports.getBasicTypeDefaultValue = getBasicTypeDefaultValue; //# sourceMappingURL=basicTypes.js.map