@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 CHANGED
@@ -3995,17 +3995,20 @@ function typePath(name) {
3995
3995
  function fieldPath(rootName, fieldName) {
3996
3996
  return `${typePath(rootName)}.fields.${fieldName}`;
3997
3997
  }
3998
- function relevantTypes(inflection3) {
3998
+ function relevantTypes(inflection3, query) {
3999
3999
  if (!inflection3) return [];
4000
+ const hasCreate = nonEmptyName(query?.create) !== null;
4001
+ const hasUpdate = nonEmptyName(query?.update) !== null;
4002
+ const hasDelete = nonEmptyName(query?.delete) !== null;
4000
4003
  return [
4001
4004
  [inflection3.tableType, "OBJECT"],
4002
4005
  [inflection3.connection, "OBJECT"],
4003
4006
  [inflection3.edge, "OBJECT"],
4004
- [inflection3.createPayloadType, "OBJECT"],
4005
- [inflection3.updatePayloadType, "OBJECT"],
4006
- [inflection3.deletePayloadType, "OBJECT"],
4007
- [inflection3.createInputType, "INPUT_OBJECT"],
4008
- [inflection3.patchType, "INPUT_OBJECT"],
4007
+ [hasCreate ? inflection3.createPayloadType : null, "OBJECT"],
4008
+ [hasUpdate ? inflection3.updatePayloadType : null, "OBJECT"],
4009
+ [hasDelete ? inflection3.deletePayloadType : null, "OBJECT"],
4010
+ [hasCreate ? inflection3.createInputType : null, "INPUT_OBJECT"],
4011
+ [hasUpdate ? inflection3.patchType : null, "INPUT_OBJECT"],
4009
4012
  [inflection3.filterType, "INPUT_OBJECT"],
4010
4013
  [inflection3.orderByType, "ENUM"]
4011
4014
  ].filter((entry) => nonEmptyName(entry[0]) !== null);
@@ -4092,10 +4095,7 @@ function analyzeSchemaIntrospectionCompatibility(introspection, metaQuery) {
4092
4095
  return false;
4093
4096
  }
4094
4097
  const inputField = inputType.inputFields?.find((field2) => field2.name === fieldName);
4095
- if (!inputField) {
4096
- missing.add(`${typePath(inputType.name)}.inputFields.${fieldName}`);
4097
- return false;
4098
- }
4098
+ if (!inputField) return true;
4099
4099
  if (baseTypeName(inputField.type) !== enumTypeName) {
4100
4100
  missing.add(`${typePath(inputType.name)}.inputFields.${fieldName}.type.${enumTypeName}`);
4101
4101
  return false;
@@ -4104,7 +4104,7 @@ function analyzeSchemaIntrospectionCompatibility(introspection, metaQuery) {
4104
4104
  };
4105
4105
  for (const table of tables) {
4106
4106
  const inflection3 = table.inflection;
4107
- for (const [typeName, kind] of relevantTypes(inflection3)) requireType(typeName, kind);
4107
+ for (const [typeName, kind] of relevantTypes(inflection3, table.query)) requireType(typeName, kind);
4108
4108
  const cleanedTable = cleanTable(table);
4109
4109
  const allQueryName = toCamelCasePlural(table.name, cleanedTable);
4110
4110
  const allOperation = queryRoot?.fields?.find((field2) => field2.name === allQueryName);
@@ -4159,7 +4159,7 @@ function analyzeSchemaIntrospectionCompatibility(introspection, metaQuery) {
4159
4159
  }
4160
4160
  const createObjectInputName = baseTypeName(createObjectField?.type);
4161
4161
  const createObjectInput = createObjectInputName ? requireType(createObjectInputName, "INPUT_OBJECT") : void 0;
4162
- const patchTypeName = nonEmptyName(inflection3?.patchType);
4162
+ const patchTypeName = nonEmptyName(table.query?.update) ? nonEmptyName(inflection3?.patchType) : null;
4163
4163
  const patchInput = patchTypeName ? requireType(patchTypeName, "INPUT_OBJECT") : void 0;
4164
4164
  const updateInputName = updateOperation ? baseTypeName(updateOperation.args.find(({ name }) => name === "input")?.type) : null;
4165
4165
  const updateInput = updateInputName ? requireType(updateInputName, "INPUT_OBJECT") : void 0;