Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@nictool/api

Package Overview
Dependencies
Maintainers
1
Versions
6
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@nictool/api - npm Package Compare versions

Comparing version 3.0.0-alpha.2 to 3.0.0-alpha.3

CHANGELOG.md

61

lib/group.js

@@ -5,2 +5,3 @@ import Mysql from './mysql.js'

const groupDbMap = { id: 'nt_group_id', parent_gid: 'parent_group_id' }
const boolFields = ['deleted']

@@ -15,8 +16,7 @@ class Group {

const g = await this.get({ id: args.id })
if (g.length) return g[0].id
if (g.length === 1) return g[0].id
}
return await Mysql.insert(
`INSERT INTO nt_group`,
mapToDbColumn(args, groupDbMap),
return await Mysql.execute(
...Mysql.insert(`nt_group`, mapToDbColumn(args, groupDbMap)),
)

@@ -26,22 +26,20 @@ }

async get(args) {
return await Mysql.select(
`SELECT nt_group_id AS id
const rows = await Mysql.execute(
...Mysql.select(
`SELECT nt_group_id AS id
, parent_group_id AS parent_gid
, name
FROM nt_group WHERE`,
mapToDbColumn(args, groupDbMap),
, deleted
FROM nt_group`,
mapToDbColumn(args, groupDbMap),
),
)
for (const r of rows) {
for (const b of boolFields) {
r[b] = r[b] === 1
}
}
return rows
}
async getAdmin(args) {
return await Mysql.select(
`SELECT nt_group_id AS id
, name
, parent_group_id AS parent_gid
, deleted
FROM nt_group WHERE`,
mapToDbColumn(args, groupDbMap),
)
}
async put(args) {

@@ -52,6 +50,8 @@ if (!args.id) return false

// Mysql.debug(1)
const r = await Mysql.update(
`UPDATE nt_group SET`,
`WHERE nt_group_id=${id}`,
mapToDbColumn(args, groupDbMap),
const r = await Mysql.execute(
...Mysql.update(
`nt_group`,
`nt_group_id=${id}`,
mapToDbColumn(args, groupDbMap),
),
)

@@ -62,8 +62,6 @@ // console.log(r)

async delete(args, val) {
const g = await this.getAdmin(args)
if (g.length !== 1) return false
async delete(args) {
await Mysql.execute(`UPDATE nt_group SET deleted=? WHERE nt_group_id=?`, [
val ?? 1,
g[0].id,
args.deleted ?? 1,
args.id,
])

@@ -74,6 +72,5 @@ return true

async destroy(args) {
const g = await this.getAdmin(args)
if (g.length === 1) {
await Mysql.execute(`DELETE FROM nt_group WHERE nt_group_id=?`, [g[0].id])
}
return await Mysql.execute(
...Mysql.delete(`nt_group`, { nt_group_id: args.id }),
)
}

@@ -80,0 +77,0 @@ }

@@ -23,2 +23,3 @@ import assert from 'node:assert/strict'

parent_gid: 0,
deleted: false,
})

@@ -33,2 +34,3 @@ })

parent_gid: 0,
deleted: false,
})

@@ -44,2 +46,3 @@ })

parent_gid: 0,
deleted: false,
},

@@ -52,8 +55,8 @@ ])

assert.ok(await Group.delete({ id: testCase.id }))
let g = await Group.getAdmin({ id: testCase.id })
assert.equal(g[0].deleted, 1)
await Group.delete({ id: testCase.id }, 0) // restore
g = await Group.getAdmin({ id: testCase.id })
assert.equal(g[0].deleted, 0)
let g = await Group.get({ id: testCase.id, deleted: 1 })
assert.equal(g[0]?.deleted, true)
await Group.delete({ id: testCase.id, deleted: 0 }) // restore
g = await Group.get({ id: testCase.id })
assert.equal(g[0].deleted, false)
})
})

@@ -45,30 +45,22 @@ import mysql from 'mysql2/promise'

