Skip to content

Commit 36fde9a

Browse files
authored
Merge pull request #29 from jg-rp/update-typedoc
docs: update typedoc
2 parents 2a11ebc + 99c43ba commit 36fde9a

File tree

11 files changed

+360
-352
lines changed

11 files changed

+360
-352
lines changed

docs/docs/README_API.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ Welcome to the API documentation for JSON P3. Also see the [quick start guide](/
44

55
## API Quick Links
66

7-
- [JSONPathEnvironment](/api/classes/jsonpath.JSONPathEnvironment)
8-
- [JSONPathEnvironment Options](/api/namespaces/jsonpath#jsonpathenvironmentoptions)
9-
- [JSONPathNodeList](/api/classes/jsonpath.JSONPathNodeList)
10-
- [JSONPathNode](/api/classes/jsonpath.JSONPathNode)
7+
- [JSONPathEnvironment](/api/namespaces/jsonpath/classes/JSONPathEnvironment)
8+
- [JSONPathEnvironment Options](/api/namespaces/jsonpath/type-aliases/JSONPathEnvironmentOptions)
9+
- [JSONPathNodeList](/api/namespaces/jsonpath/classes/JSONPathNodeList)
10+
- [JSONPathNode](/api/namespaces/jsonpath/classes/JSONPathNode)

docs/docs/guides/json-patch.md

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
JSON Patch ([RFC 6902](https://datatracker.ietf.org/doc/html/rfc6902)) is a standard for describing update operations to perform on JSON-like data. Each operation includes, at least, an `op` string and a `path`, which is a [JSON Pointer](./json-pointer.md).
44

5-
Use [`jsonpatch.apply(ops, data)`](../api/namespaces/jsonpatch.md#apply) to apply _ops_ to _data_, where _ops_ should be an array of [`OpObject`s](../api/namespaces/jsonpatch.md#opobject), as per RFC 6902. Patch operation are applied sequentially and, unless the target JSON document's root value is replaced, **data is modified in place**.
5+
Use [`jsonpatch.apply(ops, data)`](../api/namespaces/jsonpatch/functions/apply.md) to apply _ops_ to _data_, where _ops_ should be an array of [`OpObject`s](../api/namespaces/jsonpatch/type-aliases/OpObject.md), as per RFC 6902. Patch operation are applied sequentially and, unless the target JSON document's root value is replaced, **data is modified in place**.
66

77
```javascript
88
import { jsonpatch } from "json-p3";
@@ -20,7 +20,7 @@ console.log(data);
2020
// { some: { other: 'thing', foo: { bar: [Array], else: 'thing' } } }
2121
```
2222

23-
Use the [`JSONPatch`](../api/classes/jsonpatch.JSONPatch.md) constructor to create a patch for repeated application.
23+
Use the [`JSONPatch`](../api/namespaces/jsonpatch/classes/JSONPatch.md) constructor to create a patch for repeated application.
2424

2525
```javascript
2626
import { JSONPatch } from "json-p3";
@@ -40,11 +40,11 @@ console.log(data);
4040

4141
## Builder API
4242

43-
[`JSONPatch`](../api/classes/jsonpatch.JSONPatch.md) implements a builder interface for constructing JSON Patch documents. Each of the following methods appends an operation to the patch and returns the patch instance, so method calls can be chained.
43+
[`JSONPatch`](../api/namespaces/jsonpatch/classes/JSONPatch.md) implements a builder interface for constructing JSON Patch documents. Each of the following methods appends an operation to the patch and returns the patch instance, so method calls can be chained.
4444

4545
### `add()`
4646

47-
[`JSONPatch.add(pointer, value)`](../api/classes/jsonpatch.JSONPatch.md#add) appends an [_add_](https://datatracker.ietf.org/doc/html/rfc6902#section-4.1) operation to the patch. _pointer_ can be a string following RFC 6901 or an instance of [`JSONPointer`](../api/classes/jsonpointer.JSONPointer.md).
47+
[`JSONPatch.add(pointer, value)`](../api/namespaces/jsonpatch/classes/JSONPatch.md#add) appends an [_add_](https://datatracker.ietf.org/doc/html/rfc6902#section-4.1) operation to the patch. _pointer_ can be a string following RFC 6901 or an instance of [`JSONPointer`](../api/namespaces/jsonpointer/classes/JSONPointer.md).
4848

4949
```javascript
5050
import { JSONPatch } from "json-p3";
@@ -67,7 +67,7 @@ console.log(JSON.stringify(patch.toArray(), undefined, " "));
6767

6868
### `remove()`
6969

70-
[`JSONPatch.remove(pointer)`](../api/classes/jsonpatch.JSONPatch.md#add) appends an [_remove_](https://datatracker.ietf.org/doc/html/rfc6902#section-4.2) operation to the patch. _pointer_ can be a string following RFC 6901 or an instance of [`JSONPointer`](../api/classes/jsonpointer.JSONPointer.md).
70+
[`JSONPatch.remove(pointer)`](../api/namespaces/jsonpatch/classes/JSONPatch.md#remove) appends a [_remove_](https://datatracker.ietf.org/doc/html/rfc6902#section-4.2) operation to the patch. _pointer_ can be a string following RFC 6901 or an instance of [`JSONPointer`](../api/namespaces/jsonpointer/classes/JSONPointer.md).
7171

7272
```javascript
7373
import { JSONPatch } from "json-p3";
@@ -87,7 +87,7 @@ console.log(JSON.stringify(patch.toArray(), undefined, " "));
8787

8888
### `replace()`
8989

90-
[`JSONPatch.replace(pointer, value)`](../api/classes/jsonpatch.JSONPatch.md#add) appends an [_replace_](https://datatracker.ietf.org/doc/html/rfc6902#section-4.3) operation to the patch. _pointer_ can be a string following RFC 6901 or an instance of [`JSONPointer`](../api/classes/jsonpointer.JSONPointer.md).
90+
[`JSONPatch.replace(pointer, value)`](../api/namespaces/jsonpatch/classes/JSONPatch.md#replace) appends a [_replace_](https://datatracker.ietf.org/doc/html/rfc6902#section-4.3) operation to the patch. _pointer_ can be a string following RFC 6901 or an instance of [`JSONPointer`](../api/namespaces/jsonpointer/classes/JSONPointer.md).
9191

9292
```javascript
9393
import { JSONPatch } from "json-p3";
@@ -108,7 +108,7 @@ console.log(JSON.stringify(patch.toArray(), undefined, " "));
108108

109109
### `move()`
110110

111-
[`JSONPatch.move(fromPointer, toPointer)`](../api/classes/jsonpatch.JSONPatch.md#add) appends an [_move_](https://datatracker.ietf.org/doc/html/rfc6902#section-4.4) operation to the patch. _fromPointer_ and _toPointer_ can be a string following RFC 6901 or an instance of [`JSONPointer`](../api/classes/jsonpointer.JSONPointer.md).
111+
[`JSONPatch.move(fromPointer, toPointer)`](../api/namespaces/jsonpatch/classes/JSONPatch.md#move) appends a [_move_](https://datatracker.ietf.org/doc/html/rfc6902#section-4.4) operation to the patch. _fromPointer_ and _toPointer_ can be a string following RFC 6901 or an instance of [`JSONPointer`](../api/namespaces/jsonpointer/classes/JSONPointer.md).
112112

113113
```javascript
114114
import { JSONPatch } from "json-p3";
@@ -129,7 +129,7 @@ console.log(JSON.stringify(patch.toArray(), undefined, " "));
129129

130130
### `copy()`
131131

132-
[`JSONPatch.copy(fromPointer, toPointer)`](../api/classes/jsonpatch.JSONPatch.md#add) appends an [_copy_](https://datatracker.ietf.org/doc/html/rfc6902#section-4.5) operation to the patch. _fromPointer_ and _toPointer_ can be a string following RFC 6901 or an instance of [`JSONPointer`](../api/classes/jsonpointer.JSONPointer.md).
132+
[`JSONPatch.copy(fromPointer, toPointer)`](../api/namespaces/jsonpatch/classes/JSONPatch.md#copy) appends a [_copy_](https://datatracker.ietf.org/doc/html/rfc6902#section-4.5) operation to the patch. _fromPointer_ and _toPointer_ can be a string following RFC 6901 or an instance of [`JSONPointer`](../api/namespaces/jsonpointer/classes/JSONPointer.md).
133133

134134
```javascript
135135
import { JSONPatch } from "json-p3";
@@ -150,7 +150,7 @@ console.log(JSON.stringify(patch.toArray(), undefined, " "));
150150

151151
### `test()`
152152

153-
[`JSONPatch.copy(pointer, value)`](../api/classes/jsonpatch.JSONPatch.md#add) appends an [_test_](https://datatracker.ietf.org/doc/html/rfc6902#section-4.6) operation to the patch. _pointer_ can be a string following RFC 6901 or an instance of [`JSONPointer`](../api/classes/jsonpointer.JSONPointer.md).
153+
[`JSONPatch.copy(pointer, value)`](../api/namespaces/jsonpatch/classes/JSONPatch.md#test) appends a [_test_](https://datatracker.ietf.org/doc/html/rfc6902#section-4.6) operation to the patch. _pointer_ can be a string following RFC 6901 or an instance of [`JSONPointer`](../api/namespaces/jsonpointer/classes/JSONPointer.md).
154154

155155
```javascript
156156
import { JSONPatch } from "json-p3";

docs/docs/guides/json-pointer.md

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ We have extended RFC 6901 to handle index/property pointers from [Relative JSON
1010

1111
## Pointer resolution
1212

13-
Resolve a JSON Pointer against some data using [`jsonpointer.resolve(pointer, data)`](../api/namespaces/jsonpointer.md#resolve).
13+
Resolve a JSON Pointer against some data using [`jsonpointer.resolve(pointer, data)`](../api/namespaces/jsonpointer/classes/JSONPointer#resolve).
1414

1515
```javascript
1616
import { jsonpointer } from "json-p3";
@@ -28,7 +28,7 @@ const rv = jsonpointer.resolve("/users/1", data);
2828
console.log(rv); // { name: 'John', score: 86 }
2929
```
3030

31-
`resolve()` is a convenience function equivalent to `new JSONPointer(pointer).resolve(data)`. Use the [`JSONPointer`](../api/classes/jsonpointer.JSONPointer.md) constructor when you need to resolve the same pointer repeatedly against different data.
31+
`resolve()` is a convenience function equivalent to `new JSONPointer(pointer).resolve(data)`. Use the [`JSONPointer`](../api/namespaces/jsonpointer/classes/JSONPointer.md) constructor when you need to resolve the same pointer repeatedly against different data.
3232

3333
```javascript
3434
import { JSONPointer } from "json-p3";
@@ -52,7 +52,7 @@ console.log(pointer.resolve(otherData)); // { name: 'Roy' }
5252

5353
### Errors and fallbacks
5454

55-
If the pointer can't be resolved against the argument JSON value, one of [`JSONPointerIndexError`](../api/classes/jsonpointer.JSONPointerIndexError.md), [`JSONPointerKeyError`](../api/classes/jsonpointer.JSONPointerKeyError.md) or [`JSONPointerTypeError`](../api/classes/jsonpointer.JSONPointerTypeError.md) is thrown. All three exceptions inherit from [`JSONPointerResolutionError`](../api/classes/jsonpointer.JSONPointerResolutionError.md).
55+
If the pointer can't be resolved against the argument JSON value, one of [`JSONPointerIndexError`](../api/namespaces/jsonpointer/classes/JSONPointerIndexError.md), [`JSONPointerKeyError`](../api/namespaces/jsonpointer/classes/JSONPointerKeyError.md) or [`JSONPointerTypeError`](../api/namespaces/jsonpointer/classes/JSONPointerTypeError.md) is thrown. All three exceptions inherit from [`JSONPointerResolutionError`](../api/namespaces/jsonpointer/classes/JSONPointerResolutionError.md).
5656

5757
```javascript
5858
// .. continued from above
@@ -70,7 +70,7 @@ console.log(rv); // -1
7070

7171
### With parent
7272

73-
[`resolveWithParent()`](../api/classes/jsonpointer.JSONPointer.md#resolvewithparent) is similar to `resolve()`, but returns the target's parent value and the target value as a two-element array.
73+
[`resolveWithParent()`](../api/namespaces/jsonpointer/classes/JSONPointer.md#resolvewithparent) is similar to `resolve()`, but returns the target's parent value and the target value as a two-element array.
7474

7575
```javascript
7676
import { JSONPointer } from "json-p3";
@@ -87,15 +87,15 @@ const pointer = new JSONPointer("/users/1");
8787
const [parent, target] = pointer.resolveWithParent(data);
8888
```
8989

90-
If the target value does not exist but the parent does, you'll get the parent object and the special [`UNDEFINED`](../api/namespaces/jsonpointer.md#undefined) symbol. Similarly, if the pointer is pointing to the JSON document root, you'll get `UNDEFINED` and the target document in its entirety.
90+
If the target value does not exist but the parent does, you'll get the parent object and the special [`UNDEFINED`](../api/namespaces/jsonpointer/variables/UNDEFINED.md) symbol. Similarly, if the pointer is pointing to the JSON document root, you'll get `UNDEFINED` and the target document in its entirety.
9191

92-
Otherwise, if the pointer's parent does not exist, a [`JSONPointerResolutionError`](../api/classes/jsonpointer.JSONPointerResolutionError.md) is thrown.
92+
Otherwise, if the pointer's parent does not exist, a [`JSONPointerResolutionError`](../api/namespaces/jsonpointer/classes/JSONPointerResolutionError.md) is thrown.
9393

9494
## Utility methods
9595

9696
### `exists()`
9797

98-
Test for existence with [`JSONPointer.exists(data)`](../api/classes/jsonpointer.JSONPointer.md#exists). It returns `true` if the target exists in _data_, even if the target is falsy, and `false` otherwise.
98+
Test for existence with [`JSONPointer.exists(data)`](../api/namespaces/jsonpointer/classes/JSONPointer.md#exists). It returns `true` if the target exists in _data_, even if the target is falsy, and `false` otherwise.
9999

100100
```javascript
101101
import { JSONPointer } from "json-p3";
@@ -114,7 +114,7 @@ console.log(pointer.exists(data)); // true
114114

115115
### `join()`
116116

117-
Build child pointers using [`JSONPointer.join(...tokens)`](../api/classes/jsonpointer.JSONPointer.md#join). It takes any number of JSON Pointer tokens and returns a new `JSONPointer`. Similar to joining a file system path, if a token has a leading slash, the previous pointer is ignored and a new `JSONPointer` is created, before processing of remaining tokens continues.
117+
Build child pointers using [`JSONPointer.join(...tokens)`](../api/namespaces/jsonpointer/classes/JSONPointer.md#join). It takes any number of JSON Pointer tokens and returns a new `JSONPointer`. Similar to joining a file system path, if a token has a leading slash, the previous pointer is ignored and a new `JSONPointer` is created, before processing of remaining tokens continues.
118118

119119
```javascript
120120
import { JSONPointer } from "json-p3";
@@ -129,7 +129,7 @@ console.log(pointer.join("baz/qux", "0").toString()); // /foo/bar/baz/qux/0
129129

130130
### `parent()`
131131

132-
Get a pointer to the parent of an existing JSON Pointer using [`JSONPointer.parent()`](../api/classes/jsonpointer.JSONPointer.md#parent). If the pointer is pointing to the document root, `this` is returned.
132+
Get a pointer to the parent of an existing JSON Pointer using [`JSONPointer.parent()`](../api/namespaces/jsonpointer/classes/JSONPointer.md#parent). If the pointer is pointing to the document root, `this` is returned.
133133

134134
```javascript
135135
import { JSONPointer } from "json-p3";
@@ -142,7 +142,7 @@ console.log(pointer.parent().toString()); // /foo
142142

143143
### `isRelativeTo()`
144144

145-
Test if a pointer is a child of another using [`JSONPointer.isRelativeTo()`](../api/classes/jsonpointer.JSONPointer.md#isrelativeto).
145+
Test if a pointer is a child of another using [`JSONPointer.isRelativeTo()`](../api/namespaces/jsonpointer/classes/JSONPointer.md#isrelativeto).
146146

147147
```javascript
148148
import { JSONPointer } from "json-p3";
@@ -158,7 +158,7 @@ console.log(anotherPointer.isRelativeTo(pointer)); // false
158158

159159
## Relative JSON Pointer
160160

161-
Use [Relative JSON Pointer](https://datatracker.ietf.org/doc/html/draft-hha-relative-json-pointer) syntax with [`JSONPointer.to(rel)`](../api/classes/jsonpointer.JSONPointer.md#to) to create a new pointer relative to an existing one.
161+
Use [Relative JSON Pointer](https://datatracker.ietf.org/doc/html/draft-hha-relative-json-pointer) syntax with [`JSONPointer.to(rel)`](../api/namespaces/jsonpointer/classes/JSONPointer.md#to) to create a new pointer relative to an existing one.
162162

163163
```javascript
164164
import { JSONPointer } from "json-p3";

docs/docs/guides/jsonpath-extra.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
**_New in version 1.3.0_**
44

5-
JSON P3 includes some extra, non-standard JSONPath syntax that is disabled by default. Setting the [`strict`](../api/namespaces/jsonpath.md#jsonpathenvironmentoptions) option to `false` when instantiating a [`JSONPathEnvironment`](../api/classes/jsonpath.JSONPathEnvironment.md) will enable all non-standard syntax.
5+
JSON P3 includes some extra, non-standard JSONPath syntax that is disabled by default. Setting the [`strict`](../api/namespaces/jsonpath/type-aliases/JSONPathEnvironmentOptions) option to `false` when instantiating a [`JSONPathEnvironment`](../api/namespaces/jsonpath/classes/JSONPathEnvironment.md) will enable all non-standard syntax.
66

77
```javascript
88
import { JSONPathEnvironment } from "json-p3";

docs/docs/guides/jsonpath-functions.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -58,27 +58,27 @@ $.users[?search(@.name, '[Aa]')]
5858
value(nodes: JSONPathNodeList): JSONValue | undefined
5959
```
6060

61-
Return the value associated with the first node in _nodes_, if _nodes_ has exactly one [`JSONPathNode`](../api/classes/jsonpath.JSONPathNode.md). Usually, `value()` will be called with a [filter query](./jsonpath-syntax.md#filter-queries) as its argument.
61+
Return the value associated with the first node in _nodes_, if _nodes_ has exactly one [`JSONPathNode`](../api/namespaces/jsonpath/classes/JSONPathNode.md). Usually, `value()` will be called with a [filter query](./jsonpath-syntax.md#filter-queries) as its argument.
6262

6363
:::info
6464
[Filter queries](./jsonpath-syntax.md#filter-queries) that can result in at most one node are known as "singular queries", and all singular queries will be implicitly replaced with their value as required, without the use of `value()`. `value()` is useful when you need the value from a query that can, theoretically, return multiple nodes.
6565
:::
6666

6767
## Well-typedness
6868

69-
The JSONPath specification defines a [type system for function expressions](https://datatracker.ietf.org/doc/html/rfc9535#name-type-system-for-function-ex), and rules for how those types can be used within an expression. JSON P3 will throw a [JSONPathTypeError](../api/classes/jsonpath.JSONPathTypeError.md) at query compile time if it contains expressions that are not deemed to be well-typed.
69+
The JSONPath specification defines a [type system for function expressions](https://datatracker.ietf.org/doc/html/rfc9535#name-type-system-for-function-ex), and rules for how those types can be used within an expression. JSON P3 will throw a [JSONPathTypeError](../api/namespaces/jsonpath/classes/JSONPathTypeError.md) at query compile time if it contains expressions that are not deemed to be well-typed.
7070

7171
Please see [Section 2.4.3](https://datatracker.ietf.org/doc/html/rfc9535#name-well-typedness-of-function-) _Well-Typedness of Function Expressions_.
7272

7373
## Function extensions
7474

75-
Add, remove or replace [filter functions](./jsonpath-syntax.md#filter-functions) by updating the [function register](../api/classes/jsonpath.JSONPathEnvironment.md#functionregister) on a [`JSONPathEnvironment`](../api/classes/jsonpath.JSONPathEnvironment.md). It is a regular [Map](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Map), mapping function names to objects implementing the [`FilterFunction`](../api/interfaces/jsonpath.functions.FilterFunction.md) interface.
75+
Add, remove or replace [filter functions](./jsonpath-syntax.md#filter-functions) by updating the [function register](../api/namespaces/jsonpath/classes/JSONPathEnvironment.md#functionregister) on a [`JSONPathEnvironment`](../api/namespaces/jsonpath/classes/JSONPathEnvironment.md). It is a regular [Map](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Map), mapping function names to objects implementing the [`FilterFunction`](../api/namespaces/jsonpath/namespaces/functions/interfaces/FilterFunction.md) interface.
7676

7777
:::info
7878
You can update the function register on the _default environment_ (`import { DEFAULT_ENVIRONMENT } from "json-p3"`), and use convenience functions like [`query()`](../quick-start.md#jsonpath) and [`compile()`](../quick-start.md#compilation). Here we'll create a new `JSONPathEnvironment`, then use its methods directly.
7979
:::
8080

81-
Every filter function must define the types of its parameters and the type of its return value, according to the JSONPath specification's [type system](https://datatracker.ietf.org/doc/html/rfc9535#name-type-system-for-function-ex). This example implements a `typeof()` function, which accepts a parameter of [`ValueType`](../api/enums/jsonpath.functions.FunctionExpressionType.md) and returns a `ValueType`.
81+
Every filter function must define the types of its parameters and the type of its return value, according to the JSONPath specification's [type system](https://datatracker.ietf.org/doc/html/rfc9535#name-type-system-for-function-ex). This example implements a `typeof()` function, which accepts a parameter of [`ValueType`](../api/namespaces/jsonpath/namespaces/functions/enumerations/FunctionExpressionType.md) and returns a `ValueType`.
8282

8383
```typescript
8484
import {

0 commit comments

Comments
 (0)