Commit Graph

420 Commits

Author SHA1 Message Date
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
Erik Arvidsson 3a1cf20bec JS: Make fetch response headers a Map again (#1898)
Since we are using browser fetch when available it makes more sense
to use a Map.
2016-06-24 16:46:46 -07:00
Ben Kalman 3d75150b2e Noms version 48.0.0 --> 49.0.0 (#1902) 2016-06-24 12:33:43 -07:00
Erik Arvidsson ead78cb2fb JS: No need for a class for bytes.js (#1897) 2016-06-24 10:51:36 +08:00
Ben Kalman 0f4ed16641 Meta nodes encode a fake simple ref of non-ordered values (#1893)
Previously when we had an ordered (set/map) prolly tree containing
non-ordered values (blobs/refs/etc), we'd put the ref of the largest
value in each meta node, complete with its full type info and height.

This is wasteful, all we really need is the hash of the largest item for
searching the tree. In lieu of encoding just the hash - which isn't a
value - this patch creates a fake Ref<Boolean> with height 0.
2016-06-23 15:59:26 -07:00
Ben Kalman e7da64ad98 Add tests for sets and maps of 1K and 4K structs (#1866)
In Go: there are already similar tests for numbers, but testing structs
hits the non-scalar value prolly tree code.

In JS: the set and map tests hadn't even been ported from Go, so I
ported most of their functionality.
2016-06-23 14:00:03 -07:00
Ben Kalman 93b5dcb550 Add struct diffing to ordered_sequences_diff_test.go (#1877) 2016-06-23 10:10:38 -07:00
Erik Arvidsson ebd9a88d23 JS: Fix http batch store (#1885)
There were a few issues here:

1. The version header was not always passed to fetch
2. HTTP headers are case insensitive and Node an Fetch uses lower case.
3. The old code used a Map instead of an object as map. Node and Fetch
   uses an object as map. Now we just pass along the response headers.

Fixes #1881
Closes #1880 (which this is partially based in)
2016-06-23 17:41:56 +08:00
Erik Arvidsson e3b52ba2c6 Increment JS SDK version (#1879) 2016-06-23 13:42:35 +08:00
Ben Kalman c45530ef33 Remove advanceTo, not used (anymore?) (#1875) 2016-06-22 17:30:17 -07:00
cmasone-attic 4d5eb3b334 Version Noms SDK and storage (#1841)
ChunkStores provide a Version() method so that anyone directly
using a ChunkStore (e.g. BatchStoreAdaptor) can retrieve and
check the version of the underlying store.

remoteDatabaseServer checks the version of the ChunkStore it's
backed by at startup, and then provides that version as an HTTP
header to all clients. In Go, httpBatchStore checks this header
anytime it gets a response from the server and bails if there's
version skew.

In Go, the responsibility for checking whether the running code and
the data being accessed lies with the BatchStore layer. In JS, there
is code in fetch.js that checks the header mentioned above.

Towards #1561
2016-06-21 20:55:07 -07:00
Mike Gray 9b8d80852c removing unneeded eslint disable (#1862) 2016-06-21 14:21:40 -07:00
Ben Kalman 1b9ea570ae Fix sequence chunker bug triggered by repeatedly removing last element (#1844)
Fix sequence chunker bug triggered by repeatedly removing last element

The bug is we sometimes create a prollytree with a root meta sequence
node with only a single item. This is never the canonical representation
of prollytrees.

I reworked the sequence chunker to take a different approach to corner
cases. Instead of being smart and avoiding this case (which clearly
didn't work properly), it's more liberal with creating unnecessary
nodes, then it fixes them up in the finalisation step.
2016-06-20 18:35:46 -07:00