Commit Graph

432 Commits

Author SHA1 Message Date
Ben Kalman
0d6bd01810 Port PathSpec implementation to JS (#2335)
This is a breaking change to the JS API. HashSpec and parseObjectSpec
have been removed in favour of PathSpec, and parse errors now throw
SyntaxError instead of silently failing (this matches JSON.parse).
2016-08-11 15:29:27 -07:00
Erik Arvidsson
226a0471f3 JS: Fix browser version of encodeUtf8 (#2339)
When we switched to big endian we forgot to update this.

Fixes #2338
2016-08-11 12:01:01 -07:00
Erik Arvidsson
6178251012 Update to Flow 0.30.0 (#2337)
This requires all parameterized types to have type params. Fortunately
one can use `T<any>` which has the same behavior as the old `T` syntax.

We should tighten the types further after this but this unblocks us.

Fixes #2301
2016-08-11 11:27:41 -07:00
Ben Kalman
630d3a29cc Port AbsolutePath implementation to JS (#2325) 2016-08-10 13:44:08 -07:00
Ben Kalman
f7bf38bbd1 Port path implementation to JS (#2317)
JS had an incomplete implementation, most notably missing: string
parsing, hash # syntax, and support for hash indices.
2016-08-09 17:12:08 -07:00
Erik Arvidsson
da1c278264 JS: Safari 9 support (#2295)
- Lower case header names in fetch function
- fetchUint8Array should return an Uint8Array and not an ArrayBuffer
- Safari does not have slice on typed arrays

Fixes #2265
2016-08-09 13:36:19 -07:00
Ben Kalman
e50f773ec6 Use a non-nil ValueReader in sequenceChunker.Done (#2273)
Fixes https://github.com/attic-labs/noms/issues/2220.
2016-08-05 14:22:39 -07:00
Erik Arvidsson
27c687adf3 JS: Partial fix for Safari (#2288)
getAllResponseHeaders may contain empty rows
2016-08-05 14:15:37 -07:00
Erik Arvidsson
35955c06d9 JS: Fix encoding bugs related to signed varints (#2267)
The library that we were using multiplied (and divided) by 2 to
do the zigzag encoding. However, if we are already close to the
precision limit then we lose precision and the encoding/decoding
does not round trip.

Instead, we split the float64 into two Uint32 numbers and do the
operations on those.

Also, the code that split a float64 into base and exp was not shifting
enough, it was shifting until float64(maxInt64) when we need to shift
until less than max safe int (according to float64)

Fixes #2104
Fixes #2234
2016-08-05 11:45:29 -07:00
Benjamin Kalman
31790e8f37 Bump JS to v56.2.0 to pick up img change 2016-08-04 14:47:39 -07:00
Ben Kalman
0ed95244a5 Fix image in JS (#2277) 2016-08-04 14:45:46 -07:00
Adam Leventhal
117eafebbc add Blob.Splice() (#2242) 2016-08-02 16:58:41 -07:00
Erik Arvidsson
7c068f311a Update README.md (#2248) 2016-08-02 14:02:30 -07:00
Erik Arvidsson
0d402acc9b Add README.md to js/ (#2211)
This is what gets shown on npmjs.org and other tools indexing npm
modules.
2016-07-30 13:11:42 -07:00
Adam Leventhal
e920c12c1c Fix cyclic type nondeterminism (#2147) (#2148) 2016-07-29 21:35:17 -07:00
Rafael Weinstein
3d86ddb33a Fix IndexedSequenceDiff bug when entire subtree is added / removed (#2197)
IndexedSequenceDiff special cases the situation when an entire subtree was added or removed, but got its math wrong.
2016-07-29 13:22:39 -07:00
Erik Arvidsson
ff88ff2a65 Commit type: Compute the type for meta too (#2185)
This changes to compute the type for the meta field in a similar
way to how we compute the type for the value field.

Fixes #2179
2016-07-28 17:14:35 -07:00
Rafael Weinstein
74ba1012c2 sequence.getOffset => sequence.cumulativeNumLeaves (#2193)
sequence.getOffset was problematic and didn't have a clear meaning. In addition it was causing a bunch of +1 code at call sites. This patch replaces it with cumulativeNumLeaves which has a clearer meaning.
2016-07-28 16:55:41 -07:00
Rafael Weinstein
1dc71c7f27 Align JS & Go impl of binary search (#2192) 2016-07-28 16:44:49 -07:00
Ben Kalman
deab7606b2 Fix empty sequence in getCompositeChildSequence (#2167)
Based on a patch by mike@mikegray.org
2016-07-27 17:12:35 -07:00
Erik Arvidsson
7a4436e9b5 Remove Type name property (#2161)
Only struct types have a name property and this was left over from
an earlier refactoring.
2016-07-26 15:31:43 -07:00
Rafael Weinstein
b57377c1ed Chunk over value (non-type) serialization bytes (#2130)
Chunk over value (non-type) serialization bytes
2016-07-25 11:02:26 -07:00
Erik Arvidsson
ed5f913014 JS: Fix cyclic dependency (#2129)
Lazily create valueCommitType too.
2016-07-22 14:00:33 -07:00
Erik Arvidsson
cb8d44b3f9 Merge pull request #2120 from arv/commit-no-meta
Commit type should always have a meta field
2016-07-21 18:29:45 -07:00
Erik Arvidsson
68e92092e5 Commit type: Inner parents struct should also have meta
This changes so that all commit struct types have a meta field
(which might be an empty struct).

Increment the serialization version since the old data does not
necessarily have the meta field.

Fixes ##2112
2016-07-21 18:25:17 -07:00
Rafael Weinstein
717745f2fc Refactor sequence_chunker.Done() (#2076)
Go SequenceChunker Refactor
2016-07-21 14:51:32 -07:00
Aaron Boodman
f5b8b9f248 Don't escape the zero character in struct fields (#2121)
Toward #2109
2016-07-21 14:05:33 -07:00
Erik Arvidsson
d24dda5e0c JS: Compute commit type based on value and parents
We now compute the commit type based on the type of the value and
the type of the parents.

For the first commit we get:

```
struct Commit {
  parents: Set<Ref<Cycle<0>>>,
  value: T,
}
```

As long as we continue to commit values with type T that type stays
the same.

When we later commits a value of type U we get:

```
struct Commit {
  parents: Set<Ref<struct Commit {
    parents: Set<Ref<Cycle<0>>>,
    value: T | U
  }>>,
  value: U,
}
```

The new type gets combined as a union type for the value of the inner
commit struct.

Fixes #1495
2016-07-18 14:29:07 -07:00
Erik Arvidsson
1cfa818c07 JS: Fix isSubtype for unions with cycles (#2060)
This is the JS part of #2007

This exposed bugs in resolve/unresolve types and these were fixed
by making the code more similar to go.

Fixes #2015
2016-07-14 13:37:37 -07:00
Rafael Weinstein
7854e7cb6f Ensure all bytes comsumed on decode (#2048) 2016-07-13 15:30:30 -07:00
Rafael Weinstein
890433e864 Reland js type cache (#2032)
Reland js type cache (#2032)
2016-07-13 15:23:23 -07:00
Erik Arvidsson
b830762f49 Fix some copyright headers (#2026) 2016-07-12 16:02:32 -07:00
Erik Arvidsson
1a713a40ab Remove more accidentally added temp files (#2025) 2016-07-12 15:19:33 -07:00
Erik Arvidsson
500b3c1301 Remove js/rebase-shas.js
This was accidentally added in a previous commit
2016-07-12 15:14:24 -07:00
Erik Arvidsson
f2a83346ca JS: Change hash function to sha512
For browser support we use npm amscrypto.js-sha512. For node we use its
builtin crypto module.
2016-07-12 13:59:09 -07:00
Erik Arvidsson
454a7d5b48 JS: Add base32 support library
Our base32 uses 0-9a-v with no padding. The length is hard coded to
use the first 20 bytes (and therefire ends up being 32 characters)
2016-07-12 13:59:09 -07:00
Erik Arvidsson
15ecbeaa2f JS: Add third party base32 library 2016-07-12 13:59:09 -07:00
Rafael Weinstein
8a5f3853b7 Revert "Js type cache (#2011)"
This reverts commit 4e10ae63f4.
2016-07-11 18:36:17 -07:00
Rafael Weinstein
48ab930ed2 Revert "Ensure all bytes consumed on decode (#2019)"
This reverts commit cd45787a91.
2016-07-11 18:36:01 -07:00
Rafael Weinstein
cd45787a91 Ensure all bytes consumed on decode (#2019)
Ensure all bytes consumed on decode
2016-07-11 18:08:51 -07:00
Rafael Weinstein
94a27139c7 bump noms npm version & update codec-perf-rig numbers (#2016) 2016-07-11 16:54:12 -07:00
Rafael Weinstein
4e10ae63f4 Js type cache (#2011)
Js type cache
2016-07-11 16:45:35 -07:00
Mike Gray
b6f19dfea5 number encoding (#1845)
Moved to encoding Values of type Number as 2 varints.
2016-07-11 12:08:56 -07:00
Erik Arvidsson
c462f2520c Fix invalid JSON (#1993) 2016-07-08 13:17:31 -07:00
Ben Kalman
c7b67ab50a Noms JS version 49.1 --> 49.2 from last patch (#1990) 2016-07-08 10:39:47 -07:00
Ben Kalman
68e16f338e Fix noms browser fetch and splore layout (#1989) 2016-07-07 18:19:18 -07:00
Rafael Weinstein
ee5c0f3a72 MakeStructType and NewStructWithType now takes slices rather than maps (#1945)
NewStructType and NewStructWithType now takes slices rather than maps
2016-07-07 16:36:48 -07:00
Aaron Boodman
1d752e3101 Update license: Noms will be copyright Attic Labs. (#1976) 2016-07-05 22:07:42 -07:00
Erik Arvidsson
983fa59090 Samples js shared 2 (#1973)
* Revert "Revert "Share node_modules for samples/js" (#1967)"

This reverts commit 7bb1623e99.

* Add parent directory to the PATH

* Change run-all-js-tests to run samples/js before samples/js/**

* Fix a temporary comment
2016-07-05 16:25:21 -07:00
Erik Arvidsson
0a502c3ee4 Fix some js tests (#1932) 2016-06-29 15:57:53 -07:00