@constructive-io/data 0.9.1 → 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/README.md +1 -1
- 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/README.md
CHANGED
|
@@ -41,6 +41,6 @@ const tables = selectConsoleDataTables(meta._meta?.tables ?? [], {
|
|
|
41
41
|
});
|
|
42
42
|
```
|
|
43
43
|
|
|
44
|
-
`assessSchemaIntrospectionCompatibility` follows the root type names declared by `__schema`, then cross-checks `_meta` operation hints, the arguments required by the query builders, referenced object/input/enum types, table fields, and declared enum values. An incompatible result reports the exact missing GraphQL paths. `_meta` can include hidden tables or naive inflections, so callers must use standard introspection as the authority for any operation they execute.
|
|
44
|
+
`assessSchemaIntrospectionCompatibility` follows the root type names declared by `__schema`, then cross-checks `_meta` operation hints, the arguments required by the query builders, referenced object/input/enum types, table fields, and declared enum values. Create, update and delete payload and input types are required only when `_meta.query` declares that operation, since `_meta` inflection names them even for tables the caller cannot write. An enum column absent from a create or patch input is accepted (a column-level grant leaves it out); one present with another type is still drift. An incompatible result reports the exact missing GraphQL paths. `_meta` can include hidden tables or naive inflections, so callers must use standard introspection as the authority for any operation they execute.
|
|
45
45
|
|
|
46
46
|
`selectConsoleDataTables` classifies ownership only from the July `_meta` `table.scope.scope` smart tag, with `app` as the default exact scope. It excludes storage-owned tables and every table identified as a many-to-many junction, regardless of extra domain fields; physical schema names are used only for explicit exclusions and deduplication.
|
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;
|