Commit Graph

38 Commits

Author SHA1 Message Date
Gary Verhaegen
9de4c8e780
gsg test: fix ts error in recent versions (#16010) 2023-01-09 09:48:02 +00:00
azure-pipelines[bot]
4becc947a7
bump canton to 20221213 (#15886)
Co-authored-by: Azure Pipelines Daml Build <support@digitalasset.com>
Co-authored-by: Rafael Guglielmetti <rafael.guglielmetti@digitalasset.com>
Co-authored-by: Remy Haemmerle <Remy.Haemmerle@daml.com>
2022-12-15 09:25:54 +00:00
Gary Verhaegen
76d65f51ea
fix node 18 again (other issue) (#15717)
It looks like, at least on some machnes, recent Node versions will not
resove localhost to 127.0.0.1 anymore.

There wasn't really a good reason for us going through DNS resolution
for these anyway, so here's a simple fix. Hopefully.
2022-11-28 20:04:33 +01:00
Gary Verhaegen
b749828b43
update & pin puppeteer dependencies for gsg test (#15584)
Not that I relish the added flakiness on CI, but I want to be able to
run those tests locally.
2022-11-25 00:23:56 +01:00
Gary Verhaegen
dd5543eaf2
create-daml-app: make tests pass on m1 (#15031)
This is very much a "just make it work" type of patch. The main issues
were:

- A bunch of type errors in the `index.test.ts` file when opened in VS
  Code. I'm not sure how it happened, but it's possible I'm just using a
  more recent TS compiler than whoever edited this last.
- `localhost`, on my machine at least, resolves to `::1`, and therefore
  the connections were just not established. I've opted for replacing
  `localhost` with explicit `127.0.0.1`.
- `npm-cli.js` was not an executable in my `PATH`, and won't be for
  most users, but `npm` is not on our testing infrastructure's `PATH`.

Those tests are obviously not tested by CI, so please review carefully /
test this on your own machine before approving.

CHANGELOG_BEGIN
CHANGELOG_END
2022-09-23 04:57:47 +02:00
Moritz Kiefer
a230de2f82
Support getting started guide on Daml Hub (#12878)
* Support getting started guide on Daml Hub

This is annoyingly complex so let me try to provide an explanation for
the changes:

1. On Daml hub, we need to use a separate token for the public party
   and the user party.
2. This means that we need separate contexts. I cannot get access to
   the default context (not exposed) so annoyingly even for the user context we need to
   use a custom context
3. The way to get access to the public party in Daml hub is via a
   hook that reads it from the context. However, we cannot call that
   within the login callback so the way things work now that we login
   immediately show a "Logging in..." loading screen while we run the
   background query. This is actually kinda nice since it means
   something happens immediately after clicking login.

I’m sure there are better ways of handling this, my react foo is very
weak but this is what I managed to get to work.

Tested locally as well as on Daml hub and both work fine.

changelog_begin
changelog_end

.

.

.

.

.

.

.

* s/any/void/

* fmt
2022-02-11 16:41:07 +00:00
Victor Peter Rouven Müller
c0c40bd10f
Add autoformatting to ts bindings & navigator frontend (#12693)
* Add autoformatting for the ts&tsx files (typescript effectively)

changelog_begin
changelog_end

* Format ts files

* Fix ts linter warnings
2022-02-11 11:44:52 +00:00
Moritz Kiefer
5b4fdf0757
Create alias contracts in frontend in create-daml-app (#12848)
* Create alias contracts in frontend in create-daml-app

Creating them in the setup script is nice but it makes it much harder
to port this to Daml hub where we cannot rely on this.

This also requires figuring out the public party in the frontend.

I’ve chosen to infer it from the user rights which seems broadly
sensible.

For the backwards compat mode, I just hardcoded it because there isn’t
a great way to figure it out.

changelog_begin
changelog_end

* .

changelog_begin
changelog_end
2022-02-10 15:04:13 +01:00
Moritz Kiefer
8b8ee4c9e5
Bump Canton and reenable tests (#12852)
* Bump Canton and reenable tests

fixes #12808

changelog_begin
changelog_end

* display names are no longer defaulted

changelog_begin
changelog_end

* topology-change-delay is redundant

changelog_begin
changelog_end

* Switch away from grpcurl

changelog_begin
changelog_end

* try to fix canton conformance tests

changelog_begin
changelog_end

* that’s not how you scala

changelog_begin
changelog_end
2022-02-10 08:13:44 +01:00
pbatko-da
f2b7902c68
[User management] Add CreateUserResponse and GetUserResponse gRPC response wrappers [DPP-854] (#12682)
changelog_begin
Ledger API Specification: CreateUser and GetUser endpoints of UserManagementService now return the CreateUserResponse or GetUserResponse messages, whereas previously they were returning the User message).
changelog_end
2022-02-08 12:29:57 +01:00
Robin Krom
9e1fe24f71
cda: use aliases in the first feature section of docs (#12720)
CHANGELOG_BEGIN
CHANGELOG_END
2022-02-03 18:12:56 +01:00
Moritz Kiefer
2ca639ff64
Bump timeout of create-daml-app tests (#12727)
changelog_begin
changelog_end
2022-02-02 21:18:13 +00:00
Robin Krom
0029c6c981
cda: use canton for the create-daml-app tests (#12625)
CHANGELOG_BEGIN
CHANGELOG_END
2022-02-02 17:04:47 +01:00
pbatko-da
4ec336dd6a
[User management] Enforce 1k user rights limit [DPP-833] (#12558)
CHANGELOG_BEGIN
Ledger API Specification: Maximum number of user rights per user is now limited to 1000 and is added to UserManagementFeature in VersionService. getLedgerApiVersion endpoint.
CHANGELOG_END
2022-01-27 22:12:34 +01:00
Robin Krom
345e26790c
create-daml-app: Use alias templates for display names (#12390)
* create-daml-app: Use alias templates for display names

We introduce Alias contracts to the create-daml-app Daml model and use
them to display aliases in the UI instead of party identifier strings.

CHANGELOG_BEGIN
CHANGELOG_END

* fix tests

* addressing review

* Add comments to Setup.daml

* factor out alias to option conversion

CHANGELOG_BEGIN
CHANGELOG_END

* small fix in setup.daml

* replace user dropdown with input in login screen

* fix compatibility tests

* fix alias loading flick in mainscreen

* remove canton incompatible sandbox options from daml.yaml

* fix gsg-trigger.patc
2022-01-27 14:07:39 +01:00
Moritz Kiefer
fbf244e2f8
alert on invalid users in create-daml-app (#12518)
`alert` isn’t exactly great error handling but matches what we do in
other places of create-daml-app and I’m not all that keen on reworking
that everywhere for 2.0

fixes #12275

changelog_begin
changelog_end
2022-01-23 10:28:48 +01:00
Sofia Faro
a0aee0f248
Rename daml sandbox to daml sandbox-kv (#12394)
* Rename daml sandbox to daml sandbox-kv

Also drop the default sandbox on `daml start`

Part of #11831

changelog_begin
changelog_end

* update release test instructions

* try to fix a couple compat tests

* dont need special 0.0.0 logic

* buildifier-fixx
2022-01-17 10:36:06 +00:00
Moritz Kiefer
2783b7bdad
Support user management in create-daml-app (#12089)
fixes #11998

changelog_begin
changelog_end
2022-01-07 12:45:13 +00:00
Gary Verhaegen
ea55ea2d14
Further copyright updates (#12249)
Somewhat error-prone, so please review carefully.

Reasons we need this:

- Some file types are not properly handled by the script.
- The only exclusion mechanism we currently have (`NO_AUTO_COPYRIGHT`)
  is overly coarse.

CHANGELOG_BEGIN
CHANGELOG_END
2022-01-04 16:32:17 +01:00
Stefano Baghino
05505e3d03
Multiplex multiple virtual query streams through a single web socket (#10221)
* Initial work-in-progress

changelog_begin
[TS bindings] When using daml-react and daml-ledger, all streaming request to the query endpoint will be multiplexed through a single web socket.
changelog_end

* Minor touches, renaming

* Handle offsets received from the JSON API

* Create state array once per downstream consumer

* Handle reconnections as streamSubmit does

* Don't share mutable state between events

* Fix compilation errors

* Remove language-support/ts/package-lock.json

* Remove --downlevelIteration option, materialize iterators, fix one test

* I will refrain from commenting on the meaning of `this` in JavaScript

* WebSocket does not have a removeAllListeners method

* Remove unnecessary docstring from `handleQueriesChange`

* Address https://github.com/digital-asset/daml/pull/10221#discussion_r670441680

* Address https://github.com/digital-asset/daml/pull/10221#discussion_r670427941

* Address https://github.com/digital-asset/daml/pull/10221#discussion_r670448474

* Address https://github.com/digital-asset/daml/pull/10221#discussion_r670473307

* Fix some failing tests and linting fixes

* fix reconnect on server close test

* fix failing tests in test.ts and create-daml-app tests

* Update language-support/ts/daml-ledger/index.ts

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

* Update language-support/ts/daml-ledger/index.ts

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

* Update language-support/ts/daml-ledger/index.test.ts

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

* Update language-support/ts/daml-ledger/index.test.ts

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

* changes based on code review comments

Co-authored-by: Akshay <akshay.shirahatti@digitalasset.com>
Co-authored-by: akshayshirahatti-da <86774832+akshayshirahatti-da@users.noreply.github.com>
2021-10-29 09:20:33 +01:00
Moritz Kiefer
c8cede074e
Bump startup time in create-daml-app tests (#11261)
We’ve seen this timeout a few times on CI. The version in the compat
tests already has a 60s timeout and that seems to work better so
here’s to hoping this helps.

I’ve also added some logs to see where it stops if it times out
again (jest hides console.log by default which is why this uses
console.debug by default).

changelog_begin
changelog_end
2021-10-15 14:53:43 +02:00
Gary Verhaegen
79080839c1
add Auth0 support to create-daml-app (#10673)
As I was adding support to a sample app for the third time, I decided I
might as well clean it up a bit and add support for everyone.

This is completely optional, activated by (build-time) environment
variables, and should be trivial to remove for users who don't care
about it. In an ideal world we'd have options to `daml new` and this
would be one, but I think adding it out-of-the-box is a better
alternative than letting people figure this out on their own.

CHANGELOG_BEGIN
- The `create-daml-app` template now includes support for a third
  authentication scheme (in addition to the existing "dev mode" and Daml
  Hub support): Auth0.
CHANGELOG_END
2021-09-14 15:56:45 +02:00
Moritz Kiefer
46a66e2f2a
Upgrade jest to the latest version (#10107)
This ends up transitively bumping yargs-parser which has a
vulnerability but more generally I also just like being on the latest version.

changelog_begin
changelog_end
2021-06-24 11:16:29 +00:00
Bernhard Elsner
cda93db944
Daml case and logo (#8433)
* Replace many occurrences of DAML with Daml

* Update docs logo

* A few more CLI occurrences

CHANGELOG_BEGIN
- Change DAML capitalization and docs logo
CHANGELOG_END

* Fix some over-eager replacements

* A few mor occurrences in md files

* Address comments in *.proto files

* Change case in comments and strings in .ts files

* Revert changes to frozen proto files

* Also revert LF 1.11

* Update get-daml.sh

* Update windows installer

* Include .py files

* Include comments in .daml files

* More instances in the assistant CLI

* some more help texts
2021-01-08 12:50:15 +00:00
Gary Verhaegen
427179ab27
fix (some) copyright headers (#8422)
This commit fixes a few copyright headers that have been missed in the
automatic update on Jan 1, as well as the generation code in the compat
workspace so it generates the right headers.

CHANGELOG_BEGIN
CHANGELOG_END
2021-01-07 11:48:59 +01:00
Gary Verhaegen
a925f0174c
update copyright notices for 2021 (#8257)
* update copyright notices for 2021

To be merged on 2021-01-01.

CHANGELOG_BEGIN
CHANGELOG_END

* patch-bazel-windows & da-ghc-lib
2021-01-01 19:49:51 +01:00
Gary Verhaegen
ebde049cc6
@daml/react: support for multi-{key,query} streams (#7789)
This follows up on #7066 and exposes the new underlying multi-key and
multi-query stream functions through the React bindings. Following the
same reasoning as in #7066, we therefore deprecate the existing
functions (with no intention of removing them) as they become redundant.

CHANGELOG_BEGIN
* JavaScript Client Libraries: Updated React bindings to expose the
  recent addition of multi-key and multi-query streams in @daml/ledger.
  The singular versions are marked as deprecated as they have become
  redundant.

  The upgrade path for `useStreamQuery` is very straightforward: the
  query factory remains optional, but if specified it should return an
  array of queries instead of a single query. The array may be empty,
  which will return all contracts for that template (similar as not
  passing in a query factory). The return values of `useStreamQuery` and
  `useStreamQueries` are the same type.
  ```
  useStreamQuery(T) --> useStreamQueries(T)
  useStreamQuery(T, () => query, ...) --> useStreamQueries(T, () => [query], ...)
  ```

  The upgrade path for `useStreamFetchByKey` is only slightly more
  involved as the return type of `useStreamFetchByKeys` is a new type
  called `FetchByKeysResult` instead of the existing `FetchResult`.
  `FetchByKeysResult` differs from `FetchResult` in that it contains a
  `contracts` field with an array of contracts instead of a singular
  `contract` field. (It differs from `QueryResult` in that each element of
  the returned array can also be `null`, if there is no corresponding
  active contract.) Call sites can be updated as follows:
  ```
  const {loading, contract} = useStreamFetchByKey(T, () => k, ...);

  -->

  const {loading, contracts} = useStreamFetchByKeys(T, () => [k], ...));
  const contract = contracts[0];
  ```
CHANGELOG_END
2020-10-23 14:40:20 +02:00
Robin Krom
6a328212f2
language: automatic ts codegen for daml start (#7516)
This executes the code generations specified in the daml.yaml
configuration file on every invocation of `daml start`
and hence frees the user of doing it manually.

CHANGELOG_BEGIN
- [DAML Assistant] The `daml start` now runs all the code generators
specified in the `daml.yaml` project configuration file under the
`codegen` stanza. This frees the user of doing so manually on every
change to the DAML model.
CHANGELOG_END
2020-10-02 15:43:06 +02:00
Robin Krom
678a8eef71
Replace yarn with npm (#7222)
* replace yarn with npm in docs

CHANGELOG_BEGIN
CHANGELOG_END

* updating assistant and compatibility tests

* moved gitignore entry to toplevel
2020-09-08 12:07:04 +02:00
Moritz Kiefer
3589c916ac
Avoid contention in create-daml-app tests (#6575)
The issue is described in a comment (since I want to preserve it) but
here’s the brief summary:

Calling `follow` twice can result in contention if we do not wait in
between. That is shown in the log of the JSON API. For some reason
that ends up propagating to a misleading Target closed error from
puppeteer.

This PR addresses the problem by waiting for the list of followers to
be updated which definitely implies that the ledger has seen the
command.

changelog_begin
changelog_end
2020-07-02 12:25:39 +00:00
Moritz Kiefer
0c80c984b6
Upgrade puppeteer (#6539)
I don’t know if this fixes the “Target closed” issues since I never
managed to reproduce them but I’d rather debug them on the latest
version :)

changelog_begin
changelog_end
2020-06-30 16:45:08 +02:00
Moritz Kiefer
5feab1b84b
Fix waitForSelector calls in create-daml-app-tests (#6253)
`waitForSelector` returns immediately if the selector is already
present (which is documented). This means that the waitForSelector
after the second follow isn’t doing anything since we already waited
for after the first follow. `waitForFunction` seemed like the simplest
solution and doesn’t require patching the HTML which is a bit finnicky
in the compat tests.

changelog_begin
changelog_end
2020-06-08 11:26:03 +02:00
Moritz Kiefer
fc366478f0
Upgrade puppeteer (#6142)
* Upgrade puppeteer

We’ve seen a couple of issues in the compatibility tests of the form

```
Error: Protocol error (Runtime.callFunctionOn): Target closed.
```

Looking at the issue tracker in puppeteer this might be fixed in newer
versions and I don’t see why we should stick to a fairly old version
anyway.

changelog_begin
changelog_end

* Upgrade nodejs

changelog_begin
changelog_end

* temporary add a step to kill node_modules

changelog_begin
changelog_end

* Kill live server and try to fix Windows

changelog_begin
changelog_end

* Undo rm

changelog_begin
changelog_end
2020-05-28 21:58:52 +02:00
Moritz Kiefer
629ec732dd
Include puppeteer tests in compat tests (#6018)
* Include puppeteer tests in compat tests

This PR adds the puppeteer based tests to the compatibility
tests. This also means that they are now actually compatibility
tests. Before, we only tested the SDK side.

Apart from process management being a nightmare on Windows as usually,
there are two things that might stick out here:

1. I’ve replaced the `sh_binary` wrapper by a `cc_binary`. There is a
   lengthy comment explaining why. I think at the moment, we could
   actually get rid of the wraper completely and add JAVA to path in
   the tests that need it but at least for now, I’d like to keep it
   until we are sure that we don’t need to add more to it (and then
   it’s also in the git history if we do need to resurrect it).
2. These tests are duplicated now similar to the `daml ledger *`
   tests. The reasoning here is different. They depend on the SDK
   tarball either way so performance wise there is no reason to keep
   them. However, we reference the other file in the docs which means
   we cannot change it freely. What we could do is to make this
   sufficiently flexible to handle both the `daml start` case and
   separate `daml sandbox`/`daml json-api` processes and then we can
   reference it in the docs. There is still added complexity for
   Windows but that’s necessary for users as well that want to run
   this on Windows so that seems unavoidable. (I should probably also
   remove my snarky comments 😇) I’d like to kee it duplicated
   for this PR and then we can clean it up afterwards.

changelog_begin
changelog_end

* Bump timeouts

changelog_begin
changelog_end
2020-05-22 14:02:59 +02:00
Moritz Kiefer
c3f6d85192
Bump timeout in create-daml-app tests (#5928)
At least with the official azure CI nodes, this seems to run into timeouts.

changelog_begin
changelog_end
2020-05-11 11:40:47 +00:00
Rohan Jacob-Rao
12c98a5c12
create-daml-app test: Move back to daml start (#5637)
Previously we changed to running the sandbox and JSON API separately to
have more control over port allocation. Now the same behaviour is
possible using `daml start`, which is preferable because it's what we
suggest users of the Getting Started Guide should use. This change
returns to using `daml start` in the end-to-end test. We use the default ports
for the sandbox and JSON API as we do in the guide.

changelog_begin
changelog_end
2020-04-20 16:30:51 -04:00
Rohan Jacob-Rao
631b5ddcd0
create-daml-app-test: Run sandbox and JSON API server separately and wait on port files (#5615)
changelog_begin
changelog_end

* Be a bit more generous with the login/logout test timeout
* Use fsPromises.stat and remove port files before starting to be safe
2020-04-18 18:54:53 -04:00
Rohan Jacob-Rao
37ca4af529
create-daml-app: Add end-to-end tests to integration tests (#5540)
This PR gets yarn test running the Puppeteer end-to-end tests in the GSG integration test.

The first step of the test is adding the extra dependencies (Jest, Puppeteer and more). The GSG recommends a yarn add command, but this does not work against HEAD. This is because yarn add does not use resolutions in the parent package.json, and then complains about unknown versions 0.0.0 of the daml TS libaries. The solution here is to hack in the extra dependencies into the ui/package.json and then yarn install. This works, but it hard codes version numbers which we would need to maintain. I would like to be able to say version "latest", which is what yarn add would install.

The next step of the test is to copy the index.test.ts file and run yarn test in CI mode.

I've moved the GSG test to a new create-daml-app-tests target. It's marked "exclusive" in Bazel until we figure out how to avoid hardcoding port numbers. This is a bit tricky since the HTTP port is hardcoded in a couple of places in ui/package.json.

Finally, this PR gets the GSG testing docs to reference the code in the new templates/create-daml-app-test-resources folder.

changelog_begin
changelog_end
2020-04-17 12:42:24 -04:00