@vulcan-sql/core
Version:
Core package of VulcanSQL
105 lines • 3.72 kB
JavaScript
;
/*
=== Schema Sample Format ===
name: user
url: /user/:id
request:
parameters:
id:
in: query # three source: path / query / header
description: user id
type: integer # three types: boolean / number / string
validators:
- name: date
args:
format: 'yyyy-MM-dd'
- name: required
error:
- code: Forbidden
message: 'You are not allowed to access this resource'
*/
Object.defineProperty(exports, "__esModule", { value: true });
exports.BuiltArtifact = exports.APISchema = exports.CacheLayerInfo = exports.RefreshExpression = exports.RefreshTime = exports.Sample = exports.ErrorInfo = exports.PaginationSchema = exports.ResponseProperty = exports.RequestSchema = exports.ValidatorDefinition = exports.FieldDataType = exports.FieldInType = exports.PaginationMode = void 0;
const tslib_1 = require("tslib");
// This is the model of our built result
// It will be serialized and deserialized by class-transformer
// https://github.com/typestack/class-transformer/tree/master
// So we should use classes instead of interfaces.
const constraints_1 = require("../lib/validators/constraints");
const class_transformer_1 = require("class-transformer");
require("reflect-metadata");
// Pagination mode should always be UPPERCASE because schema parser will transform the user inputs.
var PaginationMode;
(function (PaginationMode) {
PaginationMode["CURSOR"] = "CURSOR";
PaginationMode["OFFSET"] = "OFFSET";
PaginationMode["KEYSET"] = "KEYSET";
})(PaginationMode = exports.PaginationMode || (exports.PaginationMode = {}));
var FieldInType;
(function (FieldInType) {
FieldInType["QUERY"] = "QUERY";
FieldInType["HEADER"] = "HEADER";
FieldInType["PATH"] = "PATH";
})(FieldInType = exports.FieldInType || (exports.FieldInType = {}));
var FieldDataType;
(function (FieldDataType) {
FieldDataType["BOOLEAN"] = "BOOLEAN";
FieldDataType["NUMBER"] = "NUMBER";
FieldDataType["STRING"] = "STRING";
})(FieldDataType = exports.FieldDataType || (exports.FieldDataType = {}));
class ValidatorDefinition {
}
exports.ValidatorDefinition = ValidatorDefinition;
class RequestSchema {
}
tslib_1.__decorate([
(0, class_transformer_1.Type)(() => constraints_1.Constraint, {
discriminator: constraints_1.ConstraintDiscriminator,
}),
tslib_1.__metadata("design:type", Array)
], RequestSchema.prototype, "constraints", void 0);
exports.RequestSchema = RequestSchema;
class ResponseProperty {
}
exports.ResponseProperty = ResponseProperty;
class PaginationSchema {
}
exports.PaginationSchema = PaginationSchema;
class ErrorInfo {
}
exports.ErrorInfo = ErrorInfo;
class Sample {
}
exports.Sample = Sample;
class RefreshTime {
}
exports.RefreshTime = RefreshTime;
class RefreshExpression {
}
exports.RefreshExpression = RefreshExpression;
class CacheLayerInfo {
}
exports.CacheLayerInfo = CacheLayerInfo;
class APISchema {
}
tslib_1.__decorate([
(0, class_transformer_1.Type)(() => RequestSchema),
tslib_1.__metadata("design:type", Array)
], APISchema.prototype, "request", void 0);
tslib_1.__decorate([
(0, class_transformer_1.Type)(() => ErrorInfo),
tslib_1.__metadata("design:type", Array)
], APISchema.prototype, "errors", void 0);
tslib_1.__decorate([
(0, class_transformer_1.Type)(() => ResponseProperty),
tslib_1.__metadata("design:type", Array)
], APISchema.prototype, "response", void 0);
exports.APISchema = APISchema;
class BuiltArtifact {
}
tslib_1.__decorate([
(0, class_transformer_1.Type)(() => APISchema),
tslib_1.__metadata("design:type", Array)
], BuiltArtifact.prototype, "schemas", void 0);
exports.BuiltArtifact = BuiltArtifact;
//# sourceMappingURL=artifact.js.map