@steroidsjs/nest 1.7.28 → 1.7.29
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/infrastructure/decorators/fields/JSONBField.d.ts +5 -0
- package/infrastructure/decorators/fields/JSONBField.js +30 -0
- package/infrastructure/decorators/fields/JSONBField.js.map +1 -0
- package/infrastructure/decorators/fields/index.d.ts +3 -1
- package/infrastructure/decorators/fields/index.js +3 -1
- package/infrastructure/decorators/fields/index.js.map +1 -1
- package/package.json +1 -1
- package/tsconfig.tsbuildinfo +1 -1
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import { IBaseFieldOptions } from './BaseField';
|
|
2
|
+
export interface IJSONBFieldOptions extends IBaseFieldOptions {
|
|
3
|
+
isJSONConstraintMessage?: string;
|
|
4
|
+
}
|
|
5
|
+
export declare function JSONBField(options?: IJSONBFieldOptions): <TFunction extends Function, Y>(target: object | TFunction, propertyKey?: string | symbol, descriptor?: TypedPropertyDescriptor<Y>) => void;
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.JSONBField = void 0;
|
|
4
|
+
const common_1 = require("@nestjs/common");
|
|
5
|
+
const typeorm_1 = require("@steroidsjs/typeorm");
|
|
6
|
+
const class_validator_1 = require("class-validator");
|
|
7
|
+
const BaseField_1 = require("./BaseField");
|
|
8
|
+
function JSONBField(options = {}) {
|
|
9
|
+
return (0, common_1.applyDecorators)(...[
|
|
10
|
+
(0, BaseField_1.BaseField)(options, {
|
|
11
|
+
decoratorName: 'JSONBField',
|
|
12
|
+
appType: 'object',
|
|
13
|
+
jsType: 'jsonb',
|
|
14
|
+
}),
|
|
15
|
+
(0, typeorm_1.Column)({
|
|
16
|
+
type: 'jsonb',
|
|
17
|
+
length: options.max,
|
|
18
|
+
default: options.defaultValue,
|
|
19
|
+
nullable: options.nullable,
|
|
20
|
+
array: options.isArray,
|
|
21
|
+
}),
|
|
22
|
+
(0, class_validator_1.IsJSON)({
|
|
23
|
+
each: options.isArray,
|
|
24
|
+
message: options.isJSONConstraintMessage || 'Должен быть JSON',
|
|
25
|
+
}),
|
|
26
|
+
!options.required && (0, class_validator_1.IsOptional)(),
|
|
27
|
+
].filter(Boolean));
|
|
28
|
+
}
|
|
29
|
+
exports.JSONBField = JSONBField;
|
|
30
|
+
//# sourceMappingURL=JSONBField.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"JSONBField.js","sourceRoot":"","sources":["../../../../src/infrastructure/decorators/fields/JSONBField.ts"],"names":[],"mappings":";;;AAAA,2CAA+C;AAC/C,iDAA2C;AAC3C,qDAAmD;AACnD,2CAAyD;AAMzD,SAAgB,UAAU,CAAC,UAA8B,EAAE;IACvD,OAAO,IAAA,wBAAe,EAAC,GAAG;QACtB,IAAA,qBAAS,EAAC,OAAO,EAAE;YACf,aAAa,EAAE,YAAY;YAC3B,OAAO,EAAE,QAAQ;YACjB,MAAM,EAAE,OAAO;SAClB,CAAC;QACF,IAAA,gBAAM,EAAC;YACH,IAAI,EAAE,OAAO;YACb,MAAM,EAAE,OAAO,CAAC,GAAG;YACnB,OAAO,EAAE,OAAO,CAAC,YAAY;YAC7B,QAAQ,EAAE,OAAO,CAAC,QAAQ;YAC1B,KAAK,EAAE,OAAO,CAAC,OAAO;SACzB,CAAC;QACF,IAAA,wBAAM,EAAC;YACH,IAAI,EAAE,OAAO,CAAC,OAAO;YACrB,OAAO,EAAE,OAAO,CAAC,uBAAuB,IAAI,kBAAkB;SACjE,CAAC;QACF,CAAC,OAAO,CAAC,QAAQ,IAAI,IAAA,4BAAU,GAAE;KACpC,CAAC,MAAM,CAAC,OAAO,CAAC,CAAC,CAAC;AACvB,CAAC;AApBD,gCAoBC"}
|
|
@@ -13,6 +13,7 @@ import { IStringFieldOptions } from './StringField';
|
|
|
13
13
|
import { IIntegerFieldOptions } from './IntegerField';
|
|
14
14
|
import { IDateFieldOptions } from './DateField';
|
|
15
15
|
import { IComputableFieldOptions } from './ComputableField';
|
|
16
|
+
import { IJSONBFieldOptions } from './JSONBField';
|
|
16
17
|
export { BooleanField } from './BooleanField';
|
|
17
18
|
export { CoordinateField } from './CoordinateField';
|
|
18
19
|
export { CreateTimeField } from './CreateTimeField';
|
|
@@ -37,4 +38,5 @@ export { UpdateTimeField } from './UpdateTimeField';
|
|
|
37
38
|
export { RelationField } from './RelationField';
|
|
38
39
|
export { RelationIdField } from './RelationIdField';
|
|
39
40
|
export { ImageField } from './ImageField';
|
|
40
|
-
export
|
|
41
|
+
export { JSONBField } from './JSONBField';
|
|
42
|
+
export type IAllFieldOptions = ICreateTimeFieldOptions & IDateTimeFieldColumnOptions & IDecimalFieldOptions & IEnumFieldOptions & IExtendFieldOptions & IFileField & IRelationFieldOptions & IRelationIdFieldOptions & IUpdateTimeFieldOptions & IEmailFieldOptions & IPhoneFieldOptions & IStringFieldOptions & IIntegerFieldOptions & IDateFieldOptions & IComputableFieldOptions & IJSONBFieldOptions;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.ImageField = exports.RelationIdField = exports.RelationField = exports.UpdateTimeField = exports.UidField = exports.TimeField = exports.TextField = exports.StringField = exports.PrimaryKeyField = exports.PhoneField = exports.PasswordField = exports.IntegerField = exports.HtmlField = exports.FileField = exports.EnumField = exports.EmailField = exports.DecimalNumberField = exports.DecimalField = exports.DateTimeField = exports.DateField = exports.ComputableField = exports.CreateTimeField = exports.CoordinateField = exports.BooleanField = void 0;
|
|
3
|
+
exports.JSONBField = exports.ImageField = exports.RelationIdField = exports.RelationField = exports.UpdateTimeField = exports.UidField = exports.TimeField = exports.TextField = exports.StringField = exports.PrimaryKeyField = exports.PhoneField = exports.PasswordField = exports.IntegerField = exports.HtmlField = exports.FileField = exports.EnumField = exports.EmailField = exports.DecimalNumberField = exports.DecimalField = exports.DateTimeField = exports.DateField = exports.ComputableField = exports.CreateTimeField = exports.CoordinateField = exports.BooleanField = void 0;
|
|
4
4
|
var BooleanField_1 = require("./BooleanField");
|
|
5
5
|
Object.defineProperty(exports, "BooleanField", { enumerable: true, get: function () { return BooleanField_1.BooleanField; } });
|
|
6
6
|
var CoordinateField_1 = require("./CoordinateField");
|
|
@@ -49,4 +49,6 @@ var RelationIdField_1 = require("./RelationIdField");
|
|
|
49
49
|
Object.defineProperty(exports, "RelationIdField", { enumerable: true, get: function () { return RelationIdField_1.RelationIdField; } });
|
|
50
50
|
var ImageField_1 = require("./ImageField");
|
|
51
51
|
Object.defineProperty(exports, "ImageField", { enumerable: true, get: function () { return ImageField_1.ImageField; } });
|
|
52
|
+
var JSONBField_1 = require("./JSONBField");
|
|
53
|
+
Object.defineProperty(exports, "JSONBField", { enumerable: true, get: function () { return JSONBField_1.JSONBField; } });
|
|
52
54
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/infrastructure/decorators/fields/index.ts"],"names":[],"mappings":";;;
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/infrastructure/decorators/fields/index.ts"],"names":[],"mappings":";;;AAiBA,+CAA4C;AAApC,4GAAA,YAAY,OAAA;AACpB,qDAAkD;AAA1C,kHAAA,eAAe,OAAA;AACvB,qDAAkD;AAA1C,kHAAA,eAAe,OAAA;AACvB,qDAAkD;AAA1C,kHAAA,eAAe,OAAA;AACvB,yCAAsC;AAA9B,sGAAA,SAAS,OAAA;AACjB,iDAA8C;AAAtC,8GAAA,aAAa,OAAA;AACrB,+CAA4C;AAApC,4GAAA,YAAY,OAAA;AACpB,2DAAwD;AAAhD,wHAAA,kBAAkB,OAAA;AAC1B,2CAAwC;AAAhC,wGAAA,UAAU,OAAA;AAClB,yCAAsC;AAA9B,sGAAA,SAAS,OAAA;AACjB,yCAAsC;AAA9B,sGAAA,SAAS,OAAA;AACjB,yCAAsC;AAA9B,sGAAA,SAAS,OAAA;AACjB,+CAA4C;AAApC,4GAAA,YAAY,OAAA;AACpB,iDAA8C;AAAtC,8GAAA,aAAa,OAAA;AACrB,2CAAwC;AAAhC,wGAAA,UAAU,OAAA;AAClB,qDAAkD;AAA1C,kHAAA,eAAe,OAAA;AACvB,6CAA0C;AAAlC,0GAAA,WAAW,OAAA;AACnB,yCAAsC;AAA9B,sGAAA,SAAS,OAAA;AACjB,yCAAsC;AAA9B,sGAAA,SAAS,OAAA;AACjB,uCAAoC;AAA5B,oGAAA,QAAQ,OAAA;AAChB,qDAAkD;AAA1C,kHAAA,eAAe,OAAA;AACvB,iDAA8C;AAAtC,8GAAA,aAAa,OAAA;AACrB,qDAAkD;AAA1C,kHAAA,eAAe,OAAA;AACvB,2CAAwC;AAAhC,wGAAA,UAAU,OAAA;AAClB,2CAAwC;AAAhC,wGAAA,UAAU,OAAA"}
|