@constructive-io/graphql-codegen 4.8.1 → 4.9.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.
|
@@ -341,12 +341,19 @@ function buildMutationHandler(table, operation, targetName, typeRegistry, ormTyp
|
|
|
341
341
|
// For create: field is required only if it has no default value
|
|
342
342
|
// For update: all fields are optional (user only updates what they want)
|
|
343
343
|
const isRequired = operation === 'create' && !fieldsWithDefaults.has(field.name);
|
|
344
|
-
|
|
344
|
+
const hasDefault = fieldsWithDefaults.has(field.name);
|
|
345
|
+
const questionProps = [
|
|
345
346
|
t.objectProperty(t.identifier('type'), t.stringLiteral('text')),
|
|
346
347
|
t.objectProperty(t.identifier('name'), t.stringLiteral(field.name)),
|
|
347
348
|
t.objectProperty(t.identifier('message'), t.stringLiteral(field.name)),
|
|
348
349
|
t.objectProperty(t.identifier('required'), t.booleanLiteral(isRequired)),
|
|
349
|
-
]
|
|
350
|
+
];
|
|
351
|
+
// Skip prompting for fields with backend-managed defaults.
|
|
352
|
+
// The field still appears in man pages and can be overridden via CLI flags.
|
|
353
|
+
if (hasDefault) {
|
|
354
|
+
questionProps.push(t.objectProperty(t.identifier('skipPrompt'), t.booleanLiteral(true)));
|
|
355
|
+
}
|
|
356
|
+
questions.push(t.objectExpression(questionProps));
|
|
350
357
|
}
|
|
351
358
|
}
|
|
352
359
|
const selectObj = operation === 'delete'
|
|
@@ -305,12 +305,19 @@ function buildMutationHandler(table, operation, targetName, typeRegistry, ormTyp
|
|
|
305
305
|
// For create: field is required only if it has no default value
|
|
306
306
|
// For update: all fields are optional (user only updates what they want)
|
|
307
307
|
const isRequired = operation === 'create' && !fieldsWithDefaults.has(field.name);
|
|
308
|
-
|
|
308
|
+
const hasDefault = fieldsWithDefaults.has(field.name);
|
|
309
|
+
const questionProps = [
|
|
309
310
|
t.objectProperty(t.identifier('type'), t.stringLiteral('text')),
|
|
310
311
|
t.objectProperty(t.identifier('name'), t.stringLiteral(field.name)),
|
|
311
312
|
t.objectProperty(t.identifier('message'), t.stringLiteral(field.name)),
|
|
312
313
|
t.objectProperty(t.identifier('required'), t.booleanLiteral(isRequired)),
|
|
313
|
-
]
|
|
314
|
+
];
|
|
315
|
+
// Skip prompting for fields with backend-managed defaults.
|
|
316
|
+
// The field still appears in man pages and can be overridden via CLI flags.
|
|
317
|
+
if (hasDefault) {
|
|
318
|
+
questionProps.push(t.objectProperty(t.identifier('skipPrompt'), t.booleanLiteral(true)));
|
|
319
|
+
}
|
|
320
|
+
questions.push(t.objectExpression(questionProps));
|
|
314
321
|
}
|
|
315
322
|
}
|
|
316
323
|
const selectObj = operation === 'delete'
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@constructive-io/graphql-codegen",
|
|
3
|
-
"version": "4.
|
|
3
|
+
"version": "4.9.0",
|
|
4
4
|
"description": "GraphQL SDK generator for Constructive databases with React Query hooks",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"graphql",
|
|
@@ -101,5 +101,5 @@
|
|
|
101
101
|
"tsx": "^4.21.0",
|
|
102
102
|
"typescript": "^5.9.3"
|
|
103
103
|
},
|
|
104
|
-
"gitHead": "
|
|
104
|
+
"gitHead": "f1f05509f0168497f17c3dbbddb131d6aa5310e1"
|
|
105
105
|
}
|