@nextage/omics-lib 1.0.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/build/constants.d.ts +57 -0
- package/build/constants.d.ts.map +1 -0
- package/build/constants.js +24 -0
- package/build/constants.js.map +1 -0
- package/build/enums.d.ts +26 -0
- package/build/enums.d.ts.map +1 -0
- package/build/enums.js +44 -0
- package/build/enums.js.map +1 -0
- package/build/errors/app-error.d.ts +13 -0
- package/build/errors/app-error.d.ts.map +1 -0
- package/build/errors/app-error.js +18 -0
- package/build/errors/app-error.js.map +1 -0
- package/build/errors/authentication-error.d.ts +6 -0
- package/build/errors/authentication-error.d.ts.map +1 -0
- package/build/errors/authentication-error.js +11 -0
- package/build/errors/authentication-error.js.map +1 -0
- package/build/errors/custom-error.d.ts +9 -0
- package/build/errors/custom-error.d.ts.map +1 -0
- package/build/errors/custom-error.js +11 -0
- package/build/errors/custom-error.js.map +1 -0
- package/build/errors/forbidden-error.d.ts +6 -0
- package/build/errors/forbidden-error.d.ts.map +1 -0
- package/build/errors/forbidden-error.js +11 -0
- package/build/errors/forbidden-error.js.map +1 -0
- package/build/errors/index.d.ts +5 -0
- package/build/errors/index.d.ts.map +1 -0
- package/build/errors/index.js +21 -0
- package/build/errors/index.js.map +1 -0
- package/build/index.d.ts +7 -0
- package/build/index.d.ts.map +1 -0
- package/build/index.js +23 -0
- package/build/index.js.map +1 -0
- package/build/interfaces.d.ts +54 -0
- package/build/interfaces.d.ts.map +1 -0
- package/build/interfaces.js +14 -0
- package/build/interfaces.js.map +1 -0
- package/build/models/genotype.d.ts +19 -0
- package/build/models/genotype.d.ts.map +1 -0
- package/build/models/genotype.js +34 -0
- package/build/models/genotype.js.map +1 -0
- package/build/models/index.d.ts +4 -0
- package/build/models/index.d.ts.map +1 -0
- package/build/models/index.js +20 -0
- package/build/models/index.js.map +1 -0
- package/build/models/sample.d.ts +19 -0
- package/build/models/sample.d.ts.map +1 -0
- package/build/models/sample.js +36 -0
- package/build/models/sample.js.map +1 -0
- package/build/models/variant.d.ts +19 -0
- package/build/models/variant.d.ts.map +1 -0
- package/build/models/variant.js +45 -0
- package/build/models/variant.js.map +1 -0
- package/build/routes/express.interfaces.d.ts +11 -0
- package/build/routes/express.interfaces.d.ts.map +1 -0
- package/build/routes/express.interfaces.js +10 -0
- package/build/routes/express.interfaces.js.map +1 -0
- package/build/routes/index.d.ts +3 -0
- package/build/routes/index.d.ts.map +1 -0
- package/build/routes/index.js +19 -0
- package/build/routes/index.js.map +1 -0
- package/build/routes/swagger.d.ts +13 -0
- package/build/routes/swagger.d.ts.map +1 -0
- package/build/routes/swagger.js +13 -0
- package/build/routes/swagger.js.map +1 -0
- package/build/routes/validators.d.ts +11 -0
- package/build/routes/validators.d.ts.map +1 -0
- package/build/routes/validators.js +17 -0
- package/build/routes/validators.js.map +1 -0
- package/build/services/index.d.ts +2 -0
- package/build/services/index.d.ts.map +1 -0
- package/build/services/index.js +18 -0
- package/build/services/index.js.map +1 -0
- package/build/services/password.d.ts +5 -0
- package/build/services/password.d.ts.map +1 -0
- package/build/services/password.js +20 -0
- package/build/services/password.js.map +1 -0
- package/build/types/genotype.d.ts +11 -0
- package/build/types/genotype.d.ts.map +1 -0
- package/build/types/genotype.js +3 -0
- package/build/types/genotype.js.map +1 -0
- package/build/types/index.d.ts +4 -0
- package/build/types/index.d.ts.map +1 -0
- package/build/types/index.js +20 -0
- package/build/types/index.js.map +1 -0
- package/build/types/sample.d.ts +13 -0
- package/build/types/sample.d.ts.map +1 -0
- package/build/types/sample.js +3 -0
- package/build/types/sample.js.map +1 -0
- package/build/types/variant.d.ts +22 -0
- package/build/types/variant.d.ts.map +1 -0
- package/build/types/variant.js +3 -0
- package/build/types/variant.js.map +1 -0
- package/build/utils/express.d.ts +37 -0
- package/build/utils/express.d.ts.map +1 -0
- package/build/utils/express.js +114 -0
- package/build/utils/express.js.map +1 -0
- package/build/utils/functs.d.ts +46 -0
- package/build/utils/functs.d.ts.map +1 -0
- package/build/utils/functs.js +128 -0
- package/build/utils/functs.js.map +1 -0
- package/build/utils/index.d.ts +3 -0
- package/build/utils/index.d.ts.map +1 -0
- package/build/utils/index.js +19 -0
- package/build/utils/index.js.map +1 -0
- package/package.json +66 -0
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import mongoose from 'mongoose';
|
|
2
|
+
import { IVariant } from '../types';
|
|
3
|
+
export interface VariantAttrs extends IVariant {
|
|
4
|
+
createdAt?: Date;
|
|
5
|
+
updatedAt?: Date;
|
|
6
|
+
deletedAt?: Date;
|
|
7
|
+
version?: number;
|
|
8
|
+
}
|
|
9
|
+
export interface VariantDoc extends mongoose.Document {
|
|
10
|
+
createdAt?: Date;
|
|
11
|
+
updatedAt?: Date;
|
|
12
|
+
deletedAt?: Date;
|
|
13
|
+
version: number;
|
|
14
|
+
}
|
|
15
|
+
export interface VariantModel extends mongoose.Model<VariantDoc> {
|
|
16
|
+
build(attrs: VariantAttrs): VariantDoc;
|
|
17
|
+
}
|
|
18
|
+
export declare const Variant: VariantModel;
|
|
19
|
+
//# sourceMappingURL=variant.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"variant.d.ts","sourceRoot":"","sources":["../../src/models/variant.ts"],"names":[],"mappings":"AAAA,OAAO,QAAQ,MAAuB,UAAU,CAAC;AAEjD,OAAO,EAAE,QAAQ,EAAE,MAAkB,UAAU,CAAC;AAEhD,MAAM,WAAW,YAAa,SAAQ,QAAQ;IAC5C,SAAS,CAAC,EAAE,IAAI,CAAC;IACjB,SAAS,CAAC,EAAE,IAAI,CAAC;IACjB,SAAS,CAAC,EAAE,IAAI,CAAC;IACjB,OAAO,CAAC,EAAI,MAAM,CAAC;CACpB;AAED,MAAM,WAAW,UAAW,SAAQ,QAAQ,CAAC,QAAQ;IACnD,SAAS,CAAC,EAAE,IAAI,CAAC;IACjB,SAAS,CAAC,EAAE,IAAI,CAAC;IACjB,SAAS,CAAC,EAAE,IAAI,CAAC;IACjB,OAAO,EAAK,MAAM,CAAC;CACpB;AAED,MAAM,WAAW,YAAa,SAAQ,QAAQ,CAAC,KAAK,CAAC,UAAU,CAAC;IAC9D,KAAK,CAAC,KAAK,EAAE,YAAY,GAAG,UAAU,CAAC;CACxC;AA4CD,eAAO,MAAM,OAAO,cAA8D,CAAC"}
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
exports.Variant = void 0;
|
|
7
|
+
const mongoose_1 = __importDefault(require("mongoose"));
|
|
8
|
+
const mongoose_update_if_current_1 = require("mongoose-update-if-current");
|
|
9
|
+
const AnnotationSchema = new mongoose_1.default.Schema({
|
|
10
|
+
gene: { type: String },
|
|
11
|
+
consequence: { type: String },
|
|
12
|
+
transcript: { type: String },
|
|
13
|
+
hgvsc: { type: String },
|
|
14
|
+
hgvsp: { type: String },
|
|
15
|
+
proteinPosition: { type: String },
|
|
16
|
+
codons: { type: String },
|
|
17
|
+
exon: { type: String }
|
|
18
|
+
}, { _id: false });
|
|
19
|
+
const schema = new mongoose_1.default.Schema({
|
|
20
|
+
variantId: { type: String, required: true, unique: true },
|
|
21
|
+
chrom: { type: String },
|
|
22
|
+
pos: { type: Number },
|
|
23
|
+
ref: { type: String },
|
|
24
|
+
alt: { type: [String] },
|
|
25
|
+
type: { type: String },
|
|
26
|
+
classification: { type: String },
|
|
27
|
+
annotations: { type: AnnotationSchema },
|
|
28
|
+
createdAt: { type: Date },
|
|
29
|
+
updatedAt: { type: Date },
|
|
30
|
+
deletedAt: { type: Date }
|
|
31
|
+
}, {
|
|
32
|
+
toJSON: {
|
|
33
|
+
transform(doc, ret) {
|
|
34
|
+
ret.id = ret._id;
|
|
35
|
+
delete ret._id;
|
|
36
|
+
},
|
|
37
|
+
},
|
|
38
|
+
});
|
|
39
|
+
schema.set('versionKey', 'version');
|
|
40
|
+
schema.plugin(mongoose_update_if_current_1.updateIfCurrentPlugin);
|
|
41
|
+
schema.statics.build = (attrs) => {
|
|
42
|
+
return new exports.Variant(attrs);
|
|
43
|
+
};
|
|
44
|
+
exports.Variant = mongoose_1.default.model('Variant', schema);
|
|
45
|
+
//# sourceMappingURL=variant.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"variant.js","sourceRoot":"","sources":["../../src/models/variant.ts"],"names":[],"mappings":";;;;;;AAAA,wDAAiD;AACjD,2EAAmE;AAqBnE,MAAM,gBAAgB,GAAG,IAAI,kBAAQ,CAAC,MAAM,CAAC;IAC3C,IAAI,EAAa,EAAE,IAAI,EAAE,MAAM,EAAE;IACjC,WAAW,EAAM,EAAE,IAAI,EAAE,MAAM,EAAE;IACjC,UAAU,EAAO,EAAE,IAAI,EAAE,MAAM,EAAE;IACjC,KAAK,EAAY,EAAE,IAAI,EAAE,MAAM,EAAE;IACjC,KAAK,EAAY,EAAE,IAAI,EAAE,MAAM,EAAE;IACjC,eAAe,EAAE,EAAE,IAAI,EAAE,MAAM,EAAE;IACjC,MAAM,EAAW,EAAE,IAAI,EAAE,MAAM,EAAE;IACjC,IAAI,EAAa,EAAE,IAAI,EAAE,MAAM,EAAE;CAClC,EAAE,EAAE,GAAG,EAAE,KAAK,EAAE,CAAC,CAAC;AAEnB,MAAM,MAAM,GAAG,IAAI,kBAAQ,CAAC,MAAM,CAChC;IACE,SAAS,EAAO,EAAE,IAAI,EAAE,MAAM,EAAE,QAAQ,EAAE,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE;IAC9D,KAAK,EAAW,EAAE,IAAI,EAAE,MAAM,EAAE;IAChC,GAAG,EAAa,EAAE,IAAI,EAAE,MAAM,EAAE;IAChC,GAAG,EAAa,EAAE,IAAI,EAAE,MAAM,EAAE;IAChC,GAAG,EAAa,EAAE,IAAI,EAAE,CAAC,MAAM,CAAC,EAAE;IAClC,IAAI,EAAY,EAAE,IAAI,EAAE,MAAM,EAAE;IAChC,cAAc,EAAE,EAAE,IAAI,EAAE,MAAM,EAAE;IAChC,WAAW,EAAK,EAAE,IAAI,EAAE,gBAAgB,EAAE;IAC1C,SAAS,EAAO,EAAE,IAAI,EAAE,IAAI,EAAE;IAC9B,SAAS,EAAO,EAAE,IAAI,EAAE,IAAI,EAAE;IAC9B,SAAS,EAAO,EAAE,IAAI,EAAE,IAAI,EAAE;CAC/B,EACD;IACE,MAAM,EAAE;QACN,SAAS,CAAC,GAAG,EAAE,GAAQ;YACrB,GAAG,CAAC,EAAE,GAAG,GAAG,CAAC,GAAG,CAAC;YACjB,OAAO,GAAG,CAAC,GAAG,CAAC;QACjB,CAAC;KACF;CACF,CACF,CAAC;AAEF,MAAM,CAAC,GAAG,CAAC,YAAY,EAAE,SAAS,CAAC,CAAC;AACpC,MAAM,CAAC,MAAM,CAAC,kDAAqB,CAAC,CAAC;AAErC,MAAM,CAAC,OAAO,CAAC,KAAK,GAAG,CAAC,KAAmB,EAAE,EAAE;IAC7C,OAAO,IAAI,eAAO,CAAC,KAAK,CAAC,CAAC;AAC5B,CAAC,CAAC;AAEW,QAAA,OAAO,GAAG,kBAAQ,CAAC,KAAK,CAA2B,SAAS,EAAE,MAAM,CAAC,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"express.interfaces.d.ts","sourceRoot":"","sources":["../../src/routes/express.interfaces.ts"],"names":[],"mappings":"AAGA,MAAM,WAAW,aAAc,SAAQ,KAAK;IAC1C,MAAM,CAAC,EAAG,MAAM,CAAC;CAClB;AAED,MAAM,WAAW,kBAAkB;IACjC,MAAM,EAAE;QAAE,MAAM,EAAE,MAAM,EAAE,CAAC;QAAC,IAAI,EAAE,MAAM,CAAC;QAAC,OAAO,EAAE,MAAM,CAAC;KAAE,CAAC;CAC9D"}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
// export interface AuthRequest extends Request {
|
|
4
|
+
// auth? : AuthRequestContext;
|
|
5
|
+
// }
|
|
6
|
+
// export interface AuthRequestContext extends JwtPayload {
|
|
7
|
+
// user?: UserDoc | null;
|
|
8
|
+
// err? : ErrorResponse;
|
|
9
|
+
// }
|
|
10
|
+
//# sourceMappingURL=express.interfaces.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"express.interfaces.js","sourceRoot":"","sources":["../../src/routes/express.interfaces.ts"],"names":[],"mappings":";;AAWA,iDAAiD;AACjD,gCAAgC;AAChC,IAAI;AAEJ,2DAA2D;AAC3D,2BAA2B;AAC3B,0BAA0B;AAC1B,IAAI"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/routes/index.ts"],"names":[],"mappings":"AAAA,cAAc,WAAW,CAAC;AAC1B,cAAc,cAAc,CAAC"}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
14
|
+
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
|
+
};
|
|
16
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
+
__exportStar(require("./swagger"), exports);
|
|
18
|
+
__exportStar(require("./validators"), exports);
|
|
19
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/routes/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,4CAA0B;AAC1B,+CAA6B"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"swagger.d.ts","sourceRoot":"","sources":["../../src/routes/swagger.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,WAAW;;;;;;;;;;CAOvB,CAAC;AAEF,eAAO,MAAM,QAAQ,IAAK,CAAA"}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.examples = exports.definitions = void 0;
|
|
4
|
+
exports.definitions = {
|
|
5
|
+
AppStatus: {
|
|
6
|
+
type: 'object',
|
|
7
|
+
properties: {
|
|
8
|
+
status: { type: 'string', example: 'OK' },
|
|
9
|
+
}
|
|
10
|
+
}
|
|
11
|
+
};
|
|
12
|
+
exports.examples = {};
|
|
13
|
+
//# sourceMappingURL=swagger.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"swagger.js","sourceRoot":"","sources":["../../src/routes/swagger.ts"],"names":[],"mappings":";;;AAAa,QAAA,WAAW,GAAG;IACzB,SAAS,EAAE;QACT,IAAI,EAAQ,QAAQ;QACpB,UAAU,EAAE;YACV,MAAM,EAAE,EAAE,IAAI,EAAE,QAAQ,EAAE,OAAO,EAAE,IAAI,EAAE;SAC1C;KACF;CACF,CAAC;AAEW,QAAA,QAAQ,GAAG,EAAE,CAAA"}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { Result, Schema, ValidationError } from 'express-validator';
|
|
2
|
+
import { DefaultSchemaKeys } from 'express-validator/lib/middlewares/schema';
|
|
3
|
+
import { ExpressErrorResult } from './express.interfaces';
|
|
4
|
+
export declare const idSchema: Schema<DefaultSchemaKeys>;
|
|
5
|
+
/**
|
|
6
|
+
*
|
|
7
|
+
* @param {*} errors
|
|
8
|
+
* @returns
|
|
9
|
+
*/
|
|
10
|
+
export declare function formatErrors(errors: Result<ValidationError>): ExpressErrorResult;
|
|
11
|
+
//# sourceMappingURL=validators.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"validators.d.ts","sourceRoot":"","sources":["../../src/routes/validators.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,MAAM,EAAE,MAAM,EAAE,eAAe,EAAE,MAAM,mBAAmB,CAAC;AACpE,OAAO,EAAE,iBAAiB,EAAE,MAAoB,0CAA0C,CAAC;AAE3F,OAAO,EAAE,kBAAkB,EAAE,MAAmB,sBAAsB,CAAC;AAEvE,eAAO,MAAM,QAAQ,EAAE,MAAM,CAAC,iBAAiB,CAE9C,CAAC;AAIF;;;;GAIG;AACF,wBAAgB,YAAY,CAAC,MAAM,EAAE,MAAM,CAAC,eAAe,CAAC,GAAG,kBAAkB,CAGjF"}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.idSchema = void 0;
|
|
4
|
+
exports.formatErrors = formatErrors;
|
|
5
|
+
const constants_1 = require("../constants");
|
|
6
|
+
exports.idSchema = {
|
|
7
|
+
id: { in: ['body', 'params', 'query'], isMongoId: true }
|
|
8
|
+
};
|
|
9
|
+
/**
|
|
10
|
+
*
|
|
11
|
+
* @param {*} errors
|
|
12
|
+
* @returns
|
|
13
|
+
*/
|
|
14
|
+
function formatErrors(errors) {
|
|
15
|
+
return { result: Object.assign({ fields: errors.array().map((e) => e.params) }, constants_1.RES_CODE.INCORRECT_DATA) };
|
|
16
|
+
}
|
|
17
|
+
//# sourceMappingURL=validators.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"validators.js","sourceRoot":"","sources":["../../src/routes/validators.ts"],"names":[],"mappings":";;;AAiBC,oCAGA;AAjBD,4CAA+D;AAGlD,QAAA,QAAQ,GAA8B;IACjD,EAAE,EAAE,EAAE,EAAE,EAAE,CAAC,MAAM,EAAE,QAAQ,EAAE,OAAO,CAAC,EAAE,SAAS,EAAE,IAAI,EAAE;CACzD,CAAC;AAIF;;;;GAIG;AACF,SAAgB,YAAY,CAAC,MAA+B;IAE3D,OAAO,EAAE,MAAM,EAAE,MAAM,CAAC,MAAM,CAAC,EAAE,MAAM,EAAE,MAAM,CAAC,KAAK,EAAE,CAAC,GAAG,CAAC,CAAC,CAAM,EAAE,EAAE,CAAC,CAAC,CAAC,MAAM,CAAC,EAAE,EAAE,oBAAQ,CAAC,cAAc,CAAC,EAAE,CAAC;AAClH,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/services/index.ts"],"names":[],"mappings":"AAAA,cAAc,YAAY,CAAC"}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
14
|
+
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
|
+
};
|
|
16
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
+
__exportStar(require("./password"), exports);
|
|
18
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/services/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,6CAA2B"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"password.d.ts","sourceRoot":"","sources":["../../src/services/password.ts"],"names":[],"mappings":"AAKA,qBAAa,QAAQ;WAEN,MAAM,CAAC,QAAQ,EAAE,MAAM;WAQvB,OAAO,CAAC,cAAc,EAAE,MAAM,EAAE,gBAAgB,EAAE,MAAM;CAMtE"}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.Password = void 0;
|
|
4
|
+
const crypto_1 = require("crypto");
|
|
5
|
+
const util_1 = require("util");
|
|
6
|
+
const scriptAsync = (0, util_1.promisify)(crypto_1.scrypt);
|
|
7
|
+
class Password {
|
|
8
|
+
static async toHash(password) {
|
|
9
|
+
const salt = (0, crypto_1.randomBytes)(8).toString('hex');
|
|
10
|
+
const buf = (await scriptAsync(password, salt, 64));
|
|
11
|
+
return `${buf.toString('hex')}.${salt}`;
|
|
12
|
+
}
|
|
13
|
+
static async compare(storedPassword, suppliedPassword) {
|
|
14
|
+
const [hashedPassword, salt] = storedPassword.split('.');
|
|
15
|
+
const buf = (await scriptAsync(suppliedPassword, salt, 64));
|
|
16
|
+
return buf.toString('hex') === hashedPassword;
|
|
17
|
+
}
|
|
18
|
+
}
|
|
19
|
+
exports.Password = Password;
|
|
20
|
+
//# sourceMappingURL=password.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"password.js","sourceRoot":"","sources":["../../src/services/password.ts"],"names":[],"mappings":";;;AAAA,mCAA6C;AAC7C,+BAA2C;AAE3C,MAAM,WAAW,GAAG,IAAA,gBAAS,EAAC,eAAM,CAAC,CAAC;AAEtC,MAAa,QAAQ;IAEnB,MAAM,CAAC,KAAK,CAAC,MAAM,CAAC,QAAgB;QAElC,MAAM,IAAI,GAAG,IAAA,oBAAW,EAAC,CAAC,CAAC,CAAC,QAAQ,CAAC,KAAK,CAAC,CAAC;QAC5C,MAAM,GAAG,GAAI,CAAC,MAAM,WAAW,CAAC,QAAQ,EAAE,IAAI,EAAE,EAAE,CAAC,CAAW,CAAC;QAE/D,OAAO,GAAG,GAAG,CAAC,QAAQ,CAAC,KAAK,CAAC,IAAI,IAAI,EAAE,CAAC;IAC1C,CAAC;IAED,MAAM,CAAC,KAAK,CAAC,OAAO,CAAC,cAAsB,EAAE,gBAAwB;QACnE,MAAM,CAAC,cAAc,EAAE,IAAI,CAAC,GAAG,cAAc,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC;QACzD,MAAM,GAAG,GAAsB,CAAC,MAAM,WAAW,CAAC,gBAAgB,EAAE,IAAI,EAAE,EAAE,CAAC,CAAW,CAAC;QAEzF,OAAO,GAAG,CAAC,QAAQ,CAAC,KAAK,CAAC,KAAK,cAAc,CAAC;IAChD,CAAC;CACF;AAhBD,4BAgBC"}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { BaseDBItem } from '../interfaces';
|
|
2
|
+
export interface IGenotype extends BaseDBItem {
|
|
3
|
+
variantId: string;
|
|
4
|
+
sampleId: string;
|
|
5
|
+
sequencingSampleId: string;
|
|
6
|
+
GT: string;
|
|
7
|
+
VAF: number;
|
|
8
|
+
DP: number;
|
|
9
|
+
alleles: string[];
|
|
10
|
+
}
|
|
11
|
+
//# sourceMappingURL=genotype.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"genotype.d.ts","sourceRoot":"","sources":["../../src/types/genotype.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,eAAe,CAAA;AAE1C,MAAM,WAAW,SAAU,SAAQ,UAAU;IAC3C,SAAS,EAAW,MAAM,CAAC;IAC3B,QAAQ,EAAY,MAAM,CAAC;IAC3B,kBAAkB,EAAE,MAAM,CAAC;IAC3B,EAAE,EAAkB,MAAM,CAAC;IAC3B,GAAG,EAAiB,MAAM,CAAC;IAC3B,EAAE,EAAkB,MAAM,CAAC;IAC3B,OAAO,EAAa,MAAM,EAAE,CAAC;CAC9B"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"genotype.js","sourceRoot":"","sources":["../../src/types/genotype.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/types/index.ts"],"names":[],"mappings":"AAAA,cAAc,YAAY,CAAC;AAC3B,cAAc,UAAU,CAAC;AACzB,cAAc,WAAW,CAAC"}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
14
|
+
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
|
+
};
|
|
16
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
+
__exportStar(require("./genotype"), exports);
|
|
18
|
+
__exportStar(require("./sample"), exports);
|
|
19
|
+
__exportStar(require("./variant"), exports);
|
|
20
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/types/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,6CAA2B;AAC3B,2CAAyB;AACzB,4CAA0B"}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { BaseDBItem } from '../interfaces';
|
|
2
|
+
export interface ISample extends BaseDBItem {
|
|
3
|
+
biobankSampleId: string;
|
|
4
|
+
sequencingSampleId: string;
|
|
5
|
+
clinical: SampleClinicalData;
|
|
6
|
+
}
|
|
7
|
+
export interface SampleClinicalData {
|
|
8
|
+
diagnosis: string;
|
|
9
|
+
snomedM: string;
|
|
10
|
+
snomedT: string;
|
|
11
|
+
tumorSite: string;
|
|
12
|
+
}
|
|
13
|
+
//# sourceMappingURL=sample.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"sample.d.ts","sourceRoot":"","sources":["../../src/types/sample.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,eAAe,CAAA;AAE1C,MAAM,WAAW,OAAQ,SAAQ,UAAU;IACzC,eAAe,EAAK,MAAM,CAAC;IAC3B,kBAAkB,EAAE,MAAM,CAAC;IAC3B,QAAQ,EAAY,kBAAkB,CAAC;CACxC;AAED,MAAM,WAAW,kBAAkB;IACjC,SAAS,EAAE,MAAM,CAAC;IAClB,OAAO,EAAI,MAAM,CAAC;IAClB,OAAO,EAAI,MAAM,CAAC;IAClB,SAAS,EAAE,MAAM,CAAC;CACnB"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"sample.js","sourceRoot":"","sources":["../../src/types/sample.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { BaseDBItem } from '../interfaces';
|
|
2
|
+
export interface IVariant extends BaseDBItem {
|
|
3
|
+
variantId: string;
|
|
4
|
+
chrom: string;
|
|
5
|
+
pos: number;
|
|
6
|
+
ref: string;
|
|
7
|
+
alt: string[];
|
|
8
|
+
type: string;
|
|
9
|
+
classification: string;
|
|
10
|
+
annotations: VariantAnnotation;
|
|
11
|
+
}
|
|
12
|
+
export interface VariantAnnotation {
|
|
13
|
+
gene: string;
|
|
14
|
+
consequence: string;
|
|
15
|
+
transcript: string;
|
|
16
|
+
hgvsc: string;
|
|
17
|
+
hgvsp: string;
|
|
18
|
+
proteinPosition: string;
|
|
19
|
+
codons: string;
|
|
20
|
+
exon: string;
|
|
21
|
+
}
|
|
22
|
+
//# sourceMappingURL=variant.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"variant.d.ts","sourceRoot":"","sources":["../../src/types/variant.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,eAAe,CAAA;AAE1C,MAAM,WAAW,QAAS,SAAQ,UAAU;IAC1C,SAAS,EAAO,MAAM,CAAC;IACvB,KAAK,EAAW,MAAM,CAAC;IACvB,GAAG,EAAa,MAAM,CAAC;IACvB,GAAG,EAAa,MAAM,CAAC;IACvB,GAAG,EAAa,MAAM,EAAE,CAAC;IACzB,IAAI,EAAY,MAAM,CAAC;IACvB,cAAc,EAAE,MAAM,CAAC;IACvB,WAAW,EAAK,iBAAiB,CAAC;CACnC;AAED,MAAM,WAAW,iBAAiB;IAChC,IAAI,EAAa,MAAM,CAAC;IACxB,WAAW,EAAM,MAAM,CAAC;IACxB,UAAU,EAAO,MAAM,CAAC;IACxB,KAAK,EAAY,MAAM,CAAC;IACxB,KAAK,EAAY,MAAM,CAAC;IACxB,eAAe,EAAE,MAAM,CAAC;IACxB,MAAM,EAAW,MAAM,CAAC;IACxB,IAAI,EAAa,MAAM,CAAC;CACzB"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"variant.js","sourceRoot":"","sources":["../../src/types/variant.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
import { Request, Response, NextFunction, Handler } from 'express';
|
|
2
|
+
import { ValidationError, Result, Schema } from 'express-validator';
|
|
3
|
+
import { DefaultSchemaKeys } from 'express-validator/lib/middlewares/schema';
|
|
4
|
+
/**
|
|
5
|
+
*
|
|
6
|
+
* @param schema
|
|
7
|
+
* @param errorFormatter
|
|
8
|
+
* @returns
|
|
9
|
+
*/
|
|
10
|
+
export declare function validateSchema(schema: Schema<DefaultSchemaKeys>, errorFormatter?: (err: Result<ValidationError>, req: Request) => Result<ValidationError>): (req: Request, res: Response, next: NextFunction) => void;
|
|
11
|
+
/**
|
|
12
|
+
*
|
|
13
|
+
* @param {*} res
|
|
14
|
+
* @param {*} status
|
|
15
|
+
* @param {*} content
|
|
16
|
+
* @returns
|
|
17
|
+
*/
|
|
18
|
+
export declare function sendJSONResponse(res: Response, status?: number, content?: Object): void;
|
|
19
|
+
/**
|
|
20
|
+
* Create an Express middleware function which errors if an HTTP method is not allowed.
|
|
21
|
+
*
|
|
22
|
+
* @access public
|
|
23
|
+
* @param {Array<string>} [methods=[]]
|
|
24
|
+
* The HTTP methods which will not throw 405 errors.
|
|
25
|
+
* @param {string} [message]
|
|
26
|
+
* The error message text to use if a disallowed method is used.
|
|
27
|
+
* @returns {import('express').Handler}
|
|
28
|
+
* Returns a middleware function.
|
|
29
|
+
*/
|
|
30
|
+
export declare function allowMethods(methods?: string[], message?: string): Handler;
|
|
31
|
+
/**
|
|
32
|
+
*
|
|
33
|
+
* @param {*} roles
|
|
34
|
+
* @param {*} condition
|
|
35
|
+
*/
|
|
36
|
+
export declare function authHandler(roles?: string[], condition?: string): (req: Request, res: Response, next: NextFunction) => void;
|
|
37
|
+
//# sourceMappingURL=express.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"express.d.ts","sourceRoot":"","sources":["../../src/utils/express.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,OAAO,EAAE,QAAQ,EAAE,YAAY,EAAE,OAAO,EAAE,MAAU,SAAS,CAAC;AAEvE,OAAO,EAAE,eAAe,EAAE,MAAM,EAAE,MAAM,EAAE,MAAmB,mBAAmB,CAAC;AACjF,OAAO,EAAE,iBAAiB,EAAE,MAAiC,0CAA0C,CAAC;AAMxG;;;;;GAKG;AACH,wBAAgB,cAAc,CAAC,MAAM,EAAE,MAAM,CAAC,iBAAiB,CAAC,EAAE,cAAc,IAAI,KAAK,MAAM,CAAC,eAAe,CAAC,EAAE,KAAK,OAAO,4BAAQ,IAE5H,KAAK,OAAO,EAAE,KAAK,QAAQ,EAAE,MAAM,YAAY,UAYxD;AAED;;;;;;GAMG;AACH,wBAAgB,gBAAgB,CAAC,GAAG,EAAE,QAAQ,EAAE,MAAM,GAAE,MAAY,EAAE,OAAO,GAAE,MAAW,QAMzF;AAED;;;;;;;;;;GAUG;AACH,wBAAgB,YAAY,CAAC,OAAO,GAAE,MAAM,EAAO,EAAE,OAAO,GAAE,MAA6B,GAAG,OAAO,CAcpG;AAoBD;;;;GAIG;AACH,wBAAgB,WAAW,CAAC,KAAK,CAAC,EAAE,MAAM,EAAE,EAAE,SAAS,CAAC,EAAE,MAAM,IAEtD,KAAK,OAAO,EAAE,KAAK,QAAQ,EAAE,MAAM,YAAY,UAkCxD"}
|
|
@@ -0,0 +1,114 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
exports.validateSchema = validateSchema;
|
|
7
|
+
exports.sendJSONResponse = sendJSONResponse;
|
|
8
|
+
exports.allowMethods = allowMethods;
|
|
9
|
+
exports.authHandler = authHandler;
|
|
10
|
+
const http_errors_1 = __importDefault(require("http-errors"));
|
|
11
|
+
const express_validator_1 = require("express-validator");
|
|
12
|
+
const constants_1 = require("../constants");
|
|
13
|
+
const functs_1 = require("./functs");
|
|
14
|
+
const authentication_error_1 = require("../errors/authentication-error");
|
|
15
|
+
const forbidden_error_1 = require("../errors/forbidden-error");
|
|
16
|
+
/**
|
|
17
|
+
*
|
|
18
|
+
* @param schema
|
|
19
|
+
* @param errorFormatter
|
|
20
|
+
* @returns
|
|
21
|
+
*/
|
|
22
|
+
function validateSchema(schema, errorFormatter = (err, req) => err) {
|
|
23
|
+
return (req, res, next) => {
|
|
24
|
+
(0, express_validator_1.checkSchema)(schema).run(req).then((aaa) => {
|
|
25
|
+
const errors = (0, express_validator_1.validationResult)(req);
|
|
26
|
+
if (errors.isEmpty())
|
|
27
|
+
return next();
|
|
28
|
+
res.status(400).json(errorFormatter(errors, req));
|
|
29
|
+
});
|
|
30
|
+
};
|
|
31
|
+
}
|
|
32
|
+
/**
|
|
33
|
+
*
|
|
34
|
+
* @param {*} res
|
|
35
|
+
* @param {*} status
|
|
36
|
+
* @param {*} content
|
|
37
|
+
* @returns
|
|
38
|
+
*/
|
|
39
|
+
function sendJSONResponse(res, status = 200, content = {}) {
|
|
40
|
+
if (!res)
|
|
41
|
+
return;
|
|
42
|
+
res.status(status);
|
|
43
|
+
res.json(content);
|
|
44
|
+
}
|
|
45
|
+
/**
|
|
46
|
+
* Create an Express middleware function which errors if an HTTP method is not allowed.
|
|
47
|
+
*
|
|
48
|
+
* @access public
|
|
49
|
+
* @param {Array<string>} [methods=[]]
|
|
50
|
+
* The HTTP methods which will not throw 405 errors.
|
|
51
|
+
* @param {string} [message]
|
|
52
|
+
* The error message text to use if a disallowed method is used.
|
|
53
|
+
* @returns {import('express').Handler}
|
|
54
|
+
* Returns a middleware function.
|
|
55
|
+
*/
|
|
56
|
+
function allowMethods(methods = [], message = 'Method Not Allowed') {
|
|
57
|
+
const normalizedMethods = normalizeAllowedMethods(methods);
|
|
58
|
+
return (request, response, next) => {
|
|
59
|
+
if (!normalizedMethods.includes(request.method.toUpperCase())) {
|
|
60
|
+
response.header('Allow', normalizedMethods.join(', '));
|
|
61
|
+
return next((0, http_errors_1.default)(405, message));
|
|
62
|
+
}
|
|
63
|
+
next();
|
|
64
|
+
};
|
|
65
|
+
}
|
|
66
|
+
;
|
|
67
|
+
/**
|
|
68
|
+
* Normalise an array of HTTP methods.
|
|
69
|
+
*
|
|
70
|
+
* @access private
|
|
71
|
+
* @param {Array<string>} methods
|
|
72
|
+
* The HTTP methods to normalise.
|
|
73
|
+
* @returns {Array<string>}
|
|
74
|
+
* Returns an array of capitalised HTTP methods.
|
|
75
|
+
*/
|
|
76
|
+
function normalizeAllowedMethods(methods) {
|
|
77
|
+
if (!Array.isArray(methods))
|
|
78
|
+
return [];
|
|
79
|
+
return methods.filter(method => typeof method === 'string')
|
|
80
|
+
.map(method => method.toUpperCase());
|
|
81
|
+
}
|
|
82
|
+
/**
|
|
83
|
+
*
|
|
84
|
+
* @param {*} roles
|
|
85
|
+
* @param {*} condition
|
|
86
|
+
*/
|
|
87
|
+
function authHandler(roles, condition) {
|
|
88
|
+
return (req, res, next) => {
|
|
89
|
+
const user = (0, functs_1.getAttr)(req, 'context.user');
|
|
90
|
+
if (!user) {
|
|
91
|
+
sendJSONResponse(res, 401, constants_1.RES_CODE.AUTH_REQUIRED);
|
|
92
|
+
next(new authentication_error_1.AuthenticationError('messages.authentication.required'));
|
|
93
|
+
return;
|
|
94
|
+
}
|
|
95
|
+
if (roles) {
|
|
96
|
+
let hasRoles = true;
|
|
97
|
+
switch (condition) {
|
|
98
|
+
case '&&':
|
|
99
|
+
hasRoles = roles.every(role => user.roles.indexOf(role) >= 0);
|
|
100
|
+
break;
|
|
101
|
+
case '||':
|
|
102
|
+
default:
|
|
103
|
+
hasRoles = roles.some(role => user.roles.indexOf(role) >= 0);
|
|
104
|
+
break;
|
|
105
|
+
}
|
|
106
|
+
if (!hasRoles) {
|
|
107
|
+
sendJSONResponse(res, 401, constants_1.RES_CODE.FORBIDDEN);
|
|
108
|
+
throw new forbidden_error_1.ForbiddenError('messages.authorization.failed');
|
|
109
|
+
}
|
|
110
|
+
}
|
|
111
|
+
next();
|
|
112
|
+
};
|
|
113
|
+
}
|
|
114
|
+
//# sourceMappingURL=express.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"express.js","sourceRoot":"","sources":["../../src/utils/express.ts"],"names":[],"mappings":"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"}
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
import { AppObject, BaseUser } from '../interfaces';
|
|
2
|
+
/**
|
|
3
|
+
*
|
|
4
|
+
* @param path
|
|
5
|
+
* @returns
|
|
6
|
+
*/
|
|
7
|
+
export declare function pathExists(path?: string): Promise<boolean>;
|
|
8
|
+
/**
|
|
9
|
+
*
|
|
10
|
+
* @param object
|
|
11
|
+
* @param path
|
|
12
|
+
*/
|
|
13
|
+
export declare function getAttr(object: any, path: string): any;
|
|
14
|
+
/**
|
|
15
|
+
*
|
|
16
|
+
* @param object
|
|
17
|
+
* @param path
|
|
18
|
+
* @param value
|
|
19
|
+
*/
|
|
20
|
+
export declare function setAttr(object: any, path: string, value: any): any;
|
|
21
|
+
/**
|
|
22
|
+
* Scan recoursively a directory to find files ending with fname
|
|
23
|
+
* @param dir Directory to use to explore
|
|
24
|
+
*/
|
|
25
|
+
export declare function findFilesRecursive(dir: string, fname: string): string[];
|
|
26
|
+
/**
|
|
27
|
+
* Sets the tenantId on the given payload based on the user's role and organizations.
|
|
28
|
+
* - Normal users: tenantId is always set to their first organization
|
|
29
|
+
* - Admin users (CONFIG_ROLES):
|
|
30
|
+
* - If applyDefaultForAdmin = false → can access all tenants
|
|
31
|
+
* - If applyDefaultForAdmin = true and tenantId not provided → tenantId set to first org (subset view)
|
|
32
|
+
*/
|
|
33
|
+
export declare function setTenant(item: AppObject, user?: BaseUser, applyDefaultForAdmin?: boolean): void;
|
|
34
|
+
/**
|
|
35
|
+
*
|
|
36
|
+
* @param user
|
|
37
|
+
* @returns
|
|
38
|
+
*/
|
|
39
|
+
export declare function getTenant(user?: BaseUser): string | undefined;
|
|
40
|
+
/**
|
|
41
|
+
*
|
|
42
|
+
* @param input
|
|
43
|
+
* @returns
|
|
44
|
+
*/
|
|
45
|
+
export declare function validateUrl(input: string): string;
|
|
46
|
+
//# sourceMappingURL=functs.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"functs.d.ts","sourceRoot":"","sources":["../../src/utils/functs.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,SAAS,EAAE,QAAQ,EAAE,MAAM,eAAe,CAAC;AAoBpD;;;;GAIG;AACH,wBAAsB,UAAU,CAAC,IAAI,GAAE,MAAW,GAAG,OAAO,CAAC,OAAO,CAAC,CAYpE;AAED;;;;GAIG;AACH,wBAAgB,OAAO,CAAC,MAAM,EAAE,GAAG,EAAE,IAAI,EAAE,MAAM,GAAG,GAAG,CAGtD;AAED;;;;;GAKG;AACH,wBAAgB,OAAO,CAAC,MAAM,EAAE,GAAG,EAAE,IAAI,EAAE,MAAM,EAAE,KAAK,EAAE,GAAG,GAAG,GAAG,CAGlE;AAED;;;GAGG;AACH,wBAAgB,kBAAkB,CAAC,GAAG,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,GAAG,MAAM,EAAE,CAgBvE;AAED;;;;;;GAMG;AACH,wBAAgB,SAAS,CAAC,IAAI,EAAE,SAAS,EAAE,IAAI,CAAC,EAAE,QAAQ,EAAE,oBAAoB,UAAQ,GAAG,IAAI,CAc9F;AAED;;;;GAIG;AACH,wBAAgB,SAAS,CAAC,IAAI,CAAC,EAAE,QAAQ,GAAG,MAAM,GAAG,SAAS,CAO7D;AAED;;;;GAIG;AACH,wBAAgB,WAAW,CAAC,KAAK,EAAE,MAAM,GAAG,MAAM,CAmBjD"}
|