Skip to content

Commit f7ecd8a

Browse files
committed
feat(guard-clause): json schema
style(guard-clause): format
1 parent 3441e17 commit f7ecd8a

29 files changed

+177
-207
lines changed

CHANGELOG.md

Lines changed: 39 additions & 84 deletions
Original file line numberDiff line numberDiff line change
@@ -1,85 +1,40 @@
1+
## (2025-01-06)
12

2-
3-
## (2025-01-06)
4-
5-
6-
* Initial commit ([e16e1b2](https://github.com/atls/common/commit/e16e1b2))
7-
8-
* feature(logger): init logger ([801ae9f](https://github.com/atls/common/commit/801ae9f))
9-
10-
* feature(typeorm-logger): init typeorm-logger ([055df1e](https://github.com/atls/common/commit/055df1e))
11-
12-
* chore: update bug template ([620773c](https://github.com/atls/common/commit/620773c))
13-
14-
* chore: update chore template ([31dd631](https://github.com/atls/common/commit/31dd631))
15-
16-
* chore: update feature template ([592629c](https://github.com/atls/common/commit/592629c))
17-
18-
* chore: update gitignore ([a0c8c64](https://github.com/atls/common/commit/a0c8c64))
19-
20-
* chore(common): publish ([81ca4b4](https://github.com/atls/common/commit/81ca4b4))
21-
22-
* chore(common): publish ([ae8b6a8](https://github.com/atls/common/commit/ae8b6a8))
23-
24-
* chore(common): versions ([cf32cb2](https://github.com/atls/common/commit/cf32cb2))
25-
26-
* chore(common): versions ([8d1bebd](https://github.com/atls/common/commit/8d1bebd))
27-
28-
* feat: help-wanted template ([7a7875f](https://github.com/atls/common/commit/7a7875f))
29-
30-
* feat: husky ([3ca1f9d](https://github.com/atls/common/commit/3ca1f9d))
31-
32-
* feat: updated packages, yarn check pass ([7f3f359](https://github.com/atls/common/commit/7f3f359))
33-
34-
* feat: upgrade environment ([44f2424](https://github.com/atls/common/commit/44f2424))
35-
36-
* feat: upgrade environment ([ba0f24d](https://github.com/atls/common/commit/ba0f24d))
37-
38-
* feat: upgrade environment ([f8fe76b](https://github.com/atls/common/commit/f8fe76b))
39-
40-
* feat: upgrade environment ([fa529ed](https://github.com/atls/common/commit/fa529ed))
41-
42-
* feat: upgrade environment ([93e6981](https://github.com/atls/common/commit/93e6981))
43-
44-
* feat: upgrade environment ([9fcd596](https://github.com/atls/common/commit/9fcd596))
45-
46-
* feat: upgraded ([89f9d2d](https://github.com/atls/common/commit/89f9d2d))
47-
48-
* feat: upgrading to latest build ([c0b655f](https://github.com/atls/common/commit/c0b655f))
49-
50-
* feat(common): bump yarn ([295ae5f](https://github.com/atls/common/commit/295ae5f))
51-
52-
* feat(common): bump yarn ([49eace1](https://github.com/atls/common/commit/49eace1))
53-
54-
* feat(core-errors): init ([8d07bf9](https://github.com/atls/common/commit/8d07bf9))
55-
56-
* feat(github): upgrade actions ([6c2b70d](https://github.com/atls/common/commit/6c2b70d))
57-
58-
* feat(issue-templates): update ([7641286](https://github.com/atls/common/commit/7641286))
59-
60-
* feat(issue-templates): update ([d386af9](https://github.com/atls/common/commit/d386af9))
61-
62-
* feat(issue-templates): update ([7849cee](https://github.com/atls/common/commit/7849cee))
63-
64-
* feat(issue-templates): update ([261f293](https://github.com/atls/common/commit/261f293))
65-
66-
* feat(workflows): update ([9068bb6](https://github.com/atls/common/commit/9068bb6))
67-
68-
* feat(workflows): update ([f98361d](https://github.com/atls/common/commit/f98361d))
69-
70-
* feat(workflows): update ([f5a7d6c](https://github.com/atls/common/commit/f5a7d6c))
71-
72-
* fix: fixed versions ([a9c66ad](https://github.com/atls/common/commit/a9c66ad))
73-
74-
* fix: husky chmod ([41f6b55](https://github.com/atls/common/commit/41f6b55))
75-
76-
* fix: more version updates yarn check passed ([9c3d680](https://github.com/atls/common/commit/9c3d680))
77-
78-
* fix: update eslint ([955c140](https://github.com/atls/common/commit/955c140))
79-
80-
* faet: move typeorm onto parent repo ([07aee97](https://github.com/atls/common/commit/07aee97))
81-
82-
83-
84-
85-
3+
- Initial commit ([e16e1b2](https://github.com/atls/common/commit/e16e1b2))
4+
- feature(logger): init logger ([801ae9f](https://github.com/atls/common/commit/801ae9f))
5+
- feature(typeorm-logger): init typeorm-logger ([055df1e](https://github.com/atls/common/commit/055df1e))
6+
- chore: update bug template ([620773c](https://github.com/atls/common/commit/620773c))
7+
- chore: update chore template ([31dd631](https://github.com/atls/common/commit/31dd631))
8+
- chore: update feature template ([592629c](https://github.com/atls/common/commit/592629c))
9+
- chore: update gitignore ([a0c8c64](https://github.com/atls/common/commit/a0c8c64))
10+
- chore(common): publish ([81ca4b4](https://github.com/atls/common/commit/81ca4b4))
11+
- chore(common): publish ([ae8b6a8](https://github.com/atls/common/commit/ae8b6a8))
12+
- chore(common): versions ([cf32cb2](https://github.com/atls/common/commit/cf32cb2))
13+
- chore(common): versions ([8d1bebd](https://github.com/atls/common/commit/8d1bebd))
14+
- feat: help-wanted template ([7a7875f](https://github.com/atls/common/commit/7a7875f))
15+
- feat: husky ([3ca1f9d](https://github.com/atls/common/commit/3ca1f9d))
16+
- feat: updated packages, yarn check pass ([7f3f359](https://github.com/atls/common/commit/7f3f359))
17+
- feat: upgrade environment ([44f2424](https://github.com/atls/common/commit/44f2424))
18+
- feat: upgrade environment ([ba0f24d](https://github.com/atls/common/commit/ba0f24d))
19+
- feat: upgrade environment ([f8fe76b](https://github.com/atls/common/commit/f8fe76b))
20+
- feat: upgrade environment ([fa529ed](https://github.com/atls/common/commit/fa529ed))
21+
- feat: upgrade environment ([93e6981](https://github.com/atls/common/commit/93e6981))
22+
- feat: upgrade environment ([9fcd596](https://github.com/atls/common/commit/9fcd596))
23+
- feat: upgraded ([89f9d2d](https://github.com/atls/common/commit/89f9d2d))
24+
- feat: upgrading to latest build ([c0b655f](https://github.com/atls/common/commit/c0b655f))
25+
- feat(common): bump yarn ([295ae5f](https://github.com/atls/common/commit/295ae5f))
26+
- feat(common): bump yarn ([49eace1](https://github.com/atls/common/commit/49eace1))
27+
- feat(core-errors): init ([8d07bf9](https://github.com/atls/common/commit/8d07bf9))
28+
- feat(github): upgrade actions ([6c2b70d](https://github.com/atls/common/commit/6c2b70d))
29+
- feat(issue-templates): update ([7641286](https://github.com/atls/common/commit/7641286))
30+
- feat(issue-templates): update ([d386af9](https://github.com/atls/common/commit/d386af9))
31+
- feat(issue-templates): update ([7849cee](https://github.com/atls/common/commit/7849cee))
32+
- feat(issue-templates): update ([261f293](https://github.com/atls/common/commit/261f293))
33+
- feat(workflows): update ([9068bb6](https://github.com/atls/common/commit/9068bb6))
34+
- feat(workflows): update ([f98361d](https://github.com/atls/common/commit/f98361d))
35+
- feat(workflows): update ([f5a7d6c](https://github.com/atls/common/commit/f5a7d6c))
36+
- fix: fixed versions ([a9c66ad](https://github.com/atls/common/commit/a9c66ad))
37+
- fix: husky chmod ([41f6b55](https://github.com/atls/common/commit/41f6b55))
38+
- fix: more version updates yarn check passed ([9c3d680](https://github.com/atls/common/commit/9c3d680))
39+
- fix: update eslint ([955c140](https://github.com/atls/common/commit/955c140))
40+
- faet: move typeorm onto parent repo ([07aee97](https://github.com/atls/common/commit/07aee97))

packages/core-errors/CHANGELOG.md

Lines changed: 40 additions & 93 deletions
Original file line numberDiff line numberDiff line change
@@ -1,98 +1,45 @@
1-
2-
31
## <small>0.0.3 (2025-01-07)</small>
4-
5-
6-
* chore(common): versions @atls/core-errors:0.0.1 ([833753a](https://github.com/atls/common/commit/833753a))
7-
8-
* chore(core-errors): release (#17) ([e486cab](https://github.com/atls/common/commit/e486cab)), closes [#17](https://github.com/atls/common/issues/17)
9-
10-
11-
12-
13-
142

3+
- chore(common): versions @atls/core-errors:0.0.1 ([833753a](https://github.com/atls/common/commit/833753a))
4+
- chore(core-errors): release (#17) ([e486cab](https://github.com/atls/common/commit/e486cab)), closes [#17](https://github.com/atls/common/issues/17)
155

166
## <small>0.0.1 (2025-01-06)</small>
17-
18-
19-
* Initial commit ([e16e1b2](https://github.com/atls/common/commit/e16e1b2))
20-
21-
* feature(logger): init logger ([801ae9f](https://github.com/atls/common/commit/801ae9f))
22-
23-
* feature(typeorm-logger): init typeorm-logger ([055df1e](https://github.com/atls/common/commit/055df1e))
24-
25-
* chore: update bug template ([620773c](https://github.com/atls/common/commit/620773c))
26-
27-
* chore: update chore template ([31dd631](https://github.com/atls/common/commit/31dd631))
28-
29-
* chore: update feature template ([592629c](https://github.com/atls/common/commit/592629c))
30-
31-
* chore: update gitignore ([a0c8c64](https://github.com/atls/common/commit/a0c8c64))
32-
33-
* chore(common): publish ([81ca4b4](https://github.com/atls/common/commit/81ca4b4))
34-
35-
* chore(common): publish ([ae8b6a8](https://github.com/atls/common/commit/ae8b6a8))
36-
37-
* chore(common): versions ([cf32cb2](https://github.com/atls/common/commit/cf32cb2))
38-
39-
* chore(common): versions ([8d1bebd](https://github.com/atls/common/commit/8d1bebd))
40-
41-
* feat: help-wanted template ([7a7875f](https://github.com/atls/common/commit/7a7875f))
42-
43-
* feat: husky ([3ca1f9d](https://github.com/atls/common/commit/3ca1f9d))
44-
45-
* feat: updated packages, yarn check pass ([7f3f359](https://github.com/atls/common/commit/7f3f359))
46-
47-
* feat: upgrade environment ([44f2424](https://github.com/atls/common/commit/44f2424))
48-
49-
* feat: upgrade environment ([ba0f24d](https://github.com/atls/common/commit/ba0f24d))
50-
51-
* feat: upgrade environment ([f8fe76b](https://github.com/atls/common/commit/f8fe76b))
52-
53-
* feat: upgrade environment ([fa529ed](https://github.com/atls/common/commit/fa529ed))
54-
55-
* feat: upgrade environment ([93e6981](https://github.com/atls/common/commit/93e6981))
56-
57-
* feat: upgrade environment ([9fcd596](https://github.com/atls/common/commit/9fcd596))
58-
59-
* feat: upgraded ([89f9d2d](https://github.com/atls/common/commit/89f9d2d))
60-
61-
* feat: upgrading to latest build ([c0b655f](https://github.com/atls/common/commit/c0b655f))
62-
63-
* feat(common): bump yarn ([295ae5f](https://github.com/atls/common/commit/295ae5f))
64-
65-
* feat(common): bump yarn ([49eace1](https://github.com/atls/common/commit/49eace1))
66-
67-
* feat(core-errors): init ([8d07bf9](https://github.com/atls/common/commit/8d07bf9))
68-
69-
* feat(github): upgrade actions ([6c2b70d](https://github.com/atls/common/commit/6c2b70d))
70-
71-
* feat(issue-templates): update ([7641286](https://github.com/atls/common/commit/7641286))
72-
73-
* feat(issue-templates): update ([d386af9](https://github.com/atls/common/commit/d386af9))
74-
75-
* feat(issue-templates): update ([7849cee](https://github.com/atls/common/commit/7849cee))
76-
77-
* feat(issue-templates): update ([261f293](https://github.com/atls/common/commit/261f293))
78-
79-
* feat(workflows): update ([9068bb6](https://github.com/atls/common/commit/9068bb6))
80-
81-
* feat(workflows): update ([f98361d](https://github.com/atls/common/commit/f98361d))
82-
83-
* feat(workflows): update ([f5a7d6c](https://github.com/atls/common/commit/f5a7d6c))
84-
85-
* fix: fixed versions ([a9c66ad](https://github.com/atls/common/commit/a9c66ad))
86-
87-
* fix: husky chmod ([41f6b55](https://github.com/atls/common/commit/41f6b55))
88-
89-
* fix: more version updates yarn check passed ([9c3d680](https://github.com/atls/common/commit/9c3d680))
90-
91-
* fix: update eslint ([955c140](https://github.com/atls/common/commit/955c140))
92-
93-
* faet: move typeorm onto parent repo ([07aee97](https://github.com/atls/common/commit/07aee97))
94-
95-
96-
977

98-
8+
- Initial commit ([e16e1b2](https://github.com/atls/common/commit/e16e1b2))
9+
- feature(logger): init logger ([801ae9f](https://github.com/atls/common/commit/801ae9f))
10+
- feature(typeorm-logger): init typeorm-logger ([055df1e](https://github.com/atls/common/commit/055df1e))
11+
- chore: update bug template ([620773c](https://github.com/atls/common/commit/620773c))
12+
- chore: update chore template ([31dd631](https://github.com/atls/common/commit/31dd631))
13+
- chore: update feature template ([592629c](https://github.com/atls/common/commit/592629c))
14+
- chore: update gitignore ([a0c8c64](https://github.com/atls/common/commit/a0c8c64))
15+
- chore(common): publish ([81ca4b4](https://github.com/atls/common/commit/81ca4b4))
16+
- chore(common): publish ([ae8b6a8](https://github.com/atls/common/commit/ae8b6a8))
17+
- chore(common): versions ([cf32cb2](https://github.com/atls/common/commit/cf32cb2))
18+
- chore(common): versions ([8d1bebd](https://github.com/atls/common/commit/8d1bebd))
19+
- feat: help-wanted template ([7a7875f](https://github.com/atls/common/commit/7a7875f))
20+
- feat: husky ([3ca1f9d](https://github.com/atls/common/commit/3ca1f9d))
21+
- feat: updated packages, yarn check pass ([7f3f359](https://github.com/atls/common/commit/7f3f359))
22+
- feat: upgrade environment ([44f2424](https://github.com/atls/common/commit/44f2424))
23+
- feat: upgrade environment ([ba0f24d](https://github.com/atls/common/commit/ba0f24d))
24+
- feat: upgrade environment ([f8fe76b](https://github.com/atls/common/commit/f8fe76b))
25+
- feat: upgrade environment ([fa529ed](https://github.com/atls/common/commit/fa529ed))
26+
- feat: upgrade environment ([93e6981](https://github.com/atls/common/commit/93e6981))
27+
- feat: upgrade environment ([9fcd596](https://github.com/atls/common/commit/9fcd596))
28+
- feat: upgraded ([89f9d2d](https://github.com/atls/common/commit/89f9d2d))
29+
- feat: upgrading to latest build ([c0b655f](https://github.com/atls/common/commit/c0b655f))
30+
- feat(common): bump yarn ([295ae5f](https://github.com/atls/common/commit/295ae5f))
31+
- feat(common): bump yarn ([49eace1](https://github.com/atls/common/commit/49eace1))
32+
- feat(core-errors): init ([8d07bf9](https://github.com/atls/common/commit/8d07bf9))
33+
- feat(github): upgrade actions ([6c2b70d](https://github.com/atls/common/commit/6c2b70d))
34+
- feat(issue-templates): update ([7641286](https://github.com/atls/common/commit/7641286))
35+
- feat(issue-templates): update ([d386af9](https://github.com/atls/common/commit/d386af9))
36+
- feat(issue-templates): update ([7849cee](https://github.com/atls/common/commit/7849cee))
37+
- feat(issue-templates): update ([261f293](https://github.com/atls/common/commit/261f293))
38+
- feat(workflows): update ([9068bb6](https://github.com/atls/common/commit/9068bb6))
39+
- feat(workflows): update ([f98361d](https://github.com/atls/common/commit/f98361d))
40+
- feat(workflows): update ([f5a7d6c](https://github.com/atls/common/commit/f5a7d6c))
41+
- fix: fixed versions ([a9c66ad](https://github.com/atls/common/commit/a9c66ad))
42+
- fix: husky chmod ([41f6b55](https://github.com/atls/common/commit/41f6b55))
43+
- fix: more version updates yarn check passed ([9c3d680](https://github.com/atls/common/commit/9c3d680))
44+
- fix: update eslint ([955c140](https://github.com/atls/common/commit/955c140))
45+
- faet: move typeorm onto parent repo ([07aee97](https://github.com/atls/common/commit/07aee97))

packages/guard-clause/package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@
1717
"postpack": "rm -rf dist"
1818
},
1919
"dependencies": {
20+
"ajv": "^8.12.0",
2021
"validator": "^13.9.0"
2122
},
2223
"devDependencies": {

packages/guard-clause/src/decorators/against/empty.decorator.factory.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
import type { AbstractGuardExtensionFactoryOptions } from '../../factory/index.js'
22
import type { DecoratorFactoryFn } from './decorator.interfaces.js'
33

4-
import { GuardFactory } from '../../factory/index.js'
54
import { NotEmptyGuardExtensionFactory } from '../../extensions/index.js'
5+
import { GuardFactory } from '../../factory/index.js'
66

77
export const EmptyDecoratorFactory = (
88
parameter: string,

packages/guard-clause/src/decorators/against/index.ts

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,15 @@
11
import type { AbstractGuardExtensionFactoryOptions } from '../../factory/index.js'
22

33
import { EmptyDecoratorFactory } from './empty.decorator.factory.js'
4-
import { NotUUIDDecoratorFactory } from './not-uuid.decorator.factory.js'
5-
import { NotNumberBetweenDecoratorFactory } from './not-number-between.decorator.factory.js'
4+
import { NotEnumDecoratorFactory } from './not-enum.decorator.factory.js'
65
import { NotInstanceDecoratorFactory } from './not-instance.decorator.factory.js'
76
import { NotIntegerDecoratorFactory } from './not-integer.decorator.factory.js'
8-
import { NotEnumDecoratorFactory } from './not-enum.decorator.factory.js'
7+
import { NotISO4217DecoratorFactory } from './not-iso4217.decorator.factory.js'
8+
import { NotJsonSchemaValidDecoratorFactory } from './not-json-schema-valid.decorator.factory.js'
9+
import { NotNumberBetweenDecoratorFactory } from './not-number-between.decorator.factory.js'
910
import { NotOneOfDecoratorFactory } from './not-one-of.decorator.factory.js'
1011
import { NotStringLengthBetweenDecoratorFactory } from './not-string-length-between.decorator.factory.js'
11-
import { NotISO4217DecoratorFactory } from './not-iso4217.decorator.factory.js'
12+
import { NotUUIDDecoratorFactory } from './not-uuid.decorator.factory.js'
1213

1314
// eslint-disable-next-line @typescript-eslint/explicit-function-return-type
1415
const factory = (name: string, options?: AbstractGuardExtensionFactoryOptions['options']) => ({
@@ -21,6 +22,7 @@ const factory = (name: string, options?: AbstractGuardExtensionFactoryOptions['o
2122
NotOneOf: NotOneOfDecoratorFactory(name, options),
2223
NotStringLengthBetween: NotStringLengthBetweenDecoratorFactory(name, options),
2324
NotISO4217: NotISO4217DecoratorFactory(name, options),
25+
NotJsonSchemaValid: NotJsonSchemaValidDecoratorFactory(name, options),
2426
})
2527

2628
export const Against = (

packages/guard-clause/src/decorators/against/not-enum.decorator.factory.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
import type { AbstractGuardExtensionFactoryOptions } from '../../factory/index.js'
22
import type { DecoratorFactoryFn } from './decorator.interfaces.js'
33

4-
import { GuardFactory } from '../../factory/index.js'
54
import { NotEnumGuardExtensionFactory } from '../../extensions/index.js'
5+
import { GuardFactory } from '../../factory/index.js'
66

77
export const NotEnumDecoratorFactory = (
88
parameter: string,

packages/guard-clause/src/decorators/against/not-instance.decorator.factory.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
import type { AbstractGuardExtensionFactoryOptions } from '../../factory/index.js'
22
import type { DecoratorFactoryFn } from './decorator.interfaces.js'
33

4-
import { GuardFactory } from '../../factory/index.js'
54
import { NotInstanceGuardExtensionFactory } from '../../extensions/index.js'
5+
import { GuardFactory } from '../../factory/index.js'
66

77
export const NotInstanceDecoratorFactory = (
88
parameter: string,

packages/guard-clause/src/decorators/against/not-integer.decorator.factory.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
import type { AbstractGuardExtensionFactoryOptions } from '../../factory/index.js'
22
import type { DecoratorFactoryFn } from './decorator.interfaces.js'
33

4-
import { GuardFactory } from '../../factory/index.js'
54
import { NotIntegerGuardExtensionFactory } from '../../extensions/index.js'
5+
import { GuardFactory } from '../../factory/index.js'
66

77
export const NotIntegerDecoratorFactory = (
88
parameter: string,

packages/guard-clause/src/decorators/against/not-iso4217.decorator.factory.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import type { AbstractGuardExtensionFactoryOptions } from '../../factory/index.js'
22

3-
import { GuardFactory } from '../../factory/index.js'
43
import { NotISO4217GuardExtensionFactory } from '../../extensions/index.js'
4+
import { GuardFactory } from '../../factory/index.js'
55

66
export const NotISO4217DecoratorFactory = (
77
parameter: string,
Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
import type { AbstractGuardExtensionFactoryOptions } from '../../factory/index.js'
2+
import type { DecoratorFactoryFn } from './decorator.interfaces.js'
3+
4+
import { NotJsonSchemaValidGuardExtensionFactory } from '../../extensions/index.js'
5+
import { GuardFactory } from '../../factory/index.js'
6+
7+
export const NotJsonSchemaValidDecoratorFactory = (
8+
parameter: string,
9+
options?: AbstractGuardExtensionFactoryOptions['options']
10+
) =>
11+
// eslint-disable-next-line @typescript-eslint/explicit-module-boundary-types
12+
(schema: any, defs?: Array<any>): DecoratorFactoryFn =>
13+
function NotJsonSchemaValid(target: any, propertyKey: string, parameterIndex: number): void {
14+
GuardFactory.register(
15+
NotJsonSchemaValidGuardExtensionFactory,
16+
target,
17+
propertyKey,
18+
parameterIndex,
19+
{
20+
parameter,
21+
options,
22+
metadata: {
23+
schema,
24+
defs,
25+
},
26+
}
27+
)
28+
}

0 commit comments

Comments
 (0)