@orion-js/models
Advanced tools
Comparing version 3.0.17 to 3.0.20
@@ -21,2 +21,11 @@ "use strict"; | ||
const schema = (0, resolveParam_1.default)(modelOptions.schema); | ||
resolvedSchema = (0, modelToSchema_1.default)(schema, model); | ||
return resolvedSchema; | ||
}; | ||
const getCleanSchema = () => { | ||
if (!modelOptions.schema) | ||
return {}; | ||
if (resolvedSchema) | ||
return resolvedSchema; | ||
const schema = (0, resolveParam_1.default)(modelOptions.schema); | ||
resolvedSchema = (0, modelToSchema_1.default)(schema); | ||
@@ -42,2 +51,3 @@ return resolvedSchema; | ||
getSchema, | ||
getCleanSchema, | ||
getResolvers, | ||
@@ -44,0 +54,0 @@ initItem: modelInitItem, |
@@ -1,1 +0,2 @@ | ||
export default function (schema: any): any; | ||
import { Model } from '..'; | ||
export default function (schema: any, model?: Model): any; |
@@ -8,3 +8,3 @@ "use strict"; | ||
const cloneDeep_1 = __importDefault(require("lodash/cloneDeep")); | ||
function default_1(schema) { | ||
function default_1(schema, model) { | ||
schema = (0, cloneDeep_1.default)(schema); | ||
@@ -22,4 +22,9 @@ const keys = Object.keys(schema); | ||
} | ||
return schema; | ||
if (!model) | ||
return schema; | ||
return { | ||
...schema, | ||
__model: model | ||
}; | ||
} | ||
exports.default = default_1; |
@@ -52,4 +52,10 @@ import { GlobalResolverResolve, ModelResolverResolve, Resolver } from '@orion-js/resolvers'; | ||
*/ | ||
getSchema: () => Schema; | ||
getSchema: () => Schema & { | ||
__model: Model; | ||
}; | ||
/** | ||
* Returns the schema without adding __model to the schema | ||
*/ | ||
getCleanSchema: () => Schema; | ||
/** | ||
* Returns the model resolvers | ||
@@ -56,0 +62,0 @@ */ |
{ | ||
"name": "@orion-js/models", | ||
"version": "3.0.17", | ||
"version": "3.0.20", | ||
"main": "lib/index.js", | ||
@@ -39,3 +39,3 @@ "types": "lib/index.d.ts", | ||
}, | ||
"gitHead": "55e56828a55b355ec68f91c11d942676bbeb241b" | ||
"gitHead": "ed37da2a1a61a9a4c0b9935d77e29d83a423e199" | ||
} |
Sorry, the diff of this file is not supported yet
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
19742
28
535