Commit Graph

121 Commits

Author SHA1 Message Date
Moritz Kiefer
49e04c11c6
Fix dependencies for create-daml-app (#13089)
No reason to incldue daml-trigger by default.

changelog_begin
changelog_end
2022-02-25 15:25:50 +00:00
Moritz Kiefer
c09e1d4b96
Document user management support in Navigator (#13085)
* Document user management support in Navigator

fixes #12934

changelog_begin
changelog_end
2022-02-25 16:11:51 +01:00
Moritz Kiefer
4307614ddf
Drop auth0 support from create-daml-app (#13053)
I don’t own this, it’s broken and other people don’t want to fix it
for 2.0 so this PRs deletes it instead of shipping broken code.

fixes #13045

changelog_begin
changelog_end
2022-02-23 17:01:05 +00:00
Moritz Kiefer
6ed6ea36e8
Drop parties from daml templates (#12953)
Complements #12952 which drops it from create-daml-app by also
dropping it from the rest.

Couldn’t find any docs or other stuff that is broken by this.

changelog_begin
changelog_end
2022-02-15 17:21:32 +00:00
Adriaan Moors
612bf97b05
No parties in create-daml-app's daml.yaml template, (#12952)
... so that Navigator shows users for login by default.

When parties are specified explicitly in daml.yaml,
navigator uses those instead of querying user management
for the list of users a user can log in as.

These days, it actually doesn't make sense to list the
parties in the daml.yaml. Navigator will query party
mgmt for a list of known parties. We don't implicitly
allocate parties (anymore), so unclear why this section
is still here.

The users for the template are created by the init script
(see Setup.daml).

See #12945

CHANGELOG_BEGIN
CHANGELOG_END
2022-02-15 17:04:50 +00: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
a03a0896c5
Create users in skeleton template (#12864)
changelog_begin
changelog_end
2022-02-10 11:57:21 +00:00
Moritz Kiefer
9830e8947f
Drop uniqueness from user aliases (#12846)
* Drop uniqueness from user aliases

We cannot support this on Daml Hub or multi-domain Canton so dropping
it seems more reasonable unfortunately.

changelog_begin
changelog_end

* .

changelog_begin
changelog_end

* .

changelog_begin
changelog_end
2022-02-10 08:44:53 +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
609537bd0d
Make gsg-trigger docs work with Canton (#12709)
Sadly most of these changes are not actually related to Canton but the
previous docs were already broken primarily because of the patch file
not making all the required changes.

I got the patch file as close as possible to the `messaging.patch` to
make it easier to keep them in sync. The fact that we have two patch
files that duplicate most of the code is something that we really need
to fix but not in this PR.

changelog_begin
changelog_end
2022-02-03 15:22:45 +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
0610a44524
daml-react: add an useUser hook (#12622)
We add a `useUser` hook to daml-react returning the user currently
logged in the ledger participant. create-daml-app is changed
accordingly.

CHANGELOG_BEGIN
[daml-react] A `useUser` react hook is added to the daml-react
TypeScript library. It allows for easy access to the currently logged in
user of a ledger participant node for ledgers supporting user
management.
CHANGELOG_END
2022-01-27 19:21:59 +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
Moritz Kiefer
9c03e7908b
Build create-daml-app with -Werror (#12513)
and fix the warning

changelog_begin
changelog_end
2022-01-20 16:50:39 +01:00
Simon Meier
2640bc6ab7
user management: require appropriate scope in user access tokens (#12428)
* user management: require `daml_ledger_api` scope in user access tokens

The accesss token's scope must include `daml_ledger_api` to ensure
that access token was issued for accessing the Daml ledger api.

CHANGELOG_BEGIN
CHANGELOG_END
2022-01-18 13:01:47 +00:00
nickchapman-da
0c13a4f1fd
Error handling for User Management exposed via daml-script (#12416)
* Error handling for User Management exposed via daml-script

changelog_begin
changelog_end

adapt ScriptTest.daml to new user-management interface

adapt create-daml-app Setup.daml to new user-management interface

* Add deriving Ord for UserId

* change example of invalid user-id char to "%" from "." (which is no longer illegal)

* recover/reify ALREADY_EXISTS from GrpcLedgerClient.createuser

* fix testcase expected order of users from daml-script listUsers

* adapt create-saml-app Setup.daml to changed interface of user-management

* reinstate sort lost in merge

* sort user in ScriptService user-management test

* improve comment for error foobar hack

* improve doc comment for validateUserId

* use upper case as test example for invalid user-id
2022-01-18 12:58:51 +00:00
Sofia Faro
2500d4fd9f
Make quickstart-java template work with canton sandbox. (#12453)
* Make quickstart-java template work with canton

Also update the quickstart-java release test instructions to use the new sandbox. This is a bit more involved than before, because of the party names being different every time, but I hope this is not too much of a burden. The test here is similar to what gets tested in the assistant integration test for quickstart-java.

changelog_begin
changelog_end

* try to fix indentation
2022-01-18 11:49:52 +00:00
Sofia Faro
430f86b4c2
Make skeleton template work with canton sandbox (#12451)
And change the relevant release test instructions to make it clear this
isn't a quickstart-java project, but a project that uses the default
template (skeleton).

changelog_begin
changelog_end
2022-01-18 10:11:15 +00: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
b84558732a
Make create-daml-app setup idempotent (#12320)
* Make create-daml-app setup idempotent

changelog_begin
changelog_end

* review feedback

changelog_begin
changelog_end
2022-01-11 15:51:19 +01: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
Alex Matson
2b1db54f14
[create-daml-app] Incorporate hub-react library for new Hub API/domains (#12279)
changelog_begin
changelog_end
2022-01-06 17:36:45 +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
42adfdc857
Get rid of deprecated components (#12167)
* Get rid of deprecated components

Removes:
- mentions of the Node.js bindings
- mentions of the Scala bindings
- usage of the Scala codegen as an SDK tool
- Java bindings "reactive components"

changelog_begin
The Node.js bindings are no longer supported as part of the Daml SDK
The Scala bindings are no longer supported as part of the Daml SDK
The Java bindings reactive components are no longer supported as part of the Daml SDK
The `daml codegen` command has dropped support for Scala
changelog_end

* Fix typo noticed by @cocreature

Co-authored-by: Moritz Kiefer <moritz.kiefer@purelyfunctional.org>

* Address https://github.com/digital-asset/daml/pull/12167#issuecomment-995714093

* Remove quickstart-scala from the SDK tarballs

* Fix failing codegen test

* Address https://github.com/digital-asset/daml/pull/12167#pullrequestreview-833991243

Co-authored-by: Moritz Kiefer <moritz.kiefer@purelyfunctional.org>
2021-12-16 16:55:19 +00:00
Gary Verhaegen
7a0198ba52
daml-react: allow for React 17 (#11463)
See #11358.

CHANGELOG_BEGIN

- [@daml/react] Our React bindings now request the `react` library as a
  peer dependency, and will accept React 17 in addition to the current
  React 16. For new projects, the `create-daml-app` template now uses
  React 17.

CHANGELOG_END
2021-11-01 15:29:42 +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
17776f3496
Factor out npm install step of create-daml-app tests (#11294)
* Factor out npm install step of create-daml-app tests

This PR speeds up the create-daml-app tests by 30s or so by factoring
out the install of the unchanged npm deps into a genrule which we then
feed in again. This is a bit ugly but given how frequently we run
those tests I do think it is worth the uglyness.

changelog_begin
changelog_end

* .

changelog_begin
changelog_end

* .

changelog_begin
changelog_end
2021-10-20 14:24:30 +02: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
08b9f82614
fix templates build for Windows (#11165)
On Windows, we run without a sandbox, which means that the `gsg-trigger`
folder might already exist and be patched, because we work directly in
the source tree.

This changes the script to work with temp dirs instead.

CHANGELOG_BEGIN
CHANGELOG_END
2021-10-07 18:25:05 +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
Moisés Ackerman
dc9fbb5aa9
Stringify errors in create-daml-app before calling alert (#10831)
This is because otherwise we get the uninformative '[object Object]'

changelog_begin
changelog_end
2021-09-09 14:11:25 +00:00
Moritz Kiefer
cecb27fe16
Stop using controller can syntax in skeleton template (#10799)
changelog_begin
changelog_end
2021-09-08 15:28:12 +02:00
Gary Verhaegen
c1559357f6
clean-up gsg README (#10641)
The current README dates back to when `create-daml-app` was its own
repo, and seems mostly written from the perspective of being the default
home page for the project. These days, `create-daml-app` serves two
purposes:

1. As the core starting point for the Getting Started Guide, we can
   assume people who are totally new to Daml will be following the
   getting started guide. How else would they even know about this
   template? In that case, I think it's fair to assume the user will *not*
   be looking to the README for guidance. Therefore, repeating the
   documentation here seems a bit pointless.
2. As a template to quickstart the creation of a "custom" app that is
   not the GSG. For that use-case, the README is the place where people
   would look for information, but at that point the information they're
   looking for are more along the lines of quick refreshers of what
   commands to run than explanations on how to use the app as Alice and
   Bob.

CHANGELOG_BEGIN
CHANGELOG_END
2021-08-23 10:59:35 +02:00
Gary Verhaegen
fb19bcb7f3
fix gsg-trigger template (#10611)
It currently has all it needs for the docs to build, but not quite for
people to use it as a useful result of the triggers docs page: without
the UI components, it's hard to see anything the triggers are supposed
to do.

CHANGELOG_BEGIN
CHANGELOG_END
2021-08-18 14:49:30 +02:00
Gary Verhaegen
f8c0a35940
rewrite trigger docs to follow gsg (#10509)
* rewrite trigger docs to follow gsg

Per #10419 point 4, I've rewritten the Triggers section to build upon
the Getting Started Guide instead of inventing its own example.

Compared to #10395, this has a lot more explanations as this page must
now serve the dual purpose of being a possible "next step" from the GSG
and being the main reference page for triggers. It's also lost the "next
steps" section, which I think is a bit of a shame, but it doesn't really
make sense here.

There's also no easy way for people not interested in the GSG to follow
along; should we expose the "completed GSG" as a tempate?

CHANGELOG_BEGIN
CHANGELOG_END

* keep copy-trigger as a template

* fix copy-trigger project name

* make up gsg-trigger template

* remove awkward sentence, fix existing typo

* update code to use when{,Some}

* add  to

* swap emitCommands and getCommandsInFlight

* typo

* insist on state-correction perspective

* fix copy-trigger tests

* add back copy-trigger to whitelist

* add gsg-trigger to whitelist
2021-08-17 13:28:07 +00:00
Gary Verhaegen
905d8add44
remove duplicated rule in create-daml-app dlint (#10352)
When opening #10342 I was only aware of the `.gitignore`; @cocreature's
comment made me find out the `.dlint.yaml`, and then, testing it, I
realized we ended up with the ignore rule twice. It does not seem to be
causing any issue in cursory tests, but still, I think it's worth
cleaning up.

CHANGELOG_BEGIN
CHANGELOG_END
2021-07-21 11:23:38 +00:00
Gary Verhaegen
e58c7ba3b4
fix template dot-files (#10342)
The `cp $SRC/$d/*` does not copy dot files.

CHANGELOG_BEGIN
CHANGELOG_END
2021-07-21 11:20:33 +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
Gary Verhaegen
e12a449c81
s/DABL/Daml Hub/ (#10062)
It's been long enough.

CHANGELOG_BEGIN
CHANGELOG_END
2021-06-21 16:37:17 +02:00
Gary Verhaegen
0adbbdcd58
update Daml Hub auth in create-daml-app (#9973)
* update Daml Hub auth in create-daml-app

Current documentation says the token is passed as a cookie. This is a
little bit more secure than passing it as a URL param, as it used to be.
Note that while it is no longer documented behaviour, the token is
actually still passed as a param (in addition to the cookie), so
existing users are not broken (yet). Still, better if the code we
generate for them matches our current docs.

CHANGELOG_BEGIN
CHANGELOG_END

* review comment
2021-06-11 16:55:13 +00:00
Moritz Kiefer
6ab965577e
Fix scala version in quickstart-scala (#9401)
Setting this manually has resulted in #9397 where we use a scala
version that doesn’t have a silencer version. This PR changes the
quickstart template to use the scala version we also use in our builds
which should avoid them getting out of sync in the future.

changelog_begin
changelog_end
2021-04-13 15:54:40 +02:00
Stefano Baghino
ed746976a3
Apply new logo to create-daml-app template (#9105)
* Apply new logo to create-daml-app template

changelog_begin
[SDK Assistant] New Daml logo on create-daml-app template
changelog_end

* Fix logo alignment, change capitalization of page title
2021-03-12 13:20:31 +01:00
Richard Kapolnai
f7abca919f
fix readme in create-daml-app: add npm install (#9060)
* fix readme in create-daml-app: add npm install

* changelog_begin
changelog_end
2021-03-09 22:02:55 +01:00