From c4beab6b0d4f97cbcb017db3ca1bf132ce98304c Mon Sep 17 00:00:00 2001 From: Nick O'Leary Date: Mon, 7 Jan 2019 16:59:38 +0000 Subject: [PATCH] Bump JSONata to 1.6.4 Fixes #2023 --- package.json | 2 +- .../editor-client/locales/en-US/jsonata.json | 13 +++++++++++++ .../editor-client/src/vendor/jsonata/formatter.js | 3 +++ 3 files changed, 17 insertions(+), 1 deletion(-) diff --git a/package.json b/package.json index 9a0d1befd..f3f9fb7de 100644 --- a/package.json +++ b/package.json @@ -45,7 +45,7 @@ "is-utf8": "0.2.1", "js-yaml": "3.12.0", "json-stringify-safe": "5.0.1", - "jsonata": "1.5.4", + "jsonata": "1.6.3", "media-typer": "1.0.1", "memorystore": "1.6.0", "mime": "2.4.0", diff --git a/packages/node_modules/@node-red/editor-client/locales/en-US/jsonata.json b/packages/node_modules/@node-red/editor-client/locales/en-US/jsonata.json index 6efd962ce..9c33e8d6d 100755 --- a/packages/node_modules/@node-red/editor-client/locales/en-US/jsonata.json +++ b/packages/node_modules/@node-red/editor-client/locales/en-US/jsonata.json @@ -218,5 +218,18 @@ "$env": { "args": "arg", "desc": "Returns the value of an environment variable.\n\nThis is a Node-RED defined function." + }, + "$eval": { + "args": "expr [, context]", + "desc": "Parses and evaluates the string `expr` which contains literal JSON or a JSONata expression using the current context as the context for evaluation." + }, + "$formatInteger": { + "args": "number, picture", + "desc": "Casts the `number` to a string and formats it to an integer representation as specified by the `picture` string. The picture string parameter defines how the number is formatted and has the same syntax as `fn:format-integer` from the XPath F&O 3.1 specification." + }, + "$parseInteger": { + "args": "string, picture", + "desc": "Parses the contents of the `string` parameter to an integer (as a JSON number) using the format specified by the `picture` string. The `picture` string parameter has the same format as `$formatInteger`." + } } diff --git a/packages/node_modules/@node-red/editor-client/src/vendor/jsonata/formatter.js b/packages/node_modules/@node-red/editor-client/src/vendor/jsonata/formatter.js index 6ff26accb..4929def85 100644 --- a/packages/node_modules/@node-red/editor-client/src/vendor/jsonata/formatter.js +++ b/packages/node_modules/@node-red/editor-client/src/vendor/jsonata/formatter.js @@ -118,11 +118,13 @@ '$count':{ args:[ 'array' ]}, '$each':{ args:[ 'object', 'function' ]}, '$env': { args:[ 'arg' ]}, + '$eval': { args: ['expr', 'context']}, '$exists':{ args:[ 'arg' ]}, '$filter':{ args:[ 'array', 'function' ]}, '$floor':{ args:[ 'number' ]}, '$flowContext': {args:['string']}, '$formatBase': {args:['number','radix']}, + '$formatInteger': {args:['number', 'picture']}, '$formatNumber': {args:['number', 'picture', 'options']}, '$fromMillis': {args:['number']}, '$globalContext': {args:['string']}, @@ -141,6 +143,7 @@ '$now':{ args:[ ]}, '$number':{ args:[ 'arg' ]}, '$pad': {args:['str', 'width','char']}, + '$parseInteger': {args:['string', 'picture']}, '$power':{ args:[ 'base', 'exponent' ]}, '$random':{ args:[ ]}, '$reduce':{ args:[ 'array', 'function' , 'init' ]},