Implement typed module contracts and conformance bindings
This commit is contained in:
@@ -126,7 +126,7 @@ export async function compileQuery(
|
||||
if (id === workspaceQueryRootId) return;
|
||||
const contract = generated.contracts.get(id)!;
|
||||
const member = contract.members.find((entry) => entry.displayName === name);
|
||||
if (!member || member.kind === "operation" || !member.queryRead)
|
||||
if (!member || member.kind === "operation" || member.kind === "module" || !member.queryRead)
|
||||
return fail("QUERY_FIELD_NOT_QUERYABLE", `${contract.displayName}.${name} is not queryable`, node);
|
||||
if (declaration.placement?.kind === "local") {
|
||||
const getter = member.operations.find(
|
||||
|
||||
+6
-1
@@ -62,7 +62,12 @@ export function linkQueries(workspace: WorkspaceRevision): LinkedQuery[] {
|
||||
for (const effect of checked.effects) {
|
||||
const contract = interfaces.get(effect.interfaceRevisionId);
|
||||
const member = contract?.members.find((entry) => entry.id === effect.memberId);
|
||||
if (!member || member.kind === "operation" || member.queryRead?.execution !== effect.execution)
|
||||
if (
|
||||
!member ||
|
||||
member.kind === "operation" ||
|
||||
member.kind === "module" ||
|
||||
member.queryRead?.execution !== effect.execution
|
||||
)
|
||||
throw new QueryCompileError(
|
||||
"QUERY_STALE_CONTRACT",
|
||||
`Query field ${effect.interfaceRevisionId}.${effect.memberId} changed`,
|
||||
|
||||
@@ -83,7 +83,7 @@ export function relationalSchema(env: RelationalSchemaEnvironment, document?: Do
|
||||
]);
|
||||
return new Map(
|
||||
env.contracts.get(row.interfaceRevisionId)!.members.flatMap((member): [string, SchemaRowField][] => {
|
||||
if (member.kind === "operation" || !member.queryRead) return [];
|
||||
if (member.kind === "operation" || member.kind === "module" || !member.queryRead) return [];
|
||||
if (member.kind === "value") return [[member.displayName, { kind: "leaf", type: member.valueType }]];
|
||||
if (many(member)) return [];
|
||||
return [
|
||||
|
||||
+1
-1
@@ -200,7 +200,7 @@ export function querySchema(
|
||||
});
|
||||
const fields: GraphQLFieldConfigMap<unknown, unknown> = { _qx: { type: new GraphQLNonNull(metadata) } };
|
||||
for (const member of contract(id).members) {
|
||||
if (member.kind === "operation" || !member.queryRead) continue;
|
||||
if (member.kind === "operation" || member.kind === "module" || !member.queryRead) continue;
|
||||
if (!/^[_A-Za-z][_0-9A-Za-z]*$/.test(member.displayName) || member.displayName.startsWith("_"))
|
||||
throw new QueryCompileError("QUERY_SCHEMA_NAME", `Unsupported query field name ${member.displayName}`);
|
||||
if (member.kind === "value") {
|
||||
|
||||
Reference in New Issue
Block a user