New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

contexture

Package Overview
Dependencies
Maintainers
1
Versions
57
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

contexture - npm Package Compare versions

Comparing version

to
0.5.2

5

CHANGELOG.md

@@ -0,1 +1,4 @@

### 0.5.2
* Memory Provider: Fix bug in results type pagination
### 0.5.1

@@ -5,3 +8,3 @@ * Documentation: Define DSL

### 0.5.0
Memory Provider: Add `totalRecords` to `results` example type
* Memory Provider: Add `totalRecords` to `results` example type

@@ -8,0 +11,0 @@ ### 0.4.2

2

package.json
{
"name": "contexture",
"version": "0.5.1",
"version": "0.5.2",
"description": "The Contexture (aka ContextTree) Core",

@@ -5,0 +5,0 @@ "main": "src/index.js",

@@ -6,7 +6,3 @@ let F = require('futil-js')

let overAsync = fns =>
_.flow(
_.over(fns),
Promise.all
)
let overAsync = fns => _.flow(_.over(fns), Promise.all)
let extendAllOn = _.extendAll.convert({ immutable: false })

@@ -13,0 +9,0 @@ let { getChildren, parentFirstDFS, getRelevantFilters } = utils

@@ -112,3 +112,3 @@ let _ = require('lodash/fp')

_.orderBy(sortField, sortDir),
_.slice((page - 1) * pageSize, pageSize)
_.slice((page - 1) * pageSize, page * pageSize)
)

@@ -115,0 +115,0 @@ ),

@@ -12,8 +12,5 @@ let _ = require('lodash/fp')

runSearch: (options, node, schema, filters, aggs) =>
_.flow(
_.filter(filters),
aggs
)(schema.memory.records),
_.flow(_.filter(filters), aggs)(schema.memory.records),
}
module.exports = MemoryProvider
{
"stats": {
"suites": 7,
"tests": 24,
"passes": 24,
"tests": 25,
"passes": 25,
"pending": 0,
"failures": 0,
"start": "2019-08-30T18:55:21.832Z",
"end": "2019-08-30T18:55:22.003Z",
"duration": 171
"start": "2020-01-21T20:27:38.338Z",
"end": "2020-01-21T20:27:38.533Z",
"duration": 195
},

@@ -37,3 +37,3 @@ "tests": [

"fullTitle": "Memory Provider basic test cases should handle basic OR test case",
"duration": 5,
"duration": 4,
"currentRetry": 0,

@@ -45,3 +45,3 @@ "err": {}

"fullTitle": "Memory Provider basic test cases should handle savedSearch",
"duration": 8,
"duration": 9,
"currentRetry": 0,

@@ -53,3 +53,3 @@ "err": {}

"fullTitle": "Memory Provider basic test cases should handle subquery",
"duration": 9,
"duration": 10,
"currentRetry": 0,

@@ -61,3 +61,3 @@ "err": {}

"fullTitle": "Memory Provider imdb test cases should handle facets",
"duration": 39,
"duration": 50,
"currentRetry": 0,

@@ -76,3 +76,3 @@ "err": {}

"fullTitle": "Memory Provider imdb test cases should handle date",
"duration": 15,
"duration": 21,
"currentRetry": 0,

@@ -84,3 +84,3 @@ "err": {}

"fullTitle": "Memory Provider imdb test cases should handle results sorting",
"duration": 15,
"duration": 18,
"currentRetry": 0,

@@ -92,3 +92,3 @@ "err": {}

"fullTitle": "Memory Provider imdb test cases should handle subquery",
"duration": 17,
"duration": 16,
"currentRetry": 0,

@@ -105,2 +105,9 @@ "err": {}

{
"title": "should handle pagination",
"fullTitle": "Memory Provider imdb test cases should handle pagination",
"duration": 2,
"currentRetry": 0,
"err": {}
},
{
"title": "should support explicit providers",

@@ -122,3 +129,3 @@ "fullTitle": "Utils getProvider should support explicit providers",

"fullTitle": "Utils getRelevantFilters should handle basic sibling",
"duration": 1,
"duration": 0,
"currentRetry": 0,

@@ -137,3 +144,3 @@ "err": {}

"fullTitle": "Utils getRelevantFilters should handle two siblings",
"duration": 0,
"duration": 1,
"currentRetry": 0,

@@ -145,3 +152,3 @@ "err": {}

"fullTitle": "Utils getRelevantFilters should handle sibling a level above and collapse",
"duration": 1,
"duration": 0,
"currentRetry": 0,

@@ -153,3 +160,3 @@ "err": {}

"fullTitle": "Utils getRelevantFilters should handle ORs",
"duration": 0,
"duration": 1,
"currentRetry": 0,

@@ -168,3 +175,3 @@ "err": {}

"fullTitle": "Utils getRelevantFilters should handle nested OR",
"duration": 1,
"duration": 0,
"currentRetry": 0,

@@ -190,3 +197,3 @@ "err": {}

"fullTitle": "Utils getRelevantFilters should handle nested AND",
"duration": 0,
"duration": 1,
"currentRetry": 0,

@@ -223,3 +230,3 @@ "err": {}

"fullTitle": "Memory Provider basic test cases should handle basic OR test case",
"duration": 5,
"duration": 4,
"currentRetry": 0,

@@ -231,3 +238,3 @@ "err": {}

"fullTitle": "Memory Provider basic test cases should handle savedSearch",
"duration": 8,
"duration": 9,
"currentRetry": 0,

@@ -239,3 +246,3 @@ "err": {}

"fullTitle": "Memory Provider basic test cases should handle subquery",
"duration": 9,
"duration": 10,
"currentRetry": 0,

@@ -247,3 +254,3 @@ "err": {}

"fullTitle": "Memory Provider imdb test cases should handle facets",
"duration": 39,
"duration": 50,
"currentRetry": 0,

@@ -262,3 +269,3 @@ "err": {}

"fullTitle": "Memory Provider imdb test cases should handle date",
"duration": 15,
"duration": 21,
"currentRetry": 0,

@@ -270,3 +277,3 @@ "err": {}

"fullTitle": "Memory Provider imdb test cases should handle results sorting",
"duration": 15,
"duration": 18,
"currentRetry": 0,

@@ -278,3 +285,3 @@ "err": {}

"fullTitle": "Memory Provider imdb test cases should handle subquery",
"duration": 17,
"duration": 16,
"currentRetry": 0,

@@ -291,2 +298,9 @@ "err": {}

{
"title": "should handle pagination",
"fullTitle": "Memory Provider imdb test cases should handle pagination",
"duration": 2,
"currentRetry": 0,
"err": {}
},
{
"title": "should support explicit providers",

@@ -308,3 +322,3 @@ "fullTitle": "Utils getProvider should support explicit providers",

"fullTitle": "Utils getRelevantFilters should handle basic sibling",
"duration": 1,
"duration": 0,
"currentRetry": 0,

@@ -323,3 +337,3 @@ "err": {}

"fullTitle": "Utils getRelevantFilters should handle two siblings",
"duration": 0,
"duration": 1,
"currentRetry": 0,

@@ -331,3 +345,3 @@ "err": {}

"fullTitle": "Utils getRelevantFilters should handle sibling a level above and collapse",
"duration": 1,
"duration": 0,
"currentRetry": 0,

@@ -339,3 +353,3 @@ "err": {}

"fullTitle": "Utils getRelevantFilters should handle ORs",
"duration": 0,
"duration": 1,
"currentRetry": 0,

@@ -354,3 +368,3 @@ "err": {}

"fullTitle": "Utils getRelevantFilters should handle nested OR",
"duration": 1,
"duration": 0,
"currentRetry": 0,

@@ -376,3 +390,3 @@ "err": {}

"fullTitle": "Utils getRelevantFilters should handle nested AND",
"duration": 0,
"duration": 1,
"currentRetry": 0,

@@ -379,0 +393,0 @@ "err": {}

@@ -45,3 +45,7 @@ let _ = require('lodash/fp')

memory: {
records: [{ a: 1, b: 1 }, { a: 1, b: 3 }, { a: 2, b: 2 }],
records: [
{ a: 1, b: 1 },
{ a: 1, b: 3 },
{ a: 2, b: 2 },
],
},

@@ -51,3 +55,7 @@ },

memory: {
records: [{ b: 1, c: 1 }, { b: 2, c: 2 }, { b: 3, c: 1 }],
records: [
{ b: 1, c: 1 },
{ b: 2, c: 2 },
{ b: 3, c: 1 },
],
},

@@ -123,6 +131,12 @@ },

cardinality: 2,
options: [{ name: '1', count: 2 }, { name: '2', count: 1 }],
options: [
{ name: '1', count: 2 },
{ name: '2', count: 1 },
],
})
expect(result.children[2].context).to.deep.equal({
results: [{ a: 1, b: 1 }, { a: 1, b: 3 }],
results: [
{ a: 1, b: 1 },
{ a: 1, b: 3 },
],
totalRecords: 2,

@@ -162,10 +176,20 @@ })

