Skip to content

Commit f7268c7

Browse files
authored
Release v0.8.9 (#21)
- group: single or list - adding permission objects - updates in sync with `api` and `server`
1 parent dbccccc commit f7268c7

11 files changed

Lines changed: 131 additions & 26 deletions

File tree

.release

Submodule .release updated 1 file

CHANGELOG.md

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,11 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/).
66

77
### Unreleased
88

9+
### [0.8.9] - 2026-03-29
10+
11+
- group: GET can return one group or array
12+
- PUT added to: group, ns, user, zone, zr
13+
914
### [0.8.8] - 2026-03-25
1015

1116
- zone_rec: delete request has id in param
@@ -108,7 +113,7 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/).
108113
[0.5.0]: https://github.com/NicTool/validate/releases/tag/0.5.0
109114
[0.6.0]: https://github.com/NicTool/validate/releases/tag/0.6.0
110115
[0.6.1]: https://github.com/NicTool/validate/releases/tag/0.6.1
111-
[0.6.3]: https://github.com/NicTool/validate/releases/tag/v0.6.3
116+
[0.6.3]: https://github.com/NicTool/validate/releases/tag/0.6.3
112117
[0.7.0]: https://github.com/NicTool/validate/releases/tag/0.7.0
113118
[0.7.1]: https://github.com/NicTool/validate/releases/tag/v0.7.1
114119
[0.7.2]: https://github.com/NicTool/validate/releases/tag/v0.7.2
@@ -122,3 +127,4 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/).
122127
[0.8.5]: https://github.com/NicTool/validate/releases/tag/v0.8.5
123128
[0.8.7]: https://github.com/NicTool/validate/releases/tag/v0.8.7
124129
[0.8.8]: https://github.com/NicTool/validate/releases/tag/v0.8.8
130+
[0.8.9]: https://github.com/NicTool/validate/releases/tag/v0.8.9

CONTRIBUTORS.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
This handcrafted artisanal software is brought to you by:
44

5-
| <img height="80" src="https://avatars.githubusercontent.com/u/261635?v=4"><br><a href="https://github.com/msimerson">msimerson</a> (<a href="https://github.com/NicTool/validate/commits?author=msimerson">27</a>) |
5+
| <img height="80" src="https://avatars.githubusercontent.com/u/261635?v=4"><br><a href="https://github.com/msimerson">msimerson</a> (<a href="https://github.com/NicTool/validate/commits?author=msimerson">28</a>) |
66
| :----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------: |
77

