@datacapy/schema 0.1.0
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/LICENSE +29 -0
- package/README.md +113 -0
- package/dist/builder/builder-array.d.ts +11 -0
- package/dist/builder/builder-array.js +35 -0
- package/dist/builder/builder-array.js.map +1 -0
- package/dist/builder/builder-base.d.ts +25 -0
- package/dist/builder/builder-base.js +140 -0
- package/dist/builder/builder-base.js.map +1 -0
- package/dist/builder/builder-boolean.d.ts +5 -0
- package/dist/builder/builder-boolean.js +12 -0
- package/dist/builder/builder-boolean.js.map +1 -0
- package/dist/builder/builder-date.d.ts +5 -0
- package/dist/builder/builder-date.js +12 -0
- package/dist/builder/builder-date.js.map +1 -0
- package/dist/builder/builder-mixed.d.ts +7 -0
- package/dist/builder/builder-mixed.js +16 -0
- package/dist/builder/builder-mixed.js.map +1 -0
- package/dist/builder/builder-number.d.ts +5 -0
- package/dist/builder/builder-number.js +12 -0
- package/dist/builder/builder-number.js.map +1 -0
- package/dist/builder/builder-object.d.ts +17 -0
- package/dist/builder/builder-object.js +47 -0
- package/dist/builder/builder-object.js.map +1 -0
- package/dist/builder/builder-or.d.ts +9 -0
- package/dist/builder/builder-or.js +23 -0
- package/dist/builder/builder-or.js.map +1 -0
- package/dist/builder/builder-schema.d.ts +18 -0
- package/dist/builder/builder-schema.js +68 -0
- package/dist/builder/builder-schema.js.map +1 -0
- package/dist/builder/builder-string.d.ts +17 -0
- package/dist/builder/builder-string.js +106 -0
- package/dist/builder/builder-string.js.map +1 -0
- package/dist/builder/index.d.ts +14 -0
- package/dist/builder/index.js +28 -0
- package/dist/builder/index.js.map +1 -0
- package/dist/builder/schema-builder.d.ts +25 -0
- package/dist/builder/schema-builder.js +46 -0
- package/dist/builder/schema-builder.js.map +1 -0
- package/dist/config.d.ts +17 -0
- package/dist/config.js +3 -0
- package/dist/config.js.map +1 -0
- package/dist/encryption/encryption-service.d.ts +4 -0
- package/dist/encryption/encryption-service.js +3 -0
- package/dist/encryption/encryption-service.js.map +1 -0
- package/dist/encryption/index.d.ts +1 -0
- package/dist/encryption/index.js +18 -0
- package/dist/encryption/index.js.map +1 -0
- package/dist/filter/filter-abstract.d.ts +9 -0
- package/dist/filter/filter-abstract.js +11 -0
- package/dist/filter/filter-abstract.js.map +1 -0
- package/dist/filter/filter-callback.d.ts +6 -0
- package/dist/filter/filter-callback.js +18 -0
- package/dist/filter/filter-callback.js.map +1 -0
- package/dist/filter/filter-condition.d.ts +8 -0
- package/dist/filter/filter-condition.js +15 -0
- package/dist/filter/filter-condition.js.map +1 -0
- package/dist/filter/filter-default-value.d.ts +10 -0
- package/dist/filter/filter-default-value.js +29 -0
- package/dist/filter/filter-default-value.js.map +1 -0
- package/dist/filter/filter-lowercase.d.ts +6 -0
- package/dist/filter/filter-lowercase.js +17 -0
- package/dist/filter/filter-lowercase.js.map +1 -0
- package/dist/filter/filter-postcode.d.ts +7 -0
- package/dist/filter/filter-postcode.js +30 -0
- package/dist/filter/filter-postcode.js.map +1 -0
- package/dist/filter/filter-prepend-http.d.ts +6 -0
- package/dist/filter/filter-prepend-http.js +17 -0
- package/dist/filter/filter-prepend-http.js.map +1 -0
- package/dist/filter/filter-strip-html.d.ts +13 -0
- package/dist/filter/filter-strip-html.js +96 -0
- package/dist/filter/filter-strip-html.js.map +1 -0
- package/dist/filter/filter-trim.d.ts +6 -0
- package/dist/filter/filter-trim.js +17 -0
- package/dist/filter/filter-trim.js.map +1 -0
- package/dist/filter/filter-uppercase.d.ts +6 -0
- package/dist/filter/filter-uppercase.js +17 -0
- package/dist/filter/filter-uppercase.js.map +1 -0
- package/dist/filter/filter.d.ts +7 -0
- package/dist/filter/filter.js +59 -0
- package/dist/filter/filter.js.map +1 -0
- package/dist/filter/index.d.ts +9 -0
- package/dist/filter/index.js +26 -0
- package/dist/filter/index.js.map +1 -0
- package/dist/index.d.ts +18 -0
- package/dist/index.js +39 -0
- package/dist/index.js.map +1 -0
- package/dist/inquisitor.d.ts +9 -0
- package/dist/inquisitor.js +44 -0
- package/dist/inquisitor.js.map +1 -0
- package/dist/iterator.d.ts +70 -0
- package/dist/iterator.js +339 -0
- package/dist/iterator.js.map +1 -0
- package/dist/manager.d.ts +30 -0
- package/dist/manager.js +55 -0
- package/dist/manager.js.map +1 -0
- package/dist/processors/field-filter.d.ts +32 -0
- package/dist/processors/field-filter.js +114 -0
- package/dist/processors/field-filter.js.map +1 -0
- package/dist/processors/field-private-filter.d.ts +9 -0
- package/dist/processors/field-private-filter.js +84 -0
- package/dist/processors/field-private-filter.js.map +1 -0
- package/dist/processors/field-type-caster.d.ts +12 -0
- package/dist/processors/field-type-caster.js +89 -0
- package/dist/processors/field-type-caster.js.map +1 -0
- package/dist/processors/field-validator.d.ts +36 -0
- package/dist/processors/field-validator.js +171 -0
- package/dist/processors/field-validator.js.map +1 -0
- package/dist/processors/index.d.ts +5 -0
- package/dist/processors/index.js +22 -0
- package/dist/processors/index.js.map +1 -0
- package/dist/processors/transient-processor.d.ts +23 -0
- package/dist/processors/transient-processor.js +124 -0
- package/dist/processors/transient-processor.js.map +1 -0
- package/dist/schema.d.ts +104 -0
- package/dist/schema.js +400 -0
- package/dist/schema.js.map +1 -0
- package/dist/spec.d.ts +69 -0
- package/dist/spec.js +3 -0
- package/dist/spec.js.map +1 -0
- package/dist/type/PropsOf.d.ts +5 -0
- package/dist/type/PropsOf.js +3 -0
- package/dist/type/PropsOf.js.map +1 -0
- package/dist/type/index.d.ts +1 -0
- package/dist/type/index.js +18 -0
- package/dist/type/index.js.map +1 -0
- package/dist/types.d.ts +13 -0
- package/dist/types.js +21 -0
- package/dist/types.js.map +1 -0
- package/dist/utilities/collection.d.ts +10 -0
- package/dist/utilities/collection.js +41 -0
- package/dist/utilities/collection.js.map +1 -0
- package/dist/utilities/index.d.ts +4 -0
- package/dist/utilities/index.js +21 -0
- package/dist/utilities/index.js.map +1 -0
- package/dist/utilities/object-path-accessor.d.ts +16 -0
- package/dist/utilities/object-path-accessor.js +132 -0
- package/dist/utilities/object-path-accessor.js.map +1 -0
- package/dist/utilities/type-caster.d.ts +10 -0
- package/dist/utilities/type-caster.js +126 -0
- package/dist/utilities/type-caster.js.map +1 -0
- package/dist/utilities/utility.d.ts +8 -0
- package/dist/utilities/utility.js +53 -0
- package/dist/utilities/utility.js.map +1 -0
- package/dist/validator/index.d.ts +12 -0
- package/dist/validator/index.js +29 -0
- package/dist/validator/index.js.map +1 -0
- package/dist/validator/validator-callback.d.ts +6 -0
- package/dist/validator/validator-callback.js +15 -0
- package/dist/validator/validator-callback.js.map +1 -0
- package/dist/validator/validator-email.d.ts +5 -0
- package/dist/validator/validator-email.js +20 -0
- package/dist/validator/validator-email.js.map +1 -0
- package/dist/validator/validator-equality.d.ts +5 -0
- package/dist/validator/validator-equality.js +19 -0
- package/dist/validator/validator-equality.js.map +1 -0
- package/dist/validator/validator-in-array.d.ts +5 -0
- package/dist/validator/validator-in-array.js +17 -0
- package/dist/validator/validator-in-array.js.map +1 -0
- package/dist/validator/validator-interface.d.ts +5 -0
- package/dist/validator/validator-interface.js +3 -0
- package/dist/validator/validator-interface.js.map +1 -0
- package/dist/validator/validator-is-empty.d.ts +5 -0
- package/dist/validator/validator-is-empty.js +37 -0
- package/dist/validator/validator-is-empty.js.map +1 -0
- package/dist/validator/validator-not-empty.d.ts +5 -0
- package/dist/validator/validator-not-empty.js +21 -0
- package/dist/validator/validator-not-empty.js.map +1 -0
- package/dist/validator/validator-not-null.d.ts +5 -0
- package/dist/validator/validator-not-null.js +19 -0
- package/dist/validator/validator-not-null.js.map +1 -0
- package/dist/validator/validator-regex.d.ts +5 -0
- package/dist/validator/validator-regex.js +20 -0
- package/dist/validator/validator-regex.js.map +1 -0
- package/dist/validator/validator-required.d.ts +5 -0
- package/dist/validator/validator-required.js +18 -0
- package/dist/validator/validator-required.js.map +1 -0
- package/dist/validator/validator-value-length.d.ts +5 -0
- package/dist/validator/validator-value-length.js +39 -0
- package/dist/validator/validator-value-length.js.map +1 -0
- package/dist/validator/validator.d.ts +7 -0
- package/dist/validator/validator.js +72 -0
- package/dist/validator/validator.js.map +1 -0
- package/package.json +51 -0
- package/tsconfig.json +26 -0
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.BuilderSchema = void 0;
|
|
4
|
+
const builder_base_1 = require("./builder-base");
|
|
5
|
+
class BuilderSchema {
|
|
6
|
+
constructor(name) {
|
|
7
|
+
this.spec = {};
|
|
8
|
+
if (name)
|
|
9
|
+
this.spec.$name = name;
|
|
10
|
+
}
|
|
11
|
+
name(name) {
|
|
12
|
+
this.spec.$name = name;
|
|
13
|
+
return this;
|
|
14
|
+
}
|
|
15
|
+
construct(constructorName) {
|
|
16
|
+
this.spec.$construct = constructorName;
|
|
17
|
+
return this;
|
|
18
|
+
}
|
|
19
|
+
constructCollection(constructorName) {
|
|
20
|
+
this.spec.$constructCollection = constructorName;
|
|
21
|
+
return this;
|
|
22
|
+
}
|
|
23
|
+
strict(value = true) {
|
|
24
|
+
this.spec.$strict = value;
|
|
25
|
+
return this;
|
|
26
|
+
}
|
|
27
|
+
shape(fields) {
|
|
28
|
+
Object.entries(fields).forEach(([key, value]) => {
|
|
29
|
+
this.spec[key] = value instanceof builder_base_1.BuilderBase ? value.build() : value;
|
|
30
|
+
});
|
|
31
|
+
return this;
|
|
32
|
+
}
|
|
33
|
+
matchAll(fieldSpec) {
|
|
34
|
+
const spec = fieldSpec instanceof builder_base_1.BuilderBase ? fieldSpec.build() : fieldSpec;
|
|
35
|
+
this.spec['*'] = spec;
|
|
36
|
+
return this;
|
|
37
|
+
}
|
|
38
|
+
extend(baseSpec) {
|
|
39
|
+
Object.assign(this.spec, baseSpec);
|
|
40
|
+
return this;
|
|
41
|
+
}
|
|
42
|
+
static buildValue(value) {
|
|
43
|
+
if (value instanceof builder_base_1.BuilderBase) {
|
|
44
|
+
return value.build();
|
|
45
|
+
}
|
|
46
|
+
if (Array.isArray(value)) {
|
|
47
|
+
return value.map((item) => BuilderSchema.buildValue(item));
|
|
48
|
+
}
|
|
49
|
+
if (value && typeof value === 'object' && value.constructor === Object) {
|
|
50
|
+
const result = {};
|
|
51
|
+
for (const key in value) {
|
|
52
|
+
result[key] = BuilderSchema.buildValue(value[key]);
|
|
53
|
+
}
|
|
54
|
+
return result;
|
|
55
|
+
}
|
|
56
|
+
return value;
|
|
57
|
+
}
|
|
58
|
+
build() {
|
|
59
|
+
const builtSpec = {};
|
|
60
|
+
for (const key in this.spec) {
|
|
61
|
+
builtSpec[key] = BuilderSchema.buildValue(this.spec[key]);
|
|
62
|
+
}
|
|
63
|
+
return builtSpec;
|
|
64
|
+
}
|
|
65
|
+
}
|
|
66
|
+
exports.BuilderSchema = BuilderSchema;
|
|
67
|
+
exports.default = BuilderSchema;
|
|
68
|
+
//# sourceMappingURL=builder-schema.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"builder-schema.js","sourceRoot":"","sources":["../../src/builder/builder-schema.ts"],"names":[],"mappings":";;;AAAA,iDAA4C;AAO5C,MAAa,aAAa;IAGxB,YAAY,IAAa;QAFjB,SAAI,GAAe,EAAE,CAAA;QAG3B,IAAI,IAAI;YAAE,IAAI,CAAC,IAAI,CAAC,KAAK,GAAG,IAAI,CAAA;IAClC,CAAC;IAKD,IAAI,CAAC,IAAY;QACf,IAAI,CAAC,IAAI,CAAC,KAAK,GAAG,IAAI,CAAA;QACtB,OAAO,IAAI,CAAA;IACb,CAAC;IAKD,SAAS,CAAC,eAAkC;QAC1C,IAAI,CAAC,IAAI,CAAC,UAAU,GAAG,eAAe,CAAA;QACtC,OAAO,IAAI,CAAA;IACb,CAAC;IAKD,mBAAmB,CAAC,eAAkC;QACpD,IAAI,CAAC,IAAI,CAAC,oBAAoB,GAAG,eAAe,CAAA;QAChD,OAAO,IAAI,CAAA;IACb,CAAC;IAKD,MAAM,CAAC,QAAiB,IAAI;QAC1B,I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AE,CAAA;YACtB,KAAK,MAAM,GAAG,IAAI,KAAK,EAAE,CAAC;gBACxB,MAAM,CAAC,GAAG,CAAC,GAAG,aAAa,CAAC,UAAU,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,CAAA;YACpD,CAAC;YACD,OAAO,MAAM,CAAA;QACf,CAAC;QAGD,OAAO,KAAK,CAAA;IACd,CAAC;IAKD,KAAK;QACH,MAAM,SAAS,GAAe,EAAE,CAAA;QAGhC,KAAK,MAAM,GAAG,IAAI,IAAI,CAAC,IAAI,EAAE,CAAC;YAC5B,SAAS,CAAC,GAAG,CAAC,GAAG,aAAa,CAAC,UAAU,CAAC,IAAI,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC,CAAA;QAC3D,CAAC;QAED,OAAO,SAAS,CAAA;IAClB,CAAC;CACF;AA3GD,sCA2GC;AAED,kBAAe,aAAa,CAAA"}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { BuilderBase } from './builder-base';
|
|
2
|
+
import { SchemaSpecValidateOptions, SchemaSpecValidateOptionsInArray, SchemaSpecValidateOptionsRegex } from '../spec';
|
|
3
|
+
export declare class BuilderString extends BuilderBase<string> {
|
|
4
|
+
protected getType(): StringConstructor;
|
|
5
|
+
email(options?: SchemaSpecValidateOptions): this;
|
|
6
|
+
minLength(min: number, options?: SchemaSpecValidateOptions): this;
|
|
7
|
+
maxLength(max: number, options?: SchemaSpecValidateOptions): this;
|
|
8
|
+
length(min: number, max: number, options?: SchemaSpecValidateOptions): this;
|
|
9
|
+
regex(pattern: RegExp | string, options?: SchemaSpecValidateOptionsRegex): this;
|
|
10
|
+
inArray(values: string[], options?: SchemaSpecValidateOptionsInArray): this;
|
|
11
|
+
trim(): this;
|
|
12
|
+
uppercase(): this;
|
|
13
|
+
lowercase(): this;
|
|
14
|
+
stripHtml(): this;
|
|
15
|
+
prependHttpIfMissing(): this;
|
|
16
|
+
}
|
|
17
|
+
export default BuilderString;
|
|
@@ -0,0 +1,106 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.BuilderString = void 0;
|
|
4
|
+
const builder_base_1 = require("./builder-base");
|
|
5
|
+
class BuilderString extends builder_base_1.BuilderBase {
|
|
6
|
+
getType() {
|
|
7
|
+
return String;
|
|
8
|
+
}
|
|
9
|
+
email(options) {
|
|
10
|
+
if (!this.spec.$validate)
|
|
11
|
+
this.spec.$validate = {};
|
|
12
|
+
this.spec.$validate.email = options || true;
|
|
13
|
+
return this;
|
|
14
|
+
}
|
|
15
|
+
minLength(min, options) {
|
|
16
|
+
if (!this.spec.$validate)
|
|
17
|
+
this.spec.$validate = {};
|
|
18
|
+
if (!this.spec.$validate.valueLength) {
|
|
19
|
+
this.spec.$validate.valueLength = {};
|
|
20
|
+
}
|
|
21
|
+
this.spec.$validate.valueLength.min = min;
|
|
22
|
+
if (options) {
|
|
23
|
+
Object.assign(this.spec.$validate.valueLength, options);
|
|
24
|
+
}
|
|
25
|
+
return this;
|
|
26
|
+
}
|
|
27
|
+
maxLength(max, options) {
|
|
28
|
+
if (!this.spec.$validate)
|
|
29
|
+
this.spec.$validate = {};
|
|
30
|
+
if (!this.spec.$validate.valueLength) {
|
|
31
|
+
this.spec.$validate.valueLength = {};
|
|
32
|
+
}
|
|
33
|
+
this.spec.$validate.valueLength.max = max;
|
|
34
|
+
if (options) {
|
|
35
|
+
Object.assign(this.spec.$validate.valueLength, options);
|
|
36
|
+
}
|
|
37
|
+
return this;
|
|
38
|
+
}
|
|
39
|
+
length(min, max, options) {
|
|
40
|
+
if (!this.spec.$validate)
|
|
41
|
+
this.spec.$validate = {};
|
|
42
|
+
this.spec.$validate.valueLength = { min, max, ...options };
|
|
43
|
+
return this;
|
|
44
|
+
}
|
|
45
|
+
regex(pattern, options) {
|
|
46
|
+
if (!this.spec.$validate)
|
|
47
|
+
this.spec.$validate = {};
|
|
48
|
+
const regexSpec = {
|
|
49
|
+
pattern,
|
|
50
|
+
...options,
|
|
51
|
+
};
|
|
52
|
+
if (this.spec.$validate.regex) {
|
|
53
|
+
if (Array.isArray(this.spec.$validate.regex)) {
|
|
54
|
+
this.spec.$validate.regex.push(regexSpec);
|
|
55
|
+
}
|
|
56
|
+
else {
|
|
57
|
+
this.spec.$validate.regex = [this.spec.$validate.regex, regexSpec];
|
|
58
|
+
}
|
|
59
|
+
}
|
|
60
|
+
else {
|
|
61
|
+
this.spec.$validate.regex = regexSpec;
|
|
62
|
+
}
|
|
63
|
+
return this;
|
|
64
|
+
}
|
|
65
|
+
inArray(values, options) {
|
|
66
|
+
if (!this.spec.$validate)
|
|
67
|
+
this.spec.$validate = {};
|
|
68
|
+
this.spec.$validate.inArray = {
|
|
69
|
+
values,
|
|
70
|
+
...options,
|
|
71
|
+
};
|
|
72
|
+
return this;
|
|
73
|
+
}
|
|
74
|
+
trim() {
|
|
75
|
+
if (!this.spec.$filter)
|
|
76
|
+
this.spec.$filter = {};
|
|
77
|
+
this.spec.$filter.trim = true;
|
|
78
|
+
return this;
|
|
79
|
+
}
|
|
80
|
+
uppercase() {
|
|
81
|
+
if (!this.spec.$filter)
|
|
82
|
+
this.spec.$filter = {};
|
|
83
|
+
this.spec.$filter.uppercase = true;
|
|
84
|
+
return this;
|
|
85
|
+
}
|
|
86
|
+
lowercase() {
|
|
87
|
+
if (!this.spec.$filter)
|
|
88
|
+
this.spec.$filter = {};
|
|
89
|
+
this.spec.$filter.lowercase = true;
|
|
90
|
+
return this;
|
|
91
|
+
}
|
|
92
|
+
stripHtml() {
|
|
93
|
+
if (!this.spec.$filter)
|
|
94
|
+
this.spec.$filter = {};
|
|
95
|
+
this.spec.$filter.stripHtml = true;
|
|
96
|
+
return this;
|
|
97
|
+
}
|
|
98
|
+
prependHttpIfMissing() {
|
|
99
|
+
return this.filterIf('prependHttp', {
|
|
100
|
+
$not: { $regex: /^[a-zA-Z][a-zA-Z\d+\-.]*:/ },
|
|
101
|
+
});
|
|
102
|
+
}
|
|
103
|
+
}
|
|
104
|
+
exports.BuilderString = BuilderString;
|
|
105
|
+
exports.default = BuilderString;
|
|
106
|
+
//# sourceMappingURL=builder-string.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"builder-string.js","sourceRoot":"","sources":["../../src/builder/builder-string.ts"],"names":[],"mappings":";;;AAAA,iDAA4C;AAW5C,MAAa,aAAc,SAAQ,0BAAmB;IAC1C,OAAO;QACf,OAAO,MAAM,CAAA;IACf,CAAC;IAOD,KAAK,CAAC,OAAmC;QACvC,IAAI,CAAC,IAAI,CAAC,IAAI,CAAC,SAAS;YAAE,IAAI,CAAC,IAAI,CAAC,SAAS,GAAG,EAAE,CAAA;QAClD,IAAI,CAAC,IAAI,CAAC,SAAS,CAAC,KAAK,GAAG,OAAO,IAAI,IAAI,CAAA;QAC3C,OAAO,IAAI,CAAA;IACb,CAAC;IAKD,SAAS,CAAC,GAAW,EAAE,OAAmC;QACxD,IAAI,CAAC,IAAI,CAAC,IAAI,CAAC,SAAS;YAAE,IAAI,CAAC,IAAI,CAAC,SAAS,GAAG,EAAE,CAAA;QAClD,IAAI,CAAC,IAAI,CAAC,IAAI,CAAC,SAAS,CAAC,WAAW,EAAE,CAAC;YACrC,IAAI,CAAC,IAAI,CAAC,SAAS,CAAC,WAAW,GAAG,EAAE,CAAA;QACtC,CAAC;QACD,IAAI,CAAC,IAAI,CAAC,SAAS,CAAC,WAAW,CAAC,GAAG,GAAG,GAAG,CAAA;QACzC,IAAI,OAAO,EAAE,CAAC;YACZ,MAAM,CAAC,MAAM,CAAC,IAAI,CAAC,IAAI,CAAC,SAAS,CAAC,WAAW,EAAE,OAAO,CAAC,CAAA;QACzD,CAAC;QACD,OAAO,IAAI,CAAA;IACb,CAAC;IAKD,SAAS,CAAC,GAAW,EAAE,OAAmC;QACxD,IAAI,CAAC,IAAI,CAAC,IAAI,CAAC,SAAS;YAAE,IAAI,CAAC,IAAI,CAAC,SAAS,GAAG,EAAE,CAAA;QAClD,IAAI,CAA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QAAC,IAAI,CAAC,IAAI,CAAC,OAAe,CAAC,SAAS,GAAG,IAAI,CAAA;QAC5C,OAAO,IAAI,CAAA;IACb,CAAC;IAKD,oBAAoB;QAClB,OAAO,IAAI,CAAC,QAAQ,CAAC,aAAa,EAAE;YAClC,IAAI,EAAE,EAAE,MAAM,EAAE,2BAA2B,EAAE;SAC9C,CAAC,CAAA;IACJ,CAAC;CACF;AA/ID,sCA+IC;AAED,kBAAe,aAAa,CAAA"}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { SchemaBuilder } from './schema-builder';
|
|
2
|
+
import { BuilderString } from './builder-string';
|
|
3
|
+
import { BuilderNumber } from './builder-number';
|
|
4
|
+
import { BuilderBoolean } from './builder-boolean';
|
|
5
|
+
import { BuilderDate } from './builder-date';
|
|
6
|
+
import { BuilderArray } from './builder-array';
|
|
7
|
+
import { BuilderObject } from './builder-object';
|
|
8
|
+
import { BuilderMixed } from './builder-mixed';
|
|
9
|
+
import { BuilderOr } from './builder-or';
|
|
10
|
+
import { BuilderSchema } from './builder-schema';
|
|
11
|
+
import { BuilderBase } from './builder-base';
|
|
12
|
+
export declare const sb: typeof SchemaBuilder;
|
|
13
|
+
export { SchemaBuilder, BuilderBase, BuilderString, BuilderNumber, BuilderBoolean, BuilderDate, BuilderArray, BuilderObject, BuilderMixed, BuilderOr, BuilderSchema, };
|
|
14
|
+
export default sb;
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.BuilderSchema = exports.BuilderOr = exports.BuilderMixed = exports.BuilderObject = exports.BuilderArray = exports.BuilderDate = exports.BuilderBoolean = exports.BuilderNumber = exports.BuilderString = exports.BuilderBase = exports.SchemaBuilder = exports.sb = void 0;
|
|
4
|
+
const schema_builder_1 = require("./schema-builder");
|
|
5
|
+
Object.defineProperty(exports, "SchemaBuilder", { enumerable: true, get: function () { return schema_builder_1.SchemaBuilder; } });
|
|
6
|
+
const builder_string_1 = require("./builder-string");
|
|
7
|
+
Object.defineProperty(exports, "BuilderString", { enumerable: true, get: function () { return builder_string_1.BuilderString; } });
|
|
8
|
+
const builder_number_1 = require("./builder-number");
|
|
9
|
+
Object.defineProperty(exports, "BuilderNumber", { enumerable: true, get: function () { return builder_number_1.BuilderNumber; } });
|
|
10
|
+
const builder_boolean_1 = require("./builder-boolean");
|
|
11
|
+
Object.defineProperty(exports, "BuilderBoolean", { enumerable: true, get: function () { return builder_boolean_1.BuilderBoolean; } });
|
|
12
|
+
const builder_date_1 = require("./builder-date");
|
|
13
|
+
Object.defineProperty(exports, "BuilderDate", { enumerable: true, get: function () { return builder_date_1.BuilderDate; } });
|
|
14
|
+
const builder_array_1 = require("./builder-array");
|
|
15
|
+
Object.defineProperty(exports, "BuilderArray", { enumerable: true, get: function () { return builder_array_1.BuilderArray; } });
|
|
16
|
+
const builder_object_1 = require("./builder-object");
|
|
17
|
+
Object.defineProperty(exports, "BuilderObject", { enumerable: true, get: function () { return builder_object_1.BuilderObject; } });
|
|
18
|
+
const builder_mixed_1 = require("./builder-mixed");
|
|
19
|
+
Object.defineProperty(exports, "BuilderMixed", { enumerable: true, get: function () { return builder_mixed_1.BuilderMixed; } });
|
|
20
|
+
const builder_or_1 = require("./builder-or");
|
|
21
|
+
Object.defineProperty(exports, "BuilderOr", { enumerable: true, get: function () { return builder_or_1.BuilderOr; } });
|
|
22
|
+
const builder_schema_1 = require("./builder-schema");
|
|
23
|
+
Object.defineProperty(exports, "BuilderSchema", { enumerable: true, get: function () { return builder_schema_1.BuilderSchema; } });
|
|
24
|
+
const builder_base_1 = require("./builder-base");
|
|
25
|
+
Object.defineProperty(exports, "BuilderBase", { enumerable: true, get: function () { return builder_base_1.BuilderBase; } });
|
|
26
|
+
exports.sb = schema_builder_1.SchemaBuilder;
|
|
27
|
+
exports.default = exports.sb;
|
|
28
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/builder/index.ts"],"names":[],"mappings":";;;AAMA,qDAAgD;AAoB9C,8FApBO,8BAAa,OAoBP;AAnBf,qDAAgD;AAqB9C,8FArBO,8BAAa,OAqBP;AApBf,qDAAgD;AAqB9C,8FArBO,8BAAa,OAqBP;AApBf,uDAAkD;AAqBhD,+FArBO,gCAAc,OAqBP;AApBhB,iDAA4C;AAqB1C,4FArBO,0BAAW,OAqBP;AApBb,mDAA8C;AAqB5C,6FArBO,4BAAY,OAqBP;AApBd,qDAAgD;AAqB9C,8FArBO,8BAAa,OAqBP;AApBf,mDAA8C;AAqB5C,6FArBO,4BAAY,OAqBP;AApBd,6CAAwC;AAqBtC,0FArBO,sBAAS,OAqBP;AApBX,qDAAgD;AAqB9C,8FArBO,8BAAa,OAqBP;AApBf,iDAA4C;AAW1C,4FAXO,0BAAW,OAWP;AALA,QAAA,EAAE,GAAG,8BAAa,CAAA;AAiB/B,kBAAe,UAAE,CAAA"}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import { BuilderString } from './builder-string';
|
|
2
|
+
import { BuilderNumber } from './builder-number';
|
|
3
|
+
import { BuilderBoolean } from './builder-boolean';
|
|
4
|
+
import { BuilderDate } from './builder-date';
|
|
5
|
+
import { BuilderArray } from './builder-array';
|
|
6
|
+
import { BuilderObject } from './builder-object';
|
|
7
|
+
import { BuilderMixed } from './builder-mixed';
|
|
8
|
+
import { BuilderOr } from './builder-or';
|
|
9
|
+
import { BuilderSchema } from './builder-schema';
|
|
10
|
+
import { BuilderBase } from './builder-base';
|
|
11
|
+
import SchemaSpec from '../spec';
|
|
12
|
+
export declare class SchemaBuilder {
|
|
13
|
+
static string(): BuilderString;
|
|
14
|
+
static number(): BuilderNumber;
|
|
15
|
+
static boolean(): BuilderBoolean;
|
|
16
|
+
static date(): BuilderDate;
|
|
17
|
+
static array<T = any>(itemSpec?: SchemaSpec | BuilderBase<any>): BuilderArray<T>;
|
|
18
|
+
static object<T extends object = any>(shape?: {
|
|
19
|
+
[K in keyof T]?: SchemaSpec | BuilderBase<any>;
|
|
20
|
+
}): BuilderObject<T>;
|
|
21
|
+
static mixed(): BuilderMixed;
|
|
22
|
+
static or(specs: Array<SchemaSpec | BuilderBase<any>>): BuilderOr;
|
|
23
|
+
static schema(name?: string): BuilderSchema;
|
|
24
|
+
static ref(schemaName: string): SchemaSpec;
|
|
25
|
+
}
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.SchemaBuilder = void 0;
|
|
4
|
+
const builder_string_1 = require("./builder-string");
|
|
5
|
+
const builder_number_1 = require("./builder-number");
|
|
6
|
+
const builder_boolean_1 = require("./builder-boolean");
|
|
7
|
+
const builder_date_1 = require("./builder-date");
|
|
8
|
+
const builder_array_1 = require("./builder-array");
|
|
9
|
+
const builder_object_1 = require("./builder-object");
|
|
10
|
+
const builder_mixed_1 = require("./builder-mixed");
|
|
11
|
+
const builder_or_1 = require("./builder-or");
|
|
12
|
+
const builder_schema_1 = require("./builder-schema");
|
|
13
|
+
class SchemaBuilder {
|
|
14
|
+
static string() {
|
|
15
|
+
return new builder_string_1.BuilderString();
|
|
16
|
+
}
|
|
17
|
+
static number() {
|
|
18
|
+
return new builder_number_1.BuilderNumber();
|
|
19
|
+
}
|
|
20
|
+
static boolean() {
|
|
21
|
+
return new builder_boolean_1.BuilderBoolean();
|
|
22
|
+
}
|
|
23
|
+
static date() {
|
|
24
|
+
return new builder_date_1.BuilderDate();
|
|
25
|
+
}
|
|
26
|
+
static array(itemSpec) {
|
|
27
|
+
return new builder_array_1.BuilderArray(itemSpec);
|
|
28
|
+
}
|
|
29
|
+
static object(shape) {
|
|
30
|
+
return new builder_object_1.BuilderObject(shape);
|
|
31
|
+
}
|
|
32
|
+
static mixed() {
|
|
33
|
+
return new builder_mixed_1.BuilderMixed();
|
|
34
|
+
}
|
|
35
|
+
static or(specs) {
|
|
36
|
+
return new builder_or_1.BuilderOr(specs);
|
|
37
|
+
}
|
|
38
|
+
static schema(name) {
|
|
39
|
+
return new builder_schema_1.BuilderSchema(name);
|
|
40
|
+
}
|
|
41
|
+
static ref(schemaName) {
|
|
42
|
+
return { $schema: schemaName };
|
|
43
|
+
}
|
|
44
|
+
}
|
|
45
|
+
exports.SchemaBuilder = SchemaBuilder;
|
|
46
|
+
//# sourceMappingURL=schema-builder.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"schema-builder.js","sourceRoot":"","sources":["../../src/builder/schema-builder.ts"],"names":[],"mappings":";;;AAKA,qDAAgD;AAChD,qDAAgD;AAChD,uDAAkD;AAClD,iDAA4C;AAC5C,mDAA8C;AAC9C,qDAAgD;AAChD,mDAA8C;AAC9C,6CAAwC;AACxC,qDAAgD;AAIhD,MAAa,aAAa;IAIxB,MAAM,CAAC,MAAM;QACX,OAAO,IAAI,8BAAa,EAAE,CAAA;IAC5B,CAAC;IAKD,MAAM,CAAC,MAAM;QACX,OAAO,IAAI,8BAAa,EAAE,CAAA;IAC5B,CAAC;IAKD,MAAM,CAAC,OAAO;QACZ,OAAO,IAAI,gCAAc,EAAE,CAAA;IAC7B,CAAC;IAKD,MAAM,CAAC,IAAI;QACT,OAAO,IAAI,0BAAW,EAAE,CAAA;IAC1B,CAAC;IAKD,MAAM,CAAC,KAAK,CACV,QAAwC;QAExC,OAAO,IAAI,4BAAY,CAAI,QAAQ,CAAC,CAAA;IACtC,CAAC;IAKD,MAAM,CAAC,MAAM,CAAyB,KAErC;QACC,OAAO,IAAI,8BAAa,CAAI,KAAK,CAAC,CAAA;IACpC,CAAC;IAKD,MAAM,CAAC,KAAK;QACV,OAAO,IAAI,4BAAY,EAAE,CAAA;IAC3B,CAAC;IAKD,MAAM,CAAC,EAAE,CAAC,KAA2C;QACnD,OAAO,IAAI,sBAAS,CAAC,KAAK,CAAC,CAAA;IAC7B,CAAC;IAKD,MAAM,CAAC,MAAM,CAAC,IAAa;QACzB,OAAO,IAAI,8BAAa,CAAC,IAAI,CAAC,CAAA;IAChC,CAAC;IAMD,MAAM,CAAC,GAAG,CAAC,UAAkB;QAC3B,OAAO,EAAE,OAAO,EAAE,UAAU,EAAE,CAAA;IAChC,CAAC;CACF;AA3ED,sCA2EC"}
|
package/dist/config.d.ts
ADDED
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import Schema from './schema';
|
|
2
|
+
import { SchemaEncryptionService } from './encryption/encryption-service';
|
|
3
|
+
export interface SchemaConfig {
|
|
4
|
+
name?: string;
|
|
5
|
+
spec?: any;
|
|
6
|
+
strict?: boolean;
|
|
7
|
+
constructors?: {
|
|
8
|
+
[key: string]: any;
|
|
9
|
+
} | Array<any>;
|
|
10
|
+
schemas?: {
|
|
11
|
+
[key: string]: Schema;
|
|
12
|
+
} | Array<Schema>;
|
|
13
|
+
defaultNotNull?: boolean;
|
|
14
|
+
skipTransients?: boolean;
|
|
15
|
+
encryptionService?: SchemaEncryptionService;
|
|
16
|
+
}
|
|
17
|
+
export default SchemaConfig;
|
package/dist/config.js
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"config.js","sourceRoot":"","sources":["../src/config.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"encryption-service.js","sourceRoot":"","sources":["../../src/encryption/encryption-service.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './encryption-service';
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
14
|
+
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
|
+
};
|
|
16
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
+
__exportStar(require("./encryption-service"), exports);
|
|
18
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/encryption/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,uDAAoC"}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
export interface FilterConfig {
|
|
2
|
+
allowMultiple: boolean;
|
|
3
|
+
}
|
|
4
|
+
export declare abstract class FilterAbstract {
|
|
5
|
+
abstract filter(value: any, options?: any): any | Promise<any>;
|
|
6
|
+
abstract getName(): string;
|
|
7
|
+
getConfig(): FilterConfig;
|
|
8
|
+
}
|
|
9
|
+
export default FilterAbstract;
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.FilterAbstract = void 0;
|
|
4
|
+
class FilterAbstract {
|
|
5
|
+
getConfig() {
|
|
6
|
+
return { allowMultiple: true };
|
|
7
|
+
}
|
|
8
|
+
}
|
|
9
|
+
exports.FilterAbstract = FilterAbstract;
|
|
10
|
+
exports.default = FilterAbstract;
|
|
11
|
+
//# sourceMappingURL=filter-abstract.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"filter-abstract.js","sourceRoot":"","sources":["../../src/filter/filter-abstract.ts"],"names":[],"mappings":";;;AAIA,MAAsB,cAAc;IAIlC,SAAS;QACP,OAAO,EAAE,aAAa,EAAE,IAAI,EAAE,CAAA;IAChC,CAAC;CACF;AAPD,wCAOC;AAED,kBAAe,cAAc,CAAA"}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.FilterCallback = void 0;
|
|
4
|
+
const filter_abstract_1 = require("./filter-abstract");
|
|
5
|
+
class FilterCallback extends filter_abstract_1.FilterAbstract {
|
|
6
|
+
filter(value, options) {
|
|
7
|
+
var filter = options;
|
|
8
|
+
if (typeof filter == 'function')
|
|
9
|
+
value = filter(value);
|
|
10
|
+
return value;
|
|
11
|
+
}
|
|
12
|
+
getName() {
|
|
13
|
+
return 'callback';
|
|
14
|
+
}
|
|
15
|
+
}
|
|
16
|
+
exports.FilterCallback = FilterCallback;
|
|
17
|
+
exports.default = FilterCallback;
|
|
18
|
+
//# sourceMappingURL=filter-callback.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"filter-callback.js","sourceRoot":"","sources":["../../src/filter/filter-callback.ts"],"names":[],"mappings":";;;AAAA,uDAAkD;AAElD,MAAa,cAAe,SAAQ,gCAAc;IAChD,MAAM,CAAC,KAAU,EAAE,OAAQ;QACzB,IAAI,MAAM,GAAG,OAAO,CAAA;QACpB,IAAI,OAAO,MAAM,IAAI,UAAU;YAAE,KAAK,GAAG,MAAM,CAAC,KAAK,CAAC,CAAA;QACtD,OAAO,KAAK,CAAA;IACd,CAAC;IAED,OAAO;QACL,OAAO,UAAU,CAAA;IACnB,CAAC;CACF;AAVD,wCAUC;AAED,kBAAe,cAAc,CAAA"}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.FilterCondition = void 0;
|
|
4
|
+
class FilterCondition {
|
|
5
|
+
static evaluate(value, spec) {
|
|
6
|
+
if (spec.$not)
|
|
7
|
+
return !this.evaluate(value, spec.$not);
|
|
8
|
+
if (spec.$regex)
|
|
9
|
+
return spec.$regex.test(String(value !== null && value !== void 0 ? value : ''));
|
|
10
|
+
return true;
|
|
11
|
+
}
|
|
12
|
+
}
|
|
13
|
+
exports.FilterCondition = FilterCondition;
|
|
14
|
+
exports.default = FilterCondition;
|
|
15
|
+
//# sourceMappingURL=filter-condition.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"filter-condition.js","sourceRoot":"","sources":["../../src/filter/filter-condition.ts"],"names":[],"mappings":";;;AAKA,MAAa,eAAe;IAC1B,MAAM,CAAC,QAAQ,CAAC,KAAU,EAAE,IAAyB;QACnD,IAAI,IAAI,CAAC,IAAI;YAAE,OAAO,CAAC,IAAI,CAAC,QAAQ,CAAC,KAAK,EAAE,IAAI,CAAC,IAAI,CAAC,CAAA;QACtD,IAAI,IAAI,CAAC,MAAM;YAAE,OAAO,IAAI,CAAC,MAAM,CAAC,IAAI,CAAC,MAAM,CAAC,KAAK,aAAL,KAAK,cAAL,KAAK,GAAI,EAAE,CAAC,CAAC,CAAA;QAC7D,OAAO,IAAI,CAAA;IACb,CAAC;CACF;AAND,0CAMC;AAED,kBAAe,eAAe,CAAA"}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { FilterAbstract } from './filter-abstract';
|
|
2
|
+
export declare class FilterDefaultValue extends FilterAbstract {
|
|
3
|
+
filter(value: any, options?: any): any;
|
|
4
|
+
static isNull(value: any): boolean;
|
|
5
|
+
getName(): string;
|
|
6
|
+
getConfig(): {
|
|
7
|
+
allowMultiple: boolean;
|
|
8
|
+
};
|
|
9
|
+
}
|
|
10
|
+
export default FilterDefaultValue;
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.FilterDefaultValue = void 0;
|
|
4
|
+
const filter_abstract_1 = require("./filter-abstract");
|
|
5
|
+
class FilterDefaultValue extends filter_abstract_1.FilterAbstract {
|
|
6
|
+
filter(value, options) {
|
|
7
|
+
if (value === undefined ||
|
|
8
|
+
FilterDefaultValue.isNull(value) ||
|
|
9
|
+
(Array.isArray(value) && value.length === 0)) {
|
|
10
|
+
var defaultValue = options;
|
|
11
|
+
value = typeof defaultValue == 'function' ? defaultValue() : defaultValue;
|
|
12
|
+
}
|
|
13
|
+
return value;
|
|
14
|
+
}
|
|
15
|
+
static isNull(value) {
|
|
16
|
+
var result = value === null ||
|
|
17
|
+
(typeof value == 'string' && value.toLowerCase() == 'null');
|
|
18
|
+
return result;
|
|
19
|
+
}
|
|
20
|
+
getName() {
|
|
21
|
+
return 'defaultValue';
|
|
22
|
+
}
|
|
23
|
+
getConfig() {
|
|
24
|
+
return { allowMultiple: false };
|
|
25
|
+
}
|
|
26
|
+
}
|
|
27
|
+
exports.FilterDefaultValue = FilterDefaultValue;
|
|
28
|
+
exports.default = FilterDefaultValue;
|
|
29
|
+
//# sourceMappingURL=filter-default-value.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"filter-default-value.js","sourceRoot":"","sources":["../../src/filter/filter-default-value.ts"],"names":[],"mappings":";;;AAAA,uDAAkD;AAClD,MAAa,kBAAmB,SAAQ,gCAAc;IACpD,MAAM,CAAC,KAAU,EAAE,OAAQ;QACzB,IACE,KAAK,KAAK,SAAS;YACnB,kBAAkB,CAAC,MAAM,CAAC,KAAK,CAAC;YAChC,CAAC,KAAK,CAAC,OAAO,CAAC,KAAK,CAAC,IAAI,KAAK,CAAC,MAAM,KAAK,CAAC,CAAC,EAC5C,CAAC;YACD,IAAI,YAAY,GAAG,OAAO,CAAA;YAC1B,KAAK,GAAG,OAAO,YAAY,IAAI,UAAU,CAAC,CAAC,CAAC,YAAY,EAAE,CAAC,CAAC,CAAC,YAAY,CAAA;QAC3E,CAAC;QACD,OAAO,KAAK,CAAA;IACd,CAAC;IAED,MAAM,CAAC,MAAM,CAAC,KAAK;QACjB,IAAI,MAAM,GACR,KAAK,KAAK,IAAI;YAEd,CAAC,OAAO,KAAK,IAAI,QAAQ,IAAI,KAAK,CAAC,WAAW,EAAE,IAAI,MAAM,CAAC,CAAA;QAE7D,OAAO,MAAM,CAAA;IACf,CAAC;IAED,OAAO;QACL,OAAO,cAAc,CAAA;IACvB,CAAC;IAED,SAAS;QACP,OAAO,EAAE,aAAa,EAAE,KAAK,EAAE,CAAA;IACjC,CAAC;CACF;AA7BD,gDA6BC;AAED,kBAAe,kBAAkB,CAAA"}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.FilterLowercase = void 0;
|
|
4
|
+
const filter_abstract_1 = require("./filter-abstract");
|
|
5
|
+
class FilterLowercase extends filter_abstract_1.FilterAbstract {
|
|
6
|
+
filter(value, _options) {
|
|
7
|
+
if (typeof value == 'string')
|
|
8
|
+
value = value.toLowerCase();
|
|
9
|
+
return value;
|
|
10
|
+
}
|
|
11
|
+
getName() {
|
|
12
|
+
return 'lowercase';
|
|
13
|
+
}
|
|
14
|
+
}
|
|
15
|
+
exports.FilterLowercase = FilterLowercase;
|
|
16
|
+
exports.default = FilterLowercase;
|
|
17
|
+
//# sourceMappingURL=filter-lowercase.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"filter-lowercase.js","sourceRoot":"","sources":["../../src/filter/filter-lowercase.ts"],"names":[],"mappings":";;;AAAA,uDAAkD;AAElD,MAAa,eAAgB,SAAQ,gCAAc;IACjD,MAAM,CAAC,KAAU,EAAE,QAAS;QAC1B,IAAI,OAAO,KAAK,IAAI,QAAQ;YAAE,KAAK,GAAG,KAAK,CAAC,WAAW,EAAE,CAAA;QACzD,OAAO,KAAK,CAAA;IACd,CAAC;IAED,OAAO;QACL,OAAO,WAAW,CAAA;IACpB,CAAC;CACF;AATD,0CASC;AAED,kBAAe,eAAe,CAAA"}
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.FilterPostcode = void 0;
|
|
4
|
+
const filter_abstract_1 = require("./filter-abstract");
|
|
5
|
+
class FilterPostcode extends filter_abstract_1.FilterAbstract {
|
|
6
|
+
filter(value, _options) {
|
|
7
|
+
return this.filterUk(value, _options);
|
|
8
|
+
}
|
|
9
|
+
filterUk(value, _options) {
|
|
10
|
+
value = value.toUpperCase().trim();
|
|
11
|
+
value = value.replace(/\s\s+/g, ' ');
|
|
12
|
+
if (value.indexOf(' ') == -1 &&
|
|
13
|
+
value.length >= 5 &&
|
|
14
|
+
value.length <= 7) {
|
|
15
|
+
let chars = value.split('');
|
|
16
|
+
let spaceIndex = chars.length - 3;
|
|
17
|
+
if (chars[spaceIndex] != ' ') {
|
|
18
|
+
chars.splice(spaceIndex, 0, ' ');
|
|
19
|
+
value = chars.join('');
|
|
20
|
+
}
|
|
21
|
+
}
|
|
22
|
+
return value;
|
|
23
|
+
}
|
|
24
|
+
getName() {
|
|
25
|
+
return 'postcode';
|
|
26
|
+
}
|
|
27
|
+
}
|
|
28
|
+
exports.FilterPostcode = FilterPostcode;
|
|
29
|
+
exports.default = FilterPostcode;
|
|
30
|
+
//# sourceMappingURL=filter-postcode.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"filter-postcode.js","sourceRoot":"","sources":["../../src/filter/filter-postcode.ts"],"names":[],"mappings":";;;AAAA,uDAAkD;AAYlD,MAAa,cAAe,SAAQ,gCAAc;IAChD,MAAM,CAAC,KAAU,EAAE,QAAS;QAC1B,OAAO,IAAI,CAAC,QAAQ,CAAC,KAAK,EAAE,QAAQ,CAAC,CAAA;IACvC,CAAC;IAED,QAAQ,CAAC,KAAU,EAAE,QAAS;QAC5B,KAAK,GAAG,KAAK,CAAC,WAAW,EAAE,CAAC,IAAI,EAAE,CAAA;QAElC,KAAK,GAAG,KAAK,CAAC,OAAO,CAAC,QAAQ,EAAE,GAAG,CAAC,CAAA;QACpC,IACE,KAAK,CAAC,OAAO,CAAC,GAAG,CAAC,IAAI,CAAC,CAAC;YACxB,KAAK,CAAC,MAAM,IAAI,CAAC;YACjB,KAAK,CAAC,MAAM,IAAI,CAAC,EACjB,CAAC;YAED,IAAI,KAAK,GAAG,KAAK,CAAC,KAAK,CAAC,EAAE,CAAC,CAAA;YAC3B,IAAI,UAAU,GAAG,KAAK,CAAC,MAAM,GAAG,CAAC,CAAA;YACjC,IAAI,KAAK,CAAC,UAAU,CAAC,IAAI,GAAG,EAAE,CAAC;gBAC7B,KAAK,CAAC,MAAM,CAAC,UAAU,EAAE,CAAC,EAAE,GAAG,CAAC,CAAA;gBAChC,KAAK,GAAG,KAAK,CAAC,IAAI,CAAC,EAAE,CAAC,CAAA;YACxB,CAAC;QACH,CAAC;QACD,OAAO,KAAK,CAAA;IACd,CAAC;IAED,OAAO;QACL,OAAO,UAAU,CAAA;IACnB,CAAC;CACF;AA5BD,wCA4BC;AAED,kBAAe,cAAc,CAAA"}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.FilterPrependHttp = void 0;
|
|
4
|
+
const filter_abstract_1 = require("./filter-abstract");
|
|
5
|
+
class FilterPrependHttp extends filter_abstract_1.FilterAbstract {
|
|
6
|
+
filter(value, _options) {
|
|
7
|
+
if (typeof value === 'string' && value.length > 0)
|
|
8
|
+
value = 'http://' + value;
|
|
9
|
+
return value;
|
|
10
|
+
}
|
|
11
|
+
getName() {
|
|
12
|
+
return 'prependHttp';
|
|
13
|
+
}
|
|
14
|
+
}
|
|
15
|
+
exports.FilterPrependHttp = FilterPrependHttp;
|
|
16
|
+
exports.default = FilterPrependHttp;
|
|
17
|
+
//# sourceMappingURL=filter-prepend-http.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"filter-prepend-http.js","sourceRoot":"","sources":["../../src/filter/filter-prepend-http.ts"],"names":[],"mappings":";;;AAAA,uDAAkD;AAElD,MAAa,iBAAkB,SAAQ,gCAAc;IACnD,MAAM,CAAC,KAAU,EAAE,QAAS;QAC1B,IAAI,OAAO,KAAK,KAAK,QAAQ,IAAI,KAAK,CAAC,MAAM,GAAG,CAAC;YAAE,KAAK,GAAG,SAAS,GAAG,KAAK,CAAA;QAC5E,OAAO,KAAK,CAAA;IACd,CAAC;IAED,OAAO;QACL,OAAO,aAAa,CAAA;IACtB,CAAC;CACF;AATD,8CASC;AAED,kBAAe,iBAAiB,CAAA"}
|