Commit Graph

217 Commits

Author SHA1 Message Date
Ben Kalman 9b667cc6ba Implement efficient set/map size/length (#1277)
The Go Len implementation just iterated over all values and incremented
a counter. Now it can just read it off the meta sequence.

The JS implementation never supported size because it would have been
async in order to implement even the Go style implementation.

Mostly addresses #764 (efficient; but could be more efficient).
2016-04-19 17:04:33 -07:00
Erik Arvidsson 34e14af8ea Update to Flow 0.23 (#1257)
This required that we updated all clients to Noms SDK 11. The only
thing that needed real changes was Crunchbase IU.
2016-04-15 14:09:36 -07:00
Erik Arvidsson 58d37a487d Export Commit type and inc version 2016-04-15 10:05:59 -07:00
Erik Arvidsson 71ee644d36 Add runtime type checking to structs (#1253) 2016-04-15 09:25:25 -07:00
Erik Arvidsson 14f7bdeb11 Remove isNullOrUndefined
The usage of isNullOrUndefined prevented flow 0.23 from detecting
that the value cannot be null or undefined.

This function was only used in one place.
2016-04-14 18:35:34 -07:00
Erik Arvidsson 524c9bea2b Use @attic/eslintrc (#1252) 2016-04-14 15:03:48 -07:00
Erik Arvidsson c2b114da6f Make eslintrc a module (#1251) 2016-04-14 14:31:21 -07:00
Erik Arvidsson 3aab928f30 JS SDK: Export StructFieldMirror (#1247)
And add StructMirror get name
2016-04-14 09:39:45 -07:00
Erik Arvidsson 9aef59c62f JS: Allow defs to contain correct noms value (#1216)
If a Def for type T is already a noms value of type T we can just
return that
2016-04-14 09:08:43 -07:00
Erik Arvidsson aefc8fe149 Export emptyRef and update JS SDK (#1246) 2016-04-13 17:35:13 -07:00
Erik Arvidsson a02ca3cd6d JS: Remove empty Refs in package when the package is created (#1220)
This means that we do not need to use fixup type in any other
place in the code.
2016-04-13 17:29:49 -07:00
Erik Arvidsson 9a244c851a Revert "JS SDK: Export emptyRef (#1240)"
This reverts commit 13bddf763f.

I hadn't landed the change with emptyRef yet
2016-04-13 15:15:25 -07:00
Erik Arvidsson 13bddf763f JS SDK: Export emptyRef (#1240) 2016-04-13 15:12:47 -07:00
Ben Kalman 7c8d95bc8e Move js/webpack-config to jsmodules in preparation for publishing to npm (#1235) 2016-04-13 14:20:36 -07:00
Ben Kalman 20101a3eee Make noms-webpack-config export an object not a function (#1228)
* Make noms-webpack-config export an object not a function

* V2

* Add noms-webpack-config to build.py

* Update other build.py files, fix webpack config issue

* Don't effectively exclude out.js
2016-04-13 11:49:23 -07:00
Ben Kalman 66e60150f1 Lower random map diff test size even more, to 50 (#1225) 2016-04-12 17:00:31 -07:00
Ben Kalman 7c253e272e Lower random map diff test size (#1221) 2016-04-12 15:59:28 -07:00
Ben Kalman 3cdf75d6d0 Implement Set/Map diff (#1139) 2016-04-12 14:58:39 -07:00
Erik Arvidsson 3b76423cd0 Auto deploy JS (#1215)
Trying to use the version in package.json again

Issue #1200
2016-04-11 18:05:00 -07:00
Rafael Weinstein 1676707906 WriteValue returns RefBase 2016-04-11 17:09:25 -07:00
Erik Arvidsson 1b7cf1d2bb Fix package.json version 2016-04-11 15:21:14 -07:00
Erik Arvidsson 65206c8336 defToNoms (#1204)
This is a convenience function for creating deeply nested Noms structures.
2016-04-11 15:19:37 -07:00
Erik Arvidsson bfc7a5d88e JS: Remove makePrimitiveType (#1206)
type.js no longer exports makePrimitiveType. It is recommended to use
the type constants directly. There are a few cases where we had a
NomsKind and needed a Type. For those cases there is now a
getPrimitiveType but it is not exported by noms.

Fixes #1168
2016-04-11 15:00:39 -07:00
Erik Arvidsson 72fe7d2860 JS: Reduce map size in test (#1207)
BuildMap keeps timing out. This changes the size from 5k to 1k.

Fixes #1142
2016-04-11 14:27:25 -07:00
Erik Arvidsson 33cbf99ec4 Add more detailed error information when writing the wrong type (#1202) 2016-04-11 12:10:52 -07:00
Erik Arvidsson c2d1edc436 Fix compare/equal/less on booleans (#1191)
The codegen tests were hitting this not implemented path.
2016-04-08 14:07:53 -07:00
Erik Arvidsson e59dfacf1b JS codegen: Add test for recursive type (#1190)
To make this work we also have to export the noms `Type` for types
defined in the package.

Issue #1081
2016-04-08 09:51:49 -07:00
Erik Arvidsson b85ce637b5 Noms SDK: Export primitive types (#1189) 2016-04-07 11:41:41 -07:00
Erik Arvidsson 0dcb9c35c7 Noms SDK: Export blobType and inc version (#1187) 2016-04-07 11:02:18 -07:00
Erik Arvidsson b6eeef0250 Export BlobWriter and inc version 2016-04-06 20:03:23 -07:00
Erik Arvidsson be436da066 Noms SDK export newBlob 2016-04-06 16:54:17 -07:00
Erik Arvidsson 26e747a20e Noms SDK: Export createStructClass and increment version 2016-04-06 13:58:42 -07:00
Erik Arvidsson 8385227847 Add type validation
* Add type validation

This is not yet hooked up to the different APIs

Towards #1078
2016-04-05 13:56:00 -07:00
Ben Kalman f27f9b36bb Remove async-test.js
Its 'instanceof Promise' check was broken because of a babel Promise

polyfill; but mocha supports async style tests natively now anyway.
2016-04-01 18:01:34 -07:00
Erik Arvidsson 2031372212 JS: Dynamically create a class per struct
The decoder now generates a class for a struct. Given:

```noms
struct MyStruct {
  x: Int8
  s: optional String
}
```

the generated class looks something like this:

```js
class MyStruct extends Struct {
  get x(): int8 { ... }
  setX(value: int8): MyStruct { ... }
  get s(): ?string { ... }
  setS(value: ?string): MyStruct { ... }
}
```

The base class `Struct` has nothing on it (except chunks). It
usefull in cases where a generic struct is wanted.

To reflect on Structs we introduce StructMirror.

This also means that Commit is now a real ~~boy~~type.

This does not yet handle Defs.

Towards #1157
2016-04-01 09:37:58 -07:00
Erik Arvidsson 82dc1cd686 Prepare Noms JS SDK v6.1.0 2016-03-30 13:33:40 -07:00
Erik Arvidsson 870f5b1420 NomDL JS CodeGen
This is the first step towards generating JS code from NomDL.

At this point, only the code to create and register the
Package is done.
2016-03-30 13:19:33 -07:00
Erik Arvidsson b1a95cb5f7 Prepare release noms SDK 6.0.0 2016-03-28 15:04:49 -07:00
Erik Arvidsson 56be90796e JS: chunks should use typed RefValue
Fixes #1112
2016-03-28 10:59:48 -07:00
Erik Arvidsson 7910ad31cf JS: Make chunks an array of RefValue
Towards #1112
2016-03-28 10:18:35 -07:00
Erik Arvidsson b0ce8801bb Merge pull request #1143 from arv/sort-func
Precompute the compare function before calling sort
2016-03-28 09:47:37 -07:00
Erik Arvidsson 7ab67d504f Use Buffer for utf8 encoding on Node.js
Related to #1082
2016-03-25 17:23:57 -07:00
Erik Arvidsson 30568f896e Precompute the compare function before calling sort
Currently we do the type detection inside every compare callback.
Since we know the type ahead of time we can use a more optimized
compare function based on the type.

Fixes #1122
Towards #1142
2016-03-25 16:33:17 -07:00
Erik Arvidsson df9f8a7c6f JS: Update js sdk version to 5.0.0 2016-03-24 17:40:24 -07:00
Erik Arvidsson ea33034e20 JS: Make NomsList append insert take var args 2016-03-24 17:40:24 -07:00
Erik Arvidsson 82def05bfd JS: Fix NomsList splice signature
Fixes #1065
2016-03-24 17:40:18 -07:00
Rafael Weinstein c30a888128 Export Dataset 2016-03-23 16:56:43 -07:00
Erik Arvidsson 7c5599009a Merge pull request #1133 from arv/value-interface
JS: Change Value to be an interface
2016-03-23 15:38:28 -07:00
Erik Arvidsson c1554ad58a JS: Cache values in DataStore
The DataStore constructor now takes a second optional parameter
which is the number of bytes of values to cache.

DataStore is no longer a ChunkStore so it no longer has getRoot,
updateRoot, get, put or close.

Since DataStore now does its own caching CacheStore is no longer
useful and is now removed.

Fixes #1096
2016-03-23 15:31:28 -07:00
Rafael Weinstein 0fa94f8d98 Fix Map 2016-03-23 15:28:52 -07:00