ts-comply
Version:
TypeTools is a Typescript library for providing extensible tooling runtime validations and type helpers.
101 lines • 5.73 kB
JavaScript
;
var __extends = (this && this.__extends) || (function () {
var extendStatics = function (d, b) {
extendStatics = Object.setPrototypeOf ||
({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };
return extendStatics(d, b);
};
return function (d, b) {
if (typeof b !== "function" && b !== null)
throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");
extendStatics(d, b);
function __() { this.constructor = d; }
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
};
})();
var __makeTemplateObject = (this && this.__makeTemplateObject) || function (cooked, raw) {
if (Object.defineProperty) { Object.defineProperty(cooked, "raw", { value: raw }); } else { cooked.raw = raw; }
return cooked;
};
var __runInitializers = (this && this.__runInitializers) || function (thisArg, initializers, value) {
var useValue = arguments.length > 2;
for (var i = 0; i < initializers.length; i++) {
value = useValue ? initializers[i].call(thisArg, value) : initializers[i].call(thisArg);
}
return useValue ? value : void 0;
};
var __esDecorate = (this && this.__esDecorate) || function (ctor, descriptorIn, decorators, contextIn, initializers, extraInitializers) {
function accept(f) { if (f !== void 0 && typeof f !== "function") throw new TypeError("Function expected"); return f; }
var kind = contextIn.kind, key = kind === "getter" ? "get" : kind === "setter" ? "set" : "value";
var target = !descriptorIn && ctor ? contextIn["static"] ? ctor : ctor.prototype : null;
var descriptor = descriptorIn || (target ? Object.getOwnPropertyDescriptor(target, contextIn.name) : {});
var _, done = false;
for (var i = decorators.length - 1; i >= 0; i--) {
var context = {};
for (var p in contextIn) context[p] = p === "access" ? {} : contextIn[p];
for (var p in contextIn.access) context.access[p] = contextIn.access[p];
context.addInitializer = function (f) { if (done) throw new TypeError("Cannot add initializers after decoration has completed"); extraInitializers.push(accept(f || null)); };
var result = (0, decorators[i])(kind === "accessor" ? { get: descriptor.get, set: descriptor.set } : descriptor[key], context);
if (kind === "accessor") {
if (result === void 0) continue;
if (result === null || typeof result !== "object") throw new TypeError("Object expected");
if (_ = accept(result.get)) descriptor.get = _;
if (_ = accept(result.set)) descriptor.set = _;
if (_ = accept(result.init)) initializers.push(_);
}
else if (_ = accept(result)) {
if (kind === "field") initializers.push(_);
else descriptor[key] = _;
}
}
if (target) Object.defineProperty(target, contextIn.name, descriptor);
done = true;
};
var _this = this;
Object.defineProperty(exports, "__esModule", { value: true });
exports.SampleServer = void 0;
var globals_ix_1 = require("../../../src/common/globals.ix");
var security_common_1 = require("../../../src/common/security/security.common");
var http_shim_1 = require("../http.shim");
var scopeName = "authsrv;pid=".concat(process.pid);
var roles = {
ADMIN: 1,
};
var SampleServer = exports.SampleServer = function () {
var _a;
var _instanceExtraInitializers = [];
var _terminalIn_decorators;
return _a = (function (_super) {
__extends(SampleServer, _super);
function SampleServer() {
var _this = _super.call(this, {
name: 'sample-server',
type: http_shim_1.HttpBaseLib.EXPRESS,
scopeName: scopeName,
security: {
accessor: { required: false, baseToken: '<secret.sampleServer.default.token>' },
secureChannel: { enabled: true, required: false, encryption: security_common_1.SecureChannelTypes.ECC_4Q, signingKey: '<secret.sampleServer.default.signingKey>' },
},
startOptions: { port: (0, globals_ix_1.toBe)(templateObject_1 || (templateObject_1 = __makeTemplateObject(["<secret.sampleServer.default.port ?: number:17082>"], ["<secret.sampleServer.default.port ?: number:17082>"]))) },
}) || this;
__runInitializers(_this, _instanceExtraInitializers);
_this.apiVersion = 'v1';
_this.apiPath = _this.configGlobal.api.basePath;
_this.addDefaultProcessor(http_shim_1.ReqProcessor.BASIC, http_shim_1.ReqProcessor.AUTH);
return _this;
}
SampleServer.prototype.test = function () { };
SampleServer.prototype.terminalIn = function (op) {
op.res.returnJson({ data: op.req.data, params: op.req.params, headers: op.req.headers });
};
return SampleServer;
}(http_shim_1.HttpServerShim)),
(function () {
_terminalIn_decorators = [http_shim_1.HTTP.GET("/terminal-in"), http_shim_1.HTTP.ACCESS({ ADMIN: 1 })];
__esDecorate(_a, null, _terminalIn_decorators, { kind: "method", name: "terminalIn", static: false, private: false, access: { has: function (obj) { return "terminalIn" in obj; }, get: function (obj) { return obj.terminalIn; } } }, null, _instanceExtraInitializers);
})(),
_a;
}();
var templateObject_1;
//# sourceMappingURL=sample.server.js.map