@distrohelena/canton-typescript-sdk 0.1.36 → 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.
Files changed (99) hide show
  1. package/README.md +104 -34
  2. package/dist/cjs/core/types/requests/{submit-command-request.js → submit-commands-request.js} +10 -6
  3. package/dist/cjs/index.js +10 -8
  4. package/dist/cjs/query/canonical/in-memory-query-evaluator.js +291 -0
  5. package/dist/cjs/query/canonical/public-identity.js +41 -0
  6. package/dist/cjs/query/canonical/query-ast.js +2 -0
  7. package/dist/cjs/query/canonical/query-dataset.js +351 -0
  8. package/dist/cjs/query/canonical/query-normalizer.js +655 -0
  9. package/dist/cjs/query/canonical/query-schema.js +86 -0
  10. package/dist/cjs/query/canton-manager.js +14 -5
  11. package/dist/cjs/query/errors/query-snapshot-incomplete-error.js +19 -0
  12. package/dist/cjs/query/grpc/grpc-contract-cache.js +484 -0
  13. package/dist/cjs/query/grpc/grpc-package-relation-reader.js +218 -0
  14. package/dist/cjs/query/grpc/grpc-query-client.js +249 -0
  15. package/dist/cjs/query/grpc/grpc-query-snapshot-reader.js +238 -0
  16. package/dist/cjs/query/grpc/grpc-query-value-mapper.js +204 -0
  17. package/dist/cjs/query/grpc/grpc-relation-mapper.js +794 -0
  18. package/dist/cjs/query/pqs/pqs-query-client.js +151 -582
  19. package/dist/cjs/query/pqs/pqs-relational-sql-compiler.js +138 -95
  20. package/dist/cjs/query/pqs/pqs-result-shape.js +28 -0
  21. package/dist/cjs/query/pqs/pqs-schema-profile.js +49 -48
  22. package/dist/cjs/query/pqs/pqs-sql-compiler.js +343 -289
  23. package/dist/cjs/query/pqs/pqs-sql-syntax.js +10 -0
  24. package/dist/cjs/services/command/command-service-client.js +16 -3
  25. package/dist/cjs/services/commands/command-payload-builder.js +1 -1
  26. package/dist/cjs/services/commands/command-submission-pipeline.js +21 -6
  27. package/dist/cjs/testing/runtime/declarative-action-executor.js +3 -3
  28. package/dist/cjs/transports/grpc/grpc-transport.js +2 -2
  29. package/dist/cjs/transports/grpc/mappers/commands-mapper.js +6 -6
  30. package/dist/cjs/transports/grpc/mappers/interactive-command-mapper.js +1 -1
  31. package/dist/cjs/transports/json/json-transport.js +1 -1
  32. package/dist/cjs/transports/json/mappers/commands-mapper.js +3 -3
  33. package/dist/core/transports/transport.interface.d.ts +4 -4
  34. package/dist/core/types/prepared-command-submission.d.ts +3 -3
  35. package/dist/core/types/requests/{submit-command-request.d.ts → submit-commands-request.d.ts} +8 -4
  36. package/dist/core/types/requests/{submit-command-request.js → submit-commands-request.js} +8 -4
  37. package/dist/index.d.ts +5 -2
  38. package/dist/index.js +2 -1
  39. package/dist/query/canonical/in-memory-query-evaluator.d.ts +22 -0
  40. package/dist/query/canonical/in-memory-query-evaluator.js +287 -0
  41. package/dist/query/canonical/public-identity.d.ts +14 -0
  42. package/dist/query/canonical/public-identity.js +35 -0
  43. package/dist/query/canonical/query-ast.d.ts +104 -0
  44. package/dist/query/canonical/query-ast.js +1 -0
  45. package/dist/query/canonical/query-dataset.d.ts +63 -0
  46. package/dist/query/canonical/query-dataset.js +343 -0
  47. package/dist/query/canonical/query-normalizer.d.ts +10 -0
  48. package/dist/query/canonical/query-normalizer.js +646 -0
  49. package/dist/query/canonical/query-schema.d.ts +25 -0
  50. package/dist/query/canonical/query-schema.js +83 -0
  51. package/dist/query/canton-manager.js +14 -5
  52. package/dist/query/errors/query-snapshot-incomplete-error.d.ts +14 -0
  53. package/dist/query/errors/query-snapshot-incomplete-error.js +15 -0
  54. package/dist/query/grpc/grpc-contract-cache.d.ts +27 -0
  55. package/dist/query/grpc/grpc-contract-cache.js +479 -0
  56. package/dist/query/grpc/grpc-package-relation-reader.d.ts +43 -0
  57. package/dist/query/grpc/grpc-package-relation-reader.js +213 -0
  58. package/dist/query/grpc/grpc-query-client.d.ts +42 -0
  59. package/dist/query/grpc/grpc-query-client.js +245 -0
  60. package/dist/query/grpc/grpc-query-snapshot-reader.d.ts +33 -0
  61. package/dist/query/grpc/grpc-query-snapshot-reader.js +233 -0
  62. package/dist/query/grpc/grpc-query-value-mapper.d.ts +15 -0
  63. package/dist/query/grpc/grpc-query-value-mapper.js +195 -0
  64. package/dist/query/grpc/grpc-relation-mapper.d.ts +67 -0
  65. package/dist/query/grpc/grpc-relation-mapper.js +789 -0
  66. package/dist/query/pqs/pqs-query-client.d.ts +10 -20
  67. package/dist/query/pqs/pqs-query-client.js +154 -585
  68. package/dist/query/pqs/pqs-relational-sql-compiler.d.ts +9 -17
  69. package/dist/query/pqs/pqs-relational-sql-compiler.js +136 -95
  70. package/dist/query/pqs/pqs-result-shape.d.ts +25 -0
  71. package/dist/query/pqs/pqs-result-shape.js +25 -0
  72. package/dist/query/pqs/pqs-schema-profile.js +49 -48
  73. package/dist/query/pqs/pqs-sql-compiler.d.ts +18 -3
  74. package/dist/query/pqs/pqs-sql-compiler.js +337 -288
  75. package/dist/query/pqs/pqs-sql-syntax.d.ts +2 -0
  76. package/dist/query/pqs/pqs-sql-syntax.js +6 -0
  77. package/dist/query/query-client.d.ts +15 -0
  78. package/dist/services/command/command-service-client.d.ts +9 -4
  79. package/dist/services/command/command-service-client.js +16 -3
  80. package/dist/services/command-submission/command-submission-service-client.d.ts +2 -2
  81. package/dist/services/commands/command-payload-builder.d.ts +2 -2
  82. package/dist/services/commands/command-payload-builder.js +1 -1
  83. package/dist/services/commands/command-submission-pipeline.d.ts +5 -4
  84. package/dist/services/commands/command-submission-pipeline.js +21 -6
  85. package/dist/testing/runtime/declarative-action-executor.js +3 -3
  86. package/dist/transports/grpc/grpc-transport.d.ts +4 -4
  87. package/dist/transports/grpc/grpc-transport.js +3 -3
  88. package/dist/transports/grpc/mappers/commands-mapper.d.ts +3 -3
  89. package/dist/transports/grpc/mappers/commands-mapper.js +4 -4
  90. package/dist/transports/grpc/mappers/interactive-command-mapper.d.ts +3 -3
  91. package/dist/transports/grpc/mappers/interactive-command-mapper.js +1 -1
  92. package/dist/transports/json/json-transport.d.ts +2 -2
  93. package/dist/transports/json/json-transport.js +2 -2
  94. package/dist/transports/json/mappers/commands-mapper.d.ts +2 -2
  95. package/dist/transports/json/mappers/commands-mapper.js +2 -2
  96. package/package.json +4 -3
  97. package/dist/cjs/query/grpc/grpc-contract-query-client.js +0 -178
  98. package/dist/query/grpc/grpc-contract-query-client.d.ts +0 -33
  99. 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) { return this.pipeline.submitForTransactionAsync(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
- prepareAsync(request, options) { return this.pipeline.prepareAsync(request, options); }
19
- executeAndWaitAsync(prepared, signatures, options) { return this.pipeline.executeAsync(prepared, signatures, options); }
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
- command: mapCanonicalCommand(request.command),
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
- submitForTransactionAsync(request, options) { if (!this.dependencies.transport.submitCommandForTransactionAsync)
19
- throw new not_supported_error_js_1.NotSupportedError("transaction-returning command submission is not supported by the selected transport"); return this.dependencies.transport.submitCommandForTransactionAsync(request, options); }
20
- prepareAsync(request, options) { if (!this.dependencies.transport.prepareCommandAsync)
21
- throw new not_supported_error_js_1.NotSupportedError("interactive command preparation is not supported by the selected transport"); return this.dependencies.transport.prepareCommandAsync(request, options); }
22
- executeAsync(prepared, signatures, options) { if (!this.dependencies.transport.executePreparedCommandAndWaitAsync)
23
- throw new not_supported_error_js_1.NotSupportedError("interactive command execution is not supported by the selected transport"); return this.dependencies.transport.executePreparedCommandAndWaitAsync(prepared, signatures, options); }
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;
@@ -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 submit_command_request_js_1 = require("../../core/types/requests/submit-command-request.js");
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 submit_command_request_js_1.SubmitCommandRequest({
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.mapGrpcSubmitCommandRequest)(request), options);
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.mapGrpcSubmitCommandForTransactionRequest)(request), options));
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.mapGrpcSubmitCommandRequest = mapGrpcSubmitCommandRequest;
4
- exports.mapGrpcSubmitCommandForTransactionRequest = mapGrpcSubmitCommandForTransactionRequest;
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 mapGrpcSubmitCommandRequest(request) {
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: [mapGrpcLedgerCommand(request.command)],
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 mapGrpcSubmitCommandForTransactionRequest(request) {
43
- return { commands: mapGrpcSubmitCommandRequest(request).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: [(0, commands_mapper_js_1.mapGrpcLedgerCommand)(request.command)],
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.mapJsonSubmitCommandRequest)(request), options);
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.mapJsonSubmitCommandRequest = mapJsonSubmitCommandRequest;
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 mapJsonSubmitCommandRequest(request) {
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: [mapJsonCommand(request.command)],
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 { SubmitCommandRequest } from "../types/requests/submit-command-request.js";
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: SubmitCommandRequest, signer?: ICommandSigner | CommandSigners, options?: RequestOptions): Promise<SubmitCommandResponse>;
247
- submitCommandForTransactionAsync?(request: SubmitCommandRequest, options?: RequestOptions): Promise<SubmitCommandTransactionResponse>;
248
- prepareCommandAsync?(request: SubmitCommandRequest, options?: RequestOptions): Promise<PreparedCommandSubmission>;
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 { SubmitCommandRequest } from "./requests/submit-command-request.js";
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: SubmitCommandRequest;
4
+ readonly request: SubmitCommandsRequest;
5
5
  readonly transaction: unknown;
6
6
  readonly transactionHash: Uint8Array;
7
7
  readonly hashingSchemeVersion: number;
8
- constructor(request: SubmitCommandRequest, transaction: unknown, transactionHash: Uint8Array, hashingSchemeVersion: number);
8
+ constructor(request: SubmitCommandsRequest, transaction: unknown, transactionHash: Uint8Array, hashingSchemeVersion: number);
9
9
  }
@@ -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
- import { CommandDeduplicationPeriod } from "../command-deduplication-period.js";
4
- export declare class SubmitCommandRequest {
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 command: LedgerCommand;
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
- command: LedgerCommand;
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 SubmitCommandRequest {
5
+ export class SubmitCommandsRequest {
6
6
  applicationId;
7
7
  userId;
8
8
  actAs;
9
9
  readAs;
10
- command;
10
+ commands;
11
11
  commandId;
12
12
  deduplicationPeriod;
13
13
  disclosedContracts;
14
14
  synchronizerId;
15
15
  constructor(init) {
16
- if (init.actAs.length === 0) {
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.command = init.command;
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 { SubmitCommandRequest } from "./core/types/requests/submit-command-request.js";
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 { SubmitCommandRequest } from "./core/types/requests/submit-command-request.js";
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
+ }