diff --git a/packages/generate/src/edgeql-js.ts b/packages/generate/src/edgeql-js.ts index 18739d593..9f4c0411c 100644 --- a/packages/generate/src/edgeql-js.ts +++ b/packages/generate/src/edgeql-js.ts @@ -137,13 +137,7 @@ export async function generateQueryBuilder(params: { generateSetImpl(generatorParams); console.log("Generating globals..."); generateGlobals(generatorParams); - - // TODO: Fix 'fts' module generation properly, for now we just disable - // output of this module - dir._modules.delete("fts"); - dir._map.delete("modules/fts"); - // ----------------- - + console.log("Generating index..."); generateIndex(generatorParams); // generate module imports diff --git a/packages/generate/src/edgeql-js/generateFunctionTypes.ts b/packages/generate/src/edgeql-js/generateFunctionTypes.ts index 6d4159a07..30a971539 100644 --- a/packages/generate/src/edgeql-js/generateFunctionTypes.ts +++ b/packages/generate/src/edgeql-js/generateFunctionTypes.ts @@ -103,7 +103,6 @@ export function generateFuncopTypes( const implicitCastableRootTypes = getImplicitCastableRootTypes(casts); for (const [funcName, _funcDefs] of funcops.entries()) { - console.log("Generating function type for", funcName); const { mod, name } = splitName(funcName); const code = dir.getModule(mod); diff --git a/packages/generate/src/funcoputil.ts b/packages/generate/src/funcoputil.ts index 06b58f074..eef810a62 100644 --- a/packages/generate/src/funcoputil.ts +++ b/packages/generate/src/funcoputil.ts @@ -36,10 +36,13 @@ export function expandFuncopAnytypeOverloads( // create an anytype overload for 'range' so 'anypoint' // gets inferred to the same type in return type - const anypointParams = [ + const paramsList = [ ...overload.params.positional, ...overload.params.named, - ].filter((param) => param.type.name.includes("anypoint")); + ]; + const anypointParams = paramsList.filter((param) => + param.type.name.includes("anypoint") + ); if (anypointParams.length) { return [ { @@ -54,6 +57,23 @@ export function expandFuncopAnytypeOverloads( }, ]; } + const anyobjectParams = paramsList.filter((param) => + param.type.name.includes("anyobject") + ); + if (anyobjectParams.length) { + return [ + { + ...overload, + anytypes: { + kind: "noncastable" as const, + type: ["$.ObjectType"], + typeObj: anyobjectParams[0].type, + refName: anyobjectParams[0].typeName, + refPath: findPathOfAnytype(anyobjectParams[0].type.id, types), + }, + }, + ]; + } // Each overload with 'anytype' params is expanded into several overloads: // - overload for each implicitly castable root type union @@ -73,10 +93,9 @@ export function expandFuncopAnytypeOverloads( // other params reference first param type // - return anytype: references first param type - const anytypeParams = [ - ...overload.params.positional, - ...overload.params.named, - ].filter((param) => param.type.name.includes("anytype")); + const anytypeParams = paramsList.filter((param) => + param.type.name.includes("anytype") + ); if (anytypeParams.length) { const hasArrayType = @@ -204,7 +223,11 @@ function _findPathOfAnytype( ): string | null { const type = types.get(typeId); - if (type.name === "anytype" || type.name === "anypoint") { + if ( + type.name === "anytype" || + type.name === "anypoint" || + type.name === "anyobject" + ) { return '["__element__"]'; } if (type.kind === "array") {