@distrohelena/canton-typescript-sdk 0.1.33 → 0.1.35
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +169 -14
- package/dist/cjs/client/external-party-activation-client.js +20 -10
- package/dist/cjs/core/errors/active-contracts-traversal-error.js +12 -0
- package/dist/cjs/core/polling/poll-until-async.js +26 -0
- package/dist/cjs/core/types/active-contracts-traversal-options.js +26 -0
- package/dist/cjs/core/types/command-deduplication-period.js +2 -0
- package/dist/cjs/core/types/operation-deadline.js +42 -0
- package/dist/cjs/core/types/requests/allocate-party-request.js +2 -0
- package/dist/cjs/core/types/requests/finalize-decentralized-party-request.js +6 -0
- package/dist/cjs/core/types/requests/submit-command-request.js +43 -0
- package/dist/cjs/core/types/requests/wait-for-party-hosting-request.js +40 -0
- package/dist/cjs/index.js +13 -27
- package/dist/cjs/query/grpc/grpc-contract-query-client.js +33 -16
- package/dist/cjs/services/party-management/decentralized-party-lifecycle.js +12 -1
- package/dist/cjs/services/party-management/party-management-service-client.js +3 -0
- package/dist/cjs/services/state/state-service-client.js +1 -1
- package/dist/cjs/services/topology-aggregation/topology-aggregation-service-client.js +36 -0
- package/dist/cjs/transports/grpc/grpc-channel-factory.js +5 -7
- package/dist/cjs/transports/grpc/grpc-transport.js +31 -15
- package/dist/cjs/transports/grpc/mappers/command-deduplication-mapper.js +22 -0
- package/dist/cjs/transports/grpc/mappers/commands-mapper.js +3 -4
- package/dist/cjs/transports/grpc/mappers/interactive-command-mapper.js +5 -3
- package/dist/cjs/transports/grpc/mappers/parties-mapper.js +1 -12
- package/dist/cjs/transports/json/mappers/commands-mapper.js +5 -1
- package/dist/cjs/transports/json/mappers/parties-mapper.js +1 -0
- package/dist/client/external-party-activation-client.js +20 -10
- package/dist/client/external-party-activation-response.d.ts +1 -1
- package/dist/core/errors/active-contracts-traversal-error.d.ts +5 -0
- package/dist/core/errors/active-contracts-traversal-error.js +8 -0
- package/dist/core/polling/poll-until-async.d.ts +10 -0
- package/dist/core/polling/poll-until-async.js +23 -0
- package/dist/core/transports/transport.interface.d.ts +11 -3
- package/dist/core/types/active-contracts-traversal-options.d.ts +11 -0
- package/dist/core/types/active-contracts-traversal-options.js +22 -0
- package/dist/core/types/command-deduplication-period.d.ts +7 -0
- package/dist/core/types/command-deduplication-period.js +1 -0
- package/dist/core/types/operation-deadline.d.ts +13 -0
- package/dist/core/types/operation-deadline.js +38 -0
- package/dist/core/types/requests/allocate-party-request.d.ts +2 -0
- package/dist/core/types/requests/allocate-party-request.js +2 -0
- package/dist/core/types/requests/finalize-decentralized-party-request.d.ts +6 -0
- package/dist/core/types/requests/finalize-decentralized-party-request.js +6 -0
- package/dist/core/types/requests/submit-command-request.d.ts +5 -0
- package/dist/core/types/requests/submit-command-request.js +43 -0
- package/dist/core/types/requests/wait-for-party-hosting-request.d.ts +14 -0
- package/dist/core/types/requests/wait-for-party-hosting-request.js +36 -0
- package/dist/index.d.ts +5 -11
- package/dist/index.js +4 -11
- package/dist/query/grpc/grpc-contract-query-client.js +33 -16
- package/dist/services/party-management/decentralized-party-lifecycle.d.ts +1 -1
- package/dist/services/party-management/decentralized-party-lifecycle.js +12 -1
- package/dist/services/party-management/party-management-service-client.js +3 -0
- package/dist/services/state/state-service-client.d.ts +1 -1
- package/dist/services/state/state-service-client.js +1 -1
- package/dist/services/topology-aggregation/topology-aggregation-service-client.d.ts +4 -1
- package/dist/services/topology-aggregation/topology-aggregation-service-client.js +36 -0
- package/dist/services/topology-manager-read/topology-manager-read-service-client.d.ts +3 -1
- package/dist/services/user-management/user-management-service-client.d.ts +7 -1
- package/dist/transports/grpc/grpc-channel-factory.d.ts +0 -1
- package/dist/transports/grpc/grpc-channel-factory.js +5 -7
- package/dist/transports/grpc/grpc-transport.d.ts +10 -3
- package/dist/transports/grpc/grpc-transport.js +31 -15
- package/dist/transports/grpc/mappers/command-deduplication-mapper.d.ts +5 -0
- package/dist/transports/grpc/mappers/command-deduplication-mapper.js +19 -0
- package/dist/transports/grpc/mappers/commands-mapper.js +3 -4
- package/dist/transports/grpc/mappers/interactive-command-mapper.js +5 -3
- package/dist/transports/grpc/mappers/parties-mapper.d.ts +3 -7
- package/dist/transports/grpc/mappers/parties-mapper.js +1 -10
- package/dist/transports/json/json-transport.d.ts +10 -5
- package/dist/transports/json/mappers/commands-mapper.js +5 -1
- package/dist/transports/json/mappers/parties-mapper.d.ts +1 -0
- package/dist/transports/json/mappers/parties-mapper.js +1 -0
- package/node/participant-358-synchronizer.mjs +33 -1
- package/node/start-local-participant-358.sh +33 -3
- package/node/test-participant-358-sidecar.sh +31 -1
- package/package.json +11 -1
- package/dist/cjs/core/types/health-check-status.js +0 -10
- package/dist/cjs/core/types/requests/get-ledger-api-version-request.js +0 -6
- package/dist/cjs/core/types/requests/get-package-references-request.js +0 -10
- package/dist/cjs/core/types/requests/get-participant-id-request.js +0 -7
- package/dist/cjs/core/types/requests/get-participant-status-request.js +0 -6
- package/dist/cjs/core/types/requests/health-check-request.js +0 -10
- package/dist/cjs/core/types/responses/get-ledger-api-version-response.js +0 -12
- package/dist/cjs/core/types/responses/get-package-references-response.js +0 -10
- package/dist/cjs/core/types/responses/get-participant-id-response.js +0 -10
- package/dist/cjs/core/types/responses/get-participant-status-response.js +0 -12
- package/dist/cjs/core/types/responses/health-check-response.js +0 -10
- package/dist/cjs/transports/grpc/mappers/health-mapper.js +0 -24
- package/dist/cjs/transports/grpc/mappers/participant-status-mapper.js +0 -58
- package/dist/core/types/health-check-status.d.ts +0 -6
- package/dist/core/types/health-check-status.js +0 -7
- package/dist/core/types/requests/get-ledger-api-version-request.d.ts +0 -2
- package/dist/core/types/requests/get-ledger-api-version-request.js +0 -2
- package/dist/core/types/requests/get-package-references-request.d.ts +0 -6
- package/dist/core/types/requests/get-package-references-request.js +0 -6
- package/dist/core/types/requests/get-participant-id-request.d.ts +0 -3
- package/dist/core/types/requests/get-participant-id-request.js +0 -3
- package/dist/core/types/requests/get-participant-status-request.d.ts +0 -2
- package/dist/core/types/requests/get-participant-status-request.js +0 -2
- package/dist/core/types/requests/health-check-request.d.ts +0 -6
- package/dist/core/types/requests/health-check-request.js +0 -6
- package/dist/core/types/responses/get-ledger-api-version-response.d.ts +0 -8
- package/dist/core/types/responses/get-ledger-api-version-response.js +0 -8
- package/dist/core/types/responses/get-package-references-response.d.ts +0 -7
- package/dist/core/types/responses/get-package-references-response.js +0 -6
- package/dist/core/types/responses/get-participant-id-response.d.ts +0 -6
- package/dist/core/types/responses/get-participant-id-response.js +0 -6
- package/dist/core/types/responses/get-participant-status-response.d.ts +0 -10
- package/dist/core/types/responses/get-participant-status-response.js +0 -8
- package/dist/core/types/responses/health-check-response.d.ts +0 -7
- package/dist/core/types/responses/health-check-response.js +0 -6
- package/dist/transports/grpc/mappers/health-mapper.d.ts +0 -5
- package/dist/transports/grpc/mappers/health-mapper.js +0 -21
- package/dist/transports/grpc/mappers/participant-status-mapper.d.ts +0 -5
- package/dist/transports/grpc/mappers/participant-status-mapper.js +0 -54
|
@@ -1,8 +1,12 @@
|
|
|
1
1
|
import { ValidationError } from "../../../core/errors/validation-error.js";
|
|
2
2
|
import { SubmitCommandResponse } from "../../../core/types/responses/submit-command-response.js";
|
|
3
3
|
import { SignatureFormat, SigningAlgorithmSpec, } from "../generated/canton/com/daml/ledger/api/v2/crypto.js";
|
|
4
|
+
import { mapGrpcDeduplicationPeriod } from "./command-deduplication-mapper.js";
|
|
4
5
|
import { mapGrpcLedgerCommand } from "./commands-mapper.js";
|
|
5
6
|
export function mapGrpcPrepareSubmissionRequest(request, commandId) {
|
|
7
|
+
mapGrpcDeduplicationPeriod(request.deduplicationPeriod, {
|
|
8
|
+
allowParticipantBegin: false,
|
|
9
|
+
});
|
|
6
10
|
return {
|
|
7
11
|
userId: request.userId ?? "",
|
|
8
12
|
commandId,
|
|
@@ -22,9 +26,7 @@ export function mapGrpcExecuteSubmissionAndWaitRequest(init) {
|
|
|
22
26
|
partySignatures: {
|
|
23
27
|
signatures: init.signerResults.map(({ party, result }) => ({ party, signatures: [mapGrpcSignature(result)] })),
|
|
24
28
|
},
|
|
25
|
-
deduplicationPeriod: {
|
|
26
|
-
oneofKind: undefined,
|
|
27
|
-
},
|
|
29
|
+
deduplicationPeriod: mapGrpcDeduplicationPeriod(init.request.deduplicationPeriod, { allowParticipantBegin: false }),
|
|
28
30
|
submissionId: init.submissionId,
|
|
29
31
|
userId: init.request.userId ?? "",
|
|
30
32
|
hashingSchemeVersion: init.hashingSchemeVersion,
|
|
@@ -1,13 +1,11 @@
|
|
|
1
|
-
import { GetParticipantIdRequest } from "../../../core/types/requests/get-participant-id-request.js";
|
|
2
1
|
import { GetPartiesRequest } from "../../../core/types/requests/get-parties-request.js";
|
|
3
|
-
import {
|
|
2
|
+
import { AllocatePartyRequest as SdkAllocatePartyRequest } from "../../../core/types/requests/allocate-party-request.js";
|
|
4
3
|
import { ListPartiesRequest } from "../../../core/types/requests/list-parties-request.js";
|
|
5
4
|
import { CreatePartyResponse } from "../../../core/types/responses/create-party-response.js";
|
|
6
|
-
import { GetParticipantIdResponse as SdkGetParticipantIdResponse } from "../../../core/types/responses/get-participant-id-response.js";
|
|
7
5
|
import { GetPartiesResponse as SdkGetPartiesResponse } from "../../../core/types/responses/get-parties-response.js";
|
|
8
6
|
import { ListPartiesResponse } from "../../../core/types/responses/list-parties-response.js";
|
|
9
|
-
import { AllocatePartyRequest, AllocatePartyResponse,
|
|
10
|
-
export declare function mapGrpcCreatePartyRequest(request:
|
|
7
|
+
import { AllocatePartyRequest, AllocatePartyResponse, GetPartiesResponse, ListKnownPartiesRequest, ListKnownPartiesResponse } from "../generated/canton/com/daml/ledger/api/v2/admin/party_management_service.js";
|
|
8
|
+
export declare function mapGrpcCreatePartyRequest(request: SdkAllocatePartyRequest): AllocatePartyRequest;
|
|
11
9
|
export declare function mapGrpcCreateParty(payload: {
|
|
12
10
|
identifier?: string;
|
|
13
11
|
partyDetails?: {
|
|
@@ -16,8 +14,6 @@ export declare function mapGrpcCreateParty(payload: {
|
|
|
16
14
|
} | AllocatePartyResponse): CreatePartyResponse;
|
|
17
15
|
export declare function mapGrpcListPartiesRequest(request: ListPartiesRequest): ListKnownPartiesRequest;
|
|
18
16
|
export declare function mapGrpcListParties(payload: ListKnownPartiesResponse): ListPartiesResponse;
|
|
19
|
-
export declare function mapGrpcGetParticipantIdRequest(_request: GetParticipantIdRequest): Record<string, never>;
|
|
20
|
-
export declare function mapGrpcGetParticipantId(payload: Partial<GetParticipantIdResponse>): SdkGetParticipantIdResponse;
|
|
21
17
|
export declare function mapGrpcGetPartiesRequest(request: GetPartiesRequest): {
|
|
22
18
|
parties: string[];
|
|
23
19
|
identityProviderId: string;
|
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import { PartyDetails as SdkPartyDetails } from "../../../core/types/party-details.js";
|
|
2
2
|
import { CreatePartyResponse } from "../../../core/types/responses/create-party-response.js";
|
|
3
|
-
import { GetParticipantIdResponse as SdkGetParticipantIdResponse } from "../../../core/types/responses/get-participant-id-response.js";
|
|
4
3
|
import { GetPartiesResponse as SdkGetPartiesResponse } from "../../../core/types/responses/get-parties-response.js";
|
|
5
4
|
import { ListPartiesResponse } from "../../../core/types/responses/list-parties-response.js";
|
|
6
5
|
export function mapGrpcCreatePartyRequest(request) {
|
|
@@ -8,7 +7,7 @@ export function mapGrpcCreatePartyRequest(request) {
|
|
|
8
7
|
partyIdHint: request.partyIdHint ?? "",
|
|
9
8
|
identityProviderId: "",
|
|
10
9
|
synchronizerId: "",
|
|
11
|
-
userId: "",
|
|
10
|
+
userId: request.userId ?? "",
|
|
12
11
|
};
|
|
13
12
|
}
|
|
14
13
|
export function mapGrpcCreateParty(payload) {
|
|
@@ -37,14 +36,6 @@ export function mapGrpcListParties(payload) {
|
|
|
37
36
|
nextPageToken: payload.nextPageToken || undefined,
|
|
38
37
|
});
|
|
39
38
|
}
|
|
40
|
-
export function mapGrpcGetParticipantIdRequest(_request) {
|
|
41
|
-
return {};
|
|
42
|
-
}
|
|
43
|
-
export function mapGrpcGetParticipantId(payload) {
|
|
44
|
-
return new SdkGetParticipantIdResponse({
|
|
45
|
-
participantId: payload.participantId ?? "",
|
|
46
|
-
});
|
|
47
|
-
}
|
|
48
39
|
export function mapGrpcGetPartiesRequest(request) {
|
|
49
40
|
return {
|
|
50
41
|
parties: [...request.parties],
|
|
@@ -1,18 +1,24 @@
|
|
|
1
1
|
import { AllocatePartyRequest } from "../../core/types/requests/allocate-party-request.js";
|
|
2
2
|
import { GetActiveContractsRequest } from "../../core/types/requests/get-active-contracts-request.js";
|
|
3
|
-
import {
|
|
3
|
+
import { GetUserRequest } from "../../core/types/requests/get-user-request.js";
|
|
4
4
|
import { ListKnownPartiesRequest } from "../../core/types/requests/list-known-parties-request.js";
|
|
5
|
+
import { ListPartyToParticipantRequest } from "../../core/types/requests/list-party-to-participant-request.js";
|
|
6
|
+
import { ListUserRightsRequest } from "../../core/types/requests/list-user-rights-request.js";
|
|
7
|
+
import { ListUsersRequest } from "../../core/types/requests/list-users-request.js";
|
|
5
8
|
import { SubmitCommandRequest } from "../../core/types/requests/submit-command-request.js";
|
|
6
9
|
import { AllocatePartyResponse } from "../../core/types/responses/allocate-party-response.js";
|
|
10
|
+
import { GetUserResponse } from "../../core/types/responses/get-user-response.js";
|
|
11
|
+
import { ListPartyToParticipantResponse } from "../../core/types/responses/list-party-to-participant-response.js";
|
|
12
|
+
import { ListUserRightsResponse } from "../../core/types/responses/list-user-rights-response.js";
|
|
13
|
+
import { ListUsersResponse } from "../../core/types/responses/list-users-response.js";
|
|
7
14
|
import type { ListPartiesRequest as TopologyListPartiesRequest, ListPartiesResponse as TopologyListPartiesResponse, ListKeyOwnersRequest, ListKeyOwnersResponse } from "../grpc/generated/canton/com/digitalasset/canton/topology/admin/v30/topology_aggregation_service.js";
|
|
8
15
|
import type { AddTransactionsRequest, AddTransactionsResponse, AuthorizeRequest, AuthorizeResponse, CreateTemporaryTopologyStoreRequest, CreateTemporaryTopologyStoreResponse, DropTemporaryTopologyStoreRequest, DropTemporaryTopologyStoreResponse, GenerateTransactionsRequest, GenerateTransactionsResponse, ImportTopologySnapshotRequest, ImportTopologySnapshotResponse, ImportTopologySnapshotV2Request, ImportTopologySnapshotV2Response, SignTransactionsRequest, SignTransactionsResponse } from "../grpc/generated/canton/com/digitalasset/canton/topology/admin/v30/topology_manager_write_service.js";
|
|
9
16
|
import type { GetContractRequest, GetContractResponse } from "../grpc/generated/canton/com/daml/ledger/api/v2/contract_service.js";
|
|
10
17
|
import type { AddPartyAsyncRequest, AddPartyAsyncResponse, ClearPartyOnboardingFlagRequest, ClearPartyOnboardingFlagResponse, GetHighestOffsetByTimestampRequest, GetHighestOffsetByTimestampResponse } from "../grpc/generated/canton/com/digitalasset/canton/admin/participant/v30/party_management_service.js";
|
|
11
18
|
import type { GetEventsByContractIdRequest, GetEventsByContractIdResponse } from "../grpc/generated/canton/com/daml/ledger/api/v2/event_query_service.js";
|
|
12
19
|
import type { CurrentTimeRequest, CurrentTimeResponse, GetIdRequest, GetIdResponse } from "../grpc/generated/canton/com/digitalasset/canton/topology/admin/v30/initialization_service.js";
|
|
13
|
-
import type { ListAllRequest, ListAllResponse, ListLsuAnnouncementRequest, ListLsuAnnouncementResponse, ListLsuSequencerConnectionSuccessorRequest, ListLsuSequencerConnectionSuccessorResponse, ListMediatorSynchronizerStateRequest, ListMediatorSynchronizerStateResponse, ListSequencingParametersStateRequest, ListSequencingParametersStateResponse, ListSynchronizerParametersStateRequest, ListSynchronizerParametersStateResponse,
|
|
14
|
-
import { GetParticipantIdResponse } from "
|
|
15
|
-
import type { GetPartiesRequest, GetPartiesResponse } from "../grpc/generated/canton/com/daml/ledger/api/v2/admin/party_management_service.js";
|
|
20
|
+
import type { ListAllRequest, ListAllResponse, ListLsuAnnouncementRequest, ListLsuAnnouncementResponse, ListLsuSequencerConnectionSuccessorRequest, ListLsuSequencerConnectionSuccessorResponse, ListMediatorSynchronizerStateRequest, ListMediatorSynchronizerStateResponse, ListSequencingParametersStateRequest, ListSequencingParametersStateResponse, ListSynchronizerParametersStateRequest, ListSynchronizerParametersStateResponse, ListVettedPackagesRequest as TopologyListVettedPackagesRequest, ListVettedPackagesResponse as TopologyListVettedPackagesResponse, ListPartyHostingLimitsRequest, ListPartyHostingLimitsResponse, ListParticipantSynchronizerPermissionRequest, ListParticipantSynchronizerPermissionResponse, ListSynchronizerTrustCertificateRequest, ListSynchronizerTrustCertificateResponse, ListPartyToKeyMappingRequest, ListPartyToKeyMappingResponse, ListOwnerToKeyMappingRequest, ListOwnerToKeyMappingResponse, ListDecentralizedNamespaceDefinitionRequest, ListDecentralizedNamespaceDefinitionResponse, ListNamespaceDelegationRequest, ListNamespaceDelegationResponse, ListSequencerSynchronizerStateRequest, ListSequencerSynchronizerStateResponse } from "../grpc/generated/canton/com/digitalasset/canton/topology/admin/v30/topology_manager_read_service.js";
|
|
21
|
+
import type { GetParticipantIdRequest, GetParticipantIdResponse, GetPartiesRequest, GetPartiesResponse } from "../grpc/generated/canton/com/daml/ledger/api/v2/admin/party_management_service.js";
|
|
16
22
|
import type { GetResourceLimitsRequest, GetResourceLimitsResponse } from "../grpc/generated/canton/com/digitalasset/canton/admin/participant/v30/resource_management_service.js";
|
|
17
23
|
import type { GetNoWaitCommitmentsFromRequest, GetNoWaitCommitmentsFromResponse, GetParticipantScheduleRequest as GetParticipantPruningScheduleRequest, GetParticipantScheduleResponse as GetParticipantPruningScheduleResponse, GetScheduleRequest as GetPruningScheduleRequest, GetScheduleResponse as GetPruningScheduleResponse } from "../grpc/generated/canton/com/digitalasset/canton/admin/pruning/v30/pruning.js";
|
|
18
24
|
import type { AllocateExternalPartyRequest, AllocateExternalPartyResponse, GenerateExternalPartyTopologyRequest, GenerateExternalPartyTopologyResponse } from "../grpc/generated/canton/com/daml/ledger/api/v2/admin/party_management_service.js";
|
|
@@ -36,7 +42,6 @@ import { ICommandSigner } from "../../core/signing/command-signer.interface.js";
|
|
|
36
42
|
import { RequestOptions } from "../../core/types/request-options.js";
|
|
37
43
|
import type { ListKnownPackagesRequest, ListKnownPackagesResponse, UploadDarFileRequest } from "../grpc/generated/canton/com/daml/ledger/api/v2/admin/package_management_service.js";
|
|
38
44
|
import { UploadDarFileResponse } from "../grpc/generated/canton/com/daml/ledger/api/v2/admin/package_management_service.js";
|
|
39
|
-
import type { GetUserRequest, GetUserResponse, ListUserRightsRequest, ListUserRightsResponse, ListUsersRequest, ListUsersResponse } from "../grpc/generated/canton/com/daml/ledger/api/v2/admin/user_management_service.js";
|
|
40
45
|
import type { GetCommandStatusRequest, GetCommandStatusResponse } from "../grpc/generated/canton/com/daml/ledger/api/v2/admin/command_inspection_service.js";
|
|
41
46
|
import type { GetActiveContractsPageRequest, GetActiveContractsPageResponse, GetConnectedSynchronizersRequest, GetConnectedSynchronizersResponse, GetLedgerEndRequest, GetLedgerEndResponse, GetLatestPrunedOffsetsRequest, GetLatestPrunedOffsetsResponse } from "../grpc/generated/canton/com/daml/ledger/api/v2/state_service.js";
|
|
42
47
|
import { GetPackageRequest, GetPackageResponse, GetPackageStatusRequest, GetPackageStatusResponse, ListPackagesRequest, ListPackagesResponse, ListVettedPackagesRequest, ListVettedPackagesResponse } from "../grpc/generated/canton/com/daml/ledger/api/v2/package_service.js";
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { randomUUID } from "node:crypto";
|
|
2
|
+
import { TransportError } from "../../../core/errors/transport-error.js";
|
|
2
3
|
import { ValidationError } from "../../../core/errors/validation-error.js";
|
|
3
4
|
import { CreateAndExerciseCommand } from "../../../core/types/commands/create-and-exercise-command.js";
|
|
4
5
|
import { CreateCommand } from "../../../core/types/commands/create-command.js";
|
|
@@ -9,8 +10,11 @@ import { ExerciseByKeyCommand } from "../../../core/types/commands/exercise-by-k
|
|
|
9
10
|
import { ExerciseCommand } from "../../../core/types/commands/exercise-command.js";
|
|
10
11
|
import { SubmitCommandResponse } from "../../../core/types/responses/submit-command-response.js";
|
|
11
12
|
export function mapJsonSubmitCommandRequest(request) {
|
|
13
|
+
if (request.deduplicationPeriod !== undefined) {
|
|
14
|
+
throw new TransportError("command deduplication periods are not supported by the JSON transport");
|
|
15
|
+
}
|
|
12
16
|
return {
|
|
13
|
-
commandId: randomUUID(),
|
|
17
|
+
commandId: request.commandId ?? randomUUID(),
|
|
14
18
|
actAs: request.actAs,
|
|
15
19
|
readAs: request.readAs,
|
|
16
20
|
commands: [mapJsonCommand(request.command)],
|
|
@@ -13,6 +13,7 @@ export declare function mapJsonCreateParty(payload: {
|
|
|
13
13
|
}): CreatePartyResponse;
|
|
14
14
|
export declare function mapJsonAllocatePartyRequest(request: AllocatePartyRequest): {
|
|
15
15
|
partyIdHint?: string;
|
|
16
|
+
userId?: string;
|
|
16
17
|
localMetadata?: {
|
|
17
18
|
attributes: Record<string, string>;
|
|
18
19
|
};
|
|
@@ -6,6 +6,12 @@ import { SynchronizerConnectivityServiceClient } from "../dist/transports/grpc/g
|
|
|
6
6
|
import { ListRegisteredSynchronizersResponse_Status } from "../dist/transports/grpc/generated/canton/com/digitalasset/canton/admin/participant/v30/synchronizer_connectivity_service.js";
|
|
7
7
|
import { SequencerConnectionValidation } from "../dist/transports/grpc/generated/canton/com/digitalasset/canton/admin/sequencer/v30/sequencer_connection.js";
|
|
8
8
|
import { VersionServiceClient } from "../dist/transports/grpc/generated/canton/com/daml/ledger/api/v2/version_service.client.js";
|
|
9
|
+
import { UserManagementServiceClient } from "../dist/transports/grpc/generated/canton/com/daml/ledger/api/v2/admin/user_management_service.client.js";
|
|
10
|
+
import {
|
|
11
|
+
GrantUserRightsRequest,
|
|
12
|
+
Right,
|
|
13
|
+
Right_CanReadAsAnyParty,
|
|
14
|
+
} from "../dist/transports/grpc/generated/canton/com/daml/ledger/api/v2/admin/user_management_service.js";
|
|
9
15
|
|
|
10
16
|
function getRequiredEnvironment(name) {
|
|
11
17
|
const value = process.env[name];
|
|
@@ -128,6 +134,30 @@ async function readLedgerApiVersion() {
|
|
|
128
134
|
}
|
|
129
135
|
}
|
|
130
136
|
|
|
137
|
+
async function ensureLedgerUserReadRights() {
|
|
138
|
+
const endpoint = getRequiredEnvironment("PARTICIPANT_358_LEDGER_ENDPOINT");
|
|
139
|
+
const token = process.env.PARTICIPANT_358_LEDGER_BEARER_TOKEN ?? createSharedSecretToken();
|
|
140
|
+
const userId = process.env.PARTICIPANT_358_LEDGER_USER_ID ?? "ledger-api-user";
|
|
141
|
+
const { options, transport } = createClient(endpoint, token);
|
|
142
|
+
|
|
143
|
+
try {
|
|
144
|
+
const request = GrantUserRightsRequest.create({
|
|
145
|
+
userId,
|
|
146
|
+
rights: [Right.create({
|
|
147
|
+
kind: {
|
|
148
|
+
oneofKind: "canReadAsAnyParty",
|
|
149
|
+
canReadAsAnyParty: Right_CanReadAsAnyParty.create(),
|
|
150
|
+
},
|
|
151
|
+
})],
|
|
152
|
+
});
|
|
153
|
+
|
|
154
|
+
await new UserManagementServiceClient(transport)
|
|
155
|
+
.grantUserRights(request, options).response;
|
|
156
|
+
} finally {
|
|
157
|
+
transport.close();
|
|
158
|
+
}
|
|
159
|
+
}
|
|
160
|
+
|
|
131
161
|
const command = process.argv[2];
|
|
132
162
|
if (command === "export") {
|
|
133
163
|
await exportSynchronizerConfig();
|
|
@@ -137,6 +167,8 @@ if (command === "export") {
|
|
|
137
167
|
await readLedgerApiVersion();
|
|
138
168
|
} else if (command === "mint-ledger-token") {
|
|
139
169
|
await writeLedgerToken();
|
|
170
|
+
} else if (command === "ensure-ledger-user-read-rights") {
|
|
171
|
+
await ensureLedgerUserReadRights();
|
|
140
172
|
} else {
|
|
141
|
-
throw new Error("Expected 'export', 'connect', 'ledger-api-version',
|
|
173
|
+
throw new Error("Expected 'export', 'connect', 'ledger-api-version', 'mint-ledger-token', or 'ensure-ledger-user-read-rights'.");
|
|
142
174
|
}
|
|
@@ -12,8 +12,35 @@ LEDGER_PORT="${PARTICIPANT_358_LEDGER_PORT:-8901}"
|
|
|
12
12
|
ADMIN_PORT="${PARTICIPANT_358_ADMIN_PORT:-8902}"
|
|
13
13
|
JSON_PORT="${PARTICIPANT_358_JSON_PORT:-8975}"
|
|
14
14
|
SOURCE_ADMIN_ENDPOINT="${PARTICIPANT_358_SOURCE_ADMIN_ENDPOINT:-localhost:3902}"
|
|
15
|
+
SYNCHRONIZER_CONFIG="$RUNTIME_DIR/registered-synchronizer.json"
|
|
16
|
+
LEDGER_TOKEN_FILE="$RUNTIME_DIR/ledger-api-user.token"
|
|
15
17
|
DOCKER_COMPOSE_CMD=()
|
|
16
18
|
|
|
19
|
+
print_bearer_token_exports() {
|
|
20
|
+
local escaped_token_file
|
|
21
|
+
printf -v escaped_token_file '%q' "$LEDGER_TOKEN_FILE"
|
|
22
|
+
printf 'export SDK_TEST_LEDGER_BEARER_TOKEN="$(cat %s)"\n' "$escaped_token_file"
|
|
23
|
+
printf 'export SDK_TEST_LEDGER_ADMIN_BEARER_TOKEN="$(cat %s)"\n' "$escaped_token_file"
|
|
24
|
+
printf 'export SDK_TEST_PARTICIPANT_ADMIN_BEARER_TOKEN="$(cat %s)"\n' "$escaped_token_file"
|
|
25
|
+
printf 'export SDK_EXAMPLE_BEARER_TOKEN="$(cat %s)"\n' "$escaped_token_file"
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
if (( $# > 0 )); then
|
|
29
|
+
if [[ "$1" != "--refresh-token" || $# -ne 1 ]]; then
|
|
30
|
+
echo "Usage: $(basename "$0") [--refresh-token]" >&2
|
|
31
|
+
exit 1
|
|
32
|
+
elif [[ ! -d "$RUNTIME_DIR" || ! -f "$LEDGER_TOKEN_FILE" ]]; then
|
|
33
|
+
echo "Participant 3.5.8 runtime token does not exist at $LEDGER_TOKEN_FILE. Start the sidecar first." >&2
|
|
34
|
+
exit 1
|
|
35
|
+
fi
|
|
36
|
+
|
|
37
|
+
PARTICIPANT_358_LEDGER_TOKEN_FILE="$LEDGER_TOKEN_FILE" \
|
|
38
|
+
node "$SCRIPT_DIR/participant-358-synchronizer.mjs" mint-ledger-token
|
|
39
|
+
chmod 600 "$LEDGER_TOKEN_FILE"
|
|
40
|
+
print_bearer_token_exports
|
|
41
|
+
exit 0
|
|
42
|
+
fi
|
|
43
|
+
|
|
17
44
|
resolve_docker_compose_cmd() {
|
|
18
45
|
if docker compose version >/dev/null 2>&1; then DOCKER_COMPOSE_CMD=(docker compose); return; fi
|
|
19
46
|
if docker-compose version >/dev/null 2>&1; then DOCKER_COMPOSE_CMD=(docker-compose); return; fi
|
|
@@ -49,10 +76,9 @@ for port in "$LEDGER_PORT" "$ADMIN_PORT" "$JSON_PORT"; do assert_host_port_avail
|
|
|
49
76
|
|
|
50
77
|
mkdir -p "$RUNTIME_DIR"
|
|
51
78
|
chmod 700 "$RUNTIME_DIR"
|
|
52
|
-
SYNCHRONIZER_CONFIG="$RUNTIME_DIR/registered-synchronizer.json"
|
|
53
|
-
LEDGER_TOKEN_FILE="$RUNTIME_DIR/ledger-api-user.token"
|
|
54
79
|
PARTICIPANT_358_LEDGER_TOKEN_FILE="$LEDGER_TOKEN_FILE" \
|
|
55
80
|
node "$SCRIPT_DIR/participant-358-synchronizer.mjs" mint-ledger-token
|
|
81
|
+
chmod 600 "$LEDGER_TOKEN_FILE"
|
|
56
82
|
cat > "$RUNTIME_DIR/participant-358.env" <<EOF
|
|
57
83
|
PARTICIPANT_358_SYNCHRONIZER_CONFIG=$SYNCHRONIZER_CONFIG
|
|
58
84
|
PARTICIPANT_358_SOURCE_ADMIN_ENDPOINT=$SOURCE_ADMIN_ENDPOINT
|
|
@@ -170,6 +196,10 @@ if [[ "${PARTICIPANT_358_SKIP_SYNCHRONIZER_CONNECT:-0}" != "1" ]]; then
|
|
|
170
196
|
fi
|
|
171
197
|
sleep 2
|
|
172
198
|
done
|
|
199
|
+
|
|
200
|
+
PARTICIPANT_358_LEDGER_ENDPOINT="localhost:$LEDGER_PORT" \
|
|
201
|
+
PARTICIPANT_358_LEDGER_BEARER_TOKEN="$(cat "$LEDGER_TOKEN_FILE")" \
|
|
202
|
+
node "$SCRIPT_DIR/participant-358-synchronizer.mjs" ensure-ledger-user-read-rights
|
|
173
203
|
fi
|
|
174
204
|
|
|
175
205
|
cat <<EOF
|
|
@@ -180,5 +210,5 @@ export SDK_TEST_PARTICIPANT_ADMIN_ENDPOINT=localhost:$ADMIN_PORT
|
|
|
180
210
|
export SDK_EXAMPLE_LEDGER_ENDPOINT=localhost:$LEDGER_PORT
|
|
181
211
|
export SDK_EXAMPLE_LEDGER_ADMIN_ENDPOINT=localhost:$LEDGER_PORT
|
|
182
212
|
export SDK_EXAMPLE_PARTICIPANT_ADMIN_ENDPOINT=localhost:$ADMIN_PORT
|
|
183
|
-
export SDK_EXAMPLE_BEARER_TOKEN="\$(cat $LEDGER_TOKEN_FILE)"
|
|
184
213
|
EOF
|
|
214
|
+
print_bearer_token_exports
|
|
@@ -10,6 +10,8 @@ STOP_SCRIPT="$REPO_ROOT/node/stop-local-participant-358.sh"
|
|
|
10
10
|
grep -Fq 'export SDK_EXAMPLE_LEDGER_ENDPOINT=localhost:$LEDGER_PORT' "$START_SCRIPT"
|
|
11
11
|
grep -Fq 'export SDK_EXAMPLE_LEDGER_ADMIN_ENDPOINT=localhost:$LEDGER_PORT' "$START_SCRIPT"
|
|
12
12
|
grep -Fq 'export SDK_EXAMPLE_PARTICIPANT_ADMIN_ENDPOINT=localhost:$ADMIN_PORT' "$START_SCRIPT"
|
|
13
|
+
grep -Fq 'ensure-ledger-user-read-rights' "$START_SCRIPT"
|
|
14
|
+
grep -Fq 'canReadAsAnyParty' "$REPO_ROOT/node/participant-358-synchronizer.mjs"
|
|
13
15
|
|
|
14
16
|
tmpdir="$(mktemp -d)"
|
|
15
17
|
trap 'rm -rf "$tmpdir"' EXIT
|
|
@@ -28,9 +30,15 @@ chmod +x "$stubbin/docker"
|
|
|
28
30
|
|
|
29
31
|
runtime_dir="$tmpdir/runtime"
|
|
30
32
|
docker_log="$tmpdir/docker.log"
|
|
33
|
+
test_ledger_port=18901
|
|
34
|
+
test_admin_port=18902
|
|
35
|
+
test_json_port=18975
|
|
31
36
|
PATH="$stubbin:$PATH" \
|
|
32
37
|
DOCKER_LOG="$docker_log" \
|
|
33
38
|
PARTICIPANT_358_RUNTIME_DIR="$runtime_dir" \
|
|
39
|
+
PARTICIPANT_358_LEDGER_PORT="$test_ledger_port" \
|
|
40
|
+
PARTICIPANT_358_ADMIN_PORT="$test_admin_port" \
|
|
41
|
+
PARTICIPANT_358_JSON_PORT="$test_json_port" \
|
|
34
42
|
PARTICIPANT_358_SKIP_SYNCHRONIZER_CONNECT=1 \
|
|
35
43
|
"$START_SCRIPT"
|
|
36
44
|
|
|
@@ -48,7 +56,9 @@ grep -Fqx ' databaseName = participant358' "$runtime_dir/canton.conf"
|
|
|
48
56
|
grep -Fqx ' admin-api {' "$runtime_dir/canton.conf"
|
|
49
57
|
grep -Fqx ' address = "0.0.0.0"' "$runtime_dir/canton.conf"
|
|
50
58
|
grep -Fqx ' port = 5002' "$runtime_dir/canton.conf"
|
|
51
|
-
grep -Fqx
|
|
59
|
+
grep -Fqx " - \"127.0.0.1:$test_ledger_port:5001\"" "$runtime_dir/compose.yaml"
|
|
60
|
+
grep -Fqx " - \"127.0.0.1:$test_admin_port:5002\"" "$runtime_dir/compose.yaml"
|
|
61
|
+
grep -Fqx " - \"127.0.0.1:$test_json_port:7575\"" "$runtime_dir/compose.yaml"
|
|
52
62
|
grep -Fqx ' port = 5002' "$runtime_dir/canton.conf"
|
|
53
63
|
grep -Fqx ' port = 7575' "$runtime_dir/canton.conf"
|
|
54
64
|
grep -Fq 'PARTICIPANT_358_SYNCHRONIZER_CONFIG=' "$runtime_dir/participant-358.env"
|
|
@@ -66,6 +76,26 @@ if (payload.exp - payload.iat !== 300) throw new Error("token lifetime must be 3
|
|
|
66
76
|
grep -F -- '--project-name canton-participant-358' "$docker_log"
|
|
67
77
|
grep -Fqx ' name: quickstart' "$runtime_dir/compose.yaml"
|
|
68
78
|
|
|
79
|
+
docker_calls_before_refresh="$(wc -l < "$docker_log")"
|
|
80
|
+
refresh_output="$(
|
|
81
|
+
PATH="$stubbin:$PATH" \
|
|
82
|
+
DOCKER_LOG="$docker_log" \
|
|
83
|
+
PARTICIPANT_358_RUNTIME_DIR="$runtime_dir" \
|
|
84
|
+
"$START_SCRIPT" --refresh-token
|
|
85
|
+
)"
|
|
86
|
+
[[ "$(wc -l < "$docker_log")" == "$docker_calls_before_refresh" ]]
|
|
87
|
+
[[ "$(stat -c '%a' "$runtime_dir/ledger-api-user.token")" == 600 ]]
|
|
88
|
+
grep -Fqx "export SDK_TEST_LEDGER_BEARER_TOKEN=\"\$(cat $runtime_dir/ledger-api-user.token)\"" <<<"$refresh_output"
|
|
89
|
+
grep -Fqx "export SDK_TEST_LEDGER_ADMIN_BEARER_TOKEN=\"\$(cat $runtime_dir/ledger-api-user.token)\"" <<<"$refresh_output"
|
|
90
|
+
grep -Fqx "export SDK_TEST_PARTICIPANT_ADMIN_BEARER_TOKEN=\"\$(cat $runtime_dir/ledger-api-user.token)\"" <<<"$refresh_output"
|
|
91
|
+
grep -Fqx "export SDK_EXAMPLE_BEARER_TOKEN=\"\$(cat $runtime_dir/ledger-api-user.token)\"" <<<"$refresh_output"
|
|
92
|
+
[[ "$(wc -l <<<"$refresh_output")" == 4 ]]
|
|
93
|
+
|
|
94
|
+
if "$START_SCRIPT" --unknown >/dev/null 2>&1; then
|
|
95
|
+
echo 'sidecar launcher accepted an unknown argument' >&2
|
|
96
|
+
exit 1
|
|
97
|
+
fi
|
|
98
|
+
|
|
69
99
|
if PATH="$stubbin:$PATH" PARTICIPANT_358_LEDGER_PORT=3901 "$START_SCRIPT" >/dev/null 2>&1; then
|
|
70
100
|
echo 'sidecar launcher accepted a CN Quickstart Ledger port' >&2
|
|
71
101
|
exit 1
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@distrohelena/canton-typescript-sdk",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.35",
|
|
4
4
|
"license": "Apache-2.0",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "./dist/index.js",
|
|
@@ -88,6 +88,16 @@
|
|
|
88
88
|
"example:party:hosted": "npm run build && node --loader ts-node/esm examples/10-hosted-party.ts",
|
|
89
89
|
"example:party:external": "npm run build && node --loader ts-node/esm examples/20-external-party-ed25519.ts",
|
|
90
90
|
"example:party:decentralized": "npm run build && node --loader ts-node/esm examples/30-decentralized-party-ed25519.ts",
|
|
91
|
+
"example:dar:upload": "npm run build && node --loader ts-node/esm examples/40-dar-upload.ts",
|
|
92
|
+
"example:contract:create-exercise": "npm run build && node --loader ts-node/esm examples/50-create-and-exercise.ts",
|
|
93
|
+
"example:contract:query": "npm run build && node --loader ts-node/esm examples/60-query-active-contracts.ts",
|
|
94
|
+
"example:updates:stream": "npm run build && node --loader ts-node/esm examples/61-stream-updates.ts",
|
|
95
|
+
"example:user:rights": "npm run build && node --loader ts-node/esm examples/70-user-rights.ts",
|
|
96
|
+
"example:topology:party-hosting": "npm run build && node --loader ts-node/esm examples/80-topology-inspection.ts",
|
|
97
|
+
"example:workflow:atomic": "npm run build && node --loader ts-node/esm examples/90-atomic-create-and-exercise.ts",
|
|
98
|
+
"example:workflow:retry": "npm run build && node --loader ts-node/esm examples/91-idempotent-command-retry.ts",
|
|
99
|
+
"example:workflow:resume": "npm run build && node --loader ts-node/esm examples/92-resume-update-stream.ts",
|
|
100
|
+
"example:workflow:stale-contract": "npm run build && node --loader ts-node/esm examples/93-archive-and-stale-contract.ts",
|
|
91
101
|
"lint": "eslint . --max-warnings=0",
|
|
92
102
|
"lint:fix": "eslint . --fix --max-warnings=0",
|
|
93
103
|
"start:local-ledger": "bash node/start-local.sh",
|
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.HealthCheckStatus = void 0;
|
|
4
|
-
var HealthCheckStatus;
|
|
5
|
-
(function (HealthCheckStatus) {
|
|
6
|
-
HealthCheckStatus["unknown"] = "unknown";
|
|
7
|
-
HealthCheckStatus["serving"] = "serving";
|
|
8
|
-
HealthCheckStatus["notServing"] = "notServing";
|
|
9
|
-
HealthCheckStatus["serviceUnknown"] = "serviceUnknown";
|
|
10
|
-
})(HealthCheckStatus || (exports.HealthCheckStatus = HealthCheckStatus = {}));
|
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.GetPackageReferencesRequest = void 0;
|
|
4
|
-
class GetPackageReferencesRequest {
|
|
5
|
-
packageId;
|
|
6
|
-
constructor(init) {
|
|
7
|
-
this.packageId = init.packageId;
|
|
8
|
-
}
|
|
9
|
-
}
|
|
10
|
-
exports.GetPackageReferencesRequest = GetPackageReferencesRequest;
|
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.HealthCheckRequest = void 0;
|
|
4
|
-
class HealthCheckRequest {
|
|
5
|
-
service;
|
|
6
|
-
constructor(init = {}) {
|
|
7
|
-
this.service = init.service;
|
|
8
|
-
}
|
|
9
|
-
}
|
|
10
|
-
exports.HealthCheckRequest = HealthCheckRequest;
|
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.GetLedgerApiVersionResponse = void 0;
|
|
4
|
-
class GetLedgerApiVersionResponse {
|
|
5
|
-
version;
|
|
6
|
-
features;
|
|
7
|
-
constructor(init) {
|
|
8
|
-
this.version = init.version;
|
|
9
|
-
this.features = init.features;
|
|
10
|
-
}
|
|
11
|
-
}
|
|
12
|
-
exports.GetLedgerApiVersionResponse = GetLedgerApiVersionResponse;
|
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.GetPackageReferencesResponse = void 0;
|
|
4
|
-
class GetPackageReferencesResponse {
|
|
5
|
-
dars;
|
|
6
|
-
constructor(init) {
|
|
7
|
-
this.dars = [...init.dars];
|
|
8
|
-
}
|
|
9
|
-
}
|
|
10
|
-
exports.GetPackageReferencesResponse = GetPackageReferencesResponse;
|
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.GetParticipantIdResponse = void 0;
|
|
4
|
-
class GetParticipantIdResponse {
|
|
5
|
-
participantId;
|
|
6
|
-
constructor(init) {
|
|
7
|
-
this.participantId = init.participantId;
|
|
8
|
-
}
|
|
9
|
-
}
|
|
10
|
-
exports.GetParticipantIdResponse = GetParticipantIdResponse;
|
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.GetParticipantStatusResponse = void 0;
|
|
4
|
-
class GetParticipantStatusResponse {
|
|
5
|
-
status;
|
|
6
|
-
notInitialized;
|
|
7
|
-
constructor(init) {
|
|
8
|
-
this.status = init.status;
|
|
9
|
-
this.notInitialized = init.notInitialized;
|
|
10
|
-
}
|
|
11
|
-
}
|
|
12
|
-
exports.GetParticipantStatusResponse = GetParticipantStatusResponse;
|
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.HealthCheckResponse = void 0;
|
|
4
|
-
class HealthCheckResponse {
|
|
5
|
-
status;
|
|
6
|
-
constructor(init) {
|
|
7
|
-
this.status = init.status;
|
|
8
|
-
}
|
|
9
|
-
}
|
|
10
|
-
exports.HealthCheckResponse = HealthCheckResponse;
|
|
@@ -1,24 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.mapGrpcHealthCheckResponse = mapGrpcHealthCheckResponse;
|
|
4
|
-
const health_check_status_js_1 = require("../../../core/types/health-check-status.js");
|
|
5
|
-
const health_check_response_js_1 = require("../../../core/types/responses/health-check-response.js");
|
|
6
|
-
const health_js_1 = require("../generated/canton/google/grpc/health/v1/health.js");
|
|
7
|
-
function mapGrpcHealthCheckResponse(payload) {
|
|
8
|
-
return new health_check_response_js_1.HealthCheckResponse({
|
|
9
|
-
status: mapGrpcHealthStatus(payload.status),
|
|
10
|
-
});
|
|
11
|
-
}
|
|
12
|
-
function mapGrpcHealthStatus(status) {
|
|
13
|
-
switch (status) {
|
|
14
|
-
case health_js_1.HealthCheckResponse_ServingStatus.SERVING:
|
|
15
|
-
return health_check_status_js_1.HealthCheckStatus.serving;
|
|
16
|
-
case health_js_1.HealthCheckResponse_ServingStatus.NOT_SERVING:
|
|
17
|
-
return health_check_status_js_1.HealthCheckStatus.notServing;
|
|
18
|
-
case health_js_1.HealthCheckResponse_ServingStatus.SERVICE_UNKNOWN:
|
|
19
|
-
return health_check_status_js_1.HealthCheckStatus.serviceUnknown;
|
|
20
|
-
case health_js_1.HealthCheckResponse_ServingStatus.UNKNOWN:
|
|
21
|
-
default:
|
|
22
|
-
return health_check_status_js_1.HealthCheckStatus.unknown;
|
|
23
|
-
}
|
|
24
|
-
}
|
|
@@ -1,58 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.mapGrpcGetParticipantStatusRequest = mapGrpcGetParticipantStatusRequest;
|
|
4
|
-
exports.mapGrpcParticipantStatusResponse = mapGrpcParticipantStatusResponse;
|
|
5
|
-
const get_participant_status_response_js_1 = require("../../../core/types/responses/get-participant-status-response.js");
|
|
6
|
-
const connected_synchronizer_health_js_1 = require("../../../core/types/connected-synchronizer-health.js");
|
|
7
|
-
const connected_synchronizer_status_js_1 = require("../../../core/types/connected-synchronizer-status.js");
|
|
8
|
-
const participant_node_status_js_1 = require("../../../core/types/participant-node-status.js");
|
|
9
|
-
const participant_status_service_js_1 = require("../generated/canton/com/digitalasset/canton/admin/participant/v30/participant_status_service.js");
|
|
10
|
-
const admin_status_mapper_js_1 = require("./admin-status-mapper.js");
|
|
11
|
-
function mapGrpcGetParticipantStatusRequest(_request) {
|
|
12
|
-
return {};
|
|
13
|
-
}
|
|
14
|
-
function mapGrpcParticipantStatusResponse(payload) {
|
|
15
|
-
switch (payload.kind?.oneofKind) {
|
|
16
|
-
case "status":
|
|
17
|
-
return new get_participant_status_response_js_1.GetParticipantStatusResponse({
|
|
18
|
-
status: mapGrpcParticipantNodeStatus(payload.kind.status),
|
|
19
|
-
});
|
|
20
|
-
case "notInitialized":
|
|
21
|
-
return new get_participant_status_response_js_1.GetParticipantStatusResponse({
|
|
22
|
-
notInitialized: (0, admin_status_mapper_js_1.mapGrpcAdminNotInitializedStatus)(payload.kind.notInitialized),
|
|
23
|
-
});
|
|
24
|
-
default:
|
|
25
|
-
return new get_participant_status_response_js_1.GetParticipantStatusResponse({});
|
|
26
|
-
}
|
|
27
|
-
}
|
|
28
|
-
function mapGrpcParticipantNodeStatus(payload) {
|
|
29
|
-
const commonStatus = (0, admin_status_mapper_js_1.mapGrpcAdminNodeStatus)(payload.commonStatus);
|
|
30
|
-
return new participant_node_status_js_1.ParticipantNodeStatus({
|
|
31
|
-
uid: commonStatus.uid,
|
|
32
|
-
uptime: commonStatus.uptime,
|
|
33
|
-
ports: { ...commonStatus.ports },
|
|
34
|
-
active: payload.active ?? commonStatus.active,
|
|
35
|
-
topologyQueues: commonStatus.topologyQueues,
|
|
36
|
-
components: [...commonStatus.components],
|
|
37
|
-
version: commonStatus.version,
|
|
38
|
-
connectedSynchronizers: (payload.connectedSynchronizers ?? []).map((item) => mapGrpcConnectedSynchronizerStatus(item)),
|
|
39
|
-
supportedProtocolVersions: [...(payload.supportedProtocolVersions ?? [])],
|
|
40
|
-
});
|
|
41
|
-
}
|
|
42
|
-
function mapGrpcConnectedSynchronizerStatus(payload) {
|
|
43
|
-
return new connected_synchronizer_status_js_1.ConnectedSynchronizerStatus({
|
|
44
|
-
physicalSynchronizerId: payload.physicalSynchronizerId ?? "",
|
|
45
|
-
health: mapGrpcConnectedSynchronizerHealth(payload.health),
|
|
46
|
-
});
|
|
47
|
-
}
|
|
48
|
-
function mapGrpcConnectedSynchronizerHealth(value) {
|
|
49
|
-
switch (value) {
|
|
50
|
-
case participant_status_service_js_1.ConnectedSynchronizer_Health.HEALTHY:
|
|
51
|
-
return connected_synchronizer_health_js_1.ConnectedSynchronizerHealth.healthy;
|
|
52
|
-
case participant_status_service_js_1.ConnectedSynchronizer_Health.UNHEALTHY:
|
|
53
|
-
return connected_synchronizer_health_js_1.ConnectedSynchronizerHealth.unhealthy;
|
|
54
|
-
case participant_status_service_js_1.ConnectedSynchronizer_Health.UNSPECIFIED:
|
|
55
|
-
default:
|
|
56
|
-
return connected_synchronizer_health_js_1.ConnectedSynchronizerHealth.unspecified;
|
|
57
|
-
}
|
|
58
|
-
}
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
export var HealthCheckStatus;
|
|
2
|
-
(function (HealthCheckStatus) {
|
|
3
|
-
HealthCheckStatus["unknown"] = "unknown";
|
|
4
|
-
HealthCheckStatus["serving"] = "serving";
|
|
5
|
-
HealthCheckStatus["notServing"] = "notServing";
|
|
6
|
-
HealthCheckStatus["serviceUnknown"] = "serviceUnknown";
|
|
7
|
-
})(HealthCheckStatus || (HealthCheckStatus = {}));
|