jsonata 2.2.2.1 → 2.3.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 52797dede85591f15e5e3ad10670d556d3b4683471c5b5e00f0ff0602e147694
4
- data.tar.gz: 0d235b9161ee1d2a45a1f492c813c5a2b04f438aa91af7707f9144c48e39724b
3
+ metadata.gz: bea690b7d2f45ff9b9fbac15bc42d733017c39b20c87d5a85a2399474568c7f1
4
+ data.tar.gz: 1f7e5c8f4cc77b0a505217c8e55db0a2545d9eb99794fcdfea5a6ed739caaaff
5
5
  SHA512:
6
- metadata.gz: 945f2e2fca929e067dd684ce171edc66f8d233047e3bea1b6e3b1513022e662a05342b1d393f585d43e2ed0892cb824a77896df04a19cb56922fe5fb6fc7216a
7
- data.tar.gz: 1d960e3b290979f87f8f71509fcd1bbbd76a95081a08a701df7a1d33c57270857fe4f3d908530796cdc56c747857b95b53d3d9b13616a739d343dabe942ffd80
6
+ metadata.gz: 191d1fe80ba7dfc7be95a6c45130fc58b42944361ded8927d31907cfe167c531bee390038d957e7e65d2e7f15a254a29399c67b221e3b34a525ace87d144c79e
7
+ data.tar.gz: b239073e99a95c19706550461cd45394a04e46e021d79a2021167680a1c2cbb3c154f35428683d88e94a3a2e8d53c3fded5f2d9c4a6ef399109b3349aa44b7a1
data/.rubocop_local.yml CHANGED
@@ -16,6 +16,9 @@ Naming/PredicateMethod:
16
16
  Enabled: false
17
17
  Style/CaseLikeIf:
18
18
  Enabled: false
19
+ # e.g. the transform checks every match before changing any of them, so the loops must stay separate.
20
+ Style/CombinableLoops:
21
+ Enabled: false
19
22
  Style/CommentAnnotation:
20
23
  Enabled: false
21
24
  Style/ConditionalAssignment:
@@ -36,6 +39,8 @@ Style/MultipleComparison:
36
39
  Enabled: false
37
40
  Style/NegatedIfElseCondition:
38
41
  Enabled: false
42
+ Style/Next:
43
+ Enabled: false
39
44
  Style/RedundantAssignment:
40
45
  Enabled: false
41
46
 
data/AGENTS.md CHANGED
@@ -10,6 +10,14 @@ the decisions behind the port and how JavaScript semantics are emulated in Ruby.
10
10
  - **Keep the structure diffable.** Ruby files mirror the JS files: same function order, same names (snake_case),
11
11
  same comments (including the JSDoc text and TODOs). Ruby-only code is marked with a comment such as
12
12
  `(Ruby specific)` or `(jsonata-js: <original construct>)`, so it is clear what is a deviation.
13
+ - **Doc comments are YARD.** Port JSDoc blocks to YARD tags, keeping the description text as-is:
14
+ `@param {Type} name - desc` becomes `@param name [Type] desc`, `@returns {Type} desc` becomes
15
+ `@return [Type] desc`, and `@throws desc` becomes `@raise [Jsonata::Error] desc`. Use the parameter name of
16
+ the Ruby method (snake_case). Translate the JS types to Ruby: `Object`/`object`/`*` -> `Object`,
17
+ `string` -> `String`, `number` -> `Numeric`, `Integer` -> `Integer`, `float` -> `Float`, `boolean` ->
18
+ `Boolean`, `Array`/`*[]` -> `Array`, `Function` -> `Lambda, NativeFunction, Proc`, `undefined` -> `nil`,
19
+ `A|B` -> `A, B`, and object literal types to the Ruby class representing them (e.g. `{{bind, lookup}}` ->
20
+ `Frame`, `{{lambda: ...}}` -> `Lambda`), or `Hash`. Ruby-only methods also use YARD tags.
13
21
  - **Keep the upstream copyright headers.** Each ported file starts with the IBM copyright header of the JS file it
14
22
  ports (in ASCII, `(c)` for the copyright sign), as required by the MIT license. Copy the header when porting a
15
23
  new file, and update the years if upstream changes them.
@@ -34,8 +42,11 @@ the decisions behind the port and how JavaScript semantics are emulated in Ruby.
34
42
 
35
43
  ## Porting workflow for jsonata-js changes
36
44
 
