Commit Graph

545 Commits

Author SHA1 Message Date
Martin Huschenbett
83d720664d
dam2ts: Make template id accessible at the type level (#4248)
We add a third type parameter `I` to the `Template` interface and use it as
the type of the `templateId` field. We add this parameter to `CreateEvent`,
`ArchiveEvent` and `Event` as well. The reason behind this is to allow for
patterns like
```ts
function handleFooOrBar(event: CreateEvent<Foo, Foo.Key, typeof Foo.templateId>
                             | CreateEvent<Bar, Bar.Key, typeof Bar.templateId>) {
    switch (event.templateId) {
        case Foo.templateId: ...
        case Bar.templateId: ...
    }
}
```
and get exhaustiveness checking. This will become particularly handy when
handling upgrades, where `Foo` and `Bar` would be the old and new version
of a template, resp.

CHANGELOG_BEGIN
CHANGELOG_END
2020-01-28 17:49:10 +01:00
Shayne Fletcher
9c0fe75b94
Add daml2ts to the SDK release tarball (#4234)
changelog_begin
- daml2ts now included in the SDK
changelog_end
2020-01-27 13:18:05 -05:00
Martin Huschenbett
68b938d1b4 daml-ledger.ts: Fix build and lint config (#4215)
CHANGELOG_BEGIN
CHANGELOG_END
2020-01-27 10:11:16 +00:00
Martin Huschenbett
8b7878fdc6 daml-types.ts: Lint tests as well (#4208)
* daml-types.ts: Lint tests as well

Also simplify file selection a bit.

CHANGELOG_BEGIN
CHANGELOG_END

* Fix build command in test script

CHANGELOG_BEGIN
CHANGELOG_END
2020-01-25 07:38:10 +00:00
Shayne Fletcher
2160ad5035 Fix missing module refs issue (#4211)
changelog_begin
changelog_end

Co-authored-by: Shayne Fletcher <shayne.fletcher@digitalasset.com>
2020-01-24 21:46:15 +00:00
Leonid Shlyapnikov
135abd1288 Remove obsolete scala codegen-sbt-example. (#4210)
It relies on `damlc.jar` which we are stopping to support/publish.

CHANGELOG_BEGIN
CHANGELOG_END
2020-01-24 18:11:19 +00:00
Robin Krom
020f6945dc
language: nicer descriptions for typescript libraries (#4203)
CHANGELOG_BEGIN
CHANGELOG_END
2020-01-24 14:18:33 +01:00
Martin Huschenbett
183df61805 daml-ledger.ts: Rename create argument to payload (#4198)
This is better in line with the field name of the `CreatedEvent` you'll
receive as a result of calling this.

CHANGELOG_BEGIN
CHANGELOG_END
2020-01-24 12:55:56 +00:00
Martin Huschenbett
3a4d3563cf daml-ledger.ts: Simplify types of *ByKey operations (#4202)
The current type signature adds complexity which is unjustified in my
opinion. Who would expect meaningful results when specifying a template
by key `undefined`?

CHANGELOG_BEGIN
CHANGELOG_END
2020-01-24 10:40:23 +00:00
Leonid Shlyapnikov
9ab419f96b CHANGELOG_BEGIN (#4192)
[JSON API - Experimental] Rename ``argument`` field to ``payload`` in the ``command/create`` request. See #4189.

CHANGELOG_END
2020-01-24 09:04:03 +01:00
Rohan Jacob-Rao
63660c6d4e Correct rename to "daml-ledger" (#4195)
CHANGELOG_BEGIN
CHANGELOG_END
2020-01-24 09:00:40 +01:00
Shayne Fletcher
3811b6c191 Use template Key in template generic params list (#4186)
changelog_begin
changelog_end

Co-authored-by: Shayne Fletcher <shayne.fletcher@digitalasset.com>
2020-01-23 20:21:24 +00:00
Robin Krom
811d740df5
upload typescript packages to npm registry (#4185)
* make packages public

This uploads the typescript npm packages of the language support to the
npm registry in the release process.

CHANGELOG_BEGIN
CHANGELOG_END

* address moritz/gary's review

* generate the .npmrc file

* adding debug output

just in case the upload will fail in the next release.

* reverse package order
2020-01-23 18:31:50 +01:00
Robin Krom
a3de2fbf0c
rename typescript language support libs (#4180)
We rename the typescript packages of the language support as follows:
  @digitalasset/daml-json-types -> @daml/types
  @digitalasset/daml-ledger-fetch -> @daml/ledger

CHANGELOG_BEGIN
CHANGELOG_END
2020-01-23 16:14:25 +01:00
Shayne Fletcher
526801789e Add associated key type for templates (#4172)
changelog_begin
changelog_end

Co-authored-by: Shayne Fletcher <shayne.fletcher@digitalasset.com>
2020-01-23 09:10:24 +01:00
Andreas Herrmann
032ed82254
language-support/ts yarn install (#4159)
* Remove language-support/ts/packages/yarn.lock

That file is for local development exclusively.

CHANGELOG_BEGIN
CHANGELOG_END

* yarn args --frozen-lockfile

Co-authored-by: Andreas Herrmann <andreash87@gmx.ch>
2020-01-22 17:28:14 +01:00
Moritz Kiefer
9b529ad8cb
Cleanup typescript hacks for Windows (#4167)
changelog_begin
changelog_end
2020-01-22 17:19:45 +01:00
Moritz Kiefer
970d9891fd
Disable all the TS stuff on Windows (#4163)
* Disable all the TS stuff on Windows

changelog_begin
changelog_end

* disable jest explicitly

* more disabling

* :sadpanda:

* Replace @language_support_ts_deps on Windows

Provides dummy content so that `load` commands are still valid on
Windows without `yarn_install`.

* disable daml-ledger-fetch on windows

* shut up buildifier

Co-authored-by: Andreas Herrmann <andreash87@gmx.ch>
2020-01-22 16:07:20 +01:00
Moritz Kiefer
2653c6f1fe
Disable eslint_test on Windows (#4161)
* Disable eslint_test on Windows

This is currently breaking CI completely so for now let’s disable it.

changelog_begin
changelog_end

* clean expunge
2020-01-22 14:43:15 +01:00
Martin Huschenbett
6abd9f4ca0
Clean the TS vs Bazel stuff a bit (#4149)
* Clean the TS vs Bazel stuff a bit

CHANGELOG_BEGIN
CHANGELOG_END

* Fix build issues

CHANGELOG_BEGIN
CHANGELOG_END

* Add dom library back to daml-json-types

CHANGELOG_BEGIN
CHANGELOG_END
2020-01-22 11:30:50 +01:00
Robin Krom
81b8897fc8
added a package.json to work with yarn workspaces (#4147)
* added a package.json to work with yarn workspaces

This adds a package.json files on top of our typescript libraries so
that we can develop locally via yarn workspaces. The package.json that
describes the bazel managed dependencies is moved into a subfolder.

CHANGELOG_BEGIN
CHANGELOG_END

* updated bazelignore

* SDK_VERSION -> SDKVERSION
2020-01-21 22:23:51 +01:00
Robin Krom
ad9325275a
language: put sdk versions into package.json (#4122)
* language: put sdk versions into package.json

The typescript library versions of our support libraries are now given
by the sdk version.

CHANGELOG_BEGIN
CHANGELOG_END

* removed local field

* better placeholders

* consistent SDK_VERSION

* sed sdkversion in test script
2020-01-21 15:41:40 +01:00
Martin Huschenbett
3d2131fdbd
Remove pseudo* functions from daml-ledger-fetch (#4130)
Since the JSON API supports `fetchByKey` and `exerciseByKey` now, we don't
need the `pseudo*` versions of these functions anymore.

CHANGELOG_BEGIN
CHANGELOG_END
2020-01-21 15:25:40 +01:00
Andreas Herrmann
e005d4c03b Define and use eslint_test Bazel macro (#4124)
* Define eslint test case

* Define eslint_test macro

* Eslint test for daml-ledger-fetch

* Fix lint issues

* Deduplicate eslint on language-support/ts

* Use eslint --parser-options to define tsconfigRootDiro

Allows to avoid hard-coding the Bazel package path into the package.json
file. Instead derives the package root from the location of the
tsconfig.json file.

* document eslint

* pass kwargs to _eslint_test

* Add copyright header

CHANGELOG_BEGIN
CHANGELOG_END

* Exclude daml-json-types tests from lint

Otherwise eslint complains about mismatching config in `tsconfig.json`.
The test files are excluded from the project in `tsconfig.json`.

* Fix linter warning in daml-json-types

Co-authored-by: Andreas Herrmann <andreash87@gmx.ch>
2020-01-21 13:39:54 +00:00
Robin Krom
7494019302
language: added licenses for ts libraries (#4117)
CHANGELOG_BEGIN
CHANGELOG_END
2020-01-21 13:29:20 +01:00
Martin Huschenbett
b0ade660b8 daml2ts: Fix validation of nested optionals (#4128)
Currently, the validator for `Optional (Optional _)` would allow the value
`[null]`, which is not the JSON encoding for any value of this type.

This PR fixes the issue. Since it detects companion objects for the
`Optional` by means of their JavaScript class, we can also drop the
`isOptional` property from the `Serializable` interface.

CHANGELOG_BEGIN
CHANGELOG_END
2020-01-20 23:29:08 +00:00
Martin Huschenbett
92a3628cf2
daml2ts: Add tests for daml-json-types (#4120)
CHANGELOG_BEGIN
CHANGELOG_END
2020-01-20 22:24:09 +01:00
Robin Krom
704d576ecd Bazelify daml json types (#4110)
* language: bazel rules for daml-json-types/daml-ledger-fetch

This moves the daml-json-types/daml-ledger-fetch libraries out of the
tests directory and builds them with bazel. We'll rename these libraries
in a follow up PR.

CHANGELOG_BEGIN
CHANGELOG_END

* Update deps.bzl

Co-Authored-By: Andreas Herrmann <42969706+aherrmann-da@users.noreply.github.com>

* updated package.json

* rename nodejs patch

* update yarn.lock

* update @bazel/bazel dependency

* wrong typescript version in toplevel package.json

Co-authored-by: Andreas Herrmann <42969706+aherrmann-da@users.noreply.github.com>
2020-01-20 15:02:33 +00:00
Martin Huschenbett
092973e48d
daml2ts: Isolate tests better (#4111)
* daml2ts: Isolate tests better

Currently, the `sh_test` for `daml2ts` copies too many files into the
temporary directory where the test is run. This can cause issues with
stale files from development experiments being copied into the test.

This PR addresses the issue by exluding some directories which only
contain generated files.

CHANGELOG_BEGIN
CHANGELOG_END

* Exclude `node_modules` from buildifier check

Co-authored-by: Andreas Herrmann <andreash87@gmx.ch>
2020-01-20 14:48:21 +01:00
Shayne Fletcher
9478a5f60a Support nested optionals (#4106)
* First cut at generalized type

changelog_begin
changelog_end

* Update code gen and test

Co-authored-by: Shayne Fletcher <shayne.fletcher@digitalasset.com>
2020-01-20 10:25:10 +01:00
Leonid Shlyapnikov
c8c55c4408
Exercise by key (#4049)
* Implement exercise by key

ExerciseCommand got a new required element: `reference` of polymorphic type.

* Add test case: exercise Archive by contractKey

* Add test case for ExerciseCommand JSON protocol

* flatten contract reference in ExerciseCommand JSON protocol

* formatting

* Update exercise by key

* Update documentation

CHANGELOG_BEGIN

- [JSON API - Experimental] Support Exercise by Key. See #4009.

CHANGELOG_END

* Address code review comments
2020-01-18 09:06:52 -05:00
Stephen Compall
0520fdfa84
in query argument, rename %templates to templateIds, and nest query under 'query' field (#4082)
* in query argument, rename %templates to templateIds, and nest query under 'query' field

CHANGELOG_BEGIN
- [JSON API - Experimental] In 'search' endpoint arguments, %templates is now templateIds.
  Additionally, all contract query fields must occur under 'query'.
  See `issue #3450 <https://github.com/digital-asset/daml/issues/3450>`__.
CHANGELOG_END

* fix other old query format usages
2020-01-17 14:34:27 -05:00
Shayne Fletcher
6e79687be9
Add 'isOptional' to 'Serializable<>' (#4079)
changelog_begin
changelog_end

Co-authored-by: Shayne Fletcher <shayne.fletcher@digitalasset.com>
2020-01-17 07:25:00 -05:00
Shayne Fletcher
09dd123c64
Basic numeric type support : first cut (#4059)
* Basic numeric type support : first cut

changelog_begin
changelog_end

* Post-review fixups

Co-authored-by: Shayne Fletcher <shayne.fletcher@digitalasset.com>
2020-01-16 12:53:31 -05:00
Shayne Fletcher
1542e4c29b daml2ts : sum-of-product rewrite (#4047)
* Wip

* Checkpoint

* It works!

* Refactor

changelog_begin
changelog_end

Co-authored-by: Shayne Fletcher <shayne.fletcher@digitalasset.com>
2020-01-14 21:37:21 +00:00
Samir Talwar
5aa33cf7e9 bindings-rxjava: Attempt to fix the flakiness in BotTest. (#3931)
* bindings-rxjava: Fix warnings and tidy up code in BotTest.

* bindings-rxjava: Complete BotTest.TestFlowable properly.

This avoids a stack trace in the logs.

* bindings-rxjava: Use `should have size` in BotTest.

Better error messages when it fails.

* bindings-rxjava: Use `Eventually` to wait, rather than `Thread.sleep`.

This should hopefully fix the flakiness in this test.
2020-01-13 08:46:31 +00:00
Shayne Fletcher
c261fcda62 Test parameteric sum of product (#4018)
```
CHANGELOG_BEGIN
CHANGELOG_END
```
2020-01-10 21:54:32 +00:00
nickchapman-da
006aa9b608
Type checking DAML-LF type synonyms (#3959)
* CHANGELOG_BEGIN
Type-check type synonyms.
CHANGELOG_END

* placate HLint

* comments

* Add an example that requires the check in kindOf

* check types containing syn-apps are well formed even when there is no expression of that type

* show type mismatch error after synonyms are expanded

* typeOf calls expandTypeSynonyms; track vars bound by TForall during expansion

* test interaction of syn-expansion and free-vars; add one bigger testcase

* extend bigger example with pointed typeclass, having functor as a super class

Co-authored-by: Moritz Kiefer <moritz.kiefer@purelyfunctional.org>
2020-01-10 17:51:51 +00:00
Martin Huschenbett
719d1b4b42 daml2ts: Add support for exerciseByKey (#4010)
CHANGELOG_BEGIN
CHANGELOG_END
2020-01-10 15:13:29 +00:00
Martin Huschenbett
f7d8f101df
daml2ts: Make the integration tests tighter (#4007)
CHANGELOG_BEGIN
CHANGELOG_END
2020-01-10 15:39:27 +01:00
Martin Huschenbett
d2fd744b1f daml2ts: Test that templates in non-top-level modules work (#4006)
CHANGELOG_BEGIN
CHANGELOG_END
2020-01-10 10:43:30 +00:00
Leonid Shlyapnikov
93216a0d71
Template ID to JsString JSON serialization (#3991)
* test cases: domain.TemplateId JSON serialization to JsString

* JSON protocol updated

* Fixing json-api test cases

* test cases: domain.TemplateId JSON serialization to JsString

* JSON protocol updated

* Fixing json-api test cases

* Adapt daml2ts and support libraries

* Update documentation

CHANGELOG_BEGIN

[JSON API - Experimental]
- Use JSON string to encode template IDs. Use colon (``:``) to separate parts of the ID.
  The request format, with optional package ID:
  - "<module>:<entity>"
  - "<package ID>:<module>:<entity>"
  The response always contains fully qualified template ID in the format:
  - "<package ID>:<module>:<entity>"
  See #3647.

CHANGELOG_END

* Minor documentation formatting changes.

Co-authored-by: Martin Huschenbett <martin.huschenbett@posteo.me>
2020-01-09 14:43:41 -05:00
Moritz Kiefer
c5b11aa229 Fix DAML module filename in java codegen tests (#4003)
A mismatch between the module and the filename is already a warning
and will become an error in the future.

changelog_begin
changelog_end
2020-01-09 16:52:11 +00:00
Shayne Fletcher
e0685a327b Implement sums of products (#3992)
```
CHANGELOG_BEGIN
CHANGELOG_END
```
2020-01-09 12:59:32 +00:00
Martin Huschenbett
1d07d82962 daml2ts: Lift type annotation for variant decoders to jtv.oneOf (#3994)
Currently, the generated decoder for, say, `Either` looks like
```ts
() => jtv.oneOf(
  jtv.object<Either<a, b>>(...),
  jtv.object<Either<a, b>>(...),
)
```
After this PR, the generated code will look like
```ts
() => jtv.oneOf<Either<a, b>>(
  jtv.object(...),
  jtv.object(...),
)
```
That saves us a few type annotations but nothing major.

CHANGELOG_BEGIN
CHANGELOG_END
2020-01-09 12:22:45 +00:00
Martin Huschenbett
20ad5263d4 daml2ts: Support lookupByKey (#3987)
* daml2ts: Support lookupByKey

We'll add `fetchByKey` and `exerciseByKey` in a separate PR. We'll remove
the `pseudo*` methods in another PR after that one.

CHANGELOG_BEGIN
CHANGELOG_END

* daml2ts: make `lookupByKey` inaccessible for templates without key
2020-01-09 10:51:44 +00:00
Leonid Shlyapnikov
e75b98351c Aligning DB contract table with domain.ActiveContract class (#3989)
* Aligning DB contract table with domain.ActiveContract class

adding key,signatories, observers and agreement_text to DB contract table
removing witnessParties

Reading signatories and observers from contracts table

Updating doc, removing witnessParties

Address code review comments, thanks @S11001001

CHANGELOG_BEGIN

[JSON API - Experimental]
- Align ``contract`` table with ``domain.ActiveContract`` class.
  The database schema has changed, if using ``--query-store-jdbc-config``,
  you must rebuild the database by adding ``,createSchema=true``. See #3754.
- ``witnessParties`` field is removed from all JSON responses.

CHANGELOG_END

* Fix TypeScript domain models

remove witnessParties and workflowId fields. workflowId has be removed
from JSON output a while ago.
2020-01-08 20:39:57 +00:00
Shayne Fletcher
7ed91c1f6d
Daml2ts variant support (#3988)
* Sketch out code generation required for variants

* More testing

* Checkpoint

* Checkpoint.

* Add serialization for variants.

```
CHANGELOG_BEGIN
CHANGELOG_END
```
2020-01-08 13:11:18 -05:00
Martin Huschenbett
1f817ecbe8 daml2ts: Use master version of damlc in watch-damlc.sh (#3979)
So far, we've used the version of damlc installed with the SDK on the
devs machine. This lead to hard to debug version mismatches. This PR
changes `watch-damlc.sh` to use `bazel run //:damlc` instead.

CHANGELOG_BEGIN
CHANGELOG_END
2020-01-08 13:08:24 +00:00
Leonid Shlyapnikov
2c154f2299 Rename argument to payload in domain.ActiveContract (#3971)
CHANGELOG_BEGIN

[JSON API - Experimental] Rename ``argument`` in active contract to ``payload``. See #3826.

CHANGELOG_END
2020-01-08 13:59:27 +01:00
Shayne Fletcher
9c30a7096b Revert "Better handling of recursive return types (#3968)" (#3972)
This reverts commit 17a5abf25a.
```
CHANGELOG_BEGIN
CHANGELOG_END
```
2020-01-08 11:48:48 +01:00
Shayne Fletcher
17a5abf25a
Better handling of recursive return types (#3968)
CHANGELOG_BEGIN
CHANGELOG_END
2020-01-07 13:58:51 -05:00
Moritz Kiefer
a8b4a84b08
Move most of the remaining serializable types to stable LF packages (#3964)
* Move most of the remaining serializable types to stable LF packages

The only serializable types left in DAML stdlib after this PR are the
following:

- DA.Upgrade:MetaEquiv
- DA.Random:Minstd
- DA.Next.Set:Set
- DA.Next.Map:Map
- DA.Generics:MetaSel0
- DA.Generics:MetaData0
- DA.Generics:DecidedStrictness
- DA.Generics:SourceStrictness
- DA.Generics:SourceUnpackedness
- DA.Generics:Associativity
- DA.Generics:Infix0
- DA.Generics:Fixity
- DA.Generics:K1
- DA.Generics:Par1
- DA.Generics:U1
- DA.Internal.Prelude:Optional

Ignoring the Generics stuff which isn’t very urgent imho and the
Upgrade stuff which is probably going to change significantly anyway,
this leaves us with the weird Random module, the wrappers around
TextMap which will go away anyway and DA.Internal.Prelude:Optional
which shouldn’t exist in the first place (I’ll address that in a
separate PR).

CHANGELOG_BEGIN

- [DAML Compiler] Move more types from daml-stdlib to standalone LF
packages. The module names for the types have also changed
slightly. This only matters over the Ledger API when you specify the
module name explicitly. In DAML you should continue to use the
existing module names.

  - The types from ``DA.Semigroup` are now in a separate package under
  ``DA.Semigroup.Types``
  - The types from ``DA.Monoid` are now in a separate package under
  ``DA.Monoid.Types``
  - The types from ``DA.Time` are now in a separate package under
  ``DA.Time.Types``
  - The types from ``DA.Validation` are now in a separate package
  under ``DA.Validation.Types``
  - The types from ``DA.Logic` are now in a separate package under
  ``DA.Logic.Types``
  - The types from `DA.Date` are now in a separate package under
  `DA.Date.Types`.
  - The `Down` type from `DA.Internal.Prelude` is now in a separate
  package under `DA.Internal.Down`.

CHANGELOG_end

* Fix serializability of RelTime

* fix daml-docs

* Fix tests
2020-01-07 18:25:23 +01:00
Martin Huschenbett
8cb70df0fa
daml2ts: Enforce that template types are records at the type level (#3960)
The DAML-LF spec says that templates types must be records. Let's enforce
this property in the generated TypeScript on the type level as well.
2020-01-07 14:32:49 +01:00
Martin Huschenbett
f09433e8da daml2ts: Slightly prettify output (#3957) 2020-01-07 10:22:32 +00:00
Andreas Herrmann
f33e79c787
Remove unused dependencies to da_scala_library (#3938)
* Inline all scala_library dependencies

* Run //:buildifier-fix

* TMP scala_library_suite --> scala_library

* da_scala_library: Enable unused dependency checker

* scala_library: Enable unused dependency checker

* //daml-lf/data:data

* //daml-lf/engine:engine

* //ledger-api/rs-grpc-akka:rs-grpc-akka

* //ledger/participant-state:participant-state

* //ledger/ledger-api-client:ledger-api-client

* //scala-protoc-plugins/scala-logging:scala-logging-lib

* //ledger/ledger-api-scala-logging:ledger-api-scala-logging

* //ledger/ledger-api-common:ledger-api-common

* //ledger-service/utils:utils

* //ledger-service/jwt:jwt

* //ledger/ledger-api-auth:ledger-api-auth

* //extractor:extractor

* //daml-assistant/scala-daml-project-config:scala-daml-project-config

* //language-support/codegen-common:codegen-common

* //language-support/scala/codegen:codegen

* //language-support/codegen-main:codegen-main-lib

* //ledger-service/db-backend:db-backend

* //ledger-service/http-json:http-json

* //daml-lf/scenario-interpreter:scenario-interpreter

* //ledger/sandbox:sandbox

* //navigator/backend:navigator-library

* //daml-assistant/daml-sdk:sdk-lib

* //daml-lf/data-scalacheck:data-scalacheck

* //daml-script/test:test-lib

* //ledger/ledger-api-common:ledger-api-common-scala-tests-lib

* //ledger/test-common:test-common

* //ledger/sandbox:sandbox-scala-tests-lib

* //extractor:extractor-scala-tests-lib

* //language-support/java/bindings:bindings-java-tests-lib

* //language-support/java/bindings-rxjava:bindings-java-tests-lib

* //language-support/scala/bindings-akka-testing:bindings-akka-testing

* //language-support/scala/codegen-testing:codegen-testing

* //language-support/scala/codegen-sample-app:daml-lf-codegen-sample-app

* //language-support/scala/codegen-sample-app:daml-lf-codegen-sample-app-testing

* //language-support/scala/codegen-testing:codegen-testing-testing

* //ledger-api/sample-service:sample-service

* //ledger-api/rs-grpc-akka:rs-grpc-akka-tests-lib

* //ledger/ledger-api-test-tool:ledger-api-test-tool-lib

* //ledger/ledger-api-test-tool:ledger-api-test-tool-tests

* //ledger/participant-state/kvutils:kvutils

* //ledger/sandbox:ledger-api-server

* //ledger/sandbox-perf:sandbox-perf-lib

* //navigator/backend:navigator-tests-library

* UNDO scala_library_suite --> scala_library

This reverts commit ab3eb1ae23139e2ec431ab4551fbb0371e0354e1.

Co-authored-by: Andreas Herrmann <andreash87@gmx.ch>
2020-01-06 18:14:21 +01:00
Andreas Herrmann
43bbfeaee6
Remove unused dependencies to da_scala_binary (#3937)
* Inline all scala_binary dependencies

* Run //:buildifier-fix

* da_scala_binary: Enable unused dependency checker

* //compiler/scenario-service/server:scenario-service-raw

* //language-support/scala/codegen:codegen-main

* //daml-lf/encoder:encoder_binary

* //daml-lf/repl:repl

* //language-support/codegen-main:codegen-main

* //language-support/scala/examples:quickstart-scala-bin

* //ledger-api/rs-grpc-akka:rs-grpc-akka-perf

* //ledger-service/jwt:jwt-bin

* //ledger/api-server-damlonx/reference-v2:reference-v2

* //ledger/api-server-damlonx/reference-v2:ephemeral-postgres-reference-server

* //ledger/ledger-api-auth:ledger-api-auth-bin

* //ledger/ledger-api-test-tool:ledger-api-test-tool

* //ledger/participant-state/kvutils/tools:integrity-check

* //navigator/integration-test:navigatortest-jar

* Run //:buildifier-fix

Co-authored-by: Andreas Herrmann <andreash87@gmx.ch>
2020-01-06 13:58:56 +01:00
Moritz Kiefer
42c586f8d4
Bump ghcide (#3943)
* Bump ghcide

* Fix ghcide build

* Include bugfix for Windows
2020-01-04 07:51:51 +01:00
Gary Verhaegen
878429e3bf
update copyright notices to 2020 (#3939)
copyright update 2020

* update template
* run script: `dade-copyright-headers update .`
* update script
* manual adjustments
* exclude frozen proto files from further header checks (by adding NO_AUTO_COPYRIGHT files)
2020-01-02 21:21:13 +01:00
Andreas Herrmann
9fbb787062 Remove unused dependencies to da_scala_test(_suite) (#3925)
* Remove unused scala.bzl imports

* override_targets org.scalatest.scalatest_2.12

Otherwise, rules_scala implicitly adds a different version to scala_test
than other packages transitively depending on scalatest. This causes
unused dependency checker to raise an error.

* Handle rules_scala scalatest in pom_file.bzl

* Inline all scala_test dependencies

So that `unused_dependency_checker = "error"` can be applied to them.

* Run //:buildifier-fix

* TMP scala_test_suite --> scala_test

* da_scala_test: Enable unused dependency checker

* //navigator/backend:navigator-scala-tests

* //ledger/sandbox:sandbox-scala-tests

* //ledger/participant-state/kvutils:kvutils-tests

* //ledger/participant-state:participant-state-tests

* //ledger/ledger-api-scala-logging:ledger-api-scala-logging-test

* //ledger/ledger-api-common:ledger-api-common-scala-tests

* //ledger/ledger-api-client:ledger-api-client-tests

* //ledger/ledger-api-auth:ledger-api-auth-scala-tests

* //ledger-service/lf-value-json:tests

* //ledger-service/jwt:tests

* //ledger-service/http-json:tests

* //ledger-api/rs-grpc-akka:rs-grpc-akka-tests

* //language-support/scala/codegen-sample-app:tests

* //language-support/scala/codegen-sample-app:ScalaCodeGenIT

* //language-support/scala/codegen:tests

* //language-support/scala/bindings-akka:tests

* //language-support/java/codegen:test

* //language-support/java/codegen:ledger-tests

* //language-support/java/bindings-rxjava:bindings-java-tests

* //language-support/codegen-common:test

* //extractor:extractor-scala-tests

* //daml-lf/scenario-interpreter:scenario-interpreter_tests

* //daml-lf/language:language-test

* //daml-lf/interface:tests

* //daml-lf/engine:tests

* //daml-lf/encoder:tests

* //daml-lf/archive:daml_lf_archive_reader_tests

* //daml-assistant/scala-daml-project-config:scala-daml-project-config-tests

* UNDO scala_test_suite --> scala_test

This reverts commit 13ed47ba725e944533ca1157a070cb8dc30569ac.

Co-authored-by: Andreas Herrmann <andreash87@gmx.ch>
2019-12-30 13:49:59 +00:00
Rohan Jacob-Rao
6c480cf9ae
Fix typos in daml2ts readme (#3927) 2019-12-27 11:10:32 -05:00
Leonid Shlyapnikov
f22d52a2ff Change variant JSON encoding, so it is easier to pattern match on it in TypeScript (#3882)
* Change variant json encoding,

adding integration test

* Add DamlLfTypeLookup dependencies

* Add MetadataReader

* Add test WIP

* Add serialize test cases

* Add serialize test cases, WIP

* Test for variant encoding decoding

* Solving merge conflicts

* Updating roundtrip test

* Minor cleanup

* Addressing code review comments

Add JsonVariant custom matcher

* Update specification

* Update link

* Add test case, WIP

* Add proper template key resolution

* Got rid of choice record ID resolution, resolving choice type and key type

* Fixing logging

* Add Contract Key decoding tests

* cleanup

* cleanup

* Update JSON variant encoding tests

* Add more contract key JSON decoding tests

* Fix variant JSON encoding

* Change value predicate to support new variant encoding

* Change value predicate to support new variant encoding

* Add lookup by contract key test case

where contract key contains variant and record

Add `requiredResource` to bazel utils

CHANGELOG_BEGIN

- [JSON API - Experimental] Change variant JSON encoding. The new format is ``{ tag: data-constructor, value: argument }``.
  For example, if we have: ``data Foo = Bar Int | Baz``, these are all valid JSON encodings for values of type Foo:
  - ``{"tag": "Bar", "value": 42}``
  - ``{"tag": "Baz", "value": {}}``
  See #3622

- [JSON API - Experimental] Fix ``/contracts/lookup` find by contract key.

- [JSON API - Experimental] Fix ``/command/exercise`` to support any LF type as a choice argument.
  See #3390

CHANGELOG_END

* minor cleanup

* Fix copy/paste

* Renaming

* Got rid of DAML LF identifier resolution

resolving DAML LF Type based on command type

* Address code review comments, thanks @S11001001

* Address code review comments, thanks @S11001001

Do not include any error handling here; this partial function should
only match the successful case, JsonVariant.

* Address code review comments, thanks @S11001001

comment

* Address code review comments, thanks @S11001001

using `JsonVariant` for variant encoding/decoding

* Address code review comments, thanks @S11001001

replace `find` and `map` chain with collectFirst

* Update docs/source/json-api/lf-value-specification.rst

Co-Authored-By: Stephen Compall <stephen.compall@daml.com>

Co-authored-by: Stephen Compall <scompall@nocandysw.com>
2019-12-24 20:55:44 +00:00
Samir Talwar
1794d8a2fd Sandbox: Manage resources and close them properly on failure. (#3871)
* sandbox: Create a monadic `ResourceOwner` to manage resources.

* sandbox: Rewrite `ResourceOwner` to be async.

* sandbox: Make sure failed resources are closed immediately.

* sandbox: Better naming in `Open`.

* sandbox: Rename `Open` to `Resource`, and open/close to acquire/release.

* sandbox: Convert `() => AutoCloseable` into `ResourceOwner`.

* sandbox: Refactor the LedgerApiServer in terms of resources.

* sandbox: Explicitly convert `() => AutoCloseable` to `ResourceOwner`.

Explicit > Implicit, right?

* sandbox: Create helpers for converting things to ResourceOwners.

Because I tried to start using them and there was so much code being
written at once.

* sandbox: Simplify construction of JdbcLedgerDao.

* sandbox: Releasing resources should be idempotent.

In that we should only do it once.

* sandbox: Fix the ResetService by closing the API services _first_.

They need to be shut down before the gRPC server.

* sandbox: Don't try and shut down PostgreSQL twice in tests.

* sandbox: Actually run the assertions in ResourceOwnerSpec.

Facepalm.

* sandbox: Test `Resource.sequence` more rigorously.

* sandbox: Move the helpers around `Resource` into `Resource.apply`.

* sandbox: Convert LedgerApiServer resource owners to classes.

* sandbox: Make `ResourceOwner` a monad too, delegating to `Resource`.

* sandbox: Turn `LedgerApiServer` into a ResourceOwner.

* sandbox: Simplify the public signature of `Resource.apply`.

* sandbox: Use ResourceOwners to simplify DB resource management.

This is one hell of a change. Sorry.

* sandbox: Try not to nest `Await.result` calls.

Causes issues when running in a `DirectExecutionContext`.

* sandbox: Turn index subscriptions into resources.

* sandbox: Fix warnings in RecoveringIndexerSpec.

* sandbox: Always release before recovering the indexer.

* sandbox: Add `flatten` and `transformWith` to `Resource`.

* sandbox: If releasing twice in parallel, the second should wait.

* sandbox: If the indexer recovers, clean up the old subscription.

* sandbox: Convert StandaloneIndexerServer into a resource owner.

* sandbox: Convert StandaloneApiServer into a resource owner.

* reference-v2: Rewrite ReferenceServer in terms of resources.

CHANGELOG_BEGIN

- [Reference v2] On an exception, shut down everything and crash.
  Previously, the server would stay in a half-running state.

CHANGELOG_END

* sandbox: Rewrite SandboxServer in terms of resources.

* sandbox: Write the port file in a Future.

* sandbox: JdbcIndexer no longer needs to manage the actorSystem.

* sandbox: Shut down the LedgerApiServer when closing the Sandbox.

* sandbox: Rename `Resource.pure` to `Resource.successful`.

* sandbox: Rename `Resource.sequence_` to `sequenceIgnoringValues`.

* sandbox: Delete `CloseableResource`.

It's only used in once place. Just inline it.

* sandbox: `LedgerDao` no longer needs to be closeable.

* sandbox: Delete implicit materializers where they're not used.

* http-json: Wait for the Sandbox to start in tests.

* sandbox: Convert `scheduleHeartbeats` into a ResourceOwner.

* reference-v2: Explain why we steal ownership of the actor system.

* sandbox: Document why we only release resources once.

* sandbox: Add clues to ResourceOwnerSpec.

* http-json: Fix HttpServiceTestFixture to pass auth service through.

* codegen-sample-app: In ScalaCodeGenIT, wait for the server to  start.
2019-12-22 15:05:55 +00:00
Martin Huschenbett
f725137795 daml2ts: Do some maintenance tasks in daml-ledger-fetch (#3922)
Fix a few todos. Remove a few useless lambdas. Use newer syntax.
2019-12-20 18:44:17 +00:00
Martin Huschenbett
02d72e3a55 daml2ts: Clean up yarn.lock for support libraries (#3921) 2019-12-20 17:08:56 +00:00
Shayne Fletcher
11681c6aa3
Add 'R' to 'Choice<T,C,R>' defn (#3895)
* 'Choice<T,C,R>' defn

* Speculative. Account for the absence of tuples

* Finalize the exercise decoding and add a test

* Shorter version of bazel bootstrap (recommended by AH)

* argDecoder => argumentDecoder

Co-Authored-By: Martin Huschenbett <martin.huschenbett@posteo.me>

* Update language-support/ts/codegen/tests/ts/daml-ledger-fetch/src/index.ts

Co-Authored-By: Martin Huschenbett <martin.huschenbett@posteo.me>

* Update language-support/ts/codegen/tests/ts/daml-ledger-fetch/src/index.ts

Co-Authored-By: Martin Huschenbett <martin.huschenbett@posteo.me>

* Update language-support/ts/codegen/tests/ts/daml-ledger-fetch/src/index.ts

Co-Authored-By: Martin Huschenbett <martin.huschenbett@posteo.me>

* Update language-support/ts/codegen/tests/ts/daml-ledger-fetch/src/index.ts

Co-Authored-By: Martin Huschenbett <martin.huschenbett@posteo.me>

* Update language-support/ts/codegen/tests/ts/daml-ledger-fetch/src/index.ts

Co-Authored-By: Martin Huschenbett <martin.huschenbett@posteo.me>

* Update language-support/ts/codegen/tests/ts/generated/src/__tests__/test.ts

Co-Authored-By: Martin Huschenbett <martin.huschenbett@posteo.me>

* Update language-support/ts/codegen/tests/ts/generated/src/__tests__/test.ts

Co-Authored-By: Martin Huschenbett <martin.huschenbett@posteo.me>

* Remove spurious return

* argDecoder => argumentDecoder

* Note to self : don't accept suggestions, implement them yourself

Co-authored-by: Martin Huschenbett <martin.huschenbett@posteo.me>
2019-12-20 08:48:23 -05:00
Brian Healey
9f13a2fb10 Upgrade to Akka 2.6.1, akka-http 10.1.11 and Scala 2.12.10 (#3903)
* Upgrade to Akka 2.6.1, akka-http 10.1.11 and Scala 2.12.10

Akka 2.6.1 Upgrade Changes
- Materializer in place of ActorMaterializer
- Source.future instead of Source.fromFuture
- The Scheduler.schedule method has been deprecated in favor of selecting scheduleWithFixedDelay or scheduleAtFixedRate
- onDownstreamFinish(cause: Throwable)
- ActorAttributes.supervisionStrategy(...) in place of ActorMaterializerSettings.withSupervisionStrategy

See https://doc.akka.io/docs/akka/current/project/migration-guide-2.5.x-2.6.x.html

* Akka 2.6.1 Upgrade Changes
- onDownstreamFinish(cause: Throwable)

See https://doc.akka.io/docs/akka/current/project/migration-guide-2.5.x-2.6.x.html

* code review: remove unnecessary supervision strategy
2019-12-19 18:00:59 +00:00
Moritz Kiefer
c48b0ee289 Move Any wrappers and Archive to stable packages (#3890)
* Move Any wrappers and Archive to stable packages

There are no actual API or functionality changes in this PR but the
logic for locating the stable packages has slightly changed since the
Any wrappers package only makes sense for LF 1.7. To address this, we
simply filter out stable packages for newer LF versions since it
doesn’t make sense to depend on those anyway.

CHANGELOG_BEGIN

- [DAML Compiler] Move ``Archive`` type to a separate DALF.

CHANGELOG_END

* More comments

* Fix java codegen tests

* fix more tests

* Force cache reset on Windows

* Revert "Force cache reset on Windows"

This reverts commit 9f2b7d70b2.
2019-12-19 01:26:38 +00:00
Martin Huschenbett
00f23ef7d5
Rename Contract type to CreateEvent and move it to daml-ledger-fetch (#3869)
What was called `Contract` until now is actually a create event. Hence the
renaming. We'll most likely get a `Contract` type in DAML as well and this
renaming will avoid a name conflict. Also, create events are not part of
DAML-LF values and hence not generated by `daml2ts`. Thus, there's not need
to have them in `daml-json-types`. Instead, they should be in a future
`daml-json-api-types` package which captures the types used by the JSON API.
2019-12-17 15:05:32 +01:00
Martin Huschenbett
6d83a7bf47
Move daml-json-types to TypeScript 3.7.3 (#3856)
This should have happened in a previous PR, but I missed it.
2019-12-17 08:47:41 +01:00
Robin Krom
bbb6e27d04
language: daml2ds: Removal of accidentally slipped in dependencies (#3862)
These seem to have slipped in when running yarn locally.
2019-12-16 15:40:49 +01:00
Robin Krom
881d36eab4
language: daml2ts: support for enum types (#3852)
* language: daml2ts: support for enum types

This adds support for enum types to daml2ts. daml-lf enums are converted
to typescript enums and a decoder defined in the same namespace.

* static serializable check for enums and better tests
2019-12-16 13:57:25 +01:00
nickchapman-da
1369351f70
separate type-synonyms from type-constructors (#3829)
* separate type-synonyms from type-constructors in DAML-LF .proto and Haskell AST

* comments
2019-12-16 11:52:28 +00:00
Samir Talwar
71e8c20127 Sandbox: Fix warnings in SandboxServer. (#3853)
* sandbox: Move SandboxServer's helper classes to the companion object.

And make them `private`, `final`, and non-`case`.

* sandbox: Drop SandboxServer.apply and just call the constructor.

* sandbox: Move the SandboxServer#SandboxState class into the object.

Leave the `resetAndRestartServer` method behind, though.
2019-12-14 20:52:03 +00:00
Martin Huschenbett
44005348a3
daml2ts: Upgrade to TypeScript 3.7 (#3854)
Also upgrade ESLint to the newest version and its plugins to the newest
version.
2019-12-13 23:01:05 +01:00
Martin Huschenbett
05860d1df4
daml2ts: Tie the knot between templates and their choices without hacks (#3839)
In the code generated by `daml2ts`, every template companion object lists
all its choices and every choice has a pointer back to the companion object
of its template. Thus, there's a knot to tie.

So far, we initialized the choices as `undefined` and later mutated them to
point to the template companion object. This feels kind of hacky,
particularly since we end up with cyclic values.

This PR pushes the pointer from the choice back to the template companion
object behind a lambda. This makes the hack unnecessary and removes the
cyclic values.
2019-12-13 12:03:51 +01:00
Jussi Mäki
ce70ad4a2f
Async package management (#3806)
* Add package_entries table

* Change PublicPackageUpload event to cover list of packages.

Add PublicPackageUploadRejected.

* Produce new package update events in KeyValueConsumption

* Update signature of uploadPackages

* Cleanup InMemoryKVParticipantState. Add submissionId to uploadPackages.

* Fix up InMemoryKVParticipantStateIT

* Initial ledger dao changes for package entries

Drop the participant_id as we never expect to see
entries of other participants. This should be done
for party_entries as well.

* Drop UploadPackagesResult

* Implement getPackageEntries and refactor callers

* Add maxRecordTime to uploadPackages

* First cut at updating ApiPackageManagementService

* Update tests, wire through the packageEntries

* Don't extend IndexPackagesService in InMemoryPackageStore

It does not implement the full interface and it isn't used
directly as one anyway.

* Drop maximum_record_time from package_management_service

Adding maximum record times touches the whole stack. Leaving
this change to another PR.

* Wire through the removal of maximum_record_time.

And remove dead code from InMemoryKVParticipantState

* Remove checking for duplicate package uploads

This aligns with the behaviour of WriteService.

* Reformat

* Fix PackageManagementService after adding of submission_id to the service
2019-12-13 09:56:47 +01:00
Martin Huschenbett
3722f32429
daml2ts: Add more tests (#3832) 2019-12-12 18:42:27 +01:00
Gary Verhaegen
2b3693bf4d
restore 0.13.38 logging defaults for daml jars (#3819)
CHANGELOG_BEGIN
- [Sandbox] Restore 0.13.38 logging behaviour.
- [Navigator] Restore 0.13.38 logging behaviour.
- [Extractor] Restore 0.13.38 logging behaviour.
- [Internals] As of 0.13.39, we merged a number of internal JAR files in
  the SDK tarball to reduce its size. These jars used to be standalone
  JARs you could invoke as e.g. ``java -jar sandbox.jar <args>``. As a
  result of merging the jars, they lost their individual ``logback.xml``
  configuration file. Although running the jars directly was (and is
  still) not supported, note that you can now achieve the same behaviour
  with e.g. ``java -Dlogback.configurationFile=sandbox-logback.xml -jar
  daml-sdk.jar sandbox <args>``.
CHANGELOG_END
2019-12-12 14:02:23 +01:00
Leonid Shlyapnikov
0b172da49a Add ExceptionOps to extract exception details safely (#3822)
* Add ExceptionOps to extract exception details safely

`Throwable.getMessage` can return `null` which caused unexpected NPE
in JSON API error handling

* Fix formatting

* Remove show instance

* Addressing code review comments,

thanks Stefano!
2019-12-11 18:38:44 +00:00
associahedron
08ee42fb30 Implement missing genmap fns (#3807) 2019-12-11 11:16:25 +00:00
Remy
94aea562d6 scala codegen: add GenMap support (#3522)
* scala codegen: add GenMap support

* scala-codegen: use InsertOrdMap as underlying of Generic Map binding

* Address Stephen's comments

* make TextMap a strict subtype of immutable.Map to avoid overlap with GenMap

Otherwise, attempted GenMap encodings like
`Value.encode(InsertOrdMap("foo" -> "bar"))` (and any contract
containing such a structure) are either ambiguous or, worse, yield the
wrong result.

* ensure better return types for InsertOrdMap and similar wrappers' operations

* if is an expression

* adapt various primitive encodings to newtype TextMap

* easy cleanups of the TextMapApi

* proper alias for deprecated Map

* update deprecation releases

* Revert "proper alias for deprecated Map"

This reverts commit e85aa85b960c4bf5c4f9624896183ec6e2182bba.

* remove useless invisible deprecated notice

* add generic map tests for scala codegen

* please restart CI
2019-12-11 09:22:38 +00:00
Leonid Shlyapnikov
dcc7dc913f
Add choice result to the exercise response (#3757)
* Adding choice result to the exercise response, WIP

* Adding choice result to the exercise response, WIP

* Refactoring towards #3390,

ExerciseCommand argument does not always have to be a Record, changing
typearg: JsObject -> JsValue

* Cleanup

* exercise-with-result endpoint

* todo

* Switching /commands/exercise to use SubmitAndWaitForTransactionTree,

populating archived and created from TransactionTree

* removing debug println

* Fixing tests

* Removing `/command/exercise-with-result` endpoint

this one returns only exercise result, `/command/exercise` now returns
exercise result and events

* Updating docs

* Updating docs

CHANGELOG_BEGIN

- [JSON API - Experimental] Expose exercise result. Changed the output
of the ``/command/exercise``. Note ``exerciseResult`` and ``contracts``
in ``{"status":200,"result":{"exerciseResult": ...,"contracts":[...]}``.
See #3314

CHANGELOG_END
2019-12-10 10:09:24 -05:00
Martin Huschenbett
0b63fa432b
daml2ts: Add instructions on how to develop (#3799) 2019-12-10 12:52:03 +01:00
Moritz Kiefer
e769264ddf Move all datatypes out of daml-prim (#3791)
* Move all datatypes out of daml-prim

This moves the remaining two modules DA.Types and GHC.Tuple to
separate LF packages with stable identifiers.

The only data types remaining are the ones for typeclasses which will
disappear once we move this to type synonyms.

CHANGELOG_BEGIN

- [DAML Compiler] The modules DA.Types and GHC.Tuple from daml-prim
have been moved to separate packages.

CHANGELOG_END

* Fix codegen tests

* Fix DarReader test

* Fix kvutils tests

* Fix jdbcdao tests

* Fix hs ledger bindings tests
2019-12-10 09:19:16 +01:00
Stefano Baghino
6e17cdba90
Fix typo in JavaDoc (#3793) 2019-12-09 17:58:33 +01:00
Robert Autenrieth
bf2098f038
Check ledger and participant ID in claims (#3781)
* Add ledger and participant ID to claims

CHANGELOG_BEGIN
- [Ledger] AuthService implementations can now restrict the validity of access tokens to a single ledger or participant.
- [Sandbox] The sandbox JWT authentication now respects the ledgerId and participantId fields of the token payload.

CHANGELOG_END

* Add tests for ledger and participant in claims

* Address review comment

* Address review comment

* Fix tests

* Fix tests
2019-12-09 17:55:17 +01:00
Stefano Baghino
18824016c1 Ensure the access token is initialized when constructing a client (#3788)
* Ensure the access token is initialized when constructing a client

CHANGELOG_BEGIN
- [Java Client] Ensure the access token is initialized when using a
deprecated constructor.
CHANGELOG_END

* Improve phrasing and grammar
2019-12-09 14:14:45 +00:00
Martin Huschenbett
0211e1337d Move the bazel aliases for yarn and java to the root BUILD file (#3786)
Replicating the yarn alias in multiple places doesn't make sense.
2019-12-09 13:22:21 +00:00
Martin Huschenbett
19d2a22b0b
daml2ts: Add E2E tests (#3776)
* daml2ts: Add E2E tests

* Attempt to fix failing test

* Don't try to delete the temp directory

* Cleanup block can't be empty

* Leave TMP_DIR before removing it
2019-12-07 18:34:40 +01:00
Gerolf Seitz
9d926d81b0 RxJava Bindings: Allow bot to run on a scheduler (#3404)
* RxJava Bindings: Allow bot to run on a scheduler

It seems that having many bots results in a some sort of deadlock
or blocking of data flow within the flowable network.

Adding some async boundaries to allow for concurrent processing
seems to help.

Fixes #2356

CHANGELOG_BEGIN
- [RxJava Bindings] Added a method to the ``Bot`` class allowing users to specify a ``Scheduler`` to use for running the bot. See `issue #2356 <https://github.com/digital-asset/daml/issues/2356>`__.
CHANGELOG_END

* Go easy, test!
2019-12-06 16:30:25 +00:00
Gerolf Seitz
658365e5eb Java codegen fixes (#3762)
* Fix compiler warnings in generated enums

* Fix warnings in generated equals method for parameterized types.

* Remove warning in equals for records without fields.

CHANGELOG_BEGIN
- [Java Bindings] Removed warnings in code emitted by the Java Codegen.
CHANGELOG_END

* fix compilation error in tests
2019-12-06 15:10:38 +00:00
Stefano Baghino
da9306414b Add authentication support to DamlLedgerClient (#3743)
Add documentation

CHANGELOG_BEGIN
- [Java Bindings] Added authentication support. See `issue #3626 <https://github.com/digital-asset/daml/issues/3626>`__.
CHANGELOG_END
2019-12-05 10:57:51 +00:00
Stefano Baghino
94aafd8121 Add authentication support to Java transaction client (#3733)
* Add authentication support to Java transaction client

* Address https://github.com/digital-asset/daml/pull/3733#discussion_r354182366
2019-12-05 10:17:30 +00:00
nickchapman-da
1684b2290a daml assistant: expect auth token in Bearer format (#3736)
* daml assistant expected auth token in Bearer format

* Daml assistant does no validation of the auth token before passing in on to the ledger.

* clarify code with newtype Token
2019-12-05 09:19:02 +00:00
Robin Krom
ed4397b2eb language: add registerTemplate for daml2ts (#3737) 2019-12-05 09:07:16 +01:00
Moritz Kiefer
ba30e86911
Split wired-in modules into separate LF packages (#3696)
This is a first step towards making sure that the package ids for
types defined in daml-prim and daml-stdlib don’t change. This PR
mostly adds all the necessary infrastructure for that and moves
GHC.Types and GHC.Prim to make sure it works.

Until data-dependencies are really solid and we have verified that we
no longer have performance issues with an increasing number of Haskell
packages, we still include the source files in daml-prim and then just
rewrite the references.

We will also need to add tests that these packages really have stable
ids but I’ll leave that for separate PRs since this doesn’t make that
much sense anyway until all of the types have moved to stable
packages.

CHANGELOG_BEGIN

- [DAML Compiler] The modules GHC.Prim and GHC.Types from daml-prim
have been moved to separate packages.

CHANGELOG_END
2019-12-04 16:42:48 +01:00
Martin Huschenbett
5c02b1a1c3 Make the daml2ts tests fail on generated unused imports/definitions (#3714)
* Make the daml2ts tests fail on generated unused imports/definitions

* Shut up buildifier
2019-12-04 14:08:50 +00:00
Robert Autenrieth
a827040e4c
Add authentication docs (#3661)
* Add authentication docs

* Use anonymous references

* Update obsolete info on authentication

* Improve authentication intro
2019-12-04 14:51:19 +01:00
Stefano Baghino
50d689d011 Optimize imports in //language-support/java/bindings-rxjava (#3728) 2019-12-04 11:08:13 +00:00
Stefano Baghino
ba0c5e8b30
Add support for authentication to Java command submission client (#3716)
* Add support for authentication to Java command submission client

* Fix compilation error
2019-12-04 11:31:50 +01:00
Stefano Baghino
36da75e1d6
Add authentication support to Java command completion client (#3713)
* Add authentication support to Java command completion client

* Address https://github.com/digital-asset/daml/pull/3713#discussion_r353629606
2019-12-04 11:31:21 +01:00
Stefano Baghino
8d5b4af0f2
Add support for authentication to Java time client (#3721) 2019-12-04 11:00:30 +01:00
Stefano Baghino
8eb5956f31
Add support for authentication to Java package client (#3720) 2019-12-04 10:42:48 +01:00
nickchapman-da
d15b0c7538
Add support for type-synonyms in DAML-LF .proto and Haskell AST (#3703)
* Add support for type-synonyms in DAML-LF .proto and Haskell AST

* address review comments
2019-12-03 14:51:02 +00:00
Martin Huschenbett
7d1068b69d
daml2ts: Avoid 'unused definition' warning for modules without templates (#3698)
We only use the `templateId` function in a module only when the module
contains at least one template definition. Thus, we don't generate it if
there are no modules. That's the only functional change. The other changes
are due to the fact that we want better readability of the code.
2019-12-02 18:21:22 +01:00
Martin Huschenbett
6e6614ae56 daml2ts: Use monoTraverse to collect modules refs in types (#3690)
This was suggested by @corcreature on a previous PR.
2019-12-02 14:56:22 +00:00
Martin Huschenbett
712231c963 daml2ts: Don't produce unused imports (#3689)
Instead of importing _all_ other modules referenced from a module, only
import those that are actually referenced from the generated code. First,
this produces less noise within each generated file. Second and probably
more important, this allows for not generating files without any actual
definition at all.

https://github.com/digital-asset/davl/pull/81 demonstrates the effect of
this change on DAVL.
2019-12-01 11:38:56 +00:00
associahedron
2713d6978d
Reduce SDK tarball size by 70% by deduplicating Scala dependencies. (#3678)
* Start moving all the jars into a single jar.

* Fold navigator into daml-sdk jar

* include sandbox

* Remove unnecessary compileDeps.

CHANGELOG_BEGIN

- [DAML SDK] Reduced the size of the DAML SDK by about
60% uncompressed, 70% compressed, by deduplicating Scala
dependencies.

CHANGELOG_END

* update copyright header

* buildifier fix
2019-11-29 13:26:47 +00:00
Stefano Baghino
0123c659f2 Add authentication support to CommandClient (#3666) 2019-11-29 07:20:39 +00:00
Stefano Baghino
9e9eb68e38 Make ActiveContractsClient work against auth ledgers (#3653)
* Make ActiveContractsClient work against auth ledgers

* Address review comments

- Address https://github.com/digital-asset/daml/pull/3653#discussion_r351667485
- Address https://github.com/digital-asset/daml/pull/3653#discussion_r351667588
2019-11-28 12:36:50 +00:00
nickchapman-da
d3d6891021
Rename daml lf tuples (#3658)
* Rename DAML-LF tuples as structs (structural records)
2019-11-28 07:58:30 +00:00
Brian Healey
02186ef068 Ledger configuration indexing changes (rebased to master) (#3553)
* Add participant-state configuration protobuf

- Move the "DamlConfiguration" from kvutils into participant-state/protobuf/ledger_configuration.proto.
- Add version number and spec (ala transaction.proto)

This is a preparation for indexing the configuration and having one canonical serialization for it.

* Initial thoughts on indexing the configuration

* Implement indexing of ledger configuration changes

* Add record time to all Updates. Wire through participant id.

and rename V7__Add_configuration to V8.

* Add ledger_configuration_java_proto to release artifacts

* Fix up release of ledger_configuration_java_proto

* Suggestions from review

Co-Authored-By: Gerolf Seitz <gerolf.seitz@digitalasset.com>

* Apply suggestions from code review

Co-Authored-By: Gerolf Seitz <gerolf.seitz@digitalasset.com>

* address rebase issues

* Resolve compilation errors after rebase/merge

* happy formatting for scala and bazel and friends

* Drop "openWorld" setting from configuration

And refactor the tests to allocate parties explicitly.

* Fix up migration and tests

* Drop authorizedParticipantIds from configuration

Implement configuration authorization in kvutils using the previous
the participant id of the previous configuration.

* Post-rebase fixes

* Add missing migrations

* Apply suggestions from code review

Co-Authored-By: Gerolf Seitz <gerolf.seitz@digitalasset.com>

* Add missing mavenUpload to ledger-api-server

* Remove stateUpdateRecordTime

* Address code review

- Address PR review
- Merge TimeModelImpl and the traits. Remove TimeModel from ledger-api-common.
- Throw `Err` from KeyValueConsumption on parse errors instead of assert/sys.error

* Reformat

* Add missing protobuf file

* Fix compilation after TimeModel changes. Add version logs to participant-state{,-kvutils}.

* Fix TestUtil.scala build

* Apply suggestions from code review

Co-Authored-By: Gerolf Seitz <gerolf.seitz@digitalasset.com>

* Address review

- synchronized access to ledgerConfiguration in InMemoryLedger
- store rejection if configuration generation is wrong

* Update ledger/participant-state/protobuf/ledger_configuration.rst

Co-Authored-By: Gerolf Seitz <gerolf.seitz@digitalasset.com>
2019-11-27 17:41:23 +01:00
Martin Huschenbett
677b30687f Improve wording of daml2ts readme (#3652) 2019-11-27 16:16:10 +00:00
Remy
5b155409a0 DAML-LF iface reader: rename Map to TextMap (#3610)
CHANGELOG_BEGIN

 [DAM-LF Interface Reader]: **Rename** ``PrimTypeMap`` to ``PrimTypeTextMap`` and ``PrimType.Map`` to ``PrimType.TextMap``

CHANGELOG_END
2019-11-27 14:01:35 +00:00
Stefano Baghino
4d922e763b Add authentication to Java identity client (#3630)
* Add authentication to Java identity client

Contributes to #3626

No changelog added right now, it will be added with the PR that
effectively closes the ticket.

Moves `LedgerCallCredentials` to a shared package.

Establishes the test framework for other Java clients.

* Address https://github.com/digital-asset/daml/pull/3630#discussion_r350663731

* Address https://github.com/digital-asset/daml/pull/3630#discussion_r350663731

* Rebase and fix compilation errors

* Fix type of jar in artifacts.yaml

Co-Authored-By: Gerolf Seitz <gerolf.seitz@digitalasset.com>

* Fix more errors emerged after rebase

* Add dependency for DAML assistant ITs

* Add missing dependency

* Fix wrong dependency

* fix release
2019-11-26 18:51:09 +00:00
Martin Huschenbett
09a681d4f3 Add a readme for daml2ts (#3638) 2019-11-26 17:49:40 +00:00
Stefano Baghino
25f65f746b
Move DamlLedgerClient to builder-based constructors (#3620)
With the intent of adding more functionality to the Java bindings, in
particular authentication, this PR deprecates existing constructors in
favor of a more flexible builder based approach.

CHANGELOG_BEGIN

- [Java Bindings] Deprecated existing constructors for
``DamlLedgerClient``, please use the static ``newBuilder`` method to
instantiate a builder and use it to create the client, starting from
either a ``NettyChannelBuilder`` or a plain host/port pair.

CHANGELOG_END
2019-11-25 23:19:14 +01:00
nickchapman-da
0f0a12db22 Sdk access token file (#3607)
* support --access-token-file in SDK

* rename: HostAndPort -> LedgerArgs; HostAndPortFlags -> LedgerFlags

* integration test for --access-token-file

* doc & more help

* address comments: use FilePath

* adapt to renamed arg: --auth-jwt-hs256-unsafe

* avoid use of single quotes on command line
2019-11-25 17:38:41 +00:00
Stefano Baghino
552bf6497d Obscure shared-secret-based authenticated sandbox (#3609)
The shared-secret-based authentication is there exclusively for testing,
this PR makes sure that this is correctly reported through the CLI and
hides this until further notice.

Makes sure that the flag clearly says that this option is not meant for
production use cases.

A warning is already printed when this feature is used, both at startup
and every time this verifier is used.

CHANGELOG_BEGIN

- [Sandbox] The ``--auth-jwt-hs256`` is renamed to
``--auth-jwt-hs256-unsafe``: you are advised to _not_ use this JWT token
signing way in a production environment.

CHANGELOG_END
2019-11-25 14:27:21 +00:00
Remy
d152c7cbfd daml-lf: rename Map to TextMap in archive proto (#3589)
* daml-lf: rename Map to TextMap in archive proto
+ in Scala/haskell AST

* a bit more renamming

* Update compiler/daml-lf-tools/src/DA/Daml/LF/TypeChecker/Serializability.hs

Co-Authored-By: associahedron <231829+associahedron@users.noreply.github.com>

* fix test

* Apply suggestions from code review

Co-Authored-By: associahedron <231829+associahedron@users.noreply.github.com>

* Update compiler/daml-lf-ast/src/DA/Daml/LF/Ast/Base.hs

Co-Authored-By: associahedron <231829+associahedron@users.noreply.github.com>
2019-11-25 12:14:57 +00:00
Andreas Herrmann
10031a614c Remove all instances of use_default_shell_env = True (#3597)
* use_default_shell_env = False in proto_gen

* use_default_shell_env = False in scala_source_jar

* use_default_shell_env = False in scaladoc_jar

* use_default_shell_env = False in dar_to_scala

* use_default_shell_env = False in _real_pkg_tar

* use_default_shell_env = False in client_server_build

* use_default_shell_env = False in npm_package
2019-11-25 09:15:00 +00:00
Samir Talwar
1bd2ec5b1a grpc-utils: Simpler extractors. (#3594)
* grpc-utils: Simpler GrpcStatus extractors when you know the code.

And don't care about the description.

* grpc-utils: Simpler GrpcException extractors when you know the code.

And don't care about the description.

* Apply suggestions from code review

Co-Authored-By: Stefano Baghino <43749967+stefanobaghino-da@users.noreply.github.com>

* Add `new` to `SpecificGrpc{Exception,Status}` constructor calls.

Also, don't blindly apply GitHub suggestions.
2019-11-22 21:09:17 +00:00
Remy
b506e27bde Java-codegen: add support for Generic Maps. (#3549)
* java-bindings: use LinkedHashMap asunderlying Map for DamlGenMap

* Address Samir's comments

* java-codegen: make DamlList, DamlMap and DamlGenMap immutable

* Address Samir's comments

* Adress Gerolf's comments

* more cleanup

* fix value generator

* Address Gerolf's comments:

CHANGELOG_BEGIN

[Java Bindings]
  * Rename ``DamlMap`` to ``DamlTextMap``
  * ``DamlCollectors`` class provides Collectors to build more easily ``DamlList`` and ``DamlTextMap``
  * Change the recommended method to convert ``DamlValue`` containers from/to Java Bindings containers.
    See `docs/source/app-dev/bindings-java/codegen.rst` for more details the new methodology.

CHANGELOG_END

* fix tests
2019-11-22 08:07:53 +00:00
nickchapman-da
9ab2923814
support authenticating ledgers in haskell ledger bindings (#3561)
* support authenticating ledgers in haskell ledger bindings

* address comments

CHANGELOG

- [Haskell Ledger Bindings] - support for passing `JWT` tokens to authenticating ledgers.
2019-11-21 15:11:33 +00:00
Stefano Baghino
c51ecd3c58
Extractor with authentication (#3514)
* Make Extractor work against Ledger API servers protected by authentication

* Update changelog

* Address https://github.com/digital-asset/daml/pull/3514#pullrequestreview-318811500

- https://github.com/digital-asset/daml/pull/3514#discussion_r347753205
- https://github.com/digital-asset/daml/pull/3514#discussion_r347753629
- https://github.com/digital-asset/daml/pull/3514#discussion_r347754462

* Address https://github.com/digital-asset/daml/pull/3514#discussion_r347755484

* Address https://github.com/digital-asset/daml/pull/3514#discussion_r347752424

* Address https://github.com/digital-asset/daml/pull/3514#discussion_r347756328

* Fix docs

* Fix artifacts.yaml
2019-11-19 17:12:25 +01:00
Martin Huschenbett
c33517cf9f MVP for a daml2ts codegen (#3441)
* MVP for a daml2ts codegen

This PR adds an MVP for a codegen for TypeScript.

Given a DAR, daml2ts replicates the structure of the serializable type
definitions in it as TypeScript type definitions following our JSON
representation of DAML-LF types. It also adds decoders for all these types,
which can be used to check where an arbitray JSON value has the given type.
Finally, daml2ts also produces one JavaScript object for each template, which
reflects the type information of that template.

All produces objects implement some interfaces defined in a TypeScript
library currently called `@digitalasset/daml-json-types`. This libary is not
yet uploaded to NPM but rather included in the `tests/ts/daml-json-types`
directory. This libary also contains the JSON decoders for all of DAML-LF's
builtin types.

There are quite a few limitations right now. Most notably, variant and enum
types are not properly typed right now but rather gradually "typed" as
`unknown`. We also don't support nested `Optional`s, the `Numeric` type or
sum-of-product types in DAML. These issues are tracked in #3518.

There is currently one test. It takes a very simple DAML model, generates
the TypeScript for it and checks that it compiles and contains no linter
warnings/errors. Proper integration tests against the JSON API will follow.

* Address @cocreature's comments

* Make test work on Windows
2019-11-19 15:51:17 +00:00
Remy
027d63a787 java representation for value GenMap (#3515) 2019-11-19 08:53:15 +00:00
Remy
fedc49dd12 leger-api: add GenMap support (#3506)
* leger-api: add GenMap support

* cosmetic

* Address Gerolf's  comment

* add a point in the release notes

* Address Fran's comments
2019-11-18 18:13:25 +00:00
Remy
43eb69cbbd DAML-LF: add GenMap tests for LF encoder (#3491)
* daml-lf: fix decoder

* daml-lf: extend testing dar for encoder

* add EOF to .lf files

* change 1.dev to 1.7 for java codegen encoding test

* formatting

* fixes
2019-11-18 10:07:13 +00:00
Remy
4bd98b6cbc DAML-LF: add GenMap in iface reader (#3487)
* daml-lf: add GenMap in iface reader

* remove useless code

* Update language-support/scala/codegen/src/main/scala/com/digitalasset/codegen/lf/LFUtil.scala

Co-Authored-By: Stephen Compall <stephen.compall@daml.com>

* please restart CI
2019-11-17 08:12:10 +00:00
Gerolf Seitz
172ce90597
Upload codegen fat-jars to maven central (#3476) 2019-11-14 18:40:54 +01:00
Fabio Tudone
011cb0cdcb Fix build command typo in quickstart-scala's README.md (#3459) 2019-11-13 17:18:03 -05:00
Stefano Baghino
f55a044312 Remove font coloring (#3448) 2019-11-13 12:38:22 +00:00
Andreas Herrmann
c7038f128e Fix Bazel warnings (#3414)
* No longer depend on "@bazel_tools//tools/jdk:jar"

To avoid the following warnings
```
WARNING: /home/aj/.cache/bazel/_bazel_aj/c1e06e2358666d118d0ae50e2d32c25d/external/bazel_tools/tools/jdk/BUILD:124:1: in alias rule @bazel_tools//tools/jdk🫙 target '@bazel_tools//tools/jdk:jar' depends on deprecated target '@local_jdk//:jar': Don't depend on targets in the JDK workspace; use @bazel_tools//tools/jdk:current_java_runtime instead (see https://github.com/bazelbuild/bazel/issues/5594)
```

* Targets and files should not share names

To avoid the warning
```
WARNING: /home/aj/tweag.io/da/da-master/compiler/damlc/tests/BUILD.bazel:316:1: target 'simple-dalf.dalf' is both a rule and a file; please choose another name for the rule
```
2019-11-11 15:41:34 +00:00
Stefano Baghino
377b43f2d6
Pass token in individual calls, remove default location for client token (#3403)
* Pass token in individual calls, remove default location for client token

* Fix things for AuthorizationIT

* Fix ledger-service usages of LedgerClient

* Fix remaining compilation errors
2019-11-11 16:22:25 +01:00
Martin Huschenbett
6fe3df57cd Rewrite PRSelf when loading a dependency package (#3406)
When buidling simple project that has our favourite large project as a
dependency, this decreased
- total allocations from 63GB to 57GB
- run time from 34.0s to 31.5s
2019-11-11 08:52:07 +00:00
Remy
d39d7974fc daml-lf: freeze version 1.7 (#3340)
* daml-lf: freeze daml-lf 1.7

* speedy: remove useless double checks
2019-11-07 09:51:18 +00:00
Stefano Baghino
c8aaffd62c Add GrpcException extractor (#3344)
* Add GrpcException extractor

* Use GrpcStatus in integration test

* Fix compilation error

* Fix compilation error

* Address https://github.com/digital-asset/daml/pull/3344#discussion_r342981204

* Restricting extractor types
2019-11-06 14:44:06 +00:00
Remy
2885766826 daml-lf-encoder: validate dar generated by the encoder (#3339) 2019-11-05 15:15:08 +00:00
Stefano Baghino
42051ae037
Add and validate expiration on claims (#3286)
* Add and validate expiration on claims

* Address review comments

* Test existing services for token expiration

* Test expiration mid-stream

* Address https://github.com/digital-asset/daml/pull/3286#pullrequestreview-309710454
2019-10-31 13:14:44 -04:00
Andreas Herrmann
2bd1db490a
Replace bazel-deps by rules_jvm_external (#3253)
* Update bazel-common to fix javadoc issues

Specifically, to fix the following error

```
ERROR: /home/aj/tweag.io/da/da-bazel-1.1/ledger-api/rs-grpc-bridge/BUILD.bazel:7:1: in javadoc_library rule //ledger-api/rs-grpc-bridge:rs-grpc-bridge_javadoc:
Traceback (most recent call last):
        File "/home/aj/tweag.io/da/da-bazel-1.1/ledger-api/rs-grpc-bridge/BUILD.bazel", line 7
                javadoc_library(name = 'rs-grpc-bridge_javadoc')
        File "/home/aj/.cache/bazel/_bazel_aj/5f825ad28f8e070f999ba37395e46ee5/external/com_github_google_bazel_common/tools/javadoc/javadoc.bzl", line 27, in _javadoc_library
                dep.java.transitive_deps
object of type 'JavaSkylarkApiProvider' has no field 'transitive_deps'
```

* Define Maven deps using rules_jvm_external

* Pin artifacts

* Remove bazel-deps generated targets

* Remove bazel-deps

* Switch to rules_jvm_external targets

* update bazel documentation

* pom_file: There are no more bazel-deps targets

* BAZEL-JVM.md `maven_install` typo
2019-10-28 13:53:14 +01:00
Remy
25c3797d89
DAML-LF Numeric: compute properly the value version for + test update (#3122)
* extractor: update test with numerics
* java-codegen: test numeric
* fix some numeric tests
* fix assignVersion for values
2019-10-17 13:17:21 +02:00
Remy
e45b585307 daml-lf: repackage daml-lf archive proto (daml_lf -> daml_lf_dev) (#3169) 2019-10-15 09:36:11 +00:00
Remy
d64df4b5f7 daml-lf: clean achive bazel build (#3175)
* clean the mess in daml-lf achive bazel build

* add release note

* Address Moritz's comments

* more release notes
2019-10-15 08:36:46 +00:00
Remy
fc1a000090 daml-lf: rename daml_lf_archive_scala target to daml_lf_archive_reader (#3168)
* daml-lf: rename daml_lf_archive_scala target to daml_lf_archive_reader

* fix release
2019-10-14 14:53:50 +00:00
Gerolf Seitz
e310cbe143 Fix automatic retry mechanism in scala bindings. (#3061)
* Fix automatic retry mechanism in scala bindings.

This fix only affects the usage of
com.digitalasset.ledger.client.binding.LedgerClientBinding#retryingConfirmedCommands

The retry mechanism didn't distinguish between submission failures and
final completion failures. Retrying completion failures with the same
commandId doesn't make sense, as the deduplication mechanism will kick
in.
The new mechanism now only retries commands with an updated LET and MRT
in case the server responds with a RESOURCE_EXHAUSTED status code (i.e.
backpressure).

Fixes #3057.

* Add UNAVAILABLE as retryable error code

* fix unreleased.rst
2019-10-11 08:17:33 +00:00
Leonid Shlyapnikov
06a4d56025
Scala codegen StackOverflowError fix (#3159)
* introducing map and bimap

not relying on default implementations provided by Traverse and Bitraverse

* lazy collect

* updating release doc

* cleanup

* daml-lf/interface: add foldMap overrides

* implementing `bifoldMap` explicitly for `DefDataType` and `DataType`

* replacing `toStream` with `to[ImmArraySeq]`, updating release notes
2019-10-10 17:15:08 -04:00
Richard Kapolnai
4c280a5f1b Add helper to Java Bindings to prepare transformer for Bot.wire. (#3098)
* Add helper to Java Bindings to prepare transformator for Bot.wire. Fixes #3097

* Java bindings: rename to contractTransformer

Co-Authored-By: Stefano Baghino <43749967+stefanobaghino-da@users.noreply.github.com>

* Rename to transformer

Co-Authored-By: Stefano Baghino <43749967+stefanobaghino-da@users.noreply.github.com>

* Keep error info for invalid class

Co-Authored-By: Stefano Baghino <43749967+stefanobaghino-da@users.noreply.github.com>

* Add generic info to declaration

* Add test for contract tranformer

* Add license header

* Improve contractTransformer by storing reflection results

* Rename folder scala to java

* Add maven coordinates tag

* rename bazel goal back to bindings-java-tests

* integrate contract transformation test with codegen

* manual merge on unreleased.rst

* add daml model for integration testing
2019-10-07 17:38:26 +02:00
Oliver Seeliger
c9658c7813
Multi participant node named logging (#2647) (#3080)
* Upgrade scala-logging and slf4j

* Named logging for multi-participant tests (#2647)
2019-10-03 18:20:57 +02:00
Gary Verhaegen
5e0f664473
fix haskell export script (#3076) 2019-10-03 08:36:14 +02:00
Remy
d540f7aab0 Daml-LF: change Numeric max scale from 38 to 37 (#2969)
* daml-lf: numeric maxScale change from 38 to 37

* daml-lf: update spec

* udpate protobuf comments
2019-09-23 12:39:28 +00:00
Leonid Shlyapnikov
c982478c6e Fixing quickstart-scala example and doc (#2901)
* Fixing quickstart-scala example

* Updating docs

* Adding Scala codegen config

* Minor cleanup

* Apply suggestions from code review

Applying doc changes, thanks @bame-da!

Co-Authored-By: Bernhard Elsner <40762178+bame-da@users.noreply.github.com>
2019-09-16 12:44:04 +00:00
Leonid Shlyapnikov
4a9fb1ccff
DAML assistant codegen command (#2800)
* DAML assistant codegen command, codegen config reader and docs
2019-09-12 14:23:49 -04:00
Stefano Baghino
47d8432670
Panic on interface reader error (#2890) 2019-09-12 15:15:21 +02:00
nickchapman-da
69b520c879
Hlb update and document external build steps (#2769)
* stack setup for HLB and Nim

* build_packages.sh and daml-ledger.cabal

* update README

* export-package for daml-ledger

* export-package, run here

* find tmp daml-ledger

* update README for review comments

* ref daml instructions

* further improve the process and documentation in response to comments

* have -with-rtsopts match the bazel build

* fixes for Gary
2019-09-09 14:37:03 +01:00
Andreas Herrmann
ed39800a9f Rename hazel_deps to hackage_deps (#2789)
* hazel_deps --> hackage_deps

Mechanical change:

```
sed -i 's/hazel_deps/hackage_deps/g' $(ag -l hazel_deps)
```

* Hazel dependencies --> Hackage dependencies
2019-09-06 09:01:09 +00:00
Moritz Kiefer
1fa15ffb1d
Fix typo in filterEverythingForParty in HS ledger bindings (#2771) 2019-09-05 16:08:34 +02:00
Remy
3ee9b83fb1 daml-lf: adapt interface reader to Numeric (#2666) 2019-09-02 10:02:56 +02:00
Remy
20649cf78e ledger-api: rename decimal field to numeric in value Proto (#2688)
* add Numeric.java

* ledger-api: rename `decimal` field to `numeric` in value protobuf

* Address Gerolf's comment

* ledger-api: add missing renammings

* ledger-api: relax syntax of numbers that can be sent as numerics

* extractor:  fix

* leger-api: change format of number though ledger api

* daml-lf: fix numeric regexp

* ledger: fix tests
2019-08-29 22:51:33 +00:00
Moritz Kiefer
3cda28935b Refactor DAR manifest reader (#2699)
* Refactor DAR manifest reader

This PR replaces the ad hoc string munging by a proper parser.

* Fix tests

* Fix more tests

* Factor out isHeaderChar
2019-08-29 10:26:53 +00:00
Moritz Kiefer
96bc868261 Mark Haskell ledger bindings tests flaky on all platforms (#2692) 2019-08-28 15:37:12 +00:00
Remy
6a96060af1 daml-lf: udpate LF protobuf for numerics (#2649)
* daml-lf: update proto for Numerics

* daml-lf: test decoder

* daml-lf: update spec

* daml-lf: polish proto doc

* damlc: address reviewers' comments

* daml-lf: minor fix
2019-08-26 11:55:48 +00:00
nickchapman-da
ea02814b34
hlb, remove dependency on DAML-LF libs (#2650)
* hlb, remove dependency on DAML-LF libs

* Update language-support/hs/bindings/src/DA/Ledger/Services/PackageService.hs

newtype instead of data

Co-Authored-By: Moritz Kiefer <moritz.kiefer@purelyfunctional.org>
2019-08-23 18:00:58 +01:00
Stefano Baghino
d79e03d42c
Ensure uniqueness of decoding and encoding methods (#2651)
Fixes #2367
2019-08-23 17:31:37 +02:00
Remy
9a4dff63b2
daml-lf: introduce Numeric in internal AST (#2608)
* daml-lf: introduce numeric in daml-lf AST
* daml-lf: add test for command preprocessor
* interface-reader: fix for Numerics
* Address Gerolf's review
2019-08-23 15:27:14 +02:00
Moritz Kiefer
67c2e2a9ef
Switch to upstream gRPC-haskell (#2642)
* Switch to upstream gRPC-haskell
2019-08-23 15:10:15 +02:00
Gerolf Seitz
32a61b275f Java Codegen now supports parametrized ContractIds. (#2621)
Fixes #2258
2019-08-22 12:01:22 +00:00
Moritz Kiefer
49b2ec1558
Refactor gRPC request cancellation support in gRPC-haskell (#2626)
* Refactor gRPC request cancellation support in gRPC-haskell

Previously, we had a separate constructor that took an additional
callback that had access to the client call so that we could use that
for cancellation. This PR removes the separate constructor and instead
changes the callback accepted by ClientReaderRequest (and for
consistency also the one accepted by ClientBiDiRequest) to pass the
client call.

This seems like a simpler solution so I’m more hopeful that we will be
able to upstream this change (this is the only API breaking change we
made afaik). There are two caveats here:

1. This will break existing consumers that use ClientReaderRequest. At
this stage in gRPC-haskell this is very reasonable and upstream
doesn’t seem to try very hard to avoid those.

2. The callback is called slightly later than the custom callback we
added before so you have to wait a bit longer until you can cancel
things. At least on our test suite that doesn’t seem to make a
difference.
2019-08-22 12:53:30 +02:00
Bernhard Elsner
d9298c8744 Various improvements to make hs-bindings usable outside repo (#2583) 2019-08-19 16:44:45 +00:00
Bártfai Tamás
a76f82d088 Fix log level for errors in Bot.java (#2581) 2019-08-17 19:42:54 +02:00
Moritz Kiefer
6a0ebc9f5e Go back to building grpc-haskell-core using c2hs (#2574)
* Go back to building grpc-haskell-core using c2hs

This should hopefully avoid issues like the CSize vs CULong issue we
had a while back and might fix some of the issues we have been seeing
on CI.

I’m marking the Haskell ledger bindings as non-flaky for now so we can
see if the issues reappear.

* Fix path

* Fix c2hs runfiles

* s/basedir/dirname/

* Fix varname

* Remove fixme \o/

* Mark hs ledger bindings flaky again
2019-08-16 14:17:11 +00:00
Moritz Kiefer
f3f2d3311b
Remove dependency on isolated sandboxes from HS ledger bindings tests (#2554)
The only tests that relied on this, were the ones for package
management and party management but we can fairly easily remove that
dependency by only checking the diff in packages and thereby folding
the listKnown* and uploadParty/uploadDar file into a combined test.

I’ve also bumped one timeout that I’ve seen fail on CI and managed to
get to fail locally under load.

I am unable to get the tests to fail now locally so I’ve marked them
as non-flaky on everything but Windows (we’ve seen weird segfaults
there).
2019-08-15 11:50:51 +02:00
Moritz Kiefer
ef635ea301
Mark tests that use Haskell gRPC bindings as flaky (#2521)
I’m hoping to investigate this soon but for now this should hopefully
result in less time spend restarting tests.
2019-08-13 20:38:51 +02:00
Gary Verhaegen
99ea93168d
update copyright notices (#2499) 2019-08-13 17:23:03 +01:00
Moritz Kiefer
8f587dc456
Use per-test parties in HS ledger bindings tests (#2481)
* Use per-test parties in HS ledger bindings tests

This should hopefully solve the flakiness issues caused by the reset
service. For now, there is a very small number of tests that we run on
an isolated sandbox namely the tests for party management and package
management.

* shut up hlint

* Disable reset tests
2019-08-12 12:56:18 +02:00
nickchapman-da
5ebc5e4d19
Hlb apps package discovery (#2455)
* suggested tiny code simplifications

* fix package discovery for Nim/Chat ledger apps
2019-08-08 16:50:17 +01:00
Remy
5dd7f1afcf java-codegen: fix broken language-support/java/codegen/src/it/dar/integration-tests-model-1.0.dar (#2443) 2019-08-07 13:56:36 +00:00
nickchapman-da
8f9a781750
hlb, use Int64 / Fixed E10 as appropriate (#2440) 2019-08-07 13:27:58 +01:00
nickchapman-da
2b1204ceac
hlb, fix bug where sandbox is not being run on a dynamically allocated port (#2428) 2019-08-07 11:16:53 +01:00
nickchapman-da
f5688bdc25
hlb, cleanup daml used for tests (#2370) 2019-08-01 22:24:54 +01:00
nickchapman-da
1c12354f38
hlb, reformat all the types (#2369) 2019-08-01 22:24:28 +01:00
nickchapman-da
662361ac47
hlb, convert all the values (#2368) 2019-08-01 15:27:14 +01:00
Gary Verhaegen
568403210b
hs-bindings readme: fix link (#2349) 2019-07-31 14:22:01 +01:00
Gary Verhaegen
0b8933627c record Nick's comments on hs ledger bindings (#2340) 2019-07-30 16:25:19 +00:00
nickchapman-da
8b5cd613f4
hlb, no wildcard record construction (#2332)
* remove: type Status = LL.Status

* no {..} in record construction
2019-07-30 13:47:09 +01:00
Moritz Kiefer
50a04397e4
Supporting producing sdist tarballs for the HS ledger bindings (#2336)
* Supporting producing sdist tarballs for the HS ledger bindings

The README.md has an explanation for how you can use this.

This should hopefully allow others to experiment with the bindings.
2019-07-30 14:34:16 +02:00
Stefano Baghino
340a4eb6a4
Read stakeholders through the active contract service (#2316)
* Read stakeholders through the active contract service

Fixes #2070

Also standardizes the use of American English spelling for `serialize`
and `deserialize`. Standardize. Serialize. Americanize.

* Remove Haskell bindings test workaround

* Address https://github.com/digital-asset/daml/pull/2316#discussion_r308193661
2019-07-30 10:40:45 +02:00
nickchapman-da
53eed132db
fix missing Status info in Completion (#2321) 2019-07-30 09:23:54 +01:00
nickchapman-da
b90862ebec
improve haskell module hierarchy to be more consistent (#2319) 2019-07-29 15:55:55 +01:00
Gerolf Seitz
136f6d1c08
Remove ExercisedEvent#contract_creating_event_id. (#2262)
This is a breaking change on the ledger api. So far we could rely on the
assumption that contractId == eventId. This assumption doesn't hold
anymore in a daml-on-x setting, where the eventId is created by the
api server, but the absolute contractId is created by the ledger
implementation.

Instead of going through weird contortions to store the relevant data in
the existing database schema, it is more viable in the long term to
remove that field and instead provide facilities to lookup transactions
by contractId.

Contributes to #2068.
2019-07-29 11:30:01 +02:00
Gerolf Seitz
c1608604ae
Add all packages in bindings-(rx)java to the javadoc (#2284)
Fixes #2280
2019-07-29 09:54:13 +02:00
nickchapman-da
77ed83b5b7
assert the reset service has worked as expected (#2305)
* assert the reset service has worked as expected

* flipping hlint
2019-07-26 18:46:52 +01:00
nickchapman-da
7064953a13
hlb, support: PartyManagementService (#2300)
* small refactorings in response to previous PR

* hlb, support: PartyManagementService
2019-07-26 16:47:01 +01:00
Michał Majcherski
37a921516b
Upgrade gRPC JVM libs (#2276)
* Haskell ledger bindings tests setup fix - use --port-file to obtain sandbox's port

* Update gRPC JVM libs

* Add missing gRPC core dependency

* Redirect sandbox's stdout and stderr to /dev/null

* Amend ledger's NettyServerBuilder settings after gRPC upgrade
2019-07-26 14:44:59 +02:00
nickchapman-da
7d7ee965d9
fix retry handling for issue #2260 (#2294) 2019-07-26 13:44:40 +01:00
nickchapman-da
49e21660f1
support --host option for daml deploy command (#2285) 2019-07-25 12:26:07 +01:00
nickchapman-da
b30228ab95
{-# LANGUAGE OverloadedStrings #-} is now on by default (#2270) 2019-07-24 08:09:26 +01:00
Remy
53de5edbc1 ledger-api: Kill legacy identifier (#2211)
* ledger-api: drop support for legacy identifier

* address scala-codegen: Stephen's comments

* language support: fix test
2019-07-23 20:34:52 +00:00
nickchapman-da
d306814193
hlb, support: CommandService, all 4 RPCs (#2267) 2019-07-23 17:29:30 +01:00
nickchapman-da
dd09c42210
hlb, support: RPC ListKnownPackages (#2261) 2019-07-23 14:09:58 +01:00
nickchapman-da
eec0333c73
support TimeService RPCs in haskell ledger bindings (#2247) 2019-07-23 09:42:36 +01:00
nickchapman-da
a31d5f04e1
go all-in on RecordWildcard syntax: {..} (#2212) 2019-07-18 12:36:45 +01:00
nickchapman-da
83e01d42eb
cleanup and refactor code structure for nim/chat ledger apps (#2210) 2019-07-18 12:36:19 +01:00
Michał Majcherski
76f877e71d
Haskell ledger bindings - multiple reset test (#2185) 2019-07-17 17:17:29 +02:00
Andreas Herrmann
63b46304eb
Base DA.Bazel.Runfiles on bazel-runfiles (#2147)
* DA.Bazel.Runfiles based on bazel-runfiles

* locateRunfilesMb -> locateRunfiles

* .exe extension on Windows

* Add docstring to locateRunfiles

* bazel-runfiles: Normalize on Windows
2019-07-17 09:48:44 +02:00
nickchapman-da
102cca04cd
haskell ledger bindings, support uploadDarFile (#2146)
* support uploadDarFile

* comment

* move uploadDarFileGetPid into test code
2019-07-15 16:06:41 +01:00
Remy
7c8bb0257d java-codegen: add integration tests for lf 1.5 (#2143)
* java-codegen: add integration tests for lf 1.5

* formatting

* java-codegen: add README abotu tests organization
2019-07-15 14:35:35 +00:00
nickchapman-da
63dd57ab19
fix nim/chat apps (#2120) 2019-07-15 08:57:43 +01:00
Remy
e7bbf87692 Freeze DAML-LF version 1.6 (#1937)
* daml-lf: cosmetic

* daml-lf: release V1.6

* daml-lf: update spec

* update unreleased.rst

* Address Martin's comments

* damlc: active daml-lf-target 1.6

* lf-encoder: fix testing dar generation

* daml-lf spec: simplify 1.dev description

* daml-lf: fix engine test

* daml-lf: fix version timeline

* extractor: fix test

* Address Stephen's comments

* Add more meat to the release notes

* java-codegen: update docs

* damlc: set 1.6 as default output version

* java-codegen update integration tests

* undo replicating typo

* release notes

* scala-codegen: update test

* java-codegen: fix doc

* extractor: fix  test

* address Gerolf's comments

* realse-notes: cleanup unreleased.rst

* Address last comment from Stephen

+ cosmetic cleanup

* formatting
2019-07-12 19:06:44 +00:00
nickchapman-da
4909ee1f01
refactor Stream -> StreamCore/StreamExtra (#2114) 2019-07-11 18:52:50 +01:00
nickchapman-da
a183df6585
haskell ledger bindings: improve thread handling (#2096)
* no forkIO

* mask_ body of asyncStreamGen

* reinstate flaky = True

* use: MonadUnliftIO

* thank you HLint
2019-07-11 17:25:02 +01:00
Gabor Aranyossy
33c746fe9b loading Dars from ZipInputStreams (#2005)
* loading Dars from ZipInputStreams

formatting and cleanup

fixing DarReaderTest not compiling

fmt

using IOUtils to read the ZipInputStream

fixing CodeGen

fixing broken legacy DAR loading

fixed v2 ReferenceServer

cleanup

* fixing rebase conflicts

* introduced a fromFile method to avoid having to do boiler-plating where the input is a File

* addressing leaking resources

* cleanup

* inlining closures

* closing the darStream
2019-07-11 15:37:21 +00:00
nickchapman-da
c41aca5b64
haskell ledger bindings -- LedgerConfigurationService (#2075)
* support: LedgerConfigurationService

* add da_haskell_repl target for haskell legdger bindings build

* address review comments

* fmt
2019-07-10 11:35:46 +01:00
nickchapman-da
5296f0253e
support: ActiveContractsService (#2067) 2019-07-09 15:09:55 +01:00
nickchapman-da
7a981d0e33
preserve [Transaction] per stream element in getTransactions rpc-wrapper, matching the .proto definition (#2054) 2019-07-09 10:35:34 +01:00
nickchapman-da
85a5222a28
Hlb address review comments (#2034)
* inline Convert.lowerList

* newtype Verbosity

* generalize type for raiseMap, and add comment
2019-07-08 16:28:07 +01:00
nickchapman-da
74b684ee0a
Hlb transaction service (#2029)
* support rpc: GetFlatTransactionByEventId

* support rpc: GetFlatTransactionById

* test: GetTransactions

* support rpc: GetTransactionTrees, and types: TransactionTree,TreeEvent

* reorder TransactionService.hs to match .proto

* rpcs: GetTransactionByEventId, GetTransactionById
2019-07-05 17:20:08 +01:00
Gary Verhaegen
acbc5de820 remove some build warnings (#2012) 2019-07-04 22:07:49 +00:00
Brian Healey
ecbe0b15b5 resolve daml warnings for language-support (#1995)
* resolve daml warnings for language-support

* resolve warnings for generated very large archive daml
2019-07-03 17:48:42 +00:00
nickchapman-da
f3ae835d30
Hlb optional offset in command completion (#1989)
* dont drop error info when not StatusOk

* CommandCompletionService supports optional offset; adapt tests
2019-07-03 14:32:46 +01:00
Stefano Baghino
4774e75eb8 The completion stream RPC defaults to the ledger end as offset (#1961)
* The completion stream RPC defaults to the ledger end as offset

Fixes #1913

Relevant changes are propagated to the Java bindings (including
deprecating a method that would now return a nullable ledger end).

* Refactor completionStream method

* Address review comments

- ignore command creation results
(https://github.com/digital-asset/daml/pull/1961#discussion_r299089539)
- avoid re-connecting to the client for every command
(https://github.com/digital-asset/daml/pull/1961#discussion_r299092328)
- move offset field optionality to domain object
(https://github.com/digital-asset/daml/pull/1961#discussion_r299090451)

* Improve tests
2019-07-02 10:02:43 +00:00
Gabor Aranyossy
709112e92b fixing issue of returning inclusive ledger offsets with completions (#1932)
* fixing issue of returning inclusive ledger offsets with completions

* changelog update

* removed TODO

* fixing haskell tests
2019-07-01 07:45:26 +00:00
Stefano Baghino
3dc0c02766
Add contract key support to Scala bindings and navigator (#1950)
* Expose the contract key in the Scala bindings

* Expose contract keys on the navigator

* Update release notes

* Remove ui-backend.conf file from navigator scenario

Addresses https://github.com/digital-asset/daml/pull/1950#discussion_r298814223

* Fix broken docstring reference to DamlLfDefRef

Addresses https://github.com/digital-asset/daml/pull/1950#discussion_r298814301
2019-06-30 20:57:55 +02:00
Michał Majcherski
2afefb7883
windows: root build (#1894)
* windows: root build

* windows: fixed haskell bindings tests

* windows: disable client_server_test test

* windows: marking daml_test flaky due to #1907

* windows: removing da-hs-damlc-app run from build.ps1

* windows: disable hie-core alias of currently disabled target
2019-06-28 12:55:31 +02:00
Stefano Baghino
2f319315a9 Mark Haskell bindings tests as flaky until #1927 is fixed (#1928) 2019-06-28 08:37:06 +00:00
nickchapman-da
0473734359
Hlb wrap more services (#1904)
* support: CommandCompletionService.completionEnd

* support checkpoints from: CommandCompletionService.completionStream

* address review comments

* add type for LedgerOffset; prefer AbsOffset when known

* extend submit/complete testcase
2019-06-27 15:30:47 +01:00
Remy
6cd3f93d2e scala-codegen: add support for enum type (#1833)
* scala-codege: add support for enum type

* formatting

* first part of Stephen comments

* Address Stephen's comments
2019-06-26 17:50:37 +00:00
Stefano Baghino
f8bebffb4e Expose signatories and observers throughout the platform (#1814)
* Add signatories and observers to Ledger API

Cascade fixes deriving from compilation and test errors.

* Add signatories and observers to Java bindings and codegen

* Add signatories and observers to Scala bindings and codegen

* Add signatories and observers to navigator

* Add signatories and observers to the Haskell bindings

* Add integration test

* Comply with formatting standard

* Add release notes

* Apply edits from CI feedback and self-review

* Fix wrong input on test case for observers sorting

Co-Authored-By: Robert Autenrieth <31539813+rautenrieth-da@users.noreply.github.com>

* Read JSON as strings from DB, parse them as parties

Address https://github.com/digital-asset/daml/pull/1814#discussion_r296405252

* Change parties rendering and observer display condition

Address https://github.com/digital-asset/daml/pull/1814#discussion_r296390104

* Fix sorting tests, implement sorting by agreement

Address https://github.com/digital-asset/daml/pull/1814#discussion_r296397390

FIXME notes have been added for suspicious test cases

* Prevent any mutation of CreatedEvent arguments

Address https://github.com/digital-asset/daml/pull/1814#discussion_r296572639

* Comply with formatting standard

* Stakeholders are filtered up to the witnesses

Addresses https://github.com/digital-asset/daml/pull/1814#discussion_r297102521
2019-06-26 14:02:59 +00:00
Remy
41574d33f7 java-codegen: Add support for enum types (#1648)
* java-codegen: add support for Enum

* Address Stefano's comment
2019-06-26 11:50:25 +00:00
nickchapman-da
eba9af48ac
Hlb review comments (#1881)
* Define LedgerService using ReaderT to avoid boilerplate
* re-export TimeoutSeconds from GRPC.HighLevel.Client, instead of defining as a newtype
* rename: Valuable -> IsLedgerValue
2019-06-26 11:02:12 +01:00
nickchapman-da
4432a79407
refactor (#1865) 2019-06-26 08:09:08 +01:00
Gerolf Seitz
b0a465784e
Add grpc-netty as dep for bindings-java. publish daml-lf-archive (#1798)
We add a dependency in bindings-java to grpc-netty, so it is
automatically available in the classpath for users. Otherwise they get
an error like [0] if they don't add it explicitly.

We also publish daml-lf-archive-java to maven central.

[0] io.grpc.ManagedChannelProvider$ProviderNotFoundException: No
functional channel service provider found. Try adding a dependency
on the grpc-okhttp, grpc-netty, or grpc-netty-shaded artifact
2019-06-24 08:16:31 +02:00
Moritz Kiefer
c5cce0b22c [hs-ledger-bindings tests] Read the main dalf from the DAR manifest (#1803)
Previously, we got the package id by listing all packages and taking
the first. That is not a valid assumption and broke with a PR. This PR
changes the tests to use the DAR reader that we already used for
visualization (now factored into a separate library) and reads the
main dalf using that.
2019-06-21 15:32:40 +00:00
Robert Autenrieth
c14b909c71 Implement package management API in the sandbox (#1610)
* store archive size in `DarReader`

* rename `SandboxTemplateStore` to `SandboxPackageStore`

* store package info in `SandboxPackageStore`

* introduce package upload / read to write / index services

not tested yet, just a ton of plumbing

* WIP test the package service

* Fix build errors after rebase

* Move packages service to v2

* Ledger API client uses ledger API types

* Fix ReflectionIT

* Correctly handle uploading invalid dar files

* Fix reading DAR entry file sizes

* Improve package management IT

* Improve handling of duplicate packages

* Fix language-support build

* Use unique party and command names

* Rename lfpackage to language

* Rename SandboxPackageStore to InMemoryPackageStore

* Remove getCurrentTime ledger method

* Improve package management IT

* Move InMemoryActiveContracts and InMemoryPackageStore

* Use case object for UploadDarResult.Ok

* Address review comments

* Update release notes

Fixes #1311

* Use BazelRunfiles in test
2019-06-19 12:31:53 +00:00
Stefano Baghino
656e456b78 Add ExerciseByKey command to Ledger API (#1724)
Fixes #1366

Also adds support for the new command to the Java bindings and codegen
2019-06-19 09:11:52 +00:00
Stefano Baghino
02e950394d Support generic types as contract keys in codegen (#1743)
Fixes #1728
2019-06-18 14:54:23 +00:00
Nick Smith
0c0e4231f3
Fixes #1204: Release bindings and codegens to Maven Central. (#1205)
* Fixes #1204: Release bindings and codegens to Maven Central.

Upload the Java and Scala Bindings with the respective code
generator binaries to Sonatype Open Source Repository
Host for synchronization with Maven Central.
2019-06-17 15:37:49 +02:00
nickchapman-da
8cd1bc738c
GroupChat, take 2 (#1671)
* GroupChat, take 2
* GroupChat, last member may leave
* Add origin field into Group to support the group identity
2019-06-17 10:01:25 +01:00
nickchapman-da
fab80b7813
remove duplicate grpc example (#1679) 2019-06-17 09:56:03 +01:00
Stefano Baghino
ee3dae56e2
Add contract key support for created events to Haskell bindings (#1689)
Fixes #1688
2019-06-17 10:52:31 +02:00
Stefano Baghino
6ba26f4e1f Add contract keys to created events in the Ledger API (#1586)
* Add contract keys to created events in the Ledger API

Fixes #1268

* Update ledger/ledger-api-integration-tests/src/test/itsuite/scala/com/digitalasset/platform/tests/integration/ledger/api/TransactionServiceIT.scala

Co-Authored-By: Stephen Compall <scompall@nocandysw.com>

* Update language-support/java/bindings-rxjava/src/test/scala/com/daml/ledger/rxjava/grpc/helpers/TransactionGenerator.scala

Co-Authored-By: Stephen Compall <scompall@nocandysw.com>

* Update ledger/ledger-api-integration-tests/src/test/itsuite/scala/com/digitalasset/platform/tests/integration/ledger/api/TransactionServiceIT.scala

Co-Authored-By: Stephen Compall <scompall@nocandysw.com>

* Add run suffix to transaction service integration tests

Addresses https://github.com/digital-asset/daml/pull/1586#discussion_r293233810
Addresses https://github.com/digital-asset/daml/pull/1586#discussion_r293233886

* Re-introduce unused bindings

Addresses https://github.com/digital-asset/daml/pull/1586#discussion_r293056685
Addresses https://github.com/digital-asset/daml/pull/1586#discussion_r293056741

* Update ledger/ledger-api-common/src/main/scala/com/digitalasset/platform/participant/util/LfEngineToApi.scala

Co-Authored-By: Stephen Compall <scompall@nocandysw.com>

* Use newly introduce assertOrRuntimeEx method

Applies the suggestion introduced by 7cc5c3eb71

* Contract keys to be typed after generated types

Also adds support in daml-lf/interface for contract keys

Addresses https://github.com/digital-asset/daml/pull/1586#pullrequestreview-249431707

* Address https://github.com/digital-asset/daml/pull/1586#discussion_r293773427

* Fix compilation error from previous commit

* Fix compilation errors in navigator
2019-06-14 16:45:12 +00:00
nickchapman-da
106e90e8a6
Group chat daml model (#1618)
Nim:
* fix index numbering in demo.md
* add in game "help" command to show available commands
* small code simplification for code review

GroupChat:
* DAML chat-room model, with support for multiple chat-groups with entry by invitation
* simplify: pass Invitation
* fix bug spotted by Bernhard -- Gain access to a Group without a valid invite
2019-06-13 11:06:49 +01:00
Remy
0591075187 cleanup daml-lf scala packages (#1581)
* cleanup daml-lf scala packages

* Address Stephen's Comments

* update maven coordinates of language package
2019-06-12 15:55:48 +00:00
Leonid Shlyapnikov
3eab89e6c6
Custom bindings doc + iou-no-codegen scala example (#1569)
* Custom bindings doc + iou-no-codegen scala example

* Fixing formatting

* Review suggestion

Co-Authored-By: Stephen Compall <scompall@nocandysw.com>

* Adding bazel build for `language-support/scala/examples/iou-no-codegen`

* Review suggestions

* Final touches + addressing review comments

* Adding notes about codegen alternatives

* Removing detectedOs lazy val
2019-06-12 09:26:54 -04:00
Nick Smith
7575f8cb0e
Buildsystem scala sources improvements (#1602)
* Fixes #1600. Improve Bazel Scala source JAR generation.

Include sources from JAR files defined as 'sources' to a Bazel Scala
target. The improvement will allow inclusion of generated source targets
in sources JARs of dependencies.

* Use temporary directory in the dar_to_scala() rule.

Place the output of the Scala code generator in a temporary
directory instead of a directory at the 'primary' output path as Bazel
rules should never have directory dependencies.
2019-06-12 14:45:54 +02:00
Jost Berthold
b0b3e29c49
language-support/scala: add support for specifying dependency roots explicitly (#1210)
* language-support/scala: add support for specifying roots explicitly

By default, code-gen will use all templates in the given package as roots, and
generate code for all types used. This patch adds the ability to specify roots
explicitly via a set of regex.es to match the (fully qualified) template names.

This is an experiment, tests and UI need to be adjusted later.

* scala codegen rootfilter: move filtering to envIFace handling

* doc for --root option

* scalafmt

* test filterTemplatesBy

* release note for --root Scala codegen option
2019-06-12 11:10:23 +10:00
Stephen Compall
cc21c78be2
Scala ecosystem: discourage Identifier name in scala primitive (#1570)
* Primitive.LegacyTemplateId replaces 2-tuple TemplateId.unapply; 3-tuple variant introduced

* ensure the suggested replacements are well-typed and behaved

* suggest LegacyTemplateId for 2-valued form
2019-06-11 17:31:28 -04:00
Leonid Shlyapnikov
8ed703e14d Removing damlc dependency (#1588)
quickstart-scala example does not buld DAR from SBT
2019-06-11 18:17:51 +00:00
Beth Aitman
e6c1d1e414 Suggestions for demo instructions (#1580) 2019-06-11 11:25:27 +01:00