@constructive-io/data 0.9.2 → 0.9.3
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/dist/index.cjs +12 -12
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +12 -12
- package/dist/index.js.map +1 -1
- package/package.json +2 -2
package/dist/index.js
CHANGED
|
@@ -3990,17 +3990,20 @@ function typePath(name) {
|
|
|
3990
3990
|
function fieldPath(rootName, fieldName) {
|
|
3991
3991
|
return `${typePath(rootName)}.fields.${fieldName}`;
|
|
3992
3992
|
}
|
|
3993
|
-
function relevantTypes(inflection3) {
|
|
3993
|
+
function relevantTypes(inflection3, query) {
|
|
3994
3994
|
if (!inflection3) return [];
|
|
3995
|
+
const hasCreate = nonEmptyName(query?.create) !== null;
|
|
3996
|
+
const hasUpdate = nonEmptyName(query?.update) !== null;
|
|
3997
|
+
const hasDelete = nonEmptyName(query?.delete) !== null;
|
|
3995
3998
|
return [
|
|
3996
3999
|
[inflection3.tableType, "OBJECT"],
|
|
3997
4000
|
[inflection3.connection, "OBJECT"],
|
|
3998
4001
|
[inflection3.edge, "OBJECT"],
|
|
3999
|
-
[inflection3.createPayloadType, "OBJECT"],
|
|
4000
|
-
[inflection3.updatePayloadType, "OBJECT"],
|
|
4001
|
-
[inflection3.deletePayloadType, "OBJECT"],
|
|
4002
|
-
[inflection3.createInputType, "INPUT_OBJECT"],
|
|
4003
|
-
[inflection3.patchType, "INPUT_OBJECT"],
|
|
4002
|
+
[hasCreate ? inflection3.createPayloadType : null, "OBJECT"],
|
|
4003
|
+
[hasUpdate ? inflection3.updatePayloadType : null, "OBJECT"],
|
|
4004
|
+
[hasDelete ? inflection3.deletePayloadType : null, "OBJECT"],
|
|
4005
|
+
[hasCreate ? inflection3.createInputType : null, "INPUT_OBJECT"],
|
|
4006
|
+
[hasUpdate ? inflection3.patchType : null, "INPUT_OBJECT"],
|
|
4004
4007
|
[inflection3.filterType, "INPUT_OBJECT"],
|
|
4005
4008
|
[inflection3.orderByType, "ENUM"]
|
|
4006
4009
|
].filter((entry) => nonEmptyName(entry[0]) !== null);
|
|
@@ -4087,10 +4090,7 @@ function analyzeSchemaIntrospectionCompatibility(introspection, metaQuery) {
|
|
|
4087
4090
|
return false;
|
|
4088
4091
|
}
|
|
4089
4092
|
const inputField = inputType.inputFields?.find((field2) => field2.name === fieldName);
|
|
4090
|
-
if (!inputField)
|
|
4091
|
-
missing.add(`${typePath(inputType.name)}.inputFields.${fieldName}`);
|
|
4092
|
-
return false;
|
|
4093
|
-
}
|
|
4093
|
+
if (!inputField) return true;
|
|
4094
4094
|
if (baseTypeName(inputField.type) !== enumTypeName) {
|
|
4095
4095
|
missing.add(`${typePath(inputType.name)}.inputFields.${fieldName}.type.${enumTypeName}`);
|
|
4096
4096
|
return false;
|
|
@@ -4099,7 +4099,7 @@ function analyzeSchemaIntrospectionCompatibility(introspection, metaQuery) {
|
|
|
4099
4099
|
};
|
|
4100
4100
|
for (const table of tables) {
|
|
4101
4101
|
const inflection3 = table.inflection;
|
|
4102
|
-
for (const [typeName, kind] of relevantTypes(inflection3)) requireType(typeName, kind);
|
|
4102
|
+
for (const [typeName, kind] of relevantTypes(inflection3, table.query)) requireType(typeName, kind);
|
|
4103
4103
|
const cleanedTable = cleanTable(table);
|
|
4104
4104
|
const allQueryName = toCamelCasePlural(table.name, cleanedTable);
|
|
4105
4105
|
const allOperation = queryRoot?.fields?.find((field2) => field2.name === allQueryName);
|
|
@@ -4154,7 +4154,7 @@ function analyzeSchemaIntrospectionCompatibility(introspection, metaQuery) {
|
|
|
4154
4154
|
}
|
|
4155
4155
|
const createObjectInputName = baseTypeName(createObjectField?.type);
|
|
4156
4156
|
const createObjectInput = createObjectInputName ? requireType(createObjectInputName, "INPUT_OBJECT") : void 0;
|
|
4157
|
-
const patchTypeName = nonEmptyName(inflection3?.patchType);
|
|
4157
|
+
const patchTypeName = nonEmptyName(table.query?.update) ? nonEmptyName(inflection3?.patchType) : null;
|
|
4158
4158
|
const patchInput = patchTypeName ? requireType(patchTypeName, "INPUT_OBJECT") : void 0;
|
|
4159
4159
|
const updateInputName = updateOperation ? baseTypeName(updateOperation.args.find(({ name }) => name === "input")?.type) : null;
|
|
4160
4160
|
const updateInput = updateInputName ? requireType(updateInputName, "INPUT_OBJECT") : void 0;
|