37
- The `jsonata-js sync` workflow (`.github/workflows/jsonata-js-sync.yaml`) runs these steps daily with Claude and
38
- opens a PR from the `jsonata-js-sync` branch; they also apply when porting by hand.
45
+ The `jsonata-js sync` workflow (`.github/workflows/jsonata-js-sync.yaml`) runs these steps daily with Claude, once
46
+ per jsonata-js commit (with the submodule already checked out at that commit, so step 1 is skipped), and commits
47
+ each port separately on the `jsonata-js-sync` branch; they also apply when porting by hand. Merge the sync PR with
48
+ "Rebase and merge", so that each jsonata-js commit keeps a matching commit on master: the `jsonata-js tags` workflow
49
+ (`.github/workflows/jsonata-js-tags.yaml`) gives the commit syncing a jsonata-js release tag the same tag.
39
50
 
40
51
  1. `bundle exec rake jsonata_js:update` - moves the submodule to jsonata-js master and lists new commits.
41
52
  2. `bundle exec rake jsonata_js:diff` - shows the `src/` and `test/` changes since the commit recorded in this repo.
@@ -109,7 +120,7 @@ opens a PR from the `jsonata-js-sync` branch; they also apply when porting by ha
109
120
  - Regex literals are parsed into `Parser::RegexLiteral` (source + flags) and translated by `Utils.js_regexp`:
110
121
  `^`/`$` become `\A`/`\z` unless the `m` flag is set, `[]` and `[^]` are rewritten, and `(?a)` is prepended so
111
122
  `\w`, `\d`, `\b` are ASCII-only as in JS.
112
- - `RegExp.lastIndex` is emulated with a `last_index` variable captured by the matcher closure in
123
+ - `RegExp.lastIndex` is emulated with a `re_last_index` variable captured by the matcher closure in
113
124
  `evaluate_regex`.
114
125
  - The jsonata-js `RegexEngine` option is the `:regex_engine` option: a callable `(source, flags)` returning an
115
126
  object that responds to `match(str, pos)`.
data/README.md CHANGED
@@ -98,6 +98,7 @@ end
98
98
  | `:timeout` | Evaluation timeout in milliseconds (error `D1012`) |
99
99
  | `:stack` | Maximum evaluation depth (error `D1011`) |
100
100
  | `:sequence` | Maximum sequence length (error `D2015`) |
101
+ | `:inherited` | Allow looking up inherited properties (no effect: Ruby Hashes have no prototype) |
101
102
  | `:regex_engine` | A callable `(source, flags)` returning an object that responds to `match(str, pos)` |
102
103
 
103
104
  ### Mapping between JSON and Ruby values
@@ -167,11 +168,20 @@ bundle exec rspec # port the src/ changes until the tests pass
167
168
  git add vendor/jsonata-js lib # commit the submodule bump together with the ported changes
168
169
  ```
169
170
 
170
- The `jsonata-js sync` workflow (`.github/workflows/jsonata-js-sync.yaml`) does this daily: when jsonata-js
171
- master moves, it bumps the submodule, has Claude port any `src/` and `test/` changes, and opens (or updates) a
172
- pull request from the `jsonata-js-sync` branch. The PR is a draft if the tests or rubocop fail. The steps are in
173
- `bin/jsonata-js-sync`; `DRY_RUN=1 bin/jsonata-js-sync publish` shows the commit message and PR description
174
- for the current submodule checkout without pushing.
171
+ The `jsonata-js sync` workflow (`.github/workflows/jsonata-js-sync.yaml`) does this daily, one jsonata-js commit at
172
+ a time: for each new jsonata-js master commit, it bumps the submodule to it, follows a version change in
173
+ `package.json`, has Claude port any `src/` and `test/` changes, and commits. It opens (or updates) a pull request
174
+ from the `jsonata-js-sync` branch, which it rebases onto master on every run, so fixes pushed to the branch are
175
+ kept. If a commit cannot be ported cleanly, it stops there and makes the PR a draft; nothing more is synced until
176
+ the PR is fixed and marked ready for review. Merge the PR with "Rebase and merge" (not squash).
177
+
178
+ The `jsonata-js tags` workflow (`.github/workflows/jsonata-js-tags.yaml`) then gives the commit that syncs a
179
+ jsonata-js release tag the same tag (if its version matches), including tags that jsonata-js adds to older
180
+ commits later. It does not release the gem.
181
+
182
+ The steps of both are in `bin/jsonata-js-sync`. With `DRY_RUN=1`, `bin/jsonata-js-sync sync` commits to a local
183
+ `jsonata-js-sync` branch and prints the PR description, and `bin/jsonata-js-sync tag` tags locally, without
184
+ pushing.
175
185
 
176
186
  ## Versioning
177
187