@orion-js/typed-model 3.2.53 → 3.3.9
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/lib/enum.test.d.ts +1 -0
- package/lib/enum.test.js +29 -0
- package/lib/factories/getModelForClass.js +3 -0
- package/package.json +7 -7
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
package/lib/enum.test.js
ADDED
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
|
3
|
+
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
4
|
+
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
5
|
+
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
6
|
+
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
7
|
+
};
|
|
8
|
+
var __metadata = (this && this.__metadata) || function (k, v) {
|
|
9
|
+
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
|
|
10
|
+
};
|
|
11
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
|
+
const schema_1 = require("@orion-js/schema");
|
|
13
|
+
const _1 = require(".");
|
|
14
|
+
describe('Test custom fields', () => {
|
|
15
|
+
it('Should convert custom fields correctly', async () => {
|
|
16
|
+
const colorsEnum = (0, schema_1.createEnum)('ColorsEnum', ['red', 'blue', 'green']);
|
|
17
|
+
let TestParams = class TestParams {
|
|
18
|
+
};
|
|
19
|
+
__decorate([
|
|
20
|
+
(0, _1.Prop)({ type: colorsEnum }),
|
|
21
|
+
__metadata("design:type", String)
|
|
22
|
+
], TestParams.prototype, "color", void 0);
|
|
23
|
+
TestParams = __decorate([
|
|
24
|
+
(0, _1.TypedSchema)()
|
|
25
|
+
], TestParams);
|
|
26
|
+
const model = (0, _1.getModelForClass)(TestParams);
|
|
27
|
+
expect(model.getCleanSchema().color.type._isFieldType).toBe(true);
|
|
28
|
+
});
|
|
29
|
+
});
|
|
@@ -10,6 +10,9 @@ function processModelSchemaForProp(prop) {
|
|
|
10
10
|
if (prop.type?.__isModel === true) {
|
|
11
11
|
return prop;
|
|
12
12
|
}
|
|
13
|
+
if (prop.type?._isFieldType === true) {
|
|
14
|
+
return prop;
|
|
15
|
+
}
|
|
13
16
|
return (0, processSchemaForProp_1.processSchemaForProp)(prop);
|
|
14
17
|
}
|
|
15
18
|
function getModelForClass(target) {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@orion-js/typed-model",
|
|
3
|
-
"version": "3.
|
|
3
|
+
"version": "3.3.9",
|
|
4
4
|
"main": "lib/index.js",
|
|
5
5
|
"types": "lib/index.d.ts",
|
|
6
6
|
"files": [
|
|
@@ -17,11 +17,11 @@
|
|
|
17
17
|
"test": "jest --config jest.config.js"
|
|
18
18
|
},
|
|
19
19
|
"dependencies": {
|
|
20
|
-
"@orion-js/helpers": "^3.
|
|
21
|
-
"@orion-js/models": "^3.
|
|
22
|
-
"@orion-js/resolvers": "^3.
|
|
23
|
-
"@orion-js/schema": "^3.
|
|
24
|
-
"@orion-js/services": "^3.
|
|
20
|
+
"@orion-js/helpers": "^3.3.6",
|
|
21
|
+
"@orion-js/models": "^3.3.9",
|
|
22
|
+
"@orion-js/resolvers": "^3.3.9",
|
|
23
|
+
"@orion-js/schema": "^3.3.9",
|
|
24
|
+
"@orion-js/services": "^3.3.6",
|
|
25
25
|
"lodash": "^4.17.21",
|
|
26
26
|
"reflect-metadata": "0.1.13"
|
|
27
27
|
},
|
|
@@ -41,5 +41,5 @@
|
|
|
41
41
|
"publishConfig": {
|
|
42
42
|
"access": "public"
|
|
43
43
|
},
|
|
44
|
-
"gitHead": "
|
|
44
|
+
"gitHead": "c9591d61fe15eb98c6b6d5c3773afab11c412e42"
|
|
45
45
|
}
|