@fragment-dev/cli 2026.3.24 → 2026.3.25-1
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 +3 -0
- package/dist/{chunk-BVLDXXBM.js → chunk-2AQAHBZD.js} +21 -6
- package/dist/{chunk-XDXL2YJK.js → chunk-D2ZXKL25.js} +8 -2
- package/dist/{chunk-EP2JQZA5.js → chunk-JHWQKNRZ.js} +1 -1
- package/dist/commands/gen-graphql.js +2 -2
- package/dist/commands.js +3 -3
- package/dist/graphql.js +1 -1
- package/dist/index.js +3 -3
- package/oclif.manifest.json +8 -1
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -240,11 +240,14 @@ Generate GraphQL queries from your Schema for your SDK.
|
|
|
240
240
|
```
|
|
241
241
|
USAGE
|
|
242
242
|
$ fragment gen-graphql -p <value> -o <value> [--output-file-per-query] [--include-standard-queries]
|
|
243
|
+
[--include-runtime-args]
|
|
243
244
|
|
|
244
245
|
FLAGS
|
|
245
246
|
-o, --output=<value> (required) The output path for the generated file(s). Must end with .graphql or .gql,
|
|
246
247
|
unless --output-file-per-query is set. If set, the output path must be a directory.
|
|
247
248
|
-p, --path=<value> (required) The path to the schema file.
|
|
249
|
+
--include-runtime-args Include tags, groups, and conditions (when not defined in the Schema) as arguments in
|
|
250
|
+
the generated GraphQL queries.
|
|
248
251
|
--include-standard-queries Include the set of standard queries in the output. This is required only if you are
|
|
249
252
|
not using the Fragment SDK.
|
|
250
253
|
--output-file-per-query Output each query in a separate file instead of a single file.
|
|
@@ -35,7 +35,8 @@ var getAccountParams = (accountPath, schema) => {
|
|
|
35
35
|
);
|
|
36
36
|
};
|
|
37
37
|
var schemaToEntryDefinitions = ({
|
|
38
|
-
schema
|
|
38
|
+
schema,
|
|
39
|
+
includeRuntimeArgs
|
|
39
40
|
}) => {
|
|
40
41
|
return schema.ledgerEntries.types.flatMap((ledgerEntry) => {
|
|
41
42
|
const entryOnlyParams = getSchemaObjectParameters({
|
|
@@ -59,10 +60,7 @@ var schemaToEntryDefinitions = ({
|
|
|
59
60
|
repeatedKeys.add(condition.repeated.key);
|
|
60
61
|
} else {
|
|
61
62
|
const condParams = getSchemaObjectParameters(condition);
|
|
62
|
-
const accountParams = getAccountParams(
|
|
63
|
-
condition.account.path,
|
|
64
|
-
schema
|
|
65
|
-
);
|
|
63
|
+
const accountParams = getAccountParams(condition.account.path, schema);
|
|
66
64
|
staticLineParams.push(...condParams, ...accountParams);
|
|
67
65
|
}
|
|
68
66
|
});
|
|
@@ -74,12 +72,15 @@ var schemaToEntryDefinitions = ({
|
|
|
74
72
|
(line) => !!line.tx
|
|
75
73
|
);
|
|
76
74
|
const isRuntimeEntry = (ledgerEntry.lines ?? []).length === 0;
|
|
75
|
+
const hasSchemaConditions = (ledgerEntry.conditions ?? []).length > 0;
|
|
77
76
|
const codegenInput = {
|
|
78
77
|
entryType: ledgerEntry.type,
|
|
79
78
|
typeVersion: ledgerEntry.typeVersion,
|
|
80
79
|
runtimeEntry: isRuntimeEntry,
|
|
81
80
|
parameters,
|
|
82
|
-
repeatedParameterKeys: repeatedParameterKeys.length > 0 ? repeatedParameterKeys : void 0
|
|
81
|
+
repeatedParameterKeys: repeatedParameterKeys.length > 0 ? repeatedParameterKeys : void 0,
|
|
82
|
+
includeRuntimeArgs: includeRuntimeArgs ?? false,
|
|
83
|
+
hasSchemaConditions
|
|
83
84
|
};
|
|
84
85
|
if (isRuntimeEntry) {
|
|
85
86
|
return [
|
|
@@ -213,6 +214,13 @@ var getPredefinedParameters = (definition) => {
|
|
|
213
214
|
params["tags"] = "[LedgerEntryTagInput!]";
|
|
214
215
|
params["groups"] = "[LedgerEntryGroupInput!]";
|
|
215
216
|
}
|
|
217
|
+
if (definition.includeRuntimeArgs && !definition.runtimeEntry) {
|
|
218
|
+
params["tags"] = "[LedgerEntryTagInput!]";
|
|
219
|
+
params["groups"] = "[LedgerEntryGroupInput!]";
|
|
220
|
+
if (!definition.hasSchemaConditions) {
|
|
221
|
+
params["conditions"] = "[LedgerEntryConditionInput!]";
|
|
222
|
+
}
|
|
223
|
+
}
|
|
216
224
|
params["ledgerIk"] = "SafeString!";
|
|
217
225
|
return params;
|
|
218
226
|
};
|
|
@@ -272,6 +280,13 @@ var entryDefinitionToMutation = (definition) => {
|
|
|
272
280
|
if (definition.runtimeEntry) {
|
|
273
281
|
command.push(`lines: $lines, tags: $tags, groups: $groups,`);
|
|
274
282
|
}
|
|
283
|
+
if (definition.includeRuntimeArgs && !definition.runtimeEntry) {
|
|
284
|
+
const runtimeArgs = ["tags: $tags", "groups: $groups"];
|
|
285
|
+
if (!definition.hasSchemaConditions) {
|
|
286
|
+
runtimeArgs.push("conditions: $conditions");
|
|
287
|
+
}
|
|
288
|
+
command.push(`${runtimeArgs.join(", ")},`);
|
|
289
|
+
}
|
|
275
290
|
const allParamKeys = [
|
|
276
291
|
...definition.parameters.filter((p) => !repeatedKeys.has(p)),
|
|
277
292
|
...definition.repeatedParameterKeys ?? []
|
|
@@ -3,7 +3,7 @@ import {
|
|
|
3
3
|
generateQueryFiles,
|
|
4
4
|
schemaToEntryDefinitions,
|
|
5
5
|
validateOutputName
|
|
6
|
-
} from "./chunk-
|
|
6
|
+
} from "./chunk-2AQAHBZD.js";
|
|
7
7
|
import {
|
|
8
8
|
Schema,
|
|
9
9
|
parseWithError
|
|
@@ -90,6 +90,11 @@ var GenGraphQL = class _GenGraphQL extends FragmentCommand {
|
|
|
90
90
|
required: false,
|
|
91
91
|
default: false,
|
|
92
92
|
description: "Include the set of standard queries in the output. This is required only if you are not using the Fragment SDK."
|
|
93
|
+
}),
|
|
94
|
+
"include-runtime-args": import_core.Flags.boolean({
|
|
95
|
+
required: false,
|
|
96
|
+
default: false,
|
|
97
|
+
description: "Include tags, groups, and conditions (when not defined in the Schema) as arguments in the generated GraphQL queries."
|
|
93
98
|
})
|
|
94
99
|
};
|
|
95
100
|
}
|
|
@@ -129,7 +134,8 @@ ${import_chalk.default.gray("Schema file:")} ${path}`);
|
|
|
129
134
|
}
|
|
130
135
|
try {
|
|
131
136
|
const entryDefinitions = schemaToEntryDefinitions({
|
|
132
|
-
schema: validatedSchema
|
|
137
|
+
schema: validatedSchema,
|
|
138
|
+
includeRuntimeArgs: flags["include-runtime-args"]
|
|
133
139
|
});
|
|
134
140
|
const generateQueryParams = {
|
|
135
141
|
definitions: entryDefinitions,
|
package/dist/commands.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import {
|
|
2
2
|
COMMANDS
|
|
3
|
-
} from "./chunk-
|
|
3
|
+
} from "./chunk-JHWQKNRZ.js";
|
|
4
4
|
import "./chunk-WPXGTOQF.js";
|
|
5
5
|
import "./chunk-B4BVB4BK.js";
|
|
6
6
|
import "./chunk-MOF7FUIJ.js";
|
|
@@ -28,8 +28,8 @@ import "./chunk-RBALPYPJ.js";
|
|
|
28
28
|
import "./chunk-LUHFWRCU.js";
|
|
29
29
|
import "./chunk-G2JISDKX.js";
|
|
30
30
|
import "./chunk-JSQLWL2J.js";
|
|
31
|
-
import "./chunk-
|
|
32
|
-
import "./chunk-
|
|
31
|
+
import "./chunk-D2ZXKL25.js";
|
|
32
|
+
import "./chunk-2AQAHBZD.js";
|
|
33
33
|
import "./chunk-ODU6I44Y.js";
|
|
34
34
|
import "./chunk-73ZTML2E.js";
|
|
35
35
|
import "./chunk-G6SIJABO.js";
|
package/dist/graphql.js
CHANGED
package/dist/index.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import {
|
|
2
2
|
COMMANDS
|
|
3
|
-
} from "./chunk-
|
|
3
|
+
} from "./chunk-JHWQKNRZ.js";
|
|
4
4
|
import "./chunk-WPXGTOQF.js";
|
|
5
5
|
import "./chunk-B4BVB4BK.js";
|
|
6
6
|
import "./chunk-MOF7FUIJ.js";
|
|
@@ -28,8 +28,8 @@ import "./chunk-RBALPYPJ.js";
|
|
|
28
28
|
import "./chunk-LUHFWRCU.js";
|
|
29
29
|
import "./chunk-G2JISDKX.js";
|
|
30
30
|
import "./chunk-JSQLWL2J.js";
|
|
31
|
-
import "./chunk-
|
|
32
|
-
import "./chunk-
|
|
31
|
+
import "./chunk-D2ZXKL25.js";
|
|
32
|
+
import "./chunk-2AQAHBZD.js";
|
|
33
33
|
import "./chunk-ODU6I44Y.js";
|
|
34
34
|
import "./chunk-73ZTML2E.js";
|
|
35
35
|
import "./chunk-G6SIJABO.js";
|
package/oclif.manifest.json
CHANGED
|
@@ -960,6 +960,13 @@
|
|
|
960
960
|
"required": false,
|
|
961
961
|
"allowNo": false,
|
|
962
962
|
"type": "boolean"
|
|
963
|
+
},
|
|
964
|
+
"include-runtime-args": {
|
|
965
|
+
"description": "Include tags, groups, and conditions (when not defined in the Schema) as arguments in the generated GraphQL queries.",
|
|
966
|
+
"name": "include-runtime-args",
|
|
967
|
+
"required": false,
|
|
968
|
+
"allowNo": false,
|
|
969
|
+
"type": "boolean"
|
|
963
970
|
}
|
|
964
971
|
},
|
|
965
972
|
"hasDynamicHelp": false,
|
|
@@ -973,5 +980,5 @@
|
|
|
973
980
|
"help": "Generate GraphQL queries from your Schema for your SDK."
|
|
974
981
|
}
|
|
975
982
|
},
|
|
976
|
-
"version": "2026.3.
|
|
983
|
+
"version": "2026.3.25-1"
|
|
977
984
|
}
|