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

@wmfs/j2119

Package Overview
Dependencies
Maintainers
1
Versions
36
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@wmfs/j2119 - npm Package Compare versions

Comparing version

to
1.6.1

2

lib/j2119/assigner.js

@@ -111,3 +111,3 @@ const oxford = require('./oxford')

// object field without a defined child role
if (fieldName && !childType && type === TYPES.object) {
if (fieldName && !childType && !type && (modal !== 'MUST NOT')) {
this.roles.addGrandchildRole(role, fieldName, fieldName)

@@ -114,0 +114,0 @@ this.allowedFields.setAny(fieldName)

@@ -143,3 +143,3 @@ const DateTime = require('luxon').DateTime

case TYPES.object:
if (typeof value !== 'object' && !Array.isArray(value)) report('an Object')
if (typeof value !== 'object' || Array.isArray(value)) report('an Object')
break

@@ -146,0 +146,0 @@ case TYPES.array:

@@ -26,3 +26,3 @@ // Tried use jsonpath to do this, but it couldn't distinguish between

const step = '((' + dotStep + ')|(' + bracketStep + ')|(' + index + '))' + '(' + index + ')?'
const path = '^\\$' + '(' + step + ')+$'
const path = '^\\$' + '(' + step + ')*$'

@@ -32,3 +32,3 @@ const rpDotStep = DOT_SEPARATOR + nameRe

const rpStep = '((' + rpDotStep + ')|(' + bracketStep + '))' + '(' + rpNumIndex + ')?'
const referencePath = '^\\$' + '(' + rpStep + ')+$'
const referencePath = '^\\$' + '(' + rpStep + ')*$'

@@ -35,0 +35,0 @@ const pathRe = new XRegExp(path)

{
"name": "@wmfs/j2119",
"version": "1.6.0",
"version": "1.6.1",
"description": "A general-purpose validator generator that uses RFC2119-style assertions as input.",

@@ -5,0 +5,0 @@ "author": "West Midlands Fire Service",

# j2119
[![Tymly Package](https://img.shields.io/badge/tymly-package-blue.svg)](https://tymly.io/) [![npm (scoped)](https://img.shields.io/npm/v/@wmfs/j2119.svg)](https://www.npmjs.com/package/@wmfs/j2119) [![Build Status](https://travis-ci.com/wmfs/j2119.svg?branch=master)](https://travis-ci.org/wmfs/j2119) [![codecov](https://codecov.io/gh/wmfs/j2119/branch/master/graph/badge.svg)](https://codecov.io/gh/wmfs/j2119) [![Dependabot badge](https://img.shields.io/badge/Dependabot-active-brightgreen.svg)](https://dependabot.com/) [![Commitizen friendly](https://img.shields.io/badge/commitizen-friendly-brightgreen.svg)](http://commitizen.github.io/cz-cli/)
[![Tymly Package](https://img.shields.io/badge/tymly-package-blue.svg)](https://tymly.io/) [![npm (scoped)](https://img.shields.io/npm/v/@wmfs/j2119.svg)](https://www.npmjs.com/package/@wmfs/j2119) [![Build Status](https://travis-ci.com/wmfs/j2119.svg?branch=master)](https://travis-ci.com/wmfs/j2119) [![codecov](https://codecov.io/gh/wmfs/j2119/branch/master/graph/badge.svg)](https://codecov.io/gh/wmfs/j2119) [![Dependabot badge](https://img.shields.io/badge/Dependabot-active-brightgreen.svg)](https://dependabot.com/) [![Commitizen friendly](https://img.shields.io/badge/commitizen-friendly-brightgreen.svg)](http://commitizen.github.io/cz-cli/)
[![JavaScript Style Guide](https://img.shields.io/badge/code_style-standard-brightgreen.svg)](https://standardjs.com) [![license](https://img.shields.io/github/license/mashape/apistatus.svg)](https://github.com/wmfs/tymly/blob/master/packages/j2112/LICENSE)

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

@@ -10,2 +10,11 @@ /* eslint-env mocha */

describe('J2119 JsonPathChecker', () => {
describe('should allow default paths', () => {
it('$ path', () =>
expect(jsonPathChecker.isPath('$')).to.be.true()
)
it('$ reference path', () =>
expect(jsonPathChecker.isReferencePath('$')).to.be.true()
)
})
describe('should do simple paths', () => {

@@ -12,0 +21,0 @@ const paths = [

@@ -19,3 +19,38 @@ /* eslint-env mocha */

const STATE_MACHINE_WITH_EXTENSION = {
const WITH_ARRAY_RESULT = {
StartAt: 'No-op',
States: {
'No-op': {
Type: 'Pass',
ResultPath: '$.coords',
Result: [
'foo',
'bar',
{
bazz: 123
}
],
End: true
}
}
}
const WITH_OBJECT_RESULT = {
StartAt: 'No-op',
States: {
'No-op': {
Type: 'Pass',
ResultPath: '$.coords',
Result: {
foo: {
'x-datum': 0.381018,
'y-datum': 622.2269926397355
}
},
End: true
}
}
}
const STATE_MACHINE_WITH_RESOURCE_CONFIG_OBJECT = {
StartAt: 'x',

@@ -53,2 +88,37 @@ States: {

const STATE_MACHINE_WITH_RESOURCE_CONFIG_ARRAY = {
StartAt: 'x',
States: {
x: {
Type: 'Task',
Resource: 'module:monkeyPunk',
ResourceConfig: [
'param',
{
x: 'X',
y: {
down: {
deep: {
and: {
deeper: {
and: {
deeper: {
}
}
}
}
}
}
}
},
1,
true
],
End: true
}
},
namespace: 'Test',
name: 'Extension'
}
const SCHEMA = require.resolve('./fixtures/AWL.j2119')

@@ -65,2 +135,14 @@ const EXTENSION = require.resolve('./fixtures/TymlyExtension.j2119')

it('validate state machine with result object', () => {
const v = validator(SCHEMA)
const p = v.validate(WITH_OBJECT_RESULT)
expect(p.length).to.eql(0)
})
it('validate state machine with result array', () => {
const v = validator(SCHEMA)
const p = v.validate(WITH_ARRAY_RESULT)
expect(p.length).to.eql(0)
})
it('fail to validate a text string', () => {

@@ -95,4 +177,7 @@ const v = validator(SCHEMA)

const np = v.validate(STATE_MACHINE_WITH_EXTENSION)
const np = v.validate(STATE_MACHINE_WITH_RESOURCE_CONFIG_OBJECT)
expect(np.length).to.eql(0)
const nnp = v.validate(STATE_MACHINE_WITH_RESOURCE_CONFIG_ARRAY)
expect(nnp.length).to.eql(0)
})

@@ -99,0 +184,0 @@

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet