@distrohelena/canton-typescript-sdk 0.1.4 → 0.1.6

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 (254) hide show
  1. package/README.md +333 -1
  2. package/dist/client/canton-client-options.d.ts +3 -0
  3. package/dist/client/canton-client-options.js +2 -0
  4. package/dist/client/service-registry.js +4 -3
  5. package/dist/core/errors/grpc-transport-error.d.ts +14 -0
  6. package/dist/core/errors/grpc-transport-error.js +76 -0
  7. package/dist/core/signing/sign-command-request.d.ts +4 -0
  8. package/dist/core/signing/sign-command-request.js +4 -0
  9. package/dist/core/signing/sign-command-result.d.ts +2 -0
  10. package/dist/core/signing/sign-command-result.js +9 -0
  11. package/dist/core/transports/transport.interface.d.ts +2 -2
  12. package/dist/core/types/canton-hash-purpose.d.ts +2 -1
  13. package/dist/core/types/canton-hash-purpose.js +1 -0
  14. package/dist/core/types/commands/create-and-exercise-command.js +1 -1
  15. package/dist/core/types/commands/exercise-by-key-command.js +2 -2
  16. package/dist/core/types/commands/exercise-command.js +2 -2
  17. package/dist/core/types/daml-numeric.d.ts +6 -0
  18. package/dist/core/types/daml-numeric.js +14 -0
  19. package/dist/core/types/daml-party.d.ts +6 -0
  20. package/dist/core/types/daml-party.js +14 -0
  21. package/dist/core/types/requests/create-decentralized-party-request.d.ts +41 -0
  22. package/dist/core/types/requests/create-decentralized-party-request.js +82 -0
  23. package/dist/core/types/requests/create-external-party-request.d.ts +42 -0
  24. package/dist/core/types/requests/create-external-party-request.js +47 -0
  25. package/dist/core/types/requests/finalize-decentralized-party-request.d.ts +39 -0
  26. package/dist/core/types/requests/finalize-decentralized-party-request.js +42 -0
  27. package/dist/core/types/requests/get-active-contracts-page-request.d.ts +15 -2
  28. package/dist/core/types/requests/get-active-contracts-page-request.js +4 -0
  29. package/dist/core/types/requests/submit-command-request.d.ts +2 -0
  30. package/dist/core/types/requests/submit-command-request.js +2 -0
  31. package/dist/core/types/topology/topology-signature-format.d.ts +2 -1
  32. package/dist/core/types/topology/topology-signature-format.js +1 -0
  33. package/dist/daml-lf/container/dar-archive-entry.d.ts +8 -0
  34. package/dist/daml-lf/container/dar-archive-entry.js +8 -0
  35. package/dist/daml-lf/container/dar-archive-loader.js +14 -0
  36. package/dist/daml-lf/container/dar-archive.d.ts +6 -0
  37. package/dist/daml-lf/container/dar-archive.js +4 -0
  38. package/dist/daml-lf/container/dar-source-bundle-loader.d.ts +5 -0
  39. package/dist/daml-lf/container/dar-source-bundle-loader.js +33 -0
  40. package/dist/daml-lf/container/dar-source-bundle.d.ts +45 -0
  41. package/dist/daml-lf/container/dar-source-bundle.js +11 -0
  42. package/dist/daml-lf/container/dar-source-file-entry.d.ts +8 -0
  43. package/dist/daml-lf/container/dar-source-file-entry.js +8 -0
  44. package/dist/daml-lf/daml-lf-compilation.d.ts +12 -0
  45. package/dist/daml-lf/daml-lf-compilation.js +35 -0
  46. package/dist/daml-lf/index.d.ts +11 -0
  47. package/dist/daml-lf/index.js +10 -0
  48. package/dist/daml-lf/interpreter/daml-lf-builtin-dispatch.d.ts +43 -0
  49. package/dist/daml-lf/interpreter/daml-lf-builtin-dispatch.js +933 -0
  50. package/dist/daml-lf/interpreter/daml-lf-evaluator.d.ts +95 -0
  51. package/dist/daml-lf/interpreter/daml-lf-evaluator.js +1131 -0
  52. package/dist/daml-lf/interpreter/daml-lf-interpreter-scaffold.d.ts +3 -0
  53. package/dist/daml-lf/interpreter/daml-lf-interpreter-scaffold.js +6 -1
  54. package/dist/daml-lf/interpreter/daml-lf-lexical-scope.d.ts +13 -0
  55. package/dist/daml-lf/interpreter/daml-lf-lexical-scope.js +46 -0
  56. package/dist/daml-lf/interpreter/daml-lf-runtime-frame.d.ts +16 -0
  57. package/dist/daml-lf/interpreter/daml-lf-runtime-frame.js +15 -0
  58. package/dist/daml-lf/interpreter/daml-lf-runtime-value.d.ts +21 -0
  59. package/dist/daml-lf/interpreter/daml-lf-runtime-value.js +4 -1
  60. package/dist/daml-lf/interpreter/daml-lf-step-kind.d.ts +7 -0
  61. package/dist/daml-lf/interpreter/daml-lf-step-kind.js +8 -0
  62. package/dist/daml-lf/interpreter/daml-lf-trace-sink.interface.d.ts +30 -0
  63. package/dist/daml-lf/interpreter/daml-lf-trace-sink.interface.js +1 -0
  64. package/dist/daml-lf/model/daml-lf-builtin-type.d.ts +3 -0
  65. package/dist/daml-lf/model/daml-lf-builtin-type.js +3 -0
  66. package/dist/daml-lf/model/daml-lf-choice.d.ts +5 -0
  67. package/dist/daml-lf/model/daml-lf-choice.js +4 -0
  68. package/dist/daml-lf/model/daml-lf-expression-path.d.ts +2 -0
  69. package/dist/daml-lf/model/daml-lf-expression-path.js +81 -0
  70. package/dist/daml-lf/model/daml-lf-expression.d.ts +146 -0
  71. package/dist/daml-lf/model/daml-lf-expression.js +71 -0
  72. package/dist/daml-lf/model/daml-lf-template.d.ts +2 -0
  73. package/dist/daml-lf/model/daml-lf-template.js +2 -0
  74. package/dist/daml-lf/model/daml-lf-type.d.ts +2 -0
  75. package/dist/daml-lf/model/daml-lf-type.js +4 -0
  76. package/dist/daml-lf/model/lf-2-model-mapper.d.ts +5 -0
  77. package/dist/daml-lf/model/lf-2-model-mapper.js +445 -12
  78. package/dist/debugger/errors/replay-determinism.exception.d.ts +3 -0
  79. package/dist/debugger/errors/replay-determinism.exception.js +3 -0
  80. package/dist/debugger/errors/replay-missing-package.exception.d.ts +3 -0
  81. package/dist/debugger/errors/replay-missing-package.exception.js +3 -0
  82. package/dist/debugger/errors/replay-missing-source.exception.d.ts +3 -0
  83. package/dist/debugger/errors/replay-missing-source.exception.js +3 -0
  84. package/dist/debugger/errors/replay-source-map.exception.d.ts +3 -0
  85. package/dist/debugger/errors/replay-source-map.exception.js +3 -0
  86. package/dist/debugger/errors/replay-state-hydration.exception.d.ts +3 -0
  87. package/dist/debugger/errors/replay-state-hydration.exception.js +3 -0
  88. package/dist/debugger/errors/replay-unsupported-lf-construct.exception.d.ts +3 -0
  89. package/dist/debugger/errors/replay-unsupported-lf-construct.exception.js +3 -0
  90. package/dist/debugger/errors/replay-unsupported-update.exception.d.ts +3 -0
  91. package/dist/debugger/errors/replay-unsupported-update.exception.js +3 -0
  92. package/dist/debugger/index.d.ts +31 -0
  93. package/dist/debugger/index.js +31 -0
  94. package/dist/debugger/ledger-replay-debugger-client.d.ts +31 -0
  95. package/dist/debugger/ledger-replay-debugger-client.js +53 -0
  96. package/dist/debugger/replay/ledger-replay-environment-builder.d.ts +95 -0
  97. package/dist/debugger/replay/ledger-replay-environment-builder.js +249 -0
  98. package/dist/debugger/replay/ledger-replay-session-loader.d.ts +78 -0
  99. package/dist/debugger/replay/ledger-replay-session-loader.js +565 -0
  100. package/dist/debugger/replay/replay-artifact-resolver.d.ts +30 -0
  101. package/dist/debugger/replay/replay-artifact-resolver.js +210 -0
  102. package/dist/debugger/replay/replay-determinism-validator.d.ts +12 -0
  103. package/dist/debugger/replay/replay-determinism-validator.js +161 -0
  104. package/dist/debugger/replay/replay-entrypoint-definition-resolver.d.ts +40 -0
  105. package/dist/debugger/replay/replay-entrypoint-definition-resolver.js +337 -0
  106. package/dist/debugger/replay/replay-entrypoint.d.ts +22 -0
  107. package/dist/debugger/replay/replay-entrypoint.js +14 -0
  108. package/dist/debugger/replay/replay-ledger-value-normalizer.d.ts +7 -0
  109. package/dist/debugger/replay/replay-ledger-value-normalizer.js +194 -0
  110. package/dist/debugger/replay/replay-update-loader.d.ts +24 -0
  111. package/dist/debugger/replay/replay-update-loader.js +94 -0
  112. package/dist/debugger/replay/replay-update-visibility-validator.d.ts +19 -0
  113. package/dist/debugger/replay/replay-update-visibility-validator.js +19 -0
  114. package/dist/debugger/session/in-memory-replay-session-store.d.ts +27 -0
  115. package/dist/debugger/session/in-memory-replay-session-store.js +109 -0
  116. package/dist/debugger/session/replay-phase.d.ts +7 -0
  117. package/dist/debugger/session/replay-phase.js +8 -0
  118. package/dist/debugger/session/replay-scope.d.ts +10 -0
  119. package/dist/debugger/session/replay-scope.js +10 -0
  120. package/dist/debugger/session/replay-session-metadata.d.ts +10 -0
  121. package/dist/debugger/session/replay-session-metadata.js +10 -0
  122. package/dist/debugger/session/replay-session-request.d.ts +6 -0
  123. package/dist/debugger/session/replay-session-request.js +10 -0
  124. package/dist/debugger/session/replay-session.d.ts +12 -0
  125. package/dist/debugger/session/replay-session.js +10 -0
  126. package/dist/debugger/session/replay-source-location.d.ts +17 -0
  127. package/dist/debugger/session/replay-source-location.js +16 -0
  128. package/dist/debugger/session/replay-stack-frame.d.ts +8 -0
  129. package/dist/debugger/session/replay-stack-frame.js +8 -0
  130. package/dist/debugger/session/replay-state-delta.d.ts +29 -0
  131. package/dist/debugger/session/replay-state-delta.js +24 -0
  132. package/dist/debugger/session/replay-step-advance-result.d.ts +24 -0
  133. package/dist/debugger/session/replay-step-advance-result.js +16 -0
  134. package/dist/debugger/session/replay-step.d.ts +30 -0
  135. package/dist/debugger/session/replay-step.js +24 -0
  136. package/dist/debugger/session/replay-value-preview.d.ts +8 -0
  137. package/dist/debugger/session/replay-value-preview.js +15 -0
  138. package/dist/debugger/source/daml-source-mapper.d.ts +12 -0
  139. package/dist/debugger/source/daml-source-mapper.js +21 -0
  140. package/dist/debugger/source/dar-source-map-metadata.d.ts +26 -0
  141. package/dist/debugger/source/dar-source-map-metadata.js +10 -0
  142. package/dist/debugger/source/source-coverage-validator.d.ts +8 -0
  143. package/dist/debugger/source/source-coverage-validator.js +16 -0
  144. package/dist/debugger/source/source-indexed-compilation.d.ts +45 -0
  145. package/dist/debugger/source/source-indexed-compilation.js +110 -0
  146. package/dist/debugger/source/source-mapping-precision.d.ts +5 -0
  147. package/dist/debugger/source/source-mapping-precision.js +4 -0
  148. package/dist/index.d.ts +20 -0
  149. package/dist/index.js +12 -0
  150. package/dist/query/cache/memory-query-cache.d.ts +9 -0
  151. package/dist/query/cache/memory-query-cache.js +24 -0
  152. package/dist/query/cache/query-cache-store.d.ts +5 -0
  153. package/dist/query/cache/query-cache-store.js +1 -0
  154. package/dist/query/canton-manager-options.d.ts +17 -0
  155. package/dist/query/canton-manager-options.js +1 -0
  156. package/dist/query/canton-manager.d.ts +11 -0
  157. package/dist/query/canton-manager.js +42 -0
  158. package/dist/query/errors/pqs-query-error.d.ts +10 -0
  159. package/dist/query/errors/pqs-query-error.js +11 -0
  160. package/dist/query/errors/pqs-schema-profile-error.d.ts +3 -0
  161. package/dist/query/errors/pqs-schema-profile-error.js +3 -0
  162. package/dist/query/errors/query-capability-error.d.ts +7 -0
  163. package/dist/query/errors/query-capability-error.js +10 -0
  164. package/dist/query/grpc/grpc-contract-query-client.d.ts +32 -0
  165. package/dist/query/grpc/grpc-contract-query-client.js +126 -0
  166. package/dist/query/model-types.d.ts +258 -0
  167. package/dist/query/model-types.js +14 -0
  168. package/dist/query/pqs/pqs-pool.d.ts +13 -0
  169. package/dist/query/pqs/pqs-pool.js +18 -0
  170. package/dist/query/pqs/pqs-query-client.d.ts +49 -0
  171. package/dist/query/pqs/pqs-query-client.js +324 -0
  172. package/dist/query/pqs/pqs-schema-profile.d.ts +25 -0
  173. package/dist/query/pqs/pqs-schema-profile.js +120 -0
  174. package/dist/query/pqs/pqs-sql-compiler.d.ts +7 -0
  175. package/dist/query/pqs/pqs-sql-compiler.js +132 -0
  176. package/dist/query/pqs/read-only-sql.d.ts +1 -0
  177. package/dist/query/pqs/read-only-sql.js +35 -0
  178. package/dist/query/query-client.d.ts +61 -0
  179. package/dist/query/query-client.js +1 -0
  180. package/dist/query/query-source.d.ts +4 -0
  181. package/dist/query/query-source.js +5 -0
  182. package/dist/services/commands/command-payload-builder.js +3 -3
  183. package/dist/services/commands/command-submission-pipeline.js +1 -7
  184. package/dist/services/party-management/decentralized-party-lifecycle.d.ts +6 -0
  185. package/dist/services/party-management/decentralized-party-lifecycle.js +82 -0
  186. package/dist/services/party-management/party-management-service-client.d.ts +16 -1
  187. package/dist/services/party-management/party-management-service-client.js +142 -1
  188. package/dist/services/topology-manager-write/topology-signed-transaction-assembler.js +4 -0
  189. package/dist/testing/campaign/campaign-artifact.d.ts +20 -0
  190. package/dist/testing/campaign/campaign-artifact.js +147 -0
  191. package/dist/testing/campaign/campaign-definition.d.ts +9 -0
  192. package/dist/testing/campaign/campaign-definition.js +78 -0
  193. package/dist/testing/campaign/campaign-metrics.d.ts +32 -0
  194. package/dist/testing/campaign/campaign-metrics.js +26 -0
  195. package/dist/testing/campaign/campaign-model.d.ts +11 -0
  196. package/dist/testing/campaign/campaign-model.js +21 -0
  197. package/dist/testing/campaign/campaign-runner.d.ts +99 -0
  198. package/dist/testing/campaign/campaign-runner.js +194 -0
  199. package/dist/testing/campaign/campaign-scheduler.d.ts +40 -0
  200. package/dist/testing/campaign/campaign-scheduler.js +75 -0
  201. package/dist/testing/campaign/campaign-types.d.ts +52 -0
  202. package/dist/testing/campaign/campaign-types.js +11 -0
  203. package/dist/testing/daml/daml-action-arbitrary.d.ts +13 -0
  204. package/dist/testing/daml/daml-action-arbitrary.js +24 -0
  205. package/dist/testing/daml/daml-choice-action-arbitrary.d.ts +18 -0
  206. package/dist/testing/daml/daml-choice-action-arbitrary.js +27 -0
  207. package/dist/testing/daml/daml-create-action-arbitrary.d.ts +19 -0
  208. package/dist/testing/daml/daml-create-action-arbitrary.js +34 -0
  209. package/dist/testing/daml/daml-testing-catalog.d.ts +38 -0
  210. package/dist/testing/daml/daml-testing-catalog.js +40 -0
  211. package/dist/testing/daml/daml-value-arbitrary.d.ts +8 -0
  212. package/dist/testing/daml/daml-value-arbitrary.js +43 -0
  213. package/dist/testing/daml/declarative-campaign-arbitrary.d.ts +15 -0
  214. package/dist/testing/daml/declarative-campaign-arbitrary.js +30 -0
  215. package/dist/testing/errors/invariant-campaign-failure.d.ts +24 -0
  216. package/dist/testing/errors/invariant-campaign-failure.js +37 -0
  217. package/dist/testing/errors/testing-configuration-error.d.ts +3 -0
  218. package/dist/testing/errors/testing-configuration-error.js +6 -0
  219. package/dist/testing/handlers/handler.d.ts +19 -0
  220. package/dist/testing/handlers/handler.js +31 -0
  221. package/dist/testing/index.d.ts +22 -0
  222. package/dist/testing/index.js +22 -0
  223. package/dist/testing/runtime/campaign-isolation.d.ts +14 -0
  224. package/dist/testing/runtime/campaign-isolation.js +23 -0
  225. package/dist/testing/runtime/canton-test-runtime.d.ts +58 -0
  226. package/dist/testing/runtime/canton-test-runtime.js +138 -0
  227. package/dist/testing/runtime/declarative-action-executor.d.ts +16 -0
  228. package/dist/testing/runtime/declarative-action-executor.js +41 -0
  229. package/dist/testing/targets/target.d.ts +49 -0
  230. package/dist/testing/targets/target.js +121 -0
  231. package/dist/transports/grpc/grpc-channel-factory.d.ts +4 -0
  232. package/dist/transports/grpc/grpc-channel-factory.js +42 -1
  233. package/dist/transports/grpc/grpc-transport.d.ts +2 -2
  234. package/dist/transports/grpc/grpc-transport.js +42 -3
  235. package/dist/transports/grpc/mappers/commands-mapper.d.ts +10 -2
  236. package/dist/transports/grpc/mappers/commands-mapper.js +30 -12
  237. package/dist/transports/grpc/mappers/contracts-mapper.d.ts +3 -1
  238. package/dist/transports/grpc/mappers/contracts-mapper.js +16 -3
  239. package/dist/transports/grpc/mappers/interactive-command-mapper.d.ts +15 -0
  240. package/dist/transports/grpc/mappers/interactive-command-mapper.js +54 -0
  241. package/dist/transports/grpc/mappers/topology-manager-write-mapper.js +59 -1
  242. package/dist/transports/json/json-transport.d.ts +2 -2
  243. package/dist/transports/json/json-transport.js +2 -2
  244. package/dist/transports/json/mappers/commands-mapper.js +23 -9
  245. package/node/.generated/start-local/additional-config.extra-participants.conf +37 -0
  246. package/node/.generated/start-local/additional-config.extra-validators.conf +35 -0
  247. package/node/.generated/start-local/compose-extra-participants.yaml +147 -0
  248. package/node/.generated/start-local/extra-participants.env +30 -0
  249. package/node/es256-jwt.mjs +177 -0
  250. package/node/start-local.sh +886 -0
  251. package/node/stop-local.sh +200 -0
  252. package/node/test-start-local.sh +354 -0
  253. package/node/test-stop-local.sh +112 -0
  254. package/package.json +21 -2
