@distrohelena/canton-typescript-sdk 0.1.36 → 0.1.38
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 +143 -34
- package/dist/cjs/core/types/requests/{submit-command-request.js → submit-commands-request.js} +10 -6
- package/dist/cjs/index.js +10 -8
- package/dist/cjs/query/canonical/in-memory-query-evaluator.js +291 -0
- package/dist/cjs/query/canonical/public-identity.js +41 -0
- package/dist/cjs/query/canonical/query-ast.js +2 -0
- package/dist/cjs/query/canonical/query-dataset.js +351 -0
- package/dist/cjs/query/canonical/query-normalizer.js +657 -0
- package/dist/cjs/query/canonical/query-schema.js +86 -0
- package/dist/cjs/query/canton-manager.js +14 -5
- package/dist/cjs/query/errors/query-snapshot-incomplete-error.js +19 -0
- package/dist/cjs/query/grpc/grpc-contract-cache.js +484 -0
- package/dist/cjs/query/grpc/grpc-package-relation-reader.js +218 -0
- package/dist/cjs/query/grpc/grpc-query-client.js +249 -0
- package/dist/cjs/query/grpc/grpc-query-snapshot-reader.js +238 -0
- package/dist/cjs/query/grpc/grpc-query-value-mapper.js +204 -0
- package/dist/cjs/query/grpc/grpc-relation-mapper.js +794 -0
- package/dist/cjs/query/pqs/pqs-query-client.js +151 -582
- package/dist/cjs/query/pqs/pqs-relational-sql-compiler.js +138 -95
- package/dist/cjs/query/pqs/pqs-result-shape.js +28 -0
- package/dist/cjs/query/pqs/pqs-schema-profile.js +49 -48
- package/dist/cjs/query/pqs/pqs-sql-compiler.js +343 -289
- package/dist/cjs/query/pqs/pqs-sql-syntax.js +10 -0
- package/dist/cjs/services/command/command-service-client.js +16 -3
- package/dist/cjs/services/commands/command-payload-builder.js +1 -1
- package/dist/cjs/services/commands/command-submission-pipeline.js +21 -6
- package/dist/cjs/testing/runtime/declarative-action-executor.js +3 -3
- package/dist/cjs/transports/grpc/grpc-transport.js +2 -2
- package/dist/cjs/transports/grpc/mappers/commands-mapper.js +6 -6
- package/dist/cjs/transports/grpc/mappers/interactive-command-mapper.js +1 -1
- package/dist/cjs/transports/json/json-transport.js +1 -1
- package/dist/cjs/transports/json/mappers/commands-mapper.js +3 -3
- package/dist/core/transports/transport.interface.d.ts +4 -4
- package/dist/core/types/prepared-command-submission.d.ts +3 -3
- package/dist/core/types/requests/{submit-command-request.d.ts → submit-commands-request.d.ts} +8 -4
- package/dist/core/types/requests/{submit-command-request.js → submit-commands-request.js} +8 -4
- package/dist/index.d.ts +5 -2
- package/dist/index.js +2 -1
- package/dist/query/canonical/in-memory-query-evaluator.d.ts +22 -0
- package/dist/query/canonical/in-memory-query-evaluator.js +287 -0
- package/dist/query/canonical/public-identity.d.ts +14 -0
- package/dist/query/canonical/public-identity.js +35 -0
- package/dist/query/canonical/query-ast.d.ts +104 -0
- package/dist/query/canonical/query-ast.js +1 -0
- package/dist/query/canonical/query-dataset.d.ts +63 -0
- package/dist/query/canonical/query-dataset.js +343 -0
- package/dist/query/canonical/query-normalizer.d.ts +10 -0
- package/dist/query/canonical/query-normalizer.js +648 -0
- package/dist/query/canonical/query-schema.d.ts +25 -0
- package/dist/query/canonical/query-schema.js +83 -0
- package/dist/query/canton-manager.js +14 -5
- package/dist/query/errors/query-snapshot-incomplete-error.d.ts +14 -0
- package/dist/query/errors/query-snapshot-incomplete-error.js +15 -0
- package/dist/query/grpc/grpc-contract-cache.d.ts +27 -0
- package/dist/query/grpc/grpc-contract-cache.js +479 -0
- package/dist/query/grpc/grpc-package-relation-reader.d.ts +43 -0
- package/dist/query/grpc/grpc-package-relation-reader.js +213 -0
- package/dist/query/grpc/grpc-query-client.d.ts +42 -0
- package/dist/query/grpc/grpc-query-client.js +245 -0
- package/dist/query/grpc/grpc-query-snapshot-reader.d.ts +33 -0
- package/dist/query/grpc/grpc-query-snapshot-reader.js +233 -0
- package/dist/query/grpc/grpc-query-value-mapper.d.ts +15 -0
- package/dist/query/grpc/grpc-query-value-mapper.js +195 -0
- package/dist/query/grpc/grpc-relation-mapper.d.ts +67 -0
- package/dist/query/grpc/grpc-relation-mapper.js +789 -0
- package/dist/query/model-types.d.ts +2 -0
- package/dist/query/pqs/pqs-query-client.d.ts +10 -20
- package/dist/query/pqs/pqs-query-client.js +154 -585
- package/dist/query/pqs/pqs-relational-sql-compiler.d.ts +9 -17
- package/dist/query/pqs/pqs-relational-sql-compiler.js +136 -95
- package/dist/query/pqs/pqs-result-shape.d.ts +25 -0
- package/dist/query/pqs/pqs-result-shape.js +25 -0
- package/dist/query/pqs/pqs-schema-profile.js +49 -48
- package/dist/query/pqs/pqs-sql-compiler.d.ts +18 -3
- package/dist/query/pqs/pqs-sql-compiler.js +337 -288
- package/dist/query/pqs/pqs-sql-syntax.d.ts +2 -0
- package/dist/query/pqs/pqs-sql-syntax.js +6 -0
- package/dist/query/query-client.d.ts +16 -0
- package/dist/services/command/command-service-client.d.ts +9 -4
- package/dist/services/command/command-service-client.js +16 -3
- package/dist/services/command-submission/command-submission-service-client.d.ts +2 -2
- package/dist/services/commands/command-payload-builder.d.ts +2 -2
- package/dist/services/commands/command-payload-builder.js +1 -1
- package/dist/services/commands/command-submission-pipeline.d.ts +5 -4
- package/dist/services/commands/command-submission-pipeline.js +21 -6
- package/dist/testing/runtime/declarative-action-executor.js +3 -3
- package/dist/transports/grpc/grpc-transport.d.ts +4 -4
- package/dist/transports/grpc/grpc-transport.js +3 -3
- package/dist/transports/grpc/mappers/commands-mapper.d.ts +3 -3
- package/dist/transports/grpc/mappers/commands-mapper.js +4 -4
- package/dist/transports/grpc/mappers/interactive-command-mapper.d.ts +3 -3
- package/dist/transports/grpc/mappers/interactive-command-mapper.js +1 -1
- package/dist/transports/json/json-transport.d.ts +2 -2
- package/dist/transports/json/json-transport.js +2 -2
- package/dist/transports/json/mappers/commands-mapper.d.ts +2 -2
- package/dist/transports/json/mappers/commands-mapper.js +2 -2
- package/node/start-local-splice-0.6.12.sh +6 -0
- package/node/start-local-splice-0.6.13.sh +6 -0
- package/node/start-local-splice-0.6.14.sh +6 -0
- package/node/start-local-splice-0.7.0.sh +6 -0
- package/node/stop-local-splice-0.6.12.sh +6 -0
- package/node/stop-local-splice-0.6.13.sh +6 -0
- package/node/stop-local-splice-0.6.14.sh +6 -0
- package/node/stop-local-splice-0.7.0.sh +6 -0
- package/node/test-start-local-splice-0.6.12.sh +28 -0
- package/node/test-start-local-splice-0.6.13.sh +28 -0
- package/node/test-start-local-splice-0.6.14.sh +28 -0
- package/node/test-start-local-splice-0.7.0.sh +28 -0
- package/node/test-stop-local-splice-0.6.12.sh +28 -0
- package/node/test-stop-local-splice-0.6.13.sh +28 -0
- package/node/test-stop-local-splice-0.6.14.sh +28 -0
- package/node/test-stop-local-splice-0.7.0.sh +28 -0
- package/package.json +29 -4
- package/dist/cjs/query/grpc/grpc-contract-query-client.js +0 -178
- package/dist/query/grpc/grpc-contract-query-client.d.ts +0 -33
- package/dist/query/grpc/grpc-contract-query-client.js +0 -174
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { QuerySource } from "./query-source.js";
|
|
2
2
|
import { ContractTypeOrderBy, ContractTypeResult, ContractTypeSelect, ContractTypeUnique, ContractTypeWhere, ContractTypeGroupByArgs, ContractTypeGroupRow, ContractCountArgs, ContractFindManyArgs, ContractFindUniqueArgs, ContractGroupByArgs, ContractGroupRow, ContractResult, EventOrderBy, EventResult, EventGroupByArgs, EventGroupRow, EventSelect, EventUnique, EventWhere, ExerciseOrderBy, ExerciseResult, ExerciseSelect, ExerciseTypeOrderBy, ExerciseTypeResult, ExerciseTypeSelect, ExerciseTypeUnique, ExerciseTypeWhere, ExerciseTypeGroupByArgs, ExerciseTypeGroupRow, ExerciseWhere, ExerciseGroupByArgs, ExerciseGroupRow, PackageOrderBy, PackageResult, PackageSelect, PackageUnique, PackageWhere, PackageGroupByArgs, PackageGroupRow, TransactionOrderBy, TransactionResult, TransactionSelect, TransactionUnique, TransactionWhere, TransactionGroupByArgs, TransactionGroupRow, WatermarkOrderBy, WatermarkRow, WatermarkSelect, WatermarkUnique, WatermarkWhere, WatermarkGroupByArgs, WatermarkGroupRow, ContractTypeInclude, EventInclude, ExerciseInclude, ExerciseTypeInclude, PackageInclude, TransactionInclude, JsonProjectionResult } from "./model-types.js";
|
|
3
|
+
/** `take: 0` returns all matching rows (no limit), matching `skip: 0`'s "no offset" meaning. */
|
|
3
4
|
export interface FindManyArgs<TWhere, TSelect, TOrderBy, TInclude = never> {
|
|
4
5
|
readonly where?: TWhere;
|
|
5
6
|
readonly select?: TSelect;
|
|
@@ -8,6 +9,19 @@ export interface FindManyArgs<TWhere, TSelect, TOrderBy, TInclude = never> {
|
|
|
8
9
|
readonly take?: number;
|
|
9
10
|
readonly include?: TInclude;
|
|
10
11
|
}
|
|
12
|
+
export interface ContractCacheArgs {
|
|
13
|
+
readonly parties?: readonly string[];
|
|
14
|
+
}
|
|
15
|
+
export type ContractCacheResult = {
|
|
16
|
+
readonly source: QuerySource.grpc;
|
|
17
|
+
readonly cached: true;
|
|
18
|
+
readonly activeAtOffset: string;
|
|
19
|
+
readonly contractCount: number;
|
|
20
|
+
readonly expiresAt: Date;
|
|
21
|
+
} | {
|
|
22
|
+
readonly source: QuerySource.pqs;
|
|
23
|
+
readonly cached: false;
|
|
24
|
+
};
|
|
11
25
|
export interface QueryDelegate<TRow, TWhere, TSelect, TOrderBy, TUnique, TInclude = never, TGroupBy = never, TGroupRow = never> {
|
|
12
26
|
findMany<TArgs extends FindManyArgs<TWhere, TSelect, TOrderBy, TInclude>>(args?: TArgs): Promise<readonly (TRow & JsonProjectionResult<TArgs>)[]>;
|
|
13
27
|
findUnique<TArgs extends {
|
|
@@ -36,6 +50,8 @@ export type QueryCollectionDelegate<TRow, TWhere, TSelect, TOrderBy, TInclude =
|
|
|
36
50
|
export interface QueryClient {
|
|
37
51
|
readonly source: QuerySource;
|
|
38
52
|
$queryRaw<TRow>(sql: string, values?: readonly unknown[]): Promise<readonly TRow[]>;
|
|
53
|
+
cacheContracts(args?: ContractCacheArgs): Promise<ContractCacheResult>;
|
|
54
|
+
invalidateContractsCache(args?: ContractCacheArgs): Promise<void>;
|
|
39
55
|
readonly contracts: {
|
|
40
56
|
findMany<TArgs extends ContractFindManyArgs>(args?: TArgs): Promise<readonly (ContractResult & JsonProjectionResult<TArgs>)[]>;
|
|
41
57
|
findUnique<TArgs extends ContractFindUniqueArgs>(args: TArgs): Promise<(ContractResult & JsonProjectionResult<TArgs>) | undefined>;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { CommandSigners, ICommandSigner } from "../../core/signing/command-signer.interface.js";
|
|
2
2
|
import { RequestOptions } from "../../core/types/request-options.js";
|
|
3
3
|
import { ITransport } from "../../core/transports/transport.interface.js";
|
|
4
|
-
import {
|
|
4
|
+
import { SubmitCommandsRequest } from "../../core/types/requests/submit-commands-request.js";
|
|
5
5
|
import { SubmitCommandResponse } from "../../core/types/responses/submit-command-response.js";
|
|
6
6
|
import { SubmitCommandTransactionResponse } from "../../core/types/responses/submit-command-transaction-response.js";
|
|
7
7
|
import { PreparedCommandSubmission } from "../../core/types/prepared-command-submission.js";
|
|
@@ -9,9 +9,14 @@ import { SignCommandResult } from "../../core/signing/sign-command-result.js";
|
|
|
9
9
|
export declare class CommandServiceClient {
|
|
10
10
|
private readonly pipeline;
|
|
11
11
|
constructor(transport: ITransport, signer?: ICommandSigner | CommandSigners);
|
|
12
|
-
submitAndWaitForTransactionAsync(request:
|
|
12
|
+
submitAndWaitForTransactionAsync(request: SubmitCommandsRequest, options?: RequestOptions): Promise<SubmitCommandTransactionResponse>;
|
|
13
13
|
/** Submits a command and waits for the result. Supported on JSON and gRPC. */
|
|
14
|
-
submitAndWaitAsync(request:
|
|
15
|
-
|
|
14
|
+
submitAndWaitAsync(request: SubmitCommandsRequest, options?: RequestOptions): Promise<SubmitCommandResponse>;
|
|
15
|
+
/**
|
|
16
|
+
* Submits through the connected participant without external command signing.
|
|
17
|
+
* A configured command signer is deliberately ignored for this call.
|
|
18
|
+
*/
|
|
19
|
+
submitParticipantLocalAndWaitAsync(request: SubmitCommandsRequest, options?: RequestOptions): Promise<SubmitCommandResponse>;
|
|
20
|
+
prepareAsync(request: SubmitCommandsRequest, options?: RequestOptions): Promise<PreparedCommandSubmission>;
|
|
16
21
|
executeAndWaitAsync(prepared: PreparedCommandSubmission, signatures: Readonly<Record<string, SignCommandResult>>, options?: RequestOptions): Promise<SubmitCommandResponse>;
|
|
17
22
|
}
|
|
@@ -7,11 +7,24 @@ export class CommandServiceClient {
|
|
|
7
7
|
signer,
|
|
8
8
|
});
|
|
9
9
|
}
|
|
10
|
-
submitAndWaitForTransactionAsync(request, options) {
|
|
10
|
+
submitAndWaitForTransactionAsync(request, options) {
|
|
11
|
+
return this.pipeline.submitForTransactionAsync(request, options);
|
|
12
|
+
}
|
|
11
13
|
/** Submits a command and waits for the result. Supported on JSON and gRPC. */
|
|
12
14
|
submitAndWaitAsync(request, options) {
|
|
13
15
|
return this.pipeline.submitAsync(request, options);
|
|
14
16
|
}
|
|
15
|
-
|
|
16
|
-
|
|
17
|
+
/**
|
|
18
|
+
* Submits through the connected participant without external command signing.
|
|
19
|
+
* A configured command signer is deliberately ignored for this call.
|
|
20
|
+
*/
|
|
21
|
+
submitParticipantLocalAndWaitAsync(request, options) {
|
|
22
|
+
return this.pipeline.submitParticipantLocalAsync(request, options);
|
|
23
|
+
}
|
|
24
|
+
prepareAsync(request, options) {
|
|
25
|
+
return this.pipeline.prepareAsync(request, options);
|
|
26
|
+
}
|
|
27
|
+
executeAndWaitAsync(prepared, signatures, options) {
|
|
28
|
+
return this.pipeline.executeAsync(prepared, signatures, options);
|
|
29
|
+
}
|
|
17
30
|
}
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import { ITransport } from "../../core/transports/transport.interface.js";
|
|
2
|
-
import {
|
|
2
|
+
import { SubmitCommandsRequest } from "../../core/types/requests/submit-commands-request.js";
|
|
3
3
|
import { SubmitCommandResponse } from "../../core/types/responses/submit-command-response.js";
|
|
4
4
|
export declare class CommandSubmissionServiceClient {
|
|
5
5
|
private readonly transport;
|
|
6
6
|
constructor(transport: ITransport);
|
|
7
7
|
/** Submits a command without waiting. Placeholder until explicitly implemented. */
|
|
8
|
-
submitAsync(_request:
|
|
8
|
+
submitAsync(_request: SubmitCommandsRequest): Promise<SubmitCommandResponse>;
|
|
9
9
|
}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import {
|
|
2
|
-
export declare function buildCanonicalCommandPayload(request:
|
|
1
|
+
import { SubmitCommandsRequest } from "../../core/types/requests/submit-commands-request.js";
|
|
2
|
+
export declare function buildCanonicalCommandPayload(request: SubmitCommandsRequest): Uint8Array;
|
|
@@ -7,7 +7,7 @@ export function buildCanonicalCommandPayload(request) {
|
|
|
7
7
|
applicationId: request.applicationId,
|
|
8
8
|
actAs: request.actAs,
|
|
9
9
|
readAs: request.readAs,
|
|
10
|
-
|
|
10
|
+
commands: request.commands.map(mapCanonicalCommand),
|
|
11
11
|
}));
|
|
12
12
|
}
|
|
13
13
|
function mapCanonicalCommand(command) {
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { CommandSigners, ICommandSigner } from "../../core/signing/command-signer.interface.js";
|
|
2
2
|
import { ITransport } from "../../core/transports/transport.interface.js";
|
|
3
3
|
import { RequestOptions } from "../../core/types/request-options.js";
|
|
4
|
-
import {
|
|
4
|
+
import { SubmitCommandsRequest } from "../../core/types/requests/submit-commands-request.js";
|
|
5
5
|
import { SubmitCommandResponse } from "../../core/types/responses/submit-command-response.js";
|
|
6
6
|
import { SubmitCommandTransactionResponse } from "../../core/types/responses/submit-command-transaction-response.js";
|
|
7
7
|
import { PreparedCommandSubmission } from "../../core/types/prepared-command-submission.js";
|
|
@@ -12,8 +12,9 @@ export declare class CommandSubmissionPipeline {
|
|
|
12
12
|
transport: ITransport;
|
|
13
13
|
signer?: ICommandSigner | CommandSigners;
|
|
14
14
|
});
|
|
15
|
-
submitAsync(request:
|
|
16
|
-
|
|
17
|
-
|
|
15
|
+
submitAsync(request: SubmitCommandsRequest, options?: RequestOptions): Promise<SubmitCommandResponse>;
|
|
16
|
+
submitParticipantLocalAsync(request: SubmitCommandsRequest, options?: RequestOptions): Promise<SubmitCommandResponse>;
|
|
17
|
+
submitForTransactionAsync(request: SubmitCommandsRequest, options?: RequestOptions): Promise<SubmitCommandTransactionResponse>;
|
|
18
|
+
prepareAsync(request: SubmitCommandsRequest, options?: RequestOptions): Promise<PreparedCommandSubmission>;
|
|
18
19
|
executeAsync(prepared: PreparedCommandSubmission, signatures: Readonly<Record<string, SignCommandResult>>, options?: RequestOptions): Promise<SubmitCommandResponse>;
|
|
19
20
|
}
|
|
@@ -12,10 +12,25 @@ export class CommandSubmissionPipeline {
|
|
|
12
12
|
}
|
|
13
13
|
return this.dependencies.transport.submitCommandAsync(request, this.dependencies.signer, options);
|
|
14
14
|
}
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
15
|
+
submitParticipantLocalAsync(request, options) {
|
|
16
|
+
return this.dependencies.transport.submitCommandAsync(request, undefined, options);
|
|
17
|
+
}
|
|
18
|
+
submitForTransactionAsync(request, options) {
|
|
19
|
+
if (!this.dependencies.transport.submitCommandForTransactionAsync) {
|
|
20
|
+
throw new NotSupportedError("transaction-returning command submission is not supported by the selected transport");
|
|
21
|
+
}
|
|
22
|
+
return this.dependencies.transport.submitCommandForTransactionAsync(request, options);
|
|
23
|
+
}
|
|
24
|
+
prepareAsync(request, options) {
|
|
25
|
+
if (!this.dependencies.transport.prepareCommandAsync) {
|
|
26
|
+
throw new NotSupportedError("interactive command preparation is not supported by the selected transport");
|
|
27
|
+
}
|
|
28
|
+
return this.dependencies.transport.prepareCommandAsync(request, options);
|
|
29
|
+
}
|
|
30
|
+
executeAsync(prepared, signatures, options) {
|
|
31
|
+
if (!this.dependencies.transport.executePreparedCommandAndWaitAsync) {
|
|
32
|
+
throw new NotSupportedError("interactive command execution is not supported by the selected transport");
|
|
33
|
+
}
|
|
34
|
+
return this.dependencies.transport.executePreparedCommandAndWaitAsync(prepared, signatures, options);
|
|
35
|
+
}
|
|
21
36
|
}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { CreateCommand } from "../../core/types/commands/create-command.js";
|
|
2
2
|
import { ExerciseCommand } from "../../core/types/commands/exercise-command.js";
|
|
3
3
|
import { DamlRecord } from "../../core/types/daml-values.js";
|
|
4
|
-
import {
|
|
4
|
+
import { SubmitCommandsRequest } from "../../core/types/requests/submit-commands-request.js";
|
|
5
5
|
import { TestingConfigurationError } from "../errors/testing-configuration-error.js";
|
|
6
6
|
import { toCampaignMetricOutcome, } from "./canton-test-runtime.js";
|
|
7
7
|
/**
|
|
@@ -18,11 +18,11 @@ export async function executeDeclarativeActionAsync(init) {
|
|
|
18
18
|
templateId: init.action.templateId,
|
|
19
19
|
createArguments: new DamlRecord({ ...init.action.payload }),
|
|
20
20
|
});
|
|
21
|
-
return toCampaignMetricOutcome(await init.runtime.submitAndWaitAsync(init.action.actor, new
|
|
21
|
+
return toCampaignMetricOutcome(await init.runtime.submitAndWaitAsync(init.action.actor, new SubmitCommandsRequest({
|
|
22
22
|
applicationId: init.applicationId,
|
|
23
23
|
actAs: route.actAs,
|
|
24
24
|
readAs: route.readAs,
|
|
25
|
-
command,
|
|
25
|
+
commands: [command],
|
|
26
26
|
})));
|
|
27
27
|
}
|
|
28
28
|
async function createExerciseCommandAsync(action, resolveContractIdAsync) {
|
|
@@ -6,7 +6,7 @@ import { ListKnownPartiesRequest } from "../../core/types/requests/list-known-pa
|
|
|
6
6
|
import { ListPartyToParticipantRequest } from "../../core/types/requests/list-party-to-participant-request.js";
|
|
7
7
|
import { ListUserRightsRequest } from "../../core/types/requests/list-user-rights-request.js";
|
|
8
8
|
import { ListUsersRequest } from "../../core/types/requests/list-users-request.js";
|
|
9
|
-
import {
|
|
9
|
+
import { SubmitCommandsRequest } from "../../core/types/requests/submit-commands-request.js";
|
|
10
10
|
import { CommandSigners, ICommandSigner } from "../../core/signing/command-signer.interface.js";
|
|
11
11
|
import { SignCommandResult } from "../../core/signing/sign-command-result.js";
|
|
12
12
|
import { PreparedCommandSubmission } from "../../core/types/prepared-command-submission.js";
|
|
@@ -151,9 +151,9 @@ export declare class GrpcTransport implements ITransport {
|
|
|
151
151
|
getUpdateByHashAsync(request: GetUpdateByHashRequest, options?: RequestOptions): Promise<ProtobufGetUpdateResponse>;
|
|
152
152
|
getUpdatesPageAsync(request: GetUpdatesPageRequest, options?: RequestOptions): Promise<ProtobufGetUpdatesPageResponse>;
|
|
153
153
|
getCompletionsAsync(request: GetCompletionsRequest, options?: RequestOptions): AsyncIterable<ProtobufCompletionStreamResponse>;
|
|
154
|
-
submitCommandAsync(request:
|
|
155
|
-
submitCommandForTransactionAsync(request:
|
|
156
|
-
prepareCommandAsync(request:
|
|
154
|
+
submitCommandAsync(request: SubmitCommandsRequest, signer?: ICommandSigner | CommandSigners, options?: RequestOptions): Promise<SubmitCommandResponse>;
|
|
155
|
+
submitCommandForTransactionAsync(request: SubmitCommandsRequest, options?: RequestOptions): Promise<import("../../core/types/responses/submit-command-transaction-response.js").SubmitCommandTransactionResponse>;
|
|
156
|
+
prepareCommandAsync(request: SubmitCommandsRequest, options?: RequestOptions): Promise<PreparedCommandSubmission>;
|
|
157
157
|
executePreparedCommandAndWaitAsync(prepared: PreparedCommandSubmission, signatures: Readonly<Record<string, SignCommandResult>>, options?: RequestOptions): Promise<SubmitCommandResponse>;
|
|
158
158
|
private throwIfDisposed;
|
|
159
159
|
private throwPartyTopologyReadCompatibilityError;
|
|
@@ -7,7 +7,7 @@ import { ListKnownPartiesResponse as SdkListKnownPartiesResponse } from "../../c
|
|
|
7
7
|
import { NotSupportedError } from "../../core/errors/not-supported-error.js";
|
|
8
8
|
import { TransportError } from "../../core/errors/transport-error.js";
|
|
9
9
|
import { createGrpcOperations, } from "./grpc-channel-factory.js";
|
|
10
|
-
import { mapGrpcSubmitCommand,
|
|
10
|
+
import { mapGrpcSubmitCommand, mapGrpcSubmitCommandsForTransactionRequest, mapGrpcSubmitCommandTransaction, mapGrpcSubmitCommandsRequest, } from "./mappers/commands-mapper.js";
|
|
11
11
|
import { mapGrpcExecuteSubmissionAndWaitRequest, mapGrpcInteractiveSubmitCommand, mapGrpcPrepareSubmissionRequest, } from "./mappers/interactive-command-mapper.js";
|
|
12
12
|
import { mapGrpcCreateParty, mapGrpcCreatePartyRequest, mapGrpcListParties, mapGrpcListPartiesRequest } from "./mappers/parties-mapper.js";
|
|
13
13
|
import { mapGrpcListPartyToParticipantRequest, mapGrpcListPartyToParticipantResponse, } from "./mappers/topology-manager-read-mapper.js";
|
|
@@ -487,7 +487,7 @@ export class GrpcTransport {
|
|
|
487
487
|
async submitCommandAsync(request, signer, options) {
|
|
488
488
|
this.throwIfDisposed();
|
|
489
489
|
if (!signer) {
|
|
490
|
-
const payload = await this.operations.submitCommandAsync(
|
|
490
|
+
const payload = await this.operations.submitCommandAsync(mapGrpcSubmitCommandsRequest(request), options);
|
|
491
491
|
return mapGrpcSubmitCommand(payload);
|
|
492
492
|
}
|
|
493
493
|
else if (request.actAs.length !== 1 && !("signAsync" in signer)) {
|
|
@@ -529,7 +529,7 @@ export class GrpcTransport {
|
|
|
529
529
|
if (!this.operations.submitCommandForTransactionAsync) {
|
|
530
530
|
throw new NotSupportedError("transaction-returning command submission is not available on this transport");
|
|
531
531
|
}
|
|
532
|
-
return mapGrpcSubmitCommandTransaction(await this.operations.submitCommandForTransactionAsync(
|
|
532
|
+
return mapGrpcSubmitCommandTransaction(await this.operations.submitCommandForTransactionAsync(mapGrpcSubmitCommandsForTransactionRequest(request), options));
|
|
533
533
|
}
|
|
534
534
|
async prepareCommandAsync(request, options) {
|
|
535
535
|
if (!this.operations.prepareSubmissionAsync) {
|
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
import { CreateCommand } from "../../../core/types/commands/create-command.js";
|
|
2
2
|
import { DamlRecord } from "../../../core/types/daml-values.js";
|
|
3
3
|
import { LedgerCommand } from "../../../core/types/commands/ledger-command.js";
|
|
4
|
-
import {
|
|
4
|
+
import { SubmitCommandsRequest } from "../../../core/types/requests/submit-commands-request.js";
|
|
5
5
|
import { SubmitCommandResponse } from "../../../core/types/responses/submit-command-response.js";
|
|
6
6
|
import { SubmitCommandTransactionResponse } from "../../../core/types/responses/submit-command-transaction-response.js";
|
|
7
7
|
import { Command } from "../generated/canton/com/daml/ledger/api/v2/commands.js";
|
|
8
8
|
import { SubmitAndWaitRequest, SubmitAndWaitResponse, SubmitAndWaitForTransactionRequest, SubmitAndWaitForTransactionResponse } from "../generated/canton/com/daml/ledger/api/v2/command_service.js";
|
|
9
9
|
import { Record as GrpcRecord, Value } from "../generated/canton/com/daml/ledger/api/v2/value.js";
|
|
10
|
-
export declare function
|
|
11
|
-
export declare function
|
|
10
|
+
export declare function mapGrpcSubmitCommandsRequest(request: SubmitCommandsRequest): SubmitAndWaitRequest;
|
|
11
|
+
export declare function mapGrpcSubmitCommandsForTransactionRequest(request: SubmitCommandsRequest): SubmitAndWaitForTransactionRequest;
|
|
12
12
|
export declare function mapGrpcSubmitCommandTransaction(payload: SubmitAndWaitForTransactionResponse): SubmitCommandTransactionResponse;
|
|
13
13
|
export declare function mapGrpcSubmitCommand(payload: {
|
|
14
14
|
commandId?: string;
|
|
@@ -11,13 +11,13 @@ import { ExerciseCommand } from "../../../core/types/commands/exercise-command.j
|
|
|
11
11
|
import { SubmitCommandResponse } from "../../../core/types/responses/submit-command-response.js";
|
|
12
12
|
import { SubmitCommandTransactionResponse } from "../../../core/types/responses/submit-command-transaction-response.js";
|
|
13
13
|
import { mapGrpcDeduplicationPeriod } from "./command-deduplication-mapper.js";
|
|
14
|
-
export function
|
|
14
|
+
export function mapGrpcSubmitCommandsRequest(request) {
|
|
15
15
|
return {
|
|
16
16
|
commands: {
|
|
17
17
|
workflowId: "",
|
|
18
18
|
userId: request.userId ?? "",
|
|
19
19
|
commandId: request.commandId ?? randomUUID(),
|
|
20
|
-
commands:
|
|
20
|
+
commands: request.commands.map(mapGrpcLedgerCommand),
|
|
21
21
|
deduplicationPeriod: mapGrpcDeduplicationPeriod(request.deduplicationPeriod, { allowParticipantBegin: true }),
|
|
22
22
|
actAs: [...request.actAs],
|
|
23
23
|
readAs: [...request.readAs],
|
|
@@ -29,8 +29,8 @@ export function mapGrpcSubmitCommandRequest(request) {
|
|
|
29
29
|
},
|
|
30
30
|
};
|
|
31
31
|
}
|
|
32
|
-
export function
|
|
33
|
-
return { commands:
|
|
32
|
+
export function mapGrpcSubmitCommandsForTransactionRequest(request) {
|
|
33
|
+
return { commands: mapGrpcSubmitCommandsRequest(request).commands };
|
|
34
34
|
}
|
|
35
35
|
export function mapGrpcSubmitCommandTransaction(payload) {
|
|
36
36
|
const transaction = payload.transaction;
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import { SignCommandResult } from "../../../core/signing/sign-command-result.js";
|
|
2
|
-
import {
|
|
2
|
+
import { SubmitCommandsRequest } from "../../../core/types/requests/submit-commands-request.js";
|
|
3
3
|
import { SubmitCommandResponse } from "../../../core/types/responses/submit-command-response.js";
|
|
4
4
|
import { Signature } from "../generated/canton/com/daml/ledger/api/v2/crypto.js";
|
|
5
5
|
import { ExecuteSubmissionAndWaitRequest, ExecuteSubmissionAndWaitResponse, HashingSchemeVersion, PrepareSubmissionRequest, PreparedTransaction } from "../generated/canton/com/daml/ledger/api/v2/interactive/interactive_submission_service.js";
|
|
6
|
-
export declare function mapGrpcPrepareSubmissionRequest(request:
|
|
6
|
+
export declare function mapGrpcPrepareSubmissionRequest(request: SubmitCommandsRequest, commandId: string): PrepareSubmissionRequest;
|
|
7
7
|
export declare function mapGrpcExecuteSubmissionAndWaitRequest(init: {
|
|
8
|
-
request:
|
|
8
|
+
request: SubmitCommandsRequest;
|
|
9
9
|
preparedTransaction: PreparedTransaction;
|
|
10
10
|
hashingSchemeVersion: HashingSchemeVersion;
|
|
11
11
|
submissionId: string;
|
|
@@ -10,7 +10,7 @@ export function mapGrpcPrepareSubmissionRequest(request, commandId) {
|
|
|
10
10
|
return {
|
|
11
11
|
userId: request.userId ?? "",
|
|
12
12
|
commandId,
|
|
13
|
-
commands:
|
|
13
|
+
commands: request.commands.map(mapGrpcLedgerCommand),
|
|
14
14
|
actAs: [...request.actAs],
|
|
15
15
|
readAs: [...request.readAs],
|
|
16
16
|
disclosedContracts: request.disclosedContracts.map(value => ({ createdEventBlob: value.createdEventBlob, contractId: value.contractId ?? "", synchronizerId: value.synchronizerId ?? "", templateId: value.templateId === undefined ? undefined : { packageId: value.templateId.packageId, moduleName: value.templateId.moduleName, entityName: value.templateId.entityName } })),
|
|
@@ -5,7 +5,7 @@ import { ListKnownPartiesRequest } from "../../core/types/requests/list-known-pa
|
|
|
5
5
|
import { ListPartyToParticipantRequest } from "../../core/types/requests/list-party-to-participant-request.js";
|
|
6
6
|
import { ListUserRightsRequest } from "../../core/types/requests/list-user-rights-request.js";
|
|
7
7
|
import { ListUsersRequest } from "../../core/types/requests/list-users-request.js";
|
|
8
|
-
import {
|
|
8
|
+
import { SubmitCommandsRequest } from "../../core/types/requests/submit-commands-request.js";
|
|
9
9
|
import { AllocatePartyResponse } from "../../core/types/responses/allocate-party-response.js";
|
|
10
10
|
import { GetUserResponse } from "../../core/types/responses/get-user-response.js";
|
|
11
11
|
import { ListPartyToParticipantResponse } from "../../core/types/responses/list-party-to-participant-response.js";
|
|
@@ -150,6 +150,6 @@ export declare class JsonTransport implements ITransport {
|
|
|
150
150
|
getUpdateByHashAsync(_request: GetUpdateByHashRequest, _options?: RequestOptions): Promise<GetUpdateResponse>;
|
|
151
151
|
getUpdatesPageAsync(_request: GetUpdatesPageRequest, _options?: RequestOptions): Promise<GetUpdatesPageResponse>;
|
|
152
152
|
getCompletionsAsync(_request: GetCompletionsRequest, _options?: RequestOptions): AsyncIterable<CompletionStreamResponse>;
|
|
153
|
-
submitCommandAsync(request:
|
|
153
|
+
submitCommandAsync(request: SubmitCommandsRequest, signer?: ICommandSigner, options?: RequestOptions): Promise<SubmitCommandResponse>;
|
|
154
154
|
private throwIfDisposed;
|
|
155
155
|
}
|
|
@@ -3,7 +3,7 @@ import { ListKnownPartiesResponse } from "../../core/types/responses/list-known-
|
|
|
3
3
|
import { NotSupportedError } from "../../core/errors/not-supported-error.js";
|
|
4
4
|
import { GetLedgerApiVersionResponse } from "../grpc/generated/canton/com/daml/ledger/api/v2/version_service.js";
|
|
5
5
|
import { ObjectDisposedError } from "../../core/errors/object-disposed-error.js";
|
|
6
|
-
import { mapJsonSubmitCommand,
|
|
6
|
+
import { mapJsonSubmitCommand, mapJsonSubmitCommandsRequest, } from "./mappers/commands-mapper.js";
|
|
7
7
|
import { UploadDarFileResponse } from "../grpc/generated/canton/com/daml/ledger/api/v2/admin/package_management_service.js";
|
|
8
8
|
import { mapJsonAllocatePartyRequest, mapJsonCreateParty, mapJsonListParties, } from "./mappers/parties-mapper.js";
|
|
9
9
|
import { mapJsonTransactionEvents } from "./mappers/events-mapper.js";
|
|
@@ -451,7 +451,7 @@ export class JsonTransport {
|
|
|
451
451
|
if (signer) {
|
|
452
452
|
throw new NotSupportedError("command signing is not supported by json transport");
|
|
453
453
|
}
|
|
454
|
-
const payload = await this.httpClient.postAsync("/v2/commands/submit-and-wait",
|
|
454
|
+
const payload = await this.httpClient.postAsync("/v2/commands/submit-and-wait", mapJsonSubmitCommandsRequest(request), options);
|
|
455
455
|
return mapJsonSubmitCommand(payload);
|
|
456
456
|
}
|
|
457
457
|
throwIfDisposed() {
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { SubmitCommandsRequest } from "../../../core/types/requests/submit-commands-request.js";
|
|
2
2
|
import { SubmitCommandResponse } from "../../../core/types/responses/submit-command-response.js";
|
|
3
|
-
export declare function
|
|
3
|
+
export declare function mapJsonSubmitCommandsRequest(request: SubmitCommandsRequest): {
|
|
4
4
|
commandId: string;
|
|
5
5
|
actAs: readonly string[];
|
|
6
6
|
readAs: readonly string[];
|
|
@@ -9,7 +9,7 @@ import { DamlRecord } from "../../../core/types/daml-values.js";
|
|
|
9
9
|
import { ExerciseByKeyCommand } from "../../../core/types/commands/exercise-by-key-command.js";
|
|
10
10
|
import { ExerciseCommand } from "../../../core/types/commands/exercise-command.js";
|
|
11
11
|
import { SubmitCommandResponse } from "../../../core/types/responses/submit-command-response.js";
|
|
12
|
-
export function
|
|
12
|
+
export function mapJsonSubmitCommandsRequest(request) {
|
|
13
13
|
if (request.deduplicationPeriod !== undefined) {
|
|
14
14
|
throw new TransportError("command deduplication periods are not supported by the JSON transport");
|
|
15
15
|
}
|
|
@@ -17,7 +17,7 @@ export function mapJsonSubmitCommandRequest(request) {
|
|
|
17
17
|
commandId: request.commandId ?? randomUUID(),
|
|
18
18
|
actAs: request.actAs,
|
|
19
19
|
readAs: request.readAs,
|
|
20
|
-
commands:
|
|
20
|
+
commands: request.commands.map(mapJsonCommand),
|
|
21
21
|
applicationId: request.applicationId || undefined,
|
|
22
22
|
};
|
|
23
23
|
}
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
#!/usr/bin/env bash
|
|
2
|
+
set -euo pipefail
|
|
3
|
+
|
|
4
|
+
REPO_ROOT="$(cd -- "$(dirname -- "${BASH_SOURCE[0]}")/.." && pwd)"
|
|
5
|
+
START_SCRIPT="$REPO_ROOT/node/start-local-splice-0.6.12.sh"
|
|
6
|
+
|
|
7
|
+
[[ -x "$START_SCRIPT" ]]
|
|
8
|
+
|
|
9
|
+
tmpdir="$(mktemp -d)"
|
|
10
|
+
trap 'rm -rf "$tmpdir"' EXIT
|
|
11
|
+
|
|
12
|
+
stub="$tmpdir/stub-start-local.sh"
|
|
13
|
+
cat > "$stub" <<'EOF'
|
|
14
|
+
#!/usr/bin/env bash
|
|
15
|
+
set -euo pipefail
|
|
16
|
+
printf 'IMAGE_TAG=%s\n' "${IMAGE_TAG:-}"
|
|
17
|
+
printf 'args=%s\n' "$*"
|
|
18
|
+
EOF
|
|
19
|
+
chmod +x "$stub"
|
|
20
|
+
|
|
21
|
+
default_output="$(START_LOCAL_SCRIPT="$stub" "$START_SCRIPT" one two)"
|
|
22
|
+
grep -Fqx 'IMAGE_TAG=0.6.12' <<<"$default_output"
|
|
23
|
+
grep -Fqx 'args=one two' <<<"$default_output"
|
|
24
|
+
|
|
25
|
+
override_output="$(IMAGE_TAG=custom-tag START_LOCAL_SCRIPT="$stub" "$START_SCRIPT")"
|
|
26
|
+
grep -Fqx 'IMAGE_TAG=custom-tag' <<<"$override_output"
|
|
27
|
+
|
|
28
|
+
echo "test-start-local-splice-0.6.12.sh: all cases passed"
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
#!/usr/bin/env bash
|
|
2
|
+
set -euo pipefail
|
|
3
|
+
|
|
4
|
+
REPO_ROOT="$(cd -- "$(dirname -- "${BASH_SOURCE[0]}")/.." && pwd)"
|
|
5
|
+
START_SCRIPT="$REPO_ROOT/node/start-local-splice-0.6.13.sh"
|
|
6
|
+
|
|
7
|
+
[[ -x "$START_SCRIPT" ]]
|
|
8
|
+
|
|
9
|
+
tmpdir="$(mktemp -d)"
|
|
10
|
+
trap 'rm -rf "$tmpdir"' EXIT
|
|
11
|
+
|
|
12
|
+
stub="$tmpdir/stub-start-local.sh"
|
|
13
|
+
cat > "$stub" <<'EOF'
|
|
14
|
+
#!/usr/bin/env bash
|
|
15
|
+
set -euo pipefail
|
|
16
|
+
printf 'IMAGE_TAG=%s\n' "${IMAGE_TAG:-}"
|
|
17
|
+
printf 'args=%s\n' "$*"
|
|
18
|
+
EOF
|
|
19
|
+
chmod +x "$stub"
|
|
20
|
+
|
|
21
|
+
default_output="$(START_LOCAL_SCRIPT="$stub" "$START_SCRIPT" one two)"
|
|
22
|
+
grep -Fqx 'IMAGE_TAG=0.6.13' <<<"$default_output"
|
|
23
|
+
grep -Fqx 'args=one two' <<<"$default_output"
|
|
24
|
+
|
|
25
|
+
override_output="$(IMAGE_TAG=custom-tag START_LOCAL_SCRIPT="$stub" "$START_SCRIPT")"
|
|
26
|
+
grep -Fqx 'IMAGE_TAG=custom-tag' <<<"$override_output"
|
|
27
|
+
|
|
28
|
+
echo "test-start-local-splice-0.6.13.sh: all cases passed"
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
#!/usr/bin/env bash
|
|
2
|
+
set -euo pipefail
|
|
3
|
+
|
|
4
|
+
REPO_ROOT="$(cd -- "$(dirname -- "${BASH_SOURCE[0]}")/.." && pwd)"
|
|
5
|
+
START_SCRIPT="$REPO_ROOT/node/start-local-splice-0.6.14.sh"
|
|
6
|
+
|
|
7
|
+
[[ -x "$START_SCRIPT" ]]
|
|
8
|
+
|
|
9
|
+
tmpdir="$(mktemp -d)"
|
|
10
|
+
trap 'rm -rf "$tmpdir"' EXIT
|
|
11
|
+
|
|
12
|
+
stub="$tmpdir/stub-start-local.sh"
|
|
13
|
+
cat > "$stub" <<'EOF'
|
|
14
|
+
#!/usr/bin/env bash
|
|
15
|
+
set -euo pipefail
|
|
16
|
+
printf 'IMAGE_TAG=%s\n' "${IMAGE_TAG:-}"
|
|
17
|
+
printf 'args=%s\n' "$*"
|
|
18
|
+
EOF
|
|
19
|
+
chmod +x "$stub"
|
|
20
|
+
|
|
21
|
+
default_output="$(START_LOCAL_SCRIPT="$stub" "$START_SCRIPT" one two)"
|
|
22
|
+
grep -Fqx 'IMAGE_TAG=0.6.14' <<<"$default_output"
|
|
23
|
+
grep -Fqx 'args=one two' <<<"$default_output"
|
|
24
|
+
|
|
25
|
+
override_output="$(IMAGE_TAG=custom-tag START_LOCAL_SCRIPT="$stub" "$START_SCRIPT")"
|
|
26
|
+
grep -Fqx 'IMAGE_TAG=custom-tag' <<<"$override_output"
|
|
27
|
+
|
|
28
|
+
echo "test-start-local-splice-0.6.14.sh: all cases passed"
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
#!/usr/bin/env bash
|
|
2
|
+
set -euo pipefail
|
|
3
|
+
|
|
4
|
+
REPO_ROOT="$(cd -- "$(dirname -- "${BASH_SOURCE[0]}")/.." && pwd)"
|
|
5
|
+
START_SCRIPT="$REPO_ROOT/node/start-local-splice-0.7.0.sh"
|
|
6
|
+
|
|
7
|
+
[[ -x "$START_SCRIPT" ]]
|
|
8
|
+
|
|
9
|
+
tmpdir="$(mktemp -d)"
|
|
10
|
+
trap 'rm -rf "$tmpdir"' EXIT
|
|
11
|
+
|
|
12
|
+
stub="$tmpdir/stub-start-local.sh"
|
|
13
|
+
cat > "$stub" <<'EOF'
|
|
14
|
+
#!/usr/bin/env bash
|
|
15
|
+
set -euo pipefail
|
|
16
|
+
printf 'IMAGE_TAG=%s\n' "${IMAGE_TAG:-}"
|
|
17
|
+
printf 'args=%s\n' "$*"
|
|
18
|
+
EOF
|
|
19
|
+
chmod +x "$stub"
|
|
20
|
+
|
|
21
|
+
default_output="$(START_LOCAL_SCRIPT="$stub" "$START_SCRIPT" one two)"
|
|
22
|
+
grep -Fqx 'IMAGE_TAG=0.7.0' <<<"$default_output"
|
|
23
|
+
grep -Fqx 'args=one two' <<<"$default_output"
|
|
24
|
+
|
|
25
|
+
override_output="$(IMAGE_TAG=custom-tag START_LOCAL_SCRIPT="$stub" "$START_SCRIPT")"
|
|
26
|
+
grep -Fqx 'IMAGE_TAG=custom-tag' <<<"$override_output"
|
|
27
|
+
|
|
28
|
+
echo "test-start-local-splice-0.7.0.sh: all cases passed"
|