diff --git a/graphql/codegen/src/__tests__/codegen/__snapshots__/cli-generator.test.ts.snap b/graphql/codegen/src/__tests__/codegen/__snapshots__/cli-generator.test.ts.snap index 4e0126985..322d77d1f 100644 --- a/graphql/codegen/src/__tests__/codegen/__snapshots__/cli-generator.test.ts.snap +++ b/graphql/codegen/src/__tests__/codegen/__snapshots__/cli-generator.test.ts.snap @@ -615,7 +615,7 @@ import carCmd from "./commands/car"; import driverCmd from "./commands/driver"; import currentUserCmd from "./commands/current-user"; import loginCmd from "./commands/login"; -const createCommandMap = () => ({ +const createCommandMap: (() => Record>, prompter: Inquirerer, options: CLIOptions) => Promise>) = () => ({ "context": contextCmd, "auth": authCmd, "car": carCmd, @@ -641,7 +641,7 @@ export const commands = async (argv: Partial>, prompter: message: "What do you want to do?", options: Object.keys(commandMap) }]); - command = answer.command; + command = answer.command as string; } const commandFn = commandMap[command]; if (!commandFn) { @@ -681,7 +681,7 @@ export default async (argv: Partial>, prompter: Inquirer message: "What do you want to do?", options: ["set-token", "status", "logout"] }]); - return handleAuthSubcommand(answer.subcommand, newArgv, prompter, store); + return handleAuthSubcommand(answer.subcommand as string, newArgv, prompter, store); } return handleAuthSubcommand(subcommand, newArgv, prompter, store); }; @@ -715,7 +715,7 @@ async function handleSetToken(argv: Partial>, prompter: message: "API Token", required: true }]); - tokenValue = answer.token; + tokenValue = answer.token as string; } store.setCredentials(current.name, { token: String(tokenValue || "").trim() @@ -750,7 +750,7 @@ async function handleLogout(argv: Partial>, prompter: In message: \`Remove credentials for "\${current.name}"?\`, default: false }]); - if (!confirm.confirm) { + if (!(confirm.confirm as boolean)) { return; } if (store.removeCredentials(current.name)) { @@ -770,7 +770,9 @@ exports[`cli-generator generates commands/car.ts 1`] = ` import { CLIOptions, Inquirerer, extractFirst } from "inquirerer"; import { getClient } from "../executor"; import { coerceAnswers, stripUndefined } from "../utils"; -const fieldSchema = { +import type { FieldSchema } from "../utils"; +import type { CreateCarInput, CarPatch } from "../../orm/input-types"; +const fieldSchema: FieldSchema = { id: "uuid", make: "string", model: "string", @@ -795,7 +797,7 @@ export default async (argv: Partial>, prompter: Inquirer message: "What do you want to do?", options: ["list", "get", "create", "update", "delete"] }]); - return handleTableSubcommand(answer.subcommand, newArgv, prompter); + return handleTableSubcommand(answer.subcommand as string, newArgv, prompter); } return handleTableSubcommand(subcommand, newArgv, prompter); }; @@ -848,7 +850,7 @@ async function handleGet(argv: Partial>, prompter: Inqui }]); const client = getClient(); const result = await client.car.findOne({ - id: answers.id, + id: answers.id as string, select: { id: true, make: true, @@ -891,7 +893,7 @@ async function handleCreate(argv: Partial>, prompter: In required: true }]); const answers = coerceAnswers(rawAnswers, fieldSchema); - const cleanedData = stripUndefined(answers, fieldSchema); + const cleanedData = stripUndefined(answers, fieldSchema) as CreateCarInput["car"]; const client = getClient(); const result = await client.car.create({ data: { @@ -947,7 +949,7 @@ async function handleUpdate(argv: Partial>, prompter: In required: false }]); const answers = coerceAnswers(rawAnswers, fieldSchema); - const cleanedData = stripUndefined(answers, fieldSchema); + const cleanedData = stripUndefined(answers, fieldSchema) as CarPatch; const client = getClient(); const result = await client.car.update({ where: { @@ -1032,7 +1034,7 @@ export default async (argv: Partial>, prompter: Inquirer message: "What do you want to do?", options: ["create", "list", "use", "current", "delete"] }]); - return handleSubcommand(answer.subcommand, newArgv, prompter, store); + return handleSubcommand(answer.subcommand as string, newArgv, prompter, store); } return handleSubcommand(subcommand, newArgv, prompter, store); }; @@ -1058,7 +1060,7 @@ async function handleCreate(argv: Partial>, prompter: In first: name, newArgv: restArgv } = extractFirst(argv); - const answers = await prompter.prompt({ + const answers = (await prompter.prompt({ name, ...restArgv }, [{ @@ -1071,7 +1073,7 @@ async function handleCreate(argv: Partial>, prompter: In name: "endpoint", message: "GraphQL endpoint URL", required: true - }]); + }])) as unknown as Record; const contextName = answers.name; const endpoint = answers.endpoint; store.createContext(contextName, { @@ -1116,7 +1118,7 @@ async function handleUse(argv: Partial>, prompter: Inqui message: "Select context", options: contexts.map(c => c.name) }]); - contextName = answer.name; + contextName = answer.name as string; } if (store.setCurrentContext(contextName)) { console.log(\`Switched to context: \${contextName}\`); @@ -1153,7 +1155,7 @@ async function handleDelete(argv: Partial>, prompter: In message: "Select context to delete", options: contexts.map(c => c.name) }]); - contextName = answer.name; + contextName = answer.name as string; } if (store.deleteContext(contextName)) { console.log(\`Deleted context: \${contextName}\`); @@ -1173,6 +1175,7 @@ exports[`cli-generator generates commands/current-user.ts (custom query) 1`] = ` import { CLIOptions, Inquirerer } from "inquirerer"; import { getClient } from "../executor"; import { buildSelectFromPaths } from "../utils"; +import type { UserSelect } from "../../orm/input-types"; export default async (argv: Partial>, prompter: Inquirerer, _options: CLIOptions) => { try { if (argv.help || argv.h) { @@ -1180,9 +1183,11 @@ export default async (argv: Partial>, prompter: Inquirer process.exit(0); } const client = getClient(); - const selectFields = buildSelectFromPaths(argv.select ?? ""); + const selectFields = buildSelectFromPaths(argv.select as string ?? ""); const result = await client.query.currentUser({ select: selectFields + } as unknown as { + select: UserSelect; }).execute(); console.log(JSON.stringify(result, null, 2)); } catch (error) { @@ -1204,7 +1209,9 @@ exports[`cli-generator generates commands/driver.ts 1`] = ` import { CLIOptions, Inquirerer, extractFirst } from "inquirerer"; import { getClient } from "../executor"; import { coerceAnswers, stripUndefined } from "../utils"; -const fieldSchema = { +import type { FieldSchema } from "../utils"; +import type { CreateDriverInput, DriverPatch } from "../../orm/input-types"; +const fieldSchema: FieldSchema = { id: "uuid", name: "string", licenseNumber: "string" @@ -1226,7 +1233,7 @@ export default async (argv: Partial>, prompter: Inquirer message: "What do you want to do?", options: ["list", "get", "create", "update", "delete"] }]); - return handleTableSubcommand(answer.subcommand, newArgv, prompter); + return handleTableSubcommand(answer.subcommand as string, newArgv, prompter); } return handleTableSubcommand(subcommand, newArgv, prompter); }; @@ -1276,7 +1283,7 @@ async function handleGet(argv: Partial>, prompter: Inqui }]); const client = getClient(); const result = await client.driver.findOne({ - id: answers.id, + id: answers.id as string, select: { id: true, name: true, @@ -1306,7 +1313,7 @@ async function handleCreate(argv: Partial>, prompter: In required: true }]); const answers = coerceAnswers(rawAnswers, fieldSchema); - const cleanedData = stripUndefined(answers, fieldSchema); + const cleanedData = stripUndefined(answers, fieldSchema) as CreateDriverInput["driver"]; const client = getClient(); const result = await client.driver.create({ data: { @@ -1347,7 +1354,7 @@ async function handleUpdate(argv: Partial>, prompter: In required: false }]); const answers = coerceAnswers(rawAnswers, fieldSchema); - const cleanedData = stripUndefined(answers, fieldSchema); + const cleanedData = stripUndefined(answers, fieldSchema) as DriverPatch; const client = getClient(); const result = await client.driver.update({ where: { @@ -1410,6 +1417,8 @@ exports[`cli-generator generates commands/login.ts (custom mutation) 1`] = ` import { CLIOptions, Inquirerer } from "inquirerer"; import { getClient } from "../executor"; import { buildSelectFromPaths } from "../utils"; +import type { LoginVariables } from "../../orm/mutation"; +import type { LoginPayloadSelect } from "../../orm/input-types"; export default async (argv: Partial>, prompter: Inquirerer, _options: CLIOptions) => { try { if (argv.help || argv.h) { @@ -1428,9 +1437,11 @@ export default async (argv: Partial>, prompter: Inquirer required: true }]); const client = getClient(); - const selectFields = buildSelectFromPaths(argv.select ?? "clientMutationId"); - const result = await client.mutation.login(answers, { + const selectFields = buildSelectFromPaths(argv.select as string ?? "clientMutationId"); + const result = await client.mutation.login(answers as unknown as LoginVariables, { select: selectFields + } as unknown as { + select: LoginPayloadSelect; }).execute(); console.log(JSON.stringify(result, null, 2)); } catch (error) { @@ -1466,7 +1477,7 @@ export function getClient(contextName?: string) { throw new Error("No active context. Run \\"context create\\" or \\"context use\\" first."); } } - const headers = {}; + const headers: Record = {}; if (store.hasValidCredentials(ctx.name)) { const creds = store.getCredentials(ctx.name); if (creds?.token) { @@ -3376,7 +3387,7 @@ export default async (argv: Partial>, prompter: Inquirer message: "What do you want to do?", options: ["set-token", "status", "logout"] }]); - return handleAuthSubcommand(answer.subcommand, newArgv, prompter, store); + return handleAuthSubcommand(answer.subcommand as string, newArgv, prompter, store); } return handleAuthSubcommand(subcommand, newArgv, prompter, store); }; @@ -3410,7 +3421,7 @@ async function handleSetToken(argv: Partial>, prompter: message: "API Token", required: true }]); - tokenValue = answer.token; + tokenValue = answer.token as string; } store.setCredentials(current.name, { token: String(tokenValue || "").trim() @@ -3445,7 +3456,7 @@ async function handleLogout(argv: Partial>, prompter: In message: \`Remove credentials for "\${current.name}"?\`, default: false }]); - if (!confirm.confirm) { + if (!(confirm.confirm as boolean)) { return; } if (store.removeCredentials(current.name)) { @@ -3470,7 +3481,7 @@ import authCurrentUserCmd from "./commands/auth/current-user"; import authLoginCmd from "./commands/auth/login"; import membersMemberCmd from "./commands/members/member"; import appCarCmd from "./commands/app/car"; -const createCommandMap = () => ({ +const createCommandMap: (() => Record>, prompter: Inquirerer, options: CLIOptions) => Promise>) = () => ({ "context": contextCmd, "credentials": credentialsCmd, "auth:user": authUserCmd, @@ -3497,7 +3508,7 @@ export const commands = async (argv: Partial>, prompter: message: "What do you want to do?", options: Object.keys(commandMap) }]); - command = answer.command; + command = answer.command as string; } const commandFn = commandMap[command]; if (!commandFn) { @@ -3537,7 +3548,7 @@ export default async (argv: Partial>, prompter: Inquirer message: "What do you want to do?", options: ["create", "list", "use", "current", "delete"] }]); - return handleSubcommand(answer.subcommand, newArgv, prompter, store); + return handleSubcommand(answer.subcommand as string, newArgv, prompter, store); } return handleSubcommand(subcommand, newArgv, prompter, store); }; @@ -3587,20 +3598,20 @@ async function handleCreate(argv: Partial>, prompter: In message: "app endpoint", default: "http://app.localhost/graphql" }]); - const contextName = answers.name; + const contextName = answers.name as string; const targets = { "auth": { - endpoint: answers.authEndpoint + endpoint: answers.authEndpoint as string }, "members": { - endpoint: answers.membersEndpoint + endpoint: answers.membersEndpoint as string }, "app": { - endpoint: answers.appEndpoint + endpoint: answers.appEndpoint as string } }; store.createContext(contextName, { - endpoint: answers.authEndpoint, + endpoint: answers.authEndpoint as string, targets: targets }); const settings = store.loadSettings(); @@ -3608,9 +3619,9 @@ async function handleCreate(argv: Partial>, prompter: In store.setCurrentContext(contextName); } console.log(\`Created context: \${contextName}\`); - console.log(\` auth: \${answers.authEndpoint}\`); - console.log(\` members: \${answers.membersEndpoint}\`); - console.log(\` app: \${answers.appEndpoint}\`); + console.log(\` auth: \${answers.authEndpoint as string}\`); + console.log(\` members: \${answers.membersEndpoint as string}\`); + console.log(\` app: \${answers.appEndpoint as string}\`); } function handleList(store: ReturnType) { const contexts = store.listContexts(); @@ -3644,7 +3655,7 @@ async function handleUse(argv: Partial>, prompter: Inqui message: "Select context", options: contexts.map(c => c.name) }]); - contextName = answer.name; + contextName = answer.name as string; } if (store.setCurrentContext(contextName)) { console.log(\`Switched to context: \${contextName}\`); @@ -3681,7 +3692,7 @@ async function handleDelete(argv: Partial>, prompter: In message: "Select context to delete", options: contexts.map(c => c.name) }]); - contextName = answer.name; + contextName = answer.name as string; } if (store.deleteContext(contextName)) { console.log(\`Deleted context: \${contextName}\`); @@ -3721,7 +3732,7 @@ export function getClient(targetName: string, contextName?: string) { if (!createFn) { throw new Error(\`Unknown target: \${targetName}\`); } - const headers = {}; + const headers: Record = {}; let endpoint = ""; const ctx = contextName ? store.loadContext(contextName) : store.getCurrentContext(); if (ctx) { @@ -3752,6 +3763,8 @@ exports[`multi-target cli generator generates target-prefixed custom commands wi import { CLIOptions, Inquirerer } from "inquirerer"; import { getClient, getStore } from "../../executor"; import { buildSelectFromPaths } from "../../utils"; +import type { LoginVariables } from "../../../orm/mutation"; +import type { LoginPayloadSelect } from "../../../orm/input-types"; export default async (argv: Partial>, prompter: Inquirerer, _options: CLIOptions) => { try { if (argv.help || argv.h) { @@ -3770,9 +3783,11 @@ export default async (argv: Partial>, prompter: Inquirer required: true }]); const client = getClient("auth"); - const selectFields = buildSelectFromPaths(argv.select ?? "clientMutationId"); - const result = await client.mutation.login(answers, { + const selectFields = buildSelectFromPaths(argv.select as string ?? "clientMutationId"); + const result = await client.mutation.login(answers as unknown as LoginVariables, { select: selectFields + } as unknown as { + select: LoginPayloadSelect; }).execute(); if (argv.saveToken && result) { const tokenValue = result.token || result.jwtToken || result.accessToken; @@ -3807,7 +3822,9 @@ exports[`multi-target cli generator generates target-prefixed table commands 1`] import { CLIOptions, Inquirerer, extractFirst } from "inquirerer"; import { getClient } from "../../executor"; import { coerceAnswers, stripUndefined } from "../../utils"; -const fieldSchema = { +import type { FieldSchema } from "../../utils"; +import type { CreateUserInput, UserPatch } from "../../../orm/input-types"; +const fieldSchema: FieldSchema = { id: "uuid", email: "string", name: "string" @@ -3829,7 +3846,7 @@ export default async (argv: Partial>, prompter: Inquirer message: "What do you want to do?", options: ["list", "get", "create", "update", "delete"] }]); - return handleTableSubcommand(answer.subcommand, newArgv, prompter); + return handleTableSubcommand(answer.subcommand as string, newArgv, prompter); } return handleTableSubcommand(subcommand, newArgv, prompter); }; @@ -3879,7 +3896,7 @@ async function handleGet(argv: Partial>, prompter: Inqui }]); const client = getClient("auth"); const result = await client.user.findOne({ - id: answers.id, + id: answers.id as string, select: { id: true, email: true, @@ -3909,7 +3926,7 @@ async function handleCreate(argv: Partial>, prompter: In required: true }]); const answers = coerceAnswers(rawAnswers, fieldSchema); - const cleanedData = stripUndefined(answers, fieldSchema); + const cleanedData = stripUndefined(answers, fieldSchema) as CreateUserInput["user"]; const client = getClient("auth"); const result = await client.user.create({ data: { @@ -3950,7 +3967,7 @@ async function handleUpdate(argv: Partial>, prompter: In required: false }]); const answers = coerceAnswers(rawAnswers, fieldSchema); - const cleanedData = stripUndefined(answers, fieldSchema); + const cleanedData = stripUndefined(answers, fieldSchema) as UserPatch; const client = getClient("auth"); const result = await client.user.update({ where: { @@ -4013,7 +4030,9 @@ exports[`multi-target cli generator generates target-prefixed table commands 2`] import { CLIOptions, Inquirerer, extractFirst } from "inquirerer"; import { getClient } from "../../executor"; import { coerceAnswers, stripUndefined } from "../../utils"; -const fieldSchema = { +import type { FieldSchema } from "../../utils"; +import type { CreateMemberInput, MemberPatch } from "../../../orm/input-types"; +const fieldSchema: FieldSchema = { id: "uuid", role: "string" }; @@ -4034,7 +4053,7 @@ export default async (argv: Partial>, prompter: Inquirer message: "What do you want to do?", options: ["list", "get", "create", "update", "delete"] }]); - return handleTableSubcommand(answer.subcommand, newArgv, prompter); + return handleTableSubcommand(answer.subcommand as string, newArgv, prompter); } return handleTableSubcommand(subcommand, newArgv, prompter); }; @@ -4083,7 +4102,7 @@ async function handleGet(argv: Partial>, prompter: Inqui }]); const client = getClient("members"); const result = await client.member.findOne({ - id: answers.id, + id: answers.id as string, select: { id: true, role: true @@ -4107,7 +4126,7 @@ async function handleCreate(argv: Partial>, prompter: In required: true }]); const answers = coerceAnswers(rawAnswers, fieldSchema); - const cleanedData = stripUndefined(answers, fieldSchema); + const cleanedData = stripUndefined(answers, fieldSchema) as CreateMemberInput["member"]; const client = getClient("members"); const result = await client.member.create({ data: { @@ -4141,7 +4160,7 @@ async function handleUpdate(argv: Partial>, prompter: In required: false }]); const answers = coerceAnswers(rawAnswers, fieldSchema); - const cleanedData = stripUndefined(answers, fieldSchema); + const cleanedData = stripUndefined(answers, fieldSchema) as MemberPatch; const client = getClient("members"); const result = await client.member.update({ where: { @@ -4202,7 +4221,9 @@ exports[`multi-target cli generator generates target-prefixed table commands 3`] import { CLIOptions, Inquirerer, extractFirst } from "inquirerer"; import { getClient } from "../../executor"; import { coerceAnswers, stripUndefined } from "../../utils"; -const fieldSchema = { +import type { FieldSchema } from "../../utils"; +import type { CreateCarInput, CarPatch } from "../../../orm/input-types"; +const fieldSchema: FieldSchema = { id: "uuid", make: "string", model: "string", @@ -4227,7 +4248,7 @@ export default async (argv: Partial>, prompter: Inquirer message: "What do you want to do?", options: ["list", "get", "create", "update", "delete"] }]); - return handleTableSubcommand(answer.subcommand, newArgv, prompter); + return handleTableSubcommand(answer.subcommand as string, newArgv, prompter); } return handleTableSubcommand(subcommand, newArgv, prompter); }; @@ -4280,7 +4301,7 @@ async function handleGet(argv: Partial>, prompter: Inqui }]); const client = getClient("app"); const result = await client.car.findOne({ - id: answers.id, + id: answers.id as string, select: { id: true, make: true, @@ -4323,7 +4344,7 @@ async function handleCreate(argv: Partial>, prompter: In required: true }]); const answers = coerceAnswers(rawAnswers, fieldSchema); - const cleanedData = stripUndefined(answers, fieldSchema); + const cleanedData = stripUndefined(answers, fieldSchema) as CreateCarInput["car"]; const client = getClient("app"); const result = await client.car.create({ data: { @@ -4379,7 +4400,7 @@ async function handleUpdate(argv: Partial>, prompter: In required: false }]); const answers = coerceAnswers(rawAnswers, fieldSchema); - const cleanedData = stripUndefined(answers, fieldSchema); + const cleanedData = stripUndefined(answers, fieldSchema) as CarPatch; const client = getClient("app"); const result = await client.car.update({ where: { diff --git a/graphql/codegen/src/core/codegen/cli/command-map-generator.ts b/graphql/codegen/src/core/codegen/cli/command-map-generator.ts index 15f9ac71f..5a5b7e54e 100644 --- a/graphql/codegen/src/core/codegen/cli/command-map-generator.ts +++ b/graphql/codegen/src/core/codegen/cli/command-map-generator.ts @@ -32,6 +32,47 @@ function createNamedImportDeclaration( return decl; } +/** + * Build the command handler function type: + * (argv: Partial>, prompter: Inquirerer, options: CLIOptions) => Promise + * This matches the actual exported handler signatures from table/custom command files. + */ +function buildCommandHandlerType(): t.TSFunctionType { + const argvParam = t.identifier('argv'); + argvParam.typeAnnotation = t.tsTypeAnnotation( + t.tsTypeReference( + t.identifier('Partial'), + t.tsTypeParameterInstantiation([ + t.tsTypeReference( + t.identifier('Record'), + t.tsTypeParameterInstantiation([ + t.tsStringKeyword(), + t.tsUnknownKeyword(), + ]), + ), + ]), + ), + ); + const prompterParam = t.identifier('prompter'); + prompterParam.typeAnnotation = t.tsTypeAnnotation( + t.tsTypeReference(t.identifier('Inquirerer')), + ); + const optionsParam = t.identifier('options'); + optionsParam.typeAnnotation = t.tsTypeAnnotation( + t.tsTypeReference(t.identifier('CLIOptions')), + ); + return t.tsFunctionType( + null, + [argvParam, prompterParam, optionsParam], + t.tsTypeAnnotation( + t.tsTypeReference( + t.identifier('Promise'), + t.tsTypeParameterInstantiation([t.tsVoidKeyword()]), + ), + ), + ); +} + export function generateCommandMap( tables: CleanTable[], customOperations: CleanOperation[], @@ -83,25 +124,9 @@ export function generateCommandMap( ), ); - const createCommandMapFunc = t.variableDeclaration('const', [ - t.variableDeclarator( - t.identifier('createCommandMap'), - t.arrowFunctionExpression( - [], - t.objectExpression(mapProperties), - ), - ), - ]); - - const createCommandMapAnnotation = t.tsTypeAnnotation( - t.tsTypeReference( - t.identifier('Record'), - t.tsTypeParameterInstantiation([ - t.tsStringKeyword(), - t.tsFunctionType(null, [], t.tsTypeAnnotation(t.tsAnyKeyword())), - ]), - ), - ); + // Build command handler type matching actual handler signature: + // (argv: Partial>, prompter: Inquirerer, options: CLIOptions) => Promise + const commandHandlerType = buildCommandHandlerType(); const createCommandMapId = t.identifier('createCommandMap'); createCommandMapId.typeAnnotation = t.tsTypeAnnotation( @@ -114,7 +139,7 @@ export function generateCommandMap( t.identifier('Record'), t.tsTypeParameterInstantiation([ t.tsStringKeyword(), - t.tsFunctionType(null, [], t.tsTypeAnnotation(t.tsUnknownKeyword())), + commandHandlerType, ]), ), ), @@ -122,6 +147,15 @@ export function generateCommandMap( ), ); + const createCommandMapFunc = t.variableDeclaration('const', [ + t.variableDeclarator( + createCommandMapId, + t.arrowFunctionExpression( + [], + t.objectExpression(mapProperties), + ), + ), + ]); statements.push(createCommandMapFunc); const usageLines = [ @@ -285,9 +319,12 @@ export function generateCommandMap( t.assignmentExpression( '=', t.identifier('command'), - t.memberExpression( - t.identifier('answer'), - t.identifier('command'), + t.tsAsExpression( + t.memberExpression( + t.identifier('answer'), + t.identifier('command'), + ), + t.tsStringKeyword(), ), ), ), @@ -449,9 +486,31 @@ export function generateMultiTargetCommandMap( ), ); + // Build command handler type matching actual handler signature + const multiTargetCommandHandlerType = buildCommandHandlerType(); + + const multiTargetCreateCommandMapId = t.identifier('createCommandMap'); + multiTargetCreateCommandMapId.typeAnnotation = t.tsTypeAnnotation( + t.tsParenthesizedType( + t.tsFunctionType( + null, + [], + t.tsTypeAnnotation( + t.tsTypeReference( + t.identifier('Record'), + t.tsTypeParameterInstantiation([ + t.tsStringKeyword(), + multiTargetCommandHandlerType, + ]), + ), + ), + ), + ), + ); + const createCommandMapFunc = t.variableDeclaration('const', [ t.variableDeclarator( - t.identifier('createCommandMap'), + multiTargetCreateCommandMapId, t.arrowFunctionExpression( [], t.objectExpression(mapProperties), @@ -626,9 +685,12 @@ export function generateMultiTargetCommandMap( t.assignmentExpression( '=', t.identifier('command'), - t.memberExpression( - t.identifier('answer'), - t.identifier('command'), + t.tsAsExpression( + t.memberExpression( + t.identifier('answer'), + t.identifier('command'), + ), + t.tsStringKeyword(), ), ), ), diff --git a/graphql/codegen/src/core/codegen/cli/custom-command-generator.ts b/graphql/codegen/src/core/codegen/cli/custom-command-generator.ts index 72ee42480..7fc780437 100644 --- a/graphql/codegen/src/core/codegen/cli/custom-command-generator.ts +++ b/graphql/codegen/src/core/codegen/cli/custom-command-generator.ts @@ -2,7 +2,7 @@ import * as t from '@babel/types'; import { toKebabCase } from 'komoji'; import { generateCode } from '../babel-ast'; -import { getGeneratedFileHeader } from '../utils'; +import { getGeneratedFileHeader, ucFirst } from '../utils'; import type { CleanOperation, CleanTypeRef } from '../../../types/schema'; import type { GeneratedFile } from './executor-generator'; import { buildQuestionsArray } from './arg-mapper'; @@ -144,25 +144,40 @@ function buildOrmCustomCall( argsExpr: t.Expression, selectExpr?: t.Expression, hasArgs: boolean = true, + selectTypeName?: string, ): t.Expression { const callArgs: t.Expression[] = []; + // Helper: wrap { select } and cast to `{ select: XxxSelect }` via `unknown`. + // The ORM method's second parameter is `{ select: S } & StrictSelect`. + // We import the concrete Select type (e.g. CheckPasswordPayloadSelect) and cast + // `{ select: selectFields } as unknown as { select: XxxSelect }` so TS infers + // `S = XxxSelect` and StrictSelect is satisfied. + const castSelectWrapper = (sel: t.Expression) => { + const selectObj = t.objectExpression([ + t.objectProperty(t.identifier('select'), sel), + ]); + if (!selectTypeName) return selectObj; + return t.tsAsExpression( + t.tsAsExpression(selectObj, t.tsUnknownKeyword()), + t.tsTypeLiteral([ + t.tsPropertySignature( + t.identifier('select'), + t.tsTypeAnnotation( + t.tsTypeReference(t.identifier(selectTypeName)), + ), + ), + ]), + ); + }; if (hasArgs) { - // Operation has arguments: pass args as first param, select as second + // Operation has arguments: pass args as first param, select as second. callArgs.push(argsExpr); if (selectExpr) { - callArgs.push( - t.objectExpression([ - t.objectProperty(t.identifier('select'), selectExpr), - ]), - ); + callArgs.push(castSelectWrapper(selectExpr)); } } else if (selectExpr) { - // No arguments: pass { select } as the only param (ORM signature) - callArgs.push( - t.objectExpression([ - t.objectProperty(t.identifier('select'), selectExpr), - ]), - ); + // No arguments: pass { select } as the only param (ORM signature). + callArgs.push(castSelectWrapper(selectExpr)); } return t.callExpression( t.memberExpression( @@ -232,6 +247,21 @@ export function generateCustomCommand(op: CleanOperation, options?: CustomComman ); } + // Import the Variables type for this operation from the ORM query/mutation module. + // Custom operations define their own Variables types (e.g. CheckPasswordVariables) + // in the ORM layer. We import and cast CLI answers to this type for proper typing. + if (op.args.length > 0) { + const variablesTypeName = `${ucFirst(op.name)}Variables`; + // Commands are at cli/commands/xxx.ts (no target) or cli/commands/{target}/xxx.ts (with target). + // ORM query/mutation is at orm/{opKind}/ — two or three levels up from commands. + const ormOpPath = options?.targetName + ? `../../../orm/${opKind}` + : `../../orm/${opKind}`; + statements.push( + createImportDeclaration(ormOpPath, [variablesTypeName], true), + ); + } + const questionsArray = op.args.length > 0 ? buildQuestionsArray(op.args) @@ -325,11 +355,23 @@ export function generateCustomCommand(op: CleanOperation, options?: CustomComman ); } + // Cast args to the specific Variables type for this operation. + // The ORM expects typed variables (e.g. CheckPasswordVariables), and CLI + // prompt answers are Record. We cast through `unknown` + // first because Record doesn't directly overlap with + // Variables types that have specific property types (like `input: SomeInput`). + const variablesTypeName = `${ucFirst(op.name)}Variables`; const argsExpr = op.args.length > 0 - ? (hasInputObjectArg - ? t.identifier('parsedAnswers') - : t.identifier('answers')) + ? t.tsAsExpression( + t.tsAsExpression( + hasInputObjectArg + ? t.identifier('parsedAnswers') + : t.identifier('answers'), + t.tsUnknownKeyword(), + ), + t.tsTypeReference(t.identifier(variablesTypeName)), + ) : t.objectExpression([]); // For OBJECT return types, generate runtime select from --select flag @@ -345,7 +387,10 @@ export function generateCustomCommand(op: CleanOperation, options?: CustomComman t.callExpression(t.identifier('buildSelectFromPaths'), [ t.logicalExpression( '??', - t.memberExpression(t.identifier('argv'), t.identifier('select')), + t.tsAsExpression( + t.memberExpression(t.identifier('argv'), t.identifier('select')), + t.tsStringKeyword(), + ), t.stringLiteral(defaultSelect), ), ]), @@ -355,13 +400,34 @@ export function generateCustomCommand(op: CleanOperation, options?: CustomComman selectExpr = t.identifier('selectFields'); } + // Derive the Select type name from the operation's return type. + // e.g. CheckPasswordPayload → CheckPasswordPayloadSelect + // This is used to cast { select } to the proper type for StrictSelect. + let selectTypeName: string | undefined; + if (isObjectReturn) { + const baseReturnType = unwrapType(op.returnType); + if (baseReturnType.name) { + selectTypeName = `${baseReturnType.name}Select`; + } + } + + // Import the Select type from orm/input-types if we have one + if (selectTypeName) { + const inputTypesPath = options?.targetName + ? `../../../orm/input-types` + : `../../orm/input-types`; + statements.push( + createImportDeclaration(inputTypesPath, [selectTypeName], true), + ); + } + const hasArgs = op.args.length > 0; bodyStatements.push( t.variableDeclaration('const', [ t.variableDeclarator( t.identifier('result'), t.awaitExpression( - buildOrmCustomCall(opKind, op.name, argsExpr, selectExpr, hasArgs), + buildOrmCustomCall(opKind, op.name, argsExpr, selectExpr, hasArgs, selectTypeName), ), ), ]), diff --git a/graphql/codegen/src/core/codegen/cli/executor-generator.ts b/graphql/codegen/src/core/codegen/cli/executor-generator.ts index f82a478f3..50cfeb007 100644 --- a/graphql/codegen/src/core/codegen/cli/executor-generator.ts +++ b/graphql/codegen/src/core/codegen/cli/executor-generator.ts @@ -141,12 +141,24 @@ export function generateExecutorFile(toolName: string, options?: ExecutorOptions ]), ), - t.variableDeclaration('const', [ - t.variableDeclarator( - t.identifier('headers'), - t.objectExpression([]), - ), - ]), + (() => { + const headersId = t.identifier('headers'); + headersId.typeAnnotation = t.tsTypeAnnotation( + t.tsTypeReference( + t.identifier('Record'), + t.tsTypeParameterInstantiation([ + t.tsStringKeyword(), + t.tsStringKeyword(), + ]), + ), + ); + return t.variableDeclaration('const', [ + t.variableDeclarator( + headersId, + t.objectExpression([]), + ), + ]); + })(), t.ifStatement( t.callExpression( @@ -399,12 +411,24 @@ export function generateMultiTargetExecutorFile( ), ]), ), - t.variableDeclaration('const', [ - t.variableDeclarator( - t.identifier('headers'), - t.objectExpression([]), - ), - ]), + (() => { + const headersId = t.identifier('headers'); + headersId.typeAnnotation = t.tsTypeAnnotation( + t.tsTypeReference( + t.identifier('Record'), + t.tsTypeParameterInstantiation([ + t.tsStringKeyword(), + t.tsStringKeyword(), + ]), + ), + ); + return t.variableDeclaration('const', [ + t.variableDeclarator( + headersId, + t.objectExpression([]), + ), + ]); + })(), t.variableDeclaration('let', [ t.variableDeclarator(t.identifier('endpoint'), t.stringLiteral('')), ]), diff --git a/graphql/codegen/src/core/codegen/cli/infra-generator.ts b/graphql/codegen/src/core/codegen/cli/infra-generator.ts index dbfbf44bb..5e4195d3f 100644 --- a/graphql/codegen/src/core/codegen/cli/infra-generator.ts +++ b/graphql/codegen/src/core/codegen/cli/infra-generator.ts @@ -218,9 +218,12 @@ Create Options: ]), t.returnStatement( t.callExpression(t.identifier('handleSubcommand'), [ - t.memberExpression( - t.identifier('answer'), - t.identifier('subcommand'), + t.tsAsExpression( + t.memberExpression( + t.identifier('answer'), + t.identifier('subcommand'), + ), + t.tsStringKeyword(), ), t.identifier('newArgv'), t.identifier('prompter'), @@ -372,61 +375,73 @@ function buildCreateHandler(): t.FunctionDeclaration { t.variableDeclaration('const', [ t.variableDeclarator( t.identifier('answers'), - t.awaitExpression( - t.callExpression( - t.memberExpression( - t.identifier('prompter'), - t.identifier('prompt'), - ), - [ - t.objectExpression([ - t.objectProperty( - t.identifier('name'), - t.identifier('name'), - false, - true, + t.tsAsExpression( + t.tsAsExpression( + t.awaitExpression( + t.callExpression( + t.memberExpression( + t.identifier('prompter'), + t.identifier('prompt'), ), - t.spreadElement(t.identifier('restArgv')), - ]), - t.arrayExpression([ - t.objectExpression([ - t.objectProperty( - t.identifier('type'), - t.stringLiteral('text'), - ), - t.objectProperty( - t.identifier('name'), - t.stringLiteral('name'), - ), - t.objectProperty( - t.identifier('message'), - t.stringLiteral('Context name'), - ), - t.objectProperty( - t.identifier('required'), - t.booleanLiteral(true), - ), - ]), - t.objectExpression([ - t.objectProperty( - t.identifier('type'), - t.stringLiteral('text'), - ), - t.objectProperty( - t.identifier('name'), - t.stringLiteral('endpoint'), - ), - t.objectProperty( - t.identifier('message'), - t.stringLiteral('GraphQL endpoint URL'), - ), - t.objectProperty( - t.identifier('required'), - t.booleanLiteral(true), - ), - ]), - ]), - ], + [ + t.objectExpression([ + t.objectProperty( + t.identifier('name'), + t.identifier('name'), + false, + true, + ), + t.spreadElement(t.identifier('restArgv')), + ]), + t.arrayExpression([ + t.objectExpression([ + t.objectProperty( + t.identifier('type'), + t.stringLiteral('text'), + ), + t.objectProperty( + t.identifier('name'), + t.stringLiteral('name'), + ), + t.objectProperty( + t.identifier('message'), + t.stringLiteral('Context name'), + ), + t.objectProperty( + t.identifier('required'), + t.booleanLiteral(true), + ), + ]), + t.objectExpression([ + t.objectProperty( + t.identifier('type'), + t.stringLiteral('text'), + ), + t.objectProperty( + t.identifier('name'), + t.stringLiteral('endpoint'), + ), + t.objectProperty( + t.identifier('message'), + t.stringLiteral('GraphQL endpoint URL'), + ), + t.objectProperty( + t.identifier('required'), + t.booleanLiteral(true), + ), + ]), + ]), + ], + ), + ), + t.tsUnknownKeyword(), + ), + t.tsTypeReference( + t.identifier('Record'), + t.tsTypeParameterInstantiation([ + t.tsStringKeyword(), + t.tsStringKeyword(), + ]), ), ), ), @@ -841,9 +856,12 @@ function buildUseHandler(): t.FunctionDeclaration { t.assignmentExpression( '=', t.identifier('contextName'), - t.memberExpression( - t.identifier('answer'), - t.identifier('name'), + t.tsAsExpression( + t.memberExpression( + t.identifier('answer'), + t.identifier('name'), + ), + t.tsStringKeyword(), ), ), ), @@ -1176,9 +1194,12 @@ function buildDeleteHandler(): t.FunctionDeclaration { t.assignmentExpression( '=', t.identifier('contextName'), - t.memberExpression( - t.identifier('answer'), - t.identifier('name'), + t.tsAsExpression( + t.memberExpression( + t.identifier('answer'), + t.identifier('name'), + ), + t.tsStringKeyword(), ), ), ), @@ -1399,9 +1420,12 @@ Options: ]), t.returnStatement( t.callExpression(t.identifier('handleAuthSubcommand'), [ - t.memberExpression( - t.identifier('answer'), - t.identifier('subcommand'), + t.tsAsExpression( + t.memberExpression( + t.identifier('answer'), + t.identifier('subcommand'), + ), + t.tsStringKeyword(), ), t.identifier('newArgv'), t.identifier('prompter'), @@ -1620,9 +1644,12 @@ function buildSetTokenHandler(): t.FunctionDeclaration { t.assignmentExpression( '=', t.identifier('tokenValue'), - t.memberExpression( - t.identifier('answer'), - t.identifier('token'), + t.tsAsExpression( + t.memberExpression( + t.identifier('answer'), + t.identifier('token'), + ), + t.tsStringKeyword(), ), ), ), @@ -1969,9 +1996,12 @@ function buildLogoutHandler(): t.FunctionDeclaration { t.ifStatement( t.unaryExpression( '!', - t.memberExpression( - t.identifier('confirm'), - t.identifier('confirm'), + t.tsAsExpression( + t.memberExpression( + t.identifier('confirm'), + t.identifier('confirm'), + ), + t.tsBooleanKeyword(), ), ), t.blockStatement([t.returnStatement()]), @@ -2215,9 +2245,12 @@ ${targets.map((tgt) => ` --${tgt.name}-endpoint ${tgt.name} endpoint (de ]), t.returnStatement( t.callExpression(t.identifier('handleSubcommand'), [ - t.memberExpression( - t.identifier('answer'), - t.identifier('subcommand'), + t.tsAsExpression( + t.memberExpression( + t.identifier('answer'), + t.identifier('subcommand'), + ), + t.tsStringKeyword(), ), t.identifier('newArgv'), t.identifier('prompter'), @@ -2387,7 +2420,7 @@ function buildMultiTargetCreateHandler( t.objectExpression([ t.objectProperty( t.identifier('endpoint'), - t.memberExpression(t.identifier('answers'), t.identifier(fieldName)), + t.tsAsExpression(t.memberExpression(t.identifier('answers'), t.identifier(fieldName)), t.tsStringKeyword()), ), ]), ); @@ -2436,7 +2469,7 @@ function buildMultiTargetCreateHandler( t.variableDeclaration('const', [ t.variableDeclarator( t.identifier('contextName'), - t.memberExpression(t.identifier('answers'), t.identifier('name')), + t.tsAsExpression(t.memberExpression(t.identifier('answers'), t.identifier('name')), t.tsStringKeyword()), ), ]), t.variableDeclaration('const', [ @@ -2453,9 +2486,12 @@ function buildMultiTargetCreateHandler( t.objectExpression([ t.objectProperty( t.identifier('endpoint'), - t.memberExpression( - t.identifier('answers'), - t.identifier(`${targets[0].name}Endpoint`), + t.tsAsExpression( + t.memberExpression( + t.identifier('answers'), + t.identifier(`${targets[0].name}Endpoint`), + ), + t.tsStringKeyword(), ), ), t.objectProperty( @@ -2526,7 +2562,7 @@ function buildMultiTargetCreateHandler( t.templateElement({ raw: ` ${target.name}: `, cooked: ` ${target.name}: ` }), t.templateElement({ raw: '', cooked: '' }, true), ], - [t.memberExpression(t.identifier('answers'), t.identifier(fieldName))], + [t.tsAsExpression(t.memberExpression(t.identifier('answers'), t.identifier(fieldName)), t.tsStringKeyword())], ), ], ), @@ -2697,9 +2733,12 @@ Options: ]), t.returnStatement( t.callExpression(t.identifier('handleAuthSubcommand'), [ - t.memberExpression( - t.identifier('answer'), - t.identifier('subcommand'), + t.tsAsExpression( + t.memberExpression( + t.identifier('answer'), + t.identifier('subcommand'), + ), + t.tsStringKeyword(), ), t.identifier('newArgv'), t.identifier('prompter'), diff --git a/graphql/codegen/src/core/codegen/cli/table-command-generator.ts b/graphql/codegen/src/core/codegen/cli/table-command-generator.ts index e0acbf522..e6a151e16 100644 --- a/graphql/codegen/src/core/codegen/cli/table-command-generator.ts +++ b/graphql/codegen/src/core/codegen/cli/table-command-generator.ts @@ -8,10 +8,12 @@ import { getScalarFields, getTableNames, ucFirst, + lcFirst, + getCreateInputTypeName, + getPatchTypeName, } from '../utils'; import type { CleanTable, TypeRegistry } from '../../../types/schema'; import type { GeneratedFile } from './executor-generator'; -import { getCreateInputTypeName } from '../utils'; function createImportDeclaration( moduleSpecifier: string, @@ -34,6 +36,68 @@ function createImportDeclaration( * This is used at runtime for type coercion (string CLI args → proper types). * e.g., { name: 'string', isActive: 'boolean', position: 'int', status: 'enum' } */ +/** + * Returns a t.TSType node for the appropriate TypeScript type assertion + * based on a field's GraphQL type. Used to cast `cleanedData.fieldName` + * to the correct type expected by the ORM. + */ +/** + * Known GraphQL scalar types. Anything not in this set is an enum or custom type. + */ +const KNOWN_SCALARS = new Set([ + 'String', 'Boolean', 'Int', 'BigInt', 'Float', 'UUID', + 'JSON', 'GeoJSON', 'Datetime', 'Date', 'Time', 'Cursor', + 'BigFloat', 'Interval', +]); + +/** + * Returns true if the GraphQL type is a known scalar. + * Non-scalar types (enums, custom input types) need different handling. + */ +function isKnownScalar(gqlType: string): boolean { + return KNOWN_SCALARS.has(gqlType.replace(/!/g, '')); +} + +function getTsTypeForField(field: { type: { gqlType: string; isArray: boolean } }): t.TSType | null { + const gqlType = field.type.gqlType.replace(/!/g, ''); + + // For non-scalar types (enums, custom types), return null to signal + // that no type assertion should be emitted — the value will be passed + // without casting, which avoids "string is not assignable to EnumType" errors. + if (!isKnownScalar(gqlType)) { + return null; + } + + // Determine the base scalar type + // Note: ORM input types flatten array fields to their scalar base type + // (e.g., _uuid[] in PG -> string in the ORM input), so we do NOT wrap + // in tsArrayType here. + switch (gqlType) { + case 'Boolean': + return t.tsBooleanKeyword(); + case 'Int': + case 'BigInt': + case 'Float': + case 'BigFloat': + return t.tsNumberKeyword(); + case 'JSON': + case 'GeoJSON': + return t.tsTypeReference( + t.identifier('Record'), + t.tsTypeParameterInstantiation([ + t.tsStringKeyword(), + t.tsUnknownKeyword(), + ]), + ); + case 'Interval': + // IntervalInput is a complex type, skip assertion + return null; + case 'UUID': + default: + return t.tsStringKeyword(); + } +} + function buildFieldSchemaObject(table: CleanTable): t.ObjectExpression { const fields = getScalarFields(table); return t.objectExpression( @@ -281,10 +345,17 @@ function buildGetHandler(table: CleanTable, targetName?: string): t.FunctionDecl t.objectProperty(t.identifier('required'), t.booleanLiteral(true)), ]); + const pkTsType = pk.gqlType === 'Int' || pk.gqlType === 'BigInt' + ? t.tsNumberKeyword() + : t.tsStringKeyword(); + const ormArgs = t.objectExpression([ t.objectProperty( t.identifier(pk.name), - t.memberExpression(t.identifier('answers'), t.identifier(pk.name)), + t.tsAsExpression( + t.memberExpression(t.identifier('answers'), t.identifier(pk.name)), + pkTsType, + ), ), t.objectProperty(t.identifier('select'), selectObj), ]); @@ -340,6 +411,33 @@ function buildGetHandler(table: CleanTable, targetName?: string): t.FunctionDecl * Looks up the CreateXInput -> inner input type (e.g. DatabaseInput) in the * TypeRegistry and checks each field's defaultValue from introspection. */ +/** + * Resolve the inner input type from a CreateXInput or UpdateXInput type. + * The CreateXInput has an inner field (e.g. "database" of type DatabaseInput) + * that contains the actual field definitions. + */ +function resolveInnerInputType( + inputTypeName: string, + typeRegistry: TypeRegistry, +): { name: string; fields: Set } | null { + const inputType = typeRegistry.get(inputTypeName); + if (!inputType?.inputFields) return null; + + for (const inputField of inputType.inputFields) { + const innerTypeName = inputField.type.name + || inputField.type.ofType?.name + || inputField.type.ofType?.ofType?.name; + if (!innerTypeName) continue; + + const innerType = typeRegistry.get(innerTypeName); + if (!innerType?.inputFields) continue; + + const fields = new Set(innerType.inputFields.map((f) => f.name)); + return { name: innerTypeName, fields }; + } + return null; +} + function getFieldsWithDefaults( table: CleanTable, typeRegistry?: TypeRegistry, @@ -347,59 +445,79 @@ function getFieldsWithDefaults( const fieldsWithDefaults = new Set(); if (!typeRegistry) return fieldsWithDefaults; - // Look up the CreateXInput type (e.g. CreateDatabaseInput) const createInputTypeName = getCreateInputTypeName(table); - const createInputType = typeRegistry.get(createInputTypeName); - if (!createInputType?.inputFields) return fieldsWithDefaults; - - // The CreateXInput has an inner field (e.g. "database" of type DatabaseInput) - // Find the inner input type that contains the actual field definitions - for (const inputField of createInputType.inputFields) { - // The inner field's type name is the actual input type (e.g. DatabaseInput) - const innerTypeName = inputField.type.name - || inputField.type.ofType?.name - || inputField.type.ofType?.ofType?.name; - if (!innerTypeName) continue; + const resolved = resolveInnerInputType(createInputTypeName, typeRegistry); + if (!resolved) return fieldsWithDefaults; - const innerType = typeRegistry.get(innerTypeName); - if (!innerType?.inputFields) continue; + const innerType = typeRegistry.get(resolved.name); + if (!innerType?.inputFields) return fieldsWithDefaults; - // Check each field in the inner input type for defaultValue - for (const field of innerType.inputFields) { - if (field.defaultValue !== undefined) { - fieldsWithDefaults.add(field.name); - } - // Also check if the field is NOT wrapped in NON_NULL (nullable = has default or is optional) - if (field.type.kind !== 'NON_NULL') { - fieldsWithDefaults.add(field.name); - } + for (const field of innerType.inputFields) { + if (field.defaultValue !== undefined) { + fieldsWithDefaults.add(field.name); + } + if (field.type.kind !== 'NON_NULL') { + fieldsWithDefaults.add(field.name); } } return fieldsWithDefaults; } +/** + * Get the set of field names that actually exist in the create/update input type. + * Fields not in this set (e.g. computed fields like searchTsvRank, hashUuid) + * should be excluded from the data object in create/update handlers. + */ +function getWritableFieldNames( + table: CleanTable, + typeRegistry?: TypeRegistry, +): Set | null { + if (!typeRegistry) return null; + + const createInputTypeName = getCreateInputTypeName(table); + const resolved = resolveInnerInputType(createInputTypeName, typeRegistry); + return resolved?.fields ?? null; +} + function buildMutationHandler( table: CleanTable, operation: 'create' | 'update' | 'delete', targetName?: string, typeRegistry?: TypeRegistry, + ormTypes?: { createInputTypeName: string; innerFieldName: string; patchTypeName: string }, ): t.FunctionDeclaration { const { singularName } = getTableNames(table); const pkFields = getPrimaryKeyInfo(table); const pk = pkFields[0]; - const editableFields = getScalarFields(table).filter( - (f) => - f.name !== pk.name && - f.name !== 'nodeId' && - f.name !== 'createdAt' && - f.name !== 'updatedAt', - ); + // Get the set of writable field names from the type registry + // This filters out computed fields (e.g. searchTsvRank, hashUuid) that exist + // on the entity type but not on the create/update input type. + const writableFields = getWritableFieldNames(table, typeRegistry); // Get fields that have defaults from introspection (for create operations) const fieldsWithDefaults = getFieldsWithDefaults(table, typeRegistry); + // For create: include fields that are in the create input type. + // For update/delete: always exclude the PK (it goes in `where`, not `data`). + // The ORM input-types generator always excludes these fields from create inputs + // (see EXCLUDED_MUTATION_FIELDS in input-types-generator.ts). We must match this + // to avoid generating data properties that don't exist on the ORM create type. + // For non-'id' PKs (e.g. NodeTypeRegistry.name), we allow them in create data + // since they are user-provided natural keys that DO appear in the create input. + const ORM_EXCLUDED_FIELDS = ['id', 'createdAt', 'updatedAt', 'nodeId']; + const editableFields = getScalarFields(table).filter( + (f) => + // For update/delete: always exclude PK (it goes in `where`, not `data`) + // For create: exclude PK only if it's in the ORM exclusion list (e.g. 'id') + (f.name !== pk.name || (operation === 'create' && !ORM_EXCLUDED_FIELDS.includes(pk.name))) && + // Always exclude ORM-excluded fields (except PK which is handled above) + (f.name === pk.name || !ORM_EXCLUDED_FIELDS.includes(f.name)) && + // If we have type registry info, only include fields that exist in the input type + (writableFields === null || writableFields.has(f.name)), + ); + const questions: t.Expression[] = []; if (operation === 'update' || operation === 'delete') { @@ -447,28 +565,30 @@ function buildMutationHandler( let ormArgs: t.ObjectExpression; - if (operation === 'create') { - const dataProps = editableFields.map((f) => + // Build data properties without individual type assertions. + // Instead, we build a plain object from cleanedData and cast the entire + // data value through `unknown` to bridge the type gap between + // Record and the ORM's specific input type. + // This handles scalars, enums (string literal unions like ObjectCategory), + // and array fields uniformly without needing to import each type. + const buildDataProps = () => + editableFields.map((f) => t.objectProperty( t.identifier(f.name), t.memberExpression(t.identifier('cleanedData'), t.identifier(f.name)), - false, - true, ), ); + + + if (operation === 'create') { ormArgs = t.objectExpression([ - t.objectProperty(t.identifier('data'), t.objectExpression(dataProps)), + t.objectProperty( + t.identifier('data'), + t.objectExpression(buildDataProps()), + ), t.objectProperty(t.identifier('select'), selectObj), ]); } else if (operation === 'update') { - const dataProps = editableFields.map((f) => - t.objectProperty( - t.identifier(f.name), - t.memberExpression(t.identifier('cleanedData'), t.identifier(f.name)), - false, - true, - ), - ); ormArgs = t.objectExpression([ t.objectProperty( t.identifier('where'), @@ -477,12 +597,17 @@ function buildMutationHandler( t.identifier(pk.name), t.tsAsExpression( t.memberExpression(t.identifier('answers'), t.identifier(pk.name)), - t.tsStringKeyword(), + pk.gqlType === 'Int' || pk.gqlType === 'BigInt' + ? t.tsNumberKeyword() + : t.tsStringKeyword(), ), ), ]), ), - t.objectProperty(t.identifier('data'), t.objectExpression(dataProps)), + t.objectProperty( + t.identifier('data'), + t.objectExpression(buildDataProps()), + ), t.objectProperty(t.identifier('select'), selectObj), ]); } else { @@ -494,7 +619,9 @@ function buildMutationHandler( t.identifier(pk.name), t.tsAsExpression( t.memberExpression(t.identifier('answers'), t.identifier(pk.name)), - t.tsStringKeyword(), + pk.gqlType === 'Int' || pk.gqlType === 'BigInt' + ? t.tsNumberKeyword() + : t.tsStringKeyword(), ), ), ]), @@ -530,14 +657,38 @@ function buildMutationHandler( ]; if (operation !== 'delete') { + // Build stripUndefined call and cast to the proper ORM input type + // so that property accesses on cleanedData are correctly typed. + const stripUndefinedCall = t.callExpression(t.identifier('stripUndefined'), [ + t.identifier('answers'), + t.identifier('fieldSchema'), + ]); + + let cleanedDataExpr: t.Expression = stripUndefinedCall; + if (ormTypes) { + if (operation === 'create') { + // cleanedData as CreateXxxInput['fieldName'] + cleanedDataExpr = t.tsAsExpression( + stripUndefinedCall, + t.tsIndexedAccessType( + t.tsTypeReference(t.identifier(ormTypes.createInputTypeName)), + t.tsLiteralType(t.stringLiteral(ormTypes.innerFieldName)), + ), + ); + } else if (operation === 'update') { + // cleanedData as XxxPatch + cleanedDataExpr = t.tsAsExpression( + stripUndefinedCall, + t.tsTypeReference(t.identifier(ormTypes.patchTypeName)), + ); + } + } + tryBody.push( t.variableDeclaration('const', [ t.variableDeclarator( t.identifier('cleanedData'), - t.callExpression(t.identifier('stripUndefined'), [ - t.identifier('answers'), - t.identifier('fieldSchema'), - ]), + cleanedDataExpr, ), ]), ); @@ -607,18 +758,57 @@ export function generateTableCommand(table: CleanTable, options?: TableCommandOp statements.push( createImportDeclaration(utilsPath, ['coerceAnswers', 'stripUndefined']), ); + statements.push( + createImportDeclaration(utilsPath, ['FieldSchema'], true), + ); + + // Import ORM input types for proper type assertions in mutation handlers. + // These types ensure that cleanedData is cast to the correct ORM input type + // (e.g., CreateAppPermissionInput['appPermission'] for create, AppPermissionPatch for update) + // instead of remaining as Record. + const createInputTypeName = getCreateInputTypeName(table); + const patchTypeName = getPatchTypeName(table); + const innerFieldName = lcFirst(table.name); + // Commands are at cli/commands/xxx.ts (no target) or cli/commands/{target}/xxx.ts (with target). + // ORM input-types is at orm/input-types.ts — two or three levels up from commands. + const inputTypesPath = options?.targetName + ? `../../../orm/input-types` + : `../../orm/input-types`; + statements.push( + createImportDeclaration(inputTypesPath, [createInputTypeName, patchTypeName], true), + ); // Generate field schema for type coercion + // Use explicit FieldSchema type annotation so TS narrows string literals to FieldType + const fieldSchemaId = t.identifier('fieldSchema'); + fieldSchemaId.typeAnnotation = t.tsTypeAnnotation( + t.tsTypeReference(t.identifier('FieldSchema')), + ); statements.push( t.variableDeclaration('const', [ t.variableDeclarator( - t.identifier('fieldSchema'), + fieldSchemaId, buildFieldSchemaObject(table), ), ]), ); - const subcommands = ['list', 'get', 'create', 'update', 'delete']; + // Determine which operations the ORM model supports for this table. + // Most tables have `one: null` simply because there's no dedicated GraphQL + // findOne query, but the ORM still generates `findOne` using the PK. + // The only tables WITHOUT `findOne` are pure record types from SQL functions + // (e.g. GetAllRecord, OrgGetManagersRecord) which have no update/delete either. + // We detect these by checking: if one, update, AND delete are all null, it's a + // read-only record type with no `findOne`. + const hasUpdate = table.query?.update !== undefined && table.query?.update !== null; + const hasDelete = table.query?.delete !== undefined && table.query?.delete !== null; + const hasGet = table.query?.one !== null || hasUpdate || hasDelete; + + const subcommands: string[] = ['list']; + if (hasGet) subcommands.push('get'); + subcommands.push('create'); + if (hasUpdate) subcommands.push('update'); + if (hasDelete) subcommands.push('delete'); const usageLines = [ '', @@ -626,14 +816,12 @@ export function generateTableCommand(table: CleanTable, options?: TableCommandOp '', 'Commands:', ` list List all ${singularName} records`, - ` get Get a ${singularName} by ID`, - ` create Create a new ${singularName}`, - ` update Update an existing ${singularName}`, - ` delete Delete a ${singularName}`, - '', - ' --help, -h Show this help message', - '', ]; + if (hasGet) usageLines.push(` get Get a ${singularName} by ID`); + usageLines.push(` create Create a new ${singularName}`); + if (hasUpdate) usageLines.push(` update Update an existing ${singularName}`); + if (hasDelete) usageLines.push(` delete Delete a ${singularName}`); + usageLines.push('', ' --help, -h Show this help message', ''); statements.push( t.variableDeclaration('const', [ @@ -742,9 +930,12 @@ export function generateTableCommand(table: CleanTable, options?: TableCommandOp ]), t.returnStatement( t.callExpression(t.identifier('handleTableSubcommand'), [ - t.memberExpression( - t.identifier('answer'), - t.identifier('subcommand'), + t.tsAsExpression( + t.memberExpression( + t.identifier('answer'), + t.identifier('subcommand'), + ), + t.tsStringKeyword(), ), t.identifier('newArgv'), t.identifier('prompter'), @@ -793,11 +984,12 @@ export function generateTableCommand(table: CleanTable, options?: TableCommandOp ); const tn = options?.targetName; + const ormTypes = { createInputTypeName, patchTypeName, innerFieldName }; statements.push(buildListHandler(table, tn)); - statements.push(buildGetHandler(table, tn)); - statements.push(buildMutationHandler(table, 'create', tn, options?.typeRegistry)); - statements.push(buildMutationHandler(table, 'update', tn, options?.typeRegistry)); - statements.push(buildMutationHandler(table, 'delete', tn, options?.typeRegistry)); + if (hasGet) statements.push(buildGetHandler(table, tn)); + statements.push(buildMutationHandler(table, 'create', tn, options?.typeRegistry, ormTypes)); + if (hasUpdate) statements.push(buildMutationHandler(table, 'update', tn, options?.typeRegistry, ormTypes)); + if (hasDelete) statements.push(buildMutationHandler(table, 'delete', tn, options?.typeRegistry, ormTypes)); const header = getGeneratedFileHeader(`CLI commands for ${table.name}`); const code = generateCode(statements); diff --git a/sdk/constructive-cli/scripts/generate-sdk.ts b/sdk/constructive-cli/scripts/generate-sdk.ts index 40a37bb88..c2d892067 100644 --- a/sdk/constructive-cli/scripts/generate-sdk.ts +++ b/sdk/constructive-cli/scripts/generate-sdk.ts @@ -1,6 +1,3 @@ -import * as fs from 'fs'; -import * as path from 'path'; - import { generateMulti, expandSchemaDirToMultiTarget, @@ -73,45 +70,9 @@ async function main() { process.exit(1); } - // Post-generation: add // @ts-nocheck to generated CLI .ts files - // The CLI codegen templates have known type issues that need proper fixes upstream. - // For now, suppress TS errors in generated CLI code so the build passes. - const srcDir = path.resolve('./src'); - addTsNocheckToCliFiles(srcDir); - console.log('\nCLI SDK generation completed successfully!'); } -/** - * Recursively find all .ts files under cli/ directories and prepend // @ts-nocheck - * if they contain the codegen header marker. - */ -function addTsNocheckToCliFiles(dir: string): void { - const CODEGEN_MARKER = '@constructive-io/graphql-codegen'; - const TS_NOCHECK = '// @ts-nocheck\n'; - - function walk(currentDir: string): void { - for (const entry of fs.readdirSync(currentDir, { withFileTypes: true })) { - const fullPath = path.join(currentDir, entry.name); - if (entry.isDirectory()) { - walk(fullPath); - } else if (entry.isFile() && entry.name.endsWith('.ts')) { - // Only process files inside cli/ directories - const relative = path.relative(dir, fullPath); - if (!relative.includes(`cli${path.sep}`) && !relative.includes('cli/')) continue; - - const content = fs.readFileSync(fullPath, 'utf-8'); - if (content.includes(CODEGEN_MARKER) && !content.startsWith(TS_NOCHECK)) { - fs.writeFileSync(fullPath, TS_NOCHECK + content); - } - } - } - } - - walk(dir); - console.log('Added // @ts-nocheck to generated CLI files'); -} - main().catch((err) => { console.error('Fatal error:', err); process.exit(1); diff --git a/sdk/constructive-cli/src/admin/cli/commands.ts b/sdk/constructive-cli/src/admin/cli/commands.ts index 7866f7f98..75ae01229 100644 --- a/sdk/constructive-cli/src/admin/cli/commands.ts +++ b/sdk/constructive-cli/src/admin/cli/commands.ts @@ -1,4 +1,3 @@ -// @ts-nocheck /** * CLI command map and entry point * @generated by @constructive-io/graphql-codegen @@ -52,7 +51,14 @@ import orgPermissionsGetByMaskCmd from './commands/org-permissions-get-by-mask'; import stepsRequiredCmd from './commands/steps-required'; import submitInviteCodeCmd from './commands/submit-invite-code'; import submitOrgInviteCodeCmd from './commands/submit-org-invite-code'; -const createCommandMap = () => ({ +const createCommandMap: () => Record< + string, + ( + argv: Partial>, + prompter: Inquirerer, + options: CLIOptions + ) => Promise +> = () => ({ context: contextCmd, auth: authCmd, 'org-get-managers-record': orgGetManagersRecordCmd, @@ -123,7 +129,7 @@ export const commands = async ( options: Object.keys(commandMap), }, ]); - command = answer.command; + command = answer.command as string; } const commandFn = commandMap[command]; if (!commandFn) { diff --git a/sdk/constructive-cli/src/admin/cli/commands/app-achievement.ts b/sdk/constructive-cli/src/admin/cli/commands/app-achievement.ts index c9f60782f..442ae9bb8 100644 --- a/sdk/constructive-cli/src/admin/cli/commands/app-achievement.ts +++ b/sdk/constructive-cli/src/admin/cli/commands/app-achievement.ts @@ -1,4 +1,3 @@ -// @ts-nocheck /** * CLI commands for AppAchievement * @generated by @constructive-io/graphql-codegen @@ -7,7 +6,9 @@ import { CLIOptions, Inquirerer, extractFirst } from 'inquirerer'; import { getClient } from '../executor'; import { coerceAnswers, stripUndefined } from '../utils'; -const fieldSchema = { +import type { FieldSchema } from '../utils'; +import type { CreateAppAchievementInput, AppAchievementPatch } from '../../orm/input-types'; +const fieldSchema: FieldSchema = { id: 'uuid', actorId: 'uuid', name: 'string', @@ -36,7 +37,7 @@ export default async ( options: ['list', 'get', 'create', 'update', 'delete'], }, ]); - return handleTableSubcommand(answer.subcommand, newArgv, prompter); + return handleTableSubcommand(answer.subcommand as string, newArgv, prompter); } return handleTableSubcommand(subcommand, newArgv, prompter); }; @@ -98,7 +99,7 @@ async function handleGet(argv: Partial>, prompter: Inqui const client = getClient(); const result = await client.appAchievement .findOne({ - id: answers.id, + id: answers.id as string, select: { id: true, actorId: true, @@ -141,7 +142,10 @@ async function handleCreate(argv: Partial>, prompter: In }, ]); const answers = coerceAnswers(rawAnswers, fieldSchema); - const cleanedData = stripUndefined(answers, fieldSchema); + const cleanedData = stripUndefined( + answers, + fieldSchema + ) as CreateAppAchievementInput['appAchievement']; const client = getClient(); const result = await client.appAchievement .create({ @@ -198,7 +202,7 @@ async function handleUpdate(argv: Partial>, prompter: In }, ]); const answers = coerceAnswers(rawAnswers, fieldSchema); - const cleanedData = stripUndefined(answers, fieldSchema); + const cleanedData = stripUndefined(answers, fieldSchema) as AppAchievementPatch; const client = getClient(); const result = await client.appAchievement .update({ diff --git a/sdk/constructive-cli/src/admin/cli/commands/app-admin-grant.ts b/sdk/constructive-cli/src/admin/cli/commands/app-admin-grant.ts index a726576c7..4488c81b9 100644 --- a/sdk/constructive-cli/src/admin/cli/commands/app-admin-grant.ts +++ b/sdk/constructive-cli/src/admin/cli/commands/app-admin-grant.ts @@ -1,4 +1,3 @@ -// @ts-nocheck /** * CLI commands for AppAdminGrant * @generated by @constructive-io/graphql-codegen @@ -7,7 +6,9 @@ import { CLIOptions, Inquirerer, extractFirst } from 'inquirerer'; import { getClient } from '../executor'; import { coerceAnswers, stripUndefined } from '../utils'; -const fieldSchema = { +import type { FieldSchema } from '../utils'; +import type { CreateAppAdminGrantInput, AppAdminGrantPatch } from '../../orm/input-types'; +const fieldSchema: FieldSchema = { id: 'uuid', isGrant: 'boolean', actorId: 'uuid', @@ -36,7 +37,7 @@ export default async ( options: ['list', 'get', 'create', 'update', 'delete'], }, ]); - return handleTableSubcommand(answer.subcommand, newArgv, prompter); + return handleTableSubcommand(answer.subcommand as string, newArgv, prompter); } return handleTableSubcommand(subcommand, newArgv, prompter); }; @@ -98,7 +99,7 @@ async function handleGet(argv: Partial>, prompter: Inqui const client = getClient(); const result = await client.appAdminGrant .findOne({ - id: answers.id, + id: answers.id as string, select: { id: true, isGrant: true, @@ -141,7 +142,10 @@ async function handleCreate(argv: Partial>, prompter: In }, ]); const answers = coerceAnswers(rawAnswers, fieldSchema); - const cleanedData = stripUndefined(answers, fieldSchema); + const cleanedData = stripUndefined( + answers, + fieldSchema + ) as CreateAppAdminGrantInput['appAdminGrant']; const client = getClient(); const result = await client.appAdminGrant .create({ @@ -198,7 +202,7 @@ async function handleUpdate(argv: Partial>, prompter: In }, ]); const answers = coerceAnswers(rawAnswers, fieldSchema); - const cleanedData = stripUndefined(answers, fieldSchema); + const cleanedData = stripUndefined(answers, fieldSchema) as AppAdminGrantPatch; const client = getClient(); const result = await client.appAdminGrant .update({ diff --git a/sdk/constructive-cli/src/admin/cli/commands/app-grant.ts b/sdk/constructive-cli/src/admin/cli/commands/app-grant.ts index db7616f3c..29bb697c7 100644 --- a/sdk/constructive-cli/src/admin/cli/commands/app-grant.ts +++ b/sdk/constructive-cli/src/admin/cli/commands/app-grant.ts @@ -1,4 +1,3 @@ -// @ts-nocheck /** * CLI commands for AppGrant * @generated by @constructive-io/graphql-codegen @@ -7,7 +6,9 @@ import { CLIOptions, Inquirerer, extractFirst } from 'inquirerer'; import { getClient } from '../executor'; import { coerceAnswers, stripUndefined } from '../utils'; -const fieldSchema = { +import type { FieldSchema } from '../utils'; +import type { CreateAppGrantInput, AppGrantPatch } from '../../orm/input-types'; +const fieldSchema: FieldSchema = { id: 'uuid', permissions: 'string', isGrant: 'boolean', @@ -37,7 +38,7 @@ export default async ( options: ['list', 'get', 'create', 'update', 'delete'], }, ]); - return handleTableSubcommand(answer.subcommand, newArgv, prompter); + return handleTableSubcommand(answer.subcommand as string, newArgv, prompter); } return handleTableSubcommand(subcommand, newArgv, prompter); }; @@ -100,7 +101,7 @@ async function handleGet(argv: Partial>, prompter: Inqui const client = getClient(); const result = await client.appGrant .findOne({ - id: answers.id, + id: answers.id as string, select: { id: true, permissions: true, @@ -150,7 +151,7 @@ async function handleCreate(argv: Partial>, prompter: In }, ]); const answers = coerceAnswers(rawAnswers, fieldSchema); - const cleanedData = stripUndefined(answers, fieldSchema); + const cleanedData = stripUndefined(answers, fieldSchema) as CreateAppGrantInput['appGrant']; const client = getClient(); const result = await client.appGrant .create({ @@ -215,7 +216,7 @@ async function handleUpdate(argv: Partial>, prompter: In }, ]); const answers = coerceAnswers(rawAnswers, fieldSchema); - const cleanedData = stripUndefined(answers, fieldSchema); + const cleanedData = stripUndefined(answers, fieldSchema) as AppGrantPatch; const client = getClient(); const result = await client.appGrant .update({ diff --git a/sdk/constructive-cli/src/admin/cli/commands/app-level-requirement.ts b/sdk/constructive-cli/src/admin/cli/commands/app-level-requirement.ts index 2ed21da3d..cd90d6655 100644 --- a/sdk/constructive-cli/src/admin/cli/commands/app-level-requirement.ts +++ b/sdk/constructive-cli/src/admin/cli/commands/app-level-requirement.ts @@ -1,4 +1,3 @@ -// @ts-nocheck /** * CLI commands for AppLevelRequirement * @generated by @constructive-io/graphql-codegen @@ -7,7 +6,12 @@ import { CLIOptions, Inquirerer, extractFirst } from 'inquirerer'; import { getClient } from '../executor'; import { coerceAnswers, stripUndefined } from '../utils'; -const fieldSchema = { +import type { FieldSchema } from '../utils'; +import type { + CreateAppLevelRequirementInput, + AppLevelRequirementPatch, +} from '../../orm/input-types'; +const fieldSchema: FieldSchema = { id: 'uuid', name: 'string', level: 'string', @@ -38,7 +42,7 @@ export default async ( options: ['list', 'get', 'create', 'update', 'delete'], }, ]); - return handleTableSubcommand(answer.subcommand, newArgv, prompter); + return handleTableSubcommand(answer.subcommand as string, newArgv, prompter); } return handleTableSubcommand(subcommand, newArgv, prompter); }; @@ -102,7 +106,7 @@ async function handleGet(argv: Partial>, prompter: Inqui const client = getClient(); const result = await client.appLevelRequirement .findOne({ - id: answers.id, + id: answers.id as string, select: { id: true, name: true, @@ -159,7 +163,10 @@ async function handleCreate(argv: Partial>, prompter: In }, ]); const answers = coerceAnswers(rawAnswers, fieldSchema); - const cleanedData = stripUndefined(answers, fieldSchema); + const cleanedData = stripUndefined( + answers, + fieldSchema + ) as CreateAppLevelRequirementInput['appLevelRequirement']; const client = getClient(); const result = await client.appLevelRequirement .create({ @@ -232,7 +239,7 @@ async function handleUpdate(argv: Partial>, prompter: In }, ]); const answers = coerceAnswers(rawAnswers, fieldSchema); - const cleanedData = stripUndefined(answers, fieldSchema); + const cleanedData = stripUndefined(answers, fieldSchema) as AppLevelRequirementPatch; const client = getClient(); const result = await client.appLevelRequirement .update({ diff --git a/sdk/constructive-cli/src/admin/cli/commands/app-level.ts b/sdk/constructive-cli/src/admin/cli/commands/app-level.ts index 52f600deb..ada9f7e9f 100644 --- a/sdk/constructive-cli/src/admin/cli/commands/app-level.ts +++ b/sdk/constructive-cli/src/admin/cli/commands/app-level.ts @@ -1,4 +1,3 @@ -// @ts-nocheck /** * CLI commands for AppLevel * @generated by @constructive-io/graphql-codegen @@ -7,7 +6,9 @@ import { CLIOptions, Inquirerer, extractFirst } from 'inquirerer'; import { getClient } from '../executor'; import { coerceAnswers, stripUndefined } from '../utils'; -const fieldSchema = { +import type { FieldSchema } from '../utils'; +import type { CreateAppLevelInput, AppLevelPatch } from '../../orm/input-types'; +const fieldSchema: FieldSchema = { id: 'uuid', name: 'string', description: 'string', @@ -37,7 +38,7 @@ export default async ( options: ['list', 'get', 'create', 'update', 'delete'], }, ]); - return handleTableSubcommand(answer.subcommand, newArgv, prompter); + return handleTableSubcommand(answer.subcommand as string, newArgv, prompter); } return handleTableSubcommand(subcommand, newArgv, prompter); }; @@ -100,7 +101,7 @@ async function handleGet(argv: Partial>, prompter: Inqui const client = getClient(); const result = await client.appLevel .findOne({ - id: answers.id, + id: answers.id as string, select: { id: true, name: true, @@ -150,7 +151,7 @@ async function handleCreate(argv: Partial>, prompter: In }, ]); const answers = coerceAnswers(rawAnswers, fieldSchema); - const cleanedData = stripUndefined(answers, fieldSchema); + const cleanedData = stripUndefined(answers, fieldSchema) as CreateAppLevelInput['appLevel']; const client = getClient(); const result = await client.appLevel .create({ @@ -215,7 +216,7 @@ async function handleUpdate(argv: Partial>, prompter: In }, ]); const answers = coerceAnswers(rawAnswers, fieldSchema); - const cleanedData = stripUndefined(answers, fieldSchema); + const cleanedData = stripUndefined(answers, fieldSchema) as AppLevelPatch; const client = getClient(); const result = await client.appLevel .update({ diff --git a/sdk/constructive-cli/src/admin/cli/commands/app-limit-default.ts b/sdk/constructive-cli/src/admin/cli/commands/app-limit-default.ts index f86ae0cf2..9987aceca 100644 --- a/sdk/constructive-cli/src/admin/cli/commands/app-limit-default.ts +++ b/sdk/constructive-cli/src/admin/cli/commands/app-limit-default.ts @@ -1,4 +1,3 @@ -// @ts-nocheck /** * CLI commands for AppLimitDefault * @generated by @constructive-io/graphql-codegen @@ -7,7 +6,9 @@ import { CLIOptions, Inquirerer, extractFirst } from 'inquirerer'; import { getClient } from '../executor'; import { coerceAnswers, stripUndefined } from '../utils'; -const fieldSchema = { +import type { FieldSchema } from '../utils'; +import type { CreateAppLimitDefaultInput, AppLimitDefaultPatch } from '../../orm/input-types'; +const fieldSchema: FieldSchema = { id: 'uuid', name: 'string', max: 'int', @@ -33,7 +34,7 @@ export default async ( options: ['list', 'get', 'create', 'update', 'delete'], }, ]); - return handleTableSubcommand(answer.subcommand, newArgv, prompter); + return handleTableSubcommand(answer.subcommand as string, newArgv, prompter); } return handleTableSubcommand(subcommand, newArgv, prompter); }; @@ -92,7 +93,7 @@ async function handleGet(argv: Partial>, prompter: Inqui const client = getClient(); const result = await client.appLimitDefault .findOne({ - id: answers.id, + id: answers.id as string, select: { id: true, name: true, @@ -126,7 +127,10 @@ async function handleCreate(argv: Partial>, prompter: In }, ]); const answers = coerceAnswers(rawAnswers, fieldSchema); - const cleanedData = stripUndefined(answers, fieldSchema); + const cleanedData = stripUndefined( + answers, + fieldSchema + ) as CreateAppLimitDefaultInput['appLimitDefault']; const client = getClient(); const result = await client.appLimitDefault .create({ @@ -173,7 +177,7 @@ async function handleUpdate(argv: Partial>, prompter: In }, ]); const answers = coerceAnswers(rawAnswers, fieldSchema); - const cleanedData = stripUndefined(answers, fieldSchema); + const cleanedData = stripUndefined(answers, fieldSchema) as AppLimitDefaultPatch; const client = getClient(); const result = await client.appLimitDefault .update({ diff --git a/sdk/constructive-cli/src/admin/cli/commands/app-limit.ts b/sdk/constructive-cli/src/admin/cli/commands/app-limit.ts index 8ab281f2e..9fd7858b4 100644 --- a/sdk/constructive-cli/src/admin/cli/commands/app-limit.ts +++ b/sdk/constructive-cli/src/admin/cli/commands/app-limit.ts @@ -1,4 +1,3 @@ -// @ts-nocheck /** * CLI commands for AppLimit * @generated by @constructive-io/graphql-codegen @@ -7,7 +6,9 @@ import { CLIOptions, Inquirerer, extractFirst } from 'inquirerer'; import { getClient } from '../executor'; import { coerceAnswers, stripUndefined } from '../utils'; -const fieldSchema = { +import type { FieldSchema } from '../utils'; +import type { CreateAppLimitInput, AppLimitPatch } from '../../orm/input-types'; +const fieldSchema: FieldSchema = { id: 'uuid', name: 'string', actorId: 'uuid', @@ -35,7 +36,7 @@ export default async ( options: ['list', 'get', 'create', 'update', 'delete'], }, ]); - return handleTableSubcommand(answer.subcommand, newArgv, prompter); + return handleTableSubcommand(answer.subcommand as string, newArgv, prompter); } return handleTableSubcommand(subcommand, newArgv, prompter); }; @@ -96,7 +97,7 @@ async function handleGet(argv: Partial>, prompter: Inqui const client = getClient(); const result = await client.appLimit .findOne({ - id: answers.id, + id: answers.id as string, select: { id: true, name: true, @@ -144,7 +145,7 @@ async function handleCreate(argv: Partial>, prompter: In }, ]); const answers = coerceAnswers(rawAnswers, fieldSchema); - const cleanedData = stripUndefined(answers, fieldSchema); + const cleanedData = stripUndefined(answers, fieldSchema) as CreateAppLimitInput['appLimit']; const client = getClient(); const result = await client.appLimit .create({ @@ -207,7 +208,7 @@ async function handleUpdate(argv: Partial>, prompter: In }, ]); const answers = coerceAnswers(rawAnswers, fieldSchema); - const cleanedData = stripUndefined(answers, fieldSchema); + const cleanedData = stripUndefined(answers, fieldSchema) as AppLimitPatch; const client = getClient(); const result = await client.appLimit .update({ diff --git a/sdk/constructive-cli/src/admin/cli/commands/app-membership-default.ts b/sdk/constructive-cli/src/admin/cli/commands/app-membership-default.ts index df43b7d1f..7149c842f 100644 --- a/sdk/constructive-cli/src/admin/cli/commands/app-membership-default.ts +++ b/sdk/constructive-cli/src/admin/cli/commands/app-membership-default.ts @@ -1,4 +1,3 @@ -// @ts-nocheck /** * CLI commands for AppMembershipDefault * @generated by @constructive-io/graphql-codegen @@ -7,7 +6,12 @@ import { CLIOptions, Inquirerer, extractFirst } from 'inquirerer'; import { getClient } from '../executor'; import { coerceAnswers, stripUndefined } from '../utils'; -const fieldSchema = { +import type { FieldSchema } from '../utils'; +import type { + CreateAppMembershipDefaultInput, + AppMembershipDefaultPatch, +} from '../../orm/input-types'; +const fieldSchema: FieldSchema = { id: 'uuid', createdAt: 'string', updatedAt: 'string', @@ -37,7 +41,7 @@ export default async ( options: ['list', 'get', 'create', 'update', 'delete'], }, ]); - return handleTableSubcommand(answer.subcommand, newArgv, prompter); + return handleTableSubcommand(answer.subcommand as string, newArgv, prompter); } return handleTableSubcommand(subcommand, newArgv, prompter); }; @@ -100,7 +104,7 @@ async function handleGet(argv: Partial>, prompter: Inqui const client = getClient(); const result = await client.appMembershipDefault .findOne({ - id: answers.id, + id: answers.id as string, select: { id: true, createdAt: true, @@ -150,7 +154,10 @@ async function handleCreate(argv: Partial>, prompter: In }, ]); const answers = coerceAnswers(rawAnswers, fieldSchema); - const cleanedData = stripUndefined(answers, fieldSchema); + const cleanedData = stripUndefined( + answers, + fieldSchema + ) as CreateAppMembershipDefaultInput['appMembershipDefault']; const client = getClient(); const result = await client.appMembershipDefault .create({ @@ -215,7 +222,7 @@ async function handleUpdate(argv: Partial>, prompter: In }, ]); const answers = coerceAnswers(rawAnswers, fieldSchema); - const cleanedData = stripUndefined(answers, fieldSchema); + const cleanedData = stripUndefined(answers, fieldSchema) as AppMembershipDefaultPatch; const client = getClient(); const result = await client.appMembershipDefault .update({ diff --git a/sdk/constructive-cli/src/admin/cli/commands/app-membership.ts b/sdk/constructive-cli/src/admin/cli/commands/app-membership.ts index 40a35b966..307a40f1c 100644 --- a/sdk/constructive-cli/src/admin/cli/commands/app-membership.ts +++ b/sdk/constructive-cli/src/admin/cli/commands/app-membership.ts @@ -1,4 +1,3 @@ -// @ts-nocheck /** * CLI commands for AppMembership * @generated by @constructive-io/graphql-codegen @@ -7,7 +6,9 @@ import { CLIOptions, Inquirerer, extractFirst } from 'inquirerer'; import { getClient } from '../executor'; import { coerceAnswers, stripUndefined } from '../utils'; -const fieldSchema = { +import type { FieldSchema } from '../utils'; +import type { CreateAppMembershipInput, AppMembershipPatch } from '../../orm/input-types'; +const fieldSchema: FieldSchema = { id: 'uuid', createdAt: 'string', updatedAt: 'string', @@ -46,7 +47,7 @@ export default async ( options: ['list', 'get', 'create', 'update', 'delete'], }, ]); - return handleTableSubcommand(answer.subcommand, newArgv, prompter); + return handleTableSubcommand(answer.subcommand as string, newArgv, prompter); } return handleTableSubcommand(subcommand, newArgv, prompter); }; @@ -118,7 +119,7 @@ async function handleGet(argv: Partial>, prompter: Inqui const client = getClient(); const result = await client.appMembership .findOne({ - id: answers.id, + id: answers.id as string, select: { id: true, createdAt: true, @@ -231,7 +232,10 @@ async function handleCreate(argv: Partial>, prompter: In }, ]); const answers = coerceAnswers(rawAnswers, fieldSchema); - const cleanedData = stripUndefined(answers, fieldSchema); + const cleanedData = stripUndefined( + answers, + fieldSchema + ) as CreateAppMembershipInput['appMembership']; const client = getClient(); const result = await client.appMembership .create({ @@ -368,7 +372,7 @@ async function handleUpdate(argv: Partial>, prompter: In }, ]); const answers = coerceAnswers(rawAnswers, fieldSchema); - const cleanedData = stripUndefined(answers, fieldSchema); + const cleanedData = stripUndefined(answers, fieldSchema) as AppMembershipPatch; const client = getClient(); const result = await client.appMembership .update({ diff --git a/sdk/constructive-cli/src/admin/cli/commands/app-owner-grant.ts b/sdk/constructive-cli/src/admin/cli/commands/app-owner-grant.ts index a9fce8358..fab8a6c5f 100644 --- a/sdk/constructive-cli/src/admin/cli/commands/app-owner-grant.ts +++ b/sdk/constructive-cli/src/admin/cli/commands/app-owner-grant.ts @@ -1,4 +1,3 @@ -// @ts-nocheck /** * CLI commands for AppOwnerGrant * @generated by @constructive-io/graphql-codegen @@ -7,7 +6,9 @@ import { CLIOptions, Inquirerer, extractFirst } from 'inquirerer'; import { getClient } from '../executor'; import { coerceAnswers, stripUndefined } from '../utils'; -const fieldSchema = { +import type { FieldSchema } from '../utils'; +import type { CreateAppOwnerGrantInput, AppOwnerGrantPatch } from '../../orm/input-types'; +const fieldSchema: FieldSchema = { id: 'uuid', isGrant: 'boolean', actorId: 'uuid', @@ -36,7 +37,7 @@ export default async ( options: ['list', 'get', 'create', 'update', 'delete'], }, ]); - return handleTableSubcommand(answer.subcommand, newArgv, prompter); + return handleTableSubcommand(answer.subcommand as string, newArgv, prompter); } return handleTableSubcommand(subcommand, newArgv, prompter); }; @@ -98,7 +99,7 @@ async function handleGet(argv: Partial>, prompter: Inqui const client = getClient(); const result = await client.appOwnerGrant .findOne({ - id: answers.id, + id: answers.id as string, select: { id: true, isGrant: true, @@ -141,7 +142,10 @@ async function handleCreate(argv: Partial>, prompter: In }, ]); const answers = coerceAnswers(rawAnswers, fieldSchema); - const cleanedData = stripUndefined(answers, fieldSchema); + const cleanedData = stripUndefined( + answers, + fieldSchema + ) as CreateAppOwnerGrantInput['appOwnerGrant']; const client = getClient(); const result = await client.appOwnerGrant .create({ @@ -198,7 +202,7 @@ async function handleUpdate(argv: Partial>, prompter: In }, ]); const answers = coerceAnswers(rawAnswers, fieldSchema); - const cleanedData = stripUndefined(answers, fieldSchema); + const cleanedData = stripUndefined(answers, fieldSchema) as AppOwnerGrantPatch; const client = getClient(); const result = await client.appOwnerGrant .update({ diff --git a/sdk/constructive-cli/src/admin/cli/commands/app-permission-default.ts b/sdk/constructive-cli/src/admin/cli/commands/app-permission-default.ts index 50b80cc1e..6953061cb 100644 --- a/sdk/constructive-cli/src/admin/cli/commands/app-permission-default.ts +++ b/sdk/constructive-cli/src/admin/cli/commands/app-permission-default.ts @@ -1,4 +1,3 @@ -// @ts-nocheck /** * CLI commands for AppPermissionDefault * @generated by @constructive-io/graphql-codegen @@ -7,7 +6,12 @@ import { CLIOptions, Inquirerer, extractFirst } from 'inquirerer'; import { getClient } from '../executor'; import { coerceAnswers, stripUndefined } from '../utils'; -const fieldSchema = { +import type { FieldSchema } from '../utils'; +import type { + CreateAppPermissionDefaultInput, + AppPermissionDefaultPatch, +} from '../../orm/input-types'; +const fieldSchema: FieldSchema = { id: 'uuid', permissions: 'string', }; @@ -32,7 +36,7 @@ export default async ( options: ['list', 'get', 'create', 'update', 'delete'], }, ]); - return handleTableSubcommand(answer.subcommand, newArgv, prompter); + return handleTableSubcommand(answer.subcommand as string, newArgv, prompter); } return handleTableSubcommand(subcommand, newArgv, prompter); }; @@ -90,7 +94,7 @@ async function handleGet(argv: Partial>, prompter: Inqui const client = getClient(); const result = await client.appPermissionDefault .findOne({ - id: answers.id, + id: answers.id as string, select: { id: true, permissions: true, @@ -117,7 +121,10 @@ async function handleCreate(argv: Partial>, prompter: In }, ]); const answers = coerceAnswers(rawAnswers, fieldSchema); - const cleanedData = stripUndefined(answers, fieldSchema); + const cleanedData = stripUndefined( + answers, + fieldSchema + ) as CreateAppPermissionDefaultInput['appPermissionDefault']; const client = getClient(); const result = await client.appPermissionDefault .create({ @@ -156,7 +163,7 @@ async function handleUpdate(argv: Partial>, prompter: In }, ]); const answers = coerceAnswers(rawAnswers, fieldSchema); - const cleanedData = stripUndefined(answers, fieldSchema); + const cleanedData = stripUndefined(answers, fieldSchema) as AppPermissionDefaultPatch; const client = getClient(); const result = await client.appPermissionDefault .update({ diff --git a/sdk/constructive-cli/src/admin/cli/commands/app-permission.ts b/sdk/constructive-cli/src/admin/cli/commands/app-permission.ts index 1b2b2a10e..881addd75 100644 --- a/sdk/constructive-cli/src/admin/cli/commands/app-permission.ts +++ b/sdk/constructive-cli/src/admin/cli/commands/app-permission.ts @@ -1,4 +1,3 @@ -// @ts-nocheck /** * CLI commands for AppPermission * @generated by @constructive-io/graphql-codegen @@ -7,7 +6,9 @@ import { CLIOptions, Inquirerer, extractFirst } from 'inquirerer'; import { getClient } from '../executor'; import { coerceAnswers, stripUndefined } from '../utils'; -const fieldSchema = { +import type { FieldSchema } from '../utils'; +import type { CreateAppPermissionInput, AppPermissionPatch } from '../../orm/input-types'; +const fieldSchema: FieldSchema = { id: 'uuid', name: 'string', bitnum: 'int', @@ -35,7 +36,7 @@ export default async ( options: ['list', 'get', 'create', 'update', 'delete'], }, ]); - return handleTableSubcommand(answer.subcommand, newArgv, prompter); + return handleTableSubcommand(answer.subcommand as string, newArgv, prompter); } return handleTableSubcommand(subcommand, newArgv, prompter); }; @@ -96,7 +97,7 @@ async function handleGet(argv: Partial>, prompter: Inqui const client = getClient(); const result = await client.appPermission .findOne({ - id: answers.id, + id: answers.id as string, select: { id: true, name: true, @@ -144,7 +145,10 @@ async function handleCreate(argv: Partial>, prompter: In }, ]); const answers = coerceAnswers(rawAnswers, fieldSchema); - const cleanedData = stripUndefined(answers, fieldSchema); + const cleanedData = stripUndefined( + answers, + fieldSchema + ) as CreateAppPermissionInput['appPermission']; const client = getClient(); const result = await client.appPermission .create({ @@ -207,7 +211,7 @@ async function handleUpdate(argv: Partial>, prompter: In }, ]); const answers = coerceAnswers(rawAnswers, fieldSchema); - const cleanedData = stripUndefined(answers, fieldSchema); + const cleanedData = stripUndefined(answers, fieldSchema) as AppPermissionPatch; const client = getClient(); const result = await client.appPermission .update({ diff --git a/sdk/constructive-cli/src/admin/cli/commands/app-permissions-get-by-mask.ts b/sdk/constructive-cli/src/admin/cli/commands/app-permissions-get-by-mask.ts index 52ce91ab6..b467acc7f 100644 --- a/sdk/constructive-cli/src/admin/cli/commands/app-permissions-get-by-mask.ts +++ b/sdk/constructive-cli/src/admin/cli/commands/app-permissions-get-by-mask.ts @@ -1,4 +1,3 @@ -// @ts-nocheck /** * CLI command for query appPermissionsGetByMask * @generated by @constructive-io/graphql-codegen @@ -7,6 +6,8 @@ import { CLIOptions, Inquirerer } from 'inquirerer'; import { getClient } from '../executor'; import { buildSelectFromPaths } from '../utils'; +import type { AppPermissionsGetByMaskVariables } from '../../orm/query'; +import type { AppPermissionConnectionSelect } from '../../orm/input-types'; export default async ( argv: Partial>, prompter: Inquirerer, @@ -43,11 +44,16 @@ export default async ( }, ]); const client = getClient(); - const selectFields = buildSelectFromPaths(argv.select ?? ''); + const selectFields = buildSelectFromPaths((argv.select as string) ?? ''); const result = await client.query - .appPermissionsGetByMask(answers, { - select: selectFields, - }) + .appPermissionsGetByMask( + answers as unknown as AppPermissionsGetByMaskVariables, + { + select: selectFields, + } as unknown as { + select: AppPermissionConnectionSelect; + } + ) .execute(); console.log(JSON.stringify(result, null, 2)); } catch (error) { diff --git a/sdk/constructive-cli/src/admin/cli/commands/app-permissions-get-mask-by-names.ts b/sdk/constructive-cli/src/admin/cli/commands/app-permissions-get-mask-by-names.ts index 693bae1a2..2b9494ddd 100644 --- a/sdk/constructive-cli/src/admin/cli/commands/app-permissions-get-mask-by-names.ts +++ b/sdk/constructive-cli/src/admin/cli/commands/app-permissions-get-mask-by-names.ts @@ -1,4 +1,3 @@ -// @ts-nocheck /** * CLI command for query appPermissionsGetMaskByNames * @generated by @constructive-io/graphql-codegen @@ -6,6 +5,7 @@ */ import { CLIOptions, Inquirerer } from 'inquirerer'; import { getClient } from '../executor'; +import type { AppPermissionsGetMaskByNamesVariables } from '../../orm/query'; export default async ( argv: Partial>, prompter: Inquirerer, @@ -26,7 +26,9 @@ export default async ( }, ]); const client = getClient(); - const result = await client.query.appPermissionsGetMaskByNames(answers).execute(); + const result = await client.query + .appPermissionsGetMaskByNames(answers as unknown as AppPermissionsGetMaskByNamesVariables) + .execute(); console.log(JSON.stringify(result, null, 2)); } catch (error) { console.error('Failed: appPermissionsGetMaskByNames'); diff --git a/sdk/constructive-cli/src/admin/cli/commands/app-permissions-get-mask.ts b/sdk/constructive-cli/src/admin/cli/commands/app-permissions-get-mask.ts index 60838c45e..f40cf3607 100644 --- a/sdk/constructive-cli/src/admin/cli/commands/app-permissions-get-mask.ts +++ b/sdk/constructive-cli/src/admin/cli/commands/app-permissions-get-mask.ts @@ -1,4 +1,3 @@ -// @ts-nocheck /** * CLI command for query appPermissionsGetMask * @generated by @constructive-io/graphql-codegen @@ -6,6 +5,7 @@ */ import { CLIOptions, Inquirerer } from 'inquirerer'; import { getClient } from '../executor'; +import type { AppPermissionsGetMaskVariables } from '../../orm/query'; export default async ( argv: Partial>, prompter: Inquirerer, @@ -26,7 +26,9 @@ export default async ( }, ]); const client = getClient(); - const result = await client.query.appPermissionsGetMask(answers).execute(); + const result = await client.query + .appPermissionsGetMask(answers as unknown as AppPermissionsGetMaskVariables) + .execute(); console.log(JSON.stringify(result, null, 2)); } catch (error) { console.error('Failed: appPermissionsGetMask'); diff --git a/sdk/constructive-cli/src/admin/cli/commands/app-permissions-get-padded-mask.ts b/sdk/constructive-cli/src/admin/cli/commands/app-permissions-get-padded-mask.ts index e671b931b..afa2fbc4c 100644 --- a/sdk/constructive-cli/src/admin/cli/commands/app-permissions-get-padded-mask.ts +++ b/sdk/constructive-cli/src/admin/cli/commands/app-permissions-get-padded-mask.ts @@ -1,4 +1,3 @@ -// @ts-nocheck /** * CLI command for query appPermissionsGetPaddedMask * @generated by @constructive-io/graphql-codegen @@ -6,6 +5,7 @@ */ import { CLIOptions, Inquirerer } from 'inquirerer'; import { getClient } from '../executor'; +import type { AppPermissionsGetPaddedMaskVariables } from '../../orm/query'; export default async ( argv: Partial>, prompter: Inquirerer, @@ -26,7 +26,9 @@ export default async ( }, ]); const client = getClient(); - const result = await client.query.appPermissionsGetPaddedMask(answers).execute(); + const result = await client.query + .appPermissionsGetPaddedMask(answers as unknown as AppPermissionsGetPaddedMaskVariables) + .execute(); console.log(JSON.stringify(result, null, 2)); } catch (error) { console.error('Failed: appPermissionsGetPaddedMask'); diff --git a/sdk/constructive-cli/src/admin/cli/commands/app-step.ts b/sdk/constructive-cli/src/admin/cli/commands/app-step.ts index ad0efff93..ee68a01de 100644 --- a/sdk/constructive-cli/src/admin/cli/commands/app-step.ts +++ b/sdk/constructive-cli/src/admin/cli/commands/app-step.ts @@ -1,4 +1,3 @@ -// @ts-nocheck /** * CLI commands for AppStep * @generated by @constructive-io/graphql-codegen @@ -7,7 +6,9 @@ import { CLIOptions, Inquirerer, extractFirst } from 'inquirerer'; import { getClient } from '../executor'; import { coerceAnswers, stripUndefined } from '../utils'; -const fieldSchema = { +import type { FieldSchema } from '../utils'; +import type { CreateAppStepInput, AppStepPatch } from '../../orm/input-types'; +const fieldSchema: FieldSchema = { id: 'uuid', actorId: 'uuid', name: 'string', @@ -36,7 +37,7 @@ export default async ( options: ['list', 'get', 'create', 'update', 'delete'], }, ]); - return handleTableSubcommand(answer.subcommand, newArgv, prompter); + return handleTableSubcommand(answer.subcommand as string, newArgv, prompter); } return handleTableSubcommand(subcommand, newArgv, prompter); }; @@ -98,7 +99,7 @@ async function handleGet(argv: Partial>, prompter: Inqui const client = getClient(); const result = await client.appStep .findOne({ - id: answers.id, + id: answers.id as string, select: { id: true, actorId: true, @@ -141,7 +142,7 @@ async function handleCreate(argv: Partial>, prompter: In }, ]); const answers = coerceAnswers(rawAnswers, fieldSchema); - const cleanedData = stripUndefined(answers, fieldSchema); + const cleanedData = stripUndefined(answers, fieldSchema) as CreateAppStepInput['appStep']; const client = getClient(); const result = await client.appStep .create({ @@ -198,7 +199,7 @@ async function handleUpdate(argv: Partial>, prompter: In }, ]); const answers = coerceAnswers(rawAnswers, fieldSchema); - const cleanedData = stripUndefined(answers, fieldSchema); + const cleanedData = stripUndefined(answers, fieldSchema) as AppStepPatch; const client = getClient(); const result = await client.appStep .update({ diff --git a/sdk/constructive-cli/src/admin/cli/commands/auth.ts b/sdk/constructive-cli/src/admin/cli/commands/auth.ts index 1bfe7085c..c731ba27c 100644 --- a/sdk/constructive-cli/src/admin/cli/commands/auth.ts +++ b/sdk/constructive-cli/src/admin/cli/commands/auth.ts @@ -1,4 +1,3 @@ -// @ts-nocheck /** * Authentication commands * @generated by @constructive-io/graphql-codegen @@ -28,7 +27,7 @@ export default async ( options: ['set-token', 'status', 'logout'], }, ]); - return handleAuthSubcommand(answer.subcommand, newArgv, prompter, store); + return handleAuthSubcommand(answer.subcommand as string, newArgv, prompter, store); } return handleAuthSubcommand(subcommand, newArgv, prompter, store); }; @@ -71,7 +70,7 @@ async function handleSetToken( required: true, }, ]); - tokenValue = answer.token; + tokenValue = answer.token as string; } store.setCredentials(current.name, { token: String(tokenValue || '').trim(), @@ -112,7 +111,7 @@ async function handleLogout( default: false, }, ]); - if (!confirm.confirm) { + if (!(confirm.confirm as boolean)) { return; } if (store.removeCredentials(current.name)) { diff --git a/sdk/constructive-cli/src/admin/cli/commands/claimed-invite.ts b/sdk/constructive-cli/src/admin/cli/commands/claimed-invite.ts index 1437b21bd..d8505e958 100644 --- a/sdk/constructive-cli/src/admin/cli/commands/claimed-invite.ts +++ b/sdk/constructive-cli/src/admin/cli/commands/claimed-invite.ts @@ -1,4 +1,3 @@ -// @ts-nocheck /** * CLI commands for ClaimedInvite * @generated by @constructive-io/graphql-codegen @@ -7,7 +6,9 @@ import { CLIOptions, Inquirerer, extractFirst } from 'inquirerer'; import { getClient } from '../executor'; import { coerceAnswers, stripUndefined } from '../utils'; -const fieldSchema = { +import type { FieldSchema } from '../utils'; +import type { CreateClaimedInviteInput, ClaimedInvitePatch } from '../../orm/input-types'; +const fieldSchema: FieldSchema = { id: 'uuid', data: 'json', senderId: 'uuid', @@ -36,7 +37,7 @@ export default async ( options: ['list', 'get', 'create', 'update', 'delete'], }, ]); - return handleTableSubcommand(answer.subcommand, newArgv, prompter); + return handleTableSubcommand(answer.subcommand as string, newArgv, prompter); } return handleTableSubcommand(subcommand, newArgv, prompter); }; @@ -98,7 +99,7 @@ async function handleGet(argv: Partial>, prompter: Inqui const client = getClient(); const result = await client.claimedInvite .findOne({ - id: answers.id, + id: answers.id as string, select: { id: true, data: true, @@ -141,7 +142,10 @@ async function handleCreate(argv: Partial>, prompter: In }, ]); const answers = coerceAnswers(rawAnswers, fieldSchema); - const cleanedData = stripUndefined(answers, fieldSchema); + const cleanedData = stripUndefined( + answers, + fieldSchema + ) as CreateClaimedInviteInput['claimedInvite']; const client = getClient(); const result = await client.claimedInvite .create({ @@ -198,7 +202,7 @@ async function handleUpdate(argv: Partial>, prompter: In }, ]); const answers = coerceAnswers(rawAnswers, fieldSchema); - const cleanedData = stripUndefined(answers, fieldSchema); + const cleanedData = stripUndefined(answers, fieldSchema) as ClaimedInvitePatch; const client = getClient(); const result = await client.claimedInvite .update({ diff --git a/sdk/constructive-cli/src/admin/cli/commands/context.ts b/sdk/constructive-cli/src/admin/cli/commands/context.ts index 7f8262bb6..52d12c666 100644 --- a/sdk/constructive-cli/src/admin/cli/commands/context.ts +++ b/sdk/constructive-cli/src/admin/cli/commands/context.ts @@ -1,4 +1,3 @@ -// @ts-nocheck /** * Context management commands * @generated by @constructive-io/graphql-codegen @@ -28,7 +27,7 @@ export default async ( options: ['create', 'list', 'use', 'current', 'delete'], }, ]); - return handleSubcommand(answer.subcommand, newArgv, prompter, store); + return handleSubcommand(answer.subcommand as string, newArgv, prompter, store); } return handleSubcommand(subcommand, newArgv, prompter, store); }; @@ -60,7 +59,7 @@ async function handleCreate( store: ReturnType ) { const { first: name, newArgv: restArgv } = extractFirst(argv); - const answers = await prompter.prompt( + const answers = (await prompter.prompt( { name, ...restArgv, @@ -79,7 +78,7 @@ async function handleCreate( required: true, }, ] - ); + )) as unknown as Record; const contextName = answers.name; const endpoint = answers.endpoint; store.createContext(contextName, { @@ -128,7 +127,7 @@ async function handleUse( options: contexts.map((c) => c.name), }, ]); - contextName = answer.name; + contextName = answer.name as string; } if (store.setCurrentContext(contextName)) { console.log(`Switched to context: ${contextName}`); @@ -169,7 +168,7 @@ async function handleDelete( options: contexts.map((c) => c.name), }, ]); - contextName = answer.name; + contextName = answer.name as string; } if (store.deleteContext(contextName)) { console.log(`Deleted context: ${contextName}`); diff --git a/sdk/constructive-cli/src/admin/cli/commands/invite.ts b/sdk/constructive-cli/src/admin/cli/commands/invite.ts index ea2018a28..79a3c92b6 100644 --- a/sdk/constructive-cli/src/admin/cli/commands/invite.ts +++ b/sdk/constructive-cli/src/admin/cli/commands/invite.ts @@ -1,4 +1,3 @@ -// @ts-nocheck /** * CLI commands for Invite * @generated by @constructive-io/graphql-codegen @@ -7,7 +6,9 @@ import { CLIOptions, Inquirerer, extractFirst } from 'inquirerer'; import { getClient } from '../executor'; import { coerceAnswers, stripUndefined } from '../utils'; -const fieldSchema = { +import type { FieldSchema } from '../utils'; +import type { CreateInviteInput, InvitePatch } from '../../orm/input-types'; +const fieldSchema: FieldSchema = { id: 'uuid', email: 'string', senderId: 'uuid', @@ -42,7 +43,7 @@ export default async ( options: ['list', 'get', 'create', 'update', 'delete'], }, ]); - return handleTableSubcommand(answer.subcommand, newArgv, prompter); + return handleTableSubcommand(answer.subcommand as string, newArgv, prompter); } return handleTableSubcommand(subcommand, newArgv, prompter); }; @@ -110,7 +111,7 @@ async function handleGet(argv: Partial>, prompter: Inqui const client = getClient(); const result = await client.invite .findOne({ - id: answers.id, + id: answers.id as string, select: { id: true, email: true, @@ -195,7 +196,7 @@ async function handleCreate(argv: Partial>, prompter: In }, ]); const answers = coerceAnswers(rawAnswers, fieldSchema); - const cleanedData = stripUndefined(answers, fieldSchema); + const cleanedData = stripUndefined(answers, fieldSchema) as CreateInviteInput['invite']; const client = getClient(); const result = await client.invite .create({ @@ -300,7 +301,7 @@ async function handleUpdate(argv: Partial>, prompter: In }, ]); const answers = coerceAnswers(rawAnswers, fieldSchema); - const cleanedData = stripUndefined(answers, fieldSchema); + const cleanedData = stripUndefined(answers, fieldSchema) as InvitePatch; const client = getClient(); const result = await client.invite .update({ diff --git a/sdk/constructive-cli/src/admin/cli/commands/membership-type.ts b/sdk/constructive-cli/src/admin/cli/commands/membership-type.ts index 83f9ebc34..118aade21 100644 --- a/sdk/constructive-cli/src/admin/cli/commands/membership-type.ts +++ b/sdk/constructive-cli/src/admin/cli/commands/membership-type.ts @@ -1,4 +1,3 @@ -// @ts-nocheck /** * CLI commands for MembershipType * @generated by @constructive-io/graphql-codegen @@ -7,7 +6,9 @@ import { CLIOptions, Inquirerer, extractFirst } from 'inquirerer'; import { getClient } from '../executor'; import { coerceAnswers, stripUndefined } from '../utils'; -const fieldSchema = { +import type { FieldSchema } from '../utils'; +import type { CreateMembershipTypeInput, MembershipTypePatch } from '../../orm/input-types'; +const fieldSchema: FieldSchema = { id: 'int', name: 'string', description: 'string', @@ -34,7 +35,7 @@ export default async ( options: ['list', 'get', 'create', 'update', 'delete'], }, ]); - return handleTableSubcommand(answer.subcommand, newArgv, prompter); + return handleTableSubcommand(answer.subcommand as string, newArgv, prompter); } return handleTableSubcommand(subcommand, newArgv, prompter); }; @@ -94,7 +95,7 @@ async function handleGet(argv: Partial>, prompter: Inqui const client = getClient(); const result = await client.membershipType .findOne({ - id: answers.id, + id: answers.id as number, select: { id: true, name: true, @@ -135,7 +136,10 @@ async function handleCreate(argv: Partial>, prompter: In }, ]); const answers = coerceAnswers(rawAnswers, fieldSchema); - const cleanedData = stripUndefined(answers, fieldSchema); + const cleanedData = stripUndefined( + answers, + fieldSchema + ) as CreateMembershipTypeInput['membershipType']; const client = getClient(); const result = await client.membershipType .create({ @@ -190,12 +194,12 @@ async function handleUpdate(argv: Partial>, prompter: In }, ]); const answers = coerceAnswers(rawAnswers, fieldSchema); - const cleanedData = stripUndefined(answers, fieldSchema); + const cleanedData = stripUndefined(answers, fieldSchema) as MembershipTypePatch; const client = getClient(); const result = await client.membershipType .update({ where: { - id: answers.id as string, + id: answers.id as number, }, data: { name: cleanedData.name, @@ -234,7 +238,7 @@ async function handleDelete(argv: Partial>, prompter: In const result = await client.membershipType .delete({ where: { - id: answers.id as string, + id: answers.id as number, }, select: { id: true, diff --git a/sdk/constructive-cli/src/admin/cli/commands/org-admin-grant.ts b/sdk/constructive-cli/src/admin/cli/commands/org-admin-grant.ts index c640b79e7..5684dbda8 100644 --- a/sdk/constructive-cli/src/admin/cli/commands/org-admin-grant.ts +++ b/sdk/constructive-cli/src/admin/cli/commands/org-admin-grant.ts @@ -1,4 +1,3 @@ -// @ts-nocheck /** * CLI commands for OrgAdminGrant * @generated by @constructive-io/graphql-codegen @@ -7,7 +6,9 @@ import { CLIOptions, Inquirerer, extractFirst } from 'inquirerer'; import { getClient } from '../executor'; import { coerceAnswers, stripUndefined } from '../utils'; -const fieldSchema = { +import type { FieldSchema } from '../utils'; +import type { CreateOrgAdminGrantInput, OrgAdminGrantPatch } from '../../orm/input-types'; +const fieldSchema: FieldSchema = { id: 'uuid', isGrant: 'boolean', actorId: 'uuid', @@ -37,7 +38,7 @@ export default async ( options: ['list', 'get', 'create', 'update', 'delete'], }, ]); - return handleTableSubcommand(answer.subcommand, newArgv, prompter); + return handleTableSubcommand(answer.subcommand as string, newArgv, prompter); } return handleTableSubcommand(subcommand, newArgv, prompter); }; @@ -100,7 +101,7 @@ async function handleGet(argv: Partial>, prompter: Inqui const client = getClient(); const result = await client.orgAdminGrant .findOne({ - id: answers.id, + id: answers.id as string, select: { id: true, isGrant: true, @@ -150,7 +151,10 @@ async function handleCreate(argv: Partial>, prompter: In }, ]); const answers = coerceAnswers(rawAnswers, fieldSchema); - const cleanedData = stripUndefined(answers, fieldSchema); + const cleanedData = stripUndefined( + answers, + fieldSchema + ) as CreateOrgAdminGrantInput['orgAdminGrant']; const client = getClient(); const result = await client.orgAdminGrant .create({ @@ -215,7 +219,7 @@ async function handleUpdate(argv: Partial>, prompter: In }, ]); const answers = coerceAnswers(rawAnswers, fieldSchema); - const cleanedData = stripUndefined(answers, fieldSchema); + const cleanedData = stripUndefined(answers, fieldSchema) as OrgAdminGrantPatch; const client = getClient(); const result = await client.orgAdminGrant .update({ diff --git a/sdk/constructive-cli/src/admin/cli/commands/org-chart-edge-grant.ts b/sdk/constructive-cli/src/admin/cli/commands/org-chart-edge-grant.ts index 8b9f5154b..c8063f861 100644 --- a/sdk/constructive-cli/src/admin/cli/commands/org-chart-edge-grant.ts +++ b/sdk/constructive-cli/src/admin/cli/commands/org-chart-edge-grant.ts @@ -1,4 +1,3 @@ -// @ts-nocheck /** * CLI commands for OrgChartEdgeGrant * @generated by @constructive-io/graphql-codegen @@ -7,7 +6,9 @@ import { CLIOptions, Inquirerer, extractFirst } from 'inquirerer'; import { getClient } from '../executor'; import { coerceAnswers, stripUndefined } from '../utils'; -const fieldSchema = { +import type { FieldSchema } from '../utils'; +import type { CreateOrgChartEdgeGrantInput, OrgChartEdgeGrantPatch } from '../../orm/input-types'; +const fieldSchema: FieldSchema = { id: 'uuid', entityId: 'uuid', childId: 'uuid', @@ -39,7 +40,7 @@ export default async ( options: ['list', 'get', 'create', 'update', 'delete'], }, ]); - return handleTableSubcommand(answer.subcommand, newArgv, prompter); + return handleTableSubcommand(answer.subcommand as string, newArgv, prompter); } return handleTableSubcommand(subcommand, newArgv, prompter); }; @@ -104,7 +105,7 @@ async function handleGet(argv: Partial>, prompter: Inqui const client = getClient(); const result = await client.orgChartEdgeGrant .findOne({ - id: answers.id, + id: answers.id as string, select: { id: true, entityId: true, @@ -174,7 +175,10 @@ async function handleCreate(argv: Partial>, prompter: In }, ]); const answers = coerceAnswers(rawAnswers, fieldSchema); - const cleanedData = stripUndefined(answers, fieldSchema); + const cleanedData = stripUndefined( + answers, + fieldSchema + ) as CreateOrgChartEdgeGrantInput['orgChartEdgeGrant']; const client = getClient(); const result = await client.orgChartEdgeGrant .create({ @@ -262,7 +266,7 @@ async function handleUpdate(argv: Partial>, prompter: In }, ]); const answers = coerceAnswers(rawAnswers, fieldSchema); - const cleanedData = stripUndefined(answers, fieldSchema); + const cleanedData = stripUndefined(answers, fieldSchema) as OrgChartEdgeGrantPatch; const client = getClient(); const result = await client.orgChartEdgeGrant .update({ diff --git a/sdk/constructive-cli/src/admin/cli/commands/org-chart-edge.ts b/sdk/constructive-cli/src/admin/cli/commands/org-chart-edge.ts index 123135e1a..546a094e1 100644 --- a/sdk/constructive-cli/src/admin/cli/commands/org-chart-edge.ts +++ b/sdk/constructive-cli/src/admin/cli/commands/org-chart-edge.ts @@ -1,4 +1,3 @@ -// @ts-nocheck /** * CLI commands for OrgChartEdge * @generated by @constructive-io/graphql-codegen @@ -7,7 +6,9 @@ import { CLIOptions, Inquirerer, extractFirst } from 'inquirerer'; import { getClient } from '../executor'; import { coerceAnswers, stripUndefined } from '../utils'; -const fieldSchema = { +import type { FieldSchema } from '../utils'; +import type { CreateOrgChartEdgeInput, OrgChartEdgePatch } from '../../orm/input-types'; +const fieldSchema: FieldSchema = { id: 'uuid', createdAt: 'string', updatedAt: 'string', @@ -38,7 +39,7 @@ export default async ( options: ['list', 'get', 'create', 'update', 'delete'], }, ]); - return handleTableSubcommand(answer.subcommand, newArgv, prompter); + return handleTableSubcommand(answer.subcommand as string, newArgv, prompter); } return handleTableSubcommand(subcommand, newArgv, prompter); }; @@ -102,7 +103,7 @@ async function handleGet(argv: Partial>, prompter: Inqui const client = getClient(); const result = await client.orgChartEdge .findOne({ - id: answers.id, + id: answers.id as string, select: { id: true, createdAt: true, @@ -159,7 +160,10 @@ async function handleCreate(argv: Partial>, prompter: In }, ]); const answers = coerceAnswers(rawAnswers, fieldSchema); - const cleanedData = stripUndefined(answers, fieldSchema); + const cleanedData = stripUndefined( + answers, + fieldSchema + ) as CreateOrgChartEdgeInput['orgChartEdge']; const client = getClient(); const result = await client.orgChartEdge .create({ @@ -232,7 +236,7 @@ async function handleUpdate(argv: Partial>, prompter: In }, ]); const answers = coerceAnswers(rawAnswers, fieldSchema); - const cleanedData = stripUndefined(answers, fieldSchema); + const cleanedData = stripUndefined(answers, fieldSchema) as OrgChartEdgePatch; const client = getClient(); const result = await client.orgChartEdge .update({ diff --git a/sdk/constructive-cli/src/admin/cli/commands/org-claimed-invite.ts b/sdk/constructive-cli/src/admin/cli/commands/org-claimed-invite.ts index b6b7f07f0..96231ab87 100644 --- a/sdk/constructive-cli/src/admin/cli/commands/org-claimed-invite.ts +++ b/sdk/constructive-cli/src/admin/cli/commands/org-claimed-invite.ts @@ -1,4 +1,3 @@ -// @ts-nocheck /** * CLI commands for OrgClaimedInvite * @generated by @constructive-io/graphql-codegen @@ -7,7 +6,9 @@ import { CLIOptions, Inquirerer, extractFirst } from 'inquirerer'; import { getClient } from '../executor'; import { coerceAnswers, stripUndefined } from '../utils'; -const fieldSchema = { +import type { FieldSchema } from '../utils'; +import type { CreateOrgClaimedInviteInput, OrgClaimedInvitePatch } from '../../orm/input-types'; +const fieldSchema: FieldSchema = { id: 'uuid', data: 'json', senderId: 'uuid', @@ -37,7 +38,7 @@ export default async ( options: ['list', 'get', 'create', 'update', 'delete'], }, ]); - return handleTableSubcommand(answer.subcommand, newArgv, prompter); + return handleTableSubcommand(answer.subcommand as string, newArgv, prompter); } return handleTableSubcommand(subcommand, newArgv, prompter); }; @@ -100,7 +101,7 @@ async function handleGet(argv: Partial>, prompter: Inqui const client = getClient(); const result = await client.orgClaimedInvite .findOne({ - id: answers.id, + id: answers.id as string, select: { id: true, data: true, @@ -150,7 +151,10 @@ async function handleCreate(argv: Partial>, prompter: In }, ]); const answers = coerceAnswers(rawAnswers, fieldSchema); - const cleanedData = stripUndefined(answers, fieldSchema); + const cleanedData = stripUndefined( + answers, + fieldSchema + ) as CreateOrgClaimedInviteInput['orgClaimedInvite']; const client = getClient(); const result = await client.orgClaimedInvite .create({ @@ -215,7 +219,7 @@ async function handleUpdate(argv: Partial>, prompter: In }, ]); const answers = coerceAnswers(rawAnswers, fieldSchema); - const cleanedData = stripUndefined(answers, fieldSchema); + const cleanedData = stripUndefined(answers, fieldSchema) as OrgClaimedInvitePatch; const client = getClient(); const result = await client.orgClaimedInvite .update({ diff --git a/sdk/constructive-cli/src/admin/cli/commands/org-get-managers-record.ts b/sdk/constructive-cli/src/admin/cli/commands/org-get-managers-record.ts index bbc4577ce..665a15560 100644 --- a/sdk/constructive-cli/src/admin/cli/commands/org-get-managers-record.ts +++ b/sdk/constructive-cli/src/admin/cli/commands/org-get-managers-record.ts @@ -1,4 +1,3 @@ -// @ts-nocheck /** * CLI commands for OrgGetManagersRecord * @generated by @constructive-io/graphql-codegen @@ -7,12 +6,17 @@ import { CLIOptions, Inquirerer, extractFirst } from 'inquirerer'; import { getClient } from '../executor'; import { coerceAnswers, stripUndefined } from '../utils'; -const fieldSchema = { +import type { FieldSchema } from '../utils'; +import type { + CreateOrgGetManagersRecordInput, + OrgGetManagersRecordPatch, +} from '../../orm/input-types'; +const fieldSchema: FieldSchema = { userId: 'uuid', depth: 'int', }; const usage = - '\norg-get-managers-record \n\nCommands:\n list List all orgGetManagersRecord records\n get Get a orgGetManagersRecord by ID\n create Create a new orgGetManagersRecord\n update Update an existing orgGetManagersRecord\n delete Delete a orgGetManagersRecord\n\n --help, -h Show this help message\n'; + '\norg-get-managers-record \n\nCommands:\n list List all orgGetManagersRecord records\n create Create a new orgGetManagersRecord\n\n --help, -h Show this help message\n'; export default async ( argv: Partial>, prompter: Inquirerer, @@ -29,10 +33,10 @@ export default async ( type: 'autocomplete', name: 'subcommand', message: 'What do you want to do?', - options: ['list', 'get', 'create', 'update', 'delete'], + options: ['list', 'create'], }, ]); - return handleTableSubcommand(answer.subcommand, newArgv, prompter); + return handleTableSubcommand(answer.subcommand as string, newArgv, prompter); } return handleTableSubcommand(subcommand, newArgv, prompter); }; @@ -44,14 +48,8 @@ async function handleTableSubcommand( switch (subcommand) { case 'list': return handleList(argv, prompter); - case 'get': - return handleGet(argv, prompter); case 'create': return handleCreate(argv, prompter); - case 'update': - return handleUpdate(argv, prompter); - case 'delete': - return handleDelete(argv, prompter); default: console.log(usage); process.exit(1); @@ -77,35 +75,6 @@ async function handleList(_argv: Partial>, _prompter: In process.exit(1); } } -async function handleGet(argv: Partial>, prompter: Inquirerer) { - try { - const answers = await prompter.prompt(argv, [ - { - type: 'text', - name: 'id', - message: 'id', - required: true, - }, - ]); - const client = getClient(); - const result = await client.orgGetManagersRecord - .findOne({ - id: answers.id, - select: { - userId: true, - depth: true, - }, - }) - .execute(); - console.log(JSON.stringify(result, null, 2)); - } catch (error) { - console.error('Record not found.'); - if (error instanceof Error) { - console.error(error.message); - } - process.exit(1); - } -} async function handleCreate(argv: Partial>, prompter: Inquirerer) { try { const rawAnswers = await prompter.prompt(argv, [ @@ -123,7 +92,10 @@ async function handleCreate(argv: Partial>, prompter: In }, ]); const answers = coerceAnswers(rawAnswers, fieldSchema); - const cleanedData = stripUndefined(answers, fieldSchema); + const cleanedData = stripUndefined( + answers, + fieldSchema + ) as CreateOrgGetManagersRecordInput['orgGetManagersRecord']; const client = getClient(); const result = await client.orgGetManagersRecord .create({ @@ -146,83 +118,3 @@ async function handleCreate(argv: Partial>, prompter: In process.exit(1); } } -async function handleUpdate(argv: Partial>, prompter: Inquirerer) { - try { - const rawAnswers = await prompter.prompt(argv, [ - { - type: 'text', - name: 'id', - message: 'id', - required: true, - }, - { - type: 'text', - name: 'userId', - message: 'userId', - required: false, - }, - { - type: 'text', - name: 'depth', - message: 'depth', - required: false, - }, - ]); - const answers = coerceAnswers(rawAnswers, fieldSchema); - const cleanedData = stripUndefined(answers, fieldSchema); - const client = getClient(); - const result = await client.orgGetManagersRecord - .update({ - where: { - id: answers.id as string, - }, - data: { - userId: cleanedData.userId, - depth: cleanedData.depth, - }, - select: { - userId: true, - depth: true, - }, - }) - .execute(); - console.log(JSON.stringify(result, null, 2)); - } catch (error) { - console.error('Failed to update record.'); - if (error instanceof Error) { - console.error(error.message); - } - process.exit(1); - } -} -async function handleDelete(argv: Partial>, prompter: Inquirerer) { - try { - const rawAnswers = await prompter.prompt(argv, [ - { - type: 'text', - name: 'id', - message: 'id', - required: true, - }, - ]); - const answers = coerceAnswers(rawAnswers, fieldSchema); - const client = getClient(); - const result = await client.orgGetManagersRecord - .delete({ - where: { - id: answers.id as string, - }, - select: { - id: true, - }, - }) - .execute(); - console.log(JSON.stringify(result, null, 2)); - } catch (error) { - console.error('Failed to delete record.'); - if (error instanceof Error) { - console.error(error.message); - } - process.exit(1); - } -} diff --git a/sdk/constructive-cli/src/admin/cli/commands/org-get-subordinates-record.ts b/sdk/constructive-cli/src/admin/cli/commands/org-get-subordinates-record.ts index 1bf7ab95c..3bcb09aca 100644 --- a/sdk/constructive-cli/src/admin/cli/commands/org-get-subordinates-record.ts +++ b/sdk/constructive-cli/src/admin/cli/commands/org-get-subordinates-record.ts @@ -1,4 +1,3 @@ -// @ts-nocheck /** * CLI commands for OrgGetSubordinatesRecord * @generated by @constructive-io/graphql-codegen @@ -7,12 +6,17 @@ import { CLIOptions, Inquirerer, extractFirst } from 'inquirerer'; import { getClient } from '../executor'; import { coerceAnswers, stripUndefined } from '../utils'; -const fieldSchema = { +import type { FieldSchema } from '../utils'; +import type { + CreateOrgGetSubordinatesRecordInput, + OrgGetSubordinatesRecordPatch, +} from '../../orm/input-types'; +const fieldSchema: FieldSchema = { userId: 'uuid', depth: 'int', }; const usage = - '\norg-get-subordinates-record \n\nCommands:\n list List all orgGetSubordinatesRecord records\n get Get a orgGetSubordinatesRecord by ID\n create Create a new orgGetSubordinatesRecord\n update Update an existing orgGetSubordinatesRecord\n delete Delete a orgGetSubordinatesRecord\n\n --help, -h Show this help message\n'; + '\norg-get-subordinates-record \n\nCommands:\n list List all orgGetSubordinatesRecord records\n create Create a new orgGetSubordinatesRecord\n\n --help, -h Show this help message\n'; export default async ( argv: Partial>, prompter: Inquirerer, @@ -29,10 +33,10 @@ export default async ( type: 'autocomplete', name: 'subcommand', message: 'What do you want to do?', - options: ['list', 'get', 'create', 'update', 'delete'], + options: ['list', 'create'], }, ]); - return handleTableSubcommand(answer.subcommand, newArgv, prompter); + return handleTableSubcommand(answer.subcommand as string, newArgv, prompter); } return handleTableSubcommand(subcommand, newArgv, prompter); }; @@ -44,14 +48,8 @@ async function handleTableSubcommand( switch (subcommand) { case 'list': return handleList(argv, prompter); - case 'get': - return handleGet(argv, prompter); case 'create': return handleCreate(argv, prompter); - case 'update': - return handleUpdate(argv, prompter); - case 'delete': - return handleDelete(argv, prompter); default: console.log(usage); process.exit(1); @@ -77,35 +75,6 @@ async function handleList(_argv: Partial>, _prompter: In process.exit(1); } } -async function handleGet(argv: Partial>, prompter: Inquirerer) { - try { - const answers = await prompter.prompt(argv, [ - { - type: 'text', - name: 'id', - message: 'id', - required: true, - }, - ]); - const client = getClient(); - const result = await client.orgGetSubordinatesRecord - .findOne({ - id: answers.id, - select: { - userId: true, - depth: true, - }, - }) - .execute(); - console.log(JSON.stringify(result, null, 2)); - } catch (error) { - console.error('Record not found.'); - if (error instanceof Error) { - console.error(error.message); - } - process.exit(1); - } -} async function handleCreate(argv: Partial>, prompter: Inquirerer) { try { const rawAnswers = await prompter.prompt(argv, [ @@ -123,7 +92,10 @@ async function handleCreate(argv: Partial>, prompter: In }, ]); const answers = coerceAnswers(rawAnswers, fieldSchema); - const cleanedData = stripUndefined(answers, fieldSchema); + const cleanedData = stripUndefined( + answers, + fieldSchema + ) as CreateOrgGetSubordinatesRecordInput['orgGetSubordinatesRecord']; const client = getClient(); const result = await client.orgGetSubordinatesRecord .create({ @@ -146,83 +118,3 @@ async function handleCreate(argv: Partial>, prompter: In process.exit(1); } } -async function handleUpdate(argv: Partial>, prompter: Inquirerer) { - try { - const rawAnswers = await prompter.prompt(argv, [ - { - type: 'text', - name: 'id', - message: 'id', - required: true, - }, - { - type: 'text', - name: 'userId', - message: 'userId', - required: false, - }, - { - type: 'text', - name: 'depth', - message: 'depth', - required: false, - }, - ]); - const answers = coerceAnswers(rawAnswers, fieldSchema); - const cleanedData = stripUndefined(answers, fieldSchema); - const client = getClient(); - const result = await client.orgGetSubordinatesRecord - .update({ - where: { - id: answers.id as string, - }, - data: { - userId: cleanedData.userId, - depth: cleanedData.depth, - }, - select: { - userId: true, - depth: true, - }, - }) - .execute(); - console.log(JSON.stringify(result, null, 2)); - } catch (error) { - console.error('Failed to update record.'); - if (error instanceof Error) { - console.error(error.message); - } - process.exit(1); - } -} -async function handleDelete(argv: Partial>, prompter: Inquirerer) { - try { - const rawAnswers = await prompter.prompt(argv, [ - { - type: 'text', - name: 'id', - message: 'id', - required: true, - }, - ]); - const answers = coerceAnswers(rawAnswers, fieldSchema); - const client = getClient(); - const result = await client.orgGetSubordinatesRecord - .delete({ - where: { - id: answers.id as string, - }, - select: { - id: true, - }, - }) - .execute(); - console.log(JSON.stringify(result, null, 2)); - } catch (error) { - console.error('Failed to delete record.'); - if (error instanceof Error) { - console.error(error.message); - } - process.exit(1); - } -} diff --git a/sdk/constructive-cli/src/admin/cli/commands/org-grant.ts b/sdk/constructive-cli/src/admin/cli/commands/org-grant.ts index a47b2488d..27ff25e22 100644 --- a/sdk/constructive-cli/src/admin/cli/commands/org-grant.ts +++ b/sdk/constructive-cli/src/admin/cli/commands/org-grant.ts @@ -1,4 +1,3 @@ -// @ts-nocheck /** * CLI commands for OrgGrant * @generated by @constructive-io/graphql-codegen @@ -7,7 +6,9 @@ import { CLIOptions, Inquirerer, extractFirst } from 'inquirerer'; import { getClient } from '../executor'; import { coerceAnswers, stripUndefined } from '../utils'; -const fieldSchema = { +import type { FieldSchema } from '../utils'; +import type { CreateOrgGrantInput, OrgGrantPatch } from '../../orm/input-types'; +const fieldSchema: FieldSchema = { id: 'uuid', permissions: 'string', isGrant: 'boolean', @@ -38,7 +39,7 @@ export default async ( options: ['list', 'get', 'create', 'update', 'delete'], }, ]); - return handleTableSubcommand(answer.subcommand, newArgv, prompter); + return handleTableSubcommand(answer.subcommand as string, newArgv, prompter); } return handleTableSubcommand(subcommand, newArgv, prompter); }; @@ -102,7 +103,7 @@ async function handleGet(argv: Partial>, prompter: Inqui const client = getClient(); const result = await client.orgGrant .findOne({ - id: answers.id, + id: answers.id as string, select: { id: true, permissions: true, @@ -159,7 +160,7 @@ async function handleCreate(argv: Partial>, prompter: In }, ]); const answers = coerceAnswers(rawAnswers, fieldSchema); - const cleanedData = stripUndefined(answers, fieldSchema); + const cleanedData = stripUndefined(answers, fieldSchema) as CreateOrgGrantInput['orgGrant']; const client = getClient(); const result = await client.orgGrant .create({ @@ -232,7 +233,7 @@ async function handleUpdate(argv: Partial>, prompter: In }, ]); const answers = coerceAnswers(rawAnswers, fieldSchema); - const cleanedData = stripUndefined(answers, fieldSchema); + const cleanedData = stripUndefined(answers, fieldSchema) as OrgGrantPatch; const client = getClient(); const result = await client.orgGrant .update({ diff --git a/sdk/constructive-cli/src/admin/cli/commands/org-invite.ts b/sdk/constructive-cli/src/admin/cli/commands/org-invite.ts index 5d914a888..066b24be4 100644 --- a/sdk/constructive-cli/src/admin/cli/commands/org-invite.ts +++ b/sdk/constructive-cli/src/admin/cli/commands/org-invite.ts @@ -1,4 +1,3 @@ -// @ts-nocheck /** * CLI commands for OrgInvite * @generated by @constructive-io/graphql-codegen @@ -7,7 +6,9 @@ import { CLIOptions, Inquirerer, extractFirst } from 'inquirerer'; import { getClient } from '../executor'; import { coerceAnswers, stripUndefined } from '../utils'; -const fieldSchema = { +import type { FieldSchema } from '../utils'; +import type { CreateOrgInviteInput, OrgInvitePatch } from '../../orm/input-types'; +const fieldSchema: FieldSchema = { id: 'uuid', email: 'string', senderId: 'uuid', @@ -44,7 +45,7 @@ export default async ( options: ['list', 'get', 'create', 'update', 'delete'], }, ]); - return handleTableSubcommand(answer.subcommand, newArgv, prompter); + return handleTableSubcommand(answer.subcommand as string, newArgv, prompter); } return handleTableSubcommand(subcommand, newArgv, prompter); }; @@ -114,7 +115,7 @@ async function handleGet(argv: Partial>, prompter: Inqui const client = getClient(); const result = await client.orgInvite .findOne({ - id: answers.id, + id: answers.id as string, select: { id: true, email: true, @@ -213,7 +214,7 @@ async function handleCreate(argv: Partial>, prompter: In }, ]); const answers = coerceAnswers(rawAnswers, fieldSchema); - const cleanedData = stripUndefined(answers, fieldSchema); + const cleanedData = stripUndefined(answers, fieldSchema) as CreateOrgInviteInput['orgInvite']; const client = getClient(); const result = await client.orgInvite .create({ @@ -334,7 +335,7 @@ async function handleUpdate(argv: Partial>, prompter: In }, ]); const answers = coerceAnswers(rawAnswers, fieldSchema); - const cleanedData = stripUndefined(answers, fieldSchema); + const cleanedData = stripUndefined(answers, fieldSchema) as OrgInvitePatch; const client = getClient(); const result = await client.orgInvite .update({ diff --git a/sdk/constructive-cli/src/admin/cli/commands/org-is-manager-of.ts b/sdk/constructive-cli/src/admin/cli/commands/org-is-manager-of.ts index 64a2aac50..83684fede 100644 --- a/sdk/constructive-cli/src/admin/cli/commands/org-is-manager-of.ts +++ b/sdk/constructive-cli/src/admin/cli/commands/org-is-manager-of.ts @@ -1,4 +1,3 @@ -// @ts-nocheck /** * CLI command for query orgIsManagerOf * @generated by @constructive-io/graphql-codegen @@ -6,6 +5,7 @@ */ import { CLIOptions, Inquirerer } from 'inquirerer'; import { getClient } from '../executor'; +import type { OrgIsManagerOfVariables } from '../../orm/query'; export default async ( argv: Partial>, prompter: Inquirerer, @@ -39,7 +39,9 @@ export default async ( }, ]); const client = getClient(); - const result = await client.query.orgIsManagerOf(answers).execute(); + const result = await client.query + .orgIsManagerOf(answers as unknown as OrgIsManagerOfVariables) + .execute(); console.log(JSON.stringify(result, null, 2)); } catch (error) { console.error('Failed: orgIsManagerOf'); diff --git a/sdk/constructive-cli/src/admin/cli/commands/org-limit-default.ts b/sdk/constructive-cli/src/admin/cli/commands/org-limit-default.ts index ec14c8a01..88c820f50 100644 --- a/sdk/constructive-cli/src/admin/cli/commands/org-limit-default.ts +++ b/sdk/constructive-cli/src/admin/cli/commands/org-limit-default.ts @@ -1,4 +1,3 @@ -// @ts-nocheck /** * CLI commands for OrgLimitDefault * @generated by @constructive-io/graphql-codegen @@ -7,7 +6,9 @@ import { CLIOptions, Inquirerer, extractFirst } from 'inquirerer'; import { getClient } from '../executor'; import { coerceAnswers, stripUndefined } from '../utils'; -const fieldSchema = { +import type { FieldSchema } from '../utils'; +import type { CreateOrgLimitDefaultInput, OrgLimitDefaultPatch } from '../../orm/input-types'; +const fieldSchema: FieldSchema = { id: 'uuid', name: 'string', max: 'int', @@ -33,7 +34,7 @@ export default async ( options: ['list', 'get', 'create', 'update', 'delete'], }, ]); - return handleTableSubcommand(answer.subcommand, newArgv, prompter); + return handleTableSubcommand(answer.subcommand as string, newArgv, prompter); } return handleTableSubcommand(subcommand, newArgv, prompter); }; @@ -92,7 +93,7 @@ async function handleGet(argv: Partial>, prompter: Inqui const client = getClient(); const result = await client.orgLimitDefault .findOne({ - id: answers.id, + id: answers.id as string, select: { id: true, name: true, @@ -126,7 +127,10 @@ async function handleCreate(argv: Partial>, prompter: In }, ]); const answers = coerceAnswers(rawAnswers, fieldSchema); - const cleanedData = stripUndefined(answers, fieldSchema); + const cleanedData = stripUndefined( + answers, + fieldSchema + ) as CreateOrgLimitDefaultInput['orgLimitDefault']; const client = getClient(); const result = await client.orgLimitDefault .create({ @@ -173,7 +177,7 @@ async function handleUpdate(argv: Partial>, prompter: In }, ]); const answers = coerceAnswers(rawAnswers, fieldSchema); - const cleanedData = stripUndefined(answers, fieldSchema); + const cleanedData = stripUndefined(answers, fieldSchema) as OrgLimitDefaultPatch; const client = getClient(); const result = await client.orgLimitDefault .update({ diff --git a/sdk/constructive-cli/src/admin/cli/commands/org-limit.ts b/sdk/constructive-cli/src/admin/cli/commands/org-limit.ts index 2712aebed..821d1cee8 100644 --- a/sdk/constructive-cli/src/admin/cli/commands/org-limit.ts +++ b/sdk/constructive-cli/src/admin/cli/commands/org-limit.ts @@ -1,4 +1,3 @@ -// @ts-nocheck /** * CLI commands for OrgLimit * @generated by @constructive-io/graphql-codegen @@ -7,7 +6,9 @@ import { CLIOptions, Inquirerer, extractFirst } from 'inquirerer'; import { getClient } from '../executor'; import { coerceAnswers, stripUndefined } from '../utils'; -const fieldSchema = { +import type { FieldSchema } from '../utils'; +import type { CreateOrgLimitInput, OrgLimitPatch } from '../../orm/input-types'; +const fieldSchema: FieldSchema = { id: 'uuid', name: 'string', actorId: 'uuid', @@ -36,7 +37,7 @@ export default async ( options: ['list', 'get', 'create', 'update', 'delete'], }, ]); - return handleTableSubcommand(answer.subcommand, newArgv, prompter); + return handleTableSubcommand(answer.subcommand as string, newArgv, prompter); } return handleTableSubcommand(subcommand, newArgv, prompter); }; @@ -98,7 +99,7 @@ async function handleGet(argv: Partial>, prompter: Inqui const client = getClient(); const result = await client.orgLimit .findOne({ - id: answers.id, + id: answers.id as string, select: { id: true, name: true, @@ -153,7 +154,7 @@ async function handleCreate(argv: Partial>, prompter: In }, ]); const answers = coerceAnswers(rawAnswers, fieldSchema); - const cleanedData = stripUndefined(answers, fieldSchema); + const cleanedData = stripUndefined(answers, fieldSchema) as CreateOrgLimitInput['orgLimit']; const client = getClient(); const result = await client.orgLimit .create({ @@ -224,7 +225,7 @@ async function handleUpdate(argv: Partial>, prompter: In }, ]); const answers = coerceAnswers(rawAnswers, fieldSchema); - const cleanedData = stripUndefined(answers, fieldSchema); + const cleanedData = stripUndefined(answers, fieldSchema) as OrgLimitPatch; const client = getClient(); const result = await client.orgLimit .update({ diff --git a/sdk/constructive-cli/src/admin/cli/commands/org-member.ts b/sdk/constructive-cli/src/admin/cli/commands/org-member.ts index 2498d8bf2..3e5b52db8 100644 --- a/sdk/constructive-cli/src/admin/cli/commands/org-member.ts +++ b/sdk/constructive-cli/src/admin/cli/commands/org-member.ts @@ -1,4 +1,3 @@ -// @ts-nocheck /** * CLI commands for OrgMember * @generated by @constructive-io/graphql-codegen @@ -7,7 +6,9 @@ import { CLIOptions, Inquirerer, extractFirst } from 'inquirerer'; import { getClient } from '../executor'; import { coerceAnswers, stripUndefined } from '../utils'; -const fieldSchema = { +import type { FieldSchema } from '../utils'; +import type { CreateOrgMemberInput, OrgMemberPatch } from '../../orm/input-types'; +const fieldSchema: FieldSchema = { id: 'uuid', isAdmin: 'boolean', actorId: 'uuid', @@ -34,7 +35,7 @@ export default async ( options: ['list', 'get', 'create', 'update', 'delete'], }, ]); - return handleTableSubcommand(answer.subcommand, newArgv, prompter); + return handleTableSubcommand(answer.subcommand as string, newArgv, prompter); } return handleTableSubcommand(subcommand, newArgv, prompter); }; @@ -94,7 +95,7 @@ async function handleGet(argv: Partial>, prompter: Inqui const client = getClient(); const result = await client.orgMember .findOne({ - id: answers.id, + id: answers.id as string, select: { id: true, isAdmin: true, @@ -135,7 +136,7 @@ async function handleCreate(argv: Partial>, prompter: In }, ]); const answers = coerceAnswers(rawAnswers, fieldSchema); - const cleanedData = stripUndefined(answers, fieldSchema); + const cleanedData = stripUndefined(answers, fieldSchema) as CreateOrgMemberInput['orgMember']; const client = getClient(); const result = await client.orgMember .create({ @@ -190,7 +191,7 @@ async function handleUpdate(argv: Partial>, prompter: In }, ]); const answers = coerceAnswers(rawAnswers, fieldSchema); - const cleanedData = stripUndefined(answers, fieldSchema); + const cleanedData = stripUndefined(answers, fieldSchema) as OrgMemberPatch; const client = getClient(); const result = await client.orgMember .update({ diff --git a/sdk/constructive-cli/src/admin/cli/commands/org-membership-default.ts b/sdk/constructive-cli/src/admin/cli/commands/org-membership-default.ts index 779aa0e40..2b298d262 100644 --- a/sdk/constructive-cli/src/admin/cli/commands/org-membership-default.ts +++ b/sdk/constructive-cli/src/admin/cli/commands/org-membership-default.ts @@ -1,4 +1,3 @@ -// @ts-nocheck /** * CLI commands for OrgMembershipDefault * @generated by @constructive-io/graphql-codegen @@ -7,7 +6,12 @@ import { CLIOptions, Inquirerer, extractFirst } from 'inquirerer'; import { getClient } from '../executor'; import { coerceAnswers, stripUndefined } from '../utils'; -const fieldSchema = { +import type { FieldSchema } from '../utils'; +import type { + CreateOrgMembershipDefaultInput, + OrgMembershipDefaultPatch, +} from '../../orm/input-types'; +const fieldSchema: FieldSchema = { id: 'uuid', createdAt: 'string', updatedAt: 'string', @@ -39,7 +43,7 @@ export default async ( options: ['list', 'get', 'create', 'update', 'delete'], }, ]); - return handleTableSubcommand(answer.subcommand, newArgv, prompter); + return handleTableSubcommand(answer.subcommand as string, newArgv, prompter); } return handleTableSubcommand(subcommand, newArgv, prompter); }; @@ -104,7 +108,7 @@ async function handleGet(argv: Partial>, prompter: Inqui const client = getClient(); const result = await client.orgMembershipDefault .findOne({ - id: answers.id, + id: answers.id as string, select: { id: true, createdAt: true, @@ -168,7 +172,10 @@ async function handleCreate(argv: Partial>, prompter: In }, ]); const answers = coerceAnswers(rawAnswers, fieldSchema); - const cleanedData = stripUndefined(answers, fieldSchema); + const cleanedData = stripUndefined( + answers, + fieldSchema + ) as CreateOrgMembershipDefaultInput['orgMembershipDefault']; const client = getClient(); const result = await client.orgMembershipDefault .create({ @@ -249,7 +256,7 @@ async function handleUpdate(argv: Partial>, prompter: In }, ]); const answers = coerceAnswers(rawAnswers, fieldSchema); - const cleanedData = stripUndefined(answers, fieldSchema); + const cleanedData = stripUndefined(answers, fieldSchema) as OrgMembershipDefaultPatch; const client = getClient(); const result = await client.orgMembershipDefault .update({ diff --git a/sdk/constructive-cli/src/admin/cli/commands/org-membership.ts b/sdk/constructive-cli/src/admin/cli/commands/org-membership.ts index a1605b22f..9341e9407 100644 --- a/sdk/constructive-cli/src/admin/cli/commands/org-membership.ts +++ b/sdk/constructive-cli/src/admin/cli/commands/org-membership.ts @@ -1,4 +1,3 @@ -// @ts-nocheck /** * CLI commands for OrgMembership * @generated by @constructive-io/graphql-codegen @@ -7,7 +6,9 @@ import { CLIOptions, Inquirerer, extractFirst } from 'inquirerer'; import { getClient } from '../executor'; import { coerceAnswers, stripUndefined } from '../utils'; -const fieldSchema = { +import type { FieldSchema } from '../utils'; +import type { CreateOrgMembershipInput, OrgMembershipPatch } from '../../orm/input-types'; +const fieldSchema: FieldSchema = { id: 'uuid', createdAt: 'string', updatedAt: 'string', @@ -46,7 +47,7 @@ export default async ( options: ['list', 'get', 'create', 'update', 'delete'], }, ]); - return handleTableSubcommand(answer.subcommand, newArgv, prompter); + return handleTableSubcommand(answer.subcommand as string, newArgv, prompter); } return handleTableSubcommand(subcommand, newArgv, prompter); }; @@ -118,7 +119,7 @@ async function handleGet(argv: Partial>, prompter: Inqui const client = getClient(); const result = await client.orgMembership .findOne({ - id: answers.id, + id: answers.id as string, select: { id: true, createdAt: true, @@ -231,7 +232,10 @@ async function handleCreate(argv: Partial>, prompter: In }, ]); const answers = coerceAnswers(rawAnswers, fieldSchema); - const cleanedData = stripUndefined(answers, fieldSchema); + const cleanedData = stripUndefined( + answers, + fieldSchema + ) as CreateOrgMembershipInput['orgMembership']; const client = getClient(); const result = await client.orgMembership .create({ @@ -368,7 +372,7 @@ async function handleUpdate(argv: Partial>, prompter: In }, ]); const answers = coerceAnswers(rawAnswers, fieldSchema); - const cleanedData = stripUndefined(answers, fieldSchema); + const cleanedData = stripUndefined(answers, fieldSchema) as OrgMembershipPatch; const client = getClient(); const result = await client.orgMembership .update({ diff --git a/sdk/constructive-cli/src/admin/cli/commands/org-owner-grant.ts b/sdk/constructive-cli/src/admin/cli/commands/org-owner-grant.ts index 6c158fcc3..d253209cf 100644 --- a/sdk/constructive-cli/src/admin/cli/commands/org-owner-grant.ts +++ b/sdk/constructive-cli/src/admin/cli/commands/org-owner-grant.ts @@ -1,4 +1,3 @@ -// @ts-nocheck /** * CLI commands for OrgOwnerGrant * @generated by @constructive-io/graphql-codegen @@ -7,7 +6,9 @@ import { CLIOptions, Inquirerer, extractFirst } from 'inquirerer'; import { getClient } from '../executor'; import { coerceAnswers, stripUndefined } from '../utils'; -const fieldSchema = { +import type { FieldSchema } from '../utils'; +import type { CreateOrgOwnerGrantInput, OrgOwnerGrantPatch } from '../../orm/input-types'; +const fieldSchema: FieldSchema = { id: 'uuid', isGrant: 'boolean', actorId: 'uuid', @@ -37,7 +38,7 @@ export default async ( options: ['list', 'get', 'create', 'update', 'delete'], }, ]); - return handleTableSubcommand(answer.subcommand, newArgv, prompter); + return handleTableSubcommand(answer.subcommand as string, newArgv, prompter); } return handleTableSubcommand(subcommand, newArgv, prompter); }; @@ -100,7 +101,7 @@ async function handleGet(argv: Partial>, prompter: Inqui const client = getClient(); const result = await client.orgOwnerGrant .findOne({ - id: answers.id, + id: answers.id as string, select: { id: true, isGrant: true, @@ -150,7 +151,10 @@ async function handleCreate(argv: Partial>, prompter: In }, ]); const answers = coerceAnswers(rawAnswers, fieldSchema); - const cleanedData = stripUndefined(answers, fieldSchema); + const cleanedData = stripUndefined( + answers, + fieldSchema + ) as CreateOrgOwnerGrantInput['orgOwnerGrant']; const client = getClient(); const result = await client.orgOwnerGrant .create({ @@ -215,7 +219,7 @@ async function handleUpdate(argv: Partial>, prompter: In }, ]); const answers = coerceAnswers(rawAnswers, fieldSchema); - const cleanedData = stripUndefined(answers, fieldSchema); + const cleanedData = stripUndefined(answers, fieldSchema) as OrgOwnerGrantPatch; const client = getClient(); const result = await client.orgOwnerGrant .update({ diff --git a/sdk/constructive-cli/src/admin/cli/commands/org-permission-default.ts b/sdk/constructive-cli/src/admin/cli/commands/org-permission-default.ts index 67ecc9c66..8a8ead854 100644 --- a/sdk/constructive-cli/src/admin/cli/commands/org-permission-default.ts +++ b/sdk/constructive-cli/src/admin/cli/commands/org-permission-default.ts @@ -1,4 +1,3 @@ -// @ts-nocheck /** * CLI commands for OrgPermissionDefault * @generated by @constructive-io/graphql-codegen @@ -7,7 +6,12 @@ import { CLIOptions, Inquirerer, extractFirst } from 'inquirerer'; import { getClient } from '../executor'; import { coerceAnswers, stripUndefined } from '../utils'; -const fieldSchema = { +import type { FieldSchema } from '../utils'; +import type { + CreateOrgPermissionDefaultInput, + OrgPermissionDefaultPatch, +} from '../../orm/input-types'; +const fieldSchema: FieldSchema = { id: 'uuid', permissions: 'string', entityId: 'uuid', @@ -33,7 +37,7 @@ export default async ( options: ['list', 'get', 'create', 'update', 'delete'], }, ]); - return handleTableSubcommand(answer.subcommand, newArgv, prompter); + return handleTableSubcommand(answer.subcommand as string, newArgv, prompter); } return handleTableSubcommand(subcommand, newArgv, prompter); }; @@ -92,7 +96,7 @@ async function handleGet(argv: Partial>, prompter: Inqui const client = getClient(); const result = await client.orgPermissionDefault .findOne({ - id: answers.id, + id: answers.id as string, select: { id: true, permissions: true, @@ -126,7 +130,10 @@ async function handleCreate(argv: Partial>, prompter: In }, ]); const answers = coerceAnswers(rawAnswers, fieldSchema); - const cleanedData = stripUndefined(answers, fieldSchema); + const cleanedData = stripUndefined( + answers, + fieldSchema + ) as CreateOrgPermissionDefaultInput['orgPermissionDefault']; const client = getClient(); const result = await client.orgPermissionDefault .create({ @@ -173,7 +180,7 @@ async function handleUpdate(argv: Partial>, prompter: In }, ]); const answers = coerceAnswers(rawAnswers, fieldSchema); - const cleanedData = stripUndefined(answers, fieldSchema); + const cleanedData = stripUndefined(answers, fieldSchema) as OrgPermissionDefaultPatch; const client = getClient(); const result = await client.orgPermissionDefault .update({ diff --git a/sdk/constructive-cli/src/admin/cli/commands/org-permission.ts b/sdk/constructive-cli/src/admin/cli/commands/org-permission.ts index e200959be..4b94d233b 100644 --- a/sdk/constructive-cli/src/admin/cli/commands/org-permission.ts +++ b/sdk/constructive-cli/src/admin/cli/commands/org-permission.ts @@ -1,4 +1,3 @@ -// @ts-nocheck /** * CLI commands for OrgPermission * @generated by @constructive-io/graphql-codegen @@ -7,7 +6,9 @@ import { CLIOptions, Inquirerer, extractFirst } from 'inquirerer'; import { getClient } from '../executor'; import { coerceAnswers, stripUndefined } from '../utils'; -const fieldSchema = { +import type { FieldSchema } from '../utils'; +import type { CreateOrgPermissionInput, OrgPermissionPatch } from '../../orm/input-types'; +const fieldSchema: FieldSchema = { id: 'uuid', name: 'string', bitnum: 'int', @@ -35,7 +36,7 @@ export default async ( options: ['list', 'get', 'create', 'update', 'delete'], }, ]); - return handleTableSubcommand(answer.subcommand, newArgv, prompter); + return handleTableSubcommand(answer.subcommand as string, newArgv, prompter); } return handleTableSubcommand(subcommand, newArgv, prompter); }; @@ -96,7 +97,7 @@ async function handleGet(argv: Partial>, prompter: Inqui const client = getClient(); const result = await client.orgPermission .findOne({ - id: answers.id, + id: answers.id as string, select: { id: true, name: true, @@ -144,7 +145,10 @@ async function handleCreate(argv: Partial>, prompter: In }, ]); const answers = coerceAnswers(rawAnswers, fieldSchema); - const cleanedData = stripUndefined(answers, fieldSchema); + const cleanedData = stripUndefined( + answers, + fieldSchema + ) as CreateOrgPermissionInput['orgPermission']; const client = getClient(); const result = await client.orgPermission .create({ @@ -207,7 +211,7 @@ async function handleUpdate(argv: Partial>, prompter: In }, ]); const answers = coerceAnswers(rawAnswers, fieldSchema); - const cleanedData = stripUndefined(answers, fieldSchema); + const cleanedData = stripUndefined(answers, fieldSchema) as OrgPermissionPatch; const client = getClient(); const result = await client.orgPermission .update({ diff --git a/sdk/constructive-cli/src/admin/cli/commands/org-permissions-get-by-mask.ts b/sdk/constructive-cli/src/admin/cli/commands/org-permissions-get-by-mask.ts index a0fc95016..4fce871b9 100644 --- a/sdk/constructive-cli/src/admin/cli/commands/org-permissions-get-by-mask.ts +++ b/sdk/constructive-cli/src/admin/cli/commands/org-permissions-get-by-mask.ts @@ -1,4 +1,3 @@ -// @ts-nocheck /** * CLI command for query orgPermissionsGetByMask * @generated by @constructive-io/graphql-codegen @@ -7,6 +6,8 @@ import { CLIOptions, Inquirerer } from 'inquirerer'; import { getClient } from '../executor'; import { buildSelectFromPaths } from '../utils'; +import type { OrgPermissionsGetByMaskVariables } from '../../orm/query'; +import type { OrgPermissionConnectionSelect } from '../../orm/input-types'; export default async ( argv: Partial>, prompter: Inquirerer, @@ -43,11 +44,16 @@ export default async ( }, ]); const client = getClient(); - const selectFields = buildSelectFromPaths(argv.select ?? ''); + const selectFields = buildSelectFromPaths((argv.select as string) ?? ''); const result = await client.query - .orgPermissionsGetByMask(answers, { - select: selectFields, - }) + .orgPermissionsGetByMask( + answers as unknown as OrgPermissionsGetByMaskVariables, + { + select: selectFields, + } as unknown as { + select: OrgPermissionConnectionSelect; + } + ) .execute(); console.log(JSON.stringify(result, null, 2)); } catch (error) { diff --git a/sdk/constructive-cli/src/admin/cli/commands/org-permissions-get-mask-by-names.ts b/sdk/constructive-cli/src/admin/cli/commands/org-permissions-get-mask-by-names.ts index 939e6eeb0..643b68096 100644 --- a/sdk/constructive-cli/src/admin/cli/commands/org-permissions-get-mask-by-names.ts +++ b/sdk/constructive-cli/src/admin/cli/commands/org-permissions-get-mask-by-names.ts @@ -1,4 +1,3 @@ -// @ts-nocheck /** * CLI command for query orgPermissionsGetMaskByNames * @generated by @constructive-io/graphql-codegen @@ -6,6 +5,7 @@ */ import { CLIOptions, Inquirerer } from 'inquirerer'; import { getClient } from '../executor'; +import type { OrgPermissionsGetMaskByNamesVariables } from '../../orm/query'; export default async ( argv: Partial>, prompter: Inquirerer, @@ -26,7 +26,9 @@ export default async ( }, ]); const client = getClient(); - const result = await client.query.orgPermissionsGetMaskByNames(answers).execute(); + const result = await client.query + .orgPermissionsGetMaskByNames(answers as unknown as OrgPermissionsGetMaskByNamesVariables) + .execute(); console.log(JSON.stringify(result, null, 2)); } catch (error) { console.error('Failed: orgPermissionsGetMaskByNames'); diff --git a/sdk/constructive-cli/src/admin/cli/commands/org-permissions-get-mask.ts b/sdk/constructive-cli/src/admin/cli/commands/org-permissions-get-mask.ts index cd8d2731a..7045bd200 100644 --- a/sdk/constructive-cli/src/admin/cli/commands/org-permissions-get-mask.ts +++ b/sdk/constructive-cli/src/admin/cli/commands/org-permissions-get-mask.ts @@ -1,4 +1,3 @@ -// @ts-nocheck /** * CLI command for query orgPermissionsGetMask * @generated by @constructive-io/graphql-codegen @@ -6,6 +5,7 @@ */ import { CLIOptions, Inquirerer } from 'inquirerer'; import { getClient } from '../executor'; +import type { OrgPermissionsGetMaskVariables } from '../../orm/query'; export default async ( argv: Partial>, prompter: Inquirerer, @@ -26,7 +26,9 @@ export default async ( }, ]); const client = getClient(); - const result = await client.query.orgPermissionsGetMask(answers).execute(); + const result = await client.query + .orgPermissionsGetMask(answers as unknown as OrgPermissionsGetMaskVariables) + .execute(); console.log(JSON.stringify(result, null, 2)); } catch (error) { console.error('Failed: orgPermissionsGetMask'); diff --git a/sdk/constructive-cli/src/admin/cli/commands/org-permissions-get-padded-mask.ts b/sdk/constructive-cli/src/admin/cli/commands/org-permissions-get-padded-mask.ts index c750f0558..1963857d2 100644 --- a/sdk/constructive-cli/src/admin/cli/commands/org-permissions-get-padded-mask.ts +++ b/sdk/constructive-cli/src/admin/cli/commands/org-permissions-get-padded-mask.ts @@ -1,4 +1,3 @@ -// @ts-nocheck /** * CLI command for query orgPermissionsGetPaddedMask * @generated by @constructive-io/graphql-codegen @@ -6,6 +5,7 @@ */ import { CLIOptions, Inquirerer } from 'inquirerer'; import { getClient } from '../executor'; +import type { OrgPermissionsGetPaddedMaskVariables } from '../../orm/query'; export default async ( argv: Partial>, prompter: Inquirerer, @@ -26,7 +26,9 @@ export default async ( }, ]); const client = getClient(); - const result = await client.query.orgPermissionsGetPaddedMask(answers).execute(); + const result = await client.query + .orgPermissionsGetPaddedMask(answers as unknown as OrgPermissionsGetPaddedMaskVariables) + .execute(); console.log(JSON.stringify(result, null, 2)); } catch (error) { console.error('Failed: orgPermissionsGetPaddedMask'); diff --git a/sdk/constructive-cli/src/admin/cli/commands/steps-achieved.ts b/sdk/constructive-cli/src/admin/cli/commands/steps-achieved.ts index a74a28510..edc8fcea9 100644 --- a/sdk/constructive-cli/src/admin/cli/commands/steps-achieved.ts +++ b/sdk/constructive-cli/src/admin/cli/commands/steps-achieved.ts @@ -1,4 +1,3 @@ -// @ts-nocheck /** * CLI command for query stepsAchieved * @generated by @constructive-io/graphql-codegen @@ -6,6 +5,7 @@ */ import { CLIOptions, Inquirerer } from 'inquirerer'; import { getClient } from '../executor'; +import type { StepsAchievedVariables } from '../../orm/query'; export default async ( argv: Partial>, prompter: Inquirerer, @@ -29,7 +29,9 @@ export default async ( }, ]); const client = getClient(); - const result = await client.query.stepsAchieved(answers).execute(); + const result = await client.query + .stepsAchieved(answers as unknown as StepsAchievedVariables) + .execute(); console.log(JSON.stringify(result, null, 2)); } catch (error) { console.error('Failed: stepsAchieved'); diff --git a/sdk/constructive-cli/src/admin/cli/commands/steps-required.ts b/sdk/constructive-cli/src/admin/cli/commands/steps-required.ts index 08b9cd4b5..794b78438 100644 --- a/sdk/constructive-cli/src/admin/cli/commands/steps-required.ts +++ b/sdk/constructive-cli/src/admin/cli/commands/steps-required.ts @@ -1,4 +1,3 @@ -// @ts-nocheck /** * CLI command for query stepsRequired * @generated by @constructive-io/graphql-codegen @@ -7,6 +6,8 @@ import { CLIOptions, Inquirerer } from 'inquirerer'; import { getClient } from '../executor'; import { buildSelectFromPaths } from '../utils'; +import type { StepsRequiredVariables } from '../../orm/query'; +import type { AppLevelRequirementConnectionSelect } from '../../orm/input-types'; export default async ( argv: Partial>, prompter: Inquirerer, @@ -48,11 +49,16 @@ export default async ( }, ]); const client = getClient(); - const selectFields = buildSelectFromPaths(argv.select ?? ''); + const selectFields = buildSelectFromPaths((argv.select as string) ?? ''); const result = await client.query - .stepsRequired(answers, { - select: selectFields, - }) + .stepsRequired( + answers as unknown as StepsRequiredVariables, + { + select: selectFields, + } as unknown as { + select: AppLevelRequirementConnectionSelect; + } + ) .execute(); console.log(JSON.stringify(result, null, 2)); } catch (error) { diff --git a/sdk/constructive-cli/src/admin/cli/commands/submit-invite-code.ts b/sdk/constructive-cli/src/admin/cli/commands/submit-invite-code.ts index 99f418ea5..61a3b8264 100644 --- a/sdk/constructive-cli/src/admin/cli/commands/submit-invite-code.ts +++ b/sdk/constructive-cli/src/admin/cli/commands/submit-invite-code.ts @@ -1,4 +1,3 @@ -// @ts-nocheck /** * CLI command for mutation submitInviteCode * @generated by @constructive-io/graphql-codegen @@ -7,6 +6,8 @@ import { CLIOptions, Inquirerer } from 'inquirerer'; import { getClient } from '../executor'; import { parseMutationInput, buildSelectFromPaths } from '../utils'; +import type { SubmitInviteCodeVariables } from '../../orm/mutation'; +import type { SubmitInviteCodePayloadSelect } from '../../orm/input-types'; export default async ( argv: Partial>, prompter: Inquirerer, @@ -28,11 +29,16 @@ export default async ( ]); const client = getClient(); const parsedAnswers = parseMutationInput(answers); - const selectFields = buildSelectFromPaths(argv.select ?? 'clientMutationId'); + const selectFields = buildSelectFromPaths((argv.select as string) ?? 'clientMutationId'); const result = await client.mutation - .submitInviteCode(parsedAnswers, { - select: selectFields, - }) + .submitInviteCode( + parsedAnswers as unknown as SubmitInviteCodeVariables, + { + select: selectFields, + } as unknown as { + select: SubmitInviteCodePayloadSelect; + } + ) .execute(); console.log(JSON.stringify(result, null, 2)); } catch (error) { diff --git a/sdk/constructive-cli/src/admin/cli/commands/submit-org-invite-code.ts b/sdk/constructive-cli/src/admin/cli/commands/submit-org-invite-code.ts index 8e209567b..59a0c2e91 100644 --- a/sdk/constructive-cli/src/admin/cli/commands/submit-org-invite-code.ts +++ b/sdk/constructive-cli/src/admin/cli/commands/submit-org-invite-code.ts @@ -1,4 +1,3 @@ -// @ts-nocheck /** * CLI command for mutation submitOrgInviteCode * @generated by @constructive-io/graphql-codegen @@ -7,6 +6,8 @@ import { CLIOptions, Inquirerer } from 'inquirerer'; import { getClient } from '../executor'; import { parseMutationInput, buildSelectFromPaths } from '../utils'; +import type { SubmitOrgInviteCodeVariables } from '../../orm/mutation'; +import type { SubmitOrgInviteCodePayloadSelect } from '../../orm/input-types'; export default async ( argv: Partial>, prompter: Inquirerer, @@ -30,11 +31,16 @@ export default async ( ]); const client = getClient(); const parsedAnswers = parseMutationInput(answers); - const selectFields = buildSelectFromPaths(argv.select ?? 'clientMutationId'); + const selectFields = buildSelectFromPaths((argv.select as string) ?? 'clientMutationId'); const result = await client.mutation - .submitOrgInviteCode(parsedAnswers, { - select: selectFields, - }) + .submitOrgInviteCode( + parsedAnswers as unknown as SubmitOrgInviteCodeVariables, + { + select: selectFields, + } as unknown as { + select: SubmitOrgInviteCodePayloadSelect; + } + ) .execute(); console.log(JSON.stringify(result, null, 2)); } catch (error) { diff --git a/sdk/constructive-cli/src/admin/cli/executor.ts b/sdk/constructive-cli/src/admin/cli/executor.ts index 08615a32b..721e8e68e 100644 --- a/sdk/constructive-cli/src/admin/cli/executor.ts +++ b/sdk/constructive-cli/src/admin/cli/executor.ts @@ -1,4 +1,3 @@ -// @ts-nocheck /** * Executor and config store for CLI * @generated by @constructive-io/graphql-codegen @@ -22,7 +21,7 @@ export function getClient(contextName?: string) { throw new Error('No active context. Run "context create" or "context use" first.'); } } - const headers = {}; + const headers: Record = {}; if (store.hasValidCredentials(ctx.name)) { const creds = store.getCredentials(ctx.name); if (creds?.token) { diff --git a/sdk/constructive-cli/src/admin/cli/index.ts b/sdk/constructive-cli/src/admin/cli/index.ts index fc2ecaced..05d1f1ecb 100644 --- a/sdk/constructive-cli/src/admin/cli/index.ts +++ b/sdk/constructive-cli/src/admin/cli/index.ts @@ -1,4 +1,3 @@ -// @ts-nocheck /** * CLI entry point * @generated by @constructive-io/graphql-codegen diff --git a/sdk/constructive-cli/src/admin/cli/node-fetch.ts b/sdk/constructive-cli/src/admin/cli/node-fetch.ts index 7390a6cb6..81bb05834 100644 --- a/sdk/constructive-cli/src/admin/cli/node-fetch.ts +++ b/sdk/constructive-cli/src/admin/cli/node-fetch.ts @@ -1,4 +1,3 @@ -// @ts-nocheck /** * Node HTTP adapter for localhost subdomain routing * @generated by @constructive-io/graphql-codegen diff --git a/sdk/constructive-cli/src/admin/cli/utils.ts b/sdk/constructive-cli/src/admin/cli/utils.ts index eb869282d..e55945fee 100644 --- a/sdk/constructive-cli/src/admin/cli/utils.ts +++ b/sdk/constructive-cli/src/admin/cli/utils.ts @@ -1,4 +1,3 @@ -// @ts-nocheck /** * CLI utility functions for type coercion and input handling * @generated by @constructive-io/graphql-codegen diff --git a/sdk/constructive-cli/src/auth/cli/commands.ts b/sdk/constructive-cli/src/auth/cli/commands.ts index 315c71ac3..c00935fda 100644 --- a/sdk/constructive-cli/src/auth/cli/commands.ts +++ b/sdk/constructive-cli/src/auth/cli/commands.ts @@ -1,4 +1,3 @@ -// @ts-nocheck /** * CLI command map and entry point * @generated by @constructive-io/graphql-codegen @@ -34,7 +33,14 @@ import forgotPasswordCmd from './commands/forgot-password'; import sendVerificationEmailCmd from './commands/send-verification-email'; import verifyPasswordCmd from './commands/verify-password'; import verifyTotpCmd from './commands/verify-totp'; -const createCommandMap = () => ({ +const createCommandMap: () => Record< + string, + ( + argv: Partial>, + prompter: Inquirerer, + options: CLIOptions + ) => Promise +> = () => ({ context: contextCmd, auth: authCmd, 'role-type': roleTypeCmd, @@ -87,7 +93,7 @@ export const commands = async ( options: Object.keys(commandMap), }, ]); - command = answer.command; + command = answer.command as string; } const commandFn = commandMap[command]; if (!commandFn) { diff --git a/sdk/constructive-cli/src/auth/cli/commands/audit-log.ts b/sdk/constructive-cli/src/auth/cli/commands/audit-log.ts index 933dfd39d..f41124c84 100644 --- a/sdk/constructive-cli/src/auth/cli/commands/audit-log.ts +++ b/sdk/constructive-cli/src/auth/cli/commands/audit-log.ts @@ -1,4 +1,3 @@ -// @ts-nocheck /** * CLI commands for AuditLog * @generated by @constructive-io/graphql-codegen @@ -7,7 +6,9 @@ import { CLIOptions, Inquirerer, extractFirst } from 'inquirerer'; import { getClient } from '../executor'; import { coerceAnswers, stripUndefined } from '../utils'; -const fieldSchema = { +import type { FieldSchema } from '../utils'; +import type { CreateAuditLogInput, AuditLogPatch } from '../../orm/input-types'; +const fieldSchema: FieldSchema = { id: 'uuid', event: 'string', actorId: 'uuid', @@ -38,7 +39,7 @@ export default async ( options: ['list', 'get', 'create', 'update', 'delete'], }, ]); - return handleTableSubcommand(answer.subcommand, newArgv, prompter); + return handleTableSubcommand(answer.subcommand as string, newArgv, prompter); } return handleTableSubcommand(subcommand, newArgv, prompter); }; @@ -102,7 +103,7 @@ async function handleGet(argv: Partial>, prompter: Inqui const client = getClient(); const result = await client.auditLog .findOne({ - id: answers.id, + id: answers.id as string, select: { id: true, event: true, @@ -165,7 +166,7 @@ async function handleCreate(argv: Partial>, prompter: In }, ]); const answers = coerceAnswers(rawAnswers, fieldSchema); - const cleanedData = stripUndefined(answers, fieldSchema); + const cleanedData = stripUndefined(answers, fieldSchema) as CreateAuditLogInput['auditLog']; const client = getClient(); const result = await client.auditLog .create({ @@ -245,7 +246,7 @@ async function handleUpdate(argv: Partial>, prompter: In }, ]); const answers = coerceAnswers(rawAnswers, fieldSchema); - const cleanedData = stripUndefined(answers, fieldSchema); + const cleanedData = stripUndefined(answers, fieldSchema) as AuditLogPatch; const client = getClient(); const result = await client.auditLog .update({ diff --git a/sdk/constructive-cli/src/auth/cli/commands/auth.ts b/sdk/constructive-cli/src/auth/cli/commands/auth.ts index 1bfe7085c..c731ba27c 100644 --- a/sdk/constructive-cli/src/auth/cli/commands/auth.ts +++ b/sdk/constructive-cli/src/auth/cli/commands/auth.ts @@ -1,4 +1,3 @@ -// @ts-nocheck /** * Authentication commands * @generated by @constructive-io/graphql-codegen @@ -28,7 +27,7 @@ export default async ( options: ['set-token', 'status', 'logout'], }, ]); - return handleAuthSubcommand(answer.subcommand, newArgv, prompter, store); + return handleAuthSubcommand(answer.subcommand as string, newArgv, prompter, store); } return handleAuthSubcommand(subcommand, newArgv, prompter, store); }; @@ -71,7 +70,7 @@ async function handleSetToken( required: true, }, ]); - tokenValue = answer.token; + tokenValue = answer.token as string; } store.setCredentials(current.name, { token: String(tokenValue || '').trim(), @@ -112,7 +111,7 @@ async function handleLogout( default: false, }, ]); - if (!confirm.confirm) { + if (!(confirm.confirm as boolean)) { return; } if (store.removeCredentials(current.name)) { diff --git a/sdk/constructive-cli/src/auth/cli/commands/check-password.ts b/sdk/constructive-cli/src/auth/cli/commands/check-password.ts index ab47f3206..5a2a0a1be 100644 --- a/sdk/constructive-cli/src/auth/cli/commands/check-password.ts +++ b/sdk/constructive-cli/src/auth/cli/commands/check-password.ts @@ -1,4 +1,3 @@ -// @ts-nocheck /** * CLI command for mutation checkPassword * @generated by @constructive-io/graphql-codegen @@ -7,6 +6,8 @@ import { CLIOptions, Inquirerer } from 'inquirerer'; import { getClient } from '../executor'; import { parseMutationInput, buildSelectFromPaths } from '../utils'; +import type { CheckPasswordVariables } from '../../orm/mutation'; +import type { CheckPasswordPayloadSelect } from '../../orm/input-types'; export default async ( argv: Partial>, prompter: Inquirerer, @@ -28,11 +29,16 @@ export default async ( ]); const client = getClient(); const parsedAnswers = parseMutationInput(answers); - const selectFields = buildSelectFromPaths(argv.select ?? 'clientMutationId'); + const selectFields = buildSelectFromPaths((argv.select as string) ?? 'clientMutationId'); const result = await client.mutation - .checkPassword(parsedAnswers, { - select: selectFields, - }) + .checkPassword( + parsedAnswers as unknown as CheckPasswordVariables, + { + select: selectFields, + } as unknown as { + select: CheckPasswordPayloadSelect; + } + ) .execute(); console.log(JSON.stringify(result, null, 2)); } catch (error) { diff --git a/sdk/constructive-cli/src/auth/cli/commands/confirm-delete-account.ts b/sdk/constructive-cli/src/auth/cli/commands/confirm-delete-account.ts index 2351bec6f..bdde36e74 100644 --- a/sdk/constructive-cli/src/auth/cli/commands/confirm-delete-account.ts +++ b/sdk/constructive-cli/src/auth/cli/commands/confirm-delete-account.ts @@ -1,4 +1,3 @@ -// @ts-nocheck /** * CLI command for mutation confirmDeleteAccount * @generated by @constructive-io/graphql-codegen @@ -7,6 +6,8 @@ import { CLIOptions, Inquirerer } from 'inquirerer'; import { getClient } from '../executor'; import { parseMutationInput, buildSelectFromPaths } from '../utils'; +import type { ConfirmDeleteAccountVariables } from '../../orm/mutation'; +import type { ConfirmDeleteAccountPayloadSelect } from '../../orm/input-types'; export default async ( argv: Partial>, prompter: Inquirerer, @@ -30,11 +31,16 @@ export default async ( ]); const client = getClient(); const parsedAnswers = parseMutationInput(answers); - const selectFields = buildSelectFromPaths(argv.select ?? 'clientMutationId'); + const selectFields = buildSelectFromPaths((argv.select as string) ?? 'clientMutationId'); const result = await client.mutation - .confirmDeleteAccount(parsedAnswers, { - select: selectFields, - }) + .confirmDeleteAccount( + parsedAnswers as unknown as ConfirmDeleteAccountVariables, + { + select: selectFields, + } as unknown as { + select: ConfirmDeleteAccountPayloadSelect; + } + ) .execute(); console.log(JSON.stringify(result, null, 2)); } catch (error) { diff --git a/sdk/constructive-cli/src/auth/cli/commands/connected-account.ts b/sdk/constructive-cli/src/auth/cli/commands/connected-account.ts index c1b5490ee..3d2ae973c 100644 --- a/sdk/constructive-cli/src/auth/cli/commands/connected-account.ts +++ b/sdk/constructive-cli/src/auth/cli/commands/connected-account.ts @@ -1,4 +1,3 @@ -// @ts-nocheck /** * CLI commands for ConnectedAccount * @generated by @constructive-io/graphql-codegen @@ -7,7 +6,9 @@ import { CLIOptions, Inquirerer, extractFirst } from 'inquirerer'; import { getClient } from '../executor'; import { coerceAnswers, stripUndefined } from '../utils'; -const fieldSchema = { +import type { FieldSchema } from '../utils'; +import type { CreateConnectedAccountInput, ConnectedAccountPatch } from '../../orm/input-types'; +const fieldSchema: FieldSchema = { id: 'uuid', ownerId: 'uuid', service: 'string', @@ -38,7 +39,7 @@ export default async ( options: ['list', 'get', 'create', 'update', 'delete'], }, ]); - return handleTableSubcommand(answer.subcommand, newArgv, prompter); + return handleTableSubcommand(answer.subcommand as string, newArgv, prompter); } return handleTableSubcommand(subcommand, newArgv, prompter); }; @@ -102,7 +103,7 @@ async function handleGet(argv: Partial>, prompter: Inqui const client = getClient(); const result = await client.connectedAccount .findOne({ - id: answers.id, + id: answers.id as string, select: { id: true, ownerId: true, @@ -159,7 +160,10 @@ async function handleCreate(argv: Partial>, prompter: In }, ]); const answers = coerceAnswers(rawAnswers, fieldSchema); - const cleanedData = stripUndefined(answers, fieldSchema); + const cleanedData = stripUndefined( + answers, + fieldSchema + ) as CreateConnectedAccountInput['connectedAccount']; const client = getClient(); const result = await client.connectedAccount .create({ @@ -232,7 +236,7 @@ async function handleUpdate(argv: Partial>, prompter: In }, ]); const answers = coerceAnswers(rawAnswers, fieldSchema); - const cleanedData = stripUndefined(answers, fieldSchema); + const cleanedData = stripUndefined(answers, fieldSchema) as ConnectedAccountPatch; const client = getClient(); const result = await client.connectedAccount .update({ diff --git a/sdk/constructive-cli/src/auth/cli/commands/context.ts b/sdk/constructive-cli/src/auth/cli/commands/context.ts index 7f8262bb6..52d12c666 100644 --- a/sdk/constructive-cli/src/auth/cli/commands/context.ts +++ b/sdk/constructive-cli/src/auth/cli/commands/context.ts @@ -1,4 +1,3 @@ -// @ts-nocheck /** * Context management commands * @generated by @constructive-io/graphql-codegen @@ -28,7 +27,7 @@ export default async ( options: ['create', 'list', 'use', 'current', 'delete'], }, ]); - return handleSubcommand(answer.subcommand, newArgv, prompter, store); + return handleSubcommand(answer.subcommand as string, newArgv, prompter, store); } return handleSubcommand(subcommand, newArgv, prompter, store); }; @@ -60,7 +59,7 @@ async function handleCreate( store: ReturnType ) { const { first: name, newArgv: restArgv } = extractFirst(argv); - const answers = await prompter.prompt( + const answers = (await prompter.prompt( { name, ...restArgv, @@ -79,7 +78,7 @@ async function handleCreate( required: true, }, ] - ); + )) as unknown as Record; const contextName = answers.name; const endpoint = answers.endpoint; store.createContext(contextName, { @@ -128,7 +127,7 @@ async function handleUse( options: contexts.map((c) => c.name), }, ]); - contextName = answer.name; + contextName = answer.name as string; } if (store.setCurrentContext(contextName)) { console.log(`Switched to context: ${contextName}`); @@ -169,7 +168,7 @@ async function handleDelete( options: contexts.map((c) => c.name), }, ]); - contextName = answer.name; + contextName = answer.name as string; } if (store.deleteContext(contextName)) { console.log(`Deleted context: ${contextName}`); diff --git a/sdk/constructive-cli/src/auth/cli/commands/crypto-address.ts b/sdk/constructive-cli/src/auth/cli/commands/crypto-address.ts index 831614dee..fbef27bc6 100644 --- a/sdk/constructive-cli/src/auth/cli/commands/crypto-address.ts +++ b/sdk/constructive-cli/src/auth/cli/commands/crypto-address.ts @@ -1,4 +1,3 @@ -// @ts-nocheck /** * CLI commands for CryptoAddress * @generated by @constructive-io/graphql-codegen @@ -7,7 +6,9 @@ import { CLIOptions, Inquirerer, extractFirst } from 'inquirerer'; import { getClient } from '../executor'; import { coerceAnswers, stripUndefined } from '../utils'; -const fieldSchema = { +import type { FieldSchema } from '../utils'; +import type { CreateCryptoAddressInput, CryptoAddressPatch } from '../../orm/input-types'; +const fieldSchema: FieldSchema = { id: 'uuid', ownerId: 'uuid', address: 'string', @@ -37,7 +38,7 @@ export default async ( options: ['list', 'get', 'create', 'update', 'delete'], }, ]); - return handleTableSubcommand(answer.subcommand, newArgv, prompter); + return handleTableSubcommand(answer.subcommand as string, newArgv, prompter); } return handleTableSubcommand(subcommand, newArgv, prompter); }; @@ -100,7 +101,7 @@ async function handleGet(argv: Partial>, prompter: Inqui const client = getClient(); const result = await client.cryptoAddress .findOne({ - id: answers.id, + id: answers.id as string, select: { id: true, ownerId: true, @@ -150,7 +151,10 @@ async function handleCreate(argv: Partial>, prompter: In }, ]); const answers = coerceAnswers(rawAnswers, fieldSchema); - const cleanedData = stripUndefined(answers, fieldSchema); + const cleanedData = stripUndefined( + answers, + fieldSchema + ) as CreateCryptoAddressInput['cryptoAddress']; const client = getClient(); const result = await client.cryptoAddress .create({ @@ -215,7 +219,7 @@ async function handleUpdate(argv: Partial>, prompter: In }, ]); const answers = coerceAnswers(rawAnswers, fieldSchema); - const cleanedData = stripUndefined(answers, fieldSchema); + const cleanedData = stripUndefined(answers, fieldSchema) as CryptoAddressPatch; const client = getClient(); const result = await client.cryptoAddress .update({ diff --git a/sdk/constructive-cli/src/auth/cli/commands/current-ip-address.ts b/sdk/constructive-cli/src/auth/cli/commands/current-ip-address.ts index 1cc9889d5..e2dd3037d 100644 --- a/sdk/constructive-cli/src/auth/cli/commands/current-ip-address.ts +++ b/sdk/constructive-cli/src/auth/cli/commands/current-ip-address.ts @@ -1,4 +1,3 @@ -// @ts-nocheck /** * CLI command for query currentIpAddress * @generated by @constructive-io/graphql-codegen diff --git a/sdk/constructive-cli/src/auth/cli/commands/current-user-agent.ts b/sdk/constructive-cli/src/auth/cli/commands/current-user-agent.ts index bfda7984a..9191321fb 100644 --- a/sdk/constructive-cli/src/auth/cli/commands/current-user-agent.ts +++ b/sdk/constructive-cli/src/auth/cli/commands/current-user-agent.ts @@ -1,4 +1,3 @@ -// @ts-nocheck /** * CLI command for query currentUserAgent * @generated by @constructive-io/graphql-codegen diff --git a/sdk/constructive-cli/src/auth/cli/commands/current-user-id.ts b/sdk/constructive-cli/src/auth/cli/commands/current-user-id.ts index d719c2bca..0ade5d19e 100644 --- a/sdk/constructive-cli/src/auth/cli/commands/current-user-id.ts +++ b/sdk/constructive-cli/src/auth/cli/commands/current-user-id.ts @@ -1,4 +1,3 @@ -// @ts-nocheck /** * CLI command for query currentUserId * @generated by @constructive-io/graphql-codegen diff --git a/sdk/constructive-cli/src/auth/cli/commands/current-user.ts b/sdk/constructive-cli/src/auth/cli/commands/current-user.ts index 55f33a839..14c69246b 100644 --- a/sdk/constructive-cli/src/auth/cli/commands/current-user.ts +++ b/sdk/constructive-cli/src/auth/cli/commands/current-user.ts @@ -1,4 +1,3 @@ -// @ts-nocheck /** * CLI command for query currentUser * @generated by @constructive-io/graphql-codegen @@ -7,6 +6,7 @@ import { CLIOptions, Inquirerer } from 'inquirerer'; import { getClient } from '../executor'; import { buildSelectFromPaths } from '../utils'; +import type { UserSelect } from '../../orm/input-types'; export default async ( argv: Partial>, prompter: Inquirerer, @@ -18,10 +18,12 @@ export default async ( process.exit(0); } const client = getClient(); - const selectFields = buildSelectFromPaths(argv.select ?? ''); + const selectFields = buildSelectFromPaths((argv.select as string) ?? ''); const result = await client.query .currentUser({ select: selectFields, + } as unknown as { + select: UserSelect; }) .execute(); console.log(JSON.stringify(result, null, 2)); diff --git a/sdk/constructive-cli/src/auth/cli/commands/email.ts b/sdk/constructive-cli/src/auth/cli/commands/email.ts index 68a64aa94..4c9aa304a 100644 --- a/sdk/constructive-cli/src/auth/cli/commands/email.ts +++ b/sdk/constructive-cli/src/auth/cli/commands/email.ts @@ -1,4 +1,3 @@ -// @ts-nocheck /** * CLI commands for Email * @generated by @constructive-io/graphql-codegen @@ -7,7 +6,9 @@ import { CLIOptions, Inquirerer, extractFirst } from 'inquirerer'; import { getClient } from '../executor'; import { coerceAnswers, stripUndefined } from '../utils'; -const fieldSchema = { +import type { FieldSchema } from '../utils'; +import type { CreateEmailInput, EmailPatch } from '../../orm/input-types'; +const fieldSchema: FieldSchema = { id: 'uuid', ownerId: 'uuid', email: 'string', @@ -37,7 +38,7 @@ export default async ( options: ['list', 'get', 'create', 'update', 'delete'], }, ]); - return handleTableSubcommand(answer.subcommand, newArgv, prompter); + return handleTableSubcommand(answer.subcommand as string, newArgv, prompter); } return handleTableSubcommand(subcommand, newArgv, prompter); }; @@ -100,7 +101,7 @@ async function handleGet(argv: Partial>, prompter: Inqui const client = getClient(); const result = await client.email .findOne({ - id: answers.id, + id: answers.id as string, select: { id: true, ownerId: true, @@ -150,7 +151,7 @@ async function handleCreate(argv: Partial>, prompter: In }, ]); const answers = coerceAnswers(rawAnswers, fieldSchema); - const cleanedData = stripUndefined(answers, fieldSchema); + const cleanedData = stripUndefined(answers, fieldSchema) as CreateEmailInput['email']; const client = getClient(); const result = await client.email .create({ @@ -215,7 +216,7 @@ async function handleUpdate(argv: Partial>, prompter: In }, ]); const answers = coerceAnswers(rawAnswers, fieldSchema); - const cleanedData = stripUndefined(answers, fieldSchema); + const cleanedData = stripUndefined(answers, fieldSchema) as EmailPatch; const client = getClient(); const result = await client.email .update({ diff --git a/sdk/constructive-cli/src/auth/cli/commands/extend-token-expires.ts b/sdk/constructive-cli/src/auth/cli/commands/extend-token-expires.ts index 011b80d61..74638bd9d 100644 --- a/sdk/constructive-cli/src/auth/cli/commands/extend-token-expires.ts +++ b/sdk/constructive-cli/src/auth/cli/commands/extend-token-expires.ts @@ -1,4 +1,3 @@ -// @ts-nocheck /** * CLI command for mutation extendTokenExpires * @generated by @constructive-io/graphql-codegen @@ -7,6 +6,8 @@ import { CLIOptions, Inquirerer } from 'inquirerer'; import { getClient } from '../executor'; import { parseMutationInput, buildSelectFromPaths } from '../utils'; +import type { ExtendTokenExpiresVariables } from '../../orm/mutation'; +import type { ExtendTokenExpiresPayloadSelect } from '../../orm/input-types'; export default async ( argv: Partial>, prompter: Inquirerer, @@ -30,11 +31,16 @@ export default async ( ]); const client = getClient(); const parsedAnswers = parseMutationInput(answers); - const selectFields = buildSelectFromPaths(argv.select ?? 'clientMutationId'); + const selectFields = buildSelectFromPaths((argv.select as string) ?? 'clientMutationId'); const result = await client.mutation - .extendTokenExpires(parsedAnswers, { - select: selectFields, - }) + .extendTokenExpires( + parsedAnswers as unknown as ExtendTokenExpiresVariables, + { + select: selectFields, + } as unknown as { + select: ExtendTokenExpiresPayloadSelect; + } + ) .execute(); console.log(JSON.stringify(result, null, 2)); } catch (error) { diff --git a/sdk/constructive-cli/src/auth/cli/commands/forgot-password.ts b/sdk/constructive-cli/src/auth/cli/commands/forgot-password.ts index f912ca75b..65ed743a9 100644 --- a/sdk/constructive-cli/src/auth/cli/commands/forgot-password.ts +++ b/sdk/constructive-cli/src/auth/cli/commands/forgot-password.ts @@ -1,4 +1,3 @@ -// @ts-nocheck /** * CLI command for mutation forgotPassword * @generated by @constructive-io/graphql-codegen @@ -7,6 +6,8 @@ import { CLIOptions, Inquirerer } from 'inquirerer'; import { getClient } from '../executor'; import { parseMutationInput, buildSelectFromPaths } from '../utils'; +import type { ForgotPasswordVariables } from '../../orm/mutation'; +import type { ForgotPasswordPayloadSelect } from '../../orm/input-types'; export default async ( argv: Partial>, prompter: Inquirerer, @@ -28,11 +29,16 @@ export default async ( ]); const client = getClient(); const parsedAnswers = parseMutationInput(answers); - const selectFields = buildSelectFromPaths(argv.select ?? 'clientMutationId'); + const selectFields = buildSelectFromPaths((argv.select as string) ?? 'clientMutationId'); const result = await client.mutation - .forgotPassword(parsedAnswers, { - select: selectFields, - }) + .forgotPassword( + parsedAnswers as unknown as ForgotPasswordVariables, + { + select: selectFields, + } as unknown as { + select: ForgotPasswordPayloadSelect; + } + ) .execute(); console.log(JSON.stringify(result, null, 2)); } catch (error) { diff --git a/sdk/constructive-cli/src/auth/cli/commands/one-time-token.ts b/sdk/constructive-cli/src/auth/cli/commands/one-time-token.ts index 13bb251e7..5cfad9cf5 100644 --- a/sdk/constructive-cli/src/auth/cli/commands/one-time-token.ts +++ b/sdk/constructive-cli/src/auth/cli/commands/one-time-token.ts @@ -1,4 +1,3 @@ -// @ts-nocheck /** * CLI command for mutation oneTimeToken * @generated by @constructive-io/graphql-codegen @@ -7,6 +6,8 @@ import { CLIOptions, Inquirerer } from 'inquirerer'; import { getClient } from '../executor'; import { parseMutationInput, buildSelectFromPaths } from '../utils'; +import type { OneTimeTokenVariables } from '../../orm/mutation'; +import type { OneTimeTokenPayloadSelect } from '../../orm/input-types'; export default async ( argv: Partial>, prompter: Inquirerer, @@ -28,11 +29,16 @@ export default async ( ]); const client = getClient(); const parsedAnswers = parseMutationInput(answers); - const selectFields = buildSelectFromPaths(argv.select ?? 'clientMutationId'); + const selectFields = buildSelectFromPaths((argv.select as string) ?? 'clientMutationId'); const result = await client.mutation - .oneTimeToken(parsedAnswers, { - select: selectFields, - }) + .oneTimeToken( + parsedAnswers as unknown as OneTimeTokenVariables, + { + select: selectFields, + } as unknown as { + select: OneTimeTokenPayloadSelect; + } + ) .execute(); console.log(JSON.stringify(result, null, 2)); } catch (error) { diff --git a/sdk/constructive-cli/src/auth/cli/commands/phone-number.ts b/sdk/constructive-cli/src/auth/cli/commands/phone-number.ts index 092c6422f..1645c15fa 100644 --- a/sdk/constructive-cli/src/auth/cli/commands/phone-number.ts +++ b/sdk/constructive-cli/src/auth/cli/commands/phone-number.ts @@ -1,4 +1,3 @@ -// @ts-nocheck /** * CLI commands for PhoneNumber * @generated by @constructive-io/graphql-codegen @@ -7,7 +6,9 @@ import { CLIOptions, Inquirerer, extractFirst } from 'inquirerer'; import { getClient } from '../executor'; import { coerceAnswers, stripUndefined } from '../utils'; -const fieldSchema = { +import type { FieldSchema } from '../utils'; +import type { CreatePhoneNumberInput, PhoneNumberPatch } from '../../orm/input-types'; +const fieldSchema: FieldSchema = { id: 'uuid', ownerId: 'uuid', cc: 'string', @@ -38,7 +39,7 @@ export default async ( options: ['list', 'get', 'create', 'update', 'delete'], }, ]); - return handleTableSubcommand(answer.subcommand, newArgv, prompter); + return handleTableSubcommand(answer.subcommand as string, newArgv, prompter); } return handleTableSubcommand(subcommand, newArgv, prompter); }; @@ -102,7 +103,7 @@ async function handleGet(argv: Partial>, prompter: Inqui const client = getClient(); const result = await client.phoneNumber .findOne({ - id: answers.id, + id: answers.id as string, select: { id: true, ownerId: true, @@ -159,7 +160,10 @@ async function handleCreate(argv: Partial>, prompter: In }, ]); const answers = coerceAnswers(rawAnswers, fieldSchema); - const cleanedData = stripUndefined(answers, fieldSchema); + const cleanedData = stripUndefined( + answers, + fieldSchema + ) as CreatePhoneNumberInput['phoneNumber']; const client = getClient(); const result = await client.phoneNumber .create({ @@ -232,7 +236,7 @@ async function handleUpdate(argv: Partial>, prompter: In }, ]); const answers = coerceAnswers(rawAnswers, fieldSchema); - const cleanedData = stripUndefined(answers, fieldSchema); + const cleanedData = stripUndefined(answers, fieldSchema) as PhoneNumberPatch; const client = getClient(); const result = await client.phoneNumber .update({ diff --git a/sdk/constructive-cli/src/auth/cli/commands/reset-password.ts b/sdk/constructive-cli/src/auth/cli/commands/reset-password.ts index 480f76fbe..58086bdcc 100644 --- a/sdk/constructive-cli/src/auth/cli/commands/reset-password.ts +++ b/sdk/constructive-cli/src/auth/cli/commands/reset-password.ts @@ -1,4 +1,3 @@ -// @ts-nocheck /** * CLI command for mutation resetPassword * @generated by @constructive-io/graphql-codegen @@ -7,6 +6,8 @@ import { CLIOptions, Inquirerer } from 'inquirerer'; import { getClient } from '../executor'; import { parseMutationInput, buildSelectFromPaths } from '../utils'; +import type { ResetPasswordVariables } from '../../orm/mutation'; +import type { ResetPasswordPayloadSelect } from '../../orm/input-types'; export default async ( argv: Partial>, prompter: Inquirerer, @@ -28,11 +29,16 @@ export default async ( ]); const client = getClient(); const parsedAnswers = parseMutationInput(answers); - const selectFields = buildSelectFromPaths(argv.select ?? 'clientMutationId'); + const selectFields = buildSelectFromPaths((argv.select as string) ?? 'clientMutationId'); const result = await client.mutation - .resetPassword(parsedAnswers, { - select: selectFields, - }) + .resetPassword( + parsedAnswers as unknown as ResetPasswordVariables, + { + select: selectFields, + } as unknown as { + select: ResetPasswordPayloadSelect; + } + ) .execute(); console.log(JSON.stringify(result, null, 2)); } catch (error) { diff --git a/sdk/constructive-cli/src/auth/cli/commands/role-type.ts b/sdk/constructive-cli/src/auth/cli/commands/role-type.ts index 9c170c8f6..dc6e319c0 100644 --- a/sdk/constructive-cli/src/auth/cli/commands/role-type.ts +++ b/sdk/constructive-cli/src/auth/cli/commands/role-type.ts @@ -1,4 +1,3 @@ -// @ts-nocheck /** * CLI commands for RoleType * @generated by @constructive-io/graphql-codegen @@ -7,7 +6,9 @@ import { CLIOptions, Inquirerer, extractFirst } from 'inquirerer'; import { getClient } from '../executor'; import { coerceAnswers, stripUndefined } from '../utils'; -const fieldSchema = { +import type { FieldSchema } from '../utils'; +import type { CreateRoleTypeInput, RoleTypePatch } from '../../orm/input-types'; +const fieldSchema: FieldSchema = { id: 'int', name: 'string', }; @@ -32,7 +33,7 @@ export default async ( options: ['list', 'get', 'create', 'update', 'delete'], }, ]); - return handleTableSubcommand(answer.subcommand, newArgv, prompter); + return handleTableSubcommand(answer.subcommand as string, newArgv, prompter); } return handleTableSubcommand(subcommand, newArgv, prompter); }; @@ -90,7 +91,7 @@ async function handleGet(argv: Partial>, prompter: Inqui const client = getClient(); const result = await client.roleType .findOne({ - id: answers.id, + id: answers.id as number, select: { id: true, name: true, @@ -117,7 +118,7 @@ async function handleCreate(argv: Partial>, prompter: In }, ]); const answers = coerceAnswers(rawAnswers, fieldSchema); - const cleanedData = stripUndefined(answers, fieldSchema); + const cleanedData = stripUndefined(answers, fieldSchema) as CreateRoleTypeInput['roleType']; const client = getClient(); const result = await client.roleType .create({ @@ -156,12 +157,12 @@ async function handleUpdate(argv: Partial>, prompter: In }, ]); const answers = coerceAnswers(rawAnswers, fieldSchema); - const cleanedData = stripUndefined(answers, fieldSchema); + const cleanedData = stripUndefined(answers, fieldSchema) as RoleTypePatch; const client = getClient(); const result = await client.roleType .update({ where: { - id: answers.id as string, + id: answers.id as number, }, data: { name: cleanedData.name, @@ -196,7 +197,7 @@ async function handleDelete(argv: Partial>, prompter: In const result = await client.roleType .delete({ where: { - id: answers.id as string, + id: answers.id as number, }, select: { id: true, diff --git a/sdk/constructive-cli/src/auth/cli/commands/send-account-deletion-email.ts b/sdk/constructive-cli/src/auth/cli/commands/send-account-deletion-email.ts index b44a95b92..4f4e2ad15 100644 --- a/sdk/constructive-cli/src/auth/cli/commands/send-account-deletion-email.ts +++ b/sdk/constructive-cli/src/auth/cli/commands/send-account-deletion-email.ts @@ -1,4 +1,3 @@ -// @ts-nocheck /** * CLI command for mutation sendAccountDeletionEmail * @generated by @constructive-io/graphql-codegen @@ -7,6 +6,8 @@ import { CLIOptions, Inquirerer } from 'inquirerer'; import { getClient } from '../executor'; import { parseMutationInput, buildSelectFromPaths } from '../utils'; +import type { SendAccountDeletionEmailVariables } from '../../orm/mutation'; +import type { SendAccountDeletionEmailPayloadSelect } from '../../orm/input-types'; export default async ( argv: Partial>, prompter: Inquirerer, @@ -30,11 +31,16 @@ export default async ( ]); const client = getClient(); const parsedAnswers = parseMutationInput(answers); - const selectFields = buildSelectFromPaths(argv.select ?? 'clientMutationId'); + const selectFields = buildSelectFromPaths((argv.select as string) ?? 'clientMutationId'); const result = await client.mutation - .sendAccountDeletionEmail(parsedAnswers, { - select: selectFields, - }) + .sendAccountDeletionEmail( + parsedAnswers as unknown as SendAccountDeletionEmailVariables, + { + select: selectFields, + } as unknown as { + select: SendAccountDeletionEmailPayloadSelect; + } + ) .execute(); console.log(JSON.stringify(result, null, 2)); } catch (error) { diff --git a/sdk/constructive-cli/src/auth/cli/commands/send-verification-email.ts b/sdk/constructive-cli/src/auth/cli/commands/send-verification-email.ts index 73d848f9c..5a12954a7 100644 --- a/sdk/constructive-cli/src/auth/cli/commands/send-verification-email.ts +++ b/sdk/constructive-cli/src/auth/cli/commands/send-verification-email.ts @@ -1,4 +1,3 @@ -// @ts-nocheck /** * CLI command for mutation sendVerificationEmail * @generated by @constructive-io/graphql-codegen @@ -7,6 +6,8 @@ import { CLIOptions, Inquirerer } from 'inquirerer'; import { getClient } from '../executor'; import { parseMutationInput, buildSelectFromPaths } from '../utils'; +import type { SendVerificationEmailVariables } from '../../orm/mutation'; +import type { SendVerificationEmailPayloadSelect } from '../../orm/input-types'; export default async ( argv: Partial>, prompter: Inquirerer, @@ -30,11 +31,16 @@ export default async ( ]); const client = getClient(); const parsedAnswers = parseMutationInput(answers); - const selectFields = buildSelectFromPaths(argv.select ?? 'clientMutationId'); + const selectFields = buildSelectFromPaths((argv.select as string) ?? 'clientMutationId'); const result = await client.mutation - .sendVerificationEmail(parsedAnswers, { - select: selectFields, - }) + .sendVerificationEmail( + parsedAnswers as unknown as SendVerificationEmailVariables, + { + select: selectFields, + } as unknown as { + select: SendVerificationEmailPayloadSelect; + } + ) .execute(); console.log(JSON.stringify(result, null, 2)); } catch (error) { diff --git a/sdk/constructive-cli/src/auth/cli/commands/set-password.ts b/sdk/constructive-cli/src/auth/cli/commands/set-password.ts index 9dead0903..ef6da0931 100644 --- a/sdk/constructive-cli/src/auth/cli/commands/set-password.ts +++ b/sdk/constructive-cli/src/auth/cli/commands/set-password.ts @@ -1,4 +1,3 @@ -// @ts-nocheck /** * CLI command for mutation setPassword * @generated by @constructive-io/graphql-codegen @@ -7,6 +6,8 @@ import { CLIOptions, Inquirerer } from 'inquirerer'; import { getClient } from '../executor'; import { parseMutationInput, buildSelectFromPaths } from '../utils'; +import type { SetPasswordVariables } from '../../orm/mutation'; +import type { SetPasswordPayloadSelect } from '../../orm/input-types'; export default async ( argv: Partial>, prompter: Inquirerer, @@ -28,11 +29,16 @@ export default async ( ]); const client = getClient(); const parsedAnswers = parseMutationInput(answers); - const selectFields = buildSelectFromPaths(argv.select ?? 'clientMutationId'); + const selectFields = buildSelectFromPaths((argv.select as string) ?? 'clientMutationId'); const result = await client.mutation - .setPassword(parsedAnswers, { - select: selectFields, - }) + .setPassword( + parsedAnswers as unknown as SetPasswordVariables, + { + select: selectFields, + } as unknown as { + select: SetPasswordPayloadSelect; + } + ) .execute(); console.log(JSON.stringify(result, null, 2)); } catch (error) { diff --git a/sdk/constructive-cli/src/auth/cli/commands/sign-in-one-time-token.ts b/sdk/constructive-cli/src/auth/cli/commands/sign-in-one-time-token.ts index 4683f88f8..64617736f 100644 --- a/sdk/constructive-cli/src/auth/cli/commands/sign-in-one-time-token.ts +++ b/sdk/constructive-cli/src/auth/cli/commands/sign-in-one-time-token.ts @@ -1,4 +1,3 @@ -// @ts-nocheck /** * CLI command for mutation signInOneTimeToken * @generated by @constructive-io/graphql-codegen @@ -7,6 +6,8 @@ import { CLIOptions, Inquirerer } from 'inquirerer'; import { getClient } from '../executor'; import { parseMutationInput, buildSelectFromPaths } from '../utils'; +import type { SignInOneTimeTokenVariables } from '../../orm/mutation'; +import type { SignInOneTimeTokenPayloadSelect } from '../../orm/input-types'; export default async ( argv: Partial>, prompter: Inquirerer, @@ -30,11 +31,16 @@ export default async ( ]); const client = getClient(); const parsedAnswers = parseMutationInput(answers); - const selectFields = buildSelectFromPaths(argv.select ?? 'clientMutationId'); + const selectFields = buildSelectFromPaths((argv.select as string) ?? 'clientMutationId'); const result = await client.mutation - .signInOneTimeToken(parsedAnswers, { - select: selectFields, - }) + .signInOneTimeToken( + parsedAnswers as unknown as SignInOneTimeTokenVariables, + { + select: selectFields, + } as unknown as { + select: SignInOneTimeTokenPayloadSelect; + } + ) .execute(); console.log(JSON.stringify(result, null, 2)); } catch (error) { diff --git a/sdk/constructive-cli/src/auth/cli/commands/sign-in.ts b/sdk/constructive-cli/src/auth/cli/commands/sign-in.ts index 72ea70174..5f106c0c8 100644 --- a/sdk/constructive-cli/src/auth/cli/commands/sign-in.ts +++ b/sdk/constructive-cli/src/auth/cli/commands/sign-in.ts @@ -1,4 +1,3 @@ -// @ts-nocheck /** * CLI command for mutation signIn * @generated by @constructive-io/graphql-codegen @@ -7,6 +6,8 @@ import { CLIOptions, Inquirerer } from 'inquirerer'; import { getClient } from '../executor'; import { parseMutationInput, buildSelectFromPaths } from '../utils'; +import type { SignInVariables } from '../../orm/mutation'; +import type { SignInPayloadSelect } from '../../orm/input-types'; export default async ( argv: Partial>, prompter: Inquirerer, @@ -28,11 +29,16 @@ export default async ( ]); const client = getClient(); const parsedAnswers = parseMutationInput(answers); - const selectFields = buildSelectFromPaths(argv.select ?? 'clientMutationId'); + const selectFields = buildSelectFromPaths((argv.select as string) ?? 'clientMutationId'); const result = await client.mutation - .signIn(parsedAnswers, { - select: selectFields, - }) + .signIn( + parsedAnswers as unknown as SignInVariables, + { + select: selectFields, + } as unknown as { + select: SignInPayloadSelect; + } + ) .execute(); console.log(JSON.stringify(result, null, 2)); } catch (error) { diff --git a/sdk/constructive-cli/src/auth/cli/commands/sign-out.ts b/sdk/constructive-cli/src/auth/cli/commands/sign-out.ts index 0c70f3c0d..331f6073b 100644 --- a/sdk/constructive-cli/src/auth/cli/commands/sign-out.ts +++ b/sdk/constructive-cli/src/auth/cli/commands/sign-out.ts @@ -1,4 +1,3 @@ -// @ts-nocheck /** * CLI command for mutation signOut * @generated by @constructive-io/graphql-codegen @@ -7,6 +6,8 @@ import { CLIOptions, Inquirerer } from 'inquirerer'; import { getClient } from '../executor'; import { parseMutationInput, buildSelectFromPaths } from '../utils'; +import type { SignOutVariables } from '../../orm/mutation'; +import type { SignOutPayloadSelect } from '../../orm/input-types'; export default async ( argv: Partial>, prompter: Inquirerer, @@ -28,11 +29,16 @@ export default async ( ]); const client = getClient(); const parsedAnswers = parseMutationInput(answers); - const selectFields = buildSelectFromPaths(argv.select ?? 'clientMutationId'); + const selectFields = buildSelectFromPaths((argv.select as string) ?? 'clientMutationId'); const result = await client.mutation - .signOut(parsedAnswers, { - select: selectFields, - }) + .signOut( + parsedAnswers as unknown as SignOutVariables, + { + select: selectFields, + } as unknown as { + select: SignOutPayloadSelect; + } + ) .execute(); console.log(JSON.stringify(result, null, 2)); } catch (error) { diff --git a/sdk/constructive-cli/src/auth/cli/commands/sign-up.ts b/sdk/constructive-cli/src/auth/cli/commands/sign-up.ts index afe5ade97..e5ead7b45 100644 --- a/sdk/constructive-cli/src/auth/cli/commands/sign-up.ts +++ b/sdk/constructive-cli/src/auth/cli/commands/sign-up.ts @@ -1,4 +1,3 @@ -// @ts-nocheck /** * CLI command for mutation signUp * @generated by @constructive-io/graphql-codegen @@ -7,6 +6,8 @@ import { CLIOptions, Inquirerer } from 'inquirerer'; import { getClient } from '../executor'; import { parseMutationInput, buildSelectFromPaths } from '../utils'; +import type { SignUpVariables } from '../../orm/mutation'; +import type { SignUpPayloadSelect } from '../../orm/input-types'; export default async ( argv: Partial>, prompter: Inquirerer, @@ -28,11 +29,16 @@ export default async ( ]); const client = getClient(); const parsedAnswers = parseMutationInput(answers); - const selectFields = buildSelectFromPaths(argv.select ?? 'clientMutationId'); + const selectFields = buildSelectFromPaths((argv.select as string) ?? 'clientMutationId'); const result = await client.mutation - .signUp(parsedAnswers, { - select: selectFields, - }) + .signUp( + parsedAnswers as unknown as SignUpVariables, + { + select: selectFields, + } as unknown as { + select: SignUpPayloadSelect; + } + ) .execute(); console.log(JSON.stringify(result, null, 2)); } catch (error) { diff --git a/sdk/constructive-cli/src/auth/cli/commands/user.ts b/sdk/constructive-cli/src/auth/cli/commands/user.ts index dcdb5b416..1932cb03f 100644 --- a/sdk/constructive-cli/src/auth/cli/commands/user.ts +++ b/sdk/constructive-cli/src/auth/cli/commands/user.ts @@ -1,4 +1,3 @@ -// @ts-nocheck /** * CLI commands for User * @generated by @constructive-io/graphql-codegen @@ -7,7 +6,9 @@ import { CLIOptions, Inquirerer, extractFirst } from 'inquirerer'; import { getClient } from '../executor'; import { coerceAnswers, stripUndefined } from '../utils'; -const fieldSchema = { +import type { FieldSchema } from '../utils'; +import type { CreateUserInput, UserPatch } from '../../orm/input-types'; +const fieldSchema: FieldSchema = { id: 'uuid', username: 'string', displayName: 'string', @@ -39,7 +40,7 @@ export default async ( options: ['list', 'get', 'create', 'update', 'delete'], }, ]); - return handleTableSubcommand(answer.subcommand, newArgv, prompter); + return handleTableSubcommand(answer.subcommand as string, newArgv, prompter); } return handleTableSubcommand(subcommand, newArgv, prompter); }; @@ -104,7 +105,7 @@ async function handleGet(argv: Partial>, prompter: Inqui const client = getClient(); const result = await client.user .findOne({ - id: answers.id, + id: answers.id as string, select: { id: true, username: true, @@ -160,15 +161,9 @@ async function handleCreate(argv: Partial>, prompter: In message: 'type', required: false, }, - { - type: 'text', - name: 'searchTsvRank', - message: 'searchTsvRank', - required: true, - }, ]); const answers = coerceAnswers(rawAnswers, fieldSchema); - const cleanedData = stripUndefined(answers, fieldSchema); + const cleanedData = stripUndefined(answers, fieldSchema) as CreateUserInput['user']; const client = getClient(); const result = await client.user .create({ @@ -178,7 +173,6 @@ async function handleCreate(argv: Partial>, prompter: In profilePicture: cleanedData.profilePicture, searchTsv: cleanedData.searchTsv, type: cleanedData.type, - searchTsvRank: cleanedData.searchTsvRank, }, select: { id: true, @@ -241,15 +235,9 @@ async function handleUpdate(argv: Partial>, prompter: In message: 'type', required: false, }, - { - type: 'text', - name: 'searchTsvRank', - message: 'searchTsvRank', - required: false, - }, ]); const answers = coerceAnswers(rawAnswers, fieldSchema); - const cleanedData = stripUndefined(answers, fieldSchema); + const cleanedData = stripUndefined(answers, fieldSchema) as UserPatch; const client = getClient(); const result = await client.user .update({ @@ -262,7 +250,6 @@ async function handleUpdate(argv: Partial>, prompter: In profilePicture: cleanedData.profilePicture, searchTsv: cleanedData.searchTsv, type: cleanedData.type, - searchTsvRank: cleanedData.searchTsvRank, }, select: { id: true, diff --git a/sdk/constructive-cli/src/auth/cli/commands/verify-email.ts b/sdk/constructive-cli/src/auth/cli/commands/verify-email.ts index f6302c6ff..31012e653 100644 --- a/sdk/constructive-cli/src/auth/cli/commands/verify-email.ts +++ b/sdk/constructive-cli/src/auth/cli/commands/verify-email.ts @@ -1,4 +1,3 @@ -// @ts-nocheck /** * CLI command for mutation verifyEmail * @generated by @constructive-io/graphql-codegen @@ -7,6 +6,8 @@ import { CLIOptions, Inquirerer } from 'inquirerer'; import { getClient } from '../executor'; import { parseMutationInput, buildSelectFromPaths } from '../utils'; +import type { VerifyEmailVariables } from '../../orm/mutation'; +import type { VerifyEmailPayloadSelect } from '../../orm/input-types'; export default async ( argv: Partial>, prompter: Inquirerer, @@ -28,11 +29,16 @@ export default async ( ]); const client = getClient(); const parsedAnswers = parseMutationInput(answers); - const selectFields = buildSelectFromPaths(argv.select ?? 'clientMutationId'); + const selectFields = buildSelectFromPaths((argv.select as string) ?? 'clientMutationId'); const result = await client.mutation - .verifyEmail(parsedAnswers, { - select: selectFields, - }) + .verifyEmail( + parsedAnswers as unknown as VerifyEmailVariables, + { + select: selectFields, + } as unknown as { + select: VerifyEmailPayloadSelect; + } + ) .execute(); console.log(JSON.stringify(result, null, 2)); } catch (error) { diff --git a/sdk/constructive-cli/src/auth/cli/commands/verify-password.ts b/sdk/constructive-cli/src/auth/cli/commands/verify-password.ts index 28fe9f91b..1fbec78f4 100644 --- a/sdk/constructive-cli/src/auth/cli/commands/verify-password.ts +++ b/sdk/constructive-cli/src/auth/cli/commands/verify-password.ts @@ -1,4 +1,3 @@ -// @ts-nocheck /** * CLI command for mutation verifyPassword * @generated by @constructive-io/graphql-codegen @@ -7,6 +6,8 @@ import { CLIOptions, Inquirerer } from 'inquirerer'; import { getClient } from '../executor'; import { parseMutationInput, buildSelectFromPaths } from '../utils'; +import type { VerifyPasswordVariables } from '../../orm/mutation'; +import type { VerifyPasswordPayloadSelect } from '../../orm/input-types'; export default async ( argv: Partial>, prompter: Inquirerer, @@ -28,11 +29,16 @@ export default async ( ]); const client = getClient(); const parsedAnswers = parseMutationInput(answers); - const selectFields = buildSelectFromPaths(argv.select ?? 'clientMutationId'); + const selectFields = buildSelectFromPaths((argv.select as string) ?? 'clientMutationId'); const result = await client.mutation - .verifyPassword(parsedAnswers, { - select: selectFields, - }) + .verifyPassword( + parsedAnswers as unknown as VerifyPasswordVariables, + { + select: selectFields, + } as unknown as { + select: VerifyPasswordPayloadSelect; + } + ) .execute(); console.log(JSON.stringify(result, null, 2)); } catch (error) { diff --git a/sdk/constructive-cli/src/auth/cli/commands/verify-totp.ts b/sdk/constructive-cli/src/auth/cli/commands/verify-totp.ts index fadbb9235..b8c3f8267 100644 --- a/sdk/constructive-cli/src/auth/cli/commands/verify-totp.ts +++ b/sdk/constructive-cli/src/auth/cli/commands/verify-totp.ts @@ -1,4 +1,3 @@ -// @ts-nocheck /** * CLI command for mutation verifyTotp * @generated by @constructive-io/graphql-codegen @@ -7,6 +6,8 @@ import { CLIOptions, Inquirerer } from 'inquirerer'; import { getClient } from '../executor'; import { parseMutationInput, buildSelectFromPaths } from '../utils'; +import type { VerifyTotpVariables } from '../../orm/mutation'; +import type { VerifyTotpPayloadSelect } from '../../orm/input-types'; export default async ( argv: Partial>, prompter: Inquirerer, @@ -28,11 +29,16 @@ export default async ( ]); const client = getClient(); const parsedAnswers = parseMutationInput(answers); - const selectFields = buildSelectFromPaths(argv.select ?? 'clientMutationId'); + const selectFields = buildSelectFromPaths((argv.select as string) ?? 'clientMutationId'); const result = await client.mutation - .verifyTotp(parsedAnswers, { - select: selectFields, - }) + .verifyTotp( + parsedAnswers as unknown as VerifyTotpVariables, + { + select: selectFields, + } as unknown as { + select: VerifyTotpPayloadSelect; + } + ) .execute(); console.log(JSON.stringify(result, null, 2)); } catch (error) { diff --git a/sdk/constructive-cli/src/auth/cli/executor.ts b/sdk/constructive-cli/src/auth/cli/executor.ts index 08615a32b..721e8e68e 100644 --- a/sdk/constructive-cli/src/auth/cli/executor.ts +++ b/sdk/constructive-cli/src/auth/cli/executor.ts @@ -1,4 +1,3 @@ -// @ts-nocheck /** * Executor and config store for CLI * @generated by @constructive-io/graphql-codegen @@ -22,7 +21,7 @@ export function getClient(contextName?: string) { throw new Error('No active context. Run "context create" or "context use" first.'); } } - const headers = {}; + const headers: Record = {}; if (store.hasValidCredentials(ctx.name)) { const creds = store.getCredentials(ctx.name); if (creds?.token) { diff --git a/sdk/constructive-cli/src/auth/cli/index.ts b/sdk/constructive-cli/src/auth/cli/index.ts index fc2ecaced..05d1f1ecb 100644 --- a/sdk/constructive-cli/src/auth/cli/index.ts +++ b/sdk/constructive-cli/src/auth/cli/index.ts @@ -1,4 +1,3 @@ -// @ts-nocheck /** * CLI entry point * @generated by @constructive-io/graphql-codegen diff --git a/sdk/constructive-cli/src/auth/cli/node-fetch.ts b/sdk/constructive-cli/src/auth/cli/node-fetch.ts index 7390a6cb6..81bb05834 100644 --- a/sdk/constructive-cli/src/auth/cli/node-fetch.ts +++ b/sdk/constructive-cli/src/auth/cli/node-fetch.ts @@ -1,4 +1,3 @@ -// @ts-nocheck /** * Node HTTP adapter for localhost subdomain routing * @generated by @constructive-io/graphql-codegen diff --git a/sdk/constructive-cli/src/auth/cli/utils.ts b/sdk/constructive-cli/src/auth/cli/utils.ts index eb869282d..e55945fee 100644 --- a/sdk/constructive-cli/src/auth/cli/utils.ts +++ b/sdk/constructive-cli/src/auth/cli/utils.ts @@ -1,4 +1,3 @@ -// @ts-nocheck /** * CLI utility functions for type coercion and input handling * @generated by @constructive-io/graphql-codegen diff --git a/sdk/constructive-cli/src/objects/cli/commands.ts b/sdk/constructive-cli/src/objects/cli/commands.ts index 1d85c85a7..0a7124f90 100644 --- a/sdk/constructive-cli/src/objects/cli/commands.ts +++ b/sdk/constructive-cli/src/objects/cli/commands.ts @@ -1,4 +1,3 @@ -// @ts-nocheck /** * CLI command map and entry point * @generated by @constructive-io/graphql-codegen @@ -24,7 +23,14 @@ import setPropsAndCommitCmd from './commands/set-props-and-commit'; import insertNodeAtPathCmd from './commands/insert-node-at-path'; import updateNodeAtPathCmd from './commands/update-node-at-path'; import setAndCommitCmd from './commands/set-and-commit'; -const createCommandMap = () => ({ +const createCommandMap: () => Record< + string, + ( + argv: Partial>, + prompter: Inquirerer, + options: CLIOptions + ) => Promise +> = () => ({ context: contextCmd, auth: authCmd, 'get-all-record': getAllRecordCmd, @@ -67,7 +73,7 @@ export const commands = async ( options: Object.keys(commandMap), }, ]); - command = answer.command; + command = answer.command as string; } const commandFn = commandMap[command]; if (!commandFn) { diff --git a/sdk/constructive-cli/src/objects/cli/commands/auth.ts b/sdk/constructive-cli/src/objects/cli/commands/auth.ts index 1bfe7085c..c731ba27c 100644 --- a/sdk/constructive-cli/src/objects/cli/commands/auth.ts +++ b/sdk/constructive-cli/src/objects/cli/commands/auth.ts @@ -1,4 +1,3 @@ -// @ts-nocheck /** * Authentication commands * @generated by @constructive-io/graphql-codegen @@ -28,7 +27,7 @@ export default async ( options: ['set-token', 'status', 'logout'], }, ]); - return handleAuthSubcommand(answer.subcommand, newArgv, prompter, store); + return handleAuthSubcommand(answer.subcommand as string, newArgv, prompter, store); } return handleAuthSubcommand(subcommand, newArgv, prompter, store); }; @@ -71,7 +70,7 @@ async function handleSetToken( required: true, }, ]); - tokenValue = answer.token; + tokenValue = answer.token as string; } store.setCredentials(current.name, { token: String(tokenValue || '').trim(), @@ -112,7 +111,7 @@ async function handleLogout( default: false, }, ]); - if (!confirm.confirm) { + if (!(confirm.confirm as boolean)) { return; } if (store.removeCredentials(current.name)) { diff --git a/sdk/constructive-cli/src/objects/cli/commands/commit.ts b/sdk/constructive-cli/src/objects/cli/commands/commit.ts index 0172f1f39..4f884622d 100644 --- a/sdk/constructive-cli/src/objects/cli/commands/commit.ts +++ b/sdk/constructive-cli/src/objects/cli/commands/commit.ts @@ -1,4 +1,3 @@ -// @ts-nocheck /** * CLI commands for Commit * @generated by @constructive-io/graphql-codegen @@ -7,7 +6,9 @@ import { CLIOptions, Inquirerer, extractFirst } from 'inquirerer'; import { getClient } from '../executor'; import { coerceAnswers, stripUndefined } from '../utils'; -const fieldSchema = { +import type { FieldSchema } from '../utils'; +import type { CreateCommitInput, CommitPatch } from '../../orm/input-types'; +const fieldSchema: FieldSchema = { id: 'uuid', message: 'string', databaseId: 'uuid', @@ -39,7 +40,7 @@ export default async ( options: ['list', 'get', 'create', 'update', 'delete'], }, ]); - return handleTableSubcommand(answer.subcommand, newArgv, prompter); + return handleTableSubcommand(answer.subcommand as string, newArgv, prompter); } return handleTableSubcommand(subcommand, newArgv, prompter); }; @@ -104,7 +105,7 @@ async function handleGet(argv: Partial>, prompter: Inqui const client = getClient(); const result = await client.commit .findOne({ - id: answers.id, + id: answers.id as string, select: { id: true, message: true, @@ -180,7 +181,7 @@ async function handleCreate(argv: Partial>, prompter: In }, ]); const answers = coerceAnswers(rawAnswers, fieldSchema); - const cleanedData = stripUndefined(answers, fieldSchema); + const cleanedData = stripUndefined(answers, fieldSchema) as CreateCommitInput['commit']; const client = getClient(); const result = await client.commit .create({ @@ -275,7 +276,7 @@ async function handleUpdate(argv: Partial>, prompter: In }, ]); const answers = coerceAnswers(rawAnswers, fieldSchema); - const cleanedData = stripUndefined(answers, fieldSchema); + const cleanedData = stripUndefined(answers, fieldSchema) as CommitPatch; const client = getClient(); const result = await client.commit .update({ diff --git a/sdk/constructive-cli/src/objects/cli/commands/context.ts b/sdk/constructive-cli/src/objects/cli/commands/context.ts index 7f8262bb6..52d12c666 100644 --- a/sdk/constructive-cli/src/objects/cli/commands/context.ts +++ b/sdk/constructive-cli/src/objects/cli/commands/context.ts @@ -1,4 +1,3 @@ -// @ts-nocheck /** * Context management commands * @generated by @constructive-io/graphql-codegen @@ -28,7 +27,7 @@ export default async ( options: ['create', 'list', 'use', 'current', 'delete'], }, ]); - return handleSubcommand(answer.subcommand, newArgv, prompter, store); + return handleSubcommand(answer.subcommand as string, newArgv, prompter, store); } return handleSubcommand(subcommand, newArgv, prompter, store); }; @@ -60,7 +59,7 @@ async function handleCreate( store: ReturnType ) { const { first: name, newArgv: restArgv } = extractFirst(argv); - const answers = await prompter.prompt( + const answers = (await prompter.prompt( { name, ...restArgv, @@ -79,7 +78,7 @@ async function handleCreate( required: true, }, ] - ); + )) as unknown as Record; const contextName = answers.name; const endpoint = answers.endpoint; store.createContext(contextName, { @@ -128,7 +127,7 @@ async function handleUse( options: contexts.map((c) => c.name), }, ]); - contextName = answer.name; + contextName = answer.name as string; } if (store.setCurrentContext(contextName)) { console.log(`Switched to context: ${contextName}`); @@ -169,7 +168,7 @@ async function handleDelete( options: contexts.map((c) => c.name), }, ]); - contextName = answer.name; + contextName = answer.name as string; } if (store.deleteContext(contextName)) { console.log(`Deleted context: ${contextName}`); diff --git a/sdk/constructive-cli/src/objects/cli/commands/freeze-objects.ts b/sdk/constructive-cli/src/objects/cli/commands/freeze-objects.ts index 9ef7984cf..ebdea0b37 100644 --- a/sdk/constructive-cli/src/objects/cli/commands/freeze-objects.ts +++ b/sdk/constructive-cli/src/objects/cli/commands/freeze-objects.ts @@ -1,4 +1,3 @@ -// @ts-nocheck /** * CLI command for mutation freezeObjects * @generated by @constructive-io/graphql-codegen @@ -7,6 +6,8 @@ import { CLIOptions, Inquirerer } from 'inquirerer'; import { getClient } from '../executor'; import { parseMutationInput, buildSelectFromPaths } from '../utils'; +import type { FreezeObjectsVariables } from '../../orm/mutation'; +import type { FreezeObjectsPayloadSelect } from '../../orm/input-types'; export default async ( argv: Partial>, prompter: Inquirerer, @@ -28,11 +29,16 @@ export default async ( ]); const client = getClient(); const parsedAnswers = parseMutationInput(answers); - const selectFields = buildSelectFromPaths(argv.select ?? 'clientMutationId'); + const selectFields = buildSelectFromPaths((argv.select as string) ?? 'clientMutationId'); const result = await client.mutation - .freezeObjects(parsedAnswers, { - select: selectFields, - }) + .freezeObjects( + parsedAnswers as unknown as FreezeObjectsVariables, + { + select: selectFields, + } as unknown as { + select: FreezeObjectsPayloadSelect; + } + ) .execute(); console.log(JSON.stringify(result, null, 2)); } catch (error) { diff --git a/sdk/constructive-cli/src/objects/cli/commands/get-all-objects-from-root.ts b/sdk/constructive-cli/src/objects/cli/commands/get-all-objects-from-root.ts index 271ae4afa..6c2bef23b 100644 --- a/sdk/constructive-cli/src/objects/cli/commands/get-all-objects-from-root.ts +++ b/sdk/constructive-cli/src/objects/cli/commands/get-all-objects-from-root.ts @@ -1,4 +1,3 @@ -// @ts-nocheck /** * CLI command for query getAllObjectsFromRoot * @generated by @constructive-io/graphql-codegen @@ -7,6 +6,8 @@ import { CLIOptions, Inquirerer } from 'inquirerer'; import { getClient } from '../executor'; import { buildSelectFromPaths } from '../utils'; +import type { GetAllObjectsFromRootVariables } from '../../orm/query'; +import type { ObjectConnectionSelect } from '../../orm/input-types'; export default async ( argv: Partial>, prompter: Inquirerer, @@ -48,11 +49,16 @@ export default async ( }, ]); const client = getClient(); - const selectFields = buildSelectFromPaths(argv.select ?? ''); + const selectFields = buildSelectFromPaths((argv.select as string) ?? ''); const result = await client.query - .getAllObjectsFromRoot(answers, { - select: selectFields, - }) + .getAllObjectsFromRoot( + answers as unknown as GetAllObjectsFromRootVariables, + { + select: selectFields, + } as unknown as { + select: ObjectConnectionSelect; + } + ) .execute(); console.log(JSON.stringify(result, null, 2)); } catch (error) { diff --git a/sdk/constructive-cli/src/objects/cli/commands/get-all-record.ts b/sdk/constructive-cli/src/objects/cli/commands/get-all-record.ts index a16ed34bb..f1919c11d 100644 --- a/sdk/constructive-cli/src/objects/cli/commands/get-all-record.ts +++ b/sdk/constructive-cli/src/objects/cli/commands/get-all-record.ts @@ -1,4 +1,3 @@ -// @ts-nocheck /** * CLI commands for GetAllRecord * @generated by @constructive-io/graphql-codegen @@ -7,12 +6,14 @@ import { CLIOptions, Inquirerer, extractFirst } from 'inquirerer'; import { getClient } from '../executor'; import { coerceAnswers, stripUndefined } from '../utils'; -const fieldSchema = { +import type { FieldSchema } from '../utils'; +import type { CreateGetAllRecordInput, GetAllRecordPatch } from '../../orm/input-types'; +const fieldSchema: FieldSchema = { path: 'string', data: 'json', }; const usage = - '\nget-all-record \n\nCommands:\n list List all getAllRecord records\n get Get a getAllRecord by ID\n create Create a new getAllRecord\n update Update an existing getAllRecord\n delete Delete a getAllRecord\n\n --help, -h Show this help message\n'; + '\nget-all-record \n\nCommands:\n list List all getAllRecord records\n create Create a new getAllRecord\n\n --help, -h Show this help message\n'; export default async ( argv: Partial>, prompter: Inquirerer, @@ -29,10 +30,10 @@ export default async ( type: 'autocomplete', name: 'subcommand', message: 'What do you want to do?', - options: ['list', 'get', 'create', 'update', 'delete'], + options: ['list', 'create'], }, ]); - return handleTableSubcommand(answer.subcommand, newArgv, prompter); + return handleTableSubcommand(answer.subcommand as string, newArgv, prompter); } return handleTableSubcommand(subcommand, newArgv, prompter); }; @@ -44,14 +45,8 @@ async function handleTableSubcommand( switch (subcommand) { case 'list': return handleList(argv, prompter); - case 'get': - return handleGet(argv, prompter); case 'create': return handleCreate(argv, prompter); - case 'update': - return handleUpdate(argv, prompter); - case 'delete': - return handleDelete(argv, prompter); default: console.log(usage); process.exit(1); @@ -77,35 +72,6 @@ async function handleList(_argv: Partial>, _prompter: In process.exit(1); } } -async function handleGet(argv: Partial>, prompter: Inquirerer) { - try { - const answers = await prompter.prompt(argv, [ - { - type: 'text', - name: 'id', - message: 'id', - required: true, - }, - ]); - const client = getClient(); - const result = await client.getAllRecord - .findOne({ - id: answers.id, - select: { - path: true, - data: true, - }, - }) - .execute(); - console.log(JSON.stringify(result, null, 2)); - } catch (error) { - console.error('Record not found.'); - if (error instanceof Error) { - console.error(error.message); - } - process.exit(1); - } -} async function handleCreate(argv: Partial>, prompter: Inquirerer) { try { const rawAnswers = await prompter.prompt(argv, [ @@ -123,7 +89,10 @@ async function handleCreate(argv: Partial>, prompter: In }, ]); const answers = coerceAnswers(rawAnswers, fieldSchema); - const cleanedData = stripUndefined(answers, fieldSchema); + const cleanedData = stripUndefined( + answers, + fieldSchema + ) as CreateGetAllRecordInput['getAllRecord']; const client = getClient(); const result = await client.getAllRecord .create({ @@ -146,83 +115,3 @@ async function handleCreate(argv: Partial>, prompter: In process.exit(1); } } -async function handleUpdate(argv: Partial>, prompter: Inquirerer) { - try { - const rawAnswers = await prompter.prompt(argv, [ - { - type: 'text', - name: 'id', - message: 'id', - required: true, - }, - { - type: 'text', - name: 'path', - message: 'path', - required: false, - }, - { - type: 'text', - name: 'data', - message: 'data', - required: false, - }, - ]); - const answers = coerceAnswers(rawAnswers, fieldSchema); - const cleanedData = stripUndefined(answers, fieldSchema); - const client = getClient(); - const result = await client.getAllRecord - .update({ - where: { - id: answers.id as string, - }, - data: { - path: cleanedData.path, - data: cleanedData.data, - }, - select: { - path: true, - data: true, - }, - }) - .execute(); - console.log(JSON.stringify(result, null, 2)); - } catch (error) { - console.error('Failed to update record.'); - if (error instanceof Error) { - console.error(error.message); - } - process.exit(1); - } -} -async function handleDelete(argv: Partial>, prompter: Inquirerer) { - try { - const rawAnswers = await prompter.prompt(argv, [ - { - type: 'text', - name: 'id', - message: 'id', - required: true, - }, - ]); - const answers = coerceAnswers(rawAnswers, fieldSchema); - const client = getClient(); - const result = await client.getAllRecord - .delete({ - where: { - id: answers.id as string, - }, - select: { - id: true, - }, - }) - .execute(); - console.log(JSON.stringify(result, null, 2)); - } catch (error) { - console.error('Failed to delete record.'); - if (error instanceof Error) { - console.error(error.message); - } - process.exit(1); - } -} diff --git a/sdk/constructive-cli/src/objects/cli/commands/get-object-at-path.ts b/sdk/constructive-cli/src/objects/cli/commands/get-object-at-path.ts index 89312b530..336a7e8d5 100644 --- a/sdk/constructive-cli/src/objects/cli/commands/get-object-at-path.ts +++ b/sdk/constructive-cli/src/objects/cli/commands/get-object-at-path.ts @@ -1,4 +1,3 @@ -// @ts-nocheck /** * CLI command for query getObjectAtPath * @generated by @constructive-io/graphql-codegen @@ -7,6 +6,8 @@ import { CLIOptions, Inquirerer } from 'inquirerer'; import { getClient } from '../executor'; import { buildSelectFromPaths } from '../utils'; +import type { GetObjectAtPathVariables } from '../../orm/query'; +import type { ObjectSelect } from '../../orm/input-types'; export default async ( argv: Partial>, prompter: Inquirerer, @@ -40,11 +41,16 @@ export default async ( }, ]); const client = getClient(); - const selectFields = buildSelectFromPaths(argv.select ?? ''); + const selectFields = buildSelectFromPaths((argv.select as string) ?? ''); const result = await client.query - .getObjectAtPath(answers, { - select: selectFields, - }) + .getObjectAtPath( + answers as unknown as GetObjectAtPathVariables, + { + select: selectFields, + } as unknown as { + select: ObjectSelect; + } + ) .execute(); console.log(JSON.stringify(result, null, 2)); } catch (error) { diff --git a/sdk/constructive-cli/src/objects/cli/commands/get-path-objects-from-root.ts b/sdk/constructive-cli/src/objects/cli/commands/get-path-objects-from-root.ts index 6aaf3a971..398523580 100644 --- a/sdk/constructive-cli/src/objects/cli/commands/get-path-objects-from-root.ts +++ b/sdk/constructive-cli/src/objects/cli/commands/get-path-objects-from-root.ts @@ -1,4 +1,3 @@ -// @ts-nocheck /** * CLI command for query getPathObjectsFromRoot * @generated by @constructive-io/graphql-codegen @@ -7,6 +6,8 @@ import { CLIOptions, Inquirerer } from 'inquirerer'; import { getClient } from '../executor'; import { buildSelectFromPaths } from '../utils'; +import type { GetPathObjectsFromRootVariables } from '../../orm/query'; +import type { ObjectConnectionSelect } from '../../orm/input-types'; export default async ( argv: Partial>, prompter: Inquirerer, @@ -53,11 +54,16 @@ export default async ( }, ]); const client = getClient(); - const selectFields = buildSelectFromPaths(argv.select ?? ''); + const selectFields = buildSelectFromPaths((argv.select as string) ?? ''); const result = await client.query - .getPathObjectsFromRoot(answers, { - select: selectFields, - }) + .getPathObjectsFromRoot( + answers as unknown as GetPathObjectsFromRootVariables, + { + select: selectFields, + } as unknown as { + select: ObjectConnectionSelect; + } + ) .execute(); console.log(JSON.stringify(result, null, 2)); } catch (error) { diff --git a/sdk/constructive-cli/src/objects/cli/commands/init-empty-repo.ts b/sdk/constructive-cli/src/objects/cli/commands/init-empty-repo.ts index 483aa0c8c..7623fbe29 100644 --- a/sdk/constructive-cli/src/objects/cli/commands/init-empty-repo.ts +++ b/sdk/constructive-cli/src/objects/cli/commands/init-empty-repo.ts @@ -1,4 +1,3 @@ -// @ts-nocheck /** * CLI command for mutation initEmptyRepo * @generated by @constructive-io/graphql-codegen @@ -7,6 +6,8 @@ import { CLIOptions, Inquirerer } from 'inquirerer'; import { getClient } from '../executor'; import { parseMutationInput, buildSelectFromPaths } from '../utils'; +import type { InitEmptyRepoVariables } from '../../orm/mutation'; +import type { InitEmptyRepoPayloadSelect } from '../../orm/input-types'; export default async ( argv: Partial>, prompter: Inquirerer, @@ -28,11 +29,16 @@ export default async ( ]); const client = getClient(); const parsedAnswers = parseMutationInput(answers); - const selectFields = buildSelectFromPaths(argv.select ?? 'clientMutationId'); + const selectFields = buildSelectFromPaths((argv.select as string) ?? 'clientMutationId'); const result = await client.mutation - .initEmptyRepo(parsedAnswers, { - select: selectFields, - }) + .initEmptyRepo( + parsedAnswers as unknown as InitEmptyRepoVariables, + { + select: selectFields, + } as unknown as { + select: InitEmptyRepoPayloadSelect; + } + ) .execute(); console.log(JSON.stringify(result, null, 2)); } catch (error) { diff --git a/sdk/constructive-cli/src/objects/cli/commands/insert-node-at-path.ts b/sdk/constructive-cli/src/objects/cli/commands/insert-node-at-path.ts index 3b27dcaa7..fe9c9a4bc 100644 --- a/sdk/constructive-cli/src/objects/cli/commands/insert-node-at-path.ts +++ b/sdk/constructive-cli/src/objects/cli/commands/insert-node-at-path.ts @@ -1,4 +1,3 @@ -// @ts-nocheck /** * CLI command for mutation insertNodeAtPath * @generated by @constructive-io/graphql-codegen @@ -7,6 +6,8 @@ import { CLIOptions, Inquirerer } from 'inquirerer'; import { getClient } from '../executor'; import { parseMutationInput, buildSelectFromPaths } from '../utils'; +import type { InsertNodeAtPathVariables } from '../../orm/mutation'; +import type { InsertNodeAtPathPayloadSelect } from '../../orm/input-types'; export default async ( argv: Partial>, prompter: Inquirerer, @@ -30,11 +31,16 @@ export default async ( ]); const client = getClient(); const parsedAnswers = parseMutationInput(answers); - const selectFields = buildSelectFromPaths(argv.select ?? 'clientMutationId'); + const selectFields = buildSelectFromPaths((argv.select as string) ?? 'clientMutationId'); const result = await client.mutation - .insertNodeAtPath(parsedAnswers, { - select: selectFields, - }) + .insertNodeAtPath( + parsedAnswers as unknown as InsertNodeAtPathVariables, + { + select: selectFields, + } as unknown as { + select: InsertNodeAtPathPayloadSelect; + } + ) .execute(); console.log(JSON.stringify(result, null, 2)); } catch (error) { diff --git a/sdk/constructive-cli/src/objects/cli/commands/object.ts b/sdk/constructive-cli/src/objects/cli/commands/object.ts index 65df949e2..20f6f3670 100644 --- a/sdk/constructive-cli/src/objects/cli/commands/object.ts +++ b/sdk/constructive-cli/src/objects/cli/commands/object.ts @@ -1,4 +1,3 @@ -// @ts-nocheck /** * CLI commands for Object * @generated by @constructive-io/graphql-codegen @@ -7,7 +6,9 @@ import { CLIOptions, Inquirerer, extractFirst } from 'inquirerer'; import { getClient } from '../executor'; import { coerceAnswers, stripUndefined } from '../utils'; -const fieldSchema = { +import type { FieldSchema } from '../utils'; +import type { CreateObjectInput, ObjectPatch } from '../../orm/input-types'; +const fieldSchema: FieldSchema = { hashUuid: 'uuid', id: 'uuid', databaseId: 'uuid', @@ -38,7 +39,7 @@ export default async ( options: ['list', 'get', 'create', 'update', 'delete'], }, ]); - return handleTableSubcommand(answer.subcommand, newArgv, prompter); + return handleTableSubcommand(answer.subcommand as string, newArgv, prompter); } return handleTableSubcommand(subcommand, newArgv, prompter); }; @@ -102,7 +103,7 @@ async function handleGet(argv: Partial>, prompter: Inqui const client = getClient(); const result = await client.object .findOne({ - id: answers.id, + id: answers.id as string, select: { hashUuid: true, id: true, @@ -127,12 +128,6 @@ async function handleGet(argv: Partial>, prompter: Inqui async function handleCreate(argv: Partial>, prompter: Inquirerer) { try { const rawAnswers = await prompter.prompt(argv, [ - { - type: 'text', - name: 'hashUuid', - message: 'hashUuid', - required: true, - }, { type: 'text', name: 'databaseId', @@ -165,12 +160,11 @@ async function handleCreate(argv: Partial>, prompter: In }, ]); const answers = coerceAnswers(rawAnswers, fieldSchema); - const cleanedData = stripUndefined(answers, fieldSchema); + const cleanedData = stripUndefined(answers, fieldSchema) as CreateObjectInput['object']; const client = getClient(); const result = await client.object .create({ data: { - hashUuid: cleanedData.hashUuid, databaseId: cleanedData.databaseId, kids: cleanedData.kids, ktree: cleanedData.ktree, @@ -207,12 +201,6 @@ async function handleUpdate(argv: Partial>, prompter: In message: 'id', required: true, }, - { - type: 'text', - name: 'hashUuid', - message: 'hashUuid', - required: false, - }, { type: 'text', name: 'databaseId', @@ -245,7 +233,7 @@ async function handleUpdate(argv: Partial>, prompter: In }, ]); const answers = coerceAnswers(rawAnswers, fieldSchema); - const cleanedData = stripUndefined(answers, fieldSchema); + const cleanedData = stripUndefined(answers, fieldSchema) as ObjectPatch; const client = getClient(); const result = await client.object .update({ @@ -253,7 +241,6 @@ async function handleUpdate(argv: Partial>, prompter: In id: answers.id as string, }, data: { - hashUuid: cleanedData.hashUuid, databaseId: cleanedData.databaseId, kids: cleanedData.kids, ktree: cleanedData.ktree, diff --git a/sdk/constructive-cli/src/objects/cli/commands/ref.ts b/sdk/constructive-cli/src/objects/cli/commands/ref.ts index 122e07f1c..5eaa605d8 100644 --- a/sdk/constructive-cli/src/objects/cli/commands/ref.ts +++ b/sdk/constructive-cli/src/objects/cli/commands/ref.ts @@ -1,4 +1,3 @@ -// @ts-nocheck /** * CLI commands for Ref * @generated by @constructive-io/graphql-codegen @@ -7,7 +6,9 @@ import { CLIOptions, Inquirerer, extractFirst } from 'inquirerer'; import { getClient } from '../executor'; import { coerceAnswers, stripUndefined } from '../utils'; -const fieldSchema = { +import type { FieldSchema } from '../utils'; +import type { CreateRefInput, RefPatch } from '../../orm/input-types'; +const fieldSchema: FieldSchema = { id: 'uuid', name: 'string', databaseId: 'uuid', @@ -35,7 +36,7 @@ export default async ( options: ['list', 'get', 'create', 'update', 'delete'], }, ]); - return handleTableSubcommand(answer.subcommand, newArgv, prompter); + return handleTableSubcommand(answer.subcommand as string, newArgv, prompter); } return handleTableSubcommand(subcommand, newArgv, prompter); }; @@ -96,7 +97,7 @@ async function handleGet(argv: Partial>, prompter: Inqui const client = getClient(); const result = await client.ref .findOne({ - id: answers.id, + id: answers.id as string, select: { id: true, name: true, @@ -144,7 +145,7 @@ async function handleCreate(argv: Partial>, prompter: In }, ]); const answers = coerceAnswers(rawAnswers, fieldSchema); - const cleanedData = stripUndefined(answers, fieldSchema); + const cleanedData = stripUndefined(answers, fieldSchema) as CreateRefInput['ref']; const client = getClient(); const result = await client.ref .create({ @@ -207,7 +208,7 @@ async function handleUpdate(argv: Partial>, prompter: In }, ]); const answers = coerceAnswers(rawAnswers, fieldSchema); - const cleanedData = stripUndefined(answers, fieldSchema); + const cleanedData = stripUndefined(answers, fieldSchema) as RefPatch; const client = getClient(); const result = await client.ref .update({ diff --git a/sdk/constructive-cli/src/objects/cli/commands/remove-node-at-path.ts b/sdk/constructive-cli/src/objects/cli/commands/remove-node-at-path.ts index e1b7598ed..94fd0f628 100644 --- a/sdk/constructive-cli/src/objects/cli/commands/remove-node-at-path.ts +++ b/sdk/constructive-cli/src/objects/cli/commands/remove-node-at-path.ts @@ -1,4 +1,3 @@ -// @ts-nocheck /** * CLI command for mutation removeNodeAtPath * @generated by @constructive-io/graphql-codegen @@ -7,6 +6,8 @@ import { CLIOptions, Inquirerer } from 'inquirerer'; import { getClient } from '../executor'; import { parseMutationInput, buildSelectFromPaths } from '../utils'; +import type { RemoveNodeAtPathVariables } from '../../orm/mutation'; +import type { RemoveNodeAtPathPayloadSelect } from '../../orm/input-types'; export default async ( argv: Partial>, prompter: Inquirerer, @@ -30,11 +31,16 @@ export default async ( ]); const client = getClient(); const parsedAnswers = parseMutationInput(answers); - const selectFields = buildSelectFromPaths(argv.select ?? 'clientMutationId'); + const selectFields = buildSelectFromPaths((argv.select as string) ?? 'clientMutationId'); const result = await client.mutation - .removeNodeAtPath(parsedAnswers, { - select: selectFields, - }) + .removeNodeAtPath( + parsedAnswers as unknown as RemoveNodeAtPathVariables, + { + select: selectFields, + } as unknown as { + select: RemoveNodeAtPathPayloadSelect; + } + ) .execute(); console.log(JSON.stringify(result, null, 2)); } catch (error) { diff --git a/sdk/constructive-cli/src/objects/cli/commands/rev-parse.ts b/sdk/constructive-cli/src/objects/cli/commands/rev-parse.ts index 28cc403fd..302b86962 100644 --- a/sdk/constructive-cli/src/objects/cli/commands/rev-parse.ts +++ b/sdk/constructive-cli/src/objects/cli/commands/rev-parse.ts @@ -1,4 +1,3 @@ -// @ts-nocheck /** * CLI command for query revParse * @generated by @constructive-io/graphql-codegen @@ -6,6 +5,7 @@ */ import { CLIOptions, Inquirerer } from 'inquirerer'; import { getClient } from '../executor'; +import type { RevParseVariables } from '../../orm/query'; export default async ( argv: Partial>, prompter: Inquirerer, @@ -34,7 +34,7 @@ export default async ( }, ]); const client = getClient(); - const result = await client.query.revParse(answers).execute(); + const result = await client.query.revParse(answers as unknown as RevParseVariables).execute(); console.log(JSON.stringify(result, null, 2)); } catch (error) { console.error('Failed: revParse'); diff --git a/sdk/constructive-cli/src/objects/cli/commands/set-and-commit.ts b/sdk/constructive-cli/src/objects/cli/commands/set-and-commit.ts index 3527c00df..c52a5c55b 100644 --- a/sdk/constructive-cli/src/objects/cli/commands/set-and-commit.ts +++ b/sdk/constructive-cli/src/objects/cli/commands/set-and-commit.ts @@ -1,4 +1,3 @@ -// @ts-nocheck /** * CLI command for mutation setAndCommit * @generated by @constructive-io/graphql-codegen @@ -7,6 +6,8 @@ import { CLIOptions, Inquirerer } from 'inquirerer'; import { getClient } from '../executor'; import { parseMutationInput, buildSelectFromPaths } from '../utils'; +import type { SetAndCommitVariables } from '../../orm/mutation'; +import type { SetAndCommitPayloadSelect } from '../../orm/input-types'; export default async ( argv: Partial>, prompter: Inquirerer, @@ -28,11 +29,16 @@ export default async ( ]); const client = getClient(); const parsedAnswers = parseMutationInput(answers); - const selectFields = buildSelectFromPaths(argv.select ?? 'clientMutationId'); + const selectFields = buildSelectFromPaths((argv.select as string) ?? 'clientMutationId'); const result = await client.mutation - .setAndCommit(parsedAnswers, { - select: selectFields, - }) + .setAndCommit( + parsedAnswers as unknown as SetAndCommitVariables, + { + select: selectFields, + } as unknown as { + select: SetAndCommitPayloadSelect; + } + ) .execute(); console.log(JSON.stringify(result, null, 2)); } catch (error) { diff --git a/sdk/constructive-cli/src/objects/cli/commands/set-data-at-path.ts b/sdk/constructive-cli/src/objects/cli/commands/set-data-at-path.ts index 562aaec04..9c379eac9 100644 --- a/sdk/constructive-cli/src/objects/cli/commands/set-data-at-path.ts +++ b/sdk/constructive-cli/src/objects/cli/commands/set-data-at-path.ts @@ -1,4 +1,3 @@ -// @ts-nocheck /** * CLI command for mutation setDataAtPath * @generated by @constructive-io/graphql-codegen @@ -7,6 +6,8 @@ import { CLIOptions, Inquirerer } from 'inquirerer'; import { getClient } from '../executor'; import { parseMutationInput, buildSelectFromPaths } from '../utils'; +import type { SetDataAtPathVariables } from '../../orm/mutation'; +import type { SetDataAtPathPayloadSelect } from '../../orm/input-types'; export default async ( argv: Partial>, prompter: Inquirerer, @@ -28,11 +29,16 @@ export default async ( ]); const client = getClient(); const parsedAnswers = parseMutationInput(answers); - const selectFields = buildSelectFromPaths(argv.select ?? 'clientMutationId'); + const selectFields = buildSelectFromPaths((argv.select as string) ?? 'clientMutationId'); const result = await client.mutation - .setDataAtPath(parsedAnswers, { - select: selectFields, - }) + .setDataAtPath( + parsedAnswers as unknown as SetDataAtPathVariables, + { + select: selectFields, + } as unknown as { + select: SetDataAtPathPayloadSelect; + } + ) .execute(); console.log(JSON.stringify(result, null, 2)); } catch (error) { diff --git a/sdk/constructive-cli/src/objects/cli/commands/set-props-and-commit.ts b/sdk/constructive-cli/src/objects/cli/commands/set-props-and-commit.ts index 67f730e86..9841e10a7 100644 --- a/sdk/constructive-cli/src/objects/cli/commands/set-props-and-commit.ts +++ b/sdk/constructive-cli/src/objects/cli/commands/set-props-and-commit.ts @@ -1,4 +1,3 @@ -// @ts-nocheck /** * CLI command for mutation setPropsAndCommit * @generated by @constructive-io/graphql-codegen @@ -7,6 +6,8 @@ import { CLIOptions, Inquirerer } from 'inquirerer'; import { getClient } from '../executor'; import { parseMutationInput, buildSelectFromPaths } from '../utils'; +import type { SetPropsAndCommitVariables } from '../../orm/mutation'; +import type { SetPropsAndCommitPayloadSelect } from '../../orm/input-types'; export default async ( argv: Partial>, prompter: Inquirerer, @@ -30,11 +31,16 @@ export default async ( ]); const client = getClient(); const parsedAnswers = parseMutationInput(answers); - const selectFields = buildSelectFromPaths(argv.select ?? 'clientMutationId'); + const selectFields = buildSelectFromPaths((argv.select as string) ?? 'clientMutationId'); const result = await client.mutation - .setPropsAndCommit(parsedAnswers, { - select: selectFields, - }) + .setPropsAndCommit( + parsedAnswers as unknown as SetPropsAndCommitVariables, + { + select: selectFields, + } as unknown as { + select: SetPropsAndCommitPayloadSelect; + } + ) .execute(); console.log(JSON.stringify(result, null, 2)); } catch (error) { diff --git a/sdk/constructive-cli/src/objects/cli/commands/store.ts b/sdk/constructive-cli/src/objects/cli/commands/store.ts index 2e2f8f1f8..689cc57e2 100644 --- a/sdk/constructive-cli/src/objects/cli/commands/store.ts +++ b/sdk/constructive-cli/src/objects/cli/commands/store.ts @@ -1,4 +1,3 @@ -// @ts-nocheck /** * CLI commands for Store * @generated by @constructive-io/graphql-codegen @@ -7,7 +6,9 @@ import { CLIOptions, Inquirerer, extractFirst } from 'inquirerer'; import { getClient } from '../executor'; import { coerceAnswers, stripUndefined } from '../utils'; -const fieldSchema = { +import type { FieldSchema } from '../utils'; +import type { CreateStoreInput, StorePatch } from '../../orm/input-types'; +const fieldSchema: FieldSchema = { id: 'uuid', name: 'string', databaseId: 'uuid', @@ -35,7 +36,7 @@ export default async ( options: ['list', 'get', 'create', 'update', 'delete'], }, ]); - return handleTableSubcommand(answer.subcommand, newArgv, prompter); + return handleTableSubcommand(answer.subcommand as string, newArgv, prompter); } return handleTableSubcommand(subcommand, newArgv, prompter); }; @@ -96,7 +97,7 @@ async function handleGet(argv: Partial>, prompter: Inqui const client = getClient(); const result = await client.store .findOne({ - id: answers.id, + id: answers.id as string, select: { id: true, name: true, @@ -138,7 +139,7 @@ async function handleCreate(argv: Partial>, prompter: In }, ]); const answers = coerceAnswers(rawAnswers, fieldSchema); - const cleanedData = stripUndefined(answers, fieldSchema); + const cleanedData = stripUndefined(answers, fieldSchema) as CreateStoreInput['store']; const client = getClient(); const result = await client.store .create({ @@ -194,7 +195,7 @@ async function handleUpdate(argv: Partial>, prompter: In }, ]); const answers = coerceAnswers(rawAnswers, fieldSchema); - const cleanedData = stripUndefined(answers, fieldSchema); + const cleanedData = stripUndefined(answers, fieldSchema) as StorePatch; const client = getClient(); const result = await client.store .update({ diff --git a/sdk/constructive-cli/src/objects/cli/commands/update-node-at-path.ts b/sdk/constructive-cli/src/objects/cli/commands/update-node-at-path.ts index 831cf2335..5869fe973 100644 --- a/sdk/constructive-cli/src/objects/cli/commands/update-node-at-path.ts +++ b/sdk/constructive-cli/src/objects/cli/commands/update-node-at-path.ts @@ -1,4 +1,3 @@ -// @ts-nocheck /** * CLI command for mutation updateNodeAtPath * @generated by @constructive-io/graphql-codegen @@ -7,6 +6,8 @@ import { CLIOptions, Inquirerer } from 'inquirerer'; import { getClient } from '../executor'; import { parseMutationInput, buildSelectFromPaths } from '../utils'; +import type { UpdateNodeAtPathVariables } from '../../orm/mutation'; +import type { UpdateNodeAtPathPayloadSelect } from '../../orm/input-types'; export default async ( argv: Partial>, prompter: Inquirerer, @@ -30,11 +31,16 @@ export default async ( ]); const client = getClient(); const parsedAnswers = parseMutationInput(answers); - const selectFields = buildSelectFromPaths(argv.select ?? 'clientMutationId'); + const selectFields = buildSelectFromPaths((argv.select as string) ?? 'clientMutationId'); const result = await client.mutation - .updateNodeAtPath(parsedAnswers, { - select: selectFields, - }) + .updateNodeAtPath( + parsedAnswers as unknown as UpdateNodeAtPathVariables, + { + select: selectFields, + } as unknown as { + select: UpdateNodeAtPathPayloadSelect; + } + ) .execute(); console.log(JSON.stringify(result, null, 2)); } catch (error) { diff --git a/sdk/constructive-cli/src/objects/cli/executor.ts b/sdk/constructive-cli/src/objects/cli/executor.ts index 08615a32b..721e8e68e 100644 --- a/sdk/constructive-cli/src/objects/cli/executor.ts +++ b/sdk/constructive-cli/src/objects/cli/executor.ts @@ -1,4 +1,3 @@ -// @ts-nocheck /** * Executor and config store for CLI * @generated by @constructive-io/graphql-codegen @@ -22,7 +21,7 @@ export function getClient(contextName?: string) { throw new Error('No active context. Run "context create" or "context use" first.'); } } - const headers = {}; + const headers: Record = {}; if (store.hasValidCredentials(ctx.name)) { const creds = store.getCredentials(ctx.name); if (creds?.token) { diff --git a/sdk/constructive-cli/src/objects/cli/index.ts b/sdk/constructive-cli/src/objects/cli/index.ts index fc2ecaced..05d1f1ecb 100644 --- a/sdk/constructive-cli/src/objects/cli/index.ts +++ b/sdk/constructive-cli/src/objects/cli/index.ts @@ -1,4 +1,3 @@ -// @ts-nocheck /** * CLI entry point * @generated by @constructive-io/graphql-codegen diff --git a/sdk/constructive-cli/src/objects/cli/node-fetch.ts b/sdk/constructive-cli/src/objects/cli/node-fetch.ts index 7390a6cb6..81bb05834 100644 --- a/sdk/constructive-cli/src/objects/cli/node-fetch.ts +++ b/sdk/constructive-cli/src/objects/cli/node-fetch.ts @@ -1,4 +1,3 @@ -// @ts-nocheck /** * Node HTTP adapter for localhost subdomain routing * @generated by @constructive-io/graphql-codegen diff --git a/sdk/constructive-cli/src/objects/cli/utils.ts b/sdk/constructive-cli/src/objects/cli/utils.ts index eb869282d..e55945fee 100644 --- a/sdk/constructive-cli/src/objects/cli/utils.ts +++ b/sdk/constructive-cli/src/objects/cli/utils.ts @@ -1,4 +1,3 @@ -// @ts-nocheck /** * CLI utility functions for type coercion and input handling * @generated by @constructive-io/graphql-codegen diff --git a/sdk/constructive-cli/src/public/cli/commands.ts b/sdk/constructive-cli/src/public/cli/commands.ts index 972335eb0..09033c0f4 100644 --- a/sdk/constructive-cli/src/public/cli/commands.ts +++ b/sdk/constructive-cli/src/public/cli/commands.ts @@ -1,4 +1,3 @@ -// @ts-nocheck /** * CLI command map and entry point * @generated by @constructive-io/graphql-codegen @@ -161,7 +160,14 @@ import forgotPasswordCmd from './commands/forgot-password'; import sendVerificationEmailCmd from './commands/send-verification-email'; import verifyPasswordCmd from './commands/verify-password'; import verifyTotpCmd from './commands/verify-totp'; -const createCommandMap = () => ({ +const createCommandMap: () => Record< + string, + ( + argv: Partial>, + prompter: Inquirerer, + options: CLIOptions + ) => Promise +> = () => ({ context: contextCmd, auth: authCmd, 'org-get-managers-record': orgGetManagersRecordCmd, @@ -341,7 +347,7 @@ export const commands = async ( options: Object.keys(commandMap), }, ]); - command = answer.command; + command = answer.command as string; } const commandFn = commandMap[command]; if (!commandFn) { diff --git a/sdk/constructive-cli/src/public/cli/commands/api-module.ts b/sdk/constructive-cli/src/public/cli/commands/api-module.ts index f49732def..f0fe851ae 100644 --- a/sdk/constructive-cli/src/public/cli/commands/api-module.ts +++ b/sdk/constructive-cli/src/public/cli/commands/api-module.ts @@ -1,4 +1,3 @@ -// @ts-nocheck /** * CLI commands for ApiModule * @generated by @constructive-io/graphql-codegen @@ -7,7 +6,9 @@ import { CLIOptions, Inquirerer, extractFirst } from 'inquirerer'; import { getClient } from '../executor'; import { coerceAnswers, stripUndefined } from '../utils'; -const fieldSchema = { +import type { FieldSchema } from '../utils'; +import type { CreateApiModuleInput, ApiModulePatch } from '../../orm/input-types'; +const fieldSchema: FieldSchema = { id: 'uuid', databaseId: 'uuid', apiId: 'uuid', @@ -35,7 +36,7 @@ export default async ( options: ['list', 'get', 'create', 'update', 'delete'], }, ]); - return handleTableSubcommand(answer.subcommand, newArgv, prompter); + return handleTableSubcommand(answer.subcommand as string, newArgv, prompter); } return handleTableSubcommand(subcommand, newArgv, prompter); }; @@ -96,7 +97,7 @@ async function handleGet(argv: Partial>, prompter: Inqui const client = getClient(); const result = await client.apiModule .findOne({ - id: answers.id, + id: answers.id as string, select: { id: true, databaseId: true, @@ -144,7 +145,7 @@ async function handleCreate(argv: Partial>, prompter: In }, ]); const answers = coerceAnswers(rawAnswers, fieldSchema); - const cleanedData = stripUndefined(answers, fieldSchema); + const cleanedData = stripUndefined(answers, fieldSchema) as CreateApiModuleInput['apiModule']; const client = getClient(); const result = await client.apiModule .create({ @@ -207,7 +208,7 @@ async function handleUpdate(argv: Partial>, prompter: In }, ]); const answers = coerceAnswers(rawAnswers, fieldSchema); - const cleanedData = stripUndefined(answers, fieldSchema); + const cleanedData = stripUndefined(answers, fieldSchema) as ApiModulePatch; const client = getClient(); const result = await client.apiModule .update({ diff --git a/sdk/constructive-cli/src/public/cli/commands/api-schema.ts b/sdk/constructive-cli/src/public/cli/commands/api-schema.ts index 67ff8000b..0154cded7 100644 --- a/sdk/constructive-cli/src/public/cli/commands/api-schema.ts +++ b/sdk/constructive-cli/src/public/cli/commands/api-schema.ts @@ -1,4 +1,3 @@ -// @ts-nocheck /** * CLI commands for ApiSchema * @generated by @constructive-io/graphql-codegen @@ -7,7 +6,9 @@ import { CLIOptions, Inquirerer, extractFirst } from 'inquirerer'; import { getClient } from '../executor'; import { coerceAnswers, stripUndefined } from '../utils'; -const fieldSchema = { +import type { FieldSchema } from '../utils'; +import type { CreateApiSchemaInput, ApiSchemaPatch } from '../../orm/input-types'; +const fieldSchema: FieldSchema = { id: 'uuid', databaseId: 'uuid', schemaId: 'uuid', @@ -34,7 +35,7 @@ export default async ( options: ['list', 'get', 'create', 'update', 'delete'], }, ]); - return handleTableSubcommand(answer.subcommand, newArgv, prompter); + return handleTableSubcommand(answer.subcommand as string, newArgv, prompter); } return handleTableSubcommand(subcommand, newArgv, prompter); }; @@ -94,7 +95,7 @@ async function handleGet(argv: Partial>, prompter: Inqui const client = getClient(); const result = await client.apiSchema .findOne({ - id: answers.id, + id: answers.id as string, select: { id: true, databaseId: true, @@ -135,7 +136,7 @@ async function handleCreate(argv: Partial>, prompter: In }, ]); const answers = coerceAnswers(rawAnswers, fieldSchema); - const cleanedData = stripUndefined(answers, fieldSchema); + const cleanedData = stripUndefined(answers, fieldSchema) as CreateApiSchemaInput['apiSchema']; const client = getClient(); const result = await client.apiSchema .create({ @@ -190,7 +191,7 @@ async function handleUpdate(argv: Partial>, prompter: In }, ]); const answers = coerceAnswers(rawAnswers, fieldSchema); - const cleanedData = stripUndefined(answers, fieldSchema); + const cleanedData = stripUndefined(answers, fieldSchema) as ApiSchemaPatch; const client = getClient(); const result = await client.apiSchema .update({ diff --git a/sdk/constructive-cli/src/public/cli/commands/api.ts b/sdk/constructive-cli/src/public/cli/commands/api.ts index da9416001..dad2f58a9 100644 --- a/sdk/constructive-cli/src/public/cli/commands/api.ts +++ b/sdk/constructive-cli/src/public/cli/commands/api.ts @@ -1,4 +1,3 @@ -// @ts-nocheck /** * CLI commands for Api * @generated by @constructive-io/graphql-codegen @@ -7,7 +6,9 @@ import { CLIOptions, Inquirerer, extractFirst } from 'inquirerer'; import { getClient } from '../executor'; import { coerceAnswers, stripUndefined } from '../utils'; -const fieldSchema = { +import type { FieldSchema } from '../utils'; +import type { CreateApiInput, ApiPatch } from '../../orm/input-types'; +const fieldSchema: FieldSchema = { id: 'uuid', databaseId: 'uuid', name: 'string', @@ -37,7 +38,7 @@ export default async ( options: ['list', 'get', 'create', 'update', 'delete'], }, ]); - return handleTableSubcommand(answer.subcommand, newArgv, prompter); + return handleTableSubcommand(answer.subcommand as string, newArgv, prompter); } return handleTableSubcommand(subcommand, newArgv, prompter); }; @@ -100,7 +101,7 @@ async function handleGet(argv: Partial>, prompter: Inqui const client = getClient(); const result = await client.api .findOne({ - id: answers.id, + id: answers.id as string, select: { id: true, databaseId: true, @@ -162,7 +163,7 @@ async function handleCreate(argv: Partial>, prompter: In }, ]); const answers = coerceAnswers(rawAnswers, fieldSchema); - const cleanedData = stripUndefined(answers, fieldSchema); + const cleanedData = stripUndefined(answers, fieldSchema) as CreateApiInput['api']; const client = getClient(); const result = await client.api .create({ @@ -241,7 +242,7 @@ async function handleUpdate(argv: Partial>, prompter: In }, ]); const answers = coerceAnswers(rawAnswers, fieldSchema); - const cleanedData = stripUndefined(answers, fieldSchema); + const cleanedData = stripUndefined(answers, fieldSchema) as ApiPatch; const client = getClient(); const result = await client.api .update({ diff --git a/sdk/constructive-cli/src/public/cli/commands/app-achievement.ts b/sdk/constructive-cli/src/public/cli/commands/app-achievement.ts index c9f60782f..442ae9bb8 100644 --- a/sdk/constructive-cli/src/public/cli/commands/app-achievement.ts +++ b/sdk/constructive-cli/src/public/cli/commands/app-achievement.ts @@ -1,4 +1,3 @@ -// @ts-nocheck /** * CLI commands for AppAchievement * @generated by @constructive-io/graphql-codegen @@ -7,7 +6,9 @@ import { CLIOptions, Inquirerer, extractFirst } from 'inquirerer'; import { getClient } from '../executor'; import { coerceAnswers, stripUndefined } from '../utils'; -const fieldSchema = { +import type { FieldSchema } from '../utils'; +import type { CreateAppAchievementInput, AppAchievementPatch } from '../../orm/input-types'; +const fieldSchema: FieldSchema = { id: 'uuid', actorId: 'uuid', name: 'string', @@ -36,7 +37,7 @@ export default async ( options: ['list', 'get', 'create', 'update', 'delete'], }, ]); - return handleTableSubcommand(answer.subcommand, newArgv, prompter); + return handleTableSubcommand(answer.subcommand as string, newArgv, prompter); } return handleTableSubcommand(subcommand, newArgv, prompter); }; @@ -98,7 +99,7 @@ async function handleGet(argv: Partial>, prompter: Inqui const client = getClient(); const result = await client.appAchievement .findOne({ - id: answers.id, + id: answers.id as string, select: { id: true, actorId: true, @@ -141,7 +142,10 @@ async function handleCreate(argv: Partial>, prompter: In }, ]); const answers = coerceAnswers(rawAnswers, fieldSchema); - const cleanedData = stripUndefined(answers, fieldSchema); + const cleanedData = stripUndefined( + answers, + fieldSchema + ) as CreateAppAchievementInput['appAchievement']; const client = getClient(); const result = await client.appAchievement .create({ @@ -198,7 +202,7 @@ async function handleUpdate(argv: Partial>, prompter: In }, ]); const answers = coerceAnswers(rawAnswers, fieldSchema); - const cleanedData = stripUndefined(answers, fieldSchema); + const cleanedData = stripUndefined(answers, fieldSchema) as AppAchievementPatch; const client = getClient(); const result = await client.appAchievement .update({ diff --git a/sdk/constructive-cli/src/public/cli/commands/app-admin-grant.ts b/sdk/constructive-cli/src/public/cli/commands/app-admin-grant.ts index a726576c7..4488c81b9 100644 --- a/sdk/constructive-cli/src/public/cli/commands/app-admin-grant.ts +++ b/sdk/constructive-cli/src/public/cli/commands/app-admin-grant.ts @@ -1,4 +1,3 @@ -// @ts-nocheck /** * CLI commands for AppAdminGrant * @generated by @constructive-io/graphql-codegen @@ -7,7 +6,9 @@ import { CLIOptions, Inquirerer, extractFirst } from 'inquirerer'; import { getClient } from '../executor'; import { coerceAnswers, stripUndefined } from '../utils'; -const fieldSchema = { +import type { FieldSchema } from '../utils'; +import type { CreateAppAdminGrantInput, AppAdminGrantPatch } from '../../orm/input-types'; +const fieldSchema: FieldSchema = { id: 'uuid', isGrant: 'boolean', actorId: 'uuid', @@ -36,7 +37,7 @@ export default async ( options: ['list', 'get', 'create', 'update', 'delete'], }, ]); - return handleTableSubcommand(answer.subcommand, newArgv, prompter); + return handleTableSubcommand(answer.subcommand as string, newArgv, prompter); } return handleTableSubcommand(subcommand, newArgv, prompter); }; @@ -98,7 +99,7 @@ async function handleGet(argv: Partial>, prompter: Inqui const client = getClient(); const result = await client.appAdminGrant .findOne({ - id: answers.id, + id: answers.id as string, select: { id: true, isGrant: true, @@ -141,7 +142,10 @@ async function handleCreate(argv: Partial>, prompter: In }, ]); const answers = coerceAnswers(rawAnswers, fieldSchema); - const cleanedData = stripUndefined(answers, fieldSchema); + const cleanedData = stripUndefined( + answers, + fieldSchema + ) as CreateAppAdminGrantInput['appAdminGrant']; const client = getClient(); const result = await client.appAdminGrant .create({ @@ -198,7 +202,7 @@ async function handleUpdate(argv: Partial>, prompter: In }, ]); const answers = coerceAnswers(rawAnswers, fieldSchema); - const cleanedData = stripUndefined(answers, fieldSchema); + const cleanedData = stripUndefined(answers, fieldSchema) as AppAdminGrantPatch; const client = getClient(); const result = await client.appAdminGrant .update({ diff --git a/sdk/constructive-cli/src/public/cli/commands/app-grant.ts b/sdk/constructive-cli/src/public/cli/commands/app-grant.ts index db7616f3c..29bb697c7 100644 --- a/sdk/constructive-cli/src/public/cli/commands/app-grant.ts +++ b/sdk/constructive-cli/src/public/cli/commands/app-grant.ts @@ -1,4 +1,3 @@ -// @ts-nocheck /** * CLI commands for AppGrant * @generated by @constructive-io/graphql-codegen @@ -7,7 +6,9 @@ import { CLIOptions, Inquirerer, extractFirst } from 'inquirerer'; import { getClient } from '../executor'; import { coerceAnswers, stripUndefined } from '../utils'; -const fieldSchema = { +import type { FieldSchema } from '../utils'; +import type { CreateAppGrantInput, AppGrantPatch } from '../../orm/input-types'; +const fieldSchema: FieldSchema = { id: 'uuid', permissions: 'string', isGrant: 'boolean', @@ -37,7 +38,7 @@ export default async ( options: ['list', 'get', 'create', 'update', 'delete'], }, ]); - return handleTableSubcommand(answer.subcommand, newArgv, prompter); + return handleTableSubcommand(answer.subcommand as string, newArgv, prompter); } return handleTableSubcommand(subcommand, newArgv, prompter); }; @@ -100,7 +101,7 @@ async function handleGet(argv: Partial>, prompter: Inqui const client = getClient(); const result = await client.appGrant .findOne({ - id: answers.id, + id: answers.id as string, select: { id: true, permissions: true, @@ -150,7 +151,7 @@ async function handleCreate(argv: Partial>, prompter: In }, ]); const answers = coerceAnswers(rawAnswers, fieldSchema); - const cleanedData = stripUndefined(answers, fieldSchema); + const cleanedData = stripUndefined(answers, fieldSchema) as CreateAppGrantInput['appGrant']; const client = getClient(); const result = await client.appGrant .create({ @@ -215,7 +216,7 @@ async function handleUpdate(argv: Partial>, prompter: In }, ]); const answers = coerceAnswers(rawAnswers, fieldSchema); - const cleanedData = stripUndefined(answers, fieldSchema); + const cleanedData = stripUndefined(answers, fieldSchema) as AppGrantPatch; const client = getClient(); const result = await client.appGrant .update({ diff --git a/sdk/constructive-cli/src/public/cli/commands/app-level-requirement.ts b/sdk/constructive-cli/src/public/cli/commands/app-level-requirement.ts index 2ed21da3d..cd90d6655 100644 --- a/sdk/constructive-cli/src/public/cli/commands/app-level-requirement.ts +++ b/sdk/constructive-cli/src/public/cli/commands/app-level-requirement.ts @@ -1,4 +1,3 @@ -// @ts-nocheck /** * CLI commands for AppLevelRequirement * @generated by @constructive-io/graphql-codegen @@ -7,7 +6,12 @@ import { CLIOptions, Inquirerer, extractFirst } from 'inquirerer'; import { getClient } from '../executor'; import { coerceAnswers, stripUndefined } from '../utils'; -const fieldSchema = { +import type { FieldSchema } from '../utils'; +import type { + CreateAppLevelRequirementInput, + AppLevelRequirementPatch, +} from '../../orm/input-types'; +const fieldSchema: FieldSchema = { id: 'uuid', name: 'string', level: 'string', @@ -38,7 +42,7 @@ export default async ( options: ['list', 'get', 'create', 'update', 'delete'], }, ]); - return handleTableSubcommand(answer.subcommand, newArgv, prompter); + return handleTableSubcommand(answer.subcommand as string, newArgv, prompter); } return handleTableSubcommand(subcommand, newArgv, prompter); }; @@ -102,7 +106,7 @@ async function handleGet(argv: Partial>, prompter: Inqui const client = getClient(); const result = await client.appLevelRequirement .findOne({ - id: answers.id, + id: answers.id as string, select: { id: true, name: true, @@ -159,7 +163,10 @@ async function handleCreate(argv: Partial>, prompter: In }, ]); const answers = coerceAnswers(rawAnswers, fieldSchema); - const cleanedData = stripUndefined(answers, fieldSchema); + const cleanedData = stripUndefined( + answers, + fieldSchema + ) as CreateAppLevelRequirementInput['appLevelRequirement']; const client = getClient(); const result = await client.appLevelRequirement .create({ @@ -232,7 +239,7 @@ async function handleUpdate(argv: Partial>, prompter: In }, ]); const answers = coerceAnswers(rawAnswers, fieldSchema); - const cleanedData = stripUndefined(answers, fieldSchema); + const cleanedData = stripUndefined(answers, fieldSchema) as AppLevelRequirementPatch; const client = getClient(); const result = await client.appLevelRequirement .update({ diff --git a/sdk/constructive-cli/src/public/cli/commands/app-level.ts b/sdk/constructive-cli/src/public/cli/commands/app-level.ts index 52f600deb..ada9f7e9f 100644 --- a/sdk/constructive-cli/src/public/cli/commands/app-level.ts +++ b/sdk/constructive-cli/src/public/cli/commands/app-level.ts @@ -1,4 +1,3 @@ -// @ts-nocheck /** * CLI commands for AppLevel * @generated by @constructive-io/graphql-codegen @@ -7,7 +6,9 @@ import { CLIOptions, Inquirerer, extractFirst } from 'inquirerer'; import { getClient } from '../executor'; import { coerceAnswers, stripUndefined } from '../utils'; -const fieldSchema = { +import type { FieldSchema } from '../utils'; +import type { CreateAppLevelInput, AppLevelPatch } from '../../orm/input-types'; +const fieldSchema: FieldSchema = { id: 'uuid', name: 'string', description: 'string', @@ -37,7 +38,7 @@ export default async ( options: ['list', 'get', 'create', 'update', 'delete'], }, ]); - return handleTableSubcommand(answer.subcommand, newArgv, prompter); + return handleTableSubcommand(answer.subcommand as string, newArgv, prompter); } return handleTableSubcommand(subcommand, newArgv, prompter); }; @@ -100,7 +101,7 @@ async function handleGet(argv: Partial>, prompter: Inqui const client = getClient(); const result = await client.appLevel .findOne({ - id: answers.id, + id: answers.id as string, select: { id: true, name: true, @@ -150,7 +151,7 @@ async function handleCreate(argv: Partial>, prompter: In }, ]); const answers = coerceAnswers(rawAnswers, fieldSchema); - const cleanedData = stripUndefined(answers, fieldSchema); + const cleanedData = stripUndefined(answers, fieldSchema) as CreateAppLevelInput['appLevel']; const client = getClient(); const result = await client.appLevel .create({ @@ -215,7 +216,7 @@ async function handleUpdate(argv: Partial>, prompter: In }, ]); const answers = coerceAnswers(rawAnswers, fieldSchema); - const cleanedData = stripUndefined(answers, fieldSchema); + const cleanedData = stripUndefined(answers, fieldSchema) as AppLevelPatch; const client = getClient(); const result = await client.appLevel .update({ diff --git a/sdk/constructive-cli/src/public/cli/commands/app-limit-default.ts b/sdk/constructive-cli/src/public/cli/commands/app-limit-default.ts index f86ae0cf2..9987aceca 100644 --- a/sdk/constructive-cli/src/public/cli/commands/app-limit-default.ts +++ b/sdk/constructive-cli/src/public/cli/commands/app-limit-default.ts @@ -1,4 +1,3 @@ -// @ts-nocheck /** * CLI commands for AppLimitDefault * @generated by @constructive-io/graphql-codegen @@ -7,7 +6,9 @@ import { CLIOptions, Inquirerer, extractFirst } from 'inquirerer'; import { getClient } from '../executor'; import { coerceAnswers, stripUndefined } from '../utils'; -const fieldSchema = { +import type { FieldSchema } from '../utils'; +import type { CreateAppLimitDefaultInput, AppLimitDefaultPatch } from '../../orm/input-types'; +const fieldSchema: FieldSchema = { id: 'uuid', name: 'string', max: 'int', @@ -33,7 +34,7 @@ export default async ( options: ['list', 'get', 'create', 'update', 'delete'], }, ]); - return handleTableSubcommand(answer.subcommand, newArgv, prompter); + return handleTableSubcommand(answer.subcommand as string, newArgv, prompter); } return handleTableSubcommand(subcommand, newArgv, prompter); }; @@ -92,7 +93,7 @@ async function handleGet(argv: Partial>, prompter: Inqui const client = getClient(); const result = await client.appLimitDefault .findOne({ - id: answers.id, + id: answers.id as string, select: { id: true, name: true, @@ -126,7 +127,10 @@ async function handleCreate(argv: Partial>, prompter: In }, ]); const answers = coerceAnswers(rawAnswers, fieldSchema); - const cleanedData = stripUndefined(answers, fieldSchema); + const cleanedData = stripUndefined( + answers, + fieldSchema + ) as CreateAppLimitDefaultInput['appLimitDefault']; const client = getClient(); const result = await client.appLimitDefault .create({ @@ -173,7 +177,7 @@ async function handleUpdate(argv: Partial>, prompter: In }, ]); const answers = coerceAnswers(rawAnswers, fieldSchema); - const cleanedData = stripUndefined(answers, fieldSchema); + const cleanedData = stripUndefined(answers, fieldSchema) as AppLimitDefaultPatch; const client = getClient(); const result = await client.appLimitDefault .update({ diff --git a/sdk/constructive-cli/src/public/cli/commands/app-limit.ts b/sdk/constructive-cli/src/public/cli/commands/app-limit.ts index 8ab281f2e..9fd7858b4 100644 --- a/sdk/constructive-cli/src/public/cli/commands/app-limit.ts +++ b/sdk/constructive-cli/src/public/cli/commands/app-limit.ts @@ -1,4 +1,3 @@ -// @ts-nocheck /** * CLI commands for AppLimit * @generated by @constructive-io/graphql-codegen @@ -7,7 +6,9 @@ import { CLIOptions, Inquirerer, extractFirst } from 'inquirerer'; import { getClient } from '../executor'; import { coerceAnswers, stripUndefined } from '../utils'; -const fieldSchema = { +import type { FieldSchema } from '../utils'; +import type { CreateAppLimitInput, AppLimitPatch } from '../../orm/input-types'; +const fieldSchema: FieldSchema = { id: 'uuid', name: 'string', actorId: 'uuid', @@ -35,7 +36,7 @@ export default async ( options: ['list', 'get', 'create', 'update', 'delete'], }, ]); - return handleTableSubcommand(answer.subcommand, newArgv, prompter); + return handleTableSubcommand(answer.subcommand as string, newArgv, prompter); } return handleTableSubcommand(subcommand, newArgv, prompter); }; @@ -96,7 +97,7 @@ async function handleGet(argv: Partial>, prompter: Inqui const client = getClient(); const result = await client.appLimit .findOne({ - id: answers.id, + id: answers.id as string, select: { id: true, name: true, @@ -144,7 +145,7 @@ async function handleCreate(argv: Partial>, prompter: In }, ]); const answers = coerceAnswers(rawAnswers, fieldSchema); - const cleanedData = stripUndefined(answers, fieldSchema); + const cleanedData = stripUndefined(answers, fieldSchema) as CreateAppLimitInput['appLimit']; const client = getClient(); const result = await client.appLimit .create({ @@ -207,7 +208,7 @@ async function handleUpdate(argv: Partial>, prompter: In }, ]); const answers = coerceAnswers(rawAnswers, fieldSchema); - const cleanedData = stripUndefined(answers, fieldSchema); + const cleanedData = stripUndefined(answers, fieldSchema) as AppLimitPatch; const client = getClient(); const result = await client.appLimit .update({ diff --git a/sdk/constructive-cli/src/public/cli/commands/app-membership-default.ts b/sdk/constructive-cli/src/public/cli/commands/app-membership-default.ts index df43b7d1f..7149c842f 100644 --- a/sdk/constructive-cli/src/public/cli/commands/app-membership-default.ts +++ b/sdk/constructive-cli/src/public/cli/commands/app-membership-default.ts @@ -1,4 +1,3 @@ -// @ts-nocheck /** * CLI commands for AppMembershipDefault * @generated by @constructive-io/graphql-codegen @@ -7,7 +6,12 @@ import { CLIOptions, Inquirerer, extractFirst } from 'inquirerer'; import { getClient } from '../executor'; import { coerceAnswers, stripUndefined } from '../utils'; -const fieldSchema = { +import type { FieldSchema } from '../utils'; +import type { + CreateAppMembershipDefaultInput, + AppMembershipDefaultPatch, +} from '../../orm/input-types'; +const fieldSchema: FieldSchema = { id: 'uuid', createdAt: 'string', updatedAt: 'string', @@ -37,7 +41,7 @@ export default async ( options: ['list', 'get', 'create', 'update', 'delete'], }, ]); - return handleTableSubcommand(answer.subcommand, newArgv, prompter); + return handleTableSubcommand(answer.subcommand as string, newArgv, prompter); } return handleTableSubcommand(subcommand, newArgv, prompter); }; @@ -100,7 +104,7 @@ async function handleGet(argv: Partial>, prompter: Inqui const client = getClient(); const result = await client.appMembershipDefault .findOne({ - id: answers.id, + id: answers.id as string, select: { id: true, createdAt: true, @@ -150,7 +154,10 @@ async function handleCreate(argv: Partial>, prompter: In }, ]); const answers = coerceAnswers(rawAnswers, fieldSchema); - const cleanedData = stripUndefined(answers, fieldSchema); + const cleanedData = stripUndefined( + answers, + fieldSchema + ) as CreateAppMembershipDefaultInput['appMembershipDefault']; const client = getClient(); const result = await client.appMembershipDefault .create({ @@ -215,7 +222,7 @@ async function handleUpdate(argv: Partial>, prompter: In }, ]); const answers = coerceAnswers(rawAnswers, fieldSchema); - const cleanedData = stripUndefined(answers, fieldSchema); + const cleanedData = stripUndefined(answers, fieldSchema) as AppMembershipDefaultPatch; const client = getClient(); const result = await client.appMembershipDefault .update({ diff --git a/sdk/constructive-cli/src/public/cli/commands/app-membership.ts b/sdk/constructive-cli/src/public/cli/commands/app-membership.ts index 40a35b966..307a40f1c 100644 --- a/sdk/constructive-cli/src/public/cli/commands/app-membership.ts +++ b/sdk/constructive-cli/src/public/cli/commands/app-membership.ts @@ -1,4 +1,3 @@ -// @ts-nocheck /** * CLI commands for AppMembership * @generated by @constructive-io/graphql-codegen @@ -7,7 +6,9 @@ import { CLIOptions, Inquirerer, extractFirst } from 'inquirerer'; import { getClient } from '../executor'; import { coerceAnswers, stripUndefined } from '../utils'; -const fieldSchema = { +import type { FieldSchema } from '../utils'; +import type { CreateAppMembershipInput, AppMembershipPatch } from '../../orm/input-types'; +const fieldSchema: FieldSchema = { id: 'uuid', createdAt: 'string', updatedAt: 'string', @@ -46,7 +47,7 @@ export default async ( options: ['list', 'get', 'create', 'update', 'delete'], }, ]); - return handleTableSubcommand(answer.subcommand, newArgv, prompter); + return handleTableSubcommand(answer.subcommand as string, newArgv, prompter); } return handleTableSubcommand(subcommand, newArgv, prompter); }; @@ -118,7 +119,7 @@ async function handleGet(argv: Partial>, prompter: Inqui const client = getClient(); const result = await client.appMembership .findOne({ - id: answers.id, + id: answers.id as string, select: { id: true, createdAt: true, @@ -231,7 +232,10 @@ async function handleCreate(argv: Partial>, prompter: In }, ]); const answers = coerceAnswers(rawAnswers, fieldSchema); - const cleanedData = stripUndefined(answers, fieldSchema); + const cleanedData = stripUndefined( + answers, + fieldSchema + ) as CreateAppMembershipInput['appMembership']; const client = getClient(); const result = await client.appMembership .create({ @@ -368,7 +372,7 @@ async function handleUpdate(argv: Partial>, prompter: In }, ]); const answers = coerceAnswers(rawAnswers, fieldSchema); - const cleanedData = stripUndefined(answers, fieldSchema); + const cleanedData = stripUndefined(answers, fieldSchema) as AppMembershipPatch; const client = getClient(); const result = await client.appMembership .update({ diff --git a/sdk/constructive-cli/src/public/cli/commands/app-owner-grant.ts b/sdk/constructive-cli/src/public/cli/commands/app-owner-grant.ts index a9fce8358..fab8a6c5f 100644 --- a/sdk/constructive-cli/src/public/cli/commands/app-owner-grant.ts +++ b/sdk/constructive-cli/src/public/cli/commands/app-owner-grant.ts @@ -1,4 +1,3 @@ -// @ts-nocheck /** * CLI commands for AppOwnerGrant * @generated by @constructive-io/graphql-codegen @@ -7,7 +6,9 @@ import { CLIOptions, Inquirerer, extractFirst } from 'inquirerer'; import { getClient } from '../executor'; import { coerceAnswers, stripUndefined } from '../utils'; -const fieldSchema = { +import type { FieldSchema } from '../utils'; +import type { CreateAppOwnerGrantInput, AppOwnerGrantPatch } from '../../orm/input-types'; +const fieldSchema: FieldSchema = { id: 'uuid', isGrant: 'boolean', actorId: 'uuid', @@ -36,7 +37,7 @@ export default async ( options: ['list', 'get', 'create', 'update', 'delete'], }, ]); - return handleTableSubcommand(answer.subcommand, newArgv, prompter); + return handleTableSubcommand(answer.subcommand as string, newArgv, prompter); } return handleTableSubcommand(subcommand, newArgv, prompter); }; @@ -98,7 +99,7 @@ async function handleGet(argv: Partial>, prompter: Inqui const client = getClient(); const result = await client.appOwnerGrant .findOne({ - id: answers.id, + id: answers.id as string, select: { id: true, isGrant: true, @@ -141,7 +142,10 @@ async function handleCreate(argv: Partial>, prompter: In }, ]); const answers = coerceAnswers(rawAnswers, fieldSchema); - const cleanedData = stripUndefined(answers, fieldSchema); + const cleanedData = stripUndefined( + answers, + fieldSchema + ) as CreateAppOwnerGrantInput['appOwnerGrant']; const client = getClient(); const result = await client.appOwnerGrant .create({ @@ -198,7 +202,7 @@ async function handleUpdate(argv: Partial>, prompter: In }, ]); const answers = coerceAnswers(rawAnswers, fieldSchema); - const cleanedData = stripUndefined(answers, fieldSchema); + const cleanedData = stripUndefined(answers, fieldSchema) as AppOwnerGrantPatch; const client = getClient(); const result = await client.appOwnerGrant .update({ diff --git a/sdk/constructive-cli/src/public/cli/commands/app-permission-default.ts b/sdk/constructive-cli/src/public/cli/commands/app-permission-default.ts index 50b80cc1e..6953061cb 100644 --- a/sdk/constructive-cli/src/public/cli/commands/app-permission-default.ts +++ b/sdk/constructive-cli/src/public/cli/commands/app-permission-default.ts @@ -1,4 +1,3 @@ -// @ts-nocheck /** * CLI commands for AppPermissionDefault * @generated by @constructive-io/graphql-codegen @@ -7,7 +6,12 @@ import { CLIOptions, Inquirerer, extractFirst } from 'inquirerer'; import { getClient } from '../executor'; import { coerceAnswers, stripUndefined } from '../utils'; -const fieldSchema = { +import type { FieldSchema } from '../utils'; +import type { + CreateAppPermissionDefaultInput, + AppPermissionDefaultPatch, +} from '../../orm/input-types'; +const fieldSchema: FieldSchema = { id: 'uuid', permissions: 'string', }; @@ -32,7 +36,7 @@ export default async ( options: ['list', 'get', 'create', 'update', 'delete'], }, ]); - return handleTableSubcommand(answer.subcommand, newArgv, prompter); + return handleTableSubcommand(answer.subcommand as string, newArgv, prompter); } return handleTableSubcommand(subcommand, newArgv, prompter); }; @@ -90,7 +94,7 @@ async function handleGet(argv: Partial>, prompter: Inqui const client = getClient(); const result = await client.appPermissionDefault .findOne({ - id: answers.id, + id: answers.id as string, select: { id: true, permissions: true, @@ -117,7 +121,10 @@ async function handleCreate(argv: Partial>, prompter: In }, ]); const answers = coerceAnswers(rawAnswers, fieldSchema); - const cleanedData = stripUndefined(answers, fieldSchema); + const cleanedData = stripUndefined( + answers, + fieldSchema + ) as CreateAppPermissionDefaultInput['appPermissionDefault']; const client = getClient(); const result = await client.appPermissionDefault .create({ @@ -156,7 +163,7 @@ async function handleUpdate(argv: Partial>, prompter: In }, ]); const answers = coerceAnswers(rawAnswers, fieldSchema); - const cleanedData = stripUndefined(answers, fieldSchema); + const cleanedData = stripUndefined(answers, fieldSchema) as AppPermissionDefaultPatch; const client = getClient(); const result = await client.appPermissionDefault .update({ diff --git a/sdk/constructive-cli/src/public/cli/commands/app-permission.ts b/sdk/constructive-cli/src/public/cli/commands/app-permission.ts index 1b2b2a10e..881addd75 100644 --- a/sdk/constructive-cli/src/public/cli/commands/app-permission.ts +++ b/sdk/constructive-cli/src/public/cli/commands/app-permission.ts @@ -1,4 +1,3 @@ -// @ts-nocheck /** * CLI commands for AppPermission * @generated by @constructive-io/graphql-codegen @@ -7,7 +6,9 @@ import { CLIOptions, Inquirerer, extractFirst } from 'inquirerer'; import { getClient } from '../executor'; import { coerceAnswers, stripUndefined } from '../utils'; -const fieldSchema = { +import type { FieldSchema } from '../utils'; +import type { CreateAppPermissionInput, AppPermissionPatch } from '../../orm/input-types'; +const fieldSchema: FieldSchema = { id: 'uuid', name: 'string', bitnum: 'int', @@ -35,7 +36,7 @@ export default async ( options: ['list', 'get', 'create', 'update', 'delete'], }, ]); - return handleTableSubcommand(answer.subcommand, newArgv, prompter); + return handleTableSubcommand(answer.subcommand as string, newArgv, prompter); } return handleTableSubcommand(subcommand, newArgv, prompter); }; @@ -96,7 +97,7 @@ async function handleGet(argv: Partial>, prompter: Inqui const client = getClient(); const result = await client.appPermission .findOne({ - id: answers.id, + id: answers.id as string, select: { id: true, name: true, @@ -144,7 +145,10 @@ async function handleCreate(argv: Partial>, prompter: In }, ]); const answers = coerceAnswers(rawAnswers, fieldSchema); - const cleanedData = stripUndefined(answers, fieldSchema); + const cleanedData = stripUndefined( + answers, + fieldSchema + ) as CreateAppPermissionInput['appPermission']; const client = getClient(); const result = await client.appPermission .create({ @@ -207,7 +211,7 @@ async function handleUpdate(argv: Partial>, prompter: In }, ]); const answers = coerceAnswers(rawAnswers, fieldSchema); - const cleanedData = stripUndefined(answers, fieldSchema); + const cleanedData = stripUndefined(answers, fieldSchema) as AppPermissionPatch; const client = getClient(); const result = await client.appPermission .update({ diff --git a/sdk/constructive-cli/src/public/cli/commands/app-permissions-get-by-mask.ts b/sdk/constructive-cli/src/public/cli/commands/app-permissions-get-by-mask.ts index 52ce91ab6..b467acc7f 100644 --- a/sdk/constructive-cli/src/public/cli/commands/app-permissions-get-by-mask.ts +++ b/sdk/constructive-cli/src/public/cli/commands/app-permissions-get-by-mask.ts @@ -1,4 +1,3 @@ -// @ts-nocheck /** * CLI command for query appPermissionsGetByMask * @generated by @constructive-io/graphql-codegen @@ -7,6 +6,8 @@ import { CLIOptions, Inquirerer } from 'inquirerer'; import { getClient } from '../executor'; import { buildSelectFromPaths } from '../utils'; +import type { AppPermissionsGetByMaskVariables } from '../../orm/query'; +import type { AppPermissionConnectionSelect } from '../../orm/input-types'; export default async ( argv: Partial>, prompter: Inquirerer, @@ -43,11 +44,16 @@ export default async ( }, ]); const client = getClient(); - const selectFields = buildSelectFromPaths(argv.select ?? ''); + const selectFields = buildSelectFromPaths((argv.select as string) ?? ''); const result = await client.query - .appPermissionsGetByMask(answers, { - select: selectFields, - }) + .appPermissionsGetByMask( + answers as unknown as AppPermissionsGetByMaskVariables, + { + select: selectFields, + } as unknown as { + select: AppPermissionConnectionSelect; + } + ) .execute(); console.log(JSON.stringify(result, null, 2)); } catch (error) { diff --git a/sdk/constructive-cli/src/public/cli/commands/app-permissions-get-mask-by-names.ts b/sdk/constructive-cli/src/public/cli/commands/app-permissions-get-mask-by-names.ts index 693bae1a2..2b9494ddd 100644 --- a/sdk/constructive-cli/src/public/cli/commands/app-permissions-get-mask-by-names.ts +++ b/sdk/constructive-cli/src/public/cli/commands/app-permissions-get-mask-by-names.ts @@ -1,4 +1,3 @@ -// @ts-nocheck /** * CLI command for query appPermissionsGetMaskByNames * @generated by @constructive-io/graphql-codegen @@ -6,6 +5,7 @@ */ import { CLIOptions, Inquirerer } from 'inquirerer'; import { getClient } from '../executor'; +import type { AppPermissionsGetMaskByNamesVariables } from '../../orm/query'; export default async ( argv: Partial>, prompter: Inquirerer, @@ -26,7 +26,9 @@ export default async ( }, ]); const client = getClient(); - const result = await client.query.appPermissionsGetMaskByNames(answers).execute(); + const result = await client.query + .appPermissionsGetMaskByNames(answers as unknown as AppPermissionsGetMaskByNamesVariables) + .execute(); console.log(JSON.stringify(result, null, 2)); } catch (error) { console.error('Failed: appPermissionsGetMaskByNames'); diff --git a/sdk/constructive-cli/src/public/cli/commands/app-permissions-get-mask.ts b/sdk/constructive-cli/src/public/cli/commands/app-permissions-get-mask.ts index 60838c45e..f40cf3607 100644 --- a/sdk/constructive-cli/src/public/cli/commands/app-permissions-get-mask.ts +++ b/sdk/constructive-cli/src/public/cli/commands/app-permissions-get-mask.ts @@ -1,4 +1,3 @@ -// @ts-nocheck /** * CLI command for query appPermissionsGetMask * @generated by @constructive-io/graphql-codegen @@ -6,6 +5,7 @@ */ import { CLIOptions, Inquirerer } from 'inquirerer'; import { getClient } from '../executor'; +import type { AppPermissionsGetMaskVariables } from '../../orm/query'; export default async ( argv: Partial>, prompter: Inquirerer, @@ -26,7 +26,9 @@ export default async ( }, ]); const client = getClient(); - const result = await client.query.appPermissionsGetMask(answers).execute(); + const result = await client.query + .appPermissionsGetMask(answers as unknown as AppPermissionsGetMaskVariables) + .execute(); console.log(JSON.stringify(result, null, 2)); } catch (error) { console.error('Failed: appPermissionsGetMask'); diff --git a/sdk/constructive-cli/src/public/cli/commands/app-permissions-get-padded-mask.ts b/sdk/constructive-cli/src/public/cli/commands/app-permissions-get-padded-mask.ts index e671b931b..afa2fbc4c 100644 --- a/sdk/constructive-cli/src/public/cli/commands/app-permissions-get-padded-mask.ts +++ b/sdk/constructive-cli/src/public/cli/commands/app-permissions-get-padded-mask.ts @@ -1,4 +1,3 @@ -// @ts-nocheck /** * CLI command for query appPermissionsGetPaddedMask * @generated by @constructive-io/graphql-codegen @@ -6,6 +5,7 @@ */ import { CLIOptions, Inquirerer } from 'inquirerer'; import { getClient } from '../executor'; +import type { AppPermissionsGetPaddedMaskVariables } from '../../orm/query'; export default async ( argv: Partial>, prompter: Inquirerer, @@ -26,7 +26,9 @@ export default async ( }, ]); const client = getClient(); - const result = await client.query.appPermissionsGetPaddedMask(answers).execute(); + const result = await client.query + .appPermissionsGetPaddedMask(answers as unknown as AppPermissionsGetPaddedMaskVariables) + .execute(); console.log(JSON.stringify(result, null, 2)); } catch (error) { console.error('Failed: appPermissionsGetPaddedMask'); diff --git a/sdk/constructive-cli/src/public/cli/commands/app-step.ts b/sdk/constructive-cli/src/public/cli/commands/app-step.ts index ad0efff93..ee68a01de 100644 --- a/sdk/constructive-cli/src/public/cli/commands/app-step.ts +++ b/sdk/constructive-cli/src/public/cli/commands/app-step.ts @@ -1,4 +1,3 @@ -// @ts-nocheck /** * CLI commands for AppStep * @generated by @constructive-io/graphql-codegen @@ -7,7 +6,9 @@ import { CLIOptions, Inquirerer, extractFirst } from 'inquirerer'; import { getClient } from '../executor'; import { coerceAnswers, stripUndefined } from '../utils'; -const fieldSchema = { +import type { FieldSchema } from '../utils'; +import type { CreateAppStepInput, AppStepPatch } from '../../orm/input-types'; +const fieldSchema: FieldSchema = { id: 'uuid', actorId: 'uuid', name: 'string', @@ -36,7 +37,7 @@ export default async ( options: ['list', 'get', 'create', 'update', 'delete'], }, ]); - return handleTableSubcommand(answer.subcommand, newArgv, prompter); + return handleTableSubcommand(answer.subcommand as string, newArgv, prompter); } return handleTableSubcommand(subcommand, newArgv, prompter); }; @@ -98,7 +99,7 @@ async function handleGet(argv: Partial>, prompter: Inqui const client = getClient(); const result = await client.appStep .findOne({ - id: answers.id, + id: answers.id as string, select: { id: true, actorId: true, @@ -141,7 +142,7 @@ async function handleCreate(argv: Partial>, prompter: In }, ]); const answers = coerceAnswers(rawAnswers, fieldSchema); - const cleanedData = stripUndefined(answers, fieldSchema); + const cleanedData = stripUndefined(answers, fieldSchema) as CreateAppStepInput['appStep']; const client = getClient(); const result = await client.appStep .create({ @@ -198,7 +199,7 @@ async function handleUpdate(argv: Partial>, prompter: In }, ]); const answers = coerceAnswers(rawAnswers, fieldSchema); - const cleanedData = stripUndefined(answers, fieldSchema); + const cleanedData = stripUndefined(answers, fieldSchema) as AppStepPatch; const client = getClient(); const result = await client.appStep .update({ diff --git a/sdk/constructive-cli/src/public/cli/commands/app.ts b/sdk/constructive-cli/src/public/cli/commands/app.ts index 03ede0cc7..cf27f5b5a 100644 --- a/sdk/constructive-cli/src/public/cli/commands/app.ts +++ b/sdk/constructive-cli/src/public/cli/commands/app.ts @@ -1,4 +1,3 @@ -// @ts-nocheck /** * CLI commands for App * @generated by @constructive-io/graphql-codegen @@ -7,7 +6,9 @@ import { CLIOptions, Inquirerer, extractFirst } from 'inquirerer'; import { getClient } from '../executor'; import { coerceAnswers, stripUndefined } from '../utils'; -const fieldSchema = { +import type { FieldSchema } from '../utils'; +import type { CreateAppInput, AppPatch } from '../../orm/input-types'; +const fieldSchema: FieldSchema = { id: 'uuid', databaseId: 'uuid', siteId: 'uuid', @@ -39,7 +40,7 @@ export default async ( options: ['list', 'get', 'create', 'update', 'delete'], }, ]); - return handleTableSubcommand(answer.subcommand, newArgv, prompter); + return handleTableSubcommand(answer.subcommand as string, newArgv, prompter); } return handleTableSubcommand(subcommand, newArgv, prompter); }; @@ -104,7 +105,7 @@ async function handleGet(argv: Partial>, prompter: Inqui const client = getClient(); const result = await client.app .findOne({ - id: answers.id, + id: answers.id as string, select: { id: true, databaseId: true, @@ -180,7 +181,7 @@ async function handleCreate(argv: Partial>, prompter: In }, ]); const answers = coerceAnswers(rawAnswers, fieldSchema); - const cleanedData = stripUndefined(answers, fieldSchema); + const cleanedData = stripUndefined(answers, fieldSchema) as CreateAppInput['app']; const client = getClient(); const result = await client.app .create({ @@ -275,7 +276,7 @@ async function handleUpdate(argv: Partial>, prompter: In }, ]); const answers = coerceAnswers(rawAnswers, fieldSchema); - const cleanedData = stripUndefined(answers, fieldSchema); + const cleanedData = stripUndefined(answers, fieldSchema) as AppPatch; const client = getClient(); const result = await client.app .update({ diff --git a/sdk/constructive-cli/src/public/cli/commands/apply-rls.ts b/sdk/constructive-cli/src/public/cli/commands/apply-rls.ts index ac1904df4..dedc37f12 100644 --- a/sdk/constructive-cli/src/public/cli/commands/apply-rls.ts +++ b/sdk/constructive-cli/src/public/cli/commands/apply-rls.ts @@ -1,4 +1,3 @@ -// @ts-nocheck /** * CLI command for mutation applyRls * @generated by @constructive-io/graphql-codegen @@ -7,6 +6,8 @@ import { CLIOptions, Inquirerer } from 'inquirerer'; import { getClient } from '../executor'; import { parseMutationInput, buildSelectFromPaths } from '../utils'; +import type { ApplyRlsVariables } from '../../orm/mutation'; +import type { ApplyRlsPayloadSelect } from '../../orm/input-types'; export default async ( argv: Partial>, prompter: Inquirerer, @@ -28,11 +29,16 @@ export default async ( ]); const client = getClient(); const parsedAnswers = parseMutationInput(answers); - const selectFields = buildSelectFromPaths(argv.select ?? 'clientMutationId'); + const selectFields = buildSelectFromPaths((argv.select as string) ?? 'clientMutationId'); const result = await client.mutation - .applyRls(parsedAnswers, { - select: selectFields, - }) + .applyRls( + parsedAnswers as unknown as ApplyRlsVariables, + { + select: selectFields, + } as unknown as { + select: ApplyRlsPayloadSelect; + } + ) .execute(); console.log(JSON.stringify(result, null, 2)); } catch (error) { diff --git a/sdk/constructive-cli/src/public/cli/commands/ast-migration.ts b/sdk/constructive-cli/src/public/cli/commands/ast-migration.ts index 21afb4fb7..f2ac6b8df 100644 --- a/sdk/constructive-cli/src/public/cli/commands/ast-migration.ts +++ b/sdk/constructive-cli/src/public/cli/commands/ast-migration.ts @@ -1,4 +1,3 @@ -// @ts-nocheck /** * CLI commands for AstMigration * @generated by @constructive-io/graphql-codegen @@ -7,7 +6,9 @@ import { CLIOptions, Inquirerer, extractFirst } from 'inquirerer'; import { getClient } from '../executor'; import { coerceAnswers, stripUndefined } from '../utils'; -const fieldSchema = { +import type { FieldSchema } from '../utils'; +import type { CreateAstMigrationInput, AstMigrationPatch } from '../../orm/input-types'; +const fieldSchema: FieldSchema = { id: 'int', databaseId: 'uuid', name: 'string', @@ -23,7 +24,7 @@ const fieldSchema = { actorId: 'uuid', }; const usage = - '\nast-migration \n\nCommands:\n list List all astMigration records\n get Get a astMigration by ID\n create Create a new astMigration\n update Update an existing astMigration\n delete Delete a astMigration\n\n --help, -h Show this help message\n'; + '\nast-migration \n\nCommands:\n list List all astMigration records\n create Create a new astMigration\n\n --help, -h Show this help message\n'; export default async ( argv: Partial>, prompter: Inquirerer, @@ -40,10 +41,10 @@ export default async ( type: 'autocomplete', name: 'subcommand', message: 'What do you want to do?', - options: ['list', 'get', 'create', 'update', 'delete'], + options: ['list', 'create'], }, ]); - return handleTableSubcommand(answer.subcommand, newArgv, prompter); + return handleTableSubcommand(answer.subcommand as string, newArgv, prompter); } return handleTableSubcommand(subcommand, newArgv, prompter); }; @@ -55,14 +56,8 @@ async function handleTableSubcommand( switch (subcommand) { case 'list': return handleList(argv, prompter); - case 'get': - return handleGet(argv, prompter); case 'create': return handleCreate(argv, prompter); - case 'update': - return handleUpdate(argv, prompter); - case 'delete': - return handleDelete(argv, prompter); default: console.log(usage); process.exit(1); @@ -99,46 +94,6 @@ async function handleList(_argv: Partial>, _prompter: In process.exit(1); } } -async function handleGet(argv: Partial>, prompter: Inquirerer) { - try { - const answers = await prompter.prompt(argv, [ - { - type: 'text', - name: 'id', - message: 'id', - required: true, - }, - ]); - const client = getClient(); - const result = await client.astMigration - .findOne({ - id: answers.id, - select: { - id: true, - databaseId: true, - name: true, - requires: true, - payload: true, - deploys: true, - deploy: true, - revert: true, - verify: true, - createdAt: true, - action: true, - actionId: true, - actorId: true, - }, - }) - .execute(); - console.log(JSON.stringify(result, null, 2)); - } catch (error) { - console.error('Record not found.'); - if (error instanceof Error) { - console.error(error.message); - } - process.exit(1); - } -} async function handleCreate(argv: Partial>, prompter: Inquirerer) { try { const rawAnswers = await prompter.prompt(argv, [ @@ -210,7 +165,10 @@ async function handleCreate(argv: Partial>, prompter: In }, ]); const answers = coerceAnswers(rawAnswers, fieldSchema); - const cleanedData = stripUndefined(answers, fieldSchema); + const cleanedData = stripUndefined( + answers, + fieldSchema + ) as CreateAstMigrationInput['astMigration']; const client = getClient(); const result = await client.astMigration .create({ @@ -253,157 +211,3 @@ async function handleCreate(argv: Partial>, prompter: In process.exit(1); } } -async function handleUpdate(argv: Partial>, prompter: Inquirerer) { - try { - const rawAnswers = await prompter.prompt(argv, [ - { - type: 'text', - name: 'id', - message: 'id', - required: true, - }, - { - type: 'text', - name: 'databaseId', - message: 'databaseId', - required: false, - }, - { - type: 'text', - name: 'name', - message: 'name', - required: false, - }, - { - type: 'text', - name: 'requires', - message: 'requires', - required: false, - }, - { - type: 'text', - name: 'payload', - message: 'payload', - required: false, - }, - { - type: 'text', - name: 'deploys', - message: 'deploys', - required: false, - }, - { - type: 'text', - name: 'deploy', - message: 'deploy', - required: false, - }, - { - type: 'text', - name: 'revert', - message: 'revert', - required: false, - }, - { - type: 'text', - name: 'verify', - message: 'verify', - required: false, - }, - { - type: 'text', - name: 'action', - message: 'action', - required: false, - }, - { - type: 'text', - name: 'actionId', - message: 'actionId', - required: false, - }, - { - type: 'text', - name: 'actorId', - message: 'actorId', - required: false, - }, - ]); - const answers = coerceAnswers(rawAnswers, fieldSchema); - const cleanedData = stripUndefined(answers, fieldSchema); - const client = getClient(); - const result = await client.astMigration - .update({ - where: { - id: answers.id as string, - }, - data: { - databaseId: cleanedData.databaseId, - name: cleanedData.name, - requires: cleanedData.requires, - payload: cleanedData.payload, - deploys: cleanedData.deploys, - deploy: cleanedData.deploy, - revert: cleanedData.revert, - verify: cleanedData.verify, - action: cleanedData.action, - actionId: cleanedData.actionId, - actorId: cleanedData.actorId, - }, - select: { - id: true, - databaseId: true, - name: true, - requires: true, - payload: true, - deploys: true, - deploy: true, - revert: true, - verify: true, - createdAt: true, - action: true, - actionId: true, - actorId: true, - }, - }) - .execute(); - console.log(JSON.stringify(result, null, 2)); - } catch (error) { - console.error('Failed to update record.'); - if (error instanceof Error) { - console.error(error.message); - } - process.exit(1); - } -} -async function handleDelete(argv: Partial>, prompter: Inquirerer) { - try { - const rawAnswers = await prompter.prompt(argv, [ - { - type: 'text', - name: 'id', - message: 'id', - required: true, - }, - ]); - const answers = coerceAnswers(rawAnswers, fieldSchema); - const client = getClient(); - const result = await client.astMigration - .delete({ - where: { - id: answers.id as string, - }, - select: { - id: true, - }, - }) - .execute(); - console.log(JSON.stringify(result, null, 2)); - } catch (error) { - console.error('Failed to delete record.'); - if (error instanceof Error) { - console.error(error.message); - } - process.exit(1); - } -} diff --git a/sdk/constructive-cli/src/public/cli/commands/audit-log.ts b/sdk/constructive-cli/src/public/cli/commands/audit-log.ts index 933dfd39d..f41124c84 100644 --- a/sdk/constructive-cli/src/public/cli/commands/audit-log.ts +++ b/sdk/constructive-cli/src/public/cli/commands/audit-log.ts @@ -1,4 +1,3 @@ -// @ts-nocheck /** * CLI commands for AuditLog * @generated by @constructive-io/graphql-codegen @@ -7,7 +6,9 @@ import { CLIOptions, Inquirerer, extractFirst } from 'inquirerer'; import { getClient } from '../executor'; import { coerceAnswers, stripUndefined } from '../utils'; -const fieldSchema = { +import type { FieldSchema } from '../utils'; +import type { CreateAuditLogInput, AuditLogPatch } from '../../orm/input-types'; +const fieldSchema: FieldSchema = { id: 'uuid', event: 'string', actorId: 'uuid', @@ -38,7 +39,7 @@ export default async ( options: ['list', 'get', 'create', 'update', 'delete'], }, ]); - return handleTableSubcommand(answer.subcommand, newArgv, prompter); + return handleTableSubcommand(answer.subcommand as string, newArgv, prompter); } return handleTableSubcommand(subcommand, newArgv, prompter); }; @@ -102,7 +103,7 @@ async function handleGet(argv: Partial>, prompter: Inqui const client = getClient(); const result = await client.auditLog .findOne({ - id: answers.id, + id: answers.id as string, select: { id: true, event: true, @@ -165,7 +166,7 @@ async function handleCreate(argv: Partial>, prompter: In }, ]); const answers = coerceAnswers(rawAnswers, fieldSchema); - const cleanedData = stripUndefined(answers, fieldSchema); + const cleanedData = stripUndefined(answers, fieldSchema) as CreateAuditLogInput['auditLog']; const client = getClient(); const result = await client.auditLog .create({ @@ -245,7 +246,7 @@ async function handleUpdate(argv: Partial>, prompter: In }, ]); const answers = coerceAnswers(rawAnswers, fieldSchema); - const cleanedData = stripUndefined(answers, fieldSchema); + const cleanedData = stripUndefined(answers, fieldSchema) as AuditLogPatch; const client = getClient(); const result = await client.auditLog .update({ diff --git a/sdk/constructive-cli/src/public/cli/commands/auth.ts b/sdk/constructive-cli/src/public/cli/commands/auth.ts index 1bfe7085c..c731ba27c 100644 --- a/sdk/constructive-cli/src/public/cli/commands/auth.ts +++ b/sdk/constructive-cli/src/public/cli/commands/auth.ts @@ -1,4 +1,3 @@ -// @ts-nocheck /** * Authentication commands * @generated by @constructive-io/graphql-codegen @@ -28,7 +27,7 @@ export default async ( options: ['set-token', 'status', 'logout'], }, ]); - return handleAuthSubcommand(answer.subcommand, newArgv, prompter, store); + return handleAuthSubcommand(answer.subcommand as string, newArgv, prompter, store); } return handleAuthSubcommand(subcommand, newArgv, prompter, store); }; @@ -71,7 +70,7 @@ async function handleSetToken( required: true, }, ]); - tokenValue = answer.token; + tokenValue = answer.token as string; } store.setCredentials(current.name, { token: String(tokenValue || '').trim(), @@ -112,7 +111,7 @@ async function handleLogout( default: false, }, ]); - if (!confirm.confirm) { + if (!(confirm.confirm as boolean)) { return; } if (store.removeCredentials(current.name)) { diff --git a/sdk/constructive-cli/src/public/cli/commands/bootstrap-user.ts b/sdk/constructive-cli/src/public/cli/commands/bootstrap-user.ts index 0f8d594a5..11f465a9a 100644 --- a/sdk/constructive-cli/src/public/cli/commands/bootstrap-user.ts +++ b/sdk/constructive-cli/src/public/cli/commands/bootstrap-user.ts @@ -1,4 +1,3 @@ -// @ts-nocheck /** * CLI command for mutation bootstrapUser * @generated by @constructive-io/graphql-codegen @@ -7,6 +6,8 @@ import { CLIOptions, Inquirerer } from 'inquirerer'; import { getClient } from '../executor'; import { parseMutationInput, buildSelectFromPaths } from '../utils'; +import type { BootstrapUserVariables } from '../../orm/mutation'; +import type { BootstrapUserPayloadSelect } from '../../orm/input-types'; export default async ( argv: Partial>, prompter: Inquirerer, @@ -28,11 +29,16 @@ export default async ( ]); const client = getClient(); const parsedAnswers = parseMutationInput(answers); - const selectFields = buildSelectFromPaths(argv.select ?? 'clientMutationId'); + const selectFields = buildSelectFromPaths((argv.select as string) ?? 'clientMutationId'); const result = await client.mutation - .bootstrapUser(parsedAnswers, { - select: selectFields, - }) + .bootstrapUser( + parsedAnswers as unknown as BootstrapUserVariables, + { + select: selectFields, + } as unknown as { + select: BootstrapUserPayloadSelect; + } + ) .execute(); console.log(JSON.stringify(result, null, 2)); } catch (error) { diff --git a/sdk/constructive-cli/src/public/cli/commands/check-constraint.ts b/sdk/constructive-cli/src/public/cli/commands/check-constraint.ts index d0ee942b8..7e5b70778 100644 --- a/sdk/constructive-cli/src/public/cli/commands/check-constraint.ts +++ b/sdk/constructive-cli/src/public/cli/commands/check-constraint.ts @@ -1,4 +1,3 @@ -// @ts-nocheck /** * CLI commands for CheckConstraint * @generated by @constructive-io/graphql-codegen @@ -7,7 +6,9 @@ import { CLIOptions, Inquirerer, extractFirst } from 'inquirerer'; import { getClient } from '../executor'; import { coerceAnswers, stripUndefined } from '../utils'; -const fieldSchema = { +import type { FieldSchema } from '../utils'; +import type { CreateCheckConstraintInput, CheckConstraintPatch } from '../../orm/input-types'; +const fieldSchema: FieldSchema = { id: 'uuid', databaseId: 'uuid', tableId: 'uuid', @@ -44,7 +45,7 @@ export default async ( options: ['list', 'get', 'create', 'update', 'delete'], }, ]); - return handleTableSubcommand(answer.subcommand, newArgv, prompter); + return handleTableSubcommand(answer.subcommand as string, newArgv, prompter); } return handleTableSubcommand(subcommand, newArgv, prompter); }; @@ -114,7 +115,7 @@ async function handleGet(argv: Partial>, prompter: Inqui const client = getClient(); const result = await client.checkConstraint .findOne({ - id: answers.id, + id: answers.id as string, select: { id: true, databaseId: true, @@ -213,7 +214,10 @@ async function handleCreate(argv: Partial>, prompter: In }, ]); const answers = coerceAnswers(rawAnswers, fieldSchema); - const cleanedData = stripUndefined(answers, fieldSchema); + const cleanedData = stripUndefined( + answers, + fieldSchema + ) as CreateCheckConstraintInput['checkConstraint']; const client = getClient(); const result = await client.checkConstraint .create({ @@ -334,7 +338,7 @@ async function handleUpdate(argv: Partial>, prompter: In }, ]); const answers = coerceAnswers(rawAnswers, fieldSchema); - const cleanedData = stripUndefined(answers, fieldSchema); + const cleanedData = stripUndefined(answers, fieldSchema) as CheckConstraintPatch; const client = getClient(); const result = await client.checkConstraint .update({ diff --git a/sdk/constructive-cli/src/public/cli/commands/check-password.ts b/sdk/constructive-cli/src/public/cli/commands/check-password.ts index ab47f3206..5a2a0a1be 100644 --- a/sdk/constructive-cli/src/public/cli/commands/check-password.ts +++ b/sdk/constructive-cli/src/public/cli/commands/check-password.ts @@ -1,4 +1,3 @@ -// @ts-nocheck /** * CLI command for mutation checkPassword * @generated by @constructive-io/graphql-codegen @@ -7,6 +6,8 @@ import { CLIOptions, Inquirerer } from 'inquirerer'; import { getClient } from '../executor'; import { parseMutationInput, buildSelectFromPaths } from '../utils'; +import type { CheckPasswordVariables } from '../../orm/mutation'; +import type { CheckPasswordPayloadSelect } from '../../orm/input-types'; export default async ( argv: Partial>, prompter: Inquirerer, @@ -28,11 +29,16 @@ export default async ( ]); const client = getClient(); const parsedAnswers = parseMutationInput(answers); - const selectFields = buildSelectFromPaths(argv.select ?? 'clientMutationId'); + const selectFields = buildSelectFromPaths((argv.select as string) ?? 'clientMutationId'); const result = await client.mutation - .checkPassword(parsedAnswers, { - select: selectFields, - }) + .checkPassword( + parsedAnswers as unknown as CheckPasswordVariables, + { + select: selectFields, + } as unknown as { + select: CheckPasswordPayloadSelect; + } + ) .execute(); console.log(JSON.stringify(result, null, 2)); } catch (error) { diff --git a/sdk/constructive-cli/src/public/cli/commands/claimed-invite.ts b/sdk/constructive-cli/src/public/cli/commands/claimed-invite.ts index 1437b21bd..d8505e958 100644 --- a/sdk/constructive-cli/src/public/cli/commands/claimed-invite.ts +++ b/sdk/constructive-cli/src/public/cli/commands/claimed-invite.ts @@ -1,4 +1,3 @@ -// @ts-nocheck /** * CLI commands for ClaimedInvite * @generated by @constructive-io/graphql-codegen @@ -7,7 +6,9 @@ import { CLIOptions, Inquirerer, extractFirst } from 'inquirerer'; import { getClient } from '../executor'; import { coerceAnswers, stripUndefined } from '../utils'; -const fieldSchema = { +import type { FieldSchema } from '../utils'; +import type { CreateClaimedInviteInput, ClaimedInvitePatch } from '../../orm/input-types'; +const fieldSchema: FieldSchema = { id: 'uuid', data: 'json', senderId: 'uuid', @@ -36,7 +37,7 @@ export default async ( options: ['list', 'get', 'create', 'update', 'delete'], }, ]); - return handleTableSubcommand(answer.subcommand, newArgv, prompter); + return handleTableSubcommand(answer.subcommand as string, newArgv, prompter); } return handleTableSubcommand(subcommand, newArgv, prompter); }; @@ -98,7 +99,7 @@ async function handleGet(argv: Partial>, prompter: Inqui const client = getClient(); const result = await client.claimedInvite .findOne({ - id: answers.id, + id: answers.id as string, select: { id: true, data: true, @@ -141,7 +142,10 @@ async function handleCreate(argv: Partial>, prompter: In }, ]); const answers = coerceAnswers(rawAnswers, fieldSchema); - const cleanedData = stripUndefined(answers, fieldSchema); + const cleanedData = stripUndefined( + answers, + fieldSchema + ) as CreateClaimedInviteInput['claimedInvite']; const client = getClient(); const result = await client.claimedInvite .create({ @@ -198,7 +202,7 @@ async function handleUpdate(argv: Partial>, prompter: In }, ]); const answers = coerceAnswers(rawAnswers, fieldSchema); - const cleanedData = stripUndefined(answers, fieldSchema); + const cleanedData = stripUndefined(answers, fieldSchema) as ClaimedInvitePatch; const client = getClient(); const result = await client.claimedInvite .update({ diff --git a/sdk/constructive-cli/src/public/cli/commands/commit.ts b/sdk/constructive-cli/src/public/cli/commands/commit.ts index 0172f1f39..4f884622d 100644 --- a/sdk/constructive-cli/src/public/cli/commands/commit.ts +++ b/sdk/constructive-cli/src/public/cli/commands/commit.ts @@ -1,4 +1,3 @@ -// @ts-nocheck /** * CLI commands for Commit * @generated by @constructive-io/graphql-codegen @@ -7,7 +6,9 @@ import { CLIOptions, Inquirerer, extractFirst } from 'inquirerer'; import { getClient } from '../executor'; import { coerceAnswers, stripUndefined } from '../utils'; -const fieldSchema = { +import type { FieldSchema } from '../utils'; +import type { CreateCommitInput, CommitPatch } from '../../orm/input-types'; +const fieldSchema: FieldSchema = { id: 'uuid', message: 'string', databaseId: 'uuid', @@ -39,7 +40,7 @@ export default async ( options: ['list', 'get', 'create', 'update', 'delete'], }, ]); - return handleTableSubcommand(answer.subcommand, newArgv, prompter); + return handleTableSubcommand(answer.subcommand as string, newArgv, prompter); } return handleTableSubcommand(subcommand, newArgv, prompter); }; @@ -104,7 +105,7 @@ async function handleGet(argv: Partial>, prompter: Inqui const client = getClient(); const result = await client.commit .findOne({ - id: answers.id, + id: answers.id as string, select: { id: true, message: true, @@ -180,7 +181,7 @@ async function handleCreate(argv: Partial>, prompter: In }, ]); const answers = coerceAnswers(rawAnswers, fieldSchema); - const cleanedData = stripUndefined(answers, fieldSchema); + const cleanedData = stripUndefined(answers, fieldSchema) as CreateCommitInput['commit']; const client = getClient(); const result = await client.commit .create({ @@ -275,7 +276,7 @@ async function handleUpdate(argv: Partial>, prompter: In }, ]); const answers = coerceAnswers(rawAnswers, fieldSchema); - const cleanedData = stripUndefined(answers, fieldSchema); + const cleanedData = stripUndefined(answers, fieldSchema) as CommitPatch; const client = getClient(); const result = await client.commit .update({ diff --git a/sdk/constructive-cli/src/public/cli/commands/confirm-delete-account.ts b/sdk/constructive-cli/src/public/cli/commands/confirm-delete-account.ts index 2351bec6f..bdde36e74 100644 --- a/sdk/constructive-cli/src/public/cli/commands/confirm-delete-account.ts +++ b/sdk/constructive-cli/src/public/cli/commands/confirm-delete-account.ts @@ -1,4 +1,3 @@ -// @ts-nocheck /** * CLI command for mutation confirmDeleteAccount * @generated by @constructive-io/graphql-codegen @@ -7,6 +6,8 @@ import { CLIOptions, Inquirerer } from 'inquirerer'; import { getClient } from '../executor'; import { parseMutationInput, buildSelectFromPaths } from '../utils'; +import type { ConfirmDeleteAccountVariables } from '../../orm/mutation'; +import type { ConfirmDeleteAccountPayloadSelect } from '../../orm/input-types'; export default async ( argv: Partial>, prompter: Inquirerer, @@ -30,11 +31,16 @@ export default async ( ]); const client = getClient(); const parsedAnswers = parseMutationInput(answers); - const selectFields = buildSelectFromPaths(argv.select ?? 'clientMutationId'); + const selectFields = buildSelectFromPaths((argv.select as string) ?? 'clientMutationId'); const result = await client.mutation - .confirmDeleteAccount(parsedAnswers, { - select: selectFields, - }) + .confirmDeleteAccount( + parsedAnswers as unknown as ConfirmDeleteAccountVariables, + { + select: selectFields, + } as unknown as { + select: ConfirmDeleteAccountPayloadSelect; + } + ) .execute(); console.log(JSON.stringify(result, null, 2)); } catch (error) { diff --git a/sdk/constructive-cli/src/public/cli/commands/connected-account.ts b/sdk/constructive-cli/src/public/cli/commands/connected-account.ts index c1b5490ee..3d2ae973c 100644 --- a/sdk/constructive-cli/src/public/cli/commands/connected-account.ts +++ b/sdk/constructive-cli/src/public/cli/commands/connected-account.ts @@ -1,4 +1,3 @@ -// @ts-nocheck /** * CLI commands for ConnectedAccount * @generated by @constructive-io/graphql-codegen @@ -7,7 +6,9 @@ import { CLIOptions, Inquirerer, extractFirst } from 'inquirerer'; import { getClient } from '../executor'; import { coerceAnswers, stripUndefined } from '../utils'; -const fieldSchema = { +import type { FieldSchema } from '../utils'; +import type { CreateConnectedAccountInput, ConnectedAccountPatch } from '../../orm/input-types'; +const fieldSchema: FieldSchema = { id: 'uuid', ownerId: 'uuid', service: 'string', @@ -38,7 +39,7 @@ export default async ( options: ['list', 'get', 'create', 'update', 'delete'], }, ]); - return handleTableSubcommand(answer.subcommand, newArgv, prompter); + return handleTableSubcommand(answer.subcommand as string, newArgv, prompter); } return handleTableSubcommand(subcommand, newArgv, prompter); }; @@ -102,7 +103,7 @@ async function handleGet(argv: Partial>, prompter: Inqui const client = getClient(); const result = await client.connectedAccount .findOne({ - id: answers.id, + id: answers.id as string, select: { id: true, ownerId: true, @@ -159,7 +160,10 @@ async function handleCreate(argv: Partial>, prompter: In }, ]); const answers = coerceAnswers(rawAnswers, fieldSchema); - const cleanedData = stripUndefined(answers, fieldSchema); + const cleanedData = stripUndefined( + answers, + fieldSchema + ) as CreateConnectedAccountInput['connectedAccount']; const client = getClient(); const result = await client.connectedAccount .create({ @@ -232,7 +236,7 @@ async function handleUpdate(argv: Partial>, prompter: In }, ]); const answers = coerceAnswers(rawAnswers, fieldSchema); - const cleanedData = stripUndefined(answers, fieldSchema); + const cleanedData = stripUndefined(answers, fieldSchema) as ConnectedAccountPatch; const client = getClient(); const result = await client.connectedAccount .update({ diff --git a/sdk/constructive-cli/src/public/cli/commands/connected-accounts-module.ts b/sdk/constructive-cli/src/public/cli/commands/connected-accounts-module.ts index c6961ed25..6f2afdf0e 100644 --- a/sdk/constructive-cli/src/public/cli/commands/connected-accounts-module.ts +++ b/sdk/constructive-cli/src/public/cli/commands/connected-accounts-module.ts @@ -1,4 +1,3 @@ -// @ts-nocheck /** * CLI commands for ConnectedAccountsModule * @generated by @constructive-io/graphql-codegen @@ -7,7 +6,12 @@ import { CLIOptions, Inquirerer, extractFirst } from 'inquirerer'; import { getClient } from '../executor'; import { coerceAnswers, stripUndefined } from '../utils'; -const fieldSchema = { +import type { FieldSchema } from '../utils'; +import type { + CreateConnectedAccountsModuleInput, + ConnectedAccountsModulePatch, +} from '../../orm/input-types'; +const fieldSchema: FieldSchema = { id: 'uuid', databaseId: 'uuid', schemaId: 'uuid', @@ -37,7 +41,7 @@ export default async ( options: ['list', 'get', 'create', 'update', 'delete'], }, ]); - return handleTableSubcommand(answer.subcommand, newArgv, prompter); + return handleTableSubcommand(answer.subcommand as string, newArgv, prompter); } return handleTableSubcommand(subcommand, newArgv, prompter); }; @@ -100,7 +104,7 @@ async function handleGet(argv: Partial>, prompter: Inqui const client = getClient(); const result = await client.connectedAccountsModule .findOne({ - id: answers.id, + id: answers.id as string, select: { id: true, databaseId: true, @@ -162,7 +166,10 @@ async function handleCreate(argv: Partial>, prompter: In }, ]); const answers = coerceAnswers(rawAnswers, fieldSchema); - const cleanedData = stripUndefined(answers, fieldSchema); + const cleanedData = stripUndefined( + answers, + fieldSchema + ) as CreateConnectedAccountsModuleInput['connectedAccountsModule']; const client = getClient(); const result = await client.connectedAccountsModule .create({ @@ -241,7 +248,7 @@ async function handleUpdate(argv: Partial>, prompter: In }, ]); const answers = coerceAnswers(rawAnswers, fieldSchema); - const cleanedData = stripUndefined(answers, fieldSchema); + const cleanedData = stripUndefined(answers, fieldSchema) as ConnectedAccountsModulePatch; const client = getClient(); const result = await client.connectedAccountsModule .update({ diff --git a/sdk/constructive-cli/src/public/cli/commands/context.ts b/sdk/constructive-cli/src/public/cli/commands/context.ts index 7f8262bb6..52d12c666 100644 --- a/sdk/constructive-cli/src/public/cli/commands/context.ts +++ b/sdk/constructive-cli/src/public/cli/commands/context.ts @@ -1,4 +1,3 @@ -// @ts-nocheck /** * Context management commands * @generated by @constructive-io/graphql-codegen @@ -28,7 +27,7 @@ export default async ( options: ['create', 'list', 'use', 'current', 'delete'], }, ]); - return handleSubcommand(answer.subcommand, newArgv, prompter, store); + return handleSubcommand(answer.subcommand as string, newArgv, prompter, store); } return handleSubcommand(subcommand, newArgv, prompter, store); }; @@ -60,7 +59,7 @@ async function handleCreate( store: ReturnType ) { const { first: name, newArgv: restArgv } = extractFirst(argv); - const answers = await prompter.prompt( + const answers = (await prompter.prompt( { name, ...restArgv, @@ -79,7 +78,7 @@ async function handleCreate( required: true, }, ] - ); + )) as unknown as Record; const contextName = answers.name; const endpoint = answers.endpoint; store.createContext(contextName, { @@ -128,7 +127,7 @@ async function handleUse( options: contexts.map((c) => c.name), }, ]); - contextName = answer.name; + contextName = answer.name as string; } if (store.setCurrentContext(contextName)) { console.log(`Switched to context: ${contextName}`); @@ -169,7 +168,7 @@ async function handleDelete( options: contexts.map((c) => c.name), }, ]); - contextName = answer.name; + contextName = answer.name as string; } if (store.deleteContext(contextName)) { console.log(`Deleted context: ${contextName}`); diff --git a/sdk/constructive-cli/src/public/cli/commands/create-user-database.ts b/sdk/constructive-cli/src/public/cli/commands/create-user-database.ts index 855b82358..8e13f5c3f 100644 --- a/sdk/constructive-cli/src/public/cli/commands/create-user-database.ts +++ b/sdk/constructive-cli/src/public/cli/commands/create-user-database.ts @@ -1,4 +1,3 @@ -// @ts-nocheck /** * CLI command for mutation createUserDatabase * @generated by @constructive-io/graphql-codegen @@ -7,6 +6,8 @@ import { CLIOptions, Inquirerer } from 'inquirerer'; import { getClient } from '../executor'; import { parseMutationInput, buildSelectFromPaths } from '../utils'; +import type { CreateUserDatabaseVariables } from '../../orm/mutation'; +import type { CreateUserDatabasePayloadSelect } from '../../orm/input-types'; export default async ( argv: Partial>, prompter: Inquirerer, @@ -30,11 +31,16 @@ export default async ( ]); const client = getClient(); const parsedAnswers = parseMutationInput(answers); - const selectFields = buildSelectFromPaths(argv.select ?? 'clientMutationId'); + const selectFields = buildSelectFromPaths((argv.select as string) ?? 'clientMutationId'); const result = await client.mutation - .createUserDatabase(parsedAnswers, { - select: selectFields, - }) + .createUserDatabase( + parsedAnswers as unknown as CreateUserDatabaseVariables, + { + select: selectFields, + } as unknown as { + select: CreateUserDatabasePayloadSelect; + } + ) .execute(); console.log(JSON.stringify(result, null, 2)); } catch (error) { diff --git a/sdk/constructive-cli/src/public/cli/commands/crypto-address.ts b/sdk/constructive-cli/src/public/cli/commands/crypto-address.ts index 831614dee..fbef27bc6 100644 --- a/sdk/constructive-cli/src/public/cli/commands/crypto-address.ts +++ b/sdk/constructive-cli/src/public/cli/commands/crypto-address.ts @@ -1,4 +1,3 @@ -// @ts-nocheck /** * CLI commands for CryptoAddress * @generated by @constructive-io/graphql-codegen @@ -7,7 +6,9 @@ import { CLIOptions, Inquirerer, extractFirst } from 'inquirerer'; import { getClient } from '../executor'; import { coerceAnswers, stripUndefined } from '../utils'; -const fieldSchema = { +import type { FieldSchema } from '../utils'; +import type { CreateCryptoAddressInput, CryptoAddressPatch } from '../../orm/input-types'; +const fieldSchema: FieldSchema = { id: 'uuid', ownerId: 'uuid', address: 'string', @@ -37,7 +38,7 @@ export default async ( options: ['list', 'get', 'create', 'update', 'delete'], }, ]); - return handleTableSubcommand(answer.subcommand, newArgv, prompter); + return handleTableSubcommand(answer.subcommand as string, newArgv, prompter); } return handleTableSubcommand(subcommand, newArgv, prompter); }; @@ -100,7 +101,7 @@ async function handleGet(argv: Partial>, prompter: Inqui const client = getClient(); const result = await client.cryptoAddress .findOne({ - id: answers.id, + id: answers.id as string, select: { id: true, ownerId: true, @@ -150,7 +151,10 @@ async function handleCreate(argv: Partial>, prompter: In }, ]); const answers = coerceAnswers(rawAnswers, fieldSchema); - const cleanedData = stripUndefined(answers, fieldSchema); + const cleanedData = stripUndefined( + answers, + fieldSchema + ) as CreateCryptoAddressInput['cryptoAddress']; const client = getClient(); const result = await client.cryptoAddress .create({ @@ -215,7 +219,7 @@ async function handleUpdate(argv: Partial>, prompter: In }, ]); const answers = coerceAnswers(rawAnswers, fieldSchema); - const cleanedData = stripUndefined(answers, fieldSchema); + const cleanedData = stripUndefined(answers, fieldSchema) as CryptoAddressPatch; const client = getClient(); const result = await client.cryptoAddress .update({ diff --git a/sdk/constructive-cli/src/public/cli/commands/crypto-addresses-module.ts b/sdk/constructive-cli/src/public/cli/commands/crypto-addresses-module.ts index 653d7e8e5..206d43a79 100644 --- a/sdk/constructive-cli/src/public/cli/commands/crypto-addresses-module.ts +++ b/sdk/constructive-cli/src/public/cli/commands/crypto-addresses-module.ts @@ -1,4 +1,3 @@ -// @ts-nocheck /** * CLI commands for CryptoAddressesModule * @generated by @constructive-io/graphql-codegen @@ -7,7 +6,12 @@ import { CLIOptions, Inquirerer, extractFirst } from 'inquirerer'; import { getClient } from '../executor'; import { coerceAnswers, stripUndefined } from '../utils'; -const fieldSchema = { +import type { FieldSchema } from '../utils'; +import type { + CreateCryptoAddressesModuleInput, + CryptoAddressesModulePatch, +} from '../../orm/input-types'; +const fieldSchema: FieldSchema = { id: 'uuid', databaseId: 'uuid', schemaId: 'uuid', @@ -38,7 +42,7 @@ export default async ( options: ['list', 'get', 'create', 'update', 'delete'], }, ]); - return handleTableSubcommand(answer.subcommand, newArgv, prompter); + return handleTableSubcommand(answer.subcommand as string, newArgv, prompter); } return handleTableSubcommand(subcommand, newArgv, prompter); }; @@ -102,7 +106,7 @@ async function handleGet(argv: Partial>, prompter: Inqui const client = getClient(); const result = await client.cryptoAddressesModule .findOne({ - id: answers.id, + id: answers.id as string, select: { id: true, databaseId: true, @@ -171,7 +175,10 @@ async function handleCreate(argv: Partial>, prompter: In }, ]); const answers = coerceAnswers(rawAnswers, fieldSchema); - const cleanedData = stripUndefined(answers, fieldSchema); + const cleanedData = stripUndefined( + answers, + fieldSchema + ) as CreateCryptoAddressesModuleInput['cryptoAddressesModule']; const client = getClient(); const result = await client.cryptoAddressesModule .create({ @@ -258,7 +265,7 @@ async function handleUpdate(argv: Partial>, prompter: In }, ]); const answers = coerceAnswers(rawAnswers, fieldSchema); - const cleanedData = stripUndefined(answers, fieldSchema); + const cleanedData = stripUndefined(answers, fieldSchema) as CryptoAddressesModulePatch; const client = getClient(); const result = await client.cryptoAddressesModule .update({ diff --git a/sdk/constructive-cli/src/public/cli/commands/crypto-auth-module.ts b/sdk/constructive-cli/src/public/cli/commands/crypto-auth-module.ts index 4c2847e28..d49223a71 100644 --- a/sdk/constructive-cli/src/public/cli/commands/crypto-auth-module.ts +++ b/sdk/constructive-cli/src/public/cli/commands/crypto-auth-module.ts @@ -1,4 +1,3 @@ -// @ts-nocheck /** * CLI commands for CryptoAuthModule * @generated by @constructive-io/graphql-codegen @@ -7,7 +6,9 @@ import { CLIOptions, Inquirerer, extractFirst } from 'inquirerer'; import { getClient } from '../executor'; import { coerceAnswers, stripUndefined } from '../utils'; -const fieldSchema = { +import type { FieldSchema } from '../utils'; +import type { CreateCryptoAuthModuleInput, CryptoAuthModulePatch } from '../../orm/input-types'; +const fieldSchema: FieldSchema = { id: 'uuid', databaseId: 'uuid', schemaId: 'uuid', @@ -44,7 +45,7 @@ export default async ( options: ['list', 'get', 'create', 'update', 'delete'], }, ]); - return handleTableSubcommand(answer.subcommand, newArgv, prompter); + return handleTableSubcommand(answer.subcommand as string, newArgv, prompter); } return handleTableSubcommand(subcommand, newArgv, prompter); }; @@ -114,7 +115,7 @@ async function handleGet(argv: Partial>, prompter: Inqui const client = getClient(); const result = await client.cryptoAuthModule .findOne({ - id: answers.id, + id: answers.id as string, select: { id: true, databaseId: true, @@ -225,7 +226,10 @@ async function handleCreate(argv: Partial>, prompter: In }, ]); const answers = coerceAnswers(rawAnswers, fieldSchema); - const cleanedData = stripUndefined(answers, fieldSchema); + const cleanedData = stripUndefined( + answers, + fieldSchema + ) as CreateCryptoAuthModuleInput['cryptoAuthModule']; const client = getClient(); const result = await client.cryptoAuthModule .create({ @@ -360,7 +364,7 @@ async function handleUpdate(argv: Partial>, prompter: In }, ]); const answers = coerceAnswers(rawAnswers, fieldSchema); - const cleanedData = stripUndefined(answers, fieldSchema); + const cleanedData = stripUndefined(answers, fieldSchema) as CryptoAuthModulePatch; const client = getClient(); const result = await client.cryptoAuthModule .update({ diff --git a/sdk/constructive-cli/src/public/cli/commands/current-ip-address.ts b/sdk/constructive-cli/src/public/cli/commands/current-ip-address.ts index 1cc9889d5..e2dd3037d 100644 --- a/sdk/constructive-cli/src/public/cli/commands/current-ip-address.ts +++ b/sdk/constructive-cli/src/public/cli/commands/current-ip-address.ts @@ -1,4 +1,3 @@ -// @ts-nocheck /** * CLI command for query currentIpAddress * @generated by @constructive-io/graphql-codegen diff --git a/sdk/constructive-cli/src/public/cli/commands/current-user-agent.ts b/sdk/constructive-cli/src/public/cli/commands/current-user-agent.ts index bfda7984a..9191321fb 100644 --- a/sdk/constructive-cli/src/public/cli/commands/current-user-agent.ts +++ b/sdk/constructive-cli/src/public/cli/commands/current-user-agent.ts @@ -1,4 +1,3 @@ -// @ts-nocheck /** * CLI command for query currentUserAgent * @generated by @constructive-io/graphql-codegen diff --git a/sdk/constructive-cli/src/public/cli/commands/current-user-id.ts b/sdk/constructive-cli/src/public/cli/commands/current-user-id.ts index d719c2bca..0ade5d19e 100644 --- a/sdk/constructive-cli/src/public/cli/commands/current-user-id.ts +++ b/sdk/constructive-cli/src/public/cli/commands/current-user-id.ts @@ -1,4 +1,3 @@ -// @ts-nocheck /** * CLI command for query currentUserId * @generated by @constructive-io/graphql-codegen diff --git a/sdk/constructive-cli/src/public/cli/commands/current-user.ts b/sdk/constructive-cli/src/public/cli/commands/current-user.ts index 55f33a839..14c69246b 100644 --- a/sdk/constructive-cli/src/public/cli/commands/current-user.ts +++ b/sdk/constructive-cli/src/public/cli/commands/current-user.ts @@ -1,4 +1,3 @@ -// @ts-nocheck /** * CLI command for query currentUser * @generated by @constructive-io/graphql-codegen @@ -7,6 +6,7 @@ import { CLIOptions, Inquirerer } from 'inquirerer'; import { getClient } from '../executor'; import { buildSelectFromPaths } from '../utils'; +import type { UserSelect } from '../../orm/input-types'; export default async ( argv: Partial>, prompter: Inquirerer, @@ -18,10 +18,12 @@ export default async ( process.exit(0); } const client = getClient(); - const selectFields = buildSelectFromPaths(argv.select ?? ''); + const selectFields = buildSelectFromPaths((argv.select as string) ?? ''); const result = await client.query .currentUser({ select: selectFields, + } as unknown as { + select: UserSelect; }) .execute(); console.log(JSON.stringify(result, null, 2)); diff --git a/sdk/constructive-cli/src/public/cli/commands/database-provision-module.ts b/sdk/constructive-cli/src/public/cli/commands/database-provision-module.ts index 4b264e918..a51978ba1 100644 --- a/sdk/constructive-cli/src/public/cli/commands/database-provision-module.ts +++ b/sdk/constructive-cli/src/public/cli/commands/database-provision-module.ts @@ -1,4 +1,3 @@ -// @ts-nocheck /** * CLI commands for DatabaseProvisionModule * @generated by @constructive-io/graphql-codegen @@ -7,7 +6,12 @@ import { CLIOptions, Inquirerer, extractFirst } from 'inquirerer'; import { getClient } from '../executor'; import { coerceAnswers, stripUndefined } from '../utils'; -const fieldSchema = { +import type { FieldSchema } from '../utils'; +import type { + CreateDatabaseProvisionModuleInput, + DatabaseProvisionModulePatch, +} from '../../orm/input-types'; +const fieldSchema: FieldSchema = { id: 'uuid', databaseName: 'string', ownerId: 'uuid', @@ -44,7 +48,7 @@ export default async ( options: ['list', 'get', 'create', 'update', 'delete'], }, ]); - return handleTableSubcommand(answer.subcommand, newArgv, prompter); + return handleTableSubcommand(answer.subcommand as string, newArgv, prompter); } return handleTableSubcommand(subcommand, newArgv, prompter); }; @@ -114,7 +118,7 @@ async function handleGet(argv: Partial>, prompter: Inqui const client = getClient(); const result = await client.databaseProvisionModule .findOne({ - id: answers.id, + id: answers.id as string, select: { id: true, databaseName: true, @@ -213,7 +217,10 @@ async function handleCreate(argv: Partial>, prompter: In }, ]); const answers = coerceAnswers(rawAnswers, fieldSchema); - const cleanedData = stripUndefined(answers, fieldSchema); + const cleanedData = stripUndefined( + answers, + fieldSchema + ) as CreateDatabaseProvisionModuleInput['databaseProvisionModule']; const client = getClient(); const result = await client.databaseProvisionModule .create({ @@ -334,7 +341,7 @@ async function handleUpdate(argv: Partial>, prompter: In }, ]); const answers = coerceAnswers(rawAnswers, fieldSchema); - const cleanedData = stripUndefined(answers, fieldSchema); + const cleanedData = stripUndefined(answers, fieldSchema) as DatabaseProvisionModulePatch; const client = getClient(); const result = await client.databaseProvisionModule .update({ diff --git a/sdk/constructive-cli/src/public/cli/commands/database.ts b/sdk/constructive-cli/src/public/cli/commands/database.ts index e4d2b552a..5f4563129 100644 --- a/sdk/constructive-cli/src/public/cli/commands/database.ts +++ b/sdk/constructive-cli/src/public/cli/commands/database.ts @@ -1,4 +1,3 @@ -// @ts-nocheck /** * CLI commands for Database * @generated by @constructive-io/graphql-codegen @@ -7,7 +6,9 @@ import { CLIOptions, Inquirerer, extractFirst } from 'inquirerer'; import { getClient } from '../executor'; import { coerceAnswers, stripUndefined } from '../utils'; -const fieldSchema = { +import type { FieldSchema } from '../utils'; +import type { CreateDatabaseInput, DatabasePatch } from '../../orm/input-types'; +const fieldSchema: FieldSchema = { id: 'uuid', ownerId: 'uuid', schemaHash: 'string', @@ -38,7 +39,7 @@ export default async ( options: ['list', 'get', 'create', 'update', 'delete'], }, ]); - return handleTableSubcommand(answer.subcommand, newArgv, prompter); + return handleTableSubcommand(answer.subcommand as string, newArgv, prompter); } return handleTableSubcommand(subcommand, newArgv, prompter); }; @@ -102,7 +103,7 @@ async function handleGet(argv: Partial>, prompter: Inqui const client = getClient(); const result = await client.database .findOne({ - id: answers.id, + id: answers.id as string, select: { id: true, ownerId: true, @@ -159,7 +160,7 @@ async function handleCreate(argv: Partial>, prompter: In }, ]); const answers = coerceAnswers(rawAnswers, fieldSchema); - const cleanedData = stripUndefined(answers, fieldSchema); + const cleanedData = stripUndefined(answers, fieldSchema) as CreateDatabaseInput['database']; const client = getClient(); const result = await client.database .create({ @@ -232,7 +233,7 @@ async function handleUpdate(argv: Partial>, prompter: In }, ]); const answers = coerceAnswers(rawAnswers, fieldSchema); - const cleanedData = stripUndefined(answers, fieldSchema); + const cleanedData = stripUndefined(answers, fieldSchema) as DatabasePatch; const client = getClient(); const result = await client.database .update({ diff --git a/sdk/constructive-cli/src/public/cli/commands/default-ids-module.ts b/sdk/constructive-cli/src/public/cli/commands/default-ids-module.ts index 30c4826c6..575f4f41f 100644 --- a/sdk/constructive-cli/src/public/cli/commands/default-ids-module.ts +++ b/sdk/constructive-cli/src/public/cli/commands/default-ids-module.ts @@ -1,4 +1,3 @@ -// @ts-nocheck /** * CLI commands for DefaultIdsModule * @generated by @constructive-io/graphql-codegen @@ -7,7 +6,9 @@ import { CLIOptions, Inquirerer, extractFirst } from 'inquirerer'; import { getClient } from '../executor'; import { coerceAnswers, stripUndefined } from '../utils'; -const fieldSchema = { +import type { FieldSchema } from '../utils'; +import type { CreateDefaultIdsModuleInput, DefaultIdsModulePatch } from '../../orm/input-types'; +const fieldSchema: FieldSchema = { id: 'uuid', databaseId: 'uuid', }; @@ -32,7 +33,7 @@ export default async ( options: ['list', 'get', 'create', 'update', 'delete'], }, ]); - return handleTableSubcommand(answer.subcommand, newArgv, prompter); + return handleTableSubcommand(answer.subcommand as string, newArgv, prompter); } return handleTableSubcommand(subcommand, newArgv, prompter); }; @@ -90,7 +91,7 @@ async function handleGet(argv: Partial>, prompter: Inqui const client = getClient(); const result = await client.defaultIdsModule .findOne({ - id: answers.id, + id: answers.id as string, select: { id: true, databaseId: true, @@ -117,7 +118,10 @@ async function handleCreate(argv: Partial>, prompter: In }, ]); const answers = coerceAnswers(rawAnswers, fieldSchema); - const cleanedData = stripUndefined(answers, fieldSchema); + const cleanedData = stripUndefined( + answers, + fieldSchema + ) as CreateDefaultIdsModuleInput['defaultIdsModule']; const client = getClient(); const result = await client.defaultIdsModule .create({ @@ -156,7 +160,7 @@ async function handleUpdate(argv: Partial>, prompter: In }, ]); const answers = coerceAnswers(rawAnswers, fieldSchema); - const cleanedData = stripUndefined(answers, fieldSchema); + const cleanedData = stripUndefined(answers, fieldSchema) as DefaultIdsModulePatch; const client = getClient(); const result = await client.defaultIdsModule .update({ diff --git a/sdk/constructive-cli/src/public/cli/commands/default-privilege.ts b/sdk/constructive-cli/src/public/cli/commands/default-privilege.ts index 97df16506..8a6aba815 100644 --- a/sdk/constructive-cli/src/public/cli/commands/default-privilege.ts +++ b/sdk/constructive-cli/src/public/cli/commands/default-privilege.ts @@ -1,4 +1,3 @@ -// @ts-nocheck /** * CLI commands for DefaultPrivilege * @generated by @constructive-io/graphql-codegen @@ -7,7 +6,9 @@ import { CLIOptions, Inquirerer, extractFirst } from 'inquirerer'; import { getClient } from '../executor'; import { coerceAnswers, stripUndefined } from '../utils'; -const fieldSchema = { +import type { FieldSchema } from '../utils'; +import type { CreateDefaultPrivilegeInput, DefaultPrivilegePatch } from '../../orm/input-types'; +const fieldSchema: FieldSchema = { id: 'uuid', databaseId: 'uuid', schemaId: 'uuid', @@ -37,7 +38,7 @@ export default async ( options: ['list', 'get', 'create', 'update', 'delete'], }, ]); - return handleTableSubcommand(answer.subcommand, newArgv, prompter); + return handleTableSubcommand(answer.subcommand as string, newArgv, prompter); } return handleTableSubcommand(subcommand, newArgv, prompter); }; @@ -100,7 +101,7 @@ async function handleGet(argv: Partial>, prompter: Inqui const client = getClient(); const result = await client.defaultPrivilege .findOne({ - id: answers.id, + id: answers.id as string, select: { id: true, databaseId: true, @@ -162,7 +163,10 @@ async function handleCreate(argv: Partial>, prompter: In }, ]); const answers = coerceAnswers(rawAnswers, fieldSchema); - const cleanedData = stripUndefined(answers, fieldSchema); + const cleanedData = stripUndefined( + answers, + fieldSchema + ) as CreateDefaultPrivilegeInput['defaultPrivilege']; const client = getClient(); const result = await client.defaultPrivilege .create({ @@ -241,7 +245,7 @@ async function handleUpdate(argv: Partial>, prompter: In }, ]); const answers = coerceAnswers(rawAnswers, fieldSchema); - const cleanedData = stripUndefined(answers, fieldSchema); + const cleanedData = stripUndefined(answers, fieldSchema) as DefaultPrivilegePatch; const client = getClient(); const result = await client.defaultPrivilege .update({ diff --git a/sdk/constructive-cli/src/public/cli/commands/denormalized-table-field.ts b/sdk/constructive-cli/src/public/cli/commands/denormalized-table-field.ts index 8833c491a..1725acfd8 100644 --- a/sdk/constructive-cli/src/public/cli/commands/denormalized-table-field.ts +++ b/sdk/constructive-cli/src/public/cli/commands/denormalized-table-field.ts @@ -1,4 +1,3 @@ -// @ts-nocheck /** * CLI commands for DenormalizedTableField * @generated by @constructive-io/graphql-codegen @@ -7,7 +6,12 @@ import { CLIOptions, Inquirerer, extractFirst } from 'inquirerer'; import { getClient } from '../executor'; import { coerceAnswers, stripUndefined } from '../utils'; -const fieldSchema = { +import type { FieldSchema } from '../utils'; +import type { + CreateDenormalizedTableFieldInput, + DenormalizedTableFieldPatch, +} from '../../orm/input-types'; +const fieldSchema: FieldSchema = { id: 'uuid', databaseId: 'uuid', tableId: 'uuid', @@ -42,7 +46,7 @@ export default async ( options: ['list', 'get', 'create', 'update', 'delete'], }, ]); - return handleTableSubcommand(answer.subcommand, newArgv, prompter); + return handleTableSubcommand(answer.subcommand as string, newArgv, prompter); } return handleTableSubcommand(subcommand, newArgv, prompter); }; @@ -110,7 +114,7 @@ async function handleGet(argv: Partial>, prompter: Inqui const client = getClient(); const result = await client.denormalizedTableField .findOne({ - id: answers.id, + id: answers.id as string, select: { id: true, databaseId: true, @@ -207,7 +211,10 @@ async function handleCreate(argv: Partial>, prompter: In }, ]); const answers = coerceAnswers(rawAnswers, fieldSchema); - const cleanedData = stripUndefined(answers, fieldSchema); + const cleanedData = stripUndefined( + answers, + fieldSchema + ) as CreateDenormalizedTableFieldInput['denormalizedTableField']; const client = getClient(); const result = await client.denormalizedTableField .create({ @@ -326,7 +333,7 @@ async function handleUpdate(argv: Partial>, prompter: In }, ]); const answers = coerceAnswers(rawAnswers, fieldSchema); - const cleanedData = stripUndefined(answers, fieldSchema); + const cleanedData = stripUndefined(answers, fieldSchema) as DenormalizedTableFieldPatch; const client = getClient(); const result = await client.denormalizedTableField .update({ diff --git a/sdk/constructive-cli/src/public/cli/commands/domain.ts b/sdk/constructive-cli/src/public/cli/commands/domain.ts index 7817db851..93d0e435c 100644 --- a/sdk/constructive-cli/src/public/cli/commands/domain.ts +++ b/sdk/constructive-cli/src/public/cli/commands/domain.ts @@ -1,4 +1,3 @@ -// @ts-nocheck /** * CLI commands for Domain * @generated by @constructive-io/graphql-codegen @@ -7,7 +6,9 @@ import { CLIOptions, Inquirerer, extractFirst } from 'inquirerer'; import { getClient } from '../executor'; import { coerceAnswers, stripUndefined } from '../utils'; -const fieldSchema = { +import type { FieldSchema } from '../utils'; +import type { CreateDomainInput, DomainPatch } from '../../orm/input-types'; +const fieldSchema: FieldSchema = { id: 'uuid', databaseId: 'uuid', apiId: 'uuid', @@ -36,7 +37,7 @@ export default async ( options: ['list', 'get', 'create', 'update', 'delete'], }, ]); - return handleTableSubcommand(answer.subcommand, newArgv, prompter); + return handleTableSubcommand(answer.subcommand as string, newArgv, prompter); } return handleTableSubcommand(subcommand, newArgv, prompter); }; @@ -98,7 +99,7 @@ async function handleGet(argv: Partial>, prompter: Inqui const client = getClient(); const result = await client.domain .findOne({ - id: answers.id, + id: answers.id as string, select: { id: true, databaseId: true, @@ -153,7 +154,7 @@ async function handleCreate(argv: Partial>, prompter: In }, ]); const answers = coerceAnswers(rawAnswers, fieldSchema); - const cleanedData = stripUndefined(answers, fieldSchema); + const cleanedData = stripUndefined(answers, fieldSchema) as CreateDomainInput['domain']; const client = getClient(); const result = await client.domain .create({ @@ -224,7 +225,7 @@ async function handleUpdate(argv: Partial>, prompter: In }, ]); const answers = coerceAnswers(rawAnswers, fieldSchema); - const cleanedData = stripUndefined(answers, fieldSchema); + const cleanedData = stripUndefined(answers, fieldSchema) as DomainPatch; const client = getClient(); const result = await client.domain .update({ diff --git a/sdk/constructive-cli/src/public/cli/commands/email.ts b/sdk/constructive-cli/src/public/cli/commands/email.ts index 68a64aa94..4c9aa304a 100644 --- a/sdk/constructive-cli/src/public/cli/commands/email.ts +++ b/sdk/constructive-cli/src/public/cli/commands/email.ts @@ -1,4 +1,3 @@ -// @ts-nocheck /** * CLI commands for Email * @generated by @constructive-io/graphql-codegen @@ -7,7 +6,9 @@ import { CLIOptions, Inquirerer, extractFirst } from 'inquirerer'; import { getClient } from '../executor'; import { coerceAnswers, stripUndefined } from '../utils'; -const fieldSchema = { +import type { FieldSchema } from '../utils'; +import type { CreateEmailInput, EmailPatch } from '../../orm/input-types'; +const fieldSchema: FieldSchema = { id: 'uuid', ownerId: 'uuid', email: 'string', @@ -37,7 +38,7 @@ export default async ( options: ['list', 'get', 'create', 'update', 'delete'], }, ]); - return handleTableSubcommand(answer.subcommand, newArgv, prompter); + return handleTableSubcommand(answer.subcommand as string, newArgv, prompter); } return handleTableSubcommand(subcommand, newArgv, prompter); }; @@ -100,7 +101,7 @@ async function handleGet(argv: Partial>, prompter: Inqui const client = getClient(); const result = await client.email .findOne({ - id: answers.id, + id: answers.id as string, select: { id: true, ownerId: true, @@ -150,7 +151,7 @@ async function handleCreate(argv: Partial>, prompter: In }, ]); const answers = coerceAnswers(rawAnswers, fieldSchema); - const cleanedData = stripUndefined(answers, fieldSchema); + const cleanedData = stripUndefined(answers, fieldSchema) as CreateEmailInput['email']; const client = getClient(); const result = await client.email .create({ @@ -215,7 +216,7 @@ async function handleUpdate(argv: Partial>, prompter: In }, ]); const answers = coerceAnswers(rawAnswers, fieldSchema); - const cleanedData = stripUndefined(answers, fieldSchema); + const cleanedData = stripUndefined(answers, fieldSchema) as EmailPatch; const client = getClient(); const result = await client.email .update({ diff --git a/sdk/constructive-cli/src/public/cli/commands/emails-module.ts b/sdk/constructive-cli/src/public/cli/commands/emails-module.ts index 63453f4d2..32e88b5e4 100644 --- a/sdk/constructive-cli/src/public/cli/commands/emails-module.ts +++ b/sdk/constructive-cli/src/public/cli/commands/emails-module.ts @@ -1,4 +1,3 @@ -// @ts-nocheck /** * CLI commands for EmailsModule * @generated by @constructive-io/graphql-codegen @@ -7,7 +6,9 @@ import { CLIOptions, Inquirerer, extractFirst } from 'inquirerer'; import { getClient } from '../executor'; import { coerceAnswers, stripUndefined } from '../utils'; -const fieldSchema = { +import type { FieldSchema } from '../utils'; +import type { CreateEmailsModuleInput, EmailsModulePatch } from '../../orm/input-types'; +const fieldSchema: FieldSchema = { id: 'uuid', databaseId: 'uuid', schemaId: 'uuid', @@ -37,7 +38,7 @@ export default async ( options: ['list', 'get', 'create', 'update', 'delete'], }, ]); - return handleTableSubcommand(answer.subcommand, newArgv, prompter); + return handleTableSubcommand(answer.subcommand as string, newArgv, prompter); } return handleTableSubcommand(subcommand, newArgv, prompter); }; @@ -100,7 +101,7 @@ async function handleGet(argv: Partial>, prompter: Inqui const client = getClient(); const result = await client.emailsModule .findOne({ - id: answers.id, + id: answers.id as string, select: { id: true, databaseId: true, @@ -162,7 +163,10 @@ async function handleCreate(argv: Partial>, prompter: In }, ]); const answers = coerceAnswers(rawAnswers, fieldSchema); - const cleanedData = stripUndefined(answers, fieldSchema); + const cleanedData = stripUndefined( + answers, + fieldSchema + ) as CreateEmailsModuleInput['emailsModule']; const client = getClient(); const result = await client.emailsModule .create({ @@ -241,7 +245,7 @@ async function handleUpdate(argv: Partial>, prompter: In }, ]); const answers = coerceAnswers(rawAnswers, fieldSchema); - const cleanedData = stripUndefined(answers, fieldSchema); + const cleanedData = stripUndefined(answers, fieldSchema) as EmailsModulePatch; const client = getClient(); const result = await client.emailsModule .update({ diff --git a/sdk/constructive-cli/src/public/cli/commands/encrypted-secrets-module.ts b/sdk/constructive-cli/src/public/cli/commands/encrypted-secrets-module.ts index 2ba6d34ed..950a0d3d8 100644 --- a/sdk/constructive-cli/src/public/cli/commands/encrypted-secrets-module.ts +++ b/sdk/constructive-cli/src/public/cli/commands/encrypted-secrets-module.ts @@ -1,4 +1,3 @@ -// @ts-nocheck /** * CLI commands for EncryptedSecretsModule * @generated by @constructive-io/graphql-codegen @@ -7,7 +6,12 @@ import { CLIOptions, Inquirerer, extractFirst } from 'inquirerer'; import { getClient } from '../executor'; import { coerceAnswers, stripUndefined } from '../utils'; -const fieldSchema = { +import type { FieldSchema } from '../utils'; +import type { + CreateEncryptedSecretsModuleInput, + EncryptedSecretsModulePatch, +} from '../../orm/input-types'; +const fieldSchema: FieldSchema = { id: 'uuid', databaseId: 'uuid', schemaId: 'uuid', @@ -35,7 +39,7 @@ export default async ( options: ['list', 'get', 'create', 'update', 'delete'], }, ]); - return handleTableSubcommand(answer.subcommand, newArgv, prompter); + return handleTableSubcommand(answer.subcommand as string, newArgv, prompter); } return handleTableSubcommand(subcommand, newArgv, prompter); }; @@ -96,7 +100,7 @@ async function handleGet(argv: Partial>, prompter: Inqui const client = getClient(); const result = await client.encryptedSecretsModule .findOne({ - id: answers.id, + id: answers.id as string, select: { id: true, databaseId: true, @@ -144,7 +148,10 @@ async function handleCreate(argv: Partial>, prompter: In }, ]); const answers = coerceAnswers(rawAnswers, fieldSchema); - const cleanedData = stripUndefined(answers, fieldSchema); + const cleanedData = stripUndefined( + answers, + fieldSchema + ) as CreateEncryptedSecretsModuleInput['encryptedSecretsModule']; const client = getClient(); const result = await client.encryptedSecretsModule .create({ @@ -207,7 +214,7 @@ async function handleUpdate(argv: Partial>, prompter: In }, ]); const answers = coerceAnswers(rawAnswers, fieldSchema); - const cleanedData = stripUndefined(answers, fieldSchema); + const cleanedData = stripUndefined(answers, fieldSchema) as EncryptedSecretsModulePatch; const client = getClient(); const result = await client.encryptedSecretsModule .update({ diff --git a/sdk/constructive-cli/src/public/cli/commands/extend-token-expires.ts b/sdk/constructive-cli/src/public/cli/commands/extend-token-expires.ts index 011b80d61..74638bd9d 100644 --- a/sdk/constructive-cli/src/public/cli/commands/extend-token-expires.ts +++ b/sdk/constructive-cli/src/public/cli/commands/extend-token-expires.ts @@ -1,4 +1,3 @@ -// @ts-nocheck /** * CLI command for mutation extendTokenExpires * @generated by @constructive-io/graphql-codegen @@ -7,6 +6,8 @@ import { CLIOptions, Inquirerer } from 'inquirerer'; import { getClient } from '../executor'; import { parseMutationInput, buildSelectFromPaths } from '../utils'; +import type { ExtendTokenExpiresVariables } from '../../orm/mutation'; +import type { ExtendTokenExpiresPayloadSelect } from '../../orm/input-types'; export default async ( argv: Partial>, prompter: Inquirerer, @@ -30,11 +31,16 @@ export default async ( ]); const client = getClient(); const parsedAnswers = parseMutationInput(answers); - const selectFields = buildSelectFromPaths(argv.select ?? 'clientMutationId'); + const selectFields = buildSelectFromPaths((argv.select as string) ?? 'clientMutationId'); const result = await client.mutation - .extendTokenExpires(parsedAnswers, { - select: selectFields, - }) + .extendTokenExpires( + parsedAnswers as unknown as ExtendTokenExpiresVariables, + { + select: selectFields, + } as unknown as { + select: ExtendTokenExpiresPayloadSelect; + } + ) .execute(); console.log(JSON.stringify(result, null, 2)); } catch (error) { diff --git a/sdk/constructive-cli/src/public/cli/commands/field-module.ts b/sdk/constructive-cli/src/public/cli/commands/field-module.ts index e6e8ce145..e049ef2a8 100644 --- a/sdk/constructive-cli/src/public/cli/commands/field-module.ts +++ b/sdk/constructive-cli/src/public/cli/commands/field-module.ts @@ -1,4 +1,3 @@ -// @ts-nocheck /** * CLI commands for FieldModule * @generated by @constructive-io/graphql-codegen @@ -7,7 +6,9 @@ import { CLIOptions, Inquirerer, extractFirst } from 'inquirerer'; import { getClient } from '../executor'; import { coerceAnswers, stripUndefined } from '../utils'; -const fieldSchema = { +import type { FieldSchema } from '../utils'; +import type { CreateFieldModuleInput, FieldModulePatch } from '../../orm/input-types'; +const fieldSchema: FieldSchema = { id: 'uuid', databaseId: 'uuid', privateSchemaId: 'uuid', @@ -39,7 +40,7 @@ export default async ( options: ['list', 'get', 'create', 'update', 'delete'], }, ]); - return handleTableSubcommand(answer.subcommand, newArgv, prompter); + return handleTableSubcommand(answer.subcommand as string, newArgv, prompter); } return handleTableSubcommand(subcommand, newArgv, prompter); }; @@ -104,7 +105,7 @@ async function handleGet(argv: Partial>, prompter: Inqui const client = getClient(); const result = await client.fieldModule .findOne({ - id: answers.id, + id: answers.id as string, select: { id: true, databaseId: true, @@ -180,7 +181,10 @@ async function handleCreate(argv: Partial>, prompter: In }, ]); const answers = coerceAnswers(rawAnswers, fieldSchema); - const cleanedData = stripUndefined(answers, fieldSchema); + const cleanedData = stripUndefined( + answers, + fieldSchema + ) as CreateFieldModuleInput['fieldModule']; const client = getClient(); const result = await client.fieldModule .create({ @@ -275,7 +279,7 @@ async function handleUpdate(argv: Partial>, prompter: In }, ]); const answers = coerceAnswers(rawAnswers, fieldSchema); - const cleanedData = stripUndefined(answers, fieldSchema); + const cleanedData = stripUndefined(answers, fieldSchema) as FieldModulePatch; const client = getClient(); const result = await client.fieldModule .update({ diff --git a/sdk/constructive-cli/src/public/cli/commands/field.ts b/sdk/constructive-cli/src/public/cli/commands/field.ts index 2766a80fc..f1a67ea28 100644 --- a/sdk/constructive-cli/src/public/cli/commands/field.ts +++ b/sdk/constructive-cli/src/public/cli/commands/field.ts @@ -1,4 +1,3 @@ -// @ts-nocheck /** * CLI commands for Field * @generated by @constructive-io/graphql-codegen @@ -7,7 +6,9 @@ import { CLIOptions, Inquirerer, extractFirst } from 'inquirerer'; import { getClient } from '../executor'; import { coerceAnswers, stripUndefined } from '../utils'; -const fieldSchema = { +import type { FieldSchema } from '../utils'; +import type { CreateFieldInput, FieldPatch } from '../../orm/input-types'; +const fieldSchema: FieldSchema = { id: 'uuid', databaseId: 'uuid', tableId: 'uuid', @@ -54,7 +55,7 @@ export default async ( options: ['list', 'get', 'create', 'update', 'delete'], }, ]); - return handleTableSubcommand(answer.subcommand, newArgv, prompter); + return handleTableSubcommand(answer.subcommand as string, newArgv, prompter); } return handleTableSubcommand(subcommand, newArgv, prompter); }; @@ -134,7 +135,7 @@ async function handleGet(argv: Partial>, prompter: Inqui const client = getClient(); const result = await client.field .findOne({ - id: answers.id, + id: answers.id as string, select: { id: true, databaseId: true, @@ -303,7 +304,7 @@ async function handleCreate(argv: Partial>, prompter: In }, ]); const answers = coerceAnswers(rawAnswers, fieldSchema); - const cleanedData = stripUndefined(answers, fieldSchema); + const cleanedData = stripUndefined(answers, fieldSchema) as CreateFieldInput['field']; const client = getClient(); const result = await client.field .create({ @@ -504,7 +505,7 @@ async function handleUpdate(argv: Partial>, prompter: In }, ]); const answers = coerceAnswers(rawAnswers, fieldSchema); - const cleanedData = stripUndefined(answers, fieldSchema); + const cleanedData = stripUndefined(answers, fieldSchema) as FieldPatch; const client = getClient(); const result = await client.field .update({ diff --git a/sdk/constructive-cli/src/public/cli/commands/foreign-key-constraint.ts b/sdk/constructive-cli/src/public/cli/commands/foreign-key-constraint.ts index 4d10914db..db4546571 100644 --- a/sdk/constructive-cli/src/public/cli/commands/foreign-key-constraint.ts +++ b/sdk/constructive-cli/src/public/cli/commands/foreign-key-constraint.ts @@ -1,4 +1,3 @@ -// @ts-nocheck /** * CLI commands for ForeignKeyConstraint * @generated by @constructive-io/graphql-codegen @@ -7,7 +6,12 @@ import { CLIOptions, Inquirerer, extractFirst } from 'inquirerer'; import { getClient } from '../executor'; import { coerceAnswers, stripUndefined } from '../utils'; -const fieldSchema = { +import type { FieldSchema } from '../utils'; +import type { + CreateForeignKeyConstraintInput, + ForeignKeyConstraintPatch, +} from '../../orm/input-types'; +const fieldSchema: FieldSchema = { id: 'uuid', databaseId: 'uuid', tableId: 'uuid', @@ -48,7 +52,7 @@ export default async ( options: ['list', 'get', 'create', 'update', 'delete'], }, ]); - return handleTableSubcommand(answer.subcommand, newArgv, prompter); + return handleTableSubcommand(answer.subcommand as string, newArgv, prompter); } return handleTableSubcommand(subcommand, newArgv, prompter); }; @@ -122,7 +126,7 @@ async function handleGet(argv: Partial>, prompter: Inqui const client = getClient(); const result = await client.foreignKeyConstraint .findOne({ - id: answers.id, + id: answers.id as string, select: { id: true, databaseId: true, @@ -249,7 +253,10 @@ async function handleCreate(argv: Partial>, prompter: In }, ]); const answers = coerceAnswers(rawAnswers, fieldSchema); - const cleanedData = stripUndefined(answers, fieldSchema); + const cleanedData = stripUndefined( + answers, + fieldSchema + ) as CreateForeignKeyConstraintInput['foreignKeyConstraint']; const client = getClient(); const result = await client.foreignKeyConstraint .create({ @@ -402,7 +409,7 @@ async function handleUpdate(argv: Partial>, prompter: In }, ]); const answers = coerceAnswers(rawAnswers, fieldSchema); - const cleanedData = stripUndefined(answers, fieldSchema); + const cleanedData = stripUndefined(answers, fieldSchema) as ForeignKeyConstraintPatch; const client = getClient(); const result = await client.foreignKeyConstraint .update({ diff --git a/sdk/constructive-cli/src/public/cli/commands/forgot-password.ts b/sdk/constructive-cli/src/public/cli/commands/forgot-password.ts index f912ca75b..65ed743a9 100644 --- a/sdk/constructive-cli/src/public/cli/commands/forgot-password.ts +++ b/sdk/constructive-cli/src/public/cli/commands/forgot-password.ts @@ -1,4 +1,3 @@ -// @ts-nocheck /** * CLI command for mutation forgotPassword * @generated by @constructive-io/graphql-codegen @@ -7,6 +6,8 @@ import { CLIOptions, Inquirerer } from 'inquirerer'; import { getClient } from '../executor'; import { parseMutationInput, buildSelectFromPaths } from '../utils'; +import type { ForgotPasswordVariables } from '../../orm/mutation'; +import type { ForgotPasswordPayloadSelect } from '../../orm/input-types'; export default async ( argv: Partial>, prompter: Inquirerer, @@ -28,11 +29,16 @@ export default async ( ]); const client = getClient(); const parsedAnswers = parseMutationInput(answers); - const selectFields = buildSelectFromPaths(argv.select ?? 'clientMutationId'); + const selectFields = buildSelectFromPaths((argv.select as string) ?? 'clientMutationId'); const result = await client.mutation - .forgotPassword(parsedAnswers, { - select: selectFields, - }) + .forgotPassword( + parsedAnswers as unknown as ForgotPasswordVariables, + { + select: selectFields, + } as unknown as { + select: ForgotPasswordPayloadSelect; + } + ) .execute(); console.log(JSON.stringify(result, null, 2)); } catch (error) { diff --git a/sdk/constructive-cli/src/public/cli/commands/freeze-objects.ts b/sdk/constructive-cli/src/public/cli/commands/freeze-objects.ts index 9ef7984cf..ebdea0b37 100644 --- a/sdk/constructive-cli/src/public/cli/commands/freeze-objects.ts +++ b/sdk/constructive-cli/src/public/cli/commands/freeze-objects.ts @@ -1,4 +1,3 @@ -// @ts-nocheck /** * CLI command for mutation freezeObjects * @generated by @constructive-io/graphql-codegen @@ -7,6 +6,8 @@ import { CLIOptions, Inquirerer } from 'inquirerer'; import { getClient } from '../executor'; import { parseMutationInput, buildSelectFromPaths } from '../utils'; +import type { FreezeObjectsVariables } from '../../orm/mutation'; +import type { FreezeObjectsPayloadSelect } from '../../orm/input-types'; export default async ( argv: Partial>, prompter: Inquirerer, @@ -28,11 +29,16 @@ export default async ( ]); const client = getClient(); const parsedAnswers = parseMutationInput(answers); - const selectFields = buildSelectFromPaths(argv.select ?? 'clientMutationId'); + const selectFields = buildSelectFromPaths((argv.select as string) ?? 'clientMutationId'); const result = await client.mutation - .freezeObjects(parsedAnswers, { - select: selectFields, - }) + .freezeObjects( + parsedAnswers as unknown as FreezeObjectsVariables, + { + select: selectFields, + } as unknown as { + select: FreezeObjectsPayloadSelect; + } + ) .execute(); console.log(JSON.stringify(result, null, 2)); } catch (error) { diff --git a/sdk/constructive-cli/src/public/cli/commands/full-text-search.ts b/sdk/constructive-cli/src/public/cli/commands/full-text-search.ts index 70e739810..543fed8e0 100644 --- a/sdk/constructive-cli/src/public/cli/commands/full-text-search.ts +++ b/sdk/constructive-cli/src/public/cli/commands/full-text-search.ts @@ -1,4 +1,3 @@ -// @ts-nocheck /** * CLI commands for FullTextSearch * @generated by @constructive-io/graphql-codegen @@ -7,7 +6,9 @@ import { CLIOptions, Inquirerer, extractFirst } from 'inquirerer'; import { getClient } from '../executor'; import { coerceAnswers, stripUndefined } from '../utils'; -const fieldSchema = { +import type { FieldSchema } from '../utils'; +import type { CreateFullTextSearchInput, FullTextSearchPatch } from '../../orm/input-types'; +const fieldSchema: FieldSchema = { id: 'uuid', databaseId: 'uuid', tableId: 'uuid', @@ -39,7 +40,7 @@ export default async ( options: ['list', 'get', 'create', 'update', 'delete'], }, ]); - return handleTableSubcommand(answer.subcommand, newArgv, prompter); + return handleTableSubcommand(answer.subcommand as string, newArgv, prompter); } return handleTableSubcommand(subcommand, newArgv, prompter); }; @@ -104,7 +105,7 @@ async function handleGet(argv: Partial>, prompter: Inqui const client = getClient(); const result = await client.fullTextSearch .findOne({ - id: answers.id, + id: answers.id as string, select: { id: true, databaseId: true, @@ -168,7 +169,10 @@ async function handleCreate(argv: Partial>, prompter: In }, ]); const answers = coerceAnswers(rawAnswers, fieldSchema); - const cleanedData = stripUndefined(answers, fieldSchema); + const cleanedData = stripUndefined( + answers, + fieldSchema + ) as CreateFullTextSearchInput['fullTextSearch']; const client = getClient(); const result = await client.fullTextSearch .create({ @@ -249,7 +253,7 @@ async function handleUpdate(argv: Partial>, prompter: In }, ]); const answers = coerceAnswers(rawAnswers, fieldSchema); - const cleanedData = stripUndefined(answers, fieldSchema); + const cleanedData = stripUndefined(answers, fieldSchema) as FullTextSearchPatch; const client = getClient(); const result = await client.fullTextSearch .update({ diff --git a/sdk/constructive-cli/src/public/cli/commands/get-all-objects-from-root.ts b/sdk/constructive-cli/src/public/cli/commands/get-all-objects-from-root.ts index 271ae4afa..6c2bef23b 100644 --- a/sdk/constructive-cli/src/public/cli/commands/get-all-objects-from-root.ts +++ b/sdk/constructive-cli/src/public/cli/commands/get-all-objects-from-root.ts @@ -1,4 +1,3 @@ -// @ts-nocheck /** * CLI command for query getAllObjectsFromRoot * @generated by @constructive-io/graphql-codegen @@ -7,6 +6,8 @@ import { CLIOptions, Inquirerer } from 'inquirerer'; import { getClient } from '../executor'; import { buildSelectFromPaths } from '../utils'; +import type { GetAllObjectsFromRootVariables } from '../../orm/query'; +import type { ObjectConnectionSelect } from '../../orm/input-types'; export default async ( argv: Partial>, prompter: Inquirerer, @@ -48,11 +49,16 @@ export default async ( }, ]); const client = getClient(); - const selectFields = buildSelectFromPaths(argv.select ?? ''); + const selectFields = buildSelectFromPaths((argv.select as string) ?? ''); const result = await client.query - .getAllObjectsFromRoot(answers, { - select: selectFields, - }) + .getAllObjectsFromRoot( + answers as unknown as GetAllObjectsFromRootVariables, + { + select: selectFields, + } as unknown as { + select: ObjectConnectionSelect; + } + ) .execute(); console.log(JSON.stringify(result, null, 2)); } catch (error) { diff --git a/sdk/constructive-cli/src/public/cli/commands/get-all-record.ts b/sdk/constructive-cli/src/public/cli/commands/get-all-record.ts index a16ed34bb..f1919c11d 100644 --- a/sdk/constructive-cli/src/public/cli/commands/get-all-record.ts +++ b/sdk/constructive-cli/src/public/cli/commands/get-all-record.ts @@ -1,4 +1,3 @@ -// @ts-nocheck /** * CLI commands for GetAllRecord * @generated by @constructive-io/graphql-codegen @@ -7,12 +6,14 @@ import { CLIOptions, Inquirerer, extractFirst } from 'inquirerer'; import { getClient } from '../executor'; import { coerceAnswers, stripUndefined } from '../utils'; -const fieldSchema = { +import type { FieldSchema } from '../utils'; +import type { CreateGetAllRecordInput, GetAllRecordPatch } from '../../orm/input-types'; +const fieldSchema: FieldSchema = { path: 'string', data: 'json', }; const usage = - '\nget-all-record \n\nCommands:\n list List all getAllRecord records\n get Get a getAllRecord by ID\n create Create a new getAllRecord\n update Update an existing getAllRecord\n delete Delete a getAllRecord\n\n --help, -h Show this help message\n'; + '\nget-all-record \n\nCommands:\n list List all getAllRecord records\n create Create a new getAllRecord\n\n --help, -h Show this help message\n'; export default async ( argv: Partial>, prompter: Inquirerer, @@ -29,10 +30,10 @@ export default async ( type: 'autocomplete', name: 'subcommand', message: 'What do you want to do?', - options: ['list', 'get', 'create', 'update', 'delete'], + options: ['list', 'create'], }, ]); - return handleTableSubcommand(answer.subcommand, newArgv, prompter); + return handleTableSubcommand(answer.subcommand as string, newArgv, prompter); } return handleTableSubcommand(subcommand, newArgv, prompter); }; @@ -44,14 +45,8 @@ async function handleTableSubcommand( switch (subcommand) { case 'list': return handleList(argv, prompter); - case 'get': - return handleGet(argv, prompter); case 'create': return handleCreate(argv, prompter); - case 'update': - return handleUpdate(argv, prompter); - case 'delete': - return handleDelete(argv, prompter); default: console.log(usage); process.exit(1); @@ -77,35 +72,6 @@ async function handleList(_argv: Partial>, _prompter: In process.exit(1); } } -async function handleGet(argv: Partial>, prompter: Inquirerer) { - try { - const answers = await prompter.prompt(argv, [ - { - type: 'text', - name: 'id', - message: 'id', - required: true, - }, - ]); - const client = getClient(); - const result = await client.getAllRecord - .findOne({ - id: answers.id, - select: { - path: true, - data: true, - }, - }) - .execute(); - console.log(JSON.stringify(result, null, 2)); - } catch (error) { - console.error('Record not found.'); - if (error instanceof Error) { - console.error(error.message); - } - process.exit(1); - } -} async function handleCreate(argv: Partial>, prompter: Inquirerer) { try { const rawAnswers = await prompter.prompt(argv, [ @@ -123,7 +89,10 @@ async function handleCreate(argv: Partial>, prompter: In }, ]); const answers = coerceAnswers(rawAnswers, fieldSchema); - const cleanedData = stripUndefined(answers, fieldSchema); + const cleanedData = stripUndefined( + answers, + fieldSchema + ) as CreateGetAllRecordInput['getAllRecord']; const client = getClient(); const result = await client.getAllRecord .create({ @@ -146,83 +115,3 @@ async function handleCreate(argv: Partial>, prompter: In process.exit(1); } } -async function handleUpdate(argv: Partial>, prompter: Inquirerer) { - try { - const rawAnswers = await prompter.prompt(argv, [ - { - type: 'text', - name: 'id', - message: 'id', - required: true, - }, - { - type: 'text', - name: 'path', - message: 'path', - required: false, - }, - { - type: 'text', - name: 'data', - message: 'data', - required: false, - }, - ]); - const answers = coerceAnswers(rawAnswers, fieldSchema); - const cleanedData = stripUndefined(answers, fieldSchema); - const client = getClient(); - const result = await client.getAllRecord - .update({ - where: { - id: answers.id as string, - }, - data: { - path: cleanedData.path, - data: cleanedData.data, - }, - select: { - path: true, - data: true, - }, - }) - .execute(); - console.log(JSON.stringify(result, null, 2)); - } catch (error) { - console.error('Failed to update record.'); - if (error instanceof Error) { - console.error(error.message); - } - process.exit(1); - } -} -async function handleDelete(argv: Partial>, prompter: Inquirerer) { - try { - const rawAnswers = await prompter.prompt(argv, [ - { - type: 'text', - name: 'id', - message: 'id', - required: true, - }, - ]); - const answers = coerceAnswers(rawAnswers, fieldSchema); - const client = getClient(); - const result = await client.getAllRecord - .delete({ - where: { - id: answers.id as string, - }, - select: { - id: true, - }, - }) - .execute(); - console.log(JSON.stringify(result, null, 2)); - } catch (error) { - console.error('Failed to delete record.'); - if (error instanceof Error) { - console.error(error.message); - } - process.exit(1); - } -} diff --git a/sdk/constructive-cli/src/public/cli/commands/get-object-at-path.ts b/sdk/constructive-cli/src/public/cli/commands/get-object-at-path.ts index 89312b530..336a7e8d5 100644 --- a/sdk/constructive-cli/src/public/cli/commands/get-object-at-path.ts +++ b/sdk/constructive-cli/src/public/cli/commands/get-object-at-path.ts @@ -1,4 +1,3 @@ -// @ts-nocheck /** * CLI command for query getObjectAtPath * @generated by @constructive-io/graphql-codegen @@ -7,6 +6,8 @@ import { CLIOptions, Inquirerer } from 'inquirerer'; import { getClient } from '../executor'; import { buildSelectFromPaths } from '../utils'; +import type { GetObjectAtPathVariables } from '../../orm/query'; +import type { ObjectSelect } from '../../orm/input-types'; export default async ( argv: Partial>, prompter: Inquirerer, @@ -40,11 +41,16 @@ export default async ( }, ]); const client = getClient(); - const selectFields = buildSelectFromPaths(argv.select ?? ''); + const selectFields = buildSelectFromPaths((argv.select as string) ?? ''); const result = await client.query - .getObjectAtPath(answers, { - select: selectFields, - }) + .getObjectAtPath( + answers as unknown as GetObjectAtPathVariables, + { + select: selectFields, + } as unknown as { + select: ObjectSelect; + } + ) .execute(); console.log(JSON.stringify(result, null, 2)); } catch (error) { diff --git a/sdk/constructive-cli/src/public/cli/commands/get-path-objects-from-root.ts b/sdk/constructive-cli/src/public/cli/commands/get-path-objects-from-root.ts index 6aaf3a971..398523580 100644 --- a/sdk/constructive-cli/src/public/cli/commands/get-path-objects-from-root.ts +++ b/sdk/constructive-cli/src/public/cli/commands/get-path-objects-from-root.ts @@ -1,4 +1,3 @@ -// @ts-nocheck /** * CLI command for query getPathObjectsFromRoot * @generated by @constructive-io/graphql-codegen @@ -7,6 +6,8 @@ import { CLIOptions, Inquirerer } from 'inquirerer'; import { getClient } from '../executor'; import { buildSelectFromPaths } from '../utils'; +import type { GetPathObjectsFromRootVariables } from '../../orm/query'; +import type { ObjectConnectionSelect } from '../../orm/input-types'; export default async ( argv: Partial>, prompter: Inquirerer, @@ -53,11 +54,16 @@ export default async ( }, ]); const client = getClient(); - const selectFields = buildSelectFromPaths(argv.select ?? ''); + const selectFields = buildSelectFromPaths((argv.select as string) ?? ''); const result = await client.query - .getPathObjectsFromRoot(answers, { - select: selectFields, - }) + .getPathObjectsFromRoot( + answers as unknown as GetPathObjectsFromRootVariables, + { + select: selectFields, + } as unknown as { + select: ObjectConnectionSelect; + } + ) .execute(); console.log(JSON.stringify(result, null, 2)); } catch (error) { diff --git a/sdk/constructive-cli/src/public/cli/commands/hierarchy-module.ts b/sdk/constructive-cli/src/public/cli/commands/hierarchy-module.ts index 2bd372b6a..c609baa36 100644 --- a/sdk/constructive-cli/src/public/cli/commands/hierarchy-module.ts +++ b/sdk/constructive-cli/src/public/cli/commands/hierarchy-module.ts @@ -1,4 +1,3 @@ -// @ts-nocheck /** * CLI commands for HierarchyModule * @generated by @constructive-io/graphql-codegen @@ -7,7 +6,9 @@ import { CLIOptions, Inquirerer, extractFirst } from 'inquirerer'; import { getClient } from '../executor'; import { coerceAnswers, stripUndefined } from '../utils'; -const fieldSchema = { +import type { FieldSchema } from '../utils'; +import type { CreateHierarchyModuleInput, HierarchyModulePatch } from '../../orm/input-types'; +const fieldSchema: FieldSchema = { id: 'uuid', databaseId: 'uuid', schemaId: 'uuid', @@ -50,7 +51,7 @@ export default async ( options: ['list', 'get', 'create', 'update', 'delete'], }, ]); - return handleTableSubcommand(answer.subcommand, newArgv, prompter); + return handleTableSubcommand(answer.subcommand as string, newArgv, prompter); } return handleTableSubcommand(subcommand, newArgv, prompter); }; @@ -126,7 +127,7 @@ async function handleGet(argv: Partial>, prompter: Inqui const client = getClient(); const result = await client.hierarchyModule .findOne({ - id: answers.id, + id: answers.id as string, select: { id: true, databaseId: true, @@ -273,7 +274,10 @@ async function handleCreate(argv: Partial>, prompter: In }, ]); const answers = coerceAnswers(rawAnswers, fieldSchema); - const cleanedData = stripUndefined(answers, fieldSchema); + const cleanedData = stripUndefined( + answers, + fieldSchema + ) as CreateHierarchyModuleInput['hierarchyModule']; const client = getClient(); const result = await client.hierarchyModule .create({ @@ -449,7 +453,7 @@ async function handleUpdate(argv: Partial>, prompter: In }, ]); const answers = coerceAnswers(rawAnswers, fieldSchema); - const cleanedData = stripUndefined(answers, fieldSchema); + const cleanedData = stripUndefined(answers, fieldSchema) as HierarchyModulePatch; const client = getClient(); const result = await client.hierarchyModule .update({ diff --git a/sdk/constructive-cli/src/public/cli/commands/index.ts b/sdk/constructive-cli/src/public/cli/commands/index.ts index 4af943142..c42fade10 100644 --- a/sdk/constructive-cli/src/public/cli/commands/index.ts +++ b/sdk/constructive-cli/src/public/cli/commands/index.ts @@ -1,4 +1,3 @@ -// @ts-nocheck /** * CLI commands for Index * @generated by @constructive-io/graphql-codegen @@ -7,7 +6,9 @@ import { CLIOptions, Inquirerer, extractFirst } from 'inquirerer'; import { getClient } from '../executor'; import { coerceAnswers, stripUndefined } from '../utils'; -const fieldSchema = { +import type { FieldSchema } from '../utils'; +import type { CreateIndexInput, IndexPatch } from '../../orm/input-types'; +const fieldSchema: FieldSchema = { id: 'uuid', databaseId: 'uuid', tableId: 'uuid', @@ -47,7 +48,7 @@ export default async ( options: ['list', 'get', 'create', 'update', 'delete'], }, ]); - return handleTableSubcommand(answer.subcommand, newArgv, prompter); + return handleTableSubcommand(answer.subcommand as string, newArgv, prompter); } return handleTableSubcommand(subcommand, newArgv, prompter); }; @@ -120,7 +121,7 @@ async function handleGet(argv: Partial>, prompter: Inqui const client = getClient(); const result = await client.index .findOne({ - id: answers.id, + id: answers.id as string, select: { id: true, databaseId: true, @@ -240,7 +241,7 @@ async function handleCreate(argv: Partial>, prompter: In }, ]); const answers = coerceAnswers(rawAnswers, fieldSchema); - const cleanedData = stripUndefined(answers, fieldSchema); + const cleanedData = stripUndefined(answers, fieldSchema) as CreateIndexInput['index']; const client = getClient(); const result = await client.index .create({ @@ -385,7 +386,7 @@ async function handleUpdate(argv: Partial>, prompter: In }, ]); const answers = coerceAnswers(rawAnswers, fieldSchema); - const cleanedData = stripUndefined(answers, fieldSchema); + const cleanedData = stripUndefined(answers, fieldSchema) as IndexPatch; const client = getClient(); const result = await client.index .update({ diff --git a/sdk/constructive-cli/src/public/cli/commands/init-empty-repo.ts b/sdk/constructive-cli/src/public/cli/commands/init-empty-repo.ts index 483aa0c8c..7623fbe29 100644 --- a/sdk/constructive-cli/src/public/cli/commands/init-empty-repo.ts +++ b/sdk/constructive-cli/src/public/cli/commands/init-empty-repo.ts @@ -1,4 +1,3 @@ -// @ts-nocheck /** * CLI command for mutation initEmptyRepo * @generated by @constructive-io/graphql-codegen @@ -7,6 +6,8 @@ import { CLIOptions, Inquirerer } from 'inquirerer'; import { getClient } from '../executor'; import { parseMutationInput, buildSelectFromPaths } from '../utils'; +import type { InitEmptyRepoVariables } from '../../orm/mutation'; +import type { InitEmptyRepoPayloadSelect } from '../../orm/input-types'; export default async ( argv: Partial>, prompter: Inquirerer, @@ -28,11 +29,16 @@ export default async ( ]); const client = getClient(); const parsedAnswers = parseMutationInput(answers); - const selectFields = buildSelectFromPaths(argv.select ?? 'clientMutationId'); + const selectFields = buildSelectFromPaths((argv.select as string) ?? 'clientMutationId'); const result = await client.mutation - .initEmptyRepo(parsedAnswers, { - select: selectFields, - }) + .initEmptyRepo( + parsedAnswers as unknown as InitEmptyRepoVariables, + { + select: selectFields, + } as unknown as { + select: InitEmptyRepoPayloadSelect; + } + ) .execute(); console.log(JSON.stringify(result, null, 2)); } catch (error) { diff --git a/sdk/constructive-cli/src/public/cli/commands/insert-node-at-path.ts b/sdk/constructive-cli/src/public/cli/commands/insert-node-at-path.ts index 3b27dcaa7..fe9c9a4bc 100644 --- a/sdk/constructive-cli/src/public/cli/commands/insert-node-at-path.ts +++ b/sdk/constructive-cli/src/public/cli/commands/insert-node-at-path.ts @@ -1,4 +1,3 @@ -// @ts-nocheck /** * CLI command for mutation insertNodeAtPath * @generated by @constructive-io/graphql-codegen @@ -7,6 +6,8 @@ import { CLIOptions, Inquirerer } from 'inquirerer'; import { getClient } from '../executor'; import { parseMutationInput, buildSelectFromPaths } from '../utils'; +import type { InsertNodeAtPathVariables } from '../../orm/mutation'; +import type { InsertNodeAtPathPayloadSelect } from '../../orm/input-types'; export default async ( argv: Partial>, prompter: Inquirerer, @@ -30,11 +31,16 @@ export default async ( ]); const client = getClient(); const parsedAnswers = parseMutationInput(answers); - const selectFields = buildSelectFromPaths(argv.select ?? 'clientMutationId'); + const selectFields = buildSelectFromPaths((argv.select as string) ?? 'clientMutationId'); const result = await client.mutation - .insertNodeAtPath(parsedAnswers, { - select: selectFields, - }) + .insertNodeAtPath( + parsedAnswers as unknown as InsertNodeAtPathVariables, + { + select: selectFields, + } as unknown as { + select: InsertNodeAtPathPayloadSelect; + } + ) .execute(); console.log(JSON.stringify(result, null, 2)); } catch (error) { diff --git a/sdk/constructive-cli/src/public/cli/commands/invite.ts b/sdk/constructive-cli/src/public/cli/commands/invite.ts index ea2018a28..79a3c92b6 100644 --- a/sdk/constructive-cli/src/public/cli/commands/invite.ts +++ b/sdk/constructive-cli/src/public/cli/commands/invite.ts @@ -1,4 +1,3 @@ -// @ts-nocheck /** * CLI commands for Invite * @generated by @constructive-io/graphql-codegen @@ -7,7 +6,9 @@ import { CLIOptions, Inquirerer, extractFirst } from 'inquirerer'; import { getClient } from '../executor'; import { coerceAnswers, stripUndefined } from '../utils'; -const fieldSchema = { +import type { FieldSchema } from '../utils'; +import type { CreateInviteInput, InvitePatch } from '../../orm/input-types'; +const fieldSchema: FieldSchema = { id: 'uuid', email: 'string', senderId: 'uuid', @@ -42,7 +43,7 @@ export default async ( options: ['list', 'get', 'create', 'update', 'delete'], }, ]); - return handleTableSubcommand(answer.subcommand, newArgv, prompter); + return handleTableSubcommand(answer.subcommand as string, newArgv, prompter); } return handleTableSubcommand(subcommand, newArgv, prompter); }; @@ -110,7 +111,7 @@ async function handleGet(argv: Partial>, prompter: Inqui const client = getClient(); const result = await client.invite .findOne({ - id: answers.id, + id: answers.id as string, select: { id: true, email: true, @@ -195,7 +196,7 @@ async function handleCreate(argv: Partial>, prompter: In }, ]); const answers = coerceAnswers(rawAnswers, fieldSchema); - const cleanedData = stripUndefined(answers, fieldSchema); + const cleanedData = stripUndefined(answers, fieldSchema) as CreateInviteInput['invite']; const client = getClient(); const result = await client.invite .create({ @@ -300,7 +301,7 @@ async function handleUpdate(argv: Partial>, prompter: In }, ]); const answers = coerceAnswers(rawAnswers, fieldSchema); - const cleanedData = stripUndefined(answers, fieldSchema); + const cleanedData = stripUndefined(answers, fieldSchema) as InvitePatch; const client = getClient(); const result = await client.invite .update({ diff --git a/sdk/constructive-cli/src/public/cli/commands/invites-module.ts b/sdk/constructive-cli/src/public/cli/commands/invites-module.ts index 6bd69e139..220b1d94f 100644 --- a/sdk/constructive-cli/src/public/cli/commands/invites-module.ts +++ b/sdk/constructive-cli/src/public/cli/commands/invites-module.ts @@ -1,4 +1,3 @@ -// @ts-nocheck /** * CLI commands for InvitesModule * @generated by @constructive-io/graphql-codegen @@ -7,7 +6,9 @@ import { CLIOptions, Inquirerer, extractFirst } from 'inquirerer'; import { getClient } from '../executor'; import { coerceAnswers, stripUndefined } from '../utils'; -const fieldSchema = { +import type { FieldSchema } from '../utils'; +import type { CreateInvitesModuleInput, InvitesModulePatch } from '../../orm/input-types'; +const fieldSchema: FieldSchema = { id: 'uuid', databaseId: 'uuid', schemaId: 'uuid', @@ -44,7 +45,7 @@ export default async ( options: ['list', 'get', 'create', 'update', 'delete'], }, ]); - return handleTableSubcommand(answer.subcommand, newArgv, prompter); + return handleTableSubcommand(answer.subcommand as string, newArgv, prompter); } return handleTableSubcommand(subcommand, newArgv, prompter); }; @@ -114,7 +115,7 @@ async function handleGet(argv: Partial>, prompter: Inqui const client = getClient(); const result = await client.invitesModule .findOne({ - id: answers.id, + id: answers.id as string, select: { id: true, databaseId: true, @@ -225,7 +226,10 @@ async function handleCreate(argv: Partial>, prompter: In }, ]); const answers = coerceAnswers(rawAnswers, fieldSchema); - const cleanedData = stripUndefined(answers, fieldSchema); + const cleanedData = stripUndefined( + answers, + fieldSchema + ) as CreateInvitesModuleInput['invitesModule']; const client = getClient(); const result = await client.invitesModule .create({ @@ -360,7 +364,7 @@ async function handleUpdate(argv: Partial>, prompter: In }, ]); const answers = coerceAnswers(rawAnswers, fieldSchema); - const cleanedData = stripUndefined(answers, fieldSchema); + const cleanedData = stripUndefined(answers, fieldSchema) as InvitesModulePatch; const client = getClient(); const result = await client.invitesModule .update({ diff --git a/sdk/constructive-cli/src/public/cli/commands/levels-module.ts b/sdk/constructive-cli/src/public/cli/commands/levels-module.ts index 40b7049e0..80985c817 100644 --- a/sdk/constructive-cli/src/public/cli/commands/levels-module.ts +++ b/sdk/constructive-cli/src/public/cli/commands/levels-module.ts @@ -1,4 +1,3 @@ -// @ts-nocheck /** * CLI commands for LevelsModule * @generated by @constructive-io/graphql-codegen @@ -7,7 +6,9 @@ import { CLIOptions, Inquirerer, extractFirst } from 'inquirerer'; import { getClient } from '../executor'; import { coerceAnswers, stripUndefined } from '../utils'; -const fieldSchema = { +import type { FieldSchema } from '../utils'; +import type { CreateLevelsModuleInput, LevelsModulePatch } from '../../orm/input-types'; +const fieldSchema: FieldSchema = { id: 'uuid', databaseId: 'uuid', schemaId: 'uuid', @@ -56,7 +57,7 @@ export default async ( options: ['list', 'get', 'create', 'update', 'delete'], }, ]); - return handleTableSubcommand(answer.subcommand, newArgv, prompter); + return handleTableSubcommand(answer.subcommand as string, newArgv, prompter); } return handleTableSubcommand(subcommand, newArgv, prompter); }; @@ -138,7 +139,7 @@ async function handleGet(argv: Partial>, prompter: Inqui const client = getClient(); const result = await client.levelsModule .findOne({ - id: answers.id, + id: answers.id as string, select: { id: true, databaseId: true, @@ -333,7 +334,10 @@ async function handleCreate(argv: Partial>, prompter: In }, ]); const answers = coerceAnswers(rawAnswers, fieldSchema); - const cleanedData = stripUndefined(answers, fieldSchema); + const cleanedData = stripUndefined( + answers, + fieldSchema + ) as CreateLevelsModuleInput['levelsModule']; const client = getClient(); const result = await client.levelsModule .create({ @@ -564,7 +568,7 @@ async function handleUpdate(argv: Partial>, prompter: In }, ]); const answers = coerceAnswers(rawAnswers, fieldSchema); - const cleanedData = stripUndefined(answers, fieldSchema); + const cleanedData = stripUndefined(answers, fieldSchema) as LevelsModulePatch; const client = getClient(); const result = await client.levelsModule .update({ diff --git a/sdk/constructive-cli/src/public/cli/commands/limits-module.ts b/sdk/constructive-cli/src/public/cli/commands/limits-module.ts index a80952f0c..cd4c7a14b 100644 --- a/sdk/constructive-cli/src/public/cli/commands/limits-module.ts +++ b/sdk/constructive-cli/src/public/cli/commands/limits-module.ts @@ -1,4 +1,3 @@ -// @ts-nocheck /** * CLI commands for LimitsModule * @generated by @constructive-io/graphql-codegen @@ -7,7 +6,9 @@ import { CLIOptions, Inquirerer, extractFirst } from 'inquirerer'; import { getClient } from '../executor'; import { coerceAnswers, stripUndefined } from '../utils'; -const fieldSchema = { +import type { FieldSchema } from '../utils'; +import type { CreateLimitsModuleInput, LimitsModulePatch } from '../../orm/input-types'; +const fieldSchema: FieldSchema = { id: 'uuid', databaseId: 'uuid', schemaId: 'uuid', @@ -48,7 +49,7 @@ export default async ( options: ['list', 'get', 'create', 'update', 'delete'], }, ]); - return handleTableSubcommand(answer.subcommand, newArgv, prompter); + return handleTableSubcommand(answer.subcommand as string, newArgv, prompter); } return handleTableSubcommand(subcommand, newArgv, prompter); }; @@ -122,7 +123,7 @@ async function handleGet(argv: Partial>, prompter: Inqui const client = getClient(); const result = await client.limitsModule .findOne({ - id: answers.id, + id: answers.id as string, select: { id: true, databaseId: true, @@ -261,7 +262,10 @@ async function handleCreate(argv: Partial>, prompter: In }, ]); const answers = coerceAnswers(rawAnswers, fieldSchema); - const cleanedData = stripUndefined(answers, fieldSchema); + const cleanedData = stripUndefined( + answers, + fieldSchema + ) as CreateLimitsModuleInput['limitsModule']; const client = getClient(); const result = await client.limitsModule .create({ @@ -428,7 +432,7 @@ async function handleUpdate(argv: Partial>, prompter: In }, ]); const answers = coerceAnswers(rawAnswers, fieldSchema); - const cleanedData = stripUndefined(answers, fieldSchema); + const cleanedData = stripUndefined(answers, fieldSchema) as LimitsModulePatch; const client = getClient(); const result = await client.limitsModule .update({ diff --git a/sdk/constructive-cli/src/public/cli/commands/membership-type.ts b/sdk/constructive-cli/src/public/cli/commands/membership-type.ts index 83f9ebc34..118aade21 100644 --- a/sdk/constructive-cli/src/public/cli/commands/membership-type.ts +++ b/sdk/constructive-cli/src/public/cli/commands/membership-type.ts @@ -1,4 +1,3 @@ -// @ts-nocheck /** * CLI commands for MembershipType * @generated by @constructive-io/graphql-codegen @@ -7,7 +6,9 @@ import { CLIOptions, Inquirerer, extractFirst } from 'inquirerer'; import { getClient } from '../executor'; import { coerceAnswers, stripUndefined } from '../utils'; -const fieldSchema = { +import type { FieldSchema } from '../utils'; +import type { CreateMembershipTypeInput, MembershipTypePatch } from '../../orm/input-types'; +const fieldSchema: FieldSchema = { id: 'int', name: 'string', description: 'string', @@ -34,7 +35,7 @@ export default async ( options: ['list', 'get', 'create', 'update', 'delete'], }, ]); - return handleTableSubcommand(answer.subcommand, newArgv, prompter); + return handleTableSubcommand(answer.subcommand as string, newArgv, prompter); } return handleTableSubcommand(subcommand, newArgv, prompter); }; @@ -94,7 +95,7 @@ async function handleGet(argv: Partial>, prompter: Inqui const client = getClient(); const result = await client.membershipType .findOne({ - id: answers.id, + id: answers.id as number, select: { id: true, name: true, @@ -135,7 +136,10 @@ async function handleCreate(argv: Partial>, prompter: In }, ]); const answers = coerceAnswers(rawAnswers, fieldSchema); - const cleanedData = stripUndefined(answers, fieldSchema); + const cleanedData = stripUndefined( + answers, + fieldSchema + ) as CreateMembershipTypeInput['membershipType']; const client = getClient(); const result = await client.membershipType .create({ @@ -190,12 +194,12 @@ async function handleUpdate(argv: Partial>, prompter: In }, ]); const answers = coerceAnswers(rawAnswers, fieldSchema); - const cleanedData = stripUndefined(answers, fieldSchema); + const cleanedData = stripUndefined(answers, fieldSchema) as MembershipTypePatch; const client = getClient(); const result = await client.membershipType .update({ where: { - id: answers.id as string, + id: answers.id as number, }, data: { name: cleanedData.name, @@ -234,7 +238,7 @@ async function handleDelete(argv: Partial>, prompter: In const result = await client.membershipType .delete({ where: { - id: answers.id as string, + id: answers.id as number, }, select: { id: true, diff --git a/sdk/constructive-cli/src/public/cli/commands/membership-types-module.ts b/sdk/constructive-cli/src/public/cli/commands/membership-types-module.ts index 09d7abb02..26cb9a649 100644 --- a/sdk/constructive-cli/src/public/cli/commands/membership-types-module.ts +++ b/sdk/constructive-cli/src/public/cli/commands/membership-types-module.ts @@ -1,4 +1,3 @@ -// @ts-nocheck /** * CLI commands for MembershipTypesModule * @generated by @constructive-io/graphql-codegen @@ -7,7 +6,12 @@ import { CLIOptions, Inquirerer, extractFirst } from 'inquirerer'; import { getClient } from '../executor'; import { coerceAnswers, stripUndefined } from '../utils'; -const fieldSchema = { +import type { FieldSchema } from '../utils'; +import type { + CreateMembershipTypesModuleInput, + MembershipTypesModulePatch, +} from '../../orm/input-types'; +const fieldSchema: FieldSchema = { id: 'uuid', databaseId: 'uuid', schemaId: 'uuid', @@ -35,7 +39,7 @@ export default async ( options: ['list', 'get', 'create', 'update', 'delete'], }, ]); - return handleTableSubcommand(answer.subcommand, newArgv, prompter); + return handleTableSubcommand(answer.subcommand as string, newArgv, prompter); } return handleTableSubcommand(subcommand, newArgv, prompter); }; @@ -96,7 +100,7 @@ async function handleGet(argv: Partial>, prompter: Inqui const client = getClient(); const result = await client.membershipTypesModule .findOne({ - id: answers.id, + id: answers.id as string, select: { id: true, databaseId: true, @@ -144,7 +148,10 @@ async function handleCreate(argv: Partial>, prompter: In }, ]); const answers = coerceAnswers(rawAnswers, fieldSchema); - const cleanedData = stripUndefined(answers, fieldSchema); + const cleanedData = stripUndefined( + answers, + fieldSchema + ) as CreateMembershipTypesModuleInput['membershipTypesModule']; const client = getClient(); const result = await client.membershipTypesModule .create({ @@ -207,7 +214,7 @@ async function handleUpdate(argv: Partial>, prompter: In }, ]); const answers = coerceAnswers(rawAnswers, fieldSchema); - const cleanedData = stripUndefined(answers, fieldSchema); + const cleanedData = stripUndefined(answers, fieldSchema) as MembershipTypesModulePatch; const client = getClient(); const result = await client.membershipTypesModule .update({ diff --git a/sdk/constructive-cli/src/public/cli/commands/memberships-module.ts b/sdk/constructive-cli/src/public/cli/commands/memberships-module.ts index a531237ef..256556141 100644 --- a/sdk/constructive-cli/src/public/cli/commands/memberships-module.ts +++ b/sdk/constructive-cli/src/public/cli/commands/memberships-module.ts @@ -1,4 +1,3 @@ -// @ts-nocheck /** * CLI commands for MembershipsModule * @generated by @constructive-io/graphql-codegen @@ -7,7 +6,9 @@ import { CLIOptions, Inquirerer, extractFirst } from 'inquirerer'; import { getClient } from '../executor'; import { coerceAnswers, stripUndefined } from '../utils'; -const fieldSchema = { +import type { FieldSchema } from '../utils'; +import type { CreateMembershipsModuleInput, MembershipsModulePatch } from '../../orm/input-types'; +const fieldSchema: FieldSchema = { id: 'uuid', databaseId: 'uuid', schemaId: 'uuid', @@ -61,7 +62,7 @@ export default async ( options: ['list', 'get', 'create', 'update', 'delete'], }, ]); - return handleTableSubcommand(answer.subcommand, newArgv, prompter); + return handleTableSubcommand(answer.subcommand as string, newArgv, prompter); } return handleTableSubcommand(subcommand, newArgv, prompter); }; @@ -148,7 +149,7 @@ async function handleGet(argv: Partial>, prompter: Inqui const client = getClient(); const result = await client.membershipsModule .findOne({ - id: answers.id, + id: answers.id as string, select: { id: true, databaseId: true, @@ -378,7 +379,10 @@ async function handleCreate(argv: Partial>, prompter: In }, ]); const answers = coerceAnswers(rawAnswers, fieldSchema); - const cleanedData = stripUndefined(answers, fieldSchema); + const cleanedData = stripUndefined( + answers, + fieldSchema + ) as CreateMembershipsModuleInput['membershipsModule']; const client = getClient(); const result = await client.membershipsModule .create({ @@ -649,7 +653,7 @@ async function handleUpdate(argv: Partial>, prompter: In }, ]); const answers = coerceAnswers(rawAnswers, fieldSchema); - const cleanedData = stripUndefined(answers, fieldSchema); + const cleanedData = stripUndefined(answers, fieldSchema) as MembershipsModulePatch; const client = getClient(); const result = await client.membershipsModule .update({ diff --git a/sdk/constructive-cli/src/public/cli/commands/node-type-registry.ts b/sdk/constructive-cli/src/public/cli/commands/node-type-registry.ts index e6e10d2c8..99a0db790 100644 --- a/sdk/constructive-cli/src/public/cli/commands/node-type-registry.ts +++ b/sdk/constructive-cli/src/public/cli/commands/node-type-registry.ts @@ -1,4 +1,3 @@ -// @ts-nocheck /** * CLI commands for NodeTypeRegistry * @generated by @constructive-io/graphql-codegen @@ -7,7 +6,9 @@ import { CLIOptions, Inquirerer, extractFirst } from 'inquirerer'; import { getClient } from '../executor'; import { coerceAnswers, stripUndefined } from '../utils'; -const fieldSchema = { +import type { FieldSchema } from '../utils'; +import type { CreateNodeTypeRegistryInput, NodeTypeRegistryPatch } from '../../orm/input-types'; +const fieldSchema: FieldSchema = { name: 'string', slug: 'string', category: 'string', @@ -39,7 +40,7 @@ export default async ( options: ['list', 'get', 'create', 'update', 'delete'], }, ]); - return handleTableSubcommand(answer.subcommand, newArgv, prompter); + return handleTableSubcommand(answer.subcommand as string, newArgv, prompter); } return handleTableSubcommand(subcommand, newArgv, prompter); }; @@ -104,7 +105,7 @@ async function handleGet(argv: Partial>, prompter: Inqui const client = getClient(); const result = await client.nodeTypeRegistry .findOne({ - name: answers.name, + name: answers.name as string, select: { name: true, slug: true, @@ -130,6 +131,12 @@ async function handleGet(argv: Partial>, prompter: Inqui async function handleCreate(argv: Partial>, prompter: Inquirerer) { try { const rawAnswers = await prompter.prompt(argv, [ + { + type: 'text', + name: 'name', + message: 'name', + required: true, + }, { type: 'text', name: 'slug', @@ -168,11 +175,15 @@ async function handleCreate(argv: Partial>, prompter: In }, ]); const answers = coerceAnswers(rawAnswers, fieldSchema); - const cleanedData = stripUndefined(answers, fieldSchema); + const cleanedData = stripUndefined( + answers, + fieldSchema + ) as CreateNodeTypeRegistryInput['nodeTypeRegistry']; const client = getClient(); const result = await client.nodeTypeRegistry .create({ data: { + name: cleanedData.name, slug: cleanedData.slug, category: cleanedData.category, displayName: cleanedData.displayName, @@ -249,7 +260,7 @@ async function handleUpdate(argv: Partial>, prompter: In }, ]); const answers = coerceAnswers(rawAnswers, fieldSchema); - const cleanedData = stripUndefined(answers, fieldSchema); + const cleanedData = stripUndefined(answers, fieldSchema) as NodeTypeRegistryPatch; const client = getClient(); const result = await client.nodeTypeRegistry .update({ diff --git a/sdk/constructive-cli/src/public/cli/commands/object.ts b/sdk/constructive-cli/src/public/cli/commands/object.ts index 65df949e2..20f6f3670 100644 --- a/sdk/constructive-cli/src/public/cli/commands/object.ts +++ b/sdk/constructive-cli/src/public/cli/commands/object.ts @@ -1,4 +1,3 @@ -// @ts-nocheck /** * CLI commands for Object * @generated by @constructive-io/graphql-codegen @@ -7,7 +6,9 @@ import { CLIOptions, Inquirerer, extractFirst } from 'inquirerer'; import { getClient } from '../executor'; import { coerceAnswers, stripUndefined } from '../utils'; -const fieldSchema = { +import type { FieldSchema } from '../utils'; +import type { CreateObjectInput, ObjectPatch } from '../../orm/input-types'; +const fieldSchema: FieldSchema = { hashUuid: 'uuid', id: 'uuid', databaseId: 'uuid', @@ -38,7 +39,7 @@ export default async ( options: ['list', 'get', 'create', 'update', 'delete'], }, ]); - return handleTableSubcommand(answer.subcommand, newArgv, prompter); + return handleTableSubcommand(answer.subcommand as string, newArgv, prompter); } return handleTableSubcommand(subcommand, newArgv, prompter); }; @@ -102,7 +103,7 @@ async function handleGet(argv: Partial>, prompter: Inqui const client = getClient(); const result = await client.object .findOne({ - id: answers.id, + id: answers.id as string, select: { hashUuid: true, id: true, @@ -127,12 +128,6 @@ async function handleGet(argv: Partial>, prompter: Inqui async function handleCreate(argv: Partial>, prompter: Inquirerer) { try { const rawAnswers = await prompter.prompt(argv, [ - { - type: 'text', - name: 'hashUuid', - message: 'hashUuid', - required: true, - }, { type: 'text', name: 'databaseId', @@ -165,12 +160,11 @@ async function handleCreate(argv: Partial>, prompter: In }, ]); const answers = coerceAnswers(rawAnswers, fieldSchema); - const cleanedData = stripUndefined(answers, fieldSchema); + const cleanedData = stripUndefined(answers, fieldSchema) as CreateObjectInput['object']; const client = getClient(); const result = await client.object .create({ data: { - hashUuid: cleanedData.hashUuid, databaseId: cleanedData.databaseId, kids: cleanedData.kids, ktree: cleanedData.ktree, @@ -207,12 +201,6 @@ async function handleUpdate(argv: Partial>, prompter: In message: 'id', required: true, }, - { - type: 'text', - name: 'hashUuid', - message: 'hashUuid', - required: false, - }, { type: 'text', name: 'databaseId', @@ -245,7 +233,7 @@ async function handleUpdate(argv: Partial>, prompter: In }, ]); const answers = coerceAnswers(rawAnswers, fieldSchema); - const cleanedData = stripUndefined(answers, fieldSchema); + const cleanedData = stripUndefined(answers, fieldSchema) as ObjectPatch; const client = getClient(); const result = await client.object .update({ @@ -253,7 +241,6 @@ async function handleUpdate(argv: Partial>, prompter: In id: answers.id as string, }, data: { - hashUuid: cleanedData.hashUuid, databaseId: cleanedData.databaseId, kids: cleanedData.kids, ktree: cleanedData.ktree, diff --git a/sdk/constructive-cli/src/public/cli/commands/one-time-token.ts b/sdk/constructive-cli/src/public/cli/commands/one-time-token.ts index 13bb251e7..5cfad9cf5 100644 --- a/sdk/constructive-cli/src/public/cli/commands/one-time-token.ts +++ b/sdk/constructive-cli/src/public/cli/commands/one-time-token.ts @@ -1,4 +1,3 @@ -// @ts-nocheck /** * CLI command for mutation oneTimeToken * @generated by @constructive-io/graphql-codegen @@ -7,6 +6,8 @@ import { CLIOptions, Inquirerer } from 'inquirerer'; import { getClient } from '../executor'; import { parseMutationInput, buildSelectFromPaths } from '../utils'; +import type { OneTimeTokenVariables } from '../../orm/mutation'; +import type { OneTimeTokenPayloadSelect } from '../../orm/input-types'; export default async ( argv: Partial>, prompter: Inquirerer, @@ -28,11 +29,16 @@ export default async ( ]); const client = getClient(); const parsedAnswers = parseMutationInput(answers); - const selectFields = buildSelectFromPaths(argv.select ?? 'clientMutationId'); + const selectFields = buildSelectFromPaths((argv.select as string) ?? 'clientMutationId'); const result = await client.mutation - .oneTimeToken(parsedAnswers, { - select: selectFields, - }) + .oneTimeToken( + parsedAnswers as unknown as OneTimeTokenVariables, + { + select: selectFields, + } as unknown as { + select: OneTimeTokenPayloadSelect; + } + ) .execute(); console.log(JSON.stringify(result, null, 2)); } catch (error) { diff --git a/sdk/constructive-cli/src/public/cli/commands/org-admin-grant.ts b/sdk/constructive-cli/src/public/cli/commands/org-admin-grant.ts index c640b79e7..5684dbda8 100644 --- a/sdk/constructive-cli/src/public/cli/commands/org-admin-grant.ts +++ b/sdk/constructive-cli/src/public/cli/commands/org-admin-grant.ts @@ -1,4 +1,3 @@ -// @ts-nocheck /** * CLI commands for OrgAdminGrant * @generated by @constructive-io/graphql-codegen @@ -7,7 +6,9 @@ import { CLIOptions, Inquirerer, extractFirst } from 'inquirerer'; import { getClient } from '../executor'; import { coerceAnswers, stripUndefined } from '../utils'; -const fieldSchema = { +import type { FieldSchema } from '../utils'; +import type { CreateOrgAdminGrantInput, OrgAdminGrantPatch } from '../../orm/input-types'; +const fieldSchema: FieldSchema = { id: 'uuid', isGrant: 'boolean', actorId: 'uuid', @@ -37,7 +38,7 @@ export default async ( options: ['list', 'get', 'create', 'update', 'delete'], }, ]); - return handleTableSubcommand(answer.subcommand, newArgv, prompter); + return handleTableSubcommand(answer.subcommand as string, newArgv, prompter); } return handleTableSubcommand(subcommand, newArgv, prompter); }; @@ -100,7 +101,7 @@ async function handleGet(argv: Partial>, prompter: Inqui const client = getClient(); const result = await client.orgAdminGrant .findOne({ - id: answers.id, + id: answers.id as string, select: { id: true, isGrant: true, @@ -150,7 +151,10 @@ async function handleCreate(argv: Partial>, prompter: In }, ]); const answers = coerceAnswers(rawAnswers, fieldSchema); - const cleanedData = stripUndefined(answers, fieldSchema); + const cleanedData = stripUndefined( + answers, + fieldSchema + ) as CreateOrgAdminGrantInput['orgAdminGrant']; const client = getClient(); const result = await client.orgAdminGrant .create({ @@ -215,7 +219,7 @@ async function handleUpdate(argv: Partial>, prompter: In }, ]); const answers = coerceAnswers(rawAnswers, fieldSchema); - const cleanedData = stripUndefined(answers, fieldSchema); + const cleanedData = stripUndefined(answers, fieldSchema) as OrgAdminGrantPatch; const client = getClient(); const result = await client.orgAdminGrant .update({ diff --git a/sdk/constructive-cli/src/public/cli/commands/org-chart-edge-grant.ts b/sdk/constructive-cli/src/public/cli/commands/org-chart-edge-grant.ts index 8b9f5154b..c8063f861 100644 --- a/sdk/constructive-cli/src/public/cli/commands/org-chart-edge-grant.ts +++ b/sdk/constructive-cli/src/public/cli/commands/org-chart-edge-grant.ts @@ -1,4 +1,3 @@ -// @ts-nocheck /** * CLI commands for OrgChartEdgeGrant * @generated by @constructive-io/graphql-codegen @@ -7,7 +6,9 @@ import { CLIOptions, Inquirerer, extractFirst } from 'inquirerer'; import { getClient } from '../executor'; import { coerceAnswers, stripUndefined } from '../utils'; -const fieldSchema = { +import type { FieldSchema } from '../utils'; +import type { CreateOrgChartEdgeGrantInput, OrgChartEdgeGrantPatch } from '../../orm/input-types'; +const fieldSchema: FieldSchema = { id: 'uuid', entityId: 'uuid', childId: 'uuid', @@ -39,7 +40,7 @@ export default async ( options: ['list', 'get', 'create', 'update', 'delete'], }, ]); - return handleTableSubcommand(answer.subcommand, newArgv, prompter); + return handleTableSubcommand(answer.subcommand as string, newArgv, prompter); } return handleTableSubcommand(subcommand, newArgv, prompter); }; @@ -104,7 +105,7 @@ async function handleGet(argv: Partial>, prompter: Inqui const client = getClient(); const result = await client.orgChartEdgeGrant .findOne({ - id: answers.id, + id: answers.id as string, select: { id: true, entityId: true, @@ -174,7 +175,10 @@ async function handleCreate(argv: Partial>, prompter: In }, ]); const answers = coerceAnswers(rawAnswers, fieldSchema); - const cleanedData = stripUndefined(answers, fieldSchema); + const cleanedData = stripUndefined( + answers, + fieldSchema + ) as CreateOrgChartEdgeGrantInput['orgChartEdgeGrant']; const client = getClient(); const result = await client.orgChartEdgeGrant .create({ @@ -262,7 +266,7 @@ async function handleUpdate(argv: Partial>, prompter: In }, ]); const answers = coerceAnswers(rawAnswers, fieldSchema); - const cleanedData = stripUndefined(answers, fieldSchema); + const cleanedData = stripUndefined(answers, fieldSchema) as OrgChartEdgeGrantPatch; const client = getClient(); const result = await client.orgChartEdgeGrant .update({ diff --git a/sdk/constructive-cli/src/public/cli/commands/org-chart-edge.ts b/sdk/constructive-cli/src/public/cli/commands/org-chart-edge.ts index 123135e1a..546a094e1 100644 --- a/sdk/constructive-cli/src/public/cli/commands/org-chart-edge.ts +++ b/sdk/constructive-cli/src/public/cli/commands/org-chart-edge.ts @@ -1,4 +1,3 @@ -// @ts-nocheck /** * CLI commands for OrgChartEdge * @generated by @constructive-io/graphql-codegen @@ -7,7 +6,9 @@ import { CLIOptions, Inquirerer, extractFirst } from 'inquirerer'; import { getClient } from '../executor'; import { coerceAnswers, stripUndefined } from '../utils'; -const fieldSchema = { +import type { FieldSchema } from '../utils'; +import type { CreateOrgChartEdgeInput, OrgChartEdgePatch } from '../../orm/input-types'; +const fieldSchema: FieldSchema = { id: 'uuid', createdAt: 'string', updatedAt: 'string', @@ -38,7 +39,7 @@ export default async ( options: ['list', 'get', 'create', 'update', 'delete'], }, ]); - return handleTableSubcommand(answer.subcommand, newArgv, prompter); + return handleTableSubcommand(answer.subcommand as string, newArgv, prompter); } return handleTableSubcommand(subcommand, newArgv, prompter); }; @@ -102,7 +103,7 @@ async function handleGet(argv: Partial>, prompter: Inqui const client = getClient(); const result = await client.orgChartEdge .findOne({ - id: answers.id, + id: answers.id as string, select: { id: true, createdAt: true, @@ -159,7 +160,10 @@ async function handleCreate(argv: Partial>, prompter: In }, ]); const answers = coerceAnswers(rawAnswers, fieldSchema); - const cleanedData = stripUndefined(answers, fieldSchema); + const cleanedData = stripUndefined( + answers, + fieldSchema + ) as CreateOrgChartEdgeInput['orgChartEdge']; const client = getClient(); const result = await client.orgChartEdge .create({ @@ -232,7 +236,7 @@ async function handleUpdate(argv: Partial>, prompter: In }, ]); const answers = coerceAnswers(rawAnswers, fieldSchema); - const cleanedData = stripUndefined(answers, fieldSchema); + const cleanedData = stripUndefined(answers, fieldSchema) as OrgChartEdgePatch; const client = getClient(); const result = await client.orgChartEdge .update({ diff --git a/sdk/constructive-cli/src/public/cli/commands/org-claimed-invite.ts b/sdk/constructive-cli/src/public/cli/commands/org-claimed-invite.ts index b6b7f07f0..96231ab87 100644 --- a/sdk/constructive-cli/src/public/cli/commands/org-claimed-invite.ts +++ b/sdk/constructive-cli/src/public/cli/commands/org-claimed-invite.ts @@ -1,4 +1,3 @@ -// @ts-nocheck /** * CLI commands for OrgClaimedInvite * @generated by @constructive-io/graphql-codegen @@ -7,7 +6,9 @@ import { CLIOptions, Inquirerer, extractFirst } from 'inquirerer'; import { getClient } from '../executor'; import { coerceAnswers, stripUndefined } from '../utils'; -const fieldSchema = { +import type { FieldSchema } from '../utils'; +import type { CreateOrgClaimedInviteInput, OrgClaimedInvitePatch } from '../../orm/input-types'; +const fieldSchema: FieldSchema = { id: 'uuid', data: 'json', senderId: 'uuid', @@ -37,7 +38,7 @@ export default async ( options: ['list', 'get', 'create', 'update', 'delete'], }, ]); - return handleTableSubcommand(answer.subcommand, newArgv, prompter); + return handleTableSubcommand(answer.subcommand as string, newArgv, prompter); } return handleTableSubcommand(subcommand, newArgv, prompter); }; @@ -100,7 +101,7 @@ async function handleGet(argv: Partial>, prompter: Inqui const client = getClient(); const result = await client.orgClaimedInvite .findOne({ - id: answers.id, + id: answers.id as string, select: { id: true, data: true, @@ -150,7 +151,10 @@ async function handleCreate(argv: Partial>, prompter: In }, ]); const answers = coerceAnswers(rawAnswers, fieldSchema); - const cleanedData = stripUndefined(answers, fieldSchema); + const cleanedData = stripUndefined( + answers, + fieldSchema + ) as CreateOrgClaimedInviteInput['orgClaimedInvite']; const client = getClient(); const result = await client.orgClaimedInvite .create({ @@ -215,7 +219,7 @@ async function handleUpdate(argv: Partial>, prompter: In }, ]); const answers = coerceAnswers(rawAnswers, fieldSchema); - const cleanedData = stripUndefined(answers, fieldSchema); + const cleanedData = stripUndefined(answers, fieldSchema) as OrgClaimedInvitePatch; const client = getClient(); const result = await client.orgClaimedInvite .update({ diff --git a/sdk/constructive-cli/src/public/cli/commands/org-get-managers-record.ts b/sdk/constructive-cli/src/public/cli/commands/org-get-managers-record.ts index bbc4577ce..665a15560 100644 --- a/sdk/constructive-cli/src/public/cli/commands/org-get-managers-record.ts +++ b/sdk/constructive-cli/src/public/cli/commands/org-get-managers-record.ts @@ -1,4 +1,3 @@ -// @ts-nocheck /** * CLI commands for OrgGetManagersRecord * @generated by @constructive-io/graphql-codegen @@ -7,12 +6,17 @@ import { CLIOptions, Inquirerer, extractFirst } from 'inquirerer'; import { getClient } from '../executor'; import { coerceAnswers, stripUndefined } from '../utils'; -const fieldSchema = { +import type { FieldSchema } from '../utils'; +import type { + CreateOrgGetManagersRecordInput, + OrgGetManagersRecordPatch, +} from '../../orm/input-types'; +const fieldSchema: FieldSchema = { userId: 'uuid', depth: 'int', }; const usage = - '\norg-get-managers-record \n\nCommands:\n list List all orgGetManagersRecord records\n get Get a orgGetManagersRecord by ID\n create Create a new orgGetManagersRecord\n update Update an existing orgGetManagersRecord\n delete Delete a orgGetManagersRecord\n\n --help, -h Show this help message\n'; + '\norg-get-managers-record \n\nCommands:\n list List all orgGetManagersRecord records\n create Create a new orgGetManagersRecord\n\n --help, -h Show this help message\n'; export default async ( argv: Partial>, prompter: Inquirerer, @@ -29,10 +33,10 @@ export default async ( type: 'autocomplete', name: 'subcommand', message: 'What do you want to do?', - options: ['list', 'get', 'create', 'update', 'delete'], + options: ['list', 'create'], }, ]); - return handleTableSubcommand(answer.subcommand, newArgv, prompter); + return handleTableSubcommand(answer.subcommand as string, newArgv, prompter); } return handleTableSubcommand(subcommand, newArgv, prompter); }; @@ -44,14 +48,8 @@ async function handleTableSubcommand( switch (subcommand) { case 'list': return handleList(argv, prompter); - case 'get': - return handleGet(argv, prompter); case 'create': return handleCreate(argv, prompter); - case 'update': - return handleUpdate(argv, prompter); - case 'delete': - return handleDelete(argv, prompter); default: console.log(usage); process.exit(1); @@ -77,35 +75,6 @@ async function handleList(_argv: Partial>, _prompter: In process.exit(1); } } -async function handleGet(argv: Partial>, prompter: Inquirerer) { - try { - const answers = await prompter.prompt(argv, [ - { - type: 'text', - name: 'id', - message: 'id', - required: true, - }, - ]); - const client = getClient(); - const result = await client.orgGetManagersRecord - .findOne({ - id: answers.id, - select: { - userId: true, - depth: true, - }, - }) - .execute(); - console.log(JSON.stringify(result, null, 2)); - } catch (error) { - console.error('Record not found.'); - if (error instanceof Error) { - console.error(error.message); - } - process.exit(1); - } -} async function handleCreate(argv: Partial>, prompter: Inquirerer) { try { const rawAnswers = await prompter.prompt(argv, [ @@ -123,7 +92,10 @@ async function handleCreate(argv: Partial>, prompter: In }, ]); const answers = coerceAnswers(rawAnswers, fieldSchema); - const cleanedData = stripUndefined(answers, fieldSchema); + const cleanedData = stripUndefined( + answers, + fieldSchema + ) as CreateOrgGetManagersRecordInput['orgGetManagersRecord']; const client = getClient(); const result = await client.orgGetManagersRecord .create({ @@ -146,83 +118,3 @@ async function handleCreate(argv: Partial>, prompter: In process.exit(1); } } -async function handleUpdate(argv: Partial>, prompter: Inquirerer) { - try { - const rawAnswers = await prompter.prompt(argv, [ - { - type: 'text', - name: 'id', - message: 'id', - required: true, - }, - { - type: 'text', - name: 'userId', - message: 'userId', - required: false, - }, - { - type: 'text', - name: 'depth', - message: 'depth', - required: false, - }, - ]); - const answers = coerceAnswers(rawAnswers, fieldSchema); - const cleanedData = stripUndefined(answers, fieldSchema); - const client = getClient(); - const result = await client.orgGetManagersRecord - .update({ - where: { - id: answers.id as string, - }, - data: { - userId: cleanedData.userId, - depth: cleanedData.depth, - }, - select: { - userId: true, - depth: true, - }, - }) - .execute(); - console.log(JSON.stringify(result, null, 2)); - } catch (error) { - console.error('Failed to update record.'); - if (error instanceof Error) { - console.error(error.message); - } - process.exit(1); - } -} -async function handleDelete(argv: Partial>, prompter: Inquirerer) { - try { - const rawAnswers = await prompter.prompt(argv, [ - { - type: 'text', - name: 'id', - message: 'id', - required: true, - }, - ]); - const answers = coerceAnswers(rawAnswers, fieldSchema); - const client = getClient(); - const result = await client.orgGetManagersRecord - .delete({ - where: { - id: answers.id as string, - }, - select: { - id: true, - }, - }) - .execute(); - console.log(JSON.stringify(result, null, 2)); - } catch (error) { - console.error('Failed to delete record.'); - if (error instanceof Error) { - console.error(error.message); - } - process.exit(1); - } -} diff --git a/sdk/constructive-cli/src/public/cli/commands/org-get-subordinates-record.ts b/sdk/constructive-cli/src/public/cli/commands/org-get-subordinates-record.ts index 1bf7ab95c..3bcb09aca 100644 --- a/sdk/constructive-cli/src/public/cli/commands/org-get-subordinates-record.ts +++ b/sdk/constructive-cli/src/public/cli/commands/org-get-subordinates-record.ts @@ -1,4 +1,3 @@ -// @ts-nocheck /** * CLI commands for OrgGetSubordinatesRecord * @generated by @constructive-io/graphql-codegen @@ -7,12 +6,17 @@ import { CLIOptions, Inquirerer, extractFirst } from 'inquirerer'; import { getClient } from '../executor'; import { coerceAnswers, stripUndefined } from '../utils'; -const fieldSchema = { +import type { FieldSchema } from '../utils'; +import type { + CreateOrgGetSubordinatesRecordInput, + OrgGetSubordinatesRecordPatch, +} from '../../orm/input-types'; +const fieldSchema: FieldSchema = { userId: 'uuid', depth: 'int', }; const usage = - '\norg-get-subordinates-record \n\nCommands:\n list List all orgGetSubordinatesRecord records\n get Get a orgGetSubordinatesRecord by ID\n create Create a new orgGetSubordinatesRecord\n update Update an existing orgGetSubordinatesRecord\n delete Delete a orgGetSubordinatesRecord\n\n --help, -h Show this help message\n'; + '\norg-get-subordinates-record \n\nCommands:\n list List all orgGetSubordinatesRecord records\n create Create a new orgGetSubordinatesRecord\n\n --help, -h Show this help message\n'; export default async ( argv: Partial>, prompter: Inquirerer, @@ -29,10 +33,10 @@ export default async ( type: 'autocomplete', name: 'subcommand', message: 'What do you want to do?', - options: ['list', 'get', 'create', 'update', 'delete'], + options: ['list', 'create'], }, ]); - return handleTableSubcommand(answer.subcommand, newArgv, prompter); + return handleTableSubcommand(answer.subcommand as string, newArgv, prompter); } return handleTableSubcommand(subcommand, newArgv, prompter); }; @@ -44,14 +48,8 @@ async function handleTableSubcommand( switch (subcommand) { case 'list': return handleList(argv, prompter); - case 'get': - return handleGet(argv, prompter); case 'create': return handleCreate(argv, prompter); - case 'update': - return handleUpdate(argv, prompter); - case 'delete': - return handleDelete(argv, prompter); default: console.log(usage); process.exit(1); @@ -77,35 +75,6 @@ async function handleList(_argv: Partial>, _prompter: In process.exit(1); } } -async function handleGet(argv: Partial>, prompter: Inquirerer) { - try { - const answers = await prompter.prompt(argv, [ - { - type: 'text', - name: 'id', - message: 'id', - required: true, - }, - ]); - const client = getClient(); - const result = await client.orgGetSubordinatesRecord - .findOne({ - id: answers.id, - select: { - userId: true, - depth: true, - }, - }) - .execute(); - console.log(JSON.stringify(result, null, 2)); - } catch (error) { - console.error('Record not found.'); - if (error instanceof Error) { - console.error(error.message); - } - process.exit(1); - } -} async function handleCreate(argv: Partial>, prompter: Inquirerer) { try { const rawAnswers = await prompter.prompt(argv, [ @@ -123,7 +92,10 @@ async function handleCreate(argv: Partial>, prompter: In }, ]); const answers = coerceAnswers(rawAnswers, fieldSchema); - const cleanedData = stripUndefined(answers, fieldSchema); + const cleanedData = stripUndefined( + answers, + fieldSchema + ) as CreateOrgGetSubordinatesRecordInput['orgGetSubordinatesRecord']; const client = getClient(); const result = await client.orgGetSubordinatesRecord .create({ @@ -146,83 +118,3 @@ async function handleCreate(argv: Partial>, prompter: In process.exit(1); } } -async function handleUpdate(argv: Partial>, prompter: Inquirerer) { - try { - const rawAnswers = await prompter.prompt(argv, [ - { - type: 'text', - name: 'id', - message: 'id', - required: true, - }, - { - type: 'text', - name: 'userId', - message: 'userId', - required: false, - }, - { - type: 'text', - name: 'depth', - message: 'depth', - required: false, - }, - ]); - const answers = coerceAnswers(rawAnswers, fieldSchema); - const cleanedData = stripUndefined(answers, fieldSchema); - const client = getClient(); - const result = await client.orgGetSubordinatesRecord - .update({ - where: { - id: answers.id as string, - }, - data: { - userId: cleanedData.userId, - depth: cleanedData.depth, - }, - select: { - userId: true, - depth: true, - }, - }) - .execute(); - console.log(JSON.stringify(result, null, 2)); - } catch (error) { - console.error('Failed to update record.'); - if (error instanceof Error) { - console.error(error.message); - } - process.exit(1); - } -} -async function handleDelete(argv: Partial>, prompter: Inquirerer) { - try { - const rawAnswers = await prompter.prompt(argv, [ - { - type: 'text', - name: 'id', - message: 'id', - required: true, - }, - ]); - const answers = coerceAnswers(rawAnswers, fieldSchema); - const client = getClient(); - const result = await client.orgGetSubordinatesRecord - .delete({ - where: { - id: answers.id as string, - }, - select: { - id: true, - }, - }) - .execute(); - console.log(JSON.stringify(result, null, 2)); - } catch (error) { - console.error('Failed to delete record.'); - if (error instanceof Error) { - console.error(error.message); - } - process.exit(1); - } -} diff --git a/sdk/constructive-cli/src/public/cli/commands/org-grant.ts b/sdk/constructive-cli/src/public/cli/commands/org-grant.ts index a47b2488d..27ff25e22 100644 --- a/sdk/constructive-cli/src/public/cli/commands/org-grant.ts +++ b/sdk/constructive-cli/src/public/cli/commands/org-grant.ts @@ -1,4 +1,3 @@ -// @ts-nocheck /** * CLI commands for OrgGrant * @generated by @constructive-io/graphql-codegen @@ -7,7 +6,9 @@ import { CLIOptions, Inquirerer, extractFirst } from 'inquirerer'; import { getClient } from '../executor'; import { coerceAnswers, stripUndefined } from '../utils'; -const fieldSchema = { +import type { FieldSchema } from '../utils'; +import type { CreateOrgGrantInput, OrgGrantPatch } from '../../orm/input-types'; +const fieldSchema: FieldSchema = { id: 'uuid', permissions: 'string', isGrant: 'boolean', @@ -38,7 +39,7 @@ export default async ( options: ['list', 'get', 'create', 'update', 'delete'], }, ]); - return handleTableSubcommand(answer.subcommand, newArgv, prompter); + return handleTableSubcommand(answer.subcommand as string, newArgv, prompter); } return handleTableSubcommand(subcommand, newArgv, prompter); }; @@ -102,7 +103,7 @@ async function handleGet(argv: Partial>, prompter: Inqui const client = getClient(); const result = await client.orgGrant .findOne({ - id: answers.id, + id: answers.id as string, select: { id: true, permissions: true, @@ -159,7 +160,7 @@ async function handleCreate(argv: Partial>, prompter: In }, ]); const answers = coerceAnswers(rawAnswers, fieldSchema); - const cleanedData = stripUndefined(answers, fieldSchema); + const cleanedData = stripUndefined(answers, fieldSchema) as CreateOrgGrantInput['orgGrant']; const client = getClient(); const result = await client.orgGrant .create({ @@ -232,7 +233,7 @@ async function handleUpdate(argv: Partial>, prompter: In }, ]); const answers = coerceAnswers(rawAnswers, fieldSchema); - const cleanedData = stripUndefined(answers, fieldSchema); + const cleanedData = stripUndefined(answers, fieldSchema) as OrgGrantPatch; const client = getClient(); const result = await client.orgGrant .update({ diff --git a/sdk/constructive-cli/src/public/cli/commands/org-invite.ts b/sdk/constructive-cli/src/public/cli/commands/org-invite.ts index 5d914a888..066b24be4 100644 --- a/sdk/constructive-cli/src/public/cli/commands/org-invite.ts +++ b/sdk/constructive-cli/src/public/cli/commands/org-invite.ts @@ -1,4 +1,3 @@ -// @ts-nocheck /** * CLI commands for OrgInvite * @generated by @constructive-io/graphql-codegen @@ -7,7 +6,9 @@ import { CLIOptions, Inquirerer, extractFirst } from 'inquirerer'; import { getClient } from '../executor'; import { coerceAnswers, stripUndefined } from '../utils'; -const fieldSchema = { +import type { FieldSchema } from '../utils'; +import type { CreateOrgInviteInput, OrgInvitePatch } from '../../orm/input-types'; +const fieldSchema: FieldSchema = { id: 'uuid', email: 'string', senderId: 'uuid', @@ -44,7 +45,7 @@ export default async ( options: ['list', 'get', 'create', 'update', 'delete'], }, ]); - return handleTableSubcommand(answer.subcommand, newArgv, prompter); + return handleTableSubcommand(answer.subcommand as string, newArgv, prompter); } return handleTableSubcommand(subcommand, newArgv, prompter); }; @@ -114,7 +115,7 @@ async function handleGet(argv: Partial>, prompter: Inqui const client = getClient(); const result = await client.orgInvite .findOne({ - id: answers.id, + id: answers.id as string, select: { id: true, email: true, @@ -213,7 +214,7 @@ async function handleCreate(argv: Partial>, prompter: In }, ]); const answers = coerceAnswers(rawAnswers, fieldSchema); - const cleanedData = stripUndefined(answers, fieldSchema); + const cleanedData = stripUndefined(answers, fieldSchema) as CreateOrgInviteInput['orgInvite']; const client = getClient(); const result = await client.orgInvite .create({ @@ -334,7 +335,7 @@ async function handleUpdate(argv: Partial>, prompter: In }, ]); const answers = coerceAnswers(rawAnswers, fieldSchema); - const cleanedData = stripUndefined(answers, fieldSchema); + const cleanedData = stripUndefined(answers, fieldSchema) as OrgInvitePatch; const client = getClient(); const result = await client.orgInvite .update({ diff --git a/sdk/constructive-cli/src/public/cli/commands/org-is-manager-of.ts b/sdk/constructive-cli/src/public/cli/commands/org-is-manager-of.ts index 64a2aac50..83684fede 100644 --- a/sdk/constructive-cli/src/public/cli/commands/org-is-manager-of.ts +++ b/sdk/constructive-cli/src/public/cli/commands/org-is-manager-of.ts @@ -1,4 +1,3 @@ -// @ts-nocheck /** * CLI command for query orgIsManagerOf * @generated by @constructive-io/graphql-codegen @@ -6,6 +5,7 @@ */ import { CLIOptions, Inquirerer } from 'inquirerer'; import { getClient } from '../executor'; +import type { OrgIsManagerOfVariables } from '../../orm/query'; export default async ( argv: Partial>, prompter: Inquirerer, @@ -39,7 +39,9 @@ export default async ( }, ]); const client = getClient(); - const result = await client.query.orgIsManagerOf(answers).execute(); + const result = await client.query + .orgIsManagerOf(answers as unknown as OrgIsManagerOfVariables) + .execute(); console.log(JSON.stringify(result, null, 2)); } catch (error) { console.error('Failed: orgIsManagerOf'); diff --git a/sdk/constructive-cli/src/public/cli/commands/org-limit-default.ts b/sdk/constructive-cli/src/public/cli/commands/org-limit-default.ts index ec14c8a01..88c820f50 100644 --- a/sdk/constructive-cli/src/public/cli/commands/org-limit-default.ts +++ b/sdk/constructive-cli/src/public/cli/commands/org-limit-default.ts @@ -1,4 +1,3 @@ -// @ts-nocheck /** * CLI commands for OrgLimitDefault * @generated by @constructive-io/graphql-codegen @@ -7,7 +6,9 @@ import { CLIOptions, Inquirerer, extractFirst } from 'inquirerer'; import { getClient } from '../executor'; import { coerceAnswers, stripUndefined } from '../utils'; -const fieldSchema = { +import type { FieldSchema } from '../utils'; +import type { CreateOrgLimitDefaultInput, OrgLimitDefaultPatch } from '../../orm/input-types'; +const fieldSchema: FieldSchema = { id: 'uuid', name: 'string', max: 'int', @@ -33,7 +34,7 @@ export default async ( options: ['list', 'get', 'create', 'update', 'delete'], }, ]); - return handleTableSubcommand(answer.subcommand, newArgv, prompter); + return handleTableSubcommand(answer.subcommand as string, newArgv, prompter); } return handleTableSubcommand(subcommand, newArgv, prompter); }; @@ -92,7 +93,7 @@ async function handleGet(argv: Partial>, prompter: Inqui const client = getClient(); const result = await client.orgLimitDefault .findOne({ - id: answers.id, + id: answers.id as string, select: { id: true, name: true, @@ -126,7 +127,10 @@ async function handleCreate(argv: Partial>, prompter: In }, ]); const answers = coerceAnswers(rawAnswers, fieldSchema); - const cleanedData = stripUndefined(answers, fieldSchema); + const cleanedData = stripUndefined( + answers, + fieldSchema + ) as CreateOrgLimitDefaultInput['orgLimitDefault']; const client = getClient(); const result = await client.orgLimitDefault .create({ @@ -173,7 +177,7 @@ async function handleUpdate(argv: Partial>, prompter: In }, ]); const answers = coerceAnswers(rawAnswers, fieldSchema); - const cleanedData = stripUndefined(answers, fieldSchema); + const cleanedData = stripUndefined(answers, fieldSchema) as OrgLimitDefaultPatch; const client = getClient(); const result = await client.orgLimitDefault .update({ diff --git a/sdk/constructive-cli/src/public/cli/commands/org-limit.ts b/sdk/constructive-cli/src/public/cli/commands/org-limit.ts index 2712aebed..821d1cee8 100644 --- a/sdk/constructive-cli/src/public/cli/commands/org-limit.ts +++ b/sdk/constructive-cli/src/public/cli/commands/org-limit.ts @@ -1,4 +1,3 @@ -// @ts-nocheck /** * CLI commands for OrgLimit * @generated by @constructive-io/graphql-codegen @@ -7,7 +6,9 @@ import { CLIOptions, Inquirerer, extractFirst } from 'inquirerer'; import { getClient } from '../executor'; import { coerceAnswers, stripUndefined } from '../utils'; -const fieldSchema = { +import type { FieldSchema } from '../utils'; +import type { CreateOrgLimitInput, OrgLimitPatch } from '../../orm/input-types'; +const fieldSchema: FieldSchema = { id: 'uuid', name: 'string', actorId: 'uuid', @@ -36,7 +37,7 @@ export default async ( options: ['list', 'get', 'create', 'update', 'delete'], }, ]); - return handleTableSubcommand(answer.subcommand, newArgv, prompter); + return handleTableSubcommand(answer.subcommand as string, newArgv, prompter); } return handleTableSubcommand(subcommand, newArgv, prompter); }; @@ -98,7 +99,7 @@ async function handleGet(argv: Partial>, prompter: Inqui const client = getClient(); const result = await client.orgLimit .findOne({ - id: answers.id, + id: answers.id as string, select: { id: true, name: true, @@ -153,7 +154,7 @@ async function handleCreate(argv: Partial>, prompter: In }, ]); const answers = coerceAnswers(rawAnswers, fieldSchema); - const cleanedData = stripUndefined(answers, fieldSchema); + const cleanedData = stripUndefined(answers, fieldSchema) as CreateOrgLimitInput['orgLimit']; const client = getClient(); const result = await client.orgLimit .create({ @@ -224,7 +225,7 @@ async function handleUpdate(argv: Partial>, prompter: In }, ]); const answers = coerceAnswers(rawAnswers, fieldSchema); - const cleanedData = stripUndefined(answers, fieldSchema); + const cleanedData = stripUndefined(answers, fieldSchema) as OrgLimitPatch; const client = getClient(); const result = await client.orgLimit .update({ diff --git a/sdk/constructive-cli/src/public/cli/commands/org-member.ts b/sdk/constructive-cli/src/public/cli/commands/org-member.ts index 2498d8bf2..3e5b52db8 100644 --- a/sdk/constructive-cli/src/public/cli/commands/org-member.ts +++ b/sdk/constructive-cli/src/public/cli/commands/org-member.ts @@ -1,4 +1,3 @@ -// @ts-nocheck /** * CLI commands for OrgMember * @generated by @constructive-io/graphql-codegen @@ -7,7 +6,9 @@ import { CLIOptions, Inquirerer, extractFirst } from 'inquirerer'; import { getClient } from '../executor'; import { coerceAnswers, stripUndefined } from '../utils'; -const fieldSchema = { +import type { FieldSchema } from '../utils'; +import type { CreateOrgMemberInput, OrgMemberPatch } from '../../orm/input-types'; +const fieldSchema: FieldSchema = { id: 'uuid', isAdmin: 'boolean', actorId: 'uuid', @@ -34,7 +35,7 @@ export default async ( options: ['list', 'get', 'create', 'update', 'delete'], }, ]); - return handleTableSubcommand(answer.subcommand, newArgv, prompter); + return handleTableSubcommand(answer.subcommand as string, newArgv, prompter); } return handleTableSubcommand(subcommand, newArgv, prompter); }; @@ -94,7 +95,7 @@ async function handleGet(argv: Partial>, prompter: Inqui const client = getClient(); const result = await client.orgMember .findOne({ - id: answers.id, + id: answers.id as string, select: { id: true, isAdmin: true, @@ -135,7 +136,7 @@ async function handleCreate(argv: Partial>, prompter: In }, ]); const answers = coerceAnswers(rawAnswers, fieldSchema); - const cleanedData = stripUndefined(answers, fieldSchema); + const cleanedData = stripUndefined(answers, fieldSchema) as CreateOrgMemberInput['orgMember']; const client = getClient(); const result = await client.orgMember .create({ @@ -190,7 +191,7 @@ async function handleUpdate(argv: Partial>, prompter: In }, ]); const answers = coerceAnswers(rawAnswers, fieldSchema); - const cleanedData = stripUndefined(answers, fieldSchema); + const cleanedData = stripUndefined(answers, fieldSchema) as OrgMemberPatch; const client = getClient(); const result = await client.orgMember .update({ diff --git a/sdk/constructive-cli/src/public/cli/commands/org-membership-default.ts b/sdk/constructive-cli/src/public/cli/commands/org-membership-default.ts index 779aa0e40..2b298d262 100644 --- a/sdk/constructive-cli/src/public/cli/commands/org-membership-default.ts +++ b/sdk/constructive-cli/src/public/cli/commands/org-membership-default.ts @@ -1,4 +1,3 @@ -// @ts-nocheck /** * CLI commands for OrgMembershipDefault * @generated by @constructive-io/graphql-codegen @@ -7,7 +6,12 @@ import { CLIOptions, Inquirerer, extractFirst } from 'inquirerer'; import { getClient } from '../executor'; import { coerceAnswers, stripUndefined } from '../utils'; -const fieldSchema = { +import type { FieldSchema } from '../utils'; +import type { + CreateOrgMembershipDefaultInput, + OrgMembershipDefaultPatch, +} from '../../orm/input-types'; +const fieldSchema: FieldSchema = { id: 'uuid', createdAt: 'string', updatedAt: 'string', @@ -39,7 +43,7 @@ export default async ( options: ['list', 'get', 'create', 'update', 'delete'], }, ]); - return handleTableSubcommand(answer.subcommand, newArgv, prompter); + return handleTableSubcommand(answer.subcommand as string, newArgv, prompter); } return handleTableSubcommand(subcommand, newArgv, prompter); }; @@ -104,7 +108,7 @@ async function handleGet(argv: Partial>, prompter: Inqui const client = getClient(); const result = await client.orgMembershipDefault .findOne({ - id: answers.id, + id: answers.id as string, select: { id: true, createdAt: true, @@ -168,7 +172,10 @@ async function handleCreate(argv: Partial>, prompter: In }, ]); const answers = coerceAnswers(rawAnswers, fieldSchema); - const cleanedData = stripUndefined(answers, fieldSchema); + const cleanedData = stripUndefined( + answers, + fieldSchema + ) as CreateOrgMembershipDefaultInput['orgMembershipDefault']; const client = getClient(); const result = await client.orgMembershipDefault .create({ @@ -249,7 +256,7 @@ async function handleUpdate(argv: Partial>, prompter: In }, ]); const answers = coerceAnswers(rawAnswers, fieldSchema); - const cleanedData = stripUndefined(answers, fieldSchema); + const cleanedData = stripUndefined(answers, fieldSchema) as OrgMembershipDefaultPatch; const client = getClient(); const result = await client.orgMembershipDefault .update({ diff --git a/sdk/constructive-cli/src/public/cli/commands/org-membership.ts b/sdk/constructive-cli/src/public/cli/commands/org-membership.ts index a1605b22f..9341e9407 100644 --- a/sdk/constructive-cli/src/public/cli/commands/org-membership.ts +++ b/sdk/constructive-cli/src/public/cli/commands/org-membership.ts @@ -1,4 +1,3 @@ -// @ts-nocheck /** * CLI commands for OrgMembership * @generated by @constructive-io/graphql-codegen @@ -7,7 +6,9 @@ import { CLIOptions, Inquirerer, extractFirst } from 'inquirerer'; import { getClient } from '../executor'; import { coerceAnswers, stripUndefined } from '../utils'; -const fieldSchema = { +import type { FieldSchema } from '../utils'; +import type { CreateOrgMembershipInput, OrgMembershipPatch } from '../../orm/input-types'; +const fieldSchema: FieldSchema = { id: 'uuid', createdAt: 'string', updatedAt: 'string', @@ -46,7 +47,7 @@ export default async ( options: ['list', 'get', 'create', 'update', 'delete'], }, ]); - return handleTableSubcommand(answer.subcommand, newArgv, prompter); + return handleTableSubcommand(answer.subcommand as string, newArgv, prompter); } return handleTableSubcommand(subcommand, newArgv, prompter); }; @@ -118,7 +119,7 @@ async function handleGet(argv: Partial>, prompter: Inqui const client = getClient(); const result = await client.orgMembership .findOne({ - id: answers.id, + id: answers.id as string, select: { id: true, createdAt: true, @@ -231,7 +232,10 @@ async function handleCreate(argv: Partial>, prompter: In }, ]); const answers = coerceAnswers(rawAnswers, fieldSchema); - const cleanedData = stripUndefined(answers, fieldSchema); + const cleanedData = stripUndefined( + answers, + fieldSchema + ) as CreateOrgMembershipInput['orgMembership']; const client = getClient(); const result = await client.orgMembership .create({ @@ -368,7 +372,7 @@ async function handleUpdate(argv: Partial>, prompter: In }, ]); const answers = coerceAnswers(rawAnswers, fieldSchema); - const cleanedData = stripUndefined(answers, fieldSchema); + const cleanedData = stripUndefined(answers, fieldSchema) as OrgMembershipPatch; const client = getClient(); const result = await client.orgMembership .update({ diff --git a/sdk/constructive-cli/src/public/cli/commands/org-owner-grant.ts b/sdk/constructive-cli/src/public/cli/commands/org-owner-grant.ts index 6c158fcc3..d253209cf 100644 --- a/sdk/constructive-cli/src/public/cli/commands/org-owner-grant.ts +++ b/sdk/constructive-cli/src/public/cli/commands/org-owner-grant.ts @@ -1,4 +1,3 @@ -// @ts-nocheck /** * CLI commands for OrgOwnerGrant * @generated by @constructive-io/graphql-codegen @@ -7,7 +6,9 @@ import { CLIOptions, Inquirerer, extractFirst } from 'inquirerer'; import { getClient } from '../executor'; import { coerceAnswers, stripUndefined } from '../utils'; -const fieldSchema = { +import type { FieldSchema } from '../utils'; +import type { CreateOrgOwnerGrantInput, OrgOwnerGrantPatch } from '../../orm/input-types'; +const fieldSchema: FieldSchema = { id: 'uuid', isGrant: 'boolean', actorId: 'uuid', @@ -37,7 +38,7 @@ export default async ( options: ['list', 'get', 'create', 'update', 'delete'], }, ]); - return handleTableSubcommand(answer.subcommand, newArgv, prompter); + return handleTableSubcommand(answer.subcommand as string, newArgv, prompter); } return handleTableSubcommand(subcommand, newArgv, prompter); }; @@ -100,7 +101,7 @@ async function handleGet(argv: Partial>, prompter: Inqui const client = getClient(); const result = await client.orgOwnerGrant .findOne({ - id: answers.id, + id: answers.id as string, select: { id: true, isGrant: true, @@ -150,7 +151,10 @@ async function handleCreate(argv: Partial>, prompter: In }, ]); const answers = coerceAnswers(rawAnswers, fieldSchema); - const cleanedData = stripUndefined(answers, fieldSchema); + const cleanedData = stripUndefined( + answers, + fieldSchema + ) as CreateOrgOwnerGrantInput['orgOwnerGrant']; const client = getClient(); const result = await client.orgOwnerGrant .create({ @@ -215,7 +219,7 @@ async function handleUpdate(argv: Partial>, prompter: In }, ]); const answers = coerceAnswers(rawAnswers, fieldSchema); - const cleanedData = stripUndefined(answers, fieldSchema); + const cleanedData = stripUndefined(answers, fieldSchema) as OrgOwnerGrantPatch; const client = getClient(); const result = await client.orgOwnerGrant .update({ diff --git a/sdk/constructive-cli/src/public/cli/commands/org-permission-default.ts b/sdk/constructive-cli/src/public/cli/commands/org-permission-default.ts index 67ecc9c66..8a8ead854 100644 --- a/sdk/constructive-cli/src/public/cli/commands/org-permission-default.ts +++ b/sdk/constructive-cli/src/public/cli/commands/org-permission-default.ts @@ -1,4 +1,3 @@ -// @ts-nocheck /** * CLI commands for OrgPermissionDefault * @generated by @constructive-io/graphql-codegen @@ -7,7 +6,12 @@ import { CLIOptions, Inquirerer, extractFirst } from 'inquirerer'; import { getClient } from '../executor'; import { coerceAnswers, stripUndefined } from '../utils'; -const fieldSchema = { +import type { FieldSchema } from '../utils'; +import type { + CreateOrgPermissionDefaultInput, + OrgPermissionDefaultPatch, +} from '../../orm/input-types'; +const fieldSchema: FieldSchema = { id: 'uuid', permissions: 'string', entityId: 'uuid', @@ -33,7 +37,7 @@ export default async ( options: ['list', 'get', 'create', 'update', 'delete'], }, ]); - return handleTableSubcommand(answer.subcommand, newArgv, prompter); + return handleTableSubcommand(answer.subcommand as string, newArgv, prompter); } return handleTableSubcommand(subcommand, newArgv, prompter); }; @@ -92,7 +96,7 @@ async function handleGet(argv: Partial>, prompter: Inqui const client = getClient(); const result = await client.orgPermissionDefault .findOne({ - id: answers.id, + id: answers.id as string, select: { id: true, permissions: true, @@ -126,7 +130,10 @@ async function handleCreate(argv: Partial>, prompter: In }, ]); const answers = coerceAnswers(rawAnswers, fieldSchema); - const cleanedData = stripUndefined(answers, fieldSchema); + const cleanedData = stripUndefined( + answers, + fieldSchema + ) as CreateOrgPermissionDefaultInput['orgPermissionDefault']; const client = getClient(); const result = await client.orgPermissionDefault .create({ @@ -173,7 +180,7 @@ async function handleUpdate(argv: Partial>, prompter: In }, ]); const answers = coerceAnswers(rawAnswers, fieldSchema); - const cleanedData = stripUndefined(answers, fieldSchema); + const cleanedData = stripUndefined(answers, fieldSchema) as OrgPermissionDefaultPatch; const client = getClient(); const result = await client.orgPermissionDefault .update({ diff --git a/sdk/constructive-cli/src/public/cli/commands/org-permission.ts b/sdk/constructive-cli/src/public/cli/commands/org-permission.ts index e200959be..4b94d233b 100644 --- a/sdk/constructive-cli/src/public/cli/commands/org-permission.ts +++ b/sdk/constructive-cli/src/public/cli/commands/org-permission.ts @@ -1,4 +1,3 @@ -// @ts-nocheck /** * CLI commands for OrgPermission * @generated by @constructive-io/graphql-codegen @@ -7,7 +6,9 @@ import { CLIOptions, Inquirerer, extractFirst } from 'inquirerer'; import { getClient } from '../executor'; import { coerceAnswers, stripUndefined } from '../utils'; -const fieldSchema = { +import type { FieldSchema } from '../utils'; +import type { CreateOrgPermissionInput, OrgPermissionPatch } from '../../orm/input-types'; +const fieldSchema: FieldSchema = { id: 'uuid', name: 'string', bitnum: 'int', @@ -35,7 +36,7 @@ export default async ( options: ['list', 'get', 'create', 'update', 'delete'], }, ]); - return handleTableSubcommand(answer.subcommand, newArgv, prompter); + return handleTableSubcommand(answer.subcommand as string, newArgv, prompter); } return handleTableSubcommand(subcommand, newArgv, prompter); }; @@ -96,7 +97,7 @@ async function handleGet(argv: Partial>, prompter: Inqui const client = getClient(); const result = await client.orgPermission .findOne({ - id: answers.id, + id: answers.id as string, select: { id: true, name: true, @@ -144,7 +145,10 @@ async function handleCreate(argv: Partial>, prompter: In }, ]); const answers = coerceAnswers(rawAnswers, fieldSchema); - const cleanedData = stripUndefined(answers, fieldSchema); + const cleanedData = stripUndefined( + answers, + fieldSchema + ) as CreateOrgPermissionInput['orgPermission']; const client = getClient(); const result = await client.orgPermission .create({ @@ -207,7 +211,7 @@ async function handleUpdate(argv: Partial>, prompter: In }, ]); const answers = coerceAnswers(rawAnswers, fieldSchema); - const cleanedData = stripUndefined(answers, fieldSchema); + const cleanedData = stripUndefined(answers, fieldSchema) as OrgPermissionPatch; const client = getClient(); const result = await client.orgPermission .update({ diff --git a/sdk/constructive-cli/src/public/cli/commands/org-permissions-get-by-mask.ts b/sdk/constructive-cli/src/public/cli/commands/org-permissions-get-by-mask.ts index a0fc95016..4fce871b9 100644 --- a/sdk/constructive-cli/src/public/cli/commands/org-permissions-get-by-mask.ts +++ b/sdk/constructive-cli/src/public/cli/commands/org-permissions-get-by-mask.ts @@ -1,4 +1,3 @@ -// @ts-nocheck /** * CLI command for query orgPermissionsGetByMask * @generated by @constructive-io/graphql-codegen @@ -7,6 +6,8 @@ import { CLIOptions, Inquirerer } from 'inquirerer'; import { getClient } from '../executor'; import { buildSelectFromPaths } from '../utils'; +import type { OrgPermissionsGetByMaskVariables } from '../../orm/query'; +import type { OrgPermissionConnectionSelect } from '../../orm/input-types'; export default async ( argv: Partial>, prompter: Inquirerer, @@ -43,11 +44,16 @@ export default async ( }, ]); const client = getClient(); - const selectFields = buildSelectFromPaths(argv.select ?? ''); + const selectFields = buildSelectFromPaths((argv.select as string) ?? ''); const result = await client.query - .orgPermissionsGetByMask(answers, { - select: selectFields, - }) + .orgPermissionsGetByMask( + answers as unknown as OrgPermissionsGetByMaskVariables, + { + select: selectFields, + } as unknown as { + select: OrgPermissionConnectionSelect; + } + ) .execute(); console.log(JSON.stringify(result, null, 2)); } catch (error) { diff --git a/sdk/constructive-cli/src/public/cli/commands/org-permissions-get-mask-by-names.ts b/sdk/constructive-cli/src/public/cli/commands/org-permissions-get-mask-by-names.ts index 939e6eeb0..643b68096 100644 --- a/sdk/constructive-cli/src/public/cli/commands/org-permissions-get-mask-by-names.ts +++ b/sdk/constructive-cli/src/public/cli/commands/org-permissions-get-mask-by-names.ts @@ -1,4 +1,3 @@ -// @ts-nocheck /** * CLI command for query orgPermissionsGetMaskByNames * @generated by @constructive-io/graphql-codegen @@ -6,6 +5,7 @@ */ import { CLIOptions, Inquirerer } from 'inquirerer'; import { getClient } from '../executor'; +import type { OrgPermissionsGetMaskByNamesVariables } from '../../orm/query'; export default async ( argv: Partial>, prompter: Inquirerer, @@ -26,7 +26,9 @@ export default async ( }, ]); const client = getClient(); - const result = await client.query.orgPermissionsGetMaskByNames(answers).execute(); + const result = await client.query + .orgPermissionsGetMaskByNames(answers as unknown as OrgPermissionsGetMaskByNamesVariables) + .execute(); console.log(JSON.stringify(result, null, 2)); } catch (error) { console.error('Failed: orgPermissionsGetMaskByNames'); diff --git a/sdk/constructive-cli/src/public/cli/commands/org-permissions-get-mask.ts b/sdk/constructive-cli/src/public/cli/commands/org-permissions-get-mask.ts index cd8d2731a..7045bd200 100644 --- a/sdk/constructive-cli/src/public/cli/commands/org-permissions-get-mask.ts +++ b/sdk/constructive-cli/src/public/cli/commands/org-permissions-get-mask.ts @@ -1,4 +1,3 @@ -// @ts-nocheck /** * CLI command for query orgPermissionsGetMask * @generated by @constructive-io/graphql-codegen @@ -6,6 +5,7 @@ */ import { CLIOptions, Inquirerer } from 'inquirerer'; import { getClient } from '../executor'; +import type { OrgPermissionsGetMaskVariables } from '../../orm/query'; export default async ( argv: Partial>, prompter: Inquirerer, @@ -26,7 +26,9 @@ export default async ( }, ]); const client = getClient(); - const result = await client.query.orgPermissionsGetMask(answers).execute(); + const result = await client.query + .orgPermissionsGetMask(answers as unknown as OrgPermissionsGetMaskVariables) + .execute(); console.log(JSON.stringify(result, null, 2)); } catch (error) { console.error('Failed: orgPermissionsGetMask'); diff --git a/sdk/constructive-cli/src/public/cli/commands/org-permissions-get-padded-mask.ts b/sdk/constructive-cli/src/public/cli/commands/org-permissions-get-padded-mask.ts index c750f0558..1963857d2 100644 --- a/sdk/constructive-cli/src/public/cli/commands/org-permissions-get-padded-mask.ts +++ b/sdk/constructive-cli/src/public/cli/commands/org-permissions-get-padded-mask.ts @@ -1,4 +1,3 @@ -// @ts-nocheck /** * CLI command for query orgPermissionsGetPaddedMask * @generated by @constructive-io/graphql-codegen @@ -6,6 +5,7 @@ */ import { CLIOptions, Inquirerer } from 'inquirerer'; import { getClient } from '../executor'; +import type { OrgPermissionsGetPaddedMaskVariables } from '../../orm/query'; export default async ( argv: Partial>, prompter: Inquirerer, @@ -26,7 +26,9 @@ export default async ( }, ]); const client = getClient(); - const result = await client.query.orgPermissionsGetPaddedMask(answers).execute(); + const result = await client.query + .orgPermissionsGetPaddedMask(answers as unknown as OrgPermissionsGetPaddedMaskVariables) + .execute(); console.log(JSON.stringify(result, null, 2)); } catch (error) { console.error('Failed: orgPermissionsGetPaddedMask'); diff --git a/sdk/constructive-cli/src/public/cli/commands/permissions-module.ts b/sdk/constructive-cli/src/public/cli/commands/permissions-module.ts index d067835d1..bf7c5d0cf 100644 --- a/sdk/constructive-cli/src/public/cli/commands/permissions-module.ts +++ b/sdk/constructive-cli/src/public/cli/commands/permissions-module.ts @@ -1,4 +1,3 @@ -// @ts-nocheck /** * CLI commands for PermissionsModule * @generated by @constructive-io/graphql-codegen @@ -7,7 +6,9 @@ import { CLIOptions, Inquirerer, extractFirst } from 'inquirerer'; import { getClient } from '../executor'; import { coerceAnswers, stripUndefined } from '../utils'; -const fieldSchema = { +import type { FieldSchema } from '../utils'; +import type { CreatePermissionsModuleInput, PermissionsModulePatch } from '../../orm/input-types'; +const fieldSchema: FieldSchema = { id: 'uuid', databaseId: 'uuid', schemaId: 'uuid', @@ -47,7 +48,7 @@ export default async ( options: ['list', 'get', 'create', 'update', 'delete'], }, ]); - return handleTableSubcommand(answer.subcommand, newArgv, prompter); + return handleTableSubcommand(answer.subcommand as string, newArgv, prompter); } return handleTableSubcommand(subcommand, newArgv, prompter); }; @@ -120,7 +121,7 @@ async function handleGet(argv: Partial>, prompter: Inqui const client = getClient(); const result = await client.permissionsModule .findOne({ - id: answers.id, + id: answers.id as string, select: { id: true, databaseId: true, @@ -252,7 +253,10 @@ async function handleCreate(argv: Partial>, prompter: In }, ]); const answers = coerceAnswers(rawAnswers, fieldSchema); - const cleanedData = stripUndefined(answers, fieldSchema); + const cleanedData = stripUndefined( + answers, + fieldSchema + ) as CreatePermissionsModuleInput['permissionsModule']; const client = getClient(); const result = await client.permissionsModule .create({ @@ -411,7 +415,7 @@ async function handleUpdate(argv: Partial>, prompter: In }, ]); const answers = coerceAnswers(rawAnswers, fieldSchema); - const cleanedData = stripUndefined(answers, fieldSchema); + const cleanedData = stripUndefined(answers, fieldSchema) as PermissionsModulePatch; const client = getClient(); const result = await client.permissionsModule .update({ diff --git a/sdk/constructive-cli/src/public/cli/commands/phone-number.ts b/sdk/constructive-cli/src/public/cli/commands/phone-number.ts index 092c6422f..1645c15fa 100644 --- a/sdk/constructive-cli/src/public/cli/commands/phone-number.ts +++ b/sdk/constructive-cli/src/public/cli/commands/phone-number.ts @@ -1,4 +1,3 @@ -// @ts-nocheck /** * CLI commands for PhoneNumber * @generated by @constructive-io/graphql-codegen @@ -7,7 +6,9 @@ import { CLIOptions, Inquirerer, extractFirst } from 'inquirerer'; import { getClient } from '../executor'; import { coerceAnswers, stripUndefined } from '../utils'; -const fieldSchema = { +import type { FieldSchema } from '../utils'; +import type { CreatePhoneNumberInput, PhoneNumberPatch } from '../../orm/input-types'; +const fieldSchema: FieldSchema = { id: 'uuid', ownerId: 'uuid', cc: 'string', @@ -38,7 +39,7 @@ export default async ( options: ['list', 'get', 'create', 'update', 'delete'], }, ]); - return handleTableSubcommand(answer.subcommand, newArgv, prompter); + return handleTableSubcommand(answer.subcommand as string, newArgv, prompter); } return handleTableSubcommand(subcommand, newArgv, prompter); }; @@ -102,7 +103,7 @@ async function handleGet(argv: Partial>, prompter: Inqui const client = getClient(); const result = await client.phoneNumber .findOne({ - id: answers.id, + id: answers.id as string, select: { id: true, ownerId: true, @@ -159,7 +160,10 @@ async function handleCreate(argv: Partial>, prompter: In }, ]); const answers = coerceAnswers(rawAnswers, fieldSchema); - const cleanedData = stripUndefined(answers, fieldSchema); + const cleanedData = stripUndefined( + answers, + fieldSchema + ) as CreatePhoneNumberInput['phoneNumber']; const client = getClient(); const result = await client.phoneNumber .create({ @@ -232,7 +236,7 @@ async function handleUpdate(argv: Partial>, prompter: In }, ]); const answers = coerceAnswers(rawAnswers, fieldSchema); - const cleanedData = stripUndefined(answers, fieldSchema); + const cleanedData = stripUndefined(answers, fieldSchema) as PhoneNumberPatch; const client = getClient(); const result = await client.phoneNumber .update({ diff --git a/sdk/constructive-cli/src/public/cli/commands/phone-numbers-module.ts b/sdk/constructive-cli/src/public/cli/commands/phone-numbers-module.ts index c1378334b..79ab7ad1a 100644 --- a/sdk/constructive-cli/src/public/cli/commands/phone-numbers-module.ts +++ b/sdk/constructive-cli/src/public/cli/commands/phone-numbers-module.ts @@ -1,4 +1,3 @@ -// @ts-nocheck /** * CLI commands for PhoneNumbersModule * @generated by @constructive-io/graphql-codegen @@ -7,7 +6,9 @@ import { CLIOptions, Inquirerer, extractFirst } from 'inquirerer'; import { getClient } from '../executor'; import { coerceAnswers, stripUndefined } from '../utils'; -const fieldSchema = { +import type { FieldSchema } from '../utils'; +import type { CreatePhoneNumbersModuleInput, PhoneNumbersModulePatch } from '../../orm/input-types'; +const fieldSchema: FieldSchema = { id: 'uuid', databaseId: 'uuid', schemaId: 'uuid', @@ -37,7 +38,7 @@ export default async ( options: ['list', 'get', 'create', 'update', 'delete'], }, ]); - return handleTableSubcommand(answer.subcommand, newArgv, prompter); + return handleTableSubcommand(answer.subcommand as string, newArgv, prompter); } return handleTableSubcommand(subcommand, newArgv, prompter); }; @@ -100,7 +101,7 @@ async function handleGet(argv: Partial>, prompter: Inqui const client = getClient(); const result = await client.phoneNumbersModule .findOne({ - id: answers.id, + id: answers.id as string, select: { id: true, databaseId: true, @@ -162,7 +163,10 @@ async function handleCreate(argv: Partial>, prompter: In }, ]); const answers = coerceAnswers(rawAnswers, fieldSchema); - const cleanedData = stripUndefined(answers, fieldSchema); + const cleanedData = stripUndefined( + answers, + fieldSchema + ) as CreatePhoneNumbersModuleInput['phoneNumbersModule']; const client = getClient(); const result = await client.phoneNumbersModule .create({ @@ -241,7 +245,7 @@ async function handleUpdate(argv: Partial>, prompter: In }, ]); const answers = coerceAnswers(rawAnswers, fieldSchema); - const cleanedData = stripUndefined(answers, fieldSchema); + const cleanedData = stripUndefined(answers, fieldSchema) as PhoneNumbersModulePatch; const client = getClient(); const result = await client.phoneNumbersModule .update({ diff --git a/sdk/constructive-cli/src/public/cli/commands/policy.ts b/sdk/constructive-cli/src/public/cli/commands/policy.ts index e9ea868af..b60e690e4 100644 --- a/sdk/constructive-cli/src/public/cli/commands/policy.ts +++ b/sdk/constructive-cli/src/public/cli/commands/policy.ts @@ -1,4 +1,3 @@ -// @ts-nocheck /** * CLI commands for Policy * @generated by @constructive-io/graphql-codegen @@ -7,7 +6,9 @@ import { CLIOptions, Inquirerer, extractFirst } from 'inquirerer'; import { getClient } from '../executor'; import { coerceAnswers, stripUndefined } from '../utils'; -const fieldSchema = { +import type { FieldSchema } from '../utils'; +import type { CreatePolicyInput, PolicyPatch } from '../../orm/input-types'; +const fieldSchema: FieldSchema = { id: 'uuid', databaseId: 'uuid', tableId: 'uuid', @@ -47,7 +48,7 @@ export default async ( options: ['list', 'get', 'create', 'update', 'delete'], }, ]); - return handleTableSubcommand(answer.subcommand, newArgv, prompter); + return handleTableSubcommand(answer.subcommand as string, newArgv, prompter); } return handleTableSubcommand(subcommand, newArgv, prompter); }; @@ -120,7 +121,7 @@ async function handleGet(argv: Partial>, prompter: Inqui const client = getClient(); const result = await client.policy .findOne({ - id: answers.id, + id: answers.id as string, select: { id: true, databaseId: true, @@ -240,7 +241,7 @@ async function handleCreate(argv: Partial>, prompter: In }, ]); const answers = coerceAnswers(rawAnswers, fieldSchema); - const cleanedData = stripUndefined(answers, fieldSchema); + const cleanedData = stripUndefined(answers, fieldSchema) as CreatePolicyInput['policy']; const client = getClient(); const result = await client.policy .create({ @@ -385,7 +386,7 @@ async function handleUpdate(argv: Partial>, prompter: In }, ]); const answers = coerceAnswers(rawAnswers, fieldSchema); - const cleanedData = stripUndefined(answers, fieldSchema); + const cleanedData = stripUndefined(answers, fieldSchema) as PolicyPatch; const client = getClient(); const result = await client.policy .update({ diff --git a/sdk/constructive-cli/src/public/cli/commands/primary-key-constraint.ts b/sdk/constructive-cli/src/public/cli/commands/primary-key-constraint.ts index 9eed98e4d..2fe4956b4 100644 --- a/sdk/constructive-cli/src/public/cli/commands/primary-key-constraint.ts +++ b/sdk/constructive-cli/src/public/cli/commands/primary-key-constraint.ts @@ -1,4 +1,3 @@ -// @ts-nocheck /** * CLI commands for PrimaryKeyConstraint * @generated by @constructive-io/graphql-codegen @@ -7,7 +6,12 @@ import { CLIOptions, Inquirerer, extractFirst } from 'inquirerer'; import { getClient } from '../executor'; import { coerceAnswers, stripUndefined } from '../utils'; -const fieldSchema = { +import type { FieldSchema } from '../utils'; +import type { + CreatePrimaryKeyConstraintInput, + PrimaryKeyConstraintPatch, +} from '../../orm/input-types'; +const fieldSchema: FieldSchema = { id: 'uuid', databaseId: 'uuid', tableId: 'uuid', @@ -43,7 +47,7 @@ export default async ( options: ['list', 'get', 'create', 'update', 'delete'], }, ]); - return handleTableSubcommand(answer.subcommand, newArgv, prompter); + return handleTableSubcommand(answer.subcommand as string, newArgv, prompter); } return handleTableSubcommand(subcommand, newArgv, prompter); }; @@ -112,7 +116,7 @@ async function handleGet(argv: Partial>, prompter: Inqui const client = getClient(); const result = await client.primaryKeyConstraint .findOne({ - id: answers.id, + id: answers.id as string, select: { id: true, databaseId: true, @@ -204,7 +208,10 @@ async function handleCreate(argv: Partial>, prompter: In }, ]); const answers = coerceAnswers(rawAnswers, fieldSchema); - const cleanedData = stripUndefined(answers, fieldSchema); + const cleanedData = stripUndefined( + answers, + fieldSchema + ) as CreatePrimaryKeyConstraintInput['primaryKeyConstraint']; const client = getClient(); const result = await client.primaryKeyConstraint .create({ @@ -317,7 +324,7 @@ async function handleUpdate(argv: Partial>, prompter: In }, ]); const answers = coerceAnswers(rawAnswers, fieldSchema); - const cleanedData = stripUndefined(answers, fieldSchema); + const cleanedData = stripUndefined(answers, fieldSchema) as PrimaryKeyConstraintPatch; const client = getClient(); const result = await client.primaryKeyConstraint .update({ diff --git a/sdk/constructive-cli/src/public/cli/commands/profiles-module.ts b/sdk/constructive-cli/src/public/cli/commands/profiles-module.ts index 517ffb705..2071b2dbc 100644 --- a/sdk/constructive-cli/src/public/cli/commands/profiles-module.ts +++ b/sdk/constructive-cli/src/public/cli/commands/profiles-module.ts @@ -1,4 +1,3 @@ -// @ts-nocheck /** * CLI commands for ProfilesModule * @generated by @constructive-io/graphql-codegen @@ -7,7 +6,9 @@ import { CLIOptions, Inquirerer, extractFirst } from 'inquirerer'; import { getClient } from '../executor'; import { coerceAnswers, stripUndefined } from '../utils'; -const fieldSchema = { +import type { FieldSchema } from '../utils'; +import type { CreateProfilesModuleInput, ProfilesModulePatch } from '../../orm/input-types'; +const fieldSchema: FieldSchema = { id: 'uuid', databaseId: 'uuid', schemaId: 'uuid', @@ -48,7 +49,7 @@ export default async ( options: ['list', 'get', 'create', 'update', 'delete'], }, ]); - return handleTableSubcommand(answer.subcommand, newArgv, prompter); + return handleTableSubcommand(answer.subcommand as string, newArgv, prompter); } return handleTableSubcommand(subcommand, newArgv, prompter); }; @@ -122,7 +123,7 @@ async function handleGet(argv: Partial>, prompter: Inqui const client = getClient(); const result = await client.profilesModule .findOne({ - id: answers.id, + id: answers.id as string, select: { id: true, databaseId: true, @@ -261,7 +262,10 @@ async function handleCreate(argv: Partial>, prompter: In }, ]); const answers = coerceAnswers(rawAnswers, fieldSchema); - const cleanedData = stripUndefined(answers, fieldSchema); + const cleanedData = stripUndefined( + answers, + fieldSchema + ) as CreateProfilesModuleInput['profilesModule']; const client = getClient(); const result = await client.profilesModule .create({ @@ -428,7 +432,7 @@ async function handleUpdate(argv: Partial>, prompter: In }, ]); const answers = coerceAnswers(rawAnswers, fieldSchema); - const cleanedData = stripUndefined(answers, fieldSchema); + const cleanedData = stripUndefined(answers, fieldSchema) as ProfilesModulePatch; const client = getClient(); const result = await client.profilesModule .update({ diff --git a/sdk/constructive-cli/src/public/cli/commands/provision-database-with-user.ts b/sdk/constructive-cli/src/public/cli/commands/provision-database-with-user.ts index 2c44920cb..95dfb049d 100644 --- a/sdk/constructive-cli/src/public/cli/commands/provision-database-with-user.ts +++ b/sdk/constructive-cli/src/public/cli/commands/provision-database-with-user.ts @@ -1,4 +1,3 @@ -// @ts-nocheck /** * CLI command for mutation provisionDatabaseWithUser * @generated by @constructive-io/graphql-codegen @@ -7,6 +6,8 @@ import { CLIOptions, Inquirerer } from 'inquirerer'; import { getClient } from '../executor'; import { parseMutationInput, buildSelectFromPaths } from '../utils'; +import type { ProvisionDatabaseWithUserVariables } from '../../orm/mutation'; +import type { ProvisionDatabaseWithUserPayloadSelect } from '../../orm/input-types'; export default async ( argv: Partial>, prompter: Inquirerer, @@ -30,11 +31,16 @@ export default async ( ]); const client = getClient(); const parsedAnswers = parseMutationInput(answers); - const selectFields = buildSelectFromPaths(argv.select ?? 'clientMutationId'); + const selectFields = buildSelectFromPaths((argv.select as string) ?? 'clientMutationId'); const result = await client.mutation - .provisionDatabaseWithUser(parsedAnswers, { - select: selectFields, - }) + .provisionDatabaseWithUser( + parsedAnswers as unknown as ProvisionDatabaseWithUserVariables, + { + select: selectFields, + } as unknown as { + select: ProvisionDatabaseWithUserPayloadSelect; + } + ) .execute(); console.log(JSON.stringify(result, null, 2)); } catch (error) { diff --git a/sdk/constructive-cli/src/public/cli/commands/ref.ts b/sdk/constructive-cli/src/public/cli/commands/ref.ts index 122e07f1c..5eaa605d8 100644 --- a/sdk/constructive-cli/src/public/cli/commands/ref.ts +++ b/sdk/constructive-cli/src/public/cli/commands/ref.ts @@ -1,4 +1,3 @@ -// @ts-nocheck /** * CLI commands for Ref * @generated by @constructive-io/graphql-codegen @@ -7,7 +6,9 @@ import { CLIOptions, Inquirerer, extractFirst } from 'inquirerer'; import { getClient } from '../executor'; import { coerceAnswers, stripUndefined } from '../utils'; -const fieldSchema = { +import type { FieldSchema } from '../utils'; +import type { CreateRefInput, RefPatch } from '../../orm/input-types'; +const fieldSchema: FieldSchema = { id: 'uuid', name: 'string', databaseId: 'uuid', @@ -35,7 +36,7 @@ export default async ( options: ['list', 'get', 'create', 'update', 'delete'], }, ]); - return handleTableSubcommand(answer.subcommand, newArgv, prompter); + return handleTableSubcommand(answer.subcommand as string, newArgv, prompter); } return handleTableSubcommand(subcommand, newArgv, prompter); }; @@ -96,7 +97,7 @@ async function handleGet(argv: Partial>, prompter: Inqui const client = getClient(); const result = await client.ref .findOne({ - id: answers.id, + id: answers.id as string, select: { id: true, name: true, @@ -144,7 +145,7 @@ async function handleCreate(argv: Partial>, prompter: In }, ]); const answers = coerceAnswers(rawAnswers, fieldSchema); - const cleanedData = stripUndefined(answers, fieldSchema); + const cleanedData = stripUndefined(answers, fieldSchema) as CreateRefInput['ref']; const client = getClient(); const result = await client.ref .create({ @@ -207,7 +208,7 @@ async function handleUpdate(argv: Partial>, prompter: In }, ]); const answers = coerceAnswers(rawAnswers, fieldSchema); - const cleanedData = stripUndefined(answers, fieldSchema); + const cleanedData = stripUndefined(answers, fieldSchema) as RefPatch; const client = getClient(); const result = await client.ref .update({ diff --git a/sdk/constructive-cli/src/public/cli/commands/relation-provision.ts b/sdk/constructive-cli/src/public/cli/commands/relation-provision.ts index bef346c39..bacaee34c 100644 --- a/sdk/constructive-cli/src/public/cli/commands/relation-provision.ts +++ b/sdk/constructive-cli/src/public/cli/commands/relation-provision.ts @@ -1,4 +1,3 @@ -// @ts-nocheck /** * CLI commands for RelationProvision * @generated by @constructive-io/graphql-codegen @@ -7,7 +6,9 @@ import { CLIOptions, Inquirerer, extractFirst } from 'inquirerer'; import { getClient } from '../executor'; import { coerceAnswers, stripUndefined } from '../utils'; -const fieldSchema = { +import type { FieldSchema } from '../utils'; +import type { CreateRelationProvisionInput, RelationProvisionPatch } from '../../orm/input-types'; +const fieldSchema: FieldSchema = { id: 'uuid', databaseId: 'uuid', relationType: 'string', @@ -58,7 +59,7 @@ export default async ( options: ['list', 'get', 'create', 'update', 'delete'], }, ]); - return handleTableSubcommand(answer.subcommand, newArgv, prompter); + return handleTableSubcommand(answer.subcommand as string, newArgv, prompter); } return handleTableSubcommand(subcommand, newArgv, prompter); }; @@ -142,7 +143,7 @@ async function handleGet(argv: Partial>, prompter: Inqui const client = getClient(); const result = await client.relationProvision .findOne({ - id: answers.id, + id: answers.id as string, select: { id: true, databaseId: true, @@ -351,7 +352,10 @@ async function handleCreate(argv: Partial>, prompter: In }, ]); const answers = coerceAnswers(rawAnswers, fieldSchema); - const cleanedData = stripUndefined(answers, fieldSchema); + const cleanedData = stripUndefined( + answers, + fieldSchema + ) as CreateRelationProvisionInput['relationProvision']; const client = getClient(); const result = await client.relationProvision .create({ @@ -598,7 +602,7 @@ async function handleUpdate(argv: Partial>, prompter: In }, ]); const answers = coerceAnswers(rawAnswers, fieldSchema); - const cleanedData = stripUndefined(answers, fieldSchema); + const cleanedData = stripUndefined(answers, fieldSchema) as RelationProvisionPatch; const client = getClient(); const result = await client.relationProvision .update({ diff --git a/sdk/constructive-cli/src/public/cli/commands/remove-node-at-path.ts b/sdk/constructive-cli/src/public/cli/commands/remove-node-at-path.ts index e1b7598ed..94fd0f628 100644 --- a/sdk/constructive-cli/src/public/cli/commands/remove-node-at-path.ts +++ b/sdk/constructive-cli/src/public/cli/commands/remove-node-at-path.ts @@ -1,4 +1,3 @@ -// @ts-nocheck /** * CLI command for mutation removeNodeAtPath * @generated by @constructive-io/graphql-codegen @@ -7,6 +6,8 @@ import { CLIOptions, Inquirerer } from 'inquirerer'; import { getClient } from '../executor'; import { parseMutationInput, buildSelectFromPaths } from '../utils'; +import type { RemoveNodeAtPathVariables } from '../../orm/mutation'; +import type { RemoveNodeAtPathPayloadSelect } from '../../orm/input-types'; export default async ( argv: Partial>, prompter: Inquirerer, @@ -30,11 +31,16 @@ export default async ( ]); const client = getClient(); const parsedAnswers = parseMutationInput(answers); - const selectFields = buildSelectFromPaths(argv.select ?? 'clientMutationId'); + const selectFields = buildSelectFromPaths((argv.select as string) ?? 'clientMutationId'); const result = await client.mutation - .removeNodeAtPath(parsedAnswers, { - select: selectFields, - }) + .removeNodeAtPath( + parsedAnswers as unknown as RemoveNodeAtPathVariables, + { + select: selectFields, + } as unknown as { + select: RemoveNodeAtPathPayloadSelect; + } + ) .execute(); console.log(JSON.stringify(result, null, 2)); } catch (error) { diff --git a/sdk/constructive-cli/src/public/cli/commands/reset-password.ts b/sdk/constructive-cli/src/public/cli/commands/reset-password.ts index 480f76fbe..58086bdcc 100644 --- a/sdk/constructive-cli/src/public/cli/commands/reset-password.ts +++ b/sdk/constructive-cli/src/public/cli/commands/reset-password.ts @@ -1,4 +1,3 @@ -// @ts-nocheck /** * CLI command for mutation resetPassword * @generated by @constructive-io/graphql-codegen @@ -7,6 +6,8 @@ import { CLIOptions, Inquirerer } from 'inquirerer'; import { getClient } from '../executor'; import { parseMutationInput, buildSelectFromPaths } from '../utils'; +import type { ResetPasswordVariables } from '../../orm/mutation'; +import type { ResetPasswordPayloadSelect } from '../../orm/input-types'; export default async ( argv: Partial>, prompter: Inquirerer, @@ -28,11 +29,16 @@ export default async ( ]); const client = getClient(); const parsedAnswers = parseMutationInput(answers); - const selectFields = buildSelectFromPaths(argv.select ?? 'clientMutationId'); + const selectFields = buildSelectFromPaths((argv.select as string) ?? 'clientMutationId'); const result = await client.mutation - .resetPassword(parsedAnswers, { - select: selectFields, - }) + .resetPassword( + parsedAnswers as unknown as ResetPasswordVariables, + { + select: selectFields, + } as unknown as { + select: ResetPasswordPayloadSelect; + } + ) .execute(); console.log(JSON.stringify(result, null, 2)); } catch (error) { diff --git a/sdk/constructive-cli/src/public/cli/commands/rev-parse.ts b/sdk/constructive-cli/src/public/cli/commands/rev-parse.ts index 28cc403fd..302b86962 100644 --- a/sdk/constructive-cli/src/public/cli/commands/rev-parse.ts +++ b/sdk/constructive-cli/src/public/cli/commands/rev-parse.ts @@ -1,4 +1,3 @@ -// @ts-nocheck /** * CLI command for query revParse * @generated by @constructive-io/graphql-codegen @@ -6,6 +5,7 @@ */ import { CLIOptions, Inquirerer } from 'inquirerer'; import { getClient } from '../executor'; +import type { RevParseVariables } from '../../orm/query'; export default async ( argv: Partial>, prompter: Inquirerer, @@ -34,7 +34,7 @@ export default async ( }, ]); const client = getClient(); - const result = await client.query.revParse(answers).execute(); + const result = await client.query.revParse(answers as unknown as RevParseVariables).execute(); console.log(JSON.stringify(result, null, 2)); } catch (error) { console.error('Failed: revParse'); diff --git a/sdk/constructive-cli/src/public/cli/commands/rls-module.ts b/sdk/constructive-cli/src/public/cli/commands/rls-module.ts index d29d522f5..003beb4d6 100644 --- a/sdk/constructive-cli/src/public/cli/commands/rls-module.ts +++ b/sdk/constructive-cli/src/public/cli/commands/rls-module.ts @@ -1,4 +1,3 @@ -// @ts-nocheck /** * CLI commands for RlsModule * @generated by @constructive-io/graphql-codegen @@ -7,7 +6,9 @@ import { CLIOptions, Inquirerer, extractFirst } from 'inquirerer'; import { getClient } from '../executor'; import { coerceAnswers, stripUndefined } from '../utils'; -const fieldSchema = { +import type { FieldSchema } from '../utils'; +import type { CreateRlsModuleInput, RlsModulePatch } from '../../orm/input-types'; +const fieldSchema: FieldSchema = { id: 'uuid', databaseId: 'uuid', apiId: 'uuid', @@ -42,7 +43,7 @@ export default async ( options: ['list', 'get', 'create', 'update', 'delete'], }, ]); - return handleTableSubcommand(answer.subcommand, newArgv, prompter); + return handleTableSubcommand(answer.subcommand as string, newArgv, prompter); } return handleTableSubcommand(subcommand, newArgv, prompter); }; @@ -110,7 +111,7 @@ async function handleGet(argv: Partial>, prompter: Inqui const client = getClient(); const result = await client.rlsModule .findOne({ - id: answers.id, + id: answers.id as string, select: { id: true, databaseId: true, @@ -207,7 +208,7 @@ async function handleCreate(argv: Partial>, prompter: In }, ]); const answers = coerceAnswers(rawAnswers, fieldSchema); - const cleanedData = stripUndefined(answers, fieldSchema); + const cleanedData = stripUndefined(answers, fieldSchema) as CreateRlsModuleInput['rlsModule']; const client = getClient(); const result = await client.rlsModule .create({ @@ -326,7 +327,7 @@ async function handleUpdate(argv: Partial>, prompter: In }, ]); const answers = coerceAnswers(rawAnswers, fieldSchema); - const cleanedData = stripUndefined(answers, fieldSchema); + const cleanedData = stripUndefined(answers, fieldSchema) as RlsModulePatch; const client = getClient(); const result = await client.rlsModule .update({ diff --git a/sdk/constructive-cli/src/public/cli/commands/role-type.ts b/sdk/constructive-cli/src/public/cli/commands/role-type.ts index 9c170c8f6..dc6e319c0 100644 --- a/sdk/constructive-cli/src/public/cli/commands/role-type.ts +++ b/sdk/constructive-cli/src/public/cli/commands/role-type.ts @@ -1,4 +1,3 @@ -// @ts-nocheck /** * CLI commands for RoleType * @generated by @constructive-io/graphql-codegen @@ -7,7 +6,9 @@ import { CLIOptions, Inquirerer, extractFirst } from 'inquirerer'; import { getClient } from '../executor'; import { coerceAnswers, stripUndefined } from '../utils'; -const fieldSchema = { +import type { FieldSchema } from '../utils'; +import type { CreateRoleTypeInput, RoleTypePatch } from '../../orm/input-types'; +const fieldSchema: FieldSchema = { id: 'int', name: 'string', }; @@ -32,7 +33,7 @@ export default async ( options: ['list', 'get', 'create', 'update', 'delete'], }, ]); - return handleTableSubcommand(answer.subcommand, newArgv, prompter); + return handleTableSubcommand(answer.subcommand as string, newArgv, prompter); } return handleTableSubcommand(subcommand, newArgv, prompter); }; @@ -90,7 +91,7 @@ async function handleGet(argv: Partial>, prompter: Inqui const client = getClient(); const result = await client.roleType .findOne({ - id: answers.id, + id: answers.id as number, select: { id: true, name: true, @@ -117,7 +118,7 @@ async function handleCreate(argv: Partial>, prompter: In }, ]); const answers = coerceAnswers(rawAnswers, fieldSchema); - const cleanedData = stripUndefined(answers, fieldSchema); + const cleanedData = stripUndefined(answers, fieldSchema) as CreateRoleTypeInput['roleType']; const client = getClient(); const result = await client.roleType .create({ @@ -156,12 +157,12 @@ async function handleUpdate(argv: Partial>, prompter: In }, ]); const answers = coerceAnswers(rawAnswers, fieldSchema); - const cleanedData = stripUndefined(answers, fieldSchema); + const cleanedData = stripUndefined(answers, fieldSchema) as RoleTypePatch; const client = getClient(); const result = await client.roleType .update({ where: { - id: answers.id as string, + id: answers.id as number, }, data: { name: cleanedData.name, @@ -196,7 +197,7 @@ async function handleDelete(argv: Partial>, prompter: In const result = await client.roleType .delete({ where: { - id: answers.id as string, + id: answers.id as number, }, select: { id: true, diff --git a/sdk/constructive-cli/src/public/cli/commands/schema-grant.ts b/sdk/constructive-cli/src/public/cli/commands/schema-grant.ts index 12720a2e2..b9dcfc5ea 100644 --- a/sdk/constructive-cli/src/public/cli/commands/schema-grant.ts +++ b/sdk/constructive-cli/src/public/cli/commands/schema-grant.ts @@ -1,4 +1,3 @@ -// @ts-nocheck /** * CLI commands for SchemaGrant * @generated by @constructive-io/graphql-codegen @@ -7,7 +6,9 @@ import { CLIOptions, Inquirerer, extractFirst } from 'inquirerer'; import { getClient } from '../executor'; import { coerceAnswers, stripUndefined } from '../utils'; -const fieldSchema = { +import type { FieldSchema } from '../utils'; +import type { CreateSchemaGrantInput, SchemaGrantPatch } from '../../orm/input-types'; +const fieldSchema: FieldSchema = { id: 'uuid', databaseId: 'uuid', schemaId: 'uuid', @@ -36,7 +37,7 @@ export default async ( options: ['list', 'get', 'create', 'update', 'delete'], }, ]); - return handleTableSubcommand(answer.subcommand, newArgv, prompter); + return handleTableSubcommand(answer.subcommand as string, newArgv, prompter); } return handleTableSubcommand(subcommand, newArgv, prompter); }; @@ -98,7 +99,7 @@ async function handleGet(argv: Partial>, prompter: Inqui const client = getClient(); const result = await client.schemaGrant .findOne({ - id: answers.id, + id: answers.id as string, select: { id: true, databaseId: true, @@ -141,7 +142,10 @@ async function handleCreate(argv: Partial>, prompter: In }, ]); const answers = coerceAnswers(rawAnswers, fieldSchema); - const cleanedData = stripUndefined(answers, fieldSchema); + const cleanedData = stripUndefined( + answers, + fieldSchema + ) as CreateSchemaGrantInput['schemaGrant']; const client = getClient(); const result = await client.schemaGrant .create({ @@ -198,7 +202,7 @@ async function handleUpdate(argv: Partial>, prompter: In }, ]); const answers = coerceAnswers(rawAnswers, fieldSchema); - const cleanedData = stripUndefined(answers, fieldSchema); + const cleanedData = stripUndefined(answers, fieldSchema) as SchemaGrantPatch; const client = getClient(); const result = await client.schemaGrant .update({ diff --git a/sdk/constructive-cli/src/public/cli/commands/schema.ts b/sdk/constructive-cli/src/public/cli/commands/schema.ts index f42a22e9a..162dbc671 100644 --- a/sdk/constructive-cli/src/public/cli/commands/schema.ts +++ b/sdk/constructive-cli/src/public/cli/commands/schema.ts @@ -1,4 +1,3 @@ -// @ts-nocheck /** * CLI commands for Schema * @generated by @constructive-io/graphql-codegen @@ -7,7 +6,9 @@ import { CLIOptions, Inquirerer, extractFirst } from 'inquirerer'; import { getClient } from '../executor'; import { coerceAnswers, stripUndefined } from '../utils'; -const fieldSchema = { +import type { FieldSchema } from '../utils'; +import type { CreateSchemaInput, SchemaPatch } from '../../orm/input-types'; +const fieldSchema: FieldSchema = { id: 'uuid', databaseId: 'uuid', name: 'string', @@ -44,7 +45,7 @@ export default async ( options: ['list', 'get', 'create', 'update', 'delete'], }, ]); - return handleTableSubcommand(answer.subcommand, newArgv, prompter); + return handleTableSubcommand(answer.subcommand as string, newArgv, prompter); } return handleTableSubcommand(subcommand, newArgv, prompter); }; @@ -114,7 +115,7 @@ async function handleGet(argv: Partial>, prompter: Inqui const client = getClient(); const result = await client.schema .findOne({ - id: answers.id, + id: answers.id as string, select: { id: true, databaseId: true, @@ -213,7 +214,7 @@ async function handleCreate(argv: Partial>, prompter: In }, ]); const answers = coerceAnswers(rawAnswers, fieldSchema); - const cleanedData = stripUndefined(answers, fieldSchema); + const cleanedData = stripUndefined(answers, fieldSchema) as CreateSchemaInput['schema']; const client = getClient(); const result = await client.schema .create({ @@ -334,7 +335,7 @@ async function handleUpdate(argv: Partial>, prompter: In }, ]); const answers = coerceAnswers(rawAnswers, fieldSchema); - const cleanedData = stripUndefined(answers, fieldSchema); + const cleanedData = stripUndefined(answers, fieldSchema) as SchemaPatch; const client = getClient(); const result = await client.schema .update({ diff --git a/sdk/constructive-cli/src/public/cli/commands/secrets-module.ts b/sdk/constructive-cli/src/public/cli/commands/secrets-module.ts index c6b21d012..3edacaa38 100644 --- a/sdk/constructive-cli/src/public/cli/commands/secrets-module.ts +++ b/sdk/constructive-cli/src/public/cli/commands/secrets-module.ts @@ -1,4 +1,3 @@ -// @ts-nocheck /** * CLI commands for SecretsModule * @generated by @constructive-io/graphql-codegen @@ -7,7 +6,9 @@ import { CLIOptions, Inquirerer, extractFirst } from 'inquirerer'; import { getClient } from '../executor'; import { coerceAnswers, stripUndefined } from '../utils'; -const fieldSchema = { +import type { FieldSchema } from '../utils'; +import type { CreateSecretsModuleInput, SecretsModulePatch } from '../../orm/input-types'; +const fieldSchema: FieldSchema = { id: 'uuid', databaseId: 'uuid', schemaId: 'uuid', @@ -35,7 +36,7 @@ export default async ( options: ['list', 'get', 'create', 'update', 'delete'], }, ]); - return handleTableSubcommand(answer.subcommand, newArgv, prompter); + return handleTableSubcommand(answer.subcommand as string, newArgv, prompter); } return handleTableSubcommand(subcommand, newArgv, prompter); }; @@ -96,7 +97,7 @@ async function handleGet(argv: Partial>, prompter: Inqui const client = getClient(); const result = await client.secretsModule .findOne({ - id: answers.id, + id: answers.id as string, select: { id: true, databaseId: true, @@ -144,7 +145,10 @@ async function handleCreate(argv: Partial>, prompter: In }, ]); const answers = coerceAnswers(rawAnswers, fieldSchema); - const cleanedData = stripUndefined(answers, fieldSchema); + const cleanedData = stripUndefined( + answers, + fieldSchema + ) as CreateSecretsModuleInput['secretsModule']; const client = getClient(); const result = await client.secretsModule .create({ @@ -207,7 +211,7 @@ async function handleUpdate(argv: Partial>, prompter: In }, ]); const answers = coerceAnswers(rawAnswers, fieldSchema); - const cleanedData = stripUndefined(answers, fieldSchema); + const cleanedData = stripUndefined(answers, fieldSchema) as SecretsModulePatch; const client = getClient(); const result = await client.secretsModule .update({ diff --git a/sdk/constructive-cli/src/public/cli/commands/secure-table-provision.ts b/sdk/constructive-cli/src/public/cli/commands/secure-table-provision.ts index bef1ae68c..d703afd52 100644 --- a/sdk/constructive-cli/src/public/cli/commands/secure-table-provision.ts +++ b/sdk/constructive-cli/src/public/cli/commands/secure-table-provision.ts @@ -1,4 +1,3 @@ -// @ts-nocheck /** * CLI commands for SecureTableProvision * @generated by @constructive-io/graphql-codegen @@ -7,7 +6,12 @@ import { CLIOptions, Inquirerer, extractFirst } from 'inquirerer'; import { getClient } from '../executor'; import { coerceAnswers, stripUndefined } from '../utils'; -const fieldSchema = { +import type { FieldSchema } from '../utils'; +import type { + CreateSecureTableProvisionInput, + SecureTableProvisionPatch, +} from '../../orm/input-types'; +const fieldSchema: FieldSchema = { id: 'uuid', databaseId: 'uuid', schemaId: 'uuid', @@ -47,7 +51,7 @@ export default async ( options: ['list', 'get', 'create', 'update', 'delete'], }, ]); - return handleTableSubcommand(answer.subcommand, newArgv, prompter); + return handleTableSubcommand(answer.subcommand as string, newArgv, prompter); } return handleTableSubcommand(subcommand, newArgv, prompter); }; @@ -120,7 +124,7 @@ async function handleGet(argv: Partial>, prompter: Inqui const client = getClient(); const result = await client.secureTableProvision .findOne({ - id: answers.id, + id: answers.id as string, select: { id: true, databaseId: true, @@ -252,7 +256,10 @@ async function handleCreate(argv: Partial>, prompter: In }, ]); const answers = coerceAnswers(rawAnswers, fieldSchema); - const cleanedData = stripUndefined(answers, fieldSchema); + const cleanedData = stripUndefined( + answers, + fieldSchema + ) as CreateSecureTableProvisionInput['secureTableProvision']; const client = getClient(); const result = await client.secureTableProvision .create({ @@ -411,7 +418,7 @@ async function handleUpdate(argv: Partial>, prompter: In }, ]); const answers = coerceAnswers(rawAnswers, fieldSchema); - const cleanedData = stripUndefined(answers, fieldSchema); + const cleanedData = stripUndefined(answers, fieldSchema) as SecureTableProvisionPatch; const client = getClient(); const result = await client.secureTableProvision .update({ diff --git a/sdk/constructive-cli/src/public/cli/commands/send-account-deletion-email.ts b/sdk/constructive-cli/src/public/cli/commands/send-account-deletion-email.ts index b44a95b92..4f4e2ad15 100644 --- a/sdk/constructive-cli/src/public/cli/commands/send-account-deletion-email.ts +++ b/sdk/constructive-cli/src/public/cli/commands/send-account-deletion-email.ts @@ -1,4 +1,3 @@ -// @ts-nocheck /** * CLI command for mutation sendAccountDeletionEmail * @generated by @constructive-io/graphql-codegen @@ -7,6 +6,8 @@ import { CLIOptions, Inquirerer } from 'inquirerer'; import { getClient } from '../executor'; import { parseMutationInput, buildSelectFromPaths } from '../utils'; +import type { SendAccountDeletionEmailVariables } from '../../orm/mutation'; +import type { SendAccountDeletionEmailPayloadSelect } from '../../orm/input-types'; export default async ( argv: Partial>, prompter: Inquirerer, @@ -30,11 +31,16 @@ export default async ( ]); const client = getClient(); const parsedAnswers = parseMutationInput(answers); - const selectFields = buildSelectFromPaths(argv.select ?? 'clientMutationId'); + const selectFields = buildSelectFromPaths((argv.select as string) ?? 'clientMutationId'); const result = await client.mutation - .sendAccountDeletionEmail(parsedAnswers, { - select: selectFields, - }) + .sendAccountDeletionEmail( + parsedAnswers as unknown as SendAccountDeletionEmailVariables, + { + select: selectFields, + } as unknown as { + select: SendAccountDeletionEmailPayloadSelect; + } + ) .execute(); console.log(JSON.stringify(result, null, 2)); } catch (error) { diff --git a/sdk/constructive-cli/src/public/cli/commands/send-verification-email.ts b/sdk/constructive-cli/src/public/cli/commands/send-verification-email.ts index 73d848f9c..5a12954a7 100644 --- a/sdk/constructive-cli/src/public/cli/commands/send-verification-email.ts +++ b/sdk/constructive-cli/src/public/cli/commands/send-verification-email.ts @@ -1,4 +1,3 @@ -// @ts-nocheck /** * CLI command for mutation sendVerificationEmail * @generated by @constructive-io/graphql-codegen @@ -7,6 +6,8 @@ import { CLIOptions, Inquirerer } from 'inquirerer'; import { getClient } from '../executor'; import { parseMutationInput, buildSelectFromPaths } from '../utils'; +import type { SendVerificationEmailVariables } from '../../orm/mutation'; +import type { SendVerificationEmailPayloadSelect } from '../../orm/input-types'; export default async ( argv: Partial>, prompter: Inquirerer, @@ -30,11 +31,16 @@ export default async ( ]); const client = getClient(); const parsedAnswers = parseMutationInput(answers); - const selectFields = buildSelectFromPaths(argv.select ?? 'clientMutationId'); + const selectFields = buildSelectFromPaths((argv.select as string) ?? 'clientMutationId'); const result = await client.mutation - .sendVerificationEmail(parsedAnswers, { - select: selectFields, - }) + .sendVerificationEmail( + parsedAnswers as unknown as SendVerificationEmailVariables, + { + select: selectFields, + } as unknown as { + select: SendVerificationEmailPayloadSelect; + } + ) .execute(); console.log(JSON.stringify(result, null, 2)); } catch (error) { diff --git a/sdk/constructive-cli/src/public/cli/commands/sessions-module.ts b/sdk/constructive-cli/src/public/cli/commands/sessions-module.ts index fbe71bcab..072437802 100644 --- a/sdk/constructive-cli/src/public/cli/commands/sessions-module.ts +++ b/sdk/constructive-cli/src/public/cli/commands/sessions-module.ts @@ -1,4 +1,3 @@ -// @ts-nocheck /** * CLI commands for SessionsModule * @generated by @constructive-io/graphql-codegen @@ -7,7 +6,9 @@ import { CLIOptions, Inquirerer, extractFirst } from 'inquirerer'; import { getClient } from '../executor'; import { coerceAnswers, stripUndefined } from '../utils'; -const fieldSchema = { +import type { FieldSchema } from '../utils'; +import type { CreateSessionsModuleInput, SessionsModulePatch } from '../../orm/input-types'; +const fieldSchema: FieldSchema = { id: 'uuid', databaseId: 'uuid', schemaId: 'uuid', @@ -41,7 +42,7 @@ export default async ( options: ['list', 'get', 'create', 'update', 'delete'], }, ]); - return handleTableSubcommand(answer.subcommand, newArgv, prompter); + return handleTableSubcommand(answer.subcommand as string, newArgv, prompter); } return handleTableSubcommand(subcommand, newArgv, prompter); }; @@ -108,7 +109,7 @@ async function handleGet(argv: Partial>, prompter: Inqui const client = getClient(); const result = await client.sessionsModule .findOne({ - id: answers.id, + id: answers.id as string, select: { id: true, databaseId: true, @@ -198,7 +199,10 @@ async function handleCreate(argv: Partial>, prompter: In }, ]); const answers = coerceAnswers(rawAnswers, fieldSchema); - const cleanedData = stripUndefined(answers, fieldSchema); + const cleanedData = stripUndefined( + answers, + fieldSchema + ) as CreateSessionsModuleInput['sessionsModule']; const client = getClient(); const result = await client.sessionsModule .create({ @@ -309,7 +313,7 @@ async function handleUpdate(argv: Partial>, prompter: In }, ]); const answers = coerceAnswers(rawAnswers, fieldSchema); - const cleanedData = stripUndefined(answers, fieldSchema); + const cleanedData = stripUndefined(answers, fieldSchema) as SessionsModulePatch; const client = getClient(); const result = await client.sessionsModule .update({ diff --git a/sdk/constructive-cli/src/public/cli/commands/set-and-commit.ts b/sdk/constructive-cli/src/public/cli/commands/set-and-commit.ts index 3527c00df..c52a5c55b 100644 --- a/sdk/constructive-cli/src/public/cli/commands/set-and-commit.ts +++ b/sdk/constructive-cli/src/public/cli/commands/set-and-commit.ts @@ -1,4 +1,3 @@ -// @ts-nocheck /** * CLI command for mutation setAndCommit * @generated by @constructive-io/graphql-codegen @@ -7,6 +6,8 @@ import { CLIOptions, Inquirerer } from 'inquirerer'; import { getClient } from '../executor'; import { parseMutationInput, buildSelectFromPaths } from '../utils'; +import type { SetAndCommitVariables } from '../../orm/mutation'; +import type { SetAndCommitPayloadSelect } from '../../orm/input-types'; export default async ( argv: Partial>, prompter: Inquirerer, @@ -28,11 +29,16 @@ export default async ( ]); const client = getClient(); const parsedAnswers = parseMutationInput(answers); - const selectFields = buildSelectFromPaths(argv.select ?? 'clientMutationId'); + const selectFields = buildSelectFromPaths((argv.select as string) ?? 'clientMutationId'); const result = await client.mutation - .setAndCommit(parsedAnswers, { - select: selectFields, - }) + .setAndCommit( + parsedAnswers as unknown as SetAndCommitVariables, + { + select: selectFields, + } as unknown as { + select: SetAndCommitPayloadSelect; + } + ) .execute(); console.log(JSON.stringify(result, null, 2)); } catch (error) { diff --git a/sdk/constructive-cli/src/public/cli/commands/set-data-at-path.ts b/sdk/constructive-cli/src/public/cli/commands/set-data-at-path.ts index 562aaec04..9c379eac9 100644 --- a/sdk/constructive-cli/src/public/cli/commands/set-data-at-path.ts +++ b/sdk/constructive-cli/src/public/cli/commands/set-data-at-path.ts @@ -1,4 +1,3 @@ -// @ts-nocheck /** * CLI command for mutation setDataAtPath * @generated by @constructive-io/graphql-codegen @@ -7,6 +6,8 @@ import { CLIOptions, Inquirerer } from 'inquirerer'; import { getClient } from '../executor'; import { parseMutationInput, buildSelectFromPaths } from '../utils'; +import type { SetDataAtPathVariables } from '../../orm/mutation'; +import type { SetDataAtPathPayloadSelect } from '../../orm/input-types'; export default async ( argv: Partial>, prompter: Inquirerer, @@ -28,11 +29,16 @@ export default async ( ]); const client = getClient(); const parsedAnswers = parseMutationInput(answers); - const selectFields = buildSelectFromPaths(argv.select ?? 'clientMutationId'); + const selectFields = buildSelectFromPaths((argv.select as string) ?? 'clientMutationId'); const result = await client.mutation - .setDataAtPath(parsedAnswers, { - select: selectFields, - }) + .setDataAtPath( + parsedAnswers as unknown as SetDataAtPathVariables, + { + select: selectFields, + } as unknown as { + select: SetDataAtPathPayloadSelect; + } + ) .execute(); console.log(JSON.stringify(result, null, 2)); } catch (error) { diff --git a/sdk/constructive-cli/src/public/cli/commands/set-field-order.ts b/sdk/constructive-cli/src/public/cli/commands/set-field-order.ts index 6d5407a92..20edf472f 100644 --- a/sdk/constructive-cli/src/public/cli/commands/set-field-order.ts +++ b/sdk/constructive-cli/src/public/cli/commands/set-field-order.ts @@ -1,4 +1,3 @@ -// @ts-nocheck /** * CLI command for mutation setFieldOrder * @generated by @constructive-io/graphql-codegen @@ -7,6 +6,8 @@ import { CLIOptions, Inquirerer } from 'inquirerer'; import { getClient } from '../executor'; import { parseMutationInput, buildSelectFromPaths } from '../utils'; +import type { SetFieldOrderVariables } from '../../orm/mutation'; +import type { SetFieldOrderPayloadSelect } from '../../orm/input-types'; export default async ( argv: Partial>, prompter: Inquirerer, @@ -28,11 +29,16 @@ export default async ( ]); const client = getClient(); const parsedAnswers = parseMutationInput(answers); - const selectFields = buildSelectFromPaths(argv.select ?? 'clientMutationId'); + const selectFields = buildSelectFromPaths((argv.select as string) ?? 'clientMutationId'); const result = await client.mutation - .setFieldOrder(parsedAnswers, { - select: selectFields, - }) + .setFieldOrder( + parsedAnswers as unknown as SetFieldOrderVariables, + { + select: selectFields, + } as unknown as { + select: SetFieldOrderPayloadSelect; + } + ) .execute(); console.log(JSON.stringify(result, null, 2)); } catch (error) { diff --git a/sdk/constructive-cli/src/public/cli/commands/set-password.ts b/sdk/constructive-cli/src/public/cli/commands/set-password.ts index 9dead0903..ef6da0931 100644 --- a/sdk/constructive-cli/src/public/cli/commands/set-password.ts +++ b/sdk/constructive-cli/src/public/cli/commands/set-password.ts @@ -1,4 +1,3 @@ -// @ts-nocheck /** * CLI command for mutation setPassword * @generated by @constructive-io/graphql-codegen @@ -7,6 +6,8 @@ import { CLIOptions, Inquirerer } from 'inquirerer'; import { getClient } from '../executor'; import { parseMutationInput, buildSelectFromPaths } from '../utils'; +import type { SetPasswordVariables } from '../../orm/mutation'; +import type { SetPasswordPayloadSelect } from '../../orm/input-types'; export default async ( argv: Partial>, prompter: Inquirerer, @@ -28,11 +29,16 @@ export default async ( ]); const client = getClient(); const parsedAnswers = parseMutationInput(answers); - const selectFields = buildSelectFromPaths(argv.select ?? 'clientMutationId'); + const selectFields = buildSelectFromPaths((argv.select as string) ?? 'clientMutationId'); const result = await client.mutation - .setPassword(parsedAnswers, { - select: selectFields, - }) + .setPassword( + parsedAnswers as unknown as SetPasswordVariables, + { + select: selectFields, + } as unknown as { + select: SetPasswordPayloadSelect; + } + ) .execute(); console.log(JSON.stringify(result, null, 2)); } catch (error) { diff --git a/sdk/constructive-cli/src/public/cli/commands/set-props-and-commit.ts b/sdk/constructive-cli/src/public/cli/commands/set-props-and-commit.ts index 67f730e86..9841e10a7 100644 --- a/sdk/constructive-cli/src/public/cli/commands/set-props-and-commit.ts +++ b/sdk/constructive-cli/src/public/cli/commands/set-props-and-commit.ts @@ -1,4 +1,3 @@ -// @ts-nocheck /** * CLI command for mutation setPropsAndCommit * @generated by @constructive-io/graphql-codegen @@ -7,6 +6,8 @@ import { CLIOptions, Inquirerer } from 'inquirerer'; import { getClient } from '../executor'; import { parseMutationInput, buildSelectFromPaths } from '../utils'; +import type { SetPropsAndCommitVariables } from '../../orm/mutation'; +import type { SetPropsAndCommitPayloadSelect } from '../../orm/input-types'; export default async ( argv: Partial>, prompter: Inquirerer, @@ -30,11 +31,16 @@ export default async ( ]); const client = getClient(); const parsedAnswers = parseMutationInput(answers); - const selectFields = buildSelectFromPaths(argv.select ?? 'clientMutationId'); + const selectFields = buildSelectFromPaths((argv.select as string) ?? 'clientMutationId'); const result = await client.mutation - .setPropsAndCommit(parsedAnswers, { - select: selectFields, - }) + .setPropsAndCommit( + parsedAnswers as unknown as SetPropsAndCommitVariables, + { + select: selectFields, + } as unknown as { + select: SetPropsAndCommitPayloadSelect; + } + ) .execute(); console.log(JSON.stringify(result, null, 2)); } catch (error) { diff --git a/sdk/constructive-cli/src/public/cli/commands/sign-in-one-time-token.ts b/sdk/constructive-cli/src/public/cli/commands/sign-in-one-time-token.ts index 4683f88f8..64617736f 100644 --- a/sdk/constructive-cli/src/public/cli/commands/sign-in-one-time-token.ts +++ b/sdk/constructive-cli/src/public/cli/commands/sign-in-one-time-token.ts @@ -1,4 +1,3 @@ -// @ts-nocheck /** * CLI command for mutation signInOneTimeToken * @generated by @constructive-io/graphql-codegen @@ -7,6 +6,8 @@ import { CLIOptions, Inquirerer } from 'inquirerer'; import { getClient } from '../executor'; import { parseMutationInput, buildSelectFromPaths } from '../utils'; +import type { SignInOneTimeTokenVariables } from '../../orm/mutation'; +import type { SignInOneTimeTokenPayloadSelect } from '../../orm/input-types'; export default async ( argv: Partial>, prompter: Inquirerer, @@ -30,11 +31,16 @@ export default async ( ]); const client = getClient(); const parsedAnswers = parseMutationInput(answers); - const selectFields = buildSelectFromPaths(argv.select ?? 'clientMutationId'); + const selectFields = buildSelectFromPaths((argv.select as string) ?? 'clientMutationId'); const result = await client.mutation - .signInOneTimeToken(parsedAnswers, { - select: selectFields, - }) + .signInOneTimeToken( + parsedAnswers as unknown as SignInOneTimeTokenVariables, + { + select: selectFields, + } as unknown as { + select: SignInOneTimeTokenPayloadSelect; + } + ) .execute(); console.log(JSON.stringify(result, null, 2)); } catch (error) { diff --git a/sdk/constructive-cli/src/public/cli/commands/sign-in.ts b/sdk/constructive-cli/src/public/cli/commands/sign-in.ts index 72ea70174..5f106c0c8 100644 --- a/sdk/constructive-cli/src/public/cli/commands/sign-in.ts +++ b/sdk/constructive-cli/src/public/cli/commands/sign-in.ts @@ -1,4 +1,3 @@ -// @ts-nocheck /** * CLI command for mutation signIn * @generated by @constructive-io/graphql-codegen @@ -7,6 +6,8 @@ import { CLIOptions, Inquirerer } from 'inquirerer'; import { getClient } from '../executor'; import { parseMutationInput, buildSelectFromPaths } from '../utils'; +import type { SignInVariables } from '../../orm/mutation'; +import type { SignInPayloadSelect } from '../../orm/input-types'; export default async ( argv: Partial>, prompter: Inquirerer, @@ -28,11 +29,16 @@ export default async ( ]); const client = getClient(); const parsedAnswers = parseMutationInput(answers); - const selectFields = buildSelectFromPaths(argv.select ?? 'clientMutationId'); + const selectFields = buildSelectFromPaths((argv.select as string) ?? 'clientMutationId'); const result = await client.mutation - .signIn(parsedAnswers, { - select: selectFields, - }) + .signIn( + parsedAnswers as unknown as SignInVariables, + { + select: selectFields, + } as unknown as { + select: SignInPayloadSelect; + } + ) .execute(); console.log(JSON.stringify(result, null, 2)); } catch (error) { diff --git a/sdk/constructive-cli/src/public/cli/commands/sign-out.ts b/sdk/constructive-cli/src/public/cli/commands/sign-out.ts index 0c70f3c0d..331f6073b 100644 --- a/sdk/constructive-cli/src/public/cli/commands/sign-out.ts +++ b/sdk/constructive-cli/src/public/cli/commands/sign-out.ts @@ -1,4 +1,3 @@ -// @ts-nocheck /** * CLI command for mutation signOut * @generated by @constructive-io/graphql-codegen @@ -7,6 +6,8 @@ import { CLIOptions, Inquirerer } from 'inquirerer'; import { getClient } from '../executor'; import { parseMutationInput, buildSelectFromPaths } from '../utils'; +import type { SignOutVariables } from '../../orm/mutation'; +import type { SignOutPayloadSelect } from '../../orm/input-types'; export default async ( argv: Partial>, prompter: Inquirerer, @@ -28,11 +29,16 @@ export default async ( ]); const client = getClient(); const parsedAnswers = parseMutationInput(answers); - const selectFields = buildSelectFromPaths(argv.select ?? 'clientMutationId'); + const selectFields = buildSelectFromPaths((argv.select as string) ?? 'clientMutationId'); const result = await client.mutation - .signOut(parsedAnswers, { - select: selectFields, - }) + .signOut( + parsedAnswers as unknown as SignOutVariables, + { + select: selectFields, + } as unknown as { + select: SignOutPayloadSelect; + } + ) .execute(); console.log(JSON.stringify(result, null, 2)); } catch (error) { diff --git a/sdk/constructive-cli/src/public/cli/commands/sign-up.ts b/sdk/constructive-cli/src/public/cli/commands/sign-up.ts index afe5ade97..e5ead7b45 100644 --- a/sdk/constructive-cli/src/public/cli/commands/sign-up.ts +++ b/sdk/constructive-cli/src/public/cli/commands/sign-up.ts @@ -1,4 +1,3 @@ -// @ts-nocheck /** * CLI command for mutation signUp * @generated by @constructive-io/graphql-codegen @@ -7,6 +6,8 @@ import { CLIOptions, Inquirerer } from 'inquirerer'; import { getClient } from '../executor'; import { parseMutationInput, buildSelectFromPaths } from '../utils'; +import type { SignUpVariables } from '../../orm/mutation'; +import type { SignUpPayloadSelect } from '../../orm/input-types'; export default async ( argv: Partial>, prompter: Inquirerer, @@ -28,11 +29,16 @@ export default async ( ]); const client = getClient(); const parsedAnswers = parseMutationInput(answers); - const selectFields = buildSelectFromPaths(argv.select ?? 'clientMutationId'); + const selectFields = buildSelectFromPaths((argv.select as string) ?? 'clientMutationId'); const result = await client.mutation - .signUp(parsedAnswers, { - select: selectFields, - }) + .signUp( + parsedAnswers as unknown as SignUpVariables, + { + select: selectFields, + } as unknown as { + select: SignUpPayloadSelect; + } + ) .execute(); console.log(JSON.stringify(result, null, 2)); } catch (error) { diff --git a/sdk/constructive-cli/src/public/cli/commands/site-metadatum.ts b/sdk/constructive-cli/src/public/cli/commands/site-metadatum.ts index bb8c9658e..b772b72e2 100644 --- a/sdk/constructive-cli/src/public/cli/commands/site-metadatum.ts +++ b/sdk/constructive-cli/src/public/cli/commands/site-metadatum.ts @@ -1,4 +1,3 @@ -// @ts-nocheck /** * CLI commands for SiteMetadatum * @generated by @constructive-io/graphql-codegen @@ -7,7 +6,9 @@ import { CLIOptions, Inquirerer, extractFirst } from 'inquirerer'; import { getClient } from '../executor'; import { coerceAnswers, stripUndefined } from '../utils'; -const fieldSchema = { +import type { FieldSchema } from '../utils'; +import type { CreateSiteMetadatumInput, SiteMetadatumPatch } from '../../orm/input-types'; +const fieldSchema: FieldSchema = { id: 'uuid', databaseId: 'uuid', siteId: 'uuid', @@ -36,7 +37,7 @@ export default async ( options: ['list', 'get', 'create', 'update', 'delete'], }, ]); - return handleTableSubcommand(answer.subcommand, newArgv, prompter); + return handleTableSubcommand(answer.subcommand as string, newArgv, prompter); } return handleTableSubcommand(subcommand, newArgv, prompter); }; @@ -98,7 +99,7 @@ async function handleGet(argv: Partial>, prompter: Inqui const client = getClient(); const result = await client.siteMetadatum .findOne({ - id: answers.id, + id: answers.id as string, select: { id: true, databaseId: true, @@ -153,7 +154,10 @@ async function handleCreate(argv: Partial>, prompter: In }, ]); const answers = coerceAnswers(rawAnswers, fieldSchema); - const cleanedData = stripUndefined(answers, fieldSchema); + const cleanedData = stripUndefined( + answers, + fieldSchema + ) as CreateSiteMetadatumInput['siteMetadatum']; const client = getClient(); const result = await client.siteMetadatum .create({ @@ -224,7 +228,7 @@ async function handleUpdate(argv: Partial>, prompter: In }, ]); const answers = coerceAnswers(rawAnswers, fieldSchema); - const cleanedData = stripUndefined(answers, fieldSchema); + const cleanedData = stripUndefined(answers, fieldSchema) as SiteMetadatumPatch; const client = getClient(); const result = await client.siteMetadatum .update({ diff --git a/sdk/constructive-cli/src/public/cli/commands/site-module.ts b/sdk/constructive-cli/src/public/cli/commands/site-module.ts index 0f5c20df8..bd4eabacf 100644 --- a/sdk/constructive-cli/src/public/cli/commands/site-module.ts +++ b/sdk/constructive-cli/src/public/cli/commands/site-module.ts @@ -1,4 +1,3 @@ -// @ts-nocheck /** * CLI commands for SiteModule * @generated by @constructive-io/graphql-codegen @@ -7,7 +6,9 @@ import { CLIOptions, Inquirerer, extractFirst } from 'inquirerer'; import { getClient } from '../executor'; import { coerceAnswers, stripUndefined } from '../utils'; -const fieldSchema = { +import type { FieldSchema } from '../utils'; +import type { CreateSiteModuleInput, SiteModulePatch } from '../../orm/input-types'; +const fieldSchema: FieldSchema = { id: 'uuid', databaseId: 'uuid', siteId: 'uuid', @@ -35,7 +36,7 @@ export default async ( options: ['list', 'get', 'create', 'update', 'delete'], }, ]); - return handleTableSubcommand(answer.subcommand, newArgv, prompter); + return handleTableSubcommand(answer.subcommand as string, newArgv, prompter); } return handleTableSubcommand(subcommand, newArgv, prompter); }; @@ -96,7 +97,7 @@ async function handleGet(argv: Partial>, prompter: Inqui const client = getClient(); const result = await client.siteModule .findOne({ - id: answers.id, + id: answers.id as string, select: { id: true, databaseId: true, @@ -144,7 +145,7 @@ async function handleCreate(argv: Partial>, prompter: In }, ]); const answers = coerceAnswers(rawAnswers, fieldSchema); - const cleanedData = stripUndefined(answers, fieldSchema); + const cleanedData = stripUndefined(answers, fieldSchema) as CreateSiteModuleInput['siteModule']; const client = getClient(); const result = await client.siteModule .create({ @@ -207,7 +208,7 @@ async function handleUpdate(argv: Partial>, prompter: In }, ]); const answers = coerceAnswers(rawAnswers, fieldSchema); - const cleanedData = stripUndefined(answers, fieldSchema); + const cleanedData = stripUndefined(answers, fieldSchema) as SiteModulePatch; const client = getClient(); const result = await client.siteModule .update({ diff --git a/sdk/constructive-cli/src/public/cli/commands/site-theme.ts b/sdk/constructive-cli/src/public/cli/commands/site-theme.ts index 99c4bb52c..0e792ce3a 100644 --- a/sdk/constructive-cli/src/public/cli/commands/site-theme.ts +++ b/sdk/constructive-cli/src/public/cli/commands/site-theme.ts @@ -1,4 +1,3 @@ -// @ts-nocheck /** * CLI commands for SiteTheme * @generated by @constructive-io/graphql-codegen @@ -7,7 +6,9 @@ import { CLIOptions, Inquirerer, extractFirst } from 'inquirerer'; import { getClient } from '../executor'; import { coerceAnswers, stripUndefined } from '../utils'; -const fieldSchema = { +import type { FieldSchema } from '../utils'; +import type { CreateSiteThemeInput, SiteThemePatch } from '../../orm/input-types'; +const fieldSchema: FieldSchema = { id: 'uuid', databaseId: 'uuid', siteId: 'uuid', @@ -34,7 +35,7 @@ export default async ( options: ['list', 'get', 'create', 'update', 'delete'], }, ]); - return handleTableSubcommand(answer.subcommand, newArgv, prompter); + return handleTableSubcommand(answer.subcommand as string, newArgv, prompter); } return handleTableSubcommand(subcommand, newArgv, prompter); }; @@ -94,7 +95,7 @@ async function handleGet(argv: Partial>, prompter: Inqui const client = getClient(); const result = await client.siteTheme .findOne({ - id: answers.id, + id: answers.id as string, select: { id: true, databaseId: true, @@ -135,7 +136,7 @@ async function handleCreate(argv: Partial>, prompter: In }, ]); const answers = coerceAnswers(rawAnswers, fieldSchema); - const cleanedData = stripUndefined(answers, fieldSchema); + const cleanedData = stripUndefined(answers, fieldSchema) as CreateSiteThemeInput['siteTheme']; const client = getClient(); const result = await client.siteTheme .create({ @@ -190,7 +191,7 @@ async function handleUpdate(argv: Partial>, prompter: In }, ]); const answers = coerceAnswers(rawAnswers, fieldSchema); - const cleanedData = stripUndefined(answers, fieldSchema); + const cleanedData = stripUndefined(answers, fieldSchema) as SiteThemePatch; const client = getClient(); const result = await client.siteTheme .update({ diff --git a/sdk/constructive-cli/src/public/cli/commands/site.ts b/sdk/constructive-cli/src/public/cli/commands/site.ts index 593ff2339..5cd1c2926 100644 --- a/sdk/constructive-cli/src/public/cli/commands/site.ts +++ b/sdk/constructive-cli/src/public/cli/commands/site.ts @@ -1,4 +1,3 @@ -// @ts-nocheck /** * CLI commands for Site * @generated by @constructive-io/graphql-codegen @@ -7,7 +6,9 @@ import { CLIOptions, Inquirerer, extractFirst } from 'inquirerer'; import { getClient } from '../executor'; import { coerceAnswers, stripUndefined } from '../utils'; -const fieldSchema = { +import type { FieldSchema } from '../utils'; +import type { CreateSiteInput, SitePatch } from '../../orm/input-types'; +const fieldSchema: FieldSchema = { id: 'uuid', databaseId: 'uuid', title: 'string', @@ -39,7 +40,7 @@ export default async ( options: ['list', 'get', 'create', 'update', 'delete'], }, ]); - return handleTableSubcommand(answer.subcommand, newArgv, prompter); + return handleTableSubcommand(answer.subcommand as string, newArgv, prompter); } return handleTableSubcommand(subcommand, newArgv, prompter); }; @@ -104,7 +105,7 @@ async function handleGet(argv: Partial>, prompter: Inqui const client = getClient(); const result = await client.site .findOne({ - id: answers.id, + id: answers.id as string, select: { id: true, databaseId: true, @@ -180,7 +181,7 @@ async function handleCreate(argv: Partial>, prompter: In }, ]); const answers = coerceAnswers(rawAnswers, fieldSchema); - const cleanedData = stripUndefined(answers, fieldSchema); + const cleanedData = stripUndefined(answers, fieldSchema) as CreateSiteInput['site']; const client = getClient(); const result = await client.site .create({ @@ -275,7 +276,7 @@ async function handleUpdate(argv: Partial>, prompter: In }, ]); const answers = coerceAnswers(rawAnswers, fieldSchema); - const cleanedData = stripUndefined(answers, fieldSchema); + const cleanedData = stripUndefined(answers, fieldSchema) as SitePatch; const client = getClient(); const result = await client.site .update({ diff --git a/sdk/constructive-cli/src/public/cli/commands/sql-migration.ts b/sdk/constructive-cli/src/public/cli/commands/sql-migration.ts index aa3cb639d..beb7c5544 100644 --- a/sdk/constructive-cli/src/public/cli/commands/sql-migration.ts +++ b/sdk/constructive-cli/src/public/cli/commands/sql-migration.ts @@ -1,4 +1,3 @@ -// @ts-nocheck /** * CLI commands for SqlMigration * @generated by @constructive-io/graphql-codegen @@ -7,7 +6,9 @@ import { CLIOptions, Inquirerer, extractFirst } from 'inquirerer'; import { getClient } from '../executor'; import { coerceAnswers, stripUndefined } from '../utils'; -const fieldSchema = { +import type { FieldSchema } from '../utils'; +import type { CreateSqlMigrationInput, SqlMigrationPatch } from '../../orm/input-types'; +const fieldSchema: FieldSchema = { id: 'int', name: 'string', databaseId: 'uuid', @@ -23,7 +24,7 @@ const fieldSchema = { actorId: 'uuid', }; const usage = - '\nsql-migration \n\nCommands:\n list List all sqlMigration records\n get Get a sqlMigration by ID\n create Create a new sqlMigration\n update Update an existing sqlMigration\n delete Delete a sqlMigration\n\n --help, -h Show this help message\n'; + '\nsql-migration \n\nCommands:\n list List all sqlMigration records\n create Create a new sqlMigration\n\n --help, -h Show this help message\n'; export default async ( argv: Partial>, prompter: Inquirerer, @@ -40,10 +41,10 @@ export default async ( type: 'autocomplete', name: 'subcommand', message: 'What do you want to do?', - options: ['list', 'get', 'create', 'update', 'delete'], + options: ['list', 'create'], }, ]); - return handleTableSubcommand(answer.subcommand, newArgv, prompter); + return handleTableSubcommand(answer.subcommand as string, newArgv, prompter); } return handleTableSubcommand(subcommand, newArgv, prompter); }; @@ -55,14 +56,8 @@ async function handleTableSubcommand( switch (subcommand) { case 'list': return handleList(argv, prompter); - case 'get': - return handleGet(argv, prompter); case 'create': return handleCreate(argv, prompter); - case 'update': - return handleUpdate(argv, prompter); - case 'delete': - return handleDelete(argv, prompter); default: console.log(usage); process.exit(1); @@ -99,46 +94,6 @@ async function handleList(_argv: Partial>, _prompter: In process.exit(1); } } -async function handleGet(argv: Partial>, prompter: Inquirerer) { - try { - const answers = await prompter.prompt(argv, [ - { - type: 'text', - name: 'id', - message: 'id', - required: true, - }, - ]); - const client = getClient(); - const result = await client.sqlMigration - .findOne({ - id: answers.id, - select: { - id: true, - name: true, - databaseId: true, - deploy: true, - deps: true, - payload: true, - content: true, - revert: true, - verify: true, - createdAt: true, - action: true, - actionId: true, - actorId: true, - }, - }) - .execute(); - console.log(JSON.stringify(result, null, 2)); - } catch (error) { - console.error('Record not found.'); - if (error instanceof Error) { - console.error(error.message); - } - process.exit(1); - } -} async function handleCreate(argv: Partial>, prompter: Inquirerer) { try { const rawAnswers = await prompter.prompt(argv, [ @@ -210,7 +165,10 @@ async function handleCreate(argv: Partial>, prompter: In }, ]); const answers = coerceAnswers(rawAnswers, fieldSchema); - const cleanedData = stripUndefined(answers, fieldSchema); + const cleanedData = stripUndefined( + answers, + fieldSchema + ) as CreateSqlMigrationInput['sqlMigration']; const client = getClient(); const result = await client.sqlMigration .create({ @@ -253,157 +211,3 @@ async function handleCreate(argv: Partial>, prompter: In process.exit(1); } } -async function handleUpdate(argv: Partial>, prompter: Inquirerer) { - try { - const rawAnswers = await prompter.prompt(argv, [ - { - type: 'text', - name: 'id', - message: 'id', - required: true, - }, - { - type: 'text', - name: 'name', - message: 'name', - required: false, - }, - { - type: 'text', - name: 'databaseId', - message: 'databaseId', - required: false, - }, - { - type: 'text', - name: 'deploy', - message: 'deploy', - required: false, - }, - { - type: 'text', - name: 'deps', - message: 'deps', - required: false, - }, - { - type: 'text', - name: 'payload', - message: 'payload', - required: false, - }, - { - type: 'text', - name: 'content', - message: 'content', - required: false, - }, - { - type: 'text', - name: 'revert', - message: 'revert', - required: false, - }, - { - type: 'text', - name: 'verify', - message: 'verify', - required: false, - }, - { - type: 'text', - name: 'action', - message: 'action', - required: false, - }, - { - type: 'text', - name: 'actionId', - message: 'actionId', - required: false, - }, - { - type: 'text', - name: 'actorId', - message: 'actorId', - required: false, - }, - ]); - const answers = coerceAnswers(rawAnswers, fieldSchema); - const cleanedData = stripUndefined(answers, fieldSchema); - const client = getClient(); - const result = await client.sqlMigration - .update({ - where: { - id: answers.id as string, - }, - data: { - name: cleanedData.name, - databaseId: cleanedData.databaseId, - deploy: cleanedData.deploy, - deps: cleanedData.deps, - payload: cleanedData.payload, - content: cleanedData.content, - revert: cleanedData.revert, - verify: cleanedData.verify, - action: cleanedData.action, - actionId: cleanedData.actionId, - actorId: cleanedData.actorId, - }, - select: { - id: true, - name: true, - databaseId: true, - deploy: true, - deps: true, - payload: true, - content: true, - revert: true, - verify: true, - createdAt: true, - action: true, - actionId: true, - actorId: true, - }, - }) - .execute(); - console.log(JSON.stringify(result, null, 2)); - } catch (error) { - console.error('Failed to update record.'); - if (error instanceof Error) { - console.error(error.message); - } - process.exit(1); - } -} -async function handleDelete(argv: Partial>, prompter: Inquirerer) { - try { - const rawAnswers = await prompter.prompt(argv, [ - { - type: 'text', - name: 'id', - message: 'id', - required: true, - }, - ]); - const answers = coerceAnswers(rawAnswers, fieldSchema); - const client = getClient(); - const result = await client.sqlMigration - .delete({ - where: { - id: answers.id as string, - }, - select: { - id: true, - }, - }) - .execute(); - console.log(JSON.stringify(result, null, 2)); - } catch (error) { - console.error('Failed to delete record.'); - if (error instanceof Error) { - console.error(error.message); - } - process.exit(1); - } -} diff --git a/sdk/constructive-cli/src/public/cli/commands/steps-achieved.ts b/sdk/constructive-cli/src/public/cli/commands/steps-achieved.ts index a74a28510..edc8fcea9 100644 --- a/sdk/constructive-cli/src/public/cli/commands/steps-achieved.ts +++ b/sdk/constructive-cli/src/public/cli/commands/steps-achieved.ts @@ -1,4 +1,3 @@ -// @ts-nocheck /** * CLI command for query stepsAchieved * @generated by @constructive-io/graphql-codegen @@ -6,6 +5,7 @@ */ import { CLIOptions, Inquirerer } from 'inquirerer'; import { getClient } from '../executor'; +import type { StepsAchievedVariables } from '../../orm/query'; export default async ( argv: Partial>, prompter: Inquirerer, @@ -29,7 +29,9 @@ export default async ( }, ]); const client = getClient(); - const result = await client.query.stepsAchieved(answers).execute(); + const result = await client.query + .stepsAchieved(answers as unknown as StepsAchievedVariables) + .execute(); console.log(JSON.stringify(result, null, 2)); } catch (error) { console.error('Failed: stepsAchieved'); diff --git a/sdk/constructive-cli/src/public/cli/commands/steps-required.ts b/sdk/constructive-cli/src/public/cli/commands/steps-required.ts index 08b9cd4b5..794b78438 100644 --- a/sdk/constructive-cli/src/public/cli/commands/steps-required.ts +++ b/sdk/constructive-cli/src/public/cli/commands/steps-required.ts @@ -1,4 +1,3 @@ -// @ts-nocheck /** * CLI command for query stepsRequired * @generated by @constructive-io/graphql-codegen @@ -7,6 +6,8 @@ import { CLIOptions, Inquirerer } from 'inquirerer'; import { getClient } from '../executor'; import { buildSelectFromPaths } from '../utils'; +import type { StepsRequiredVariables } from '../../orm/query'; +import type { AppLevelRequirementConnectionSelect } from '../../orm/input-types'; export default async ( argv: Partial>, prompter: Inquirerer, @@ -48,11 +49,16 @@ export default async ( }, ]); const client = getClient(); - const selectFields = buildSelectFromPaths(argv.select ?? ''); + const selectFields = buildSelectFromPaths((argv.select as string) ?? ''); const result = await client.query - .stepsRequired(answers, { - select: selectFields, - }) + .stepsRequired( + answers as unknown as StepsRequiredVariables, + { + select: selectFields, + } as unknown as { + select: AppLevelRequirementConnectionSelect; + } + ) .execute(); console.log(JSON.stringify(result, null, 2)); } catch (error) { diff --git a/sdk/constructive-cli/src/public/cli/commands/store.ts b/sdk/constructive-cli/src/public/cli/commands/store.ts index 2e2f8f1f8..689cc57e2 100644 --- a/sdk/constructive-cli/src/public/cli/commands/store.ts +++ b/sdk/constructive-cli/src/public/cli/commands/store.ts @@ -1,4 +1,3 @@ -// @ts-nocheck /** * CLI commands for Store * @generated by @constructive-io/graphql-codegen @@ -7,7 +6,9 @@ import { CLIOptions, Inquirerer, extractFirst } from 'inquirerer'; import { getClient } from '../executor'; import { coerceAnswers, stripUndefined } from '../utils'; -const fieldSchema = { +import type { FieldSchema } from '../utils'; +import type { CreateStoreInput, StorePatch } from '../../orm/input-types'; +const fieldSchema: FieldSchema = { id: 'uuid', name: 'string', databaseId: 'uuid', @@ -35,7 +36,7 @@ export default async ( options: ['list', 'get', 'create', 'update', 'delete'], }, ]); - return handleTableSubcommand(answer.subcommand, newArgv, prompter); + return handleTableSubcommand(answer.subcommand as string, newArgv, prompter); } return handleTableSubcommand(subcommand, newArgv, prompter); }; @@ -96,7 +97,7 @@ async function handleGet(argv: Partial>, prompter: Inqui const client = getClient(); const result = await client.store .findOne({ - id: answers.id, + id: answers.id as string, select: { id: true, name: true, @@ -138,7 +139,7 @@ async function handleCreate(argv: Partial>, prompter: In }, ]); const answers = coerceAnswers(rawAnswers, fieldSchema); - const cleanedData = stripUndefined(answers, fieldSchema); + const cleanedData = stripUndefined(answers, fieldSchema) as CreateStoreInput['store']; const client = getClient(); const result = await client.store .create({ @@ -194,7 +195,7 @@ async function handleUpdate(argv: Partial>, prompter: In }, ]); const answers = coerceAnswers(rawAnswers, fieldSchema); - const cleanedData = stripUndefined(answers, fieldSchema); + const cleanedData = stripUndefined(answers, fieldSchema) as StorePatch; const client = getClient(); const result = await client.store .update({ diff --git a/sdk/constructive-cli/src/public/cli/commands/submit-invite-code.ts b/sdk/constructive-cli/src/public/cli/commands/submit-invite-code.ts index 99f418ea5..61a3b8264 100644 --- a/sdk/constructive-cli/src/public/cli/commands/submit-invite-code.ts +++ b/sdk/constructive-cli/src/public/cli/commands/submit-invite-code.ts @@ -1,4 +1,3 @@ -// @ts-nocheck /** * CLI command for mutation submitInviteCode * @generated by @constructive-io/graphql-codegen @@ -7,6 +6,8 @@ import { CLIOptions, Inquirerer } from 'inquirerer'; import { getClient } from '../executor'; import { parseMutationInput, buildSelectFromPaths } from '../utils'; +import type { SubmitInviteCodeVariables } from '../../orm/mutation'; +import type { SubmitInviteCodePayloadSelect } from '../../orm/input-types'; export default async ( argv: Partial>, prompter: Inquirerer, @@ -28,11 +29,16 @@ export default async ( ]); const client = getClient(); const parsedAnswers = parseMutationInput(answers); - const selectFields = buildSelectFromPaths(argv.select ?? 'clientMutationId'); + const selectFields = buildSelectFromPaths((argv.select as string) ?? 'clientMutationId'); const result = await client.mutation - .submitInviteCode(parsedAnswers, { - select: selectFields, - }) + .submitInviteCode( + parsedAnswers as unknown as SubmitInviteCodeVariables, + { + select: selectFields, + } as unknown as { + select: SubmitInviteCodePayloadSelect; + } + ) .execute(); console.log(JSON.stringify(result, null, 2)); } catch (error) { diff --git a/sdk/constructive-cli/src/public/cli/commands/submit-org-invite-code.ts b/sdk/constructive-cli/src/public/cli/commands/submit-org-invite-code.ts index 8e209567b..59a0c2e91 100644 --- a/sdk/constructive-cli/src/public/cli/commands/submit-org-invite-code.ts +++ b/sdk/constructive-cli/src/public/cli/commands/submit-org-invite-code.ts @@ -1,4 +1,3 @@ -// @ts-nocheck /** * CLI command for mutation submitOrgInviteCode * @generated by @constructive-io/graphql-codegen @@ -7,6 +6,8 @@ import { CLIOptions, Inquirerer } from 'inquirerer'; import { getClient } from '../executor'; import { parseMutationInput, buildSelectFromPaths } from '../utils'; +import type { SubmitOrgInviteCodeVariables } from '../../orm/mutation'; +import type { SubmitOrgInviteCodePayloadSelect } from '../../orm/input-types'; export default async ( argv: Partial>, prompter: Inquirerer, @@ -30,11 +31,16 @@ export default async ( ]); const client = getClient(); const parsedAnswers = parseMutationInput(answers); - const selectFields = buildSelectFromPaths(argv.select ?? 'clientMutationId'); + const selectFields = buildSelectFromPaths((argv.select as string) ?? 'clientMutationId'); const result = await client.mutation - .submitOrgInviteCode(parsedAnswers, { - select: selectFields, - }) + .submitOrgInviteCode( + parsedAnswers as unknown as SubmitOrgInviteCodeVariables, + { + select: selectFields, + } as unknown as { + select: SubmitOrgInviteCodePayloadSelect; + } + ) .execute(); console.log(JSON.stringify(result, null, 2)); } catch (error) { diff --git a/sdk/constructive-cli/src/public/cli/commands/table-grant.ts b/sdk/constructive-cli/src/public/cli/commands/table-grant.ts index 29aa202f5..10af90d6c 100644 --- a/sdk/constructive-cli/src/public/cli/commands/table-grant.ts +++ b/sdk/constructive-cli/src/public/cli/commands/table-grant.ts @@ -1,4 +1,3 @@ -// @ts-nocheck /** * CLI commands for TableGrant * @generated by @constructive-io/graphql-codegen @@ -7,7 +6,9 @@ import { CLIOptions, Inquirerer, extractFirst } from 'inquirerer'; import { getClient } from '../executor'; import { coerceAnswers, stripUndefined } from '../utils'; -const fieldSchema = { +import type { FieldSchema } from '../utils'; +import type { CreateTableGrantInput, TableGrantPatch } from '../../orm/input-types'; +const fieldSchema: FieldSchema = { id: 'uuid', databaseId: 'uuid', tableId: 'uuid', @@ -39,7 +40,7 @@ export default async ( options: ['list', 'get', 'create', 'update', 'delete'], }, ]); - return handleTableSubcommand(answer.subcommand, newArgv, prompter); + return handleTableSubcommand(answer.subcommand as string, newArgv, prompter); } return handleTableSubcommand(subcommand, newArgv, prompter); }; @@ -104,7 +105,7 @@ async function handleGet(argv: Partial>, prompter: Inqui const client = getClient(); const result = await client.tableGrant .findOne({ - id: answers.id, + id: answers.id as string, select: { id: true, databaseId: true, @@ -168,7 +169,7 @@ async function handleCreate(argv: Partial>, prompter: In }, ]); const answers = coerceAnswers(rawAnswers, fieldSchema); - const cleanedData = stripUndefined(answers, fieldSchema); + const cleanedData = stripUndefined(answers, fieldSchema) as CreateTableGrantInput['tableGrant']; const client = getClient(); const result = await client.tableGrant .create({ @@ -249,7 +250,7 @@ async function handleUpdate(argv: Partial>, prompter: In }, ]); const answers = coerceAnswers(rawAnswers, fieldSchema); - const cleanedData = stripUndefined(answers, fieldSchema); + const cleanedData = stripUndefined(answers, fieldSchema) as TableGrantPatch; const client = getClient(); const result = await client.tableGrant .update({ diff --git a/sdk/constructive-cli/src/public/cli/commands/table-module.ts b/sdk/constructive-cli/src/public/cli/commands/table-module.ts index 5e236b326..cb344f356 100644 --- a/sdk/constructive-cli/src/public/cli/commands/table-module.ts +++ b/sdk/constructive-cli/src/public/cli/commands/table-module.ts @@ -1,4 +1,3 @@ -// @ts-nocheck /** * CLI commands for TableModule * @generated by @constructive-io/graphql-codegen @@ -7,7 +6,9 @@ import { CLIOptions, Inquirerer, extractFirst } from 'inquirerer'; import { getClient } from '../executor'; import { coerceAnswers, stripUndefined } from '../utils'; -const fieldSchema = { +import type { FieldSchema } from '../utils'; +import type { CreateTableModuleInput, TableModulePatch } from '../../orm/input-types'; +const fieldSchema: FieldSchema = { id: 'uuid', databaseId: 'uuid', schemaId: 'uuid', @@ -39,7 +40,7 @@ export default async ( options: ['list', 'get', 'create', 'update', 'delete'], }, ]); - return handleTableSubcommand(answer.subcommand, newArgv, prompter); + return handleTableSubcommand(answer.subcommand as string, newArgv, prompter); } return handleTableSubcommand(subcommand, newArgv, prompter); }; @@ -104,7 +105,7 @@ async function handleGet(argv: Partial>, prompter: Inqui const client = getClient(); const result = await client.tableModule .findOne({ - id: answers.id, + id: answers.id as string, select: { id: true, databaseId: true, @@ -180,7 +181,10 @@ async function handleCreate(argv: Partial>, prompter: In }, ]); const answers = coerceAnswers(rawAnswers, fieldSchema); - const cleanedData = stripUndefined(answers, fieldSchema); + const cleanedData = stripUndefined( + answers, + fieldSchema + ) as CreateTableModuleInput['tableModule']; const client = getClient(); const result = await client.tableModule .create({ @@ -275,7 +279,7 @@ async function handleUpdate(argv: Partial>, prompter: In }, ]); const answers = coerceAnswers(rawAnswers, fieldSchema); - const cleanedData = stripUndefined(answers, fieldSchema); + const cleanedData = stripUndefined(answers, fieldSchema) as TableModulePatch; const client = getClient(); const result = await client.tableModule .update({ diff --git a/sdk/constructive-cli/src/public/cli/commands/table-template-module.ts b/sdk/constructive-cli/src/public/cli/commands/table-template-module.ts index 137902e26..4a57eafae 100644 --- a/sdk/constructive-cli/src/public/cli/commands/table-template-module.ts +++ b/sdk/constructive-cli/src/public/cli/commands/table-template-module.ts @@ -1,4 +1,3 @@ -// @ts-nocheck /** * CLI commands for TableTemplateModule * @generated by @constructive-io/graphql-codegen @@ -7,7 +6,12 @@ import { CLIOptions, Inquirerer, extractFirst } from 'inquirerer'; import { getClient } from '../executor'; import { coerceAnswers, stripUndefined } from '../utils'; -const fieldSchema = { +import type { FieldSchema } from '../utils'; +import type { + CreateTableTemplateModuleInput, + TableTemplateModulePatch, +} from '../../orm/input-types'; +const fieldSchema: FieldSchema = { id: 'uuid', databaseId: 'uuid', schemaId: 'uuid', @@ -39,7 +43,7 @@ export default async ( options: ['list', 'get', 'create', 'update', 'delete'], }, ]); - return handleTableSubcommand(answer.subcommand, newArgv, prompter); + return handleTableSubcommand(answer.subcommand as string, newArgv, prompter); } return handleTableSubcommand(subcommand, newArgv, prompter); }; @@ -104,7 +108,7 @@ async function handleGet(argv: Partial>, prompter: Inqui const client = getClient(); const result = await client.tableTemplateModule .findOne({ - id: answers.id, + id: answers.id as string, select: { id: true, databaseId: true, @@ -180,7 +184,10 @@ async function handleCreate(argv: Partial>, prompter: In }, ]); const answers = coerceAnswers(rawAnswers, fieldSchema); - const cleanedData = stripUndefined(answers, fieldSchema); + const cleanedData = stripUndefined( + answers, + fieldSchema + ) as CreateTableTemplateModuleInput['tableTemplateModule']; const client = getClient(); const result = await client.tableTemplateModule .create({ @@ -275,7 +282,7 @@ async function handleUpdate(argv: Partial>, prompter: In }, ]); const answers = coerceAnswers(rawAnswers, fieldSchema); - const cleanedData = stripUndefined(answers, fieldSchema); + const cleanedData = stripUndefined(answers, fieldSchema) as TableTemplateModulePatch; const client = getClient(); const result = await client.tableTemplateModule .update({ diff --git a/sdk/constructive-cli/src/public/cli/commands/table.ts b/sdk/constructive-cli/src/public/cli/commands/table.ts index d645069b3..fc70cf4a5 100644 --- a/sdk/constructive-cli/src/public/cli/commands/table.ts +++ b/sdk/constructive-cli/src/public/cli/commands/table.ts @@ -1,4 +1,3 @@ -// @ts-nocheck /** * CLI commands for Table * @generated by @constructive-io/graphql-codegen @@ -7,7 +6,9 @@ import { CLIOptions, Inquirerer, extractFirst } from 'inquirerer'; import { getClient } from '../executor'; import { coerceAnswers, stripUndefined } from '../utils'; -const fieldSchema = { +import type { FieldSchema } from '../utils'; +import type { CreateTableInput, TablePatch } from '../../orm/input-types'; +const fieldSchema: FieldSchema = { id: 'uuid', databaseId: 'uuid', schemaId: 'uuid', @@ -49,7 +50,7 @@ export default async ( options: ['list', 'get', 'create', 'update', 'delete'], }, ]); - return handleTableSubcommand(answer.subcommand, newArgv, prompter); + return handleTableSubcommand(answer.subcommand as string, newArgv, prompter); } return handleTableSubcommand(subcommand, newArgv, prompter); }; @@ -124,7 +125,7 @@ async function handleGet(argv: Partial>, prompter: Inqui const client = getClient(); const result = await client.table .findOne({ - id: answers.id, + id: answers.id as string, select: { id: true, databaseId: true, @@ -258,7 +259,7 @@ async function handleCreate(argv: Partial>, prompter: In }, ]); const answers = coerceAnswers(rawAnswers, fieldSchema); - const cleanedData = stripUndefined(answers, fieldSchema); + const cleanedData = stripUndefined(answers, fieldSchema) as CreateTableInput['table']; const client = getClient(); const result = await client.table .create({ @@ -419,7 +420,7 @@ async function handleUpdate(argv: Partial>, prompter: In }, ]); const answers = coerceAnswers(rawAnswers, fieldSchema); - const cleanedData = stripUndefined(answers, fieldSchema); + const cleanedData = stripUndefined(answers, fieldSchema) as TablePatch; const client = getClient(); const result = await client.table .update({ diff --git a/sdk/constructive-cli/src/public/cli/commands/trigger-function.ts b/sdk/constructive-cli/src/public/cli/commands/trigger-function.ts index f07571aa2..f0b19ad97 100644 --- a/sdk/constructive-cli/src/public/cli/commands/trigger-function.ts +++ b/sdk/constructive-cli/src/public/cli/commands/trigger-function.ts @@ -1,4 +1,3 @@ -// @ts-nocheck /** * CLI commands for TriggerFunction * @generated by @constructive-io/graphql-codegen @@ -7,7 +6,9 @@ import { CLIOptions, Inquirerer, extractFirst } from 'inquirerer'; import { getClient } from '../executor'; import { coerceAnswers, stripUndefined } from '../utils'; -const fieldSchema = { +import type { FieldSchema } from '../utils'; +import type { CreateTriggerFunctionInput, TriggerFunctionPatch } from '../../orm/input-types'; +const fieldSchema: FieldSchema = { id: 'uuid', databaseId: 'uuid', name: 'string', @@ -36,7 +37,7 @@ export default async ( options: ['list', 'get', 'create', 'update', 'delete'], }, ]); - return handleTableSubcommand(answer.subcommand, newArgv, prompter); + return handleTableSubcommand(answer.subcommand as string, newArgv, prompter); } return handleTableSubcommand(subcommand, newArgv, prompter); }; @@ -98,7 +99,7 @@ async function handleGet(argv: Partial>, prompter: Inqui const client = getClient(); const result = await client.triggerFunction .findOne({ - id: answers.id, + id: answers.id as string, select: { id: true, databaseId: true, @@ -141,7 +142,10 @@ async function handleCreate(argv: Partial>, prompter: In }, ]); const answers = coerceAnswers(rawAnswers, fieldSchema); - const cleanedData = stripUndefined(answers, fieldSchema); + const cleanedData = stripUndefined( + answers, + fieldSchema + ) as CreateTriggerFunctionInput['triggerFunction']; const client = getClient(); const result = await client.triggerFunction .create({ @@ -198,7 +202,7 @@ async function handleUpdate(argv: Partial>, prompter: In }, ]); const answers = coerceAnswers(rawAnswers, fieldSchema); - const cleanedData = stripUndefined(answers, fieldSchema); + const cleanedData = stripUndefined(answers, fieldSchema) as TriggerFunctionPatch; const client = getClient(); const result = await client.triggerFunction .update({ diff --git a/sdk/constructive-cli/src/public/cli/commands/trigger.ts b/sdk/constructive-cli/src/public/cli/commands/trigger.ts index 13169c743..e458adae6 100644 --- a/sdk/constructive-cli/src/public/cli/commands/trigger.ts +++ b/sdk/constructive-cli/src/public/cli/commands/trigger.ts @@ -1,4 +1,3 @@ -// @ts-nocheck /** * CLI commands for Trigger * @generated by @constructive-io/graphql-codegen @@ -7,7 +6,9 @@ import { CLIOptions, Inquirerer, extractFirst } from 'inquirerer'; import { getClient } from '../executor'; import { coerceAnswers, stripUndefined } from '../utils'; -const fieldSchema = { +import type { FieldSchema } from '../utils'; +import type { CreateTriggerInput, TriggerPatch } from '../../orm/input-types'; +const fieldSchema: FieldSchema = { id: 'uuid', databaseId: 'uuid', tableId: 'uuid', @@ -43,7 +44,7 @@ export default async ( options: ['list', 'get', 'create', 'update', 'delete'], }, ]); - return handleTableSubcommand(answer.subcommand, newArgv, prompter); + return handleTableSubcommand(answer.subcommand as string, newArgv, prompter); } return handleTableSubcommand(subcommand, newArgv, prompter); }; @@ -112,7 +113,7 @@ async function handleGet(argv: Partial>, prompter: Inqui const client = getClient(); const result = await client.trigger .findOne({ - id: answers.id, + id: answers.id as string, select: { id: true, databaseId: true, @@ -204,7 +205,7 @@ async function handleCreate(argv: Partial>, prompter: In }, ]); const answers = coerceAnswers(rawAnswers, fieldSchema); - const cleanedData = stripUndefined(answers, fieldSchema); + const cleanedData = stripUndefined(answers, fieldSchema) as CreateTriggerInput['trigger']; const client = getClient(); const result = await client.trigger .create({ @@ -317,7 +318,7 @@ async function handleUpdate(argv: Partial>, prompter: In }, ]); const answers = coerceAnswers(rawAnswers, fieldSchema); - const cleanedData = stripUndefined(answers, fieldSchema); + const cleanedData = stripUndefined(answers, fieldSchema) as TriggerPatch; const client = getClient(); const result = await client.trigger .update({ diff --git a/sdk/constructive-cli/src/public/cli/commands/unique-constraint.ts b/sdk/constructive-cli/src/public/cli/commands/unique-constraint.ts index e5202da38..fe7b25ee2 100644 --- a/sdk/constructive-cli/src/public/cli/commands/unique-constraint.ts +++ b/sdk/constructive-cli/src/public/cli/commands/unique-constraint.ts @@ -1,4 +1,3 @@ -// @ts-nocheck /** * CLI commands for UniqueConstraint * @generated by @constructive-io/graphql-codegen @@ -7,7 +6,9 @@ import { CLIOptions, Inquirerer, extractFirst } from 'inquirerer'; import { getClient } from '../executor'; import { coerceAnswers, stripUndefined } from '../utils'; -const fieldSchema = { +import type { FieldSchema } from '../utils'; +import type { CreateUniqueConstraintInput, UniqueConstraintPatch } from '../../orm/input-types'; +const fieldSchema: FieldSchema = { id: 'uuid', databaseId: 'uuid', tableId: 'uuid', @@ -44,7 +45,7 @@ export default async ( options: ['list', 'get', 'create', 'update', 'delete'], }, ]); - return handleTableSubcommand(answer.subcommand, newArgv, prompter); + return handleTableSubcommand(answer.subcommand as string, newArgv, prompter); } return handleTableSubcommand(subcommand, newArgv, prompter); }; @@ -114,7 +115,7 @@ async function handleGet(argv: Partial>, prompter: Inqui const client = getClient(); const result = await client.uniqueConstraint .findOne({ - id: answers.id, + id: answers.id as string, select: { id: true, databaseId: true, @@ -213,7 +214,10 @@ async function handleCreate(argv: Partial>, prompter: In }, ]); const answers = coerceAnswers(rawAnswers, fieldSchema); - const cleanedData = stripUndefined(answers, fieldSchema); + const cleanedData = stripUndefined( + answers, + fieldSchema + ) as CreateUniqueConstraintInput['uniqueConstraint']; const client = getClient(); const result = await client.uniqueConstraint .create({ @@ -334,7 +338,7 @@ async function handleUpdate(argv: Partial>, prompter: In }, ]); const answers = coerceAnswers(rawAnswers, fieldSchema); - const cleanedData = stripUndefined(answers, fieldSchema); + const cleanedData = stripUndefined(answers, fieldSchema) as UniqueConstraintPatch; const client = getClient(); const result = await client.uniqueConstraint .update({ diff --git a/sdk/constructive-cli/src/public/cli/commands/update-node-at-path.ts b/sdk/constructive-cli/src/public/cli/commands/update-node-at-path.ts index 831cf2335..5869fe973 100644 --- a/sdk/constructive-cli/src/public/cli/commands/update-node-at-path.ts +++ b/sdk/constructive-cli/src/public/cli/commands/update-node-at-path.ts @@ -1,4 +1,3 @@ -// @ts-nocheck /** * CLI command for mutation updateNodeAtPath * @generated by @constructive-io/graphql-codegen @@ -7,6 +6,8 @@ import { CLIOptions, Inquirerer } from 'inquirerer'; import { getClient } from '../executor'; import { parseMutationInput, buildSelectFromPaths } from '../utils'; +import type { UpdateNodeAtPathVariables } from '../../orm/mutation'; +import type { UpdateNodeAtPathPayloadSelect } from '../../orm/input-types'; export default async ( argv: Partial>, prompter: Inquirerer, @@ -30,11 +31,16 @@ export default async ( ]); const client = getClient(); const parsedAnswers = parseMutationInput(answers); - const selectFields = buildSelectFromPaths(argv.select ?? 'clientMutationId'); + const selectFields = buildSelectFromPaths((argv.select as string) ?? 'clientMutationId'); const result = await client.mutation - .updateNodeAtPath(parsedAnswers, { - select: selectFields, - }) + .updateNodeAtPath( + parsedAnswers as unknown as UpdateNodeAtPathVariables, + { + select: selectFields, + } as unknown as { + select: UpdateNodeAtPathPayloadSelect; + } + ) .execute(); console.log(JSON.stringify(result, null, 2)); } catch (error) { diff --git a/sdk/constructive-cli/src/public/cli/commands/user-auth-module.ts b/sdk/constructive-cli/src/public/cli/commands/user-auth-module.ts index 370b88d66..d51ab6cf9 100644 --- a/sdk/constructive-cli/src/public/cli/commands/user-auth-module.ts +++ b/sdk/constructive-cli/src/public/cli/commands/user-auth-module.ts @@ -1,4 +1,3 @@ -// @ts-nocheck /** * CLI commands for UserAuthModule * @generated by @constructive-io/graphql-codegen @@ -7,7 +6,9 @@ import { CLIOptions, Inquirerer, extractFirst } from 'inquirerer'; import { getClient } from '../executor'; import { coerceAnswers, stripUndefined } from '../utils'; -const fieldSchema = { +import type { FieldSchema } from '../utils'; +import type { CreateUserAuthModuleInput, UserAuthModulePatch } from '../../orm/input-types'; +const fieldSchema: FieldSchema = { id: 'uuid', databaseId: 'uuid', schemaId: 'uuid', @@ -56,7 +57,7 @@ export default async ( options: ['list', 'get', 'create', 'update', 'delete'], }, ]); - return handleTableSubcommand(answer.subcommand, newArgv, prompter); + return handleTableSubcommand(answer.subcommand as string, newArgv, prompter); } return handleTableSubcommand(subcommand, newArgv, prompter); }; @@ -138,7 +139,7 @@ async function handleGet(argv: Partial>, prompter: Inqui const client = getClient(); const result = await client.userAuthModule .findOne({ - id: answers.id, + id: answers.id as string, select: { id: true, databaseId: true, @@ -333,7 +334,10 @@ async function handleCreate(argv: Partial>, prompter: In }, ]); const answers = coerceAnswers(rawAnswers, fieldSchema); - const cleanedData = stripUndefined(answers, fieldSchema); + const cleanedData = stripUndefined( + answers, + fieldSchema + ) as CreateUserAuthModuleInput['userAuthModule']; const client = getClient(); const result = await client.userAuthModule .create({ @@ -564,7 +568,7 @@ async function handleUpdate(argv: Partial>, prompter: In }, ]); const answers = coerceAnswers(rawAnswers, fieldSchema); - const cleanedData = stripUndefined(answers, fieldSchema); + const cleanedData = stripUndefined(answers, fieldSchema) as UserAuthModulePatch; const client = getClient(); const result = await client.userAuthModule .update({ diff --git a/sdk/constructive-cli/src/public/cli/commands/user.ts b/sdk/constructive-cli/src/public/cli/commands/user.ts index dcdb5b416..1932cb03f 100644 --- a/sdk/constructive-cli/src/public/cli/commands/user.ts +++ b/sdk/constructive-cli/src/public/cli/commands/user.ts @@ -1,4 +1,3 @@ -// @ts-nocheck /** * CLI commands for User * @generated by @constructive-io/graphql-codegen @@ -7,7 +6,9 @@ import { CLIOptions, Inquirerer, extractFirst } from 'inquirerer'; import { getClient } from '../executor'; import { coerceAnswers, stripUndefined } from '../utils'; -const fieldSchema = { +import type { FieldSchema } from '../utils'; +import type { CreateUserInput, UserPatch } from '../../orm/input-types'; +const fieldSchema: FieldSchema = { id: 'uuid', username: 'string', displayName: 'string', @@ -39,7 +40,7 @@ export default async ( options: ['list', 'get', 'create', 'update', 'delete'], }, ]); - return handleTableSubcommand(answer.subcommand, newArgv, prompter); + return handleTableSubcommand(answer.subcommand as string, newArgv, prompter); } return handleTableSubcommand(subcommand, newArgv, prompter); }; @@ -104,7 +105,7 @@ async function handleGet(argv: Partial>, prompter: Inqui const client = getClient(); const result = await client.user .findOne({ - id: answers.id, + id: answers.id as string, select: { id: true, username: true, @@ -160,15 +161,9 @@ async function handleCreate(argv: Partial>, prompter: In message: 'type', required: false, }, - { - type: 'text', - name: 'searchTsvRank', - message: 'searchTsvRank', - required: true, - }, ]); const answers = coerceAnswers(rawAnswers, fieldSchema); - const cleanedData = stripUndefined(answers, fieldSchema); + const cleanedData = stripUndefined(answers, fieldSchema) as CreateUserInput['user']; const client = getClient(); const result = await client.user .create({ @@ -178,7 +173,6 @@ async function handleCreate(argv: Partial>, prompter: In profilePicture: cleanedData.profilePicture, searchTsv: cleanedData.searchTsv, type: cleanedData.type, - searchTsvRank: cleanedData.searchTsvRank, }, select: { id: true, @@ -241,15 +235,9 @@ async function handleUpdate(argv: Partial>, prompter: In message: 'type', required: false, }, - { - type: 'text', - name: 'searchTsvRank', - message: 'searchTsvRank', - required: false, - }, ]); const answers = coerceAnswers(rawAnswers, fieldSchema); - const cleanedData = stripUndefined(answers, fieldSchema); + const cleanedData = stripUndefined(answers, fieldSchema) as UserPatch; const client = getClient(); const result = await client.user .update({ @@ -262,7 +250,6 @@ async function handleUpdate(argv: Partial>, prompter: In profilePicture: cleanedData.profilePicture, searchTsv: cleanedData.searchTsv, type: cleanedData.type, - searchTsvRank: cleanedData.searchTsvRank, }, select: { id: true, diff --git a/sdk/constructive-cli/src/public/cli/commands/users-module.ts b/sdk/constructive-cli/src/public/cli/commands/users-module.ts index 0d14bfb9d..0f08c879c 100644 --- a/sdk/constructive-cli/src/public/cli/commands/users-module.ts +++ b/sdk/constructive-cli/src/public/cli/commands/users-module.ts @@ -1,4 +1,3 @@ -// @ts-nocheck /** * CLI commands for UsersModule * @generated by @constructive-io/graphql-codegen @@ -7,7 +6,9 @@ import { CLIOptions, Inquirerer, extractFirst } from 'inquirerer'; import { getClient } from '../executor'; import { coerceAnswers, stripUndefined } from '../utils'; -const fieldSchema = { +import type { FieldSchema } from '../utils'; +import type { CreateUsersModuleInput, UsersModulePatch } from '../../orm/input-types'; +const fieldSchema: FieldSchema = { id: 'uuid', databaseId: 'uuid', schemaId: 'uuid', @@ -37,7 +38,7 @@ export default async ( options: ['list', 'get', 'create', 'update', 'delete'], }, ]); - return handleTableSubcommand(answer.subcommand, newArgv, prompter); + return handleTableSubcommand(answer.subcommand as string, newArgv, prompter); } return handleTableSubcommand(subcommand, newArgv, prompter); }; @@ -100,7 +101,7 @@ async function handleGet(argv: Partial>, prompter: Inqui const client = getClient(); const result = await client.usersModule .findOne({ - id: answers.id, + id: answers.id as string, select: { id: true, databaseId: true, @@ -162,7 +163,10 @@ async function handleCreate(argv: Partial>, prompter: In }, ]); const answers = coerceAnswers(rawAnswers, fieldSchema); - const cleanedData = stripUndefined(answers, fieldSchema); + const cleanedData = stripUndefined( + answers, + fieldSchema + ) as CreateUsersModuleInput['usersModule']; const client = getClient(); const result = await client.usersModule .create({ @@ -241,7 +245,7 @@ async function handleUpdate(argv: Partial>, prompter: In }, ]); const answers = coerceAnswers(rawAnswers, fieldSchema); - const cleanedData = stripUndefined(answers, fieldSchema); + const cleanedData = stripUndefined(answers, fieldSchema) as UsersModulePatch; const client = getClient(); const result = await client.usersModule .update({ diff --git a/sdk/constructive-cli/src/public/cli/commands/uuid-module.ts b/sdk/constructive-cli/src/public/cli/commands/uuid-module.ts index c6fb1df31..b18369eb6 100644 --- a/sdk/constructive-cli/src/public/cli/commands/uuid-module.ts +++ b/sdk/constructive-cli/src/public/cli/commands/uuid-module.ts @@ -1,4 +1,3 @@ -// @ts-nocheck /** * CLI commands for UuidModule * @generated by @constructive-io/graphql-codegen @@ -7,7 +6,9 @@ import { CLIOptions, Inquirerer, extractFirst } from 'inquirerer'; import { getClient } from '../executor'; import { coerceAnswers, stripUndefined } from '../utils'; -const fieldSchema = { +import type { FieldSchema } from '../utils'; +import type { CreateUuidModuleInput, UuidModulePatch } from '../../orm/input-types'; +const fieldSchema: FieldSchema = { id: 'uuid', databaseId: 'uuid', schemaId: 'uuid', @@ -35,7 +36,7 @@ export default async ( options: ['list', 'get', 'create', 'update', 'delete'], }, ]); - return handleTableSubcommand(answer.subcommand, newArgv, prompter); + return handleTableSubcommand(answer.subcommand as string, newArgv, prompter); } return handleTableSubcommand(subcommand, newArgv, prompter); }; @@ -96,7 +97,7 @@ async function handleGet(argv: Partial>, prompter: Inqui const client = getClient(); const result = await client.uuidModule .findOne({ - id: answers.id, + id: answers.id as string, select: { id: true, databaseId: true, @@ -144,7 +145,7 @@ async function handleCreate(argv: Partial>, prompter: In }, ]); const answers = coerceAnswers(rawAnswers, fieldSchema); - const cleanedData = stripUndefined(answers, fieldSchema); + const cleanedData = stripUndefined(answers, fieldSchema) as CreateUuidModuleInput['uuidModule']; const client = getClient(); const result = await client.uuidModule .create({ @@ -207,7 +208,7 @@ async function handleUpdate(argv: Partial>, prompter: In }, ]); const answers = coerceAnswers(rawAnswers, fieldSchema); - const cleanedData = stripUndefined(answers, fieldSchema); + const cleanedData = stripUndefined(answers, fieldSchema) as UuidModulePatch; const client = getClient(); const result = await client.uuidModule .update({ diff --git a/sdk/constructive-cli/src/public/cli/commands/verify-email.ts b/sdk/constructive-cli/src/public/cli/commands/verify-email.ts index f6302c6ff..31012e653 100644 --- a/sdk/constructive-cli/src/public/cli/commands/verify-email.ts +++ b/sdk/constructive-cli/src/public/cli/commands/verify-email.ts @@ -1,4 +1,3 @@ -// @ts-nocheck /** * CLI command for mutation verifyEmail * @generated by @constructive-io/graphql-codegen @@ -7,6 +6,8 @@ import { CLIOptions, Inquirerer } from 'inquirerer'; import { getClient } from '../executor'; import { parseMutationInput, buildSelectFromPaths } from '../utils'; +import type { VerifyEmailVariables } from '../../orm/mutation'; +import type { VerifyEmailPayloadSelect } from '../../orm/input-types'; export default async ( argv: Partial>, prompter: Inquirerer, @@ -28,11 +29,16 @@ export default async ( ]); const client = getClient(); const parsedAnswers = parseMutationInput(answers); - const selectFields = buildSelectFromPaths(argv.select ?? 'clientMutationId'); + const selectFields = buildSelectFromPaths((argv.select as string) ?? 'clientMutationId'); const result = await client.mutation - .verifyEmail(parsedAnswers, { - select: selectFields, - }) + .verifyEmail( + parsedAnswers as unknown as VerifyEmailVariables, + { + select: selectFields, + } as unknown as { + select: VerifyEmailPayloadSelect; + } + ) .execute(); console.log(JSON.stringify(result, null, 2)); } catch (error) { diff --git a/sdk/constructive-cli/src/public/cli/commands/verify-password.ts b/sdk/constructive-cli/src/public/cli/commands/verify-password.ts index 28fe9f91b..1fbec78f4 100644 --- a/sdk/constructive-cli/src/public/cli/commands/verify-password.ts +++ b/sdk/constructive-cli/src/public/cli/commands/verify-password.ts @@ -1,4 +1,3 @@ -// @ts-nocheck /** * CLI command for mutation verifyPassword * @generated by @constructive-io/graphql-codegen @@ -7,6 +6,8 @@ import { CLIOptions, Inquirerer } from 'inquirerer'; import { getClient } from '../executor'; import { parseMutationInput, buildSelectFromPaths } from '../utils'; +import type { VerifyPasswordVariables } from '../../orm/mutation'; +import type { VerifyPasswordPayloadSelect } from '../../orm/input-types'; export default async ( argv: Partial>, prompter: Inquirerer, @@ -28,11 +29,16 @@ export default async ( ]); const client = getClient(); const parsedAnswers = parseMutationInput(answers); - const selectFields = buildSelectFromPaths(argv.select ?? 'clientMutationId'); + const selectFields = buildSelectFromPaths((argv.select as string) ?? 'clientMutationId'); const result = await client.mutation - .verifyPassword(parsedAnswers, { - select: selectFields, - }) + .verifyPassword( + parsedAnswers as unknown as VerifyPasswordVariables, + { + select: selectFields, + } as unknown as { + select: VerifyPasswordPayloadSelect; + } + ) .execute(); console.log(JSON.stringify(result, null, 2)); } catch (error) { diff --git a/sdk/constructive-cli/src/public/cli/commands/verify-totp.ts b/sdk/constructive-cli/src/public/cli/commands/verify-totp.ts index fadbb9235..b8c3f8267 100644 --- a/sdk/constructive-cli/src/public/cli/commands/verify-totp.ts +++ b/sdk/constructive-cli/src/public/cli/commands/verify-totp.ts @@ -1,4 +1,3 @@ -// @ts-nocheck /** * CLI command for mutation verifyTotp * @generated by @constructive-io/graphql-codegen @@ -7,6 +6,8 @@ import { CLIOptions, Inquirerer } from 'inquirerer'; import { getClient } from '../executor'; import { parseMutationInput, buildSelectFromPaths } from '../utils'; +import type { VerifyTotpVariables } from '../../orm/mutation'; +import type { VerifyTotpPayloadSelect } from '../../orm/input-types'; export default async ( argv: Partial>, prompter: Inquirerer, @@ -28,11 +29,16 @@ export default async ( ]); const client = getClient(); const parsedAnswers = parseMutationInput(answers); - const selectFields = buildSelectFromPaths(argv.select ?? 'clientMutationId'); + const selectFields = buildSelectFromPaths((argv.select as string) ?? 'clientMutationId'); const result = await client.mutation - .verifyTotp(parsedAnswers, { - select: selectFields, - }) + .verifyTotp( + parsedAnswers as unknown as VerifyTotpVariables, + { + select: selectFields, + } as unknown as { + select: VerifyTotpPayloadSelect; + } + ) .execute(); console.log(JSON.stringify(result, null, 2)); } catch (error) { diff --git a/sdk/constructive-cli/src/public/cli/commands/view-grant.ts b/sdk/constructive-cli/src/public/cli/commands/view-grant.ts index 4f87b366a..632bd8942 100644 --- a/sdk/constructive-cli/src/public/cli/commands/view-grant.ts +++ b/sdk/constructive-cli/src/public/cli/commands/view-grant.ts @@ -1,4 +1,3 @@ -// @ts-nocheck /** * CLI commands for ViewGrant * @generated by @constructive-io/graphql-codegen @@ -7,7 +6,9 @@ import { CLIOptions, Inquirerer, extractFirst } from 'inquirerer'; import { getClient } from '../executor'; import { coerceAnswers, stripUndefined } from '../utils'; -const fieldSchema = { +import type { FieldSchema } from '../utils'; +import type { CreateViewGrantInput, ViewGrantPatch } from '../../orm/input-types'; +const fieldSchema: FieldSchema = { id: 'uuid', databaseId: 'uuid', viewId: 'uuid', @@ -37,7 +38,7 @@ export default async ( options: ['list', 'get', 'create', 'update', 'delete'], }, ]); - return handleTableSubcommand(answer.subcommand, newArgv, prompter); + return handleTableSubcommand(answer.subcommand as string, newArgv, prompter); } return handleTableSubcommand(subcommand, newArgv, prompter); }; @@ -100,7 +101,7 @@ async function handleGet(argv: Partial>, prompter: Inqui const client = getClient(); const result = await client.viewGrant .findOne({ - id: answers.id, + id: answers.id as string, select: { id: true, databaseId: true, @@ -162,7 +163,7 @@ async function handleCreate(argv: Partial>, prompter: In }, ]); const answers = coerceAnswers(rawAnswers, fieldSchema); - const cleanedData = stripUndefined(answers, fieldSchema); + const cleanedData = stripUndefined(answers, fieldSchema) as CreateViewGrantInput['viewGrant']; const client = getClient(); const result = await client.viewGrant .create({ @@ -241,7 +242,7 @@ async function handleUpdate(argv: Partial>, prompter: In }, ]); const answers = coerceAnswers(rawAnswers, fieldSchema); - const cleanedData = stripUndefined(answers, fieldSchema); + const cleanedData = stripUndefined(answers, fieldSchema) as ViewGrantPatch; const client = getClient(); const result = await client.viewGrant .update({ diff --git a/sdk/constructive-cli/src/public/cli/commands/view-rule.ts b/sdk/constructive-cli/src/public/cli/commands/view-rule.ts index e8c476cd5..f136e671f 100644 --- a/sdk/constructive-cli/src/public/cli/commands/view-rule.ts +++ b/sdk/constructive-cli/src/public/cli/commands/view-rule.ts @@ -1,4 +1,3 @@ -// @ts-nocheck /** * CLI commands for ViewRule * @generated by @constructive-io/graphql-codegen @@ -7,7 +6,9 @@ import { CLIOptions, Inquirerer, extractFirst } from 'inquirerer'; import { getClient } from '../executor'; import { coerceAnswers, stripUndefined } from '../utils'; -const fieldSchema = { +import type { FieldSchema } from '../utils'; +import type { CreateViewRuleInput, ViewRulePatch } from '../../orm/input-types'; +const fieldSchema: FieldSchema = { id: 'uuid', databaseId: 'uuid', viewId: 'uuid', @@ -36,7 +37,7 @@ export default async ( options: ['list', 'get', 'create', 'update', 'delete'], }, ]); - return handleTableSubcommand(answer.subcommand, newArgv, prompter); + return handleTableSubcommand(answer.subcommand as string, newArgv, prompter); } return handleTableSubcommand(subcommand, newArgv, prompter); }; @@ -98,7 +99,7 @@ async function handleGet(argv: Partial>, prompter: Inqui const client = getClient(); const result = await client.viewRule .findOne({ - id: answers.id, + id: answers.id as string, select: { id: true, databaseId: true, @@ -153,7 +154,7 @@ async function handleCreate(argv: Partial>, prompter: In }, ]); const answers = coerceAnswers(rawAnswers, fieldSchema); - const cleanedData = stripUndefined(answers, fieldSchema); + const cleanedData = stripUndefined(answers, fieldSchema) as CreateViewRuleInput['viewRule']; const client = getClient(); const result = await client.viewRule .create({ @@ -224,7 +225,7 @@ async function handleUpdate(argv: Partial>, prompter: In }, ]); const answers = coerceAnswers(rawAnswers, fieldSchema); - const cleanedData = stripUndefined(answers, fieldSchema); + const cleanedData = stripUndefined(answers, fieldSchema) as ViewRulePatch; const client = getClient(); const result = await client.viewRule .update({ diff --git a/sdk/constructive-cli/src/public/cli/commands/view-table.ts b/sdk/constructive-cli/src/public/cli/commands/view-table.ts index aff1166e8..5fc018a2a 100644 --- a/sdk/constructive-cli/src/public/cli/commands/view-table.ts +++ b/sdk/constructive-cli/src/public/cli/commands/view-table.ts @@ -1,4 +1,3 @@ -// @ts-nocheck /** * CLI commands for ViewTable * @generated by @constructive-io/graphql-codegen @@ -7,7 +6,9 @@ import { CLIOptions, Inquirerer, extractFirst } from 'inquirerer'; import { getClient } from '../executor'; import { coerceAnswers, stripUndefined } from '../utils'; -const fieldSchema = { +import type { FieldSchema } from '../utils'; +import type { CreateViewTableInput, ViewTablePatch } from '../../orm/input-types'; +const fieldSchema: FieldSchema = { id: 'uuid', viewId: 'uuid', tableId: 'uuid', @@ -34,7 +35,7 @@ export default async ( options: ['list', 'get', 'create', 'update', 'delete'], }, ]); - return handleTableSubcommand(answer.subcommand, newArgv, prompter); + return handleTableSubcommand(answer.subcommand as string, newArgv, prompter); } return handleTableSubcommand(subcommand, newArgv, prompter); }; @@ -94,7 +95,7 @@ async function handleGet(argv: Partial>, prompter: Inqui const client = getClient(); const result = await client.viewTable .findOne({ - id: answers.id, + id: answers.id as string, select: { id: true, viewId: true, @@ -135,7 +136,7 @@ async function handleCreate(argv: Partial>, prompter: In }, ]); const answers = coerceAnswers(rawAnswers, fieldSchema); - const cleanedData = stripUndefined(answers, fieldSchema); + const cleanedData = stripUndefined(answers, fieldSchema) as CreateViewTableInput['viewTable']; const client = getClient(); const result = await client.viewTable .create({ @@ -190,7 +191,7 @@ async function handleUpdate(argv: Partial>, prompter: In }, ]); const answers = coerceAnswers(rawAnswers, fieldSchema); - const cleanedData = stripUndefined(answers, fieldSchema); + const cleanedData = stripUndefined(answers, fieldSchema) as ViewTablePatch; const client = getClient(); const result = await client.viewTable .update({ diff --git a/sdk/constructive-cli/src/public/cli/commands/view.ts b/sdk/constructive-cli/src/public/cli/commands/view.ts index 0c0dd085f..43658e746 100644 --- a/sdk/constructive-cli/src/public/cli/commands/view.ts +++ b/sdk/constructive-cli/src/public/cli/commands/view.ts @@ -1,4 +1,3 @@ -// @ts-nocheck /** * CLI commands for View * @generated by @constructive-io/graphql-codegen @@ -7,7 +6,9 @@ import { CLIOptions, Inquirerer, extractFirst } from 'inquirerer'; import { getClient } from '../executor'; import { coerceAnswers, stripUndefined } from '../utils'; -const fieldSchema = { +import type { FieldSchema } from '../utils'; +import type { CreateViewInput, ViewPatch } from '../../orm/input-types'; +const fieldSchema: FieldSchema = { id: 'uuid', databaseId: 'uuid', schemaId: 'uuid', @@ -46,7 +47,7 @@ export default async ( options: ['list', 'get', 'create', 'update', 'delete'], }, ]); - return handleTableSubcommand(answer.subcommand, newArgv, prompter); + return handleTableSubcommand(answer.subcommand as string, newArgv, prompter); } return handleTableSubcommand(subcommand, newArgv, prompter); }; @@ -118,7 +119,7 @@ async function handleGet(argv: Partial>, prompter: Inqui const client = getClient(); const result = await client.view .findOne({ - id: answers.id, + id: answers.id as string, select: { id: true, databaseId: true, @@ -243,7 +244,7 @@ async function handleCreate(argv: Partial>, prompter: In }, ]); const answers = coerceAnswers(rawAnswers, fieldSchema); - const cleanedData = stripUndefined(answers, fieldSchema); + const cleanedData = stripUndefined(answers, fieldSchema) as CreateViewInput['view']; const client = getClient(); const result = await client.view .create({ @@ -394,7 +395,7 @@ async function handleUpdate(argv: Partial>, prompter: In }, ]); const answers = coerceAnswers(rawAnswers, fieldSchema); - const cleanedData = stripUndefined(answers, fieldSchema); + const cleanedData = stripUndefined(answers, fieldSchema) as ViewPatch; const client = getClient(); const result = await client.view .update({ diff --git a/sdk/constructive-cli/src/public/cli/executor.ts b/sdk/constructive-cli/src/public/cli/executor.ts index 08615a32b..721e8e68e 100644 --- a/sdk/constructive-cli/src/public/cli/executor.ts +++ b/sdk/constructive-cli/src/public/cli/executor.ts @@ -1,4 +1,3 @@ -// @ts-nocheck /** * Executor and config store for CLI * @generated by @constructive-io/graphql-codegen @@ -22,7 +21,7 @@ export function getClient(contextName?: string) { throw new Error('No active context. Run "context create" or "context use" first.'); } } - const headers = {}; + const headers: Record = {}; if (store.hasValidCredentials(ctx.name)) { const creds = store.getCredentials(ctx.name); if (creds?.token) { diff --git a/sdk/constructive-cli/src/public/cli/index.ts b/sdk/constructive-cli/src/public/cli/index.ts index fc2ecaced..05d1f1ecb 100644 --- a/sdk/constructive-cli/src/public/cli/index.ts +++ b/sdk/constructive-cli/src/public/cli/index.ts @@ -1,4 +1,3 @@ -// @ts-nocheck /** * CLI entry point * @generated by @constructive-io/graphql-codegen diff --git a/sdk/constructive-cli/src/public/cli/node-fetch.ts b/sdk/constructive-cli/src/public/cli/node-fetch.ts index 7390a6cb6..81bb05834 100644 --- a/sdk/constructive-cli/src/public/cli/node-fetch.ts +++ b/sdk/constructive-cli/src/public/cli/node-fetch.ts @@ -1,4 +1,3 @@ -// @ts-nocheck /** * Node HTTP adapter for localhost subdomain routing * @generated by @constructive-io/graphql-codegen diff --git a/sdk/constructive-cli/src/public/cli/utils.ts b/sdk/constructive-cli/src/public/cli/utils.ts index eb869282d..e55945fee 100644 --- a/sdk/constructive-cli/src/public/cli/utils.ts +++ b/sdk/constructive-cli/src/public/cli/utils.ts @@ -1,4 +1,3 @@ -// @ts-nocheck /** * CLI utility functions for type coercion and input handling * @generated by @constructive-io/graphql-codegen