Skip to content

Commit

Permalink
v6.4.0
Browse files Browse the repository at this point in the history
  • Loading branch information
rjrodger committed Jun 10, 2024
1 parent 76349f7 commit 3503065
Show file tree
Hide file tree
Showing 12 changed files with 38 additions and 35 deletions.
2 changes: 1 addition & 1 deletion lib/cmd_encrypt.js
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ module.exports = (ctx) => {
} else {
return resolve({ ok: !err, pass: out.hash, salt: salt })
}
}
},
)
})
}
Expand Down
2 changes: 1 addition & 1 deletion lib/hasher.js
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ function hasher(seneca, spec, done) {

clean_interval = setInterval(
make_clean_waiting(waiting, spec.interval),
spec.interval
spec.interval,
)

close_defined = prepare_close(close_defined, seneca)
Expand Down
2 changes: 1 addition & 1 deletion lib/list_login.js
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ module.exports = (ctx) => {
sort$: { when: -1 },
limit$: options.limit,
},
login_q || {}
login_q || {},
)

var items = await seneca.entity(ctx.sys_login).list$(full_login_q)
Expand Down
2 changes: 1 addition & 1 deletion lib/list_user.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ module.exports = (ctx) => {

msg = intern.load_user_fields(
msg,
ctx.standard_user_fields.concat(Object.keys(q))
ctx.standard_user_fields.concat(Object.keys(q)),
)

var full_query = q
Expand Down
2 changes: 1 addition & 1 deletion lib/login_user.js
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ module.exports = (ctx) => {
var find_msg = Object.assign({ q: {} }, msg)
find_msg.q.fields$ = [
...new Set(
user_fields.concat((find_msg.q.fields$ || []).concat(['pass', 'salt']))
user_fields.concat((find_msg.q.fields$ || []).concat(['pass', 'salt'])),
),
]

Expand Down
4 changes: 2 additions & 2 deletions lib/make_verify.js
Original file line number Diff line number Diff line change
Expand Up @@ -44,8 +44,8 @@ module.exports = (ctx) => {
null != msg.expire_point
? msg.expire_point
: null != msg.expire_duration
? t_c + msg.expire_duration
: Number.MAX_SAFE_INTEGER
? t_c + msg.expire_duration
: Number.MAX_SAFE_INTEGER

var verify_data = {
...custom,
Expand Down
2 changes: 1 addition & 1 deletion lib/register_user.js
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ module.exports = (ctx) => {
sv: intern.SV,
},

pass_fields.fields
pass_fields.fields,
)

var user = await seneca.entity(ctx.sys_user).data$(combined_data).save$()
Expand Down
2 changes: 1 addition & 1 deletion lib/update_user.js
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ module.exports = (ctx) => {
var data_msg = Object.assign(
{},
msg,
ctx.convenience_fields.reduce((m, f) => ((m[f] = void 0), m), {})
ctx.convenience_fields.reduce((m, f) => ((m[f] = void 0), m), {}),
)

var user_data = intern.normalize_user_data(data_msg, ctx)
Expand Down
18 changes: 9 additions & 9 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "@seneca/user",
"description": "User management plugin for Seneca",
"version": "6.3.0",
"version": "6.4.0",
"keywords": [
"seneca",
"user",
Expand Down Expand Up @@ -56,21 +56,21 @@
"node": ">=12"
},
"dependencies": {
"uuid": "^9.0.0"
"uuid": "^10.0.0"
},
"devDependencies": {
"@hapi/code": "8",
"@hapi/lab": "23",
"@hapi/code": "9",
"@hapi/lab": "25",
"coveralls": "^3.1.1",
"prettier": "^2.8.8",
"prettier": "^3.3.1",
"seneca-doc": "^2.1.3",
"seneca-msg-test": "^3.4.0",
"@seneca/maintain": "^0.0.30"
"seneca-msg-test": "^4.1.0",
"@seneca/maintain": "^0.1.0"
},
"peerDependencies": {
"seneca": ">=3",
"seneca": ">=3||>=4.0.0-rc2",
"seneca-promisify": ">=3",
"seneca-entity": ">=23"
"seneca-entity": ">=26"
},
"repository": {
"type": "git",
Expand Down
27 changes: 15 additions & 12 deletions test/intern.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ lab.test('fix_nick_handle', async () => {
user: { handle: 'foo' },
})
expect(
intern.fix_nick_handle({ user: { nick: 'bar', handle: 'foo' } }, o)
intern.fix_nick_handle({ user: { nick: 'bar', handle: 'foo' } }, o),
).equal({ user: { handle: 'foo' } })
expect(intern.fix_nick_handle({ q: { nick: 'foo' } }, o)).equal({
q: { handle: 'foo' },
Expand Down Expand Up @@ -363,37 +363,40 @@ lab.test('load_user_field', () => {
q: { fields$: ['x', 'y', 'z'] },
})
expect(intern.load_user_fields({ a: 1, q: { k: 1 } }, 'x', ['y', 'z'])).equal(
{ a: 1, q: { k: 1, fields$: ['x', 'y', 'z'] } }
{ a: 1, q: { k: 1, fields$: ['x', 'y', 'z'] } },
)

expect(
intern.load_user_fields({ a: 1, q: { fields$: [] } }, 'x', ['y', 'z'])
intern.load_user_fields({ a: 1, q: { fields$: [] } }, 'x', ['y', 'z']),
).equal({ a: 1, q: { fields$: ['x', 'y', 'z'] } })
expect(
intern.load_user_fields({ a: 1, q: { k: 1, fields$: [] } }, 'x', ['y', 'z'])
intern.load_user_fields({ a: 1, q: { k: 1, fields$: [] } }, 'x', [
'y',
'z',
]),
).equal({ a: 1, q: { k: 1, fields$: ['x', 'y', 'z'] } })

expect(
intern.load_user_fields({ a: 1, q: { fields$: ['q'] } }, 'x', ['y', 'z'])
intern.load_user_fields({ a: 1, q: { fields$: ['q'] } }, 'x', ['y', 'z']),
).equal({ a: 1, q: { fields$: ['q', 'x', 'y', 'z'] } })
expect(
intern.load_user_fields({ a: 1, q: { k: 1, fields$: ['q'] } }, 'x', [
'y',
'z',
])
]),
).equal({ a: 1, q: { k: 1, fields$: ['q', 'x', 'y', 'z'] } })

expect(
intern.load_user_fields({ a: 1, q: { fields$: ['q', 'x'] } }, 'x', [
'y',
'z',
])
]),
).equal({ a: 1, q: { fields$: ['q', 'x', 'y', 'z'] } })
expect(
intern.load_user_fields({ a: 1, q: { k: 1, fields$: ['q', 'x'] } }, 'x', [
'y',
'z',
])
]),
).equal({ a: 1, q: { k: 1, fields$: ['q', 'x', 'y', 'z'] } })
})