async insert(query, params = {}) {
const skipExecute = params.skipExecute ?? false
delete params.skipExecute
insert(table, params = {}) {
return [
`INSERT INTO ${table} (${Object.keys(params).join(',')}) VALUES(${Object.keys(params).map(() => '?')})`,
Object.values(params),
]
}
query += `(${Object.keys(params).join(',')}) VALUES(${Object.keys(params).map(() => '?')})`
if (skipExecute) return query
return await this.execute(query, Object.values(params))
select(query, params = {}) {
return this.whereConditions(query, params)
}
async select(query, params = {}) {
const skipExecute = params.skipExecute ?? false
delete params.skipExecute
const [queryWhere, paramsArray] = this.whereConditions(query, params)
if (skipExecute) return queryWhere
return await this.execute(queryWhere, paramsArray)
update(table, where, params = {}) {
return [
`UPDATE ${table} SET ${Object.keys(params).join('=?,')}=? WHERE ${where}`,
Object.values(params),
]
}
async update(query, where, params = {}) {
const skipExecute = params.skipExecute ?? false
delete params.skipExecute
query += ` ${Object.keys(params).join('=?,')}=? ${where}`
if (skipExecute) return { q: query, p: Object.values(params) }
return await this.execute(query, Object.values(params))
delete(table, params) {
return this.whereConditions(`DELETE FROM ${table}`, params)
}

@@ -86,2 +78,3 @@

for (const p in params) {
if (first) newQuery += ' WHERE'
if (!first) newQuery += ' AND'

@@ -96,7 +89,2 @@ newQuery += ` ${p}=?`

async delete(query, params) {
const [queryWhere, paramsArray] = this.whereConditions(query, params)
return await this.execute(queryWhere, paramsArray)
}
async disconnect(dbh) {

@@ -103,0 +91,0 @@ const d = dbh || this.dbh

@@ -23,53 +23,76 @@ import assert from 'node:assert/strict'

it('SQL: formats SELECT queries', async () => {
const r = await Mysql.select(`SELECT * FROM nt_user WHERE`, {
last_name: 'Test',
skipExecute: true,
})
assert.equal(r, `SELECT * FROM nt_user WHERE last_name=?`)
it('formats SELECT queries', () => {
assert.deepEqual(
Mysql.select(`SELECT * FROM nt_user`, {
last_name: 'Test',
}),
[`SELECT * FROM nt_user WHERE last_name=?`, ['Test']],
)
})
it('SQL: formats INSERT queries', async () => {
const r = await Mysql.select(`INSERT INTO nt_user SET`, {
it('formats INSERT query', () => {
const r = Mysql.insert(`nt_user`, {
first_name: 'uNite',
last_name: 'Test',
skipExecute: true,
})
assert.equal(r, `INSERT INTO nt_user SET first_name=? AND last_name=?`)
assert.deepEqual(r, [
`INSERT INTO nt_user (first_name,last_name) VALUES(?,?)`,
['uNite', 'Test'],
])
})
it('SQL: formats UPDATE queries, 1', async () => {
const { q, p } = await Mysql.update(
`UPDATE nt_user SET`,
`WHERE nt_user_id=4096`,
{ first_name: 'uNite', skipExecute: true },
)
assert.equal(q, `UPDATE nt_user SET first_name=? WHERE nt_user_id=4096`)
assert.deepEqual(p, ['uNite'])
describe('update', () => {
it('formats with one value', () => {
const r = Mysql.update(`nt_user`, `nt_user_id=4096`, {
first_name: 'uNite',
})
assert.deepEqual(r, [
`UPDATE nt_user SET first_name=? WHERE nt_user_id=4096`,
['uNite'],
])
})
it('formats with two values', () => {
const r = Mysql.update(`nt_user`, `nt_user_id=4096`, {
last_name: 'Teste',
is_admin: 1,
})
assert.deepEqual(r, [
`UPDATE nt_user SET last_name=?,is_admin=? WHERE nt_user_id=4096`,
['Teste', 1],
])
})
it('formats with three values', () => {
const r = Mysql.update(`nt_user`, `nt_user_id=4096`, {
first_name: 'Unit',
last_name: 'Test',
is_admin: 0,
})
assert.deepEqual(r, [
`UPDATE nt_user SET first_name=?,last_name=?,is_admin=? WHERE nt_user_id=4096`,
['Unit', 'Test', 0],
])
})
})
it('SQL: formats UPDATE queries, 2', async () => {
const { q, p } = await Mysql.update(
`UPDATE nt_user SET`,
`WHERE nt_user_id=4096`,
{ last_name: 'Teste', is_admin: 1, skipExecute: true },
)
assert.equal(
q,
`UPDATE nt_user SET last_name=?,is_admin=? WHERE nt_user_id=4096`,
)
assert.deepEqual(p, ['Teste', 1])
describe('delete', () => {
it('no params', () => {
assert.deepEqual(Mysql.delete(`nt_user`, {}), [`DELETE FROM nt_user`, []])
})
it('with params', () => {
assert.deepEqual(Mysql.delete(`nt_user`, { last_name: 'Test' }), [
`DELETE FROM nt_user WHERE last_name=?`,
['Test'],
])
})
})
it('SQL: formats UPDATE queries, 3', async () => {
const { q, p } = await Mysql.update(
`UPDATE nt_user SET`,
`WHERE nt_user_id=4096`,
{ first_name: 'Unit', last_name: 'Test', is_admin: 0, skipExecute: true },
)
assert.equal(
q,
`UPDATE nt_user SET first_name=?,last_name=?,is_admin=? WHERE nt_user_id=4096`,
)
assert.deepEqual(p, ['Unit', 'Test', 0])
it('executes formatted queries', async () => {
const [query, argsArray] = Mysql.select(`SELECT * FROM nt_options`)
const r = await Mysql.execute(query, argsArray)
assert.deepEqual(r[0].option_id, 1)
// await Mysql.execute(...Mysql.select(`SELECT * FROM nt_options`))
})

@@ -76,0 +99,0 @@

@@ -23,5 +23,4 @@ import Mysql from './mysql.js'

return await Mysql.insert(
`INSERT INTO nt_perm`,
mapToDbColumn(objectToDb(args), permDbMap),
return await Mysql.execute(
...Mysql.insert(`nt_perm`, mapToDbColumn(objectToDb(args), permDbMap)),
)

@@ -38,5 +37,9 @@ }

, p.deleted
FROM nt_perm p WHERE`
FROM nt_perm p`
// Mysql.debug(1)
const rows = await Mysql.select(query, mapToDbColumn(args, permDbMap))
if (args.deleted === undefined) args.deleted = false
const rows = await Mysql.execute(
...Mysql.select(query, mapToDbColumn(args, permDbMap)),
)
if (rows.length === 0) return

@@ -64,3 +67,3 @@ if (rows.length > 1) {

AND u.nt_user_id=?`
const rows = await Mysql.select(query, [args.uid])
const rows = await Mysql.execute(...Mysql.select(query, [args.uid]))
return dbToObject(rows[0])

@@ -74,6 +77,8 @@ }

// Mysql.debug(1)
const r = await Mysql.update(
`UPDATE nt_perm SET`,
`WHERE nt_perm_id=${id}`,
mapToDbColumn(args, permDbMap),
const r = await Mysql.execute(
...Mysql.update(
`nt_perm`,
`nt_perm_id=${id}`,
mapToDbColumn(args, permDbMap),
),
)

@@ -83,7 +88,5 @@ return r.changedRows === 1

async delete(args, val) {
const p = await this.get(args)
if (!p) return false
async delete(args) {
await Mysql.execute(`UPDATE nt_perm SET deleted=? WHERE nt_perm_id=?`, [
val ?? 1,
args.deleted ?? 1,
args.id,

@@ -95,7 +98,4 @@ ])

async destroy(args) {
const p = await this.get(args)
if (!p) return false
return await Mysql.delete(
`DELETE FROM nt_perm WHERE`,
mapToDbColumn(args, permDbMap),
return await Mysql.execute(
...Mysql.delete(`nt_perm`, mapToDbColumn(args, permDbMap)),
)

@@ -102,0 +102,0 @@ }

import assert from 'node:assert/strict'
import { describe, it, after, before } from 'node:test'
import Group from './group.js'
import User from './user.js'
import Permission from './permission.js'
import User from './user.js'
import groupTestCase from './test/group.json' with { type: 'json' }
import userTestCase from './test/user.json' with { type: 'json' }
import permTestCase from './test/permission.json' with { type: 'json' }
import userTestCase from './test/user.json' with { type: 'json' }
before(async () => {
await Group.create(groupTestCase)
await User.create(userTestCase)

@@ -61,5 +65,5 @@ })

assert.ok(await Permission.delete({ id: permTestCase.id }))
let p = await Permission.get({ id: permTestCase.id })
assert.equal(p.deleted, true)
await Permission.delete({ id: permTestCase.id }, 0) // restore
let p = await Permission.get({ id: permTestCase.id, deleted: 1 })
assert.equal(p?.deleted, true)
await Permission.delete({ id: permTestCase.id, deleted: 0 }) // restore
p = await Permission.get({ id: permTestCase.id })

@@ -66,0 +70,0 @@ assert.equal(p.deleted, false)

@@ -19,5 +19,4 @@ import Mysql from './mysql.js'

const id = await Mysql.insert(
`INSERT INTO nt_user_session`,
mapToDbColumn(args, sessionDbMap),
const id = await Mysql.execute(
...Mysql.insert(`nt_user_session`, mapToDbColumn(args, sessionDbMap)),
)

@@ -53,6 +52,31 @@ return id

async put(args) {
if (!args.id) return false
if (args.last_access) {
const p = await this.get({ id: args.id })
// if less than 60 seconds old, do nothing
const now = parseInt(Date.now() / 1000, 10)
const oneMinuteAgo = now - 60
// update only when +1 minute old (save DB writes)
if (p.last_access > oneMinuteAgo) return true
args.last_access = now
}
const id = args.id
delete args.id
const r = await Mysql.execute(
...Mysql.update(
`nt_user_session`,
`nt_user_session_id=${id}`,
mapToDbColumn(args, sessionDbMap),
),
)
// console.log(r)
return r.changedRows === 1
}
async delete(args) {
const r = await Mysql.select(
`DELETE FROM nt_user_session WHERE`,
mapToDbColumn(args, sessionDbMap),
const r = await Mysql.execute(
...Mysql.delete(`nt_user_session`, mapToDbColumn(args, sessionDbMap)),
)

@@ -59,0 +83,0 @@ return r.affectedRows === 1

@@ -9,3 +9,4 @@ {

"last_name": "Test",
"is_admin": false,
"deleted": false
}

@@ -8,2 +8,3 @@ import crypto from 'node:crypto'

const userDbMap = { id: 'nt_user_id', gid: 'nt_group_id' }
const boolFields = ['is_admin', 'deleted']

@@ -74,5 +75,4 @@ class User {

const userId = await Mysql.insert(
`INSERT INTO nt_user`,
mapToDbColumn(args, userDbMap),
const userId = await Mysql.execute(
...Mysql.insert(`nt_user`, mapToDbColumn(args, userDbMap)),
)

@@ -83,4 +83,6 @@ return userId

async get(args) {
return await Mysql.select(
`SELECT email
if (args.deleted === undefined) args.deleted = false
const rows = await Mysql.execute(
...Mysql.select(
`SELECT email
, first_name

@@ -92,21 +94,13 @@ , last_name

, email
FROM nt_user WHERE`,
mapToDbColumn(args, userDbMap),
)
}
async getAdmin(args) {
return await Mysql.select(
`SELECT email
, first_name
, last_name
, nt_group_id AS gid
, nt_user_id AS id
, username
, password
, email
, deleted
FROM nt_user WHERE`,
mapToDbColumn(args, userDbMap),
FROM nt_user`,
mapToDbColumn(args, userDbMap),
),
)
for (const r of rows) {
for (const b of boolFields) {
r[b] = r[b] === 1
}
}
return rows
}

@@ -118,6 +112,8 @@

delete args.id
const r = await Mysql.update(
`UPDATE nt_user SET`,
`WHERE nt_user_id=${id}`,
mapToDbColumn(args, userDbMap),
const r = await Mysql.execute(
...Mysql.update(
`nt_user`,
`nt_user_id=${id}`,
mapToDbColumn(args, userDbMap),
),
)

@@ -127,8 +123,6 @@ return r.changedRows === 1

async delete(args, val) {
const u = await this.getAdmin(args)
if (u.length !== 1) return false
async delete(args) {
const r = await Mysql.execute(
`UPDATE nt_user SET deleted=? WHERE nt_user_id=?`,
[val ?? 1, u[0].id],
[args.deleted ?? 1, args.id],
)

@@ -139,9 +133,5 @@ return r.changedRows === 1

async destroy(args) {
const u = await this.getAdmin(args)
if (u.length === 1) {
await Mysql.delete(
`DELETE FROM nt_user WHERE`,
mapToDbColumn({ id: u[0].id }, userDbMap),
)
}
await Mysql.execute(
...Mysql.delete(`nt_user`, mapToDbColumn({ id: args.id }, userDbMap)),
)
}

@@ -148,0 +138,0 @@

@@ -20,3 +20,3 @@ import assert from 'node:assert/strict'

const r = JSON.parse(JSON.stringify(u))
for (const f of ['deleted', 'password', 'pass_salt']) {
for (const f of ['password', 'pass_salt']) {
delete r[f]

@@ -61,7 +61,7 @@ }

assert.ok(await User.delete({ id: testCase.id }))
let u = await User.getAdmin({ id: testCase.id })
assert.equal(u[0].deleted, 1)
await User.delete({ id: testCase.id }, 0) // restore
u = await User.getAdmin({ id: testCase.id })
assert.equal(u[0].deleted, 0)
let u = await User.get({ id: testCase.id, deleted: 1 })
assert.equal(u[0].deleted, true)
await User.delete({ id: testCase.id, deleted: 0 }) // restore
u = await User.get({ id: testCase.id })
assert.equal(u[0].deleted, false)
})

@@ -68,0 +68,0 @@ })

@@ -27,3 +27,3 @@ import os from 'node:os'

function mapToDbColumn(args, maps) {
// create an instance, so we don't mangle the original
// create an instance, so we don't mangle the original args
const newArgs = JSON.parse(JSON.stringify(args))

@@ -30,0 +30,0 @@

{
"name": "@nictool/api",
"version": "3.0.0-alpha.2",
"version": "3.0.0-alpha.3",
"description": "NicTool API",

@@ -11,4 +11,4 @@ "main": "index.js",

"lint:fix": "npm run lint -- --fix",
"prettier": "npx prettier *.js lib routes test html --check",
"prettier:fix": "npm run prettier -- --write",
"prettier": "npx prettier *.js conf.d lib routes html --check",
"prettier:fix": "npx prettier *.js conf.d lib routes html --write",
"start": "NODE_ENV=production node ./server",

@@ -47,3 +47,3 @@ "develop": "NODE_ENV=development node ./server",

"@hapi/vision": "^7.0.3",
"@nictool/validate": "^0.7.3",
"@nictool/validate": "^0.7.4",
"hapi-swagger": "^17.2.1",

@@ -50,0 +50,0 @@ "mysql2": "^3.9.2",

@@ -36,3 +36,3 @@ [![Build Status](https://github.com/NicTool/api/actions/workflows/ci.yml/badge.svg)](https://github.com/NicTool/api/actions/workflows/ci.yml)

will start up the HTTP service on the port specified in `conf.d/http.yml`. The default URL for the service is [http://localhost:3000](http://localhost:3000) and the API methods have documentation at [http://localhost:3000/documentation](http://localhost:3000/documentation).
will start up the HTTP service on the port specified in `conf.d/http.yml`. The default URL for the service is [http://localhost:3000](http://localhost:3000) and the API methods have documentation at [http://localhost:3000/documentation#/](http://localhost:3000/documentation#/).

@@ -39,0 +39,0 @@

@@ -22,2 +22,3 @@ import validate from '@nictool/validate'

})
if (groups.length !== 1) {

@@ -24,0 +25,0 @@ return h

@@ -72,3 +72,3 @@ import assert from 'node:assert/strict'

it('GET /group', async () => {
it(`GET /group/${case2Id}`, async () => {
const res = await server.inject({

@@ -75,0 +75,0 @@ method: 'GET',

@@ -22,2 +22,3 @@ 'use strict'

import { Session, SessionRoutes } from './session.js'
import { PermissionRoutes } from './permission.js'

@@ -65,3 +66,3 @@ let server

validate: async (request, session) => {
const s = await Session.get({ id: session.nt_user_session_id })
const s = await Session.get({ id: session.id })
if (!s) return { isValid: false } // invalid cookie

@@ -87,2 +88,3 @@

SessionRoutes(server)
PermissionRoutes(server)

@@ -89,0 +91,0 @@ server.route({

import validate from '@nictool/validate'
import Group from '../lib/group.js'
import User from '../lib/user.js'
import Session from '../lib/session.js'
import { meta } from '../lib/util.js'

@@ -20,11 +20,11 @@

handler: async (request, h) => {
const { nt_user_id, nt_user_session_id } = request.state['sid-nictool']
const users = await User.get({ id: nt_user_id })
const groups = await Group.get({ id: users[0].gid })
delete users[0].gid
const { user, group, session } = request.state['sid-nictool']
Session.put({ id: session.id, last_access: true })
return h
.response({
user: users[0],
group: groups[0],
session: { id: nt_user_session_id },
user: user,
group: group,
session: { id: session.id },
meta: {

@@ -58,4 +58,4 @@ api: meta.api,

const sessId = await Session.create({
nt_user_id: account.user.id,
nt_user_session: '3.0.0',
uid: account.user.id,
session: '3.0.0',
last_access: parseInt(Date.now() / 1000, 10),

@@ -65,4 +65,5 @@ })

request.cookieAuth.set({
nt_user_id: account.user.id,
nt_user_session_id: sessId,
user: account.user,
group: account.group,
session: { id: sessId },
})

@@ -86,2 +87,11 @@

path: '/session',
options: {
validate: {
query: validate.session.DELETE,
},
response: {
schema: validate.session.GET,
},
tags: ['api'],
},
handler: (request, h) => {

@@ -99,8 +109,2 @@ request.cookieAuth.clear()

},
options: {
response: {
schema: validate.session.GET,
},
tags: ['api'],
},
},

@@ -107,0 +111,0 @@ ])

@@ -7,5 +7,7 @@ import assert from 'node:assert/strict'

import groupCase from './test/group.json' with { type: 'json' }
import permCase from './test/permission.json' with { type: 'json' }
import User from '../lib/user.js'
import Group from '../lib/group.js'
import Permission from '../lib/permission.js'

@@ -17,2 +19,3 @@ let server

await User.create(userCase)
await Permission.create(permCase)
server = await init()

@@ -91,3 +94,2 @@ })

assert.equal(res.statusCode, 200)
// console.log(res.result)
})

@@ -94,0 +96,0 @@ }

{
"id": 4095,
"uid": 4095,
"gid": 4095,
"inherit": true,
"name": "Route Test Permission",
"group_write": false,
"group_create": false,
"group_delete": false,
"zone_write": true,
"zone_create": true,
"zone_delegate": true,
"zone_delete": true,
"zonerecord_write": false,
"zonerecord_create": false,
"zonerecord_delegate": false,
"zonerecord_delete": false,
"user_write": false,
"user_create": false,
"user_delete": false,
"nameserver_write": false,
"nameserver_create": false,
"nameserver_delete": false,
"name": "Test Permission",
"self_write": false,
"usable_ns": "",
"deleted": false
"deleted": false,
"group": { "id": 4095, "create": false, "write": false, "delete": false },
"nameserver": {
"usable": [],
"create": false,
"write": false,
"delete": false
},
"zone": { "create": true, "write": true, "delete": true, "delegate": true },
"zonerecord": {
"create": false,
"write": false,
"delete": false,
"delegate": false
},
"user": { "id": 4095, "create": false, "write": false, "delete": false }
}

@@ -19,3 +19,6 @@ import assert from 'node:assert/strict'

const userId2 = 4094
after(async () => {
User.destroy({ id: userId2 })
await server.stop()

@@ -66,4 +69,2 @@ })

const userId2 = 4094
it('POST /user', async () => {

@@ -135,14 +136,2 @@ const testCase = JSON.parse(JSON.stringify(userCase))

it(`DELETE /user/${userId2}`, async () => {
const res = await server.inject({
method: 'DELETE',
url: `/user/${userId2}?destroy=true`,
headers: {
Cookie: sessionCookie,
},
})
// console.log(res.result)
assert.equal(res.statusCode, 200)
})
it('DELETE /session', async () => {

@@ -149,0 +138,0 @@ const res = await server.inject({

@@ -8,2 +8,3 @@ 'use strict'

import Session from './lib/session.js'
import Permission from './lib/permission.js'

@@ -59,2 +60,3 @@ import groupCase from './lib/test/group.json' with { type: 'json' }

await destroyTestGroup()
await destroyTestPermission()
await User.mysql.disconnect()

@@ -78,1 +80,6 @@ await Group.mysql.disconnect()

}
async function destroyTestPermission() {
await Permission.destroy({ id: userCase.id })
await Permission.destroy({ id: userCase.id - 1 })
}

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc