Skip to content

Commit 0428342

Browse files
andrew-colemanmattbaileyuk
authored andcommitted
Add versioning to the documentation
Signed-off-by: andrew-coleman <[email protected]>
1 parent 6198e10 commit 0428342

33 files changed

+3144
-1
lines changed

website/i18n/en.json

Lines changed: 111 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -115,6 +115,117 @@
115115
"using-nodejs": {
116116
"title": "Using JSONata in a Node application",
117117
"sidebar_label": "In NodeJS"
118+
},
119+
"version-1.7.0/version-1.7.0-aggregation-functions": {
120+
"title": "Numeric aggregation functions",
121+
"sidebar_label": "Aggregation Functions"
122+
},
123+
"version-1.7.0/version-1.7.0-array-functions": {
124+
"title": "Array Functions"
125+
},
126+
"version-1.7.0/version-1.7.0-boolean-functions": {
127+
"title": "Boolean functions",
128+
"sidebar_label": "Boolean Functions"
129+
},
130+
"version-1.7.0/version-1.7.0-boolean-operators": {
131+
"title": "Boolean Operators",
132+
"sidebar_label": "Boolean Operators"
133+
},
134+
"version-1.7.0/version-1.7.0-comparison-operators": {
135+
"title": "Comparison Operators",
136+
"sidebar_label": "Comparison Operators"
137+
},
138+
"version-1.7.0/version-1.7.0-composition": {
139+
"title": "Query composition",
140+
"sidebar_label": "Query Composition"
141+
},
142+
"version-1.7.0/version-1.7.0-construction": {
143+
"title": "Building result structures",
144+
"sidebar_label": "Result Structures"
145+
},
146+
"version-1.7.0/version-1.7.0-contributing": {
147+
"title": "Contributing to JSONata",
148+
"sidebar_label": "Community and Contributing"
149+
},
150+
"version-1.7.0/version-1.7.0-date-time-functions": {
151+
"title": "Date/Time functions",
152+
"sidebar_label": "Date/Time Functions"
153+
},
154+
"version-1.7.0/version-1.7.0-date-time": {
155+
"title": "Date/Time processing",
156+
"sidebar_label": "Date/Time Processing"
157+
},
158+
"version-1.7.0/version-1.7.0-embedding-extending": {
159+
"title": "Embedding and Extending JSONata",
160+
"sidebar_label": "Embedding and Extending JSONata"
161+
},
162+
"version-1.7.0/version-1.7.0-expressions": {
163+
"title": "Manipulating data with functions and expressions",
164+
"sidebar_label": "Functions and Expressions"
165+
},
166+
"version-1.7.0/version-1.7.0-higher-order-functions": {
167+
"title": "Higher order functions",
168+
"sidebar_label": "Higher Order Functions"
169+
},
170+
"version-1.7.0/version-1.7.0-numeric-functions": {
171+
"title": "Numeric functions",
172+
"sidebar_label": "Numeric Functions"
173+
},
174+
"version-1.7.0/version-1.7.0-numeric-operators": {
175+
"title": "Numeric Operators",
176+
"sidebar_label": "Numeric Operators"
177+
},
178+
"version-1.7.0/version-1.7.0-object-functions": {
179+
"title": "Object functions",
180+
"sidebar_label": "Object Functions"
181+
},
182+
"version-1.7.0/version-1.7.0-other-operators": {
183+
"title": "Other Operators",
184+
"sidebar_label": "Other Operators"
185+
},
186+
"version-1.7.0/version-1.7.0-overview": {
187+
"title": "JSONata Documentation",
188+
"sidebar_label": "Overview"
189+
},
190+
"version-1.7.0/version-1.7.0-path-operators": {
191+
"title": "Path Operators",
192+
"sidebar_label": "Path Operators"
193+
},
194+
"version-1.7.0/version-1.7.0-predicate": {
195+
"title": "Query refinement using predicate expressions",
196+
"sidebar_label": "Predicate Queries"
197+
},
198+
"version-1.7.0/version-1.7.0-processing": {
199+
"title": "The JSONata processing model",
200+
"sidebar_label": "Processing Model"
201+
},
202+
"version-1.7.0/version-1.7.0-programming": {
203+
"title": "Programming constructs",
204+
"sidebar_label": "Functional Programming"
205+
},
206+
"version-1.7.0/version-1.7.0-regex": {
207+
"title": "Using Regular Expressions",
208+
"sidebar_label": "Regular Expressions"
209+
},
210+
"version-1.7.0/version-1.7.0-simple": {
211+
"title": "Simple Queries",
212+
"sidebar_label": "Simple Queries"
213+
},
214+
"version-1.7.0/version-1.7.0-sorting-grouping": {
215+
"title": "Sorting, Grouping and Aggregation",
216+
"sidebar_label": "Sorting, Grouping and Aggregation"
217+
},
218+
"version-1.7.0/version-1.7.0-string-functions": {
219+
"title": "String functions",
220+
"sidebar_label": "String Functions"
221+
},
222+
"version-1.7.0/version-1.7.0-using-browser": {
223+
"title": "Using JSONata in a Web page",
224+
"sidebar_label": "In a Web Page"
225+
},
226+
"version-1.7.0/version-1.7.0-using-nodejs": {
227+
"title": "Using JSONata in a Node application",
228+
"sidebar_label": "In NodeJS"
118229
}
119230
},
120231
"links": {

website/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,6 @@
99
"rename-version": "docusaurus-rename-version"
1010
},
1111
"devDependencies": {
12-
"docusaurus": "^1.6.2"
12+
"docusaurus": "^1.14.0"
1313
}
1414
}

