@fragment-dev/cli 2026.10.1-5 → 2026.10.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.
- package/README.md +16 -4
- package/dist/{chunk-T7PAZDQ2.js → chunk-23KWDUJZ.js} +7 -1
- package/dist/{chunk-JMFDKBJW.js → chunk-2LDAYJQR.js} +2 -2
- package/dist/{chunk-Q62TGFNL.js → chunk-2QR6NGWG.js} +1 -1
- package/dist/{chunk-LINOTI5E.js → chunk-3IA6BI6A.js} +1 -1
- package/dist/{chunk-GZF5GHBV.js → chunk-3IGRQ6LL.js} +3 -3
- package/dist/{chunk-MUN6P2HN.js → chunk-3K6ERQYV.js} +1 -1
- package/dist/{chunk-D65TXRLZ.js → chunk-5NKCOZCW.js} +2 -2
- package/dist/{chunk-VZA2YKI6.js → chunk-5UOYY7GS.js} +2 -2
- package/dist/{chunk-F6IDBMXZ.js → chunk-6PRTPBP7.js} +1 -1
- package/dist/{chunk-XUOVQRQH.js → chunk-D45KVQKB.js} +1 -1
- package/dist/{chunk-7LEHQFLL.js → chunk-DT372IG6.js} +1 -1
- package/dist/{chunk-I7HWZUNL.js → chunk-DYIB3NZM.js} +59 -12
- package/dist/{chunk-3QIKHVTA.js → chunk-E7ZKZZP4.js} +2 -2
- package/dist/{chunk-C67WHN2H.js → chunk-F4DGB2QI.js} +2 -2
- package/dist/{chunk-TXPR56T5.js → chunk-H3ZCVAW3.js} +1 -1
- package/dist/{chunk-B3OMOGVU.js → chunk-HK327LQP.js} +3 -3
- package/dist/{chunk-JV34IPXX.js → chunk-IQIFAKDJ.js} +3 -3
- package/dist/{chunk-BMPSZNHE.js → chunk-JO6OQM5C.js} +1 -1
- package/dist/{chunk-DURV4GOT.js → chunk-KVBNKJBH.js} +2 -2
- package/dist/{chunk-5VGUS75G.js → chunk-LDS5IWT5.js} +6 -6
- package/dist/{chunk-SWVXV42Y.js → chunk-M7BM6YC2.js} +1 -1
- package/dist/{chunk-5JTGKU4S.js → chunk-NJSYUXAC.js} +2 -2
- package/dist/chunk-NT74GT6W.js +1287 -0
- package/dist/{chunk-WUKDB7IX.js → chunk-PHWV3NOP.js} +162 -51
- package/dist/{chunk-KP7MQPVO.js → chunk-Q3JFAZ3A.js} +1 -1
- package/dist/{chunk-WCXDVPWC.js → chunk-Q6ZKCAYH.js} +2 -2
- package/dist/{chunk-EIF4FTEI.js → chunk-QBQANVTD.js} +2 -2
- package/dist/{chunk-E4TL7SOK.js → chunk-QGFJ5H4G.js} +2 -2
- package/dist/{chunk-PU52GTGB.js → chunk-QZNZYG2G.js} +24 -14
- package/dist/{chunk-76JJLPFT.js → chunk-RML6NQHP.js} +1 -1
- package/dist/{chunk-4IMXVHLX.js → chunk-SU5G5HM2.js} +2 -2
- package/dist/{chunk-2DFNUYYB.js → chunk-THGEB6PT.js} +3 -3
- package/dist/{chunk-I65PNYBQ.js → chunk-UJP55YSW.js} +25 -25
- package/dist/{chunk-JXIMFTTA.js → chunk-V3NABYUX.js} +2 -2
- package/dist/{chunk-MOBC7AAW.js → chunk-V4IQY3DF.js} +1 -1
- package/dist/{chunk-DVQMZBTY.js → chunk-WRUBCN4G.js} +2 -2
- package/dist/{chunk-DKAEBT2M.js → chunk-XJ2TNWI7.js} +8 -0
- package/dist/commands/add-ledger-entry.js +4 -4
- package/dist/commands/api-client/create.js +3 -3
- package/dist/commands/create-custom-link.js +4 -4
- package/dist/commands/create-ledger.js +4 -4
- package/dist/commands/delete-custom-txs.js +4 -4
- package/dist/commands/delete-ledger.js +4 -4
- package/dist/commands/delete-schema.js +4 -4
- package/dist/commands/gen-graphql.js +8 -8
- package/dist/commands/get-schema.js +5 -5
- package/dist/commands/init.js +3 -3
- package/dist/commands/login.js +4 -4
- package/dist/commands/migrate-ledger-entry.js +4 -4
- package/dist/commands/query/ledgerAccounts.js +4 -4
- package/dist/commands/query/ledgers.js +4 -4
- package/dist/commands/query/schema.js +4 -4
- package/dist/commands/query/schemas.js +4 -4
- package/dist/commands/reverse-ledger-entry.js +4 -4
- package/dist/commands/start.js +3 -3
- package/dist/commands/store-schema.js +4 -4
- package/dist/commands/token.js +4 -4
- package/dist/commands/update-ledger-account.js +4 -4
- package/dist/commands/update.js +4 -4
- package/dist/commands/verify-schema.js +9 -8
- package/dist/commands/version.js +3 -3
- package/dist/commands/workspace.js +4 -4
- package/dist/commands.js +37 -36
- package/dist/graphql.js +3 -3
- package/dist/index.js +37 -36
- package/dist/lib/authenticatedCommand.js +3 -3
- package/dist/lib/baseCommand.js +2 -2
- package/dist/utils/formatValidationErrors.js +2 -2
- package/dist/utils/schemaBackCompat.js +21 -0
- package/dist/utils/schemaValidation.js +5 -5
- package/dist/utils.js +5 -3
- package/oclif.manifest.json +18 -2
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -646,12 +646,14 @@ Verify that a schema file follows the Fragment JSON schema format
|
|
|
646
646
|
|
|
647
647
|
```
|
|
648
648
|
USAGE
|
|
649
|
-
$ fragment verify-schema [-p <value>] [-v] [-j]
|
|
649
|
+
$ fragment verify-schema [-p <value>] [-v] [-j] [-a <value>]
|
|
650
650
|
|
|
651
651
|
FLAGS
|
|
652
|
-
-
|
|
653
|
-
|
|
654
|
-
-
|
|
652
|
+
-a, --against=<value> Path to a previous version of the schema to check backwards compatibility against (e.g. the
|
|
653
|
+
output of `fragment get-schema`)
|
|
654
|
+
-j, --json Output validation results as JSON for programmatic use
|
|
655
|
+
-p, --path=<value> [default: fragment/fragment.json] Path to schema file (e.g. my-schema.jsonc)
|
|
656
|
+
-v, --verbose Show detailed validation output
|
|
655
657
|
|
|
656
658
|
DESCRIPTION
|
|
657
659
|
Verify that a schema file follows the Fragment JSON schema format
|
|
@@ -664,6 +666,16 @@ EXAMPLES
|
|
|
664
666
|
$ fragment verify-schema -p fragment/fragment.json --verbose
|
|
665
667
|
|
|
666
668
|
$ fragment verify-schema --path ./my-schema.jsonc --json
|
|
669
|
+
|
|
670
|
+
Check that the schema is backwards-compatible with the deployed schema.
|
|
671
|
+
|
|
672
|
+
$ fragment get-schema --key my-schema --output deployed-schema.jsonc && fragment verify-schema --path \
|
|
673
|
+
my-schema.jsonc --against deployed-schema.jsonc
|
|
674
|
+
|
|
675
|
+
Check that the schema is backwards-compatible with its copy on the main branch.
|
|
676
|
+
|
|
677
|
+
$ git show origin/main:my-schema.jsonc > base-schema.jsonc && fragment verify-schema --path my-schema.jsonc \
|
|
678
|
+
--against base-schema.jsonc
|
|
667
679
|
```
|
|
668
680
|
|
|
669
681
|
## `fragment version`
|
|
@@ -9,7 +9,7 @@ import {
|
|
|
9
9
|
codes,
|
|
10
10
|
getStringParametersInternal,
|
|
11
11
|
z
|
|
12
|
-
} from "./chunk-
|
|
12
|
+
} from "./chunk-XJ2TNWI7.js";
|
|
13
13
|
import {
|
|
14
14
|
init_cjs_shims
|
|
15
15
|
} from "./chunk-7GH3YGSC.js";
|
|
@@ -400,6 +400,11 @@ var BaseSchema = z.object({
|
|
|
400
400
|
})
|
|
401
401
|
)
|
|
402
402
|
});
|
|
403
|
+
var VALID_LEDGER_ACCOUNT_STATUS_TRANSITIONS = {
|
|
404
|
+
active: ["disabled"],
|
|
405
|
+
disabled: ["archived", "active"],
|
|
406
|
+
archived: ["active"]
|
|
407
|
+
};
|
|
403
408
|
|
|
404
409
|
export {
|
|
405
410
|
fillParams,
|
|
@@ -421,6 +426,7 @@ export {
|
|
|
421
426
|
SYSTEM_PARAMETER_NAMES,
|
|
422
427
|
SchemaPaymentTypeStatusSchema,
|
|
423
428
|
SchemaEntryGroup,
|
|
429
|
+
VALID_LEDGER_ACCOUNT_STATUS_TRANSITIONS,
|
|
424
430
|
getStructuralPath,
|
|
425
431
|
getInstanceValueByAccountPath,
|
|
426
432
|
getSubpaths,
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
import {
|
|
2
2
|
inquirer_default
|
|
3
|
-
} from "./chunk-
|
|
3
|
+
} from "./chunk-6PRTPBP7.js";
|
|
4
4
|
import {
|
|
5
5
|
AuthenticatedCommand
|
|
6
|
-
} from "./chunk-
|
|
6
|
+
} from "./chunk-SU5G5HM2.js";
|
|
7
7
|
import {
|
|
8
8
|
require_lib
|
|
9
|
-
} from "./chunk-
|
|
9
|
+
} from "./chunk-3IA6BI6A.js";
|
|
10
10
|
import {
|
|
11
11
|
require_source
|
|
12
12
|
} from "./chunk-QDAKBUNO.js";
|
|
@@ -1,25 +1,29 @@
|
|
|
1
|
+
import {
|
|
2
|
+
BackCompatCheckError,
|
|
3
|
+
verifySchemaAgainstFile
|
|
4
|
+
} from "./chunk-NT74GT6W.js";
|
|
1
5
|
import {
|
|
2
6
|
extractSchemaMetadata,
|
|
3
7
|
isJsonParseError,
|
|
4
8
|
validateSchemaStructure
|
|
5
|
-
} from "./chunk-
|
|
9
|
+
} from "./chunk-IQIFAKDJ.js";
|
|
6
10
|
import {
|
|
7
11
|
DEFAULT_SCHEMA_PATH
|
|
8
12
|
} from "./chunk-A4BSWX5D.js";
|
|
9
13
|
import {
|
|
10
14
|
logValidationErrors
|
|
11
|
-
} from "./chunk-
|
|
15
|
+
} from "./chunk-V4IQY3DF.js";
|
|
12
16
|
import {
|
|
13
17
|
FragmentCommand,
|
|
14
18
|
require_lib
|
|
15
|
-
} from "./chunk-
|
|
19
|
+
} from "./chunk-3IA6BI6A.js";
|
|
16
20
|
import {
|
|
17
21
|
colorizeJson,
|
|
18
22
|
emphasize,
|
|
19
23
|
getParsedSchema,
|
|
20
24
|
getParsedSchemaString,
|
|
21
25
|
parseJSON
|
|
22
|
-
} from "./chunk-
|
|
26
|
+
} from "./chunk-QZNZYG2G.js";
|
|
23
27
|
import {
|
|
24
28
|
require_source
|
|
25
29
|
} from "./chunk-QDAKBUNO.js";
|
|
@@ -32,6 +36,12 @@ import {
|
|
|
32
36
|
init_cjs_shims();
|
|
33
37
|
var import_core = __toESM(require_lib(), 1);
|
|
34
38
|
var import_chalk = __toESM(require_source(), 1);
|
|
39
|
+
var getErrorType = (error) => {
|
|
40
|
+
if (error instanceof BackCompatCheckError) {
|
|
41
|
+
return error.jsonType;
|
|
42
|
+
}
|
|
43
|
+
return isJsonParseError(error) ? "parse_error" : "validation_error";
|
|
44
|
+
};
|
|
35
45
|
var VerifySchema = class _VerifySchema extends FragmentCommand {
|
|
36
46
|
static {
|
|
37
47
|
this.description = "Verify that a schema file follows the Fragment JSON schema format";
|
|
@@ -41,7 +51,15 @@ var VerifySchema = class _VerifySchema extends FragmentCommand {
|
|
|
41
51
|
"<%= config.bin %> <%= command.id %>",
|
|
42
52
|
"<%= config.bin %> <%= command.id %> --path ./my-schema.jsonc",
|
|
43
53
|
"<%= config.bin %> <%= command.id %> -p fragment/fragment.json --verbose",
|
|
44
|
-
"<%= config.bin %> <%= command.id %> --path ./my-schema.jsonc --json"
|
|
54
|
+
"<%= config.bin %> <%= command.id %> --path ./my-schema.jsonc --json",
|
|
55
|
+
{
|
|
56
|
+
description: "Check that the schema is backwards-compatible with the deployed schema.",
|
|
57
|
+
command: "fragment get-schema --key my-schema --output deployed-schema.jsonc && <%= config.bin %> <%= command.id %> --path my-schema.jsonc --against deployed-schema.jsonc"
|
|
58
|
+
},
|
|
59
|
+
{
|
|
60
|
+
description: "Check that the schema is backwards-compatible with its copy on the main branch.",
|
|
61
|
+
command: "$ git show origin/main:my-schema.jsonc > base-schema.jsonc && <%= config.bin %> <%= command.id %> --path my-schema.jsonc --against base-schema.jsonc"
|
|
62
|
+
}
|
|
45
63
|
];
|
|
46
64
|
}
|
|
47
65
|
static {
|
|
@@ -60,11 +78,16 @@ var VerifySchema = class _VerifySchema extends FragmentCommand {
|
|
|
60
78
|
char: "j",
|
|
61
79
|
description: "Output validation results as JSON for programmatic use",
|
|
62
80
|
default: false
|
|
81
|
+
}),
|
|
82
|
+
against: import_core.Flags.string({
|
|
83
|
+
char: "a",
|
|
84
|
+
description: "Path to a previous version of the schema to check backwards compatibility against (e.g. the output of `fragment get-schema`)"
|
|
63
85
|
})
|
|
64
86
|
};
|
|
65
87
|
}
|
|
66
88
|
async run() {
|
|
67
89
|
const { flags } = await this.parse(_VerifySchema);
|
|
90
|
+
const against = flags.against ? { path: flags.against } : null;
|
|
68
91
|
try {
|
|
69
92
|
let schema;
|
|
70
93
|
if (flags.json) {
|
|
@@ -91,18 +114,26 @@ var VerifySchema = class _VerifySchema extends FragmentCommand {
|
|
|
91
114
|
});
|
|
92
115
|
}
|
|
93
116
|
this.validateSchema(schema);
|
|
117
|
+
if (against) {
|
|
118
|
+
verifySchemaAgainstFile({
|
|
119
|
+
command: this,
|
|
120
|
+
schema,
|
|
121
|
+
againstPath: against.path,
|
|
122
|
+
requireEnvVariables: !flags.json
|
|
123
|
+
});
|
|
124
|
+
}
|
|
94
125
|
if (flags.json) {
|
|
95
|
-
this.outputJsonResult(schema, flags.path, true);
|
|
126
|
+
this.outputJsonResult(schema, flags.path, true, void 0, against);
|
|
96
127
|
} else {
|
|
97
128
|
if (flags.verbose) {
|
|
98
129
|
this.displayParsedSchema(schema);
|
|
99
130
|
this.displayValidationDetails(schema);
|
|
100
131
|
}
|
|
101
|
-
this.displaySuccessMessage(schema, flags.verbose);
|
|
132
|
+
this.displaySuccessMessage(schema, flags.verbose, against);
|
|
102
133
|
}
|
|
103
134
|
} catch (error) {
|
|
104
135
|
if (flags.json) {
|
|
105
|
-
this.outputJsonResult(null, flags.path, false, error);
|
|
136
|
+
this.outputJsonResult(null, flags.path, false, error, against);
|
|
106
137
|
} else {
|
|
107
138
|
this.handleValidationError(error, flags.path);
|
|
108
139
|
}
|
|
@@ -126,12 +157,17 @@ var VerifySchema = class _VerifySchema extends FragmentCommand {
|
|
|
126
157
|
` Ledger entry types: ${emphasize(metadata.entryTypeCount.toString())}`
|
|
127
158
|
);
|
|
128
159
|
}
|
|
129
|
-
displaySuccessMessage(schema, verbose) {
|
|
160
|
+
displaySuccessMessage(schema, verbose, against) {
|
|
130
161
|
this.log(`
|
|
131
162
|
${import_chalk.default.green("\u2705 Schema validation successful!")}`);
|
|
132
163
|
this.log(
|
|
133
164
|
`Schema "${schema.key}" is valid and follows the Fragment JSON schema format.`
|
|
134
165
|
);
|
|
166
|
+
if (against) {
|
|
167
|
+
this.log(
|
|
168
|
+
`Schema is backwards-compatible with ${emphasize(against.path)}.`
|
|
169
|
+
);
|
|
170
|
+
}
|
|
135
171
|
if (!verbose) {
|
|
136
172
|
this.log(
|
|
137
173
|
`
|
|
@@ -141,7 +177,7 @@ Run with ${emphasize(
|
|
|
141
177
|
);
|
|
142
178
|
}
|
|
143
179
|
}
|
|
144
|
-
outputJsonResult(schema, schemaPath, success, error) {
|
|
180
|
+
outputJsonResult(schema, schemaPath, success, error, against) {
|
|
145
181
|
const result = {
|
|
146
182
|
success,
|
|
147
183
|
schemaPath,
|
|
@@ -156,10 +192,13 @@ Run with ${emphasize(
|
|
|
156
192
|
entryTypeCount: metadata.entryTypeCount
|
|
157
193
|
};
|
|
158
194
|
}
|
|
195
|
+
if (against) {
|
|
196
|
+
result.against = against;
|
|
197
|
+
}
|
|
159
198
|
if (!success && error) {
|
|
160
199
|
result.error = {
|
|
161
200
|
message: error.message || "Unknown validation error",
|
|
162
|
-
type:
|
|
201
|
+
type: getErrorType(error)
|
|
163
202
|
};
|
|
164
203
|
if (error.validationErrors) {
|
|
165
204
|
result.error.validationErrors = error.validationErrors;
|
|
@@ -171,7 +210,15 @@ Run with ${emphasize(
|
|
|
171
210
|
}
|
|
172
211
|
}
|
|
173
212
|
handleValidationError(error, schemaPath) {
|
|
174
|
-
if (
|
|
213
|
+
if (error instanceof BackCompatCheckError) {
|
|
214
|
+
this.logToStderr(
|
|
215
|
+
`
|
|
216
|
+
${import_chalk.default.red("\u274C Schema backwards-compatibility check failed!")}`
|
|
217
|
+
);
|
|
218
|
+
this.logToStderr(error.message);
|
|
219
|
+
this.logToStderr(`
|
|
220
|
+
${import_chalk.default.gray("Schema file:")} ${schemaPath}`);
|
|
221
|
+
} else if (!isJsonParseError(error)) {
|
|
175
222
|
this.logToStderr(`
|
|
176
223
|
${import_chalk.default.red("\u274C Schema validation failed!")}`);
|
|
177
224
|
if (error.validationErrors) {
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import {
|
|
2
2
|
inquirer_default
|
|
3
|
-
} from "./chunk-
|
|
3
|
+
} from "./chunk-6PRTPBP7.js";
|
|
4
4
|
import {
|
|
5
5
|
FragmentCommand,
|
|
6
6
|
require_lib
|
|
7
|
-
} from "./chunk-
|
|
7
|
+
} from "./chunk-3IA6BI6A.js";
|
|
8
8
|
import {
|
|
9
9
|
require_source
|
|
10
10
|
} from "./chunk-QDAKBUNO.js";
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
import {
|
|
2
2
|
AuthenticatedCommand
|
|
3
|
-
} from "./chunk-
|
|
3
|
+
} from "./chunk-SU5G5HM2.js";
|
|
4
4
|
import {
|
|
5
5
|
require_lib
|
|
6
|
-
} from "./chunk-
|
|
6
|
+
} from "./chunk-3IA6BI6A.js";
|
|
7
7
|
import {
|
|
8
8
|
getParsedSchema
|
|
9
|
-
} from "./chunk-
|
|
9
|
+
} from "./chunk-QZNZYG2G.js";
|
|
10
10
|
import {
|
|
11
11
|
__toESM,
|
|
12
12
|
init_cjs_shims
|
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
import {
|
|
2
2
|
Schema,
|
|
3
3
|
parseWithError
|
|
4
|
-
} from "./chunk-
|
|
4
|
+
} from "./chunk-PHWV3NOP.js";
|
|
5
5
|
import {
|
|
6
6
|
formatValidationErrors
|
|
7
|
-
} from "./chunk-
|
|
7
|
+
} from "./chunk-V4IQY3DF.js";
|
|
8
8
|
import {
|
|
9
9
|
BadRequestError
|
|
10
|
-
} from "./chunk-
|
|
10
|
+
} from "./chunk-XJ2TNWI7.js";
|
|
11
11
|
import {
|
|
12
12
|
init_cjs_shims
|
|
13
13
|
} from "./chunk-7GH3YGSC.js";
|
|
@@ -4,25 +4,25 @@ import {
|
|
|
4
4
|
schemaToEntryDefinitions,
|
|
5
5
|
schemaToPaymentDefinitions,
|
|
6
6
|
validateOutputName
|
|
7
|
-
} from "./chunk-
|
|
7
|
+
} from "./chunk-H3ZCVAW3.js";
|
|
8
8
|
import {
|
|
9
9
|
Schema,
|
|
10
10
|
parseWithError
|
|
11
|
-
} from "./chunk-
|
|
11
|
+
} from "./chunk-PHWV3NOP.js";
|
|
12
12
|
import {
|
|
13
13
|
formatValidationErrors,
|
|
14
14
|
logValidationErrors
|
|
15
|
-
} from "./chunk-
|
|
15
|
+
} from "./chunk-V4IQY3DF.js";
|
|
16
16
|
import {
|
|
17
17
|
BadRequestError
|
|
18
|
-
} from "./chunk-
|
|
18
|
+
} from "./chunk-XJ2TNWI7.js";
|
|
19
19
|
import {
|
|
20
20
|
FragmentCommand,
|
|
21
21
|
require_lib
|
|
22
|
-
} from "./chunk-
|
|
22
|
+
} from "./chunk-3IA6BI6A.js";
|
|
23
23
|
import {
|
|
24
24
|
getParsedSchema
|
|
25
|
-
} from "./chunk-
|
|
25
|
+
} from "./chunk-QZNZYG2G.js";
|
|
26
26
|
import {
|
|
27
27
|
require_source
|
|
28
28
|
} from "./chunk-QDAKBUNO.js";
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import {
|
|
2
2
|
inquirer_default
|
|
3
|
-
} from "./chunk-
|
|
3
|
+
} from "./chunk-6PRTPBP7.js";
|
|
4
4
|
import {
|
|
5
5
|
defaultBrowserAuthDeps,
|
|
6
6
|
provisionApiClient
|
|
@@ -8,7 +8,7 @@ import {
|
|
|
8
8
|
import {
|
|
9
9
|
FragmentCommand,
|
|
10
10
|
require_lib
|
|
11
|
-
} from "./chunk-
|
|
11
|
+
} from "./chunk-3IA6BI6A.js";
|
|
12
12
|
import {
|
|
13
13
|
require_source
|
|
14
14
|
} from "./chunk-QDAKBUNO.js";
|