cardinality: 2,
options: [{ name: '1', count: 2 }, { name: '2', count: 1 }],
options: [
{ name: '1', count: 2 },
{ name: '2', count: 1 },
],
})
expect(result.children[1].context).to.deep.equal({
cardinality: 2,
options: [{ name: '1', count: 2 }, { name: '2', count: 1 }],
options: [
{ name: '1', count: 2 },
{ name: '2', count: 1 },
],
})
expect(result.children[2].context).to.deep.equal({
results: [{ a: 1, b: 1 }, { a: 1, b: 3 }, { a: 2, b: 2 }],
results: [
{ a: 1, b: 1 },
{ a: 1, b: 3 },
{ a: 2, b: 2 },
],
totalRecords: 3,

@@ -214,3 +238,6 @@ })

expect(result.children[1].context).to.deep.equal({
results: [{ a: 1, b: 1 }, { a: 1, b: 3 }],
results: [
{ a: 1, b: 1 },
{ a: 1, b: 3 },
],
totalRecords: 2,

@@ -264,3 +291,6 @@ })

expect(result.children[1].context).to.deep.equal({
results: [{ b: 1, c: 1 }, { b: 3, c: 1 }],
results: [
{ b: 1, c: 1 },
{ b: 3, c: 1 },
],
totalRecords: 2,

@@ -492,3 +522,23 @@ })

})
it('should handle pagination', async () => {
let dsl = {
key: 'results',
type: 'results',
pageSize: 2,
schema: 'favorites',
}
let result = await process(dsl)
let firstPage = result.context.results
expect(_.map('movie', firstPage)).to.deep.equal([
'Game of Thrones',
'The Matrix',
])
result = await process({ ...dsl, page: 2 })
let secondPage = result.context.results
expect(_.map('movie', secondPage)).to.deep.equal([
'Star Trek: The Next Generation',
'Game of Thrones',
])
})
})
})