From e282112a8359d4b0df10771121cbad80d2bfd9ac Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Wed, 7 Oct 2026 10:13:05 -0400 Subject: [PATCH 01/22] build(deps): bump axios from 1.18.1 to 1.20.0 in /quickstart/frontend (#387) Bumps [axios](https://github.com/axios/axios) from 1.18.1 to 1.20.0. - [Release notes](https://github.com/axios/axios/releases) - [Changelog](https://github.com/axios/axios/blob/v1.x/CHANGELOG.md) - [Commits](https://github.com/axios/axios/compare/v1.18.1...v1.20.0) --- updated-dependencies: - dependency-name: axios dependency-version: 1.20.0 dependency-type: direct:production ... Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> --- quickstart/frontend/package-lock.json | 10 +++++----- quickstart/frontend/package.json | 2 +- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/quickstart/frontend/package-lock.json b/quickstart/frontend/package-lock.json index 7e5745896..714bbf481 100644 --- a/quickstart/frontend/package-lock.json +++ b/quickstart/frontend/package-lock.json @@ -9,7 +9,7 @@ "version": "0.0.0", "dependencies": { "@modyfi/vite-plugin-yaml": "^1.1.1", - "axios": "^1.18.1", + "axios": "^1.20.0", "openapi-client-axios": "^7.9.0", "react": "^18.3.1", "react-dom": "^18.3.1", @@ -1874,13 +1874,13 @@ "license": "MIT" }, "node_modules/axios": { - "version": "1.18.1", - "resolved": "https://registry.npmjs.org/axios/-/axios-1.18.1.tgz", - "integrity": "sha512-3nTvFlvpn9Zu/RkHUqtc7/+al4UpRW5az71ap5zccp6e8RAYEzhMTecX8Dz1wWDYrPpUoB1HAQEGEAEvUr7S9g==", + "version": "1.20.0", + "resolved": "https://registry.npmjs.org/axios/-/axios-1.20.0.tgz", + "integrity": "sha512-r8aOh8j9cGKpgQAqpzrUHnSIc6a59Y3Xf/cv8sy1DrHCkZHzQGEuoq1tARk6qSyDdtQGSDgpb9kFlruzPvrgwg==", "license": "MIT", "dependencies": { "follow-redirects": "^1.16.0", - "form-data": "^4.0.5", + "form-data": "^4.0.6", "https-proxy-agent": "^5.0.1", "proxy-from-env": "^2.1.0" } diff --git a/quickstart/frontend/package.json b/quickstart/frontend/package.json index f9f0f73eb..3fa7b03f0 100644 --- a/quickstart/frontend/package.json +++ b/quickstart/frontend/package.json @@ -12,7 +12,7 @@ }, "dependencies": { "@modyfi/vite-plugin-yaml": "^1.1.1", - "axios": "^1.18.1", + "axios": "^1.20.0", "openapi-client-axios": "^7.9.0", "react": "^18.3.1", "react-dom": "^18.3.1", From d643939cd3a5f357318f0d28bcdc31c4d0cc0dc8 Mon Sep 17 00:00:00 2001 From: Daniel Porter Date: Fri, 23 Oct 2026 10:28:46 -0400 Subject: [PATCH 02/22] docs: add cf-docs snippet markers to quickstart code blocks (#393) --- .../configure/project-structure-overview.rst | 12 ++ ...observability-troubleshooting-overview.rst | 15 ++ .../operate/deploy-quickstart-to-devnet.rst | 183 ++++++++++++++++ .../quickstart/operate/explore-the-demo.rst | 3 + ...onboard-external-parties-in-quickstart.rst | 80 ++++++- .../sdk/quickstart/operate/json-api.rst | 201 ++++++++++++++++++ 6 files changed, 493 insertions(+), 1 deletion(-) diff --git a/sdk/docs/sharable/sdk/quickstart/configure/project-structure-overview.rst b/sdk/docs/sharable/sdk/quickstart/configure/project-structure-overview.rst index 0bc818de4..34901df3c 100644 --- a/sdk/docs/sharable/sdk/quickstart/configure/project-structure-overview.rst +++ b/sdk/docs/sharable/sdk/quickstart/configure/project-structure-overview.rst @@ -178,10 +178,13 @@ Empty responses indicate healthy services. Admin ports are defined in ``quickstart/docker/modules/localnet/compose.yaml`` .. code-block:: bash + :name: cf-docs-snippet-cn-quickstart-project-structure-health-check-admin-ports-start curl -v http://localhost:2902/admin # Accesses App User admin if exposed curl -v http://localhost:3902/admin # Accesses App Provider admin if exposed +.. cf-docs-snippet-cn-quickstart-project-structure-health-check-admin-ports-end + See :ref:`quickstart-json-ledger-api` for detailed port usage and authentication patterns. Application structure @@ -352,6 +355,7 @@ Quick Start ----------- .. code-block:: bash + :name: cf-docs-snippet-cn-quickstart-project-structure-quick-start-commands-start cd quickstart/ make setup # Configure deployment @@ -359,24 +363,32 @@ Quick Start make start # Start LocalNet make status # Verify containers running +.. cf-docs-snippet-cn-quickstart-project-structure-quick-start-commands-end + Iterative development --------------------- .. code-block:: bash + :name: cf-docs-snippet-cn-quickstart-project-structure-iterative-development-commands-start make build-daml # Rebuild Daml contracts make build-backend # Rebuild Java services make build-frontend # Rebuild React app make restart # Restart services with new code +.. cf-docs-snippet-cn-quickstart-project-structure-iterative-development-commands-end + Debugging and logs ------------------ .. code-block:: bash + :name: cf-docs-snippet-cn-quickstart-project-structure-debugging-log-commands-start make capture-logs # Start log capture (separate terminal) make shell # Open Daml Shell for ledger queries +.. cf-docs-snippet-cn-quickstart-project-structure-debugging-log-commands-end + See :ref:`quickstart-debugging-and-troubleshooting-lnav` for log analysis techniques. Next steps diff --git a/sdk/docs/sharable/sdk/quickstart/observe/observability-troubleshooting-overview.rst b/sdk/docs/sharable/sdk/quickstart/observe/observability-troubleshooting-overview.rst index 7ea84ad75..1f5c99a8f 100644 --- a/sdk/docs/sharable/sdk/quickstart/observe/observability-troubleshooting-overview.rst +++ b/sdk/docs/sharable/sdk/quickstart/observe/observability-troubleshooting-overview.rst @@ -160,9 +160,12 @@ All persistent state in the example application is stored in one or more postgre You can use the postgres configuration in ``.env`` to connect directly to these instances. .. code-block:: + :name: cf-docs-snippet-cn-quickstart-observability-postgres-direct-psql-start $ docker exec -it psql -v --username <.env username> --dbname <.env dbname> --password +.. cf-docs-snippet-cn-quickstart-observability-postgres-direct-psql-end + For example: if you connect to the ``postgres-splice-app-provider`` container (default username ``cnadmin``, dbname ``scribe``, and password ``supersafe``; then you can use the SQL interface to PQS to examine the @@ -267,10 +270,14 @@ Direct Ledger inspection using correlation identifiers Starting from ``$ make stop clean-all && make build start``, we proceed with initiating the example application app-user onboarding: .. code-block:: + :name: cf-docs-snippet-cn-quickstart-observability-create-app-install-request-command-start $ make create-app-install-request | cat -n +.. cf-docs-snippet-cn-quickstart-observability-create-app-install-request-command-end + .. code-block:: + :name: cf-docs-snippet-cn-quickstart-observability-create-app-install-request-output-start docker compose -f docker/app-user-shell/compose.yaml --env-file .env run --rm create-app-install-request || true get_token ledger-api-user AppProvider @@ -317,6 +324,8 @@ Starting from ``$ make stop clean-all && make build start``, we proceed with ini "1220e48d6d59af99a1b61eca414fe25766c342bb4e7d8d485e049a11a7f2267ed5c0", "completion_offset":73} +.. cf-docs-snippet-cn-quickstart-observability-create-app-install-request-output-end + This is the output of a script submitting a create command to the app-user’s participant node, it already contains number of the correlation ids mentioned above: @@ -352,6 +361,7 @@ We can immediately use the transaction id in Daml Shell to view the associated ledger transaction: .. code-block:: + :name: cf-docs-snippet-cn-quickstart-observability-daml-shell-transaction-lookup-start $ make shell docker compose -f docker/daml-shell/compose.yaml --env-file .env run --rm daml-shell || true @@ -364,6 +374,8 @@ associated ledger transaction: {"dso": "DSO::1220015e721c8ec5c1a5868b418442f064530e367c2587a9b43bd66f58c7bfddfec4", "meta": {"values": []}, "user": "Org1::122072b20a515d939910f9412f915cff8c1a7a427ddde76c6d0b7646d0022d4d4551", "provider": "AppProvider::12202fe7b2bf950dca3858b880d9ee0dd58249af8821ff2330ea1b80420852e816ff"} postgres-splice-app-provider:5432/scribe 3f → 48> +.. cf-docs-snippet-cn-quickstart-observability-daml-shell-transaction-lookup-end + From here we can get more identifiers: +------------+---------------------------------------+ @@ -383,6 +395,7 @@ Ledger API directly for more information. The Contract Id can be used to immediately display the contract in Daml Shell: .. code-block:: + :name: cf-docs-snippet-cn-quickstart-observability-daml-shell-contract-lookup-start postgres-splice-app-provider:5432/scribe 3f → 48> contract 005c17f89b7fd1d5fde9c548740c32924edeeddacc6320256892636b4e3b7d66aaca101220777c5420863adb012c4f38847049346014c44eba7cd54bf58950dd6a18679053 ╓───────────────────────────────────────────────────────────────────────────╖ @@ -401,6 +414,8 @@ immediately display the contract in Daml Shell: ╙───────────────────────────────────────────────────────────────────────────╜ postgres-splice-app-provider:5432/scribe 3f → 48> +.. cf-docs-snippet-cn-quickstart-observability-daml-shell-contract-lookup-end + If the problem is a bug in your smart contract, then exploring the transaction and related provenance within Daml Shell and using the Daml IDE to synthesize and rerun the relevant transactions will diff --git a/sdk/docs/sharable/sdk/quickstart/operate/deploy-quickstart-to-devnet.rst b/sdk/docs/sharable/sdk/quickstart/operate/deploy-quickstart-to-devnet.rst index 836a44f75..a76dca9c0 100644 --- a/sdk/docs/sharable/sdk/quickstart/operate/deploy-quickstart-to-devnet.rst +++ b/sdk/docs/sharable/sdk/quickstart/operate/deploy-quickstart-to-devnet.rst @@ -92,6 +92,7 @@ Add explicit host entires for reliable routing. Add these entries to ``/etc/hosts``: .. code-block:: bash + :name: cf-docs-snippet-cn-quickstart-devnet-configure-etc-hosts-start sudo vim /etc/hosts @@ -105,6 +106,8 @@ Add these entries to ``/etc/hosts``: 127.0.0.1 keycloak.localhost 127.0.0.1 host.docker.internal +.. cf-docs-snippet-cn-quickstart-devnet-configure-etc-hosts-end + You only need to complete this step one time. .. list-table:: DevNet Host Entries @@ -170,9 +173,12 @@ https://github.com/digital-asset/decentralized-canton-sync/releases/download/v0. Move the ``splice-node`` tarball to your desired location and then unzip it. .. code-block:: bash + :name: cf-docs-snippet-cn-quickstart-devnet-untar-splice-node-start tar xzvf 0.5.8_splice-node.tar.gz +.. cf-docs-snippet-cn-quickstart-devnet-untar-splice-node-end + The new ``splice-node`` repo and ``cn-quickstart`` should be siblings to one another. :: @@ -229,9 +235,12 @@ Clean Docker Clear Docker If this is not your first time connecting to ``DevNet`` so that stale containers do not interfere. .. code-block:: bash + :name: cf-docs-snippet-cn-quickstart-devnet-docker-compose-down-volumes-start docker compose down -v +.. cf-docs-snippet-cn-quickstart-devnet-docker-compose-down-volumes-end + Get network information ----------------------- @@ -241,6 +250,7 @@ Retrieve DevNet migration ID and Splice version In terminal, from the ``/validator`` directory run: .. code-block:: bash + :name: cf-docs-snippet-cn-quickstart-devnet-retrieve-migration-id-and-version-start INFO_URL="https://docs.dev.global.canton.network.sync.global/info" SPLICE_VERSION=$(curl -s "$INFO_URL" | jq -r '.synchronizer?.active?.version') @@ -249,6 +259,8 @@ In terminal, from the ``/validator`` directory run: echo "Splice Version: $SPLICE_VERSION" echo "Migration ID: $MIGRATION_ID" +.. cf-docs-snippet-cn-quickstart-devnet-retrieve-migration-id-and-version-end + Verify that the Splice version matches the splice-node version that you recently downloaded and unzipped. Minor Splice versions change on a regular basis. You may elect to hard code ``SPLICE_VERSION`` rather than saving the most recent version. e.g. ``SPLICE_VERSION=0.5.8`` @@ -261,6 +273,7 @@ If not, your sponsoring SV will provide the appropriate URL. In this case, you must replace the provided ``SPONSOR_SV_URL`` with your provided URL. .. code-block:: bash + :name: cf-docs-snippet-cn-quickstart-devnet-get-onboarding-secret-start # GSF Sponsor SV URL for DevNet SPONSOR_SV_URL="https://sv.sv-1.dev.global.canton.network.sync.global" @@ -269,6 +282,8 @@ In this case, you must replace the provided ``SPONSOR_SV_URL`` with your provide ONBOARDING_SECRET=$(curl -s -X POST "$SPONSOR_SV_URL/api/sv/v0/devnet/onboard/validator/prepare") echo $ONBOARDING_SECRET +.. cf-docs-snippet-cn-quickstart-devnet-get-onboarding-secret-end + .. tip:: The onboarding secret is only good for 1 hour. @@ -287,9 +302,12 @@ The default party hint is ``quickstart-USERNAME-1`` Return to the terminal in the ``validator`` directory. Set ``PARTY_HINT``. .. code-block:: bash + :name: cf-docs-snippet-cn-quickstart-devnet-set-party-hint-start PARTY_HINT="quickstart-USERNAME-1" +.. cf-docs-snippet-cn-quickstart-devnet-set-party-hint-end + This value must match the expected party hint. Authentication @@ -306,6 +324,7 @@ Files include ``quickstart/quickstart/docker/modules/keycloak/compose.env``, ``A ``splice-node/docker-compose/validator/.env`` .. code-block:: bash + :name: cf-docs-snippet-cn-quickstart-devnet-validator-env-authentication-start # Authentication @@ -331,6 +350,8 @@ Files include ``quickstart/quickstart/docker/modules/keycloak/compose.env``, ``A WALLET_UI_CLIENT_ID="app-provider-wallet" ANS_UI_CLIENT_ID="app-provider-ans" +.. cf-docs-snippet-cn-quickstart-devnet-validator-env-authentication-end + .. note:: These are development secrets and should be changed for production. @@ -341,6 +362,7 @@ Start the validator with the start.sh script. Verify that you are in the ``validator`` directory, then run this command to connect to ``DevNet``: .. code-block:: bash + :name: cf-docs-snippet-cn-quickstart-devnet-start-validator-script-start ./start.sh \ -s "https://sv.sv-1.dev.global.canton.network.sync.global" \ @@ -350,6 +372,8 @@ Verify that you are in the ``validator`` directory, then run this command to con -w \ -a +.. cf-docs-snippet-cn-quickstart-devnet-start-validator-script-end + Flag descriptions ^^^^^^^^^^^^^^^^^ @@ -386,12 +410,16 @@ Spin up the Quickstart DevNet In a second terminal, navigate to the Quickstart ``DevNet`` Docker Compose directory. .. code-block:: bash + :name: cf-docs-snippet-cn-quickstart-devnet-cd-devnet-compose-dir-start cd cn-quickstart/quickstart/docker/modules/devnet docker compose --env-file compose.env --profile devnet up -d postgres-keycloak keycloak nginx-keycloak postgres-pqs pqs-app-provider backend-service +.. cf-docs-snippet-cn-quickstart-devnet-cd-devnet-compose-dir-end + .. code-block:: text + :name: cf-docs-snippet-cn-quickstart-devnet-devnet-compose-up-output-start devnet ~ % docker compose --env-file compose.env --profile devnet up -d postgres-keycloak keycloak nginx-keycloak postgres-pqs pqs-app-provider backend-service [+] Running 7/7 @@ -403,6 +431,8 @@ In a second terminal, navigate to the Quickstart ``DevNet`` Docker Compose direc ✔ Container pqs-app-provider Started 27.3s ✔ Container backend-service Started 41.4s +.. cf-docs-snippet-cn-quickstart-devnet-devnet-compose-up-output-end + ``DevNet`` connects shortly after spinning up the docker containers. A successful connection shows healthy containers. @@ -420,39 +450,54 @@ Build and upload the DAR Return to the ``/quickstart`` directory. .. code-block:: bash + :name: cf-docs-snippet-cn-quickstart-devnet-return-to-quickstart-dir-start cd ../../../ +.. cf-docs-snippet-cn-quickstart-devnet-return-to-quickstart-dir-end + Then build the Daml code. .. code-block:: bash + :name: cf-docs-snippet-cn-quickstart-devnet-make-build-daml-start make build-daml +.. cf-docs-snippet-cn-quickstart-devnet-make-build-daml-end + Verify that the ``DAR`` was created. .. code-block:: bash + :name: cf-docs-snippet-cn-quickstart-devnet-verify-dar-exists-start ls -la daml/licensing/.daml/dist/quickstart-licensing-0.0.1.dar +.. cf-docs-snippet-cn-quickstart-devnet-verify-dar-exists-end + If successful, this command returns the ``DAR`` file. .. code-block:: text + :name: cf-docs-snippet-cn-quickstart-devnet-verify-dar-exists-output-start -rw-r--r-- 1 username staff 685582 Nov 25 09:00 daml/licensing/.daml/dist/quickstart-licensing-0.0.1.dar +.. cf-docs-snippet-cn-quickstart-devnet-verify-dar-exists-output-end + Upload the DAR to your DevNet validator --------------------------------------- Get a token from Keycloak to make an authenticated request: .. code-block:: bash + :name: cf-docs-snippet-cn-quickstart-devnet-dar-upload-get-token-start TOKEN=$(curl -s -X POST "http://keycloak.localhost:8082/realms/AppProvider/protocol/openid-connect/token" \ -d "grant_type=client_credentials" \ -d "client_id=app-provider-validator" \ -d "client_secret=AL8648b9SfdTFImq7FV56Vd0KHifHBuC" | jq -r .access_token) +.. cf-docs-snippet-cn-quickstart-devnet-dar-upload-get-token-end + (Note that the ``client_secret`` matches the ``app-provider-validator``'s ``secret`` in Keycloak's ``AppProvider-realm.json``). From the ``/quickstart`` directory, upload the ``DAR`` to your ``DevNet`` validator (MacOS users replace ``${LEDGER_PORT}`` with ``8080``): @@ -461,22 +506,28 @@ MacOS ^^^^^ .. code-block:: bash + :name: cf-docs-snippet-cn-quickstart-devnet-dar-upload-macos-start curl -X POST "http://json-ledger-api.localhost:8080/v2/dars?vetAllPackages=true" \ -H "Authorization: Bearer $TOKEN" \ -H 'Content-Type: application/octet-stream' \ --data-binary @daml/licensing/.daml/dist/quickstart-licensing-0.0.1.dar +.. cf-docs-snippet-cn-quickstart-devnet-dar-upload-macos-end + Linux ^^^^^ .. code-block:: bash + :name: cf-docs-snippet-cn-quickstart-devnet-dar-upload-linux-start curl -X POST "http://json-ledger-api.localhost:${LEDGER_PORT}/v2/dars?vetAllPackages=true" \ -H "Authorization: Bearer $TOKEN" \ -H 'Content-Type: application/octet-stream' \ --data-binary @daml/licensing/.daml/dist/quickstart-licensing-0.0.1.dar +.. cf-docs-snippet-cn-quickstart-devnet-dar-upload-linux-end + An empty response of ``{}`` indicates a successful upload. Build the Backend @@ -485,9 +536,12 @@ Build the Backend Build the backend from the ``/quickstart`` directory: .. code-block:: bash + :name: cf-docs-snippet-cn-quickstart-devnet-make-build-backend-start make build-backend +.. cf-docs-snippet-cn-quickstart-devnet-make-build-backend-end + Configure Quickstart frontend for DevNet ---------------------------------------- @@ -499,15 +553,21 @@ Review ``vite.config.ts`` for details. Build the frontend from the ``/quickstart`` directory: .. code-block:: bash + :name: cf-docs-snippet-cn-quickstart-devnet-make-build-frontend-start make build-frontend +.. cf-docs-snippet-cn-quickstart-devnet-make-build-frontend-end + Start the Vite development server. .. code-block:: bash + :name: cf-docs-snippet-cn-quickstart-devnet-make-vite-dev-start make vite-dev +.. cf-docs-snippet-cn-quickstart-devnet-make-vite-dev-end + The frontend runs on ``port 5173``. Open your browser to: @@ -565,35 +625,47 @@ You can check that Docker services are connected by checking ``docker ps``. To check a specific service use grep. e.g. ``docker ps | grep backend-service``. .. code-block:: bash + :name: cf-docs-snippet-cn-quickstart-devnet-health-check-docker-ps-start docker ps --format "table {{.Names}}\t{{.Status}}" +.. cf-docs-snippet-cn-quickstart-devnet-health-check-docker-ps-end + Via, CURL, get a token and then ping the service. Get an auth token: .. code-block:: bash + :name: cf-docs-snippet-cn-quickstart-devnet-health-check-get-token-start TOKEN=$(curl -s -X POST "http://keycloak.localhost:8082/realms/AppProvider/protocol/openid-connect/token" \ -d "grant_type=client_credentials" \ -d "client_id=app-provider-backend" \ -d "client_secret=05dmL9DAUmDnIlfoZ5EQ7pKskWmhBlNz" | jq -r .access_token) +.. cf-docs-snippet-cn-quickstart-devnet-health-check-get-token-end + Call the service of your choice: .. code-block:: bash + :name: cf-docs-snippet-cn-quickstart-devnet-health-check-call-service-start Backend health check: curl -H "Authorization: Bearer $TOKEN" http://localhost:8089/actuator/health +.. cf-docs-snippet-cn-quickstart-devnet-health-check-call-service-end + Super validator connectivity check ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ You may make a connectivity check to the ``DevNet`` super validator at anytime: .. code-block:: bash + :name: cf-docs-snippet-cn-quickstart-devnet-super-validator-connectivity-check-start curl -s "https://scan.sv-1.dev.global.canton.network.sync.global/api/scan/v0/splice-instance-names" +.. cf-docs-snippet-cn-quickstart-devnet-super-validator-connectivity-check-end + .. image:: images/devnet-canton-network-devnet-connectivity-check.png :alt: Super validator connectivity check @@ -603,6 +675,7 @@ View tables You can explore the container schema by querying the list of tables. .. code-block:: bash + :name: cf-docs-snippet-cn-quickstart-devnet-view-validator-tables-start docker exec -it splice-validator-postgres-splice-1 psql -U cnadmin -d validator -c " SELECT schemaname, tablename @@ -610,20 +683,28 @@ You can explore the container schema by querying the list of tables. WHERE schemaname = 'validator' ORDER BY tablename;" +.. cf-docs-snippet-cn-quickstart-devnet-view-validator-tables-end + Confirm current migration ID ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ .. code-block:: bash + :name: cf-docs-snippet-cn-quickstart-devnet-confirm-migration-id-start curl -s "https://docs.dev.global.canton.network.sync.global/info" | jq '.synchronizer?.active?.migration_id' +.. cf-docs-snippet-cn-quickstart-devnet-confirm-migration-id-end + Find DSO fingerprint ^^^^^^^^^^^^^^^^^^^^ .. code-block:: bash + :name: cf-docs-snippet-cn-quickstart-devnet-find-dso-fingerprint-start curl -s "https://scan.sv-1.dev.global.canton.network.sync.global/api/scan/v0/dso-party-id" +.. cf-docs-snippet-cn-quickstart-devnet-find-dso-fingerprint-end + Docker ------ @@ -631,23 +712,32 @@ Read docker logs ^^^^^^^^^^^^^^^^ .. code-block:: bash + :name: cf-docs-snippet-cn-quickstart-devnet-read-docker-logs-start docker logs FAILING_VALIDATOR --tail 100 +.. cf-docs-snippet-cn-quickstart-devnet-read-docker-logs-end + Kill running containers ^^^^^^^^^^^^^^^^^^^^^^^ .. code-block:: bash + :name: cf-docs-snippet-cn-quickstart-devnet-docker-kill-all-start docker kill $(docker ps -q) +.. cf-docs-snippet-cn-quickstart-devnet-docker-kill-all-end + Stop gracefully ^^^^^^^^^^^^^^^ .. code-block:: bash + :name: cf-docs-snippet-cn-quickstart-devnet-docker-stop-all-start docker stop $(docker ps -q) +.. cf-docs-snippet-cn-quickstart-devnet-docker-stop-all-end + ``docker ps -q`` lists the container IDs of running containers ``$()`` passes those IDs to the kill or stop command @@ -655,16 +745,22 @@ Remove containers after stopping ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ .. code-block:: bash + :name: cf-docs-snippet-cn-quickstart-devnet-docker-rm-all-start docker rm $(docker ps -aq) +.. cf-docs-snippet-cn-quickstart-devnet-docker-rm-all-end + One command ^^^^^^^^^^^ .. code-block:: bash + :name: cf-docs-snippet-cn-quickstart-devnet-docker-stop-and-rm-all-start docker stop $(docker ps -q) && docker rm $(docker ps -aq) +.. cf-docs-snippet-cn-quickstart-devnet-docker-stop-and-rm-all-end + Troubleshooting --------------- @@ -685,6 +781,7 @@ Change port ``80:80`` in ``"${HOST_BIND_IP:-127.0.0.1}:80:80"`` to ``8080:80``. ``splice-node/docker-compose/validator/compose.yaml`` .. code-block:: yaml + :name: cf-docs-snippet-cn-quickstart-devnet-vmnetd-nginx-compose-start nginx: image: "nginx:${NGINX_VERSION}" @@ -707,6 +804,8 @@ Change port ``80:80`` in ``"${HOST_BIND_IP:-127.0.0.1}:80:80"`` to ``8080:80``. retries: 3 start_period: 60s +.. cf-docs-snippet-cn-quickstart-devnet-vmnetd-nginx-compose-end + Troubleshoot frontend JavaScript mapping errors ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ @@ -724,25 +823,34 @@ Ping app-provider.localhost """"""""""""""""""""""""""" .. code-block:: bash + :name: cf-docs-snippet-cn-quickstart-devnet-ping-app-provider-start ping -c 1 app-provider.localhost +.. cf-docs-snippet-cn-quickstart-devnet-ping-app-provider-end + If successful, navigate to the app at http://app-provider.localhost:5173 and login. Check backend-service logs for errors """"""""""""""""""""""""""""""""""""" .. code-block:: bash + :name: cf-docs-snippet-cn-quickstart-devnet-backend-service-logs-start docker logs backend-service --tail 30 +.. cf-docs-snippet-cn-quickstart-devnet-backend-service-logs-end + Find the login options """""""""""""""""""""" .. code-block:: bash + :name: cf-docs-snippet-cn-quickstart-devnet-find-login-links-start curl -s http://localhost:8089/login-links | jq +.. cf-docs-snippet-cn-quickstart-devnet-find-login-links-end + Get token for backend API access """""""""""""""""""""""""""""""" @@ -757,42 +865,60 @@ Verify token was retrieved """""""""""""""""""""""""" .. code-block:: bash + :name: cf-docs-snippet-cn-quickstart-devnet-verify-token-length-start echo "Token length: ${#TOKEN}" +.. cf-docs-snippet-cn-quickstart-devnet-verify-token-length-end + Query data from PQS """"""""""""""""""" Query app install requests .. code-block:: bash + :name: cf-docs-snippet-cn-quickstart-devnet-pqs-query-app-install-requests-start curl -H "Authorization: Bearer $TOKEN" http://localhost:8089/app-install-requests | head -10 +.. cf-docs-snippet-cn-quickstart-devnet-pqs-query-app-install-requests-end + Query license data .. code-block:: bash + :name: cf-docs-snippet-cn-quickstart-devnet-pqs-query-licenses-start curl -H "Authorization: Bearer $TOKEN" http://localhost:5173/api/licenses +.. cf-docs-snippet-cn-quickstart-devnet-pqs-query-licenses-end + Error port is already in use ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ If terminal shows ``Error: Port 5173 is already in use`` identify and kill the associated node process, then run your command again. .. code-block:: bash + :name: cf-docs-snippet-cn-quickstart-devnet-port-in-use-lsof-start lsof -i :5173 +.. cf-docs-snippet-cn-quickstart-devnet-port-in-use-lsof-end + .. code-block:: text + :name: cf-docs-snippet-cn-quickstart-devnet-port-in-use-lsof-output-start COMMAND PID USER FD TYPE DEVICE SIZE/OFF NODE NAME node 12345 USERNAME 34u IPv6 DEVICE 0t0 TCP localhost:5173 (LISTEN) +.. cf-docs-snippet-cn-quickstart-devnet-port-in-use-lsof-output-end + .. code-block:: bash + :name: cf-docs-snippet-cn-quickstart-devnet-port-in-use-kill-start kill -9 12345 +.. cf-docs-snippet-cn-quickstart-devnet-port-in-use-kill-end + Restart unhealthy Docker containers ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ @@ -801,21 +927,30 @@ If you have trouble connecting to healthy containers, restart the Docker contain Stop the container .. code-block:: bash + :name: cf-docs-snippet-cn-quickstart-devnet-unhealthy-validator-down-start docker compose -f splice-node/docker-compose/validator/compose.yaml down +.. cf-docs-snippet-cn-quickstart-devnet-unhealthy-validator-down-end + Start fresh and capture the logs .. code-block:: bash + :name: cf-docs-snippet-cn-quickstart-devnet-unhealthy-validator-up-capture-logs-start docker compose -f splice-node/docker-compose/validator/compose.yaml up validator 2>&1 | tee validator-startup.log +.. cf-docs-snippet-cn-quickstart-devnet-unhealthy-validator-up-capture-logs-end + Read logs in terminal: .. code-block:: bash + :name: cf-docs-snippet-cn-quickstart-devnet-unhealthy-validator-read-logs-start docker logs splice-validator-validator-1 2>&1 | head -300 +.. cf-docs-snippet-cn-quickstart-devnet-unhealthy-validator-read-logs-end + Replace ``splice-validator-validator-1`` with the desired container. Keycloak @@ -833,24 +968,34 @@ Keycloak Check Keycloak logs: .. code-block:: bash + :name: cf-docs-snippet-cn-quickstart-devnet-keycloak-logs-start docker logs keycloak +.. cf-docs-snippet-cn-quickstart-devnet-keycloak-logs-end + Check PostgreSQL: .. code-block:: bash + :name: cf-docs-snippet-cn-quickstart-devnet-keycloak-postgres-logs-start docker logs postgres-keycloak +.. cf-docs-snippet-cn-quickstart-devnet-keycloak-postgres-logs-end + Check the OIDC discovery endpoint: .. code-block:: bash + :name: cf-docs-snippet-cn-quickstart-devnet-keycloak-oidc-discovery-start curl -s http://keycloak.localhost:8082/realms/AppProvider/.well-known/openid-configuration | jq . +.. cf-docs-snippet-cn-quickstart-devnet-keycloak-oidc-discovery-end + Get an OAuth2 ``AppProvider realm`` token: .. code-block:: bash + :name: cf-docs-snippet-cn-quickstart-devnet-keycloak-app-provider-token-start curl -s -X POST http://keycloak.localhost:8082/realms/AppProvider/protocol/openid-connect/token \ -H "Content-Type: application/x-www-form-urlencoded" \ @@ -859,9 +1004,12 @@ Get an OAuth2 ``AppProvider realm`` token: -d "username=app-provider" \ -d "password=app-provider" | jq .access_token +.. cf-docs-snippet-cn-quickstart-devnet-keycloak-app-provider-token-end + Get an OAuth2 ``AppUser realm`` token: .. code-block:: bash + :name: cf-docs-snippet-cn-quickstart-devnet-keycloak-app-user-token-start curl -s -X POST http://keycloak.localhost:8082/realms/AppUser/protocol/openid-connect/token \ -H "Content-Type: application/x-www-form-urlencoded" \ @@ -870,24 +1018,33 @@ Get an OAuth2 ``AppUser realm`` token: -d "username=app-user" \ -d "password=app-user" | jq .access_token +.. cf-docs-snippet-cn-quickstart-devnet-keycloak-app-user-token-end + Check Keycloak's public key location: .. code-block:: bash + :name: cf-docs-snippet-cn-quickstart-devnet-keycloak-public-key-location-start curl -s http://keycloak.localhost:8082/realms/AppProvider/.well-known/openid-configuration | jq .issuer +.. cf-docs-snippet-cn-quickstart-devnet-keycloak-public-key-location-end + Expected response is ``"http://host.docker.internal:8082/realms/AppProvider"`` Unable to login to Keycloak as admin ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ .. code-block:: bash + :name: cf-docs-snippet-cn-quickstart-devnet-keycloak-admin-ssl-logs-start docker logs keycloak 2>&1 | grep -i "ssl\|https\|require" | tail -20 +.. cf-docs-snippet-cn-quickstart-devnet-keycloak-admin-ssl-logs-end + The following command disables the SSL requirements for the master realm and allows you to login as admin at ``localhost:8082``. .. code-block:: bash + :name: cf-docs-snippet-cn-quickstart-devnet-keycloak-admin-disable-ssl-start docker exec -it keycloak /opt/keycloak/bin/kcadm.sh config credentials \ --server http://localhost:8082 --realm master --user admin --password admin @@ -895,61 +1052,85 @@ The following command disables the SSL requirements for the master realm and all docker exec -it keycloak /opt/keycloak/bin/kcadm.sh update realms/master \ -s sslRequired=NONE +.. cf-docs-snippet-cn-quickstart-devnet-keycloak-admin-disable-ssl-end + Splice-onboarding troubleshooting ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ Find specific env values: .. code-block:: bash + :name: cf-docs-snippet-cn-quickstart-devnet-splice-onboarding-env-start docker exec splice-onboarding env | grep -E "PARTICIPANT|LEDGER" +.. cf-docs-snippet-cn-quickstart-devnet-splice-onboarding-env-end + Restart the ``splice-onboarding`` container: .. code-block:: bash + :name: cf-docs-snippet-cn-quickstart-devnet-splice-onboarding-restart-start cd cn-quickstart/quickstart/docker/modules/devnet docker compose --env-file compose.env -f compose.yaml --profile devnet down -v docker compose --env-file compose.env -f compose.yaml --profile devnet build --no-cache splice-onboarding docker compose --env-file compose.env -f compose.yaml --profile devnet up -d +.. cf-docs-snippet-cn-quickstart-devnet-splice-onboarding-restart-end + Watch the logs: .. code-block:: bash + :name: cf-docs-snippet-cn-quickstart-devnet-splice-onboarding-logs-start docker logs -f splice-onboarding +.. cf-docs-snippet-cn-quickstart-devnet-splice-onboarding-logs-end + Query ``splice-onboarding`` networks: .. code-block:: bash + :name: cf-docs-snippet-cn-quickstart-devnet-splice-onboarding-networks-start docker inspect splice-onboarding --format '{{json .NetworkSettings.Networks}}' | jq +.. cf-docs-snippet-cn-quickstart-devnet-splice-onboarding-networks-end + Check which network the ``splice-validator-nginx`` is on: .. code-block:: bash + :name: cf-docs-snippet-cn-quickstart-devnet-validator-nginx-container-names-start docker ps --format "{{.Names}}" | grep -E "nginx|validator|participant" +.. cf-docs-snippet-cn-quickstart-devnet-validator-nginx-container-names-end + Then inspect that container to see its network: .. code-block:: bash + :name: cf-docs-snippet-cn-quickstart-devnet-validator-nginx-networks-start docker inspect splice-validator-nginx-1 --format '{{json .NetworkSettings.Networks}}' 2>/dev/null | jq || \ docker network inspect splice-validator_splice_validator --format '{{range .Containers}}{{.Name}} {{end}}' +.. cf-docs-snippet-cn-quickstart-devnet-validator-nginx-networks-end + Check if ``splice-onboarding`` is initialized: .. code-block:: bash + :name: cf-docs-snippet-cn-quickstart-devnet-splice-onboarding-initialized-start docker exec splice-onboarding cat /tmp/all-done && echo "SUCCESS" +.. cf-docs-snippet-cn-quickstart-devnet-splice-onboarding-initialized-end + Splice-onboarding connection issue ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ If you run ``splice-onboarding`` logs and see: .. code-block:: text + :name: cf-docs-snippet-cn-quickstart-devnet-splice-onboarding-connection-error-output-start (base) devnet ~ % docker logs -f splice-onboarding Start with mode --init @@ -961,5 +1142,7 @@ If you run ``splice-onboarding`` logs and see: Waiting for participant... attempt 4/60 Waiting for participant... attempt 5/60 +.. cf-docs-snippet-cn-quickstart-devnet-splice-onboarding-connection-error-output-end + Then there is likely an error in ``LEDGER_HOST`` or ``LEDGER_PORT``. Unset the variables or quit and restart terminal. diff --git a/sdk/docs/sharable/sdk/quickstart/operate/explore-the-demo.rst b/sdk/docs/sharable/sdk/quickstart/operate/explore-the-demo.rst index fe0719f51..06f020a39 100644 --- a/sdk/docs/sharable/sdk/quickstart/operate/explore-the-demo.rst +++ b/sdk/docs/sharable/sdk/quickstart/operate/explore-the-demo.rst @@ -100,9 +100,12 @@ Build Quickstart Build and start App Quickstart: .. code-block:: bash + :name: cf-docs-snippet-cn-quickstart-explore-demo-make-build-and-start-start make build; make start +.. cf-docs-snippet-cn-quickstart-explore-demo-make-build-and-start-end + Open an incognito browser and navigate to: :: diff --git a/sdk/docs/sharable/sdk/quickstart/operate/how-to-onboard-external-parties-in-quickstart.rst b/sdk/docs/sharable/sdk/quickstart/operate/how-to-onboard-external-parties-in-quickstart.rst index f4b030e53..a0b236b38 100644 --- a/sdk/docs/sharable/sdk/quickstart/operate/how-to-onboard-external-parties-in-quickstart.rst +++ b/sdk/docs/sharable/sdk/quickstart/operate/how-to-onboard-external-parties-in-quickstart.rst @@ -33,6 +33,7 @@ If you haven't installed the Canton Network Quickstart application, refer to :ref:`quickstart-cnqs-installation`. .. code-block:: bash + :name: cf-docs-snippet-cn-quickstart-external-parties-localnet-setup-start # Navigate to Quickstart directory and run setup cd cn-quickstart @@ -47,15 +48,20 @@ refer to :ref:`quickstart-cnqs-installation`. # Start LocalNet make start +.. cf-docs-snippet-cn-quickstart-external-parties-localnet-setup-end + Your ``.env.local`` file should look like: .. code-block:: text + :name: cf-docs-snippet-cn-quickstart-external-parties-env-local-example-start OBSERVABILITY_ENABLED=false AUTH_MODE=shared-secret PARTY_HINT=quickstart-USERNAME-1 TEST_MODE=off +.. cf-docs-snippet-cn-quickstart-external-parties-env-local-example-end + **Obtain Admin Token** The external party topology APIs require authentication. @@ -63,18 +69,22 @@ In shared-secret mode, you generate a JWT token using the ``splice-onboarding`` container with ``app-user`` as the subject: .. code-block:: bash + :name: cf-docs-snippet-cn-quickstart-external-parties-admin-token-start ADMIN_TOKEN=$(docker exec splice-onboarding \ jwt-cli encode hs256 --s unsafe --p '{"sub": "app-user", "aud": "https://canton.network.global"}') echo $ADMIN_TOKEN +.. cf-docs-snippet-cn-quickstart-external-parties-admin-token-end + Generate Cryptographic Keys --------------------------- Create an Ed25519 key pair for the external party. .. code-block:: bash + :name: cf-docs-snippet-cn-quickstart-external-parties-generate-ed25519-keys-start # Generate Ed25519 private key in PEM format openssl genpkey -algorithm ed25519 -out external_party_private.pem @@ -83,6 +93,8 @@ Create an Ed25519 key pair for the external party. HEX_PUBLIC_KEY=$(openssl pkey -in external_party_private.pem -pubout -outform DER | tail -c 32 | xxd -p -c 32) echo "Hex public key: $HEX_PUBLIC_KEY" +.. cf-docs-snippet-cn-quickstart-external-parties-generate-ed25519-keys-end + Onboard an External Party ------------------------- @@ -92,13 +104,17 @@ Generate Topology Transactions Update the ``party_hint`` value below to match your ``.env.local`` configuration. .. code-block:: bash + :name: cf-docs-snippet-cn-quickstart-external-parties-party-hint-from-env-start # Extract party hint from .env.local PARTY_HINT=$(grep '^PARTY_HINT=' .env.local | cut -d= -f2) +.. cf-docs-snippet-cn-quickstart-external-parties-party-hint-from-env-end + Use the validator API to generate the three required topology transactions: .. code-block:: bash + :name: cf-docs-snippet-cn-quickstart-external-parties-generate-topology-request-start GENERATE_RESPONSE=$(curl -sS -X POST http://localhost:2903/api/validator/v0/admin/external-party/topology/generate \ -H "Authorization: Bearer $ADMIN_TOKEN" \ @@ -110,9 +126,12 @@ Use the validator API to generate the three required topology transactions: echo "$GENERATE_RESPONSE" | jq . +.. cf-docs-snippet-cn-quickstart-external-parties-generate-topology-request-end + **Example response:** .. code-block:: json + :name: cf-docs-snippet-cn-quickstart-external-parties-generate-topology-response-start { "party_id": "quickstart-USERNAME-1::1220abc123...", @@ -132,6 +151,8 @@ Use the validator API to generate the three required topology transactions: ] } +.. cf-docs-snippet-cn-quickstart-external-parties-generate-topology-response-end + The response contains: - ``party_id``: The allocated party identifier (party hint + key fingerprint) @@ -152,6 +173,7 @@ The ``GENERATE_RESPONSE`` variable was set by the curl command above. Now extract the party ID, topology transactions, and hashes: .. code-block:: bash + :name: cf-docs-snippet-cn-quickstart-external-parties-extract-topology-fields-start # Extract party_id for later use PARTY_ID=$(echo "$GENERATE_RESPONSE" | jq -r '.party_id') @@ -176,11 +198,14 @@ Now extract the party ID, topology transactions, and hashes: echo "Hash 2: $HASH_2" echo "Hash 3: $HASH_3" +.. cf-docs-snippet-cn-quickstart-external-parties-extract-topology-fields-end + **Sign each hash with Ed25519 private key:** The signing commands use temporary files for cross-platform compatibility: .. code-block:: bash + :name: cf-docs-snippet-cn-quickstart-external-parties-sign-topology-hashes-start # Sign hash 1 printf '%s' "$HASH_1" | xxd -r -p > /tmp/hash1.bin @@ -197,6 +222,8 @@ The signing commands use temporary files for cross-platform compatibility: SIG_3=$(openssl pkeyutl -sign -inkey external_party_private.pem -rawin -in /tmp/hash3.bin | xxd -p | tr -d '\n') echo "Signature 3: $SIG_3" +.. cf-docs-snippet-cn-quickstart-external-parties-sign-topology-hashes-end + .. note:: The hashes and signatures are hex-encoded strings. The submit API expects: @@ -208,6 +235,7 @@ Submit Signed Topology Transactions ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ .. code-block:: bash + :name: cf-docs-snippet-cn-quickstart-external-parties-submit-topology-request-start curl -X POST http://localhost:2903/api/validator/v0/admin/external-party/topology/submit \ -H "Authorization: Bearer $ADMIN_TOKEN" \ @@ -230,14 +258,19 @@ Submit Signed Topology Transactions ] }' +.. cf-docs-snippet-cn-quickstart-external-parties-submit-topology-request-end + **Successful response:** .. code-block:: json + :name: cf-docs-snippet-cn-quickstart-external-parties-submit-topology-response-start { "party_id": "quickstart-USERNAME-1::1220abc123..." } +.. cf-docs-snippet-cn-quickstart-external-parties-submit-topology-response-end + Validate Party Creation ^^^^^^^^^^^^^^^^^^^^^^^ @@ -246,21 +279,28 @@ After submitting the signed topology transactions, verify the external party was Generate a Ledger API token for the ``ledger-api-user``. .. code-block:: bash + :name: cf-docs-snippet-cn-quickstart-external-parties-ledger-api-token-start LEDGER_TOKEN=$(docker exec splice-onboarding \ jwt-cli encode hs256 --s unsafe --p '{"sub": "ledger-api-user", "aud": "https://canton.network.global"}') +.. cf-docs-snippet-cn-quickstart-external-parties-ledger-api-token-end + .. code-block:: bash + :name: cf-docs-snippet-cn-quickstart-external-parties-query-parties-start # Query parties endpoint to verify party exists curl -f -sS "http://localhost:2975/v2/parties?parties=$PARTY_ID" \ -H "Authorization: Bearer $LEDGER_TOKEN" +.. cf-docs-snippet-cn-quickstart-external-parties-query-parties-end + **Discover Synchronizer ID** The synchronizer ID identifies the network your participant is connected to and is required for topology validation and transaction submission. .. code-block:: bash + :name: cf-docs-snippet-cn-quickstart-external-parties-get-synchronizer-id-start # Get the synchronizer ID from connected synchronizers SYNCHRONIZER_ID=$(curl -f -sS -L http://localhost:2975/v2/state/connected-synchronizers \ @@ -268,9 +308,12 @@ The synchronizer ID identifies the network your participant is connected to and echo "Synchronizer ID: $SYNCHRONIZER_ID" +.. cf-docs-snippet-cn-quickstart-external-parties-get-synchronizer-id-end + This typically returns a value like ``global-domain::12209d604bfb...``. .. code-block:: bash + :name: cf-docs-snippet-cn-quickstart-external-parties-list-party-to-participant-mappings-start # List party-to-participant mappings to verify party is in topology grpcurl -plaintext -d '{ @@ -283,6 +326,8 @@ This typically returns a value like ``global-domain::12209d604bfb...``. "filter_party": "'"$PARTY_ID"'" }' localhost:2902 com.digitalasset.canton.topology.admin.v30.TopologyManagerReadService/ListPartyToParticipant +.. cf-docs-snippet-cn-quickstart-external-parties-list-party-to-participant-mappings-end + .. note:: Topology transaction submission is asynchronous. @@ -313,6 +358,7 @@ The Ping template requires an ``initiator`` (your external party) and a ``respon Retrieve the ``app_user`` party from your Quickstart LocalNet to use as responder: .. code-block:: bash + :name: cf-docs-snippet-cn-quickstart-external-parties-get-responder-party-start RESPONDER_PARTY=$(grpcurl -plaintext -H "Authorization: Bearer $LEDGER_TOKEN" localhost:2901 \ com.daml.ledger.api.v2.admin.PartyManagementService/ListKnownParties | \ @@ -320,9 +366,12 @@ Retrieve the ``app_user`` party from your Quickstart LocalNet to use as responde echo "Responder party: $RESPONDER_PARTY" +.. cf-docs-snippet-cn-quickstart-external-parties-get-responder-party-end + Submit the ``Ping`` contract: .. code-block:: bash + :name: cf-docs-snippet-cn-quickstart-external-parties-prepare-ping-submission-start grpcurl -emit-defaults -plaintext \ -H "Authorization: Bearer $LEDGER_TOKEN" \ @@ -353,6 +402,8 @@ Submit the ``Ping`` contract: com.daml.ledger.api.v2.interactive.InteractiveSubmissionService/PrepareSubmission \ > prepare_response.json +.. cf-docs-snippet-cn-quickstart-external-parties-prepare-ping-submission-end + .. note:: The ``user_id`` must be ``ledger-api-user`` to match the JWT subject used for the ``LEDGER_TOKEN``. @@ -363,10 +414,13 @@ Submit the ``Ping`` contract: module name, and template name. Discover deployed packages using: .. code-block:: bash + :name: cf-docs-snippet-cn-quickstart-external-parties-list-deployed-packages-start grpcurl -plaintext -H "Authorization: Bearer $LEDGER_TOKEN" localhost:2901 \ com.daml.ledger.api.v2.PackageService/ListPackages + .. cf-docs-snippet-cn-quickstart-external-parties-list-deployed-packages-end + **Response fields:** - ``prepared_transaction``: The full transaction and metadata to be signed @@ -376,10 +430,13 @@ Submit the ``Ping`` contract: Extract the prepared transaction and hash for signing: .. code-block:: bash + :name: cf-docs-snippet-cn-quickstart-external-parties-extract-prepared-transaction-start PREPARED_TRANSACTION=$(cat prepare_response.json | jq .prepared_transaction) TRANSACTION_HASH=$(cat prepare_response.json | jq -r .prepared_transaction_hash) +.. cf-docs-snippet-cn-quickstart-external-parties-extract-prepared-transaction-end + Step 2: Validate and Sign ^^^^^^^^^^^^^^^^^^^^^^^^^ @@ -388,9 +445,12 @@ Step 2: Validate and Sign Before signing, inspect the prepared transaction to verify it matches your intent: .. code-block:: bash + :name: cf-docs-snippet-cn-quickstart-external-parties-inspect-prepared-transaction-start cat prepare_response.json | jq .prepared_transaction +.. cf-docs-snippet-cn-quickstart-external-parties-inspect-prepared-transaction-end + **2. Sign the Hash** Sign the ``$TRANSACTION_HASH`` returned by ``PrepareSubmission`` with your Ed25519 private key: @@ -404,6 +464,7 @@ Sign the ``$TRANSACTION_HASH`` returned by ``PrepareSubmission`` with your Ed255 **Sign the hash with your private key:** .. code-block:: bash + :name: cf-docs-snippet-cn-quickstart-external-parties-sign-prepared-transaction-hash-start # Decode base64 hash to temp file printf '%s' "$TRANSACTION_HASH" | base64 --decode > /tmp/tx_hash.bin @@ -411,6 +472,8 @@ Sign the ``$TRANSACTION_HASH`` returned by ``PrepareSubmission`` with your Ed255 # Sign and encode to base64 SIGNATURE=$(openssl pkeyutl -sign -inkey external_party_private.pem -rawin -in /tmp/tx_hash.bin | base64 | tr -d '\n') +.. cf-docs-snippet-cn-quickstart-external-parties-sign-prepared-transaction-hash-end + Store the signature for the execute step. Step 3: Execute Submission @@ -419,6 +482,7 @@ Step 3: Execute Submission Submit the signed transaction using ``InteractiveSubmissionService/ExecuteSubmission``: .. code-block:: bash + :name: cf-docs-snippet-cn-quickstart-external-parties-execute-submission-start SUBMISSION_ID=$(uuidgen) @@ -447,6 +511,8 @@ Submit the signed transaction using ``InteractiveSubmissionService/ExecuteSubmis }' localhost:2901 \ com.daml.ledger.api.v2.interactive.InteractiveSubmissionService/ExecuteSubmission +.. cf-docs-snippet-cn-quickstart-external-parties-execute-submission-end + **Key fields:** - ``submission_id``: A new UUID for this submission attempt (can retry with a new ID without re-signing) @@ -466,6 +532,7 @@ Verify the transaction was processed using the ``CompletionStream`` endpoint. In your second terminal: .. code-block:: bash + :name: cf-docs-snippet-cn-quickstart-external-parties-stream-completions-start grpcurl -emit-defaults -plaintext -H "Authorization: Bearer $LEDGER_TOKEN" -d '{ "user_id": "ledger-api-user", @@ -474,16 +541,22 @@ In your second terminal: com.daml.ledger.api.v2.CommandCompletionService/CompletionStream \ > completion_response.json +.. cf-docs-snippet-cn-quickstart-external-parties-stream-completions-end + The stream captures the completion after executing Step 3 in your original terminal. Stop the stream, then inspect the result: .. code-block:: bash + :name: cf-docs-snippet-cn-quickstart-external-parties-inspect-completion-start cat completion_response.json | jq . - A ``status.code`` of ``0`` indicates success: +.. cf-docs-snippet-cn-quickstart-external-parties-inspect-completion-end + +A ``status.code`` of ``0`` indicates success: .. code-block:: json + :name: cf-docs-snippet-cn-quickstart-external-parties-completion-success-response-start { "completion": { @@ -494,11 +567,14 @@ Stop the stream, then inspect the result: } } +.. cf-docs-snippet-cn-quickstart-external-parties-completion-success-response-end + **Query Transaction Details (Optional)** Extract the ``offset`` from the completion and use ``GetUpdates`` to retrieve full transaction details: .. code-block:: bash + :name: cf-docs-snippet-cn-quickstart-external-parties-get-transaction-updates-start COMPLETION_OFFSET=$(cat completion_response.json | jq -r '.completion.offset') @@ -520,6 +596,8 @@ Extract the ``offset`` from the completion and use ``GetUpdates`` to retrieve fu }' localhost:2901 \ com.daml.ledger.api.v2.UpdateService/GetUpdates +.. cf-docs-snippet-cn-quickstart-external-parties-get-transaction-updates-end + .. note:: External parties authenticate via cryptographic signatures rather than ledger user rights. diff --git a/sdk/docs/sharable/sdk/quickstart/operate/json-api.rst b/sdk/docs/sharable/sdk/quickstart/operate/json-api.rst index 11355d10c..1dd67e90f 100644 --- a/sdk/docs/sharable/sdk/quickstart/operate/json-api.rst +++ b/sdk/docs/sharable/sdk/quickstart/operate/json-api.rst @@ -127,6 +127,7 @@ Get a Token Use the AppUser validator client to get a token. .. code-block:: bash + :name: cf-docs-snippet-cn-quickstart-json-api-get-user-admin-token-start export USER_ADMIN_TOKEN=$(curl -fsS "http://keycloak.localhost:8082/realms/AppUser/protocol/openid-connect/token" \ -H "Content-Type: application/x-www-form-urlencoded" \ @@ -135,6 +136,8 @@ Use the AppUser validator client to get a token. -d "grant_type=client_credentials" \ -d "scope=openid" | jq -r .access_token) +.. cf-docs-snippet-cn-quickstart-json-api-get-user-admin-token-end + (client_secret is set in oauth2.env and AppUser-realm.json) An empty return indicates success. @@ -142,37 +145,50 @@ An empty return indicates success. Verify the token .. code-block:: bash + :name: cf-docs-snippet-cn-quickstart-json-api-echo-user-admin-token-start echo $USER_ADMIN_TOKEN +.. cf-docs-snippet-cn-quickstart-json-api-echo-user-admin-token-end + Use the token ~~~~~~~~~~~~~ List existing parties and include the token in API requests .. code-block:: bash + :name: cf-docs-snippet-cn-quickstart-json-api-list-parties-start curl -H "Authorization: Bearer $USER_ADMIN_TOKEN" \ http://localhost:2975/v2/parties +.. cf-docs-snippet-cn-quickstart-json-api-list-parties-end + View Party and DSO activity in lnav ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ View Party activity in lnav with the ``filter-in`` command followed by the app provider or app user IDs. .. code-block:: text + :name: cf-docs-snippet-cn-quickstart-json-api-lnav-filter-app-provider-start :filter-in APP_PROVIDER_ID +.. cf-docs-snippet-cn-quickstart-json-api-lnav-filter-app-provider-end + You can also view DSO activity in lnav using the DSO ID. .. code-block:: text + :name: cf-docs-snippet-cn-quickstart-json-api-lnav-filter-dso-start :filter-in DSO_ID +.. cf-docs-snippet-cn-quickstart-json-api-lnav-filter-dso-end + Save the ``party`` values for ``app-provider`` as APP_PROVIDER_PARTY and ``app-user`` as APP_USER_PARTY. .. code-block:: bash + :name: cf-docs-snippet-cn-quickstart-json-api-save-app-parties-start APP_PROVIDER_PARTY=$(curl -s -H "Authorization: Bearer $USER_ADMIN_TOKEN" http://localhost:2975/v2/parties | \ jq -r '.partyDetails[] | select(.party | startswith("app_provider_quickstart-")) | .party') @@ -183,16 +199,21 @@ Save the ``party`` values for ``app-provider`` as APP_PROVIDER_PARTY and ``app-u echo "APP_PROVIDER_PARTY: $APP_PROVIDER_PARTY" echo "APP_USER_PARTY: $APP_USER_PARTY" +.. cf-docs-snippet-cn-quickstart-json-api-save-app-parties-end + Save the DSO Party ~~~~~~~~~~~~~~~~~~ .. code-block:: bash + :name: cf-docs-snippet-cn-quickstart-json-api-save-dso-party-start DSO_PARTY=$(curl -s "http://localhost:2975/v2/parties" \ -H "Authorization: Bearer $USER_ADMIN_TOKEN" | \ jq -r '.partyDetails[] | select(.party | startswith("DSO::")) | .party') echo "DSO Party: $DSO_PARTY" +.. cf-docs-snippet-cn-quickstart-json-api-save-dso-party-end + You're now ready to make authenticated JSON API calls to your LocalNet. Token management troubleshooting @@ -208,6 +229,7 @@ Create a party Create a new party on the AppUser validator. .. code-block:: bash + :name: cf-docs-snippet-cn-quickstart-json-api-create-party-request-start curl -X POST http://localhost:2975/v2/parties \ -H "Authorization: Bearer $USER_ADMIN_TOKEN" \ @@ -216,12 +238,15 @@ Create a new party on the AppUser validator. "partyIdHint": "Alice" }' +.. cf-docs-snippet-cn-quickstart-json-api-create-party-request-end + You can use any name as the ``partyIdHint`` value. Canton may append additional characters for uniqueness. Success Response: .. code-block:: json + :name: cf-docs-snippet-cn-quickstart-json-api-create-party-response-start { "partyDetails": { @@ -232,19 +257,27 @@ Success Response: } } +.. cf-docs-snippet-cn-quickstart-json-api-create-party-response-end + See the new participant Alice in lnav ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ .. code-block:: text + :name: cf-docs-snippet-cn-quickstart-json-api-lnav-filter-alice-name-start :filter-in: Alice +.. cf-docs-snippet-cn-quickstart-json-api-lnav-filter-alice-name-end + or .. code-block:: text + :name: cf-docs-snippet-cn-quickstart-json-api-lnav-filter-alice-id-start :filter-in: ALICE_ID +.. cf-docs-snippet-cn-quickstart-json-api-lnav-filter-alice-id-end + Troubleshoot common party creation issues ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ @@ -253,28 +286,37 @@ Troubleshoot common party creation issues ``INVALID_ARGUMENT``, ``Party already exists``, or ``400 Bad Request``: Party might already exist - check with: .. code-block:: bash + :name: cf-docs-snippet-cn-quickstart-json-api-list-parties-troubleshoot-start curl -X GET http://localhost:2975/v2/parties \ -H "Authorization: Bearer $USER_ADMIN_TOKEN" +.. cf-docs-snippet-cn-quickstart-json-api-list-parties-troubleshoot-end + Upload a DAR ------------ Upload the prebuilt licensing DAR to the validator. .. code-block:: bash + :name: cf-docs-snippet-cn-quickstart-json-api-upload-dar-request-start curl -X POST http://localhost:2975/v2/packages \ -H "Content-Type: application/octet-stream" \ -H "Authorization: Bearer $USER_ADMIN_TOKEN" \ --data-binary @./daml/licensing/.daml/dist/quickstart-licensing-0.0.1.dar +.. cf-docs-snippet-cn-quickstart-json-api-upload-dar-request-end + Success looks like: .. code-block:: json + :name: cf-docs-snippet-cn-quickstart-json-api-upload-dar-response-start {} +.. cf-docs-snippet-cn-quickstart-json-api-upload-dar-response-end + DAR Upload issues ~~~~~~~~~~~~~~~~~ @@ -290,9 +332,12 @@ Create a contract on LocalNet Inspect the DAR to find the package hash. Find and save the package ID, a 64-character hex string. .. code-block:: bash + :name: cf-docs-snippet-cn-quickstart-json-api-inspect-dar-start dpm damlc inspect-dar daml/licensing/.daml/dist/quickstart-licensing-0.0.1.dar +.. cf-docs-snippet-cn-quickstart-json-api-inspect-dar-end + We suggest copying and pasting this command for your convenience. If you choose to type it out, you may need to type the full directory without the use of autocomplete. @@ -310,26 +355,33 @@ At the time of publication, the repeating string of ``b59ffbf847ac36fee1a4a74386 Alternatively, if you're querying the ``quickstart-licensing`` DAR, as we do in this tutorial, you can quickly grep and save the project ID with: .. code-block:: bash + :name: cf-docs-snippet-cn-quickstart-json-api-save-package-id-start PACKAGE_ID=$(dpm damlc inspect-dar daml/licensing/.daml/dist/quickstart-licensing-0.0.1.dar | grep "quickstart-licensing-0.0.1-" | grep -v "dalf" | tail -1 | awk '{print $2}' | tr -d '"') echo $PACKAGE_ID +.. cf-docs-snippet-cn-quickstart-json-api-save-package-id-end + If you'd like to query a different DAR then change the file path. See the DAR activity in ``lnav`` by filtering the package ID ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ .. code-block:: text + :name: cf-docs-snippet-cn-quickstart-json-api-lnav-filter-package-id-start :filter-in PACKAGE_ID +.. cf-docs-snippet-cn-quickstart-json-api-lnav-filter-package-id-end + Create the Contract ~~~~~~~~~~~~~~~~~~~ Renew your token to query the participant: .. code-block:: bash + :name: cf-docs-snippet-cn-quickstart-json-api-renew-user-admin-token-start USER_ADMIN_TOKEN=$(curl -fsS "http://keycloak.localhost:8082/realms/AppUser/protocol/openid-connect/token" \ -H 'Content-Type: application/x-www-form-urlencoded' \ @@ -338,10 +390,13 @@ Renew your token to query the participant: -d 'grant_type=client_credentials' \ -d 'scope=openid' | jq -r .access_token) +.. cf-docs-snippet-cn-quickstart-json-api-renew-user-admin-token-end + Get PROVIDER_ADMIN_TOKEN ~~~~~~~~~~~~~~~~~~~~~~~~ .. code-block:: bash + :name: cf-docs-snippet-cn-quickstart-json-api-get-provider-admin-token-start PROVIDER_ADMIN_TOKEN=$(curl -f -s -S "http://keycloak.localhost:8082/realms/AppProvider/protocol/openid-connect/token" \ -H 'Content-Type: application/x-www-form-urlencoded' \ @@ -350,9 +405,12 @@ Get PROVIDER_ADMIN_TOKEN -d 'grant_type=client_credentials' \ -d 'scope=openid' | jq -r .access_token) +.. cf-docs-snippet-cn-quickstart-json-api-get-provider-admin-token-end + Get the user token: .. code-block:: bash + :name: cf-docs-snippet-cn-quickstart-json-api-get-user-token-start USER_TOKEN=$(curl -f -s -S "http://keycloak.localhost:8082/realms/AppUser/protocol/openid-connect/token" \ -H 'Content-Type: application/x-www-form-urlencoded' \ @@ -362,9 +420,12 @@ Get the user token: -d 'grant_type=password' \ -d 'scope=openid' | jq -r .access_token) +.. cf-docs-snippet-cn-quickstart-json-api-get-user-token-end + Create the ``AppInstallRequest``: .. code-block:: bash + :name: cf-docs-snippet-cn-quickstart-json-api-create-app-install-request-start curl -X POST "http://localhost:2975/v2/commands/submit-and-wait" \ -H "Authorization: Bearer $USER_TOKEN" \ @@ -392,17 +453,22 @@ Create the ``AppInstallRequest``: "packageIdSelectionPreference": [] }' +.. cf-docs-snippet-cn-quickstart-json-api-create-app-install-request-end + The return shows your first contract made on LocalNet via the JSON API ledger! The return looks something like: .. code-block:: + :name: cf-docs-snippet-cn-quickstart-json-api-create-app-install-request-response-start { "updateId": "122059bdefac3665d7a0e933017e8b4f68b5668945ca3ecca219bee89741f10b28b1", "completionOffset": 1666 } +.. cf-docs-snippet-cn-quickstart-json-api-create-app-install-request-response-end + updateId: A unique identifier for this ledger update/transaction. You can use this to track this specific operation in logs. completionOffset: The position in the ledger where this transaction was committed. For example, 1666 means this was the 1,666th transaction on this participant. @@ -410,9 +476,12 @@ For example, 1666 means this was the 1,666th transaction on this participant. See the contract creation in lnav by filtering for ``AppInstallRequest`` or filter by the ``updateId`` value. .. code-block:: text + :name: cf-docs-snippet-cn-quickstart-json-api-lnav-filter-app-install-request-start :filter-in AppInstallRequest +.. cf-docs-snippet-cn-quickstart-json-api-lnav-filter-app-install-request-end + The results show detailed information including the trace IDs. Trace IDs can be used to follow related activity throughout the complete business operation. .. image:: images/lnav-appinstallrequest.png @@ -429,9 +498,12 @@ In a new terminal window, from the ``quickstart/`` directory run ``make shell`` Query the ``AppInstallRequest`` contract: .. code-block:: text + :name: cf-docs-snippet-cn-quickstart-json-api-daml-shell-active-app-install-request-start active quickstart-licensing:Licensing.AppInstall:AppInstallRequest +.. cf-docs-snippet-cn-quickstart-json-api-daml-shell-active-app-install-request-end + .. image:: images/shell-appinstallrequest-active.png :alt: daml shell AppInstallRequest active @@ -447,15 +519,19 @@ Press tab to complete the contract ID and enter to see the contract details. Copy and save the contract ID to a new ``INSTALL_REQ_CID`` variable in the previous working terminal. .. code-block:: bash + :name: cf-docs-snippet-cn-quickstart-json-api-save-install-request-cid-start INSTALL_REQ_CID="###" +.. cf-docs-snippet-cn-quickstart-json-api-save-install-request-cid-end + Find the AppInstallRequest contract ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ Get the provider user token as a password grant for party rights. .. code-block:: bash + :name: cf-docs-snippet-cn-quickstart-json-api-get-provider-token-start PROVIDER_TOKEN=$(curl -f -s -S "http://keycloak.localhost:8082/realms/AppProvider/protocol/openid-connect/token" \ -H 'Content-Type: application/x-www-form-urlencoded' \ @@ -465,9 +541,12 @@ Get the provider user token as a password grant for party rights. -d 'grant_type=password' \ -d 'scope=openid' | jq -r .access_token) +.. cf-docs-snippet-cn-quickstart-json-api-get-provider-token-end + Exercise the Accept choice on the first contract: .. code-block:: bash + :name: cf-docs-snippet-cn-quickstart-json-api-accept-app-install-request-start JSON_PAYLOAD=$(cat <", wait a couple minutes and try again. (It can take up to 15 minutes). This is normal Canton Network behavior due to how the Participant Query Store (PQS) works. @@ -911,15 +1067,19 @@ Look up the Allocation Contract ID Query for the allocation in ``daml shell`` .. code-block:: bash + :name: cf-docs-snippet-cn-quickstart-json-api-daml-shell-active-allocations-start active splice-api-token-allocation-v1:Splice.Api.Token.AllocationV1:Allocation +.. cf-docs-snippet-cn-quickstart-json-api-daml-shell-active-allocations-end + Save the allocation contract ID as ALLOCATION_CID="###" Double check that the license renewal request, allocation , and license contract IDs are different. You may verify contract ID variables with values in ``daml shell``. .. code-block:: bash + :name: cf-docs-snippet-cn-quickstart-json-api-verify-renewal-variables-start echo "Renewal Request: $RENEWAL_REQ_CID" echo "Allocation: $ALLOCATION_CID" @@ -932,10 +1092,13 @@ You may verify contract ID variables with values in ``daml shell``. echo "DSO Party: $DSO_PARTY" echo "Contract ID: $APP_INSTALL_CID" +.. cf-docs-snippet-cn-quickstart-json-api-verify-renewal-variables-end + Renew the token ~~~~~~~~~~~~~~~ .. code-block:: bash + :name: cf-docs-snippet-cn-quickstart-json-api-renew-provider-token-start PROVIDER_TOKEN=$(curl -fsS "http://keycloak.localhost:8082/realms/AppProvider/protocol/openid-connect/token" \ -H 'Content-Type: application/x-www-form-urlencoded' \ @@ -945,13 +1108,18 @@ Renew the token -d 'grant_type=password' \ -d 'scope=openid' | jq -r .access_token) +.. cf-docs-snippet-cn-quickstart-json-api-renew-provider-token-end + Generate a unique command ID ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ .. code-block:: bash + :name: cf-docs-snippet-cn-quickstart-json-api-generate-complete-renewal-command-id-start COMMAND_ID="complete-renewal-$(date +%s%N)" +.. cf-docs-snippet-cn-quickstart-json-api-generate-complete-renewal-command-id-end + Set the endpoint path to connect to the backend service to complete the license renewal ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ @@ -959,13 +1127,17 @@ A backend service is required for this step because the DSO and the user exchang This information is not available to the Provider and therefore cannot be accessed via the daml shell. .. code-block:: bash + :name: cf-docs-snippet-cn-quickstart-json-api-set-complete-renewal-endpoint-start ENDPOINT="http://localhost:8080/licenses/${LICENSE_CID}:complete-renewal" +.. cf-docs-snippet-cn-quickstart-json-api-set-complete-renewal-endpoint-end + Create a variable for the request body ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ .. code-block:: bash + :name: cf-docs-snippet-cn-quickstart-json-api-set-complete-renewal-request-body-start REQUEST_BODY=$(cat </dev/null | jq '."https://daml.com/ledger-api"' +.. cf-docs-snippet-cn-quickstart-json-api-show-token-ledger-api-claims-end + How to discover the user and provider IDs ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ @@ -1143,6 +1332,7 @@ How to discover the user and provider IDs AppUser and AppProvider validator, wallet admin, and other IDs are located in their respective oauth2.env files. .. code-block:: bash + :name: cf-docs-snippet-cn-quickstart-json-api-discover-ids-admin-token-start # 1. Get admin token for the participant USER_ADMIN_TOKEN=$(curl -fsS "http://keycloak.localhost:8082/realms/AppUser/protocol/openid-connect/token" \ @@ -1152,20 +1342,31 @@ AppUser and AppProvider validator, wallet admin, and other IDs are located in th -d 'grant_type=client_credentials' \ -d 'scope=openid' | jq -r .access_token) +.. cf-docs-snippet-cn-quickstart-json-api-discover-ids-admin-token-end + .. code-block:: bash + :name: cf-docs-snippet-cn-quickstart-json-api-discover-ids-list-users-start # 2. List all users to discover the wallet admin user curl -s "http://localhost:2975/v2/users" \ -H "Authorization: Bearer $USER_ADMIN_TOKEN" | jq '.users[] | select(.metadata.annotations.username == "app-user")' +.. cf-docs-snippet-cn-quickstart-json-api-discover-ids-list-users-end + .. code-block:: bash + :name: cf-docs-snippet-cn-quickstart-json-api-discover-ids-extract-user-id-start # 3. Extract the user ID from the result APP_USER_ID=$(curl -s "http://localhost:2975/v2/users" \ -H "Authorization: Bearer $USER_ADMIN_TOKEN" | jq -r '.users[] | select(.metadata.annotations.username == "app-user") | .id') +.. cf-docs-snippet-cn-quickstart-json-api-discover-ids-extract-user-id-end + .. code-block:: bash + :name: cf-docs-snippet-cn-quickstart-json-api-discover-ids-get-party-start # 4. Get the party ID for that user APP_USER_PARTY=$(curl -s "http://localhost:2975/v2/users/$APP_USER_ID" \ -H "Authorization: Bearer $USER_ADMIN_TOKEN" | jq -r '.user.primaryParty') + +.. cf-docs-snippet-cn-quickstart-json-api-discover-ids-get-party-end From b4dacc7d03b010309c31203b5b2a9d6cdac9a102 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Wed, 4 Nov 2026 09:38:51 -0500 Subject: [PATCH 03/22] build(deps): bump certifi from 2026.2.25 to 2026.10.19 in /sdk (#394) Bumps [certifi](https://github.com/certifi/python-certifi) from 2026.2.25 to 2026.10.19. - [Commits](https://github.com/certifi/python-certifi/compare/2026.02.25...2026.10.19) --- updated-dependencies: - dependency-name: certifi dependency-version: 2026.10.19 dependency-type: indirect ... Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> --- sdk/poetry.lock | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/sdk/poetry.lock b/sdk/poetry.lock index 52e8767ac..9151b9ebb 100644 --- a/sdk/poetry.lock +++ b/sdk/poetry.lock @@ -1,4 +1,4 @@ -# This file is automatically @generated by Poetry 2.4.1 and should not be changed by hand. +# This file is automatically @generated by Poetry 2.5.1 and should not be changed by hand. [[package]] name = "alabaster" @@ -70,14 +70,14 @@ lxml = ["lxml"] [[package]] name = "certifi" -version = "2026.2.25" +version = "2026.10.19" description = "Python package for providing Mozilla's CA Bundle." optional = false python-versions = ">=3.7" groups = ["main"] files = [ - {file = "certifi-2026.2.25-py3-none-any.whl", hash = "sha256:027692e4402ad994f1c42e52a4997a9763c646b73e4096e4d5d6db8af1d6f0fa"}, - {file = "certifi-2026.2.25.tar.gz", hash = "sha256:e887ab5cee78ea814d3472169153c2d12cd43b14bd03329a39a9c6e2e80bfba7"}, + {file = "certifi-2026.10.19-py3-none-any.whl", hash = "sha256:42d35340cc5b9ba78e818ddbff0c5b1c2b779de448a340fd1b989f5fa8670e1b"}, + {file = "certifi-2026.10.19.tar.gz", hash = "sha256:035c1e85572b141bf1c3a3eff0e33a8eb74917522f2559075ff8d2fea780a1ae"}, ] [[package]] From fe7a2400b62da425fd2095e990d94065f8286683 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Wed, 4 Nov 2026 09:53:40 -0500 Subject: [PATCH 04/22] build(deps): bump urllib3 from 2.7.0 to 2.8.0 in /sdk (#388) Bumps [urllib3](https://github.com/urllib3/urllib3) from 2.7.0 to 2.8.0. - [Release notes](https://github.com/urllib3/urllib3/releases) - [Changelog](https://github.com/urllib3/urllib3/blob/main/CHANGES.rst) - [Commits](https://github.com/urllib3/urllib3/compare/2.7.0...2.8.0) --- updated-dependencies: - dependency-name: urllib3 dependency-version: 2.8.0 dependency-type: indirect ... Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> --- sdk/poetry.lock | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/sdk/poetry.lock b/sdk/poetry.lock index 9151b9ebb..41f47a389 100644 --- a/sdk/poetry.lock +++ b/sdk/poetry.lock @@ -1007,14 +1007,14 @@ files = [ [[package]] name = "urllib3" -version = "2.7.0" +version = "2.8.0" description = "HTTP library with thread-safe connection pooling, file post, and more." optional = false python-versions = ">=3.10" groups = ["main"] files = [ - {file = "urllib3-2.7.0-py3-none-any.whl", hash = "sha256:9fb4c81ebbb1ce9531cce37674bbc6f1360472bc18ca9a553ede278ef7276897"}, - {file = "urllib3-2.7.0.tar.gz", hash = "sha256:231e0ec3b63ceb14667c67be60f2f2c40a518cb38b03af60abc813da26505f4c"}, + {file = "urllib3-2.8.0-py3-none-any.whl", hash = "sha256:0cf3cae568d36aa9576b28dfb35f11328f1cb974ca7647d9475ebb86c75ac6e3"}, + {file = "urllib3-2.8.0.tar.gz", hash = "sha256:63bf2ead4c879426ebf22ef2a781eeb4aa3b4ae798a0435506f8687fd5bb9b63"}, ] [package.extras] From ec1e66466ca07f61617ab4206ebd230b5b4678d2 Mon Sep 17 00:00:00 2001 From: fernandomg Date: Wed, 29 Apr 2026 12:25:05 +0200 Subject: [PATCH 05/22] build: add BACKEND selector with dual-backend Make/Compose/Docker plumbing Adds BACKEND=java|js as a make-level selector, persisted in .env.local via make setup, with a compose override, Dockerfile, and start.sh for the JS service. The :daml gradle build emits both Java and TS codegen and skips the irrelevant one per active BACKEND. Root .gitignore gains an npm-prevention block to keep package.json/lock from leaking up to the repo root. Co-Authored-By: Gabito Esmiapodo <4015436+gabitoesmiapodo@users.noreply.github.com> --- .gitignore | 5 +++ quickstart/Makefile | 28 +++++++++++++-- .../src/main/kotlin/ConfigureProfilesTask.kt | 15 ++++++-- quickstart/daml/build.gradle.kts | 19 +++++++++- quickstart/docker/backend-js/Dockerfile | 23 ++++++++++++ quickstart/docker/backend-js/compose.yaml | 35 +++++++++++++++++++ quickstart/docker/backend-js/start.sh | 9 +++++ 7 files changed, 128 insertions(+), 6 deletions(-) create mode 100644 quickstart/docker/backend-js/Dockerfile create mode 100644 quickstart/docker/backend-js/compose.yaml create mode 100755 quickstart/docker/backend-js/start.sh diff --git a/.gitignore b/.gitignore index 66e09c861..50b9ee638 100644 --- a/.gitignore +++ b/.gitignore @@ -42,3 +42,8 @@ gradle-app.setting .direnv/ logs + +# Prevent accidental npm installs at the repo root +/node_modules/ +/package.json +/package-lock.json \ No newline at end of file diff --git a/quickstart/Makefile b/quickstart/Makefile index 3cb2b7cf1..ef46c738b 100644 --- a/quickstart/Makefile +++ b/quickstart/Makefile @@ -104,6 +104,13 @@ endif ############################################################################ #### backend-service ############################################################################ +# Backend implementation selector. Set via `make setup`; java (default) or js. +# Override per-invocation with `make BACKEND=js` if needed. +BACKEND ?= java +ifeq ($(BACKEND),js) + DOCKER_COMPOSE_FILES += -f ./docker/backend-js/compose.yaml +endif + ifeq ($(RESOURCE_CONSTRAINTS_ENABLED),true) RESOURCE_CONSTRAINT_CONFIG += -f ./docker/backend-service/resource-constraints.yaml endif @@ -158,12 +165,27 @@ build-frontend: ## Build the frontend application cd frontend && npm install && npm run build .PHONY: build-backend -build-backend: ## Build the backend service - ./gradlew :backend:build +build-backend: ## Build the backend service (Java by default; Node when BACKEND=js) +ifeq ($(BACKEND),js) + $(MAKE) build-backend-js +else + ./gradlew :backend:build -x :daml:tsCodegen +endif +.PHONY: build-backend-js +build-backend-js: docker-available build-daml ## Build the JS backend Docker image + $(call docker-compose, build backend-service) + +# Skip the codegen the active backend doesn't consume. distTar produces backend.tar for the +# Java image; the JS image doesn't consume it, and including it in the JS path would +# transitively re-pull :daml:codeGen via :backend:compileJava. .PHONY: build-daml build-daml: ## Build the Daml model - ./gradlew :daml:build distTar +ifeq ($(BACKEND),js) + ./gradlew :daml:build -x :daml:codeGen +else + ./gradlew :daml:build distTar -x :daml:tsCodegen +endif .PHONY: docker-available docker-available: ## Check if Docker CLI exists and is running diff --git a/quickstart/buildSrc/src/main/kotlin/ConfigureProfilesTask.kt b/quickstart/buildSrc/src/main/kotlin/ConfigureProfilesTask.kt index f7ea19df4..e1a2468e9 100644 --- a/quickstart/buildSrc/src/main/kotlin/ConfigureProfilesTask.kt +++ b/quickstart/buildSrc/src/main/kotlin/ConfigureProfilesTask.kt @@ -7,7 +7,7 @@ import java.io.File open class ConfigureProfilesTask : DefaultTask() { - enum class OptionType { BOOLEAN, PARTY_HINT, AUTH_MODE, TEST_MODE } + enum class OptionType { BOOLEAN, PARTY_HINT, AUTH_MODE, TEST_MODE, BACKEND } data class Option( val promptText: String, @@ -32,6 +32,7 @@ open class ConfigureProfilesTask : DefaultTask() { OptionType.PARTY_HINT ), Option("Enable TEST_MODE", "TEST_MODE", OptionType.TEST_MODE), + Option("Use Node.js backend (instead of Java)", "BACKEND", OptionType.BACKEND), ) options.forEach { option -> @@ -72,10 +73,20 @@ open class ConfigureProfilesTask : DefaultTask() { CAUTION: Not intended for use in production environments. Activates the test profile in the backend service. When enabled, party ID resolution is derived from the JWT token's party_id claim, overriding the tenant registration's party ID. - This feature is designed for testing purposes to generate a unique AppUser party for each test run and ensure isolation. + This feature is designed for testing purposes to generate a unique AppUser party for each test run and ensure isolation. """.trimIndent() ) } + + OptionType.BACKEND -> { + val boolValue = promptForBoolean(option.promptText, default = false) + option.value = if (boolValue) { + "js" + } else { + "java" + } + println(" ${option.envVarName} set to '${option.value}'.\n") + } } System.out.flush() } diff --git a/quickstart/daml/build.gradle.kts b/quickstart/daml/build.gradle.kts index 80821f22b..cde166d34 100644 --- a/quickstart/daml/build.gradle.kts +++ b/quickstart/daml/build.gradle.kts @@ -36,6 +36,23 @@ tasks.register(" dependsOn("compileDaml") } +tasks.register("tsCodegen") { + val requiredVersion = VersionFiles.damlYamlSdk + val dar = file("$projectDir/licensing/.daml/dist/quickstart-licensing-0.0.1.dar") + val outputDir = file("$rootDir/backend-js/generated") + + inputs.file(dar) + outputs.dir(outputDir) + + doFirst { + outputDir.deleteRecursively() + outputDir.mkdirs() + } + commandLine("dpm", "codegen-js", dar.absolutePath, "-o", outputDir.absolutePath) + environment("DPM_SDK_VERSION", requiredVersion) + dependsOn("compileDaml") +} + tasks.named("build") { - dependsOn("codeGen") + dependsOn("codeGen", "tsCodegen") } diff --git a/quickstart/docker/backend-js/Dockerfile b/quickstart/docker/backend-js/Dockerfile new file mode 100644 index 000000000..c0226aa1e --- /dev/null +++ b/quickstart/docker/backend-js/Dockerfile @@ -0,0 +1,23 @@ +# syntax=docker/dockerfile:1.7 +FROM node:22-alpine AS build +WORKDIR /app +COPY backend-js/package.json backend-js/package-lock.json ./ +COPY backend-js/generated/ ./generated/ +RUN npm ci +# Vendored token-standard specs live under backend/. Copy them into a stable in-image path +# so prebuild can find them; the host script uses the same relative path via a symlink. +COPY backend/src/main/resources/vendored/ ./vendored/ +COPY backend-js/ ./ +RUN VENDORED_DIR=./vendored npm run build + +FROM node:22-alpine AS runtime +WORKDIR /app +RUN apk add --no-cache wget +COPY --from=build /app/package.json /app/package-lock.json ./ +COPY --from=build /app/generated/ ./generated/ +RUN npm ci --omit=dev +COPY --from=build /app/dist ./dist +COPY docker/backend-js/start.sh /app/start.sh +RUN chmod +x /app/start.sh +EXPOSE 8080 +CMD ["/app/start.sh"] diff --git a/quickstart/docker/backend-js/compose.yaml b/quickstart/docker/backend-js/compose.yaml new file mode 100644 index 000000000..5c80fed50 --- /dev/null +++ b/quickstart/docker/backend-js/compose.yaml @@ -0,0 +1,35 @@ +services: + backend-service: + image: !reset null + build: + context: . + dockerfile: docker/backend-js/Dockerfile + container_name: backend-service + labels: + - "description=Node.js backend service for the Quickstart Licensing workflow. + APP_PROVIDER_PARTY is resolved at runtime via the onboarding volume." + working_dir: /app + env_file: + - ./docker/backend-service/env/app.env + - ./docker/backend-service/onboarding/env/${AUTH_MODE}.env + environment: + NODE_ENV: production + BACKEND: js + # The JS backend talks to Canton over the JSON Ledger API, not gRPC. + LEDGER_PORT: "3${PARTICIPANT_JSON_API_PORT_SUFFIX}" + volumes: !override + - onboarding:/onboarding + command: /app/start.sh + ports: + - "${BACKEND_PORT}:${BACKEND_PORT}" + depends_on: + pqs-app-provider: + condition: service_started + splice-onboarding: + condition: service_healthy + healthcheck: + test: ["CMD", "wget", "-qO-", "http://localhost:${BACKEND_PORT}/livez"] + interval: 5s + timeout: 3s + retries: 30 + start_period: 10s diff --git a/quickstart/docker/backend-js/start.sh b/quickstart/docker/backend-js/start.sh new file mode 100755 index 000000000..6074c4053 --- /dev/null +++ b/quickstart/docker/backend-js/start.sh @@ -0,0 +1,9 @@ +#!/bin/sh +set -eu + +# Mirror Java's start.sh: source every onboarding script so APP_PROVIDER_PARTY etc. are exported. +for script in /onboarding/backend-service/on/*.sh; do + [ -f "$script" ] && . "$script" +done + +exec node /app/dist/server.js From 79debc32836da97f4f53fe7e258ee07eac671552 Mon Sep 17 00:00:00 2001 From: fernandomg Date: Wed, 29 Apr 2026 12:25:18 +0200 Subject: [PATCH 06/22] feat(backend-js): bootstrap Fastify server with config and tooling Project skeleton: package + lockfile, NodeNext tsconfig, runtime config loader, server entrypoint, app builder with ErrorResponse-shaped error handler and an empty-body JSON parser to accept the frontend's logout post. Co-Authored-By: Gabito Esmiapodo <4015436+gabitoesmiapodo@users.noreply.github.com> --- quickstart/backend-js/.gitignore | 5 + quickstart/backend-js/package-lock.json | 2152 +++++++++++++++++++++++ quickstart/backend-js/package.json | 36 + quickstart/backend-js/src/config.ts | 74 + quickstart/backend-js/src/http/app.ts | 76 + quickstart/backend-js/src/server.ts | 30 + quickstart/backend-js/tsconfig.json | 16 + 7 files changed, 2389 insertions(+) create mode 100644 quickstart/backend-js/.gitignore create mode 100644 quickstart/backend-js/package-lock.json create mode 100644 quickstart/backend-js/package.json create mode 100644 quickstart/backend-js/src/config.ts create mode 100644 quickstart/backend-js/src/http/app.ts create mode 100644 quickstart/backend-js/src/server.ts create mode 100644 quickstart/backend-js/tsconfig.json diff --git a/quickstart/backend-js/.gitignore b/quickstart/backend-js/.gitignore new file mode 100644 index 000000000..78fc095ab --- /dev/null +++ b/quickstart/backend-js/.gitignore @@ -0,0 +1,5 @@ +node_modules +dist +generated +src/token-standard/metadata.types.ts +src/token-standard/allocation.types.ts diff --git a/quickstart/backend-js/package-lock.json b/quickstart/backend-js/package-lock.json new file mode 100644 index 000000000..06d97d7d6 --- /dev/null +++ b/quickstart/backend-js/package-lock.json @@ -0,0 +1,2152 @@ +{ + "name": "backend-js", + "lockfileVersion": 3, + "requires": true, + "packages": { + "": { + "name": "backend-js", + "workspaces": [ + "generated/*" + ], + "dependencies": { + "@daml.js/quickstart-licensing-0.0.1": "*", + "@daml/types": "3.4.11", + "@fastify/cookie": "^11.0.2", + "@fastify/formbody": "^8.0.2", + "@fastify/session": "^11.1.1", + "fastify": "^5.8.5", + "jose": "^6.2.3", + "openid-client": "^6.8.4", + "pg": "^8.20.0", + "pino": "^10.3.1" + }, + "devDependencies": { + "@types/node": "^25.6.0", + "@types/pg": "^8.20.0", + "openapi-typescript": "^7.13.0", + "tsx": "^4.21.0", + "typescript": "^5.9.3" + }, + "engines": { + "node": ">=22" + } + }, + "generated/daml-prim-DA-Exception-ArithmeticError-1.0.0": { + "name": "@daml.js/daml-prim-DA-Exception-ArithmeticError-1.0.0", + "version": "0.0.0", + "license": "UNLICENSED", + "dependencies": { + "@mojotech/json-type-validation": "^3.1.0" + } + }, + "generated/daml-prim-DA-Exception-AssertionFailed-1.0.0": { + "name": "@daml.js/daml-prim-DA-Exception-AssertionFailed-1.0.0", + "version": "0.0.0", + "license": "UNLICENSED", + "dependencies": { + "@mojotech/json-type-validation": "^3.1.0" + } + }, + "generated/daml-prim-DA-Exception-GeneralError-1.0.0": { + "name": "@daml.js/daml-prim-DA-Exception-GeneralError-1.0.0", + "version": "0.0.0", + "license": "UNLICENSED", + "dependencies": { + "@mojotech/json-type-validation": "^3.1.0" + } + }, + "generated/daml-prim-DA-Exception-PreconditionFailed-1.0.0": { + "name": "@daml.js/daml-prim-DA-Exception-PreconditionFailed-1.0.0", + "version": "0.0.0", + "license": "UNLICENSED", + "dependencies": { + "@mojotech/json-type-validation": "^3.1.0" + } + }, + "generated/daml-prim-DA-Types-1.0.0": { + "name": "@daml.js/daml-prim-DA-Types-1.0.0", + "version": "0.0.0", + "license": "UNLICENSED", + "dependencies": { + "@mojotech/json-type-validation": "^3.1.0" + } + }, + "generated/daml-prim-GHC-Tuple-1.0.0": { + "name": "@daml.js/daml-prim-GHC-Tuple-1.0.0", + "version": "0.0.0", + "license": "UNLICENSED", + "dependencies": { + "@mojotech/json-type-validation": "^3.1.0" + } + }, + "generated/daml-prim-GHC-Types-1.0.0": { + "name": "@daml.js/daml-prim-GHC-Types-1.0.0", + "version": "0.0.0", + "license": "UNLICENSED", + "dependencies": { + "@mojotech/json-type-validation": "^3.1.0" + } + }, + "generated/daml-stdlib-DA-Date-Types-1.0.0": { + "name": "@daml.js/daml-stdlib-DA-Date-Types-1.0.0", + "version": "0.0.0", + "license": "UNLICENSED", + "dependencies": { + "@mojotech/json-type-validation": "^3.1.0" + } + }, + "generated/daml-stdlib-DA-Internal-Down-1.0.0": { + "name": "@daml.js/daml-stdlib-DA-Internal-Down-1.0.0", + "version": "0.0.0", + "license": "UNLICENSED", + "dependencies": { + "@mojotech/json-type-validation": "^3.1.0" + } + }, + "generated/daml-stdlib-DA-Logic-Types-1.0.0": { + "name": "@daml.js/daml-stdlib-DA-Logic-Types-1.0.0", + "version": "0.0.0", + "license": "UNLICENSED", + "dependencies": { + "@mojotech/json-type-validation": "^3.1.0" + } + }, + "generated/daml-stdlib-DA-Monoid-Types-1.0.0": { + "name": "@daml.js/daml-stdlib-DA-Monoid-Types-1.0.0", + "version": "0.0.0", + "license": "UNLICENSED", + "dependencies": { + "@mojotech/json-type-validation": "^3.1.0" + } + }, + "generated/daml-stdlib-DA-NonEmpty-Types-1.0.0": { + "name": "@daml.js/daml-stdlib-DA-NonEmpty-Types-1.0.0", + "version": "0.0.0", + "license": "UNLICENSED", + "dependencies": { + "@mojotech/json-type-validation": "^3.1.0" + } + }, + "generated/daml-stdlib-DA-Random-Types-1.0.0": { + "name": "@daml.js/daml-stdlib-DA-Random-Types-1.0.0", + "version": "0.0.0", + "license": "UNLICENSED", + "dependencies": { + "@mojotech/json-type-validation": "^3.1.0" + } + }, + "generated/daml-stdlib-DA-Semigroup-Types-1.0.0": { + "name": "@daml.js/daml-stdlib-DA-Semigroup-Types-1.0.0", + "version": "0.0.0", + "license": "UNLICENSED", + "dependencies": { + "@mojotech/json-type-validation": "^3.1.0" + } + }, + "generated/daml-stdlib-DA-Set-Types-1.0.0": { + "name": "@daml.js/daml-stdlib-DA-Set-Types-1.0.0", + "version": "0.0.0", + "license": "UNLICENSED", + "dependencies": { + "@mojotech/json-type-validation": "^3.1.0" + } + }, + "generated/daml-stdlib-DA-Stack-Types-1.0.0": { + "name": "@daml.js/daml-stdlib-DA-Stack-Types-1.0.0", + "version": "0.0.0", + "license": "UNLICENSED", + "dependencies": { + "@mojotech/json-type-validation": "^3.1.0" + } + }, + "generated/daml-stdlib-DA-Time-Types-1.0.0": { + "name": "@daml.js/daml-stdlib-DA-Time-Types-1.0.0", + "version": "0.0.0", + "license": "UNLICENSED", + "dependencies": { + "@mojotech/json-type-validation": "^3.1.0" + } + }, + "generated/daml-stdlib-DA-Validation-Types-1.0.0": { + "name": "@daml.js/daml-stdlib-DA-Validation-Types-1.0.0", + "version": "0.0.0", + "license": "UNLICENSED", + "dependencies": { + "@daml.js/daml-stdlib-DA-NonEmpty-Types-1.0.0": "file:../daml-stdlib-DA-NonEmpty-Types-1.0.0", + "@mojotech/json-type-validation": "^3.1.0" + } + }, + "generated/ghc-stdlib-DA-Internal-Template-1.0.0": { + "name": "@daml.js/ghc-stdlib-DA-Internal-Template-1.0.0", + "version": "0.0.0", + "license": "UNLICENSED", + "dependencies": { + "@mojotech/json-type-validation": "^3.1.0" + } + }, + "generated/quickstart-licensing-0.0.1": { + "name": "@daml.js/quickstart-licensing-0.0.1", + "version": "0.0.0", + "license": "UNLICENSED", + "dependencies": { + "@daml.js/daml-stdlib-DA-Time-Types-1.0.0": "file:../daml-stdlib-DA-Time-Types-1.0.0", + "@daml.js/ghc-stdlib-DA-Internal-Template-1.0.0": "file:../ghc-stdlib-DA-Internal-Template-1.0.0", + "@daml.js/splice-api-token-allocation-request-v1-1.0.0": "file:../splice-api-token-allocation-request-v1-1.0.0", + "@daml.js/splice-api-token-allocation-v1-1.0.0": "file:../splice-api-token-allocation-v1-1.0.0", + "@daml.js/splice-api-token-holding-v1-1.0.0": "file:../splice-api-token-holding-v1-1.0.0", + "@daml.js/splice-api-token-metadata-v1-1.0.0": "file:../splice-api-token-metadata-v1-1.0.0", + "@mojotech/json-type-validation": "^3.1.0" + } + }, + "generated/splice-api-token-allocation-request-v1-1.0.0": { + "name": "@daml.js/splice-api-token-allocation-request-v1-1.0.0", + "version": "0.0.0", + "license": "UNLICENSED", + "dependencies": { + "@daml.js/ghc-stdlib-DA-Internal-Template-1.0.0": "file:../ghc-stdlib-DA-Internal-Template-1.0.0", + "@daml.js/splice-api-token-allocation-v1-1.0.0": "file:../splice-api-token-allocation-v1-1.0.0", + "@daml.js/splice-api-token-metadata-v1-1.0.0": "file:../splice-api-token-metadata-v1-1.0.0", + "@mojotech/json-type-validation": "^3.1.0" + } + }, + "generated/splice-api-token-allocation-v1-1.0.0": { + "name": "@daml.js/splice-api-token-allocation-v1-1.0.0", + "version": "0.0.0", + "license": "UNLICENSED", + "dependencies": { + "@daml.js/ghc-stdlib-DA-Internal-Template-1.0.0": "file:../ghc-stdlib-DA-Internal-Template-1.0.0", + "@daml.js/splice-api-token-holding-v1-1.0.0": "file:../splice-api-token-holding-v1-1.0.0", + "@daml.js/splice-api-token-metadata-v1-1.0.0": "file:../splice-api-token-metadata-v1-1.0.0", + "@mojotech/json-type-validation": "^3.1.0" + } + }, + "generated/splice-api-token-holding-v1-1.0.0": { + "name": "@daml.js/splice-api-token-holding-v1-1.0.0", + "version": "0.0.0", + "license": "UNLICENSED", + "dependencies": { + "@daml.js/daml-stdlib-DA-Time-Types-1.0.0": "file:../daml-stdlib-DA-Time-Types-1.0.0", + "@daml.js/ghc-stdlib-DA-Internal-Template-1.0.0": "file:../ghc-stdlib-DA-Internal-Template-1.0.0", + "@daml.js/splice-api-token-metadata-v1-1.0.0": "file:../splice-api-token-metadata-v1-1.0.0", + "@mojotech/json-type-validation": "^3.1.0" + } + }, + "generated/splice-api-token-metadata-v1-1.0.0": { + "name": "@daml.js/splice-api-token-metadata-v1-1.0.0", + "version": "0.0.0", + "license": "UNLICENSED", + "dependencies": { + "@daml.js/daml-stdlib-DA-Time-Types-1.0.0": "file:../daml-stdlib-DA-Time-Types-1.0.0", + "@daml.js/ghc-stdlib-DA-Internal-Template-1.0.0": "file:../ghc-stdlib-DA-Internal-Template-1.0.0", + "@mojotech/json-type-validation": "^3.1.0" + } + }, + "node_modules/@babel/code-frame": { + "version": "7.29.0", + "resolved": "https://registry.npmjs.org/@babel/code-frame/-/code-frame-7.29.0.tgz", + "integrity": "sha512-9NhCeYjq9+3uxgdtp20LSiJXJvN0FeCtNGpJxuMFZ1Kv3cWUNb6DOhJwUvcVCzKGR66cw4njwM6hrJLqgOwbcw==", + "dev": true, + "license": "MIT", + "dependencies": { + "@babel/helper-validator-identifier": "^7.28.5", + "js-tokens": "^4.0.0", + "picocolors": "^1.1.1" + }, + "engines": { + "node": ">=6.9.0" + } + }, + "node_modules/@babel/helper-validator-identifier": { + "version": "7.28.5", + "resolved": "https://registry.npmjs.org/@babel/helper-validator-identifier/-/helper-validator-identifier-7.28.5.tgz", + "integrity": "sha512-qSs4ifwzKJSV39ucNjsvc6WVHs6b7S03sOh2OcHF9UHfVPqWWALUsNUVzhSBiItjRZoLHx7nIarVjqKVusUZ1Q==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=6.9.0" + } + }, + "node_modules/@daml.js/daml-prim-DA-Exception-ArithmeticError-1.0.0": { + "resolved": "generated/daml-prim-DA-Exception-ArithmeticError-1.0.0", + "link": true + }, + "node_modules/@daml.js/daml-prim-DA-Exception-AssertionFailed-1.0.0": { + "resolved": "generated/daml-prim-DA-Exception-AssertionFailed-1.0.0", + "link": true + }, + "node_modules/@daml.js/daml-prim-DA-Exception-GeneralError-1.0.0": { + "resolved": "generated/daml-prim-DA-Exception-GeneralError-1.0.0", + "link": true + }, + "node_modules/@daml.js/daml-prim-DA-Exception-PreconditionFailed-1.0.0": { + "resolved": "generated/daml-prim-DA-Exception-PreconditionFailed-1.0.0", + "link": true + }, + "node_modules/@daml.js/daml-prim-DA-Types-1.0.0": { + "resolved": "generated/daml-prim-DA-Types-1.0.0", + "link": true + }, + "node_modules/@daml.js/daml-prim-GHC-Tuple-1.0.0": { + "resolved": "generated/daml-prim-GHC-Tuple-1.0.0", + "link": true + }, + "node_modules/@daml.js/daml-prim-GHC-Types-1.0.0": { + "resolved": "generated/daml-prim-GHC-Types-1.0.0", + "link": true + }, + "node_modules/@daml.js/daml-stdlib-DA-Date-Types-1.0.0": { + "resolved": "generated/daml-stdlib-DA-Date-Types-1.0.0", + "link": true + }, + "node_modules/@daml.js/daml-stdlib-DA-Internal-Down-1.0.0": { + "resolved": "generated/daml-stdlib-DA-Internal-Down-1.0.0", + "link": true + }, + "node_modules/@daml.js/daml-stdlib-DA-Logic-Types-1.0.0": { + "resolved": "generated/daml-stdlib-DA-Logic-Types-1.0.0", + "link": true + }, + "node_modules/@daml.js/daml-stdlib-DA-Monoid-Types-1.0.0": { + "resolved": "generated/daml-stdlib-DA-Monoid-Types-1.0.0", + "link": true + }, + "node_modules/@daml.js/daml-stdlib-DA-NonEmpty-Types-1.0.0": { + "resolved": "generated/daml-stdlib-DA-NonEmpty-Types-1.0.0", + "link": true + }, + "node_modules/@daml.js/daml-stdlib-DA-Random-Types-1.0.0": { + "resolved": "generated/daml-stdlib-DA-Random-Types-1.0.0", + "link": true + }, + "node_modules/@daml.js/daml-stdlib-DA-Semigroup-Types-1.0.0": { + "resolved": "generated/daml-stdlib-DA-Semigroup-Types-1.0.0", + "link": true + }, + "node_modules/@daml.js/daml-stdlib-DA-Set-Types-1.0.0": { + "resolved": "generated/daml-stdlib-DA-Set-Types-1.0.0", + "link": true + }, + "node_modules/@daml.js/daml-stdlib-DA-Stack-Types-1.0.0": { + "resolved": "generated/daml-stdlib-DA-Stack-Types-1.0.0", + "link": true + }, + "node_modules/@daml.js/daml-stdlib-DA-Time-Types-1.0.0": { + "resolved": "generated/daml-stdlib-DA-Time-Types-1.0.0", + "link": true + }, + "node_modules/@daml.js/daml-stdlib-DA-Validation-Types-1.0.0": { + "resolved": "generated/daml-stdlib-DA-Validation-Types-1.0.0", + "link": true + }, + "node_modules/@daml.js/ghc-stdlib-DA-Internal-Template-1.0.0": { + "resolved": "generated/ghc-stdlib-DA-Internal-Template-1.0.0", + "link": true + }, + "node_modules/@daml.js/quickstart-licensing-0.0.1": { + "resolved": "generated/quickstart-licensing-0.0.1", + "link": true + }, + "node_modules/@daml.js/splice-api-token-allocation-request-v1-1.0.0": { + "resolved": "generated/splice-api-token-allocation-request-v1-1.0.0", + "link": true + }, + "node_modules/@daml.js/splice-api-token-allocation-v1-1.0.0": { + "resolved": "generated/splice-api-token-allocation-v1-1.0.0", + "link": true + }, + "node_modules/@daml.js/splice-api-token-holding-v1-1.0.0": { + "resolved": "generated/splice-api-token-holding-v1-1.0.0", + "link": true + }, + "node_modules/@daml.js/splice-api-token-metadata-v1-1.0.0": { + "resolved": "generated/splice-api-token-metadata-v1-1.0.0", + "link": true + }, + "node_modules/@daml/types": { + "version": "3.4.11", + "resolved": "https://registry.npmjs.org/@daml/types/-/types-3.4.11.tgz", + "integrity": "sha512-lGskPPTFVtJpLbHi1XoqG7/mnOU/zJcomQixoszEbtU7D63t7xDAW9yvtaQa7C1Uz70OOBhM1z72Se63GR3NXg==", + "license": "Apache-2.0", + "dependencies": { + "@mojotech/json-type-validation": "^3.1.0", + "@types/lodash": "^4.5", + "lodash": "^4.5" + } + }, + "node_modules/@esbuild/aix-ppc64": { + "version": "0.27.7", + "resolved": "https://registry.npmjs.org/@esbuild/aix-ppc64/-/aix-ppc64-0.27.7.tgz", + "integrity": "sha512-EKX3Qwmhz1eMdEJokhALr0YiD0lhQNwDqkPYyPhiSwKrh7/4KRjQc04sZ8db+5DVVnZ1LmbNDI1uAMPEUBnQPg==", + "cpu": [ + "ppc64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "aix" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/@esbuild/android-arm": { + "version": "0.27.7", + "resolved": "https://registry.npmjs.org/@esbuild/android-arm/-/android-arm-0.27.7.tgz", + "integrity": "sha512-jbPXvB4Yj2yBV7HUfE2KHe4GJX51QplCN1pGbYjvsyCZbQmies29EoJbkEc+vYuU5o45AfQn37vZlyXy4YJ8RQ==", + "cpu": [ + "arm" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "android" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/@esbuild/android-arm64": { + "version": "0.27.7", + "resolved": "https://registry.npmjs.org/@esbuild/android-arm64/-/android-arm64-0.27.7.tgz", + "integrity": "sha512-62dPZHpIXzvChfvfLJow3q5dDtiNMkwiRzPylSCfriLvZeq0a1bWChrGx/BbUbPwOrsWKMn8idSllklzBy+dgQ==", + "cpu": [ + "arm64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "android" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/@esbuild/android-x64": { + "version": "0.27.7", + "resolved": "https://registry.npmjs.org/@esbuild/android-x64/-/android-x64-0.27.7.tgz", + "integrity": "sha512-x5VpMODneVDb70PYV2VQOmIUUiBtY3D3mPBG8NxVk5CogneYhkR7MmM3yR/uMdITLrC1ml/NV1rj4bMJuy9MCg==", + "cpu": [ + "x64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "android" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/@esbuild/darwin-arm64": { + "version": "0.27.7", + "resolved": "https://registry.npmjs.org/@esbuild/darwin-arm64/-/darwin-arm64-0.27.7.tgz", + "integrity": "sha512-5lckdqeuBPlKUwvoCXIgI2D9/ABmPq3Rdp7IfL70393YgaASt7tbju3Ac+ePVi3KDH6N2RqePfHnXkaDtY9fkw==", + "cpu": [ + "arm64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "darwin" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/@esbuild/darwin-x64": { + "version": "0.27.7", + "resolved": "https://registry.npmjs.org/@esbuild/darwin-x64/-/darwin-x64-0.27.7.tgz", + "integrity": "sha512-rYnXrKcXuT7Z+WL5K980jVFdvVKhCHhUwid+dDYQpH+qu+TefcomiMAJpIiC2EM3Rjtq0sO3StMV/+3w3MyyqQ==", + "cpu": [ + "x64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "darwin" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/@esbuild/freebsd-arm64": { + "version": "0.27.7", + "resolved": "https://registry.npmjs.org/@esbuild/freebsd-arm64/-/freebsd-arm64-0.27.7.tgz", + "integrity": "sha512-B48PqeCsEgOtzME2GbNM2roU29AMTuOIN91dsMO30t+Ydis3z/3Ngoj5hhnsOSSwNzS+6JppqWsuhTp6E82l2w==", + "cpu": [ + "arm64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "freebsd" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/@esbuild/freebsd-x64": { + "version": "0.27.7", + "resolved": "https://registry.npmjs.org/@esbuild/freebsd-x64/-/freebsd-x64-0.27.7.tgz", + "integrity": "sha512-jOBDK5XEjA4m5IJK3bpAQF9/Lelu/Z9ZcdhTRLf4cajlB+8VEhFFRjWgfy3M1O4rO2GQ/b2dLwCUGpiF/eATNQ==", + "cpu": [ + "x64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "freebsd" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/@esbuild/linux-arm": { + "version": "0.27.7", + "resolved": "https://registry.npmjs.org/@esbuild/linux-arm/-/linux-arm-0.27.7.tgz", + "integrity": "sha512-RkT/YXYBTSULo3+af8Ib0ykH8u2MBh57o7q/DAs3lTJlyVQkgQvlrPTnjIzzRPQyavxtPtfg0EopvDyIt0j1rA==", + "cpu": [ + "arm" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/@esbuild/linux-arm64": { + "version": "0.27.7", + "resolved": "https://registry.npmjs.org/@esbuild/linux-arm64/-/linux-arm64-0.27.7.tgz", + "integrity": "sha512-RZPHBoxXuNnPQO9rvjh5jdkRmVizktkT7TCDkDmQ0W2SwHInKCAV95GRuvdSvA7w4VMwfCjUiPwDi0ZO6Nfe9A==", + "cpu": [ + "arm64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/@esbuild/linux-ia32": { + "version": "0.27.7", + "resolved": "https://registry.npmjs.org/@esbuild/linux-ia32/-/linux-ia32-0.27.7.tgz", + "integrity": "sha512-GA48aKNkyQDbd3KtkplYWT102C5sn/EZTY4XROkxONgruHPU72l+gW+FfF8tf2cFjeHaRbWpOYa/uRBz/Xq1Pg==", + "cpu": [ + "ia32" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/@esbuild/linux-loong64": { + "version": "0.27.7", + "resolved": "https://registry.npmjs.org/@esbuild/linux-loong64/-/linux-loong64-0.27.7.tgz", + "integrity": "sha512-a4POruNM2oWsD4WKvBSEKGIiWQF8fZOAsycHOt6JBpZ+JN2n2JH9WAv56SOyu9X5IqAjqSIPTaJkqN8F7XOQ5Q==", + "cpu": [ + "loong64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/@esbuild/linux-mips64el": { + "version": "0.27.7", + "resolved": "https://registry.npmjs.org/@esbuild/linux-mips64el/-/linux-mips64el-0.27.7.tgz", + "integrity": "sha512-KabT5I6StirGfIz0FMgl1I+R1H73Gp0ofL9A3nG3i/cYFJzKHhouBV5VWK1CSgKvVaG4q1RNpCTR2LuTVB3fIw==", + "cpu": [ + "mips64el" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/@esbuild/linux-ppc64": { + "version": "0.27.7", + "resolved": "https://registry.npmjs.org/@esbuild/linux-ppc64/-/linux-ppc64-0.27.7.tgz", + "integrity": "sha512-gRsL4x6wsGHGRqhtI+ifpN/vpOFTQtnbsupUF5R5YTAg+y/lKelYR1hXbnBdzDjGbMYjVJLJTd2OFmMewAgwlQ==", + "cpu": [ + "ppc64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/@esbuild/linux-riscv64": { + "version": "0.27.7", + "resolved": "https://registry.npmjs.org/@esbuild/linux-riscv64/-/linux-riscv64-0.27.7.tgz", + "integrity": "sha512-hL25LbxO1QOngGzu2U5xeXtxXcW+/GvMN3ejANqXkxZ/opySAZMrc+9LY/WyjAan41unrR3YrmtTsUpwT66InQ==", + "cpu": [ + "riscv64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/@esbuild/linux-s390x": { + "version": "0.27.7", + "resolved": "https://registry.npmjs.org/@esbuild/linux-s390x/-/linux-s390x-0.27.7.tgz", + "integrity": "sha512-2k8go8Ycu1Kb46vEelhu1vqEP+UeRVj2zY1pSuPdgvbd5ykAw82Lrro28vXUrRmzEsUV0NzCf54yARIK8r0fdw==", + "cpu": [ + "s390x" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/@esbuild/linux-x64": { + "version": "0.27.7", + "resolved": "https://registry.npmjs.org/@esbuild/linux-x64/-/linux-x64-0.27.7.tgz", + "integrity": "sha512-hzznmADPt+OmsYzw1EE33ccA+HPdIqiCRq7cQeL1Jlq2gb1+OyWBkMCrYGBJ+sxVzve2ZJEVeePbLM2iEIZSxA==", + "cpu": [ + "x64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/@esbuild/netbsd-arm64": { + "version": "0.27.7", + "resolved": "https://registry.npmjs.org/@esbuild/netbsd-arm64/-/netbsd-arm64-0.27.7.tgz", + "integrity": "sha512-b6pqtrQdigZBwZxAn1UpazEisvwaIDvdbMbmrly7cDTMFnw/+3lVxxCTGOrkPVnsYIosJJXAsILG9XcQS+Yu6w==", + "cpu": [ + "arm64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "netbsd" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/@esbuild/netbsd-x64": { + "version": "0.27.7", + "resolved": "https://registry.npmjs.org/@esbuild/netbsd-x64/-/netbsd-x64-0.27.7.tgz", + "integrity": "sha512-OfatkLojr6U+WN5EDYuoQhtM+1xco+/6FSzJJnuWiUw5eVcicbyK3dq5EeV/QHT1uy6GoDhGbFpprUiHUYggrw==", + "cpu": [ + "x64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "netbsd" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/@esbuild/openbsd-arm64": { + "version": "0.27.7", + "resolved": "https://registry.npmjs.org/@esbuild/openbsd-arm64/-/openbsd-arm64-0.27.7.tgz", + "integrity": "sha512-AFuojMQTxAz75Fo8idVcqoQWEHIXFRbOc1TrVcFSgCZtQfSdc1RXgB3tjOn/krRHENUB4j00bfGjyl2mJrU37A==", + "cpu": [ + "arm64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "openbsd" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/@esbuild/openbsd-x64": { + "version": "0.27.7", + "resolved": "https://registry.npmjs.org/@esbuild/openbsd-x64/-/openbsd-x64-0.27.7.tgz", + "integrity": "sha512-+A1NJmfM8WNDv5CLVQYJ5PshuRm/4cI6WMZRg1by1GwPIQPCTs1GLEUHwiiQGT5zDdyLiRM/l1G0Pv54gvtKIg==", + "cpu": [ + "x64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "openbsd" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/@esbuild/openharmony-arm64": { + "version": "0.27.7", + "resolved": "https://registry.npmjs.org/@esbuild/openharmony-arm64/-/openharmony-arm64-0.27.7.tgz", + "integrity": "sha512-+KrvYb/C8zA9CU/g0sR6w2RBw7IGc5J2BPnc3dYc5VJxHCSF1yNMxTV5LQ7GuKteQXZtspjFbiuW5/dOj7H4Yw==", + "cpu": [ + "arm64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "openharmony" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/@esbuild/sunos-x64": { + "version": "0.27.7", + "resolved": "https://registry.npmjs.org/@esbuild/sunos-x64/-/sunos-x64-0.27.7.tgz", + "integrity": "sha512-ikktIhFBzQNt/QDyOL580ti9+5mL/YZeUPKU2ivGtGjdTYoqz6jObj6nOMfhASpS4GU4Q/Clh1QtxWAvcYKamA==", + "cpu": [ + "x64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "sunos" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/@esbuild/win32-arm64": { + "version": "0.27.7", + "resolved": "https://registry.npmjs.org/@esbuild/win32-arm64/-/win32-arm64-0.27.7.tgz", + "integrity": "sha512-7yRhbHvPqSpRUV7Q20VuDwbjW5kIMwTHpptuUzV+AA46kiPze5Z7qgt6CLCK3pWFrHeNfDd1VKgyP4O+ng17CA==", + "cpu": [ + "arm64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "win32" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/@esbuild/win32-ia32": { + "version": "0.27.7", + "resolved": "https://registry.npmjs.org/@esbuild/win32-ia32/-/win32-ia32-0.27.7.tgz", + "integrity": "sha512-SmwKXe6VHIyZYbBLJrhOoCJRB/Z1tckzmgTLfFYOfpMAx63BJEaL9ExI8x7v0oAO3Zh6D/Oi1gVxEYr5oUCFhw==", + "cpu": [ + "ia32" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "win32" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/@esbuild/win32-x64": { + "version": "0.27.7", + "resolved": "https://registry.npmjs.org/@esbuild/win32-x64/-/win32-x64-0.27.7.tgz", + "integrity": "sha512-56hiAJPhwQ1R4i+21FVF7V8kSD5zZTdHcVuRFMW0hn753vVfQN8xlx4uOPT4xoGH0Z/oVATuR82AiqSTDIpaHg==", + "cpu": [ + "x64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "win32" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/@fastify/ajv-compiler": { + "version": "4.0.5", + "resolved": "https://registry.npmjs.org/@fastify/ajv-compiler/-/ajv-compiler-4.0.5.tgz", + "integrity": "sha512-KoWKW+MhvfTRWL4qrhUwAAZoaChluo0m0vbiJlGMt2GXvL4LVPQEjt8kSpHI3IBq5Rez8fg+XeH3cneztq+C7A==", + "funding": [ + { + "type": "github", + "url": "https://github.com/sponsors/fastify" + }, + { + "type": "opencollective", + "url": "https://opencollective.com/fastify" + } + ], + "license": "MIT", + "dependencies": { + "ajv": "^8.12.0", + "ajv-formats": "^3.0.1", + "fast-uri": "^3.0.0" + } + }, + "node_modules/@fastify/cookie": { + "version": "11.0.2", + "resolved": "https://registry.npmjs.org/@fastify/cookie/-/cookie-11.0.2.tgz", + "integrity": "sha512-GWdwdGlgJxyvNv+QcKiGNevSspMQXncjMZ1J8IvuDQk0jvkzgWWZFNC2En3s+nHndZBGV8IbLwOI/sxCZw/mzA==", + "funding": [ + { + "type": "github", + "url": "https://github.com/sponsors/fastify" + }, + { + "type": "opencollective", + "url": "https://opencollective.com/fastify" + } + ], + "license": "MIT", + "dependencies": { + "cookie": "^1.0.0", + "fastify-plugin": "^5.0.0" + } + }, + "node_modules/@fastify/error": { + "version": "4.2.0", + "resolved": "https://registry.npmjs.org/@fastify/error/-/error-4.2.0.tgz", + "integrity": "sha512-RSo3sVDXfHskiBZKBPRgnQTtIqpi/7zhJOEmAxCiBcM7d0uwdGdxLlsCaLzGs8v8NnxIRlfG0N51p5yFaOentQ==", + "funding": [ + { + "type": "github", + "url": "https://github.com/sponsors/fastify" + }, + { + "type": "opencollective", + "url": "https://opencollective.com/fastify" + } + ], + "license": "MIT" + }, + "node_modules/@fastify/fast-json-stringify-compiler": { + "version": "5.0.3", + "resolved": "https://registry.npmjs.org/@fastify/fast-json-stringify-compiler/-/fast-json-stringify-compiler-5.0.3.tgz", + "integrity": "sha512-uik7yYHkLr6fxd8hJSZ8c+xF4WafPK+XzneQDPU+D10r5X19GW8lJcom2YijX2+qtFF1ENJlHXKFM9ouXNJYgQ==", + "funding": [ + { + "type": "github", + "url": "https://github.com/sponsors/fastify" + }, + { + "type": "opencollective", + "url": "https://opencollective.com/fastify" + } + ], + "license": "MIT", + "dependencies": { + "fast-json-stringify": "^6.0.0" + } + }, + "node_modules/@fastify/formbody": { + "version": "8.0.2", + "resolved": "https://registry.npmjs.org/@fastify/formbody/-/formbody-8.0.2.tgz", + "integrity": "sha512-84v5J2KrkXzjgBpYnaNRPqwgMsmY7ZDjuj0YVuMR3NXCJRCgKEZy/taSP1wUYGn0onfxJpLyRGDLa+NMaDJtnA==", + "funding": [ + { + "type": "github", + "url": "https://github.com/sponsors/fastify" + }, + { + "type": "opencollective", + "url": "https://opencollective.com/fastify" + } + ], + "license": "MIT", + "dependencies": { + "fast-querystring": "^1.1.2", + "fastify-plugin": "^5.0.0" + } + }, + "node_modules/@fastify/forwarded": { + "version": "3.0.1", + "resolved": "https://registry.npmjs.org/@fastify/forwarded/-/forwarded-3.0.1.tgz", + "integrity": "sha512-JqDochHFqXs3C3Ml3gOY58zM7OqO9ENqPo0UqAjAjH8L01fRZqwX9iLeX34//kiJubF7r2ZQHtBRU36vONbLlw==", + "funding": [ + { + "type": "github", + "url": "https://github.com/sponsors/fastify" + }, + { + "type": "opencollective", + "url": "https://opencollective.com/fastify" + } + ], + "license": "MIT" + }, + "node_modules/@fastify/merge-json-schemas": { + "version": "0.2.1", + "resolved": "https://registry.npmjs.org/@fastify/merge-json-schemas/-/merge-json-schemas-0.2.1.tgz", + "integrity": "sha512-OA3KGBCy6KtIvLf8DINC5880o5iBlDX4SxzLQS8HorJAbqluzLRn80UXU0bxZn7UOFhFgpRJDasfwn9nG4FG4A==", + "funding": [ + { + "type": "github", + "url": "https://github.com/sponsors/fastify" + }, + { + "type": "opencollective", + "url": "https://opencollective.com/fastify" + } + ], + "license": "MIT", + "dependencies": { + "dequal": "^2.0.3" + } + }, + "node_modules/@fastify/proxy-addr": { + "version": "5.1.0", + "resolved": "https://registry.npmjs.org/@fastify/proxy-addr/-/proxy-addr-5.1.0.tgz", + "integrity": "sha512-INS+6gh91cLUjB+PVHfu1UqcB76Sqtpyp7bnL+FYojhjygvOPA9ctiD/JDKsyD9Xgu4hUhCSJBPig/w7duNajw==", + "funding": [ + { + "type": "github", + "url": "https://github.com/sponsors/fastify" + }, + { + "type": "opencollective", + "url": "https://opencollective.com/fastify" + } + ], + "license": "MIT", + "dependencies": { + "@fastify/forwarded": "^3.0.0", + "ipaddr.js": "^2.1.0" + } + }, + "node_modules/@fastify/session": { + "version": "11.1.1", + "resolved": "https://registry.npmjs.org/@fastify/session/-/session-11.1.1.tgz", + "integrity": "sha512-nuKwTHxh3eJsI4NJeXoYVGzXUsg+kH1WfHgS7IofVyVhmjc+A6qGr+29WQy8hYZiNtmCjfG415COpf5xTBkW4Q==", + "funding": [ + { + "type": "github", + "url": "https://github.com/sponsors/fastify" + }, + { + "type": "opencollective", + "url": "https://opencollective.com/fastify" + } + ], + "license": "MIT", + "dependencies": { + "fastify-plugin": "^5.0.1", + "safe-stable-stringify": "^2.4.3" + } + }, + "node_modules/@mojotech/json-type-validation": { + "version": "3.1.0", + "resolved": "https://registry.npmjs.org/@mojotech/json-type-validation/-/json-type-validation-3.1.0.tgz", + "integrity": "sha512-ThH2EbHEUCPMHhXAtmYcDi0gmV+PZak4uvuWBMiBDqUuz7gGQUrsE5o1J6kKNLDX5cXAPqsfJ7uTfTcNdCDXxA==", + "license": "MIT", + "dependencies": { + "lodash.isequal": "^4.5.0" + }, + "engines": { + "node": ">=6.0.0" + } + }, + "node_modules/@pinojs/redact": { + "version": "0.4.0", + "resolved": "https://registry.npmjs.org/@pinojs/redact/-/redact-0.4.0.tgz", + "integrity": "sha512-k2ENnmBugE/rzQfEcdWHcCY+/FM3VLzH9cYEsbdsoqrvzAKRhUZeRNhAZvB8OitQJ1TBed3yqWtdjzS6wJKBwg==", + "license": "MIT" + }, + "node_modules/@redocly/ajv": { + "version": "8.11.2", + "resolved": "https://registry.npmjs.org/@redocly/ajv/-/ajv-8.11.2.tgz", + "integrity": "sha512-io1JpnwtIcvojV7QKDUSIuMN/ikdOUd1ReEnUnMKGfDVridQZ31J0MmIuqwuRjWDZfmvr+Q0MqCcfHM2gTivOg==", + "dev": true, + "license": "MIT", + "dependencies": { + "fast-deep-equal": "^3.1.1", + "json-schema-traverse": "^1.0.0", + "require-from-string": "^2.0.2", + "uri-js-replace": "^1.0.1" + }, + "funding": { + "type": "github", + "url": "https://github.com/sponsors/epoberezkin" + } + }, + "node_modules/@redocly/config": { + "version": "0.22.0", + "resolved": "https://registry.npmjs.org/@redocly/config/-/config-0.22.0.tgz", + "integrity": "sha512-gAy93Ddo01Z3bHuVdPWfCwzgfaYgMdaZPcfL7JZ7hWJoK9V0lXDbigTWkhiPFAaLWzbOJ+kbUQG1+XwIm0KRGQ==", + "dev": true, + "license": "MIT" + }, + "node_modules/@redocly/openapi-core": { + "version": "1.34.13", + "resolved": "https://registry.npmjs.org/@redocly/openapi-core/-/openapi-core-1.34.13.tgz", + "integrity": "sha512-4Tm4ysZkexx6ZTX7knqSZTqPlNgIvXc7Ha0pd30I694/GD0KtJE2xrElycfPds0vCLFAqoKyIzBtOF1xrLo8KA==", + "dev": true, + "license": "MIT", + "dependencies": { + "@redocly/ajv": "8.11.2", + "@redocly/config": "0.22.0", + "colorette": "1.4.0", + "https-proxy-agent": "7.0.6", + "js-levenshtein": "1.1.6", + "js-yaml": "4.1.1", + "minimatch": "5.1.9", + "pluralize": "8.0.0", + "yaml-ast-parser": "0.0.43" + }, + "engines": { + "node": ">=18.17.0", + "npm": ">=9.5.0" + } + }, + "node_modules/@types/lodash": { + "version": "4.17.24", + "resolved": "https://registry.npmjs.org/@types/lodash/-/lodash-4.17.24.tgz", + "integrity": "sha512-gIW7lQLZbue7lRSWEFql49QJJWThrTFFeIMJdp3eH4tKoxm1OvEPg02rm4wCCSHS0cL3/Fizimb35b7k8atwsQ==", + "license": "MIT" + }, + "node_modules/@types/node": { + "version": "25.6.0", + "resolved": "https://registry.npmjs.org/@types/node/-/node-25.6.0.tgz", + "integrity": "sha512-+qIYRKdNYJwY3vRCZMdJbPLJAtGjQBudzZzdzwQYkEPQd+PJGixUL5QfvCLDaULoLv+RhT3LDkwEfKaAkgSmNQ==", + "dev": true, + "license": "MIT", + "dependencies": { + "undici-types": "~7.19.0" + } + }, + "node_modules/@types/pg": { + "version": "8.20.0", + "resolved": "https://registry.npmjs.org/@types/pg/-/pg-8.20.0.tgz", + "integrity": "sha512-bEPFOaMAHTEP1EzpvHTbmwR8UsFyHSKsRisLIHVMXnpNefSbGA1bD6CVy+qKjGSqmZqNqBDV2azOBo8TgkcVow==", + "dev": true, + "license": "MIT", + "dependencies": { + "@types/node": "*", + "pg-protocol": "*", + "pg-types": "^2.2.0" + } + }, + "node_modules/abstract-logging": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/abstract-logging/-/abstract-logging-2.0.1.tgz", + "integrity": "sha512-2BjRTZxTPvheOvGbBslFSYOUkr+SjPtOnrLP33f+VIWLzezQpZcqVg7ja3L4dBXmzzgwT+a029jRx5PCi3JuiA==", + "license": "MIT" + }, + "node_modules/agent-base": { + "version": "7.1.4", + "resolved": "https://registry.npmjs.org/agent-base/-/agent-base-7.1.4.tgz", + "integrity": "sha512-MnA+YT8fwfJPgBx3m60MNqakm30XOkyIoH1y6huTQvC0PwZG7ki8NacLBcrPbNoo8vEZy7Jpuk7+jMO+CUovTQ==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">= 14" + } + }, + "node_modules/ajv": { + "version": "8.20.0", + "resolved": "https://registry.npmjs.org/ajv/-/ajv-8.20.0.tgz", + "integrity": "sha512-Thbli+OlOj+iMPYFBVBfJ3OmCAnaSyNn4M1vz9T6Gka5Jt9ba/HIR56joy65tY6kx/FCF5VXNB819Y7/GUrBGA==", + "license": "MIT", + "dependencies": { + "fast-deep-equal": "^3.1.3", + "fast-uri": "^3.0.1", + "json-schema-traverse": "^1.0.0", + "require-from-string": "^2.0.2" + }, + "funding": { + "type": "github", + "url": "https://github.com/sponsors/epoberezkin" + } + }, + "node_modules/ajv-formats": { + "version": "3.0.1", + "resolved": "https://registry.npmjs.org/ajv-formats/-/ajv-formats-3.0.1.tgz", + "integrity": "sha512-8iUql50EUR+uUcdRQ3HDqa6EVyo3docL8g5WJ3FNcWmu62IbkGUue/pEyLBW8VGKKucTPgqeks4fIU1DA4yowQ==", + "license": "MIT", + "dependencies": { + "ajv": "^8.0.0" + }, + "peerDependencies": { + "ajv": "^8.0.0" + }, + "peerDependenciesMeta": { + "ajv": { + "optional": true + } + } + }, + "node_modules/ansi-colors": { + "version": "4.1.3", + "resolved": "https://registry.npmjs.org/ansi-colors/-/ansi-colors-4.1.3.tgz", + "integrity": "sha512-/6w/C21Pm1A7aZitlI5Ni/2J6FFQN8i1Cvz3kHABAAbw93v/NlvKdVOqz7CCWz/3iv/JplRSEEZ83XION15ovw==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=6" + } + }, + "node_modules/argparse": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/argparse/-/argparse-2.0.1.tgz", + "integrity": "sha512-8+9WqebbFzpX9OR+Wa6O29asIogeRMzcGtAINdpMHHyAg10f05aSFVBbcEqGf/PXw1EjAZ+q2/bEBg3DvurK3Q==", + "dev": true, + "license": "Python-2.0" + }, + "node_modules/atomic-sleep": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/atomic-sleep/-/atomic-sleep-1.0.0.tgz", + "integrity": "sha512-kNOjDqAh7px0XWNI+4QbzoiR/nTkHAWNud2uvnJquD1/x5a7EQZMJT0AczqK0Qn67oY/TTQ1LbUKajZpp3I9tQ==", + "license": "MIT", + "engines": { + "node": ">=8.0.0" + } + }, + "node_modules/avvio": { + "version": "9.2.0", + "resolved": "https://registry.npmjs.org/avvio/-/avvio-9.2.0.tgz", + "integrity": "sha512-2t/sy01ArdHHE0vRH5Hsay+RtCZt3dLPji7W7/MMOCEgze5b7SNDC4j5H6FnVgPkI1MTNFGzHdHrVXDDl7QSSQ==", + "funding": [ + { + "type": "github", + "url": "https://github.com/sponsors/fastify" + }, + { + "type": "opencollective", + "url": "https://opencollective.com/fastify" + } + ], + "license": "MIT", + "dependencies": { + "@fastify/error": "^4.0.0", + "fastq": "^1.17.1" + } + }, + "node_modules/balanced-match": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/balanced-match/-/balanced-match-1.0.2.tgz", + "integrity": "sha512-3oSeUO0TMV67hN1AmbXsK4yaqU7tjiHlbxRDZOpH0KW9+CeX4bRAaX0Anxt0tx2MrpRpWwQaPwIlISEJhYU5Pw==", + "dev": true, + "license": "MIT" + }, + "node_modules/brace-expansion": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-2.1.0.tgz", + "integrity": "sha512-TN1kCZAgdgweJhWWpgKYrQaMNHcDULHkWwQIspdtjV4Y5aurRdZpjAqn6yX3FPqTA9ngHCc4hJxMAMgGfve85w==", + "dev": true, + "license": "MIT", + "dependencies": { + "balanced-match": "^1.0.0" + } + }, + "node_modules/change-case": { + "version": "5.4.4", + "resolved": "https://registry.npmjs.org/change-case/-/change-case-5.4.4.tgz", + "integrity": "sha512-HRQyTk2/YPEkt9TnUPbOpr64Uw3KOicFWPVBb+xiHvd6eBx/qPr9xqfBFDT8P2vWsvvz4jbEkfDe71W3VyNu2w==", + "dev": true, + "license": "MIT" + }, + "node_modules/colorette": { + "version": "1.4.0", + "resolved": "https://registry.npmjs.org/colorette/-/colorette-1.4.0.tgz", + "integrity": "sha512-Y2oEozpomLn7Q3HFP7dpww7AtMJplbM9lGZP6RDfHqmbeRjiwRg4n6VM6j4KLmRke85uWEI7JqF17f3pqdRA0g==", + "dev": true, + "license": "MIT" + }, + "node_modules/cookie": { + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/cookie/-/cookie-1.1.1.tgz", + "integrity": "sha512-ei8Aos7ja0weRpFzJnEA9UHJ/7XQmqglbRwnf2ATjcB9Wq874VKH9kfjjirM6UhU2/E5fFYadylyhFldcqSidQ==", + "license": "MIT", + "engines": { + "node": ">=18" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/express" + } + }, + "node_modules/debug": { + "version": "4.4.3", + "resolved": "https://registry.npmjs.org/debug/-/debug-4.4.3.tgz", + "integrity": "sha512-RGwwWnwQvkVfavKVt22FGLw+xYSdzARwm0ru6DhTVA3umU5hZc28V3kO4stgYryrTlLpuvgI9GiijltAjNbcqA==", + "dev": true, + "license": "MIT", + "dependencies": { + "ms": "^2.1.3" + }, + "engines": { + "node": ">=6.0" + }, + "peerDependenciesMeta": { + "supports-color": { + "optional": true + } + } + }, + "node_modules/dequal": { + "version": "2.0.3", + "resolved": "https://registry.npmjs.org/dequal/-/dequal-2.0.3.tgz", + "integrity": "sha512-0je+qPKHEMohvfRTCEo3CrPG6cAzAYgmzKyxRiYSSDkS6eGJdyVJm7WaYA5ECaAD9wLB2T4EEeymA5aFVcYXCA==", + "license": "MIT", + "engines": { + "node": ">=6" + } + }, + "node_modules/esbuild": { + "version": "0.27.7", + "resolved": "https://registry.npmjs.org/esbuild/-/esbuild-0.27.7.tgz", + "integrity": "sha512-IxpibTjyVnmrIQo5aqNpCgoACA/dTKLTlhMHihVHhdkxKyPO1uBBthumT0rdHmcsk9uMonIWS0m4FljWzILh3w==", + "dev": true, + "hasInstallScript": true, + "license": "MIT", + "bin": { + "esbuild": "bin/esbuild" + }, + "engines": { + "node": ">=18" + }, + "optionalDependencies": { + "@esbuild/aix-ppc64": "0.27.7", + "@esbuild/android-arm": "0.27.7", + "@esbuild/android-arm64": "0.27.7", + "@esbuild/android-x64": "0.27.7", + "@esbuild/darwin-arm64": "0.27.7", + "@esbuild/darwin-x64": "0.27.7", + "@esbuild/freebsd-arm64": "0.27.7", + "@esbuild/freebsd-x64": "0.27.7", + "@esbuild/linux-arm": "0.27.7", + "@esbuild/linux-arm64": "0.27.7", + "@esbuild/linux-ia32": "0.27.7", + "@esbuild/linux-loong64": "0.27.7", + "@esbuild/linux-mips64el": "0.27.7", + "@esbuild/linux-ppc64": "0.27.7", + "@esbuild/linux-riscv64": "0.27.7", + "@esbuild/linux-s390x": "0.27.7", + "@esbuild/linux-x64": "0.27.7", + "@esbuild/netbsd-arm64": "0.27.7", + "@esbuild/netbsd-x64": "0.27.7", + "@esbuild/openbsd-arm64": "0.27.7", + "@esbuild/openbsd-x64": "0.27.7", + "@esbuild/openharmony-arm64": "0.27.7", + "@esbuild/sunos-x64": "0.27.7", + "@esbuild/win32-arm64": "0.27.7", + "@esbuild/win32-ia32": "0.27.7", + "@esbuild/win32-x64": "0.27.7" + } + }, + "node_modules/fast-decode-uri-component": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/fast-decode-uri-component/-/fast-decode-uri-component-1.0.1.tgz", + "integrity": "sha512-WKgKWg5eUxvRZGwW8FvfbaH7AXSh2cL+3j5fMGzUMCxWBJ3dV3a7Wz8y2f/uQ0e3B6WmodD3oS54jTQ9HVTIIg==", + "license": "MIT" + }, + "node_modules/fast-deep-equal": { + "version": "3.1.3", + "resolved": "https://registry.npmjs.org/fast-deep-equal/-/fast-deep-equal-3.1.3.tgz", + "integrity": "sha512-f3qQ9oQy9j2AhBe/H9VC91wLmKBCCU/gDOnKNAYG5hswO7BLKj09Hc5HYNz9cGI++xlpDCIgDaitVs03ATR84Q==", + "license": "MIT" + }, + "node_modules/fast-json-stringify": { + "version": "6.3.0", + "resolved": "https://registry.npmjs.org/fast-json-stringify/-/fast-json-stringify-6.3.0.tgz", + "integrity": "sha512-oRCntNDY/329HJPlmdNLIdogNtt6Vyjb1WuT01Soss3slIdyUp8kAcDU3saQTOquEK8KFVfwIIF7FebxUAu+yA==", + "funding": [ + { + "type": "github", + "url": "https://github.com/sponsors/fastify" + }, + { + "type": "opencollective", + "url": "https://opencollective.com/fastify" + } + ], + "license": "MIT", + "dependencies": { + "@fastify/merge-json-schemas": "^0.2.0", + "ajv": "^8.12.0", + "ajv-formats": "^3.0.1", + "fast-uri": "^3.0.0", + "json-schema-ref-resolver": "^3.0.0", + "rfdc": "^1.2.0" + } + }, + "node_modules/fast-querystring": { + "version": "1.1.2", + "resolved": "https://registry.npmjs.org/fast-querystring/-/fast-querystring-1.1.2.tgz", + "integrity": "sha512-g6KuKWmFXc0fID8WWH0jit4g0AGBoJhCkJMb1RmbsSEUNvQ+ZC8D6CUZ+GtF8nMzSPXnhiePyyqqipzNNEnHjg==", + "license": "MIT", + "dependencies": { + "fast-decode-uri-component": "^1.0.1" + } + }, + "node_modules/fast-uri": { + "version": "3.1.0", + "resolved": "https://registry.npmjs.org/fast-uri/-/fast-uri-3.1.0.tgz", + "integrity": "sha512-iPeeDKJSWf4IEOasVVrknXpaBV0IApz/gp7S2bb7Z4Lljbl2MGJRqInZiUrQwV16cpzw/D3S5j5Julj/gT52AA==", + "funding": [ + { + "type": "github", + "url": "https://github.com/sponsors/fastify" + }, + { + "type": "opencollective", + "url": "https://opencollective.com/fastify" + } + ], + "license": "BSD-3-Clause" + }, + "node_modules/fastify": { + "version": "5.8.5", + "resolved": "https://registry.npmjs.org/fastify/-/fastify-5.8.5.tgz", + "integrity": "sha512-Yqptv59pQzPgQUSIm87hMqHJmdkb1+GPxdE6vW6FRyVE9G86mt7rOghitiU4JHRaTyDUk9pfeKmDeu70lAwM4Q==", + "funding": [ + { + "type": "github", + "url": "https://github.com/sponsors/fastify" + }, + { + "type": "opencollective", + "url": "https://opencollective.com/fastify" + } + ], + "license": "MIT", + "dependencies": { + "@fastify/ajv-compiler": "^4.0.5", + "@fastify/error": "^4.0.0", + "@fastify/fast-json-stringify-compiler": "^5.0.0", + "@fastify/proxy-addr": "^5.0.0", + "abstract-logging": "^2.0.1", + "avvio": "^9.0.0", + "fast-json-stringify": "^6.0.0", + "find-my-way": "^9.0.0", + "light-my-request": "^6.0.0", + "pino": "^9.14.0 || ^10.1.0", + "process-warning": "^5.0.0", + "rfdc": "^1.3.1", + "secure-json-parse": "^4.0.0", + "semver": "^7.6.0", + "toad-cache": "^3.7.0" + } + }, + "node_modules/fastify-plugin": { + "version": "5.1.0", + "resolved": "https://registry.npmjs.org/fastify-plugin/-/fastify-plugin-5.1.0.tgz", + "integrity": "sha512-FAIDA8eovSt5qcDgcBvDuX/v0Cjz0ohGhENZ/wpc3y+oZCY2afZ9Baqql3g/lC+OHRnciQol4ww7tuthOb9idw==", + "funding": [ + { + "type": "github", + "url": "https://github.com/sponsors/fastify" + }, + { + "type": "opencollective", + "url": "https://opencollective.com/fastify" + } + ], + "license": "MIT" + }, + "node_modules/fastq": { + "version": "1.20.1", + "resolved": "https://registry.npmjs.org/fastq/-/fastq-1.20.1.tgz", + "integrity": "sha512-GGToxJ/w1x32s/D2EKND7kTil4n8OVk/9mycTc4VDza13lOvpUZTGX3mFSCtV9ksdGBVzvsyAVLM6mHFThxXxw==", + "license": "ISC", + "dependencies": { + "reusify": "^1.0.4" + } + }, + "node_modules/find-my-way": { + "version": "9.5.0", + "resolved": "https://registry.npmjs.org/find-my-way/-/find-my-way-9.5.0.tgz", + "integrity": "sha512-VW2RfnmscZO5KgBY5XVyKREMW5nMZcxDy+buTOsL+zIPnBlbKm+00sgzoQzq1EVh4aALZLfKdwv6atBGcjvjrQ==", + "license": "MIT", + "dependencies": { + "fast-deep-equal": "^3.1.3", + "fast-querystring": "^1.0.0", + "safe-regex2": "^5.0.0" + }, + "engines": { + "node": ">=20" + } + }, + "node_modules/fsevents": { + "version": "2.3.3", + "resolved": "https://registry.npmjs.org/fsevents/-/fsevents-2.3.3.tgz", + "integrity": "sha512-5xoDfX+fL7faATnagmWPpbFtwh/R77WmMMqqHGS65C3vvB0YHrgF+B1YmZ3441tMj5n63k0212XNoJwzlhffQw==", + "dev": true, + "hasInstallScript": true, + "license": "MIT", + "optional": true, + "os": [ + "darwin" + ], + "engines": { + "node": "^8.16.0 || ^10.6.0 || >=11.0.0" + } + }, + "node_modules/get-tsconfig": { + "version": "4.14.0", + "resolved": "https://registry.npmjs.org/get-tsconfig/-/get-tsconfig-4.14.0.tgz", + "integrity": "sha512-yTb+8DXzDREzgvYmh6s9vHsSVCHeC0G3PI5bEXNBHtmshPnO+S5O7qgLEOn0I5QvMy6kpZN8K1NKGyilLb93wA==", + "dev": true, + "license": "MIT", + "dependencies": { + "resolve-pkg-maps": "^1.0.0" + }, + "funding": { + "url": "https://github.com/privatenumber/get-tsconfig?sponsor=1" + } + }, + "node_modules/https-proxy-agent": { + "version": "7.0.6", + "resolved": "https://registry.npmjs.org/https-proxy-agent/-/https-proxy-agent-7.0.6.tgz", + "integrity": "sha512-vK9P5/iUfdl95AI+JVyUuIcVtd4ofvtrOr3HNtM2yxC9bnMbEdp3x01OhQNnjb8IJYi38VlTE3mBXwcfvywuSw==", + "dev": true, + "license": "MIT", + "dependencies": { + "agent-base": "^7.1.2", + "debug": "4" + }, + "engines": { + "node": ">= 14" + } + }, + "node_modules/index-to-position": { + "version": "1.2.0", + "resolved": "https://registry.npmjs.org/index-to-position/-/index-to-position-1.2.0.tgz", + "integrity": "sha512-Yg7+ztRkqslMAS2iFaU+Oa4KTSidr63OsFGlOrJoW981kIYO3CGCS3wA95P1mUi/IVSJkn0D479KTJpVpvFNuw==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=18" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/ipaddr.js": { + "version": "2.3.0", + "resolved": "https://registry.npmjs.org/ipaddr.js/-/ipaddr.js-2.3.0.tgz", + "integrity": "sha512-Zv/pA+ciVFbCSBBjGfaKUya/CcGmUHzTydLMaTwrUUEM2DIEO3iZvueGxmacvmN50fGpGVKeTXpb2LcYQxeVdg==", + "license": "MIT", + "engines": { + "node": ">= 10" + } + }, + "node_modules/jose": { + "version": "6.2.3", + "resolved": "https://registry.npmjs.org/jose/-/jose-6.2.3.tgz", + "integrity": "sha512-YYVDInQKFJfR/xa3ojUTl8c2KoTwiL1R5Wg9YCydwH0x0B9grbzlg5HC7mMjCtUJjbQ/YnGEZIhI5tCgfTb4Hw==", + "license": "MIT", + "funding": { + "url": "https://github.com/sponsors/panva" + } + }, + "node_modules/js-levenshtein": { + "version": "1.1.6", + "resolved": "https://registry.npmjs.org/js-levenshtein/-/js-levenshtein-1.1.6.tgz", + "integrity": "sha512-X2BB11YZtrRqY4EnQcLX5Rh373zbK4alC1FW7D7MBhL2gtcC17cTnr6DmfHZeS0s2rTHjUTMMHfG7gO8SSdw+g==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/js-tokens": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/js-tokens/-/js-tokens-4.0.0.tgz", + "integrity": "sha512-RdJUflcE3cUzKiMqQgsCu06FPu9UdIJO0beYbPhHN4k6apgJtifcoCtT9bcxOpYBtpD2kCM6Sbzg4CausW/PKQ==", + "dev": true, + "license": "MIT" + }, + "node_modules/js-yaml": { + "version": "4.1.1", + "resolved": "https://registry.npmjs.org/js-yaml/-/js-yaml-4.1.1.tgz", + "integrity": "sha512-qQKT4zQxXl8lLwBtHMWwaTcGfFOZviOJet3Oy/xmGk2gZH677CJM9EvtfdSkgWcATZhj/55JZ0rmy3myCT5lsA==", + "dev": true, + "license": "MIT", + "dependencies": { + "argparse": "^2.0.1" + }, + "bin": { + "js-yaml": "bin/js-yaml.js" + } + }, + "node_modules/json-schema-ref-resolver": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/json-schema-ref-resolver/-/json-schema-ref-resolver-3.0.0.tgz", + "integrity": "sha512-hOrZIVL5jyYFjzk7+y7n5JDzGlU8rfWDuYyHwGa2WA8/pcmMHezp2xsVwxrebD/Q9t8Nc5DboieySDpCp4WG4A==", + "funding": [ + { + "type": "github", + "url": "https://github.com/sponsors/fastify" + }, + { + "type": "opencollective", + "url": "https://opencollective.com/fastify" + } + ], + "license": "MIT", + "dependencies": { + "dequal": "^2.0.3" + } + }, + "node_modules/json-schema-traverse": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/json-schema-traverse/-/json-schema-traverse-1.0.0.tgz", + "integrity": "sha512-NM8/P9n3XjXhIZn1lLhkFaACTOURQXjWhV4BA/RnOv8xvgqtqpAX9IO4mRQxSx1Rlo4tqzeqb0sOlruaOy3dug==", + "license": "MIT" + }, + "node_modules/light-my-request": { + "version": "6.6.0", + "resolved": "https://registry.npmjs.org/light-my-request/-/light-my-request-6.6.0.tgz", + "integrity": "sha512-CHYbu8RtboSIoVsHZ6Ye4cj4Aw/yg2oAFimlF7mNvfDV192LR7nDiKtSIfCuLT7KokPSTn/9kfVLm5OGN0A28A==", + "funding": [ + { + "type": "github", + "url": "https://github.com/sponsors/fastify" + }, + { + "type": "opencollective", + "url": "https://opencollective.com/fastify" + } + ], + "license": "BSD-3-Clause", + "dependencies": { + "cookie": "^1.0.1", + "process-warning": "^4.0.0", + "set-cookie-parser": "^2.6.0" + } + }, + "node_modules/light-my-request/node_modules/process-warning": { + "version": "4.0.1", + "resolved": "https://registry.npmjs.org/process-warning/-/process-warning-4.0.1.tgz", + "integrity": "sha512-3c2LzQ3rY9d0hc1emcsHhfT9Jwz0cChib/QN89oME2R451w5fy3f0afAhERFZAwrbDU43wk12d0ORBpDVME50Q==", + "funding": [ + { + "type": "github", + "url": "https://github.com/sponsors/fastify" + }, + { + "type": "opencollective", + "url": "https://opencollective.com/fastify" + } + ], + "license": "MIT" + }, + "node_modules/lodash": { + "version": "4.18.1", + "resolved": "https://registry.npmjs.org/lodash/-/lodash-4.18.1.tgz", + "integrity": "sha512-dMInicTPVE8d1e5otfwmmjlxkZoUpiVLwyeTdUsi/Caj/gfzzblBcCE5sRHV/AsjuCmxWrte2TNGSYuCeCq+0Q==", + "license": "MIT" + }, + "node_modules/lodash.isequal": { + "version": "4.5.0", + "resolved": "https://registry.npmjs.org/lodash.isequal/-/lodash.isequal-4.5.0.tgz", + "integrity": "sha512-pDo3lu8Jhfjqls6GkMgpahsF9kCyayhgykjyLMNFTKWrpVdAQtYyB4muAMWozBB4ig/dtWAmsMxLEI8wuz+DYQ==", + "deprecated": "This package is deprecated. Use require('node:util').isDeepStrictEqual instead.", + "license": "MIT" + }, + "node_modules/minimatch": { + "version": "5.1.9", + "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-5.1.9.tgz", + "integrity": "sha512-7o1wEA2RyMP7Iu7GNba9vc0RWWGACJOCZBJX2GJWip0ikV+wcOsgVuY9uE8CPiyQhkGFSlhuSkZPavN7u1c2Fw==", + "dev": true, + "license": "ISC", + "dependencies": { + "brace-expansion": "^2.0.1" + }, + "engines": { + "node": ">=10" + } + }, + "node_modules/ms": { + "version": "2.1.3", + "resolved": "https://registry.npmjs.org/ms/-/ms-2.1.3.tgz", + "integrity": "sha512-6FlzubTLZG3J2a/NVCAleEhjzq5oxgHyaCU9yYXvcLsvoVaHJq/s5xXI6/XXP6tz7R9xAOtHnSO/tXtF3WRTlA==", + "dev": true, + "license": "MIT" + }, + "node_modules/oauth4webapi": { + "version": "3.8.6", + "resolved": "https://registry.npmjs.org/oauth4webapi/-/oauth4webapi-3.8.6.tgz", + "integrity": "sha512-iwemM91xz8nryHti2yTmg5fhyEMVOkOXwHNqbvcATjyajb5oQxCQzrNOA6uElRHuMhQQTKUyFKV9y/CNyg25BQ==", + "license": "MIT", + "funding": { + "url": "https://github.com/sponsors/panva" + } + }, + "node_modules/on-exit-leak-free": { + "version": "2.1.2", + "resolved": "https://registry.npmjs.org/on-exit-leak-free/-/on-exit-leak-free-2.1.2.tgz", + "integrity": "sha512-0eJJY6hXLGf1udHwfNftBqH+g73EU4B504nZeKpz1sYRKafAghwxEJunB2O7rDZkL4PGfsMVnTXZ2EjibbqcsA==", + "license": "MIT", + "engines": { + "node": ">=14.0.0" + } + }, + "node_modules/openapi-typescript": { + "version": "7.13.0", + "resolved": "https://registry.npmjs.org/openapi-typescript/-/openapi-typescript-7.13.0.tgz", + "integrity": "sha512-EFP392gcqXS7ntPvbhBzbF8TyBA+baIYEm791Hy5YkjDYKTnk/Tn5OQeKm5BIZvJihpp8Zzr4hzx0Irde1LNGQ==", + "dev": true, + "license": "MIT", + "dependencies": { + "@redocly/openapi-core": "^1.34.6", + "ansi-colors": "^4.1.3", + "change-case": "^5.4.4", + "parse-json": "^8.3.0", + "supports-color": "^10.2.2", + "yargs-parser": "^21.1.1" + }, + "bin": { + "openapi-typescript": "bin/cli.js" + }, + "peerDependencies": { + "typescript": "^5.x" + } + }, + "node_modules/openid-client": { + "version": "6.8.4", + "resolved": "https://registry.npmjs.org/openid-client/-/openid-client-6.8.4.tgz", + "integrity": "sha512-QSw0BA08piujetEwfZsHoTrDpMEha7GDZDicQqVwX4u0ChCjefvjDB++TZ8BTg76UpwhzIQgdvvfgfl3HpCSAw==", + "license": "MIT", + "dependencies": { + "jose": "^6.2.2", + "oauth4webapi": "^3.8.5" + }, + "funding": { + "url": "https://github.com/sponsors/panva" + } + }, + "node_modules/parse-json": { + "version": "8.3.0", + "resolved": "https://registry.npmjs.org/parse-json/-/parse-json-8.3.0.tgz", + "integrity": "sha512-ybiGyvspI+fAoRQbIPRddCcSTV9/LsJbf0e/S85VLowVGzRmokfneg2kwVW/KU5rOXrPSbF1qAKPMgNTqqROQQ==", + "dev": true, + "license": "MIT", + "dependencies": { + "@babel/code-frame": "^7.26.2", + "index-to-position": "^1.1.0", + "type-fest": "^4.39.1" + }, + "engines": { + "node": ">=18" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/pg": { + "version": "8.20.0", + "resolved": "https://registry.npmjs.org/pg/-/pg-8.20.0.tgz", + "integrity": "sha512-ldhMxz2r8fl/6QkXnBD3CR9/xg694oT6DZQ2s6c/RI28OjtSOpxnPrUCGOBJ46RCUxcWdx3p6kw/xnDHjKvaRA==", + "license": "MIT", + "dependencies": { + "pg-connection-string": "^2.12.0", + "pg-pool": "^3.13.0", + "pg-protocol": "^1.13.0", + "pg-types": "2.2.0", + "pgpass": "1.0.5" + }, + "engines": { + "node": ">= 16.0.0" + }, + "optionalDependencies": { + "pg-cloudflare": "^1.3.0" + }, + "peerDependencies": { + "pg-native": ">=3.0.1" + }, + "peerDependenciesMeta": { + "pg-native": { + "optional": true + } + } + }, + "node_modules/pg-cloudflare": { + "version": "1.3.0", + "resolved": "https://registry.npmjs.org/pg-cloudflare/-/pg-cloudflare-1.3.0.tgz", + "integrity": "sha512-6lswVVSztmHiRtD6I8hw4qP/nDm1EJbKMRhf3HCYaqud7frGysPv7FYJ5noZQdhQtN2xJnimfMtvQq21pdbzyQ==", + "license": "MIT", + "optional": true + }, + "node_modules/pg-connection-string": { + "version": "2.12.0", + "resolved": "https://registry.npmjs.org/pg-connection-string/-/pg-connection-string-2.12.0.tgz", + "integrity": "sha512-U7qg+bpswf3Cs5xLzRqbXbQl85ng0mfSV/J0nnA31MCLgvEaAo7CIhmeyrmJpOr7o+zm0rXK+hNnT5l9RHkCkQ==", + "license": "MIT" + }, + "node_modules/pg-int8": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/pg-int8/-/pg-int8-1.0.1.tgz", + "integrity": "sha512-WCtabS6t3c8SkpDBUlb1kjOs7l66xsGdKpIPZsg4wR+B3+u9UAum2odSsF9tnvxg80h4ZxLWMy4pRjOsFIqQpw==", + "license": "ISC", + "engines": { + "node": ">=4.0.0" + } + }, + "node_modules/pg-pool": { + "version": "3.13.0", + "resolved": "https://registry.npmjs.org/pg-pool/-/pg-pool-3.13.0.tgz", + "integrity": "sha512-gB+R+Xud1gLFuRD/QgOIgGOBE2KCQPaPwkzBBGC9oG69pHTkhQeIuejVIk3/cnDyX39av2AxomQiyPT13WKHQA==", + "license": "MIT", + "peerDependencies": { + "pg": ">=8.0" + } + }, + "node_modules/pg-protocol": { + "version": "1.13.0", + "resolved": "https://registry.npmjs.org/pg-protocol/-/pg-protocol-1.13.0.tgz", + "integrity": "sha512-zzdvXfS6v89r6v7OcFCHfHlyG/wvry1ALxZo4LqgUoy7W9xhBDMaqOuMiF3qEV45VqsN6rdlcehHrfDtlCPc8w==", + "license": "MIT" + }, + "node_modules/pg-types": { + "version": "2.2.0", + "resolved": "https://registry.npmjs.org/pg-types/-/pg-types-2.2.0.tgz", + "integrity": "sha512-qTAAlrEsl8s4OiEQY69wDvcMIdQN6wdz5ojQiOy6YRMuynxenON0O5oCpJI6lshc6scgAY8qvJ2On/p+CXY0GA==", + "license": "MIT", + "dependencies": { + "pg-int8": "1.0.1", + "postgres-array": "~2.0.0", + "postgres-bytea": "~1.0.0", + "postgres-date": "~1.0.4", + "postgres-interval": "^1.1.0" + }, + "engines": { + "node": ">=4" + } + }, + "node_modules/pgpass": { + "version": "1.0.5", + "resolved": "https://registry.npmjs.org/pgpass/-/pgpass-1.0.5.tgz", + "integrity": "sha512-FdW9r/jQZhSeohs1Z3sI1yxFQNFvMcnmfuj4WBMUTxOrAyLMaTcE1aAMBiTlbMNaXvBCQuVi0R7hd8udDSP7ug==", + "license": "MIT", + "dependencies": { + "split2": "^4.1.0" + } + }, + "node_modules/picocolors": { + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/picocolors/-/picocolors-1.1.1.tgz", + "integrity": "sha512-xceH2snhtb5M9liqDsmEw56le376mTZkEX/jEb/RxNFyegNul7eNslCXP9FDj/Lcu0X8KEyMceP2ntpaHrDEVA==", + "dev": true, + "license": "ISC" + }, + "node_modules/pino": { + "version": "10.3.1", + "resolved": "https://registry.npmjs.org/pino/-/pino-10.3.1.tgz", + "integrity": "sha512-r34yH/GlQpKZbU1BvFFqOjhISRo1MNx1tWYsYvmj6KIRHSPMT2+yHOEb1SG6NMvRoHRF0a07kCOox/9yakl1vg==", + "license": "MIT", + "dependencies": { + "@pinojs/redact": "^0.4.0", + "atomic-sleep": "^1.0.0", + "on-exit-leak-free": "^2.1.0", + "pino-abstract-transport": "^3.0.0", + "pino-std-serializers": "^7.0.0", + "process-warning": "^5.0.0", + "quick-format-unescaped": "^4.0.3", + "real-require": "^0.2.0", + "safe-stable-stringify": "^2.3.1", + "sonic-boom": "^4.0.1", + "thread-stream": "^4.0.0" + }, + "bin": { + "pino": "bin.js" + } + }, + "node_modules/pino-abstract-transport": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/pino-abstract-transport/-/pino-abstract-transport-3.0.0.tgz", + "integrity": "sha512-wlfUczU+n7Hy/Ha5j9a/gZNy7We5+cXp8YL+X+PG8S0KXxw7n/JXA3c46Y0zQznIJ83URJiwy7Lh56WLokNuxg==", + "license": "MIT", + "dependencies": { + "split2": "^4.0.0" + } + }, + "node_modules/pino-std-serializers": { + "version": "7.1.0", + "resolved": "https://registry.npmjs.org/pino-std-serializers/-/pino-std-serializers-7.1.0.tgz", + "integrity": "sha512-BndPH67/JxGExRgiX1dX0w1FvZck5Wa4aal9198SrRhZjH3GxKQUKIBnYJTdj2HDN3UQAS06HlfcSbQj2OHmaw==", + "license": "MIT" + }, + "node_modules/pluralize": { + "version": "8.0.0", + "resolved": "https://registry.npmjs.org/pluralize/-/pluralize-8.0.0.tgz", + "integrity": "sha512-Nc3IT5yHzflTfbjgqWcCPpo7DaKy4FnpB0l/zCAW0Tc7jxAiuqSxHasntB3D7887LSrA93kDJ9IXovxJYxyLCA==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=4" + } + }, + "node_modules/postgres-array": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/postgres-array/-/postgres-array-2.0.0.tgz", + "integrity": "sha512-VpZrUqU5A69eQyW2c5CA1jtLecCsN2U/bD6VilrFDWq5+5UIEVO7nazS3TEcHf1zuPYO/sqGvUvW62g86RXZuA==", + "license": "MIT", + "engines": { + "node": ">=4" + } + }, + "node_modules/postgres-bytea": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/postgres-bytea/-/postgres-bytea-1.0.1.tgz", + "integrity": "sha512-5+5HqXnsZPE65IJZSMkZtURARZelel2oXUEO8rH83VS/hxH5vv1uHquPg5wZs8yMAfdv971IU+kcPUczi7NVBQ==", + "license": "MIT", + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/postgres-date": { + "version": "1.0.7", + "resolved": "https://registry.npmjs.org/postgres-date/-/postgres-date-1.0.7.tgz", + "integrity": "sha512-suDmjLVQg78nMK2UZ454hAG+OAW+HQPZ6n++TNDUX+L0+uUlLywnoxJKDou51Zm+zTCjrCl0Nq6J9C5hP9vK/Q==", + "license": "MIT", + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/postgres-interval": { + "version": "1.2.0", + "resolved": "https://registry.npmjs.org/postgres-interval/-/postgres-interval-1.2.0.tgz", + "integrity": "sha512-9ZhXKM/rw350N1ovuWHbGxnGh/SNJ4cnxHiM0rxE4VN41wsg8P8zWn9hv/buK00RP4WvlOyr/RBDiptyxVbkZQ==", + "license": "MIT", + "dependencies": { + "xtend": "^4.0.0" + }, + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/process-warning": { + "version": "5.0.0", + "resolved": "https://registry.npmjs.org/process-warning/-/process-warning-5.0.0.tgz", + "integrity": "sha512-a39t9ApHNx2L4+HBnQKqxxHNs1r7KF+Intd8Q/g1bUh6q0WIp9voPXJ/x0j+ZL45KF1pJd9+q2jLIRMfvEshkA==", + "funding": [ + { + "type": "github", + "url": "https://github.com/sponsors/fastify" + }, + { + "type": "opencollective", + "url": "https://opencollective.com/fastify" + } + ], + "license": "MIT" + }, + "node_modules/quick-format-unescaped": { + "version": "4.0.4", + "resolved": "https://registry.npmjs.org/quick-format-unescaped/-/quick-format-unescaped-4.0.4.tgz", + "integrity": "sha512-tYC1Q1hgyRuHgloV/YXs2w15unPVh8qfu/qCTfhTYamaw7fyhumKa2yGpdSo87vY32rIclj+4fWYQXUMs9EHvg==", + "license": "MIT" + }, + "node_modules/real-require": { + "version": "0.2.0", + "resolved": "https://registry.npmjs.org/real-require/-/real-require-0.2.0.tgz", + "integrity": "sha512-57frrGM/OCTLqLOAh0mhVA9VBMHd+9U7Zb2THMGdBUoZVOtGbJzjxsYGDJ3A9AYYCP4hn6y1TVbaOfzWtm5GFg==", + "license": "MIT", + "engines": { + "node": ">= 12.13.0" + } + }, + "node_modules/require-from-string": { + "version": "2.0.2", + "resolved": "https://registry.npmjs.org/require-from-string/-/require-from-string-2.0.2.tgz", + "integrity": "sha512-Xf0nWe6RseziFMu+Ap9biiUbmplq6S9/p+7w7YXP/JBHhrUDDUhwa+vANyubuqfZWTveU//DYVGsDG7RKL/vEw==", + "license": "MIT", + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/resolve-pkg-maps": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/resolve-pkg-maps/-/resolve-pkg-maps-1.0.0.tgz", + "integrity": "sha512-seS2Tj26TBVOC2NIc2rOe2y2ZO7efxITtLZcGSOnHHNOQ7CkiUBfw0Iw2ck6xkIhPwLhKNLS8BO+hEpngQlqzw==", + "dev": true, + "license": "MIT", + "funding": { + "url": "https://github.com/privatenumber/resolve-pkg-maps?sponsor=1" + } + }, + "node_modules/ret": { + "version": "0.5.0", + "resolved": "https://registry.npmjs.org/ret/-/ret-0.5.0.tgz", + "integrity": "sha512-I1XxrZSQ+oErkRR4jYbAyEEu2I0avBvvMM5JN+6EBprOGRCs63ENqZ3vjavq8fBw2+62G5LF5XelKwuJpcvcxw==", + "license": "MIT", + "engines": { + "node": ">=10" + } + }, + "node_modules/reusify": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/reusify/-/reusify-1.1.0.tgz", + "integrity": "sha512-g6QUff04oZpHs0eG5p83rFLhHeV00ug/Yf9nZM6fLeUrPguBTkTQOdpAWWspMh55TZfVQDPaN3NQJfbVRAxdIw==", + "license": "MIT", + "engines": { + "iojs": ">=1.0.0", + "node": ">=0.10.0" + } + }, + "node_modules/rfdc": { + "version": "1.4.1", + "resolved": "https://registry.npmjs.org/rfdc/-/rfdc-1.4.1.tgz", + "integrity": "sha512-q1b3N5QkRUWUl7iyylaaj3kOpIT0N2i9MqIEQXP73GVsN9cw3fdx8X63cEmWhJGi2PPCF23Ijp7ktmd39rawIA==", + "license": "MIT" + }, + "node_modules/safe-regex2": { + "version": "5.1.1", + "resolved": "https://registry.npmjs.org/safe-regex2/-/safe-regex2-5.1.1.tgz", + "integrity": "sha512-mOSBvHGDZMuIEZMdOz/aCEYDCv0E7nfcNsIhUF+/P+xC7Hyf3FkvymqgPbg9D1EdSGu+uKbJgy09K/RKKc7kJA==", + "funding": [ + { + "type": "github", + "url": "https://github.com/sponsors/fastify" + }, + { + "type": "opencollective", + "url": "https://opencollective.com/fastify" + } + ], + "license": "MIT", + "dependencies": { + "ret": "~0.5.0" + }, + "bin": { + "safe-regex2": "bin/safe-regex2.js" + } + }, + "node_modules/safe-stable-stringify": { + "version": "2.5.0", + "resolved": "https://registry.npmjs.org/safe-stable-stringify/-/safe-stable-stringify-2.5.0.tgz", + "integrity": "sha512-b3rppTKm9T+PsVCBEOUR46GWI7fdOs00VKZ1+9c1EWDaDMvjQc6tUwuFyIprgGgTcWoVHSKrU8H31ZHA2e0RHA==", + "license": "MIT", + "engines": { + "node": ">=10" + } + }, + "node_modules/secure-json-parse": { + "version": "4.1.0", + "resolved": "https://registry.npmjs.org/secure-json-parse/-/secure-json-parse-4.1.0.tgz", + "integrity": "sha512-l4KnYfEyqYJxDwlNVyRfO2E4NTHfMKAWdUuA8J0yve2Dz/E/PdBepY03RvyJpssIpRFwJoCD55wA+mEDs6ByWA==", + "funding": [ + { + "type": "github", + "url": "https://github.com/sponsors/fastify" + }, + { + "type": "opencollective", + "url": "https://opencollective.com/fastify" + } + ], + "license": "BSD-3-Clause" + }, + "node_modules/semver": { + "version": "7.7.4", + "resolved": "https://registry.npmjs.org/semver/-/semver-7.7.4.tgz", + "integrity": "sha512-vFKC2IEtQnVhpT78h1Yp8wzwrf8CM+MzKMHGJZfBtzhZNycRFnXsHk6E5TxIkkMsgNS7mdX3AGB7x2QM2di4lA==", + "license": "ISC", + "bin": { + "semver": "bin/semver.js" + }, + "engines": { + "node": ">=10" + } + }, + "node_modules/set-cookie-parser": { + "version": "2.7.2", + "resolved": "https://registry.npmjs.org/set-cookie-parser/-/set-cookie-parser-2.7.2.tgz", + "integrity": "sha512-oeM1lpU/UvhTxw+g3cIfxXHyJRc/uidd3yK1P242gzHds0udQBYzs3y8j4gCCW+ZJ7ad0yctld8RYO+bdurlvw==", + "license": "MIT" + }, + "node_modules/sonic-boom": { + "version": "4.2.1", + "resolved": "https://registry.npmjs.org/sonic-boom/-/sonic-boom-4.2.1.tgz", + "integrity": "sha512-w6AxtubXa2wTXAUsZMMWERrsIRAdrK0Sc+FUytWvYAhBJLyuI4llrMIC1DtlNSdI99EI86KZum2MMq3EAZlF9Q==", + "license": "MIT", + "dependencies": { + "atomic-sleep": "^1.0.0" + } + }, + "node_modules/split2": { + "version": "4.2.0", + "resolved": "https://registry.npmjs.org/split2/-/split2-4.2.0.tgz", + "integrity": "sha512-UcjcJOWknrNkF6PLX83qcHM6KHgVKNkV62Y8a5uYDVv9ydGQVwAHMKqHdJje1VTWpljG0WYpCDhrCdAOYH4TWg==", + "license": "ISC", + "engines": { + "node": ">= 10.x" + } + }, + "node_modules/supports-color": { + "version": "10.2.2", + "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-10.2.2.tgz", + "integrity": "sha512-SS+jx45GF1QjgEXQx4NJZV9ImqmO2NPz5FNsIHrsDjh2YsHnawpan7SNQ1o8NuhrbHZy9AZhIoCUiCeaW/C80g==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=18" + }, + "funding": { + "url": "https://github.com/chalk/supports-color?sponsor=1" + } + }, + "node_modules/thread-stream": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/thread-stream/-/thread-stream-4.0.0.tgz", + "integrity": "sha512-4iMVL6HAINXWf1ZKZjIPcz5wYaOdPhtO8ATvZ+Xqp3BTdaqtAwQkNmKORqcIo5YkQqGXq5cwfswDwMqqQNrpJA==", + "license": "MIT", + "dependencies": { + "real-require": "^0.2.0" + }, + "engines": { + "node": ">=20" + } + }, + "node_modules/toad-cache": { + "version": "3.7.0", + "resolved": "https://registry.npmjs.org/toad-cache/-/toad-cache-3.7.0.tgz", + "integrity": "sha512-/m8M+2BJUpoJdgAHoG+baCwBT+tf2VraSfkBgl0Y00qIWt41DJ8R5B8nsEw0I58YwF5IZH6z24/2TobDKnqSWw==", + "license": "MIT", + "engines": { + "node": ">=12" + } + }, + "node_modules/tsx": { + "version": "4.21.0", + "resolved": "https://registry.npmjs.org/tsx/-/tsx-4.21.0.tgz", + "integrity": "sha512-5C1sg4USs1lfG0GFb2RLXsdpXqBSEhAaA/0kPL01wxzpMqLILNxIxIOKiILz+cdg/pLnOUxFYOR5yhHU666wbw==", + "dev": true, + "license": "MIT", + "dependencies": { + "esbuild": "~0.27.0", + "get-tsconfig": "^4.7.5" + }, + "bin": { + "tsx": "dist/cli.mjs" + }, + "engines": { + "node": ">=18.0.0" + }, + "optionalDependencies": { + "fsevents": "~2.3.3" + } + }, + "node_modules/type-fest": { + "version": "4.41.0", + "resolved": "https://registry.npmjs.org/type-fest/-/type-fest-4.41.0.tgz", + "integrity": "sha512-TeTSQ6H5YHvpqVwBRcnLDCBnDOHWYu7IvGbHT6N8AOymcr9PJGjc1GTtiWZTYg0NCgYwvnYWEkVChQAr9bjfwA==", + "dev": true, + "license": "(MIT OR CC0-1.0)", + "engines": { + "node": ">=16" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/typescript": { + "version": "5.9.3", + "resolved": "https://registry.npmjs.org/typescript/-/typescript-5.9.3.tgz", + "integrity": "sha512-jl1vZzPDinLr9eUt3J/t7V6FgNEw9QjvBPdysz9KfQDD41fQrC2Y4vKQdiaUpFT4bXlb1RHhLpp8wtm6M5TgSw==", + "dev": true, + "license": "Apache-2.0", + "bin": { + "tsc": "bin/tsc", + "tsserver": "bin/tsserver" + }, + "engines": { + "node": ">=14.17" + } + }, + "node_modules/undici-types": { + "version": "7.19.2", + "resolved": "https://registry.npmjs.org/undici-types/-/undici-types-7.19.2.tgz", + "integrity": "sha512-qYVnV5OEm2AW8cJMCpdV20CDyaN3g0AjDlOGf1OW4iaDEx8MwdtChUp4zu4H0VP3nDRF/8RKWH+IPp9uW0YGZg==", + "dev": true, + "license": "MIT" + }, + "node_modules/uri-js-replace": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/uri-js-replace/-/uri-js-replace-1.0.1.tgz", + "integrity": "sha512-W+C9NWNLFOoBI2QWDp4UT9pv65r2w5Cx+3sTYFvtMdDBxkKt1syCqsUdSFAChbEe1uK5TfS04wt/nGwmaeIQ0g==", + "dev": true, + "license": "MIT" + }, + "node_modules/xtend": { + "version": "4.0.2", + "resolved": "https://registry.npmjs.org/xtend/-/xtend-4.0.2.tgz", + "integrity": "sha512-LKYU1iAXJXUgAXn9URjiu+MWhyUXHsvfp7mcuYm9dSUKK0/CjtrUwFAxD82/mCWbtLsGjFIad0wIsod4zrTAEQ==", + "license": "MIT", + "engines": { + "node": ">=0.4" + } + }, + "node_modules/yaml-ast-parser": { + "version": "0.0.43", + "resolved": "https://registry.npmjs.org/yaml-ast-parser/-/yaml-ast-parser-0.0.43.tgz", + "integrity": "sha512-2PTINUwsRqSd+s8XxKaJWQlUuEMHJQyEuh2edBbW8KNJz0SJPwUSD2zRWqezFEdN7IzAgeuYHFUCF7o8zRdZ0A==", + "dev": true, + "license": "Apache-2.0" + }, + "node_modules/yargs-parser": { + "version": "21.1.1", + "resolved": "https://registry.npmjs.org/yargs-parser/-/yargs-parser-21.1.1.tgz", + "integrity": "sha512-tVpsJW7DdjecAiFpbIB1e3qxIQsE6NoPc5/eTdrbbIC4h0LVsWhnoa3g+m2HclBIujHzsxZ4VJVA+GUuc2/LBw==", + "dev": true, + "license": "ISC", + "engines": { + "node": ">=12" + } + } + } +} diff --git a/quickstart/backend-js/package.json b/quickstart/backend-js/package.json new file mode 100644 index 000000000..d9ebdee21 --- /dev/null +++ b/quickstart/backend-js/package.json @@ -0,0 +1,36 @@ +{ + "name": "backend-js", + "private": true, + "type": "module", + "engines": { + "node": ">=22" + }, + "workspaces": [ + "generated/*" + ], + "scripts": { + "prebuild": "openapi-typescript ${VENDORED_DIR:-../backend/src/main/resources/vendored}/token-metadata-v1.yaml -o src/token-standard/metadata.types.ts && openapi-typescript ${VENDORED_DIR:-../backend/src/main/resources/vendored}/allocation-v1.yaml -o src/token-standard/allocation.types.ts", + "build": "tsc -p .", + "start": "node dist/server.js", + "dev": "tsx watch src/server.ts" + }, + "dependencies": { + "@daml.js/quickstart-licensing-0.0.1": "*", + "@daml/types": "3.4.11", + "@fastify/cookie": "^11.0.2", + "@fastify/formbody": "^8.0.2", + "@fastify/session": "^11.1.1", + "fastify": "^5.8.5", + "jose": "^6.2.3", + "openid-client": "^6.8.4", + "pg": "^8.20.0", + "pino": "^10.3.1" + }, + "devDependencies": { + "@types/node": "^25.6.0", + "@types/pg": "^8.20.0", + "openapi-typescript": "^7.13.0", + "tsx": "^4.21.0", + "typescript": "^5.9.3" + } +} diff --git a/quickstart/backend-js/src/config.ts b/quickstart/backend-js/src/config.ts new file mode 100644 index 000000000..187dd6a1b --- /dev/null +++ b/quickstart/backend-js/src/config.ts @@ -0,0 +1,74 @@ +export interface BackendConfig { + port: number + registryBaseUri: string + ledgerHost: string + ledgerPort: number + ledgerJsonApiBaseUrl: string + postgres: { host: string; port: number; database: string; user: string; password: string } + authMode: 'oauth2' | 'shared-secret' + testMode: boolean + appProviderParty: string + appProviderUserId: string + // Static bearer token used in shared-secret mode (provided by the onboarding volume). + sharedSecretToken?: string + oauth2?: { + backendClientId: string + backendClientSecret: string + backendOidcClientId: string + issuerUrl: string + appUserBackendOidcClientId: string + appUserIssuerUrl: string + } +} + +const required = (name: string): string => { + const v = process.env[name] + if (v === undefined || v === '') throw new Error(`Missing env var: ${name}`) + return v +} + +const optional = (name: string): string | undefined => { + const v = process.env[name] + return v === undefined || v === '' ? undefined : v +} + +export const loadConfig = (): BackendConfig => { + const ledgerHost = required('LEDGER_HOST') + const ledgerPort = Number(required('LEDGER_PORT')) + const authMode: 'oauth2' | 'shared-secret' = required('SPRING_PROFILES_ACTIVE').includes('oauth2') + ? 'oauth2' + : 'shared-secret' + + return { + port: Number(required('BACKEND_PORT')), + registryBaseUri: required('REGISTRY_BASE_URI'), + ledgerHost, + ledgerPort, + ledgerJsonApiBaseUrl: `http://${ledgerHost}:${ledgerPort}`, + postgres: { + host: required('POSTGRES_HOST'), + port: Number(required('POSTGRES_PORT')), + database: required('POSTGRES_DATABASE'), + user: required('POSTGRES_USERNAME'), + password: required('POSTGRES_PASSWORD') + }, + authMode, + testMode: process.env['TEST_MODE'] === 'on', + appProviderParty: required('APP_PROVIDER_PARTY'), + // OAuth2: the Keycloak `sub` claim is the user's UUID (AUTH_APP_PROVIDER_BACKEND_USER_ID). + // Shared-secret: the JWT subject is the username (AUTH_APP_PROVIDER_BACKEND_USER_NAME). + // The JSON Ledger API rejects requests where commands.userId disagrees with the token's userId claim. + appProviderUserId: authMode === 'shared-secret' + ? required('AUTH_APP_PROVIDER_BACKEND_USER_NAME') + : (optional('AUTH_APP_PROVIDER_BACKEND_USER_ID') ?? 'AppId'), + sharedSecretToken: authMode === 'shared-secret' ? optional('APP_PROVIDER_BACKEND_USER_TOKEN') : undefined, + oauth2: authMode === 'oauth2' ? { + backendClientId: required('AUTH_APP_PROVIDER_BACKEND_CLIENT_ID'), + backendClientSecret: required('AUTH_APP_PROVIDER_BACKEND_SECRET'), + backendOidcClientId: required('AUTH_APP_PROVIDER_BACKEND_OIDC_CLIENT_ID'), + issuerUrl: required('AUTH_APP_PROVIDER_ISSUER_URL'), + appUserBackendOidcClientId: optional('AUTH_APP_USER_BACKEND_OIDC_CLIENT_ID') ?? '', + appUserIssuerUrl: optional('AUTH_APP_USER_ISSUER_URL') ?? '' + } : undefined + } +} diff --git a/quickstart/backend-js/src/http/app.ts b/quickstart/backend-js/src/http/app.ts new file mode 100644 index 000000000..ba866c0d4 --- /dev/null +++ b/quickstart/backend-js/src/http/app.ts @@ -0,0 +1,76 @@ +import Fastify, { type FastifyInstance } from 'fastify' +import formbody from '@fastify/formbody' +import type pg from 'pg' +import type { BackendConfig } from '../config.js' +import { registerSession } from '../auth/session.js' +import { registerCsrf } from '../auth/csrf.js' +import { registerOAuth2 } from '../auth/oauth2.js' +import { registerSharedSecret, registerLogout } from '../auth/shared-secret.js' +import type { OAuth2Registry } from '../auth/oauth2-registry.js' +import type { TenantRepository } from '../tenants/repository.js' +import type { LedgerApi } from '../canton/ledger.js' +import type { TokenStandardClient } from '../token-standard/client.js' +import type { LicensingService } from '../domain/licensing/service.js' +import { registerAdmin } from '../routes/admin.js' +import { registerLoginLinks } from '../routes/login-links.js' +import { registerUser } from '../routes/user.js' +import { registerFeatureFlags } from '../routes/feature-flags.js' +import { registerAppInstallRequests } from '../routes/app-install-requests.js' +import { registerAppInstalls } from '../routes/app-installs.js' +import { registerLicenses } from '../routes/licenses.js' +import { registerLicenseRenewalRequests } from '../routes/license-renewal-requests.js' + +export interface Services { + cfg: BackendConfig + pool: pg.Pool + ledger: LedgerApi + tokenStandard: TokenStandardClient + tenants: TenantRepository + oauth2Registry: OAuth2Registry + licensing: LicensingService +} + +export const buildApp = async (services: Services): Promise => { + const { cfg, tenants, oauth2Registry } = services + const app = Fastify({ logger: { level: 'info' }, trustProxy: true }) + // Override Fastify's default JSON parser to accept empty bodies. The frontend's logout + // sends `Content-Type: application/json` with no body; the default parser rejects with + // "Body cannot be empty when content-type is set to 'application/json'". + app.addContentTypeParser('application/json', { parseAs: 'string' }, (_req, body, done) => { + if (typeof body !== 'string' || body.length === 0) { done(null, undefined); return } + try { + done(null, JSON.parse(body)) + } catch (err) { + const e = err as Error & { statusCode?: number } + e.statusCode = 400 + done(e) + } + }) + await app.register(formbody) + await registerSession(app) + if (cfg.authMode === 'oauth2') await registerCsrf(app) + await registerOAuth2(app, cfg, oauth2Registry, tenants) + await registerSharedSecret(app, cfg, tenants) + await registerLogout(app) + + await registerAdmin(app, cfg, tenants, oauth2Registry) + await registerLoginLinks(app, cfg, oauth2Registry) + await registerUser(app, tenants) + await registerFeatureFlags(app, cfg) + await registerAppInstallRequests(app, services) + await registerAppInstalls(app, services) + await registerLicenses(app, services) + await registerLicenseRenewalRequests(app, services) + + app.get('/livez', async () => ({ status: 'ok' })) + app.get('/health', async () => ({ status: 'ok', backend: 'js', authMode: cfg.authMode })) + + app.setErrorHandler((err: unknown, req, reply) => { + const e = err as { statusCode?: number; message?: string } + const status = e.statusCode ?? 500 + if (status >= 500) req.log.error({ err }, 'unhandled error') + reply.code(status).send({ message: e.message ?? 'Unknown error' }) + }) + + return app +} diff --git a/quickstart/backend-js/src/server.ts b/quickstart/backend-js/src/server.ts new file mode 100644 index 000000000..e0bb9ccad --- /dev/null +++ b/quickstart/backend-js/src/server.ts @@ -0,0 +1,30 @@ +import { loadConfig } from './config.js' +import { buildApp, type Services } from './http/app.js' +import { buildPool } from './pqs/db.js' +import { CantonTokenProvider } from './canton/auth.js' +import { LedgerApi } from './canton/ledger.js' +import { TokenStandardClient } from './token-standard/client.js' +import { TenantRepository, seedAppProvider } from './tenants/repository.js' +import { initOAuth2Registry } from './auth/oauth2.js' +import { LicensingService } from './domain/licensing/service.js' + +const main = async (): Promise => { + const cfg = loadConfig() + const pool = buildPool(cfg) + const tokens = new CantonTokenProvider(cfg) + const ledger = new LedgerApi(cfg, tokens) + const tokenStandard = new TokenStandardClient(cfg) + const tenants = new TenantRepository() + seedAppProvider(tenants, cfg) + const oauth2Registry = await initOAuth2Registry(cfg) + const licensing = new LicensingService(cfg, pool, ledger, tokenStandard, tenants) + const services: Services = { cfg, pool, ledger, tokenStandard, tenants, oauth2Registry, licensing } + const app = await buildApp(services) + await app.listen({ port: cfg.port, host: '0.0.0.0' }) + app.log.info({ backend: 'js', port: cfg.port, authMode: cfg.authMode }, 'backend-js listening') +} + +main().catch((err) => { + console.error(err) + process.exit(1) +}) diff --git a/quickstart/backend-js/tsconfig.json b/quickstart/backend-js/tsconfig.json new file mode 100644 index 000000000..aa27527e4 --- /dev/null +++ b/quickstart/backend-js/tsconfig.json @@ -0,0 +1,16 @@ +{ + "compilerOptions": { + "target": "ES2022", + "module": "NodeNext", + "moduleResolution": "NodeNext", + "outDir": "dist", + "rootDir": "src", + "strict": true, + "noUncheckedIndexedAccess": true, + "esModuleInterop": true, + "skipLibCheck": true, + "resolveJsonModule": true, + "forceConsistentCasingInFileNames": true + }, + "include": ["src/**/*.ts"] +} From 0334150b7fb008f5a4c4b022ff95e6f674b48a01 Mon Sep 17 00:00:00 2001 From: fernandomg Date: Wed, 29 Apr 2026 12:25:42 +0200 Subject: [PATCH 07/22] feat(backend-js): auth subsystem with OAuth2, shared-secret, and tenants Wires session, CSRF, and cookie middleware; OAuth2 (with plain-HTTP issuer opt-in for local Keycloak, JWKS cache per issuer, partyId resolved from the tenant repository); shared-secret form login that resolves the username against the tenant repository and seeds the AppProvider tenant with admin users; CSRF bypass for Bearer- authenticated service traffic; TEST_MODE party_id override applied at session population; admin-gate distinguishing 401/403 by Bearer or session presence; and the /admin, /user, and /login-links routes that sit on top of all of it. Co-Authored-By: Gabito Esmiapodo <4015436+gabitoesmiapodo@users.noreply.github.com> --- quickstart/backend-js/src/auth/admin-gate.ts | 21 ++++ quickstart/backend-js/src/auth/cookies.ts | 3 + quickstart/backend-js/src/auth/csrf.ts | 32 ++++++ quickstart/backend-js/src/auth/jwt-admin.ts | 27 +++++ .../backend-js/src/auth/oauth2-registry.ts | 53 +++++++++ quickstart/backend-js/src/auth/oauth2.ts | 91 +++++++++++++++ quickstart/backend-js/src/auth/session.ts | 22 ++++ .../backend-js/src/auth/shared-secret.ts | 31 +++++ .../backend-js/src/auth/test-mode-party.ts | 15 +++ quickstart/backend-js/src/routes/admin.ts | 107 ++++++++++++++++++ .../backend-js/src/routes/login-links.ts | 13 +++ quickstart/backend-js/src/routes/user.ts | 16 +++ .../backend-js/src/tenants/repository.ts | 42 +++++++ 13 files changed, 473 insertions(+) create mode 100644 quickstart/backend-js/src/auth/admin-gate.ts create mode 100644 quickstart/backend-js/src/auth/cookies.ts create mode 100644 quickstart/backend-js/src/auth/csrf.ts create mode 100644 quickstart/backend-js/src/auth/jwt-admin.ts create mode 100644 quickstart/backend-js/src/auth/oauth2-registry.ts create mode 100644 quickstart/backend-js/src/auth/oauth2.ts create mode 100644 quickstart/backend-js/src/auth/session.ts create mode 100644 quickstart/backend-js/src/auth/shared-secret.ts create mode 100644 quickstart/backend-js/src/auth/test-mode-party.ts create mode 100644 quickstart/backend-js/src/routes/admin.ts create mode 100644 quickstart/backend-js/src/routes/login-links.ts create mode 100644 quickstart/backend-js/src/routes/user.ts create mode 100644 quickstart/backend-js/src/tenants/repository.ts diff --git a/quickstart/backend-js/src/auth/admin-gate.ts b/quickstart/backend-js/src/auth/admin-gate.ts new file mode 100644 index 000000000..357d749d1 --- /dev/null +++ b/quickstart/backend-js/src/auth/admin-gate.ts @@ -0,0 +1,21 @@ +import type { FastifyReply, FastifyRequest } from 'fastify' +import type { BackendConfig } from '../config.js' +import { verifyAdminJwt } from './jwt-admin.js' + +const hasBearerToken = (authHeader: string | undefined): boolean => + typeof authHeader === 'string' && /^Bearer\s+\S+/i.test(authHeader) + +// Accepts either a valid Bearer JWT or an admin session cookie. +// On failure, replies with 401 (no auth) or 403 (authenticated but not admin) and returns false. +export const checkAdmin = async (cfg: BackendConfig, req: FastifyRequest, reply: FastifyReply): Promise => { + const sessionIsAdmin = req.session.user?.isAdmin + if (sessionIsAdmin === true) return true + + const authHeader = req.headers['authorization'] + const authenticatedButNotAdmin = sessionIsAdmin === false || hasBearerToken(authHeader) + + if (cfg.authMode === 'oauth2' && await verifyAdminJwt(cfg, authHeader)) return true + + reply.code(authenticatedButNotAdmin ? 403 : 401).send({ message: authenticatedButNotAdmin ? 'forbidden' : 'unauthorized' }) + return false +} diff --git a/quickstart/backend-js/src/auth/cookies.ts b/quickstart/backend-js/src/auth/cookies.ts new file mode 100644 index 000000000..614bd4899 --- /dev/null +++ b/quickstart/backend-js/src/auth/cookies.ts @@ -0,0 +1,3 @@ +export const SESSION_COOKIE = 'JSESSIONID' +export const XSRF_COOKIE = 'XSRF-TOKEN' +export const XSRF_HEADER = 'x-xsrf-token' diff --git a/quickstart/backend-js/src/auth/csrf.ts b/quickstart/backend-js/src/auth/csrf.ts new file mode 100644 index 000000000..4fe02956f --- /dev/null +++ b/quickstart/backend-js/src/auth/csrf.ts @@ -0,0 +1,32 @@ +import type { FastifyInstance, FastifyRequest, FastifyReply } from 'fastify' +import { randomBytes } from 'node:crypto' +import { XSRF_COOKIE, XSRF_HEADER } from './cookies.js' + +const SAFE_METHODS = new Set(['GET', 'HEAD', 'OPTIONS']) + +const ensureToken = (req: FastifyRequest, reply: FastifyReply): string => { + const existing = req.cookies[XSRF_COOKIE] + if (existing !== undefined && existing !== '') return existing + const fresh = randomBytes(32).toString('hex') + reply.setCookie(XSRF_COOKIE, fresh, { httpOnly: false, sameSite: 'lax', path: '/', secure: false }) + return fresh +} + +export const registerCsrf = async (app: FastifyInstance): Promise => { + app.addHook('onRequest', async (req, reply) => { + if (SAFE_METHODS.has(req.method)) { + ensureToken(req, reply) + return + } + // Bearer-authenticated calls are stateless service-to-service traffic (e.g. + // register-app-user-tenant); CSRF is a session-cookie defense and doesn't apply. + // Mirrors Spring Security's default of bypassing CSRF for JWT bearer auth. + const authHeader = req.headers['authorization'] + if (typeof authHeader === 'string' && /^Bearer\s+\S+/i.test(authHeader)) return + const cookieToken = req.cookies[XSRF_COOKIE] + const headerToken = req.headers[XSRF_HEADER] + if (cookieToken === undefined || headerToken === undefined || cookieToken !== headerToken) { + return reply.code(403).send({ message: 'csrf_mismatch' }) + } + }) +} diff --git a/quickstart/backend-js/src/auth/jwt-admin.ts b/quickstart/backend-js/src/auth/jwt-admin.ts new file mode 100644 index 000000000..eed8f4e78 --- /dev/null +++ b/quickstart/backend-js/src/auth/jwt-admin.ts @@ -0,0 +1,27 @@ +import { createRemoteJWKSet, jwtVerify } from 'jose' +import type { BackendConfig } from '../config.js' + +const jwksCache = new Map>() + +const getJwks = (issuer: string): ReturnType => { + const existing = jwksCache.get(issuer) + if (existing !== undefined) return existing + const jwksUri = `${issuer.replace(/\/$/, '')}/protocol/openid-connect/certs` + const jwks = createRemoteJWKSet(new URL(jwksUri)) + jwksCache.set(issuer, jwks) + return jwks +} + +export const verifyAdminJwt = async (cfg: BackendConfig, authHeader: string | undefined): Promise => { + if (cfg.authMode !== 'oauth2' || cfg.oauth2 === undefined) return false + if (authHeader === undefined || !authHeader.startsWith('Bearer ')) return false + const token = authHeader.slice(7) + const issuer = cfg.oauth2.issuerUrl + if (issuer === '') return false + try { + await jwtVerify(token, getJwks(issuer), { issuer }) + return true + } catch { + return false + } +} diff --git a/quickstart/backend-js/src/auth/oauth2-registry.ts b/quickstart/backend-js/src/auth/oauth2-registry.ts new file mode 100644 index 000000000..a596e2064 --- /dev/null +++ b/quickstart/backend-js/src/auth/oauth2-registry.ts @@ -0,0 +1,53 @@ +import * as openid from 'openid-client' + +export interface RegistrationEntry { + registrationId: string + tenantId: string + clientId: string + issuerUrl: string + config: openid.Configuration +} + +export class OAuth2Registry { + private readonly entries = new Map() + + async register(tenantId: string, clientId: string, issuerUrl: string): Promise { + const registrationId = tenantId === 'AppProvider' ? 'AppProvider' : `${tenantId}-${clientId}` + if (this.entries.has(registrationId)) { + throw new Error(`Registration already exists: ${registrationId}`) + } + // openid-client v6 rejects plain-HTTP issuers by default. Spring's default HTTP client + // (used by the Java backend) doesn't enforce HTTPS, so opt into allowInsecureRequests for + // http:// issuers to match. The execute hook propagates to all subsequent calls made + // through the returned Configuration. + // + // allowInsecureRequests is annotated @deprecated by the library to make it stand out as a + // safety override (not because it's going away or has a replacement); accepted here. + const url = new URL(issuerUrl) + const options: openid.DiscoveryRequestOptions | undefined = + url.protocol === 'http:' ? { execute: [openid.allowInsecureRequests] } : undefined + const config = await openid.discovery(url, clientId, undefined, undefined, options) + this.entries.set(registrationId, { registrationId, tenantId, clientId, issuerUrl, config }) + return registrationId + } + + get(registrationId: string): RegistrationEntry | undefined { + return this.entries.get(registrationId) + } + + list(): RegistrationEntry[] { + return [...this.entries.values()] + } + + removeByTenantId(tenantId: string): void { + const keys = [...this.entries.entries()] + .filter(([, e]) => e.tenantId === tenantId) + .map(([k]) => k) + if (keys.length === 0) throw new Error(`No registrations for tenant: ${tenantId}`) + keys.forEach((k) => this.entries.delete(k)) + } + + loginUrl(registrationId: string): string { + return `/oauth2/authorization/${registrationId}` + } +} diff --git a/quickstart/backend-js/src/auth/oauth2.ts b/quickstart/backend-js/src/auth/oauth2.ts new file mode 100644 index 000000000..6a8de17e4 --- /dev/null +++ b/quickstart/backend-js/src/auth/oauth2.ts @@ -0,0 +1,91 @@ +import type { FastifyInstance } from 'fastify' +import * as openid from 'openid-client' +import { randomBytes } from 'node:crypto' +import type { BackendConfig } from '../config.js' +import type { TenantRepository } from '../tenants/repository.js' +import { OAuth2Registry } from './oauth2-registry.js' +import { XSRF_COOKIE } from './cookies.js' +import { resolveTestModePartyId } from './test-mode-party.js' + +const baseUrl = (req: { headers: Record }, cfg: BackendConfig): string => { + const proto = (req.headers['x-forwarded-proto'] as string | undefined) ?? 'http' + const host = (req.headers['x-forwarded-host'] as string | undefined) ?? `localhost:${cfg.port}` + return `${proto}://${host}` +} + +export const initOAuth2Registry = async (cfg: BackendConfig): Promise => { + const registry = new OAuth2Registry() + if (cfg.authMode !== 'oauth2' || cfg.oauth2 === undefined) return registry + await registry.register('AppProvider', cfg.oauth2.backendOidcClientId, cfg.oauth2.issuerUrl) + return registry +} + +export const registerOAuth2 = async (app: FastifyInstance, cfg: BackendConfig, registry: OAuth2Registry, tenants: TenantRepository): Promise => { + if (cfg.authMode !== 'oauth2') return + + app.get<{ Params: { registrationId: string } }>('/oauth2/authorization/:registrationId', async (req, reply) => { + const entry = registry.get(req.params.registrationId) + if (entry === undefined) { reply.code(404); return { message: 'unknown_registration' } } + const codeVerifier = openid.randomPKCECodeVerifier() + const codeChallenge = await openid.calculatePKCECodeChallenge(codeVerifier) + const state = randomBytes(16).toString('hex') + const nonce = randomBytes(16).toString('hex') + req.session.oauthState = { state, codeVerifier, registrationId: req.params.registrationId, nonce } + const redirectUri = `${baseUrl(req, cfg)}/login/oauth2/code/${req.params.registrationId}` + const url = openid.buildAuthorizationUrl(entry.config, { + redirect_uri: redirectUri, + scope: 'openid', + code_challenge: codeChallenge, + code_challenge_method: 'S256', + state, + nonce + }) + return reply.redirect(url.href) + }) + + app.get<{ Params: { registrationId: string }; Querystring: Record }>( + '/login/oauth2/code/:registrationId', + async (req, reply) => { + const entry = registry.get(req.params.registrationId) + const stored = req.session.oauthState + if (entry === undefined || stored === undefined || stored.registrationId !== req.params.registrationId) { + reply.code(400); return { message: 'invalid_state' } + } + // Use the raw request URL to preserve the exact encoding of query parameters. + const currentUrl = new URL(req.raw.url ?? req.url, baseUrl(req, cfg)) + const tokens = await openid.authorizationCodeGrant(entry.config, currentUrl, { + pkceCodeVerifier: stored.codeVerifier, + expectedState: stored.state, + expectedNonce: stored.nonce + }) + const rawClaims = tokens.claims() + const claims: Record = rawClaims !== undefined ? (rawClaims as Record) : {} + const name = (claims['name'] as string | undefined) ?? + (claims['preferred_username'] as string | undefined) ?? + (claims['sub'] as string | undefined) ?? 'unknown' + const isAppProvider = entry.tenantId === 'AppProvider' + const roles: string[] = isAppProvider + ? ['ROLE_ADMIN', 'SCOPE_openid'] + : ['ROLE_USER', 'SCOPE_openid'] + const tenantPartyId = tenants.get(entry.tenantId)?.partyId ?? '' + req.session.user = { + name, + tenantId: entry.tenantId, + partyId: resolveTestModePartyId(cfg, claims, tenantPartyId), + userId: claims['sub'] as string | undefined, + idTokenClaims: claims, + roles, + isAdmin: isAppProvider + } + req.session.oauthState = undefined + // Mirrors Spring Security's CSRF workaround for oauth2 callback: ensure an XSRF-TOKEN + // cookie exists, but do not overwrite a token the client already holds (preserves + // tokens from in-flight tabs that were issued before login). + if (req.cookies[XSRF_COOKIE] === undefined || req.cookies[XSRF_COOKIE] === '') { + const csrfToken = randomBytes(32).toString('hex') + reply.setCookie(XSRF_COOKIE, csrfToken, { httpOnly: false, sameSite: 'lax', path: '/', secure: false }) + } + return reply.redirect('/') + } + ) +} diff --git a/quickstart/backend-js/src/auth/session.ts b/quickstart/backend-js/src/auth/session.ts new file mode 100644 index 000000000..7eeb76305 --- /dev/null +++ b/quickstart/backend-js/src/auth/session.ts @@ -0,0 +1,22 @@ +import type { FastifyInstance } from 'fastify' +import cookie from '@fastify/cookie' +import session from '@fastify/session' +import { randomBytes } from 'node:crypto' +import { SESSION_COOKIE } from './cookies.js' + +declare module 'fastify' { + interface Session { + user?: { name: string; tenantId: string; partyId: string; userId?: string; idTokenClaims?: Record; roles?: string[]; isAdmin?: boolean } + oauthState?: { state: string; codeVerifier: string; registrationId: string; nonce: string } + } +} + +export const registerSession = async (app: FastifyInstance): Promise => { + await app.register(cookie) + await app.register(session, { + secret: process.env['SESSION_SECRET'] ?? randomBytes(32).toString('hex'), + cookieName: SESSION_COOKIE, + cookie: { httpOnly: true, sameSite: 'lax', path: '/', secure: false }, + saveUninitialized: false + }) +} diff --git a/quickstart/backend-js/src/auth/shared-secret.ts b/quickstart/backend-js/src/auth/shared-secret.ts new file mode 100644 index 000000000..54d4061a3 --- /dev/null +++ b/quickstart/backend-js/src/auth/shared-secret.ts @@ -0,0 +1,31 @@ +import type { FastifyInstance } from 'fastify' +import type { BackendConfig } from '../config.js' +import type { TenantRepository } from '../tenants/repository.js' +import { resolveTestModePartyId } from './test-mode-party.js' + +export const registerSharedSecret = async (app: FastifyInstance, cfg: BackendConfig, tenants: TenantRepository): Promise => { + if (cfg.authMode !== 'shared-secret') return + + app.post<{ Body: { username?: string } }>('/login', async (req, reply) => { + const username = req.body?.username + if (username === undefined || username === '') { reply.redirect('/login?error=missing_username'); return } + const matchedTenant = tenants.list().find(t => t.users?.includes(username)) + if (matchedTenant === undefined) { reply.redirect('/login?error=unknown_user'); return } + req.session.user = { + name: username, + tenantId: matchedTenant.tenantId, + partyId: resolveTestModePartyId(cfg, req.session.user?.idTokenClaims, matchedTenant.partyId), + userId: username, + roles: matchedTenant.internal ? ['ROLE_ADMIN'] : ['ROLE_USER'], + isAdmin: matchedTenant.internal + } + reply.redirect('/') + }) +} + +export const registerLogout = async (app: FastifyInstance): Promise => { + app.post('/logout', async (req, reply) => { + await req.session.destroy() + reply.code(204).send() + }) +} diff --git a/quickstart/backend-js/src/auth/test-mode-party.ts b/quickstart/backend-js/src/auth/test-mode-party.ts new file mode 100644 index 000000000..0a11f133b --- /dev/null +++ b/quickstart/backend-js/src/auth/test-mode-party.ts @@ -0,0 +1,15 @@ +import type { BackendConfig } from '../config.js' + +// Mirrors Spring's `test` profile (OAuth2AuthenticationSuccessHandler): in TEST_MODE the +// JWT's `party_id` claim wins over the tenant-registered party so each integration-test +// run gets a fresh AppUser party. CAUTION: not for production — a forged claim would +// otherwise let any caller act as any party. +export const resolveTestModePartyId = ( + cfg: BackendConfig, + claims: Record | undefined, + fallback: string +): string => { + if (!cfg.testMode || claims === undefined) return fallback + const claim = claims['party_id'] + return typeof claim === 'string' && claim !== '' ? claim : fallback +} diff --git a/quickstart/backend-js/src/routes/admin.ts b/quickstart/backend-js/src/routes/admin.ts new file mode 100644 index 000000000..71eff2985 --- /dev/null +++ b/quickstart/backend-js/src/routes/admin.ts @@ -0,0 +1,107 @@ +import type { FastifyInstance } from 'fastify' +import type { BackendConfig } from '../config.js' +import type { TenantRepository } from '../tenants/repository.js' +import type { OAuth2Registry } from '../auth/oauth2-registry.js' +import { checkAdmin } from '../auth/admin-gate.js' + +interface TenantRegistrationRequest { + tenantId?: string + partyId?: string + walletUrl?: string + clientId?: string + issuerUrl?: string + internal?: boolean + users?: string[] +} + +export const registerAdmin = async (app: FastifyInstance, cfg: BackendConfig, repo: TenantRepository, oauth2Registry: OAuth2Registry): Promise => { + + app.get('/admin/tenant-registrations', async (req, reply) => { + if (!await checkAdmin(cfg, req, reply)) return + + if (cfg.authMode === 'oauth2') { + return oauth2Registry.list().map((entry) => { + const tenant = repo.get(entry.tenantId) + return { + tenantId: entry.tenantId, + partyId: tenant?.partyId ?? '', + walletUrl: tenant?.walletUrl ?? '', + clientId: entry.clientId, + issuerUrl: entry.issuerUrl, + internal: tenant?.internal ?? false + } + }) + } + return repo.list().map((t) => ({ + tenantId: t.tenantId, + partyId: t.partyId, + walletUrl: t.walletUrl ?? '', + internal: t.internal, + users: t.users + })) + }) + + app.post<{ Body: TenantRegistrationRequest }>('/admin/tenant-registrations', async (req, reply) => { + if (!await checkAdmin(cfg, req, reply)) return + + const body = req.body + if (!body.tenantId || !body.partyId) { + reply.code(400); return { message: 'tenantId and partyId are required' } + } + if (cfg.authMode === 'oauth2') { + if (!body.clientId || !body.issuerUrl) { + reply.code(400); return { message: 'clientId and issuerUrl are required in OAuth2 mode' } + } + const duplicate = oauth2Registry.list().some( + (e) => e.clientId === body.clientId && e.issuerUrl === body.issuerUrl + ) + if (duplicate) { + reply.code(409); return { message: 'ClientId-IssuerUrl combination already exists' } + } + } else { + if (!body.users || body.users.length === 0) { + reply.code(400); return { message: 'At least one user is required in shared-secret mode' } + } + } + if (repo.has(body.tenantId)) { + reply.code(409); return { message: 'TenantId already exists' } + } + + if (cfg.authMode === 'oauth2' && body.clientId && body.issuerUrl) { + await oauth2Registry.register(body.tenantId, body.clientId, body.issuerUrl) + } + repo.upsert({ + tenantId: body.tenantId, + partyId: body.partyId, + walletUrl: body.walletUrl ?? '', + clientId: body.clientId ?? '', + issuerUrl: body.issuerUrl ?? '', + internal: body.internal ?? false, + users: body.users + }) + reply.code(201) + return { + tenantId: body.tenantId, + partyId: body.partyId, + walletUrl: body.walletUrl ?? '', + clientId: body.clientId, + issuerUrl: body.issuerUrl, + internal: body.internal ?? false, + users: body.users + } + }) + + app.delete<{ Params: { tenantId: string } }>('/admin/tenant-registrations/:tenantId', async (req, reply) => { + if (!await checkAdmin(cfg, req, reply)) return + + try { + if (cfg.authMode === 'oauth2') { + oauth2Registry.removeByTenantId(req.params.tenantId) + } + repo.delete(req.params.tenantId) + } catch { + reply.code(404); return { message: 'Not found' } + } + reply.code(204).send() + }) +} diff --git a/quickstart/backend-js/src/routes/login-links.ts b/quickstart/backend-js/src/routes/login-links.ts new file mode 100644 index 000000000..fbaedca41 --- /dev/null +++ b/quickstart/backend-js/src/routes/login-links.ts @@ -0,0 +1,13 @@ +import type { FastifyInstance } from 'fastify' +import type { BackendConfig } from '../config.js' +import type { OAuth2Registry } from '../auth/oauth2-registry.js' + +export const registerLoginLinks = async (app: FastifyInstance, cfg: BackendConfig, oauth2Registry: OAuth2Registry): Promise => { + app.get('/login-links', async () => { + if (cfg.authMode !== 'oauth2') return [] + return oauth2Registry.list().map((entry) => ({ + name: entry.tenantId, + url: oauth2Registry.loginUrl(entry.registrationId) + })) + }) +} diff --git a/quickstart/backend-js/src/routes/user.ts b/quickstart/backend-js/src/routes/user.ts new file mode 100644 index 000000000..fa81fbbca --- /dev/null +++ b/quickstart/backend-js/src/routes/user.ts @@ -0,0 +1,16 @@ +import type { FastifyInstance } from 'fastify' +import type { TenantRepository } from '../tenants/repository.js' + +export const registerUser = async (app: FastifyInstance, tenants: TenantRepository): Promise => { + app.get('/user', async (req, reply) => { + const u = req.session.user + if (u === undefined) { reply.code(401).send({ message: 'unauthorized' }); return } + const tenant = tenants.get(u.tenantId) + const party = u.partyId !== '' ? u.partyId : tenant?.partyId ?? '' + const walletUrl = tenant?.walletUrl ?? '' + const roles = u.roles ?? (u.isAdmin === true ? ['ROLE_ADMIN'] : ['ROLE_USER']) + const isAdmin = u.isAdmin ?? roles.includes('ROLE_ADMIN') + + return { name: u.name, party, roles, isAdmin, walletUrl } + }) +} diff --git a/quickstart/backend-js/src/tenants/repository.ts b/quickstart/backend-js/src/tenants/repository.ts new file mode 100644 index 000000000..37aa9076e --- /dev/null +++ b/quickstart/backend-js/src/tenants/repository.ts @@ -0,0 +1,42 @@ +import type { BackendConfig } from '../config.js' + +export interface Tenant { + tenantId: string + partyId: string + walletUrl: string + clientId: string + issuerUrl: string + internal: boolean + users?: string[] +} + +export class TenantRepository { + private readonly tenants = new Map() + + list(): Tenant[] { return [...this.tenants.values()] } + listExternal(): Tenant[] { return this.list().filter((t) => !t.internal) } + get(tenantId: string): Tenant | undefined { return this.tenants.get(tenantId) } + has(tenantId: string): boolean { return this.tenants.has(tenantId) } + put(tenant: Tenant): void { + if (this.tenants.has(tenant.tenantId)) throw new Error(`Duplicate tenantId: ${tenant.tenantId}`) + this.tenants.set(tenant.tenantId, tenant) + } + upsert(tenant: Tenant): void { this.tenants.set(tenant.tenantId, tenant) } + delete(tenantId: string): void { + if (!this.tenants.delete(tenantId)) throw new Error(`No tenant: ${tenantId}`) + } +} + +export const seedAppProvider = (repo: TenantRepository, cfg: BackendConfig): void => { + repo.put({ + tenantId: 'AppProvider', + partyId: cfg.appProviderParty, + walletUrl: '', + clientId: cfg.oauth2?.backendOidcClientId ?? '', + issuerUrl: cfg.oauth2?.issuerUrl ?? '', + internal: true, + // Mirrors Java's application-shared-secret.yml `application.tenants.AppProvider.users`. + // Matches AUTH_APP_PROVIDER_WALLET_ADMIN_USER_NAME from docker/modules/localnet/env/app-provider-auth-on.env. + users: cfg.authMode === 'shared-secret' ? ['app-provider'] : undefined + }) +} From c368c3da4e9ed84c39dbd2b28364779c56e3f2e5 Mon Sep 17 00:00:00 2001 From: fernandomg Date: Wed, 29 Apr 2026 12:25:53 +0200 Subject: [PATCH 08/22] feat(backend-js): PQS database layer and licensing repository Adds the read-side data access used by the licensing routes: a pg connection pool, a typed contract row helper that decodes the JSONB payload, and a licensing repository that finds active contracts by id and lists them by predicate. Co-Authored-By: Gabito Esmiapodo <4015436+gabitoesmiapodo@users.noreply.github.com> --- .../src/domain/licensing/repository.ts | 83 +++++++++++++++++++ quickstart/backend-js/src/pqs/contracts.ts | 35 ++++++++ quickstart/backend-js/src/pqs/db.ts | 11 +++ 3 files changed, 129 insertions(+) create mode 100644 quickstart/backend-js/src/domain/licensing/repository.ts create mode 100644 quickstart/backend-js/src/pqs/contracts.ts create mode 100644 quickstart/backend-js/src/pqs/db.ts diff --git a/quickstart/backend-js/src/domain/licensing/repository.ts b/quickstart/backend-js/src/domain/licensing/repository.ts new file mode 100644 index 000000000..7ce972d25 --- /dev/null +++ b/quickstart/backend-js/src/domain/licensing/repository.ts @@ -0,0 +1,83 @@ +import type pg from 'pg' +import { findActive, findActiveByContractId } from '../../pqs/contracts.js' + +// Template IDs as used by PQS active() function (module:template, no package hash). +// These match Utils.getTemplateIdByClass(Clazz).qualifiedName() from the Java backend. +export const TEMPLATE_IDS = { + AppInstall: 'Licensing.AppInstall:AppInstall', + AppInstallRequest: 'Licensing.AppInstall:AppInstallRequest', + License: 'Licensing.License:License', + LicenseRenewalRequest: 'Licensing.License:LicenseRenewalRequest', + AllocationRequest: 'Splice.Api.Token.AllocationRequestV1:AllocationRequest', + Allocation: 'Splice.Api.Token.AllocationV1:Allocation' +} as const + +export interface LicenseRow { contract_id: string; license_payload: Record } +export interface LicenseWithRenewalRows { + licenseContractId: string + licensePayload: Record + renewals: Array<{ contractId: string; payload: Record; allocationCid?: string }> +} + +export const findActiveLicenses = async (pool: pg.Pool, party: string): Promise => { + const sql = ` + SELECT license.contract_id AS license_contract_id, + license.payload AS license_payload, + renewal.contract_id AS renewal_contract_id, + renewal.payload AS renewal_payload, + allocation.contract_id AS allocation_contract_id + FROM active($1) license + LEFT JOIN active($2) renewal ON + license.payload->>'licenseNum' = renewal.payload->>'licenseNum' + AND license.payload->>'user' = renewal.payload->>'user' + LEFT JOIN active($3) allocation ON + renewal.payload->>'requestId' = allocation.payload->'allocation'->'settlement'->'settlementRef'->>'id' + AND renewal.payload->>'user' = allocation.payload->'allocation'->'transferLeg'->>'sender' + WHERE license.payload->>'user' = $4 OR license.payload->>'provider' = $4 + ORDER BY license.contract_id + ` + const res = await pool.query(sql, [ + TEMPLATE_IDS.License, + TEMPLATE_IDS.LicenseRenewalRequest, + TEMPLATE_IDS.Allocation, + party + ]) + const map = new Map() + for (const row of res.rows) { + const licId: string = row.license_contract_id + let entry = map.get(licId) + if (entry === undefined) { + entry = { licenseContractId: licId, licensePayload: row.license_payload, renewals: [] } + map.set(licId, entry) + } + if (row.renewal_contract_id !== null) { + entry.renewals.push({ + contractId: row.renewal_contract_id, + payload: row.renewal_payload, + allocationCid: row.allocation_contract_id ?? undefined + }) + } + } + return [...map.values()] +} + +export const findLicenseById = (pool: pg.Pool, contractId: string) => + findActiveByContractId(pool, TEMPLATE_IDS.License, contractId) + +export const findActiveLicenseRenewalRequestById = (pool: pg.Pool, contractId: string) => + findActiveByContractId(pool, TEMPLATE_IDS.LicenseRenewalRequest, contractId) + +export const findActiveAllocationRequestById = (pool: pg.Pool, contractId: string) => + findActiveByContractId(pool, TEMPLATE_IDS.AllocationRequest, contractId) + +export const findAppInstallById = (pool: pg.Pool, contractId: string) => + findActiveByContractId(pool, TEMPLATE_IDS.AppInstall, contractId) + +export const findAppInstallRequestById = (pool: pg.Pool, contractId: string) => + findActiveByContractId(pool, TEMPLATE_IDS.AppInstallRequest, contractId) + +export const findActiveAppInstalls = (pool: pg.Pool) => + findActive(pool, TEMPLATE_IDS.AppInstall) + +export const findActiveAppInstallRequests = (pool: pg.Pool) => + findActive(pool, TEMPLATE_IDS.AppInstallRequest) diff --git a/quickstart/backend-js/src/pqs/contracts.ts b/quickstart/backend-js/src/pqs/contracts.ts new file mode 100644 index 000000000..4e8b3c7f4 --- /dev/null +++ b/quickstart/backend-js/src/pqs/contracts.ts @@ -0,0 +1,35 @@ +import type pg from 'pg' + +export interface ActiveContract

> { + contractId: string + payload: P +} + +// active($1) is the PQS-provided PostgreSQL function returning active (non-archived) contracts. +// Column names confirmed from Pqs.java: contract_id, payload. + +export const findActive = async

>( + pool: pg.Pool, + templateId: string +): Promise[]> => { + const res = await pool.query<{ contract_id: string; payload: P }>( + 'SELECT contract_id, payload FROM active($1)', + [templateId] + ) + return res.rows.map((r) => ({ contractId: r.contract_id, payload: r.payload })) +} + +export const findActiveByContractId = async

>( + pool: pg.Pool, + templateId: string, + contractId: string +): Promise | undefined> => { + const res = await pool.query<{ contract_id: string; payload: P }>( + 'SELECT contract_id, payload FROM active($1) WHERE contract_id = $2', + [templateId, contractId] + ) + const row = res.rows[0] + if (row === undefined) return undefined + return { contractId: row.contract_id, payload: row.payload } +} + diff --git a/quickstart/backend-js/src/pqs/db.ts b/quickstart/backend-js/src/pqs/db.ts new file mode 100644 index 000000000..51357b1d5 --- /dev/null +++ b/quickstart/backend-js/src/pqs/db.ts @@ -0,0 +1,11 @@ +import pg from 'pg' +import type { BackendConfig } from '../config.js' + +export const buildPool = (cfg: BackendConfig): pg.Pool => new pg.Pool({ + host: cfg.postgres.host, + port: cfg.postgres.port, + database: cfg.postgres.database, + user: cfg.postgres.user, + password: cfg.postgres.password, + max: 10 +}) From 9d79086a675417704acfeeefc00fdcd196fa4d52 Mon Sep 17 00:00:00 2001 From: fernandomg Date: Wed, 29 Apr 2026 12:26:14 +0200 Subject: [PATCH 09/22] feat(backend-js): Canton JSON Ledger API client with typed Daml command bindings Adds the write-side ledger access: a client-credentials token provider with a 30s expiry buffer, a JSON Ledger API client wrapping submit-and- wait-for-transaction, and command builders typed via the dpm codegen-js output (damlTypes.Template/Choice). Template ids carry the '#:' prefix the JSON Ledger API requires, every submit is wrapped in the JsCommands envelope, and userId is matched to the JWT subject claim. A token-standard client adds the registry admin id and allocation transfer context lookup. Co-Authored-By: Gabito Esmiapodo <4015436+gabitoesmiapodo@users.noreply.github.com> --- quickstart/backend-js/src/canton/auth.ts | 28 ++++++++ quickstart/backend-js/src/canton/commands.ts | 69 +++++++++++++++++++ quickstart/backend-js/src/canton/ledger.ts | 44 ++++++++++++ .../backend-js/src/token-standard/client.ts | 32 +++++++++ 4 files changed, 173 insertions(+) create mode 100644 quickstart/backend-js/src/canton/auth.ts create mode 100644 quickstart/backend-js/src/canton/commands.ts create mode 100644 quickstart/backend-js/src/canton/ledger.ts create mode 100644 quickstart/backend-js/src/token-standard/client.ts diff --git a/quickstart/backend-js/src/canton/auth.ts b/quickstart/backend-js/src/canton/auth.ts new file mode 100644 index 000000000..86cf320ae --- /dev/null +++ b/quickstart/backend-js/src/canton/auth.ts @@ -0,0 +1,28 @@ +import type { BackendConfig } from '../config.js' + +interface CachedToken { token: string; expiresAt: number } + +export class CantonTokenProvider { + private cached?: CachedToken + + constructor(private readonly cfg: BackendConfig) {} + + async getToken(): Promise { + if (this.cfg.authMode === 'shared-secret') return this.cfg.sharedSecretToken + if (this.cfg.authMode !== 'oauth2' || this.cfg.oauth2 === undefined) return undefined + const now = Date.now() + if (this.cached !== undefined && this.cached.expiresAt > now + 30_000) return this.cached.token + + const tokenUrl = `${this.cfg.oauth2.issuerUrl.replace(/\/$/, '')}/protocol/openid-connect/token` + const body = new URLSearchParams({ + grant_type: 'client_credentials', + client_id: this.cfg.oauth2.backendClientId, + client_secret: this.cfg.oauth2.backendClientSecret + }) + const res = await fetch(tokenUrl, { method: 'POST', body, headers: { 'content-type': 'application/x-www-form-urlencoded' } }) + if (!res.ok) throw new Error(`token endpoint ${res.status}: ${await res.text()}`) + const json = await res.json() as { access_token: string; expires_in: number } + this.cached = { token: json.access_token, expiresAt: now + json.expires_in * 1000 } + return json.access_token + } +} diff --git a/quickstart/backend-js/src/canton/commands.ts b/quickstart/backend-js/src/canton/commands.ts new file mode 100644 index 000000000..e924cb5e8 --- /dev/null +++ b/quickstart/backend-js/src/canton/commands.ts @@ -0,0 +1,69 @@ +import { randomBytes } from 'node:crypto' +import type * as damlTypes from '@daml/types' +import type { BackendConfig } from '../config.js' +import type { LedgerApi, DisclosedContract } from './ledger.js' + +export interface SubmitContext { + actAs: string + userId: string + commandIdOverride?: string +} + +export const generateCommandId = (override?: string): string => + override !== undefined && override !== '' ? override : `qs-js-${randomBytes(8).toString('hex')}` + +export const createContract = async ( + ledger: LedgerApi, + ctx: SubmitContext, + template: damlTypes.Template, + payload: T +): Promise => { + return ledger.submitAndWaitForTransaction({ + commandId: generateCommandId(ctx.commandIdOverride), + actAs: [ctx.actAs], + readAs: [ctx.actAs], + userId: ctx.userId, + commands: [{ + CreateCommand: { + templateId: template.templateId, + createArguments: template.encode(payload) + } + }] + }) +} + +export const exerciseChoice = async ( + ledger: LedgerApi, + ctx: SubmitContext, + template: damlTypes.TemplateOrInterface, + choice: damlTypes.Choice, + contractId: string, + args: C, + disclosed?: DisclosedContract[] +): Promise => { + return ledger.submitAndWaitForTransaction({ + commandId: generateCommandId(ctx.commandIdOverride), + actAs: [ctx.actAs], + readAs: [ctx.actAs], + userId: ctx.userId, + commands: [{ + ExerciseCommand: { + templateId: template.templateId, + contractId, + choice: choice.choiceName, + choiceArgument: choice.argumentEncode(args) + } + }], + disclosedContracts: disclosed + }) +} + +export const submitContextFromSession = ( + cfg: BackendConfig, + party: string, + commandIdQuery: string | undefined +): SubmitContext => ({ + actAs: party, + userId: cfg.appProviderUserId, + commandIdOverride: commandIdQuery +}) diff --git a/quickstart/backend-js/src/canton/ledger.ts b/quickstart/backend-js/src/canton/ledger.ts new file mode 100644 index 000000000..dcadc4d54 --- /dev/null +++ b/quickstart/backend-js/src/canton/ledger.ts @@ -0,0 +1,44 @@ +import type { BackendConfig } from '../config.js' +import type { CantonTokenProvider } from './auth.js' + +export interface DisclosedContract { + contractId: string + createdEventBlob: string + synchronizerId: string + templateId: string +} + +export interface Command { + CreateCommand?: { templateId: string; createArguments: unknown } + ExerciseCommand?: { templateId: string; contractId: string; choice: string; choiceArgument: unknown } +} + +export interface SubmitArgs { + commandId: string + actAs: string[] + readAs?: string[] + userId: string + commands: Command[] + disclosedContracts?: DisclosedContract[] +} + +export class LedgerApi { + constructor(private readonly cfg: BackendConfig, private readonly tokens: CantonTokenProvider) {} + + private async post(path: string, body: unknown): Promise { + const token = await this.tokens.getToken() + const headers: Record = { 'content-type': 'application/json' } + if (token !== undefined) headers['authorization'] = `Bearer ${token}` + const res = await fetch(`${this.cfg.ledgerJsonApiBaseUrl}${path}`, { method: 'POST', headers, body: JSON.stringify(body) }) + if (!res.ok) throw new Error(`${path} ${res.status}: ${await res.text()}`) + return await res.json() as T + } + + async submitAndWaitForTransaction(args: SubmitArgs): Promise { + return this.post('/v2/commands/submit-and-wait-for-transaction', { commands: args }) + } + + async submitAndWaitForTransactionTree(args: SubmitArgs): Promise { + return this.post('/v2/commands/submit-and-wait-for-transaction-tree', { commands: args }) + } +} diff --git a/quickstart/backend-js/src/token-standard/client.ts b/quickstart/backend-js/src/token-standard/client.ts new file mode 100644 index 000000000..f50e68730 --- /dev/null +++ b/quickstart/backend-js/src/token-standard/client.ts @@ -0,0 +1,32 @@ +import type { BackendConfig } from '../config.js' + +export class TokenStandardClient { + constructor(private readonly cfg: BackendConfig) {} + + private async get(path: string): Promise { + const res = await fetch(`${this.cfg.registryBaseUri}${path}`) + if (!res.ok) throw new Error(`${path} ${res.status}: ${await res.text()}`) + return await res.json() as T + } + + private async post(path: string, body: unknown): Promise { + const res = await fetch(`${this.cfg.registryBaseUri}${path}`, { + method: 'POST', + headers: { 'content-type': 'application/json' }, + body: JSON.stringify(body) + }) + if (!res.ok) throw new Error(`${path} ${res.status}: ${await res.text()}`) + return await res.json() as T + } + + async getRegistryAdminId(): Promise<{ adminId: string }> { + return this.get<{ adminId: string }>('/registry/metadata/v1/info') + } + + async getAllocationTransferContext(allocationCid: string): Promise { + return this.post( + `/registry/allocations/v1/${encodeURIComponent(allocationCid)}/choice-contexts/execute-transfer`, + {} + ) + } +} From 415facc083c41bda1e7c4f21fca07969000a10f5 Mon Sep 17 00:00:00 2001 From: fernandomg Date: Wed, 29 Apr 2026 12:26:29 +0200 Subject: [PATCH 10/22] feat(backend-js): licensing service and HTTP routes Adds the business surface exposed over the OpenAPI contract: a licensing service that orchestrates PQS reads and ledger writes, mappers that mirror the Java backend's DTO shapes, and the routes for feature-flags, app-install-requests, app-installs, licenses, and license-renewal-requests. Daml-choice routes register one wildcard per resource to dodge find-my-way's colon-route limitation while preserving the URL contract. Microsecond-precision timestamps are emitted on License_Renew, the new License contract id is read from the CreatedEvent walk (since submit-and-wait returns ACS_DELTA events without exerciseResult), and admin-only choice endpoints are gated by checkAdmin. Co-Authored-By: Gabito Esmiapodo <4015436+gabitoesmiapodo@users.noreply.github.com> --- .../src/domain/licensing/mappers.ts | 74 ++++ .../src/domain/licensing/service.ts | 323 ++++++++++++++++++ .../src/routes/app-install-requests.ts | 42 +++ .../backend-js/src/routes/app-installs.ts | 43 +++ .../backend-js/src/routes/feature-flags.ts | 8 + .../src/routes/license-renewal-requests.ts | 26 ++ quickstart/backend-js/src/routes/licenses.ts | 55 +++ 7 files changed, 571 insertions(+) create mode 100644 quickstart/backend-js/src/domain/licensing/mappers.ts create mode 100644 quickstart/backend-js/src/domain/licensing/service.ts create mode 100644 quickstart/backend-js/src/routes/app-install-requests.ts create mode 100644 quickstart/backend-js/src/routes/app-installs.ts create mode 100644 quickstart/backend-js/src/routes/feature-flags.ts create mode 100644 quickstart/backend-js/src/routes/license-renewal-requests.ts create mode 100644 quickstart/backend-js/src/routes/licenses.ts diff --git a/quickstart/backend-js/src/domain/licensing/mappers.ts b/quickstart/backend-js/src/domain/licensing/mappers.ts new file mode 100644 index 000000000..af96580d3 --- /dev/null +++ b/quickstart/backend-js/src/domain/licensing/mappers.ts @@ -0,0 +1,74 @@ +import type { LicenseWithRenewalRows } from './repository.js' + +type P = Record + +const str = (p: P, k: string): string => p[k] as string +const num = (p: P, k: string): number => Number(p[k]) +const meta = (p: P, k: string): { data: Record } => { + const m = p[k] as { values?: Record } + return { data: m?.values ?? {} } +} + +export const mapAppInstallRequest = (contractId: string, payload: P) => ({ + contractId, + provider: str(payload, 'provider'), + user: str(payload, 'user'), + meta: meta(payload, 'meta') +}) + +export const mapAppInstall = (contractId: string, payload: P) => ({ + contractId, + provider: str(payload, 'provider'), + user: str(payload, 'user'), + meta: meta(payload, 'meta'), + numLicensesCreated: num(payload, 'numLicensesCreated') +}) + +export const mapLicenseRenewalRequest = (contractId: string, payload: P, allocationCid?: string) => { + // Daml Int round-trips as a string in the JSON Ledger API to preserve 64-bit precision, + // so use BigInt and reduce before casting back to Number for the final "N days" string. + const relTime = payload['licenseExtensionDuration'] as { microseconds: string } | undefined + const micros = BigInt(relTime?.microseconds ?? '0') + const approximateDays = Number(micros / (1_000_000n * 3600n * 24n)) + ' days' + const now = Date.now() + const prepareUntil = str(payload, 'prepareUntil') + const settleBefore = str(payload, 'settleBefore') + return { + contractId, + provider: str(payload, 'provider'), + user: str(payload, 'user'), + licenseNum: num(payload, 'licenseNum'), + licenseFeeAmount: parseFloat(payload['licenseFeeAmount'] as string), + licenseFeeInstrument: null, + licenseExtensionDuration: approximateDays, + prepareUntil, + settleBefore, + requestedAt: str(payload, 'requestedAt'), + description: str(payload, 'description'), + requestId: str(payload, 'requestId'), + allocationCid: allocationCid ?? null, + prepareDeadlinePassed: new Date(prepareUntil).getTime() <= now, + settleDeadlinePassed: new Date(settleBefore).getTime() <= now + } +} + +export const mapLicense = (row: LicenseWithRenewalRows) => { + const lp = row.licensePayload as P + const now = Date.now() + const expiresAt = str(lp, 'expiresAt') + const params = lp['params'] as P + return { + contractId: row.licenseContractId, + provider: str(lp, 'provider'), + user: str(lp, 'user'), + params: { + meta: meta(params, 'meta') + }, + expiresAt, + licenseNum: num(lp, 'licenseNum'), + isExpired: new Date(expiresAt).getTime() <= now, + renewalRequests: row.renewals + .map(r => mapLicenseRenewalRequest(r.contractId, r.payload as P, r.allocationCid)) + .sort((a, b) => new Date(a.requestedAt).getTime() - new Date(b.requestedAt).getTime()) + } +} diff --git a/quickstart/backend-js/src/domain/licensing/service.ts b/quickstart/backend-js/src/domain/licensing/service.ts new file mode 100644 index 000000000..5a891e5ac --- /dev/null +++ b/quickstart/backend-js/src/domain/licensing/service.ts @@ -0,0 +1,323 @@ +import { randomUUID } from 'node:crypto' +import type pg from 'pg' +import type * as damlTypes from '@daml/types' +import { AppInstall, AppInstallRequest } from '@daml.js/quickstart-licensing-0.0.1/lib/Licensing/AppInstall/module.js' +import { License, LicenseRenewalRequest } from '@daml.js/quickstart-licensing-0.0.1/lib/Licensing/License/module.js' +import { AllocationRequest } from '@daml.js/splice-api-token-allocation-request-v1-1.0.0/lib/Splice/Api/Token/AllocationRequestV1/module.js' +import type { Allocation } from '@daml.js/splice-api-token-allocation-v1-1.0.0/lib/Splice/Api/Token/AllocationV1/module.js' +import type { AnyContract, AnyValue } from '@daml.js/splice-api-token-metadata-v1-1.0.0/lib/Splice/Api/Token/MetadataV1/module.js' +import type { BackendConfig } from '../../config.js' +import type { LedgerApi } from '../../canton/ledger.js' +import { exerciseChoice, submitContextFromSession } from '../../canton/commands.js' +import type { TokenStandardClient } from '../../token-standard/client.js' +import type { TenantRepository } from '../../tenants/repository.js' +import { + findActiveLicenses, + findLicenseById, + findActiveLicenseRenewalRequestById, + findActiveAllocationRequestById, + findAppInstallById, + findAppInstallRequestById, + findActiveAppInstalls, + findActiveAppInstallRequests +} from './repository.js' +import { mapAppInstallRequest, mapAppInstall, mapLicense } from './mappers.js' + +const cidOf = (s: string): damlTypes.ContractId => s as damlTypes.ContractId + +export class LicensingService { + constructor( + private readonly cfg: BackendConfig, + private readonly pool: pg.Pool, + private readonly ledger: LedgerApi, + private readonly tokenStandard: TokenStandardClient, + private readonly tenants: TenantRepository + ) {} + + async listAppInstallRequests(sessionParty: string) { + const contracts = await findActiveAppInstallRequests(this.pool) + return contracts + .filter(c => { + const p = c.payload as Record + return p['user'] === sessionParty || p['provider'] === sessionParty + }) + .map(c => mapAppInstallRequest(c.contractId, c.payload as Record)) + } + + async acceptAppInstallRequest(contractId: string, commandId: string | undefined, body: { installMeta?: { data?: Record }; meta?: { data?: Record } }) { + const contract = await findAppInstallRequestById(this.pool, contractId) + if (contract === undefined) return { status: 404 as const, message: `AppInstallRequest not found for contract ${contractId}` } + const ctx = submitContextFromSession(this.cfg, this.cfg.appProviderParty, commandId) + await exerciseChoice( + this.ledger, ctx, + AppInstallRequest, AppInstallRequest.AppInstallRequest_Accept, + contractId, + { + installMeta: { values: body.installMeta?.data ?? {} }, + meta: { values: body.meta?.data ?? {} } + } + ) + const payload = contract.payload as Record + return { + status: 201 as const, + body: { + provider: payload['provider'] as string, + user: payload['user'] as string, + meta: { data: body.installMeta?.data ?? {} }, + numLicensesCreated: 0 + } + } + } + + async rejectAppInstallRequest(contractId: string, commandId: string | undefined, body: { meta?: { data?: Record } }) { + const contract = await findAppInstallRequestById(this.pool, contractId) + if (contract === undefined) return { status: 404 as const, message: `AppInstallRequest not found for contract ${contractId}` } + const ctx = submitContextFromSession(this.cfg, this.cfg.appProviderParty, commandId) + await exerciseChoice( + this.ledger, ctx, + AppInstallRequest, AppInstallRequest.AppInstallRequest_Reject, + contractId, + { meta: { values: body.meta?.data ?? {} } } + ) + return { status: 204 as const } + } + + async listAppInstalls(sessionParty: string) { + const contracts = await findActiveAppInstalls(this.pool) + return contracts + .filter(c => { + const p = c.payload as Record + return p['provider'] === sessionParty || p['user'] === sessionParty + }) + .map(c => mapAppInstall(c.contractId, c.payload as Record)) + } + + async createLicense(contractId: string, commandId: string | undefined, body: { params?: { meta?: { data?: Record } } }) { + const contract = await findAppInstallById(this.pool, contractId) + if (contract === undefined) return { status: 404 as const, message: `AppInstall not found for contract ${contractId}` } + const payload = contract.payload as Record + if (payload['provider'] !== this.cfg.appProviderParty) { + return { status: 403 as const, message: 'Insufficient permissions' } + } + const ctx = submitContextFromSession(this.cfg, this.cfg.appProviderParty, commandId) + const result = await exerciseChoice( + this.ledger, ctx, + AppInstall, AppInstall.AppInstall_CreateLicense, + contractId, + { params: { meta: { values: body.params?.meta?.data ?? {} } } } + ) + const licenseId = findCreatedContract(result, ':Licensing.License:License') + if (licenseId === null) return { status: 500 as const, message: 'Failed to locate created License in transaction events' } + return { + status: 201 as const, + body: { installId: contractId, licenseId } + } + } + + async cancelAppInstall(contractId: string, commandId: string | undefined, sessionParty: string, body: { meta?: { data?: Record } }) { + const contract = await findAppInstallById(this.pool, contractId) + if (contract === undefined) return { status: 404 as const, message: `AppInstall not found for contract ${contractId}` } + const payload = contract.payload as Record + if (sessionParty !== payload['user'] && sessionParty !== payload['provider']) { + return { status: 403 as const, message: `party ${sessionParty} is not the user nor provider` } + } + const ctx = submitContextFromSession(this.cfg, this.cfg.appProviderParty, commandId) + await exerciseChoice( + this.ledger, ctx, + AppInstall, AppInstall.AppInstall_Cancel, + contractId, + { + actor: this.cfg.appProviderParty, + meta: { values: body.meta?.data ?? {} } + } + ) + return { status: 204 as const } + } + + async listLicenses(sessionParty: string) { + const rows = await findActiveLicenses(this.pool, sessionParty) + return rows + .map(mapLicense) + .sort((a, b) => { + const u = a.user.localeCompare(b.user) + return u !== 0 ? u : a.licenseNum - b.licenseNum + }) + } + + async renewLicense(contractId: string, commandId: string | undefined, body: { + licenseFeeCc: number + licenseExtensionDuration: string + prepareUntilDuration: string + settleBeforeDuration: string + description: string + }) { + const [adminId, license] = await Promise.all([ + this.tokenStandard.getRegistryAdminId(), + findLicenseById(this.pool, contractId) + ]) + if (license === undefined) return { status: 404 as const, message: `License not found for contract ${contractId}` } + const nowMs = Date.now() + const durationToMicros = (iso: string): string => { + const ms = parseDurationMs(iso) + return String(ms * 1000) + } + const ctx = submitContextFromSession(this.cfg, this.cfg.appProviderParty, commandId) + await exerciseChoice( + this.ledger, ctx, + License, License.License_Renew, + contractId, + { + requestId: randomUUID(), + licenseFeeInstrumentId: { admin: adminId.adminId, id: 'Amulet' }, + licenseFeeAmount: String(body.licenseFeeCc), + licenseExtensionDuration: { microseconds: durationToMicros(body.licenseExtensionDuration) }, + requestedAt: toIsoMicros(nowMs), + prepareUntil: toIsoMicros(nowMs + parseDurationMs(body.prepareUntilDuration)), + settleBefore: toIsoMicros(nowMs + parseDurationMs(body.settleBeforeDuration)), + description: body.description + } + ) + return { status: 201 as const } + } + + async completeLicenseRenewal(contractId: string, commandId: string | undefined, body: { + renewalRequestContractId: string + allocationContractId: string + }) { + const [choiceCtx, renewal] = await Promise.all([ + this.tokenStandard.getAllocationTransferContext(body.allocationContractId), + findActiveLicenseRenewalRequestById(this.pool, body.renewalRequestContractId) + ]) + if (choiceCtx === null || choiceCtx === undefined) { + return { status: 404 as const, message: `Transfer context not found for allocation ${body.allocationContractId}` } + } + if (renewal === undefined) { + return { status: 404 as const, message: `Active renewal request not found for contract ${body.renewalRequestContractId}` } + } + const ctx = (choiceCtx as { disclosedContracts?: Array<{ templateId: string; contractId: string; createdEventBlob: string; synchronizerId: string }> }) + const disclosed = ctx.disclosedContracts ?? [] + + const metaMap: Record = { + AmuletRules: 'amulet-rules', + OpenMiningRound: 'open-round' + } + const extraArgsValues: Record = {} + for (const dc of disclosed) { + const parts = dc.templateId.split(':') + const entityName = parts[parts.length - 1] ?? '' + const key = metaMap[entityName] + if (key !== undefined) { + extraArgsValues[key] = { tag: 'AV_ContractId', value: cidOf(dc.contractId) } + } + } + + const disclosedForLedger = disclosed.map(dc => ({ + contractId: dc.contractId, + createdEventBlob: dc.createdEventBlob, + synchronizerId: dc.synchronizerId, + templateId: dc.templateId + })) + + const submitCtx = submitContextFromSession(this.cfg, this.cfg.appProviderParty, commandId) + const result = await exerciseChoice( + this.ledger, submitCtx, + LicenseRenewalRequest, LicenseRenewalRequest.LicenseRenewalRequest_CompleteRenewal, + body.renewalRequestContractId, + { + allocationCid: cidOf(body.allocationContractId), + licenseCid: cidOf(contractId), + extraArgs: { + context: { values: extraArgsValues }, + meta: { values: {} } + } + }, + disclosedForLedger + ) + const newLicenseId = findCreatedContract(result, ':Licensing.License:License') + return { status: 200 as const, body: { licenseId: newLicenseId ?? undefined } } + } + + async expireLicense(contractId: string, commandId: string | undefined, sessionParty: string, body: { meta?: { data?: Record } }) { + const license = await findLicenseById(this.pool, contractId) + if (license === undefined) return { status: 404 as const, message: `License not found for contract ${contractId}` } + const metaData: Record = { ...(body.meta?.data ?? {}) } + if (sessionParty !== this.cfg.appProviderParty) { + metaData['Note'] = 'Triggered by user request' + } + const ctx = submitContextFromSession(this.cfg, this.cfg.appProviderParty, commandId) + await exerciseChoice( + this.ledger, ctx, + License, License.License_Expire, + contractId, + { + actor: this.cfg.appProviderParty, + meta: { values: metaData } + } + ) + return { status: 200 as const, body: 'License expired successfully' } + } + + async withdrawLicenseRenewalRequest(contractId: string, commandId: string | undefined) { + const allocationReq = await findActiveAllocationRequestById(this.pool, contractId) + if (allocationReq === undefined) return { status: 404 as const, message: `AllocationRequest ${contractId} not found` } + const ctx = submitContextFromSession(this.cfg, this.cfg.appProviderParty, commandId) + await exerciseChoice( + this.ledger, ctx, + AllocationRequest, AllocationRequest.AllocationRequest_Withdraw, + contractId, + { extraArgs: { context: { values: {} }, meta: { values: {} } } } + ) + return { status: 204 as const } + } +} + +// `submit-and-wait-for-transaction` returns events in ACS_DELTA shape (CreatedEvent / +// ArchivedEvent only) and does NOT include the choice's exerciseResult. To find a contract +// the choice just created, walk the transaction's CreatedEvents and match on a templateId +// suffix (e.g. ':Licensing.License:License'). +type CantonTxResponse = { + transaction?: { + events?: Array<{ CreatedEvent?: { templateId?: string; contractId?: string } }> + } +} +const findCreatedContract = (response: unknown, templateIdSuffix: string): string | null => { + const events = (response as CantonTxResponse).transaction?.events ?? [] + for (const event of events) { + const ce = event.CreatedEvent + if (ce === undefined) continue + if (typeof ce.templateId !== 'string' || !ce.templateId.endsWith(templateIdSuffix)) continue + if (typeof ce.contractId !== 'string') continue + return ce.contractId + } + return null +} + +// Daml `Time` is microsecond-precision. Date.toISOString() emits only milliseconds, which +// round-trips through Canton as `xxx000 µs` and fails to match the wallet's allocation +// settlement on `LicenseRenewalRequest_CompleteRenewal` (exact-equality comparison). +// Pad with sub-millisecond noise from process.hrtime to emit 6-decimal precision; the wallet +// copies the timestamp verbatim, so only the format width matters — the lower 3 digits don't +// need to track wall-clock microseconds. +const toIsoMicros = (ms: number): string => { + const subMsNs = Number(process.hrtime.bigint() % 1_000_000n) + const us = Math.floor(subMsNs / 1000) + const iso = new Date(ms).toISOString() + return iso.replace(/\.(\d{3})Z$/, `.$1${String(us).padStart(3, '0')}Z`) +} + +// Mirrors java.time.Duration.parse semantics: only days, hours, minutes, seconds are +// supported. Months and years are rejected because their length is not fixed. +const parseDurationMs = (iso: string): number => { + const m = iso.match(/^P(?:(\d+)D)?(?:T(?:(\d+)H)?(?:(\d+)M)?(?:(\d+(?:\.\d+)?)S)?)?$/) + if (m === null) throw new Error(`Invalid ISO-8601 duration (only days/hours/minutes/seconds supported): ${iso}`) + const days = Number(m[1] ?? 0) + const hours = Number(m[2] ?? 0) + const minutes = Number(m[3] ?? 0) + const seconds = Number(m[4] ?? 0) + return ( + days * 24 * 3600_000 + + hours * 3600_000 + + minutes * 60_000 + + Math.round(seconds * 1000) + ) +} diff --git a/quickstart/backend-js/src/routes/app-install-requests.ts b/quickstart/backend-js/src/routes/app-install-requests.ts new file mode 100644 index 000000000..0b268e122 --- /dev/null +++ b/quickstart/backend-js/src/routes/app-install-requests.ts @@ -0,0 +1,42 @@ +import type { FastifyInstance } from 'fastify' +import type { Services } from '../http/app.js' +import { checkAdmin } from '../auth/admin-gate.js' + +export const registerAppInstallRequests = async (app: FastifyInstance, services: Services): Promise => { + const { cfg, licensing } = services + + app.get('/app-install-requests', async (req, reply) => { + if (req.session.user === undefined) { reply.code(401).send({ message: 'unauthorized' }); return } + return licensing.listAppInstallRequests(req.session.user.partyId) + }) + + // find-my-way (Fastify v5's router) does not support a literal ':' in route paths, + // so the OpenAPI ':accept' / ':reject' suffixes can't be expressed as separate route + // entries. We register one wildcard route per resource and dispatch on the suffix. + app.post<{ Params: { '*': string }; Querystring: { commandId?: string }; Body: unknown }>( + '/app-install-requests/*', + async (req, reply) => { + if (!await checkAdmin(cfg, req, reply)) return + const m = req.params['*'].match(/^(.+):(accept|reject)$/) + const contractId = m?.[1] + const action = m?.[2] + if (contractId === undefined || action === undefined) { + reply.code(404).send({ message: 'unknown_action' }) + return + } + + if (action === 'accept') { + const body = req.body as { installMeta?: { data?: Record }; meta?: { data?: Record } } + const res = await licensing.acceptAppInstallRequest(contractId, req.query.commandId, body) + if (res.status === 404) { reply.code(404).send({ message: res.message }); return } + reply.code(201).send(res.body) + return + } + + const body = req.body as { meta?: { data?: Record } } + const res = await licensing.rejectAppInstallRequest(contractId, req.query.commandId, body) + if (res.status === 404) { reply.code(404).send({ message: res.message }); return } + reply.code(204).send() + } + ) +} diff --git a/quickstart/backend-js/src/routes/app-installs.ts b/quickstart/backend-js/src/routes/app-installs.ts new file mode 100644 index 000000000..06180cbe8 --- /dev/null +++ b/quickstart/backend-js/src/routes/app-installs.ts @@ -0,0 +1,43 @@ +import type { FastifyInstance } from 'fastify' +import type { Services } from '../http/app.js' +import { checkAdmin } from '../auth/admin-gate.js' + +export const registerAppInstalls = async (app: FastifyInstance, services: Services): Promise => { + const { cfg, licensing } = services + + app.get('/app-installs', async (req, reply) => { + if (req.session.user === undefined) { reply.code(401).send({ message: 'unauthorized' }); return } + return licensing.listAppInstalls(req.session.user.partyId) + }) + + // See app-install-requests.ts for the rationale behind the wildcard + suffix dispatch. + app.post<{ Params: { '*': string }; Querystring: { commandId?: string }; Body: unknown }>( + '/app-installs/*', + async (req, reply) => { + if (req.session.user === undefined) { reply.code(401).send({ message: 'unauthorized' }); return } + const m = req.params['*'].match(/^(.+):(create-license|cancel)$/) + const contractId = m?.[1] + const action = m?.[2] + if (contractId === undefined || action === undefined) { + reply.code(404).send({ message: 'unknown_action' }) + return + } + + if (action === 'create-license') { + if (!await checkAdmin(cfg, req, reply)) return + const body = req.body as { params?: { meta?: { data?: Record } } } + const res = await licensing.createLicense(contractId, req.query.commandId, body) + if (res.status === 404) { reply.code(404).send({ message: res.message }); return } + if (res.status === 403) { reply.code(403).send({ message: res.message }); return } + reply.code(201).send(res.body) + return + } + + const body = req.body as { meta?: { data?: Record } } + const res = await licensing.cancelAppInstall(contractId, req.query.commandId, req.session.user.partyId, body) + if (res.status === 404) { reply.code(404).send({ message: res.message }); return } + if (res.status === 403) { reply.code(403).send({ message: res.message }); return } + reply.code(204).send() + } + ) +} diff --git a/quickstart/backend-js/src/routes/feature-flags.ts b/quickstart/backend-js/src/routes/feature-flags.ts new file mode 100644 index 000000000..27aa4c858 --- /dev/null +++ b/quickstart/backend-js/src/routes/feature-flags.ts @@ -0,0 +1,8 @@ +import type { FastifyInstance } from 'fastify' +import type { BackendConfig } from '../config.js' + +export const registerFeatureFlags = async (app: FastifyInstance, cfg: BackendConfig): Promise => { + app.get('/feature-flags', async () => ({ + authMode: cfg.authMode + })) +} diff --git a/quickstart/backend-js/src/routes/license-renewal-requests.ts b/quickstart/backend-js/src/routes/license-renewal-requests.ts new file mode 100644 index 000000000..3cd182d4d --- /dev/null +++ b/quickstart/backend-js/src/routes/license-renewal-requests.ts @@ -0,0 +1,26 @@ +import type { FastifyInstance } from 'fastify' +import type { Services } from '../http/app.js' +import { checkAdmin } from '../auth/admin-gate.js' + +export const registerLicenseRenewalRequests = async (app: FastifyInstance, services: Services): Promise => { + const { cfg, licensing } = services + + // See app-install-requests.ts for the rationale behind the wildcard + suffix dispatch. + // Even with a single action, the literal-colon limitation in find-my-way prevents using + // ':contractId\\:withdraw' directly — the param name gets mangled to 'contractId:withdraw'. + app.post<{ Params: { '*': string }; Querystring: { commandId?: string } }>( + '/license-renewal-requests/*', + async (req, reply) => { + if (!await checkAdmin(cfg, req, reply)) return + const m = req.params['*'].match(/^(.+):(withdraw)$/) + const contractId = m?.[1] + if (contractId === undefined) { + reply.code(404).send({ message: 'unknown_action' }) + return + } + const res = await licensing.withdrawLicenseRenewalRequest(contractId, req.query.commandId) + if (res.status === 404) { reply.code(404).send({ message: res.message }); return } + reply.code(204).send() + } + ) +} diff --git a/quickstart/backend-js/src/routes/licenses.ts b/quickstart/backend-js/src/routes/licenses.ts new file mode 100644 index 000000000..469d0c4b2 --- /dev/null +++ b/quickstart/backend-js/src/routes/licenses.ts @@ -0,0 +1,55 @@ +import type { FastifyInstance } from 'fastify' +import type { Services } from '../http/app.js' +import { checkAdmin } from '../auth/admin-gate.js' + +export const registerLicenses = async (app: FastifyInstance, services: Services): Promise => { + const { cfg, licensing } = services + + app.get('/licenses', async (req, reply) => { + if (req.session.user === undefined) { reply.code(401).send({ message: 'unauthorized' }); return } + return licensing.listLicenses(req.session.user.partyId) + }) + + // See app-install-requests.ts for the rationale behind the wildcard + suffix dispatch. + app.post<{ Params: { '*': string }; Querystring: { commandId?: string }; Body: unknown }>( + '/licenses/*', + async (req, reply) => { + if (req.session.user === undefined) { reply.code(401).send({ message: 'unauthorized' }); return } + const m = req.params['*'].match(/^(.+):(renew|complete-renewal|expire)$/) + const contractId = m?.[1] + const action = m?.[2] + if (contractId === undefined || action === undefined) { + reply.code(404).send({ message: 'unknown_action' }) + return + } + + if (action === 'renew') { + if (!await checkAdmin(cfg, req, reply)) return + const body = req.body as { + licenseFeeCc: number + licenseExtensionDuration: string + prepareUntilDuration: string + settleBeforeDuration: string + description: string + } + const res = await licensing.renewLicense(contractId, req.query.commandId, body) + if (res.status === 404) { reply.code(404).send({ message: res.message }); return } + reply.code(201).send() + return + } + + if (action === 'complete-renewal') { + if (!await checkAdmin(cfg, req, reply)) return + const body = req.body as { renewalRequestContractId: string; allocationContractId: string } + const res = await licensing.completeLicenseRenewal(contractId, req.query.commandId, body) + if (res.status === 404) { reply.code(404).send({ message: res.message }); return } + return res.body + } + + const body = req.body as { meta?: { data?: Record } } + const res = await licensing.expireLicense(contractId, req.query.commandId, req.session.user.partyId, body) + if (res.status === 404) { reply.code(404).send({ message: res.message }); return } + return res.body + } + ) +} From 0375c2822d94647f6515db5b7ed7f4b56cc74f8a Mon Sep 17 00:00:00 2001 From: fernandomg Date: Wed, 29 Apr 2026 12:26:35 +0200 Subject: [PATCH 11/22] docs: document the Node.js backend in the README Adds a Backend implementations section that contrasts the Java and JS backends, documents the BACKEND selector and switching workflow, and notes the Java-only debug port and the per-backend codegen behaviour. Co-Authored-By: Gabito Esmiapodo <4015436+gabitoesmiapodo@users.noreply.github.com> --- README.md | 40 ++++++++++++++++++++++++++++++++++------ 1 file changed, 34 insertions(+), 6 deletions(-) diff --git a/README.md b/README.md index 1653ed4d3..8f82a3ebb 100644 --- a/README.md +++ b/README.md @@ -65,9 +65,33 @@ $ make shell ``` An assistant helps set up deployment when running `make start` for the first time. -You can choose to run the application in standard mode or test mode and with or without OAUTH2. +You can choose to run the application in standard mode or test mode, with or without OAUTH2, and which backend implementation to run (`java` or `js`). You may change this later by running `make setup`. +## Backend implementations + +Quickstart ships two interchangeable backend implementations behind the same HTTP API ([quickstart/common/openapi.yaml](quickstart/common/openapi.yaml)). Both listen on `BACKEND_PORT` (default `8080`), share the same env files under [quickstart/docker/backend-service/](quickstart/docker/backend-service/), the same `onboarding` volume, and the same cookie + CSRF auth surface (oauth2 and shared-secret). + +| Backend | Stack | Ledger transport | Source | +|---------|-------|------------------|--------| +| `java` (default) | JDK 21, Spring Boot 3.4 | gRPC (`canton:3901`) | [quickstart/backend/](quickstart/backend/) | +| `js` | Node 22, TypeScript, Fastify | JSON Ledger API (`canton:3975`) | [quickstart/backend-js/](quickstart/backend-js/) | + +Selection is persisted in `quickstart/.env.local` by `make setup` (which prompts for `BACKEND`). You can also override it per invocation: + +```bash +make build BACKEND=js # build only the JS backend image +make start BACKEND=js # bring up the stack with the JS backend in place of the Java service +``` + +Switching backends requires a clean restart so Postgres state and onboarding volumes are recreated: + +```bash +make clean-all && make start BACKEND=js +``` + +`make build-daml` runs only the codegen the active backend consumes — `:daml:tsCodegen` (TypeScript bindings under [quickstart/backend-js/generated/](quickstart/backend-js/generated/)) for `BACKEND=js`, and `:daml:codeGen` + `distTar` (Java bindings) otherwise. The JS Compose override at [quickstart/docker/backend-js/compose.yaml](quickstart/docker/backend-js/compose.yaml) uses Docker Compose `!reset` / `!override` directives, so **Docker Compose v2.24 or newer is required** when running with `BACKEND=js`. + ## Debugging TL;DR If a container fails to start, there are a few things to try: @@ -75,7 +99,7 @@ If a container fails to start, there are a few things to try: - Ensure Docker Compose is configured to allocate enough memory. The recommended minimum total memory is 8 GB. - Start fresh with `make clean-all` and then manually delete all Docker images and volumes. -**Note**: The CN Quickstart uses Java SDK version `Eclipse Temurin JDK version 21` which runs within the Docker container. This information is specified in `quickstart/compose.yaml` and `.env`. +**Note**: When running the default Java backend (`BACKEND=java`), the CN Quickstart uses Java SDK version `Eclipse Temurin JDK version 21` inside the Docker container. This information is specified in `quickstart/compose.yaml` and `.env`. The Node.js backend (`BACKEND=js`) uses the Node 22 image defined in [quickstart/docker/backend-js/Dockerfile](quickstart/docker/backend-js/Dockerfile). If you need assistance, please follow these directions to gather the log information needed for debugging: 1. `make setup` # optional @@ -216,6 +240,8 @@ working_dir: /app This configuration demonstrates how the `backend-service` relies on the Quickstart-provided infrastructure. Quickstart automates much of the local environment setup for LocalNet, allowing you to prioritize application development. As you progress toward deployment and explore cloud orchestration, a deeper grasp of service configuration is invaluable. For now, consider these services a ready-to-use infrastructure foundation. +> **Note**: the YAML above is the resolved configuration for the default Java backend. When running with `BACKEND=js`, the same `make compose-config` command produces a Node.js variant: the `image` is the `backend-js` Node 22 image, `LEDGER_PORT` is `3975` (the JSON Ledger API port instead of the gRPC port `3901`), and the bind mount sources from [quickstart/backend-js/](quickstart/backend-js/) instead of `backend/build/distributions/backend.tar`. All other fields (env files, onboarding volume, `BACKEND_PORT`, dependencies on `pqs-app-provider` and `splice-onboarding`) are identical. + Then explore `register-app-user-tenant`, the service that registers AppUser tenants to the `backend-service`. This allows end users from the AppUser organization to log in and quickly start the web UI. That, in turn, ties the AppUser Identity Provider to the AppUser primary party ID. If the end user is logged in through this Identity Provider, the user can then act as the AppUser primary party. The `register-app-user-tenant` service utilizes functionality provided by the `splice-onboarding` module to make the task as simple as possible. This step can also be performed manually through the web UI if you log in to Quickstart as `app-provider` and navigate to the tenants tab. At that tab, you can also see a list of registered tenants and verify that the `AppUser` tenant was automatically pre-registered for you by `register-app-user-tenant`. @@ -262,8 +288,8 @@ The `AppUser` organization is registered on the Quickstart startup by calling th | Service | Port | Description | |---------|------|-------------| -| Backend Service | 8080 | Spring Boot backend for Licensing workflow | -| Backend Debug (JVM) | 5005 | Remote JVM debugging (when `DEBUG_ENABLED=true`) | +| Backend Service | 8080 | Spring Boot (Java) **or** Fastify (Node.js, `BACKEND=js`) backend for the Licensing workflow | +| Backend Debug (JVM) | 5005 | Remote JVM debugging — Java backend only, when `DEBUG_ENABLED=true` | ## Canton Participant Ledger API @@ -504,10 +530,10 @@ Run: ```bash make restart-backend ``` -This target restarts the backend, handles dependent services (e.g., register-app-user-tenant), and rebuilds the service if needed. +This target restarts the backend, handles dependent services (e.g., register-app-user-tenant), and rebuilds the service if needed. It works for both backends — it rebuilds and recreates whichever implementation the active `BACKEND` value (set in `.env.local` by `make setup`, or overridden per command) selects. #### Debug backend service -Enable remote JVM debugging by setting: +Remote debugging via `DEBUG_ENABLED=true` is **Java-backend only**. Enable remote JVM debugging by setting: ```bash export DEBUG_ENABLED=true make restart-backend @@ -521,6 +547,8 @@ Configure your IDE (IntelliJ, VS Code) to attach to port 5005 for step-through d Example in IntelliJ Idea ![remote-debug-settings](sdk/docs/images/remote-debug-settings.png) +The Node.js backend (`BACKEND=js`) does not expose a Node inspector by default; `DEBUG_ENABLED=true` is a no-op in JS mode. To attach a Node debugger, run the JS backend locally outside Docker (`cd quickstart/backend-js && npm install && node --inspect=0.0.0.0:9229 ...`) or extend [quickstart/docker/backend-js/start.sh](quickstart/docker/backend-js/start.sh) to pass `--inspect` and publish port 9229 from [quickstart/docker/backend-js/compose.yaml](quickstart/docker/backend-js/compose.yaml). + ### Viewing logs For interactive local log inspection we recommend lnav (https://lnav.org/). Install the Canton log format and use it to view ``*.clog`` files. Example Canton lnav format definition: https://github.com/hyperledger-labs/splice/blob/main/canton/canton-json.lnav.json From 531195cf94096708d19e9545375478b60bd84b34 Mon Sep 17 00:00:00 2001 From: fernandomg Date: Wed, 29 Apr 2026 15:24:11 +0200 Subject: [PATCH 12/22] fix: distinguish 404 from 500 on DELETE /admin/tenant-registrations --- quickstart/backend-js/src/routes/admin.ts | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/quickstart/backend-js/src/routes/admin.ts b/quickstart/backend-js/src/routes/admin.ts index 71eff2985..5eae8f16d 100644 --- a/quickstart/backend-js/src/routes/admin.ts +++ b/quickstart/backend-js/src/routes/admin.ts @@ -94,13 +94,16 @@ export const registerAdmin = async (app: FastifyInstance, cfg: BackendConfig, re app.delete<{ Params: { tenantId: string } }>('/admin/tenant-registrations/:tenantId', async (req, reply) => { if (!await checkAdmin(cfg, req, reply)) return + if (!repo.has(req.params.tenantId)) { + reply.code(404); return { message: 'Not found' } + } try { if (cfg.authMode === 'oauth2') { oauth2Registry.removeByTenantId(req.params.tenantId) } repo.delete(req.params.tenantId) - } catch { - reply.code(404); return { message: 'Not found' } + } catch (err) { + reply.code(500); return { message: (err as Error).message } } reply.code(204).send() }) From e22dad3a661a3fbf04e43d9680cf04f1b5088808 Mon Sep 17 00:00:00 2001 From: fernandomg Date: Mon, 28 Sep 2026 18:26:05 +0200 Subject: [PATCH 13/22] fix: make active profile case insensitve --- quickstart/backend-js/src/config.ts | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/quickstart/backend-js/src/config.ts b/quickstart/backend-js/src/config.ts index 187dd6a1b..a856af16b 100644 --- a/quickstart/backend-js/src/config.ts +++ b/quickstart/backend-js/src/config.ts @@ -35,7 +35,8 @@ const optional = (name: string): string | undefined => { export const loadConfig = (): BackendConfig => { const ledgerHost = required('LEDGER_HOST') const ledgerPort = Number(required('LEDGER_PORT')) - const authMode: 'oauth2' | 'shared-secret' = required('SPRING_PROFILES_ACTIVE').includes('oauth2') + const activeProfile = required('SPRING_PROFILES_ACTIVE').toLowerCase() + const authMode: 'oauth2' | 'shared-secret' = activeProfile.includes('oauth2') ? 'oauth2' : 'shared-secret' From f377de8e0ce39f606f78642c3189dd5ca784ba7d Mon Sep 17 00:00:00 2001 From: fernandomg Date: Mon, 28 Sep 2026 20:58:53 +0200 Subject: [PATCH 14/22] fix(backend-js): return 401 for invalid Bearer tokens on admin routes An invalid token no longer falls back to the session. --- quickstart/backend-js/src/auth/admin-gate.ts | 33 +++++++++++------ quickstart/backend-js/src/auth/csrf.ts | 16 +++++++-- quickstart/backend-js/src/auth/jwt-admin.ts | 37 +++++++++++++++----- 3 files changed, 63 insertions(+), 23 deletions(-) diff --git a/quickstart/backend-js/src/auth/admin-gate.ts b/quickstart/backend-js/src/auth/admin-gate.ts index 357d749d1..51d44c7bd 100644 --- a/quickstart/backend-js/src/auth/admin-gate.ts +++ b/quickstart/backend-js/src/auth/admin-gate.ts @@ -1,21 +1,32 @@ import type { FastifyReply, FastifyRequest } from 'fastify' import type { BackendConfig } from '../config.js' -import { verifyAdminJwt } from './jwt-admin.js' +import { checkAdminBearer } from './jwt-admin.js' -const hasBearerToken = (authHeader: string | undefined): boolean => - typeof authHeader === 'string' && /^Bearer\s+\S+/i.test(authHeader) - -// Accepts either a valid Bearer JWT or an admin session cookie. -// On failure, replies with 401 (no auth) or 403 (authenticated but not admin) and returns false. +// In oauth2 mode a Bearer token decides on its own: valid passes, anything else is 401. +// Otherwise the session decides: admin passes, non-admin is 403, no session is 401. +// On failure, replies and returns false. export const checkAdmin = async (cfg: BackendConfig, req: FastifyRequest, reply: FastifyReply): Promise => { + const bearer = await checkAdminBearer(cfg, req.headers['authorization']) + if (bearer === 'valid') { + return true + } + + if (bearer === 'invalid') { + reply.code(401).send({ message: 'unauthorized' }) + return false + } + const sessionIsAdmin = req.session.user?.isAdmin - if (sessionIsAdmin === true) return true - const authHeader = req.headers['authorization'] - const authenticatedButNotAdmin = sessionIsAdmin === false || hasBearerToken(authHeader) + if (sessionIsAdmin === true) { + return true + } - if (cfg.authMode === 'oauth2' && await verifyAdminJwt(cfg, authHeader)) return true + if (sessionIsAdmin === false) { + reply.code(403).send({ message: 'forbidden' }) + return false + } - reply.code(authenticatedButNotAdmin ? 403 : 401).send({ message: authenticatedButNotAdmin ? 'forbidden' : 'unauthorized' }) + reply.code(401).send({ message: 'unauthorized' }) return false } diff --git a/quickstart/backend-js/src/auth/csrf.ts b/quickstart/backend-js/src/auth/csrf.ts index 4fe02956f..cecefce6d 100644 --- a/quickstart/backend-js/src/auth/csrf.ts +++ b/quickstart/backend-js/src/auth/csrf.ts @@ -1,13 +1,19 @@ import type { FastifyInstance, FastifyRequest, FastifyReply } from 'fastify' import { randomBytes } from 'node:crypto' import { XSRF_COOKIE, XSRF_HEADER } from './cookies.js' +import { hasBearerToken } from './jwt-admin.js' const SAFE_METHODS = new Set(['GET', 'HEAD', 'OPTIONS']) const ensureToken = (req: FastifyRequest, reply: FastifyReply): string => { const existing = req.cookies[XSRF_COOKIE] - if (existing !== undefined && existing !== '') return existing + + if (existing !== undefined && existing !== '') { + return existing + } + const fresh = randomBytes(32).toString('hex') + reply.setCookie(XSRF_COOKIE, fresh, { httpOnly: false, sameSite: 'lax', path: '/', secure: false }) return fresh } @@ -18,13 +24,17 @@ export const registerCsrf = async (app: FastifyInstance): Promise => { ensureToken(req, reply) return } + // Bearer-authenticated calls are stateless service-to-service traffic (e.g. // register-app-user-tenant); CSRF is a session-cookie defense and doesn't apply. // Mirrors Spring Security's default of bypassing CSRF for JWT bearer auth. - const authHeader = req.headers['authorization'] - if (typeof authHeader === 'string' && /^Bearer\s+\S+/i.test(authHeader)) return + if (hasBearerToken(req.headers['authorization'])) { + return + } + const cookieToken = req.cookies[XSRF_COOKIE] const headerToken = req.headers[XSRF_HEADER] + if (cookieToken === undefined || headerToken === undefined || cookieToken !== headerToken) { return reply.code(403).send({ message: 'csrf_mismatch' }) } diff --git a/quickstart/backend-js/src/auth/jwt-admin.ts b/quickstart/backend-js/src/auth/jwt-admin.ts index eed8f4e78..bf29974ea 100644 --- a/quickstart/backend-js/src/auth/jwt-admin.ts +++ b/quickstart/backend-js/src/auth/jwt-admin.ts @@ -1,27 +1,46 @@ import { createRemoteJWKSet, jwtVerify } from 'jose' import type { BackendConfig } from '../config.js' +export type AdminBearerResult = 'absent' | 'valid' | 'invalid' + +// RFC 6750 §2.1: "Bearer" 1*SP b64token +const BEARER_TOKEN = /^Bearer +([A-Za-z0-9\-._~+/]+=*)$/i + const jwksCache = new Map>() const getJwks = (issuer: string): ReturnType => { const existing = jwksCache.get(issuer) - if (existing !== undefined) return existing + if (existing !== undefined) { + return existing + } + const jwksUri = `${issuer.replace(/\/$/, '')}/protocol/openid-connect/certs` const jwks = createRemoteJWKSet(new URL(jwksUri)) + jwksCache.set(issuer, jwks) return jwks } -export const verifyAdminJwt = async (cfg: BackendConfig, authHeader: string | undefined): Promise => { - if (cfg.authMode !== 'oauth2' || cfg.oauth2 === undefined) return false - if (authHeader === undefined || !authHeader.startsWith('Bearer ')) return false - const token = authHeader.slice(7) - const issuer = cfg.oauth2.issuerUrl - if (issuer === '') return false +export const hasBearerToken = (authHeader: string | undefined): authHeader is string => + typeof authHeader === 'string' && /^Bearer\s+\S+/i.test(authHeader) + +// 'absent' when no Bearer token applies: none was sent, or not in oauth2 mode. +export const checkAdminBearer = async (cfg: BackendConfig, authHeader: string | undefined): Promise => { + if (cfg.authMode !== 'oauth2' || !hasBearerToken(authHeader)) { + return 'absent' + } + + const token = authHeader.match(BEARER_TOKEN)?.[1] + const issuer = cfg.oauth2?.issuerUrl + + if (token === undefined || issuer === undefined || issuer === '') { + return 'invalid' + } + try { await jwtVerify(token, getJwks(issuer), { issuer }) - return true + return 'valid' } catch { - return false + return 'invalid' } } From 9205ada79c8e358871b841218c1331ba473d647b Mon Sep 17 00:00:00 2001 From: fernandomg Date: Mon, 28 Sep 2026 20:58:53 +0200 Subject: [PATCH 15/22] chore(deps): upgrade vulnerable backend-js packages and pin versions --- quickstart/backend-js/package-lock.json | 340 ++++++++++++++---------- quickstart/backend-js/package.json | 26 +- 2 files changed, 208 insertions(+), 158 deletions(-) diff --git a/quickstart/backend-js/package-lock.json b/quickstart/backend-js/package-lock.json index 06d97d7d6..8a1194b3d 100644 --- a/quickstart/backend-js/package-lock.json +++ b/quickstart/backend-js/package-lock.json @@ -11,21 +11,21 @@ "dependencies": { "@daml.js/quickstart-licensing-0.0.1": "*", "@daml/types": "3.4.11", - "@fastify/cookie": "^11.0.2", - "@fastify/formbody": "^8.0.2", - "@fastify/session": "^11.1.1", - "fastify": "^5.8.5", - "jose": "^6.2.3", - "openid-client": "^6.8.4", - "pg": "^8.20.0", - "pino": "^10.3.1" + "@fastify/cookie": "11.0.2", + "@fastify/formbody": "8.0.2", + "@fastify/session": "11.1.1", + "fastify": "5.12.5", + "jose": "6.2.3", + "openid-client": "6.8.4", + "pg": "8.20.0", + "pino": "10.3.1" }, "devDependencies": { - "@types/node": "^25.6.0", - "@types/pg": "^8.20.0", - "openapi-typescript": "^7.13.0", - "tsx": "^4.21.0", - "typescript": "^5.9.3" + "@types/node": "25.6.0", + "@types/pg": "8.20.0", + "openapi-typescript": "7.13.0", + "tsx": "4.21.0", + "typescript": "5.9.3" }, "engines": { "node": ">=22" @@ -374,9 +374,9 @@ } }, "node_modules/@esbuild/aix-ppc64": { - "version": "0.27.7", - "resolved": "https://registry.npmjs.org/@esbuild/aix-ppc64/-/aix-ppc64-0.27.7.tgz", - "integrity": "sha512-EKX3Qwmhz1eMdEJokhALr0YiD0lhQNwDqkPYyPhiSwKrh7/4KRjQc04sZ8db+5DVVnZ1LmbNDI1uAMPEUBnQPg==", + "version": "0.27.2", + "resolved": "https://registry.npmjs.org/@esbuild/aix-ppc64/-/aix-ppc64-0.27.2.tgz", + "integrity": "sha512-GZMB+a0mOMZs4MpDbj8RJp4cw+w1WV5NYD6xzgvzUJ5Ek2jerwfO2eADyI6ExDSUED+1X8aMbegahsJi+8mgpw==", "cpu": [ "ppc64" ], @@ -391,9 +391,9 @@ } }, "node_modules/@esbuild/android-arm": { - "version": "0.27.7", - "resolved": "https://registry.npmjs.org/@esbuild/android-arm/-/android-arm-0.27.7.tgz", - "integrity": "sha512-jbPXvB4Yj2yBV7HUfE2KHe4GJX51QplCN1pGbYjvsyCZbQmies29EoJbkEc+vYuU5o45AfQn37vZlyXy4YJ8RQ==", + "version": "0.27.2", + "resolved": "https://registry.npmjs.org/@esbuild/android-arm/-/android-arm-0.27.2.tgz", + "integrity": "sha512-DVNI8jlPa7Ujbr1yjU2PfUSRtAUZPG9I1RwW4F4xFB1Imiu2on0ADiI/c3td+KmDtVKNbi+nffGDQMfcIMkwIA==", "cpu": [ "arm" ], @@ -408,9 +408,9 @@ } }, "node_modules/@esbuild/android-arm64": { - "version": "0.27.7", - "resolved": "https://registry.npmjs.org/@esbuild/android-arm64/-/android-arm64-0.27.7.tgz", - "integrity": "sha512-62dPZHpIXzvChfvfLJow3q5dDtiNMkwiRzPylSCfriLvZeq0a1bWChrGx/BbUbPwOrsWKMn8idSllklzBy+dgQ==", + "version": "0.27.2", + "resolved": "https://registry.npmjs.org/@esbuild/android-arm64/-/android-arm64-0.27.2.tgz", + "integrity": "sha512-pvz8ZZ7ot/RBphf8fv60ljmaoydPU12VuXHImtAs0XhLLw+EXBi2BLe3OYSBslR4rryHvweW5gmkKFwTiFy6KA==", "cpu": [ "arm64" ], @@ -425,9 +425,9 @@ } }, "node_modules/@esbuild/android-x64": { - "version": "0.27.7", - "resolved": "https://registry.npmjs.org/@esbuild/android-x64/-/android-x64-0.27.7.tgz", - "integrity": "sha512-x5VpMODneVDb70PYV2VQOmIUUiBtY3D3mPBG8NxVk5CogneYhkR7MmM3yR/uMdITLrC1ml/NV1rj4bMJuy9MCg==", + "version": "0.27.2", + "resolved": "https://registry.npmjs.org/@esbuild/android-x64/-/android-x64-0.27.2.tgz", + "integrity": "sha512-z8Ank4Byh4TJJOh4wpz8g2vDy75zFL0TlZlkUkEwYXuPSgX8yzep596n6mT7905kA9uHZsf/o2OJZubl2l3M7A==", "cpu": [ "x64" ], @@ -442,9 +442,9 @@ } }, "node_modules/@esbuild/darwin-arm64": { - "version": "0.27.7", - "resolved": "https://registry.npmjs.org/@esbuild/darwin-arm64/-/darwin-arm64-0.27.7.tgz", - "integrity": "sha512-5lckdqeuBPlKUwvoCXIgI2D9/ABmPq3Rdp7IfL70393YgaASt7tbju3Ac+ePVi3KDH6N2RqePfHnXkaDtY9fkw==", + "version": "0.27.2", + "resolved": "https://registry.npmjs.org/@esbuild/darwin-arm64/-/darwin-arm64-0.27.2.tgz", + "integrity": "sha512-davCD2Zc80nzDVRwXTcQP/28fiJbcOwvdolL0sOiOsbwBa72kegmVU0Wrh1MYrbuCL98Omp5dVhQFWRKR2ZAlg==", "cpu": [ "arm64" ], @@ -459,9 +459,9 @@ } }, "node_modules/@esbuild/darwin-x64": { - "version": "0.27.7", - "resolved": "https://registry.npmjs.org/@esbuild/darwin-x64/-/darwin-x64-0.27.7.tgz", - "integrity": "sha512-rYnXrKcXuT7Z+WL5K980jVFdvVKhCHhUwid+dDYQpH+qu+TefcomiMAJpIiC2EM3Rjtq0sO3StMV/+3w3MyyqQ==", + "version": "0.27.2", + "resolved": "https://registry.npmjs.org/@esbuild/darwin-x64/-/darwin-x64-0.27.2.tgz", + "integrity": "sha512-ZxtijOmlQCBWGwbVmwOF/UCzuGIbUkqB1faQRf5akQmxRJ1ujusWsb3CVfk/9iZKr2L5SMU5wPBi1UWbvL+VQA==", "cpu": [ "x64" ], @@ -476,9 +476,9 @@ } }, "node_modules/@esbuild/freebsd-arm64": { - "version": "0.27.7", - "resolved": "https://registry.npmjs.org/@esbuild/freebsd-arm64/-/freebsd-arm64-0.27.7.tgz", - "integrity": "sha512-B48PqeCsEgOtzME2GbNM2roU29AMTuOIN91dsMO30t+Ydis3z/3Ngoj5hhnsOSSwNzS+6JppqWsuhTp6E82l2w==", + "version": "0.27.2", + "resolved": "https://registry.npmjs.org/@esbuild/freebsd-arm64/-/freebsd-arm64-0.27.2.tgz", + "integrity": "sha512-lS/9CN+rgqQ9czogxlMcBMGd+l8Q3Nj1MFQwBZJyoEKI50XGxwuzznYdwcav6lpOGv5BqaZXqvBSiB/kJ5op+g==", "cpu": [ "arm64" ], @@ -493,9 +493,9 @@ } }, "node_modules/@esbuild/freebsd-x64": { - "version": "0.27.7", - "resolved": "https://registry.npmjs.org/@esbuild/freebsd-x64/-/freebsd-x64-0.27.7.tgz", - "integrity": "sha512-jOBDK5XEjA4m5IJK3bpAQF9/Lelu/Z9ZcdhTRLf4cajlB+8VEhFFRjWgfy3M1O4rO2GQ/b2dLwCUGpiF/eATNQ==", + "version": "0.27.2", + "resolved": "https://registry.npmjs.org/@esbuild/freebsd-x64/-/freebsd-x64-0.27.2.tgz", + "integrity": "sha512-tAfqtNYb4YgPnJlEFu4c212HYjQWSO/w/h/lQaBK7RbwGIkBOuNKQI9tqWzx7Wtp7bTPaGC6MJvWI608P3wXYA==", "cpu": [ "x64" ], @@ -510,9 +510,9 @@ } }, "node_modules/@esbuild/linux-arm": { - "version": "0.27.7", - "resolved": "https://registry.npmjs.org/@esbuild/linux-arm/-/linux-arm-0.27.7.tgz", - "integrity": "sha512-RkT/YXYBTSULo3+af8Ib0ykH8u2MBh57o7q/DAs3lTJlyVQkgQvlrPTnjIzzRPQyavxtPtfg0EopvDyIt0j1rA==", + "version": "0.27.2", + "resolved": "https://registry.npmjs.org/@esbuild/linux-arm/-/linux-arm-0.27.2.tgz", + "integrity": "sha512-vWfq4GaIMP9AIe4yj1ZUW18RDhx6EPQKjwe7n8BbIecFtCQG4CfHGaHuh7fdfq+y3LIA2vGS/o9ZBGVxIDi9hw==", "cpu": [ "arm" ], @@ -527,9 +527,9 @@ } }, "node_modules/@esbuild/linux-arm64": { - "version": "0.27.7", - "resolved": "https://registry.npmjs.org/@esbuild/linux-arm64/-/linux-arm64-0.27.7.tgz", - "integrity": "sha512-RZPHBoxXuNnPQO9rvjh5jdkRmVizktkT7TCDkDmQ0W2SwHInKCAV95GRuvdSvA7w4VMwfCjUiPwDi0ZO6Nfe9A==", + "version": "0.27.2", + "resolved": "https://registry.npmjs.org/@esbuild/linux-arm64/-/linux-arm64-0.27.2.tgz", + "integrity": "sha512-hYxN8pr66NsCCiRFkHUAsxylNOcAQaxSSkHMMjcpx0si13t1LHFphxJZUiGwojB1a/Hd5OiPIqDdXONia6bhTw==", "cpu": [ "arm64" ], @@ -544,9 +544,9 @@ } }, "node_modules/@esbuild/linux-ia32": { - "version": "0.27.7", - "resolved": "https://registry.npmjs.org/@esbuild/linux-ia32/-/linux-ia32-0.27.7.tgz", - "integrity": "sha512-GA48aKNkyQDbd3KtkplYWT102C5sn/EZTY4XROkxONgruHPU72l+gW+FfF8tf2cFjeHaRbWpOYa/uRBz/Xq1Pg==", + "version": "0.27.2", + "resolved": "https://registry.npmjs.org/@esbuild/linux-ia32/-/linux-ia32-0.27.2.tgz", + "integrity": "sha512-MJt5BRRSScPDwG2hLelYhAAKh9imjHK5+NE/tvnRLbIqUWa+0E9N4WNMjmp/kXXPHZGqPLxggwVhz7QP8CTR8w==", "cpu": [ "ia32" ], @@ -561,9 +561,9 @@ } }, "node_modules/@esbuild/linux-loong64": { - "version": "0.27.7", - "resolved": "https://registry.npmjs.org/@esbuild/linux-loong64/-/linux-loong64-0.27.7.tgz", - "integrity": "sha512-a4POruNM2oWsD4WKvBSEKGIiWQF8fZOAsycHOt6JBpZ+JN2n2JH9WAv56SOyu9X5IqAjqSIPTaJkqN8F7XOQ5Q==", + "version": "0.27.2", + "resolved": "https://registry.npmjs.org/@esbuild/linux-loong64/-/linux-loong64-0.27.2.tgz", + "integrity": "sha512-lugyF1atnAT463aO6KPshVCJK5NgRnU4yb3FUumyVz+cGvZbontBgzeGFO1nF+dPueHD367a2ZXe1NtUkAjOtg==", "cpu": [ "loong64" ], @@ -578,9 +578,9 @@ } }, "node_modules/@esbuild/linux-mips64el": { - "version": "0.27.7", - "resolved": "https://registry.npmjs.org/@esbuild/linux-mips64el/-/linux-mips64el-0.27.7.tgz", - "integrity": "sha512-KabT5I6StirGfIz0FMgl1I+R1H73Gp0ofL9A3nG3i/cYFJzKHhouBV5VWK1CSgKvVaG4q1RNpCTR2LuTVB3fIw==", + "version": "0.27.2", + "resolved": "https://registry.npmjs.org/@esbuild/linux-mips64el/-/linux-mips64el-0.27.2.tgz", + "integrity": "sha512-nlP2I6ArEBewvJ2gjrrkESEZkB5mIoaTswuqNFRv/WYd+ATtUpe9Y09RnJvgvdag7he0OWgEZWhviS1OTOKixw==", "cpu": [ "mips64el" ], @@ -595,9 +595,9 @@ } }, "node_modules/@esbuild/linux-ppc64": { - "version": "0.27.7", - "resolved": "https://registry.npmjs.org/@esbuild/linux-ppc64/-/linux-ppc64-0.27.7.tgz", - "integrity": "sha512-gRsL4x6wsGHGRqhtI+ifpN/vpOFTQtnbsupUF5R5YTAg+y/lKelYR1hXbnBdzDjGbMYjVJLJTd2OFmMewAgwlQ==", + "version": "0.27.2", + "resolved": "https://registry.npmjs.org/@esbuild/linux-ppc64/-/linux-ppc64-0.27.2.tgz", + "integrity": "sha512-C92gnpey7tUQONqg1n6dKVbx3vphKtTHJaNG2Ok9lGwbZil6DrfyecMsp9CrmXGQJmZ7iiVXvvZH6Ml5hL6XdQ==", "cpu": [ "ppc64" ], @@ -612,9 +612,9 @@ } }, "node_modules/@esbuild/linux-riscv64": { - "version": "0.27.7", - "resolved": "https://registry.npmjs.org/@esbuild/linux-riscv64/-/linux-riscv64-0.27.7.tgz", - "integrity": "sha512-hL25LbxO1QOngGzu2U5xeXtxXcW+/GvMN3ejANqXkxZ/opySAZMrc+9LY/WyjAan41unrR3YrmtTsUpwT66InQ==", + "version": "0.27.2", + "resolved": "https://registry.npmjs.org/@esbuild/linux-riscv64/-/linux-riscv64-0.27.2.tgz", + "integrity": "sha512-B5BOmojNtUyN8AXlK0QJyvjEZkWwy/FKvakkTDCziX95AowLZKR6aCDhG7LeF7uMCXEJqwa8Bejz5LTPYm8AvA==", "cpu": [ "riscv64" ], @@ -629,9 +629,9 @@ } }, "node_modules/@esbuild/linux-s390x": { - "version": "0.27.7", - "resolved": "https://registry.npmjs.org/@esbuild/linux-s390x/-/linux-s390x-0.27.7.tgz", - "integrity": "sha512-2k8go8Ycu1Kb46vEelhu1vqEP+UeRVj2zY1pSuPdgvbd5ykAw82Lrro28vXUrRmzEsUV0NzCf54yARIK8r0fdw==", + "version": "0.27.2", + "resolved": "https://registry.npmjs.org/@esbuild/linux-s390x/-/linux-s390x-0.27.2.tgz", + "integrity": "sha512-p4bm9+wsPwup5Z8f4EpfN63qNagQ47Ua2znaqGH6bqLlmJ4bx97Y9JdqxgGZ6Y8xVTixUnEkoKSHcpRlDnNr5w==", "cpu": [ "s390x" ], @@ -646,9 +646,9 @@ } }, "node_modules/@esbuild/linux-x64": { - "version": "0.27.7", - "resolved": "https://registry.npmjs.org/@esbuild/linux-x64/-/linux-x64-0.27.7.tgz", - "integrity": "sha512-hzznmADPt+OmsYzw1EE33ccA+HPdIqiCRq7cQeL1Jlq2gb1+OyWBkMCrYGBJ+sxVzve2ZJEVeePbLM2iEIZSxA==", + "version": "0.27.2", + "resolved": "https://registry.npmjs.org/@esbuild/linux-x64/-/linux-x64-0.27.2.tgz", + "integrity": "sha512-uwp2Tip5aPmH+NRUwTcfLb+W32WXjpFejTIOWZFw/v7/KnpCDKG66u4DLcurQpiYTiYwQ9B7KOeMJvLCu/OvbA==", "cpu": [ "x64" ], @@ -663,9 +663,9 @@ } }, "node_modules/@esbuild/netbsd-arm64": { - "version": "0.27.7", - "resolved": "https://registry.npmjs.org/@esbuild/netbsd-arm64/-/netbsd-arm64-0.27.7.tgz", - "integrity": "sha512-b6pqtrQdigZBwZxAn1UpazEisvwaIDvdbMbmrly7cDTMFnw/+3lVxxCTGOrkPVnsYIosJJXAsILG9XcQS+Yu6w==", + "version": "0.27.2", + "resolved": "https://registry.npmjs.org/@esbuild/netbsd-arm64/-/netbsd-arm64-0.27.2.tgz", + "integrity": "sha512-Kj6DiBlwXrPsCRDeRvGAUb/LNrBASrfqAIok+xB0LxK8CHqxZ037viF13ugfsIpePH93mX7xfJp97cyDuTZ3cw==", "cpu": [ "arm64" ], @@ -680,9 +680,9 @@ } }, "node_modules/@esbuild/netbsd-x64": { - "version": "0.27.7", - "resolved": "https://registry.npmjs.org/@esbuild/netbsd-x64/-/netbsd-x64-0.27.7.tgz", - "integrity": "sha512-OfatkLojr6U+WN5EDYuoQhtM+1xco+/6FSzJJnuWiUw5eVcicbyK3dq5EeV/QHT1uy6GoDhGbFpprUiHUYggrw==", + "version": "0.27.2", + "resolved": "https://registry.npmjs.org/@esbuild/netbsd-x64/-/netbsd-x64-0.27.2.tgz", + "integrity": "sha512-HwGDZ0VLVBY3Y+Nw0JexZy9o/nUAWq9MlV7cahpaXKW6TOzfVno3y3/M8Ga8u8Yr7GldLOov27xiCnqRZf0tCA==", "cpu": [ "x64" ], @@ -697,9 +697,9 @@ } }, "node_modules/@esbuild/openbsd-arm64": { - "version": "0.27.7", - "resolved": "https://registry.npmjs.org/@esbuild/openbsd-arm64/-/openbsd-arm64-0.27.7.tgz", - "integrity": "sha512-AFuojMQTxAz75Fo8idVcqoQWEHIXFRbOc1TrVcFSgCZtQfSdc1RXgB3tjOn/krRHENUB4j00bfGjyl2mJrU37A==", + "version": "0.27.2", + "resolved": "https://registry.npmjs.org/@esbuild/openbsd-arm64/-/openbsd-arm64-0.27.2.tgz", + "integrity": "sha512-DNIHH2BPQ5551A7oSHD0CKbwIA/Ox7+78/AWkbS5QoRzaqlev2uFayfSxq68EkonB+IKjiuxBFoV8ESJy8bOHA==", "cpu": [ "arm64" ], @@ -714,9 +714,9 @@ } }, "node_modules/@esbuild/openbsd-x64": { - "version": "0.27.7", - "resolved": "https://registry.npmjs.org/@esbuild/openbsd-x64/-/openbsd-x64-0.27.7.tgz", - "integrity": "sha512-+A1NJmfM8WNDv5CLVQYJ5PshuRm/4cI6WMZRg1by1GwPIQPCTs1GLEUHwiiQGT5zDdyLiRM/l1G0Pv54gvtKIg==", + "version": "0.27.2", + "resolved": "https://registry.npmjs.org/@esbuild/openbsd-x64/-/openbsd-x64-0.27.2.tgz", + "integrity": "sha512-/it7w9Nb7+0KFIzjalNJVR5bOzA9Vay+yIPLVHfIQYG/j+j9VTH84aNB8ExGKPU4AzfaEvN9/V4HV+F+vo8OEg==", "cpu": [ "x64" ], @@ -731,9 +731,9 @@ } }, "node_modules/@esbuild/openharmony-arm64": { - "version": "0.27.7", - "resolved": "https://registry.npmjs.org/@esbuild/openharmony-arm64/-/openharmony-arm64-0.27.7.tgz", - "integrity": "sha512-+KrvYb/C8zA9CU/g0sR6w2RBw7IGc5J2BPnc3dYc5VJxHCSF1yNMxTV5LQ7GuKteQXZtspjFbiuW5/dOj7H4Yw==", + "version": "0.27.2", + "resolved": "https://registry.npmjs.org/@esbuild/openharmony-arm64/-/openharmony-arm64-0.27.2.tgz", + "integrity": "sha512-LRBbCmiU51IXfeXk59csuX/aSaToeG7w48nMwA6049Y4J4+VbWALAuXcs+qcD04rHDuSCSRKdmY63sruDS5qag==", "cpu": [ "arm64" ], @@ -748,9 +748,9 @@ } }, "node_modules/@esbuild/sunos-x64": { - "version": "0.27.7", - "resolved": "https://registry.npmjs.org/@esbuild/sunos-x64/-/sunos-x64-0.27.7.tgz", - "integrity": "sha512-ikktIhFBzQNt/QDyOL580ti9+5mL/YZeUPKU2ivGtGjdTYoqz6jObj6nOMfhASpS4GU4Q/Clh1QtxWAvcYKamA==", + "version": "0.27.2", + "resolved": "https://registry.npmjs.org/@esbuild/sunos-x64/-/sunos-x64-0.27.2.tgz", + "integrity": "sha512-kMtx1yqJHTmqaqHPAzKCAkDaKsffmXkPHThSfRwZGyuqyIeBvf08KSsYXl+abf5HDAPMJIPnbBfXvP2ZC2TfHg==", "cpu": [ "x64" ], @@ -765,9 +765,9 @@ } }, "node_modules/@esbuild/win32-arm64": { - "version": "0.27.7", - "resolved": "https://registry.npmjs.org/@esbuild/win32-arm64/-/win32-arm64-0.27.7.tgz", - "integrity": "sha512-7yRhbHvPqSpRUV7Q20VuDwbjW5kIMwTHpptuUzV+AA46kiPze5Z7qgt6CLCK3pWFrHeNfDd1VKgyP4O+ng17CA==", + "version": "0.27.2", + "resolved": "https://registry.npmjs.org/@esbuild/win32-arm64/-/win32-arm64-0.27.2.tgz", + "integrity": "sha512-Yaf78O/B3Kkh+nKABUF++bvJv5Ijoy9AN1ww904rOXZFLWVc5OLOfL56W+C8F9xn5JQZa3UX6m+IktJnIb1Jjg==", "cpu": [ "arm64" ], @@ -782,9 +782,9 @@ } }, "node_modules/@esbuild/win32-ia32": { - "version": "0.27.7", - "resolved": "https://registry.npmjs.org/@esbuild/win32-ia32/-/win32-ia32-0.27.7.tgz", - "integrity": "sha512-SmwKXe6VHIyZYbBLJrhOoCJRB/Z1tckzmgTLfFYOfpMAx63BJEaL9ExI8x7v0oAO3Zh6D/Oi1gVxEYr5oUCFhw==", + "version": "0.27.2", + "resolved": "https://registry.npmjs.org/@esbuild/win32-ia32/-/win32-ia32-0.27.2.tgz", + "integrity": "sha512-Iuws0kxo4yusk7sw70Xa2E2imZU5HoixzxfGCdxwBdhiDgt9vX9VUCBhqcwY7/uh//78A1hMkkROMJq9l27oLQ==", "cpu": [ "ia32" ], @@ -799,9 +799,9 @@ } }, "node_modules/@esbuild/win32-x64": { - "version": "0.27.7", - "resolved": "https://registry.npmjs.org/@esbuild/win32-x64/-/win32-x64-0.27.7.tgz", - "integrity": "sha512-56hiAJPhwQ1R4i+21FVF7V8kSD5zZTdHcVuRFMW0hn753vVfQN8xlx4uOPT4xoGH0Z/oVATuR82AiqSTDIpaHg==", + "version": "0.27.2", + "resolved": "https://registry.npmjs.org/@esbuild/win32-x64/-/win32-x64-0.27.2.tgz", + "integrity": "sha512-sRdU18mcKf7F+YgheI/zGf5alZatMUTKj/jNS6l744f9u3WFu4v7twcUI9vu4mknF4Y9aDlblIie0IM+5xxaqQ==", "cpu": [ "x64" ], @@ -1029,9 +1029,9 @@ "license": "MIT" }, "node_modules/@redocly/openapi-core": { - "version": "1.34.13", - "resolved": "https://registry.npmjs.org/@redocly/openapi-core/-/openapi-core-1.34.13.tgz", - "integrity": "sha512-4Tm4ysZkexx6ZTX7knqSZTqPlNgIvXc7Ha0pd30I694/GD0KtJE2xrElycfPds0vCLFAqoKyIzBtOF1xrLo8KA==", + "version": "1.34.20", + "resolved": "https://registry.npmjs.org/@redocly/openapi-core/-/openapi-core-1.34.20.tgz", + "integrity": "sha512-ypeBZ/6BKXR9+7/TtbKhbl4UgD7raHhPS12oknlKno2A8+lnFkxIwiE/Aklu6L2cd/ioH+fCWuMxi9/p3EyAPw==", "dev": true, "license": "MIT", "dependencies": { @@ -1040,7 +1040,7 @@ "colorette": "1.4.0", "https-proxy-agent": "7.0.6", "js-levenshtein": "1.1.6", - "js-yaml": "4.1.1", + "js-yaml": "4.3.2", "minimatch": "5.1.9", "pluralize": "8.0.0", "yaml-ast-parser": "0.0.43" @@ -1181,9 +1181,9 @@ "license": "MIT" }, "node_modules/brace-expansion": { - "version": "2.1.0", - "resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-2.1.0.tgz", - "integrity": "sha512-TN1kCZAgdgweJhWWpgKYrQaMNHcDULHkWwQIspdtjV4Y5aurRdZpjAqn6yX3FPqTA9ngHCc4hJxMAMgGfve85w==", + "version": "2.1.7", + "resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-2.1.7.tgz", + "integrity": "sha512-uZbew1NqdmPDTMJ8ah1y+b+9QEJrfkXFk3RcTQw3X0jW/xRUvFKsg1CfQdSYGdTbXZWExtU3J3ccxtnfw1Fi0g==", "dev": true, "license": "MIT", "dependencies": { @@ -1245,9 +1245,9 @@ } }, "node_modules/esbuild": { - "version": "0.27.7", - "resolved": "https://registry.npmjs.org/esbuild/-/esbuild-0.27.7.tgz", - "integrity": "sha512-IxpibTjyVnmrIQo5aqNpCgoACA/dTKLTlhMHihVHhdkxKyPO1uBBthumT0rdHmcsk9uMonIWS0m4FljWzILh3w==", + "version": "0.27.2", + "resolved": "https://registry.npmjs.org/esbuild/-/esbuild-0.27.2.tgz", + "integrity": "sha512-HyNQImnsOC7X9PMNaCIeAm4ISCQXs5a5YasTXVliKv4uuBo1dKrG0A+uQS8M5eXjVMnLg3WgXaKvprHlFJQffw==", "dev": true, "hasInstallScript": true, "license": "MIT", @@ -1258,32 +1258,32 @@ "node": ">=18" }, "optionalDependencies": { - "@esbuild/aix-ppc64": "0.27.7", - "@esbuild/android-arm": "0.27.7", - "@esbuild/android-arm64": "0.27.7", - "@esbuild/android-x64": "0.27.7", - "@esbuild/darwin-arm64": "0.27.7", - "@esbuild/darwin-x64": "0.27.7", - "@esbuild/freebsd-arm64": "0.27.7", - "@esbuild/freebsd-x64": "0.27.7", - "@esbuild/linux-arm": "0.27.7", - "@esbuild/linux-arm64": "0.27.7", - "@esbuild/linux-ia32": "0.27.7", - "@esbuild/linux-loong64": "0.27.7", - "@esbuild/linux-mips64el": "0.27.7", - "@esbuild/linux-ppc64": "0.27.7", - "@esbuild/linux-riscv64": "0.27.7", - "@esbuild/linux-s390x": "0.27.7", - "@esbuild/linux-x64": "0.27.7", - "@esbuild/netbsd-arm64": "0.27.7", - "@esbuild/netbsd-x64": "0.27.7", - "@esbuild/openbsd-arm64": "0.27.7", - "@esbuild/openbsd-x64": "0.27.7", - "@esbuild/openharmony-arm64": "0.27.7", - "@esbuild/sunos-x64": "0.27.7", - "@esbuild/win32-arm64": "0.27.7", - "@esbuild/win32-ia32": "0.27.7", - "@esbuild/win32-x64": "0.27.7" + "@esbuild/aix-ppc64": "0.27.2", + "@esbuild/android-arm": "0.27.2", + "@esbuild/android-arm64": "0.27.2", + "@esbuild/android-x64": "0.27.2", + "@esbuild/darwin-arm64": "0.27.2", + "@esbuild/darwin-x64": "0.27.2", + "@esbuild/freebsd-arm64": "0.27.2", + "@esbuild/freebsd-x64": "0.27.2", + "@esbuild/linux-arm": "0.27.2", + "@esbuild/linux-arm64": "0.27.2", + "@esbuild/linux-ia32": "0.27.2", + "@esbuild/linux-loong64": "0.27.2", + "@esbuild/linux-mips64el": "0.27.2", + "@esbuild/linux-ppc64": "0.27.2", + "@esbuild/linux-riscv64": "0.27.2", + "@esbuild/linux-s390x": "0.27.2", + "@esbuild/linux-x64": "0.27.2", + "@esbuild/netbsd-arm64": "0.27.2", + "@esbuild/netbsd-x64": "0.27.2", + "@esbuild/openbsd-arm64": "0.27.2", + "@esbuild/openbsd-x64": "0.27.2", + "@esbuild/openharmony-arm64": "0.27.2", + "@esbuild/sunos-x64": "0.27.2", + "@esbuild/win32-arm64": "0.27.2", + "@esbuild/win32-ia32": "0.27.2", + "@esbuild/win32-x64": "0.27.2" } }, "node_modules/fast-decode-uri-component": { @@ -1332,9 +1332,9 @@ } }, "node_modules/fast-uri": { - "version": "3.1.0", - "resolved": "https://registry.npmjs.org/fast-uri/-/fast-uri-3.1.0.tgz", - "integrity": "sha512-iPeeDKJSWf4IEOasVVrknXpaBV0IApz/gp7S2bb7Z4Lljbl2MGJRqInZiUrQwV16cpzw/D3S5j5Julj/gT52AA==", + "version": "3.1.8", + "resolved": "https://registry.npmjs.org/fast-uri/-/fast-uri-3.1.8.tgz", + "integrity": "sha512-GZMtZUTNRpOVIECoXwLNZS5xUGE+mVNbTB8h/7Rwh2TFWcBQiPzTgyZi05BF9UMZKkLJv8XBRJTlU7zg8+ZfMg==", "funding": [ { "type": "github", @@ -1348,9 +1348,9 @@ "license": "BSD-3-Clause" }, "node_modules/fastify": { - "version": "5.8.5", - "resolved": "https://registry.npmjs.org/fastify/-/fastify-5.8.5.tgz", - "integrity": "sha512-Yqptv59pQzPgQUSIm87hMqHJmdkb1+GPxdE6vW6FRyVE9G86mt7rOghitiU4JHRaTyDUk9pfeKmDeu70lAwM4Q==", + "version": "5.12.5", + "resolved": "https://registry.npmjs.org/fastify/-/fastify-5.12.5.tgz", + "integrity": "sha512-OB2k1dlxs5/NAABqeKV2FUHkSD2BbENsCak8yULVcymn3fHIPDVa9TI3SDnJSWYSllZmSYuZXy2gTnsT+Sut1A==", "funding": [ { "type": "github", @@ -1369,11 +1369,11 @@ "@fastify/proxy-addr": "^5.0.0", "abstract-logging": "^2.0.1", "avvio": "^9.0.0", - "fast-json-stringify": "^6.0.0", - "find-my-way": "^9.0.0", + "fast-json-stringify": "^7.0.0", + "find-my-way": "^9.6.0", "light-my-request": "^6.0.0", "pino": "^9.14.0 || ^10.1.0", - "process-warning": "^5.0.0", + "process-warning": "^5.1.0", "rfdc": "^1.3.1", "secure-json-parse": "^4.0.0", "semver": "^7.6.0", @@ -1396,6 +1396,46 @@ ], "license": "MIT" }, + "node_modules/fastify/node_modules/fast-json-stringify": { + "version": "7.0.1", + "resolved": "https://registry.npmjs.org/fast-json-stringify/-/fast-json-stringify-7.0.1.tgz", + "integrity": "sha512-eRSayARSbbwlBjpP4vnTTIRD5QPcIrmihPxDeN1DtKnHPg66UuJLx+8hlK1kaFdjvzyQ/dzALoi4vwAQ+T+iZA==", + "funding": [ + { + "type": "github", + "url": "https://github.com/sponsors/fastify" + }, + { + "type": "opencollective", + "url": "https://opencollective.com/fastify" + } + ], + "license": "MIT", + "dependencies": { + "@fastify/merge-json-schemas": "^0.2.0", + "ajv": "^8.12.0", + "ajv-formats": "^3.0.1", + "fast-uri": "^4.0.0", + "json-schema-ref-resolver": "^3.0.0", + "rfdc": "^1.2.0" + } + }, + "node_modules/fastify/node_modules/fast-uri": { + "version": "4.2.1", + "resolved": "https://registry.npmjs.org/fast-uri/-/fast-uri-4.2.1.tgz", + "integrity": "sha512-TmHQgewjHtMq1E5QKA0tOE0yeYGQs25KZC/ziJpubRtWI15W92e6vPFydWOeZBVROSHBYw/QhD9d5OefdD6LDg==", + "funding": [ + { + "type": "github", + "url": "https://github.com/sponsors/fastify" + }, + { + "type": "opencollective", + "url": "https://opencollective.com/fastify" + } + ], + "license": "BSD-3-Clause" + }, "node_modules/fastq": { "version": "1.20.1", "resolved": "https://registry.npmjs.org/fastq/-/fastq-1.20.1.tgz", @@ -1406,9 +1446,9 @@ } }, "node_modules/find-my-way": { - "version": "9.5.0", - "resolved": "https://registry.npmjs.org/find-my-way/-/find-my-way-9.5.0.tgz", - "integrity": "sha512-VW2RfnmscZO5KgBY5XVyKREMW5nMZcxDy+buTOsL+zIPnBlbKm+00sgzoQzq1EVh4aALZLfKdwv6atBGcjvjrQ==", + "version": "9.9.0", + "resolved": "https://registry.npmjs.org/find-my-way/-/find-my-way-9.9.0.tgz", + "integrity": "sha512-sJsgZ1sQH2UDuowPuMKg8az7Qc8F0jnj+SKkFWU/+T0xcFlgV5skgXOGUqmQzOdmW6ALA7AhJINWx3qFBkbLHA==", "license": "MIT", "dependencies": { "fast-deep-equal": "^3.1.3", @@ -1510,10 +1550,20 @@ "license": "MIT" }, "node_modules/js-yaml": { - "version": "4.1.1", - "resolved": "https://registry.npmjs.org/js-yaml/-/js-yaml-4.1.1.tgz", - "integrity": "sha512-qQKT4zQxXl8lLwBtHMWwaTcGfFOZviOJet3Oy/xmGk2gZH677CJM9EvtfdSkgWcATZhj/55JZ0rmy3myCT5lsA==", + "version": "4.3.2", + "resolved": "https://registry.npmjs.org/js-yaml/-/js-yaml-4.3.2.tgz", + "integrity": "sha512-SFNOvSJ+Dgf/9An904Yx+CgSlIPCkIpao4qo51lpee25TIRejdH3rhR4EZMGoNx3/TP3O+wzWuiTFl4sqbltzA==", "dev": true, + "funding": [ + { + "type": "github", + "url": "https://github.com/sponsors/puzrin" + }, + { + "type": "github", + "url": "https://github.com/sponsors/nodeca" + } + ], "license": "MIT", "dependencies": { "argparse": "^2.0.1" @@ -1870,9 +1920,9 @@ } }, "node_modules/process-warning": { - "version": "5.0.0", - "resolved": "https://registry.npmjs.org/process-warning/-/process-warning-5.0.0.tgz", - "integrity": "sha512-a39t9ApHNx2L4+HBnQKqxxHNs1r7KF+Intd8Q/g1bUh6q0WIp9voPXJ/x0j+ZL45KF1pJd9+q2jLIRMfvEshkA==", + "version": "5.1.0", + "resolved": "https://registry.npmjs.org/process-warning/-/process-warning-5.1.0.tgz", + "integrity": "sha512-jQSaVHsPgtyw60e1rQ/A+/ArPEj/S8pS/vFnyGa/gYFXrKk/6RuDkoqVDQ5NI5MmS01698ltlAk0NoDBNLujRw==", "funding": [ { "type": "github", diff --git a/quickstart/backend-js/package.json b/quickstart/backend-js/package.json index d9ebdee21..28becab14 100644 --- a/quickstart/backend-js/package.json +++ b/quickstart/backend-js/package.json @@ -17,20 +17,20 @@ "dependencies": { "@daml.js/quickstart-licensing-0.0.1": "*", "@daml/types": "3.4.11", - "@fastify/cookie": "^11.0.2", - "@fastify/formbody": "^8.0.2", - "@fastify/session": "^11.1.1", - "fastify": "^5.8.5", - "jose": "^6.2.3", - "openid-client": "^6.8.4", - "pg": "^8.20.0", - "pino": "^10.3.1" + "@fastify/cookie": "11.0.2", + "@fastify/formbody": "8.0.2", + "@fastify/session": "11.1.1", + "fastify": "5.12.5", + "jose": "6.2.3", + "openid-client": "6.8.4", + "pg": "8.20.0", + "pino": "10.3.1" }, "devDependencies": { - "@types/node": "^25.6.0", - "@types/pg": "^8.20.0", - "openapi-typescript": "^7.13.0", - "tsx": "^4.21.0", - "typescript": "^5.9.3" + "@types/node": "25.6.0", + "@types/pg": "8.20.0", + "openapi-typescript": "7.13.0", + "tsx": "4.21.0", + "typescript": "5.9.3" } } From 080313b9dbd1898f941ac0786a71535cafe3dd95 Mon Sep 17 00:00:00 2001 From: fernandomg Date: Fri, 2 Oct 2026 01:10:49 +0200 Subject: [PATCH 16/22] fix(backend-js): pass the registry choice context when completing a renewal --- .../backend-js/src/domain/licensing/service.ts | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) diff --git a/quickstart/backend-js/src/domain/licensing/service.ts b/quickstart/backend-js/src/domain/licensing/service.ts index 5a891e5ac..094284c68 100644 --- a/quickstart/backend-js/src/domain/licensing/service.ts +++ b/quickstart/backend-js/src/domain/licensing/service.ts @@ -5,9 +5,9 @@ import { AppInstall, AppInstallRequest } from '@daml.js/quickstart-licensing-0.0 import { License, LicenseRenewalRequest } from '@daml.js/quickstart-licensing-0.0.1/lib/Licensing/License/module.js' import { AllocationRequest } from '@daml.js/splice-api-token-allocation-request-v1-1.0.0/lib/Splice/Api/Token/AllocationRequestV1/module.js' import type { Allocation } from '@daml.js/splice-api-token-allocation-v1-1.0.0/lib/Splice/Api/Token/AllocationV1/module.js' -import type { AnyContract, AnyValue } from '@daml.js/splice-api-token-metadata-v1-1.0.0/lib/Splice/Api/Token/MetadataV1/module.js' +import type { AnyContract, ChoiceContext } from '@daml.js/splice-api-token-metadata-v1-1.0.0/lib/Splice/Api/Token/MetadataV1/module.js' import type { BackendConfig } from '../../config.js' -import type { LedgerApi } from '../../canton/ledger.js' +import type { DisclosedContract, LedgerApi } from '../../canton/ledger.js' import { exerciseChoice, submitContextFromSession } from '../../canton/commands.js' import type { TokenStandardClient } from '../../token-standard/client.js' import type { TenantRepository } from '../../tenants/repository.js' @@ -25,6 +25,12 @@ import { mapAppInstallRequest, mapAppInstall, mapLicense } from './mappers.js' const cidOf = (s: string): damlTypes.ContractId => s as damlTypes.ContractId +// Response of the token registry's choice-context endpoints. +type RegistryChoiceContext = { + choiceContextData?: ChoiceContext + disclosedContracts?: DisclosedContract[] +} + export class LicensingService { constructor( private readonly cfg: BackendConfig, @@ -194,14 +200,16 @@ export class LicensingService { if (renewal === undefined) { return { status: 404 as const, message: `Active renewal request not found for contract ${body.renewalRequestContractId}` } } - const ctx = (choiceCtx as { disclosedContracts?: Array<{ templateId: string; contractId: string; createdEventBlob: string; synchronizerId: string }> }) + const ctx = choiceCtx as RegistryChoiceContext const disclosed = ctx.disclosedContracts ?? [] const metaMap: Record = { AmuletRules: 'amulet-rules', OpenMiningRound: 'open-round' } - const extraArgsValues: Record = {} + // Start from the registry's context: the transfer can require entries beyond the ones mapped below + // (e.g. `external-party-config-state`). + const extraArgsValues: ChoiceContext['values'] = { ...(ctx.choiceContextData?.values ?? {}) } for (const dc of disclosed) { const parts = dc.templateId.split(':') const entityName = parts[parts.length - 1] ?? '' From aa38f37668a8d588fd60699bdf83e1cb21b46420 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Thu, 5 Nov 2026 16:03:56 -0500 Subject: [PATCH 17/22] build(deps): bump setuptools from 83.0.0 to 84.1.0 in /sdk (#395) Bumps [setuptools](https://github.com/pypa/setuptools) from 83.0.0 to 84.1.0. - [Release notes](https://github.com/pypa/setuptools/releases) - [Changelog](https://github.com/pypa/setuptools/blob/main/NEWS.rst) - [Commits](https://github.com/pypa/setuptools/compare/v83.0.0...v84.1.0) --- updated-dependencies: - dependency-name: setuptools dependency-version: 84.1.0 dependency-type: indirect ... Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> --- sdk/poetry.lock | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/sdk/poetry.lock b/sdk/poetry.lock index 41f47a389..92fc81b1a 100644 --- a/sdk/poetry.lock +++ b/sdk/poetry.lock @@ -609,14 +609,14 @@ use-chardet-on-py3 = ["chardet (>=3.0.2,<8)"] [[package]] name = "setuptools" -version = "83.0.0" +version = "84.1.0" description = "Most extensible Python build backend with support for C/C++ extension modules" optional = false python-versions = ">=3.10" groups = ["main"] files = [ - {file = "setuptools-83.0.0-py3-none-any.whl", hash = "sha256:29b23c360f22f414dc7336bb39178cc7bcbf6021ed2733cde173f09dba19abb3"}, - {file = "setuptools-83.0.0.tar.gz", hash = "sha256:025bccbbf0fa05b6192bc64ae1e7b16e001fd6d6d4d5de03c97b1c1ade523bef"}, + {file = "setuptools-84.1.0-py3-none-any.whl", hash = "sha256:5231689c6ac8156cd155cfb98c3fd6fb252c3e7e9bd3d78b64d3c55f132624c9"}, + {file = "setuptools-84.1.0.tar.gz", hash = "sha256:23657205b63d4d31395ab917815247f694aafad28cd21316bf5fd45a51048ea0"}, ] [package.extras] From bb278c6ba90cbe29dea3887d7d2a4e1647cd605e Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Thu, 5 Nov 2026 16:18:50 -0500 Subject: [PATCH 18/22] build(deps-dev): bump vite from 6.4.2 to 6.4.5 in /quickstart/frontend (#396) Bumps [vite](https://github.com/vitejs/vite/tree/HEAD/packages/vite) from 6.4.2 to 6.4.5. - [Release notes](https://github.com/vitejs/vite/releases) - [Changelog](https://github.com/vitejs/vite/blob/v6.4.5/packages/vite/CHANGELOG.md) - [Commits](https://github.com/vitejs/vite/commits/v6.4.5/packages/vite) --- updated-dependencies: - dependency-name: vite dependency-version: 6.4.5 dependency-type: direct:development ... Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> --- quickstart/frontend/package-lock.json | 8 ++++---- quickstart/frontend/package.json | 2 +- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/quickstart/frontend/package-lock.json b/quickstart/frontend/package-lock.json index 714bbf481..e1485b890 100644 --- a/quickstart/frontend/package-lock.json +++ b/quickstart/frontend/package-lock.json @@ -27,7 +27,7 @@ "globals": "^15.15.0", "typescript": "^5.9.3", "typescript-eslint": "^8.58.2", - "vite": "^6.4.2" + "vite": "^6.4.5" } }, "node_modules/@babel/code-frame": { @@ -3571,9 +3571,9 @@ } }, "node_modules/vite": { - "version": "6.4.2", - "resolved": "https://registry.npmjs.org/vite/-/vite-6.4.2.tgz", - "integrity": "sha512-2N/55r4JDJ4gdrCvGgINMy+HH3iRpNIz8K6SFwVsA+JbQScLiC+clmAxBgwiSPgcG9U15QmvqCGWzMbqda5zGQ==", + "version": "6.4.5", + "resolved": "https://registry.npmjs.org/vite/-/vite-6.4.5.tgz", + "integrity": "sha512-4enwjFfi4IwtEh0w+jPzpLVOFQiPHmmzPxcHXQOyEur47o6u0jE573DmGpjA+7irXoMLYRZD5ZaFUEneS3abPg==", "license": "MIT", "dependencies": { "esbuild": "^0.25.0", diff --git a/quickstart/frontend/package.json b/quickstart/frontend/package.json index 3fa7b03f0..a77bf20e7 100644 --- a/quickstart/frontend/package.json +++ b/quickstart/frontend/package.json @@ -30,6 +30,6 @@ "globals": "^15.15.0", "typescript": "^5.9.3", "typescript-eslint": "^8.58.2", - "vite": "^6.4.2" + "vite": "^6.4.5" } } From 8b898ed3ccb15e243b22ee8d0ed3573fb91ee6b9 Mon Sep 17 00:00:00 2001 From: Elias Haase Date: Fri, 13 Nov 2026 16:33:16 +0100 Subject: [PATCH 19/22] Add LocalNet-only make targets, AGENTS.md and README updates (#398) Developers and AI agents who only need a running network for their own Daml code had to work out a docker compose command from the Makefile, or ran make build for a demo they didn't need. - Makefile: add start-localnet, stop-localnet, clean-localnet and status-localnet. They start only the Splice LocalNet module (sv, app-provider, app-user profiles) and need only Docker: no make setup, no .env.local, no build. They use LocalNet's own resource-constraints file, since RESOURCE_CONSTRAINT_CONFIG also lists application modules. - AGENTS.md: where the docs are (llms.txt, MCP server, version dashboard), which path to take for which task, LocalNet ports, auth and readiness checks, and common Daml/Ledger API pitfalls. - README: the stack is open source and needs no Daml Enterprise license; add a LocalNet-only section and a note on the version pins in quickstart/.env; link the LocalNet docs page instead of docs.sync.global. Signed-off-by: 8bitpal --- AGENTS.md | 57 +++++++++++++++++++++++++++++++++++++++++++++ README.md | 41 +++++++++++++++++++++++++++++--- quickstart/Makefile | 29 +++++++++++++++++++++++ 3 files changed, 124 insertions(+), 3 deletions(-) create mode 100644 AGENTS.md diff --git a/AGENTS.md b/AGENTS.md new file mode 100644 index 000000000..2e5a813b5 --- /dev/null +++ b/AGENTS.md @@ -0,0 +1,57 @@ +# AGENTS.md + +Guidance for AI coding agents working with this repository. + +## Documentation + +Use the Canton Network documentation at https://docs.canton.network: + +- [llms.txt](https://docs.canton.network/llms.txt): index of the docs. Append `.md` to any page URL to get its Markdown. +- [MCP server](https://docs.canton.network/shared/mcp-server): search and read the docs from an MCP-capable client. +- [Version Compatibility Dashboard](https://docs.canton.network/shared/version-compatibility-dashboard): component versions running on DevNet, TestNet and MainNet. + +Don't use Daml 2.x documentation (docs.daml.com) or the old `/build`, `/operate` and `/overview` pages on docs.digitalasset.com. Canton 3.x commands, APIs and configuration differ. + +## Choose the path for your task + +All `make` commands run from the `quickstart/` directory. + +**To deploy and test your own Daml code**, you only need the network. Start LocalNet without building the Quickstart application: + +```bash +cd quickstart +make start-localnet # needs only Docker +make status-localnet +make clean-localnet # stop and remove data when done +``` + +Don't run `make setup`, `make build` or `make start` for this. `make start` always runs `make build`, which builds the Java backend, the React frontend and the Daml model. + +**To study or extend the Quickstart application** (the licensing demo with a Java backend and React frontend), follow the [Quickstart installation guide](https://docs.canton.network/appdev/quickstart/prerequisites): `make setup`, `make build`, `make start`. + +## LocalNet facts + +- Three validators: App User (port prefix `2`), App Provider (`3`) and Super Validator (`4`). The Super Validator also runs the synchronizer. +- JSON Ledger API: `http://localhost:2975`, `:3975`, `:4975`. gRPC Ledger API: `:2901`, `:3901`, `:4901`. +- Readiness: `curl -f http://localhost:3975/readyz` (JSON Ledger API) and `curl -f http://localhost:3903/api/validator/readyz` (validator). +- Authentication without OAuth2 (`make start-localnet`, or `make setup` with OAuth2 off): JWT signed with HS256, secret `unsafe`, audience `https://canton.network.global`, subject `ledger-api-user`. The env files write the audience as `${AUTH_..._AUDIENCE:-https://canton.network.global}`; use the resolved URL. +- `ledger-api-user` is an admin, but admin rights don't allow submitting or reading as a party. Allocate parties with `"userId": "ledger-api-user"` in `POST /v2/parties` to grant `CanActAs`, or the requests fail with HTTP 403. +- If a port is already in use, `docker compose up` fails with `address already in use`. Set `DB_PORT` when PostgreSQL already runs on 5432. + +Details: [LocalNet](https://docs.canton.network/sdks-tools/development-tools/localnet). + +## Common Daml and Ledger API pitfalls + +- Define Daml interfaces in their own package, separate from the templates that implement them, and build both with a `multi-package.yaml` and `dpm build --all`. A package that defines and implements an interface fails to compile. See [Interfaces](https://docs.canton.network/appdev/modules/m3-interfaces). +- Upload DARs with `POST /v2/dars?vetAllPackages=true` and `Content-Type: application/octet-stream`. +- In query filters (`TemplateFilter`, `InterfaceFilter`), write identifiers in package-name form, `#::`. Responses return the package-ID form, which filters reject. See [Identifier Formats](https://docs.canton.network/sdks-tools/api-reference/json-api#identifier-formats). + +## Versions + +`quickstart/.env` pins `SPLICE_VERSION` (LocalNet images) and `DAML_RUNTIME_VERSION` (Daml libraries for the Java backend). The Daml projects set the same SDK version in their `daml.yaml` files. These pins can lag the shared networks; check the Version Compatibility Dashboard before deploying to DevNet, TestNet or MainNet. + +## Changing this repository + +- Build: `make build`. Daml tests: `make test`. Integration tests: `make integration-test`. +- Run `make help` for all targets. +- New source files carry the header used in existing files, for example in `quickstart/Makefile`. diff --git a/README.md b/README.md index 1653ed4d3..17a8273be 100644 --- a/README.md +++ b/README.md @@ -5,8 +5,7 @@ This update may require a `make clean-all` to remove old data and then a `make b This project provides scaffolding to develop a Canton Network (CN) application for the Global Synchronizer. We intend that you clone the repository and incrementally update the solution to match your business operations. -We assume that you have a Daml Enterprise license to leverage all of this project's features at runtime. -However, an OSS developer can benefit from this project by understanding how a CN Global Synchronizer application is structured. +You don't need a license to run it: Canton, Daml and Splice are open source, and all of this project's features work without a Daml Enterprise license. [Binaries terms and conditions](https://github.com/digital-asset/cn-quickstart/blob/main/terms.md). @@ -27,6 +26,10 @@ You can find Quickstart documentation in the Canton Network documentation portal - [FAQ](https://docs.canton.network/appdev/faq) - [Observability and Troubleshooting Overview](https://docs.canton.network/appdev/quickstart/observability-and-tracing#observability-and-tracing) - [Quickstart Reference](https://docs.canton.network/sdks-tools/reference-projects/cn-quickstart#cn-quickstart) +- [LocalNet](https://docs.canton.network/sdks-tools/development-tools/localnet): ports, Ledger API authentication and health checks +- [Version Compatibility Dashboard](https://docs.canton.network/shared/version-compatibility-dashboard): component versions running on DevNet, TestNet and MainNet + +AI coding agents: see [AGENTS.md](AGENTS.md), or start from [llms.txt](https://docs.canton.network/llms.txt) or the [docs MCP server](https://docs.canton.network/shared/mcp-server). ### Technical documentation @@ -68,6 +71,38 @@ An assistant helps set up deployment when running `make start` for the first tim You can choose to run the application in standard mode or test mode and with or without OAUTH2. You may change this later by running `make setup`. +## LocalNet only + +If you only need a running network, for example to deploy and test your own Daml code, start LocalNet without the Quickstart application. +This needs only Docker: no `make setup`, no `make build`, and no Nix, JDK or Node.js. + +```bash +$ cd quickstart + +# Start the super validator with the synchronizer, plus the App Provider and App User validators +$ make start-localnet + +# Show container status +$ make status-localnet + +# Stop LocalNet and keep its data, or stop it and remove its data +$ make stop-localnet +$ make clean-localnet +``` + +Each validator's JSON Ledger API is at `http://localhost:975`: `2975` for the App User, `3975` for the App Provider and `4975` for the Super Validator. +Requests need a JWT signed with HS256 and the secret `unsafe`, with audience `https://canton.network.global` and subject `ledger-api-user`. +See [LocalNet](https://docs.canton.network/sdks-tools/development-tools/localnet) for health checks, a token example, and how to change ports that are already in use, for example `DB_PORT` if PostgreSQL already runs on port 5432. + +Don't run `make start-localnet` and `make start` at the same time: both use the same ports. + +### Versions + +`quickstart/.env` pins the versions this project builds and runs with: `SPLICE_VERSION` sets the LocalNet images, and `DAML_RUNTIME_VERSION` sets the Daml libraries the Java backend builds against. +The Daml projects set the same SDK version in their `daml.yaml` files. +They can lag the versions running on DevNet, TestNet and MainNet. +Before you deploy to a shared network, check the [Version Compatibility Dashboard](https://docs.canton.network/shared/version-compatibility-dashboard). + ## Debugging TL;DR If a container fails to start, there are a few things to try: @@ -92,7 +127,7 @@ Read the [FAQ Make target reference](https://docs.canton.network/appdev/quicksta ## Topology -Quickstart is built on top of https://github.com/hyperledger-labs/splice/tree/main/cluster/compose/localnet. Check [documentation](https://docs.sync.global/app_dev/testing/localnet.html) for more information about Splice LocalNet. +Quickstart is built on top of https://github.com/hyperledger-labs/splice/tree/main/cluster/compose/localnet. Check the [LocalNet documentation](https://docs.canton.network/sdks-tools/development-tools/localnet) for more information about Splice LocalNet. This diagram summarizes the relationship of services that are started as part of `make start`. The `canton` and `splice` services are configured to serve multiple logically separate components (each component represented with a box in the diagram) from a single container to reduce resource consumption. Similarly the `postgres` service contains multiple databases required by Quickstart services. One `nginx` service is used as proxy for all Quickstart services that needs one except for `keycloak` that has its own `nginx-keycloak` as it needs to be ready before other services start. The focus of `Canton Network Quickstart` is to provide a development environment for App Providers. diff --git a/quickstart/Makefile b/quickstart/Makefile index 3cb2b7cf1..c310a5931 100644 --- a/quickstart/Makefile +++ b/quickstart/Makefile @@ -268,6 +268,35 @@ stop-application: docker-available ## Stop the application, leaving observabilit .PHONY: restart restart: stop start ## Restart the application +# LocalNet only: the Splice LocalNet network without the QuickStart application. +# Needs only Docker: no `make setup`, no `make build`, no JDK or Node.js. +# Don't run it at the same time as `make start`; both bind the same ports. +# RESOURCE_CONSTRAINT_CONFIG also lists application modules, so use LocalNet's file only. +ifeq ($(RESOURCE_CONSTRAINTS_ENABLED),true) + LOCALNET_ONLY_RESOURCE_CONSTRAINTS := -f ${LOCALNET_DIR}/resource-constraints.yaml +endif +LOCALNET_ONLY_COMPOSE = docker compose \ + --env-file ${LOCALNET_DIR}/compose.env \ + --env-file ${LOCALNET_DIR}/env/common.env \ + -f ${LOCALNET_DIR}/compose.yaml $(LOCALNET_ONLY_RESOURCE_CONSTRAINTS) \ + --profile sv --profile app-provider --profile app-user + +.PHONY: start-localnet +start-localnet: docker-available ## Start only Splice LocalNet, without building or starting the application + $(LOCALNET_ONLY_COMPOSE) up -d + +.PHONY: stop-localnet +stop-localnet: docker-available ## Stop LocalNet started with start-localnet, keeping its data + $(LOCALNET_ONLY_COMPOSE) down + +.PHONY: clean-localnet +clean-localnet: docker-available ## Stop LocalNet started with start-localnet and remove its data + $(LOCALNET_ONLY_COMPOSE) down -v + +.PHONY: status-localnet +status-localnet: docker-available ## Show status of LocalNet started with start-localnet + $(LOCALNET_ONLY_COMPOSE) ps + # Utility targets .PHONY: status status: docker-available ## Show status of Docker containers From 3bc208bcc56c0fea1548b9b4218c76989753325c Mon Sep 17 00:00:00 2001 From: Jimmy Chu Date: Tue, 17 Nov 2026 22:41:10 +0800 Subject: [PATCH 20/22] Align Quickstart with Canton 3.6 / Splice 0.9 and rename SCRIBE to PQS (#404) * update on all versions * Rename SCRIBE_* env vars and image to PQS_* / participant-query-store. Align Quickstart LocalNet and DevNet with Canton 3.6+ PQS naming so config uses the supported PQS_ prefix instead of the deprecated SCRIBE_ fallback. Co-authored-by: Cursor * minor fix * Fix script-service.jar path handling in dpm.nix --------- Co-authored-by: Cursor Co-authored-by: Brian Healey --- nix/dpm.nix | 24 +++++++++----- quickstart/.env | 6 ++-- .../buildSrc/src/main/kotlin/Dependencies.kt | 6 ++-- .../splice-amulet-test/daml.yaml | 2 +- .../splice-token-standard-test/daml.yaml | 2 +- .../splice-token-test-trading-app/daml.yaml | 2 +- .../splice-wallet-test/daml.yaml | 2 +- quickstart/daml/licensing-tests/daml.yaml | 2 +- quickstart/daml/licensing/daml.yaml | 2 +- .../docker/modules/daml-shell/compose.env | 2 +- quickstart/docker/modules/devnet/compose.env | 4 +-- quickstart/docker/modules/devnet/compose.yaml | 32 +++++++++---------- quickstart/docker/modules/devnet/env/pqs.env | 26 +++++++-------- .../docker/modules/keycloak/compose.env | 2 +- .../keycloak/env/app-user/on/oauth2.env | 2 +- quickstart/docker/modules/pqs/compose.env | 4 +-- quickstart/docker/modules/pqs/compose.yaml | 6 ++-- .../pqs/env/app-provider/on/oauth2.env | 16 +++++----- .../pqs/env/app-provider/on/shared-secret.env | 8 ++--- .../modules/pqs/env/app-user/on/oauth2.env | 16 +++++----- .../pqs/env/app-user/on/shared-secret.env | 8 ++--- quickstart/docker/modules/pqs/env/pqs.env | 10 +++--- quickstart/docker/modules/pqs/env/sv/on.env | 8 ++--- .../pqs/onboarding/app-provider/on/oauth2.env | 2 +- .../pqs/onboarding/app-user/on/oauth2.env | 2 +- quickstart/sync-network.sh | 2 +- ...observability-troubleshooting-overview.rst | 14 ++++---- .../operate/deploy-quickstart-to-devnet.rst | 2 +- 28 files changed, 111 insertions(+), 103 deletions(-) diff --git a/nix/dpm.nix b/nix/dpm.nix index b43ab6e01..e14dc8b70 100644 --- a/nix/dpm.nix +++ b/nix/dpm.nix @@ -1,15 +1,15 @@ { pkgs ? import {} }: let - dpmVersion = "3.5.2"; + dpmVersion = "3.6.3"; system = pkgs.stdenv.hostPlatform.system; os = if pkgs.stdenv.isDarwin then "darwin" else "linux"; arch = if pkgs.stdenv.isAarch64 then "arm64" else "amd64"; dpmHashes = { - "x86_64-linux" = "sha256:015npjj4npryg4c7k98g64zlnh4bx4jrwvbkvnhwsj7iniyfjr8c"; - "aarch64-linux" = "sha256:0f9xbpbcl58ml8mfls4wgqc0gcnfkvivjxd20xhfd1lgls8nmbhq"; - "aarch64-darwin" = "sha256:1srqpwglzljk0yiszb90bkp1b368a08dl95j77j72ijwa6hv2igr"; + "x86_64-linux" = "sha256:0m1a3y2cc6z35aj1x3i5w0i1vlqcy5iywmk93lf2hkkvrq3g596d"; + "aarch64-linux" = "sha256:0g7k3yljiad38ph1lknyzwr6c2wfcqg4xzp58sclb3h93pfn3w1h"; + "aarch64-darwin" = "sha256:04n4sq9mxwddxzqgmc59j4qc2qwvv03x92sjpnkg68fl8pjxpq6i"; }; dpmHash = dpmHashes.${system} or (throw "Unsupported system: ${system}"); in @@ -43,10 +43,18 @@ pkgs.stdenv.mkDerivation { DPM_HOME=$out $out/bin/dpm bootstrap $out # damlc ide expects script-service.jar inside its own resources directory, - # but dpm installs it as a separate daml-script component - mkdir -p $out/cache/components/damlc/${dpmVersion}/damlc-dist-dpm/lib/resources - ln -s $out/cache/components/daml-script/${dpmVersion}/script-service.jar \ - $out/cache/components/damlc/${dpmVersion}/damlc-dist-dpm/lib/resources/script-service.jar + # but dpm installs it as a separate daml-script component. SDK component + # versions may differ from the SDK release version (e.g. damlc 3.6.2 for SDK 3.6.3). + + script_jar=$(echo $out/cache/components/daml-script/*/script-service.jar | awk '{print $1}') + if [ -z "$script_jar" ] || [ ! -f "$script_jar" ]; then + echo "script-service.jar not found under daml-script components" >&2 + exit 1 + fi + for damlc_dir in $out/cache/components/damlc/*/damlc-dist-dpm; do + mkdir -p "$damlc_dir/lib/resources" + ln -sfn "$script_jar" "$damlc_dir/lib/resources/script-service.jar" + done rm -rf $out/oci-registry rm -rf $out/cache/oci-layout/* diff --git a/quickstart/.env b/quickstart/.env index be3b64003..09f0903cd 100644 --- a/quickstart/.env +++ b/quickstart/.env @@ -1,8 +1,8 @@ ## Variables for substitution in docker-compose ## Container specific variables are placed in the respective container's --env-file -DAML_RUNTIME_VERSION=3.5.2 -SPLICE_VERSION=0.6.11 +DAML_RUNTIME_VERSION=3.6.3 +SPLICE_VERSION=0.9.4 DOCKER_NETWORK=quickstart # jdk backend @@ -13,7 +13,7 @@ OTEL_AGENT_VERSION=2.10.0 # for Vite hot reload VITE_BACKEND_PORT=${BACKEND_PORT} -SCRIBE_VERSION=3.5.4 +PQS_VERSION=3.6.2 # canton network SPLICE_APP_UI_NETWORK_NAME="Canton Network" SPLICE_APP_UI_NETWORK_FAVICON_URL="https://www.canton.network/hubfs/cn-favicon-05%201-1.png" diff --git a/quickstart/buildSrc/src/main/kotlin/Dependencies.kt b/quickstart/buildSrc/src/main/kotlin/Dependencies.kt index ce7f1cf64..4fe28027a 100644 --- a/quickstart/buildSrc/src/main/kotlin/Dependencies.kt +++ b/quickstart/buildSrc/src/main/kotlin/Dependencies.kt @@ -20,12 +20,12 @@ object Deps { } object transcode { - val version get() = "3.5.8" + val version get() = "3.6.3" - // The codegen plugin and its runtime have no stable 3.5.x release; only snapshots. + // The codegen plugin and its runtime have no stable 3.6.x release; only snapshots. // Their POMs pin Daml LF snapshots that were never published to Maven Central, so // :daml forces those transitives to $version. Keep both on the same snapshot. - val codegenVersion get() = "3.5.0-snapshot.20260428.170.1007.v02f2a2a" + val codegenVersion get() = "3.6.0-snapshot.20261106.1.100.v45c1ec8" val plugin get() = "com.daml.codegen-java-daml3:com.daml.codegen-java-daml3.gradle.plugin:$codegenVersion" val codegenJavaRuntime get() = "com.daml:transcode-codegen-java-runtime_3:$codegenVersion" diff --git a/quickstart/daml/external-test-sources/splice-amulet-test/daml.yaml b/quickstart/daml/external-test-sources/splice-amulet-test/daml.yaml index 3e55b3d48..196971ac5 100644 --- a/quickstart/daml/external-test-sources/splice-amulet-test/daml.yaml +++ b/quickstart/daml/external-test-sources/splice-amulet-test/daml.yaml @@ -3,7 +3,7 @@ # classes. You should either use `daml build` or `sbt ~compile`, but NOT both # at the same time (see #179 for more context). -sdk-version: 3.5.2 +sdk-version: 3.6.3 name: splice-amulet-test source: daml version: 0.1.15 diff --git a/quickstart/daml/external-test-sources/splice-token-standard-test/daml.yaml b/quickstart/daml/external-test-sources/splice-token-standard-test/daml.yaml index ea3432962..71fdf7f6b 100644 --- a/quickstart/daml/external-test-sources/splice-token-standard-test/daml.yaml +++ b/quickstart/daml/external-test-sources/splice-token-standard-test/daml.yaml @@ -1,7 +1,7 @@ # Copyright (c) 2026 Digital Asset (Switzerland) GmbH and/or its affiliates. All rights reserved. # SPDX-License-Identifier: Apache-2.0 -sdk-version: 3.5.2 +sdk-version: 3.6.3 name: splice-token-standard-test description: | Test infrastructure for the token standard. diff --git a/quickstart/daml/external-test-sources/splice-token-test-trading-app/daml.yaml b/quickstart/daml/external-test-sources/splice-token-test-trading-app/daml.yaml index 9cce6bee0..48c997316 100644 --- a/quickstart/daml/external-test-sources/splice-token-test-trading-app/daml.yaml +++ b/quickstart/daml/external-test-sources/splice-token-test-trading-app/daml.yaml @@ -1,7 +1,7 @@ # Copyright (c) 2026 Digital Asset (Switzerland) GmbH and/or its affiliates. All rights reserved. # SPDX-License-Identifier: Apache-2.0 -sdk-version: 3.5.2 +sdk-version: 3.6.3 name: splice-token-test-trading-app description: | A trading app PoC built on top of the allocation APIs of the Canton Network Token Standard. diff --git a/quickstart/daml/external-test-sources/splice-wallet-test/daml.yaml b/quickstart/daml/external-test-sources/splice-wallet-test/daml.yaml index 7ad514b67..0ac72766b 100644 --- a/quickstart/daml/external-test-sources/splice-wallet-test/daml.yaml +++ b/quickstart/daml/external-test-sources/splice-wallet-test/daml.yaml @@ -1,4 +1,4 @@ -sdk-version: 3.5.2 +sdk-version: 3.6.3 name: splice-wallet-test source: daml version: 0.1.15 diff --git a/quickstart/daml/licensing-tests/daml.yaml b/quickstart/daml/licensing-tests/daml.yaml index 137402f99..1ac019df2 100644 --- a/quickstart/daml/licensing-tests/daml.yaml +++ b/quickstart/daml/licensing-tests/daml.yaml @@ -1,7 +1,7 @@ # for config file options, refer to # https://docs.daml.com/tools/assistant.html#project-config-file-daml-yaml -sdk-version: 3.5.2 +sdk-version: 3.6.3 name: quickstart-licensing-tests source: daml version: 0.0.1 diff --git a/quickstart/daml/licensing/daml.yaml b/quickstart/daml/licensing/daml.yaml index 70023916b..04433bbd4 100644 --- a/quickstart/daml/licensing/daml.yaml +++ b/quickstart/daml/licensing/daml.yaml @@ -1,7 +1,7 @@ # for config file options, refer to # https://docs.daml.com/tools/assistant.html#project-config-file-daml-yaml -sdk-version: 3.5.2 +sdk-version: 3.6.3 name: quickstart-licensing source: daml version: 0.0.1 diff --git a/quickstart/docker/modules/daml-shell/compose.env b/quickstart/docker/modules/daml-shell/compose.env index 1ad81588f..66db863b0 100644 --- a/quickstart/docker/modules/daml-shell/compose.env +++ b/quickstart/docker/modules/daml-shell/compose.env @@ -1,2 +1,2 @@ SHELL_IMAGE=${SHELL_IMAGE:-europe-docker.pkg.dev/da-images/public/docker/daml-shell} -SHELL_VERSION=${SHELL_VERSION:-3.5.1} +SHELL_VERSION=${SHELL_VERSION:-3.6.1} diff --git a/quickstart/docker/modules/devnet/compose.env b/quickstart/docker/modules/devnet/compose.env index fbba263ea..32a054653 100644 --- a/quickstart/docker/modules/devnet/compose.env +++ b/quickstart/docker/modules/devnet/compose.env @@ -5,8 +5,8 @@ # Image versions - inherit from parent or use sensible defaults KEYCLOAK_IMAGE=${KEYCLOAK_IMAGE:-quay.io/keycloak/keycloak} KEYCLOAK_VERSION=${KEYCLOAK_VERSION:-26.1.0} -SCRIBE_IMAGE=${SCRIBE_IMAGE:-europe-docker.pkg.dev/da-images/public/docker/scribe} -SCRIBE_VERSION=${SCRIBE_VERSION:-3.5.4} +PQS_IMAGE=${PQS_IMAGE:-europe-docker.pkg.dev/da-images/public/docker/participant-query-store} +PQS_VERSION=${PQS_VERSION:-3.6.2} POSTGRES_VERSION=${POSTGRES_VERSION:-14} NGINX_VERSION=${NGINX_VERSION:-1.27.1} JAVA_VERSION=${JAVA_VERSION:-21-jdk} diff --git a/quickstart/docker/modules/devnet/compose.yaml b/quickstart/docker/modules/devnet/compose.yaml index eea5ff5d4..bf48d36eb 100644 --- a/quickstart/docker/modules/devnet/compose.yaml +++ b/quickstart/docker/modules/devnet/compose.yaml @@ -123,27 +123,27 @@ services: - devnet pqs-app-provider: - image: ${SCRIBE_IMAGE:-europe-docker.pkg.dev/da-images/public/docker/scribe}:${SCRIBE_VERSION:-0.6.12} + image: ${PQS_IMAGE:-europe-docker.pkg.dev/da-images/public/docker/participant-query-store}:${PQS_VERSION:-3.6.2} container_name: pqs-app-provider environment: # Connect directly to splice-node's participant gRPC API (bypassing nginx) - # Scribe uses gRPC which can't set custom Host headers required by nginx virtual hosts - SCRIBE_SOURCE_LEDGER_HOST: ${SCRIBE_LEDGER_HOST:-splice-validator-participant-1} - SCRIBE_SOURCE_LEDGER_PORT: ${SCRIBE_LEDGER_PORT:-5001} - SCRIBE_SOURCE_LEDGER_TLS_ENABLED: "false" + # PQS uses gRPC which can't set custom Host headers required by nginx virtual hosts + PQS_SOURCE_LEDGER_HOST: ${PQS_LEDGER_HOST:-splice-validator-participant-1} + PQS_SOURCE_LEDGER_PORT: ${PQS_LEDGER_PORT:-5001} + PQS_SOURCE_LEDGER_TLS_ENABLED: "false" # Local PQS database - SCRIBE_TARGET_POSTGRES_HOST: postgres-pqs - SCRIBE_TARGET_POSTGRES_PORT: 5432 - SCRIBE_TARGET_POSTGRES_DATABASE: ${PQS_DB_NAME:-pqs-app-provider} - SCRIBE_TARGET_POSTGRES_USERNAME: ${PQS_DB_USER:-cnadmin} - SCRIBE_TARGET_POSTGRES_PASSWORD: ${PQS_DB_PASSWORD:-supersafe} + PQS_TARGET_POSTGRES_HOST: postgres-pqs + PQS_TARGET_POSTGRES_PORT: 5432 + PQS_TARGET_POSTGRES_DATABASE: ${PQS_DB_NAME:-pqs-app-provider} + PQS_TARGET_POSTGRES_USERNAME: ${PQS_DB_USER:-cnadmin} + PQS_TARGET_POSTGRES_PASSWORD: ${PQS_DB_PASSWORD:-supersafe} # OAuth2 authentication for ledger API (matching LocalNet variable names) - SCRIBE_SOURCE_LEDGER_AUTH: OAuth - SCRIBE_PIPELINE_OAUTH_ENDPOINT: http://nginx-keycloak:8082/realms/AppProvider/protocol/openid-connect/token - SCRIBE_PIPELINE_OAUTH_CLIENTID: ${AUTH_APP_PROVIDER_VALIDATOR_CLIENT_ID:-app-provider-validator} - SCRIBE_PIPELINE_OAUTH_CLIENTSECRET: ${AUTH_APP_PROVIDER_VALIDATOR_CLIENT_SECRET:-AL8648b9SfdTFImq7FV56Vd0KHifHBuC} - SCRIBE_PIPELINE_OAUTH_SCOPE: openid - SCRIBE_PIPELINE_OAUTH_PARAMETERS_AUDIENCE: ${AUTH_APP_PROVIDER_AUDIENCE:-https://canton.network.global} + PQS_SOURCE_LEDGER_AUTH: OAuth + PQS_PIPELINE_OAUTH_ENDPOINT: http://nginx-keycloak:8082/realms/AppProvider/protocol/openid-connect/token + PQS_PIPELINE_OAUTH_CLIENTID: ${AUTH_APP_PROVIDER_VALIDATOR_CLIENT_ID:-app-provider-validator} + PQS_PIPELINE_OAUTH_CLIENTSECRET: ${AUTH_APP_PROVIDER_VALIDATOR_CLIENT_SECRET:-AL8648b9SfdTFImq7FV56Vd0KHifHBuC} + PQS_PIPELINE_OAUTH_SCOPE: openid + PQS_PIPELINE_OAUTH_PARAMETERS_AUDIENCE: ${AUTH_APP_PROVIDER_AUDIENCE:-https://canton.network.global} command: - "pipeline" - "ledger" diff --git a/quickstart/docker/modules/devnet/env/pqs.env b/quickstart/docker/modules/devnet/env/pqs.env index 745f36ad9..edf092747 100644 --- a/quickstart/docker/modules/devnet/env/pqs.env +++ b/quickstart/docker/modules/devnet/env/pqs.env @@ -2,24 +2,24 @@ # Connects to splice-node participant via host.docker.internal # Source: splice-node participant ledger API -SCRIBE_SOURCE_LEDGER_HOST=host.docker.internal -SCRIBE_SOURCE_LEDGER_PORT=8080 +PQS_SOURCE_LEDGER_HOST=host.docker.internal +PQS_SOURCE_LEDGER_PORT=8080 # Target: Local PQS postgres -SCRIBE_TARGET_POSTGRES_HOST=postgres-pqs -SCRIBE_TARGET_POSTGRES_PORT=5432 -SCRIBE_TARGET_POSTGRES_USERNAME=cnadmin -SCRIBE_TARGET_POSTGRES_PASSWORD=supersafe -SCRIBE_TARGET_POSTGRES_DATABASE=pqs-app-provider +PQS_TARGET_POSTGRES_HOST=postgres-pqs +PQS_TARGET_POSTGRES_PORT=5432 +PQS_TARGET_POSTGRES_USERNAME=cnadmin +PQS_TARGET_POSTGRES_PASSWORD=supersafe +PQS_TARGET_POSTGRES_DATABASE=pqs-app-provider # OAuth2 authentication for ledger API -SCRIBE_SOURCE_LEDGER_AUTH=OAuth2 +PQS_SOURCE_LEDGER_AUTH=OAuth2 # Keycloak OAuth2 configuration -SCRIBE_SOURCE_LEDGER_AUTH_URL=http://host.docker.internal:8082/realms/AppProvider/protocol/openid-connect/token -SCRIBE_SOURCE_LEDGER_AUTH_CLIENT_ID=app-provider-backend -SCRIBE_SOURCE_LEDGER_AUTH_CLIENT_SECRET=AL8648b9SfdTFImq7FV56Vd0KHifHBuC -SCRIBE_SOURCE_LEDGER_AUTH_SCOPE=daml_ledger_api +PQS_SOURCE_LEDGER_AUTH_URL=http://host.docker.internal:8082/realms/AppProvider/protocol/openid-connect/token +PQS_SOURCE_LEDGER_AUTH_CLIENT_ID=app-provider-backend +PQS_SOURCE_LEDGER_AUTH_CLIENT_SECRET=AL8648b9SfdTFImq7FV56Vd0KHifHBuC +PQS_SOURCE_LEDGER_AUTH_SCOPE=daml_ledger_api # Audience for JWT tokens -SCRIBE_SOURCE_LEDGER_AUTH_AUDIENCE=https://canton.network.global +PQS_SOURCE_LEDGER_AUTH_AUDIENCE=https://canton.network.global diff --git a/quickstart/docker/modules/keycloak/compose.env b/quickstart/docker/modules/keycloak/compose.env index 9f67391b9..6cba999cb 100644 --- a/quickstart/docker/modules/keycloak/compose.env +++ b/quickstart/docker/modules/keycloak/compose.env @@ -14,6 +14,6 @@ AUTH_APP_PROVIDER_AUDIENCE=https://canton.network.global AUTH_APP_USER_ISSUER_URL_INTERNAL=http://nginx-keycloak:8082/realms/AppUser # for backend AUTH_APP_USER_ISSUER_URL=http://keycloak.localhost:8082/realms/AppUser # for backend, wallet-ui AUTH_APP_USER_WELLKNOWN_URL=${AUTH_APP_USER_ISSUER_URL_INTERNAL}/.well-known/openid-configuration # for validator -AUTH_APP_USER_TOKEN_URL=${AUTH_APP_USER_ISSUER_URL_INTERNAL}/protocol/openid-connect/token # for scribe, canton-console, onboarding +AUTH_APP_USER_TOKEN_URL=${AUTH_APP_USER_ISSUER_URL_INTERNAL}/protocol/openid-connect/token # for pqs, canton-console, onboarding AUTH_APP_USER_JWK_SET_URL=${AUTH_APP_USER_ISSUER_URL_INTERNAL}/protocol/openid-connect/certs # for participant, validator AUTH_APP_USER_AUDIENCE=https://canton.network.global \ No newline at end of file diff --git a/quickstart/docker/modules/keycloak/env/app-user/on/oauth2.env b/quickstart/docker/modules/keycloak/env/app-user/on/oauth2.env index fbc2ae372..7aaf6acca 100644 --- a/quickstart/docker/modules/keycloak/env/app-user/on/oauth2.env +++ b/quickstart/docker/modules/keycloak/env/app-user/on/oauth2.env @@ -2,7 +2,7 @@ APP_USER_PARTY_HINT=app_user_${PARTY_HINT} AUTH_APP_USER_ISSUER_URL=${AUTH_APP_USER_ISSUER_URL} # for backend, wallet-ui AUTH_APP_USER_WELLKNOWN_URL=${AUTH_APP_USER_WELLKNOWN_URL} # for validator -AUTH_APP_USER_TOKEN_URL=${AUTH_APP_USER_TOKEN_URL} # for scribe, canton-console, onboarding +AUTH_APP_USER_TOKEN_URL=${AUTH_APP_USER_TOKEN_URL} # for pqs, canton-console, onboarding AUTH_APP_USER_JWK_SET_URL=${AUTH_APP_USER_JWK_SET_URL} # for participant, validator AUTH_APP_USER_AUDIENCE=${AUTH_APP_USER_AUDIENCE} AUTH_APP_USER_WALLET_ADMIN_USER_ID=92a520cb-2f09-4e55-b465-d178c6cfe5e4 # for validator diff --git a/quickstart/docker/modules/pqs/compose.env b/quickstart/docker/modules/pqs/compose.env index de391b7e0..9e12c5936 100644 --- a/quickstart/docker/modules/pqs/compose.env +++ b/quickstart/docker/modules/pqs/compose.env @@ -1,5 +1,5 @@ -SCRIBE_IMAGE=${SCRIBE_IMAGE:-europe-docker.pkg.dev/da-images/public/docker/scribe} -SCRIBE_VERSION=${SCRIBE_VERSION:-0.6.11} +PQS_IMAGE=${PQS_IMAGE:-europe-docker.pkg.dev/da-images/public/docker/participant-query-store} +PQS_VERSION=${PQS_VERSION:-3.6.2} PQS_APP_PROVIDER_PROFILE=${PQS_APP_PROVIDER_PROFILE:-on} PQS_APP_USER_PROFILE=${PQS_APP_USER_PROFILE:-off} diff --git a/quickstart/docker/modules/pqs/compose.yaml b/quickstart/docker/modules/pqs/compose.yaml index 11ded1c59..cc40e8041 100644 --- a/quickstart/docker/modules/pqs/compose.yaml +++ b/quickstart/docker/modules/pqs/compose.yaml @@ -27,7 +27,7 @@ volumes: services: pqs-app-provider: - image: ${SCRIBE_IMAGE}:${SCRIBE_VERSION} + image: ${PQS_IMAGE}:${PQS_VERSION} container_name: pqs-app-provider env_file: - ${LOCALNET_ENV_DIR}/common.env @@ -50,7 +50,7 @@ services: - pqs-app-provider pqs-app-user: - image: ${SCRIBE_IMAGE}:${SCRIBE_VERSION} + image: ${PQS_IMAGE}:${PQS_VERSION} container_name: pqs-app-user env_file: - ${LOCALNET_ENV_DIR}/common.env @@ -73,7 +73,7 @@ services: - pqs-app-user pqs-sv: - image: ${SCRIBE_IMAGE}:${SCRIBE_VERSION} + image: ${PQS_IMAGE}:${PQS_VERSION} container_name: pqs-sv env_file: - ${LOCALNET_ENV_DIR}/common.env diff --git a/quickstart/docker/modules/pqs/env/app-provider/on/oauth2.env b/quickstart/docker/modules/pqs/env/app-provider/on/oauth2.env index 81fd2483f..ac2b89658 100644 --- a/quickstart/docker/modules/pqs/env/app-provider/on/oauth2.env +++ b/quickstart/docker/modules/pqs/env/app-provider/on/oauth2.env @@ -1,8 +1,8 @@ -SCRIBE_PIPELINE_OAUTH_CLIENTID=${AUTH_APP_PROVIDER_PQS_CLIENT_ID} -SCRIBE_PIPELINE_OAUTH_CLIENTSECRET=${AUTH_APP_PROVIDER_PQS_CLIENT_SECRET} -SCRIBE_PIPELINE_OAUTH_SCOPE=openid -SCRIBE_PIPELINE_OAUTH_ENDPOINT=${AUTH_APP_PROVIDER_TOKEN_URL} -SCRIBE_SOURCE_LEDGER_AUTH=OAuth -SCRIBE_PIPELINE_OAUTH_PARAMETERS_AUDIENCE=${AUTH_APP_PROVIDER_AUDIENCE} -SCRIBE_SOURCE_LEDGER_PORT="3${PARTICIPANT_LEDGER_API_PORT_SUFFIX}" -SCRIBE_TARGET_POSTGRES_DATABASE="pqs-app-provider" +PQS_PIPELINE_OAUTH_CLIENTID=${AUTH_APP_PROVIDER_PQS_CLIENT_ID} +PQS_PIPELINE_OAUTH_CLIENTSECRET=${AUTH_APP_PROVIDER_PQS_CLIENT_SECRET} +PQS_PIPELINE_OAUTH_SCOPE=openid +PQS_PIPELINE_OAUTH_ENDPOINT=${AUTH_APP_PROVIDER_TOKEN_URL} +PQS_SOURCE_LEDGER_AUTH=OAuth +PQS_PIPELINE_OAUTH_PARAMETERS_AUDIENCE=${AUTH_APP_PROVIDER_AUDIENCE} +PQS_SOURCE_LEDGER_PORT="3${PARTICIPANT_LEDGER_API_PORT_SUFFIX}" +PQS_TARGET_POSTGRES_DATABASE="pqs-app-provider" diff --git a/quickstart/docker/modules/pqs/env/app-provider/on/shared-secret.env b/quickstart/docker/modules/pqs/env/app-provider/on/shared-secret.env index c67e5e3d8..d14f9d78a 100644 --- a/quickstart/docker/modules/pqs/env/app-provider/on/shared-secret.env +++ b/quickstart/docker/modules/pqs/env/app-provider/on/shared-secret.env @@ -1,4 +1,4 @@ -SCRIBE_SOURCE_LEDGER_AUTH=OAuth -SCRIBE_SOURCE_LEDGER_PORT="3${PARTICIPANT_LEDGER_API_PORT_SUFFIX}" -SCRIBE_TARGET_POSTGRES_DATABASE="pqs-app-provider" -SCRIBE_CONFIG=/onboarding/app-provider-pqs.conf +PQS_SOURCE_LEDGER_AUTH=OAuth +PQS_SOURCE_LEDGER_PORT="3${PARTICIPANT_LEDGER_API_PORT_SUFFIX}" +PQS_TARGET_POSTGRES_DATABASE="pqs-app-provider" +PQS_CONFIG=/onboarding/app-provider-pqs.conf diff --git a/quickstart/docker/modules/pqs/env/app-user/on/oauth2.env b/quickstart/docker/modules/pqs/env/app-user/on/oauth2.env index cc9fb790e..bbfe8e277 100644 --- a/quickstart/docker/modules/pqs/env/app-user/on/oauth2.env +++ b/quickstart/docker/modules/pqs/env/app-user/on/oauth2.env @@ -1,8 +1,8 @@ -SCRIBE_PIPELINE_OAUTH_CLIENTID=${AUTH_APP_USER_PQS_CLIENT_ID} -SCRIBE_PIPELINE_OAUTH_CLIENTSECRET=${AUTH_APP_USER_PQS_CLIENT_SECRET} -SCRIBE_PIPELINE_OAUTH_SCOPE=openid -SCRIBE_PIPELINE_OAUTH_ENDPOINT=${AUTH_APP_USER_TOKEN_URL} -SCRIBE_SOURCE_LEDGER_AUTH=OAuth -SCRIBE_PIPELINE_OAUTH_PARAMETERS_AUDIENCE=${AUTH_APP_USER_AUDIENCE} -SCRIBE_SOURCE_LEDGER_PORT="2${PARTICIPANT_LEDGER_API_PORT_SUFFIX}" -SCRIBE_TARGET_POSTGRES_DATABASE="pqs-app-user" +PQS_PIPELINE_OAUTH_CLIENTID=${AUTH_APP_USER_PQS_CLIENT_ID} +PQS_PIPELINE_OAUTH_CLIENTSECRET=${AUTH_APP_USER_PQS_CLIENT_SECRET} +PQS_PIPELINE_OAUTH_SCOPE=openid +PQS_PIPELINE_OAUTH_ENDPOINT=${AUTH_APP_USER_TOKEN_URL} +PQS_SOURCE_LEDGER_AUTH=OAuth +PQS_PIPELINE_OAUTH_PARAMETERS_AUDIENCE=${AUTH_APP_USER_AUDIENCE} +PQS_SOURCE_LEDGER_PORT="2${PARTICIPANT_LEDGER_API_PORT_SUFFIX}" +PQS_TARGET_POSTGRES_DATABASE="pqs-app-user" diff --git a/quickstart/docker/modules/pqs/env/app-user/on/shared-secret.env b/quickstart/docker/modules/pqs/env/app-user/on/shared-secret.env index 8b7bb57e6..a16a41fd9 100644 --- a/quickstart/docker/modules/pqs/env/app-user/on/shared-secret.env +++ b/quickstart/docker/modules/pqs/env/app-user/on/shared-secret.env @@ -1,4 +1,4 @@ -SCRIBE_SOURCE_LEDGER_AUTH=OAuth -SCRIBE_SOURCE_LEDGER_PORT="2${PARTICIPANT_LEDGER_API_PORT_SUFFIX}" -SCRIBE_TARGET_POSTGRES_DATABASE="pqs-app-user" -SCRIBE_CONFIG=/onboarding/app-user-pqs.conf \ No newline at end of file +PQS_SOURCE_LEDGER_AUTH=OAuth +PQS_SOURCE_LEDGER_PORT="2${PARTICIPANT_LEDGER_API_PORT_SUFFIX}" +PQS_TARGET_POSTGRES_DATABASE="pqs-app-user" +PQS_CONFIG=/onboarding/app-user-pqs.conf \ No newline at end of file diff --git a/quickstart/docker/modules/pqs/env/pqs.env b/quickstart/docker/modules/pqs/env/pqs.env index ee8509b9a..26cfcba5c 100644 --- a/quickstart/docker/modules/pqs/env/pqs.env +++ b/quickstart/docker/modules/pqs/env/pqs.env @@ -1,7 +1,7 @@ # PQS -SCRIBE_SOURCE_LEDGER_HOST="canton" -SCRIBE_TARGET_POSTGRES_HOST="${DB_SERVER}" -SCRIBE_TARGET_POSTGRES_PORT="${DB_PORT}" -SCRIBE_TARGET_POSTGRES_USERNAME="${DB_USER}" -SCRIBE_TARGET_POSTGRES_PASSWORD="${DB_PASSWORD}" +PQS_SOURCE_LEDGER_HOST="canton" +PQS_TARGET_POSTGRES_HOST="${DB_SERVER}" +PQS_TARGET_POSTGRES_PORT="${DB_PORT}" +PQS_TARGET_POSTGRES_USERNAME="${DB_USER}" +PQS_TARGET_POSTGRES_PASSWORD="${DB_PASSWORD}" diff --git a/quickstart/docker/modules/pqs/env/sv/on.env b/quickstart/docker/modules/pqs/env/sv/on.env index 4ad2bc22b..19b74d6e5 100644 --- a/quickstart/docker/modules/pqs/env/sv/on.env +++ b/quickstart/docker/modules/pqs/env/sv/on.env @@ -1,4 +1,4 @@ -SCRIBE_SOURCE_LEDGER_AUTH=OAuth -SCRIBE_SOURCE_LEDGER_PORT="4${PARTICIPANT_LEDGER_API_PORT_SUFFIX}" -SCRIBE_TARGET_POSTGRES_DATABASE="pqs-sv" -SCRIBE_CONFIG=/onboarding/sv-pqs.conf +PQS_SOURCE_LEDGER_AUTH=OAuth +PQS_SOURCE_LEDGER_PORT="4${PARTICIPANT_LEDGER_API_PORT_SUFFIX}" +PQS_TARGET_POSTGRES_DATABASE="pqs-sv" +PQS_CONFIG=/onboarding/sv-pqs.conf diff --git a/quickstart/docker/modules/pqs/onboarding/app-provider/on/oauth2.env b/quickstart/docker/modules/pqs/onboarding/app-provider/on/oauth2.env index 284e1b984..1131d8f81 100644 --- a/quickstart/docker/modules/pqs/onboarding/app-provider/on/oauth2.env +++ b/quickstart/docker/modules/pqs/onboarding/app-provider/on/oauth2.env @@ -1,4 +1,4 @@ -AUTH_APP_PROVIDER_PQS_CLIENT_ID=app-provider-pqs # for pqs/scribe +AUTH_APP_PROVIDER_PQS_CLIENT_ID=app-provider-pqs # for pqs AUTH_APP_PROVIDER_PQS_CLIENT_SECRET=zuYvMzWEo8csYNiQNlmXNPsmPErBWP3W AUTH_APP_PROVIDER_PQS_USER_NAME=service-account-app-provider-pqs diff --git a/quickstart/docker/modules/pqs/onboarding/app-user/on/oauth2.env b/quickstart/docker/modules/pqs/onboarding/app-user/on/oauth2.env index 842ec192d..fdf39f0cc 100644 --- a/quickstart/docker/modules/pqs/onboarding/app-user/on/oauth2.env +++ b/quickstart/docker/modules/pqs/onboarding/app-user/on/oauth2.env @@ -1,4 +1,4 @@ -AUTH_APP_USER_PQS_CLIENT_ID=app-user-pqs # for pqs/scribe +AUTH_APP_USER_PQS_CLIENT_ID=app-user-pqs # for pqs AUTH_APP_USER_PQS_CLIENT_SECRET=7WkEjRTCSDz7u8CuXRWFp0UKdAp24hO4 AUTH_APP_USER_PQS_USER_NAME=service-account-app-user-pqs diff --git a/quickstart/sync-network.sh b/quickstart/sync-network.sh index 13e2bf141..31af094e6 100755 --- a/quickstart/sync-network.sh +++ b/quickstart/sync-network.sh @@ -90,7 +90,7 @@ done ENV_FILE="./.env" if [ -f "$ENV_FILE" ]; then sed -i -E "s/^(DAML_RUNTIME_VERSION=).*$/\1$DPM_SDK_VERSION/" "$ENV_FILE" - sed -i -E "s/^(IMAGE_TAG=).*$/\1$SPLICE_VERSION/" "$ENV_FILE" + sed -i -E "s/^(SPLICE_VERSION=).*$/\1$SPLICE_VERSION/" "$ENV_FILE" echo " $ENV_FILE" fi diff --git a/sdk/docs/sharable/sdk/quickstart/observe/observability-troubleshooting-overview.rst b/sdk/docs/sharable/sdk/quickstart/observe/observability-troubleshooting-overview.rst index 1f5c99a8f..aff0bf871 100644 --- a/sdk/docs/sharable/sdk/quickstart/observe/observability-troubleshooting-overview.rst +++ b/sdk/docs/sharable/sdk/quickstart/observe/observability-troubleshooting-overview.rst @@ -167,7 +167,7 @@ You can use the postgres configuration in ``.env`` to connect directly to these .. cf-docs-snippet-cn-quickstart-observability-postgres-direct-psql-end For example: if you connect to the ``postgres-splice-app-provider`` -container (default username ``cnadmin``, dbname ``scribe``, and password +container (default username ``cnadmin``, dbname ``pqs-app-provider``, and password ``supersafe``; then you can use the SQL interface to PQS to examine the app-provider’s participant’s local ledger. The SQL API to PQS is documented in the `daml documentation `__. @@ -365,14 +365,14 @@ associated ledger transaction: $ make shell docker compose -f docker/daml-shell/compose.yaml --env-file .env run --rm daml-shell || true - Connecting to jdbc:postgresql://postgres-splice-app-provider:5432/scribe... - Connected to jdbc:postgresql://postgres-splice-app-provider:5432/scribe - postgres-splice-app-provider:5432/scribe> transaction 1220e48d6d59af99a1b61eca414fe25766c342bb4e7d8d485e049a11a7f2267ed5c0 + Connecting to jdbc:postgresql://postgres-splice-app-provider:5432/pqs-app-provider... + Connected to jdbc:postgresql://postgres-splice-app-provider:5432/pqs-app-provider + postgres-splice-app-provider:5432/pqs-app-provider> transaction 1220e48d6d59af99a1b61eca414fe25766c342bb4e7d8d485e049a11a7f2267ed5c0 transactionId: 1220e48d6d59af99a1b61eca414fe25766c342bb4e7d8d485e049a11a7f2267ed5c0, offset: 48, workflowId: create-app-install-request - Feb 17, 2025, 5:26:09 AM + #1220e48d6d59af99a1b61eca414fe25766c342bb4e7d8d485e049a11a7f2267ed5c0:0 quickstart-licensing:Licensing.AppInstall:AppInstallRequest (005c17f89b7fd1d5fde9c548740c32924edeeddacc6320256892636b4e3b7d66aaca1) {"dso": "DSO::1220015e721c8ec5c1a5868b418442f064530e367c2587a9b43bd66f58c7bfddfec4", "meta": {"values": []}, "user": "Org1::122072b20a515d939910f9412f915cff8c1a7a427ddde76c6d0b7646d0022d4d4551", "provider": "AppProvider::12202fe7b2bf950dca3858b880d9ee0dd58249af8821ff2330ea1b80420852e816ff"} - postgres-splice-app-provider:5432/scribe 3f → 48> + postgres-splice-app-provider:5432/pqs-app-provider 3f → 48> .. cf-docs-snippet-cn-quickstart-observability-daml-shell-transaction-lookup-end @@ -397,7 +397,7 @@ immediately display the contract in Daml Shell: .. code-block:: :name: cf-docs-snippet-cn-quickstart-observability-daml-shell-contract-lookup-start - postgres-splice-app-provider:5432/scribe 3f → 48> contract 005c17f89b7fd1d5fde9c548740c32924edeeddacc6320256892636b4e3b7d66aaca101220777c5420863adb012c4f38847049346014c44eba7cd54bf58950dd6a18679053 + postgres-splice-app-provider:5432/pqs-app-provider 3f → 48> contract 005c17f89b7fd1d5fde9c548740c32924edeeddacc6320256892636b4e3b7d66aaca101220777c5420863adb012c4f38847049346014c44eba7cd54bf58950dd6a18679053 ╓───────────────────────────────────────────────────────────────────────────╖ | identifier: quickstart-licensing:Licensing.AppInstall:AppInstallRequest | | Type: Template | @@ -412,7 +412,7 @@ immediately display the contract in Daml Shell: | user: Org1:122072b20a515d939910f9412f915cff8c1a7a427ddde76c6d0b7646d00... | | provider: AppProvider:12202fe7b2bf950dca3858b880d9ee0dd58249af8821ff23... | ╙───────────────────────────────────────────────────────────────────────────╜ - postgres-splice-app-provider:5432/scribe 3f → 48> + postgres-splice-app-provider:5432/pqs-app-provider 3f → 48> .. cf-docs-snippet-cn-quickstart-observability-daml-shell-contract-lookup-end diff --git a/sdk/docs/sharable/sdk/quickstart/operate/deploy-quickstart-to-devnet.rst b/sdk/docs/sharable/sdk/quickstart/operate/deploy-quickstart-to-devnet.rst index a76dca9c0..cce6de825 100644 --- a/sdk/docs/sharable/sdk/quickstart/operate/deploy-quickstart-to-devnet.rst +++ b/sdk/docs/sharable/sdk/quickstart/operate/deploy-quickstart-to-devnet.rst @@ -48,7 +48,7 @@ The Quickstart DevNet deployment splits across two components: │ cn-quickstart │ │ ┌──────────┐ ┌──────────┐ ┌─────────────┐ ┌─────────────┐ │ │ │ Keycloak │ │ PQS │ │ Backend │ │ Frontend │ │ - │ │ :8082 │ │ (scribe) │ │ :8089 │ │ :5173 │ │ + │ │ :8082 │ │ (pqs) │ │ :8089 │ │ :5173 │ │ │ └──────────┘ └──────────┘ └─────────────┘ └─────────────┘ │ └────────────────────────────────────────────────────────────────┘ From 374f2d6e04f66ab919a2fab27401834235ccecd9 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Tue, 17 Nov 2026 17:58:20 +0000 Subject: [PATCH 21/22] build(deps): bump follow-redirects in /quickstart/frontend (#397) Bumps [follow-redirects](https://github.com/follow-redirects/follow-redirects) from 1.16.0 to 1.16.2. - [Release notes](https://github.com/follow-redirects/follow-redirects/releases) - [Commits](https://github.com/follow-redirects/follow-redirects/compare/v1.16.0...v1.16.2) --- updated-dependencies: - dependency-name: follow-redirects dependency-version: 1.16.2 dependency-type: indirect ... Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> --- quickstart/frontend/package-lock.json | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/quickstart/frontend/package-lock.json b/quickstart/frontend/package-lock.json index e1485b890..1df626173 100644 --- a/quickstart/frontend/package-lock.json +++ b/quickstart/frontend/package-lock.json @@ -2523,9 +2523,9 @@ "license": "ISC" }, "node_modules/follow-redirects": { - "version": "1.16.0", - "resolved": "https://registry.npmjs.org/follow-redirects/-/follow-redirects-1.16.0.tgz", - "integrity": "sha512-y5rN/uOsadFT/JfYwhxRS5R7Qce+g3zG97+JrtFZlC9klX/W5hD7iiLzScI4nZqUS7DNUdhPgw4xI8W2LuXlUw==", + "version": "1.16.2", + "resolved": "https://registry.npmjs.org/follow-redirects/-/follow-redirects-1.16.2.tgz", + "integrity": "sha512-/kVP2U8z596Ia0gwFrwyIeo74ta5aVmSeU1FfAUMAmcEP5EP7zydmag3SLiN64NaRKef3lxsq7i/g7ltJQDGow==", "funding": [ { "type": "individual", From 2cf01ceff42ce32d26c692170e3253a2bfd48f12 Mon Sep 17 00:00:00 2001 From: Facundo Farall <37149322+ffarall@users.noreply.github.com> Date: Tue, 24 Nov 2026 22:27:52 -0300 Subject: [PATCH 22/22] =?UTF-8?q?ci:=20=F0=9F=91=B7=20Replace=20CircleCI?= =?UTF-8?q?=20with=20GitHub=20Actions=20(#405)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * ci: 👷 Replace CircleCI with GitHub Actions Run Daml tests, the docs preview, the frontend build, and the Playwright integration test on GitHub-hosted runners. Fork pull requests skip the JUnit check run, and workflow or lockfile edits are flagged for review without failing the check. * ci: 👷 Keep the frontend action out of the build ignore .gitignore ignores every build directory, so the frontend composite action lives at .github/actions/frontend-build. * ci: 👷 Run the integration test on Ubuntu 24.04 ubuntu-latest is Ubuntu 26.04, and Playwright 1.59.1 has no Chromium build for that release. The 24.04 image is the one CircleCI used. * build: ⬆️ Bump Playwright to 1.63.0 ubuntu-latest is Ubuntu 26.04. Playwright 1.59.1 has no Chromium build for that release; 1.63.0 does. * ci: 👷 Run the integration test on ubuntu-latest Playwright 1.63.0 installs Chromium on Ubuntu 26.04, so the integration job no longer needs the Ubuntu 24.04 image. * ci: 👷 Rebuild the docs environment when its interpreter cannot run The docs cache key now includes the Python patch version from setup-python. poetry-install still skips a usable sdk/.venv, and installs again when that interpreter is missing or cannot start. * ci: 👷 Run Daml tests when their runner inputs change A pull request that only edits the test-daml recipe, or the shared Gradle files that recipe runs, now runs the Daml job. Documentation and frontend paths stay on their own filters. * ci: 👷 Flag the old path when a fork renames a workflow or lockfile Both fork-policy file lists now include filename and previous_filename, with duplicates removed, before the existing path filter. * ci: 👷 Stop the docs install when Poetry fails poetry-install runs in one shell. set -e makes a failed poetry install stop the recipe before poetry debug info. --- .circleci/Makefile | 21 --- .circleci/config.yml | 23 --- .circleci/configs/workflow_docs.yml | 59 ------- .circleci/configs/workflow_shared.yml | 36 ---- .circleci/configs/workflow_test.yml | 76 --------- .circleci/scripts/nix_prep.sh | 40 ----- .circleci/scripts/nix_setup.sh | 79 --------- .github/actions/daml/test/action.yml | 24 +++ .github/actions/docs/preview/action.yml | 26 +++ .github/actions/frontend-build/action.yml | 21 +++ .github/actions/integration/test/action.yml | 93 ++++++++++ .github/actions/setup/install-dpm/action.yml | 13 ++ .../actions/setup/install-dpm/install-dpm.sh | 101 +++++++++++ .github/dependabot.yml | 9 + .github/workflows/ci.yml | 161 ++++++++++++++++++ .github/workflows/fork-policy.yml | 112 ++++++++++++ nix/shell.nix | 1 - quickstart/Makefile | 2 +- quickstart/integration-test/package-lock.json | 48 ++---- quickstart/integration-test/package.json | 2 +- sdk/Makefile | 10 +- 21 files changed, 583 insertions(+), 374 deletions(-) delete mode 100644 .circleci/Makefile delete mode 100644 .circleci/config.yml delete mode 100644 .circleci/configs/workflow_docs.yml delete mode 100644 .circleci/configs/workflow_shared.yml delete mode 100644 .circleci/configs/workflow_test.yml delete mode 100755 .circleci/scripts/nix_prep.sh delete mode 100755 .circleci/scripts/nix_setup.sh create mode 100644 .github/actions/daml/test/action.yml create mode 100644 .github/actions/docs/preview/action.yml create mode 100644 .github/actions/frontend-build/action.yml create mode 100644 .github/actions/integration/test/action.yml create mode 100644 .github/actions/setup/install-dpm/action.yml create mode 100755 .github/actions/setup/install-dpm/install-dpm.sh create mode 100644 .github/dependabot.yml create mode 100644 .github/workflows/ci.yml create mode 100644 .github/workflows/fork-policy.yml diff --git a/.circleci/Makefile b/.circleci/Makefile deleted file mode 100644 index 0145efa94..000000000 --- a/.circleci/Makefile +++ /dev/null @@ -1,21 +0,0 @@ -# Copyright (c) 2026, Digital Asset (Switzerland) GmbH and/or its affiliates. All rights reserved. -# SPDX-License-Identifier: 0BSD - -# Set default goal to 'help' if no target is specified -.DEFAULT_GOAL := help - -# Default to using a nix provided CircleCI cli -# Note: this has been done to reduce noise in ../nix/shell.nix as CircleCI CLI is not needed by consumers of QS -CIRCLECI ?= nix run -I nixpkgs=nixpkgs/25.05 --extra-experimental-features 'nix-command flakes' 'nixpkgs\#circleci-cli' -- - -validate-configs: ## validate circleci configurations - cd .. && $(CIRCLECI) config validate - cd .. && $(CIRCLECI) config validate .circleci/workflow_config.yml - -# Help target -.PHONY: help -help: ## Show this help message - @echo "Usage: make [target]" - @echo - @echo "Available targets:" - @grep -E '^(# )?[a-zA-Z_-]+:.*?## .*$$' Makefile | sed -e 's/^# //' | awk 'BEGIN {FS = ":.*?## "}; {printf " %-20s %s\n", $$1, $$2}' diff --git a/.circleci/config.yml b/.circleci/config.yml deleted file mode 100644 index de19e8790..000000000 --- a/.circleci/config.yml +++ /dev/null @@ -1,23 +0,0 @@ -version: 2.1 - -# enable setup dynamic configuration: -setup: true - -# use the path-filtering orb to control jobs based on the path of an updated set of files -# https://circleci.com/developer/orbs/orb/circleci/path-filtering -orbs: - path-filtering: circleci/path-filtering@2.0.4 - -workflows: - setup: - jobs: - - path-filtering/filter: - base-revision: main - name: check-updated-files - # mapping structure: - mapping: | - .* shared_enabled true .circleci/configs/workflow_shared.yml - .* run-integration-test true .circleci/configs/workflow_test.yml - (sdk/.*|.circleci/configs/workflow_docs.yml) run-docs-validation true .circleci/configs/workflow_docs.yml - # this is the path of the configuration we should trigger once path filtering complete. - config-path: .circleci/continue_config.yml diff --git a/.circleci/configs/workflow_docs.yml b/.circleci/configs/workflow_docs.yml deleted file mode 100644 index e03ceb232..000000000 --- a/.circleci/configs/workflow_docs.yml +++ /dev/null @@ -1,59 +0,0 @@ -# Copyright (c) 2026, Digital Asset (Switzerland) GmbH and/or its affiliates. All rights reserved. -# SPDX-License-Identifier: Apache-2.0 - -version: 2.1 - -# the default pipeline parameters, which will be updated according to the results of the path-filtering orb in setup: -parameters: - run-docs-validation: - type: boolean - default: false - -commands: - docs: - parameters: - command: - type: string - description: command to run in docs directory - default: '' - steps: - - run: - name: docs/<< parameters.command >> - command: | - cd sdk \ - && << parameters.command >> - - docs-setup: - steps: - - restore_cache: - name: venv restore cache - keys: - - venv-qs-{{ checksum "./sdk/poetry.lock" }}-{{ checksum "./sdk/pyproject.toml"}}-{{ checksum "./sdk/Makefile" }} - - docs: - command: make poetry-install - - save_cache: - name: venv save cache - key: venv-qs-{{ checksum "./sdk/poetry.lock" }}-{{ checksum "./sdk/pyproject.toml"}}-{{ checksum "./sdk/Makefile" }} - paths: - - ./sdk/.venv/ - - -jobs: - validate-documentation: - resource_class: small - machine: - image: ubuntu-2404:2024.11.1 - steps: - - checkout - - nix - - docs-setup - - docs: - command: make render-preview - - - -workflows: - documentation: - when: << pipeline.parameters.run-docs-validation >> - jobs: - - validate-documentation diff --git a/.circleci/configs/workflow_shared.yml b/.circleci/configs/workflow_shared.yml deleted file mode 100644 index 6d8772820..000000000 --- a/.circleci/configs/workflow_shared.yml +++ /dev/null @@ -1,36 +0,0 @@ -# Copyright (c) 2026, Digital Asset (Switzerland) GmbH and/or its affiliates. All rights reserved. -# SPDX-License-Identifier: Apache-2.0 - -version: 2.1 - -# the default pipeline parameters, which will be updated according to the results of the path-filtering orb in setup: -parameters: - shared_enabled: - type: boolean - default: true - -commands: - nix: - steps: - - run: - name: Nix preparation - command: .circleci/scripts/nix_prep.sh - - restore_cache: - name: Nix restore cache - keys: - - nix-qs-{{ checksum "/home/circleci/nix/cache-keys/orb-version" }}-{{ checksum "/home/circleci/nix/cache-keys/nix-checksums" }} - - nix-qs-{{ checksum "/home/circleci/nix/cache-keys/orb-version" }} - - run: - name: Nix Setup - command: .circleci/scripts/nix_setup.sh - - save_cache: - name: Nix save cache - key: nix-qs-{{ checksum "/home/circleci/nix/cache-keys/orb-version" }}-{{ checksum "/home/circleci/nix/cache-keys/nix-checksums" }} - paths: - - /home/circleci/.config/nix - - /home/circleci/.local/state - - /home/circleci/.nix-bashrc - - /home/circleci/.nix-channels - - /home/circleci/.nix-defexpr - - /home/circleci/.nix-profile - - /nix diff --git a/.circleci/configs/workflow_test.yml b/.circleci/configs/workflow_test.yml deleted file mode 100644 index 301d936b9..000000000 --- a/.circleci/configs/workflow_test.yml +++ /dev/null @@ -1,76 +0,0 @@ -# Copyright (c) 2026, Digital Asset (Switzerland) GmbH and/or its affiliates. All rights reserved. -# SPDX-License-Identifier: Apache-2.0 - -version: 2.1 - -# the default pipeline parameters, which will be updated according to the results of the path-filtering orb in setup: -parameters: - run-integration-test: - type: boolean - default: false - -commands: - quickstart: - parameters: - command: - type: string - description: command to run in quickstart directory - default: '' - steps: - - run: - name: quickstart/<< parameters.command >> - command: | - cd quickstart \ - && << parameters.command >> - -jobs: - integration-test: - resource_class: xlarge - machine: - image: ubuntu-2404:2024.11.1 - environment: - - PLAYWRIGHT_SKIP_VALIDATE_HOST_REQUIREMENTS: true - # After installing browser libraries, we need to ensure that the executor is able to perform an automatic/non-interactive restart: - - NEEDRESTART_MODE: a - - DEBIAN_FRONTEND: noninteractive - # Disable ANSI output for docker compose to reduce noise in output: - - COMPOSE_ANSI: never - - COMPOSE_PROGRESS: plain - steps: - - checkout - - nix - - quickstart: - command: make help - - quickstart: - command: make ci-create-env-local - - run: - name: add /home/circleci/.daml/bin to $PATH - command: echo 'export PATH=/home/circleci/.daml/bin:${PATH}' >> $BASH_ENV - - quickstart: - command: make ci-install-playwright - - quickstart: - command: make build - - quickstart: - command: make test-daml - - quickstart: - command: make start - - quickstart: - command: make integration-test - - store_test_results: - path: quickstart/integration-test/results.xml - - store_artifacts: - when: always - path: quickstart/integration-test/playwright-report/ - destination: playwright-report - - store_artifacts: - when: always - path: quickstart/integration-test/test-results/ - destination: test-results - -workflows: - integration-test: - when: << pipeline.parameters.run-integration-test >> - jobs: - - integration-test: - context: - - artifactory-readonly diff --git a/.circleci/scripts/nix_prep.sh b/.circleci/scripts/nix_prep.sh deleted file mode 100755 index 1c2b11a16..000000000 --- a/.circleci/scripts/nix_prep.sh +++ /dev/null @@ -1,40 +0,0 @@ -#!/usr/bin/env bash -set -euo pipefail - -function main() ( - set -euo pipefail - - local orb_version="$1" - - # directories to create - local dirs=( - /home/circleci/nix/cache-keys - /nix - ) - - # directories / files to own - local own=( - /home/circleci/nix - /nix - ) - - # create directories - echo 'Creating nix directories' - mkdir -vp "${dirs[@]}" - - # write checksum files - echo 'Writing checksum files' - git ls-files --error-unmatch --full-name -s -- *.nix flake.lock ./nix | tee "/home/circleci/nix/cache-keys/nix-checksums" - tee "/home/circleci/nix/cache-keys/orb-version" <<<"${orb_version}" - - # fix ownerships - echo 'Fixing ownership' - chown -vR circleci:circleci "${own[@]}" -) - -# always run as root -if [ ${EUID} == 0 ]; then - main "${ORB_VERSION:-}" -else - sudo bash -c "$(declare -f main); main \"${ORB_VERSION:-}\"" -fi \ No newline at end of file diff --git a/.circleci/scripts/nix_setup.sh b/.circleci/scripts/nix_setup.sh deleted file mode 100755 index 0e7a56e7d..000000000 --- a/.circleci/scripts/nix_setup.sh +++ /dev/null @@ -1,79 +0,0 @@ -#!/usr/bin/env bash -set -euo pipefail - -export USER='circleci' -export HOME='/home/circleci' - -nix_version='2.24.10' -nix_config="${HOME}/.config/nix" -nix_profile="${HOME}/.nix-profile/etc/profile.d/nix.sh" -nix_env="${HOME}/.nix-bashrc" - -actual_cache_keys="${nix_config}/cache-keys" -expected_cache_keys="${HOME}/nix/cache-keys" - -# CircleCI automatically runs the bash script at BASH_ENV before any run command; -# copy our nix environment setup file to this path so that we can take advantage -# of this behavior. -# -# BASH_ENV is actually located in a /tmp, so we must always write this file no matter -# the cache state. -echo "Appending ${BASH_ENV} file..." -echo "source ${nix_profile}" >>"${BASH_ENV}" -echo "source ${nix_env}" >>"${BASH_ENV}" - -# check cache state to see if nix need to be setup -echo "Checking cache..." -if diff -ur --color=always "${actual_cache_keys}" "${expected_cache_keys}"; then - echo "Cache is up to date, skipping setup" - exit -fi -echo "Cache is outdated, setting up nix environment..." - -# loads the nix profile if it exists -function load_nix_profile() { - if [ ! -f "${nix_profile}" ]; then - echo "No nix profile" - return 1 - fi - - # shellcheck disable=SC1090 - source "${nix_profile}" - echo "Nix profile loaded" -} - -# config file -echo "Writing nix.conf file..." -mkdir -p "${nix_config}" -tee "${nix_config}/nix.conf" <"${nix_env}" - -# clean up -echo "Garbage collecting to reduce cache size..." -nix-store --gc - -# CircleCI's will attempt (and fail) to cache this socket if we leave it around -echo "Removing nix socket..." -rm -f /nix/var/nix/gc-socket/socket - -# copy the cache keys into the cache -echo "Nix is set up, copying cache keys..." -cp -vr "${expected_cache_keys}" "${actual_cache_keys}" \ No newline at end of file diff --git a/.github/actions/daml/test/action.yml b/.github/actions/daml/test/action.yml new file mode 100644 index 000000000..59153b216 --- /dev/null +++ b/.github/actions/daml/test/action.yml @@ -0,0 +1,24 @@ +# Copyright (c) 2026, Digital Asset (Switzerland) GmbH and/or its affiliates. All rights reserved. +# SPDX-License-Identifier: 0BSD + +name: Daml test +description: >- + Installs dpm and JDK 21, then builds and tests the Daml packages through + Gradle (`make test-daml`). + +runs: + using: composite + steps: + - uses: ./.github/actions/setup/install-dpm + - uses: actions/setup-java@d1374f8ac74474200d16ef8ecee22c7ae7a51880 # v6.3.0 + with: + distribution: temurin + java-version: '21' + cache: gradle + cache-dependency-path: | + quickstart/**/*.gradle* + quickstart/**/*.gradle.kts + quickstart/**/gradle-wrapper.properties + - shell: bash + working-directory: quickstart + run: make test-daml diff --git a/.github/actions/docs/preview/action.yml b/.github/actions/docs/preview/action.yml new file mode 100644 index 000000000..02e0faa95 --- /dev/null +++ b/.github/actions/docs/preview/action.yml @@ -0,0 +1,26 @@ +# Copyright (c) 2026, Digital Asset (Switzerland) GmbH and/or its affiliates. All rights reserved. +# SPDX-License-Identifier: 0BSD + +name: Docs preview +description: >- + Installs Python 3.11 and Poetry, restores sdk/.venv, and renders the + Sphinx preview. + +runs: + using: composite + steps: + - uses: actions/setup-python@6d4fd22b20465ccc0f7354476588e8df7c9ca0e0 # v7.1.0 + id: python + with: + python-version: '3.11' + - name: Install Poetry + shell: bash + run: python -m pip install --disable-pip-version-check poetry==2.5.1 + - uses: actions/cache@55cc8345863c7cc4c66a329aec7e433d2d1c52a9 # v6.1.0 + with: + path: sdk/.venv + key: venv-py${{ steps.python.outputs.python-version }}-${{ runner.os }}-${{ hashFiles('sdk/poetry.lock', 'sdk/pyproject.toml', 'sdk/Makefile') }} + - name: Render preview + shell: bash + working-directory: sdk + run: make render-preview diff --git a/.github/actions/frontend-build/action.yml b/.github/actions/frontend-build/action.yml new file mode 100644 index 000000000..8bba46f1c --- /dev/null +++ b/.github/actions/frontend-build/action.yml @@ -0,0 +1,21 @@ +# Copyright (c) 2026, Digital Asset (Switzerland) GmbH and/or its affiliates. All rights reserved. +# SPDX-License-Identifier: 0BSD + +name: Frontend build +description: >- + Installs the frontend dependencies with npm ci and builds the Vite bundle. + +runs: + using: composite + steps: + - uses: actions/setup-node@949feb2413d6458794dcd2491c4babbbce0c15c1 # v7.1.0 + with: + node-version: '20' + cache: npm + cache-dependency-path: quickstart/frontend/package-lock.json + - shell: bash + working-directory: quickstart/frontend + run: npm ci + - shell: bash + working-directory: quickstart/frontend + run: npm run build diff --git a/.github/actions/integration/test/action.yml b/.github/actions/integration/test/action.yml new file mode 100644 index 000000000..794f04b88 --- /dev/null +++ b/.github/actions/integration/test/action.yml @@ -0,0 +1,93 @@ +# Copyright (c) 2026, Digital Asset (Switzerland) GmbH and/or its affiliates. All rights reserved. +# SPDX-License-Identifier: 0BSD + +name: Integration test +description: >- + Boots LocalNet and runs the Playwright licensing suite. Uploads the + Playwright report on every run, and Compose logs when a step fails. + The JUnit check run is skipped for fork pull requests, because that + token cannot write checks. There is no registry login. + +inputs: + is-fork-pr: + description: >- + True when this is a pull request from a fork. Skips steps that need + a token with write access, including the JUnit check run. + required: true + +runs: + using: composite + steps: + - name: Free disk space + shell: bash + run: | + sudo rm -rf /usr/share/dotnet /usr/local/lib/android /opt/ghc /opt/hostedtoolcache/CodeQL + df -h / + - uses: actions/setup-java@d1374f8ac74474200d16ef8ecee22c7ae7a51880 # v6.3.0 + with: + distribution: temurin + java-version: '21' + cache: gradle + cache-dependency-path: | + quickstart/**/*.gradle* + quickstart/**/*.gradle.kts + quickstart/**/gradle-wrapper.properties + - uses: actions/setup-node@949feb2413d6458794dcd2491c4babbbce0c15c1 # v7.1.0 + with: + node-version: '20' + cache: npm + cache-dependency-path: | + quickstart/frontend/package-lock.json + quickstart/integration-test/package-lock.json + - uses: ./.github/actions/setup/install-dpm + - name: Configure Quickstart + shell: bash + working-directory: quickstart + run: make ci-create-env-local + - name: Install Playwright + shell: bash + working-directory: quickstart + run: make ci-install-playwright + - name: Build + shell: bash + working-directory: quickstart + run: make build + - name: Start + shell: bash + working-directory: quickstart + run: make start + - name: Integration test + shell: bash + working-directory: quickstart + run: make integration-test + - name: Capture compose logs + if: failure() + shell: bash + working-directory: quickstart + run: make logs > "${RUNNER_TEMP}/compose-logs.txt" || true + - uses: actions/upload-artifact@cf430e030ddbb5b0abf93d22962f4752f3646cd9 # v7.0.2 + if: failure() + with: + name: compose-logs + path: ${{ runner.temp }}/compose-logs.txt + if-no-files-found: ignore + - uses: actions/upload-artifact@cf430e030ddbb5b0abf93d22962f4752f3646cd9 # v7.0.2 + if: always() + with: + name: playwright-report + path: quickstart/integration-test/playwright-report/ + if-no-files-found: ignore + - uses: actions/upload-artifact@cf430e030ddbb5b0abf93d22962f4752f3646cd9 # v7.0.2 + if: always() + with: + name: playwright-results + path: | + quickstart/integration-test/test-results/ + quickstart/integration-test/results.xml + if-no-files-found: ignore + - uses: dorny/test-reporter@d1b5dff021aa968b288b02285a8bf47471c5928a # v3.2.0 + if: always() && inputs.is-fork-pr != 'true' && hashFiles('quickstart/integration-test/results.xml') != '' + with: + name: Integration tests + path: quickstart/integration-test/results.xml + reporter: java-junit diff --git a/.github/actions/setup/install-dpm/action.yml b/.github/actions/setup/install-dpm/action.yml new file mode 100644 index 000000000..55caade8b --- /dev/null +++ b/.github/actions/setup/install-dpm/action.yml @@ -0,0 +1,13 @@ +# Copyright (c) 2026, Digital Asset (Switzerland) GmbH and/or its affiliates. All rights reserved. +# SPDX-License-Identifier: 0BSD + +name: Install dpm +description: >- + Installs dpm 3.6.3 for the rest of the job and exports DPM_HOME, + DPM_SDK_VERSION, and PATH. The install is removed when the job ends. + +runs: + using: composite + steps: + - shell: bash + run: bash "${GITHUB_ACTION_PATH}/install-dpm.sh" diff --git a/.github/actions/setup/install-dpm/install-dpm.sh b/.github/actions/setup/install-dpm/install-dpm.sh new file mode 100755 index 000000000..038c6a21e --- /dev/null +++ b/.github/actions/setup/install-dpm/install-dpm.sh @@ -0,0 +1,101 @@ +#!/usr/bin/env bash +# Copyright (c) 2026, Digital Asset (Switzerland) GmbH and/or its affiliates. All rights reserved. +# SPDX-License-Identifier: 0BSD + +# Installs dpm 3.6.3 under RUNNER_TEMP and exports DPM_HOME, DPM_SDK_VERSION +# and PATH for the rest of the job. +# +# The tarball is the one nix/dpm.nix fetches. expected_dpm_sha256 is the +# x86_64-linux hash in that file (sha256:0m1a3y2cc6z35aj1x3i5w0i1vlqcy5iywmk93lf2hkkvrq3g596d) +# converted to hex. Keep the two in lockstep when bumping the version. +# +# 3.6.3's sdk-manifest.yaml names components codegen and canton-open-source. +# nix/dpm.nix still selects codegen-js, codegen-java and canton-enterprise, +# which this manifest does not contain. The trim below keeps the components +# the quickstart build actually runs: damlc, daml-script, codegen and +# upgrade-check. Canton comes from the published Docker images, so the +# open-source Canton component is left out. +# +# After bootstrap, script-service.jar is linked into damlc's resources +# directory. Component directories use the component version (damlc and +# daml-script are 3.6.2 inside the 3.6.3 SDK). damlc-dist-dpm/lib/resources +# is a symlink to damlc-dist-dpm/resources, which is where damlc looks. + +set -euo pipefail + +version='3.6.3' +yq_version='v4.47.1' +dest="${RUNNER_TEMP}/dpm" +yq="${RUNNER_TEMP}/yq" + +expected_dpm_sha256='cda4f206ce7b4e281c1d6956ee63f10cd31d22e0258e1ea42ae31bc6841f2a54' +# Published checksum for mikefarah/yq v4.47.1, linux amd64. +expected_yq_sha256='0fb28c6680193c41b364193d0c0fc4a03177aecde51cfc04d506b1517158c2fb' + +mkdir -p "${dest}" +curl -fsSL -o "${dest}/dpm.tar.gz" \ + "https://get.digitalasset.com/install/dpm-sdk/dpm-${version}-linux-amd64.tar.gz" +echo "${expected_dpm_sha256} ${dest}/dpm.tar.gz" | sha256sum -c - +tar --strip-components=1 -C "${dest}" -xzf "${dest}/dpm.tar.gz" +rm "${dest}/dpm.tar.gz" + +curl -fsSL -o "${yq}" \ + "https://github.com/mikefarah/yq/releases/download/${yq_version}/yq_linux_amd64" +echo "${expected_yq_sha256} ${yq}" | sha256sum -c - +chmod +x "${yq}" + +required_components=(damlc daml-script codegen upgrade-check) +for key in "${required_components[@]}"; do + if ! "${yq}" -e ".spec.components | has(\"${key}\")" "${dest}/sdk-manifest.yaml" >/dev/null; then + echo "sdk-manifest.yaml for dpm ${version} is missing component ${key}." >&2 + exit 1 + fi +done + +"${yq}" --inplace \ + '.spec.components |= with_entries( + select( .key == "damlc" + or .key == "daml-script" + or .key == "codegen" + or .key == "upgrade-check" + ) + )' \ + "${dest}/sdk-manifest.yaml" + +DPM_HOME="${dest}" "${dest}/bin/dpm" bootstrap "${dest}" + +# The bundled registry is only needed for bootstrap. +rm -rf "${dest}/oci-registry" "${dest}/cache/oci-layout" + +shopt -s nullglob +jars=("${dest}/cache/components/daml-script/"*/script-service.jar) +if [ "${#jars[@]}" -eq 0 ] || [ ! -f "${jars[0]}" ]; then + echo "script-service.jar not found under daml-script components" >&2 + exit 1 +fi +script_jar="${jars[0]}" + +linked=0 +for damlc_dir in "${dest}/cache/components/damlc/"*/damlc-dist-dpm; do + if [ ! -d "${damlc_dir}" ]; then + continue + fi + # lib/resources symlinks to ../resources on the 3.6.3 SDK. + mkdir -p "${damlc_dir}/lib/resources" + ln -sfn "${script_jar}" "${damlc_dir}/lib/resources/script-service.jar" + if [ ! -f "${damlc_dir}/lib/resources/script-service.jar" ]; then + echo "failed to link script-service.jar into ${damlc_dir}/lib/resources" >&2 + exit 1 + fi + linked=1 +done +if [ "${linked}" -ne 1 ]; then + echo "damlc resources directory not found; cannot link script-service.jar" >&2 + exit 1 +fi + +echo "${dest}/bin" >> "${GITHUB_PATH}" +{ + echo "DPM_HOME=${dest}" + echo "DPM_SDK_VERSION=${version}" +} >> "${GITHUB_ENV}" diff --git a/.github/dependabot.yml b/.github/dependabot.yml new file mode 100644 index 000000000..618348ad5 --- /dev/null +++ b/.github/dependabot.yml @@ -0,0 +1,9 @@ +# Copyright (c) 2026, Digital Asset (Switzerland) GmbH and/or its affiliates. All rights reserved. +# SPDX-License-Identifier: 0BSD + +version: 2 +updates: + - package-ecosystem: github-actions + directory: / + schedule: + interval: weekly diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml new file mode 100644 index 000000000..e19334118 --- /dev/null +++ b/.github/workflows/ci.yml @@ -0,0 +1,161 @@ +# Copyright (c) 2026, Digital Asset (Switzerland) GmbH and/or its affiliates. All rights reserved. +# SPDX-License-Identifier: 0BSD + +# One required check: "CI / All checks", the display name of the `ci-ok` job. +# It fails when any job it needs failed or was cancelled. A skipped job +# counts as success. +# +# Job steps live in .github/actions, grouped by category. This file keeps +# the triggers, the path filters, and the runner settings. + +name: CI + +on: + pull_request: + branches: [main] + push: + branches: [main] + workflow_dispatch: + +permissions: + contents: read + +# A pull request shares one group, so a new commit cancels the run still +# going and only the latest commit is checked. A push to main, and a manual +# run, uses the commit SHA: every commit is checked, and a later commit +# leaves the earlier run alone. A shared group would drop queued main runs +# even with cancel-in-progress set to false. +concurrency: + group: ${{ github.event_name == 'pull_request' && format('ci-{0}', github.ref) || format('ci-{0}', github.sha) }} + cancel-in-progress: ${{ github.event_name == 'pull_request' }} + +env: + # Fork pull requests receive a read-only token, so they cannot publish + # check runs. Same-repository pull requests, pushes and manual runs are + # not forks. There is no registry login in this workflow; a later one + # that needs secrets must be skipped when this is true. + IS_FORK_PR: ${{ github.event_name == 'pull_request' && github.event.pull_request.head.repo.full_name != github.event.pull_request.base.repo.full_name }} + +jobs: + changes: + name: Detect changes + runs-on: ubuntu-latest + permissions: + contents: read + pull-requests: read + outputs: + daml: ${{ steps.resolve.outputs.daml }} + docs: ${{ steps.resolve.outputs.docs }} + frontend: ${{ steps.resolve.outputs.frontend }} + steps: + - uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1 + - uses: dorny/paths-filter@ceb8a2b8f2d89434be7ff52d3de7ec3738c5cc9d # v4.0.3 + id: filter + if: github.event_name == 'pull_request' + with: + token: ${{ github.token }} + filters: | + daml: + - 'quickstart/daml/**' + - 'quickstart/Makefile' + - 'quickstart/build.gradle.kts' + - 'quickstart/settings.gradle.kts' + - 'quickstart/gradle.properties' + - 'quickstart/gradlew' + - 'quickstart/gradlew.bat' + - 'quickstart/gradle/**' + - 'quickstart/buildSrc/**' + - '.github/actions/daml/**' + - '.github/actions/setup/install-dpm/**' + - '.github/workflows/ci.yml' + docs: + - 'sdk/**' + - '.github/actions/docs/**' + - '.github/workflows/ci.yml' + frontend: + - 'quickstart/frontend/**' + - '.github/actions/frontend-build/**' + - '.github/workflows/ci.yml' + - id: resolve + env: + EVENT_NAME: ${{ github.event_name }} + DAML: ${{ steps.filter.outputs.daml }} + DOCS: ${{ steps.filter.outputs.docs }} + FRONTEND: ${{ steps.filter.outputs.frontend }} + run: | + if [ "${EVENT_NAME}" != "pull_request" ]; then + { + echo "daml=true" + echo "docs=true" + echo "frontend=true" + } >> "${GITHUB_OUTPUT}" + else + { + echo "daml=${DAML}" + echo "docs=${DOCS}" + echo "frontend=${FRONTEND}" + } >> "${GITHUB_OUTPUT}" + fi + + daml: + name: Daml tests + needs: [changes] + if: needs.changes.outputs.daml == 'true' + runs-on: ubuntu-latest + timeout-minutes: 30 + steps: + - uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1 + - uses: ./.github/actions/daml/test + + docs: + name: Docs preview + needs: [changes] + if: needs.changes.outputs.docs == 'true' + runs-on: ubuntu-latest + timeout-minutes: 20 + steps: + - uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1 + - uses: ./.github/actions/docs/preview + + frontend-build: + name: Frontend build + needs: [changes] + if: needs.changes.outputs.frontend == 'true' + runs-on: ubuntu-latest + timeout-minutes: 15 + steps: + - uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1 + - uses: ./.github/actions/frontend-build + + integration-test: + name: Integration tests + runs-on: ubuntu-latest + timeout-minutes: 120 + permissions: + contents: read + checks: write + env: + COMPOSE_ANSI: never + COMPOSE_PROGRESS: plain + DEBIAN_FRONTEND: noninteractive + NEEDRESTART_MODE: a + PLAYWRIGHT_SKIP_VALIDATE_HOST_REQUIREMENTS: true + steps: + - uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1 + - uses: ./.github/actions/integration/test + with: + is-fork-pr: ${{ env.IS_FORK_PR }} + + ci-ok: + name: All checks + needs: [changes, daml, docs, frontend-build, integration-test] + if: always() + runs-on: ubuntu-latest + steps: + - name: Report results + env: + NEEDS: ${{ toJSON(needs) }} + run: printf '%s\n' "$NEEDS" + - name: Require every job to succeed or be skipped + if: contains(needs.*.result, 'failure') || contains(needs.*.result, 'cancelled') + run: exit 1 diff --git a/.github/workflows/fork-policy.yml b/.github/workflows/fork-policy.yml new file mode 100644 index 000000000..7d2945e05 --- /dev/null +++ b/.github/workflows/fork-policy.yml @@ -0,0 +1,112 @@ +# Copyright (c) 2026, Digital Asset (Switzerland) GmbH and/or its affiliates. All rights reserved. +# SPDX-License-Identifier: 0BSD + +# Flags workflow and lockfile edits for review. Neither job fails for those +# edits, and neither is a required check. +# +# The pull_request job lints the workflow files in the pull request. For a +# fork, it also annotates sensitive paths. +# +# The pull_request_target job does the same file check through the API and +# posts the list as a pull request comment. It must not check out the head: +# pull_request_target runs with the base repository token. + +name: Fork policy + +on: + pull_request: + pull_request_target: + +permissions: + contents: read + +concurrency: + group: fork-policy-${{ github.event_name }}-${{ github.event.pull_request.number }} + cancel-in-progress: true + +jobs: + actionlint: + name: Actionlint + if: github.event_name == 'pull_request' + runs-on: ubuntu-latest + permissions: + contents: read + pull-requests: read + steps: + - uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1 + - name: Lint workflow files + uses: raven-actions/actionlint@3d39aea434753780c3b3d4a1a31c854b4dbf49d7 # v2.2.0 + - name: Flag workflow and lockfile changes from a fork + if: github.event.pull_request.head.repo.full_name != github.event.pull_request.base.repo.full_name + env: + GH_TOKEN: ${{ github.token }} + REPO: ${{ github.repository }} + PR: ${{ github.event.pull_request.number }} + run: | + set -euo pipefail + files="$(gh api --paginate "repos/${REPO}/pulls/${PR}/files" --jq '.[] | .filename, (.previous_filename // empty)' | awk 'NF && !seen[$0]++')" + pattern='^(\.github/|(.*/)?(package-lock\.json|poetry\.lock|pyproject\.toml|flake\.lock|gradle/libs\.versions\.toml|gradle-wrapper\.properties)$|.*\.gradle\.kts$)' + flagged="$(printf '%s\n' "${files}" | grep -E "${pattern}" || true)" + if [ -z "${flagged}" ]; then + exit 0 + fi + while IFS= read -r file; do + [ -z "${file}" ] && continue + if [[ "${file}" != *[,:]* ]]; then + echo "::warning file=${file},title=Fork review::Workflow or lockfile change from a fork needs a maintainer review." + else + echo "::warning title=Fork review::${file} needs a maintainer review." + fi + done <<< "${flagged}" + + flag-sensitive-files: + name: Flag sensitive files + if: github.event_name == 'pull_request_target' + runs-on: ubuntu-latest + permissions: + pull-requests: write + steps: + # Do not check out the pull request. The file list comes from the API. + - name: Comment on workflow and lockfile changes + env: + GH_TOKEN: ${{ github.token }} + REPO: ${{ github.repository }} + PR: ${{ github.event.pull_request.number }} + run: | + set -euo pipefail + files="$(gh api --paginate "repos/${REPO}/pulls/${PR}/files" --jq '.[] | .filename, (.previous_filename // empty)' | awk 'NF && !seen[$0]++')" + pattern='^(\.github/|(.*/)?(package-lock\.json|poetry\.lock|pyproject\.toml|flake\.lock|gradle/libs\.versions\.toml|gradle-wrapper\.properties)$|.*\.gradle\.kts$)' + flagged="$(printf '%s\n' "${files}" | grep -E "${pattern}" || true)" + marker='' + # One id per page. Keep the first without closing the API stream early. + comment_ids="$(gh api --paginate "repos/${REPO}/issues/${PR}/comments" \ + --jq "[.[] | select(.user.login == \"github-actions[bot]\") | select(.body | contains(\"${marker}\")) | .id] | .[0] // empty")" + comment_id="$(printf '%s\n' "${comment_ids}" | awk 'NF { print; exit }')" + + if [ -z "${flagged}" ]; then + if [ -n "${comment_id}" ]; then + gh api -X PATCH "repos/${REPO}/issues/comments/${comment_id}" \ + -f body="$(printf '%s\n' "${marker}" "" "The earlier workflow or lockfile changes are no longer in this pull request.")" + fi + exit 0 + fi + + body_file="${RUNNER_TEMP}/fork-policy-comment.md" + { + printf '%s\n\n' "${marker}" + echo "### Workflow and lockfile changes" + echo + echo "This pull request changes GitHub Actions files or dependency lockfiles. A maintainer should review them. This check does not fail the pull request." + echo + echo '```text' + printf '%s\n' "${flagged}" + echo '```' + } > "${body_file}" + + if [ -n "${comment_id}" ]; then + gh api -X PATCH "repos/${REPO}/issues/comments/${comment_id}" \ + -f body="$(cat "${body_file}")" + else + gh api -X POST "repos/${REPO}/issues/${PR}/comments" \ + -f body="$(cat "${body_file}")" + fi diff --git a/nix/shell.nix b/nix/shell.nix index 3797c1115..7804de074 100644 --- a/nix/shell.nix +++ b/nix/shell.nix @@ -9,7 +9,6 @@ let nodejs_20 typescript ] ++ (if ci then [ # these packages should only be installed on CI - circleci-cli docutils poetry python3 diff --git a/quickstart/Makefile b/quickstart/Makefile index c310a5931..ebeb0d0a4 100644 --- a/quickstart/Makefile +++ b/quickstart/Makefile @@ -446,7 +446,7 @@ ifeq ($(CI),true) ci-create-env-local: echo "OBSERVABILITY_ENABLED=true" > .env.local echo "AUTH_MODE=oauth2" >> .env.local - echo "PARTY_HINT=quickstart-circleci-1" >> .env.local + echo "PARTY_HINT=quickstart-ci-1" >> .env.local echo "TEST_MODE=on" >> .env.local # Install playwright dependencies in CI/CD diff --git a/quickstart/integration-test/package-lock.json b/quickstart/integration-test/package-lock.json index 9d23a195c..a576d4e72 100644 --- a/quickstart/integration-test/package-lock.json +++ b/quickstart/integration-test/package-lock.json @@ -12,24 +12,24 @@ "dotenv": "^16.6.1" }, "devDependencies": { - "@playwright/test": "^1.59.1", + "@playwright/test": "^1.63.0", "@types/node": "^22.19.17" } }, "node_modules/@playwright/test": { - "version": "1.59.1", - "resolved": "https://registry.npmjs.org/@playwright/test/-/test-1.59.1.tgz", - "integrity": "sha512-PG6q63nQg5c9rIi4/Z5lR5IVF7yU5MqmKaPOe0HSc0O2cX1fPi96sUQu5j7eo4gKCkB2AnNGoWt7y4/Xx3Kcqg==", + "version": "1.63.0", + "resolved": "https://registry.npmjs.org/@playwright/test/-/test-1.63.0.tgz", + "integrity": "sha512-oxMK4vllB9RK5NQ2l1pq1IfOf2AvnEuj/vYGDj0H2nMtmtZpKtCwt/l00GEO6xjGfpBNAvjovvYdCm50dRQkpQ==", "dev": true, "license": "Apache-2.0", "dependencies": { - "playwright": "1.59.1" + "playwright": "1.63.0" }, "bin": { "playwright": "cli.js" }, "engines": { - "node": ">=18" + "node": ">=20" } }, "node_modules/@types/node": { @@ -54,51 +54,33 @@ "url": "https://dotenvx.com" } }, - "node_modules/fsevents": { - "version": "2.3.2", - "resolved": "https://registry.npmjs.org/fsevents/-/fsevents-2.3.2.tgz", - "integrity": "sha512-xiqMQR4xAeHTuB9uWm+fFRcIOgKBMiOBP+eXiyT7jsgVCq1bkVygt00oASowB7EdtpOHaaPgKt812P9ab+DDKA==", - "dev": true, - "hasInstallScript": true, - "license": "MIT", - "optional": true, - "os": [ - "darwin" - ], - "engines": { - "node": "^8.16.0 || ^10.6.0 || >=11.0.0" - } - }, "node_modules/playwright": { - "version": "1.59.1", - "resolved": "https://registry.npmjs.org/playwright/-/playwright-1.59.1.tgz", - "integrity": "sha512-C8oWjPR3F81yljW9o5OxcWzfh6avkVwDD2VYdwIGqTkl+OGFISgypqzfu7dOe4QNLL2aqcWBmI3PMtLIK233lw==", + "version": "1.63.0", + "resolved": "https://registry.npmjs.org/playwright/-/playwright-1.63.0.tgz", + "integrity": "sha512-+7ziBLidS4NaNCdt57SUDT+wYmmd5fmiQejUic/kb+YsYSCPyOOE9sebzMjNmQrsnNpDJqd4WHvV/8lfKfUDUg==", "dev": true, "license": "Apache-2.0", "dependencies": { - "playwright-core": "1.59.1" + "playwright-core": "1.63.0" }, "bin": { "playwright": "cli.js" }, "engines": { - "node": ">=18" - }, - "optionalDependencies": { - "fsevents": "2.3.2" + "node": ">=20" } }, "node_modules/playwright-core": { - "version": "1.59.1", - "resolved": "https://registry.npmjs.org/playwright-core/-/playwright-core-1.59.1.tgz", - "integrity": "sha512-HBV/RJg81z5BiiZ9yPzIiClYV/QMsDCKUyogwH9p3MCP6IYjUFu/MActgYAvK0oWyV9NlwM3GLBjADyWgydVyg==", + "version": "1.63.0", + "resolved": "https://registry.npmjs.org/playwright-core/-/playwright-core-1.63.0.tgz", + "integrity": "sha512-rYCsBF/M5HjUch52bbtVONEFjv6Xu8sm8h72dNlR5bzIE1fvC/bxgspzkjSfU+MweEMmPM8KJebG6nnyxo5mCg==", "dev": true, "license": "Apache-2.0", "bin": { "playwright-core": "cli.js" }, "engines": { - "node": ">=18" + "node": ">=20" } }, "node_modules/undici-types": { diff --git a/quickstart/integration-test/package.json b/quickstart/integration-test/package.json index a5d6e823d..1b91b2452 100644 --- a/quickstart/integration-test/package.json +++ b/quickstart/integration-test/package.json @@ -10,7 +10,7 @@ "dotenv": "^16.6.1" }, "devDependencies": { - "@playwright/test": "^1.59.1", + "@playwright/test": "^1.63.0", "@types/node": "^22.19.17" } } diff --git a/sdk/Makefile b/sdk/Makefile index 02c3aedd0..801adb2d5 100644 --- a/sdk/Makefile +++ b/sdk/Makefile @@ -16,11 +16,13 @@ VALE_ALERT_LEVEL ?= error ############################################################################### .PHONY: poetry-install -poetry-install: .venv poetry-install: ## use poetry to install python modules - -.venv: - poetry install --no-root + set -e; \ + if [ -x .venv/bin/python ] && .venv/bin/python -c 'import sys' >/dev/null 2>&1; then \ + exit 0; \ + fi; \ + rm -rf .venv; \ + poetry install --no-root; \ poetry debug info .PHONY: clean-venv