@sortlist/cli 0.48.0 → 0.50.0
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 +5 -5
- package/dist/index.js +6 -5
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -137,11 +137,11 @@ Output is JSON when piped or with `--json`, and aligned key/value blocks in a te
|
|
|
137
137
|
|
|
138
138
|
Each operation supports:
|
|
139
139
|
|
|
140
|
-
| Flag | Description
|
|
141
|
-
| ------------------- |
|
|
142
|
-
| `--depth <n>` | Selection depth for nested fields (default: 0) |
|
|
143
|
-
| `--fields <a,b,c>` | Comma-separated fields to include |
|
|
144
|
-
| `--exclude <a,b,c>` | Comma-separated fields to exclude
|
|
140
|
+
| Flag | Description |
|
|
141
|
+
| ------------------- | ------------------------------------------------------------------------------ |
|
|
142
|
+
| `--depth <n>` | Selection depth for nested fields (default: 0); deprecated fields are left out |
|
|
143
|
+
| `--fields <a,b,c>` | Comma-separated fields to include, deprecated ones too when named |
|
|
144
|
+
| `--exclude <a,b,c>` | Comma-separated fields to exclude |
|
|
145
145
|
|
|
146
146
|
## Schema management
|
|
147
147
|
|
package/dist/index.js
CHANGED
|
@@ -1102,8 +1102,7 @@ function buildSelections(type, schema, depth, exclude, prefix, totalCount, visit
|
|
|
1102
1102
|
if (isPayload && PAYLOAD_PLUMBING.has(name)) continue;
|
|
1103
1103
|
const fullPath = `${prefix}${name}`;
|
|
1104
1104
|
if (exclude.has(fullPath) || exclude.has(name)) continue;
|
|
1105
|
-
|
|
1106
|
-
if (hasRequiredArgs) continue;
|
|
1105
|
+
if (!isAutoSelectable(field)) continue;
|
|
1107
1106
|
const namedType = unwrap(field.type);
|
|
1108
1107
|
if (isLeaf(namedType)) {
|
|
1109
1108
|
lines.push(name);
|
|
@@ -1161,10 +1160,12 @@ function isConnection(type) {
|
|
|
1161
1160
|
const fields = type.getFields();
|
|
1162
1161
|
return type.name.endsWith("Connection") && Boolean(fields.nodes) && Boolean(fields.pageInfo);
|
|
1163
1162
|
}
|
|
1163
|
+
function isAutoSelectable(field) {
|
|
1164
|
+
if (field.name.startsWith("__") || field.deprecationReason != null) return false;
|
|
1165
|
+
return !field.args.some((a) => isNonNullType(a.type) && a.defaultValue === void 0);
|
|
1166
|
+
}
|
|
1164
1167
|
function selectableFields(type) {
|
|
1165
|
-
return Object.values(type.getFields()).filter(
|
|
1166
|
-
(field) => !field.name.startsWith("__") && !field.args.some((a) => isNonNullType(a.type) && a.defaultValue === void 0)
|
|
1167
|
-
);
|
|
1168
|
+
return Object.values(type.getFields()).filter(isAutoSelectable);
|
|
1168
1169
|
}
|
|
1169
1170
|
function edgeExtras(connection) {
|
|
1170
1171
|
const edgesField = connection.getFields().edges;
|