@oridune/epic-odm
Advanced tools
Comparing version 1.0.6 to 1.0.7
{ | ||
"name": "@oridune/epic-odm", | ||
"version": "1.0.6", | ||
"version": "1.0.7", | ||
"description": "Install 1 ODM and code once with any database driver.", | ||
@@ -5,0 +5,0 @@ "main": "./src/index.js", |
"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]; } }); | ||
var desc = Object.getOwnPropertyDescriptor(m, k); | ||
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) { | ||
desc = { enumerable: true, get: function() { return m[k]; } }; | ||
} | ||
Object.defineProperty(o, k2, desc); | ||
}) : (function(o, m, k, k2) { | ||
@@ -64,3 +68,3 @@ if (k2 === undefined) k2 = k; | ||
// Get Model Options | ||
const ModelOptions = model_1.getModelOptions(model); | ||
const ModelOptions = (0, model_1.getModelOptions)(model); | ||
// Create Collection | ||
@@ -71,7 +75,7 @@ const Collection = Connection.db(ModelOptions.database).collection(ModelOptions.name); | ||
// Create Sub Indexes | ||
await Promise.all(Object.values(ModelOptions.embeds).map((embed) => createIndexes(Collection, model_1.getModelOptions(embed.model).indexes, embed.options.name))); | ||
await Promise.all(Object.values(ModelOptions.embeds).map((embed) => createIndexes(Collection, (0, model_1.getModelOptions)(embed.model).indexes, embed.options.name))); | ||
})); | ||
// Initialization | ||
for (const Model of this.Models) { | ||
const ModelOptions = model_1.getModelOptions(Model); | ||
const ModelOptions = (0, model_1.getModelOptions)(Model); | ||
await ((_a = ModelOptions.onInit) === null || _a === void 0 ? void 0 : _a.call(ModelOptions)); | ||
@@ -110,3 +114,3 @@ } | ||
// Get Model Options | ||
const ModelOptions = model_1.getModelOptions(model); | ||
const ModelOptions = (0, model_1.getModelOptions)(model); | ||
// Create New Document | ||
@@ -134,3 +138,3 @@ const Results = await this.getConnectionObject() | ||
// Get Model Options | ||
const ParentModelOptions = model_1.getModelOptions(parent.model); | ||
const ParentModelOptions = (0, model_1.getModelOptions)(parent.model); | ||
if (["OneToOne", "ManyToOne"].includes(type)) | ||
@@ -149,3 +153,3 @@ await this.getConnectionObject() | ||
// Get Model Options | ||
const ModelOptions = model_1.getModelOptions(model); | ||
const ModelOptions = (0, model_1.getModelOptions)(model); | ||
// Get Collection | ||
@@ -167,3 +171,3 @@ const Collection = this.getConnectionObject() | ||
// Get Model Options | ||
const ModelOptions = model_1.getModelOptions(model); | ||
const ModelOptions = (0, model_1.getModelOptions)(model); | ||
// Empty Stages Array | ||
@@ -173,3 +177,3 @@ let Stages = []; | ||
// Get Model Options | ||
const RelationModelOptions = model_1.getModelOptions(relation.reference()); | ||
const RelationModelOptions = (0, model_1.getModelOptions)(relation.reference()); | ||
const ProjectItem = project[relation.name]; | ||
@@ -262,3 +266,3 @@ if (typeof ProjectItem === "object") | ||
// Get Model Options | ||
const ModelOptions = model_1.getModelOptions(model); | ||
const ModelOptions = (0, model_1.getModelOptions)(model); | ||
// Create New Document | ||
@@ -273,3 +277,3 @@ const Results = await this.getConnectionObject() | ||
// Get Model Options | ||
const ModelOptions = model_1.getModelOptions(model); | ||
const ModelOptions = (0, model_1.getModelOptions)(model); | ||
// Create New Document | ||
@@ -276,0 +280,0 @@ const Results = await this.getConnectionObject() |
@@ -10,3 +10,7 @@ "use strict"; | ||
if (k2 === undefined) k2 = k; | ||
Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } }); | ||
var desc = Object.getOwnPropertyDescriptor(m, k); | ||
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) { | ||
desc = { enumerable: true, get: function() { return m[k]; } }; | ||
} | ||
Object.defineProperty(o, k2, desc); | ||
}) : (function(o, m, k, k2) { | ||
@@ -13,0 +17,0 @@ if (k2 === undefined) k2 = k; |
@@ -15,3 +15,3 @@ "use strict"; | ||
// Get Model Options | ||
const ModelOptions = model_1.getModelOptions(model); | ||
const ModelOptions = (0, model_1.getModelOptions)(model); | ||
try { | ||
@@ -57,3 +57,3 @@ // Empty Payload | ||
// Get Model Options | ||
const ModelOptions = model_1.getModelOptions(model); | ||
const ModelOptions = (0, model_1.getModelOptions)(model); | ||
try { | ||
@@ -60,0 +60,0 @@ // Validate Payload |
@@ -117,5 +117,5 @@ "use strict"; | ||
dataType: DataType, | ||
options: Object.assign(Object.assign({}, options), { name: options.name || field, validator: exports.DefaultValidation(field, options), resolver: (value) => { | ||
options: Object.assign(Object.assign({}, options), { name: options.name || field, validator: (0, exports.DefaultValidation)(field, options), resolver: (value) => { | ||
// Data Type Casting | ||
const Value = exports.TypeCast(DataType)(value); | ||
const Value = (0, exports.TypeCast)(DataType)(value); | ||
// Resolve & Return | ||
@@ -122,0 +122,0 @@ return typeof options.resolver === "function" |
@@ -6,3 +6,3 @@ "use strict"; | ||
const enums_1 = require("./enums"); | ||
const Model = (options) => (constructor) => exports.setModelOptions(constructor, Object.assign(Object.assign({}, options), { fields: Reflect.getMetadata(enums_1.MetaDataKeys.MODEL_FIELDS, constructor) || {}, embeds: Reflect.getMetadata(enums_1.MetaDataKeys.MODEL_EMBEDS, constructor) || {}, relations: Reflect.getMetadata(enums_1.MetaDataKeys.MODEL_RELATIONS, constructor) || {} })); | ||
const Model = (options) => (constructor) => (0, exports.setModelOptions)(constructor, Object.assign(Object.assign({}, options), { fields: Reflect.getMetadata(enums_1.MetaDataKeys.MODEL_FIELDS, constructor) || {}, embeds: Reflect.getMetadata(enums_1.MetaDataKeys.MODEL_EMBEDS, constructor) || {}, relations: Reflect.getMetadata(enums_1.MetaDataKeys.MODEL_RELATIONS, constructor) || {} })); | ||
exports.Model = Model; | ||
@@ -12,5 +12,5 @@ const setModelOptions = (model, options) => { | ||
const Options = typeof options === "function" | ||
? options(exports.getModelOptions(model)) | ||
? options((0, exports.getModelOptions)(model)) | ||
: options; | ||
Reflect.defineMetadata(enums_1.MetaDataKeys.MODEL_OPTIONS, Object.assign(Object.assign(Object.assign({}, (exports.getModelOptions(model) || {})), Options), { name: utils_1.Pluralize((Options === null || Options === void 0 ? void 0 : Options.name) || model.name) | ||
Reflect.defineMetadata(enums_1.MetaDataKeys.MODEL_OPTIONS, Object.assign(Object.assign(Object.assign({}, ((0, exports.getModelOptions)(model) || {})), Options), { name: (0, utils_1.Pluralize)((Options === null || Options === void 0 ? void 0 : Options.name) || model.name) | ||
.replace(/[A-Z]/g, (a) => "-" + a.toLowerCase()) | ||
@@ -17,0 +17,0 @@ .replace(/^-/, ""), indexes: (Options === null || Options === void 0 ? void 0 : Options.indexes) || {} }), model); |
@@ -20,3 +20,3 @@ "use strict"; | ||
if (typeof Options.target === "function") { | ||
const ModelOptions = model_1.getModelOptions(Model); | ||
const ModelOptions = (0, model_1.getModelOptions)(Model); | ||
const ModelInstance = new Model(); | ||
@@ -38,3 +38,3 @@ for (const Key of Object.keys(ModelOptions.relations)) // @ts-ignore | ||
name: Options.target || | ||
model_1.getModelOptions(modelInstance.constructor).name, | ||
(0, model_1.getModelOptions)(modelInstance.constructor).name, | ||
model: Model, | ||
@@ -41,0 +41,0 @@ type: type === "OneToMany" |
@@ -23,5 +23,5 @@ "use strict"; | ||
this.Models.map((model) => { | ||
const options = model_1.getModelOptions(model); | ||
const options = (0, model_1.getModelOptions)(model); | ||
if (!options.database) | ||
model_1.setModelOptions(model, Object.assign(Object.assign({}, options), { database: this.DatabaseConfiguration.database })); | ||
(0, model_1.setModelOptions)(model, Object.assign(Object.assign({}, options), { database: this.DatabaseConfiguration.database })); | ||
return model; | ||
@@ -74,3 +74,3 @@ }); | ||
// Get Model Options | ||
const ModelOptions = model_1.getModelOptions(command.model); | ||
const ModelOptions = (0, model_1.getModelOptions)(command.model); | ||
// Create Relation Items | ||
@@ -116,3 +116,3 @@ for (const [Index, Item] of Object.entries(command.payload)) | ||
// Get Model Options | ||
const ModelOptions = model_1.getModelOptions(command.model); | ||
const ModelOptions = (0, model_1.getModelOptions)(command.model); | ||
// Updated Count | ||
@@ -204,3 +204,3 @@ let UpdatedCount = 0; | ||
// Get Model Options | ||
const ModelOptions = model_1.getModelOptions(command.model); | ||
const ModelOptions = (0, model_1.getModelOptions)(command.model); | ||
// Deleted Count | ||
@@ -207,0 +207,0 @@ let DeletedCount = 0; |
@@ -20,3 +20,3 @@ "use strict"; | ||
// Get Model Options | ||
const ModelOptions = model_1.getModelOptions(this); | ||
const ModelOptions = (0, model_1.getModelOptions)(this); | ||
// Create Object Type From Model | ||
@@ -23,0 +23,0 @@ return (this.GraphQLObjectType = new (require("graphql").GraphQLObjectType)({ |
@@ -12,3 +12,3 @@ "use strict"; | ||
static createFieldsList(model, fields, select = 0, embedMode = false) { | ||
const ModelOptions = model_1.getModelOptions(model); | ||
const ModelOptions = (0, model_1.getModelOptions)(model); | ||
const ModelFieldKeys = Object.keys(ModelOptions.fields); | ||
@@ -15,0 +15,0 @@ const ModelEmbedKeys = Object.keys(ModelOptions.embeds); |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
91444
1859