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

@iannisz/node-cms

Package Overview
Dependencies
Maintainers
1
Versions
95
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@iannisz/node-cms - npm Package Compare versions

Comparing version 0.0.38 to 0.0.39

4

package.json
{
"name": "@iannisz/node-cms",
"version": "0.0.38",
"version": "0.0.39",
"description": "Node CMS",

@@ -23,5 +23,5 @@ "main": "index.js",

"ncp": "^2.0.0",
"node-json-database": "0.0.24",
"node-json-database": "0.0.25",
"queued-copy-dir": "^0.0.2"
}
}

@@ -61,3 +61,3 @@ "use strict";

catch (err) {
reject(new QueryError(500, err.stack));
reject(new QueryError(500, err.message));
}

@@ -81,3 +81,3 @@ // Query ran successfully

else if (err.code == 500) {
apache_js_workers_1.res.send('Internal Server Error: ' + err.message);
apache_js_workers_1.res.send('Database Error: ' + err.message.replace(/\x1b\[[0-9]*m/g, ''));
}

@@ -84,0 +84,0 @@ else {

@@ -82,3 +82,3 @@ import { req, res, log } from 'apache-js-workers'

} catch(err) {
reject(new QueryError(500, err.stack))
reject(new QueryError(500, err.message))
}

@@ -105,3 +105,3 @@

} else if (err.code == 500) {
res.send('Internal Server Error: ' + err.message)
res.send('Database Error: ' + err.message.replace(/\x1b\[[0-9]*m/g, ''))
} else {

@@ -108,0 +108,0 @@ res.send('Unhandled Error: ' + err.message)

@@ -321,2 +321,15 @@ /*

const reduceMap = <K, V>(
map: Map<K, V>,
f: (key: K, value: V) => string
) => {
let output = ''
for (let [ key, value ] of map) {
output += f(key, value)
}
return output
}
const showLoader = () => {

@@ -1949,2 +1962,3 @@ $('.main').innerHTML = /* html */ `

rows: DB_Table_Row_Formatted[]
data?: any
}

@@ -2139,3 +2153,6 @@

let currentTableName: string
let currentOrderBy = new Map<string, 'ASC' | 'DESC'>()
let currentFilters = new Map<string, FilterFunction>()
let currentBuiltInFilters = new Map<string, FilterFunction>()

@@ -2153,20 +2170,23 @@ const showTable = async (

})
currentTable = await getTable(dbName, tableName)
currentDbName = dbName
currentTableName = tableName
currentOrderBy.clear()
currentFilters.clear()
currentBuiltInFilters.clear()
showCurrentTable()
}
const { data } = currentTable
const showCurrentTable = (
filter?: FilterFunction
) => {
// Filter table if a filter is provided
// Get the built-in filters from the extra data of the table
const table = (filter != undefined) ? filterTable(currentTable, filter) : currentTable
if (data != undefined) {
if (data.filters != undefined) {
for (let filterName in data.filters) {
currentBuiltInFilters.set(filterName, eval(data.filters[filterName]))
}
}
}
const { rows, cols } = table
$('.main').innerHTML = /* html */ `

@@ -2178,2 +2198,38 @@ <h1>

<div class="table-container"></div>
<br><br>
<div class="built-in-filters">
${ reduceMap(currentBuiltInFilters, filterName => /* html */ `
<input type="checkbox" onchange="setTableFilter('${ filterName }', this.checked)">
${ filterName }
<br>
`) }
</div>
`
updateTable()
}
const updateTable = (
...filters: FilterFunction[]
) => {
let table = currentTable
// Apply each filter from the parameters
for (let filter of filters) {
table = filterTable(table, filter)
}
// Apply each filter from currentFilters
for (let [ _filterName, filterFunction ] of currentFilters) {
table = filterTable(table, filterFunction)
}
const { rows, cols } = table
$('.table-container').innerHTML = /* html */ `
<table class="fullwidth database-table">

@@ -2477,5 +2533,9 @@ <thead>

// Refetch the table
currentTable = await getTable(dbName, tableName)
// Reload the table
showTable(dbName, tableName)
updateTable()
} catch(err) {

@@ -2518,5 +2578,9 @@ handleRequestError(err)

// Refetch the table
currentTable = await getTable(dbName, tableName)
// Reload the table
showTable(dbName, tableName)
updateTable()
} catch(err) {

@@ -2586,3 +2650,3 @@ handleRequestError(err)

await orderCurrentTable()
showCurrentTable()
updateTable()
setOrderArrowsOfTable()

@@ -2647,5 +2711,21 @@ }

return {
cols: table.cols,
...table,
rows: rowsOut
}
}
const setTableFilter = (
builtInFilterName: string,
enabled: boolean
) => {
if (enabled) {
const filterFunction = currentBuiltInFilters.get(builtInFilterName)
currentFilters.set(builtInFilterName, filterFunction)
} else {
currentFilters.delete(builtInFilterName)
}
// Refresh table
updateTable()
}

@@ -57,3 +57,3 @@ const request = (url, body = {}, files = []) => {

// This should never happen
notification('Unhandled Error', `status code: ${err.status}, body: <code>${err.response}</code>`);
notification('Unhandled Error', `status code: ${err.status}, body: <codeblock>${err.response.replace(/\n/g, '<br>')}</codeblock>`, null);
}

@@ -60,0 +60,0 @@ };

@@ -79,3 +79,3 @@ interface SocketResponse {

notification('Unhandled Error', `status code: ${ err.status }, body: <code>${ err.response }</code>`)
notification('Unhandled Error', `status code: ${ err.status }, body: <codeblock>${ err.response.replace(/\n/g, '<br>') }</codeblock>`, null)
}

@@ -82,0 +82,0 @@ }

@@ -14,3 +14,4 @@ "use strict";

const { rows, cols } = orderedTable;
apache_js_workers_1.res.send({ rows, cols });
const { data } = tableFn;
apache_js_workers_1.res.send({ rows, cols, data });
})

@@ -17,0 +18,0 @@ .catch(err => {

@@ -17,4 +17,5 @@ import { queryTable, handleError } from './../../../../../private-workers/database-query'

const { rows, cols } = orderedTable
const { data } = tableFn
res.send({ rows, cols })
res.send({ rows, cols, data })
}

@@ -21,0 +22,0 @@ )

Sorry, the diff of this file is too big to display

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