@distrohelena/canton-explorer 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 (127) hide show
  1. package/README.md +32 -0
  2. package/dist/public/assets/DebuggerView-Mk6TEUJB.js +5 -0
  3. package/dist/public/assets/abap-08VXUWAP.js +1 -0
  4. package/dist/public/assets/apex-BWPQTe0t.js +1 -0
  5. package/dist/public/assets/azcli-Bc_sGQ0U.js +1 -0
  6. package/dist/public/assets/bat-i0X4ZdIN.js +1 -0
  7. package/dist/public/assets/bicep-B5-_aFwp.js +2 -0
  8. package/dist/public/assets/cameligo-DMUM7wLl.js +1 -0
  9. package/dist/public/assets/clojure-Cm7r79vr.js +1 -0
  10. package/dist/public/assets/codicon-ngg6Pgfi.ttf +0 -0
  11. package/dist/public/assets/coffee-Ba7i2nA0.js +1 -0
  12. package/dist/public/assets/cpp-C7h46wYY.js +1 -0
  13. package/dist/public/assets/csharp-BKxtCVv1.js +1 -0
  14. package/dist/public/assets/csp-bTuwJoIa.js +1 -0
  15. package/dist/public/assets/css-DIMkf-bt.js +3 -0
  16. package/dist/public/assets/cssMode-Ce-rlOrP.js +1 -0
  17. package/dist/public/assets/cypher-CVaqCwHa.js +1 -0
  18. package/dist/public/assets/dart-onAF5SnQ.js +1 -0
  19. package/dist/public/assets/dockerfile-DZFCIeNp.js +1 -0
  20. package/dist/public/assets/ecl-D05T4iGw.js +1 -0
  21. package/dist/public/assets/editor-Br_kD0ds.css +1 -0
  22. package/dist/public/assets/editor.api2-7H_iQTr0.js +872 -0
  23. package/dist/public/assets/elixir-6RTg0lbw.js +1 -0
  24. package/dist/public/assets/flow9-C5_-GSwl.js +1 -0
  25. package/dist/public/assets/freemarker2-B-DvnnHs.js +3 -0
  26. package/dist/public/assets/fsharp-C8Ef5oNN.js +1 -0
  27. package/dist/public/assets/go-C-y9NEjX.js +1 -0
  28. package/dist/public/assets/graphql-fmXr3nnJ.js +1 -0
  29. package/dist/public/assets/handlebars-CME0Fldi.js +1 -0
  30. package/dist/public/assets/hcl-CpzslTdj.js +1 -0
  31. package/dist/public/assets/html-Beb3lxWO.js +1 -0
  32. package/dist/public/assets/htmlMode-CAgp27Dj.js +1 -0
  33. package/dist/public/assets/index-CucRixYI.css +1 -0
  34. package/dist/public/assets/index-Dn15ZYDU.js +1 -0
  35. package/dist/public/assets/ini-sBoK_t0W.js +1 -0
  36. package/dist/public/assets/java-BEtHBSE6.js +1 -0
  37. package/dist/public/assets/javascript-DdcWrUzt.js +1 -0
  38. package/dist/public/assets/jsonMode-BCddWWWg.js +7 -0
  39. package/dist/public/assets/julia-Bri6UV-V.js +1 -0
  40. package/dist/public/assets/kotlin-BOotOW0E.js +1 -0
  41. package/dist/public/assets/less-B9JPFI3C.js +2 -0
  42. package/dist/public/assets/lexon-CfSJPG6W.js +1 -0
  43. package/dist/public/assets/liquid-DmF9SgC3.js +1 -0
  44. package/dist/public/assets/lspLanguageFeatures-D7zEWtOG.js +4 -0
  45. package/dist/public/assets/lua-CsQS60Ue.js +1 -0
  46. package/dist/public/assets/m3-D-oSqn_W.js +1 -0
  47. package/dist/public/assets/markdown-Cimd5fb3.js +1 -0
  48. package/dist/public/assets/mdx-PwCfoB0S.js +1 -0
  49. package/dist/public/assets/mips-CIPQ_RoX.js +1 -0
  50. package/dist/public/assets/monaco-runtime-Bkgn_wG8.js +6 -0
  51. package/dist/public/assets/monaco.contribution-B2Ohh6Li.js +2 -0
  52. package/dist/public/assets/msdax-DauUninz.js +1 -0
  53. package/dist/public/assets/mysql-SOo6toE5.js +1 -0
  54. package/dist/public/assets/objective-c-FvmIjYaQ.js +1 -0
  55. package/dist/public/assets/pascal-DrH0SRf2.js +1 -0
  56. package/dist/public/assets/pascaligo-D-ptJ9y-.js +1 -0
  57. package/dist/public/assets/perl-oz_6vUea.js +1 -0
  58. package/dist/public/assets/pgsql-DTj74zXo.js +1 -0
  59. package/dist/public/assets/php-nr791fC2.js +1 -0
  60. package/dist/public/assets/pla-CopQ2nXW.js +1 -0
  61. package/dist/public/assets/postiats-43DmfD33.js +1 -0
  62. package/dist/public/assets/powerquery-D3hlyOfw.js +1 -0
  63. package/dist/public/assets/powershell-DmHpPYUd.js +1 -0
  64. package/dist/public/assets/protobuf-C531GsRP.js +2 -0
  65. package/dist/public/assets/pug-Z5eAx3Zn.js +1 -0
  66. package/dist/public/assets/python-pS1EqvyQ.js +1 -0
  67. package/dist/public/assets/qsharp-DkqhCAOL.js +1 -0
  68. package/dist/public/assets/r-BwWrilGY.js +1 -0
  69. package/dist/public/assets/razor-CZ2fK_eC.js +1 -0
  70. package/dist/public/assets/redis-ClamHrr6.js +1 -0
  71. package/dist/public/assets/redshift-DT7zqm-g.js +1 -0
  72. package/dist/public/assets/restructuredtext-BYgofb2h.js +1 -0
  73. package/dist/public/assets/ruby-DezsRK8O.js +1 -0
  74. package/dist/public/assets/rust-DdL9SqIa.js +1 -0
  75. package/dist/public/assets/sb-CcwsVR0C.js +1 -0
  76. package/dist/public/assets/scala-DHpiXF5c.js +1 -0
  77. package/dist/public/assets/scheme-BeGwcela.js +1 -0
  78. package/dist/public/assets/scss-gp-XZpBa.js +3 -0
  79. package/dist/public/assets/shell-CC2rA5mh.js +1 -0
  80. package/dist/public/assets/solidity-BEEn4gHE.js +1 -0
  81. package/dist/public/assets/sophia-CRfGWb83.js +1 -0
  82. package/dist/public/assets/sparql-D_Lu-MrJ.js +1 -0
  83. package/dist/public/assets/sql-NEE52Syq.js +1 -0
  84. package/dist/public/assets/st-DbInun42.js +1 -0
  85. package/dist/public/assets/swift-Bxkupp3x.js +1 -0
  86. package/dist/public/assets/systemverilog-Bz4Y3fRF.js +1 -0
  87. package/dist/public/assets/tcl-DISqw1ZD.js +1 -0
  88. package/dist/public/assets/tsMode-06H9OqyC.js +11 -0
  89. package/dist/public/assets/twig-De2hgUGE.js +1 -0
  90. package/dist/public/assets/typescript-DS7X1pib.js +1 -0
  91. package/dist/public/assets/typespec-B8J7ngcE.js +1 -0
  92. package/dist/public/assets/vb-DV3o63ZY.js +1 -0
  93. package/dist/public/assets/wgsl-DpFanUEy.js +298 -0
  94. package/dist/public/assets/workers-D4g7l69J.js +1 -0
  95. package/dist/public/assets/xml-Br0rHxWi.js +1 -0
  96. package/dist/public/assets/yaml-qASkMRyN.js +1 -0
  97. package/dist/public/index.html +2 -2
  98. package/dist/src/api/nodes.controller.d.ts +2 -2
  99. package/dist/src/api/nodes.controller.js +20 -8
  100. package/dist/src/api/nodes.controller.js.map +1 -1
  101. package/dist/src/cache/node-cache.service.js +23 -9
  102. package/dist/src/cache/node-cache.service.js.map +1 -1
  103. package/dist/src/debugger/debugger.service.d.ts +2 -0
  104. package/dist/src/debugger/debugger.service.js +2 -0
  105. package/dist/src/debugger/debugger.service.js.map +1 -1
  106. package/dist/src/domain/node-health.js +1 -1
  107. package/dist/src/domain/node-health.js.map +1 -1
  108. package/dist/src/domain/node.types.d.ts +2 -0
  109. package/dist/src/grpc/daml-lf-archive.d.ts +2 -0
  110. package/dist/src/grpc/daml-lf-archive.js +104 -0
  111. package/dist/src/grpc/daml-lf-archive.js.map +1 -0
  112. package/dist/src/grpc/grpc-operations.service.d.ts +1 -0
  113. package/dist/src/grpc/grpc-operations.service.js +10 -6
  114. package/dist/src/grpc/grpc-operations.service.js.map +1 -1
  115. package/dist/src/pqs/pqs-summary.service.d.ts +19 -1
  116. package/dist/src/pqs/pqs-summary.service.js +430 -61
  117. package/dist/src/pqs/pqs-summary.service.js.map +1 -1
  118. package/dist/tsconfig.build.tsbuildinfo +1 -1
  119. package/package.json +9 -6
  120. package/scripts/build-debug-dar.mjs +277 -0
  121. package/scripts/generate-daml-source-map.mjs +1512 -0
  122. package/scripts/prepare-debug-dars-from-workspace.mjs +181 -0
  123. package/dist/public/assets/DebuggerView-GIrRlNTJ.js +0 -2
  124. package/dist/public/assets/editor-C5uazxST.css +0 -1
  125. package/dist/public/assets/editor.api-8w-mShFJ.js +0 -820
  126. package/dist/public/assets/index-CdWdP2w6.js +0 -1
  127. package/dist/public/assets/index-fkZAWLbW.css +0 -1
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@distrohelena/canton-explorer",
3
- "version": "0.1.4",
3
+ "version": "0.1.6",
4
4
  "description": "Read-only operations explorer for Canton participant nodes and PQS-backed ledgers.",