Expand Down Expand Up @@ -537,7 +540,7 @@ lab.test('normalize_user_data', async () => {
expect(nud({ name: 'a', user_data: { name: 'c' } })).equal(r0)
expect(nud({ user: { name: 'b' }, user_data: { name: 'a' } })).equal(r0)
expect(
nud({ name: 'a', user: { name: 'b' }, user_data: { name: 'c' } })
nud({ name: 'a', user: { name: 'b' }, user_data: { name: 'c' } }),
).equal(r0)
expect(nud({ name: 'a', email: void 0 })).equal(r0)

Expand All @@ -561,7 +564,7 @@ lab.test('normalize_user_data', async () => {
expect(nud({ pass: 'a', user_data: { pass: 'c' } })).equal(r2)
expect(nud({ user: { pass: 'b' }, user_data: { pass: 'a' } })).equal(r2)
expect(
nud({ pass: 'a', user: { pass: 'b' }, user_data: { pass: 'c' } })
nud({ pass: 'a', user: { pass: 'b' }, user_data: { pass: 'c' } }),
).equal(r2)

// password -> pass
Expand All @@ -571,14 +574,14 @@ lab.test('normalize_user_data', async () => {
expect(nud({ user_data: { password: 'a' } })).equal(r3)
expect(nud({ password: 'a', user_data: { password: 'c' } })).equal(r3)
expect(nud({ user: { password: 'b' }, user_data: { password: 'a' } })).equal(
r3
r3,
)
expect(
nud({
password: 'a',
user: { password: 'b' },
user_data: { password: 'c' },
})
}),
).equal(r3)
expect(nud({ password: 'b', pass: 'a' })).equal(r3)
})
Expand Down
2 changes: 1 addition & 1 deletion test/user.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ lab.test('export', async () => {
found = await find_user(
si,
{ handle: 'alice' },
{ standard_user_fields: ['name'] }
{ standard_user_fields: ['name'] },
)
expect(found.ok).true()
expect(found.why).not.exists()
Expand Down
8 changes: 4 additions & 4 deletions user.js
Original file line number Diff line number Diff line change
Expand Up @@ -157,7 +157,7 @@ function make_intern() {

handle,
},
initial_ctx
initial_ctx,
)
},

Expand Down Expand Up @@ -185,7 +185,7 @@ function make_intern() {
{},
msg.user || {},
msg.user_data || {},
msg_user_query
msg_user_query,
)

// can only use one convenience field - they are ordered by decreasing
Expand Down Expand Up @@ -278,7 +278,7 @@ function make_intern() {

generate_salt: function (options) {
return Crypto.randomBytes(options.salt.bytelen).toString(
options.salt.format
options.salt.format,
)
},

Expand Down Expand Up @@ -535,7 +535,7 @@ function make_intern() {

// strip undefineds
Object.keys(user_data).forEach(
(k) => void 0 === user_data[k] && delete user_data[k]
(k) => void 0 === user_data[k] && delete user_data[k],
)

return user_data
Expand Down

0 comments on commit 3503065

Please sign in to comment.