Skip to content
Permalink

Comparing changes

Choose two branches to see what’s changed or to start a new pull request. If you need to, you can also or learn more about diff comparisons.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also . Learn more about diff comparisons here.
base repository: jsonata-js/jsonata
Failed to load repositories. Confirm that selected base ref is valid, then try again.
Loading
base: b1e40eb20bb1a09f5dd2ef8bed08b76d2fd64a12
Choose a base ref
...
head repository: jsonata-js/jsonata
Failed to load repositories. Confirm that selected head ref is valid, then try again.
Loading
compare: 220b45ab937fd97f2b1a9825b83eeb95c0c6d0b7
Choose a head ref

Commits on Oct 29, 2020

  1. Update path-operators.md

    markfirmware authored and mattbaileyuk committed Oct 29, 2020
    Copy the full SHA
    6ec4269 View commit details
  2. Update construction.md (#485)

    Co-authored-by: Matt Bailey <mattbaileyuk@users.noreply.github.com>
    markfirmware and mattbaileyuk authored Oct 29, 2020
    Copy the full SHA
    68346a6 View commit details

Commits on Nov 17, 2020

  1. Copy the full SHA
    2971f85 View commit details

Commits on Jan 13, 2021

  1. Copy the full SHA
    0e72577 View commit details

Commits on Mar 15, 2021

  1. Copy the full SHA
    97295a6 View commit details

Commits on Apr 30, 2021

  1. Copy the full SHA
    4c54db2 View commit details

Commits on Jun 3, 2021

  1. Copy the full SHA
    661e1d6 View commit details

Commits on Aug 18, 2021

  1. fix regression with singleton sequence of array type

    Signed-off-by: andrew-coleman <andrew_coleman@uk.ibm.com>
    andrew-coleman authored and mattbaileyuk committed Aug 18, 2021
    Copy the full SHA
    ccb0109 View commit details

Commits on Aug 19, 2021

  1. unwrap outer array when evaluating wildcard

    Signed-off-by: andrew-coleman <andrew_coleman@uk.ibm.com>
    andrew-coleman authored and mattbaileyuk committed Aug 19, 2021
    Copy the full SHA
    57dba82 View commit details
  2. correctly handle empty array input to group expression

    Signed-off-by: andrew-coleman <andrew_coleman@uk.ibm.com>
    andrew-coleman authored and mattbaileyuk committed Aug 19, 2021
    Copy the full SHA
    33bb565 View commit details
  3. Release v1.8.5

    Signed-off-by: andrew-coleman <andrew_coleman@uk.ibm.com>
    andrew-coleman authored and mattbaileyuk committed Aug 19, 2021
    Copy the full SHA
    d9bbcce View commit details

Commits on Sep 6, 2021

  1. Update .travis.yml (#536)

    Co-authored-by: Andrew Coleman <andrew_coleman@uk.ibm.com>
    mattbaileyuk and andrew-coleman authored Sep 6, 2021
    Copy the full SHA
    477d6d9 View commit details

Commits on Nov 1, 2021

  1. (docs) Add an example for ternary conditional (#548)

    * Add ternary example
    
    * Remove extra whitespace
    cadam11 authored Nov 1, 2021
    Copy the full SHA
    ed1dacf View commit details

Commits on Nov 2, 2021

  1. Regex bug test case

    Test case for Regex issue in which the min/max picture values are being ignored.
    JAMSUPREME authored and mattbaileyuk committed Nov 2, 2021
    Copy the full SHA
    57c8440 View commit details
  2. Fix picture syntax

    JAMSUPREME authored and mattbaileyuk committed Nov 2, 2021
    Copy the full SHA
    3dae0e6 View commit details
  3. MandatoryDigits notes

    JAMSUPREME authored and mattbaileyuk committed Nov 2, 2021
    Copy the full SHA
    7bea75b View commit details
  4. Adjusting occurrence

    JAMSUPREME authored and mattbaileyuk committed Nov 2, 2021
    Copy the full SHA
    d182bd2 View commit details
  5. Adjusting for non-negative n

    JAMSUPREME authored and mattbaileyuk committed Nov 2, 2021
    Copy the full SHA
    b0ddadd View commit details
  6. Remove garbage

    JAMSUPREME authored and mattbaileyuk committed Nov 2, 2021
    Copy the full SHA
    39fdb66 View commit details
  7. Positive n

    JAMSUPREME authored and mattbaileyuk committed Nov 2, 2021
    Copy the full SHA
    a38c3ad View commit details
  8. Add width operator-style case

    JAMSUPREME authored and mattbaileyuk committed Nov 2, 2021
    Copy the full SHA
    51bb159 View commit details
  9. Adding YMD case

    Adding a YMD case which appears to be failing.
    JAMSUPREME authored and mattbaileyuk committed Nov 2, 2021
    Copy the full SHA
    fb71dd4 View commit details
  10. Copy the full SHA
    44e7941 View commit details
  11. Attempt to calculate n for MD

    JAMSUPREME authored and mattbaileyuk committed Nov 2, 2021
    Copy the full SHA
    c16ba7b View commit details
  12. n with consideration of optionalDigits

    Usage of n works except when there could be optional digits, i.e. [M#1] in which case we need to also supply a lower bound of occurrences.
    JAMSUPREME authored and mattbaileyuk committed Nov 2, 2021
    Copy the full SHA
    e6e436d View commit details

Commits on Jan 6, 2022

  1. Fixing reported issue #547 (#555)

    * Fixing reported issue #547
    
    * Fixing reported issue #547.  Added unit test coverage.
    
    * Fixing reported issue #547.  Added unit test coverage.
    
    * Fixing reported issue #547.  Added unit test coverage.
    
    * Fixing reported issue #547.  Added unit test coverage.
    kexuibm authored Jan 6, 2022
    Copy the full SHA
    65e854d View commit details

Commits on Feb 7, 2022

  1. Fixed Buffer Deprecation warning (#560)

    I've been seeing a warning for `DeprecationWarning: Buffer() is deprecated due to security and usability issues.`. This fixes that.
    Ramsey-PlexTrac authored Feb 7, 2022
    Copy the full SHA
    f14f1b3 View commit details
  2. Remove dead tech talk link (#562)

    Co-authored-by: Andrew Coleman <andrew_coleman@uk.ibm.com>
    mattbaileyuk and andrew-coleman authored Feb 7, 2022
    Copy the full SHA
    b2a2bfa View commit details
  3. Release v1.8.6

    Signed-off-by: andrew-coleman <andrew_coleman@uk.ibm.com>
    andrew-coleman authored and mattbaileyuk committed Feb 7, 2022
    Copy the full SHA
    8e4abd8 View commit details

Commits on Feb 29, 2024

  1. Add workflow

    mattbaileyuk committed Feb 29, 2024
    Copy the full SHA
    ebdb02a View commit details

Commits on Mar 1, 2024

  1. Prevent writing to the object prototype or constructor (v1 port) (#681)

    * Prevent access to __proto__
    
    Signed-off-by: andrew-coleman <andrew_coleman@uk.ibm.com>
    
    * Check for constructor property
    
    * Adjust for sync
    
    ---------
    
    Signed-off-by: andrew-coleman <andrew_coleman@uk.ibm.com>
    Co-authored-by: andrew-coleman <andrew_coleman@uk.ibm.com>
    mattbaileyuk and andrew-coleman authored Mar 1, 2024
    Copy the full SHA
    1d579db View commit details
  2. Publish version 1.8.7 (#682)

    * Update CHANGELOG.md
    
    * Publish 1.8.7
    mattbaileyuk authored Mar 1, 2024
    Copy the full SHA
    220b45a View commit details
68 changes: 68 additions & 0 deletions .github/workflows/jsonata.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,68 @@
name: Build and publish JSONata
on:
push:
branches: [ master, v1 ]
pull_request:
branches: [ master, v1 ]
jobs:
build:
runs-on: ubuntu-latest
strategy:
matrix:
node-version: [12.x, 14.x, 16.x, 18.x]
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Use Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v3
with:
node-version: ${{ matrix.node-version }}
- run: npm install
- run: npm test
publish:
needs: build
runs-on: ubuntu-latest
if: ${{ github.event_name == 'push' && github.repository == 'jsonata-js/jsonata' }}
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Use Node.js 18.x
uses: actions/setup-node@v3
with:
node-version: 18.x
- name: Install and build
run: npm install && npm test
- name: Publish to NPM
id: npmpub
uses: JS-DevTools/npm-publish@v1
with:
token: ${{ secrets.NPM_TOKEN }}
- if: steps.npmpub.outputs.type != 'none'
run: |
echo "Version changed: ${{ steps.npmpub.outputs.old-version }} => ${{ steps.npmpub.outputs.version }}"
documentation:
needs: build
runs-on: ubuntu-latest
if: ${{ github.event_name == 'push' && github.repository == 'jsonata-js/jsonata' }}
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Use Node.js 18.x
uses: actions/setup-node@v3
with:
node-version: 18.x
- name: Build documentation
run: |
cd website
npm install
npm run build
- name: Deploy to GitHub Pages
if: success()
run: |
cd website
git config --global user.name "andrew-coleman"
git config --global user.email "andrew_coleman@uk.ibm.com"
echo "machine github.com login andrew-coleman password ${{ secrets.DOCS_AUTH }}" > ~/.netrc
npm run publish-gh-pages
env:
GIT_USER: andrew-coleman
6 changes: 3 additions & 3 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
language: node_js
node_js:
- '16'
- '14'
- '12'
- '10'
- '8'
after_success:
- npm run coveralls
jobs:
@@ -17,7 +17,7 @@ jobs:
- cd website && npm install && GIT_USER="${GH_NAME}" npm run publish-gh-pages
- stage: npm release
if: branch = master AND repo = jsonata-js/jsonata
node_js: '10'
node_js: '14'
script: echo "Deploying to npm..."
deploy:
provider: npm
16 changes: 16 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,19 @@
#### 1.8.7 Maintenance Release

- Prevent writing to the object prototype or constructor (PR https://github.com/jsonata-js/jsonata/pull/681)

#### 1.8.6 Maintenance Release

- Fix bug in date/time picture string. Width formatting is not respected without a separator (issue #546)
- Fix error when converting empty array to an object (issue #547)
- Fix Buffer deprecation warning (PR #560)

#### 1.8.5 Maintenance Release

- Fix regression with singleton sequence of array type (issue #462)
- Correctly handle empty array input to group expression (issue #527)
- Fix bug with outer array when evaluating wildcard (issue #495)

#### 1.8.4 Maintenance Release

- Fix bug in `$eval` when second arg is an empty array (issue #463)
1 change: 0 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -64,7 +64,6 @@ In a browser:
- JSONata [documentation](http://docs.jsonata.org/)
- [JavaScript API](http://docs.jsonata.org/embedding-extending)
- [Intro talk](https://www.youtube.com/watch?v=TDWf6R8aqDo) at London Node User Group
- JSONata [tech talk](https://www.youtube.com/watch?v=ZRtlkIj0uDY)

## Contributing

2 changes: 1 addition & 1 deletion docs/construction.md
Original file line number Diff line number Diff line change
@@ -16,7 +16,7 @@ Array constructors can also be used within location paths for making multiple se

__Examples__

- The four emails addresses are returned in a flat array.
- The four email addresses are returned in a flat array.
<div class="jsonata-ex">
<div>Email.address</div>
<div>[
2 changes: 1 addition & 1 deletion docs/numeric-functions.md
Original file line number Diff line number Diff line change
@@ -29,7 +29,7 @@ If `number` is not specified (i.e. this function is invoked with no arguments),

__Examples__
- `$abs(5)` => `5`
- `$abs(-5)` => `-5`
- `$abs(-5)` => `5`

## `$floor()`
__Signature:__ `$floor(number)`
2 changes: 1 addition & 1 deletion docs/path-operators.md
Original file line number Diff line number Diff line change
@@ -56,7 +56,7 @@ To sort in descending order, the sort expression must be preceded by the `>` sym

`Account.Order.Product^(>Price)`

sorts all of the products into order of decreasing price. The `<` symbol can be used explicitly indicate ascending order, although that is the default behaviour.
sorts all of the products into order of decreasing price. The `<` symbol can be used to explicitly indicate ascending order, although that is the default behaviour.

Secondary (and more) sort expressions can be specified by separating them with commas (`,`). The secondary expression will be used to determine order if the primary expression ranks two values the same. For example,

20 changes: 19 additions & 1 deletion docs/programming.md
Original file line number Diff line number Diff line change
@@ -48,7 +48,25 @@ The expression `predicate` is evaluated. If its effective boolean value (see de

__Examples__

TBD
<div class="jsonata-ex">
<div>Account.Order.Product.{
`Product Name`: $.Price > 100 ? "Premium" : "Basic"
}</div>
<div>[
{
"Bowler Hat": "Basic"
},
{
"Trilby hat": "Basic"
},
{
"Bowler Hat": "Basic"
},
{
"Cloak": "Premium"
}
]</div>
</div>

## Variables

4 changes: 4 additions & 0 deletions jsonata.d.ts
Original file line number Diff line number Diff line change
@@ -13,6 +13,10 @@ declare namespace jsonata {
name?: string;
procedure?: ExprNode;
steps?: ExprNode[];
expressions?: ExprNode[];
stages?: ExprNode[];
lhs?: ExprNode;
rhs?: ExprNode;
}

interface JsonataError extends Error {
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "jsonata",
"version": "1.8.4",
"version": "1.8.7",
"description": "JSON query and transformation language",
"module": "jsonata.js",
"main": "jsonata.js",
16 changes: 14 additions & 2 deletions src/datetime.js
Original file line number Diff line number Diff line change
@@ -612,7 +612,7 @@ const dateTime = (function () {
def.integerFormat.mandatoryDigits = def.width.min;
}
}
if (def.component === 'Y') {
if ('YMD'.indexOf(def.component) !== -1) {
// §9.8.4.4
def.n = -1;
if (def.width && def.width.max !== undefined) {
@@ -983,6 +983,7 @@ const dateTime = (function () {
return offsetHours * 60 + offsetMinutes;
};
} else if (part.integerFormat) {
part.integerFormat.n = part.n;
res = generateRegex(part.integerFormat);
} else {
// must be a month or day name
@@ -1027,6 +1028,17 @@ const dateTime = (function () {
} else { // type === 'integer'
matcher.type = 'integer';
const isUpper = formatSpec.case === tcase.UPPER;
let occurrences;
if(formatSpec.n && formatSpec.n > 0){
if(formatSpec.optionalDigits === 0){
occurrences = `{${formatSpec.n}}`;
} else {
occurrences = `{${formatSpec.n - formatSpec.optionalDigits},${formatSpec.n}}`;
}
} else {
occurrences = '+';
}

switch (formatSpec.primary) {
case formats.LETTERS:
matcher.regex = isUpper ? '[A-Z]+' : '[a-z]+';
@@ -1047,7 +1059,7 @@ const dateTime = (function () {
};
break;
case formats.DECIMAL:
matcher.regex = '[0-9]+';
matcher.regex = `[0-9]${occurrences}`;
if (formatSpec.ordinal) {
// ordinals
matcher.regex += '(?:th|st|nd|rd)';
2 changes: 1 addition & 1 deletion src/functions.js
Original file line number Diff line number Diff line change
@@ -581,7 +581,7 @@ const functions = (() => {
// Simply doing `new Buffer` at this point causes Browserify to pull
// in the entire Buffer browser library, which is large and unnecessary.
// Using `global.Buffer` defeats this.
return new global.Buffer(str, 'base64').toString('binary');
return new global.Buffer.from(str, 'base64').toString('binary'); // eslint-disable-line new-cap
};
return atob(str);
}
Loading