@jackchuka/sdl-decompose 1.0.2 → 1.1.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 +26 -3
- package/bin/cli.js +11 -11
- package/dist/cli.js +5 -1
- package/dist/cli.js.map +1 -1
- package/dist/index.d.ts +2 -2
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +120 -20
- package/dist/index.js.map +1 -1
- package/dist/types.d.ts +2 -0
- package/dist/types.d.ts.map +1 -1
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -12,6 +12,7 @@ A powerful tool to decompose GraphQL SDL (Schema Definition Language) by operati
|
|
|
12
12
|
- 🔄 **All operation types**: Support for queries, mutations, and subscriptions
|
|
13
13
|
- 📝 **TypeScript support**: Full TypeScript definitions included
|
|
14
14
|
- 🛠️ **CLI and programmatic API**: Use from command line or integrate into your code
|
|
15
|
+
- 🚫 **Deprecated field filtering**: Exclude deprecated fields by default
|
|
15
16
|
- ⚡ **Fast and lightweight**: Minimal dependencies, built on top of `graphql-js`
|
|
16
17
|
|
|
17
18
|
## Installation
|
|
@@ -54,6 +55,8 @@ Options:
|
|
|
54
55
|
-t, --type <type> Operation type: query, mutation, subscription (default: "query")
|
|
55
56
|
--output <file> Output file path (optional, prints to stdout if not provided)
|
|
56
57
|
--include-builtins Include builtin scalar types in output (default: false)
|
|
58
|
+
--exclude-comments Remove comments and descriptions from output SDL (default: false)
|
|
59
|
+
--include-deprecated Include deprecated fields in output (default: false)
|
|
57
60
|
-h, --help display help for command
|
|
58
61
|
```
|
|
59
62
|
|
|
@@ -115,7 +118,21 @@ type Post {
|
|
|
115
118
|
npx @jackchuka/sdl-decompose --sdl schema.graphql --operation createUser --type mutation --output create-user.graphql
|
|
116
119
|
```
|
|
117
120
|
|
|
118
|
-
#### Example 3:
|
|
121
|
+
#### Example 3: Remove Comments from Output
|
|
122
|
+
|
|
123
|
+
```bash
|
|
124
|
+
# Clean output without comments or descriptions
|
|
125
|
+
npx @jackchuka/sdl-decompose --sdl schema.graphql --operation getUser --exclude-comments
|
|
126
|
+
```
|
|
127
|
+
|
|
128
|
+
#### Example 4: Include Deprecated Fields
|
|
129
|
+
|
|
130
|
+
```bash
|
|
131
|
+
# Include deprecated fields in output (excluded by default)
|
|
132
|
+
npx @jackchuka/sdl-decompose --sdl schema.graphql --operation getUser --include-deprecated
|
|
133
|
+
```
|
|
134
|
+
|
|
135
|
+
#### Example 5: Using with Pipes
|
|
119
136
|
|
|
120
137
|
```bash
|
|
121
138
|
# Download schema and decompose in one command
|
|
@@ -160,7 +177,9 @@ const fullSDL = `
|
|
|
160
177
|
`;
|
|
161
178
|
|
|
162
179
|
const result = decomposeGraphQL(fullSDL, 'getUser', 'query', {
|
|
163
|
-
includeBuiltinScalars: false
|
|
180
|
+
includeBuiltinScalars: false,
|
|
181
|
+
excludeComments: true,
|
|
182
|
+
includeDeprecated: false
|
|
164
183
|
});
|
|
165
184
|
|
|
166
185
|
console.log(result.sdl);
|
|
@@ -180,6 +199,8 @@ console.log('Operation found:', result.operationFound);
|
|
|
180
199
|
|
|
181
200
|
**Options:**
|
|
182
201
|
- `includeBuiltinScalars` (boolean): Include built-in scalar types (String, Int, Float, Boolean, ID) in the output. Defaults to `false`
|
|
202
|
+
- `excludeComments` (boolean): Remove comments and descriptions from the output SDL. Defaults to `false`
|
|
203
|
+
- `includeDeprecated` (boolean): Include deprecated fields in the output SDL. Defaults to `false`
|
|
183
204
|
|
|
184
205
|
**Returns:**
|
|
185
206
|
```typescript
|
|
@@ -195,6 +216,8 @@ interface DecomposeResult {
|
|
|
195
216
|
```typescript
|
|
196
217
|
interface DecomposeOptions {
|
|
197
218
|
includeBuiltinScalars?: boolean;
|
|
219
|
+
excludeComments?: boolean;
|
|
220
|
+
includeDeprecated?: boolean;
|
|
198
221
|
}
|
|
199
222
|
|
|
200
223
|
interface DecomposeResult {
|
|
@@ -235,4 +258,4 @@ MIT © [jackchuka](https://github.com/jackchuka)
|
|
|
235
258
|
## Related Projects
|
|
236
259
|
|
|
237
260
|
- [GraphQL Tools](https://www.graphql-tools.com/) - Comprehensive GraphQL utilities
|
|
238
|
-
- [GraphQL Code Generator](https://www.graphql-code-generator.com/) - Generate code from GraphQL schemas
|
|
261
|
+
- [GraphQL Code Generator](https://www.graphql-code-generator.com/) - Generate code from GraphQL schemas
|