88
<sub>this file is generated by [.release](https://github.com/msimerson/.release).

lib/group.js

Lines changed: 39 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@ export const v3 = Joi.object({
2020
deleted: Joi.boolean(),
2121
has_children: Joi.boolean(),
2222
permission: permission.v3,
23+
usable_ns: Joi.array().items(shared.uint32),
2324
})
2425

2526
// legacy group format
@@ -36,15 +37,39 @@ export const GET_req = Joi.object({
3637
id: pid,
3738
name: name,
3839
deleted: Joi.boolean(),
40+
include_subgroups: Joi.boolean(),
41+
})
42+
43+
const groupItem = Joi.object({
44+
id: pid,
45+
name: name,
46+
parent_gid: pid,
47+
deleted: Joi.boolean(),
48+
permissions: permission.v3,
3949
})
4050

4151
export const GET_res = Joi.object({
42-
group: Joi.object({
43-
id: pid,
44-
name: name,
45-
parent_gid: pid,
46-
deleted: Joi.boolean(),
47-
}),
52+
group: Joi.alternatives().try(groupItem, Joi.array().items(groupItem)),
53+
meta: shared.meta,
54+
})
55+
56+
export const GET_list_req = Joi.object({
57+
parent_gid: pid,
58+
name: name,
59+
deleted: Joi.boolean(),
60+
include_subgroups: Joi.boolean(),
61+
})
62+
63+
export const GET_list_res = Joi.object({
64+
group: Joi.array().items(
65+
Joi.object({
66+
id: pid,
67+
name: name,
68+
parent_gid: pid,
69+
deleted: Joi.boolean(),
70+
permissions: permission.v3,
71+
}),
72+
),
4873
meta: shared.meta,
4974
})
5075

@@ -53,6 +78,14 @@ export const POST = Joi.object({
5378
name: name,
5479
parent_gid: pid,
5580
deleted: Joi.boolean(),
81+
usable_ns: Joi.array().items(shared.uint32),
82+
})
83+
84+
export const PUT = Joi.object({
85+
name: name,
86+
parent_gid: pid,
87+
deleted: Joi.boolean(),
88+
usable_ns: Joi.array().items(shared.uint32),
5689
})
5790

5891
export const DELETE = Joi.object({

lib/nameserver.js

Lines changed: 29 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -45,17 +45,41 @@ export const v3 = Joi.object({
4545
export const GET_req = Joi.object({
4646
id: id,
4747
name: name,
48+
gid: shared.uint32,
4849
deleted: Joi.boolean(),
4950
})
5051

51-
export const GET_res = Joi.object({
52-
nameserver: Joi.array().items(v3),
53-
meta: shared.meta,
54-
})
55-
5652
export const POST = v3
5753

54+
export const PUT = Joi.object({
55+
name: name,
56+
ttl: shared.ttl,
57+
description: Joi.string().empty('').max(255),
58+
address: shared.ipv4,
59+
address6: shared.ipv6.empty(''),
60+
remote_login: remote_login,
61+
export: Joi.object({
62+
interval: shared.uint16,
63+
serials: Joi.boolean(),
64+
status: Joi.string().empty('').max(255),
65+
type: type,
66+
}),
67+
deleted: Joi.boolean(),
68+
})
69+
5870
export const DELETE = Joi.object({
5971
id: id,
6072
deleted: Joi.boolean(),
6173
})
74+
75+
// GET_res uses a looser name check so records with legacy/missing trailing dots
76+
// don't fail the entire response.
77+
const v3_out = v3
78+
.fork(['name'], () => Joi.string().min(1).max(255).allow(''))
79+
.fork(['address'], () => shared.ipv4.allow('').optional())
80+
.fork(['gid', 'ttl'], (s) => s.optional())
81+
82+
export const GET_res = Joi.object({
83+
nameserver: Joi.array().items(v3_out),
84+
meta: shared.meta,
85+
})

lib/permission.js

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2,12 +2,12 @@ import Joi from 'joi'
22

33
import * as shared from './shared.js'
44

5-
export const id = Joi.number().integer().min(1).max(4294967295)
5+
export const id = Joi.number().integer().min(0).max(4294967295)
66

77
export const v3 = Joi.object({
88
id: id,
9-
name: Joi.string().empty(''),
10-
inherit: Joi.boolean(),
9+
name: Joi.string().allow('', null),
10+
inherit: Joi.boolean().allow(null),
1111
self_write: Joi.boolean(),
1212
deleted: Joi.boolean(),
1313
group: Joi.object({
@@ -17,13 +17,13 @@ export const v3 = Joi.object({
1717
delete: Joi.boolean(),
1818
}),
1919
user: Joi.object({
20-
id: id,
20+
id: id.allow(null),
2121
write: Joi.boolean(),
2222
create: Joi.boolean(),
2323
delete: Joi.boolean(),
2424
}),
2525
nameserver: Joi.object({
26-
usable: Joi.array().items(Joi.number().integer().positive()),
26+
usable: Joi.array().items(Joi.number().integer().min(0)),
2727
write: Joi.boolean(),
2828
create: Joi.boolean(),
2929
delete: Joi.boolean(),

lib/session.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ export const id = shared.uint32
88

99
export const POST = Joi.object({
1010
username: user.username.required(),
11-
password: user.password.required(),
11+
password: Joi.string().min(1).required(),
1212
})
1313

1414
export const GET_res = Joi.object({

lib/user.js

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ const JoiPassword = Joi.extend(joiPasswordExtendCore)
44

55
import * as shared from './shared.js'
66
import * as group from './group.js'
7+
import * as permission from './permission.js'
78

89
export const id = Joi.number().integer().min(1).max(4294967295)
910

@@ -30,11 +31,15 @@ export const v3 = Joi.object({
3031
password: password,
3132
is_admin: Joi.boolean(),
3233
deleted: Joi.boolean(),
34+
permissions: permission.v3,
35+
inherit_group_permissions: Joi.boolean(),
3336
})
3437

3538
export const GET_req = Joi.object({
3639
id: id,
40+
gid: group.id,
3741
deleted: Joi.boolean(),
42+
include_subgroups: Joi.boolean(),
3843
})
3944

4045
export const GET_res = Joi.object({
@@ -55,6 +60,18 @@ export const POST = Joi.object({
5560
email: email,
5661
password: password,
5762
is_admin: Joi.boolean(),
63+
inherit_group_permissions: Joi.boolean(),
64+
})
65+
66+
export const PUT = Joi.object({
67+
first_name: Joi.string().min(1),
68+
last_name: Joi.string().min(1),
69+
username: username,
70+
email: email,
71+
password: password,
72+
is_admin: Joi.boolean(),
73+
deleted: Joi.boolean(),
74+
inherit_group_permissions: Joi.boolean(),
5875
})
5976

6077
export const DELETE = Joi.object({

lib/zone.js

Lines changed: 26 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ export const zone = Joi.string().min(3).max(255)
88
// .domain({ allowFullyQualified: true, allowUnderscore: true, tlds: false })
99

1010
export const v3 = Joi.object({
11-
id: id,
11+
id,
1212

1313
gid: shared.uint32.required(),
1414

@@ -41,6 +41,7 @@ export const v3 = Joi.object({
4141

4242
export const GET_req = Joi.object({
4343
id: id,
44+
gid: shared.uint32,
4445
zone: zone,
4546
search: Joi.string().max(255).allow(''),
4647
zone_like: Joi.string().max(255).allow(''),
@@ -50,16 +51,38 @@ export const GET_req = Joi.object({
5051
sort_by: Joi.string().valid('id', 'zone', 'description', 'last_modified'),
5152
sort_dir: Joi.string().lowercase().valid('asc', 'desc'),
5253
deleted: Joi.boolean(),
54+
}).options({ allowUnknown: true })
55+
56+
export const GET_ns_res = Joi.object({
57+
ns: Joi.array().items(
58+
Joi.object({
59+
owner: Joi.string().required(),
60+
ttl: shared.ttl.required(),
61+
dname: Joi.string().required(),
62+
}),
63+
),
64+
meta: shared.meta,
5365
})
5466

5567
export const GET_res = Joi.object({
5668
zone: Joi.array().items(v3),
5769
meta: shared.meta,
70+
deleted: Joi.boolean(),
5871
})
5972

6073
export const POST = v3
6174

62-
export const DELETE = Joi.object({
63-
id: id,
75+
export const PUT = Joi.object({
76+
description: Joi.string().empty('').allow(null),
77+
mailaddr: Joi.string().empty('').allow(null),
78+
ttl: shared.ttl,
79+
refresh: shared.int32,
80+
retry: shared.int32,
81+
expire: shared.int32,
82+
minimum: shared.int32,
6483
deleted: Joi.boolean(),
6584
})
85+
86+
export const DELETE = Joi.object({
87+
id,
88+
})

lib/zone_record.js

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -227,7 +227,7 @@ export const GET_req = Joi.object({
227227
id: shared.uint32,
228228
zid: shared.uint32,
229229
deleted: Joi.boolean(),
230-
})
230+
}).options({ allowUnknown: true })
231231

232232
export const GET_res = Joi.object({
233233
zone_record: Joi.array().items(v3),
@@ -236,6 +236,8 @@ export const GET_res = Joi.object({
236236

237237
export const POST = v3.fork(['id', 'ttl'], (schema) => schema.optional())
238238

239+
export const PUT = v3.fork(['id', 'zid', 'owner', 'ttl', 'type'], (schema) => schema.optional())
240+
239241
export const DELETE = Joi.object({
240242
deleted: Joi.boolean(),
241243
})

0 commit comments

Comments
 (0)