shyft
Version:
Model driven GraphQL API framework
132 lines (131 loc) • 5.55 kB
JavaScript
"use strict";
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
if (k2 === undefined) k2 = k;
Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
}) : (function(o, m, k, k2) {
if (k2 === undefined) k2 = k;
o[k2] = m[k];
}));
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
Object.defineProperty(o, "default", { enumerable: true, value: v });
}) : function(o, v) {
o["default"] = v;
});
var __importStar = (this && this.__importStar) || function (mod) {
if (mod && mod.__esModule) return mod;
var result = {};
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
__setModuleDefault(result, mod);
return result;
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.DataTypeUpload = exports.DataTypeI18n = exports.DataTypeUUID = exports.DataTypeTimeTz = exports.DataTypeTime = exports.DataTypeDate = exports.DataTypeTimestampTz = exports.DataTypeTimestamp = exports.DataTypeJson = exports.DataTypeString = exports.DataTypeBoolean = exports.DataTypeDouble = exports.DataTypeFloat = exports.DataTypeBigInt = exports.DataTypeInteger = exports.DataTypeID = exports.DataTypeUserID = void 0;
var DataType_1 = require("./DataType");
var DataTypeUser_1 = require("./DataTypeUser");
var util_1 = require("../util");
var casual = __importStar(require("casual"));
exports.DataTypeUserID = new DataTypeUser_1.DataTypeUser({
name: 'DataTypeUserID',
description: 'Data type representing a reference to a user',
/* istanbul ignore next */
mock: function () { return casual.integer(2 ^ 20, 2 ^ 51).toString(); },
});
exports.DataTypeID = new DataType_1.DataType({
name: 'DataTypeID',
description: 'Data type representing unique IDs',
/* istanbul ignore next */
mock: function () { return casual.integer(2 ^ 20, 2 ^ 51).toString(); },
});
exports.DataTypeInteger = new DataType_1.DataType({
name: 'DataTypeInteger',
description: 'Data type representing integer values',
/* istanbul ignore next */
mock: function () { return casual.integer(-2 ^ 10, 2 ^ 10); },
});
exports.DataTypeBigInt = new DataType_1.DataType({
name: 'DataTypeBigInt',
description: 'Data type representing big integer values',
/* istanbul ignore next */
mock: function () { return casual.integer(2 ^ 20, 2 ^ 51).toString(); },
});
exports.DataTypeFloat = new DataType_1.DataType({
name: 'DataTypeFloat',
description: 'Data type representing float values',
/* istanbul ignore next */
mock: function () { return casual.double(-2 ^ 10, 2 ^ 10); },
});
exports.DataTypeDouble = new DataType_1.DataType({
name: 'DataTypeDouble',
description: 'Data type representing double precision values',
/* istanbul ignore next */
mock: function () { return casual.double(-2 ^ 10, 2 ^ 10); },
});
exports.DataTypeBoolean = new DataType_1.DataType({
name: 'DataTypeBoolean',
description: 'Data type representing boolean values',
/* istanbul ignore next */
mock: function () { return casual.boolean; },
enforceRequired: true,
defaultValue: function () {
return false;
},
});
exports.DataTypeString = new DataType_1.DataType({
name: 'DataTypeString',
description: 'Data type representing text values',
/* istanbul ignore next */
mock: function () { return casual.title; },
});
exports.DataTypeJson = new DataType_1.DataType({
name: 'DataTypeJson',
description: 'Data type representing json objects',
/* istanbul ignore next */
mock: util_1.randomJson,
});
exports.DataTypeTimestamp = new DataType_1.DataType({
name: 'DataTypeTimestamp',
description: 'Data type representing a timestamp',
/* istanbul ignore next */
mock: function () { return new Date(casual.unix_time * 1000); },
});
exports.DataTypeTimestampTz = new DataType_1.DataType({
name: 'DataTypeTimestampTz',
description: 'Data type representing a timestamp with time zone information',
/* istanbul ignore next */
mock: function () { return new Date(casual.unix_time * 1000); },
});
exports.DataTypeDate = new DataType_1.DataType({
name: 'DataTypeDate',
description: 'Data type representing a date',
/* istanbul ignore next */
mock: function () { return new Date(casual.unix_time * 1000); },
});
exports.DataTypeTime = new DataType_1.DataType({
name: 'DataTypeTime',
description: 'Data type representing time',
/* istanbul ignore next */
mock: function () { return new Date(casual.unix_time * 1000); },
});
exports.DataTypeTimeTz = new DataType_1.DataType({
name: 'DataTypeTimeTz',
description: 'Data type representing time with time zone information',
/* istanbul ignore next */
mock: function () { return new Date(casual.unix_time * 1000); },
});
exports.DataTypeUUID = new DataType_1.DataType({
name: 'DataTypeUUID',
description: 'Data type representing a UUID',
/* istanbul ignore next */
mock: function () { return casual.uuid; },
});
exports.DataTypeI18n = new DataType_1.DataType({
name: 'DataTypeI18n',
description: 'Data type representing translation objects',
/* istanbul ignore next */
mock: util_1.randomJson,
});
exports.DataTypeUpload = new DataType_1.DataType({
name: 'DataTypeUpload',
description: 'Data type representing a file upload',
mock: function () { return null; },
});