When we create JS struct classes we no longer creates properties for
`chunks`, `hash` or `type` (nor for `toString`, `hashOwnProperty` etc)
If you are using structs with field names that clashes with these then
use a `StructMirror`.
Fixes#2332
Basic support for creating Noms value from Go values as well as reading
Noms values onto Go values.
Typical usage:
```
// Go to Noms
type T struct {
S string
N int32
}
nomsVal, err := marshal.Marshal(T{"Hi", 42})
// Noms to Go
var goVal T
err = marshal.Unmarshal(types.NewStruct("T", types.StructData{
"S": types.String("Bye"),
"N": types.Number(555),
}, &goVal)
```
Fixes#1591
In 7c103344 I changed noms log to use left-right diff so that it
completes faster, but it changed noms diff to use left-right as well.
Noms diff is supposed to use best diff.
* Fix noms_sync status message to indicate when new dataset is created
Originally, syncing a commit to a non-existent dataset and an already sync'ed dataset resulted in the same message: "<src> is up to date"
This fix distinguishes 2 cases:
- Syncing to a new dataset prints "<dest> created"
- Syncing to an identical dataset prints "<dest> already up to date"
Resolves: #2053
* Make message when noms sync creates new dataset more fun
Addresses: #2053
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).
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
In service of streaming set and map mutators, it'd be helpful for
ValueStore to implement some methods that are exposed only to other
code within the types package, even when a ValueStore is embedded
in a Database. That said, we don't want those methods to become a
part of the public Database API.
To enable this, this patch changes databaseCommon to embed a
*types.ValueStore, instead of composing one. This causes all the
ValueStore methods to be a part of the databaseCommon API, but
since all the Database construction methods return a Database by
interface, stuff like BatchStore() all gets masked. Thus, callers
still can't access ValueStore methods. Databases are passed into
the types package as ValueReadWriters, though, so code in there
can call any method on that interface -- including unexported stuff.
- 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
The Dataset.Commit() code pathway still enforces fast-forward-only
behavior, but a new SetHead() method allows the HEAD of a Dataset to
be forced to any other Commit.
noms sync detects the case where the source Commit is not a descendent
of the provided sink Dataset's HEAD and uses the new API to force the
sink to the desired new Commit, printing out the now-abandoned old
HEAD.
Fixes#2240
Previously there were 3 ways to construct a Path: via methods like
AddIndex, via parsing/AddPath, and simply via using append() (since Path
is a slice).
This patch deletes the former and leaves only ParsePath and append(),
with the ability to manually create the various path parts (I've made
them public). I also added documentation for the public types/fields.