@distrohelena/canton-typescript-sdk 0.1.35 → 0.1.37
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 +159 -51
- 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 +655 -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/services/state/state-service-client.js +56 -0
- 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 +646 -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/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 +15 -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/services/state/state-service-client.d.ts +4 -0
- package/dist/services/state/state-service-client.js +56 -0
- 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/package.json +8 -3
- 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
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.quotePqsIdentifier = quotePqsIdentifier;
|
|
4
|
+
exports.quotePqsString = quotePqsString;
|
|
5
|
+
function quotePqsIdentifier(value) {
|
|
6
|
+
return `"${value.replaceAll('"', '""')}"`;
|
|
7
|
+
}
|
|
8
|
+
function quotePqsString(value) {
|
|
9
|
+
return `'${value.replaceAll("'", "''")}'`;
|
|
10
|
+
}
|
|
@@ -10,12 +10,25 @@ class CommandServiceClient {
|
|
|
10
10
|
signer,
|
|
11
11
|
});
|
|
12
12
|
}
|
|
13
|
-
submitAndWaitForTransactionAsync(request, options) {
|
|
13
|
+
submitAndWaitForTransactionAsync(request, options) {
|
|
14
|
+
return this.pipeline.submitForTransactionAsync(request, options);
|
|
15
|
+
}
|
|
14
16
|
/** Submits a command and waits for the result. Supported on JSON and gRPC. */
|
|
15
17
|
submitAndWaitAsync(request, options) {
|
|
16
18
|
return this.pipeline.submitAsync(request, options);
|
|
17
19
|
}
|
|
18
|
-
|
|
19
|
-
|
|
20
|
+
/**
|
|
21
|
+
* Submits through the connected participant without external command signing.
|
|
22
|
+
* A configured command signer is deliberately ignored for this call.
|
|
23
|
+
*/
|
|
24
|
+
submitParticipantLocalAndWaitAsync(request, options) {
|
|
25
|
+
return this.pipeline.submitParticipantLocalAsync(request, options);
|
|
26
|
+
}
|
|
27
|
+
prepareAsync(request, options) {
|
|
28
|
+
return this.pipeline.prepareAsync(request, options);
|
|
29
|
+
}
|
|
30
|
+
executeAndWaitAsync(prepared, signatures, options) {
|
|
31
|
+
return this.pipeline.executeAsync(prepared, signatures, options);
|
|
32
|
+
}
|
|
20
33
|
}
|
|
21
34
|
exports.CommandServiceClient = CommandServiceClient;
|
|
@@ -10,7 +10,7 @@ function buildCanonicalCommandPayload(request) {
|
|
|
10
10
|
applicationId: request.applicationId,
|
|
11
11
|
actAs: request.actAs,
|
|
12
12
|
readAs: request.readAs,
|
|
13
|
-
|
|
13
|
+
commands: request.commands.map(mapCanonicalCommand),
|
|
14
14
|
}));
|
|
15
15
|
}
|
|
16
16
|
function mapCanonicalCommand(command) {
|
|
@@ -15,11 +15,26 @@ class CommandSubmissionPipeline {
|
|
|
15
15
|
}
|
|
16
16
|
return this.dependencies.transport.submitCommandAsync(request, this.dependencies.signer, options);
|
|
17
17
|
}
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
18
|
+
submitParticipantLocalAsync(request, options) {
|
|
19
|
+
return this.dependencies.transport.submitCommandAsync(request, undefined, options);
|
|
20
|
+
}
|
|
21
|
+
submitForTransactionAsync(request, options) {
|
|
22
|
+
if (!this.dependencies.transport.submitCommandForTransactionAsync) {
|
|
23
|
+
throw new not_supported_error_js_1.NotSupportedError("transaction-returning command submission is not supported by the selected transport");
|
|
24
|
+
}
|
|
25
|
+
return this.dependencies.transport.submitCommandForTransactionAsync(request, options);
|
|
26
|
+
}
|
|
27
|
+
prepareAsync(request, options) {
|
|
28
|
+
if (!this.dependencies.transport.prepareCommandAsync) {
|
|
29
|
+
throw new not_supported_error_js_1.NotSupportedError("interactive command preparation is not supported by the selected transport");
|
|
30
|
+
}
|
|
31
|
+
return this.dependencies.transport.prepareCommandAsync(request, options);
|
|
32
|
+
}
|
|
33
|
+
executeAsync(prepared, signatures, options) {
|
|
34
|
+
if (!this.dependencies.transport.executePreparedCommandAndWaitAsync) {
|
|
35
|
+
throw new not_supported_error_js_1.NotSupportedError("interactive command execution is not supported by the selected transport");
|
|
36
|
+
}
|
|
37
|
+
return this.dependencies.transport.executePreparedCommandAndWaitAsync(prepared, signatures, options);
|
|
38
|
+
}
|
|
24
39
|
}
|
|
25
40
|
exports.CommandSubmissionPipeline = CommandSubmissionPipeline;
|
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.StateServiceClient = void 0;
|
|
4
|
+
const active_contracts_traversal_error_js_1 = require("../../core/errors/active-contracts-traversal-error.js");
|
|
5
|
+
const validation_error_js_1 = require("../../core/errors/validation-error.js");
|
|
4
6
|
class StateServiceClient {
|
|
5
7
|
transport;
|
|
6
8
|
constructor(transport) {
|
|
@@ -11,6 +13,10 @@ class StateServiceClient {
|
|
|
11
13
|
getActiveContractsPageAsync(request, options) {
|
|
12
14
|
return this.transport.getActiveContractsPageAsync(request, options);
|
|
13
15
|
}
|
|
16
|
+
/** Reads active-contract pages lazily. Supported on gRPC; JSON rejects it. */
|
|
17
|
+
getActiveContractsPagesAsync(request, options) {
|
|
18
|
+
return this.getActiveContractsPagesLazy(request, options);
|
|
19
|
+
}
|
|
14
20
|
/** Reads active contracts as a stream. JSON-backed; gRPC currently rejects it. */
|
|
15
21
|
getActiveContractsAsync(request, observer, options) {
|
|
16
22
|
return this.transport.getActiveContractsAsync(request, observer, options);
|
|
@@ -27,5 +33,55 @@ class StateServiceClient {
|
|
|
27
33
|
getLatestPrunedOffsetsAsync(request, options) {
|
|
28
34
|
return this.transport.getLatestPrunedOffsetsAsync(request, options);
|
|
29
35
|
}
|
|
36
|
+
async *getActiveContractsPagesLazy(request, options) {
|
|
37
|
+
if (request.pageToken && request.pageToken.length > 0) {
|
|
38
|
+
throw new validation_error_js_1.ValidationError("active contracts traversal must not start with a page token");
|
|
39
|
+
}
|
|
40
|
+
let pageRequest = request;
|
|
41
|
+
let pagesRead = 0;
|
|
42
|
+
let contractsRead = 0;
|
|
43
|
+
let activeAtOffset;
|
|
44
|
+
const observedPageTokens = new Set();
|
|
45
|
+
while (true) {
|
|
46
|
+
if (pagesRead >= options.maxPages) {
|
|
47
|
+
throw new active_contracts_traversal_error_js_1.ActiveContractsTraversalError("max-pages-exceeded", "active contracts traversal exceeded maxPages");
|
|
48
|
+
}
|
|
49
|
+
const response = await this.transport.getActiveContractsPageAsync(pageRequest, options.deadline.createRequestOptions());
|
|
50
|
+
pagesRead += 1;
|
|
51
|
+
if (typeof response.activeAtOffset !== "string" ||
|
|
52
|
+
response.activeAtOffset.trim().length === 0) {
|
|
53
|
+
throw new active_contracts_traversal_error_js_1.ActiveContractsTraversalError("missing-active-at-offset", "active contracts response is missing activeAtOffset");
|
|
54
|
+
}
|
|
55
|
+
else if (activeAtOffset === undefined) {
|
|
56
|
+
if (request.activeAtOffset !== undefined &&
|
|
57
|
+
request.activeAtOffset !== response.activeAtOffset) {
|
|
58
|
+
throw new active_contracts_traversal_error_js_1.ActiveContractsTraversalError("active-at-offset-mismatch", "active contracts response activeAtOffset does not match the request");
|
|
59
|
+
}
|
|
60
|
+
activeAtOffset = response.activeAtOffset;
|
|
61
|
+
}
|
|
62
|
+
else if (activeAtOffset !== response.activeAtOffset) {
|
|
63
|
+
throw new active_contracts_traversal_error_js_1.ActiveContractsTraversalError("active-at-offset-mismatch", "active contracts response activeAtOffset changed during traversal");
|
|
64
|
+
}
|
|
65
|
+
contractsRead += response.activeContracts.length;
|
|
66
|
+
if (contractsRead > options.maxContracts) {
|
|
67
|
+
throw new active_contracts_traversal_error_js_1.ActiveContractsTraversalError("max-contracts-exceeded", "active contracts traversal exceeded maxContracts");
|
|
68
|
+
}
|
|
69
|
+
yield response;
|
|
70
|
+
if (!response.nextPageToken || response.nextPageToken.length === 0) {
|
|
71
|
+
return;
|
|
72
|
+
}
|
|
73
|
+
const pageTokenKey = Array.from(response.nextPageToken).join(",");
|
|
74
|
+
if (observedPageTokens.has(pageTokenKey)) {
|
|
75
|
+
throw new active_contracts_traversal_error_js_1.ActiveContractsTraversalError("repeated-page-token", "active contracts traversal received a repeated page token");
|
|
76
|
+
}
|
|
77
|
+
observedPageTokens.add(pageTokenKey);
|
|
78
|
+
pageRequest = {
|
|
79
|
+
activeAtOffset,
|
|
80
|
+
eventFormat: request.eventFormat,
|
|
81
|
+
maxPageSize: request.maxPageSize,
|
|
82
|
+
pageToken: response.nextPageToken,
|
|
83
|
+
};
|
|
84
|
+
}
|
|
85
|
+
}
|
|
30
86
|
}
|
|
31
87
|
exports.StateServiceClient = StateServiceClient;
|
|
@@ -4,7 +4,7 @@ exports.executeDeclarativeActionAsync = executeDeclarativeActionAsync;
|
|
|
4
4
|
const create_command_js_1 = require("../../core/types/commands/create-command.js");
|
|
5
5
|
const exercise_command_js_1 = require("../../core/types/commands/exercise-command.js");
|
|
6
6
|
const daml_values_js_1 = require("../../core/types/daml-values.js");
|
|
7
|
-
const
|
|
7
|
+
const submit_commands_request_js_1 = require("../../core/types/requests/submit-commands-request.js");
|
|
8
8
|
const testing_configuration_error_js_1 = require("../errors/testing-configuration-error.js");
|
|
9
9
|
const canton_test_runtime_js_1 = require("./canton-test-runtime.js");
|
|
10
10
|
/**
|
|
@@ -21,11 +21,11 @@ async function executeDeclarativeActionAsync(init) {
|
|
|
21
21
|
templateId: init.action.templateId,
|
|
22
22
|
createArguments: new daml_values_js_1.DamlRecord({ ...init.action.payload }),
|
|
23
23
|
});
|
|
24
|
-
return (0, canton_test_runtime_js_1.toCampaignMetricOutcome)(await init.runtime.submitAndWaitAsync(init.action.actor, new
|
|
24
|
+
return (0, canton_test_runtime_js_1.toCampaignMetricOutcome)(await init.runtime.submitAndWaitAsync(init.action.actor, new submit_commands_request_js_1.SubmitCommandsRequest({
|
|
25
25
|
applicationId: init.applicationId,
|
|
26
26
|
actAs: route.actAs,
|
|
27
27
|
readAs: route.readAs,
|
|
28
|
-
command,
|
|
28
|
+
commands: [command],
|
|
29
29
|
})));
|
|
30
30
|
}
|
|
31
31
|
async function createExerciseCommandAsync(action, resolveContractIdAsync) {
|
|
@@ -491,7 +491,7 @@ class GrpcTransport {
|
|
|
491
491
|
async submitCommandAsync(request, signer, options) {
|
|
492
492
|
this.throwIfDisposed();
|
|
493
493
|
if (!signer) {
|
|
494
|
-
const payload = await this.operations.submitCommandAsync((0, commands_mapper_js_1.
|
|
494
|
+
const payload = await this.operations.submitCommandAsync((0, commands_mapper_js_1.mapGrpcSubmitCommandsRequest)(request), options);
|
|
495
495
|
return (0, commands_mapper_js_1.mapGrpcSubmitCommand)(payload);
|
|
496
496
|
}
|
|
497
497
|
else if (request.actAs.length !== 1 && !("signAsync" in signer)) {
|
|
@@ -533,7 +533,7 @@ class GrpcTransport {
|
|
|
533
533
|
if (!this.operations.submitCommandForTransactionAsync) {
|
|
534
534
|
throw new not_supported_error_js_1.NotSupportedError("transaction-returning command submission is not available on this transport");
|
|
535
535
|
}
|
|
536
|
-
return (0, commands_mapper_js_1.mapGrpcSubmitCommandTransaction)(await this.operations.submitCommandForTransactionAsync((0, commands_mapper_js_1.
|
|
536
|
+
return (0, commands_mapper_js_1.mapGrpcSubmitCommandTransaction)(await this.operations.submitCommandForTransactionAsync((0, commands_mapper_js_1.mapGrpcSubmitCommandsForTransactionRequest)(request), options));
|
|
537
537
|
}
|
|
538
538
|
async prepareCommandAsync(request, options) {
|
|
539
539
|
if (!this.operations.prepareSubmissionAsync) {
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.
|
|
4
|
-
exports.
|
|
3
|
+
exports.mapGrpcSubmitCommandsRequest = mapGrpcSubmitCommandsRequest;
|
|
4
|
+
exports.mapGrpcSubmitCommandsForTransactionRequest = mapGrpcSubmitCommandsForTransactionRequest;
|
|
5
5
|
exports.mapGrpcSubmitCommandTransaction = mapGrpcSubmitCommandTransaction;
|
|
6
6
|
exports.mapGrpcSubmitCommand = mapGrpcSubmitCommand;
|
|
7
7
|
exports.mapGrpcLedgerCommand = mapGrpcLedgerCommand;
|
|
@@ -21,13 +21,13 @@ const exercise_command_js_1 = require("../../../core/types/commands/exercise-com
|
|
|
21
21
|
const submit_command_response_js_1 = require("../../../core/types/responses/submit-command-response.js");
|
|
22
22
|
const submit_command_transaction_response_js_1 = require("../../../core/types/responses/submit-command-transaction-response.js");
|
|
23
23
|
const command_deduplication_mapper_js_1 = require("./command-deduplication-mapper.js");
|
|
24
|
-
function
|
|
24
|
+
function mapGrpcSubmitCommandsRequest(request) {
|
|
25
25
|
return {
|
|
26
26
|
commands: {
|
|
27
27
|
workflowId: "",
|
|
28
28
|
userId: request.userId ?? "",
|
|
29
29
|
commandId: request.commandId ?? (0, node_crypto_1.randomUUID)(),
|
|
30
|
-
commands:
|
|
30
|
+
commands: request.commands.map(mapGrpcLedgerCommand),
|
|
31
31
|
deduplicationPeriod: (0, command_deduplication_mapper_js_1.mapGrpcDeduplicationPeriod)(request.deduplicationPeriod, { allowParticipantBegin: true }),
|
|
32
32
|
actAs: [...request.actAs],
|
|
33
33
|
readAs: [...request.readAs],
|
|
@@ -39,8 +39,8 @@ function mapGrpcSubmitCommandRequest(request) {
|
|
|
39
39
|
},
|
|
40
40
|
};
|
|
41
41
|
}
|
|
42
|
-
function
|
|
43
|
-
return { commands:
|
|
42
|
+
function mapGrpcSubmitCommandsForTransactionRequest(request) {
|
|
43
|
+
return { commands: mapGrpcSubmitCommandsRequest(request).commands };
|
|
44
44
|
}
|
|
45
45
|
function mapGrpcSubmitCommandTransaction(payload) {
|
|
46
46
|
const transaction = payload.transaction;
|
|
@@ -16,7 +16,7 @@ function mapGrpcPrepareSubmissionRequest(request, commandId) {
|
|
|
16
16
|
return {
|
|
17
17
|
userId: request.userId ?? "",
|
|
18
18
|
commandId,
|
|
19
|
-
commands:
|
|
19
|
+
commands: request.commands.map(commands_mapper_js_1.mapGrpcLedgerCommand),
|
|
20
20
|
actAs: [...request.actAs],
|
|
21
21
|
readAs: [...request.readAs],
|
|
22
22
|
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 } })),
|
|
@@ -454,7 +454,7 @@ class JsonTransport {
|
|
|
454
454
|
if (signer) {
|
|
455
455
|
throw new not_supported_error_js_1.NotSupportedError("command signing is not supported by json transport");
|
|
456
456
|
}
|
|
457
|
-
const payload = await this.httpClient.postAsync("/v2/commands/submit-and-wait", (0, commands_mapper_js_1.
|
|
457
|
+
const payload = await this.httpClient.postAsync("/v2/commands/submit-and-wait", (0, commands_mapper_js_1.mapJsonSubmitCommandsRequest)(request), options);
|
|
458
458
|
return (0, commands_mapper_js_1.mapJsonSubmitCommand)(payload);
|
|
459
459
|
}
|
|
460
460
|
throwIfDisposed() {
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.
|
|
3
|
+
exports.mapJsonSubmitCommandsRequest = mapJsonSubmitCommandsRequest;
|
|
4
4
|
exports.mapJsonSubmitCommand = mapJsonSubmitCommand;
|
|
5
5
|
const node_crypto_1 = require("node:crypto");
|
|
6
6
|
const transport_error_js_1 = require("../../../core/errors/transport-error.js");
|
|
@@ -13,7 +13,7 @@ const daml_values_js_1 = require("../../../core/types/daml-values.js");
|
|
|
13
13
|
const exercise_by_key_command_js_1 = require("../../../core/types/commands/exercise-by-key-command.js");
|
|
14
14
|
const exercise_command_js_1 = require("../../../core/types/commands/exercise-command.js");
|
|
15
15
|
const submit_command_response_js_1 = require("../../../core/types/responses/submit-command-response.js");
|
|
16
|
-
function
|
|
16
|
+
function mapJsonSubmitCommandsRequest(request) {
|
|
17
17
|
if (request.deduplicationPeriod !== undefined) {
|
|
18
18
|
throw new transport_error_js_1.TransportError("command deduplication periods are not supported by the JSON transport");
|
|
19
19
|
}
|
|
@@ -21,7 +21,7 @@ function mapJsonSubmitCommandRequest(request) {
|
|
|
21
21
|
commandId: request.commandId ?? (0, node_crypto_1.randomUUID)(),
|
|
22
22
|
actAs: request.actAs,
|
|
23
23
|
readAs: request.readAs,
|
|
24
|
-
commands:
|
|
24
|
+
commands: request.commands.map(mapJsonCommand),
|
|
25
25
|
applicationId: request.applicationId || undefined,
|
|
26
26
|
};
|
|
27
27
|
}
|
|
@@ -40,7 +40,7 @@ import { SignCommandResult } from "../signing/sign-command-result.js";
|
|
|
40
40
|
import { PreparedCommandSubmission } from "../types/prepared-command-submission.js";
|
|
41
41
|
import { SubmitCommandTransactionResponse } from "../types/responses/submit-command-transaction-response.js";
|
|
42
42
|
import { RequestOptions } from "../types/request-options.js";
|
|
43
|
-
import {
|
|
43
|
+
import { SubmitCommandsRequest } from "../types/requests/submit-commands-request.js";
|
|
44
44
|
import type { HealthCheckRequest, HealthCheckResponse } from "../../transports/grpc/generated/canton/google/grpc/health/v1/health.js";
|
|
45
45
|
import type { GetLedgerApiVersionRequest, GetLedgerApiVersionResponse } from "../../transports/grpc/generated/canton/com/daml/ledger/api/v2/version_service.js";
|
|
46
46
|
import type { ParticipantStatusRequest, ParticipantStatusResponse } from "../../transports/grpc/generated/canton/com/digitalasset/canton/admin/participant/v30/participant_status_service.js";
|
|
@@ -243,8 +243,8 @@ export interface ITransport {
|
|
|
243
243
|
* Submits a command.
|
|
244
244
|
* Supported on JSON and gRPC. External signing is gRPC-only.
|
|
245
245
|
*/
|
|
246
|
-
submitCommandAsync(request:
|
|
247
|
-
submitCommandForTransactionAsync?(request:
|
|
248
|
-
prepareCommandAsync?(request:
|
|
246
|
+
submitCommandAsync(request: SubmitCommandsRequest, signer?: ICommandSigner | CommandSigners, options?: RequestOptions): Promise<SubmitCommandResponse>;
|
|
247
|
+
submitCommandForTransactionAsync?(request: SubmitCommandsRequest, options?: RequestOptions): Promise<SubmitCommandTransactionResponse>;
|
|
248
|
+
prepareCommandAsync?(request: SubmitCommandsRequest, options?: RequestOptions): Promise<PreparedCommandSubmission>;
|
|
249
249
|
executePreparedCommandAndWaitAsync?(prepared: PreparedCommandSubmission, signatures: Readonly<Record<string, SignCommandResult>>, options?: RequestOptions): Promise<SubmitCommandResponse>;
|
|
250
250
|
}
|
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { SubmitCommandsRequest } from "./requests/submit-commands-request.js";
|
|
2
2
|
/** Opaque result of interactive command preparation, suitable for detached signing. */
|
|
3
3
|
export declare class PreparedCommandSubmission {
|
|
4
|
-
readonly request:
|
|
4
|
+
readonly request: SubmitCommandsRequest;
|
|
5
5
|
readonly transaction: unknown;
|
|
6
6
|
readonly transactionHash: Uint8Array;
|
|
7
7
|
readonly hashingSchemeVersion: number;
|
|
8
|
-
constructor(request:
|
|
8
|
+
constructor(request: SubmitCommandsRequest, transaction: unknown, transactionHash: Uint8Array, hashingSchemeVersion: number);
|
|
9
9
|
}
|
package/dist/core/types/requests/{submit-command-request.d.ts → submit-commands-request.d.ts}
RENAMED
|
@@ -1,12 +1,16 @@
|
|
|
1
|
+
import { CommandDeduplicationPeriod } from "../command-deduplication-period.js";
|
|
1
2
|
import { LedgerCommand } from "../commands/ledger-command.js";
|
|
2
3
|
import { DisclosedContract } from "../disclosed-contract.js";
|
|
3
|
-
|
|
4
|
-
|
|
4
|
+
export type NonEmptyLedgerCommands = readonly [
|
|
5
|
+
LedgerCommand,
|
|
6
|
+
...LedgerCommand[]
|
|
7
|
+
];
|
|
8
|
+
export declare class SubmitCommandsRequest {
|
|
5
9
|
readonly applicationId: string;
|
|
6
10
|
readonly userId?: string;
|
|
7
11
|
readonly actAs: readonly string[];
|
|
8
12
|
readonly readAs: readonly string[];
|
|
9
|
-
readonly
|
|
13
|
+
readonly commands: NonEmptyLedgerCommands;
|
|
10
14
|
readonly commandId?: string;
|
|
11
15
|
readonly deduplicationPeriod?: CommandDeduplicationPeriod;
|
|
12
16
|
readonly disclosedContracts: readonly DisclosedContract[];
|
|
@@ -16,7 +20,7 @@ export declare class SubmitCommandRequest {
|
|
|
16
20
|
userId?: string;
|
|
17
21
|
actAs: readonly string[];
|
|
18
22
|
readAs?: readonly string[];
|
|
19
|
-
|
|
23
|
+
commands: NonEmptyLedgerCommands;
|
|
20
24
|
commandId?: string;
|
|
21
25
|
deduplicationPeriod?: CommandDeduplicationPeriod;
|
|
22
26
|
disclosedContracts?: readonly DisclosedContract[];
|
|
@@ -2,18 +2,22 @@ import { ValidationError } from "../../errors/validation-error.js";
|
|
|
2
2
|
const ledgerStringPattern = /^[A-Za-z0-9#:\-_/ ]+$/;
|
|
3
3
|
const canonicalOffsetPattern = /^(0|[1-9][0-9]*)$/;
|
|
4
4
|
const maximumInt64Offset = "9223372036854775807";
|
|
5
|
-
export class
|
|
5
|
+
export class SubmitCommandsRequest {
|
|
6
6
|
applicationId;
|
|
7
7
|
userId;
|
|
8
8
|
actAs;
|
|
9
9
|
readAs;
|
|
10
|
-
|
|
10
|
+
commands;
|
|
11
11
|
commandId;
|
|
12
12
|
deduplicationPeriod;
|
|
13
13
|
disclosedContracts;
|
|
14
14
|
synchronizerId;
|
|
15
15
|
constructor(init) {
|
|
16
|
-
|
|
16
|
+
const commands = init.commands;
|
|
17
|
+
if (!Array.isArray(commands) || commands.length === 0) {
|
|
18
|
+
throw new ValidationError("submit requests require at least one command");
|
|
19
|
+
}
|
|
20
|
+
else if (init.actAs.length === 0) {
|
|
17
21
|
throw new ValidationError("submit requests require at least one actAs party");
|
|
18
22
|
}
|
|
19
23
|
else if (init.commandId !== undefined &&
|
|
@@ -27,7 +31,7 @@ export class SubmitCommandRequest {
|
|
|
27
31
|
this.userId = init.userId;
|
|
28
32
|
this.actAs = init.actAs;
|
|
29
33
|
this.readAs = init.readAs ?? [];
|
|
30
|
-
this.
|
|
34
|
+
this.commands = Object.freeze([...commands]);
|
|
31
35
|
this.commandId = init.commandId;
|
|
32
36
|
this.deduplicationPeriod = deduplicationPeriod;
|
|
33
37
|
this.disclosedContracts = init.disclosedContracts ?? [];
|
package/dist/index.d.ts
CHANGED
|
@@ -3,12 +3,14 @@ export { CantonManager } from "./query/canton-manager.js";
|
|
|
3
3
|
export { QuerySource } from "./query/query-source.js";
|
|
4
4
|
export { MemoryQueryCache } from "./query/cache/memory-query-cache.js";
|
|
5
5
|
export { QueryCapabilityError } from "./query/errors/query-capability-error.js";
|
|
6
|
+
export { QuerySnapshotIncompleteError } from "./query/errors/query-snapshot-incomplete-error.js";
|
|
7
|
+
export type { QuerySnapshotIncompleteReason } from "./query/errors/query-snapshot-incomplete-error.js";
|
|
6
8
|
export { PqsQueryError } from "./query/errors/pqs-query-error.js";
|
|
7
9
|
export { PqsSchemaProfileError } from "./query/errors/pqs-schema-profile-error.js";
|
|
8
10
|
export type { CantonManagerOptions, PqsQueryOptions, QueryCacheOptions, } from "./query/canton-manager-options.js";
|
|
9
11
|
export type { QueryCacheStore } from "./query/cache/query-cache-store.js";
|
|
10
12
|
export type { ContractFindManyArgs, ContractFindUniqueArgs, ContractCountArgs, ContractGroupByArgs, ContractGroupRow, ContractRow, ContractResult, ContractInclude, TemplateId, ContractTypeRow, ContractTypeGroupByArgs, ContractTypeGroupRow, EventRow, ExerciseRow, ExerciseTypeRow, ExerciseTypeGroupByArgs, ExerciseTypeGroupRow, PackageRow, PackageGroupByArgs, PackageGroupRow, TransactionRow, TransactionResult, WatermarkRow, WatermarkGroupByArgs, WatermarkGroupRow, ContractTypeResult, EventResult, ExerciseResult, ExerciseTypeResult, PackageResult, RowWhere, RowSelect, RowOrderBy, RelationListFilter, JsonPath, JsonPathFilter, JsonProjection, JsonFieldProjection, JsonGroupBy, JsonProjectionResult, TimeBucket, ToOneRelationArgs, ToManyRelationArgs, GroupByArgs, EventGroupByArgs, EventGroupRow, ExerciseGroupByArgs, ExerciseGroupRow, TransactionGroupByArgs, TransactionGroupRow, } from "./query/model-types.js";
|
|
11
|
-
export type { QueryClient, QueryDelegate, QueryCollectionDelegate } from "./query/query-client.js";
|
|
13
|
+
export type { QueryClient, QueryDelegate, QueryCollectionDelegate, ContractCacheArgs, ContractCacheResult } from "./query/query-client.js";
|
|
12
14
|
export { CantonHashingClient } from "./client/canton-hashing-client.js";
|
|
13
15
|
export { CantonClientOptions } from "./client/canton-client-options.js";
|
|
14
16
|
export { ExternalPartyActivationClient } from "./client/external-party-activation-client.js";
|
|
@@ -234,7 +236,8 @@ export { ListIdentityProviderConfigsRequest } from "./core/types/requests/list-i
|
|
|
234
236
|
export { ListKeyOwnersRequest } from "./core/types/requests/list-key-owners-request.js";
|
|
235
237
|
export { ListUserRightsRequest } from "./core/types/requests/list-user-rights-request.js";
|
|
236
238
|
export { ListUsersRequest } from "./core/types/requests/list-users-request.js";
|
|
237
|
-
export {
|
|
239
|
+
export { SubmitCommandsRequest } from "./core/types/requests/submit-commands-request.js";
|
|
240
|
+
export type { NonEmptyLedgerCommands } from "./core/types/requests/submit-commands-request.js";
|
|
238
241
|
export { TopologyListPartiesRequest } from "./core/types/requests/topology-list-parties-request.js";
|
|
239
242
|
export { WaitForPartyHostingRequest } from "./core/types/requests/wait-for-party-hosting-request.js";
|
|
240
243
|
export { GrantUserRightsRequest } from "./core/types/requests/grant-user-rights-request.js";
|
package/dist/index.js
CHANGED
|
@@ -3,6 +3,7 @@ export { CantonManager } from "./query/canton-manager.js";
|
|
|
3
3
|
export { QuerySource } from "./query/query-source.js";
|
|
4
4
|
export { MemoryQueryCache } from "./query/cache/memory-query-cache.js";
|
|
5
5
|
export { QueryCapabilityError } from "./query/errors/query-capability-error.js";
|
|
6
|
+
export { QuerySnapshotIncompleteError } from "./query/errors/query-snapshot-incomplete-error.js";
|
|
6
7
|
export { PqsQueryError } from "./query/errors/pqs-query-error.js";
|
|
7
8
|
export { PqsSchemaProfileError } from "./query/errors/pqs-schema-profile-error.js";
|
|
8
9
|
export { CantonHashingClient } from "./client/canton-hashing-client.js";
|
|
@@ -220,7 +221,7 @@ export { ListIdentityProviderConfigsRequest } from "./core/types/requests/list-i
|
|
|
220
221
|
export { ListKeyOwnersRequest } from "./core/types/requests/list-key-owners-request.js";
|
|
221
222
|
export { ListUserRightsRequest } from "./core/types/requests/list-user-rights-request.js";
|
|
222
223
|
export { ListUsersRequest } from "./core/types/requests/list-users-request.js";
|
|
223
|
-
export {
|
|
224
|
+
export { SubmitCommandsRequest } from "./core/types/requests/submit-commands-request.js";
|
|
224
225
|
export { TopologyListPartiesRequest } from "./core/types/requests/topology-list-parties-request.js";
|
|
225
226
|
export { WaitForPartyHostingRequest } from "./core/types/requests/wait-for-party-hosting-request.js";
|
|
226
227
|
export { GrantUserRightsRequest } from "./core/types/requests/grant-user-rights-request.js";
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import type { NormalizedAggregateQuery, NormalizedFindManyQuery, NormalizedFindUniqueQuery, NormalizedGroupByQuery, QueryPredicate } from "./query-ast.js";
|
|
2
|
+
import { type QueryDataset } from "./query-dataset.js";
|
|
3
|
+
import { type QueryRelation } from "./query-schema.js";
|
|
4
|
+
/** Reference evaluator for normalized canonical plans; it intentionally has no transport concerns. */
|
|
5
|
+
export declare class InMemoryQueryEvaluator {
|
|
6
|
+
execute(dataset: QueryDataset, query: NormalizedFindManyQuery | NormalizedFindUniqueQuery | NormalizedAggregateQuery | NormalizedGroupByQuery | {
|
|
7
|
+
readonly kind: "count";
|
|
8
|
+
readonly relation: QueryRelation;
|
|
9
|
+
readonly parties?: readonly string[];
|
|
10
|
+
readonly predicate?: QueryPredicate;
|
|
11
|
+
readonly activeOnly: boolean;
|
|
12
|
+
}): unknown;
|
|
13
|
+
private findMany;
|
|
14
|
+
private filtered;
|
|
15
|
+
private matches;
|
|
16
|
+
private related;
|
|
17
|
+
private shape;
|
|
18
|
+
private order;
|
|
19
|
+
private aggregate;
|
|
20
|
+
private groupBy;
|
|
21
|
+
private groupValues;
|
|
22
|
+
}
|