kodzero-schema-parser 0.0.1
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/dist/KodzeroToValidnoParser.d.ts +46 -0
- package/dist/KodzeroToValidnoParser.d.ts.map +1 -0
- package/dist/KodzeroToValidnoParser.js +306 -0
- package/dist/index.d.ts +3 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +2 -0
- package/dist/kz-schema-factory/FieldValidator.d.ts +18 -0
- package/dist/kz-schema-factory/FieldValidator.d.ts.map +1 -0
- package/dist/kz-schema-factory/FieldValidator.js +153 -0
- package/dist/kz-schema-factory/SchemaFactory.d.ts +46 -0
- package/dist/kz-schema-factory/SchemaFactory.d.ts.map +1 -0
- package/dist/kz-schema-factory/SchemaFactory.js +115 -0
- package/dist/kz-schema-factory/fields-to-types/number.d.ts +12 -0
- package/dist/kz-schema-factory/fields-to-types/number.d.ts.map +1 -0
- package/dist/kz-schema-factory/fields-to-types/number.js +41 -0
- package/dist/kz-schema-factory/fields-to-types/select.d.ts +12 -0
- package/dist/kz-schema-factory/fields-to-types/select.d.ts.map +1 -0
- package/dist/kz-schema-factory/fields-to-types/select.js +44 -0
- package/dist/kz-schema-factory/fields-to-types/string.d.ts +12 -0
- package/dist/kz-schema-factory/fields-to-types/string.d.ts.map +1 -0
- package/dist/kz-schema-factory/fields-to-types/string.js +47 -0
- package/dist/kz-schema-factory/fields-to-types/url.d.ts +12 -0
- package/dist/kz-schema-factory/fields-to-types/url.d.ts.map +1 -0
- package/dist/kz-schema-factory/fields-to-types/url.js +45 -0
- package/dist/kz-schema-factory/types-constructors/autofieldCreatedAt.d.ts +4 -0
- package/dist/kz-schema-factory/types-constructors/autofieldCreatedAt.d.ts.map +1 -0
- package/dist/kz-schema-factory/types-constructors/autofieldCreatedAt.js +15 -0
- package/dist/kz-schema-factory/types-constructors/autofieldId.d.ts +4 -0
- package/dist/kz-schema-factory/types-constructors/autofieldId.d.ts.map +1 -0
- package/dist/kz-schema-factory/types-constructors/autofieldId.js +16 -0
- package/dist/kz-schema-factory/types-constructors/autofieldUpdatedAt.d.ts +4 -0
- package/dist/kz-schema-factory/types-constructors/autofieldUpdatedAt.d.ts.map +1 -0
- package/dist/kz-schema-factory/types-constructors/autofieldUpdatedAt.js +15 -0
- package/dist/kz-schema-factory/types-constructors/boolean.d.ts +12 -0
- package/dist/kz-schema-factory/types-constructors/boolean.d.ts.map +1 -0
- package/dist/kz-schema-factory/types-constructors/boolean.js +30 -0
- package/dist/kz-schema-factory/types-constructors/date.d.ts +12 -0
- package/dist/kz-schema-factory/types-constructors/date.d.ts.map +1 -0
- package/dist/kz-schema-factory/types-constructors/date.js +43 -0
- package/dist/kz-schema-factory/types-constructors/email.d.ts +12 -0
- package/dist/kz-schema-factory/types-constructors/email.d.ts.map +1 -0
- package/dist/kz-schema-factory/types-constructors/email.js +45 -0
- package/dist/kz-schema-factory/types-constructors/json.d.ts +12 -0
- package/dist/kz-schema-factory/types-constructors/json.d.ts.map +1 -0
- package/dist/kz-schema-factory/types-constructors/json.js +39 -0
- package/dist/kz-schema-factory/types-constructors/number.d.ts +12 -0
- package/dist/kz-schema-factory/types-constructors/number.d.ts.map +1 -0
- package/dist/kz-schema-factory/types-constructors/number.js +41 -0
- package/dist/kz-schema-factory/types-constructors/select.d.ts +12 -0
- package/dist/kz-schema-factory/types-constructors/select.d.ts.map +1 -0
- package/dist/kz-schema-factory/types-constructors/select.js +44 -0
- package/dist/kz-schema-factory/types-constructors/string.d.ts +12 -0
- package/dist/kz-schema-factory/types-constructors/string.d.ts.map +1 -0
- package/dist/kz-schema-factory/types-constructors/string.js +47 -0
- package/dist/kz-schema-factory/types-constructors/url.d.ts +12 -0
- package/dist/kz-schema-factory/types-constructors/url.d.ts.map +1 -0
- package/dist/kz-schema-factory/types-constructors/url.js +45 -0
- package/dist/kz-schema-factory/types.d.ts +60 -0
- package/dist/kz-schema-factory/types.d.ts.map +1 -0
- package/dist/kz-schema-factory/types.js +1 -0
- package/dist/tsconfig.tsbuildinfo +1 -0
- package/dist/types/table-fields.d.ts +7 -0
- package/dist/types/table-fields.d.ts.map +1 -0
- package/dist/types/table-fields.js +1 -0
- package/dist/types/table-types-specs.d.ts +39 -0
- package/dist/types/table-types-specs.d.ts.map +1 -0
- package/dist/types/table-types-specs.js +1 -0
- package/dist/utils/generate-secret.d.ts +3 -0
- package/dist/utils/generate-secret.d.ts.map +1 -0
- package/dist/utils/generate-secret.js +9 -0
- package/dist/utils/is-valid-json.d.ts +3 -0
- package/dist/utils/is-valid-json.d.ts.map +1 -0
- package/dist/utils/is-valid-json.js +16 -0
- package/dist/utils/validate-input.d.ts +4 -0
- package/dist/utils/validate-input.d.ts.map +1 -0
- package/dist/utils/validate-input.js +7 -0
- package/package.json +53 -0
|
@@ -0,0 +1,115 @@
|
|
|
1
|
+
import TableFieldBoolean from './types-constructors/boolean.js';
|
|
2
|
+
import TableFieldDate from './types-constructors/date.js';
|
|
3
|
+
import TableFieldEmail from './types-constructors/email.js';
|
|
4
|
+
import TableFieldJson from './types-constructors/json.js';
|
|
5
|
+
import TableFieldNumber from './types-constructors/number.js';
|
|
6
|
+
import TableFieldSelect from './types-constructors/select.js';
|
|
7
|
+
import TableFieldString from './types-constructors/string.js';
|
|
8
|
+
import TableFieldUrl from './types-constructors/url.js';
|
|
9
|
+
import generateSecret from '../utils/generate-secret.js';
|
|
10
|
+
class CollectionConfig {
|
|
11
|
+
constructor(items = []) {
|
|
12
|
+
this.totalQty = items.length || 0;
|
|
13
|
+
this.indexes = [];
|
|
14
|
+
this.items = items.map((el, i) => (Object.assign(Object.assign({}, el), { order: i })));
|
|
15
|
+
}
|
|
16
|
+
add(item) {
|
|
17
|
+
const id = generateSecret(12);
|
|
18
|
+
const itemWrapped = { id, item, order: this.totalQty };
|
|
19
|
+
this.items.push(itemWrapped);
|
|
20
|
+
this.totalQty = this.items.length;
|
|
21
|
+
}
|
|
22
|
+
copyById(id) {
|
|
23
|
+
const originalItem = this.items.find((el) => el.id === id);
|
|
24
|
+
if (!originalItem)
|
|
25
|
+
return;
|
|
26
|
+
const itemCopy = Object.create(Object.getPrototypeOf(originalItem.item), Object.getOwnPropertyDescriptors(originalItem.item));
|
|
27
|
+
itemCopy.key += '-copy';
|
|
28
|
+
this.add(itemCopy);
|
|
29
|
+
this.move(this.totalQty - 1, originalItem.order + 1);
|
|
30
|
+
}
|
|
31
|
+
remove(order) {
|
|
32
|
+
this.items = this.items.filter((col) => col.order !== order);
|
|
33
|
+
this.totalQty = this.items.length;
|
|
34
|
+
}
|
|
35
|
+
removeById(id) {
|
|
36
|
+
this.items = this.items.filter((col) => col.id !== id);
|
|
37
|
+
this.totalQty = this.items.length;
|
|
38
|
+
}
|
|
39
|
+
updateNameById(id, name) {
|
|
40
|
+
const index = this.items.findIndex((el) => el.id === id);
|
|
41
|
+
this.items[index].item.key = name;
|
|
42
|
+
}
|
|
43
|
+
updateSpecsById(id, newSpecs) {
|
|
44
|
+
const index = this.items.findIndex((el) => el.id === id);
|
|
45
|
+
this.items[index].item.specs = newSpecs;
|
|
46
|
+
}
|
|
47
|
+
move(from, to) {
|
|
48
|
+
if (from === to)
|
|
49
|
+
return;
|
|
50
|
+
const fromIndex = this.items.findIndex((item) => item.order === from);
|
|
51
|
+
let toIndex = this.items.findIndex((item) => item.order === to);
|
|
52
|
+
if (to >= this.items.length) {
|
|
53
|
+
toIndex = this.items.length - 1;
|
|
54
|
+
}
|
|
55
|
+
else if (to < 0) {
|
|
56
|
+
toIndex = 0;
|
|
57
|
+
}
|
|
58
|
+
if (fromIndex === -1 || toIndex === -1)
|
|
59
|
+
return;
|
|
60
|
+
const [movedItem] = this.items.splice(fromIndex, 1);
|
|
61
|
+
this.items.splice(toIndex, 0, movedItem);
|
|
62
|
+
this.items.forEach((col, index) => {
|
|
63
|
+
col.order = index;
|
|
64
|
+
});
|
|
65
|
+
}
|
|
66
|
+
}
|
|
67
|
+
export class TableFieldCreator {
|
|
68
|
+
static create(key, type, settings = {}) {
|
|
69
|
+
switch (type) {
|
|
70
|
+
case 'boolean':
|
|
71
|
+
return new TableFieldBoolean(key);
|
|
72
|
+
case 'string':
|
|
73
|
+
return new TableFieldString(key, settings);
|
|
74
|
+
case 'number':
|
|
75
|
+
return new TableFieldNumber(key, settings);
|
|
76
|
+
case 'date':
|
|
77
|
+
return new TableFieldDate(key, settings);
|
|
78
|
+
case 'email':
|
|
79
|
+
return new TableFieldEmail(key, settings);
|
|
80
|
+
case 'json':
|
|
81
|
+
return new TableFieldJson(key, settings);
|
|
82
|
+
case 'select':
|
|
83
|
+
return new TableFieldSelect(key, settings);
|
|
84
|
+
case 'url':
|
|
85
|
+
return new TableFieldUrl(key, settings);
|
|
86
|
+
default:
|
|
87
|
+
throw new Error(`Unsupported config type: ${type}`);
|
|
88
|
+
}
|
|
89
|
+
}
|
|
90
|
+
static createBoolean(key, settings) {
|
|
91
|
+
return new TableFieldBoolean(key, settings);
|
|
92
|
+
}
|
|
93
|
+
static createString(key, settings = {}) {
|
|
94
|
+
return new TableFieldString(key, settings);
|
|
95
|
+
}
|
|
96
|
+
static createNumber(key, settings = {}) {
|
|
97
|
+
return new TableFieldNumber(key, settings);
|
|
98
|
+
}
|
|
99
|
+
static createDate(key, settings = {}) {
|
|
100
|
+
return new TableFieldDate(key, settings);
|
|
101
|
+
}
|
|
102
|
+
static createEmail(key, settings = {}) {
|
|
103
|
+
return new TableFieldEmail(key, settings);
|
|
104
|
+
}
|
|
105
|
+
static createJson(key, settings = {}) {
|
|
106
|
+
return new TableFieldJson(key, settings);
|
|
107
|
+
}
|
|
108
|
+
static createSelect(key, settings = {}) {
|
|
109
|
+
return new TableFieldSelect(key, settings);
|
|
110
|
+
}
|
|
111
|
+
static createUrl(key, settings = {}) {
|
|
112
|
+
return new TableFieldUrl(key, settings);
|
|
113
|
+
}
|
|
114
|
+
}
|
|
115
|
+
export default CollectionConfig;
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import Schema from 'validno';
|
|
2
|
+
import type { NumberSpecs, TableFieldItem } from '../types.js';
|
|
3
|
+
export declare const numberSpecsSchema: Schema;
|
|
4
|
+
declare class TableFieldNumber implements TableFieldItem<NumberSpecs> {
|
|
5
|
+
key: string;
|
|
6
|
+
type: string;
|
|
7
|
+
title: string;
|
|
8
|
+
specs: NumberSpecs;
|
|
9
|
+
constructor(key: string, settings?: Partial<NumberSpecs>);
|
|
10
|
+
}
|
|
11
|
+
export default TableFieldNumber;
|
|
12
|
+
//# sourceMappingURL=number.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"number.d.ts","sourceRoot":"","sources":["../../../src/kz-schema-factory/fields-to-types/number.ts"],"names":[],"mappings":"AAAA,OAAO,MAAM,MAAM,SAAS,CAAA;AAC5B,OAAO,KAAK,EAAE,WAAW,EAAE,cAAc,EAAE,MAAM,aAAa,CAAA;AAgB9D,eAAO,MAAM,iBAAiB,QAW5B,CAAA;AAEF,cAAM,gBAAiB,YAAW,cAAc,CAAC,WAAW,CAAC;IAC3D,GAAG,EAAE,MAAM,CAAA;IACX,IAAI,EAAE,MAAM,CAAA;IACZ,KAAK,EAAE,MAAM,CAAA;IACb,KAAK,EAAE,WAAW,CAAA;gBAEN,GAAG,EAAE,MAAM,EAAE,QAAQ,GAAE,OAAO,CAAC,WAAW,CAAkB;CAazE;AAED,eAAe,gBAAgB,CAAA"}
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
import Schema from 'validno';
|
|
2
|
+
import validateInput from '../../utils/validate-input.js';
|
|
3
|
+
var Constants;
|
|
4
|
+
(function (Constants) {
|
|
5
|
+
Constants["Name"] = "number";
|
|
6
|
+
Constants["Title"] = "\u0427\u0438\u0441\u043B\u043E";
|
|
7
|
+
})(Constants || (Constants = {}));
|
|
8
|
+
const defaultSpecs = () => {
|
|
9
|
+
return {
|
|
10
|
+
min: -Infinity,
|
|
11
|
+
max: Infinity,
|
|
12
|
+
mayBeEmpty: true,
|
|
13
|
+
};
|
|
14
|
+
};
|
|
15
|
+
export const numberSpecsSchema = new Schema({
|
|
16
|
+
min: {
|
|
17
|
+
type: [Number, null],
|
|
18
|
+
},
|
|
19
|
+
max: {
|
|
20
|
+
type: [Number, null],
|
|
21
|
+
},
|
|
22
|
+
mayBeEmpty: {
|
|
23
|
+
type: Boolean,
|
|
24
|
+
required: false,
|
|
25
|
+
},
|
|
26
|
+
});
|
|
27
|
+
class TableFieldNumber {
|
|
28
|
+
constructor(key, settings = defaultSpecs()) {
|
|
29
|
+
const combinedSettings = Object.assign(Object.assign({}, defaultSpecs()), settings);
|
|
30
|
+
validateInput(numberSpecsSchema, combinedSettings);
|
|
31
|
+
this.key = key;
|
|
32
|
+
this.type = Constants.Name;
|
|
33
|
+
this.title = Constants.Title;
|
|
34
|
+
this.specs = {
|
|
35
|
+
min: combinedSettings.min,
|
|
36
|
+
max: combinedSettings.max,
|
|
37
|
+
mayBeEmpty: combinedSettings.mayBeEmpty,
|
|
38
|
+
};
|
|
39
|
+
}
|
|
40
|
+
}
|
|
41
|
+
export default TableFieldNumber;
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import Schema from 'validno';
|
|
2
|
+
import type { SelectSpecs, TableFieldItem } from '../types.js';
|
|
3
|
+
export declare const selectSpecsSchema: Schema;
|
|
4
|
+
declare class TableFieldSelect implements TableFieldItem<SelectSpecs> {
|
|
5
|
+
key: string;
|
|
6
|
+
type: string;
|
|
7
|
+
title: string;
|
|
8
|
+
specs: SelectSpecs;
|
|
9
|
+
constructor(key: string, settings?: Partial<SelectSpecs>);
|
|
10
|
+
}
|
|
11
|
+
export default TableFieldSelect;
|
|
12
|
+
//# sourceMappingURL=select.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"select.d.ts","sourceRoot":"","sources":["../../../src/kz-schema-factory/fields-to-types/select.ts"],"names":[],"mappings":"AAAA,OAAO,MAAM,MAAM,SAAS,CAAA;AAC5B,OAAO,KAAK,EAAE,WAAW,EAAE,cAAc,EAAE,MAAM,aAAa,CAAA;AAgB9D,eAAO,MAAM,iBAAiB,QAc5B,CAAA;AAEF,cAAM,gBAAiB,YAAW,cAAc,CAAC,WAAW,CAAC;IAC3D,GAAG,EAAE,MAAM,CAAA;IACX,IAAI,EAAE,MAAM,CAAA;IACZ,KAAK,EAAE,MAAM,CAAA;IACb,KAAK,EAAE,WAAW,CAAA;gBAEN,GAAG,EAAE,MAAM,EAAE,QAAQ,GAAE,OAAO,CAAC,WAAW,CAAkB;CAazE;AAED,eAAe,gBAAgB,CAAA"}
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
import Schema from 'validno';
|
|
2
|
+
import validateInput from '../../utils/validate-input.js';
|
|
3
|
+
var Constants;
|
|
4
|
+
(function (Constants) {
|
|
5
|
+
Constants["Name"] = "select";
|
|
6
|
+
Constants["Title"] = "\u0421\u043F\u0438\u0441\u043E\u043A";
|
|
7
|
+
})(Constants || (Constants = {}));
|
|
8
|
+
const defaultSpecs = () => {
|
|
9
|
+
return {
|
|
10
|
+
multiple: false,
|
|
11
|
+
mayBeEmpty: true,
|
|
12
|
+
allowedValues: [],
|
|
13
|
+
};
|
|
14
|
+
};
|
|
15
|
+
export const selectSpecsSchema = new Schema({
|
|
16
|
+
allowedValues: {
|
|
17
|
+
type: Array,
|
|
18
|
+
eachType: String,
|
|
19
|
+
required: false,
|
|
20
|
+
},
|
|
21
|
+
multiple: {
|
|
22
|
+
type: Boolean,
|
|
23
|
+
required: false,
|
|
24
|
+
},
|
|
25
|
+
mayBeEmpty: {
|
|
26
|
+
type: Boolean,
|
|
27
|
+
required: false,
|
|
28
|
+
},
|
|
29
|
+
});
|
|
30
|
+
class TableFieldSelect {
|
|
31
|
+
constructor(key, settings = defaultSpecs()) {
|
|
32
|
+
const settingsCombined = Object.assign(Object.assign({}, defaultSpecs()), settings);
|
|
33
|
+
validateInput(selectSpecsSchema, settingsCombined);
|
|
34
|
+
this.key = key;
|
|
35
|
+
this.type = Constants.Name;
|
|
36
|
+
this.title = Constants.Title;
|
|
37
|
+
this.specs = {
|
|
38
|
+
allowedValues: settingsCombined.allowedValues,
|
|
39
|
+
multiple: settingsCombined.multiple,
|
|
40
|
+
mayBeEmpty: settingsCombined.mayBeEmpty,
|
|
41
|
+
};
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
export default TableFieldSelect;
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import Schema from 'validno';
|
|
2
|
+
import type { StringSpecs, TableFieldItem } from '../types.js';
|
|
3
|
+
export declare const stringSpecsSchema: Schema;
|
|
4
|
+
declare class TableFieldString implements TableFieldItem<StringSpecs> {
|
|
5
|
+
key: string;
|
|
6
|
+
type: string;
|
|
7
|
+
title: string;
|
|
8
|
+
specs: StringSpecs;
|
|
9
|
+
constructor(key: string, settings?: Partial<StringSpecs>);
|
|
10
|
+
}
|
|
11
|
+
export default TableFieldString;
|
|
12
|
+
//# sourceMappingURL=string.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"string.d.ts","sourceRoot":"","sources":["../../../src/kz-schema-factory/fields-to-types/string.ts"],"names":[],"mappings":"AAAA,OAAO,MAAM,MAAM,SAAS,CAAA;AAC5B,OAAO,KAAK,EAAE,WAAW,EAAE,cAAc,EAAE,MAAM,aAAa,CAAA;AAiB9D,eAAO,MAAM,iBAAiB,QAe5B,CAAA;AAEF,cAAM,gBAAiB,YAAW,cAAc,CAAC,WAAW,CAAC;IAC3D,GAAG,EAAE,MAAM,CAAA;IACX,IAAI,EAAE,MAAM,CAAA;IACZ,KAAK,EAAE,MAAM,CAAA;IACb,KAAK,EAAE,WAAW,CAAA;gBAEN,GAAG,EAAE,MAAM,EAAE,QAAQ,GAAE,OAAO,CAAC,WAAW,CAAkB;CAezE;AAED,eAAe,gBAAgB,CAAA"}
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
import Schema from 'validno';
|
|
2
|
+
import validateInput from '../../utils/validate-input.js';
|
|
3
|
+
var Constants;
|
|
4
|
+
(function (Constants) {
|
|
5
|
+
Constants["Name"] = "string";
|
|
6
|
+
Constants["Title"] = "\u0422\u0435\u043A\u0441\u0442";
|
|
7
|
+
})(Constants || (Constants = {}));
|
|
8
|
+
const defaultSpecs = () => {
|
|
9
|
+
return {
|
|
10
|
+
lengthMin: null,
|
|
11
|
+
lengthMax: null,
|
|
12
|
+
mayBeEmpty: true,
|
|
13
|
+
pattern: null,
|
|
14
|
+
};
|
|
15
|
+
};
|
|
16
|
+
export const stringSpecsSchema = new Schema({
|
|
17
|
+
lengthMin: {
|
|
18
|
+
type: [Number, null],
|
|
19
|
+
},
|
|
20
|
+
lengthMax: {
|
|
21
|
+
type: [Number, null],
|
|
22
|
+
},
|
|
23
|
+
mayBeEmpty: {
|
|
24
|
+
type: Boolean,
|
|
25
|
+
required: false,
|
|
26
|
+
},
|
|
27
|
+
pattern: {
|
|
28
|
+
type: [String, null],
|
|
29
|
+
required: false,
|
|
30
|
+
},
|
|
31
|
+
});
|
|
32
|
+
class TableFieldString {
|
|
33
|
+
constructor(key, settings = defaultSpecs()) {
|
|
34
|
+
const settingsCombined = Object.assign(Object.assign({}, defaultSpecs()), settings);
|
|
35
|
+
validateInput(stringSpecsSchema, settingsCombined);
|
|
36
|
+
this.key = key;
|
|
37
|
+
this.type = Constants.Name;
|
|
38
|
+
this.title = Constants.Title;
|
|
39
|
+
this.specs = {
|
|
40
|
+
lengthMin: settingsCombined.lengthMin,
|
|
41
|
+
lengthMax: settingsCombined.lengthMax,
|
|
42
|
+
pattern: settingsCombined.pattern,
|
|
43
|
+
mayBeEmpty: settingsCombined.mayBeEmpty,
|
|
44
|
+
};
|
|
45
|
+
}
|
|
46
|
+
}
|
|
47
|
+
export default TableFieldString;
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import Schema from 'validno';
|
|
2
|
+
import type { TableFieldItem, UrlSpecs } from '../types.js';
|
|
3
|
+
export declare const urlSpecsSchema: Schema;
|
|
4
|
+
declare class TableFieldUrl implements TableFieldItem<UrlSpecs> {
|
|
5
|
+
key: string;
|
|
6
|
+
type: string;
|
|
7
|
+
title: string;
|
|
8
|
+
specs: UrlSpecs;
|
|
9
|
+
constructor(key: string, settings?: Partial<UrlSpecs>);
|
|
10
|
+
}
|
|
11
|
+
export default TableFieldUrl;
|
|
12
|
+
//# sourceMappingURL=url.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"url.d.ts","sourceRoot":"","sources":["../../../src/kz-schema-factory/fields-to-types/url.ts"],"names":[],"mappings":"AAAA,OAAO,MAAM,MAAM,SAAS,CAAA;AAC5B,OAAO,KAAK,EAAE,cAAc,EAAE,QAAQ,EAAE,MAAM,aAAa,CAAA;AAgB3D,eAAO,MAAM,cAAc,QAezB,CAAA;AAEF,cAAM,aAAc,YAAW,cAAc,CAAC,QAAQ,CAAC;IACrD,GAAG,EAAE,MAAM,CAAA;IACX,IAAI,EAAE,MAAM,CAAA;IACZ,KAAK,EAAE,MAAM,CAAA;IACb,KAAK,EAAE,QAAQ,CAAA;gBAEH,GAAG,EAAE,MAAM,EAAE,QAAQ,GAAE,OAAO,CAAC,QAAQ,CAAkB;CAatE;AAED,eAAe,aAAa,CAAA"}
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
import Schema from 'validno';
|
|
2
|
+
import validateInput from '../../utils/validate-input.js';
|
|
3
|
+
var Constants;
|
|
4
|
+
(function (Constants) {
|
|
5
|
+
Constants["Name"] = "url";
|
|
6
|
+
Constants["Title"] = "URL";
|
|
7
|
+
})(Constants || (Constants = {}));
|
|
8
|
+
const defaultSpecs = () => {
|
|
9
|
+
return {
|
|
10
|
+
allowedDomains: [],
|
|
11
|
+
exceptDomains: [],
|
|
12
|
+
mayBeEmpty: true,
|
|
13
|
+
};
|
|
14
|
+
};
|
|
15
|
+
export const urlSpecsSchema = new Schema({
|
|
16
|
+
allowedDomains: {
|
|
17
|
+
type: Array,
|
|
18
|
+
eachType: String,
|
|
19
|
+
required: false,
|
|
20
|
+
},
|
|
21
|
+
exceptDomains: {
|
|
22
|
+
type: Array,
|
|
23
|
+
eachType: String,
|
|
24
|
+
required: false,
|
|
25
|
+
},
|
|
26
|
+
mayBeEmpty: {
|
|
27
|
+
type: Boolean,
|
|
28
|
+
required: false,
|
|
29
|
+
},
|
|
30
|
+
});
|
|
31
|
+
class TableFieldUrl {
|
|
32
|
+
constructor(key, settings = defaultSpecs()) {
|
|
33
|
+
const settingsCombined = Object.assign(Object.assign({}, defaultSpecs()), settings);
|
|
34
|
+
validateInput(urlSpecsSchema, settingsCombined);
|
|
35
|
+
this.key = key;
|
|
36
|
+
this.type = Constants.Name;
|
|
37
|
+
this.title = Constants.Title;
|
|
38
|
+
this.specs = {
|
|
39
|
+
allowedDomains: settingsCombined.allowedDomains,
|
|
40
|
+
exceptDomains: settingsCombined.exceptDomains,
|
|
41
|
+
mayBeEmpty: settingsCombined.mayBeEmpty,
|
|
42
|
+
};
|
|
43
|
+
}
|
|
44
|
+
}
|
|
45
|
+
export default TableFieldUrl;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"autofieldCreatedAt.d.ts","sourceRoot":"","sources":["../../../src/kz-schema-factory/types-constructors/autofieldCreatedAt.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,qBAAqB,CAAA;AACrD,OAAO,cAAc,MAAM,WAAW,CAAA;AAEtC,eAAO,MAAM,kBAAkB,EAAE,UAAU,CAAC,cAAc,CAczD,CAAA"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"autofieldId.d.ts","sourceRoot":"","sources":["../../../src/kz-schema-factory/types-constructors/autofieldId.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,qBAAqB,CAAA;AACrD,OAAO,gBAAgB,MAAM,aAAa,CAAA;AAE1C,eAAO,MAAM,WAAW,EAAE,UAAU,CAAC,gBAAgB,CAepD,CAAA"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"autofieldUpdatedAt.d.ts","sourceRoot":"","sources":["../../../src/kz-schema-factory/types-constructors/autofieldUpdatedAt.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,qBAAqB,CAAA;AACrD,OAAO,cAAc,MAAM,WAAW,CAAA;AAEtC,eAAO,MAAM,kBAAkB,EAAE,UAAU,CAAC,cAAc,CAczD,CAAA"}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import Schema from 'validno';
|
|
2
|
+
import type { BooleanSpecs, TableFieldItem } from '../types.js';
|
|
3
|
+
export declare const booleanSpecsSchema: Schema;
|
|
4
|
+
declare class TableFieldBoolean implements TableFieldItem<BooleanSpecs> {
|
|
5
|
+
key: string;
|
|
6
|
+
type: string;
|
|
7
|
+
title: string;
|
|
8
|
+
specs: BooleanSpecs;
|
|
9
|
+
constructor(key: string, settings?: Partial<BooleanSpecs>);
|
|
10
|
+
}
|
|
11
|
+
export default TableFieldBoolean;
|
|
12
|
+
//# sourceMappingURL=boolean.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"boolean.d.ts","sourceRoot":"","sources":["../../../src/kz-schema-factory/types-constructors/boolean.ts"],"names":[],"mappings":"AAAA,OAAO,MAAM,MAAM,SAAS,CAAA;AAC5B,OAAO,KAAK,EAAE,YAAY,EAAE,cAAc,EAAE,MAAM,aAAa,CAAA;AAc/D,eAAO,MAAM,kBAAkB,QAI7B,CAAA;AAEF,cAAM,iBAAkB,YAAW,cAAc,CAAC,YAAY,CAAC;IAC7D,GAAG,EAAE,MAAM,CAAA;IACX,IAAI,EAAE,MAAM,CAAA;IACZ,KAAK,EAAE,MAAM,CAAA;IACb,KAAK,EAAE,YAAY,CAAA;gBAEP,GAAG,EAAE,MAAM,EAAE,QAAQ,GAAE,OAAO,CAAC,YAAY,CAAkB;CAW1E;AAED,eAAe,iBAAiB,CAAA"}
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import Schema from 'validno';
|
|
2
|
+
import validateInput from '../../utils/validate-input.js';
|
|
3
|
+
var Constants;
|
|
4
|
+
(function (Constants) {
|
|
5
|
+
Constants["Name"] = "boolean";
|
|
6
|
+
Constants["Title"] = "\u0414\u0430/\u041D\u0435\u0442";
|
|
7
|
+
})(Constants || (Constants = {}));
|
|
8
|
+
const defaultSpecs = () => {
|
|
9
|
+
return {
|
|
10
|
+
onlyTrue: false,
|
|
11
|
+
};
|
|
12
|
+
};
|
|
13
|
+
export const booleanSpecsSchema = new Schema({
|
|
14
|
+
onlyTrue: {
|
|
15
|
+
type: Boolean,
|
|
16
|
+
},
|
|
17
|
+
});
|
|
18
|
+
class TableFieldBoolean {
|
|
19
|
+
constructor(key, settings = defaultSpecs()) {
|
|
20
|
+
const combinedSettings = Object.assign(Object.assign({}, defaultSpecs()), settings);
|
|
21
|
+
validateInput(booleanSpecsSchema, combinedSettings);
|
|
22
|
+
this.key = key;
|
|
23
|
+
this.type = Constants.Name;
|
|
24
|
+
this.title = Constants.Title;
|
|
25
|
+
this.specs = {
|
|
26
|
+
onlyTrue: combinedSettings.onlyTrue,
|
|
27
|
+
};
|
|
28
|
+
}
|
|
29
|
+
}
|
|
30
|
+
export default TableFieldBoolean;
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import Schema from 'validno';
|
|
2
|
+
import type { DateSpecs, TableFieldItem } from '../types.js';
|
|
3
|
+
export declare const dateSpecsSchema: Schema;
|
|
4
|
+
declare class TableFieldDate implements TableFieldItem<DateSpecs> {
|
|
5
|
+
key: string;
|
|
6
|
+
type: string;
|
|
7
|
+
title: string;
|
|
8
|
+
specs: DateSpecs;
|
|
9
|
+
constructor(key: string, settings?: Partial<DateSpecs>);
|
|
10
|
+
}
|
|
11
|
+
export default TableFieldDate;
|
|
12
|
+
//# sourceMappingURL=date.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"date.d.ts","sourceRoot":"","sources":["../../../src/kz-schema-factory/types-constructors/date.ts"],"names":[],"mappings":"AAAA,OAAO,MAAM,MAAM,SAAS,CAAA;AAC5B,OAAO,KAAK,EAAE,SAAS,EAAE,cAAc,EAAE,MAAM,aAAa,CAAA;AAgB5D,eAAO,MAAM,eAAe,QAa1B,CAAA;AAEF,cAAM,cAAe,YAAW,cAAc,CAAC,SAAS,CAAC;IACvD,GAAG,EAAE,MAAM,CAAA;IACX,IAAI,EAAE,MAAM,CAAA;IACZ,KAAK,EAAE,MAAM,CAAA;IACb,KAAK,EAAE,SAAS,CAAA;gBAEJ,GAAG,EAAE,MAAM,EAAE,QAAQ,GAAE,OAAO,CAAC,SAAS,CAAkB;CAavE;AAED,eAAe,cAAc,CAAA"}
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
import Schema from 'validno';
|
|
2
|
+
import validateInput from '../../utils/validate-input.js';
|
|
3
|
+
var Constants;
|
|
4
|
+
(function (Constants) {
|
|
5
|
+
Constants["Name"] = "date";
|
|
6
|
+
Constants["Title"] = "\u0414\u0430\u0442\u0430";
|
|
7
|
+
})(Constants || (Constants = {}));
|
|
8
|
+
const defaultSpecs = () => {
|
|
9
|
+
return {
|
|
10
|
+
min: null,
|
|
11
|
+
max: null,
|
|
12
|
+
mayBeEmpty: true,
|
|
13
|
+
};
|
|
14
|
+
};
|
|
15
|
+
export const dateSpecsSchema = new Schema({
|
|
16
|
+
min: {
|
|
17
|
+
type: [Date, null],
|
|
18
|
+
required: false,
|
|
19
|
+
},
|
|
20
|
+
max: {
|
|
21
|
+
type: [Date, null],
|
|
22
|
+
required: false,
|
|
23
|
+
},
|
|
24
|
+
mayBeEmpty: {
|
|
25
|
+
type: Boolean,
|
|
26
|
+
required: false,
|
|
27
|
+
},
|
|
28
|
+
});
|
|
29
|
+
class TableFieldDate {
|
|
30
|
+
constructor(key, settings = defaultSpecs()) {
|
|
31
|
+
const combinedSettings = Object.assign(Object.assign({}, defaultSpecs()), settings);
|
|
32
|
+
validateInput(dateSpecsSchema, combinedSettings);
|
|
33
|
+
this.key = key;
|
|
34
|
+
this.type = Constants.Name;
|
|
35
|
+
this.title = Constants.Title;
|
|
36
|
+
this.specs = {
|
|
37
|
+
min: combinedSettings.min,
|
|
38
|
+
max: combinedSettings.max,
|
|
39
|
+
mayBeEmpty: combinedSettings.mayBeEmpty,
|
|
40
|
+
};
|
|
41
|
+
}
|
|
42
|
+
}
|
|
43
|
+
export default TableFieldDate;
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import Schema from 'validno';
|
|
2
|
+
import type { EmailSpecs, TableFieldItem } from '../types.js';
|
|
3
|
+
export declare const emailSpecsSchema: Schema;
|
|
4
|
+
declare class TableFieldEmail implements TableFieldItem<EmailSpecs> {
|
|
5
|
+
key: string;
|
|
6
|
+
type: string;
|
|
7
|
+
title: string;
|
|
8
|
+
specs: EmailSpecs;
|
|
9
|
+
constructor(key: string, settings?: Partial<EmailSpecs>);
|
|
10
|
+
}
|
|
11
|
+
export default TableFieldEmail;
|
|
12
|
+
//# sourceMappingURL=email.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"email.d.ts","sourceRoot":"","sources":["../../../src/kz-schema-factory/types-constructors/email.ts"],"names":[],"mappings":"AAAA,OAAO,MAAM,MAAM,SAAS,CAAA;AAC5B,OAAO,KAAK,EAAE,UAAU,EAAE,cAAc,EAAE,MAAM,aAAa,CAAA;AAgB7D,eAAO,MAAM,gBAAgB,QAe3B,CAAA;AAEF,cAAM,eAAgB,YAAW,cAAc,CAAC,UAAU,CAAC;IACzD,GAAG,EAAE,MAAM,CAAA;IACX,IAAI,EAAE,MAAM,CAAA;IACZ,KAAK,EAAE,MAAM,CAAA;IACb,KAAK,EAAE,UAAU,CAAA;gBAEL,GAAG,EAAE,MAAM,EAAE,QAAQ,GAAE,OAAO,CAAC,UAAU,CAAkB;CAaxE;AAED,eAAe,eAAe,CAAA"}
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
import Schema from 'validno';
|
|
2
|
+
import validateInput from '../../utils/validate-input.js';
|
|
3
|
+
var Constants;
|
|
4
|
+
(function (Constants) {
|
|
5
|
+
Constants["Name"] = "email";
|
|
6
|
+
Constants["Title"] = "Email";
|
|
7
|
+
})(Constants || (Constants = {}));
|
|
8
|
+
const defaultSpecs = () => {
|
|
9
|
+
return {
|
|
10
|
+
allowedDomains: [],
|
|
11
|
+
exceptDomains: [],
|
|
12
|
+
mayBeEmpty: true,
|
|
13
|
+
};
|
|
14
|
+
};
|
|
15
|
+
export const emailSpecsSchema = new Schema({
|
|
16
|
+
allowedDomains: {
|
|
17
|
+
type: Array,
|
|
18
|
+
eachType: String,
|
|
19
|
+
required: false,
|
|
20
|
+
},
|
|
21
|
+
exceptDomains: {
|
|
22
|
+
type: Array,
|
|
23
|
+
eachType: String,
|
|
24
|
+
required: false,
|
|
25
|
+
},
|
|
26
|
+
mayBeEmpty: {
|
|
27
|
+
type: Boolean,
|
|
28
|
+
required: false,
|
|
29
|
+
},
|
|
30
|
+
});
|
|
31
|
+
class TableFieldEmail {
|
|
32
|
+
constructor(key, settings = defaultSpecs()) {
|
|
33
|
+
const combinerSettings = Object.assign(Object.assign({}, defaultSpecs()), settings);
|
|
34
|
+
validateInput(emailSpecsSchema, combinerSettings);
|
|
35
|
+
this.key = key;
|
|
36
|
+
this.type = Constants.Name;
|
|
37
|
+
this.title = Constants.Title;
|
|
38
|
+
this.specs = {
|
|
39
|
+
allowedDomains: combinerSettings.allowedDomains,
|
|
40
|
+
exceptDomains: combinerSettings.exceptDomains,
|
|
41
|
+
mayBeEmpty: combinerSettings.mayBeEmpty,
|
|
42
|
+
};
|
|
43
|
+
}
|
|
44
|
+
}
|
|
45
|
+
export default TableFieldEmail;
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import Schema from 'validno';
|
|
2
|
+
import type { JsonSpecs, TableFieldItem } from '../types.js';
|
|
3
|
+
export declare const jsonSpecsSchema: Schema;
|
|
4
|
+
declare class TableFieldJson implements TableFieldItem<JsonSpecs> {
|
|
5
|
+
key: string;
|
|
6
|
+
type: string;
|
|
7
|
+
title: string;
|
|
8
|
+
specs: JsonSpecs;
|
|
9
|
+
constructor(key: string, settings?: Partial<JsonSpecs>);
|
|
10
|
+
}
|
|
11
|
+
export default TableFieldJson;
|
|
12
|
+
//# sourceMappingURL=json.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"json.d.ts","sourceRoot":"","sources":["../../../src/kz-schema-factory/types-constructors/json.ts"],"names":[],"mappings":"AAAA,OAAO,MAAM,MAAM,SAAS,CAAA;AAC5B,OAAO,KAAK,EAAE,SAAS,EAAE,cAAc,EAAE,MAAM,aAAa,CAAA;AAe5D,eAAO,MAAM,eAAe,QAW1B,CAAA;AAEF,cAAM,cAAe,YAAW,cAAc,CAAC,SAAS,CAAC;IACvD,GAAG,EAAE,MAAM,CAAA;IACX,IAAI,EAAE,MAAM,CAAA;IACZ,KAAK,EAAE,MAAM,CAAA;IACb,KAAK,EAAE,SAAS,CAAA;gBAEJ,GAAG,EAAE,MAAM,EAAE,QAAQ,GAAE,OAAO,CAAC,SAAS,CAAkB;CAYvE;AAED,eAAe,cAAc,CAAA"}
|