5
5
  "author": "",
6
6
  "license": "Apache-2.0",
@@ -13,11 +13,14 @@
13
13
  },
14
14
  "files": [
15
15
  "bin",
16
- "config/nodes.example.json",
17
- "dist",
18
- ".env.example",
19
- "README.md"
20
- ],
16
+ "config/nodes.example.json",
17
+ "dist",
18
+ ".env.example",
19
+ "README.md",
20
+ "scripts/build-debug-dar.mjs",
21
+ "scripts/generate-daml-source-map.mjs",
22
+ "scripts/prepare-debug-dars-from-workspace.mjs"
23
+ ],
21
24
  "scripts": {
22
25
  "build": "nest build",
23
26
  "build:package": "node ./scripts/prepack.mjs",
@@ -0,0 +1,277 @@
1
+ import { cpSync, existsSync, mkdtempSync, mkdirSync, readFileSync, readdirSync, rmSync, statSync, writeFileSync } from 'node:fs';
2
+ import { tmpdir } from 'node:os';
3
+ import path from 'node:path';
4
+ import { execFileSync } from 'node:child_process';
5
+
6
+ function main() {
7
+ const options = parseArgs(process.argv.slice(2));
8
+
9
+ if (options.help) {
10
+ printHelp();
11
+ return;
12
+ }
13
+
14
+ validateOptions(options);
15
+
16
+ const tempRoot = mkdtempSync(path.join(tmpdir(), 'canton-debug-dar-'));
17
+ const unpackedDir = path.join(tempRoot, 'unpacked');
18
+ mkdirSync(unpackedDir, { recursive: true });
19
+
20
+ try {
21
+ unpackDar(options.inputDar, unpackedDir);
22
+
23
+ const debugDir = path.join(unpackedDir, 'debug');
24
+ mkdirSync(debugDir, { recursive: true });
25
+ const sourceMapTarget = path.join(debugDir, 'source-map.json');
26
+ writeFileSync(sourceMapTarget, JSON.stringify(loadJson(options.sourceMapPath), null, 2));
27
+
28
+ for (const sourceRoot of options.sourceRoots) {
29
+ copySourceRoot(unpackedDir, sourceRoot);
30
+ }
31
+
32
+ for (const sourceFile of options.sourceFiles) {
33
+ copySourceFile(unpackedDir, sourceFile);
34
+ }
35
+
36
+ packDar(unpackedDir, options.outputDar);
37
+ console.log(`Wrote debug DAR: ${options.outputDar}`);
38
+ } finally {
39
+ rmSync(tempRoot, { recursive: true, force: true });
40
+ }
41
+ }
42
+
43
+ function parseArgs(argv) {
44
+ const options = {
45
+ help: false,
46
+ overwrite: false,
47
+ inputDar: '',
48
+ outputDar: '',
49
+ sourceMapPath: '',
50
+ sourceRoots: [],
51
+ sourceFiles: [],
52
+ };
53
+
54
+ for (let index = 0; index < argv.length; index += 1) {
55
+ const argument = argv[index];
56
+
57
+ switch (argument) {
58
+ case '--help':
59
+ case '-h':
60
+ options.help = true;
61
+ break;
62
+ case '--overwrite':
63
+ options.overwrite = true;
64
+ break;
65
+ case '--input':
66
+ options.inputDar = requireValue(argv, ++index, '--input');
67
+ break;
68
+ case '--output':
69
+ options.outputDar = requireValue(argv, ++index, '--output');
70
+ break;
71
+ case '--source-map':
72
+ options.sourceMapPath = requireValue(argv, ++index, '--source-map');
73
+ break;
74
+ case '--source-root':
75
+ options.sourceRoots.push(parseMappedPath(requireValue(argv, ++index, '--source-root')));
76
+ break;
77
+ case '--source':
78
+ options.sourceFiles.push(parseMappedPath(requireValue(argv, ++index, '--source')));
79
+ break;
80
+ default:
81
+ throw new Error(`Unknown argument: ${argument}`);
82
+ }
83
+ }
84
+
85
+ if (!options.outputDar && options.inputDar) {
86
+ options.outputDar = defaultOutputPath(options.inputDar);
87
+ }
88
+
89
+ return options;
90
+ }
91
+
92
+ function validateOptions(options) {
93
+ if (!options.inputDar) {
94
+ throw new Error('--input is required');
95
+ }
96
+ if (!options.sourceMapPath) {
97
+ throw new Error('--source-map is required');
98
+ }
99
+ if (!existsSync(options.inputDar)) {
100
+ throw new Error(`Input DAR not found: ${options.inputDar}`);
101
+ }
102
+ if (!existsSync(options.sourceMapPath)) {
103
+ throw new Error(`Source map file not found: ${options.sourceMapPath}`);
104
+ }
105
+ if (existsSync(options.outputDar) && !options.overwrite) {
106
+ throw new Error(`Output DAR already exists: ${options.outputDar}. Use --overwrite to replace it.`);
107
+ }
108
+
109
+ for (const sourceRoot of options.sourceRoots) {
110
+ if (!existsSync(sourceRoot.localPath)) {
111
+ throw new Error(`Source root not found: ${sourceRoot.localPath}`);
112
+ }
113
+ if (!statSync(sourceRoot.localPath).isDirectory()) {
114
+ throw new Error(`Source root is not a directory: ${sourceRoot.localPath}`);
115
+ }
116
+ }
117
+
118
+ for (const sourceFile of options.sourceFiles) {
119
+ if (!existsSync(sourceFile.localPath)) {
120
+ throw new Error(`Source file not found: ${sourceFile.localPath}`);
121
+ }
122
+ if (!statSync(sourceFile.localPath).isFile()) {
123
+ throw new Error(`Source file is not a file: ${sourceFile.localPath}`);
124
+ }
125
+ }
126
+
127
+ loadJson(options.sourceMapPath);
128
+ }
129
+
130
+ function requireValue(argv, index, flagName) {
131
+ const value = argv[index];
132
+ if (!value) {
133
+ throw new Error(`${flagName} requires a value`);
134
+ }
135
+ return value;
136
+ }
137
+
138
+ function parseMappedPath(value) {
139
+ const separatorIndex = value.indexOf('=');
140
+ if (separatorIndex < 0) {
141
+ return {
142
+ localPath: path.resolve(value),
143
+ archivePrefix: '',
144
+ };
145
+ }
146
+
147
+ return {
148
+ localPath: path.resolve(value.slice(0, separatorIndex)),
149
+ archivePrefix: normalizeArchivePath(value.slice(separatorIndex + 1)),
150
+ };
151
+ }
152
+
153
+ function defaultOutputPath(inputDar) {
154
+ const extension = path.extname(inputDar);
155
+ const baseName = extension ? inputDar.slice(0, -extension.length) : inputDar;
156
+ return `${baseName}-debug${extension || '.dar'}`;
157
+ }
158
+
159
+ function loadJson(filePath) {
160
+ return JSON.parse(readFileSync(filePath, 'utf8'));
161
+ }
162
+
163
+ function unpackDar(inputDar, targetDir) {
164
+ execFileSync('python3', [
165
+ '-c',
166
+ `
167
+ import sys, zipfile
168
+ archive_path = sys.argv[1]
169
+ target_dir = sys.argv[2]
170
+ with zipfile.ZipFile(archive_path, "r") as archive:
171
+ archive.extractall(target_dir)
172
+ `,
173
+ inputDar,
174
+ targetDir,
175
+ ], {
176
+ stdio: 'inherit',
177
+ });
178
+ }
179
+
180
+ function packDar(sourceDir, outputDar) {
181
+ mkdirSync(path.dirname(path.resolve(outputDar)), { recursive: true });
182
+ execFileSync('python3', [
183
+ '-c',
184
+ `
185
+ import os, sys, zipfile
186
+ source_dir = sys.argv[1]
187
+ output_path = sys.argv[2]
188
+ with zipfile.ZipFile(output_path, "w", compression=zipfile.ZIP_DEFLATED) as archive:
189
+ for root, _, files in os.walk(source_dir):
190
+ for file_name in files:
191
+ absolute_path = os.path.join(root, file_name)
192
+ archive_path = os.path.relpath(absolute_path, source_dir)
193
+ archive.write(absolute_path, archive_path)
194
+ `,
195
+ sourceDir,
196
+ path.resolve(outputDar),
197
+ ], {
198
+ stdio: 'inherit',
199
+ });
200
+ }
201
+
202
+ function copySourceRoot(unpackedDir, sourceRoot) {
203
+ walkFiles(sourceRoot.localPath, (localFilePath) => {
204
+ if (!localFilePath.endsWith('.daml')) {
205
+ return;
206
+ }
207
+
208
+ const relativePath = path.relative(sourceRoot.localPath, localFilePath);
209
+ const archivePath = joinArchivePath(sourceRoot.archivePrefix, relativePath);
210
+ copyFileIntoArchive(unpackedDir, localFilePath, archivePath);
211
+ });
212
+ }
213
+
214
+ function copySourceFile(unpackedDir, sourceFile) {
215
+ const archivePath = sourceFile.archivePrefix
216
+ ? sourceFile.archivePrefix
217
+ : normalizeArchivePath(path.basename(sourceFile.localPath));
218
+ copyFileIntoArchive(unpackedDir, sourceFile.localPath, archivePath);
219
+ }
220
+
221
+ function walkFiles(rootDir, visitor) {
222
+ for (const entry of readdirSync(rootDir, { withFileTypes: true })) {
223
+ const absolutePath = path.join(rootDir, entry.name);
224
+ if (entry.isDirectory()) {
225
+ walkFiles(absolutePath, visitor);
226
+ continue;
227
+ }
228
+ if (entry.isFile()) {
229
+ visitor(absolutePath);
230
+ }
231
+ }
232
+ }
233
+
234
+ function copyFileIntoArchive(unpackedDir, localFilePath, archivePath) {
235
+ const normalizedArchivePath = normalizeArchivePath(archivePath);
236
+ const targetPath = path.join(unpackedDir, ...normalizedArchivePath.split('/'));
237
+ mkdirSync(path.dirname(targetPath), { recursive: true });
238
+ cpSync(localFilePath, targetPath);
239
+ }
240
+
241
+ function joinArchivePath(prefix, relativePath) {
242
+ const normalizedRelativePath = normalizeArchivePath(relativePath);
243
+ if (!prefix) {
244
+ return normalizedRelativePath;
245
+ }
246
+ return `${normalizeArchivePath(prefix)}/${normalizedRelativePath}`;
247
+ }
248
+
249
+ function normalizeArchivePath(value) {
250
+ return value
251
+ .replace(/\\/g, '/')
252
+ .replace(/^\.\/+/, '')
253
+ .replace(/^\/+/, '')
254
+ .replace(/\/+/g, '/');
255
+ }
256
+
257
+ function printHelp() {
258
+ console.log(`Usage:
259
+ node ./scripts/build-debug-dar.mjs \\
260
+ --input path/to/package.dar \\
261
+ --source-map path/to/source-map.json \\
262
+ [--output path/to/package-debug.dar] \\
263
+ [--source-root /path/to/project] \\
264
+ [--source-root /path/to/project=archive/prefix] \\
265
+ [--source /path/to/File.daml] \\
266
+ [--source /path/to/File.daml=src/File.daml] \\
267
+ [--overwrite]
268
+
269
+ Notes:
270
+ - The original DAR is unpacked and repacked without modifying its .dalf payloads.
271
+ - The script writes debug/source-map.json into the output DAR.
272
+ - --source-root copies every .daml file under the given directory.
273
+ - Use =archive/prefix to control where copied sources land inside the DAR.
274
+ - If --output is omitted, the script writes <input>-debug.dar beside the input DAR.`);
275
+ }
276
+
277
+ main();