@crediolabs/policy-builder-cli 0.1.2 → 0.1.4
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.
|
@@ -27,7 +27,15 @@ export async function runSynthesizeCommand(argv, flags) {
|
|
|
27
27
|
return formatToolResponse(res, flags, 'synthesize(mandate)');
|
|
28
28
|
}
|
|
29
29
|
// hasRecorded
|
|
30
|
-
const
|
|
30
|
+
const recordedFile = readJsonFile(pairs['recorded-tx']);
|
|
31
|
+
// Accept either a bare RecordedTransaction or the `{ ok, data }` artifact that
|
|
32
|
+
// `record --out` writes (same shape as `--json`), so `record --out X` followed
|
|
33
|
+
// by `synthesize --recorded-tx X` works end to end.
|
|
34
|
+
const recordedTx = recordedFile?.ok === true &&
|
|
35
|
+
typeof recordedFile.data === 'object' &&
|
|
36
|
+
recordedFile.data !== null
|
|
37
|
+
? recordedFile.data
|
|
38
|
+
: recordedFile;
|
|
31
39
|
const network = pairs.network;
|
|
32
40
|
if (!network) {
|
|
33
41
|
throw new CliError({
|
package/package.json
CHANGED
|
@@ -35,7 +35,16 @@ export async function runSynthesizeCommand(
|
|
|
35
35
|
}
|
|
36
36
|
|
|
37
37
|
// hasRecorded
|
|
38
|
-
const
|
|
38
|
+
const recordedFile = readJsonFile(pairs['recorded-tx'] as string) as Record<string, unknown>
|
|
39
|
+
// Accept either a bare RecordedTransaction or the `{ ok, data }` artifact that
|
|
40
|
+
// `record --out` writes (same shape as `--json`), so `record --out X` followed
|
|
41
|
+
// by `synthesize --recorded-tx X` works end to end.
|
|
42
|
+
const recordedTx =
|
|
43
|
+
recordedFile?.ok === true &&
|
|
44
|
+
typeof recordedFile.data === 'object' &&
|
|
45
|
+
recordedFile.data !== null
|
|
46
|
+
? (recordedFile.data as Record<string, unknown>)
|
|
47
|
+
: recordedFile
|
|
39
48
|
const network = pairs.network
|
|
40
49
|
if (!network) {
|
|
41
50
|
throw new CliError({
|