@@ -1,9 +1,12 @@
1
1
  import { DamlLfCompilation } from "../daml-lf-compilation.js";
2
2
  import { DamlLfBuiltinDispatch } from "./daml-lf-builtin-dispatch.js";
3
+ import { DamlLfEvaluator } from "./daml-lf-evaluator.js";
3
4
  export declare class DamlLfInterpreterScaffold {
4
5
  private readonly compilation;
5
6
  private readonly builtinDispatch;
7
+ private readonly evaluator;
6
8
  constructor(compilation: DamlLfCompilation);
7
9
  getCompilation(): DamlLfCompilation;
8
10
  getBuiltinDispatch(): DamlLfBuiltinDispatch;
11
+ getEvaluator(): DamlLfEvaluator;
9
12
  }
@@ -1,10 +1,12 @@
1
1
  import { DamlLfBuiltinDispatch } from "./daml-lf-builtin-dispatch.js";
2
+ import { DamlLfEvaluator } from "./daml-lf-evaluator.js";
2
3
  export class DamlLfInterpreterScaffold {
3
4
  compilation;
4
5
  builtinDispatch = new DamlLfBuiltinDispatch();
6
+ evaluator;
5
7
  constructor(compilation) {
6
8
  this.compilation = compilation;
7
- void this.compilation;
9
+ this.evaluator = new DamlLfEvaluator(this.compilation, this.builtinDispatch);
8
10
  }
9
11
  getCompilation() {
10
12
  return this.compilation;
@@ -12,4 +14,7 @@ export class DamlLfInterpreterScaffold {
12
14
  getBuiltinDispatch() {
13
15
  return this.builtinDispatch;
14
16
  }
17
+ getEvaluator() {
18
+ return this.evaluator;
19
+ }
15
20
  }
@@ -0,0 +1,13 @@
1
+ import { IDamlLfRuntimeValue } from "./daml-lf-runtime-value.js";
2
+ export declare class DamlLfLexicalScope {
3
+ private readonly parent?;
4
+ private readonly bindings;
5
+ constructor(parent?: DamlLfLexicalScope | undefined);
6
+ getBinding(name: string): IDamlLfRuntimeValue | undefined;
7
+ setBinding(name: string, value: IDamlLfRuntimeValue): void;
8
+ createChild(): DamlLfLexicalScope;
9
+ snapshotBindings(): readonly {
10
+ name: string;
11
+ value: IDamlLfRuntimeValue;
12
+ }[];
13
+ }
@@ -0,0 +1,46 @@
1
+ export class DamlLfLexicalScope {
2
+ parent;
3
+ bindings = new Map();
4
+ constructor(parent) {
5
+ this.parent = parent;
6
+ }
7
+ getBinding(name) {
8
+ const visited = new Set();
9
+ let current = this;
10
+ while (current !== undefined && !visited.has(current)) {
11
+ visited.add(current);
12
+ const binding = current.bindings.get(name);
13
+ if (binding !== undefined) {
14
+ return binding;
15
+ }
16
+ current = current.parent;
17
+ }
18
+ return undefined;
19
+ }
20
+ setBinding(name, value) {
21
+ this.bindings.set(name, value);
22
+ }
23
+ createChild() {
24
+ return new DamlLfLexicalScope(this);
25
+ }
26
+ snapshotBindings() {
27
+ const scopes = [];
28
+ const resolved = new Map();
29
+ const visited = new Set();
30
+ let current = this;
31
+ while (current !== undefined && !visited.has(current)) {
32
+ visited.add(current);
33
+ scopes.push(current);
34
+ current = current.parent;
35
+ }
36
+ for (let index = scopes.length - 1; index >= 0; index -= 1) {
37
+ for (const [name, value] of scopes[index].bindings.entries()) {
38
+ resolved.set(name, value);
39
+ }
40
+ }
41
+ return [...resolved.entries()].map(([name, value]) => ({
42
+ name,
43
+ value,
44
+ }));
45
+ }
46
+ }
@@ -0,0 +1,16 @@
1
+ import { DamlLfValueDefinition } from "../model/daml-lf-value-definition.js";
2
+ import { DamlLfLexicalScope } from "./daml-lf-lexical-scope.js";
3
+ export declare class DamlLfRuntimeFrame {
4
+ readonly frameId: string;
5
+ readonly packageId: string;
6
+ readonly moduleName: string;
7
+ readonly definition: DamlLfValueDefinition;
8
+ readonly scope: DamlLfLexicalScope;
9
+ constructor(init: {
10
+ frameId: string;
11
+ packageId: string;
12
+ moduleName: string;
13
+ definition: DamlLfValueDefinition;
14
+ scope?: DamlLfLexicalScope;
15
+ });
16
+ }
@@ -0,0 +1,15 @@
1
+ import { DamlLfLexicalScope } from "./daml-lf-lexical-scope.js";
2
+ export class DamlLfRuntimeFrame {
3
+ frameId;
4
+ packageId;
5
+ moduleName;
6
+ definition;
7
+ scope;
8
+ constructor(init) {
9
+ this.frameId = init.frameId;
10
+ this.packageId = init.packageId;
11
+ this.moduleName = init.moduleName;
12
+ this.definition = init.definition;
13
+ this.scope = init.scope ?? new DamlLfLexicalScope();
14
+ }
15
+ }
@@ -1,3 +1,24 @@
1
1
  export interface IDamlLfRuntimeValue {
2
2
  readonly kind: string;
3
+ readonly [key: string]: unknown;
4
+ }
5
+ export declare const DAML_LF_CONTRACT_ID_MARKER_KEY = "__damlLfContractId";
6
+ export declare const DAML_LF_NUMERIC_MARKER_KEY = "__damlLfNumeric";
7
+ export declare const DAML_LF_PARTY_MARKER_KEY = "__damlLfParty";
8
+ export declare const DAML_LF_RECORD_ID_MARKER_KEY = "__damlLfRecordId";
9
+ export interface IDamlLfContractIdMarkerValue {
10
+ readonly [DAML_LF_CONTRACT_ID_MARKER_KEY]: string;
11
+ }
12
+ export interface IDamlLfPartyMarkerValue {
13
+ readonly [DAML_LF_PARTY_MARKER_KEY]: string;
14
+ }
15
+ export interface IDamlLfNumericMarkerValue {
16
+ readonly [DAML_LF_NUMERIC_MARKER_KEY]: string;
17
+ }
18
+ export interface IDamlLfRecordIdMarkerValue {
19
+ readonly [DAML_LF_RECORD_ID_MARKER_KEY]: {
20
+ readonly packageId?: string;
21
+ readonly moduleName?: string;
22
+ readonly entityName?: string;
23
+ };
3
24
  }
@@ -1 +1,4 @@
1
- export {};
1
+ export const DAML_LF_CONTRACT_ID_MARKER_KEY = "__damlLfContractId";
2
+ export const DAML_LF_NUMERIC_MARKER_KEY = "__damlLfNumeric";
3
+ export const DAML_LF_PARTY_MARKER_KEY = "__damlLfParty";
4
+ export const DAML_LF_RECORD_ID_MARKER_KEY = "__damlLfRecordId";
@@ -0,0 +1,7 @@
1
+ export declare enum DamlLfStepKind {
2
+ stateEffect = "stateEffect",
3
+ call = "call",
4
+ return = "return",
5
+ enterExpression = "enterExpression",
6
+ exitExpression = "exitExpression"
7
+ }
@@ -0,0 +1,8 @@
1
+ export var DamlLfStepKind;
2
+ (function (DamlLfStepKind) {
3
+ DamlLfStepKind["stateEffect"] = "stateEffect";
4
+ DamlLfStepKind["call"] = "call";
5
+ DamlLfStepKind["return"] = "return";
6
+ DamlLfStepKind["enterExpression"] = "enterExpression";
7
+ DamlLfStepKind["exitExpression"] = "exitExpression";
8
+ })(DamlLfStepKind || (DamlLfStepKind = {}));
@@ -0,0 +1,30 @@
1
+ import { DamlLfExpression } from "../model/daml-lf-expression.js";
2
+ import { IDamlLfRuntimeValue } from "./daml-lf-runtime-value.js";
3
+ import { DamlLfRuntimeFrame } from "./daml-lf-runtime-frame.js";
4
+ import { DamlLfStepKind } from "./daml-lf-step-kind.js";
5
+ export interface IDamlLfReplayEffect {
6
+ readonly kind: "create" | "exercise" | "archive" | "fetch" | "lookup";
7
+ readonly contractId?: string;
8
+ readonly templateId?: {
9
+ readonly packageId?: string;
10
+ readonly moduleName?: string;
11
+ readonly entityName?: string;
12
+ };
13
+ readonly choice?: string;
14
+ readonly argument?: unknown;
15
+ readonly payload?: unknown;
16
+ }
17
+ export interface IDamlLfTraceStep {
18
+ readonly kind: DamlLfStepKind;
19
+ readonly expression: DamlLfExpression;
20
+ readonly frame: DamlLfRuntimeFrame;
21
+ readonly locals: readonly {
22
+ readonly name: string;
23
+ readonly value: IDamlLfRuntimeValue;
24
+ }[];
25
+ readonly value?: IDamlLfRuntimeValue;
26
+ readonly stateEffect?: IDamlLfReplayEffect;
27
+ }
28
+ export interface IDamlLfTraceSink {
29
+ onStep(step: IDamlLfTraceStep): void;
30
+ }
@@ -1,4 +1,7 @@
1
1
  export declare enum DamlLfBuiltinType {
2
+ int64 = "int64",
3
+ numeric = "numeric",
4
+ party = "party",
2
5
  text = "text",
3
6
  unknown = "unknown"
4
7
  }
@@ -1,5 +1,8 @@
1
1
  export var DamlLfBuiltinType;
2
2
  (function (DamlLfBuiltinType) {
3
+ DamlLfBuiltinType["int64"] = "int64";
4
+ DamlLfBuiltinType["numeric"] = "numeric";
5
+ DamlLfBuiltinType["party"] = "party";
3
6
  DamlLfBuiltinType["text"] = "text";
4
7
  DamlLfBuiltinType["unknown"] = "unknown";
5
8
  })(DamlLfBuiltinType || (DamlLfBuiltinType = {}));
@@ -1,16 +1,21 @@
1
1
  import { DamlLfChoiceParameter } from "./daml-lf-choice-parameter.js";
2
+ import { DamlLfExpression } from "./daml-lf-expression.js";
2
3
  import { DamlLfNodeKind } from "./daml-lf-node-kind.js";
3
4
  import { DamlLfType } from "./daml-lf-type.js";
4
5
  export declare class DamlLfChoice {
5
6
  readonly nodeKind = DamlLfNodeKind.choice;
6
7
  readonly name: string;
7
8
  readonly consuming: boolean;
9
+ readonly selfBinderName: string;
8
10
  readonly parameter: DamlLfChoiceParameter;
9
11
  readonly returnType: DamlLfType;
12
+ readonly updateExpression?: DamlLfExpression;
10
13
  constructor(init: {
11
14
  name: string;
15
+ selfBinderName: string;
12
16
  parameter: DamlLfChoiceParameter;
13
17
  consuming?: boolean;
14
18
  returnType?: DamlLfType;
19
+ updateExpression?: DamlLfExpression;
15
20
  });
16
21
  }
@@ -3,12 +3,16 @@ export class DamlLfChoice {
3
3
  nodeKind = DamlLfNodeKind.choice;
4
4
  name;
5
5
  consuming;
6
+ selfBinderName;
6
7
  parameter;
7
8
  returnType;
9
+ updateExpression;
8
10
  constructor(init) {
9
11
  this.name = init.name;
10
12
  this.parameter = init.parameter;
11
13
  this.consuming = init.consuming ?? true;
14
+ this.selfBinderName = init.selfBinderName;
12
15
  this.returnType = init.returnType ?? init.parameter.type;
16
+ this.updateExpression = init.updateExpression;
13
17
  }
14
18
  }
@@ -0,0 +1,2 @@
1
+ import { DamlLfExpression } from "./daml-lf-expression.js";
2
+ export declare function getDamlLfExpressionAtPath(root: DamlLfExpression, path: readonly number[]): DamlLfExpression | undefined;
@@ -0,0 +1,81 @@
1
+ // This child ordering is the compiler/SDK sidecar wire contract.
2
+ export function getDamlLfExpressionAtPath(root, path) {
3
+ let expression = root;
4
+ for (const childIndex of path) {
5
+ if (!Number.isSafeInteger(childIndex) || childIndex < 0) {
6
+ return undefined;
7
+ }
8
+ expression = getDamlLfExpressionChildren(expression)[childIndex];
9
+ if (expression === undefined) {
10
+ return undefined;
11
+ }
12
+ }
13
+ return expression;
14
+ }
15
+ function getDamlLfExpressionChildren(expression) {
16
+ if (expression.lambda !== undefined) {
17
+ return [expression.lambda.body];
18
+ }
19
+ if (expression.application !== undefined) {
20
+ return [
21
+ expression.application.function,
22
+ ...expression.application.arguments,
23
+ ];
24
+ }
25
+ if (expression.letExpression !== undefined) {
26
+ return [
27
+ ...expression.letExpression.bindings.map((binding) => binding.value),
28
+ expression.letExpression.body,
29
+ ];
30
+ }
31
+ if (expression.recordConstruction !== undefined) {
32
+ return expression.recordConstruction.fields.map((field) => field.value);
33
+ }
34
+ if (expression.recordProjection !== undefined) {
35
+ return [expression.recordProjection.record];
36
+ }
37
+ if (expression.recordUpdate !== undefined) {
38
+ return [
39
+ expression.recordUpdate.record,
40
+ expression.recordUpdate.value,
41
+ ];
42
+ }
43
+ if (expression.caseExpression !== undefined) {
44
+ return [
45
+ expression.caseExpression.scrutinee,
46
+ ...expression.caseExpression.alternatives.map((alternative) => alternative.body),
47
+ ];
48
+ }
49
+ if (expression.variantConstruction !== undefined) {
50
+ return [expression.variantConstruction.argument];
51
+ }
52
+ if (expression.optionalConstruction?.value !== undefined) {
53
+ return [expression.optionalConstruction.value];
54
+ }
55
+ if (expression.listConstruction !== undefined) {
56
+ return [
57
+ ...expression.listConstruction.front,
58
+ ...(expression.listConstruction.tail === undefined
59
+ ? []
60
+ : [expression.listConstruction.tail]),
61
+ ];
62
+ }
63
+ if (expression.updateExpression !== undefined) {
64
+ return [
65
+ ...(expression.updateExpression.expression === undefined
66
+ ? []
67
+ : [expression.updateExpression.expression]),
68
+ ...(expression.updateExpression.bindings?.map((binding) => binding.value) ?? []),
69
+ ...(expression.updateExpression.body === undefined
70
+ ? []
71
+ : [expression.updateExpression.body]),
72
+ ...(expression.updateExpression.contractId === undefined
73
+ ? []
74
+ : [expression.updateExpression.contractId]),
75
+ ...(expression.updateExpression.argument === undefined
76
+ ? []
77
+ : [expression.updateExpression.argument]),
78
+ ];
79
+ }
80
+ return [];
81
+ }
@@ -1,8 +1,154 @@
1
1
  import { DamlLfNodeKind } from "./daml-lf-node-kind.js";
2
+ export interface IDamlLfValueReference {
3
+ readonly packageId: string;
4
+ readonly moduleName: string;
5
+ readonly definitionName: string;
6
+ }
7
+ export interface IDamlLfExpressionSourceLocation {
8
+ readonly packageId?: string;
9
+ readonly moduleName?: string;
10
+ readonly startLine: number;
11
+ readonly startColumn: number;
12
+ readonly endLine: number;
13
+ readonly endColumn: number;
14
+ }
15
+ export interface IDamlLfLambdaExpression {
16
+ readonly parameters: readonly string[];
17
+ readonly body: DamlLfExpression;
18
+ }
19
+ export interface IDamlLfApplicationExpression {
20
+ readonly function: DamlLfExpression;
21
+ readonly arguments: readonly DamlLfExpression[];
22
+ }
23
+ export interface IDamlLfLetBinding {
24
+ readonly name: string;
25
+ readonly value: DamlLfExpression;
26
+ }
27
+ export interface IDamlLfLetExpression {
28
+ readonly bindings: readonly IDamlLfLetBinding[];
29
+ readonly body: DamlLfExpression;
30
+ }
31
+ export interface IDamlLfRecordFieldExpression {
32
+ readonly name: string;
33
+ readonly value: DamlLfExpression;
34
+ }
35
+ export interface IDamlLfRecordConstructionExpression {
36
+ readonly fields: readonly IDamlLfRecordFieldExpression[];
37
+ }
38
+ export interface IDamlLfRecordProjectionExpression {
39
+ readonly fieldName: string;
40
+ readonly record: DamlLfExpression;
41
+ }
42
+ export interface IDamlLfRecordUpdateExpression {
43
+ readonly fieldName: string;
44
+ readonly record: DamlLfExpression;
45
+ readonly value: DamlLfExpression;
46
+ }
47
+ export interface IDamlLfThrowExpression {
48
+ readonly exception: DamlLfExpression;
49
+ }
50
+ export type DamlLfBuiltinConstructor = "unit" | "false" | "true";
51
+ export type DamlLfBuiltinFunction = "equal" | "greater" | "appendText" | string;
52
+ export interface IDamlLfVariantConstructionExpression {
53
+ readonly constructorName: string;
54
+ readonly argument: DamlLfExpression;
55
+ }
56
+ export interface IDamlLfOptionalConstructionExpression {
57
+ readonly value?: DamlLfExpression;
58
+ }
59
+ export interface IDamlLfEnumConstructionExpression {
60
+ readonly constructorName: string;
61
+ }
62
+ export interface IDamlLfListConstructionExpression {
63
+ readonly front: readonly DamlLfExpression[];
64
+ readonly tail?: DamlLfExpression;
65
+ }
66
+ export interface IDamlLfUpdateBinding {
67
+ readonly name: string;
68
+ readonly value: DamlLfExpression;
69
+ }
70
+ export interface IDamlLfUpdateExpression {
71
+ readonly kind: "pure" | "block" | "embedExpr" | "tryCatch" | "create" | "createInterface" | "fetch" | "fetchInterface" | "exercise" | "exerciseInterface" | "getTime" | "ledgerTimeLt";
72
+ readonly expression?: DamlLfExpression;
73
+ readonly bindings?: readonly IDamlLfUpdateBinding[];
74
+ readonly body?: DamlLfExpression;
75
+ readonly catchVariableName?: string;
76
+ readonly catchExpression?: DamlLfExpression;
77
+ readonly templateId?: {
78
+ readonly packageId: string;
79
+ readonly moduleName: string;
80
+ readonly templateName: string;
81
+ };
82
+ readonly interfaceId?: {
83
+ readonly packageId: string;
84
+ readonly moduleName: string;
85
+ readonly templateName: string;
86
+ };
87
+ readonly choiceName?: string;
88
+ readonly contractId?: DamlLfExpression;
89
+ readonly argument?: DamlLfExpression;
90
+ readonly guardExpression?: DamlLfExpression;
91
+ }
92
+ export interface IDamlLfCaseAlternative {
93
+ readonly patternKind: "default" | "builtinCon" | "variant" | "optionalNone" | "optionalSome" | "enum" | "nil" | "cons";
94
+ readonly builtinConstructor?: DamlLfBuiltinConstructor;
95
+ readonly constructorName?: string;
96
+ readonly binderName?: string;
97
+ readonly headBinderName?: string;
98
+ readonly tailBinderName?: string;
99
+ readonly body: DamlLfExpression;
100
+ }
101
+ export interface IDamlLfCaseExpression {
102
+ readonly scrutinee: DamlLfExpression;
103
+ readonly alternatives: readonly IDamlLfCaseAlternative[];
104
+ }
2
105
  export declare class DamlLfExpression {
3
106
  readonly nodeKind = DamlLfNodeKind.expression;
4
107
  readonly textLiteral?: string;
108
+ readonly numericLiteral?: string;
109
+ readonly int64Literal?: string;
110
+ readonly valueReference?: IDamlLfValueReference;
111
+ readonly variableName?: string;
112
+ readonly lambda?: IDamlLfLambdaExpression;
113
+ readonly application?: IDamlLfApplicationExpression;
114
+ readonly letExpression?: IDamlLfLetExpression;
115
+ readonly recordConstruction?: IDamlLfRecordConstructionExpression;
116
+ readonly recordProjection?: IDamlLfRecordProjectionExpression;
117
+ readonly recordUpdate?: IDamlLfRecordUpdateExpression;
118
+ readonly throwExpression?: IDamlLfThrowExpression;
119
+ readonly builtinConstructor?: DamlLfBuiltinConstructor;
120
+ readonly builtinFunction?: DamlLfBuiltinFunction;
121
+ readonly caseExpression?: IDamlLfCaseExpression;
122
+ readonly variantConstruction?: IDamlLfVariantConstructionExpression;
123
+ readonly optionalConstruction?: IDamlLfOptionalConstructionExpression;
124
+ readonly enumConstruction?: IDamlLfEnumConstructionExpression;
125
+ readonly listConstruction?: IDamlLfListConstructionExpression;
126
+ readonly updateExpression?: IDamlLfUpdateExpression;
127
+ readonly unsupportedNodeKind?: string;
128
+ readonly sourceLocation?: IDamlLfExpressionSourceLocation;
5
129
  constructor(init: {
6
130
  textLiteral?: string;
131
+ numericLiteral?: string;
132
+ int64Literal?: string;
133
+ valueReference?: IDamlLfValueReference;
134
+ variableName?: string;
135
+ lambda?: IDamlLfLambdaExpression;
136
+ application?: IDamlLfApplicationExpression;
137
+ letExpression?: IDamlLfLetExpression;
138
+ recordConstruction?: IDamlLfRecordConstructionExpression;
139
+ recordProjection?: IDamlLfRecordProjectionExpression;
140
+ recordUpdate?: IDamlLfRecordUpdateExpression;
141
+ throwExpression?: IDamlLfThrowExpression;
142
+ builtinConstructor?: DamlLfBuiltinConstructor;
143
+ builtinFunction?: DamlLfBuiltinFunction;
144
+ caseExpression?: IDamlLfCaseExpression;
145
+ variantConstruction?: IDamlLfVariantConstructionExpression;
146
+ optionalConstruction?: IDamlLfOptionalConstructionExpression;
147
+ enumConstruction?: IDamlLfEnumConstructionExpression;
148
+ listConstruction?: IDamlLfListConstructionExpression;
149
+ updateExpression?: IDamlLfUpdateExpression;
150
+ unsupportedNodeKind?: string;
151
+ sourceLocation?: IDamlLfExpressionSourceLocation;
7
152
  });
153
+ withSourceLocation(sourceLocation: IDamlLfExpressionSourceLocation | undefined): DamlLfExpression;
8
154
  }
@@ -2,7 +2,78 @@ import { DamlLfNodeKind } from "./daml-lf-node-kind.js";
2
2
  export class DamlLfExpression {
3
3
  nodeKind = DamlLfNodeKind.expression;
4
4
  textLiteral;
5
+ numericLiteral;
6
+ int64Literal;
7
+ valueReference;
8
+ variableName;
9
+ lambda;
10
+ application;
11
+ letExpression;
12
+ recordConstruction;
13
+ recordProjection;
14
+ recordUpdate;
15
+ throwExpression;
16
+ builtinConstructor;
17
+ builtinFunction;
18
+ caseExpression;
19
+ variantConstruction;
20
+ optionalConstruction;
21
+ enumConstruction;
22
+ listConstruction;
23
+ updateExpression;
24
+ unsupportedNodeKind;
25
+ sourceLocation;
5
26
  constructor(init) {
6
27
  this.textLiteral = init.textLiteral;
28
+ this.numericLiteral = init.numericLiteral;
29
+ this.int64Literal = init.int64Literal;
30
+ this.valueReference = init.valueReference;
31
+ this.variableName = init.variableName;
32
+ this.lambda = init.lambda;
33
+ this.application = init.application;
34
+ this.letExpression = init.letExpression;
35
+ this.recordConstruction = init.recordConstruction;
36
+ this.recordProjection = init.recordProjection;
37
+ this.recordUpdate = init.recordUpdate;
38
+ this.throwExpression = init.throwExpression;
39
+ this.builtinConstructor = init.builtinConstructor;
40
+ this.builtinFunction = init.builtinFunction;
41
+ this.caseExpression = init.caseExpression;
42
+ this.variantConstruction = init.variantConstruction;
43
+ this.optionalConstruction = init.optionalConstruction;
44
+ this.enumConstruction = init.enumConstruction;
45
+ this.listConstruction = init.listConstruction;
46
+ this.updateExpression = init.updateExpression;
47
+ this.unsupportedNodeKind = init.unsupportedNodeKind;
48
+ this.sourceLocation = init.sourceLocation;
49
+ }
50
+ withSourceLocation(sourceLocation) {
51
+ if (sourceLocation === undefined) {
52
+ return this;
53
+ }
54
+ return new DamlLfExpression({
55
+ textLiteral: this.textLiteral,
56
+ numericLiteral: this.numericLiteral,
57
+ int64Literal: this.int64Literal,
58
+ valueReference: this.valueReference,
59
+ variableName: this.variableName,
60
+ lambda: this.lambda,
61
+ application: this.application,
62
+ letExpression: this.letExpression,
63
+ recordConstruction: this.recordConstruction,
64
+ recordProjection: this.recordProjection,
65
+ recordUpdate: this.recordUpdate,
66
+ throwExpression: this.throwExpression,
67
+ builtinConstructor: this.builtinConstructor,
68
+ builtinFunction: this.builtinFunction,
69
+ caseExpression: this.caseExpression,
70
+ variantConstruction: this.variantConstruction,
71
+ optionalConstruction: this.optionalConstruction,
72
+ enumConstruction: this.enumConstruction,
73
+ listConstruction: this.listConstruction,
74
+ updateExpression: this.updateExpression,
75
+ unsupportedNodeKind: this.unsupportedNodeKind,
76
+ sourceLocation,
77
+ });
7
78
  }
8
79
  }
@@ -6,11 +6,13 @@ import { DamlLfTemplateId } from "./daml-lf-template-id.js";
6
6
  export declare class DamlLfTemplate extends DamlLfDefinition {
7
7
  readonly nodeKind = DamlLfNodeKind.template;
8
8
  readonly templateId: DamlLfTemplateId;
9
+ readonly parameterName: string;
9
10
  readonly fields: readonly DamlLfField[];
10
11
  readonly choices: readonly DamlLfChoice[];
11
12
  constructor(init: {
12
13
  templateId: DamlLfTemplateId;
13
14
  name: string;
15
+ parameterName: string;
14
16
  fields: readonly DamlLfField[];
15
17
  choices: readonly DamlLfChoice[];
16
18
  });
@@ -3,6 +3,7 @@ import { DamlLfNodeKind } from "./daml-lf-node-kind.js";
3
3
  export class DamlLfTemplate extends DamlLfDefinition {
4
4
  nodeKind = DamlLfNodeKind.template;
5
5
  templateId;
6
+ parameterName;
6
7
  fields;
7
8
  choices;
8
9
  constructor(init) {
@@ -10,6 +11,7 @@ export class DamlLfTemplate extends DamlLfDefinition {
10
11
  name: init.name,
11
12
  });
12
13
  this.templateId = init.templateId;
14
+ this.parameterName = init.parameterName;
13
15
  this.fields = init.fields;
14
16
  this.choices = init.choices;
15
17
  }
@@ -4,9 +4,11 @@ import { TypeConReference } from "./type-con-reference.js";
4
4
  export declare class DamlLfType {
5
5
  readonly nodeKind = DamlLfNodeKind.type;
6
6
  readonly builtinType: DamlLfBuiltinType;
7
+ readonly numericScale?: number;
7
8
  readonly typeConReference?: TypeConReference;
8
9
  constructor(init: {
9
10
  builtinType?: DamlLfBuiltinType;
11
+ numericScale?: number;
10
12
  typeConReference?: TypeConReference;
11
13
  });
12
14
  }
@@ -3,9 +3,13 @@ import { DamlLfNodeKind } from "./daml-lf-node-kind.js";
3
3
  export class DamlLfType {
4
4
  nodeKind = DamlLfNodeKind.type;
5
5
  builtinType;
6
+ numericScale;
6
7
  typeConReference;
7
8
  constructor(init) {
8
9
  this.builtinType = init.builtinType ?? DamlLfBuiltinType.unknown;
10
+ if (init.numericScale !== undefined) {
11
+ this.numericScale = init.numericScale;
12
+ }
9
13
  this.typeConReference = init.typeConReference;
10
14
  }
11
15
  }
@@ -4,6 +4,7 @@ import { DamlLfPackage } from "./daml-lf-package.js";
4
4
  export declare class Lf2ModelMapper {
5
5
  static mapPackage(packageId: string, rawPackage: LfArchivePackage, languageVersion: DamlLfLanguageVersion): DamlLfPackage;
6
6
  private static mapType;
7
+ private static readNumericScale;
7
8
  private static mapModule;
8
9
  private static mapDataType;
9
10
  private static mapTemplateOrThrow;
@@ -14,6 +15,10 @@ export declare class Lf2ModelMapper {
14
15
  private static resolvePackageIdOrThrow;
15
16
  private static resolveImportedPackageIdOrThrow;
16
17
  private static mapExpression;
18
+ private static mapExpressionWithoutSourceLocation;
19
+ private static mapExpressionSourceLocation;
20
+ private static mapUpdateExpression;
21
+ private static mapTemplateReferenceOrThrow;
17
22
  private static resolveInternedString;
18
23
  private static resolveInternedDottedName;
19
24
  }