website/pages/en/versions.js

Lines changed: 85 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,85 @@
1+
/**
2+
* Copyright (c) 2017-present, Facebook, Inc.
3+
*
4+
* This source code is licensed under the MIT license found in the
5+
* LICENSE file in the root directory of this source tree.
6+
*/
7+
8+
const React = require('react');
9+
10+
const CompLibrary = require('../../core/CompLibrary');
11+
12+
const Container = CompLibrary.Container;
13+
14+
const CWD = process.cwd();
15+
16+
const versions = require(`${CWD}/versions.json`);
17+
18+
function Versions(props) {
19+
const {config: siteConfig} = props;
20+
const latestVersion = versions[0];
21+
const releases = 'https://github.com/jsonata-js/jsonata/releases';
22+
return (
23+
<div className="docMainWrapper wrapper">
24+
<Container className="mainContainer versionsContainer">
25+
<div className="post">
26+
<header className="postHeader">
27+
<h1>{siteConfig.title} Versions</h1>
28+
</header>
29+
<p>New versions of this project are released every so often.</p>
30+
<h3 id="latest">Current version (Stable)</h3>
31+
<table className="versions">
32+
<tbody>
33+
<tr>
34+
<th>{latestVersion}</th>
35+
<td>
36+
<a href="overview">Documentation</a>
37+
</td>
38+
<td>
39+
<a href={releases + '/latest'}>Release Notes</a>
40+
</td>
41+
</tr>
42+
</tbody>
43+
</table>
44+
<p>
45+
This is the current version of JSONata when installed from NPM
46+
</p>
47+
<h3 id="rc">Pre-release versions</h3>
48+
<table className="versions">
49+
<tbody>
50+
<tr>
51+
<th>master</th>
52+
<td>
53+
<a href="next/overview">Documentation</a>
54+
</td>
55+
</tr>
56+
</tbody>
57+
</table>
58+
<p>This is the latest development version of JSONata as committed to 'master' branch. This version may be unstable.</p>
59+
<h3 id="archive">Past Versions</h3>
60+
<table className="versions">
61+
<tbody>
62+
{versions.map(
63+
version =>
64+
version !== latestVersion && (
65+
<tr>
66+
<th>{version}</th>
67+
<td>
68+
<a href={version + '/overview'}>Documentation</a>
69+
</td>
70+
<td>
71+
<a href={releases + '/tag/v' + version}>Release Notes</a>
72+
</td>
73+
</tr>
74+
),
75+
)}
76+
</tbody>
77+
</table>
78+
</div>
79+
</Container>
80+
</div>
81+
);
82+
}
83+
84+
module.exports = Versions;
85+
Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
---
2+
id: version-1.7.0-aggregation-functions
3+
title: Numeric aggregation functions
4+
sidebar_label: Aggregation Functions
5+
original_id: aggregation-functions
6+
---
7+
8+
## `$sum()`
9+
__Signature:__ `$sum(array)`
10+
11+
Returns the arithmetic sum of an array of numbers. It is an error if the input array contains an item which isn't a number.
12+
13+
__Example__
14+
15+
- `$sum([5,1,3,7,4])` => `20`
16+
17+
## `$max()`
18+
__Signature:__ `$max(array)`
19+
20+
Returns the maximum number in an array of numbers. It is an error if the input array contains an item which isn't a number.
21+
22+
__Example__
23+
24+
- `$max([5,1,3,7,4])` => `7`
25+
26+
## `$min()`
27+
__Signature:__ `$min(array)`
28+
29+
Returns the minimum number in an array of numbers. It is an error if the input array contains an item which isn't a number.
30+
31+
__Example__
32+
33+
- `$min([5,1,3,7,4])` => `1`
34+
35+
## `$average()`
36+
__Signature:__ `$average(array)`
37+
38+
Returns the mean value of an array of numbers. It is an error if the input array contains an item which isn't a number.
39+
40+
__Example__
41+
42+
- `$average([5,1,3,7,4])` => `4`
43+
44+
Lines changed: 86 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,86 @@
1+
---
2+
id: version-1.7.0-array-functions
3+
title: Array Functions
4+
original_id: array-functions
5+
---
6+
7+
## `$count()`
8+
__Signature:__ `$count(array)`
9+
10+
Returns the number of items in the `array` parameter. If the `array` parameter is not an array, but rather a value of another JSON type, then the parameter is treated as a singleton array containing that value, and this function returns `1`.
11+
12+
If `array` is not specified, then the context value is used as the value of `array`.
13+
14+
__Examples__
15+
- `$count([1,2,3,1])` => `4`
16+
- `$count("hello")` => 1
17+
18+
## `$append()`
19+
__Signature:__ `$append(array1, array2)`
20+
21+
Returns and array containing the values in `array1` followed by the values in `array2`. If either parameter is not an array, then it is treated as a singleton array containing that value.
22+
23+
__Examples__
24+
- `$append([1,2,3], [4,5,6])` => `[1,2,3,4,5,6]`
25+
- `$append([1,2,3], 4)` => `[1,2,3,4]`
26+
- `$append("Hello", "World")` => `["Hello", "World"]`
27+
28+
29+
## `$sort()`
30+
__Signature:__ `$sort(array [, function])`
31+
32+
Returns an array containing all the values in the `array` parameter, but sorted into order. If no `function` parameter is supplied, then the `array` parameter must contain only numbers or only strings, and they will be sorted in order of increasing number, or increasing unicode codepoint respectively.
33+
34+
If a comparator `function` is supplied, then is must be a function that takes two parameters:
35+
36+
`function(left, right)`
37+
38+
This function gets invoked by the sorting algorithm to compare two values `left` and `right`. If the value of `left` should be placed after the value of `right` in the desired sort order, then the function must return Boolean `true` to indicate a swap. Otherwise it must return `false`.
39+
40+
__Example__
41+
```
42+
$sort(Account.Order.Product, function($l, $r) {
43+
$l.Description.Weight > $r.Description.Weight
44+
})
45+
```
46+
47+
This sorts the products in order of increasing weight.
48+
49+
The sorting algorithm is *stable* which means that values within the original array which are the same according to the comparator function will remain in the original order in the sorted array.
50+
51+
## `$reverse()`
52+
__Signature:__ `$reverse(array)`
53+
54+
Returns an array containing all the values from the `array` parameter, but in reverse order.
55+
56+
__Examples__
57+
- `$reverse(["Hello", "World"])` => `["World", "Hello"]`
58+
- `[1..5] ~> $reverse()` => `[5, 4, 3, 2, 1]`
59+
60+
## `$shuffle()`
61+
__Signature:__ `$shuffle(array)`
62+
63+
Returns an array containing all the values from the `array` parameter, but shuffled into random order.
64+
65+
__Examples__
66+
- `$shuffle([1..9])` => `[6, 8, 2, 3, 9, 5, 1, 4, 7]`
67+
68+
## `$distinct()`
69+
__Signature__ `$distinct(array)`
70+
71+
Returns an array containing all the values from the `array` parameter, but with any duplicates removed. Values are tested for deep equality as if by using the [equality operator](comparison-operators#equals).
72+
73+
__Examples__
74+
- `$distinct([1,2,3,3,4,3,5])` => `[1, 2, 3, 4, 5]`
75+
- `$distinct(Account.Order.Product.Description.Colour)` => `[ "Purple", "Orange", "Black" ]`
76+
77+
## `$zip()`
78+
__Signature:__ `$zip(array1, ...)`
79+
80+
Returns a convolved (zipped) array containing grouped arrays of values from the `array1` ... `arrayN` arguments from index 0, 1, 2, etc.
81+
82+
This function accepts a variable number of arguments. The length of the returned array is equal to the length of the shortest array in the arguments.
83+
84+
__Examples__
85+
- `$zip([1,2,3], [4,5,6])` => `[[1,4] ,[2,5], [3,6]]`
86+
- `$zip([1,2,3],[4,5],[7,8,9])` => `[[1,4,7], [2,5,8]]`
Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
---
2+
id: version-1.7.0-boolean-functions
3+
title: Boolean functions
4+
sidebar_label: Boolean Functions
5+
original_id: boolean-functions
6+
---
7+
8+
## `$boolean()`
9+
__Signature:__ `$boolean(arg)`
10+
11+
Casts the argument to a Boolean using the following rules:
12+
13+
| Argument type | Result |
14+
| ------------- | ------ |
15+
| Boolean | unchanged |
16+
| string: empty | `false`|
17+
| string: non-empty | `true` |
18+
| number: 0 | `false`|
19+
| number: non-zero | `true` |
20+
| null | `false`|
21+
| array: empty | `false` |
22+
| array: contains a member that casts to `true` | `true` |
23+
| array: all members cast to `false` | `false` |
24+
| object: empty | `false` |
25+
| object: non-empty | `true` |
26+
| function | `false` |
27+
28+
29+
## `$not()`
30+
__Signature:__ `$not(arg)`
31+
32+
Returns Boolean NOT on the argument. `arg` is first cast to a boolean
33+
34+
## `$exists()`
35+
__Signature:__ `$exists(arg)`
36+
37+
Returns Boolean `true` if the arg expression evaluates to a value, or `false` if the expression does not match anything (e.g. a path to a non-existent field reference).

0 commit comments

Comments
 (0)