@m1212e/rumble 0.11.1 → 0.11.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"sources":["../lib/client/generate/client.ts","../node_modules/graphql/jsutils/devAssert.mjs","../node_modules/graphql/jsutils/isObjectLike.mjs","../node_modules/graphql/jsutils/invariant.mjs","../node_modules/graphql/language/location.mjs","../node_modules/graphql/language/printLocation.mjs","../node_modules/graphql/error/GraphQLError.mjs","../node_modules/graphql/language/ast.mjs","../node_modules/graphql/language/kinds.mjs","../node_modules/graphql/language/characterClasses.mjs","../node_modules/graphql/language/blockString.mjs","../node_modules/graphql/jsutils/inspect.mjs","../node_modules/graphql/jsutils/instanceOf.mjs","../node_modules/graphql/jsutils/didYouMean.mjs","../node_modules/graphql/jsutils/identityFunc.mjs","../node_modules/graphql/jsutils/keyMap.mjs","../node_modules/graphql/jsutils/keyValMap.mjs","../node_modules/graphql/jsutils/mapValue.mjs","../node_modules/graphql/jsutils/naturalCompare.mjs","../node_modules/graphql/jsutils/suggestionList.mjs","../node_modules/graphql/jsutils/toObjMap.mjs","../node_modules/graphql/language/printString.mjs","../node_modules/graphql/language/visitor.mjs","../node_modules/graphql/language/printer.mjs","../node_modules/graphql/utilities/valueFromASTUntyped.mjs","../node_modules/graphql/type/assertName.mjs","../node_modules/graphql/type/definition.mjs","../lib/client/generate/tsRepresentation.ts","../lib/client/generate/generate.ts","../lib/client/request.ts","../lib/client/liveQuery.ts","../lib/client/mutation.ts","../lib/client/query.ts","../lib/client/subscription.ts","../lib/types/rumbleError.ts","../lib/helpers/helper.ts","../lib/helpers/lazy.ts","../lib/helpers/sqlTypes/types.ts","../lib/helpers/sqlTypes/distinctValuesFromSQLType.ts","../lib/helpers/tableHelpers.ts","../lib/abilityBuilder.ts","../lib/client/client.ts","../lib/context.ts","../lib/enum.ts","../lib/helpers/sofaOpenAPIWebhookDocs.ts","../lib/helpers/sqlTypes/mapSQLTypeToTSType.ts","../lib/helpers/determineDialectFromSchema.ts","../lib/search.ts","../lib/object.ts","../lib/orderArg.ts","../lib/pubsub.ts","../lib/query.ts","../lib/runtimeFiltersPlugin/runtimeFiltersPlugin.ts","../lib/whereArg.ts","../lib/schemaBuilder.ts","../lib/rumble.ts"],"names":["generateClient","apiUrl","rumbleImportPath","useExternalUrqlClient","availableSubscriptions","imports","code","value","devAssert","condition","message","isObjectLike","invariant","LineRegExp","getLocation","source","position","lastLineStart","line","match","printLocation","location","printSourceLocation","sourceLocation","firstLineColumnOffset","body","lineIndex","lineOffset","lineNum","columnOffset","columnNum","locationStr","lines","locationLine","subLineIndex","subLineColumnNum","subLines","i","printPrefixedLines","subLine","existingLines","_","padLen","prefix","toNormalizedOptions","args","firstArg","GraphQLError","_GraphQLError","rawArgs","_this$nodes","_nodeLocations$","_ref","nodes","positions","path","originalError","extensions","undefinedIfEmpty","nodeLocations","node","loc","pos","originalExtensions","output","formattedError","array","QueryDocumentKeys","kindValues","isNode","maybeNode","maybeKind","OperationTypeNode","Kind","isWhiteSpace","isDigit","isLetter","isNameStart","isNameContinue","printBlockString","options","escapedValue","isSingleLine","forceLeadingNewLine","hasTrailingTripleQuotes","hasTrailingQuote","hasTrailingSlash","forceTrailingNewline","printAsMultipleLines","result","skipLeadingNewLine","inspect","formatValue","seenValues","formatObjectValue","previouslySeenValues","isJSONable","jsonValue","formatArray","formatObject","object","entries","getObjectTag","key","len","remaining","items","tag","name","isProduction","instanceOf","constructor","_value$constructor","className","valueClassName","stringifiedValue","didYouMean","secondArg","subMessage","suggestionsArg","suggestions","x","selected","lastItem","identityFunc","keyMap","list","keyFn","item","keyValMap","valFn","mapValue","map","fn","naturalCompare","aStr","bStr","aIndex","bIndex","aChar","bChar","aNum","DIGIT_0","bNum","DIGIT_9","suggestionList","input","optionsByDistance","lexicalDistance","LexicalDistance","threshold","option","distance","a","b","distanceDiff","stringToArray","optionLowerCase","tmp","aLength","bLength","rows","j","upRow","currentRow","smallestCell","cost","currentCell","doubleDiagonalCell","str","strLength","toObjMap","obj","printString","escapedRegExp","escapedReplacer","escapeSequences","BREAK","visit","root","visitor","visitorKeys","enterLeaveMap","kind","getEnterLeaveForKind","stack","inArray","keys","index","edits","parent","ancestors","isLeaving","isEdited","editOffset","editKey","editValue","arrayKey","_enterLeaveMap$get","_enterLeaveMap$get2","visitFn","_node$kind","kindVisitor","print","ast","printDocASTReducer","MAX_LINE_LENGTH","join","varDefs","wrap","variable","type","defaultValue","directives","selections","block","alias","selectionSet","argsLine","indent","typeCondition","variableDefinitions","isBlockString","values","fields","description","operationTypes","operation","interfaces","hasMultilineItems","types","repeatable","locations","maybeArray","separator","_maybeArray$filter$jo","start","maybeString","end","_maybeArray$some","valueFromASTUntyped","valueNode","variables","field","assertName","assertEnumValueName","isType","isScalarType","isObjectType","isInterfaceType","isUnionType","isEnumType","isInputObjectType","isListType","isNonNullType","GraphQLScalarType","GraphQLObjectType","GraphQLInterfaceType","GraphQLUnionType","GraphQLEnumType","GraphQLInputObjectType","GraphQLList","GraphQLNonNull","ofType","isNullableType","resolveReadonlyArrayThunk","thunk","resolveObjMapThunk","config","_config$parseValue","_config$serialize","_config$parseLiteral","_config$extensionASTN","parseValue","_config$extensionASTN2","defineFieldMap","defineInterfaces","fieldsToFieldsConfig","_config$interfaces","fieldMap","isPlainObj","fieldConfig","fieldName","_fieldConfig$args","argsConfig","defineArguments","argName","argConfig","argsToArgsConfig","arg","_config$extensionASTN3","_config$extensionASTN4","defineTypes","_config$extensionASTN5","defineEnumValues","outputValue","enumValue","inputValue","valueStr","didYouMeanEnumValue","_variables","enumType","unknownValueStr","allNames","suggestedValues","typeName","valueMap","valueName","valueConfig","_config$extensionASTN6","_config$isOneOf","defineInputFieldMap","makeTSRepresentation","model","makeTSTypeFromObject","mapGraphqlScalarToTSTypeString","makeStringLiteralUnionFromEnum","makeTSTypeFromInputObject","stringifiedFields","makeTSObjectTypeField","makeTSInputObjectTypeField","returnType","isNonNullReturnType","isList","returnTypeString","isRelationType","argsStringMap","stringifyTSObjectArg","makePOptional","ret","isNullable","generateFromSchema","outputPath","schema","exists","rm","mkdir","typeMap","c","writeFile","argsKey","makeGraphQLQuery","queryName","client","enableSubscription","otwQueryName","capitalize","argsString","stringifyArgumentObjectToGraphqlList","operationString","operationVerb","stringifySelection","awaitedReturnValueReference","response","pipe","merge","empty","v","data","onPush","promise","resolve","unsub","toObservable","newObservableWithAwaitedValue","fromValue","makeGraphQLMutation","mutationName","otwMutationName","observable","toPromise","res","makeGraphQLSubscription","subscriptionName","otwSubscriptionName","selection","acc","stringifyArgumentValue","makeLiveQuery","urqlClient","_target","prop","makeMutation","makeQuery","makeSubscription","RumbleError","RumbleErrorSafe","assertFindFirstExists","assertFirstEntryExists","applyFilters","filters","entities","context","f","val","mapNullFieldsToUndefined","lazy","initializer","initialized","UnknownTypeRumbleError","sqlType","additionalInfo","createDistinctValuesFromSQLType","nameSymbol","columnsSymbol","tableHelper","dbName","tsName","table","db","tableSchema","k","isSimpleQueryFilter","filter","isFunctionFilter","createAbilityBuilder","actions","defaultLimit","registrators","registeredQueryFilters","registeredRuntimeFilters","createRegistrator","tableName","action","queryFiltersPerEntity","queryFiltersPerEntityAndAction","queryFilter","explicitFilter","entityKey","userContext","builder","createEntityObject","transformToResponse","queryFilters","where","transformedWhere","relationsFilterToSQL","limit","columns","r","getBlockEverythingFilter","primaryKeyField","distinctValues","simpleQueryFilters","functionQueryFilters","someWildcardFound","allQueryFilters","e","highestLimit","conditionObject","combinedAllowedColumns","accumulatedWhereConditions","o","combinedWhere","clientCreatorImplementer","builtSchema","createContextFunction","makeUserContext","abilityBuilder","req","isEnumSchema","schemaType","PgEnumColumn","createEnumImplementer","schemaBuilder","referenceStorage","enumColumn","refName","enumSchemaName","enumValues","schemaEnum","enumCol","s","schemaEnumEntry","graphqlImplementationName","toCamelCase","sofaOpenAPIWebhookDocs","mapSQLTypeToGraphQLType","determineDBDialectFromSchema","found","PgTable","MySqlTable","SQLiteTable","dialects","isPostgresDB","initSearchIfApplicable","sql","adjustQueryForSearch","search","abilities","originalOrderBy","cloneDeep","argsOrderBySQL","columnsToSearch","searchSQL","originalWhere","isProbablyAConfigObject","t","createObjectImplementer","makePubSubInstance","whereArgImplementer","orderArgImplementer","enumImplementer","readAction","adjust","primaryKey","registerOnInstance","subscriptions","element","_context","primaryKeyValue","mapSQLTypeStringToExposedPothosType","columnName","nullable","gqlType","configMap","userAdjustments","target","params","ref","configObject","creatorFunction","enumImpl","relations","relationSchema","WhereArg","OrderArg","relationTablePubSub","isMany","filterSpecifier","One","subscribe","_element","plural","singular","ctx","makeDefaultName","createOrderArgImplementer","sortingParameterEnumRef","inputTypeName","referenceModel","SUBSCRIPTION_NOTIFIER_RUMBLE_PREFIX","SUBSCRIPTION_NOTIFIER_REMOVED","SUBSCRIPTION_NOTIFIER_UPDATED","SUBSCRIPTION_NOTIFIER_CREATED","createPubSubInstance","pubsub","createPubSub","makePubSubKey","actionKey","instance","uniqueKeys","createQueryImplementer","listAction","manyArgs","_root","_args","_ctx","_info","query","queryInstance","pluginName","runtimeFiltersPlugin_default","applyFiltersKey","ManualFiltersPlugin","BasePlugin","resolver","info","fieldType","resolved","allResolvedValues","allFilters","allowed","SchemaBuilder","createWhereArgImplementer","mapSQLTypeStringToInputPothosType","implementDefaultWhereInputArgs","IntWhereInputArgument","FloatWhereInputArgument","StringWhereInputArgument","DateWhereInputArgument","createSchemaBuilder","disableDefaultObjects","pothosConfig","DrizzlePlugin","SmartSubscriptionsPlugin","subscribeOptionsFromIterator","JSONResolver","DateResolver","DateTimeISOResolver","rumble","rumbleInput","enum_","whereArg","orderArg","createYoga","enableApiDocs","nativeCreateYoga","useDisableIntrospection","EnvelopArmorPlugin","createSofa","useSofa","clientCreator"],"mappings":"68BAAO,SAASA,EAAAA,CAAe,CAC9B,MAAA,CAAAC,CAAAA,CACA,gBAAA,CAAAC,CAAAA,CACA,qBAAA,CAAAC,CAAAA,CACA,sBA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GyI,CAAAA,CACH,YAAAxI,CACD,CAAC,CAAA,CAED,OAAO,CAiBN,cAAA,CAAAG,CAAAA,CAIA,aAAA,CAAAM,CAAAA,CAgBA,UAAA,CAAAmI,CAAAA,CAaA,UAAA,CAAAK,CAAAA,CAIA,MAAA,CAAApf,EAIA,QAAA,CAAA6e,CAAAA,CAIA,QAAA,CAAAC,CAAAA,CAKA,KAAA,CAAAnC,CAAAA,CAIA,MAAA,CAAQ5D,CAAAA,CAMR,KAAA,CAAA6F,CAAAA,CAKA,aAAA,CAAAU,CACD,CACD","file":"index.js","sourcesContent":["export function generateClient({\n\tapiUrl,\n\trumbleImportPath,\n\tuseExternalUrqlClient,\n\tavailableSubscriptions,\n}: {\n\trumbleImportPath: string;\n\tuseExternalUrqlClient: string | boolean;\n\tapiUrl?: string;\n\tavailableSubscriptions: Set<string>;\n}) {\n\tconst imports: string[] = [];\n\tlet code: string = \"\";\n\n\tif (typeof useExternalUrqlClient === \"string\") {\n\t\timports.push(`import { urqlClient } from \"${useExternalUrqlClient}\";`);\n\t} else {\n\t\timports.push(`import { Client, fetchExchange } from '@urql/core';`);\n\t\timports.push(`import { cacheExchange } from '@urql/exchange-graphcache';`);\n\t}\n\n\timports.push(\n\t\t`import { makeLiveQuery, makeMutation, makeSubscription, makeQuery } from '${rumbleImportPath}';`,\n\t);\n\n\tif (!useExternalUrqlClient) {\n\t\tcode += `\nconst urqlClient = new Client({\n url: \"${apiUrl ?? \"PLEASE PROVIDE A URL WHEN GENERATING OR IMPORT AN EXTERNAL URQL CLIENT\"}\",\n fetchSubscriptions: true,\n exchanges: [cacheExchange({}), fetchExchange],\n fetchOptions: {\n credentials: \"include\",\n },\n requestPolicy: \"cache-and-network\",\n});\n`;\n\t}\n\n\tcode += `\nexport const client = {\n /**\n * A query and subscription combination. First queries and if exists, also subscribes to a subscription of the same name.\n * Combines the results of both, so the result is first the query result and then live updates from the subscription.\n * Assumes that the query and subscription return the same fields as per default when using the rumble query helpers.\n * If no subscription with the same name exists, this will just be a query.\n */\n liveQuery: makeLiveQuery<Query>({\n\t urqlClient,\n\t availableSubscriptions: new Set([${availableSubscriptions\n\t\t\t.values()\n\t\t\t.toArray()\n\t\t\t.map((value) => `\"${value}\"`)\n\t\t\t.join(\", \")}]),\n }),\n /**\n * A mutation that can be used to e.g. create, update or delete data.\n */\n mutate: makeMutation<Mutation>({\n\t urqlClient,\n }),\n /**\n * A continuous stream of results that updates when the server sends new data.\n */\n subscribe: makeSubscription<Subscription>({\n\t urqlClient,\n }),\n /**\n * A one-time fetch of data.\n */\n query: makeQuery<Query>({\n\t urqlClient,\n }),\n}`;\n\n\treturn {\n\t\timports,\n\t\tcode,\n\t};\n}\n","export function devAssert(condition, message) {\n const booleanCondition = Boolean(condition);\n\n if (!booleanCondition) {\n throw new Error(message);\n }\n}\n","/**\n * Return true if `value` is object-like. A value is object-like if it's not\n * `null` and has a `typeof` result of \"object\".\n */\nexport function isObjectLike(value) {\n return typeof value == 'object' && value !== null;\n}\n","export function invariant(condition, message) {\n const booleanCondition = Boolean(condition);\n\n if (!booleanCondition) {\n throw new Error(\n message != null ? message : 'Unexpected invariant triggered.',\n );\n }\n}\n","import { invariant } from '../jsutils/invariant.mjs';\nconst LineRegExp = /\\r\\n|[\\n\\r]/g;\n/**\n * Represents a location in a Source.\n */\n\n/**\n * Takes a Source and a UTF-8 character offset, and returns the corresponding\n * line and column as a SourceLocation.\n */\nexport function getLocation(source, position) {\n let lastLineStart = 0;\n let line = 1;\n\n for (const match of source.body.matchAll(LineRegExp)) {\n typeof match.index === 'number' || invariant(false);\n\n if (match.index >= position) {\n break;\n }\n\n lastLineStart = match.index + match[0].length;\n line += 1;\n }\n\n return {\n line,\n column: position + 1 - lastLineStart,\n };\n}\n","import { getLocation } from './location.mjs';\n\n/**\n * Render a helpful description of the location in the GraphQL Source document.\n */\nexport function printLocation(location) {\n return printSourceLocation(\n location.source,\n getLocation(location.source, location.start),\n );\n}\n/**\n * Render a helpful description of the location in the GraphQL Source document.\n */\n\nexport function printSourceLocation(source, sourceLocation) {\n const firstLineColumnOffset = source.locationOffset.column - 1;\n const body = ''.padStart(firstLineColumnOffset) + source.body;\n const lineIndex = sourceLocation.line - 1;\n const lineOffset = source.locationOffset.line - 1;\n const lineNum = sourceLocation.line + lineOffset;\n const columnOffset = sourceLocation.line === 1 ? firstLineColumnOffset : 0;\n const columnNum = sourceLocation.column + columnOffset;\n const locationStr = `${source.name}:${lineNum}:${columnNum}\\n`;\n const lines = body.split(/\\r\\n|[\\n\\r]/g);\n const locationLine = lines[lineIndex]; // Special case for minified documents\n\n if (locationLine.length > 120) {\n const subLineIndex = Math.floor(columnNum / 80);\n const subLineColumnNum = columnNum % 80;\n const subLines = [];\n\n for (let i = 0; i < locationLine.length; i += 80) {\n subLines.push(locationLine.slice(i, i + 80));\n }\n\n return (\n locationStr +\n printPrefixedLines([\n [`${lineNum} |`, subLines[0]],\n ...subLines.slice(1, subLineIndex + 1).map((subLine) => ['|', subLine]),\n ['|', '^'.padStart(subLineColumnNum)],\n ['|', subLines[subLineIndex + 1]],\n ])\n );\n }\n\n return (\n locationStr +\n printPrefixedLines([\n // Lines specified like this: [\"prefix\", \"string\"],\n [`${lineNum - 1} |`, lines[lineIndex - 1]],\n [`${lineNum} |`, locationLine],\n ['|', '^'.padStart(columnNum)],\n [`${lineNum + 1} |`, lines[lineIndex + 1]],\n ])\n );\n}\n\nfunction printPrefixedLines(lines) {\n const existingLines = lines.filter(([_, line]) => line !== undefined);\n const padLen = Math.max(...existingLines.map(([prefix]) => prefix.length));\n return existingLines\n .map(([prefix, line]) => prefix.padStart(padLen) + (line ? ' ' + line : ''))\n .join('\\n');\n}\n","import { isObjectLike } from '../jsutils/isObjectLike.mjs';\nimport { getLocation } from '../language/location.mjs';\nimport {\n printLocation,\n printSourceLocation,\n} from '../language/printLocation.mjs';\n\nfunction toNormalizedOptions(args) {\n const firstArg = args[0];\n\n if (firstArg == null || 'kind' in firstArg || 'length' in firstArg) {\n return {\n nodes: firstArg,\n source: args[1],\n positions: args[2],\n path: args[3],\n originalError: args[4],\n extensions: args[5],\n };\n }\n\n return firstArg;\n}\n/**\n * A GraphQLError describes an Error found during the parse, validate, or\n * execute phases of performing a GraphQL operation. In addition to a message\n * and stack trace, it also includes information about the locations in a\n * GraphQL document and/or execution result that correspond to the Error.\n */\n\nexport class GraphQLError extends Error {\n /**\n * An array of `{ line, column }` locations within the source GraphQL document\n * which correspond to this error.\n *\n * Errors during validation often contain multiple locations, for example to\n * point out two things with the same name. Errors during execution include a\n * single location, the field which produced the error.\n *\n * Enumerable, and appears in the result of JSON.stringify().\n */\n\n /**\n * An array describing the JSON-path into the execution response which\n * corresponds to this error. Only included for errors during execution.\n *\n * Enumerable, and appears in the result of JSON.stringify().\n */\n\n /**\n * An array of GraphQL AST Nodes corresponding to this error.\n */\n\n /**\n * The source GraphQL document for the first location of this error.\n *\n * Note that if this Error represents more than one node, the source may not\n * represent nodes after the first node.\n */\n\n /**\n * An array of character offsets within the source GraphQL document\n * which correspond to this error.\n */\n\n /**\n * The original error thrown from a field resolver during execution.\n */\n\n /**\n * Extension fields to add to the formatted error.\n */\n\n /**\n * @deprecated Please use the `GraphQLErrorOptions` constructor overload instead.\n */\n constructor(message, ...rawArgs) {\n var _this$nodes, _nodeLocations$, _ref;\n\n const { nodes, source, positions, path, originalError, extensions } =\n toNormalizedOptions(rawArgs);\n super(message);\n this.name = 'GraphQLError';\n this.path = path !== null && path !== void 0 ? path : undefined;\n this.originalError =\n originalError !== null && originalError !== void 0\n ? originalError\n : undefined; // Compute list of blame nodes.\n\n this.nodes = undefinedIfEmpty(\n Array.isArray(nodes) ? nodes : nodes ? [nodes] : undefined,\n );\n const nodeLocations = undefinedIfEmpty(\n (_this$nodes = this.nodes) === null || _this$nodes === void 0\n ? void 0\n : _this$nodes.map((node) => node.loc).filter((loc) => loc != null),\n ); // Compute locations in the source for the given nodes/positions.\n\n this.source =\n source !== null && source !== void 0\n ? source\n : nodeLocations === null || nodeLocations === void 0\n ? void 0\n : (_nodeLocations$ = nodeLocations[0]) === null ||\n _nodeLocations$ === void 0\n ? void 0\n : _nodeLocations$.source;\n this.positions =\n positions !== null && positions !== void 0\n ? positions\n : nodeLocations === null || nodeLocations === void 0\n ? void 0\n : nodeLocations.map((loc) => loc.start);\n this.locations =\n positions && source\n ? positions.map((pos) => getLocation(source, pos))\n : nodeLocations === null || nodeLocations === void 0\n ? void 0\n : nodeLocations.map((loc) => getLocation(loc.source, loc.start));\n const originalExtensions = isObjectLike(\n originalError === null || originalError === void 0\n ? void 0\n : originalError.extensions,\n )\n ? originalError === null || originalError === void 0\n ? void 0\n : originalError.extensions\n : undefined;\n this.extensions =\n (_ref =\n extensions !== null && extensions !== void 0\n ? extensions\n : originalExtensions) !== null && _ref !== void 0\n ? _ref\n : Object.create(null); // Only properties prescribed by the spec should be enumerable.\n // Keep the rest as non-enumerable.\n\n Object.defineProperties(this, {\n message: {\n writable: true,\n enumerable: true,\n },\n name: {\n enumerable: false,\n },\n nodes: {\n enumerable: false,\n },\n source: {\n enumerable: false,\n },\n positions: {\n enumerable: false,\n },\n originalError: {\n enumerable: false,\n },\n }); // Include (non-enumerable) stack trace.\n\n /* c8 ignore start */\n // FIXME: https://github.com/graphql/graphql-js/issues/2317\n\n if (\n originalError !== null &&\n originalError !== void 0 &&\n originalError.stack\n ) {\n Object.defineProperty(this, 'stack', {\n value: originalError.stack,\n writable: true,\n configurable: true,\n });\n } else if (Error.captureStackTrace) {\n Error.captureStackTrace(this, GraphQLError);\n } else {\n Object.defineProperty(this, 'stack', {\n value: Error().stack,\n writable: true,\n configurable: true,\n });\n }\n /* c8 ignore stop */\n }\n\n get [Symbol.toStringTag]() {\n return 'GraphQLError';\n }\n\n toString() {\n let output = this.message;\n\n if (this.nodes) {\n for (const node of this.nodes) {\n if (node.loc) {\n output += '\\n\\n' + printLocation(node.loc);\n }\n }\n } else if (this.source && this.locations) {\n for (const location of this.locations) {\n output += '\\n\\n' + printSourceLocation(this.source, location);\n }\n }\n\n return output;\n }\n\n toJSON() {\n const formattedError = {\n message: this.message,\n };\n\n if (this.locations != null) {\n formattedError.locations = this.locations;\n }\n\n if (this.path != null) {\n formattedError.path = this.path;\n }\n\n if (this.extensions != null && Object.keys(this.extensions).length > 0) {\n formattedError.extensions = this.extensions;\n }\n\n return formattedError;\n }\n}\n\nfunction undefinedIfEmpty(array) {\n return array === undefined || array.length === 0 ? undefined : array;\n}\n/**\n * See: https://spec.graphql.org/draft/#sec-Errors\n */\n\n/**\n * Prints a GraphQLError to a string, representing useful location information\n * about the error's position in the source.\n *\n * @deprecated Please use `error.toString` instead. Will be removed in v17\n */\nexport function printError(error) {\n return error.toString();\n}\n/**\n * Given a GraphQLError, format it according to the rules described by the\n * Response Format, Errors section of the GraphQL Specification.\n *\n * @deprecated Please use `error.toJSON` instead. Will be removed in v17\n */\n\nexport function formatError(error) {\n return error.toJSON();\n}\n","/**\n * Contains a range of UTF-8 character offsets and token references that\n * identify the region of the source from which the AST derived.\n */\nexport class Location {\n /**\n * The character offset at which this Node begins.\n */\n\n /**\n * The character offset at which this Node ends.\n */\n\n /**\n * The Token at which this Node begins.\n */\n\n /**\n * The Token at which this Node ends.\n */\n\n /**\n * The Source document the AST represents.\n */\n constructor(startToken, endToken, source) {\n this.start = startToken.start;\n this.end = endToken.end;\n this.startToken = startToken;\n this.endToken = endToken;\n this.source = source;\n }\n\n get [Symbol.toStringTag]() {\n return 'Location';\n }\n\n toJSON() {\n return {\n start: this.start,\n end: this.end,\n };\n }\n}\n/**\n * Represents a range of characters represented by a lexical token\n * within a Source.\n */\n\nexport class Token {\n /**\n * The kind of Token.\n */\n\n /**\n * The character offset at which this Node begins.\n */\n\n /**\n * The character offset at which this Node ends.\n */\n\n /**\n * The 1-indexed line number on which this Token appears.\n */\n\n /**\n * The 1-indexed column number at which this Token begins.\n */\n\n /**\n * For non-punctuation tokens, represents the interpreted value of the token.\n *\n * Note: is undefined for punctuation tokens, but typed as string for\n * convenience in the parser.\n */\n\n /**\n * Tokens exist as nodes in a double-linked-list amongst all tokens\n * including ignored tokens. <SOF> is always the first node and <EOF>\n * the last.\n */\n constructor(kind, start, end, line, column, value) {\n this.kind = kind;\n this.start = start;\n this.end = end;\n this.line = line;\n this.column = column; // eslint-disable-next-line @typescript-eslint/no-non-null-assertion\n\n this.value = value;\n this.prev = null;\n this.next = null;\n }\n\n get [Symbol.toStringTag]() {\n return 'Token';\n }\n\n toJSON() {\n return {\n kind: this.kind,\n value: this.value,\n line: this.line,\n column: this.column,\n };\n }\n}\n/**\n * The list of all possible AST node types.\n */\n\n/**\n * @internal\n */\nexport const QueryDocumentKeys = {\n Name: [],\n Document: ['definitions'],\n OperationDefinition: [\n 'name',\n 'variableDefinitions',\n 'directives',\n 'selectionSet',\n ],\n VariableDefinition: ['variable', 'type', 'defaultValue', 'directives'],\n Variable: ['name'],\n SelectionSet: ['selections'],\n Field: ['alias', 'name', 'arguments', 'directives', 'selectionSet'],\n Argument: ['name', 'value'],\n FragmentSpread: ['name', 'directives'],\n InlineFragment: ['typeCondition', 'directives', 'selectionSet'],\n FragmentDefinition: [\n 'name', // Note: fragment variable definitions are deprecated and will removed in v17.0.0\n 'variableDefinitions',\n 'typeCondition',\n 'directives',\n 'selectionSet',\n ],\n IntValue: [],\n FloatValue: [],\n StringValue: [],\n BooleanValue: [],\n NullValue: [],\n EnumValue: [],\n ListValue: ['values'],\n ObjectValue: ['fields'],\n ObjectField: ['name', 'value'],\n Directive: ['name', 'arguments'],\n NamedType: ['name'],\n ListType: ['type'],\n NonNullType: ['type'],\n SchemaDefinition: ['description', 'directives', 'operationTypes'],\n OperationTypeDefinition: ['type'],\n ScalarTypeDefinition: ['description', 'name', 'directives'],\n ObjectTypeDefinition: [\n 'description',\n 'name',\n 'interfaces',\n 'directives',\n 'fields',\n ],\n FieldDefinition: ['description', 'name', 'arguments', 'type', 'directives'],\n InputValueDefinition: [\n 'description',\n 'name',\n 'type',\n 'defaultValue',\n 'directives',\n ],\n InterfaceTypeDefinition: [\n 'description',\n 'name',\n 'interfaces',\n 'directives',\n 'fields',\n ],\n UnionTypeDefinition: ['description', 'name', 'directives', 'types'],\n EnumTypeDefinition: ['description', 'name', 'directives', 'values'],\n EnumValueDefinition: ['description', 'name', 'directives'],\n InputObjectTypeDefinition: ['description', 'name', 'directives', 'fields'],\n DirectiveDefinition: ['description', 'name', 'arguments', 'locations'],\n SchemaExtension: ['directives', 'operationTypes'],\n ScalarTypeExtension: ['name', 'directives'],\n ObjectTypeExtension: ['name', 'interfaces', 'directives', 'fields'],\n InterfaceTypeExtension: ['name', 'interfaces', 'directives', 'fields'],\n UnionTypeExtension: ['name', 'directives', 'types'],\n EnumTypeExtension: ['name', 'directives', 'values'],\n InputObjectTypeExtension: ['name', 'directives', 'fields'],\n};\nconst kindValues = new Set(Object.keys(QueryDocumentKeys));\n/**\n * @internal\n */\n\nexport function isNode(maybeNode) {\n const maybeKind =\n maybeNode === null || maybeNode === void 0 ? void 0 : maybeNode.kind;\n return typeof maybeKind === 'string' && kindValues.has(maybeKind);\n}\n/** Name */\n\nvar OperationTypeNode;\n\n(function (OperationTypeNode) {\n OperationTypeNode['QUERY'] = 'query';\n OperationTypeNode['MUTATION'] = 'mutation';\n OperationTypeNode['SUBSCRIPTION'] = 'subscription';\n})(OperationTypeNode || (OperationTypeNode = {}));\n\nexport { OperationTypeNode };\n","/**\n * The set of allowed kind values for AST nodes.\n */\nvar Kind;\n\n(function (Kind) {\n Kind['NAME'] = 'Name';\n Kind['DOCUMENT'] = 'Document';\n Kind['OPERATION_DEFINITION'] = 'OperationDefinition';\n Kind['VARIABLE_DEFINITION'] = 'VariableDefinition';\n Kind['SELECTION_SET'] = 'SelectionSet';\n Kind['FIELD'] = 'Field';\n Kind['ARGUMENT'] = 'Argument';\n Kind['FRAGMENT_SPREAD'] = 'FragmentSpread';\n Kind['INLINE_FRAGMENT'] = 'InlineFragment';\n Kind['FRAGMENT_DEFINITION'] = 'FragmentDefinition';\n Kind['VARIABLE'] = 'Variable';\n Kind['INT'] = 'IntValue';\n Kind['FLOAT'] = 'FloatValue';\n Kind['STRING'] = 'StringValue';\n Kind['BOOLEAN'] = 'BooleanValue';\n Kind['NULL'] = 'NullValue';\n Kind['ENUM'] = 'EnumValue';\n Kind['LIST'] = 'ListValue';\n Kind['OBJECT'] = 'ObjectValue';\n Kind['OBJECT_FIELD'] = 'ObjectField';\n Kind['DIRECTIVE'] = 'Directive';\n Kind['NAMED_TYPE'] = 'NamedType';\n Kind['LIST_TYPE'] = 'ListType';\n Kind['NON_NULL_TYPE'] = 'NonNullType';\n Kind['SCHEMA_DEFINITION'] = 'SchemaDefinition';\n Kind['OPERATION_TYPE_DEFINITION'] = 'OperationTypeDefinition';\n Kind['SCALAR_TYPE_DEFINITION'] = 'ScalarTypeDefinition';\n Kind['OBJECT_TYPE_DEFINITION'] = 'ObjectTypeDefinition';\n Kind['FIELD_DEFINITION'] = 'FieldDefinition';\n Kind['INPUT_VALUE_DEFINITION'] = 'InputValueDefinition';\n Kind['INTERFACE_TYPE_DEFINITION'] = 'InterfaceTypeDefinition';\n Kind['UNION_TYPE_DEFINITION'] = 'UnionTypeDefinition';\n Kind['ENUM_TYPE_DEFINITION'] = 'EnumTypeDefinition';\n Kind['ENUM_VALUE_DEFINITION'] = 'EnumValueDefinition';\n Kind['INPUT_OBJECT_TYPE_DEFINITION'] = 'InputObjectTypeDefinition';\n Kind['DIRECTIVE_DEFINITION'] = 'DirectiveDefinition';\n Kind['SCHEMA_EXTENSION'] = 'SchemaExtension';\n Kind['SCALAR_TYPE_EXTENSION'] = 'ScalarTypeExtension';\n Kind['OBJECT_TYPE_EXTENSION'] = 'ObjectTypeExtension';\n Kind['INTERFACE_TYPE_EXTENSION'] = 'InterfaceTypeExtension';\n Kind['UNION_TYPE_EXTENSION'] = 'UnionTypeExtension';\n Kind['ENUM_TYPE_EXTENSION'] = 'EnumTypeExtension';\n Kind['INPUT_OBJECT_TYPE_EXTENSION'] = 'InputObjectTypeExtension';\n})(Kind || (Kind = {}));\n\nexport { Kind };\n/**\n * The enum type representing the possible kind values of AST nodes.\n *\n * @deprecated Please use `Kind`. Will be remove in v17.\n */\n","/**\n * ```\n * WhiteSpace ::\n * - \"Horizontal Tab (U+0009)\"\n * - \"Space (U+0020)\"\n * ```\n * @internal\n */\nexport function isWhiteSpace(code) {\n return code === 0x0009 || code === 0x0020;\n}\n/**\n * ```\n * Digit :: one of\n * - `0` `1` `2` `3` `4` `5` `6` `7` `8` `9`\n * ```\n * @internal\n */\n\nexport function isDigit(code) {\n return code >= 0x0030 && code <= 0x0039;\n}\n/**\n * ```\n * Letter :: one of\n * - `A` `B` `C` `D` `E` `F` `G` `H` `I` `J` `K` `L` `M`\n * - `N` `O` `P` `Q` `R` `S` `T` `U` `V` `W` `X` `Y` `Z`\n * - `a` `b` `c` `d` `e` `f` `g` `h` `i` `j` `k` `l` `m`\n * - `n` `o` `p` `q` `r` `s` `t` `u` `v` `w` `x` `y` `z`\n * ```\n * @internal\n */\n\nexport function isLetter(code) {\n return (\n (code >= 0x0061 && code <= 0x007a) || // A-Z\n (code >= 0x0041 && code <= 0x005a) // a-z\n );\n}\n/**\n * ```\n * NameStart ::\n * - Letter\n * - `_`\n * ```\n * @internal\n */\n\nexport function isNameStart(code) {\n return isLetter(code) || code === 0x005f;\n}\n/**\n * ```\n * NameContinue ::\n * - Letter\n * - Digit\n * - `_`\n * ```\n * @internal\n */\n\nexport function isNameContinue(code) {\n return isLetter(code) || isDigit(code) || code === 0x005f;\n}\n","import { isWhiteSpace } from './characterClasses.mjs';\n/**\n * Produces the value of a block string from its parsed raw value, similar to\n * CoffeeScript's block string, Python's docstring trim or Ruby's strip_heredoc.\n *\n * This implements the GraphQL spec's BlockStringValue() static algorithm.\n *\n * @internal\n */\n\nexport function dedentBlockStringLines(lines) {\n var _firstNonEmptyLine2;\n\n let commonIndent = Number.MAX_SAFE_INTEGER;\n let firstNonEmptyLine = null;\n let lastNonEmptyLine = -1;\n\n for (let i = 0; i < lines.length; ++i) {\n var _firstNonEmptyLine;\n\n const line = lines[i];\n const indent = leadingWhitespace(line);\n\n if (indent === line.length) {\n continue; // skip empty lines\n }\n\n firstNonEmptyLine =\n (_firstNonEmptyLine = firstNonEmptyLine) !== null &&\n _firstNonEmptyLine !== void 0\n ? _firstNonEmptyLine\n : i;\n lastNonEmptyLine = i;\n\n if (i !== 0 && indent < commonIndent) {\n commonIndent = indent;\n }\n }\n\n return lines // Remove common indentation from all lines but first.\n .map((line, i) => (i === 0 ? line : line.slice(commonIndent))) // Remove leading and trailing blank lines.\n .slice(\n (_firstNonEmptyLine2 = firstNonEmptyLine) !== null &&\n _firstNonEmptyLine2 !== void 0\n ? _firstNonEmptyLine2\n : 0,\n lastNonEmptyLine + 1,\n );\n}\n\nfunction leadingWhitespace(str) {\n let i = 0;\n\n while (i < str.length && isWhiteSpace(str.charCodeAt(i))) {\n ++i;\n }\n\n return i;\n}\n/**\n * @internal\n */\n\nexport function isPrintableAsBlockString(value) {\n if (value === '') {\n return true; // empty string is printable\n }\n\n let isEmptyLine = true;\n let hasIndent = false;\n let hasCommonIndent = true;\n let seenNonEmptyLine = false;\n\n for (let i = 0; i < value.length; ++i) {\n switch (value.codePointAt(i)) {\n case 0x0000:\n case 0x0001:\n case 0x0002:\n case 0x0003:\n case 0x0004:\n case 0x0005:\n case 0x0006:\n case 0x0007:\n case 0x0008:\n case 0x000b:\n case 0x000c:\n case 0x000e:\n case 0x000f:\n return false;\n // Has non-printable characters\n\n case 0x000d:\n // \\r\n return false;\n // Has \\r or \\r\\n which will be replaced as \\n\n\n case 10:\n // \\n\n if (isEmptyLine && !seenNonEmptyLine) {\n return false; // Has leading new line\n }\n\n seenNonEmptyLine = true;\n isEmptyLine = true;\n hasIndent = false;\n break;\n\n case 9: // \\t\n\n case 32:\n // <space>\n hasIndent || (hasIndent = isEmptyLine);\n break;\n\n default:\n hasCommonIndent && (hasCommonIndent = hasIndent);\n isEmptyLine = false;\n }\n }\n\n if (isEmptyLine) {\n return false; // Has trailing empty lines\n }\n\n if (hasCommonIndent && seenNonEmptyLine) {\n return false; // Has internal indent\n }\n\n return true;\n}\n/**\n * Print a block string in the indented block form by adding a leading and\n * trailing blank line. However, if a block string starts with whitespace and is\n * a single-line, adding a leading blank line would strip that whitespace.\n *\n * @internal\n */\n\nexport function printBlockString(value, options) {\n const escapedValue = value.replace(/\"\"\"/g, '\\\\\"\"\"'); // Expand a block string's raw value into independent lines.\n\n const lines = escapedValue.split(/\\r\\n|[\\n\\r]/g);\n const isSingleLine = lines.length === 1; // If common indentation is found we can fix some of those cases by adding leading new line\n\n const forceLeadingNewLine =\n lines.length > 1 &&\n lines\n .slice(1)\n .every((line) => line.length === 0 || isWhiteSpace(line.charCodeAt(0))); // Trailing triple quotes just looks confusing but doesn't force trailing new line\n\n const hasTrailingTripleQuotes = escapedValue.endsWith('\\\\\"\"\"'); // Trailing quote (single or double) or slash forces trailing new line\n\n const hasTrailingQuote = value.endsWith('\"') && !hasTrailingTripleQuotes;\n const hasTrailingSlash = value.endsWith('\\\\');\n const forceTrailingNewline = hasTrailingQuote || hasTrailingSlash;\n const printAsMultipleLines =\n !(options !== null && options !== void 0 && options.minimize) && // add leading and trailing new lines only if it improves readability\n (!isSingleLine ||\n value.length > 70 ||\n forceTrailingNewline ||\n forceLeadingNewLine ||\n hasTrailingTripleQuotes);\n let result = ''; // Format a multi-line block quote to account for leading space.\n\n const skipLeadingNewLine = isSingleLine && isWhiteSpace(value.charCodeAt(0));\n\n if ((printAsMultipleLines && !skipLeadingNewLine) || forceLeadingNewLine) {\n result += '\\n';\n }\n\n result += escapedValue;\n\n if (printAsMultipleLines || forceTrailingNewline) {\n result += '\\n';\n }\n\n return '\"\"\"' + result + '\"\"\"';\n}\n","const MAX_ARRAY_LENGTH = 10;\nconst MAX_RECURSIVE_DEPTH = 2;\n/**\n * Used to print values in error messages.\n */\n\nexport function inspect(value) {\n return formatValue(value, []);\n}\n\nfunction formatValue(value, seenValues) {\n switch (typeof value) {\n case 'string':\n return JSON.stringify(value);\n\n case 'function':\n return value.name ? `[function ${value.name}]` : '[function]';\n\n case 'object':\n return formatObjectValue(value, seenValues);\n\n default:\n return String(value);\n }\n}\n\nfunction formatObjectValue(value, previouslySeenValues) {\n if (value === null) {\n return 'null';\n }\n\n if (previouslySeenValues.includes(value)) {\n return '[Circular]';\n }\n\n const seenValues = [...previouslySeenValues, value];\n\n if (isJSONable(value)) {\n const jsonValue = value.toJSON(); // check for infinite recursion\n\n if (jsonValue !== value) {\n return typeof jsonValue === 'string'\n ? jsonValue\n : formatValue(jsonValue, seenValues);\n }\n } else if (Array.isArray(value)) {\n return formatArray(value, seenValues);\n }\n\n return formatObject(value, seenValues);\n}\n\nfunction isJSONable(value) {\n return typeof value.toJSON === 'function';\n}\n\nfunction formatObject(object, seenValues) {\n const entries = Object.entries(object);\n\n if (entries.length === 0) {\n return '{}';\n }\n\n if (seenValues.length > MAX_RECURSIVE_DEPTH) {\n return '[' + getObjectTag(object) + ']';\n }\n\n const properties = entries.map(\n ([key, value]) => key + ': ' + formatValue(value, seenValues),\n );\n return '{ ' + properties.join(', ') + ' }';\n}\n\nfunction formatArray(array, seenValues) {\n if (array.length === 0) {\n return '[]';\n }\n\n if (seenValues.length > MAX_RECURSIVE_DEPTH) {\n return '[Array]';\n }\n\n const len = Math.min(MAX_ARRAY_LENGTH, array.length);\n const remaining = array.length - len;\n const items = [];\n\n for (let i = 0; i < len; ++i) {\n items.push(formatValue(array[i], seenValues));\n }\n\n if (remaining === 1) {\n items.push('... 1 more item');\n } else if (remaining > 1) {\n items.push(`... ${remaining} more items`);\n }\n\n return '[' + items.join(', ') + ']';\n}\n\nfunction getObjectTag(object) {\n const tag = Object.prototype.toString\n .call(object)\n .replace(/^\\[object /, '')\n .replace(/]$/, '');\n\n if (tag === 'Object' && typeof object.constructor === 'function') {\n const name = object.constructor.name;\n\n if (typeof name === 'string' && name !== '') {\n return name;\n }\n }\n\n return tag;\n}\n","import { inspect } from './inspect.mjs';\n/* c8 ignore next 3 */\n\nconst isProduction =\n globalThis.process && // eslint-disable-next-line no-undef\n process.env.NODE_ENV === 'production';\n/**\n * A replacement for instanceof which includes an error warning when multi-realm\n * constructors are detected.\n * See: https://expressjs.com/en/advanced/best-practice-performance.html#set-node_env-to-production\n * See: https://webpack.js.org/guides/production/\n */\n\nexport const instanceOf =\n /* c8 ignore next 6 */\n // FIXME: https://github.com/graphql/graphql-js/issues/2317\n isProduction\n ? function instanceOf(value, constructor) {\n return value instanceof constructor;\n }\n : function instanceOf(value, constructor) {\n if (value instanceof constructor) {\n return true;\n }\n\n if (typeof value === 'object' && value !== null) {\n var _value$constructor;\n\n // Prefer Symbol.toStringTag since it is immune to minification.\n const className = constructor.prototype[Symbol.toStringTag];\n const valueClassName = // We still need to support constructor's name to detect conflicts with older versions of this library.\n Symbol.toStringTag in value // @ts-expect-error TS bug see, https://github.com/microsoft/TypeScript/issues/38009\n ? value[Symbol.toStringTag]\n : (_value$constructor = value.constructor) === null ||\n _value$constructor === void 0\n ? void 0\n : _value$constructor.name;\n\n if (className === valueClassName) {\n const stringifiedValue = inspect(value);\n throw new Error(`Cannot use ${className} \"${stringifiedValue}\" from another module or realm.\n\nEnsure that there is only one instance of \"graphql\" in the node_modules\ndirectory. If different versions of \"graphql\" are the dependencies of other\nrelied on modules, use \"resolutions\" to ensure only one version is installed.\n\nhttps://yarnpkg.com/en/docs/selective-version-resolutions\n\nDuplicate \"graphql\" modules cannot be used at the same time since different\nversions may have different capabilities and behavior. The data from one\nversion used in the function from another could produce confusing and\nspurious results.`);\n }\n }\n\n return false;\n };\n","const MAX_SUGGESTIONS = 5;\n/**\n * Given [ A, B, C ] return ' Did you mean A, B, or C?'.\n */\n\nexport function didYouMean(firstArg, secondArg) {\n const [subMessage, suggestionsArg] = secondArg\n ? [firstArg, secondArg]\n : [undefined, firstArg];\n let message = ' Did you mean ';\n\n if (subMessage) {\n message += subMessage + ' ';\n }\n\n const suggestions = suggestionsArg.map((x) => `\"${x}\"`);\n\n switch (suggestions.length) {\n case 0:\n return '';\n\n case 1:\n return message + suggestions[0] + '?';\n\n case 2:\n return message + suggestions[0] + ' or ' + suggestions[1] + '?';\n }\n\n const selected = suggestions.slice(0, MAX_SUGGESTIONS);\n const lastItem = selected.pop();\n return message + selected.join(', ') + ', or ' + lastItem + '?';\n}\n","/**\n * Returns the first argument it receives.\n */\nexport function identityFunc(x) {\n return x;\n}\n","/**\n * Creates a keyed JS object from an array, given a function to produce the keys\n * for each value in the array.\n *\n * This provides a convenient lookup for the array items if the key function\n * produces unique results.\n * ```ts\n * const phoneBook = [\n * { name: 'Jon', num: '555-1234' },\n * { name: 'Jenny', num: '867-5309' }\n * ]\n *\n * const entriesByName = keyMap(\n * phoneBook,\n * entry => entry.name\n * )\n *\n * // {\n * // Jon: { name: 'Jon', num: '555-1234' },\n * // Jenny: { name: 'Jenny', num: '867-5309' }\n * // }\n *\n * const jennyEntry = entriesByName['Jenny']\n *\n * // { name: 'Jenny', num: '857-6309' }\n * ```\n */\nexport function keyMap(list, keyFn) {\n const result = Object.create(null);\n\n for (const item of list) {\n result[keyFn(item)] = item;\n }\n\n return result;\n}\n","/**\n * Creates a keyed JS object from an array, given a function to produce the keys\n * and a function to produce the values from each item in the array.\n * ```ts\n * const phoneBook = [\n * { name: 'Jon', num: '555-1234' },\n * { name: 'Jenny', num: '867-5309' }\n * ]\n *\n * // { Jon: '555-1234', Jenny: '867-5309' }\n * const phonesByName = keyValMap(\n * phoneBook,\n * entry => entry.name,\n * entry => entry.num\n * )\n * ```\n */\nexport function keyValMap(list, keyFn, valFn) {\n const result = Object.create(null);\n\n for (const item of list) {\n result[keyFn(item)] = valFn(item);\n }\n\n return result;\n}\n","/**\n * Creates an object map with the same keys as `map` and values generated by\n * running each value of `map` thru `fn`.\n */\nexport function mapValue(map, fn) {\n const result = Object.create(null);\n\n for (const key of Object.keys(map)) {\n result[key] = fn(map[key], key);\n }\n\n return result;\n}\n","/**\n * Returns a number indicating whether a reference string comes before, or after,\n * or is the same as the given string in natural sort order.\n *\n * See: https://en.wikipedia.org/wiki/Natural_sort_order\n *\n */\nexport function naturalCompare(aStr, bStr) {\n let aIndex = 0;\n let bIndex = 0;\n\n while (aIndex < aStr.length && bIndex < bStr.length) {\n let aChar = aStr.charCodeAt(aIndex);\n let bChar = bStr.charCodeAt(bIndex);\n\n if (isDigit(aChar) && isDigit(bChar)) {\n let aNum = 0;\n\n do {\n ++aIndex;\n aNum = aNum * 10 + aChar - DIGIT_0;\n aChar = aStr.charCodeAt(aIndex);\n } while (isDigit(aChar) && aNum > 0);\n\n let bNum = 0;\n\n do {\n ++bIndex;\n bNum = bNum * 10 + bChar - DIGIT_0;\n bChar = bStr.charCodeAt(bIndex);\n } while (isDigit(bChar) && bNum > 0);\n\n if (aNum < bNum) {\n return -1;\n }\n\n if (aNum > bNum) {\n return 1;\n }\n } else {\n if (aChar < bChar) {\n return -1;\n }\n\n if (aChar > bChar) {\n return 1;\n }\n\n ++aIndex;\n ++bIndex;\n }\n }\n\n return aStr.length - bStr.length;\n}\nconst DIGIT_0 = 48;\nconst DIGIT_9 = 57;\n\nfunction isDigit(code) {\n return !isNaN(code) && DIGIT_0 <= code && code <= DIGIT_9;\n}\n","import { naturalCompare } from './naturalCompare.mjs';\n/**\n * Given an invalid input string and a list of valid options, returns a filtered\n * list of valid options sorted based on their similarity with the input.\n */\n\nexport function suggestionList(input, options) {\n const optionsByDistance = Object.create(null);\n const lexicalDistance = new LexicalDistance(input);\n const threshold = Math.floor(input.length * 0.4) + 1;\n\n for (const option of options) {\n const distance = lexicalDistance.measure(option, threshold);\n\n if (distance !== undefined) {\n optionsByDistance[option] = distance;\n }\n }\n\n return Object.keys(optionsByDistance).sort((a, b) => {\n const distanceDiff = optionsByDistance[a] - optionsByDistance[b];\n return distanceDiff !== 0 ? distanceDiff : naturalCompare(a, b);\n });\n}\n/**\n * Computes the lexical distance between strings A and B.\n *\n * The \"distance\" between two strings is given by counting the minimum number\n * of edits needed to transform string A into string B. An edit can be an\n * insertion, deletion, or substitution of a single character, or a swap of two\n * adjacent characters.\n *\n * Includes a custom alteration from Damerau-Levenshtein to treat case changes\n * as a single edit which helps identify mis-cased values with an edit distance\n * of 1.\n *\n * This distance can be useful for detecting typos in input or sorting\n */\n\nclass LexicalDistance {\n constructor(input) {\n this._input = input;\n this._inputLowerCase = input.toLowerCase();\n this._inputArray = stringToArray(this._inputLowerCase);\n this._rows = [\n new Array(input.length + 1).fill(0),\n new Array(input.length + 1).fill(0),\n new Array(input.length + 1).fill(0),\n ];\n }\n\n measure(option, threshold) {\n if (this._input === option) {\n return 0;\n }\n\n const optionLowerCase = option.toLowerCase(); // Any case change counts as a single edit\n\n if (this._inputLowerCase === optionLowerCase) {\n return 1;\n }\n\n let a = stringToArray(optionLowerCase);\n let b = this._inputArray;\n\n if (a.length < b.length) {\n const tmp = a;\n a = b;\n b = tmp;\n }\n\n const aLength = a.length;\n const bLength = b.length;\n\n if (aLength - bLength > threshold) {\n return undefined;\n }\n\n const rows = this._rows;\n\n for (let j = 0; j <= bLength; j++) {\n rows[0][j] = j;\n }\n\n for (let i = 1; i <= aLength; i++) {\n const upRow = rows[(i - 1) % 3];\n const currentRow = rows[i % 3];\n let smallestCell = (currentRow[0] = i);\n\n for (let j = 1; j <= bLength; j++) {\n const cost = a[i - 1] === b[j - 1] ? 0 : 1;\n let currentCell = Math.min(\n upRow[j] + 1, // delete\n currentRow[j - 1] + 1, // insert\n upRow[j - 1] + cost, // substitute\n );\n\n if (i > 1 && j > 1 && a[i - 1] === b[j - 2] && a[i - 2] === b[j - 1]) {\n // transposition\n const doubleDiagonalCell = rows[(i - 2) % 3][j - 2];\n currentCell = Math.min(currentCell, doubleDiagonalCell + 1);\n }\n\n if (currentCell < smallestCell) {\n smallestCell = currentCell;\n }\n\n currentRow[j] = currentCell;\n } // Early exit, since distance can't go smaller than smallest element of the previous row.\n\n if (smallestCell > threshold) {\n return undefined;\n }\n }\n\n const distance = rows[aLength % 3][bLength];\n return distance <= threshold ? distance : undefined;\n }\n}\n\nfunction stringToArray(str) {\n const strLength = str.length;\n const array = new Array(strLength);\n\n for (let i = 0; i < strLength; ++i) {\n array[i] = str.charCodeAt(i);\n }\n\n return array;\n}\n","export function toObjMap(obj) {\n if (obj == null) {\n return Object.create(null);\n }\n\n if (Object.getPrototypeOf(obj) === null) {\n return obj;\n }\n\n const map = Object.create(null);\n\n for (const [key, value] of Object.entries(obj)) {\n map[key] = value;\n }\n\n return map;\n}\n","/**\n * Prints a string as a GraphQL StringValue literal. Replaces control characters\n * and excluded characters (\" U+0022 and \\\\ U+005C) with escape sequences.\n */\nexport function printString(str) {\n return `\"${str.replace(escapedRegExp, escapedReplacer)}\"`;\n} // eslint-disable-next-line no-control-regex\n\nconst escapedRegExp = /[\\x00-\\x1f\\x22\\x5c\\x7f-\\x9f]/g;\n\nfunction escapedReplacer(str) {\n return escapeSequences[str.charCodeAt(0)];\n} // prettier-ignore\n\nconst escapeSequences = [\n '\\\\u0000',\n '\\\\u0001',\n '\\\\u0002',\n '\\\\u0003',\n '\\\\u0004',\n '\\\\u0005',\n '\\\\u0006',\n '\\\\u0007',\n '\\\\b',\n '\\\\t',\n '\\\\n',\n '\\\\u000B',\n '\\\\f',\n '\\\\r',\n '\\\\u000E',\n '\\\\u000F',\n '\\\\u0010',\n '\\\\u0011',\n '\\\\u0012',\n '\\\\u0013',\n '\\\\u0014',\n '\\\\u0015',\n '\\\\u0016',\n '\\\\u0017',\n '\\\\u0018',\n '\\\\u0019',\n '\\\\u001A',\n '\\\\u001B',\n '\\\\u001C',\n '\\\\u001D',\n '\\\\u001E',\n '\\\\u001F',\n '',\n '',\n '\\\\\"',\n '',\n '',\n '',\n '',\n '',\n '',\n '',\n '',\n '',\n '',\n '',\n '',\n '', // 2F\n '',\n '',\n '',\n '',\n '',\n '',\n '',\n '',\n '',\n '',\n '',\n '',\n '',\n '',\n '',\n '', // 3F\n '',\n '',\n '',\n '',\n '',\n '',\n '',\n '',\n '',\n '',\n '',\n '',\n '',\n '',\n '',\n '', // 4F\n '',\n '',\n '',\n '',\n '',\n '',\n '',\n '',\n '',\n '',\n '',\n '',\n '\\\\\\\\',\n '',\n '',\n '', // 5F\n '',\n '',\n '',\n '',\n '',\n '',\n '',\n '',\n '',\n '',\n '',\n '',\n '',\n '',\n '',\n '', // 6F\n '',\n '',\n '',\n '',\n '',\n '',\n '',\n '',\n '',\n '',\n '',\n '',\n '',\n '',\n '',\n '\\\\u007F',\n '\\\\u0080',\n '\\\\u0081',\n '\\\\u0082',\n '\\\\u0083',\n '\\\\u0084',\n '\\\\u0085',\n '\\\\u0086',\n '\\\\u0087',\n '\\\\u0088',\n '\\\\u0089',\n '\\\\u008A',\n '\\\\u008B',\n '\\\\u008C',\n '\\\\u008D',\n '\\\\u008E',\n '\\\\u008F',\n '\\\\u0090',\n '\\\\u0091',\n '\\\\u0092',\n '\\\\u0093',\n '\\\\u0094',\n '\\\\u0095',\n '\\\\u0096',\n '\\\\u0097',\n '\\\\u0098',\n '\\\\u0099',\n '\\\\u009A',\n '\\\\u009B',\n '\\\\u009C',\n '\\\\u009D',\n '\\\\u009E',\n '\\\\u009F',\n];\n","import { devAssert } from '../jsutils/devAssert.mjs';\nimport { inspect } from '../jsutils/inspect.mjs';\nimport { isNode, QueryDocumentKeys } from './ast.mjs';\nimport { Kind } from './kinds.mjs';\n/**\n * A visitor is provided to visit, it contains the collection of\n * relevant functions to be called during the visitor's traversal.\n */\n\nexport const BREAK = Object.freeze({});\n/**\n * visit() will walk through an AST using a depth-first traversal, calling\n * the visitor's enter function at each node in the traversal, and calling the\n * leave function after visiting that node and all of its child nodes.\n *\n * By returning different values from the enter and leave functions, the\n * behavior of the visitor can be altered, including skipping over a sub-tree of\n * the AST (by returning false), editing the AST by returning a value or null\n * to remove the value, or to stop the whole traversal by returning BREAK.\n *\n * When using visit() to edit an AST, the original AST will not be modified, and\n * a new version of the AST with the changes applied will be returned from the\n * visit function.\n *\n * ```ts\n * const editedAST = visit(ast, {\n * enter(node, key, parent, path, ancestors) {\n * // @return\n * // undefined: no action\n * // false: skip visiting this node\n * // visitor.BREAK: stop visiting altogether\n * // null: delete this node\n * // any value: replace this node with the returned value\n * },\n * leave(node, key, parent, path, ancestors) {\n * // @return\n * // undefined: no action\n * // false: no action\n * // visitor.BREAK: stop visiting altogether\n * // null: delete this node\n * // any value: replace this node with the returned value\n * }\n * });\n * ```\n *\n * Alternatively to providing enter() and leave() functions, a visitor can\n * instead provide functions named the same as the kinds of AST nodes, or\n * enter/leave visitors at a named key, leading to three permutations of the\n * visitor API:\n *\n * 1) Named visitors triggered when entering a node of a specific kind.\n *\n * ```ts\n * visit(ast, {\n * Kind(node) {\n * // enter the \"Kind\" node\n * }\n * })\n * ```\n *\n * 2) Named visitors that trigger upon entering and leaving a node of a specific kind.\n *\n * ```ts\n * visit(ast, {\n * Kind: {\n * enter(node) {\n * // enter the \"Kind\" node\n * }\n * leave(node) {\n * // leave the \"Kind\" node\n * }\n * }\n * })\n * ```\n *\n * 3) Generic visitors that trigger upon entering and leaving any node.\n *\n * ```ts\n * visit(ast, {\n * enter(node) {\n * // enter any node\n * },\n * leave(node) {\n * // leave any node\n * }\n * })\n * ```\n */\n\nexport function visit(root, visitor, visitorKeys = QueryDocumentKeys) {\n const enterLeaveMap = new Map();\n\n for (const kind of Object.values(Kind)) {\n enterLeaveMap.set(kind, getEnterLeaveForKind(visitor, kind));\n }\n /* eslint-disable no-undef-init */\n\n let stack = undefined;\n let inArray = Array.isArray(root);\n let keys = [root];\n let index = -1;\n let edits = [];\n let node = root;\n let key = undefined;\n let parent = undefined;\n const path = [];\n const ancestors = [];\n /* eslint-enable no-undef-init */\n\n do {\n index++;\n const isLeaving = index === keys.length;\n const isEdited = isLeaving && edits.length !== 0;\n\n if (isLeaving) {\n key = ancestors.length === 0 ? undefined : path[path.length - 1];\n node = parent;\n parent = ancestors.pop();\n\n if (isEdited) {\n if (inArray) {\n node = node.slice();\n let editOffset = 0;\n\n for (const [editKey, editValue] of edits) {\n const arrayKey = editKey - editOffset;\n\n if (editValue === null) {\n node.splice(arrayKey, 1);\n editOffset++;\n } else {\n node[arrayKey] = editValue;\n }\n }\n } else {\n node = { ...node };\n\n for (const [editKey, editValue] of edits) {\n node[editKey] = editValue;\n }\n }\n }\n\n index = stack.index;\n keys = stack.keys;\n edits = stack.edits;\n inArray = stack.inArray;\n stack = stack.prev;\n } else if (parent) {\n key = inArray ? index : keys[index];\n node = parent[key];\n\n if (node === null || node === undefined) {\n continue;\n }\n\n path.push(key);\n }\n\n let result;\n\n if (!Array.isArray(node)) {\n var _enterLeaveMap$get, _enterLeaveMap$get2;\n\n isNode(node) || devAssert(false, `Invalid AST Node: ${inspect(node)}.`);\n const visitFn = isLeaving\n ? (_enterLeaveMap$get = enterLeaveMap.get(node.kind)) === null ||\n _enterLeaveMap$get === void 0\n ? void 0\n : _enterLeaveMap$get.leave\n : (_enterLeaveMap$get2 = enterLeaveMap.get(node.kind)) === null ||\n _enterLeaveMap$get2 === void 0\n ? void 0\n : _enterLeaveMap$get2.enter;\n result =\n visitFn === null || visitFn === void 0\n ? void 0\n : visitFn.call(visitor, node, key, parent, path, ancestors);\n\n if (result === BREAK) {\n break;\n }\n\n if (result === false) {\n if (!isLeaving) {\n path.pop();\n continue;\n }\n } else if (result !== undefined) {\n edits.push([key, result]);\n\n if (!isLeaving) {\n if (isNode(result)) {\n node = result;\n } else {\n path.pop();\n continue;\n }\n }\n }\n }\n\n if (result === undefined && isEdited) {\n edits.push([key, node]);\n }\n\n if (isLeaving) {\n path.pop();\n } else {\n var _node$kind;\n\n stack = {\n inArray,\n index,\n keys,\n edits,\n prev: stack,\n };\n inArray = Array.isArray(node);\n keys = inArray\n ? node\n : (_node$kind = visitorKeys[node.kind]) !== null &&\n _node$kind !== void 0\n ? _node$kind\n : [];\n index = -1;\n edits = [];\n\n if (parent) {\n ancestors.push(parent);\n }\n\n parent = node;\n }\n } while (stack !== undefined);\n\n if (edits.length !== 0) {\n // New root\n return edits[edits.length - 1][1];\n }\n\n return root;\n}\n/**\n * Creates a new visitor instance which delegates to many visitors to run in\n * parallel. Each visitor will be visited for each node before moving on.\n *\n * If a prior visitor edits a node, no following visitors will see that node.\n */\n\nexport function visitInParallel(visitors) {\n const skipping = new Array(visitors.length).fill(null);\n const mergedVisitor = Object.create(null);\n\n for (const kind of Object.values(Kind)) {\n let hasVisitor = false;\n const enterList = new Array(visitors.length).fill(undefined);\n const leaveList = new Array(visitors.length).fill(undefined);\n\n for (let i = 0; i < visitors.length; ++i) {\n const { enter, leave } = getEnterLeaveForKind(visitors[i], kind);\n hasVisitor || (hasVisitor = enter != null || leave != null);\n enterList[i] = enter;\n leaveList[i] = leave;\n }\n\n if (!hasVisitor) {\n continue;\n }\n\n const mergedEnterLeave = {\n enter(...args) {\n const node = args[0];\n\n for (let i = 0; i < visitors.length; i++) {\n if (skipping[i] === null) {\n var _enterList$i;\n\n const result =\n (_enterList$i = enterList[i]) === null || _enterList$i === void 0\n ? void 0\n : _enterList$i.apply(visitors[i], args);\n\n if (result === false) {\n skipping[i] = node;\n } else if (result === BREAK) {\n skipping[i] = BREAK;\n } else if (result !== undefined) {\n return result;\n }\n }\n }\n },\n\n leave(...args) {\n const node = args[0];\n\n for (let i = 0; i < visitors.length; i++) {\n if (skipping[i] === null) {\n var _leaveList$i;\n\n const result =\n (_leaveList$i = leaveList[i]) === null || _leaveList$i === void 0\n ? void 0\n : _leaveList$i.apply(visitors[i], args);\n\n if (result === BREAK) {\n skipping[i] = BREAK;\n } else if (result !== undefined && result !== false) {\n return result;\n }\n } else if (skipping[i] === node) {\n skipping[i] = null;\n }\n }\n },\n };\n mergedVisitor[kind] = mergedEnterLeave;\n }\n\n return mergedVisitor;\n}\n/**\n * Given a visitor instance and a node kind, return EnterLeaveVisitor for that kind.\n */\n\nexport function getEnterLeaveForKind(visitor, kind) {\n const kindVisitor = visitor[kind];\n\n if (typeof kindVisitor === 'object') {\n // { Kind: { enter() {}, leave() {} } }\n return kindVisitor;\n } else if (typeof kindVisitor === 'function') {\n // { Kind() {} }\n return {\n enter: kindVisitor,\n leave: undefined,\n };\n } // { enter() {}, leave() {} }\n\n return {\n enter: visitor.enter,\n leave: visitor.leave,\n };\n}\n/**\n * Given a visitor instance, if it is leaving or not, and a node kind, return\n * the function the visitor runtime should call.\n *\n * @deprecated Please use `getEnterLeaveForKind` instead. Will be removed in v17\n */\n\n/* c8 ignore next 8 */\n\nexport function getVisitFn(visitor, kind, isLeaving) {\n const { enter, leave } = getEnterLeaveForKind(visitor, kind);\n return isLeaving ? leave : enter;\n}\n","import { printBlockString } from './blockString.mjs';\nimport { printString } from './printString.mjs';\nimport { visit } from './visitor.mjs';\n/**\n * Converts an AST into a string, using one set of reasonable\n * formatting rules.\n */\n\nexport function print(ast) {\n return visit(ast, printDocASTReducer);\n}\nconst MAX_LINE_LENGTH = 80;\nconst printDocASTReducer = {\n Name: {\n leave: (node) => node.value,\n },\n Variable: {\n leave: (node) => '$' + node.name,\n },\n // Document\n Document: {\n leave: (node) => join(node.definitions, '\\n\\n'),\n },\n OperationDefinition: {\n leave(node) {\n const varDefs = wrap('(', join(node.variableDefinitions, ', '), ')');\n const prefix = join(\n [\n node.operation,\n join([node.name, varDefs]),\n join(node.directives, ' '),\n ],\n ' ',\n ); // Anonymous queries with no directives or variable definitions can use\n // the query short form.\n\n return (prefix === 'query' ? '' : prefix + ' ') + node.selectionSet;\n },\n },\n VariableDefinition: {\n leave: ({ variable, type, defaultValue, directives }) =>\n variable +\n ': ' +\n type +\n wrap(' = ', defaultValue) +\n wrap(' ', join(directives, ' ')),\n },\n SelectionSet: {\n leave: ({ selections }) => block(selections),\n },\n Field: {\n leave({ alias, name, arguments: args, directives, selectionSet }) {\n const prefix = wrap('', alias, ': ') + name;\n let argsLine = prefix + wrap('(', join(args, ', '), ')');\n\n if (argsLine.length > MAX_LINE_LENGTH) {\n argsLine = prefix + wrap('(\\n', indent(join(args, '\\n')), '\\n)');\n }\n\n return join([argsLine, join(directives, ' '), selectionSet], ' ');\n },\n },\n Argument: {\n leave: ({ name, value }) => name + ': ' + value,\n },\n // Fragments\n FragmentSpread: {\n leave: ({ name, directives }) =>\n '...' + name + wrap(' ', join(directives, ' ')),\n },\n InlineFragment: {\n leave: ({ typeCondition, directives, selectionSet }) =>\n join(\n [\n '...',\n wrap('on ', typeCondition),\n join(directives, ' '),\n selectionSet,\n ],\n ' ',\n ),\n },\n FragmentDefinition: {\n leave: (\n { name, typeCondition, variableDefinitions, directives, selectionSet }, // Note: fragment variable definitions are experimental and may be changed\n ) =>\n // or removed in the future.\n `fragment ${name}${wrap('(', join(variableDefinitions, ', '), ')')} ` +\n `on ${typeCondition} ${wrap('', join(directives, ' '), ' ')}` +\n selectionSet,\n },\n // Value\n IntValue: {\n leave: ({ value }) => value,\n },\n FloatValue: {\n leave: ({ value }) => value,\n },\n StringValue: {\n leave: ({ value, block: isBlockString }) =>\n isBlockString ? printBlockString(value) : printString(value),\n },\n BooleanValue: {\n leave: ({ value }) => (value ? 'true' : 'false'),\n },\n NullValue: {\n leave: () => 'null',\n },\n EnumValue: {\n leave: ({ value }) => value,\n },\n ListValue: {\n leave: ({ values }) => '[' + join(values, ', ') + ']',\n },\n ObjectValue: {\n leave: ({ fields }) => '{' + join(fields, ', ') + '}',\n },\n ObjectField: {\n leave: ({ name, value }) => name + ': ' + value,\n },\n // Directive\n Directive: {\n leave: ({ name, arguments: args }) =>\n '@' + name + wrap('(', join(args, ', '), ')'),\n },\n // Type\n NamedType: {\n leave: ({ name }) => name,\n },\n ListType: {\n leave: ({ type }) => '[' + type + ']',\n },\n NonNullType: {\n leave: ({ type }) => type + '!',\n },\n // Type System Definitions\n SchemaDefinition: {\n leave: ({ description, directives, operationTypes }) =>\n wrap('', description, '\\n') +\n join(['schema', join(directives, ' '), block(operationTypes)], ' '),\n },\n OperationTypeDefinition: {\n leave: ({ operation, type }) => operation + ': ' + type,\n },\n ScalarTypeDefinition: {\n leave: ({ description, name, directives }) =>\n wrap('', description, '\\n') +\n join(['scalar', name, join(directives, ' ')], ' '),\n },\n ObjectTypeDefinition: {\n leave: ({ description, name, interfaces, directives, fields }) =>\n wrap('', description, '\\n') +\n join(\n [\n 'type',\n name,\n wrap('implements ', join(interfaces, ' & ')),\n join(directives, ' '),\n block(fields),\n ],\n ' ',\n ),\n },\n FieldDefinition: {\n leave: ({ description, name, arguments: args, type, directives }) =>\n wrap('', description, '\\n') +\n name +\n (hasMultilineItems(args)\n ? wrap('(\\n', indent(join(args, '\\n')), '\\n)')\n : wrap('(', join(args, ', '), ')')) +\n ': ' +\n type +\n wrap(' ', join(directives, ' ')),\n },\n InputValueDefinition: {\n leave: ({ description, name, type, defaultValue, directives }) =>\n wrap('', description, '\\n') +\n join(\n [name + ': ' + type, wrap('= ', defaultValue), join(directives, ' ')],\n ' ',\n ),\n },\n InterfaceTypeDefinition: {\n leave: ({ description, name, interfaces, directives, fields }) =>\n wrap('', description, '\\n') +\n join(\n [\n 'interface',\n name,\n wrap('implements ', join(interfaces, ' & ')),\n join(directives, ' '),\n block(fields),\n ],\n ' ',\n ),\n },\n UnionTypeDefinition: {\n leave: ({ description, name, directives, types }) =>\n wrap('', description, '\\n') +\n join(\n ['union', name, join(directives, ' '), wrap('= ', join(types, ' | '))],\n ' ',\n ),\n },\n EnumTypeDefinition: {\n leave: ({ description, name, directives, values }) =>\n wrap('', description, '\\n') +\n join(['enum', name, join(directives, ' '), block(values)], ' '),\n },\n EnumValueDefinition: {\n leave: ({ description, name, directives }) =>\n wrap('', description, '\\n') + join([name, join(directives, ' ')], ' '),\n },\n InputObjectTypeDefinition: {\n leave: ({ description, name, directives, fields }) =>\n wrap('', description, '\\n') +\n join(['input', name, join(directives, ' '), block(fields)], ' '),\n },\n DirectiveDefinition: {\n leave: ({ description, name, arguments: args, repeatable, locations }) =>\n wrap('', description, '\\n') +\n 'directive @' +\n name +\n (hasMultilineItems(args)\n ? wrap('(\\n', indent(join(args, '\\n')), '\\n)')\n : wrap('(', join(args, ', '), ')')) +\n (repeatable ? ' repeatable' : '') +\n ' on ' +\n join(locations, ' | '),\n },\n SchemaExtension: {\n leave: ({ directives, operationTypes }) =>\n join(\n ['extend schema', join(directives, ' '), block(operationTypes)],\n ' ',\n ),\n },\n ScalarTypeExtension: {\n leave: ({ name, directives }) =>\n join(['extend scalar', name, join(directives, ' ')], ' '),\n },\n ObjectTypeExtension: {\n leave: ({ name, interfaces, directives, fields }) =>\n join(\n [\n 'extend type',\n name,\n wrap('implements ', join(interfaces, ' & ')),\n join(directives, ' '),\n block(fields),\n ],\n ' ',\n ),\n },\n InterfaceTypeExtension: {\n leave: ({ name, interfaces, directives, fields }) =>\n join(\n [\n 'extend interface',\n name,\n wrap('implements ', join(interfaces, ' & ')),\n join(directives, ' '),\n block(fields),\n ],\n ' ',\n ),\n },\n UnionTypeExtension: {\n leave: ({ name, directives, types }) =>\n join(\n [\n 'extend union',\n name,\n join(directives, ' '),\n wrap('= ', join(types, ' | ')),\n ],\n ' ',\n ),\n },\n EnumTypeExtension: {\n leave: ({ name, directives, values }) =>\n join(['extend enum', name, join(directives, ' '), block(values)], ' '),\n },\n InputObjectTypeExtension: {\n leave: ({ name, directives, fields }) =>\n join(['extend input', name, join(directives, ' '), block(fields)], ' '),\n },\n};\n/**\n * Given maybeArray, print an empty string if it is null or empty, otherwise\n * print all items together separated by separator if provided\n */\n\nfunction join(maybeArray, separator = '') {\n var _maybeArray$filter$jo;\n\n return (_maybeArray$filter$jo =\n maybeArray === null || maybeArray === void 0\n ? void 0\n : maybeArray.filter((x) => x).join(separator)) !== null &&\n _maybeArray$filter$jo !== void 0\n ? _maybeArray$filter$jo\n : '';\n}\n/**\n * Given array, print each item on its own line, wrapped in an indented `{ }` block.\n */\n\nfunction block(array) {\n return wrap('{\\n', indent(join(array, '\\n')), '\\n}');\n}\n/**\n * If maybeString is not null or empty, then wrap with start and end, otherwise print an empty string.\n */\n\nfunction wrap(start, maybeString, end = '') {\n return maybeString != null && maybeString !== ''\n ? start + maybeString + end\n : '';\n}\n\nfunction indent(str) {\n return wrap(' ', str.replace(/\\n/g, '\\n '));\n}\n\nfunction hasMultilineItems(maybeArray) {\n var _maybeArray$some;\n\n // FIXME: https://github.com/graphql/graphql-js/issues/2203\n\n /* c8 ignore next */\n return (_maybeArray$some =\n maybeArray === null || maybeArray === void 0\n ? void 0\n : maybeArray.some((str) => str.includes('\\n'))) !== null &&\n _maybeArray$some !== void 0\n ? _maybeArray$some\n : false;\n}\n","import { keyValMap } from '../jsutils/keyValMap.mjs';\nimport { Kind } from '../language/kinds.mjs';\n/**\n * Produces a JavaScript value given a GraphQL Value AST.\n *\n * Unlike `valueFromAST()`, no type is provided. The resulting JavaScript value\n * will reflect the provided GraphQL value AST.\n *\n * | GraphQL Value | JavaScript Value |\n * | -------------------- | ---------------- |\n * | Input Object | Object |\n * | List | Array |\n * | Boolean | Boolean |\n * | String / Enum | String |\n * | Int / Float | Number |\n * | Null | null |\n *\n */\n\nexport function valueFromASTUntyped(valueNode, variables) {\n switch (valueNode.kind) {\n case Kind.NULL:\n return null;\n\n case Kind.INT:\n return parseInt(valueNode.value, 10);\n\n case Kind.FLOAT:\n return parseFloat(valueNode.value);\n\n case Kind.STRING:\n case Kind.ENUM:\n case Kind.BOOLEAN:\n return valueNode.value;\n\n case Kind.LIST:\n return valueNode.values.map((node) =>\n valueFromASTUntyped(node, variables),\n );\n\n case Kind.OBJECT:\n return keyValMap(\n valueNode.fields,\n (field) => field.name.value,\n (field) => valueFromASTUntyped(field.value, variables),\n );\n\n case Kind.VARIABLE:\n return variables === null || variables === void 0\n ? void 0\n : variables[valueNode.name.value];\n }\n}\n","import { devAssert } from '../jsutils/devAssert.mjs';\nimport { GraphQLError } from '../error/GraphQLError.mjs';\nimport { isNameContinue, isNameStart } from '../language/characterClasses.mjs';\n/**\n * Upholds the spec rules about naming.\n */\n\nexport function assertName(name) {\n name != null || devAssert(false, 'Must provide name.');\n typeof name === 'string' || devAssert(false, 'Expected name to be a string.');\n\n if (name.length === 0) {\n throw new GraphQLError('Expected name to be a non-empty string.');\n }\n\n for (let i = 1; i < name.length; ++i) {\n if (!isNameContinue(name.charCodeAt(i))) {\n throw new GraphQLError(\n `Names must only contain [_a-zA-Z0-9] but \"${name}\" does not.`,\n );\n }\n }\n\n if (!isNameStart(name.charCodeAt(0))) {\n throw new GraphQLError(\n `Names must start with [_a-zA-Z] but \"${name}\" does not.`,\n );\n }\n\n return name;\n}\n/**\n * Upholds the spec rules about naming enum values.\n *\n * @internal\n */\n\nexport function assertEnumValueName(name) {\n if (name === 'true' || name === 'false' || name === 'null') {\n throw new GraphQLError(`Enum values cannot be named: ${name}`);\n }\n\n return assertName(name);\n}\n","import { devAssert } from '../jsutils/devAssert.mjs';\nimport { didYouMean } from '../jsutils/didYouMean.mjs';\nimport { identityFunc } from '../jsutils/identityFunc.mjs';\nimport { inspect } from '../jsutils/inspect.mjs';\nimport { instanceOf } from '../jsutils/instanceOf.mjs';\nimport { isObjectLike } from '../jsutils/isObjectLike.mjs';\nimport { keyMap } from '../jsutils/keyMap.mjs';\nimport { keyValMap } from '../jsutils/keyValMap.mjs';\nimport { mapValue } from '../jsutils/mapValue.mjs';\nimport { suggestionList } from '../jsutils/suggestionList.mjs';\nimport { toObjMap } from '../jsutils/toObjMap.mjs';\nimport { GraphQLError } from '../error/GraphQLError.mjs';\nimport { Kind } from '../language/kinds.mjs';\nimport { print } from '../language/printer.mjs';\nimport { valueFromASTUntyped } from '../utilities/valueFromASTUntyped.mjs';\nimport { assertEnumValueName, assertName } from './assertName.mjs';\nexport function isType(type) {\n return (\n isScalarType(type) ||\n isObjectType(type) ||\n isInterfaceType(type) ||\n isUnionType(type) ||\n isEnumType(type) ||\n isInputObjectType(type) ||\n isListType(type) ||\n isNonNullType(type)\n );\n}\nexport function assertType(type) {\n if (!isType(type)) {\n throw new Error(`Expected ${inspect(type)} to be a GraphQL type.`);\n }\n\n return type;\n}\n/**\n * There are predicates for each kind of GraphQL type.\n */\n\nexport function isScalarType(type) {\n return instanceOf(type, GraphQLScalarType);\n}\nexport function assertScalarType(type) {\n if (!isScalarType(type)) {\n throw new Error(`Expected ${inspect(type)} to be a GraphQL Scalar type.`);\n }\n\n return type;\n}\nexport function isObjectType(type) {\n return instanceOf(type, GraphQLObjectType);\n}\nexport function assertObjectType(type) {\n if (!isObjectType(type)) {\n throw new Error(`Expected ${inspect(type)} to be a GraphQL Object type.`);\n }\n\n return type;\n}\nexport function isInterfaceType(type) {\n return instanceOf(type, GraphQLInterfaceType);\n}\nexport function assertInterfaceType(type) {\n if (!isInterfaceType(type)) {\n throw new Error(\n `Expected ${inspect(type)} to be a GraphQL Interface type.`,\n );\n }\n\n return type;\n}\nexport function isUnionType(type) {\n return instanceOf(type, GraphQLUnionType);\n}\nexport function assertUnionType(type) {\n if (!isUnionType(type)) {\n throw new Error(`Expected ${inspect(type)} to be a GraphQL Union type.`);\n }\n\n return type;\n}\nexport function isEnumType(type) {\n return instanceOf(type, GraphQLEnumType);\n}\nexport function assertEnumType(type) {\n if (!isEnumType(type)) {\n throw new Error(`Expected ${inspect(type)} to be a GraphQL Enum type.`);\n }\n\n return type;\n}\nexport function isInputObjectType(type) {\n return instanceOf(type, GraphQLInputObjectType);\n}\nexport function assertInputObjectType(type) {\n if (!isInputObjectType(type)) {\n throw new Error(\n `Expected ${inspect(type)} to be a GraphQL Input Object type.`,\n );\n }\n\n return type;\n}\nexport function isListType(type) {\n return instanceOf(type, GraphQLList);\n}\nexport function assertListType(type) {\n if (!isListType(type)) {\n throw new Error(`Expected ${inspect(type)} to be a GraphQL List type.`);\n }\n\n return type;\n}\nexport function isNonNullType(type) {\n return instanceOf(type, GraphQLNonNull);\n}\nexport function assertNonNullType(type) {\n if (!isNonNullType(type)) {\n throw new Error(`Expected ${inspect(type)} to be a GraphQL Non-Null type.`);\n }\n\n return type;\n}\n/**\n * These types may be used as input types for arguments and directives.\n */\n\nexport function isInputType(type) {\n return (\n isScalarType(type) ||\n isEnumType(type) ||\n isInputObjectType(type) ||\n (isWrappingType(type) && isInputType(type.ofType))\n );\n}\nexport function assertInputType(type) {\n if (!isInputType(type)) {\n throw new Error(`Expected ${inspect(type)} to be a GraphQL input type.`);\n }\n\n return type;\n}\n/**\n * These types may be used as output types as the result of fields.\n */\n\nexport function isOutputType(type) {\n return (\n isScalarType(type) ||\n isObjectType(type) ||\n isInterfaceType(type) ||\n isUnionType(type) ||\n isEnumType(type) ||\n (isWrappingType(type) && isOutputType(type.ofType))\n );\n}\nexport function assertOutputType(type) {\n if (!isOutputType(type)) {\n throw new Error(`Expected ${inspect(type)} to be a GraphQL output type.`);\n }\n\n return type;\n}\n/**\n * These types may describe types which may be leaf values.\n */\n\nexport function isLeafType(type) {\n return isScalarType(type) || isEnumType(type);\n}\nexport function assertLeafType(type) {\n if (!isLeafType(type)) {\n throw new Error(`Expected ${inspect(type)} to be a GraphQL leaf type.`);\n }\n\n return type;\n}\n/**\n * These types may describe the parent context of a selection set.\n */\n\nexport function isCompositeType(type) {\n return isObjectType(type) || isInterfaceType(type) || isUnionType(type);\n}\nexport function assertCompositeType(type) {\n if (!isCompositeType(type)) {\n throw new Error(\n `Expected ${inspect(type)} to be a GraphQL composite type.`,\n );\n }\n\n return type;\n}\n/**\n * These types may describe the parent context of a selection set.\n */\n\nexport function isAbstractType(type) {\n return isInterfaceType(type) || isUnionType(type);\n}\nexport function assertAbstractType(type) {\n if (!isAbstractType(type)) {\n throw new Error(`Expected ${inspect(type)} to be a GraphQL abstract type.`);\n }\n\n return type;\n}\n/**\n * List Type Wrapper\n *\n * A list is a wrapping type which points to another type.\n * Lists are often created within the context of defining the fields of\n * an object type.\n *\n * Example:\n *\n * ```ts\n * const PersonType = new GraphQLObjectType({\n * name: 'Person',\n * fields: () => ({\n * parents: { type: new GraphQLList(PersonType) },\n * children: { type: new GraphQLList(PersonType) },\n * })\n * })\n * ```\n */\n\nexport class GraphQLList {\n constructor(ofType) {\n isType(ofType) ||\n devAssert(false, `Expected ${inspect(ofType)} to be a GraphQL type.`);\n this.ofType = ofType;\n }\n\n get [Symbol.toStringTag]() {\n return 'GraphQLList';\n }\n\n toString() {\n return '[' + String(this.ofType) + ']';\n }\n\n toJSON() {\n return this.toString();\n }\n}\n/**\n * Non-Null Type Wrapper\n *\n * A non-null is a wrapping type which points to another type.\n * Non-null types enforce that their values are never null and can ensure\n * an error is raised if this ever occurs during a request. It is useful for\n * fields which you can make a strong guarantee on non-nullability, for example\n * usually the id field of a database row will never be null.\n *\n * Example:\n *\n * ```ts\n * const RowType = new GraphQLObjectType({\n * name: 'Row',\n * fields: () => ({\n * id: { type: new GraphQLNonNull(GraphQLString) },\n * })\n * })\n * ```\n * Note: the enforcement of non-nullability occurs within the executor.\n */\n\nexport class GraphQLNonNull {\n constructor(ofType) {\n isNullableType(ofType) ||\n devAssert(\n false,\n `Expected ${inspect(ofType)} to be a GraphQL nullable type.`,\n );\n this.ofType = ofType;\n }\n\n get [Symbol.toStringTag]() {\n return 'GraphQLNonNull';\n }\n\n toString() {\n return String(this.ofType) + '!';\n }\n\n toJSON() {\n return this.toString();\n }\n}\n/**\n * These types wrap and modify other types\n */\n\nexport function isWrappingType(type) {\n return isListType(type) || isNonNullType(type);\n}\nexport function assertWrappingType(type) {\n if (!isWrappingType(type)) {\n throw new Error(`Expected ${inspect(type)} to be a GraphQL wrapping type.`);\n }\n\n return type;\n}\n/**\n * These types can all accept null as a value.\n */\n\nexport function isNullableType(type) {\n return isType(type) && !isNonNullType(type);\n}\nexport function assertNullableType(type) {\n if (!isNullableType(type)) {\n throw new Error(`Expected ${inspect(type)} to be a GraphQL nullable type.`);\n }\n\n return type;\n}\nexport function getNullableType(type) {\n if (type) {\n return isNonNullType(type) ? type.ofType : type;\n }\n}\n/**\n * These named types do not include modifiers like List or NonNull.\n */\n\nexport function isNamedType(type) {\n return (\n isScalarType(type) ||\n isObjectType(type) ||\n isInterfaceType(type) ||\n isUnionType(type) ||\n isEnumType(type) ||\n isInputObjectType(type)\n );\n}\nexport function assertNamedType(type) {\n if (!isNamedType(type)) {\n throw new Error(`Expected ${inspect(type)} to be a GraphQL named type.`);\n }\n\n return type;\n}\nexport function getNamedType(type) {\n if (type) {\n let unwrappedType = type;\n\n while (isWrappingType(unwrappedType)) {\n unwrappedType = unwrappedType.ofType;\n }\n\n return unwrappedType;\n }\n}\n/**\n * Used while defining GraphQL types to allow for circular references in\n * otherwise immutable type definitions.\n */\n\nexport function resolveReadonlyArrayThunk(thunk) {\n return typeof thunk === 'function' ? thunk() : thunk;\n}\nexport function resolveObjMapThunk(thunk) {\n return typeof thunk === 'function' ? thunk() : thunk;\n}\n/**\n * Custom extensions\n *\n * @remarks\n * Use a unique identifier name for your extension, for example the name of\n * your library or project. Do not use a shortened identifier as this increases\n * the risk of conflicts. We recommend you add at most one extension field,\n * an object which can contain all the values you need.\n */\n\n/**\n * Scalar Type Definition\n *\n * The leaf values of any request and input values to arguments are\n * Scalars (or Enums) and are defined with a name and a series of functions\n * used to parse input from ast or variables and to ensure validity.\n *\n * If a type's serialize function returns `null` or does not return a value\n * (i.e. it returns `undefined`) then an error will be raised and a `null`\n * value will be returned in the response. It is always better to validate\n *\n * Example:\n *\n * ```ts\n * const OddType = new GraphQLScalarType({\n * name: 'Odd',\n * serialize(value) {\n * if (!Number.isFinite(value)) {\n * throw new Error(\n * `Scalar \"Odd\" cannot represent \"${value}\" since it is not a finite number.`,\n * );\n * }\n *\n * if (value % 2 === 0) {\n * throw new Error(`Scalar \"Odd\" cannot represent \"${value}\" since it is even.`);\n * }\n * return value;\n * }\n * });\n * ```\n */\nexport class GraphQLScalarType {\n constructor(config) {\n var _config$parseValue,\n _config$serialize,\n _config$parseLiteral,\n _config$extensionASTN;\n\n const parseValue =\n (_config$parseValue = config.parseValue) !== null &&\n _config$parseValue !== void 0\n ? _config$parseValue\n : identityFunc;\n this.name = assertName(config.name);\n this.description = config.description;\n this.specifiedByURL = config.specifiedByURL;\n this.serialize =\n (_config$serialize = config.serialize) !== null &&\n _config$serialize !== void 0\n ? _config$serialize\n : identityFunc;\n this.parseValue = parseValue;\n this.parseLiteral =\n (_config$parseLiteral = config.parseLiteral) !== null &&\n _config$parseLiteral !== void 0\n ? _config$parseLiteral\n : (node, variables) => parseValue(valueFromASTUntyped(node, variables));\n this.extensions = toObjMap(config.extensions);\n this.astNode = config.astNode;\n this.extensionASTNodes =\n (_config$extensionASTN = config.extensionASTNodes) !== null &&\n _config$extensionASTN !== void 0\n ? _config$extensionASTN\n : [];\n config.specifiedByURL == null ||\n typeof config.specifiedByURL === 'string' ||\n devAssert(\n false,\n `${this.name} must provide \"specifiedByURL\" as a string, ` +\n `but got: ${inspect(config.specifiedByURL)}.`,\n );\n config.serialize == null ||\n typeof config.serialize === 'function' ||\n devAssert(\n false,\n `${this.name} must provide \"serialize\" function. If this custom Scalar is also used as an input type, ensure \"parseValue\" and \"parseLiteral\" functions are also provided.`,\n );\n\n if (config.parseLiteral) {\n (typeof config.parseValue === 'function' &&\n typeof config.parseLiteral === 'function') ||\n devAssert(\n false,\n `${this.name} must provide both \"parseValue\" and \"parseLiteral\" functions.`,\n );\n }\n }\n\n get [Symbol.toStringTag]() {\n return 'GraphQLScalarType';\n }\n\n toConfig() {\n return {\n name: this.name,\n description: this.description,\n specifiedByURL: this.specifiedByURL,\n serialize: this.serialize,\n parseValue: this.parseValue,\n parseLiteral: this.parseLiteral,\n extensions: this.extensions,\n astNode: this.astNode,\n extensionASTNodes: this.extensionASTNodes,\n };\n }\n\n toString() {\n return this.name;\n }\n\n toJSON() {\n return this.toString();\n }\n}\n\n/**\n * Object Type Definition\n *\n * Almost all of the GraphQL types you define will be object types. Object types\n * have a name, but most importantly describe their fields.\n *\n * Example:\n *\n * ```ts\n * const AddressType = new GraphQLObjectType({\n * name: 'Address',\n * fields: {\n * street: { type: GraphQLString },\n * number: { type: GraphQLInt },\n * formatted: {\n * type: GraphQLString,\n * resolve(obj) {\n * return obj.number + ' ' + obj.street\n * }\n * }\n * }\n * });\n * ```\n *\n * When two types need to refer to each other, or a type needs to refer to\n * itself in a field, you can use a function expression (aka a closure or a\n * thunk) to supply the fields lazily.\n *\n * Example:\n *\n * ```ts\n * const PersonType = new GraphQLObjectType({\n * name: 'Person',\n * fields: () => ({\n * name: { type: GraphQLString },\n * bestFriend: { type: PersonType },\n * })\n * });\n * ```\n */\nexport class GraphQLObjectType {\n constructor(config) {\n var _config$extensionASTN2;\n\n this.name = assertName(config.name);\n this.description = config.description;\n this.isTypeOf = config.isTypeOf;\n this.extensions = toObjMap(config.extensions);\n this.astNode = config.astNode;\n this.extensionASTNodes =\n (_config$extensionASTN2 = config.extensionASTNodes) !== null &&\n _config$extensionASTN2 !== void 0\n ? _config$extensionASTN2\n : [];\n\n this._fields = () => defineFieldMap(config);\n\n this._interfaces = () => defineInterfaces(config);\n\n config.isTypeOf == null ||\n typeof config.isTypeOf === 'function' ||\n devAssert(\n false,\n `${this.name} must provide \"isTypeOf\" as a function, ` +\n `but got: ${inspect(config.isTypeOf)}.`,\n );\n }\n\n get [Symbol.toStringTag]() {\n return 'GraphQLObjectType';\n }\n\n getFields() {\n if (typeof this._fields === 'function') {\n this._fields = this._fields();\n }\n\n return this._fields;\n }\n\n getInterfaces() {\n if (typeof this._interfaces === 'function') {\n this._interfaces = this._interfaces();\n }\n\n return this._interfaces;\n }\n\n toConfig() {\n return {\n name: this.name,\n description: this.description,\n interfaces: this.getInterfaces(),\n fields: fieldsToFieldsConfig(this.getFields()),\n isTypeOf: this.isTypeOf,\n extensions: this.extensions,\n astNode: this.astNode,\n extensionASTNodes: this.extensionASTNodes,\n };\n }\n\n toString() {\n return this.name;\n }\n\n toJSON() {\n return this.toString();\n }\n}\n\nfunction defineInterfaces(config) {\n var _config$interfaces;\n\n const interfaces = resolveReadonlyArrayThunk(\n (_config$interfaces = config.interfaces) !== null &&\n _config$interfaces !== void 0\n ? _config$interfaces\n : [],\n );\n Array.isArray(interfaces) ||\n devAssert(\n false,\n `${config.name} interfaces must be an Array or a function which returns an Array.`,\n );\n return interfaces;\n}\n\nfunction defineFieldMap(config) {\n const fieldMap = resolveObjMapThunk(config.fields);\n isPlainObj(fieldMap) ||\n devAssert(\n false,\n `${config.name} fields must be an object with field names as keys or a function which returns such an object.`,\n );\n return mapValue(fieldMap, (fieldConfig, fieldName) => {\n var _fieldConfig$args;\n\n isPlainObj(fieldConfig) ||\n devAssert(\n false,\n `${config.name}.${fieldName} field config must be an object.`,\n );\n fieldConfig.resolve == null ||\n typeof fieldConfig.resolve === 'function' ||\n devAssert(\n false,\n `${config.name}.${fieldName} field resolver must be a function if ` +\n `provided, but got: ${inspect(fieldConfig.resolve)}.`,\n );\n const argsConfig =\n (_fieldConfig$args = fieldConfig.args) !== null &&\n _fieldConfig$args !== void 0\n ? _fieldConfig$args\n : {};\n isPlainObj(argsConfig) ||\n devAssert(\n false,\n `${config.name}.${fieldName} args must be an object with argument names as keys.`,\n );\n return {\n name: assertName(fieldName),\n description: fieldConfig.description,\n type: fieldConfig.type,\n args: defineArguments(argsConfig),\n resolve: fieldConfig.resolve,\n subscribe: fieldConfig.subscribe,\n deprecationReason: fieldConfig.deprecationReason,\n extensions: toObjMap(fieldConfig.extensions),\n astNode: fieldConfig.astNode,\n };\n });\n}\n\nexport function defineArguments(config) {\n return Object.entries(config).map(([argName, argConfig]) => ({\n name: assertName(argName),\n description: argConfig.description,\n type: argConfig.type,\n defaultValue: argConfig.defaultValue,\n deprecationReason: argConfig.deprecationReason,\n extensions: toObjMap(argConfig.extensions),\n astNode: argConfig.astNode,\n }));\n}\n\nfunction isPlainObj(obj) {\n return isObjectLike(obj) && !Array.isArray(obj);\n}\n\nfunction fieldsToFieldsConfig(fields) {\n return mapValue(fields, (field) => ({\n description: field.description,\n type: field.type,\n args: argsToArgsConfig(field.args),\n resolve: field.resolve,\n subscribe: field.subscribe,\n deprecationReason: field.deprecationReason,\n extensions: field.extensions,\n astNode: field.astNode,\n }));\n}\n/**\n * @internal\n */\n\nexport function argsToArgsConfig(args) {\n return keyValMap(\n args,\n (arg) => arg.name,\n (arg) => ({\n description: arg.description,\n type: arg.type,\n defaultValue: arg.defaultValue,\n deprecationReason: arg.deprecationReason,\n extensions: arg.extensions,\n astNode: arg.astNode,\n }),\n );\n}\nexport function isRequiredArgument(arg) {\n return isNonNullType(arg.type) && arg.defaultValue === undefined;\n}\n\n/**\n * Interface Type Definition\n *\n * When a field can return one of a heterogeneous set of types, a Interface type\n * is used to describe what types are possible, what fields are in common across\n * all types, as well as a function to determine which type is actually used\n * when the field is resolved.\n *\n * Example:\n *\n * ```ts\n * const EntityType = new GraphQLInterfaceType({\n * name: 'Entity',\n * fields: {\n * name: { type: GraphQLString }\n * }\n * });\n * ```\n */\nexport class GraphQLInterfaceType {\n constructor(config) {\n var _config$extensionASTN3;\n\n this.name = assertName(config.name);\n this.description = config.description;\n this.resolveType = config.resolveType;\n this.extensions = toObjMap(config.extensions);\n this.astNode = config.astNode;\n this.extensionASTNodes =\n (_config$extensionASTN3 = config.extensionASTNodes) !== null &&\n _config$extensionASTN3 !== void 0\n ? _config$extensionASTN3\n : [];\n this._fields = defineFieldMap.bind(undefined, config);\n this._interfaces = defineInterfaces.bind(undefined, config);\n config.resolveType == null ||\n typeof config.resolveType === 'function' ||\n devAssert(\n false,\n `${this.name} must provide \"resolveType\" as a function, ` +\n `but got: ${inspect(config.resolveType)}.`,\n );\n }\n\n get [Symbol.toStringTag]() {\n return 'GraphQLInterfaceType';\n }\n\n getFields() {\n if (typeof this._fields === 'function') {\n this._fields = this._fields();\n }\n\n return this._fields;\n }\n\n getInterfaces() {\n if (typeof this._interfaces === 'function') {\n this._interfaces = this._interfaces();\n }\n\n return this._interfaces;\n }\n\n toConfig() {\n return {\n name: this.name,\n description: this.description,\n interfaces: this.getInterfaces(),\n fields: fieldsToFieldsConfig(this.getFields()),\n resolveType: this.resolveType,\n extensions: this.extensions,\n astNode: this.astNode,\n extensionASTNodes: this.extensionASTNodes,\n };\n }\n\n toString() {\n return this.name;\n }\n\n toJSON() {\n return this.toString();\n }\n}\n\n/**\n * Union Type Definition\n *\n * When a field can return one of a heterogeneous set of types, a Union type\n * is used to describe what types are possible as well as providing a function\n * to determine which type is actually used when the field is resolved.\n *\n * Example:\n *\n * ```ts\n * const PetType = new GraphQLUnionType({\n * name: 'Pet',\n * types: [ DogType, CatType ],\n * resolveType(value) {\n * if (value instanceof Dog) {\n * return DogType;\n * }\n * if (value instanceof Cat) {\n * return CatType;\n * }\n * }\n * });\n * ```\n */\nexport class GraphQLUnionType {\n constructor(config) {\n var _config$extensionASTN4;\n\n this.name = assertName(config.name);\n this.description = config.description;\n this.resolveType = config.resolveType;\n this.extensions = toObjMap(config.extensions);\n this.astNode = config.astNode;\n this.extensionASTNodes =\n (_config$extensionASTN4 = config.extensionASTNodes) !== null &&\n _config$extensionASTN4 !== void 0\n ? _config$extensionASTN4\n : [];\n this._types = defineTypes.bind(undefined, config);\n config.resolveType == null ||\n typeof config.resolveType === 'function' ||\n devAssert(\n false,\n `${this.name} must provide \"resolveType\" as a function, ` +\n `but got: ${inspect(config.resolveType)}.`,\n );\n }\n\n get [Symbol.toStringTag]() {\n return 'GraphQLUnionType';\n }\n\n getTypes() {\n if (typeof this._types === 'function') {\n this._types = this._types();\n }\n\n return this._types;\n }\n\n toConfig() {\n return {\n name: this.name,\n description: this.description,\n types: this.getTypes(),\n resolveType: this.resolveType,\n extensions: this.extensions,\n astNode: this.astNode,\n extensionASTNodes: this.extensionASTNodes,\n };\n }\n\n toString() {\n return this.name;\n }\n\n toJSON() {\n return this.toString();\n }\n}\n\nfunction defineTypes(config) {\n const types = resolveReadonlyArrayThunk(config.types);\n Array.isArray(types) ||\n devAssert(\n false,\n `Must provide Array of types or a function which returns such an array for Union ${config.name}.`,\n );\n return types;\n}\n\n/**\n * Enum Type Definition\n *\n * Some leaf values of requests and input values are Enums. GraphQL serializes\n * Enum values as strings, however internally Enums can be represented by any\n * kind of type, often integers.\n *\n * Example:\n *\n * ```ts\n * const RGBType = new GraphQLEnumType({\n * name: 'RGB',\n * values: {\n * RED: { value: 0 },\n * GREEN: { value: 1 },\n * BLUE: { value: 2 }\n * }\n * });\n * ```\n *\n * Note: If a value is not provided in a definition, the name of the enum value\n * will be used as its internal value.\n */\nexport class GraphQLEnumType {\n /* <T> */\n constructor(config) {\n var _config$extensionASTN5;\n\n this.name = assertName(config.name);\n this.description = config.description;\n this.extensions = toObjMap(config.extensions);\n this.astNode = config.astNode;\n this.extensionASTNodes =\n (_config$extensionASTN5 = config.extensionASTNodes) !== null &&\n _config$extensionASTN5 !== void 0\n ? _config$extensionASTN5\n : [];\n this._values =\n typeof config.values === 'function'\n ? config.values\n : defineEnumValues(this.name, config.values);\n this._valueLookup = null;\n this._nameLookup = null;\n }\n\n get [Symbol.toStringTag]() {\n return 'GraphQLEnumType';\n }\n\n getValues() {\n if (typeof this._values === 'function') {\n this._values = defineEnumValues(this.name, this._values());\n }\n\n return this._values;\n }\n\n getValue(name) {\n if (this._nameLookup === null) {\n this._nameLookup = keyMap(this.getValues(), (value) => value.name);\n }\n\n return this._nameLookup[name];\n }\n\n serialize(outputValue) {\n if (this._valueLookup === null) {\n this._valueLookup = new Map(\n this.getValues().map((enumValue) => [enumValue.value, enumValue]),\n );\n }\n\n const enumValue = this._valueLookup.get(outputValue);\n\n if (enumValue === undefined) {\n throw new GraphQLError(\n `Enum \"${this.name}\" cannot represent value: ${inspect(outputValue)}`,\n );\n }\n\n return enumValue.name;\n }\n\n parseValue(inputValue) /* T */\n {\n if (typeof inputValue !== 'string') {\n const valueStr = inspect(inputValue);\n throw new GraphQLError(\n `Enum \"${this.name}\" cannot represent non-string value: ${valueStr}.` +\n didYouMeanEnumValue(this, valueStr),\n );\n }\n\n const enumValue = this.getValue(inputValue);\n\n if (enumValue == null) {\n throw new GraphQLError(\n `Value \"${inputValue}\" does not exist in \"${this.name}\" enum.` +\n didYouMeanEnumValue(this, inputValue),\n );\n }\n\n return enumValue.value;\n }\n\n parseLiteral(valueNode, _variables) /* T */\n {\n // Note: variables will be resolved to a value before calling this function.\n if (valueNode.kind !== Kind.ENUM) {\n const valueStr = print(valueNode);\n throw new GraphQLError(\n `Enum \"${this.name}\" cannot represent non-enum value: ${valueStr}.` +\n didYouMeanEnumValue(this, valueStr),\n {\n nodes: valueNode,\n },\n );\n }\n\n const enumValue = this.getValue(valueNode.value);\n\n if (enumValue == null) {\n const valueStr = print(valueNode);\n throw new GraphQLError(\n `Value \"${valueStr}\" does not exist in \"${this.name}\" enum.` +\n didYouMeanEnumValue(this, valueStr),\n {\n nodes: valueNode,\n },\n );\n }\n\n return enumValue.value;\n }\n\n toConfig() {\n const values = keyValMap(\n this.getValues(),\n (value) => value.name,\n (value) => ({\n description: value.description,\n value: value.value,\n deprecationReason: value.deprecationReason,\n extensions: value.extensions,\n astNode: value.astNode,\n }),\n );\n return {\n name: this.name,\n description: this.description,\n values,\n extensions: this.extensions,\n astNode: this.astNode,\n extensionASTNodes: this.extensionASTNodes,\n };\n }\n\n toString() {\n return this.name;\n }\n\n toJSON() {\n return this.toString();\n }\n}\n\nfunction didYouMeanEnumValue(enumType, unknownValueStr) {\n const allNames = enumType.getValues().map((value) => value.name);\n const suggestedValues = suggestionList(unknownValueStr, allNames);\n return didYouMean('the enum value', suggestedValues);\n}\n\nfunction defineEnumValues(typeName, valueMap) {\n isPlainObj(valueMap) ||\n devAssert(\n false,\n `${typeName} values must be an object with value names as keys.`,\n );\n return Object.entries(valueMap).map(([valueName, valueConfig]) => {\n isPlainObj(valueConfig) ||\n devAssert(\n false,\n `${typeName}.${valueName} must refer to an object with a \"value\" key ` +\n `representing an internal value but got: ${inspect(valueConfig)}.`,\n );\n return {\n name: assertEnumValueName(valueName),\n description: valueConfig.description,\n value: valueConfig.value !== undefined ? valueConfig.value : valueName,\n deprecationReason: valueConfig.deprecationReason,\n extensions: toObjMap(valueConfig.extensions),\n astNode: valueConfig.astNode,\n };\n });\n}\n\n/**\n * Input Object Type Definition\n *\n * An input object defines a structured collection of fields which may be\n * supplied to a field argument.\n *\n * Using `NonNull` will ensure that a value must be provided by the query\n *\n * Example:\n *\n * ```ts\n * const GeoPoint = new GraphQLInputObjectType({\n * name: 'GeoPoint',\n * fields: {\n * lat: { type: new GraphQLNonNull(GraphQLFloat) },\n * lon: { type: new GraphQLNonNull(GraphQLFloat) },\n * alt: { type: GraphQLFloat, defaultValue: 0 },\n * }\n * });\n * ```\n */\nexport class GraphQLInputObjectType {\n constructor(config) {\n var _config$extensionASTN6, _config$isOneOf;\n\n this.name = assertName(config.name);\n this.description = config.description;\n this.extensions = toObjMap(config.extensions);\n this.astNode = config.astNode;\n this.extensionASTNodes =\n (_config$extensionASTN6 = config.extensionASTNodes) !== null &&\n _config$extensionASTN6 !== void 0\n ? _config$extensionASTN6\n : [];\n this.isOneOf =\n (_config$isOneOf = config.isOneOf) !== null && _config$isOneOf !== void 0\n ? _config$isOneOf\n : false;\n this._fields = defineInputFieldMap.bind(undefined, config);\n }\n\n get [Symbol.toStringTag]() {\n return 'GraphQLInputObjectType';\n }\n\n getFields() {\n if (typeof this._fields === 'function') {\n this._fields = this._fields();\n }\n\n return this._fields;\n }\n\n toConfig() {\n const fields = mapValue(this.getFields(), (field) => ({\n description: field.description,\n type: field.type,\n defaultValue: field.defaultValue,\n deprecationReason: field.deprecationReason,\n extensions: field.extensions,\n astNode: field.astNode,\n }));\n return {\n name: this.name,\n description: this.description,\n fields,\n extensions: this.extensions,\n astNode: this.astNode,\n extensionASTNodes: this.extensionASTNodes,\n isOneOf: this.isOneOf,\n };\n }\n\n toString() {\n return this.name;\n }\n\n toJSON() {\n return this.toString();\n }\n}\n\nfunction defineInputFieldMap(config) {\n const fieldMap = resolveObjMapThunk(config.fields);\n isPlainObj(fieldMap) ||\n devAssert(\n false,\n `${config.name} fields must be an object with field names as keys or a function which returns such an object.`,\n );\n return mapValue(fieldMap, (fieldConfig, fieldName) => {\n !('resolve' in fieldConfig) ||\n devAssert(\n false,\n `${config.name}.${fieldName} field has a resolve property, but Input Types cannot define resolvers.`,\n );\n return {\n name: assertName(fieldName),\n description: fieldConfig.description,\n type: fieldConfig.type,\n defaultValue: fieldConfig.defaultValue,\n deprecationReason: fieldConfig.deprecationReason,\n extensions: toObjMap(fieldConfig.extensions),\n astNode: fieldConfig.astNode,\n };\n });\n}\n\nexport function isRequiredInputField(field) {\n return isNonNullType(field.type) && field.defaultValue === undefined;\n}\n","import {\n\ttype GraphQLArgument,\n\tGraphQLEnumType,\n\tGraphQLInputObjectType,\n\ttype GraphQLInputType,\n\tGraphQLList,\n\tGraphQLNonNull,\n\tGraphQLObjectType,\n\ttype GraphQLOutputType,\n\tGraphQLScalarType,\n} from \"graphql\";\n\ntype GraphQLType =\n\t| GraphQLObjectType<any, any>\n\t| GraphQLEnumType\n\t| GraphQLInputObjectType\n\t| GraphQLScalarType;\n\nexport function makeTSRepresentation(model: GraphQLType) {\n\tif (model instanceof GraphQLObjectType) {\n\t\treturn makeTSTypeFromObject(model);\n\t} else if (model instanceof GraphQLScalarType) {\n\t\treturn mapGraphqlScalarToTSTypeString(model);\n\t} else if (model instanceof GraphQLEnumType) {\n\t\treturn makeStringLiteralUnionFromEnum(model);\n\t} else if (model instanceof GraphQLInputObjectType) {\n\t\treturn makeTSTypeFromInputObject(model);\n\t}\n}\n\nfunction makeTSTypeFromObject(model: GraphQLObjectType) {\n\tconst stringifiedFields = new Map<string, string>();\n\tfor (const [key, value] of Object.entries(model.getFields())) {\n\t\tstringifiedFields.set(key, makeTSObjectTypeField(value.type, value.args));\n\t}\n\n\treturn `{\n ${stringifiedFields\n\t\t.entries()\n\t\t.map(([key, value]) => `${key}: ${value}`)\n\t\t.toArray()\n\t\t.join(\",\\n \")} \n}`;\n}\n\nfunction makeTSTypeFromInputObject(model: GraphQLInputObjectType) {\n\tconst stringifiedFields = new Map<string, string>();\n\tfor (const [key, value] of Object.entries(model.getFields())) {\n\t\tstringifiedFields.set(key, makeTSInputObjectTypeField(value.type));\n\t}\n\n\treturn `{\n ${stringifiedFields\n\t\t.entries()\n\t\t.map(\n\t\t\t([key, value]) =>\n\t\t\t\t`${key}${value.includes(\"| undefined\") ? \"?\" : \"\"}: ${value}`,\n\t\t)\n\t\t.toArray()\n\t\t.join(\",\\n \")} \n}`;\n}\n\nfunction makeTSObjectTypeField(\n\treturnType: GraphQLOutputType,\n\targs?: readonly GraphQLArgument[],\n) {\n\tlet isNonNullReturnType = false;\n\tlet isList = false;\n\n\tfor (let index = 0; index < 3; index++) {\n\t\tif (returnType instanceof GraphQLList) {\n\t\t\tisList = true;\n\t\t\treturnType = returnType.ofType;\n\t\t}\n\n\t\tif (returnType instanceof GraphQLNonNull) {\n\t\t\tisNonNullReturnType = true;\n\t\t\treturnType = returnType.ofType;\n\t\t}\n\t}\n\n\tlet returnTypeString = (returnType as any).name;\n\n\tif (isList) {\n\t\treturnTypeString += \"[]\";\n\t}\n\n\tif (!isNonNullReturnType) {\n\t\treturnTypeString += \" | null\";\n\t}\n\n\tconst isRelationType = returnType instanceof GraphQLObjectType;\n\n\tconst argsStringMap = new Map<string, string>();\n\n\tfor (const arg of args ?? []) {\n\t\targsStringMap.set(arg.name, stringifyTSObjectArg(arg.type));\n\t}\n\n\tif (isRelationType) {\n\t\tconst makePOptional = argsStringMap\n\t\t\t.entries()\n\t\t\t.every(([, value]) => value.includes(\"| undefined\"));\n\t\tconst argsString =\n\t\t\t(args ?? []).length > 0\n\t\t\t\t? `p${makePOptional ? \"?\" : \"\"}: {\n ${argsStringMap\n\t\t.entries()\n\t\t.map(\n\t\t\t([key, value]) =>\n\t\t\t\t` ${key}${value.includes(\"| undefined\") ? \"?\" : \"\"}: ${value}`,\n\t\t)\n\t\t.toArray()\n\t\t.join(\",\\n \")}\n }`\n\t\t\t\t: \"\";\n\n\t\treturn `(${argsString}) => ${returnTypeString}`;\n\t} else {\n\t\treturn returnTypeString;\n\t}\n}\n\nfunction makeTSInputObjectTypeField(returnType: GraphQLInputType) {\n\tlet isNonNullReturnType = false;\n\tlet isList = false;\n\n\tfor (let index = 0; index < 3; index++) {\n\t\tif (returnType instanceof GraphQLList) {\n\t\t\tisList = true;\n\t\t\treturnType = returnType.ofType;\n\t\t}\n\n\t\tif (returnType instanceof GraphQLNonNull) {\n\t\t\tisNonNullReturnType = true;\n\t\t\treturnType = returnType.ofType;\n\t\t}\n\t}\n\n\tlet returnTypeString = (returnType as any).name;\n\n\tif (isList) {\n\t\treturnTypeString += \"[]\";\n\t}\n\n\tif (!isNonNullReturnType) {\n\t\treturnTypeString += \" | null | undefined\";\n\t} else if (isList) {\n\t\treturnTypeString += \" | undefined\";\n\t}\n\n\treturn returnTypeString;\n}\n\nfunction stringifyTSObjectArg(arg: any) {\n\tlet ret = \"unknown\";\n\tlet isNullable = true;\n\n\tif (arg instanceof GraphQLNonNull) {\n\t\tisNullable = false;\n\t\targ = arg.ofType;\n\t}\n\n\tif (\n\t\targ instanceof GraphQLInputObjectType ||\n\t\targ instanceof GraphQLScalarType\n\t) {\n\t\tret = arg.name;\n\t}\n\n\tif (isNullable) {\n\t\tret += \" | null | undefined\"; // we also want undefined in args\n\t}\n\n\treturn ret;\n}\n\nfunction mapGraphqlScalarToTSTypeString(arg: any) {\n\tswitch (arg.name) {\n\t\tcase \"ID\":\n\t\t\treturn \"string\";\n\t\tcase \"String\":\n\t\t\treturn \"string\";\n\t\tcase \"Boolean\":\n\t\t\treturn \"boolean\";\n\t\tcase \"Int\":\n\t\t\treturn \"number\";\n\t\tcase \"Float\":\n\t\t\treturn \"number\";\n\t\tcase \"Date\":\n\t\t\treturn \"Date\";\n\t\tcase \"DateTime\":\n\t\t\treturn \"Date\";\n\t\tcase \"JSON\":\n\t\t\treturn \"any\";\n\t\tdefault:\n\t\t\treturn \"unknown\";\n\t}\n}\n\nfunction makeStringLiteralUnionFromEnum(enumType: GraphQLEnumType) {\n\treturn enumType\n\t\t.getValues()\n\t\t.map((value) => `\"${value.name}\"`)\n\t\t.join(\" | \");\n}\n","import { exists, mkdir, rm, writeFile } from \"node:fs/promises\";\nimport { join } from \"node:path\";\nimport type { GraphQLSchema } from \"graphql\";\nimport { generateClient } from \"./client\";\nimport { makeTSRepresentation } from \"./tsRepresentation\";\n\nexport async function generateFromSchema({\n\toutputPath,\n\tschema,\n\trumbleImportPath = \"@m1212e/rumble\",\n\tapiUrl,\n\tuseExternalUrqlClient = false,\n}: {\n\tschema: GraphQLSchema;\n\toutputPath: string;\n\trumbleImportPath?: string;\n\tapiUrl?: string;\n\tuseExternalUrqlClient?: boolean | string;\n}) {\n\tif (await exists(outputPath)) {\n\t\tawait rm(outputPath, { recursive: true, force: true });\n\t}\n\tawait mkdir(outputPath, { recursive: true });\n\n\tif (!outputPath.endsWith(\"/\")) {\n\t\toutputPath += \"/\";\n\t}\n\n\tconst imports: string[] = [];\n\tlet code = \"\";\n\n\tconst typeMap = new Map<string, any>();\n\tfor (const [key, object] of Object.entries(schema.getTypeMap())) {\n\t\tif (key.startsWith(\"__\")) continue;\n\t\ttypeMap.set(key, object);\n\t}\n\n\tfor (const [key, object] of typeMap.entries()) {\n\t\tconst rep = makeTSRepresentation(object);\n\n\t\tif (rep === key) {\n\t\t\tcontinue;\n\t\t}\n\n\t\tcode += `\nexport type ${key} = ${makeTSRepresentation(object)};\n\t\t`;\n\t}\n\n\tconst c = generateClient({\n\t\tapiUrl,\n\t\tuseExternalUrqlClient,\n\t\trumbleImportPath,\n\t\tavailableSubscriptions: new Set(\n\t\t\tObject.keys(schema.getSubscriptionType()?.getFields() || {}),\n\t\t),\n\t});\n\n\timports.push(...c.imports);\n\tcode += c.code;\n\n\tawait writeFile(\n\t\tjoin(outputPath, \"client.ts\"),\n\t\t`${imports.join(\"\\n\")}\\n${code}`,\n\t);\n}\n","import type { Client } from \"@urql/core\";\nimport { capitalize } from \"es-toolkit\";\nimport {\n\tempty,\n\tfromValue,\n\tmap,\n\tmerge,\n\tonPush,\n\tpipe,\n\ttoObservable,\n\ttoPromise,\n} from \"wonka\";\n\nexport const argsKey = \"__args\";\n\nexport function makeGraphQLQuery({\n\tqueryName,\n\tinput,\n\tclient,\n\tenableSubscription = false,\n}: {\n\tqueryName: string;\n\tinput: Record<string, any>;\n\tclient: Client;\n\tenableSubscription?: boolean;\n}) {\n\tconst otwQueryName = `${capitalize(queryName)}Query`;\n\tconst argsString = stringifyArgumentObjectToGraphqlList(input[argsKey] ?? {});\n\tconst operationString = (operationVerb: \"query\" | \"subscription\") =>\n\t\t`${operationVerb} ${otwQueryName} { ${queryName}${argsString} { ${stringifySelection(input)} }}`;\n\n\tlet awaitedReturnValueReference: any;\n\n\tconst response = pipe(\n\t\tmerge([\n\t\t\tclient.query(operationString(\"query\"), {}),\n\t\t\tenableSubscription\n\t\t\t\t? client.subscription(operationString(\"subscription\"), {})\n\t\t\t\t: empty,\n\t\t]),\n\t\tmap((v) => {\n\t\t\tconst data = v.data?.[queryName];\n\t\t\tif (!data && v.error) {\n\t\t\t\tthrow v.error;\n\t\t\t}\n\n\t\t\treturn data;\n\t\t}),\n\t\tonPush((data) => {\n\t\t\tif (awaitedReturnValueReference) {\n\t\t\t\tObject.assign(awaitedReturnValueReference, data);\n\t\t\t}\n\t\t}),\n\t);\n\n\tconst promise = new Promise((resolve) => {\n\t\tconst unsub = toObservable(response).subscribe((v) => {\n\t\t\tunsub();\n\t\t\tconst newObservableWithAwaitedValue = pipe(\n\t\t\t\tmerge([response, fromValue(v)]),\n\t\t\t\ttoObservable,\n\t\t\t);\n\t\t\tawaitedReturnValueReference = { ...v, ...newObservableWithAwaitedValue };\n\t\t\tresolve(awaitedReturnValueReference);\n\t\t}).unsubscribe;\n\t});\n\tObject.assign(promise, toObservable(response));\n\n\treturn promise;\n}\n\nexport function makeGraphQLMutation({\n\tmutationName,\n\tinput,\n\tclient,\n}: {\n\tmutationName: string;\n\tinput: Record<string, any>;\n\tclient: Client;\n}) {\n\tconst otwMutationName = `${capitalize(mutationName)}Mutation`;\n\n\tconst argsString = stringifyArgumentObjectToGraphqlList(input[argsKey] ?? {});\n\n\tconst response = pipe(\n\t\tclient.mutation(\n\t\t\t`mutation ${otwMutationName} { ${mutationName}${argsString} { ${stringifySelection(input)} }}`,\n\t\t\t{},\n\t\t),\n\t\tmap((v) => {\n\t\t\tconst data = v.data?.[mutationName];\n\t\t\tif (!data && v.error) {\n\t\t\t\tthrow v.error;\n\t\t\t}\n\n\t\t\treturn data;\n\t\t}),\n\t);\n\n\tconst observable = toObservable(response);\n\tconst promise = toPromise(response).then((res) => {\n\t\tObject.assign(res, observable);\n\t\treturn res;\n\t});\n\tObject.assign(promise, observable);\n\n\treturn promise;\n}\n\nexport function makeGraphQLSubscription({\n\tsubscriptionName,\n\tinput,\n\tclient,\n}: {\n\tsubscriptionName: string;\n\tinput: Record<string, any>;\n\tclient: Client;\n}) {\n\tconst otwSubscriptionName = `${capitalize(subscriptionName)}Subscription`;\n\tconst argsString = stringifyArgumentObjectToGraphqlList(input[argsKey] ?? {});\n\n\treturn pipe(\n\t\tclient.subscription(\n\t\t\t`subscription ${otwSubscriptionName} { ${subscriptionName}${argsString} { ${stringifySelection(input)} }}`,\n\t\t\t{},\n\t\t),\n\t\tmap((v) => {\n\t\t\tconst data = v.data?.[subscriptionName];\n\t\t\tif (!data && v.error) {\n\t\t\t\tthrow v.error;\n\t\t\t}\n\n\t\t\treturn data;\n\t\t}),\n\t\ttoObservable,\n\t) as any;\n}\n\nfunction stringifySelection(selection: Record<string, any>) {\n\treturn Object.entries(selection)\n\t\t.filter(([key]) => key !== argsKey)\n\t\t.reduce((acc, [key, value]) => {\n\t\t\tif (typeof value === \"object\") {\n\t\t\t\tif (value[argsKey]) {\n\t\t\t\t\tconst argsString = stringifyArgumentObjectToGraphqlList(\n\t\t\t\t\t\tvalue[argsKey],\n\t\t\t\t\t);\n\t\t\t\t\tacc += `${key}${argsString} { ${stringifySelection(value)} }\n`;\n\t\t\t\t\treturn acc;\n\t\t\t\t}\n\n\t\t\t\tacc += `${key} { ${stringifySelection(value)} }\n`;\n\t\t\t} else {\n\t\t\t\tacc += `${key}\n`;\n\t\t\t}\n\t\t\treturn acc;\n\t\t}, \"\");\n}\n\nfunction stringifyArgumentObjectToGraphqlList(args: Record<any, any>) {\n\tconst entries = Object.entries(args);\n\tif (entries.length === 0) {\n\t\treturn \"\";\n\t}\n\n\treturn `(${entries.map(([key, value]) => `${key}: ${stringifyArgumentValue(value)}`).join(\", \")})`;\n}\n\nfunction stringifyArgumentValue(arg: any): string {\n\tswitch (typeof arg) {\n\t\tcase \"string\":\n\t\t\treturn `\"${arg}\"`;\n\t\tcase \"number\":\n\t\t\treturn `${arg}`;\n\t\tcase \"bigint\":\n\t\t\treturn `${arg}`;\n\t\tcase \"boolean\":\n\t\t\treturn `${arg}`;\n\t\tcase \"symbol\":\n\t\t\tthrow new Error(\"Cannot stringify a symbol to send as gql arg\");\n\t\tcase \"undefined\":\n\t\t\treturn \"null\";\n\t\tcase \"object\":\n\t\t\treturn `{ ${Object.entries(arg)\n\t\t\t\t.map(([key, value]) => `${key}: ${stringifyArgumentValue(value)}`)\n\t\t\t\t.join(\", \")} }`;\n\t\tcase \"function\":\n\t\t\tthrow new Error(\"Cannot stringify a function to send as gql arg\");\n\t}\n}\n","import type { Client } from \"@urql/core\";\nimport { makeGraphQLQuery } from \"./request\";\nimport type { QueryableObjectFromGeneratedTypes } from \"./types\";\n\nexport function makeLiveQuery<Query extends Record<string, any>>({\n\turqlClient,\n\tavailableSubscriptions,\n}: {\n\turqlClient: Client;\n\tavailableSubscriptions: Set<string>;\n}) {\n\treturn new Proxy(\n\t\t{},\n\t\t{\n\t\t\tget: (_target, prop) => {\n\t\t\t\treturn (input: Record<string, any>) => {\n\t\t\t\t\treturn makeGraphQLQuery({\n\t\t\t\t\t\tqueryName: prop as string,\n\t\t\t\t\t\tinput,\n\t\t\t\t\t\tclient: urqlClient,\n\t\t\t\t\t\tenableSubscription: availableSubscriptions.has(prop as string),\n\t\t\t\t\t});\n\t\t\t\t};\n\t\t\t},\n\t\t},\n\t) as QueryableObjectFromGeneratedTypes<Query>;\n}\n","import type { Client } from \"@urql/core\";\nimport { makeGraphQLMutation } from \"./request\";\nimport type { QueryableObjectFromGeneratedTypes } from \"./types\";\n\nexport function makeMutation<Mutation extends Record<string, any>>({\n\turqlClient,\n}: {\n\turqlClient: Client;\n}) {\n\treturn new Proxy(\n\t\t{},\n\t\t{\n\t\t\tget: (_target, prop) => {\n\t\t\t\treturn (input: Record<string, any>) => {\n\t\t\t\t\treturn makeGraphQLMutation({\n\t\t\t\t\t\tmutationName: prop as string,\n\t\t\t\t\t\tinput,\n\t\t\t\t\t\tclient: urqlClient,\n\t\t\t\t\t});\n\t\t\t\t};\n\t\t\t},\n\t\t},\n\t) as QueryableObjectFromGeneratedTypes<Mutation>;\n}\n","import type { Client } from \"@urql/core\";\nimport { makeGraphQLQuery } from \"./request\";\nimport type { QueryableObjectFromGeneratedTypes } from \"./types\";\n\nexport function makeQuery<Query extends Record<string, any>>({\n\turqlClient,\n}: {\n\turqlClient: Client;\n}) {\n\treturn new Proxy(\n\t\t{},\n\t\t{\n\t\t\tget: (_target, prop) => {\n\t\t\t\treturn (input: Record<string, any>) => {\n\t\t\t\t\treturn makeGraphQLQuery({\n\t\t\t\t\t\tqueryName: prop as string,\n\t\t\t\t\t\tinput,\n\t\t\t\t\t\tclient: urqlClient,\n\t\t\t\t\t\tenableSubscription: false,\n\t\t\t\t\t});\n\t\t\t\t};\n\t\t\t},\n\t\t},\n\t) as QueryableObjectFromGeneratedTypes<Query>;\n}\n","import type { Client } from \"@urql/core\";\nimport { argsKey, makeGraphQLSubscription } from \"./request\";\nimport type {\n\tApplySelection,\n\tObjectFieldSelection,\n\tSubscribeable,\n} from \"./types\";\nimport type { UnArray } from \"./utilTypes\";\n\nexport function makeSubscription<Subscription extends Record<string, any>>({\n\turqlClient,\n}: {\n\turqlClient: Client;\n}) {\n\treturn new Proxy(\n\t\t{},\n\t\t{\n\t\t\tget: (_target, prop) => {\n\t\t\t\treturn (input: Record<string, any>) => {\n\t\t\t\t\treturn makeGraphQLSubscription({\n\t\t\t\t\t\tsubscriptionName: prop as string,\n\t\t\t\t\t\tinput,\n\t\t\t\t\t\tclient: urqlClient,\n\t\t\t\t\t});\n\t\t\t\t};\n\t\t\t},\n\t\t},\n\t) as SubscriptionObject<Subscription>;\n}\n\nexport type SubscriptionObject<Q> = {\n\t[Key in keyof Q]: QueryableObjectField<Q[Key]>;\n};\n\ntype QueryableObjectField<T> = T extends (\n\tp: infer QueryArgs,\n) => infer QueryResponse\n\t? <\n\t\t\tSelected extends QueryArgs extends Record<string, any>\n\t\t\t\t? ObjectFieldSelection<UnArray<NonNullable<QueryResponse>>> & {\n\t\t\t\t\t\t[argsKey]: QueryArgs;\n\t\t\t\t\t}\n\t\t\t\t: ObjectFieldSelection<UnArray<NonNullable<QueryResponse>>>,\n\t\t>(\n\t\t\ts: Selected,\n\t\t) => QueryResponse extends null\n\t\t\t? Subscribeable<\n\t\t\t\t\tNonNullable<QueryResponse> extends Array<any>\n\t\t\t\t\t\t? ApplySelection<UnArray<NonNullable<QueryResponse>>, Selected>[]\n\t\t\t\t\t\t: ApplySelection<UnArray<NonNullable<QueryResponse>>, Selected>\n\t\t\t\t> | null\n\t\t\t: Subscribeable<\n\t\t\t\t\tQueryResponse extends Array<any>\n\t\t\t\t\t\t? ApplySelection<UnArray<QueryResponse>, Selected>[]\n\t\t\t\t\t\t: ApplySelection<UnArray<QueryResponse>, Selected>\n\t\t\t\t>\n\t: Subscribeable<T>;\n","import { GraphQLError } from \"graphql\";\n/**\n * An error that gets raised by rumble whenever something does not go according to plan.\n * Mostly internals, configuration errors or other unexpected things.\n */\nexport class RumbleError extends Error {\n\tconstructor(message: string) {\n\t\tsuper(message);\n\t\tthis.name = \"RumbleError\";\n\t}\n}\n\n/**\n * An error that gets raised by rumble whenever an error occurs in a resolver, containing\n * information safely exposeable to the user.\n * E.g. the assert helpers issue these.\n */\nexport class RumbleErrorSafe extends GraphQLError {}\n","import type { Filter } from \"../runtimeFiltersPlugin/pluginTypes\";\nimport { RumbleErrorSafe } from \"../types/rumbleError\";\n\n/**\n * \n * Helper function to map a drizzle findFirst query result,\n * which may be optional, to a correct drizzle type.\n * \n * @throws RumbleError\n * \n * @example\n * \n * ```ts\n * schemaBuilder.queryFields((t) => {\n return {\n findFirstUser: t.drizzleField({\n type: UserRef,\n resolve: (query, root, args, ctx, info) => {\n return (\n db.query.users\n .findFirst({\n ...query,\n where: ctx.abilities.users.filter(\"read\").single.where,\n })\n // note that we need to manually raise an error if the value is not found\n .then(assertFindFirstExists)\n );\n },\n }),\n };\n });\n * ```\n */\nexport const assertFindFirstExists = <T>(value: T | undefined): T => {\n\tif (!value)\n\t\tthrow new RumbleErrorSafe(\"Value not found but required (findFirst)\");\n\treturn value;\n};\n\n/**\n * \n * Helper function to map a drizzle findFirst query result,\n * which may be optional, to a correct drizzle type.\n * \n * @throws RumbleError\n * \n * @example\n * \n * ```ts\n schemaBuilder.mutationFields((t) => {\n return {\n updateUsername: t.drizzleField({\n type: UserRef,\n args: {\n userId: t.arg.int({ required: true }),\n newName: t.arg.string({ required: true }),\n },\n resolve: (query, root, args, ctx, info) => {\n return db\n .update(schema.users)\n .set({\n name: args.newName,\n })\n .where(\n and(\n eq(schema.users.id, args.userId),\n ctx.abilities.users.filter(\"update\").single.where\n )\n )\n .returning({ id: schema.users.id, name: schema.users.name })\n // note that we need to manually raise an error if the value is not found\n .then(assertFirstEntryExists);\n },\n }),\n };\n });\n * ```\n */\nexport const assertFirstEntryExists = <T>(value: T[]): T => {\n\tconst v = value.at(0);\n\tif (!v)\n\t\tthrow new RumbleErrorSafe(\"Value not found but required (firstEntry)\");\n\treturn v;\n};\n\n/**\n * A helper to apply a list of filters to a given list of entities.\n * \n * @example\n * \n * ```ts\n * const filtered = await applyFilters({\n filters: abilityBuilder.registeredFilters.posts.update,\n entities: entitiesToFilter,\n context: ctx,\n });\n * ```\n */\nexport const applyFilters = async <Context, T, H extends T>({\n\tfilters,\n\tentities,\n\tcontext,\n}: {\n\tentities: T[];\n\tfilters: Filter<Context, H>[];\n\tcontext: Context;\n}) => {\n\treturn (\n\t\tawait Promise.all(\n\t\t\tfilters.map((f) =>\n\t\t\t\tf({\n\t\t\t\t\tcontext,\n\t\t\t\t\tentities: entities as H[],\n\t\t\t\t}),\n\t\t\t),\n\t\t)\n\t).reduce((acc, val) => {\n\t\tacc.push(...val);\n\t\treturn acc;\n\t}, []) as T[];\n};\n\n/**\n * Helper to map null fields to undefined\n * @param obj The object to map\n * @returns The mapped object with all fields of 'null' transformed to 'undefined'\n * \n * This becomes useful for update mutations where you do not want to pass null (unset value in db)\n * but undefined (do not touch value in db) in case of a value not beeing set in the args of said mutation\n * @example\n * ```ts\n * updateUser: t.drizzleField({\n type: User,\n args: {\n id: t.arg.string({ required: true }),\n email: t.arg.string(),\n lastName: t.arg.string(),\n firstName: t.arg.string(),\n },\n resolve: async (query, root, args, ctx, info) => {\n const mappedArgs = mapNullFieldsToUndefined(args);\n const user = await db.transaction(async (tx) => {\n const user = await tx\n .update(schema.user)\n .set({\n\n // email: args.email ?? undefined,\n // lastName: args.lastName ?? undefined,\n // firstName: args.firstName ?? undefined,\n\n // becomes this\n\n email: mappedArgs.email,\n lastName: mappedArgs.lastName,\n firstName: mappedArgs.firstName,\n })\n .returning()\n .then(assertFirstEntryExists);\n return user;\n });\n\n pubsub.updated(user.id);\n\n return db.query.user\n .findFirst(\n query(\n ctx.abilities.user.filter('read', {\n inject: {\n where: { id: user.id },\n },\n }).query.single,\n ),\n )\n .then(assertFindFirstExists);\n },\n }),\n * \n * \n * ```\n */\nexport function mapNullFieldsToUndefined<T extends object>(obj: T) {\n\treturn Object.fromEntries(\n\t\tObject.entries(obj).map(([key, value]) => [\n\t\t\tkey,\n\t\t\tvalue === null ? undefined : value,\n\t\t]),\n\t) as {\n\t\t[K in keyof T]: T[K] extends null ? undefined : Exclude<T[K], null>;\n\t};\n}\n","/**\n * Creates a lazily initialized function.\n *\n * The returned function will call the initializer function on its first call and\n * store the result. On subsequent calls, it will return the stored result.\n *\n * @param initializer The function to be called for initialization.\n * @returns A function that calls the initializer function on its first call and\n * returns the stored result on subsequent calls.\n */\nexport function lazy<T>(initializer: () => T): () => T {\n\tlet value: T | undefined;\n\tlet initialized = false;\n\n\treturn () => {\n\t\tif (!initialized) {\n\t\t\tvalue = initializer();\n\t\t\tinitialized = true;\n\t\t}\n\t\treturn value!;\n\t};\n}\n","import { RumbleError } from \"../../types/rumbleError\";\n\nexport const possibleSQLTypesStrings = [\n\t\"serial\",\n\t\"int\",\n\t\"integer\",\n\t\"tinyint\",\n\t\"smallint\",\n\t\"mediumint\",\n\t\"real\",\n\t\"decimal\",\n\t\"double\",\n\t\"float\",\n\t\"string\",\n\t\"text\",\n\t\"varchar\",\n\t\"char\",\n\t\"text(256)\",\n\t\"uuid\",\n\t\"boolean\",\n\t\"date\",\n\t\"datetime\",\n\t\"timestamp\",\n\t\"json\",\n] as const;\n\nexport type PossibleSQLType = (typeof possibleSQLTypesStrings)[number];\n\nexport const UnknownTypeRumbleError = (\n\tsqlType: string,\n\tadditionalInfo?: string,\n) =>\n\tnew RumbleError(\n\t\t`RumbleError: Unknown SQL type '${sqlType}'. Please open an issue (https://github.com/m1212e/rumble/issues) so it can be added. (${additionalInfo})`,\n\t);\n","import { type PossibleSQLType, UnknownTypeRumbleError } from \"./types\";\n\nexport function createDistinctValuesFromSQLType(sqlType: PossibleSQLType): {\n\tvalue1: any;\n\tvalue2: any;\n} {\n\tif (\n\t\t[\"serial\", \"int\", \"integer\", \"tinyint\", \"smallint\", \"mediumint\"].includes(\n\t\t\tsqlType,\n\t\t)\n\t) {\n\t\treturn {\n\t\t\tvalue1: 1,\n\t\t\tvalue2: 2,\n\t\t};\n\t}\n\n\tif ([\"real\", \"decimal\", \"double\", \"float\"].includes(sqlType)) {\n\t\treturn {\n\t\t\tvalue1: 1.1,\n\t\t\tvalue2: 2.2,\n\t\t};\n\t}\n\n\tif ([\"string\", \"text\", \"varchar\", \"char\", \"text(256)\"].includes(sqlType)) {\n\t\treturn {\n\t\t\tvalue1: \"a\",\n\t\t\tvalue2: \"b\",\n\t\t};\n\t}\n\n\tif ([\"uuid\"].includes(sqlType)) {\n\t\treturn {\n\t\t\tvalue1: \"fba31870-5528-42d7-b27e-2e5ee657aea5\",\n\t\t\tvalue2: \"fc65db81-c2d1-483d-8a25-a30e2cf6e02d\",\n\t\t};\n\t}\n\n\tif ([\"boolean\"].includes(sqlType)) {\n\t\treturn {\n\t\t\tvalue1: true,\n\t\t\tvalue2: false,\n\t\t};\n\t}\n\n\tif ([\"timestamp\", \"datetime\"].includes(sqlType)) {\n\t\treturn {\n\t\t\tvalue1: new Date(2022, 1, 1),\n\t\t\tvalue2: new Date(2022, 1, 2),\n\t\t};\n\t}\n\n\tif ([\"date\"].includes(sqlType)) {\n\t\treturn {\n\t\t\tvalue1: new Date(2022, 1, 1),\n\t\t\tvalue2: new Date(2022, 1, 2),\n\t\t};\n\t}\n\n\tif ([\"json\"].includes(sqlType)) {\n\t\treturn {\n\t\t\tvalue1: { a: 1 },\n\t\t\tvalue2: { b: 2 },\n\t\t};\n\t}\n\n\tthrow UnknownTypeRumbleError(sqlType, \"Distinct\");\n}\n","import type { Column, Many, One, Table } from \"drizzle-orm\";\nimport type { NonEnumFields } from \"../enum\";\nimport type { GenericDrizzleDbTypeConstraints } from \"../types/genericDrizzleDbType\";\nimport { RumbleError } from \"../types/rumbleError\";\n\nexport type TableIdentifierTSName<DB extends GenericDrizzleDbTypeConstraints> =\n\tkeyof NonEnumFields<NonNullable<DB[\"_\"][\"relations\"][\"schema\"]>>;\n\nconst nameSymbol = Symbol.for(\"drizzle:Name\");\nconst columnsSymbol = Symbol.for(\"drizzle:Columns\");\n\nexport function tableHelper<\n\tDB extends GenericDrizzleDbTypeConstraints,\n\tTSVariable extends TableIdentifierTSName<DB>,\n\tDBVariable extends string,\n\tT extends Table,\n>({\n\tdbName,\n\ttsName,\n\ttable,\n\tdb,\n}: Partial<{\n\ttsName: TSVariable;\n\tdbName: DBVariable;\n\ttable: T;\n}> &\n\t(\n\t\t| {\n\t\t\t\tdbName: DBVariable;\n\t\t }\n\t\t| {\n\t\t\t\ttsName: TSVariable;\n\t\t }\n\t\t| {\n\t\t\t\ttable: T;\n\t\t }\n\t) & { db: DB }) {\n\tlet tableSchema: Table | undefined = table;\n\n\tif (tsName) {\n\t\ttableSchema = db._.relations.schema[tsName as string];\n\t}\n\n\tif (dbName) {\n\t\ttableSchema = Object.values(db._.relations.schema).find(\n\t\t\t(schema: any) => schema[nameSymbol] === dbName,\n\t\t);\n\t}\n\n\tif (!tableSchema) {\n\t\tthrow new RumbleError(\n\t\t\t`Could not find schema for ${JSON.stringify({ tsName, dbName, table: (table as any)?.[nameSymbol] }).toString()}`,\n\t\t);\n\t}\n\n\treturn {\n\t\ttableSchema,\n\t\tcolumns: (tableSchema as any)[columnsSymbol] as Record<string, Column>,\n\t\tget primaryColumns() {\n\t\t\treturn Object.entries((tableSchema as any)[columnsSymbol])\n\t\t\t\t.filter(([, v]) => (v as Column).primary)\n\t\t\t\t.reduce((acc, [k, v]) => {\n\t\t\t\t\t(acc as any)[k] = v;\n\t\t\t\t\treturn acc;\n\t\t\t\t}, {}) as Record<string, Column>;\n\t\t},\n\t\trelations: db._.relations.config[tsName as string] as\n\t\t\t| {\n\t\t\t\t\t[key: string]: One<any, any> | Many<any, any>;\n\t\t\t }\n\t\t\t| undefined,\n\t\tdbName: (tableSchema as any)[nameSymbol] as string,\n\t\tget tsName() {\n\t\t\treturn Object.entries(db._.relations.schema)\n\t\t\t\t.find(([, v]) => v === tableSchema)!\n\t\t\t\t.at(0) as string;\n\t\t},\n\t};\n}\n","import { relationsFilterToSQL } from \"drizzle-orm\";\nimport { lazy } from \"./helpers/lazy\";\nimport { createDistinctValuesFromSQLType } from \"./helpers/sqlTypes/distinctValuesFromSQLType\";\nimport { tableHelper } from \"./helpers/tableHelpers\";\nimport type { Filter } from \"./runtimeFiltersPlugin/pluginTypes\";\nimport type { GenericDrizzleDbTypeConstraints } from \"./types/genericDrizzleDbType\";\nimport { RumbleError } from \"./types/rumbleError\";\nimport type {\n\tCustomRumblePothosConfig,\n\tRumbleInput,\n} from \"./types/rumbleInput\";\n\nexport type AbilityBuilderType<\n\tUserContext extends Record<string, any>,\n\tDB extends GenericDrizzleDbTypeConstraints,\n\tRequestEvent extends Record<string, any>,\n\tAction extends string,\n\tPothosConfig extends CustomRumblePothosConfig,\n> = ReturnType<\n\ttypeof createAbilityBuilder<\n\t\tUserContext,\n\t\tDB,\n\t\tRequestEvent,\n\t\tAction,\n\t\tPothosConfig\n\t>\n>;\n\ntype TableName<DB extends GenericDrizzleDbTypeConstraints> = keyof DB[\"query\"];\n\ntype QueryFilterInput<\n\tDB extends GenericDrizzleDbTypeConstraints,\n\tTableKey extends TableName<DB>,\n> = Parameters<DB[\"query\"][TableKey][\"findMany\"]>[0];\n\ntype SimpleQueryFilter<\n\tDB extends GenericDrizzleDbTypeConstraints,\n\tTableKey extends keyof DB[\"query\"],\n\tFilter extends QueryFilterInput<DB, TableKey>,\n> = Filter;\n\ntype FunctionQueryFilter<\n\tDB extends GenericDrizzleDbTypeConstraints,\n\tTableKey extends keyof DB[\"query\"],\n\tFilter extends QueryFilterInput<DB, TableKey>,\n\tContext,\n> = (context: Context) => Filter | undefined | \"allow\";\n\nfunction isSimpleQueryFilter<\n\tDB extends GenericDrizzleDbTypeConstraints,\n\tTableKey extends keyof DB[\"query\"],\n\tFilter extends QueryFilterInput<DB, TableKey>,\n\tContext,\n>(\n\tfilter: QueryFilter<DB, TableKey, Filter, Context>,\n): filter is SimpleQueryFilter<DB, TableKey, Filter> {\n\treturn typeof filter !== \"function\";\n}\n\ntype QueryFilter<\n\tDB extends GenericDrizzleDbTypeConstraints,\n\tTableName extends keyof DB[\"query\"],\n\tFilter extends QueryFilterInput<DB, TableName>,\n\tContext,\n> =\n\t| SimpleQueryFilter<DB, TableName, Filter>\n\t| FunctionQueryFilter<DB, TableName, Filter, Context>;\n\nfunction isFunctionFilter<\n\tDB extends GenericDrizzleDbTypeConstraints,\n\tTableKey extends keyof DB[\"query\"],\n\tFilter extends QueryFilterInput<DB, TableKey>,\n\tContext,\n>(\n\tfilter: QueryFilter<DB, TableKey, Filter, Context>,\n): filter is FunctionQueryFilter<DB, TableKey, Filter, Context> {\n\treturn (\n\t\ttypeof filter === \"function\" && filter.constructor.name !== \"AsyncFunction\"\n\t);\n}\n\nexport const createAbilityBuilder = <\n\tUserContext extends Record<string, any>,\n\tDB extends GenericDrizzleDbTypeConstraints,\n\tRequestEvent extends Record<string, any>,\n\tAction extends string,\n\tPothosConfig extends CustomRumblePothosConfig,\n>({\n\tdb,\n\tactions,\n\tdefaultLimit,\n}: RumbleInput<UserContext, DB, RequestEvent, Action, PothosConfig>) => {\n\tconst registrators: {\n\t\t[key in TableName<DB>]: ReturnType<typeof createRegistrator<key>>;\n\t} = {} as any;\n\n\tconst registeredQueryFilters: {\n\t\t[key in TableName<DB>]: {\n\t\t\t[key in Action]: QueryFilter<DB, key, any, UserContext>[] | \"unspecified\";\n\t\t};\n\t} = {} as any;\n\n\tconst registeredRuntimeFilters: {\n\t\t[key in TableName<DB>]: {\n\t\t\t//TODO add a run all helper\n\t\t\t[key in Action]: Filter<UserContext, any>[];\n\t\t};\n\t} = {} as any;\n\n\tconst createRegistrator = <TableNameT extends TableName<DB>>(\n\t\ttableName: TableNameT,\n\t) => {\n\t\t// we want to init all possible application level filters since we want to ensure\n\t\t// that the implementaiton helpers pass an object by reference when creating\n\t\t// the implementation, instead of a copy like it would be the case with undefined\n\t\tfor (const action of actions!) {\n\t\t\tif (!registeredRuntimeFilters[tableName]) {\n\t\t\t\tregisteredRuntimeFilters[tableName] = {} as any;\n\t\t\t}\n\t\t\tif (!registeredRuntimeFilters[tableName][action]) {\n\t\t\t\tregisteredRuntimeFilters[tableName][action] = [];\n\t\t\t}\n\t\t}\n\n\t\treturn {\n\t\t\t/**\n\t\t\t * Allows to perform a specific action on a specific entity\n\t\t\t */\n\t\t\tallow: (action: Action | Action[]) => {\n\t\t\t\tlet queryFiltersPerEntity = registeredQueryFilters[tableName];\n\t\t\t\tif (!queryFiltersPerEntity) {\n\t\t\t\t\tqueryFiltersPerEntity = {} as any;\n\t\t\t\t\tregisteredQueryFilters[tableName] = queryFiltersPerEntity;\n\t\t\t\t}\n\n\t\t\t\tconst actions = Array.isArray(action) ? action : [action];\n\t\t\t\tfor (const action of actions) {\n\t\t\t\t\tlet queryFiltersPerEntityAndAction = queryFiltersPerEntity[action];\n\t\t\t\t\tif (!queryFiltersPerEntityAndAction) {\n\t\t\t\t\t\tqueryFiltersPerEntityAndAction = \"unspecified\";\n\t\t\t\t\t\tqueryFiltersPerEntity[action] = queryFiltersPerEntityAndAction;\n\t\t\t\t\t}\n\t\t\t\t}\n\n\t\t\t\treturn {\n\t\t\t\t\t/**\n\t\t\t\t\t * Restricts the allowed actions to a filter\n\t\t\t\t\t * @example\n\t\t\t\t\t * ```ts\n\t\t\t\t\t * abilityBuilder.users.allow([\"read\", \"update\", \"delete\"]).when(({ userId }) => ({\n\t\t\t\t\t * where: {\n\t\t\t\t\t * id: userId,\n\t\t\t\t\t * },\n\t\t\t\t\t * }));\n\t\t\t\t\t * ```\n\t\t\t\t\t */\n\t\t\t\t\twhen: (\n\t\t\t\t\t\tqueryFilter: QueryFilter<\n\t\t\t\t\t\t\tDB,\n\t\t\t\t\t\t\tTableNameT,\n\t\t\t\t\t\t\tQueryFilterInput<DB, TableNameT>,\n\t\t\t\t\t\t\tUserContext\n\t\t\t\t\t\t>,\n\t\t\t\t\t) => {\n\t\t\t\t\t\tfor (const action of actions) {\n\t\t\t\t\t\t\tif (queryFiltersPerEntity[action] === \"unspecified\") {\n\t\t\t\t\t\t\t\tqueryFiltersPerEntity[action] = [];\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\tconst queryFiltersPerEntityAndAction =\n\t\t\t\t\t\t\t\tqueryFiltersPerEntity[action];\n\t\t\t\t\t\t\t(\n\t\t\t\t\t\t\t\tqueryFiltersPerEntityAndAction as Exclude<\n\t\t\t\t\t\t\t\t\ttypeof queryFiltersPerEntityAndAction,\n\t\t\t\t\t\t\t\t\t\"unspecified\"\n\t\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t).push(queryFilter);\n\t\t\t\t\t\t}\n\t\t\t\t\t},\n\t\t\t\t};\n\t\t\t},\n\t\t\t/**\n\t\t\t * Allows to register an application level filter to restrict some results\n\t\t\t * which were returned by a query\n\t\t\t */\n\t\t\tfilter: (action: Action | Action[]) => {\n\t\t\t\tconst actions = Array.isArray(action) ? action : [action];\n\t\t\t\treturn {\n\t\t\t\t\t/**\n\t\t\t\t\t * The actual filter function to apply. Returns the allowed values\n\t\t\t\t\t */\n\t\t\t\t\tby: (\n\t\t\t\t\t\texplicitFilter: Filter<\n\t\t\t\t\t\t\tUserContext,\n\t\t\t\t\t\t\tNonNullable<\n\t\t\t\t\t\t\t\tAwaited<ReturnType<DB[\"query\"][TableNameT][\"findFirst\"]>>\n\t\t\t\t\t\t\t>\n\t\t\t\t\t\t>,\n\t\t\t\t\t) => {\n\t\t\t\t\t\tfor (const action of actions) {\n\t\t\t\t\t\t\tregisteredRuntimeFilters[tableName][action].push(explicitFilter);\n\t\t\t\t\t\t}\n\t\t\t\t\t},\n\t\t\t\t};\n\t\t\t},\n\t\t};\n\t};\n\n\tfor (const entityKey of Object.keys(db.query) as TableName<DB>[]) {\n\t\tregistrators[entityKey] = createRegistrator(entityKey);\n\t}\n\n\treturn {\n\t\t...registrators,\n\t\t/**\n\t\t * @internal\n\t\t * @ignore\n\t\t */\n\t\tz_registeredQueryFilters: registeredQueryFilters,\n\t\t/**\n\t\t * @internal\n\t\t * @ignore\n\t\t */\n\t\tz_registeredFilters: registeredRuntimeFilters,\n\t\t/**\n\t\t * @internal\n\t\t * @ignore\n\t\t */\n\t\tz_buildWithUserContext: (userContext: UserContext) => {\n\t\t\tconst builder: {\n\t\t\t\t[key in TableName<DB>]: ReturnType<typeof createEntityObject<key>>;\n\t\t\t} = {} as any;\n\n\t\t\tconst createEntityObject = <TableNameT extends TableName<DB>>(\n\t\t\t\ttableName: TableNameT,\n\t\t\t) => {\n\t\t\t\treturn {\n\t\t\t\t\tfilter: <\n\t\t\t\t\t\tInjection extends SimpleQueryFilter<\n\t\t\t\t\t\t\tDB,\n\t\t\t\t\t\t\tTableNameT,\n\t\t\t\t\t\t\tQueryFilterInput<DB, TableNameT>\n\t\t\t\t\t\t>,\n\t\t\t\t\t>(\n\t\t\t\t\t\taction: Action,\n\t\t\t\t\t\toptions?: {\n\t\t\t\t\t\t\t/**\n\t\t\t\t\t\t\t * Additional query filters applied only for this call. Useful for injecting one time additional filters\n\t\t\t\t\t\t\t * for e.g. user args in a handler.\n\t\t\t\t\t\t\t */\n\t\t\t\t\t\t\tinject?: Injection;\n\t\t\t\t\t\t},\n\t\t\t\t\t) => {\n\t\t\t\t\t\t/**\n\t\t\t\t\t\t * Packs the filters into a response object that can be applied for queries by the user\n\t\t\t\t\t\t */\n\t\t\t\t\t\tconst transformToResponse = <\n\t\t\t\t\t\t\tF extends QueryFilterInput<DB, TableNameT>,\n\t\t\t\t\t\t>(\n\t\t\t\t\t\t\tqueryFilters?: F,\n\t\t\t\t\t\t) => {\n\t\t\t\t\t\t\tconst where = lazy(() => {\n\t\t\t\t\t\t\t\tif (!queryFilters?.where && !options?.inject?.where) {\n\t\t\t\t\t\t\t\t\treturn;\n\t\t\t\t\t\t\t\t}\n\n\t\t\t\t\t\t\t\tif (options?.inject?.where && queryFilters?.where) {\n\t\t\t\t\t\t\t\t\treturn {\n\t\t\t\t\t\t\t\t\t\tAND: [queryFilters?.where, options?.inject?.where],\n\t\t\t\t\t\t\t\t\t};\n\t\t\t\t\t\t\t\t}\n\n\t\t\t\t\t\t\t\tif (options?.inject?.where && !queryFilters?.where) {\n\t\t\t\t\t\t\t\t\treturn options?.inject?.where;\n\t\t\t\t\t\t\t\t}\n\n\t\t\t\t\t\t\t\tif (!options?.inject?.where && queryFilters?.where) {\n\t\t\t\t\t\t\t\t\treturn queryFilters?.where;\n\t\t\t\t\t\t\t\t}\n\n\t\t\t\t\t\t\t\tif (!options?.inject?.where && !queryFilters?.where) {\n\t\t\t\t\t\t\t\t\treturn undefined;\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t});\n\n\t\t\t\t\t\t\tconst transformedWhere = lazy(() => {\n\t\t\t\t\t\t\t\tconst w = where();\n\t\t\t\t\t\t\t\tif (!w) {\n\t\t\t\t\t\t\t\t\treturn;\n\t\t\t\t\t\t\t\t}\n\n\t\t\t\t\t\t\t\tconst table = tableHelper({\n\t\t\t\t\t\t\t\t\ttsName: tableName,\n\t\t\t\t\t\t\t\t\tdb,\n\t\t\t\t\t\t\t\t});\n\n\t\t\t\t\t\t\t\treturn relationsFilterToSQL(table.tableSchema, w);\n\t\t\t\t\t\t\t});\n\n\t\t\t\t\t\t\tconst limit = lazy(() => {\n\t\t\t\t\t\t\t\tlet limit =\n\t\t\t\t\t\t\t\t\tqueryFilters?.limit ?? (defaultLimit as undefined | number);\n\n\t\t\t\t\t\t\t\t// only apply limit if neither default limit or ability limit are set\n\t\t\t\t\t\t\t\t// or lower amount is set\n\t\t\t\t\t\t\t\tif (\n\t\t\t\t\t\t\t\t\toptions?.inject?.limit &&\n\t\t\t\t\t\t\t\t\t(!limit || limit > options.inject.limit)\n\t\t\t\t\t\t\t\t) {\n\t\t\t\t\t\t\t\t\tlimit = options.inject.limit;\n\t\t\t\t\t\t\t\t}\n\n\t\t\t\t\t\t\t\tif (\n\t\t\t\t\t\t\t\t\tqueryFilters?.limit &&\n\t\t\t\t\t\t\t\t\t(!limit || queryFilters.limit > limit)\n\t\t\t\t\t\t\t\t) {\n\t\t\t\t\t\t\t\t\tlimit = queryFilters.limit;\n\t\t\t\t\t\t\t\t}\n\n\t\t\t\t\t\t\t\t// ensure that null is converted to undefined\n\t\t\t\t\t\t\t\treturn limit ?? undefined;\n\t\t\t\t\t\t\t});\n\n\t\t\t\t\t\t\tconst columns = lazy(() => {\n\t\t\t\t\t\t\t\tif (!queryFilters?.columns && !options?.inject?.columns) {\n\t\t\t\t\t\t\t\t\treturn;\n\t\t\t\t\t\t\t\t}\n\n\t\t\t\t\t\t\t\treturn {\n\t\t\t\t\t\t\t\t\t...queryFilters?.columns,\n\t\t\t\t\t\t\t\t\t...options?.inject?.columns,\n\t\t\t\t\t\t\t\t} as undefined;\n\t\t\t\t\t\t\t\t// we need to type this as undefined because TS would\n\t\t\t\t\t\t\t\t// do some funky stuff with query resolve typing otherwise\n\t\t\t\t\t\t\t});\n\n\t\t\t\t\t\t\tconst r = {\n\t\t\t\t\t\t\t\t/**\n\t\t\t\t\t\t\t\t * Query filters for the drizzle query API.\n\t\t\t\t\t\t\t\t * @example\n\t\t\t\t\t\t\t\t * ```ts\n\t\t\t\t\t\t\t\t * author: t.relation(\"author\", {\n\t\t\t\t\t\t\t\t * query: (_args, ctx) => ctx.abilities.users.filter(\"read\").query.single,\n\t\t\t\t\t\t\t\t * }),\n\t\t\t\t\t\t\t\t * ´´´\n\t\t\t\t\t\t\t\t */\n\t\t\t\t\t\t\t\tquery: {\n\t\t\t\t\t\t\t\t\t/**\n\t\t\t\t\t\t\t\t\t * For find first calls\n\t\t\t\t\t\t\t\t\t */\n\t\t\t\t\t\t\t\t\tsingle: {\n\t\t\t\t\t\t\t\t\t\tget where() {\n\t\t\t\t\t\t\t\t\t\t\treturn where();\n\t\t\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t\t\tcolumns: columns(),\n\t\t\t\t\t\t\t\t\t} as Pick<\n\t\t\t\t\t\t\t\t\t\tNonNullable<\n\t\t\t\t\t\t\t\t\t\t\tNonNullable<\n\t\t\t\t\t\t\t\t\t\t\t\tParameters<DB[\"query\"][TableNameT][\"findFirst\"]>[0]\n\t\t\t\t\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t\t\t>,\n\t\t\t\t\t\t\t\t\t\t\"columns\" | \"where\"\n\t\t\t\t\t\t\t\t\t>,\n\t\t\t\t\t\t\t\t\t/**\n\t\t\t\t\t\t\t\t\t * For find many calls\n\t\t\t\t\t\t\t\t\t */\n\t\t\t\t\t\t\t\t\tmany: {\n\t\t\t\t\t\t\t\t\t\tget where() {\n\t\t\t\t\t\t\t\t\t\t\treturn where();\n\t\t\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t\t\tcolumns: columns(),\n\t\t\t\t\t\t\t\t\t\tget limit() {\n\t\t\t\t\t\t\t\t\t\t\treturn limit();\n\t\t\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t\t} as Pick<\n\t\t\t\t\t\t\t\t\t\tNonNullable<\n\t\t\t\t\t\t\t\t\t\t\tNonNullable<\n\t\t\t\t\t\t\t\t\t\t\t\tParameters<DB[\"query\"][TableNameT][\"findMany\"]>[0]\n\t\t\t\t\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t\t\t>,\n\t\t\t\t\t\t\t\t\t\t\"columns\" | \"where\" | \"limit\"\n\t\t\t\t\t\t\t\t\t>,\n\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t/**\n\t\t\t\t\t\t\t\t * Query filters for the drizzle SQL API as used in e.g. updates.\n\t\t\t\t\t\t\t\t * @example\n\t\t\t\t\t\t\t\t *\n\t\t\t\t\t\t\t\t * ```ts\n\t\t\t\t\t\t\t\t * await db\n\t\t\t\t\t\t\t\t *\t.update(schema.users)\n\t\t\t\t\t\t\t\t *\t.set({\n\t\t\t\t\t\t\t\t *\t name: args.newName,\n\t\t\t\t\t\t\t\t * \t})\n\t\t\t\t\t\t\t\t *\t.where(\n\t\t\t\t\t\t\t\t *\t and(\n\t\t\t\t\t\t\t\t *\t eq(schema.users.id, args.userId),\n\t\t\t\t\t\t\t\t *\t ctx.abilities.users.filter(\"update\").sql.where,\n\t\t\t\t\t\t\t\t *\t ),\n\t\t\t\t\t\t\t\t *\t);\n\t\t\t\t\t\t\t\t * ```\n\t\t\t\t\t\t\t\t *\n\t\t\t\t\t\t\t\t */\n\t\t\t\t\t\t\t\tsql: {\n\t\t\t\t\t\t\t\t\tget where() {\n\t\t\t\t\t\t\t\t\t\treturn transformedWhere();\n\t\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t\tcolumns: columns(),\n\t\t\t\t\t\t\t\t\tget limit() {\n\t\t\t\t\t\t\t\t\t\treturn limit();\n\t\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t};\n\n\t\t\t\t\t\t\t// columns can't be set to undefined, drizzle will interpret this\n\t\t\t\t\t\t\t// as: don't return any columns\n\t\t\t\t\t\t\t// therefore we need to delete it\n\t\t\t\t\t\t\tif (!columns()) {\n\t\t\t\t\t\t\t\tdelete r.sql.columns;\n\t\t\t\t\t\t\t\tdelete r.query.many.columns;\n\t\t\t\t\t\t\t\tdelete r.query.single.columns;\n\t\t\t\t\t\t\t}\n\n\t\t\t\t\t\t\treturn r;\n\t\t\t\t\t\t};\n\n\t\t\t\t\t\t/**\n\t\t\t\t\t\t * Creates a filter that will never return any result\n\t\t\t\t\t\t */\n\t\t\t\t\t\tconst getBlockEverythingFilter = () => {\n\t\t\t\t\t\t\tconst tableSchema = tableHelper({\n\t\t\t\t\t\t\t\tdb,\n\t\t\t\t\t\t\t\ttsName: tableName,\n\t\t\t\t\t\t\t});\n\n\t\t\t\t\t\t\tif (Object.keys(tableSchema.primaryColumns).length === 0) {\n\t\t\t\t\t\t\t\tthrow new RumbleError(\n\t\t\t\t\t\t\t\t\t`No primary key found for entity ${tableName.toString()}`,\n\t\t\t\t\t\t\t\t);\n\t\t\t\t\t\t\t}\n\n\t\t\t\t\t\t\tconst primaryKeyField = Object.values(\n\t\t\t\t\t\t\t\ttableSchema.primaryColumns,\n\t\t\t\t\t\t\t)[0];\n\t\t\t\t\t\t\t// we want a filter that excludes everything\n\t\t\t\t\t\t\tconst distinctValues = createDistinctValuesFromSQLType(\n\t\t\t\t\t\t\t\tprimaryKeyField.getSQLType() as any,\n\t\t\t\t\t\t\t);\n\n\t\t\t\t\t\t\t// when the user has no permission for anything, ensure returns nothing\n\t\t\t\t\t\t\treturn {\n\t\t\t\t\t\t\t\twhere: {\n\t\t\t\t\t\t\t\t\tAND: [\n\t\t\t\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t\t\t\t[primaryKeyField.name]: distinctValues.value1,\n\t\t\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t\t\t\t[primaryKeyField.name]: distinctValues.value2,\n\t\t\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t\t],\n\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t};\n\t\t\t\t\t\t};\n\n\t\t\t\t\t\tlet queryFiltersPerEntityAndAction =\n\t\t\t\t\t\t\tregisteredQueryFilters?.[tableName]?.[action];\n\n\t\t\t\t\t\t// in case we have a wildcard ability, skip the rest and only apply the injected\n\t\t\t\t\t\t// filters, if any\n\t\t\t\t\t\tif (queryFiltersPerEntityAndAction === \"unspecified\") {\n\t\t\t\t\t\t\treturn transformToResponse();\n\t\t\t\t\t\t}\n\n\t\t\t\t\t\t// if nothing has been allowed, block everything\n\t\t\t\t\t\tif (!queryFiltersPerEntityAndAction) {\n\t\t\t\t\t\t\tqueryFiltersPerEntityAndAction = [getBlockEverythingFilter()];\n\t\t\t\t\t\t}\n\n\t\t\t\t\t\t//TODO: we could maybe improve performance by not filtering at each creation\n\t\t\t\t\t\t// but instead while the user sets the abilities\n\t\t\t\t\t\tconst simpleQueryFilters: SimpleQueryFilter<\n\t\t\t\t\t\t\tDB,\n\t\t\t\t\t\t\tTableNameT,\n\t\t\t\t\t\t\tQueryFilterInput<DB, TableNameT>\n\t\t\t\t\t\t>[] = queryFiltersPerEntityAndAction.filter(isSimpleQueryFilter);\n\n\t\t\t\t\t\tconst functionQueryFilters: ReturnType<\n\t\t\t\t\t\t\tFunctionQueryFilter<\n\t\t\t\t\t\t\t\tDB,\n\t\t\t\t\t\t\t\tTableNameT,\n\t\t\t\t\t\t\t\tQueryFilterInput<DB, TableNameT>,\n\t\t\t\t\t\t\t\tUserContext\n\t\t\t\t\t\t\t>\n\t\t\t\t\t\t>[] = queryFiltersPerEntityAndAction\n\t\t\t\t\t\t\t.filter(isFunctionFilter)\n\t\t\t\t\t\t\t.map((queryFilter) => queryFilter(userContext));\n\n\t\t\t\t\t\t//TODO: we could save some work by not running all the filters at each request\n\t\t\t\t\t\t// whenever one already returned \"allowed\"\n\t\t\t\t\t\tconst someWildcardFound = functionQueryFilters.some(\n\t\t\t\t\t\t\t(c) => c === \"allow\",\n\t\t\t\t\t\t);\n\n\t\t\t\t\t\tlet allQueryFilters = [\n\t\t\t\t\t\t\t...simpleQueryFilters,\n\t\t\t\t\t\t\t...functionQueryFilters,\n\t\t\t\t\t\t]\n\t\t\t\t\t\t\t// we just ignore the ones who did return undefined, since that evaluates to \"allow nothing\"\n\t\t\t\t\t\t\t.filter((e) => e !== undefined)\n\t\t\t\t\t\t\t// we already checked if we have some wildcard, so we can ignore the wildcard entries from now on\n\t\t\t\t\t\t\t.filter((e) => e !== \"allow\");\n\n\t\t\t\t\t\t// if we don't have any permitted filters and don't have a wildcard, then block everything\n\t\t\t\t\t\tif (!someWildcardFound && allQueryFilters.length === 0) {\n\t\t\t\t\t\t\tallQueryFilters = [getBlockEverythingFilter()];\n\t\t\t\t\t\t}\n\n\t\t\t\t\t\tlet highestLimit: number | undefined;\n\t\t\t\t\t\tfor (const conditionObject of allQueryFilters) {\n\t\t\t\t\t\t\tif (conditionObject?.limit) {\n\t\t\t\t\t\t\t\tif (\n\t\t\t\t\t\t\t\t\thighestLimit === undefined ||\n\t\t\t\t\t\t\t\t\tconditionObject.limit > highestLimit\n\t\t\t\t\t\t\t\t) {\n\t\t\t\t\t\t\t\t\thighestLimit = conditionObject.limit;\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}\n\n\t\t\t\t\t\tlet combinedAllowedColumns: Record<string, any> | undefined;\n\t\t\t\t\t\tfor (const conditionObject of [\n\t\t\t\t\t\t\t...allQueryFilters,\n\t\t\t\t\t\t\toptions?.inject,\n\t\t\t\t\t\t]) {\n\t\t\t\t\t\t\tif (conditionObject?.columns) {\n\t\t\t\t\t\t\t\tif (combinedAllowedColumns === undefined) {\n\t\t\t\t\t\t\t\t\tcombinedAllowedColumns = conditionObject.columns;\n\t\t\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\t\t\tcombinedAllowedColumns = {\n\t\t\t\t\t\t\t\t\t\t...combinedAllowedColumns,\n\t\t\t\t\t\t\t\t\t\t...conditionObject.columns,\n\t\t\t\t\t\t\t\t\t};\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}\n\n\t\t\t\t\t\t// in case we have a wildcard, we don't want to apply any where conditions\n\t\t\t\t\t\tconst accumulatedWhereConditions = someWildcardFound\n\t\t\t\t\t\t\t? []\n\t\t\t\t\t\t\t: allQueryFilters.filter((o) => o?.where).map((o) => o.where);\n\n\t\t\t\t\t\tconst combinedWhere =\n\t\t\t\t\t\t\taccumulatedWhereConditions.length > 0\n\t\t\t\t\t\t\t\t? { OR: accumulatedWhereConditions }\n\t\t\t\t\t\t\t\t: undefined;\n\n\t\t\t\t\t\treturn transformToResponse({\n\t\t\t\t\t\t\twhere: combinedWhere,\n\t\t\t\t\t\t\tcolumns: combinedAllowedColumns,\n\t\t\t\t\t\t\tlimit: highestLimit,\n\t\t\t\t\t\t});\n\t\t\t\t\t},\n\t\t\t\t\truntimeFilters: (action: Action) => {\n\t\t\t\t\t\treturn registeredRuntimeFilters[tableName][action];\n\t\t\t\t\t},\n\t\t\t\t};\n\t\t\t};\n\n\t\t\tfor (const entityKey of Object.keys(db.query) as TableName<DB>[]) {\n\t\t\t\tbuilder[entityKey] = createEntityObject(entityKey);\n\t\t\t}\n\n\t\t\treturn builder;\n\t\t},\n\t};\n};\n","import type { SchemaBuilderType } from \"../schemaBuilder\";\nimport type { GenericDrizzleDbTypeConstraints } from \"../types/genericDrizzleDbType\";\nimport type {\n\tCustomRumblePothosConfig,\n\tRumbleInput,\n} from \"../types/rumbleInput\";\nimport { generateFromSchema } from \"./generate/generate\";\n\nexport const clientCreatorImplementer = <\n\tUserContext extends Record<string, any>,\n\tDB extends GenericDrizzleDbTypeConstraints,\n\tRequestEvent extends Record<string, any>,\n\tAction extends string,\n\tPothosConfig extends CustomRumblePothosConfig,\n\tSchemaBuilder extends SchemaBuilderType<\n\t\tUserContext,\n\t\tDB,\n\t\tRequestEvent,\n\t\tAction,\n\t\tPothosConfig\n\t>,\n>({\n\tbuiltSchema,\n}: RumbleInput<UserContext, DB, RequestEvent, Action, PothosConfig> & {\n\tbuiltSchema: () => ReturnType<SchemaBuilder[\"toSchema\"]>;\n}) => {\n\tif (process.env.NODE_ENV !== \"development\") {\n\t\tconsole.warn(\n\t\t\t\"Running rumble client generation in non development mode. Are you sure this is correct?\",\n\t\t);\n\t}\n\n\tconst clientCreator = async ({\n\t\tapiUrl,\n\t\toutputPath,\n\t\trumbleImportPath,\n\t\tuseExternalUrqlClient,\n\t}: {\n\t\t/**\n\t\t * Path to the output directory where the client files will be generated.\n\t\t */\n\t\toutputPath: string;\n\t\t/**\n\t\t * The base URL of the Rumble API.\n\t\t */\n\t\tapiUrl?: string;\n\t\t/**\n\t\t * The import path for the rumble library, defaults to \"@m1212e/rumble\".\n\t\t */\n\t\trumbleImportPath?: string;\n\t\t/**\n\t\t * Set this to use an external urql client exported from a module.\n\t\t * If a string, uses the provided path to the urql client for importing the client.\n\t\t * If false, creates a new urql client with the provided apiUrl.\n\t\t */\n\t\tuseExternalUrqlClient?: string;\n\t}) => {\n\t\tconst schema = builtSchema();\n\t\tawait generateFromSchema({\n\t\t\tschema,\n\t\t\toutputPath,\n\t\t\trumbleImportPath,\n\t\t\tapiUrl,\n\t\t\tuseExternalUrqlClient,\n\t\t});\n\t};\n\n\treturn clientCreator;\n};\n","import type {\n\tAbilityBuilderType,\n\tcreateAbilityBuilder,\n} from \"./abilityBuilder\";\nimport type { GenericDrizzleDbTypeConstraints } from \"./types/genericDrizzleDbType\";\nimport type {\n\tCustomRumblePothosConfig,\n\tRumbleInput,\n} from \"./types/rumbleInput\";\n\nexport type ContextFunctionType<\n\tUserContext extends Record<string, any>,\n\tDB extends GenericDrizzleDbTypeConstraints,\n\tRequestEvent extends Record<string, any>,\n\tAction extends string,\n\tPothosConfig extends CustomRumblePothosConfig,\n> = ReturnType<\n\ttypeof createContextFunction<\n\t\tUserContext,\n\t\tDB,\n\t\tRequestEvent,\n\t\tAction,\n\t\tPothosConfig,\n\t\tAbilityBuilderType<UserContext, DB, RequestEvent, Action, PothosConfig>\n\t>\n>;\n\nexport type ContextType<\n\tUserContext extends Record<string, any>,\n\tDB extends GenericDrizzleDbTypeConstraints,\n\tRequestEvent extends Record<string, any>,\n\tAction extends string,\n\tPothosConfig extends CustomRumblePothosConfig,\n> = Awaited<\n\tReturnType<\n\t\tContextFunctionType<UserContext, DB, RequestEvent, Action, PothosConfig>\n\t>\n>;\n\nexport const createContextFunction = <\n\tUserContext extends Record<string, any>,\n\tDB extends GenericDrizzleDbTypeConstraints,\n\tRequestEvent extends Record<string, any>,\n\tAction extends string,\n\tPothosConfig extends CustomRumblePothosConfig,\n\tAbilityBuilder extends ReturnType<\n\t\ttypeof createAbilityBuilder<\n\t\t\tUserContext,\n\t\t\tDB,\n\t\t\tRequestEvent,\n\t\t\tAction,\n\t\t\tPothosConfig\n\t\t>\n\t>,\n>({\n\tcontext: makeUserContext,\n\tabilityBuilder,\n}: RumbleInput<UserContext, DB, RequestEvent, Action, PothosConfig> & {\n\tabilityBuilder: AbilityBuilder;\n}) => {\n\treturn async (req: RequestEvent) => {\n\t\tconst userContext = makeUserContext\n\t\t\t? await makeUserContext(req)\n\t\t\t: ({} as UserContext);\n\t\treturn {\n\t\t\t...userContext,\n\t\t\tabilities: abilityBuilder.z_buildWithUserContext(userContext),\n\t\t};\n\t};\n};\n","import { toCamelCase } from \"drizzle-orm/casing\";\nimport { type PgEnum, PgEnumColumn } from \"drizzle-orm/pg-core\";\nimport { capitalize } from \"es-toolkit\";\nimport type { SchemaBuilderType } from \"./schemaBuilder\";\nimport type { GenericDrizzleDbTypeConstraints } from \"./types/genericDrizzleDbType\";\nimport { RumbleError } from \"./types/rumbleError\";\nimport type {\n\tCustomRumblePothosConfig,\n\tRumbleInput,\n} from \"./types/rumbleInput\";\n\n/**\n * Checks if a schema type is an enum\n */\nexport function isEnumSchema(schemaType: any): schemaType is PgEnum<any> {\n\t// TODO make this compatible with other db drivers\n\treturn schemaType instanceof PgEnumColumn;\n}\n\n// TODO make this compatible with other db drivers\ntype EnumTypes = PgEnum<any>;\n\ntype EnumFields<T> = {\n\t[K in keyof T as T[K] extends EnumTypes ? K : never]: T[K];\n};\n\nexport type NonEnumFields<T> = {\n\t[K in keyof T as T[K] extends EnumTypes ? never : K]: T[K];\n};\n\nexport type EnumImplementerType<\n\tUserContext extends Record<string, any>,\n\tDB extends GenericDrizzleDbTypeConstraints,\n\tRequestEvent extends Record<string, any>,\n\tAction extends string,\n\tPothosConfig extends CustomRumblePothosConfig,\n> = ReturnType<\n\ttypeof createEnumImplementer<\n\t\tUserContext,\n\t\tDB,\n\t\tRequestEvent,\n\t\tAction,\n\t\tPothosConfig,\n\t\tSchemaBuilderType<UserContext, DB, RequestEvent, Action, PothosConfig>\n\t>\n>;\n\nexport const createEnumImplementer = <\n\tUserContext extends Record<string, any>,\n\tDB extends GenericDrizzleDbTypeConstraints,\n\tRequestEvent extends Record<string, any>,\n\tAction extends string,\n\tPothosConfig extends CustomRumblePothosConfig,\n\tSchemaBuilder extends SchemaBuilderType<\n\t\tUserContext,\n\t\tDB,\n\t\tRequestEvent,\n\t\tAction,\n\t\tPothosConfig\n\t>,\n>({\n\tdb,\n\tschemaBuilder,\n}: RumbleInput<UserContext, DB, RequestEvent, Action, PothosConfig> & {\n\tschemaBuilder: SchemaBuilder;\n}) => {\n\tconst referenceStorage = new Map<string, any>();\n\n\tconst enumImplementer = <\n\t\tExplicitEnumVariableName extends keyof EnumFields<\n\t\t\tNonNullable<DB[\"_\"][\"relations\"][\"schema\"]>\n\t\t>,\n\t\tEnumColumn extends EnumTypes,\n\t\tRefName extends string,\n\t>({\n\t\ttsName,\n\t\tenumColumn,\n\t\trefName,\n\t}: Partial<{\n\t\ttsName: ExplicitEnumVariableName;\n\t\tenumColumn: EnumColumn;\n\t\trefName?: RefName | undefined;\n\t}> &\n\t\t(\n\t\t\t| {\n\t\t\t\t\ttsName: ExplicitEnumVariableName;\n\t\t\t }\n\t\t\t| {\n\t\t\t\t\tenumColumn: EnumColumn;\n\t\t\t }\n\t\t)) => {\n\t\t//TODO check if this can be done typesafe\n\n\t\tlet enumSchemaName: string | undefined;\n\t\tlet enumValues: any[] | undefined;\n\n\t\tif (tsName) {\n\t\t\tconst schemaEnum = db._.relations.schema[tsName as string];\n\n\t\t\tenumSchemaName = tsName.toString();\n\n\t\t\tconst enumCol = Object.values(db._.relations.schema)\n\t\t\t\t.filter((s) => typeof s === \"object\")\n\t\t\t\t.map((s) => Object.values(s[Symbol.for(\"drizzle:Columns\")]))\n\t\t\t\t.flat(2)\n\t\t\t\t.find((s: any) => s.config?.enum === schemaEnum);\n\n\t\t\tif (!enumCol) {\n\t\t\t\tthrow new RumbleError(`Could not find applied enum column for ${tsName.toString()}.\nPlease ensure that you use the enum at least once as a column of a table!`);\n\t\t\t}\n\n\t\t\tenumValues = (enumCol as any).enumValues;\n\t\t} else if (enumColumn) {\n\t\t\tconst schemaEnumEntry = Object.entries(db._.relations.schema).find(\n\t\t\t\t([, value]) => value === (enumColumn as any).config.enum,\n\t\t\t);\n\n\t\t\tif (!schemaEnumEntry) {\n\t\t\t\tthrow new RumbleError(\n\t\t\t\t\t`Could not find enum in schema for ${enumColumn.name}!`,\n\t\t\t\t);\n\t\t\t}\n\n\t\t\tenumSchemaName = schemaEnumEntry[0];\n\t\t\tenumValues = enumColumn.enumValues;\n\t\t}\n\n\t\tif (!enumSchemaName || !enumValues) {\n\t\t\tthrow new RumbleError(\"Could not determine enum structure!\");\n\t\t}\n\n\t\tconst graphqlImplementationName =\n\t\t\trefName ?? `${capitalize(toCamelCase(enumSchemaName))}Enum`;\n\n\t\tlet ret: ReturnType<typeof implement> | undefined = referenceStorage.get(\n\t\t\tgraphqlImplementationName,\n\t\t);\n\t\tif (ret) {\n\t\t\treturn ret;\n\t\t}\n\n\t\tconst implement = () =>\n\t\t\tschemaBuilder.enumType(graphqlImplementationName, {\n\t\t\t\tvalues: enumValues,\n\t\t\t});\n\n\t\tret = implement();\n\t\treferenceStorage.set(graphqlImplementationName, ret);\n\t\treturn ret;\n\t};\n\n\treturn enumImplementer;\n};\n","import type { useSofa } from \"sofa-api\";\n\nexport const sofaOpenAPIWebhookDocs: NonNullable<\n\tParameters<typeof useSofa>[0][\"openAPI\"]\n> = {\n\tpaths: {\n\t\t\"/webhook\": {\n\t\t\tpost: {\n\t\t\t\toperationId: \"webhook_create\",\n\t\t\t\tdescription: \"Creates a webhook subscription.\",\n\t\t\t\ttags: [],\n\t\t\t\tparameters: [],\n\t\t\t\trequestBody: {\n\t\t\t\t\tcontent: {\n\t\t\t\t\t\t\"application/json\": {\n\t\t\t\t\t\t\tschema: {\n\t\t\t\t\t\t\t\t$ref: \"#/components/schemas/WebhookCreateBody\",\n\t\t\t\t\t\t\t},\n\t\t\t\t\t\t},\n\t\t\t\t\t},\n\t\t\t\t},\n\t\t\t\tresponses: {\n\t\t\t\t\t\"200\": {\n\t\t\t\t\t\tdescription: \"\",\n\t\t\t\t\t\tcontent: {\n\t\t\t\t\t\t\t\"application/json\": {\n\t\t\t\t\t\t\t\tschema: {\n\t\t\t\t\t\t\t\t\t$ref: \"#/components/schemas/WebhookDetailResponse\",\n\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t},\n\t\t\t\t\t\t},\n\t\t\t\t\t},\n\t\t\t\t},\n\t\t\t},\n\t\t},\n\t\t\"/webhook/{id}\": {\n\t\t\tpost: {\n\t\t\t\toperationId: \"webhook_update\",\n\t\t\t\tdescription: \"Updates a webhook subscription.\",\n\t\t\t\tparameters: [\n\t\t\t\t\t{\n\t\t\t\t\t\tname: \"id\",\n\t\t\t\t\t\tin: \"path\",\n\t\t\t\t\t\tdescription: \"The ID of the webhook to update\",\n\t\t\t\t\t\trequired: true,\n\t\t\t\t\t\tschema: {\n\t\t\t\t\t\t\ttype: \"string\",\n\t\t\t\t\t\t},\n\t\t\t\t\t} as any,\n\t\t\t\t],\n\t\t\t\trequestBody: {\n\t\t\t\t\tcontent: {\n\t\t\t\t\t\t\"application/json\": {\n\t\t\t\t\t\t\tschema: {\n\t\t\t\t\t\t\t\t$ref: \"#/components/schemas/WebhookCreateBody\",\n\t\t\t\t\t\t\t},\n\t\t\t\t\t\t},\n\t\t\t\t\t},\n\t\t\t\t},\n\t\t\t\tresponses: {\n\t\t\t\t\t\"200\": {\n\t\t\t\t\t\tdescription: \"\",\n\t\t\t\t\t\tcontent: {\n\t\t\t\t\t\t\t\"application/json\": {\n\t\t\t\t\t\t\t\tschema: {\n\t\t\t\t\t\t\t\t\t$ref: \"#/components/schemas/WebhookDetailResponse\",\n\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t},\n\t\t\t\t\t\t},\n\t\t\t\t\t},\n\t\t\t\t},\n\t\t\t},\n\t\t\tdelete: {\n\t\t\t\toperationId: \"webhook_delete\",\n\t\t\t\tdescription: \"Removes a webhook subscription.\",\n\t\t\t\ttags: [],\n\t\t\t\tparameters: [\n\t\t\t\t\t{\n\t\t\t\t\t\tname: \"id\",\n\t\t\t\t\t\tin: \"path\",\n\t\t\t\t\t\tdescription: \"The ID of the webhook to delete\",\n\t\t\t\t\t\trequired: true,\n\t\t\t\t\t\tschema: {\n\t\t\t\t\t\t\ttype: \"string\",\n\t\t\t\t\t\t},\n\t\t\t\t\t} as any,\n\t\t\t\t],\n\t\t\t\tresponses: {\n\t\t\t\t\t\"200\": {\n\t\t\t\t\t\tdescription: \"\",\n\t\t\t\t\t\tcontent: {\n\t\t\t\t\t\t\t\"application/json\": {\n\t\t\t\t\t\t\t\tschema: {\n\t\t\t\t\t\t\t\t\t$ref: \"#/components/schemas/WebhookDetailResponse\",\n\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t},\n\t\t\t\t\t\t},\n\t\t\t\t\t},\n\t\t\t\t},\n\t\t\t},\n\t\t},\n\t},\n\tcomponents: {\n\t\tschemas: {\n\t\t\tWebhookCreateBody: {\n\t\t\t\ttype: \"object\",\n\t\t\t\tproperties: {\n\t\t\t\t\tsubscription: {\n\t\t\t\t\t\tdescription:\n\t\t\t\t\t\t\t\"The subscription to subscribe to. In many cases, these match the available query IDs without the '_query' suffix. E.g., 'findFirstUser_query' -> 'findFirstUser'. See the graphql schema for more details on what subscriptions are available.\",\n\t\t\t\t\t\ttype: \"string\",\n\t\t\t\t\t},\n\t\t\t\t\tvariables: {\n\t\t\t\t\t\tdescription: \"The variables to pass to the subscription.\",\n\t\t\t\t\t\ttype: \"object\",\n\t\t\t\t\t},\n\t\t\t\t\turl: {\n\t\t\t\t\t\tdescription: \"The URL to send the webhook to.\",\n\t\t\t\t\t\ttype: \"string\",\n\t\t\t\t\t},\n\t\t\t\t},\n\t\t\t},\n\t\t\tWebhookDetailResponse: {\n\t\t\t\ttype: \"object\",\n\t\t\t\tproperties: {\n\t\t\t\t\tid: {\n\t\t\t\t\t\tdescription:\n\t\t\t\t\t\t\t\"The ID of the webhook. Can be used as reference in update or delete calls.\",\n\t\t\t\t\t\ttype: \"string\",\n\t\t\t\t\t},\n\t\t\t\t},\n\t\t\t},\n\t\t\tDateTime: {\n\t\t\t\ttype: \"string\",\n\t\t\t\tformat: \"date-time\",\n\t\t\t},\n\t\t\tDate: {\n\t\t\t\ttype: \"string\",\n\t\t\t\tformat: \"date\",\n\t\t\t},\n\t\t},\n\t},\n};\n","import type { SchemaBuilderType } from \"../../schemaBuilder\";\nimport type { GenericDrizzleDbTypeConstraints } from \"../../types/genericDrizzleDbType\";\nimport type { CustomRumblePothosConfig } from \"../../types/rumbleInput\";\nimport { type PossibleSQLType, UnknownTypeRumbleError } from \"./types\";\n\nexport function mapSQLTypeToGraphQLType<\n\tUserContext extends Record<string, any>,\n\tDB extends GenericDrizzleDbTypeConstraints,\n\tRequestEvent extends Record<string, any>,\n\tAction extends string,\n\tPothosConfig extends CustomRumblePothosConfig,\n\tSchemaBuilder extends SchemaBuilderType<\n\t\tUserContext,\n\t\tDB,\n\t\tRequestEvent,\n\t\tAction,\n\t\tPothosConfig\n\t>,\n>({ sqlType, fieldName }: { sqlType: PossibleSQLType; fieldName?: string }) {\n\ttype ReturnType = Parameters<\n\t\tParameters<Parameters<SchemaBuilder[\"queryField\"]>[1]>[0][\"field\"]\n\t>[0][\"type\"];\n\n\tlet ret: ReturnType | undefined;\n\n\tif (\n\t\t[\"serial\", \"int\", \"integer\", \"tinyint\", \"smallint\", \"mediumint\"].includes(\n\t\t\tsqlType,\n\t\t)\n\t) {\n\t\tret = \"Int\";\n\t}\n\n\tif ([\"real\", \"decimal\", \"double\", \"float\"].includes(sqlType)) {\n\t\tret = \"Float\";\n\t}\n\n\tif ([\"string\", \"text\", \"varchar\", \"char\", \"text(256)\"].includes(sqlType)) {\n\t\tif (\n\t\t\tfieldName &&\n\t\t\t(fieldName.toLowerCase().endsWith(\"_id\") ||\n\t\t\t\tfieldName.toLowerCase().endsWith(\"id\"))\n\t\t) {\n\t\t\tret = \"ID\";\n\t\t} else {\n\t\t\tret = \"String\";\n\t\t}\n\t}\n\n\tif ([\"uuid\"].includes(sqlType)) {\n\t\tret = \"ID\";\n\t}\n\n\tif ([\"boolean\"].includes(sqlType)) {\n\t\tret = \"Boolean\";\n\t}\n\n\tif ([\"timestamp\", \"datetime\"].includes(sqlType)) {\n\t\tret = \"DateTime\";\n\t}\n\n\tif ([\"date\"].includes(sqlType)) {\n\t\tret = \"Date\";\n\t}\n\n\tif ([\"json\"].includes(sqlType)) {\n\t\tret = \"JSON\";\n\t}\n\n\tif (ret !== undefined) {\n\t\treturn ret;\n\t}\n\n\tthrow UnknownTypeRumbleError(sqlType, \"SQL to GQL\");\n}\n","import type { MySqlDatabase } from \"drizzle-orm/mysql-core\";\nimport { MySqlTable } from \"drizzle-orm/mysql-core\";\nimport type { PgDatabase } from \"drizzle-orm/pg-core\";\nimport { PgTable } from \"drizzle-orm/pg-core\";\nimport type { BaseSQLiteDatabase } from \"drizzle-orm/sqlite-core\";\nimport { SQLiteTable } from \"drizzle-orm/sqlite-core\";\nimport type { GenericDrizzleDbTypeConstraints } from \"../types/genericDrizzleDbType\";\n\nexport type DBDialect = \"mysql\" | \"postgres\" | \"sqlite\";\n\nexport function determineDBDialectFromSchema<\n\tDB extends GenericDrizzleDbTypeConstraints,\n>(schema: DB[\"_\"][\"relations\"][\"schema\"]) {\n\tconst found = new Set<DBDialect>();\n\n\tfor (const table of Object.values(schema)) {\n\t\tif (typeof table !== \"object\") {\n\t\t\tcontinue;\n\t\t}\n\n\t\tif (table instanceof PgTable) {\n\t\t\tfound.add(\"postgres\");\n\t\t} else if (table instanceof MySqlTable) {\n\t\t\tfound.add(\"mysql\");\n\t\t} else if (table instanceof SQLiteTable) {\n\t\t\tfound.add(\"sqlite\");\n\t\t}\n\t}\n\n\tconst dialects = Array.from(found);\n\n\tif (dialects.length === 1) {\n\t\treturn dialects[0];\n\t}\n\n\tif (dialects.length === 0) {\n\t\tthrow new Error(\"No tables found in schema, could not determine dialect\");\n\t}\n\n\tthrow new Error(`Multiple dialects found in schema: ${dialects.join(\", \")}`);\n}\n\nexport function isPostgresDB<\n\tNarrowed extends PgDatabase<any, any> = PgDatabase<any, any>,\n>(db: GenericDrizzleDbTypeConstraints): db is Narrowed {\n\tconst dialect = determineDBDialectFromSchema(db._.relations.schema);\n\n\treturn dialect === \"postgres\";\n}\n\nexport function isMySQLDB<\n\tNarrowed extends MySqlDatabase<any, any> = MySqlDatabase<any, any>,\n>(db: GenericDrizzleDbTypeConstraints): db is Narrowed {\n\tconst dialect = determineDBDialectFromSchema(db._.relations.schema);\n\n\treturn dialect === \"mysql\";\n}\n\nexport function isSQLiteDB<\n\tNarrowed extends BaseSQLiteDatabase<any, any> = BaseSQLiteDatabase<any, any>,\n>(db: GenericDrizzleDbTypeConstraints): db is Narrowed {\n\tconst dialect = determineDBDialectFromSchema(db._.relations.schema);\n\n\treturn dialect === \"sqlite\";\n}\n","import { sql } from \"drizzle-orm\";\nimport { cloneDeep } from \"es-toolkit\";\nimport { isPostgresDB } from \"./helpers/determineDialectFromSchema\";\nimport type { tableHelper } from \"./helpers/tableHelpers\";\nimport type { GenericDrizzleDbTypeConstraints } from \"./types/genericDrizzleDbType\";\nimport type { RumbleInput } from \"./types/rumbleInput\";\n\nexport async function initSearchIfApplicable<\n\tDB extends GenericDrizzleDbTypeConstraints,\n>(db: DB) {\n\t//TODO: make other dialects compatible\n\tif (!isPostgresDB(db)) {\n\t\tconsole.info(\n\t\t\t\"Database dialect is not compatible with search, skipping search initialization.\",\n\t\t);\n\t\treturn;\n\t}\n\n\tawait db.execute(sql`CREATE EXTENSION IF NOT EXISTS pg_trgm;`);\n}\n\nexport function adjustQueryForSearch({\n\tsearch,\n\targs,\n\ttableSchema,\n\tabilities,\n}: Pick<RumbleInput<any, any, any, any, any>, \"search\"> & {\n\t//TODO types\n\targs: any;\n\ttableSchema: ReturnType<typeof tableHelper>;\n\t//TODO types\n\tabilities: any;\n}) {\n\tif (search?.enabled && args.search && args.search.length > 0) {\n\t\tconst originalOrderBy = cloneDeep(args.orderBy);\n\t\t(args as any).orderBy = (table: any) => {\n\t\t\tconst argsOrderBySQL = sql.join(\n\t\t\t\tObject.entries(originalOrderBy ?? {}).map(([key, value]) => {\n\t\t\t\t\t// value is \"asc\" or \"desc\"\n\t\t\t\t\tif (value === \"asc\") {\n\t\t\t\t\t\treturn sql`${table[key]} ASC`;\n\t\t\t\t\t} else if (value === \"desc\") {\n\t\t\t\t\t\treturn sql`${table[key]} DESC`;\n\t\t\t\t\t} else {\n\t\t\t\t\t\tthrow new Error(`Invalid value ${value} for orderBy`);\n\t\t\t\t\t}\n\t\t\t\t}),\n\t\t\t\tsql.raw(\", \"),\n\t\t\t);\n\n\t\t\t// this prevents columns beeing searched which are not accessible to the user\n\t\t\t// if the abilities defined the user not to be allowed to read something, we need\n\t\t\t// to prevent it from beeing included in the search since this could\n\t\t\t// leak information\n\t\t\tconst columnsToSearch = abilities.query.many.columns\n\t\t\t\t? Object.entries(tableSchema.columns).filter(\n\t\t\t\t\t\t([key]) => abilities.query.many.columns[key],\n\t\t\t\t\t)\n\t\t\t\t: Object.entries(tableSchema.columns);\n\n\t\t\t// GREATEST(similarity(name, ${query.search}), similarity(description, ${query.search})) DESC\n\t\t\tconst searchSQL = sql`GREATEST(${sql.join(\n\t\t\t\tcolumnsToSearch.map(([key]) => {\n\t\t\t\t\treturn sql`similarity(${table[key]}::TEXT, ${args.search})`;\n\t\t\t\t}),\n\t\t\t\tsql.raw(\", \"),\n\t\t\t)}) DESC`;\n\n\t\t\tconst ret = originalOrderBy\n\t\t\t\t? sql.join([argsOrderBySQL, searchSQL], sql.raw(\", \"))\n\t\t\t\t: searchSQL;\n\n\t\t\t// const pgDialect = new PgDialect();\n\t\t\t// console.log(pgDialect.sqlToQuery(ret));\n\n\t\t\treturn ret;\n\t\t};\n\n\t\tconst originalWhere = cloneDeep(args.where);\n\n\t\t// this limits the search to the rows which at least match the threshold score\n\t\t(args as any).where = {\n\t\t\tAND: [\n\t\t\t\toriginalWhere ?? {},\n\t\t\t\t{\n\t\t\t\t\tRAW: (table: any) => {\n\t\t\t\t\t\treturn sql`GREATEST(${sql.join(\n\t\t\t\t\t\t\tObject.entries(tableSchema.columns).map(([key]) => {\n\t\t\t\t\t\t\t\treturn sql`similarity(${table[key]}::TEXT, ${args.search})`;\n\t\t\t\t\t\t\t}),\n\t\t\t\t\t\t\tsql.raw(\", \"),\n\t\t\t\t\t\t)}) > ${search.threshold ?? 0.1}`;\n\t\t\t\t\t},\n\t\t\t\t},\n\t\t\t],\n\t\t};\n\t}\n}\n","import type { FieldMap } from \"@pothos/core\";\nimport type { DrizzleObjectFieldBuilder } from \"@pothos/plugin-drizzle\";\nimport { One, type Table } from \"drizzle-orm\";\nimport { capitalize } from \"es-toolkit\";\nimport { plural, singular } from \"pluralize\";\nimport type { AbilityBuilderType } from \"./abilityBuilder\";\nimport { type EnumImplementerType, isEnumSchema } from \"./enum\";\nimport { mapSQLTypeToGraphQLType } from \"./helpers/sqlTypes/mapSQLTypeToTSType\";\nimport type { PossibleSQLType } from \"./helpers/sqlTypes/types\";\nimport {\n\ttype TableIdentifierTSName,\n\ttableHelper,\n} from \"./helpers/tableHelpers\";\nimport type { OrderArgImplementerType } from \"./orderArg\";\nimport type { MakePubSubInstanceType } from \"./pubsub\";\nimport type { SchemaBuilderType } from \"./schemaBuilder\";\nimport { adjustQueryForSearch } from \"./search\";\nimport type { GenericDrizzleDbTypeConstraints } from \"./types/genericDrizzleDbType\";\nimport { RumbleError } from \"./types/rumbleError\";\nimport type {\n\tCustomRumblePothosConfig,\n\tRumbleInput,\n} from \"./types/rumbleInput\";\nimport type { WhereArgImplementerType } from \"./whereArg\";\n\n//TODO this is a bit flaky, we should check if we can determine the config object more reliably\n//TODO maybe a plugin can place some marker field on these objects?\nconst isProbablyAConfigObject = (t: any) => {\n\tif (typeof t !== \"object\") {\n\t\treturn false;\n\t}\n\n\tif (\n\t\tObject.keys(t).some((k) =>\n\t\t\t[\n\t\t\t\t\"args\",\n\t\t\t\t\"nullable\",\n\t\t\t\t\"query\",\n\t\t\t\t\"subscribe\",\n\t\t\t\t\"description\",\n\t\t\t\t\"type\",\n\t\t\t\t\"resolve\",\n\t\t\t].find((e) => e === k),\n\t\t)\n\t)\n\t\treturn true;\n\treturn false;\n};\n\nexport const createObjectImplementer = <\n\tUserContext extends Record<string, any>,\n\tDB extends GenericDrizzleDbTypeConstraints,\n\tRequestEvent extends Record<string, any>,\n\tAction extends string,\n\tPothosConfig extends CustomRumblePothosConfig,\n\tSchemaBuilder extends SchemaBuilderType<\n\t\tUserContext,\n\t\tDB,\n\t\tRequestEvent,\n\t\tAction,\n\t\tPothosConfig\n\t>,\n\tWhereArgImplementer extends WhereArgImplementerType<\n\t\tUserContext,\n\t\tDB,\n\t\tRequestEvent,\n\t\tAction,\n\t\tPothosConfig\n\t>,\n\tOrderArgImplementer extends OrderArgImplementerType<\n\t\tUserContext,\n\t\tDB,\n\t\tRequestEvent,\n\t\tAction,\n\t\tPothosConfig\n\t>,\n\tEnumImplementer extends EnumImplementerType<\n\t\tUserContext,\n\t\tDB,\n\t\tRequestEvent,\n\t\tAction,\n\t\tPothosConfig\n\t>,\n\tMakePubSubInstance extends MakePubSubInstanceType<\n\t\tUserContext,\n\t\tDB,\n\t\tRequestEvent,\n\t\tAction,\n\t\tPothosConfig\n\t>,\n\tAbilityBuilderInstance extends AbilityBuilderType<\n\t\tUserContext,\n\t\tDB,\n\t\tRequestEvent,\n\t\tAction,\n\t\tPothosConfig\n\t>,\n>({\n\tdb,\n\tsearch,\n\tschemaBuilder,\n\tmakePubSubInstance,\n\twhereArgImplementer,\n\torderArgImplementer,\n\tenumImplementer,\n\tabilityBuilder,\n}: RumbleInput<UserContext, DB, RequestEvent, Action, PothosConfig> & {\n\tschemaBuilder: SchemaBuilder;\n\twhereArgImplementer: WhereArgImplementer;\n\torderArgImplementer: OrderArgImplementer;\n\tenumImplementer: EnumImplementer;\n\tmakePubSubInstance: MakePubSubInstance;\n\tabilityBuilder: AbilityBuilderInstance;\n}) => {\n\treturn <\n\t\tExplicitTableName extends TableIdentifierTSName<DB>,\n\t\tRefName extends string,\n\t>({\n\t\ttable,\n\t\trefName,\n\t\treadAction = \"read\" as Action,\n\t\tadjust,\n\t}: {\n\t\t/**\n\t\t * The table you want to be used as reference for the object creation.\n\t\t */\n\t\ttable: ExplicitTableName;\n\t\t/**\n\t\t * The name you want this object to have in your graphql schema.\n\t\t * Rumble will create a reasonable default if not specified.\n\t\t */\n\t\trefName?: RefName;\n\t\t/**\n\t\t * The action used for read access to the table.\n\t\t * Defaults to \"read\".\n\t\t */\n\t\treadAction?: Action;\n\t\t/**\n\t\t * A function which can be used to adjust the fields of the object.\n\t\t * You can extend the object by specifying fields that do not exist as\n\t\t * per your db schema, or overwrite existing fields with the same name.\n\t\t * In case you do overwrite, rumble will set proper nullability and\n\t\t * subscription properties if you do not specify them explicitly.\n\t\t */\n\t\tadjust?:\n\t\t\t| ((\n\t\t\t\t\tt: DrizzleObjectFieldBuilder<\n\t\t\t\t\t\tSchemaBuilder[\"$inferSchemaTypes\"],\n\t\t\t\t\t\tSchemaBuilder[\"$inferSchemaTypes\"][\"DrizzleRelationsConfig\"][ExplicitTableName],\n\t\t\t\t\t\tNonNullable<\n\t\t\t\t\t\t\tAwaited<ReturnType<DB[\"query\"][ExplicitTableName][\"findFirst\"]>>\n\t\t\t\t\t\t>\n\t\t\t\t\t>,\n\t\t\t ) => FieldMap)\n\t\t\t| undefined;\n\t}) => {\n\t\tconst tableSchema = tableHelper({ db, tsName: table });\n\t\tif (Object.keys(tableSchema.primaryColumns).length === 0) {\n\t\t\tconsole.warn(\n\t\t\t\t`Could not find primary key for ${table.toString()}. Cannot register subscriptions!`,\n\t\t\t);\n\t\t}\n\t\tconst primaryKey = Object.values(tableSchema.primaryColumns)[0];\n\n\t\tconst { registerOnInstance } = makePubSubInstance({ table: table });\n\n\t\treturn schemaBuilder.drizzleObject(table, {\n\t\t\tname: refName ?? capitalize(table.toString()),\n\t\t\tsubscribe: (subscriptions, element, _context) => {\n\t\t\t\tif (!primaryKey) return;\n\t\t\t\tconst primaryKeyValue = (element as any)[primaryKey.name];\n\t\t\t\tif (!primaryKeyValue) {\n\t\t\t\t\tconsole.warn(\n\t\t\t\t\t\t`Could not find primary key value for ${JSON.stringify(\n\t\t\t\t\t\t\telement,\n\t\t\t\t\t\t)}. Cannot register subscription!`,\n\t\t\t\t\t);\n\t\t\t\t\treturn;\n\t\t\t\t}\n\n\t\t\t\t//TODO maybe register non specific update calls aswell?\n\t\t\t\tregisterOnInstance({\n\t\t\t\t\tinstance: subscriptions,\n\t\t\t\t\taction: \"updated\",\n\t\t\t\t\tprimaryKeyValue: primaryKeyValue,\n\t\t\t\t});\n\t\t\t},\n\t\t\tapplyFilters:\n\t\t\t\tabilityBuilder?.z_registeredFilters?.[table as any]?.[readAction],\n\t\t\tfields: (t) => {\n\t\t\t\tconst columns = tableSchema.columns;\n\t\t\t\tconst mapSQLTypeStringToExposedPothosType = <\n\t\t\t\t\tColumn extends keyof typeof columns,\n\t\t\t\t>(\n\t\t\t\t\tsqlType: PossibleSQLType,\n\t\t\t\t\tcolumnName: Column,\n\t\t\t\t\tnullable: boolean,\n\t\t\t\t) => {\n\t\t\t\t\tconst gqlType = mapSQLTypeToGraphQLType({\n\t\t\t\t\t\tsqlType,\n\t\t\t\t\t\tfieldName: columnName,\n\t\t\t\t\t});\n\t\t\t\t\tswitch (gqlType) {\n\t\t\t\t\t\tcase \"Int\":\n\t\t\t\t\t\t\t// @ts-expect-error\n\t\t\t\t\t\t\treturn t.exposeInt(columnName, { nullable });\n\t\t\t\t\t\tcase \"String\":\n\t\t\t\t\t\t\t// @ts-expect-error\n\t\t\t\t\t\t\treturn t.exposeString(columnName, { nullable });\n\t\t\t\t\t\tcase \"Boolean\":\n\t\t\t\t\t\t\t// @ts-expect-error\n\t\t\t\t\t\t\treturn t.exposeBoolean(columnName, { nullable });\n\t\t\t\t\t\tcase \"Date\":\n\t\t\t\t\t\t\treturn t.field({\n\t\t\t\t\t\t\t\ttype: \"Date\",\n\t\t\t\t\t\t\t\tresolve: (element) => (element as any)[columnName] as Date,\n\t\t\t\t\t\t\t\tnullable,\n\t\t\t\t\t\t\t});\n\t\t\t\t\t\tcase \"DateTime\":\n\t\t\t\t\t\t\treturn t.field({\n\t\t\t\t\t\t\t\ttype: \"DateTime\",\n\t\t\t\t\t\t\t\tresolve: (element) => (element as any)[columnName] as Date,\n\t\t\t\t\t\t\t\tnullable,\n\t\t\t\t\t\t\t});\n\t\t\t\t\t\tcase \"Float\":\n\t\t\t\t\t\t\t// @ts-expect-error\n\t\t\t\t\t\t\treturn t.exposeFloat(columnName, { nullable });\n\t\t\t\t\t\tcase \"ID\":\n\t\t\t\t\t\t\t// @ts-expect-error\n\t\t\t\t\t\t\treturn t.exposeID(columnName, { nullable });\n\t\t\t\t\t\tcase \"JSON\":\n\t\t\t\t\t\t\treturn t.field({\n\t\t\t\t\t\t\t\ttype: \"JSON\",\n\t\t\t\t\t\t\t\tresolve: (element) => (element as any)[columnName] as unknown,\n\t\t\t\t\t\t\t\tnullable,\n\t\t\t\t\t\t\t});\n\t\t\t\t\t\tdefault:\n\t\t\t\t\t\t\tthrow new RumbleError(\n\t\t\t\t\t\t\t\t`Unsupported object type ${gqlType} for column ${columnName}`,\n\t\t\t\t\t\t\t);\n\t\t\t\t\t}\n\t\t\t\t};\n\n\t\t\t\t// in case the user makes adjustments we want to store away which\n\t\t\t\t// pothos function was called with what config\n\t\t\t\t// this is mapped to the ref which later can be used to\n\t\t\t\t// reference these parameters while iterating over the fields\n\t\t\t\t// and checking against the userAdjustments object\n\t\t\t\t// this is necessary to e.g. merge nullability info from the database schema\n\t\t\t\t// or register subscriptions on relations\n\t\t\t\tconst configMap = new Map<\n\t\t\t\t\tany,\n\t\t\t\t\t{\n\t\t\t\t\t\tcreatorFunction: (...p: any[]) => any;\n\t\t\t\t\t\tparams: any[];\n\t\t\t\t\t\tconfigObject: any;\n\t\t\t\t\t}\n\t\t\t\t>();\n\t\t\t\t// stores the results of the user adjustments\n\t\t\t\t// also stores all the used pothos functions and the configs\n\t\t\t\t// provided by the user so we can extend that if necessary\n\t\t\t\tconst userAdjustments =\n\t\t\t\t\tadjust?.(\n\t\t\t\t\t\tnew Proxy(t, {\n\t\t\t\t\t\t\tget: (target, prop) => {\n\t\t\t\t\t\t\t\tif (\n\t\t\t\t\t\t\t\t\t// we only care for field/relation functions\n\t\t\t\t\t\t\t\t\ttypeof (target as any)[prop] !== \"function\" ||\n\t\t\t\t\t\t\t\t\tprop === \"arg\" ||\n\t\t\t\t\t\t\t\t\tprop === \"builder\" ||\n\t\t\t\t\t\t\t\t\tprop === \"graphqlKind\" ||\n\t\t\t\t\t\t\t\t\tprop === \"kind\" ||\n\t\t\t\t\t\t\t\t\tprop === \"listRef\" ||\n\t\t\t\t\t\t\t\t\tprop === \"table\" ||\n\t\t\t\t\t\t\t\t\tprop === \"typename\" ||\n\t\t\t\t\t\t\t\t\tprop === \"variant\" ||\n\t\t\t\t\t\t\t\t\tprop.toString().startsWith(\"boolean\") ||\n\t\t\t\t\t\t\t\t\tprop.toString().startsWith(\"float\") ||\n\t\t\t\t\t\t\t\t\tprop.toString().startsWith(\"id\") ||\n\t\t\t\t\t\t\t\t\tprop.toString().startsWith(\"int\") ||\n\t\t\t\t\t\t\t\t\tprop.toString().startsWith(\"string\") ||\n\t\t\t\t\t\t\t\t\tprop.toString().startsWith(\"expose\")\n\t\t\t\t\t\t\t\t) {\n\t\t\t\t\t\t\t\t\treturn (target as any)[prop];\n\t\t\t\t\t\t\t\t}\n\n\t\t\t\t\t\t\t\treturn (...params: any[]) => {\n\t\t\t\t\t\t\t\t\tconst ref = (target as any)[prop](...params);\n\t\t\t\t\t\t\t\t\tconst configObject = params.find(isProbablyAConfigObject);\n\t\t\t\t\t\t\t\t\tif (!configObject)\n\t\t\t\t\t\t\t\t\t\tthrow new RumbleError(\n\t\t\t\t\t\t\t\t\t\t\t\"Expected config object to be passed to adjust field\",\n\t\t\t\t\t\t\t\t\t\t);\n\n\t\t\t\t\t\t\t\t\tconfigMap.set(ref, {\n\t\t\t\t\t\t\t\t\t\tparams,\n\t\t\t\t\t\t\t\t\t\tcreatorFunction: (target as any)[prop],\n\t\t\t\t\t\t\t\t\t\tconfigObject,\n\t\t\t\t\t\t\t\t\t});\n\t\t\t\t\t\t\t\t\treturn ref;\n\t\t\t\t\t\t\t\t};\n\t\t\t\t\t\t\t},\n\t\t\t\t\t\t}) as any,\n\t\t\t\t\t) ?? {};\n\n\t\t\t\tconst fields = Object.entries(columns).reduce(\n\t\t\t\t\t(acc, [key, value]) => {\n\t\t\t\t\t\tif (userAdjustments[key]) {\n\t\t\t\t\t\t\tconst { params, creatorFunction, configObject } = configMap.get(\n\t\t\t\t\t\t\t\tuserAdjustments[key],\n\t\t\t\t\t\t\t)!;\n\n\t\t\t\t\t\t\tif (typeof configObject.nullable !== \"boolean\") {\n\t\t\t\t\t\t\t\tconfigObject.nullable = !value.notNull;\n\t\t\t\t\t\t\t}\n\n\t\t\t\t\t\t\tuserAdjustments[key] = creatorFunction.bind(t)(...params);\n\t\t\t\t\t\t\treturn acc;\n\t\t\t\t\t\t}\n\n\t\t\t\t\t\tif (isEnumSchema(value)) {\n\t\t\t\t\t\t\tconst enumImpl = enumImplementer({\n\t\t\t\t\t\t\t\tenumColumn: value,\n\t\t\t\t\t\t\t});\n\n\t\t\t\t\t\t\tacc[key] = t.field({\n\t\t\t\t\t\t\t\ttype: enumImpl,\n\t\t\t\t\t\t\t\tresolve: (element) => (element as any)[key],\n\t\t\t\t\t\t\t\tnullable: !value.notNull,\n\t\t\t\t\t\t\t});\n\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\tacc[key] = mapSQLTypeStringToExposedPothosType(\n\t\t\t\t\t\t\t\tvalue.getSQLType() as PossibleSQLType,\n\t\t\t\t\t\t\t\tkey,\n\t\t\t\t\t\t\t\t!value.notNull,\n\t\t\t\t\t\t\t);\n\t\t\t\t\t\t}\n\t\t\t\t\t\treturn acc;\n\t\t\t\t\t},\n\t\t\t\t\t{} as Record<\n\t\t\t\t\t\tkeyof typeof columns,\n\t\t\t\t\t\tReturnType<typeof mapSQLTypeStringToExposedPothosType>\n\t\t\t\t\t>,\n\t\t\t\t);\n\n\t\t\t\tconst relations = Object.entries(tableSchema.relations ?? {}).reduce(\n\t\t\t\t\t(acc, [key, value]) => {\n\t\t\t\t\t\tconst relationSchema = tableHelper({\n\t\t\t\t\t\t\tdb,\n\t\t\t\t\t\t\ttable: value.targetTable as Table,\n\t\t\t\t\t\t});\n\t\t\t\t\t\tconst WhereArg = whereArgImplementer({\n\t\t\t\t\t\t\tdbName: relationSchema.dbName,\n\t\t\t\t\t\t});\n\t\t\t\t\t\tconst OrderArg = orderArgImplementer({\n\t\t\t\t\t\t\tdbName: relationSchema.dbName,\n\t\t\t\t\t\t});\n\t\t\t\t\t\tconst relationTablePubSub = makePubSubInstance({\n\t\t\t\t\t\t\ttable: relationSchema.tsName as any,\n\t\t\t\t\t\t});\n\n\t\t\t\t\t\t// many relations will return an empty array so we just don't set them nullable\n\t\t\t\t\t\tlet nullable = false;\n\t\t\t\t\t\tlet isMany = true;\n\t\t\t\t\t\tlet filterSpecifier = \"many\";\n\t\t\t\t\t\tif (value instanceof One) {\n\t\t\t\t\t\t\tisMany = false;\n\t\t\t\t\t\t\tnullable = value.optional;\n\t\t\t\t\t\t\tfilterSpecifier = \"single\";\n\t\t\t\t\t\t}\n\n\t\t\t\t\t\tconst subscribe = (subscriptions: any, _element: any) => {\n\t\t\t\t\t\t\trelationTablePubSub.registerOnInstance({\n\t\t\t\t\t\t\t\tinstance: subscriptions,\n\t\t\t\t\t\t\t\taction: \"created\",\n\t\t\t\t\t\t\t});\n\t\t\t\t\t\t\trelationTablePubSub.registerOnInstance({\n\t\t\t\t\t\t\t\tinstance: subscriptions,\n\t\t\t\t\t\t\t\taction: \"removed\",\n\t\t\t\t\t\t\t});\n\t\t\t\t\t\t};\n\n\t\t\t\t\t\tif (userAdjustments[key]) {\n\t\t\t\t\t\t\tconst { params, creatorFunction, configObject } = configMap.get(\n\t\t\t\t\t\t\t\tuserAdjustments[key],\n\t\t\t\t\t\t\t)!;\n\n\t\t\t\t\t\t\tif (typeof configObject.nullable !== \"boolean\") {\n\t\t\t\t\t\t\t\tconfigObject.nullable = nullable;\n\t\t\t\t\t\t\t}\n\n\t\t\t\t\t\t\tif (typeof configObject.subscribe !== \"function\") {\n\t\t\t\t\t\t\t\tconfigObject.subscribe = subscribe;\n\t\t\t\t\t\t\t}\n\n\t\t\t\t\t\t\tuserAdjustments[key] = creatorFunction.bind(t)(...params);\n\t\t\t\t\t\t\treturn acc;\n\t\t\t\t\t\t}\n\n\t\t\t\t\t\tconst args = {\n\t\t\t\t\t\t\twhere: t.arg({ type: WhereArg, required: false }),\n\t\t\t\t\t\t\torderBy: t.arg({ type: OrderArg, required: false }),\n\t\t\t\t\t\t\t...(isMany\n\t\t\t\t\t\t\t\t? {\n\t\t\t\t\t\t\t\t\t\toffset: t.arg.int({ required: false }),\n\t\t\t\t\t\t\t\t\t\tlimit: t.arg.int({ required: false }),\n\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t: {}),\n\t\t\t\t\t\t\tsearch: t.arg.string({ required: false }),\n\t\t\t\t\t\t};\n\n\t\t\t\t\t\tif (!search?.enabled || !isMany) {\n\t\t\t\t\t\t\tdelete (args as any).search;\n\t\t\t\t\t\t}\n\n\t\t\t\t\t\t(acc as any)[key] = t.relation(key, {\n\t\t\t\t\t\t\targs,\n\t\t\t\t\t\t\tsubscribe,\n\t\t\t\t\t\t\tnullable,\n\t\t\t\t\t\t\tdescription: `Get the ${plural(relationSchema.tsName)} related to this ${singular(tableSchema.tsName)}`,\n\t\t\t\t\t\t\tquery: (args: any, ctx: any) => {\n\t\t\t\t\t\t\t\t// transform null prototyped object\n\t\t\t\t\t\t\t\targs = JSON.parse(JSON.stringify(args));\n\n\t\t\t\t\t\t\t\tif (isMany) {\n\t\t\t\t\t\t\t\t\tadjustQueryForSearch({\n\t\t\t\t\t\t\t\t\t\tsearch,\n\t\t\t\t\t\t\t\t\t\targs,\n\t\t\t\t\t\t\t\t\t\ttableSchema: relationSchema,\n\t\t\t\t\t\t\t\t\t\tabilities:\n\t\t\t\t\t\t\t\t\t\t\tctx.abilities[relationSchema.tsName].filter(readAction),\n\t\t\t\t\t\t\t\t\t});\n\t\t\t\t\t\t\t\t}\n\n\t\t\t\t\t\t\t\tconst filter = ctx.abilities[relationSchema.tsName].filter(\n\t\t\t\t\t\t\t\t\treadAction,\n\t\t\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t\t\tinject: { where: args.where, limit: args.limit },\n\t\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t).query[filterSpecifier];\n\n\t\t\t\t\t\t\t\tif (args.offset) {\n\t\t\t\t\t\t\t\t\t(filter as any).offset = args.offset;\n\t\t\t\t\t\t\t\t}\n\n\t\t\t\t\t\t\t\tif (args.orderBy) {\n\t\t\t\t\t\t\t\t\t(filter as any).orderBy = args.orderBy;\n\t\t\t\t\t\t\t\t}\n\n\t\t\t\t\t\t\t\treturn filter;\n\t\t\t\t\t\t\t},\n\t\t\t\t\t\t} as any) as any;\n\t\t\t\t\t\treturn acc;\n\t\t\t\t\t},\n\t\t\t\t\t{} as Record<\n\t\t\t\t\t\tkeyof typeof tableSchema.relations,\n\t\t\t\t\t\tReturnType<typeof mapSQLTypeStringToExposedPothosType>\n\t\t\t\t\t>,\n\t\t\t\t);\n\n\t\t\t\treturn {\n\t\t\t\t\t...fields,\n\t\t\t\t\t...relations,\n\t\t\t\t\t...userAdjustments,\n\t\t\t\t};\n\t\t\t},\n\t\t});\n\t};\n};\n","import type { Table } from \"drizzle-orm\";\nimport { toCamelCase } from \"drizzle-orm/casing\";\nimport { capitalize } from \"es-toolkit\";\nimport { lazy } from \"./helpers/lazy\";\nimport {\n\ttype TableIdentifierTSName,\n\ttableHelper,\n} from \"./helpers/tableHelpers\";\nimport type { SchemaBuilderType } from \"./schemaBuilder\";\nimport type { GenericDrizzleDbTypeConstraints } from \"./types/genericDrizzleDbType\";\nimport type {\n\tCustomRumblePothosConfig,\n\tRumbleInput,\n} from \"./types/rumbleInput\";\n\nexport type OrderArgImplementerType<\n\tUserContext extends Record<string, any>,\n\tDB extends GenericDrizzleDbTypeConstraints,\n\tRequestEvent extends Record<string, any>,\n\tAction extends string,\n\tPothosConfig extends CustomRumblePothosConfig,\n> = ReturnType<\n\ttypeof createOrderArgImplementer<\n\t\tUserContext,\n\t\tDB,\n\t\tRequestEvent,\n\t\tAction,\n\t\tPothosConfig,\n\t\tSchemaBuilderType<UserContext, DB, RequestEvent, Action, PothosConfig>\n\t>\n>;\n\nconst makeDefaultName = (dbName: string) =>\n\t`${capitalize(toCamelCase(dbName.toString()))}OrderInputArgument`;\n\nexport const createOrderArgImplementer = <\n\tUserContext extends Record<string, any>,\n\tDB extends GenericDrizzleDbTypeConstraints,\n\tRequestEvent extends Record<string, any>,\n\tAction extends string,\n\tPothosConfig extends CustomRumblePothosConfig,\n\tSchemaBuilder extends SchemaBuilderType<\n\t\tUserContext,\n\t\tDB,\n\t\tRequestEvent,\n\t\tAction,\n\t\tPothosConfig\n\t>,\n>({\n\tdb,\n\tschemaBuilder,\n}: RumbleInput<UserContext, DB, RequestEvent, Action, PothosConfig> & {\n\tschemaBuilder: SchemaBuilder;\n}) => {\n\tconst referenceStorage = new Map<string, any>();\n\n\tconst sortingParameterEnumRef = lazy(() =>\n\t\tschemaBuilder.enumType(\"SortingParameter\", {\n\t\t\tvalues: [\"asc\", \"desc\"] as const,\n\t\t}),\n\t);\n\n\tconst orderArgImplementer = <\n\t\tExplicitTableName extends TableIdentifierTSName<DB>,\n\t\tRefName extends string,\n\t>({\n\t\ttable,\n\t\trefName,\n\t\tdbName,\n\t}: Partial<{\n\t\ttable: ExplicitTableName;\n\t\trefName: RefName | undefined;\n\t\tdbName: string;\n\t}> &\n\t\t(\n\t\t\t| {\n\t\t\t\t\ttable: ExplicitTableName;\n\t\t\t }\n\t\t\t| {\n\t\t\t\t\tdbName: string;\n\t\t\t }\n\t\t)) => {\n\t\tconst tableSchema = tableHelper({\n\t\t\tdb,\n\t\t\tdbName,\n\t\t\ttsName: table!,\n\t\t});\n\n\t\tconst inputTypeName = refName ?? makeDefaultName(tableSchema.tsName);\n\n\t\tlet ret: ReturnType<typeof implement> | undefined =\n\t\t\treferenceStorage.get(inputTypeName);\n\t\tif (ret) {\n\t\t\treturn ret;\n\t\t}\n\n\t\tconst implement = () => {\n\t\t\treturn schemaBuilder.inputType(inputTypeName, {\n\t\t\t\tfields: (t) => {\n\t\t\t\t\tconst fields = Object.entries(tableSchema.columns).reduce(\n\t\t\t\t\t\t(acc, [key]) => {\n\t\t\t\t\t\t\tacc[key] = t.field({\n\t\t\t\t\t\t\t\ttype: sortingParameterEnumRef(),\n\t\t\t\t\t\t\t\trequired: false,\n\t\t\t\t\t\t\t});\n\n\t\t\t\t\t\t\treturn acc;\n\t\t\t\t\t\t},\n\t\t\t\t\t\t{} as Record<\n\t\t\t\t\t\t\tkeyof typeof tableSchema.columns,\n\t\t\t\t\t\t\tReturnType<typeof t.field>\n\t\t\t\t\t\t>,\n\t\t\t\t\t);\n\n\t\t\t\t\tconst relations = Object.entries(tableSchema.relations ?? {}).reduce(\n\t\t\t\t\t\t(acc, [key, value]) => {\n\t\t\t\t\t\t\tconst relationSchema = tableHelper({\n\t\t\t\t\t\t\t\tdb,\n\t\t\t\t\t\t\t\ttable: value.targetTable as Table,\n\t\t\t\t\t\t\t});\n\t\t\t\t\t\t\tconst referenceModel = orderArgImplementer({\n\t\t\t\t\t\t\t\tdbName: relationSchema.dbName,\n\t\t\t\t\t\t\t});\n\n\t\t\t\t\t\t\tacc[key] = t.field({\n\t\t\t\t\t\t\t\ttype: referenceModel,\n\t\t\t\t\t\t\t\trequired: false,\n\t\t\t\t\t\t\t});\n\n\t\t\t\t\t\t\treturn acc;\n\t\t\t\t\t\t},\n\t\t\t\t\t\t{} as Record<\n\t\t\t\t\t\t\tkeyof typeof tableSchema.columns,\n\t\t\t\t\t\t\tReturnType<typeof t.field>\n\t\t\t\t\t\t>,\n\t\t\t\t\t);\n\n\t\t\t\t\treturn {\n\t\t\t\t\t\t...fields,\n\t\t\t\t\t\t...relations,\n\t\t\t\t\t};\n\t\t\t\t},\n\t\t\t});\n\t\t};\n\n\t\tret = implement();\n\t\treferenceStorage.set(inputTypeName, ret);\n\t\treturn ret;\n\t};\n\n\treturn orderArgImplementer;\n};\n","import { createPubSub } from \"graphql-yoga\";\nimport type { TableIdentifierTSName } from \"./helpers/tableHelpers\";\nimport type { GenericDrizzleDbTypeConstraints } from \"./types/genericDrizzleDbType\";\nimport type {\n\tCustomRumblePothosConfig,\n\tRumbleInput,\n} from \"./types/rumbleInput\";\n\ntype PubSubAction = \"created\" | \"removed\" | \"updated\";\n\nconst SUBSCRIPTION_NOTIFIER_RUMBLE_PREFIX = \"RUMBLE_SUBSCRIPTION_NOTIFICATION\";\nconst SUBSCRIPTION_NOTIFIER_REMOVED = \"REMOVED\";\nconst SUBSCRIPTION_NOTIFIER_UPDATED = \"UPDATED\";\nconst SUBSCRIPTION_NOTIFIER_CREATED = \"CREATED\";\n\nexport type MakePubSubInstanceType<\n\tUserContext extends Record<string, any>,\n\tDB extends GenericDrizzleDbTypeConstraints,\n\tRequestEvent extends Record<string, any>,\n\tAction extends string,\n\tPothosConfig extends CustomRumblePothosConfig,\n> = ReturnType<\n\ttypeof createPubSubInstance<\n\t\tUserContext,\n\t\tDB,\n\t\tRequestEvent,\n\t\tAction,\n\t\tPothosConfig\n\t>\n>[\"makePubSubInstance\"];\n\nexport const createPubSubInstance = <\n\tUserContext extends Record<string, any>,\n\tDB extends GenericDrizzleDbTypeConstraints,\n\tRequestEvent extends Record<string, any>,\n\tAction extends string,\n\tPothosConfig extends CustomRumblePothosConfig,\n>({\n\tsubscriptions,\n}: RumbleInput<UserContext, DB, RequestEvent, Action, PothosConfig>) => {\n\tconst pubsub = subscriptions\n\t\t? createPubSub(...subscriptions)\n\t\t: createPubSub();\n\n\tconst makePubSubInstance = <\n\t\tExplicitTableName extends TableIdentifierTSName<DB>,\n\t>({\n\t\ttable,\n\t}: {\n\t\ttable: ExplicitTableName;\n\t}) => {\n\t\ttype PrimaryKeyType = any;\n\n\t\tfunction makePubSubKey({\n\t\t\taction,\n\t\t\ttableName,\n\t\t\tprimaryKeyValue,\n\t\t}: {\n\t\t\ttableName: string;\n\t\t\taction: PubSubAction;\n\t\t\tprimaryKeyValue?: PrimaryKeyType;\n\t\t}) {\n\t\t\tlet actionKey: string;\n\n\t\t\tswitch (action) {\n\t\t\t\tcase \"created\":\n\t\t\t\t\tactionKey = SUBSCRIPTION_NOTIFIER_CREATED;\n\t\t\t\t\tbreak;\n\t\t\t\tcase \"removed\":\n\t\t\t\t\tactionKey = SUBSCRIPTION_NOTIFIER_REMOVED;\n\t\t\t\t\tbreak;\n\t\t\t\tcase \"updated\":\n\t\t\t\t\tactionKey = SUBSCRIPTION_NOTIFIER_UPDATED;\n\t\t\t\t\tbreak;\n\t\t\t\tdefault:\n\t\t\t\t\tthrow new Error(`Unknown action: ${action}`);\n\t\t\t}\n\n\t\t\treturn `${SUBSCRIPTION_NOTIFIER_RUMBLE_PREFIX}/${tableName}${\n\t\t\t\tprimaryKeyValue ? `/${primaryKeyValue}` : \"\"\n\t\t\t}/${actionKey}`;\n\t\t}\n\n\t\t// TODO does caching these make sense?\n\t\treturn {\n\t\t\t/**\n\t\t\t * Call this when you want to register a subscription on an instance to this table\n\t\t\t */\n\t\t\tregisterOnInstance({\n\t\t\t\tinstance,\n\t\t\t\taction,\n\t\t\t\tprimaryKeyValue,\n\t\t\t}: {\n\t\t\t\tinstance: { register: (id: string) => void };\n\t\t\t\taction: PubSubAction;\n\t\t\t\tprimaryKeyValue?: string;\n\t\t\t}) {\n\t\t\t\tconst key = makePubSubKey({\n\t\t\t\t\ttableName: table.toString(),\n\t\t\t\t\taction,\n\t\t\t\t\tprimaryKeyValue,\n\t\t\t\t});\n\t\t\t\tinstance.register(key);\n\t\t\t},\n\t\t\t/**\n\t\t\t * Call this when you created an entity of this table\n\t\t\t */\n\t\t\tcreated() {\n\t\t\t\tconst key = makePubSubKey({\n\t\t\t\t\ttableName: table.toString(),\n\t\t\t\t\taction: \"created\",\n\t\t\t\t});\n\t\t\t\treturn pubsub.publish(key);\n\t\t\t},\n\t\t\t/**\n\t\t\t * Call this when you removed one or more entities of this table\n\t\t\t */\n\t\t\t// removed(primaryKeyValue?: PrimaryKeyType | PrimaryKeyType[]) {\n\t\t\tremoved() {\n\t\t\t\tconst key = makePubSubKey({\n\t\t\t\t\ttableName: table.toString(),\n\t\t\t\t\taction: \"removed\",\n\t\t\t\t\t//TODO would it make sense to use specific sub topics here?\n\t\t\t\t\t// primaryKeyValue,\n\t\t\t\t});\n\t\t\t\treturn pubsub.publish(key);\n\t\t\t},\n\t\t\t/**\n\t\t\t * Call this when you updated one or more entities of this table\n\t\t\t */\n\t\t\tupdated(primaryKeyValue?: PrimaryKeyType | PrimaryKeyType[]) {\n\t\t\t\tconst primaryKeys = Array.isArray(primaryKeyValue)\n\t\t\t\t\t? primaryKeyValue\n\t\t\t\t\t: [primaryKeyValue];\n\t\t\t\tconst keys = primaryKeys.map((primaryKeyValue) =>\n\t\t\t\t\tmakePubSubKey({\n\t\t\t\t\t\ttableName: table.toString(),\n\t\t\t\t\t\taction: \"updated\",\n\t\t\t\t\t\tprimaryKeyValue,\n\t\t\t\t\t}),\n\t\t\t\t);\n\t\t\t\tconst uniqueKeys = Array.from(new Set(keys));\n\t\t\t\tfor (const key of uniqueKeys) {\n\t\t\t\t\tpubsub.publish(key);\n\t\t\t\t}\n\t\t\t},\n\t\t};\n\t};\n\n\treturn {\n\t\tpubsub,\n\t\tmakePubSubInstance,\n\t};\n};\n","import { plural, singular } from \"pluralize\";\nimport { assertFindFirstExists } from \"./helpers/helper\";\nimport {\n\ttype TableIdentifierTSName,\n\ttableHelper,\n} from \"./helpers/tableHelpers\";\nimport type { OrderArgImplementerType } from \"./orderArg\";\nimport type { MakePubSubInstanceType } from \"./pubsub\";\nimport type { SchemaBuilderType } from \"./schemaBuilder\";\nimport { adjustQueryForSearch } from \"./search\";\nimport type { GenericDrizzleDbTypeConstraints } from \"./types/genericDrizzleDbType\";\nimport type {\n\tCustomRumblePothosConfig,\n\tRumbleInput,\n} from \"./types/rumbleInput\";\nimport type { WhereArgImplementerType } from \"./whereArg\";\n\n// TODO: consider removing the whole inject helper thing since we dont need a syntax transform anymore\n\nexport const createQueryImplementer = <\n\tUserContext extends Record<string, any>,\n\tDB extends GenericDrizzleDbTypeConstraints,\n\tRequestEvent extends Record<string, any>,\n\tAction extends string,\n\tPothosConfig extends CustomRumblePothosConfig,\n\tSchemaBuilder extends SchemaBuilderType<\n\t\tUserContext,\n\t\tDB,\n\t\tRequestEvent,\n\t\tAction,\n\t\tPothosConfig\n\t>,\n\tWhereArgImplementer extends WhereArgImplementerType<\n\t\tUserContext,\n\t\tDB,\n\t\tRequestEvent,\n\t\tAction,\n\t\tPothosConfig\n\t>,\n\tOrderArgImplementer extends OrderArgImplementerType<\n\t\tUserContext,\n\t\tDB,\n\t\tRequestEvent,\n\t\tAction,\n\t\tPothosConfig\n\t>,\n\tMakePubSubInstance extends MakePubSubInstanceType<\n\t\tUserContext,\n\t\tDB,\n\t\tRequestEvent,\n\t\tAction,\n\t\tPothosConfig\n\t>,\n>({\n\tdb,\n\tschemaBuilder,\n\tsearch,\n\twhereArgImplementer,\n\torderArgImplementer,\n\tmakePubSubInstance,\n}: RumbleInput<UserContext, DB, RequestEvent, Action, PothosConfig> & {\n\tschemaBuilder: SchemaBuilder;\n\twhereArgImplementer: WhereArgImplementer;\n\torderArgImplementer: OrderArgImplementer;\n\tmakePubSubInstance: MakePubSubInstance;\n}) => {\n\treturn <ExplicitTableName extends TableIdentifierTSName<DB>>({\n\t\ttable,\n\t\treadAction = \"read\" as Action,\n\t\tlistAction = \"read\" as Action,\n\t}: {\n\t\t/**\n\t\t * The table for which to implement the query\n\t\t */\n\t\ttable: ExplicitTableName;\n\t\t/**\n\t\t * Which action should be used for reading single entities\n\t\t * @default \"read\"\n\t\t */\n\t\treadAction?: Action;\n\t\t/**\n\t\t * Which action should be used for listing many entities\n\t\t * @default \"read\"\n\t\t */\n\t\tlistAction?: Action;\n\t}) => {\n\t\tconst WhereArg = whereArgImplementer({\n\t\t\ttable: table,\n\t\t});\n\t\tconst OrderArg = orderArgImplementer({\n\t\t\ttable: table,\n\t\t});\n\t\tconst tableSchema = tableHelper({\n\t\t\tdb,\n\t\t\ttsName: table!,\n\t\t});\n\t\tconst primaryKeyField = Object.values(tableSchema.primaryColumns)[0];\n\n\t\tconst { registerOnInstance } = makePubSubInstance({ table: table });\n\n\t\treturn schemaBuilder.queryFields((t) => {\n\t\t\tconst manyArgs = {\n\t\t\t\twhere: t.arg({ type: WhereArg, required: false }),\n\t\t\t\torderBy: t.arg({ type: OrderArg, required: false }),\n\t\t\t\tlimit: t.arg.int({ required: false }),\n\t\t\t\toffset: t.arg.int({ required: false }),\n\t\t\t\tsearch: t.arg.string({ required: false }),\n\t\t\t};\n\n\t\t\tif (!search?.enabled) {\n\t\t\t\tdelete (manyArgs as any).search;\n\t\t\t}\n\n\t\t\treturn {\n\t\t\t\t[plural(table.toString())]: t.drizzleField({\n\t\t\t\t\ttype: [table],\n\t\t\t\t\tnullable: false,\n\t\t\t\t\tsmartSubscription: true,\n\t\t\t\t\tdescription: `List all ${plural(table.toString())}`,\n\t\t\t\t\tsubscribe: (subscriptions, _root, _args, _ctx, _info) => {\n\t\t\t\t\t\tregisterOnInstance({\n\t\t\t\t\t\t\tinstance: subscriptions,\n\t\t\t\t\t\t\taction: \"created\",\n\t\t\t\t\t\t});\n\t\t\t\t\t\tregisterOnInstance({\n\t\t\t\t\t\t\tinstance: subscriptions,\n\t\t\t\t\t\t\taction: \"removed\",\n\t\t\t\t\t\t});\n\t\t\t\t\t},\n\t\t\t\t\targs: manyArgs,\n\t\t\t\t\tresolve: (query, _root, args, ctx, _info) => {\n\t\t\t\t\t\t// transform null prototyped object\n\t\t\t\t\t\targs = JSON.parse(JSON.stringify(args));\n\n\t\t\t\t\t\tadjustQueryForSearch({\n\t\t\t\t\t\t\tsearch,\n\t\t\t\t\t\t\targs,\n\t\t\t\t\t\t\ttableSchema,\n\t\t\t\t\t\t\tabilities: ctx.abilities[table as any].filter(listAction),\n\t\t\t\t\t\t});\n\n\t\t\t\t\t\tconst filter = ctx.abilities[table as any].filter(\n\t\t\t\t\t\t\tlistAction,\n\t\t\t\t\t\t\targs.where || args.limit || args.offset\n\t\t\t\t\t\t\t\t? {\n\t\t\t\t\t\t\t\t\t\tinject: {\n\t\t\t\t\t\t\t\t\t\t\twhere: args.where,\n\t\t\t\t\t\t\t\t\t\t\tlimit: args.limit,\n\t\t\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t: undefined,\n\t\t\t\t\t\t).query.many;\n\n\t\t\t\t\t\tif (args.offset) {\n\t\t\t\t\t\t\t(filter as any).offset = args.offset;\n\t\t\t\t\t\t}\n\n\t\t\t\t\t\tif (args.orderBy) {\n\t\t\t\t\t\t\t(filter as any).orderBy = args.orderBy;\n\t\t\t\t\t\t}\n\n\t\t\t\t\t\tconst queryInstance = query(filter as any);\n\n\t\t\t\t\t\tif (filter.columns) {\n\t\t\t\t\t\t\tqueryInstance.columns = filter.columns;\n\t\t\t\t\t\t}\n\n\t\t\t\t\t\treturn db.query[table as any].findMany(queryInstance);\n\t\t\t\t\t},\n\t\t\t\t}),\n\t\t\t\t[singular(table.toString())]: t.drizzleField({\n\t\t\t\t\ttype: table,\n\t\t\t\t\tnullable: false,\n\t\t\t\t\tsmartSubscription: true,\n\t\t\t\t\tdescription: `Get a single ${singular(table.toString())} by ID`,\n\t\t\t\t\targs: {\n\t\t\t\t\t\t// where: t.arg({ type: WhereArg, required: false }),\n\t\t\t\t\t\tid: t.arg.id({ required: true }),\n\t\t\t\t\t},\n\t\t\t\t\tresolve: (query, _root, args, ctx, _info) => {\n\t\t\t\t\t\t// transform null prototyped object\n\t\t\t\t\t\targs = JSON.parse(JSON.stringify(args));\n\n\t\t\t\t\t\tconst filter = ctx.abilities[table as any].filter(readAction, {\n\t\t\t\t\t\t\tinject: { where: { [primaryKeyField.name]: args.id } },\n\t\t\t\t\t\t}).query.single;\n\n\t\t\t\t\t\tconst queryInstance = query(filter as any);\n\n\t\t\t\t\t\tif (filter.columns) {\n\t\t\t\t\t\t\tqueryInstance.columns = filter.columns;\n\t\t\t\t\t\t}\n\n\t\t\t\t\t\treturn db.query[table as any]\n\t\t\t\t\t\t\t.findFirst(queryInstance)\n\t\t\t\t\t\t\t.then(assertFindFirstExists);\n\t\t\t\t\t},\n\t\t\t\t}),\n\t\t\t};\n\t\t});\n\t};\n};\n","import \"./pluginTypes\";\nimport SchemaBuilder, {\n\tBasePlugin,\n\ttype PothosOutputFieldConfig,\n\ttype SchemaTypes,\n} from \"@pothos/core\";\nimport type { GraphQLFieldResolver } from \"graphql\";\nimport { applyFilters } from \"../helpers/helper\";\nimport type { ApplyFiltersField } from \"./pluginTypes\";\n\nconst pluginName = \"ManualFiltersPlugin\";\n\nexport default pluginName;\n\nexport const applyFiltersKey = \"applyFilters\";\n\nexport class ManualFiltersPlugin<\n\tTypes extends SchemaTypes,\n> extends BasePlugin<Types> {\n\toverride wrapResolve(\n\t\tresolver: GraphQLFieldResolver<unknown, Types[\"Context\"], object>,\n\t\tfieldConfig: PothosOutputFieldConfig<Types>,\n\t): GraphQLFieldResolver<unknown, Types[\"Context\"], object> {\n\t\treturn async (parent, args, context, info) => {\n\t\t\t//TODO: https://github.com/hayes/pothos/discussions/1431#discussioncomment-12974130\n\t\t\tlet filters: ApplyFiltersField<Types[\"Context\"], any> | undefined;\n\t\t\tconst fieldType = fieldConfig?.type as any;\n\n\t\t\tif (fieldType.kind === \"List\") {\n\t\t\t\tfilters =\n\t\t\t\t\tfieldType.type?.ref.currentConfig.pothosOptions[applyFiltersKey];\n\t\t\t} else if (fieldType.kind === \"Object\") {\n\t\t\t\tfilters = fieldType.ref.currentConfig.pothosOptions[applyFiltersKey];\n\t\t\t}\n\n\t\t\tif (!filters || !Array.isArray(filters) || filters.length === 0) {\n\t\t\t\t// if no filter should be applied, just continue\n\t\t\t\treturn resolver(parent, args, context, info);\n\t\t\t}\n\n\t\t\tconst resolved = await resolver(parent, args, context, info);\n\t\t\tconst allResolvedValues = Array.isArray(resolved) ? resolved : [resolved];\n\t\t\tconst allFilters = Array.isArray(filters) ? filters : [filters];\n\n\t\t\tconst allowed = await applyFilters({\n\t\t\t\tfilters: allFilters,\n\t\t\t\tentities: allResolvedValues,\n\t\t\t\tcontext,\n\t\t\t});\n\n\t\t\t// if the original value was an array, return an array\n\t\t\tif (Array.isArray(resolved)) {\n\t\t\t\treturn allowed;\n\t\t\t}\n\n\t\t\t// if the original value was a single value, return the first allowed\n\t\t\t// or null if not allowed\n\t\t\treturn allowed[0] ?? null;\n\t\t};\n\t}\n}\n\nSchemaBuilder.registerPlugin(pluginName, ManualFiltersPlugin);\n","import type { Table } from \"drizzle-orm\";\nimport { toCamelCase } from \"drizzle-orm/casing\";\nimport { capitalize } from \"es-toolkit\";\nimport { type EnumImplementerType, isEnumSchema } from \"./enum\";\nimport { mapSQLTypeToGraphQLType } from \"./helpers/sqlTypes/mapSQLTypeToTSType\";\nimport type { PossibleSQLType } from \"./helpers/sqlTypes/types\";\nimport {\n\ttype TableIdentifierTSName,\n\ttableHelper,\n} from \"./helpers/tableHelpers\";\nimport type { SchemaBuilderType } from \"./schemaBuilder\";\nimport type { GenericDrizzleDbTypeConstraints } from \"./types/genericDrizzleDbType\";\nimport { RumbleError } from \"./types/rumbleError\";\nimport type {\n\tCustomRumblePothosConfig,\n\tRumbleInput,\n} from \"./types/rumbleInput\";\n\n// TODO: in general, several of the filter methods should be more\n// restrictive in case of explicitly allowed columns\n// search, order and filter should be restricted to allowed cols\n// and should completely ignore other fields since one might be ably\n// to narrow down and guess the actual values behind forbidden columns by\n// using the provided args. This way one could guess, e.g. secrets which are forbidden by\n// the column abilitiy settings but will be respected in searches, etc.\n\nexport type WhereArgImplementerType<\n\tUserContext extends Record<string, any>,\n\tDB extends GenericDrizzleDbTypeConstraints,\n\tRequestEvent extends Record<string, any>,\n\tAction extends string,\n\tPothosConfig extends CustomRumblePothosConfig,\n> = ReturnType<\n\ttypeof createWhereArgImplementer<\n\t\tUserContext,\n\t\tDB,\n\t\tRequestEvent,\n\t\tAction,\n\t\tPothosConfig,\n\t\tSchemaBuilderType<UserContext, DB, RequestEvent, Action, PothosConfig>,\n\t\tEnumImplementerType<UserContext, DB, RequestEvent, Action, PothosConfig>\n\t>\n>;\n\nconst makeDefaultName = (dbName: string) =>\n\t`${capitalize(toCamelCase(dbName.toString()))}WhereInputArgument`;\n\nexport const createWhereArgImplementer = <\n\tUserContext extends Record<string, any>,\n\tDB extends GenericDrizzleDbTypeConstraints,\n\tRequestEvent extends Record<string, any>,\n\tAction extends string,\n\tPothosConfig extends CustomRumblePothosConfig,\n\tSchemaBuilder extends SchemaBuilderType<\n\t\tUserContext,\n\t\tDB,\n\t\tRequestEvent,\n\t\tAction,\n\t\tPothosConfig\n\t>,\n\tEnumImplementer extends EnumImplementerType<\n\t\tUserContext,\n\t\tDB,\n\t\tRequestEvent,\n\t\tAction,\n\t\tPothosConfig\n\t>,\n>({\n\tdb,\n\tschemaBuilder,\n\tenumImplementer,\n}: RumbleInput<UserContext, DB, RequestEvent, Action, PothosConfig> & {\n\tenumImplementer: EnumImplementer;\n\tschemaBuilder: SchemaBuilder;\n}) => {\n\tconst referenceStorage = new Map<string, any>();\n\n\tconst whereArgImplementer = <\n\t\tExplicitTableName extends TableIdentifierTSName<DB>,\n\t\tRefName extends string,\n\t>({\n\t\ttable,\n\t\trefName,\n\t\tdbName,\n\t}: Partial<{\n\t\ttable: ExplicitTableName;\n\t\trefName: RefName | undefined;\n\t\tdbName: string;\n\t}> &\n\t\t(\n\t\t\t| {\n\t\t\t\t\ttable: ExplicitTableName;\n\t\t\t }\n\t\t\t| {\n\t\t\t\t\tdbName: string;\n\t\t\t }\n\t\t)) => {\n\t\tconst tableSchema = tableHelper({\n\t\t\tdb,\n\t\t\tdbName,\n\t\t\ttsName: table!,\n\t\t});\n\n\t\tconst inputTypeName = refName ?? makeDefaultName(tableSchema.tsName);\n\n\t\tlet ret: ReturnType<typeof implement> | undefined =\n\t\t\treferenceStorage.get(inputTypeName);\n\t\tif (ret) {\n\t\t\treturn ret;\n\t\t}\n\n\t\tconst implement = () => {\n\t\t\treturn schemaBuilder.inputType(inputTypeName, {\n\t\t\t\tfields: (t) => {\n\t\t\t\t\tconst mapSQLTypeStringToInputPothosType = (\n\t\t\t\t\t\tsqlType: PossibleSQLType,\n\t\t\t\t\t\tfieldName: string,\n\t\t\t\t\t) => {\n\t\t\t\t\t\tconst gqlType = mapSQLTypeToGraphQLType({\n\t\t\t\t\t\t\tsqlType,\n\t\t\t\t\t\t\tfieldName,\n\t\t\t\t\t\t});\n\t\t\t\t\t\tswitch (gqlType) {\n\t\t\t\t\t\t\tcase \"Int\":\n\t\t\t\t\t\t\t\treturn t.field({ type: \"IntWhereInputArgument\" });\n\t\t\t\t\t\t\tcase \"String\":\n\t\t\t\t\t\t\t\treturn t.field({ type: \"StringWhereInputArgument\" });\n\t\t\t\t\t\t\tcase \"Boolean\":\n\t\t\t\t\t\t\t\treturn t.boolean({ required: false });\n\t\t\t\t\t\t\tcase \"Date\":\n\t\t\t\t\t\t\t\treturn t.field({\n\t\t\t\t\t\t\t\t\ttype: \"DateWhereInputArgument\",\n\t\t\t\t\t\t\t\t});\n\t\t\t\t\t\t\tcase \"DateTime\":\n\t\t\t\t\t\t\t\treturn t.field({\n\t\t\t\t\t\t\t\t\ttype: \"DateWhereInputArgument\",\n\t\t\t\t\t\t\t\t});\n\t\t\t\t\t\t\tcase \"Float\":\n\t\t\t\t\t\t\t\treturn t.field({\n\t\t\t\t\t\t\t\t\ttype: \"FloatWhereInputArgument\",\n\t\t\t\t\t\t\t\t});\n\t\t\t\t\t\t\tcase \"ID\":\n\t\t\t\t\t\t\t\treturn t.id({ required: false });\n\t\t\t\t\t\t\tcase \"JSON\":\n\t\t\t\t\t\t\t\treturn t.field({\n\t\t\t\t\t\t\t\t\ttype: \"JSON\",\n\t\t\t\t\t\t\t\t\trequired: false,\n\t\t\t\t\t\t\t\t});\n\t\t\t\t\t\t\tdefault:\n\t\t\t\t\t\t\t\tthrow new RumbleError(\n\t\t\t\t\t\t\t\t\t`Unsupported argument type ${gqlType} for column ${sqlType}`,\n\t\t\t\t\t\t\t\t);\n\t\t\t\t\t\t}\n\t\t\t\t\t};\n\t\t\t\t\tconst fields = Object.entries(tableSchema.columns).reduce(\n\t\t\t\t\t\t(acc, [key, value]) => {\n\t\t\t\t\t\t\tif (isEnumSchema(value)) {\n\t\t\t\t\t\t\t\tconst enumImpl = enumImplementer({\n\t\t\t\t\t\t\t\t\tenumColumn: value,\n\t\t\t\t\t\t\t\t});\n\n\t\t\t\t\t\t\t\tacc[key] = t.field({\n\t\t\t\t\t\t\t\t\ttype: enumImpl,\n\t\t\t\t\t\t\t\t\trequired: false,\n\t\t\t\t\t\t\t\t});\n\t\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\t\tacc[key] = mapSQLTypeStringToInputPothosType(\n\t\t\t\t\t\t\t\t\tvalue.getSQLType() as PossibleSQLType,\n\t\t\t\t\t\t\t\t\tkey,\n\t\t\t\t\t\t\t\t);\n\t\t\t\t\t\t\t}\n\n\t\t\t\t\t\t\treturn acc;\n\t\t\t\t\t\t},\n\t\t\t\t\t\t{} as Record<\n\t\t\t\t\t\t\tkeyof typeof tableSchema.columns,\n\t\t\t\t\t\t\tReturnType<typeof mapSQLTypeStringToInputPothosType>\n\t\t\t\t\t\t>,\n\t\t\t\t\t);\n\n\t\t\t\t\tconst relations = Object.entries(tableSchema.relations ?? {}).reduce(\n\t\t\t\t\t\t(acc, [key, value]) => {\n\t\t\t\t\t\t\tconst relationSchema = tableHelper({\n\t\t\t\t\t\t\t\tdb,\n\t\t\t\t\t\t\t\ttable: value.targetTable as Table,\n\t\t\t\t\t\t\t});\n\t\t\t\t\t\t\tconst referenceModel = whereArgImplementer({\n\t\t\t\t\t\t\t\tdbName: relationSchema.dbName,\n\t\t\t\t\t\t\t});\n\n\t\t\t\t\t\t\tacc[key] = t.field({\n\t\t\t\t\t\t\t\ttype: referenceModel,\n\t\t\t\t\t\t\t\trequired: false,\n\t\t\t\t\t\t\t});\n\n\t\t\t\t\t\t\treturn acc;\n\t\t\t\t\t\t},\n\t\t\t\t\t\t{} as Record<\n\t\t\t\t\t\t\tkeyof typeof tableSchema.columns,\n\t\t\t\t\t\t\tReturnType<typeof mapSQLTypeStringToInputPothosType>\n\t\t\t\t\t\t>,\n\t\t\t\t\t);\n\n\t\t\t\t\treturn {\n\t\t\t\t\t\t...fields,\n\t\t\t\t\t\t...relations,\n\t\t\t\t\t};\n\t\t\t\t},\n\t\t\t});\n\t\t};\n\n\t\tret = implement();\n\t\treferenceStorage.set(inputTypeName, ret);\n\t\treturn ret;\n\t};\n\n\treturn whereArgImplementer;\n};\n\nexport type NumberWhereInputArgument = {\n\teq?: number;\n\tne?: number;\n\tgt?: number;\n\tgte?: number;\n\tlt?: number;\n\tlte?: number;\n\tin?: number[];\n\tnotIn?: number[];\n\tlike?: string;\n\tilike?: string;\n\tnotLike?: string;\n\tnotIlike?: string;\n\tisNull?: boolean;\n\tisNotNull?: boolean;\n\tarrayOverlaps?: number[];\n\tarrayContained?: number[];\n\tarrayContains?: number[];\n\tAND?: NumberWhereInputArgument[];\n\tOR?: NumberWhereInputArgument[];\n\tNOT?: NumberWhereInputArgument;\n};\n\nexport type StringWhereInputArgument = {\n\teq?: string;\n\tne?: string;\n\tgt?: string;\n\tgte?: string;\n\tlt?: string;\n\tlte?: string;\n\tin?: string[];\n\tnotIn?: string[];\n\tlike?: string;\n\tilike?: string;\n\tnotLike?: string;\n\tnotIlike?: string;\n\tisNull?: boolean;\n\tisNotNull?: boolean;\n\tarrayOverlaps?: string[];\n\tarrayContained?: string[];\n\tarrayContains?: string[];\n\tAND?: StringWhereInputArgument[];\n\tOR?: StringWhereInputArgument[];\n\tNOT?: StringWhereInputArgument;\n};\n\nexport type DateWhereInputArgument = {\n\teq?: Date;\n\tne?: Date;\n\tgt?: Date;\n\tgte?: Date;\n\tlt?: Date;\n\tlte?: Date;\n\tin?: Date[];\n\tnotIn?: Date[];\n\tlike?: string;\n\tilike?: string;\n\tnotLike?: string;\n\tnotIlike?: string;\n\tisNull?: boolean;\n\tisNotNull?: boolean;\n\tarrayOverlaps?: Date[];\n\tarrayContained?: Date[];\n\tarrayContains?: Date[];\n\tAND?: DateWhereInputArgument[];\n\tOR?: DateWhereInputArgument[];\n\tNOT?: DateWhereInputArgument;\n};\n\nexport function implementDefaultWhereInputArgs<\n\tUserContext extends Record<string, any>,\n\tDB extends GenericDrizzleDbTypeConstraints,\n\tRequestEvent extends Record<string, any>,\n\tAction extends string,\n\tPothosConfig extends CustomRumblePothosConfig,\n\tT extends SchemaBuilderType<\n\t\tUserContext,\n\t\tDB,\n\t\tRequestEvent,\n\t\tAction,\n\t\tPothosConfig\n\t>,\n>(schemaBuilder: T) {\n\tconst IntWhereInputArgument = schemaBuilder\n\t\t.inputRef<NumberWhereInputArgument>(\"IntWhereInputArgument\")\n\t\t.implement({\n\t\t\tfields: (t) => ({\n\t\t\t\teq: t.int(),\n\t\t\t\tne: t.int(),\n\t\t\t\tgt: t.int(),\n\t\t\t\tgte: t.int(),\n\t\t\t\tlt: t.int(),\n\t\t\t\tlte: t.int(),\n\t\t\t\tin: t.intList(),\n\t\t\t\tnotIn: t.intList(),\n\t\t\t\tlike: t.string(),\n\t\t\t\tilike: t.string(),\n\t\t\t\tnotLike: t.string(),\n\t\t\t\tnotIlike: t.string(),\n\t\t\t\tisNull: t.boolean(),\n\t\t\t\tisNotNull: t.boolean(),\n\t\t\t\tarrayOverlaps: t.intList(),\n\t\t\t\tarrayContained: t.intList(),\n\t\t\t\tarrayContains: t.intList(),\n\t\t\t\tAND: t.field({\n\t\t\t\t\ttype: [IntWhereInputArgument],\n\t\t\t\t}),\n\t\t\t\tOR: t.field({\n\t\t\t\t\ttype: [IntWhereInputArgument],\n\t\t\t\t}),\n\t\t\t\tNOT: t.field({\n\t\t\t\t\ttype: IntWhereInputArgument,\n\t\t\t\t}),\n\t\t\t}),\n\t\t});\n\n\tconst FloatWhereInputArgument = schemaBuilder\n\t\t.inputRef<NumberWhereInputArgument>(\"FloatWhereInputArgument\")\n\t\t.implement({\n\t\t\tfields: (t) => ({\n\t\t\t\teq: t.float(),\n\t\t\t\tne: t.float(),\n\t\t\t\tgt: t.float(),\n\t\t\t\tgte: t.float(),\n\t\t\t\tlt: t.float(),\n\t\t\t\tlte: t.float(),\n\t\t\t\tin: t.floatList(),\n\t\t\t\tnotIn: t.floatList(),\n\t\t\t\tlike: t.string(),\n\t\t\t\tilike: t.string(),\n\t\t\t\tnotLike: t.string(),\n\t\t\t\tnotIlike: t.string(),\n\t\t\t\tisNull: t.boolean(),\n\t\t\t\tisNotNull: t.boolean(),\n\t\t\t\tarrayOverlaps: t.floatList(),\n\t\t\t\tarrayContained: t.floatList(),\n\t\t\t\tarrayContains: t.floatList(),\n\t\t\t\tAND: t.field({\n\t\t\t\t\ttype: [FloatWhereInputArgument],\n\t\t\t\t}),\n\t\t\t\tOR: t.field({\n\t\t\t\t\ttype: [FloatWhereInputArgument],\n\t\t\t\t}),\n\t\t\t\tNOT: t.field({\n\t\t\t\t\ttype: FloatWhereInputArgument,\n\t\t\t\t}),\n\t\t\t}),\n\t\t});\n\n\tconst StringWhereInputArgument = schemaBuilder\n\t\t.inputRef<StringWhereInputArgument>(\"StringWhereInputArgument\")\n\t\t.implement({\n\t\t\tfields: (t) => ({\n\t\t\t\teq: t.string(),\n\t\t\t\tne: t.string(),\n\t\t\t\tgt: t.string(),\n\t\t\t\tgte: t.string(),\n\t\t\t\tlt: t.string(),\n\t\t\t\tlte: t.string(),\n\t\t\t\tin: t.stringList(),\n\t\t\t\tnotIn: t.stringList(),\n\t\t\t\tlike: t.string(),\n\t\t\t\tilike: t.string(),\n\t\t\t\tnotLike: t.string(),\n\t\t\t\tnotIlike: t.string(),\n\t\t\t\tisNull: t.boolean(),\n\t\t\t\tisNotNull: t.boolean(),\n\t\t\t\tarrayOverlaps: t.stringList(),\n\t\t\t\tarrayContained: t.stringList(),\n\t\t\t\tarrayContains: t.stringList(),\n\t\t\t\tAND: t.field({\n\t\t\t\t\ttype: [StringWhereInputArgument],\n\t\t\t\t}),\n\t\t\t\tOR: t.field({\n\t\t\t\t\ttype: [StringWhereInputArgument],\n\t\t\t\t}),\n\t\t\t\tNOT: t.field({\n\t\t\t\t\ttype: StringWhereInputArgument,\n\t\t\t\t}),\n\t\t\t}),\n\t\t});\n\n\tconst DateWhereInputArgument = schemaBuilder\n\t\t.inputRef<DateWhereInputArgument>(\"DateWhereInputArgument\")\n\t\t.implement({\n\t\t\tfields: (t) => ({\n\t\t\t\teq: t.field({ type: \"Date\" }),\n\t\t\t\tne: t.field({ type: \"Date\" }),\n\t\t\t\tgt: t.field({ type: \"Date\" }),\n\t\t\t\tgte: t.field({ type: \"Date\" }),\n\t\t\t\tlt: t.field({ type: \"Date\" }),\n\t\t\t\tlte: t.field({ type: \"Date\" }),\n\t\t\t\tin: t.field({ type: [\"Date\"] }),\n\t\t\t\tnotIn: t.field({ type: [\"Date\"] }),\n\t\t\t\tlike: t.string(),\n\t\t\t\tilike: t.string(),\n\t\t\t\tnotLike: t.string(),\n\t\t\t\tnotIlike: t.string(),\n\t\t\t\tisNull: t.boolean(),\n\t\t\t\tisNotNull: t.boolean(),\n\t\t\t\tarrayOverlaps: t.field({ type: [\"Date\"] }),\n\t\t\t\tarrayContained: t.field({ type: [\"Date\"] }),\n\t\t\t\tarrayContains: t.field({ type: [\"Date\"] }),\n\t\t\t\tAND: t.field({\n\t\t\t\t\ttype: [DateWhereInputArgument],\n\t\t\t\t}),\n\t\t\t\tOR: t.field({\n\t\t\t\t\ttype: [DateWhereInputArgument],\n\t\t\t\t}),\n\t\t\t\tNOT: t.field({\n\t\t\t\t\ttype: DateWhereInputArgument,\n\t\t\t\t}),\n\t\t\t}),\n\t\t});\n}\n","import SchemaBuilder from \"@pothos/core\";\nimport DrizzlePlugin from \"@pothos/plugin-drizzle\";\nimport SmartSubscriptionsPlugin, {\n\tsubscribeOptionsFromIterator,\n} from \"@pothos/plugin-smart-subscriptions\";\nimport {\n\tDateResolver,\n\tDateTimeISOResolver,\n\tJSONResolver,\n} from \"graphql-scalars\";\nimport type { createPubSub } from \"graphql-yoga\";\nimport type { ContextType } from \"./context\";\nimport ExplicitChecksPlugin from \"./runtimeFiltersPlugin/runtimeFiltersPlugin\";\nimport type { GenericDrizzleDbTypeConstraints } from \"./types/genericDrizzleDbType\";\nimport type {\n\tCustomRumblePothosConfig,\n\tRumbleInput,\n} from \"./types/rumbleInput\";\nimport {\n\ttype DateWhereInputArgument,\n\timplementDefaultWhereInputArgs,\n\ttype NumberWhereInputArgument,\n\ttype StringWhereInputArgument,\n} from \"./whereArg\";\n\nexport type SchemaBuilderType<\n\tUserContext extends Record<string, any>,\n\tDB extends GenericDrizzleDbTypeConstraints,\n\tRequestEvent extends Record<string, any>,\n\tAction extends string,\n\tPothosConfig extends CustomRumblePothosConfig,\n> = ReturnType<\n\ttypeof createSchemaBuilder<\n\t\tUserContext,\n\t\tDB,\n\t\tRequestEvent,\n\t\tAction,\n\t\tPothosConfig\n\t>\n>[\"schemaBuilder\"];\n\nexport const createSchemaBuilder = <\n\tUserContext extends Record<string, any>,\n\tDB extends GenericDrizzleDbTypeConstraints,\n\tRequestEvent extends Record<string, any>,\n\tAction extends string,\n\tPothosConfig extends CustomRumblePothosConfig,\n>({\n\tdb,\n\tdisableDefaultObjects,\n\tpubsub,\n\tpothosConfig,\n}: RumbleInput<UserContext, DB, RequestEvent, Action, PothosConfig> & {\n\tpubsub: ReturnType<typeof createPubSub>;\n}) => {\n\tconst schemaBuilder = new SchemaBuilder<{\n\t\tContext: ContextType<UserContext, DB, RequestEvent, Action, PothosConfig>;\n\t\tDrizzleRelations: DB[\"_\"][\"relations\"];\n\t\tScalars: {\n\t\t\tJSON: {\n\t\t\t\tInput: unknown;\n\t\t\t\tOutput: unknown;\n\t\t\t};\n\t\t\tDate: {\n\t\t\t\tInput: Date;\n\t\t\t\tOutput: Date;\n\t\t\t};\n\t\t\tDateTime: {\n\t\t\t\tInput: Date;\n\t\t\t\tOutput: Date;\n\t\t\t};\n\t\t};\n\t\tInputs: {\n\t\t\tIntWhereInputArgument: NumberWhereInputArgument;\n\t\t\tFloatWhereInputArgument: NumberWhereInputArgument;\n\t\t\tStringWhereInputArgument: StringWhereInputArgument;\n\t\t\tDateWhereInputArgument: DateWhereInputArgument;\n\t\t};\n\t}>({\n\t\t...pothosConfig,\n\t\tplugins: [\n\t\t\tExplicitChecksPlugin,\n\t\t\tDrizzlePlugin,\n\t\t\tSmartSubscriptionsPlugin,\n\t\t\t...(pothosConfig?.plugins ?? []),\n\t\t],\n\t\tdrizzle: {\n\t\t\tclient: db,\n\t\t\trelations: db._.relations,\n\t\t\tgetTableConfig(table) {\n\t\t\t\t//TODO support composite primary keys\n\t\t\t\treturn {\n\t\t\t\t\tcolumns: Object.values((table as any)[Symbol.for(\"drizzle:Columns\")]),\n\t\t\t\t\tprimaryKeys: Object.values(\n\t\t\t\t\t\t(table as any)[Symbol.for(\"drizzle:Columns\")],\n\t\t\t\t\t).filter((v: any) => v.primary),\n\t\t\t\t} as any;\n\t\t\t},\n\t\t},\n\t\tsmartSubscriptions: {\n\t\t\t...subscribeOptionsFromIterator((name, _context) => {\n\t\t\t\treturn pubsub.subscribe(name);\n\t\t\t}),\n\t\t},\n\t});\n\n\tschemaBuilder.addScalarType(\"JSON\", JSONResolver);\n\tschemaBuilder.addScalarType(\"Date\", DateResolver);\n\tschemaBuilder.addScalarType(\"DateTime\", DateTimeISOResolver);\n\timplementDefaultWhereInputArgs(schemaBuilder as any);\n\n\tif (!disableDefaultObjects?.query) {\n\t\tschemaBuilder.queryType({});\n\t}\n\n\tif (!disableDefaultObjects?.subscription) {\n\t\tschemaBuilder.subscriptionType({});\n\t}\n\n\tif (!disableDefaultObjects?.mutation) {\n\t\tschemaBuilder.mutationType({});\n\t}\n\n\treturn { schemaBuilder };\n};\n","import { EnvelopArmorPlugin } from \"@escape.tech/graphql-armor\";\nimport { useDisableIntrospection } from \"@graphql-yoga/plugin-disable-introspection\";\nimport { merge } from \"es-toolkit\";\nimport {\n\tcreateYoga as nativeCreateYoga,\n\ttype YogaServerOptions,\n} from \"graphql-yoga\";\nimport { useSofa } from \"sofa-api\";\nimport { createAbilityBuilder } from \"./abilityBuilder\";\nimport { clientCreatorImplementer } from \"./client/client\";\nimport { createContextFunction } from \"./context\";\nimport { createEnumImplementer } from \"./enum\";\nimport { lazy } from \"./helpers/lazy\";\nimport { sofaOpenAPIWebhookDocs } from \"./helpers/sofaOpenAPIWebhookDocs\";\nimport { createObjectImplementer } from \"./object\";\nimport { createOrderArgImplementer } from \"./orderArg\";\nimport { createPubSubInstance } from \"./pubsub\";\nimport { createQueryImplementer } from \"./query\";\nimport { createSchemaBuilder } from \"./schemaBuilder\";\nimport { initSearchIfApplicable } from \"./search\";\nimport type { GenericDrizzleDbTypeConstraints } from \"./types/genericDrizzleDbType\";\nimport type {\n\tCustomRumblePothosConfig,\n\tRumbleInput,\n} from \"./types/rumbleInput\";\nimport { createWhereArgImplementer } from \"./whereArg\";\n\nexport const rumble = <\n\tUserContext extends Record<string, any>,\n\tDB extends GenericDrizzleDbTypeConstraints,\n\tRequestEvent extends Record<string, any>,\n\tPothosConfig extends CustomRumblePothosConfig,\n\tAction extends string = \"read\" | \"update\" | \"delete\",\n>(\n\trumbleInput: RumbleInput<UserContext, DB, RequestEvent, Action, PothosConfig>,\n) => {\n\t// to be able to iterate over the actions, we populate the actions array in case the user does not\n\tif (!rumbleInput.actions) {\n\t\trumbleInput.actions = [\"read\", \"update\", \"delete\"] as Action[];\n\t}\n\n\tif (rumbleInput.defaultLimit === undefined) {\n\t\trumbleInput.defaultLimit = 100;\n\t}\n\n\tif (rumbleInput.search?.enabled) {\n\t\tinitSearchIfApplicable(rumbleInput.db);\n\t}\n\n\tconst abilityBuilder = createAbilityBuilder<\n\t\tUserContext,\n\t\tDB,\n\t\tRequestEvent,\n\t\tAction,\n\t\tPothosConfig\n\t>(rumbleInput);\n\n\tconst context = createContextFunction<\n\t\tUserContext,\n\t\tDB,\n\t\tRequestEvent,\n\t\tAction,\n\t\tPothosConfig,\n\t\ttypeof abilityBuilder\n\t>({\n\t\t...rumbleInput,\n\t\tabilityBuilder,\n\t});\n\n\tconst { makePubSubInstance, pubsub } = createPubSubInstance<\n\t\tUserContext,\n\t\tDB,\n\t\tRequestEvent,\n\t\tAction,\n\t\tPothosConfig\n\t>({\n\t\t...rumbleInput,\n\t});\n\n\tconst { schemaBuilder } = createSchemaBuilder<\n\t\tUserContext,\n\t\tDB,\n\t\tRequestEvent,\n\t\tAction,\n\t\tPothosConfig\n\t>({ ...rumbleInput, pubsub });\n\tconst enum_ = createEnumImplementer<\n\t\tUserContext,\n\t\tDB,\n\t\tRequestEvent,\n\t\tAction,\n\t\tPothosConfig,\n\t\ttypeof schemaBuilder\n\t>({\n\t\t...rumbleInput,\n\t\tschemaBuilder,\n\t});\n\tconst whereArg = createWhereArgImplementer<\n\t\tUserContext,\n\t\tDB,\n\t\tRequestEvent,\n\t\tAction,\n\t\tPothosConfig,\n\t\ttypeof schemaBuilder,\n\t\ttypeof enum_\n\t>({\n\t\t...rumbleInput,\n\t\tschemaBuilder,\n\t\tenumImplementer: enum_,\n\t});\n\tconst orderArg = createOrderArgImplementer<\n\t\tUserContext,\n\t\tDB,\n\t\tRequestEvent,\n\t\tAction,\n\t\tPothosConfig,\n\t\ttypeof schemaBuilder\n\t>({\n\t\t...rumbleInput,\n\t\tschemaBuilder,\n\t});\n\tconst object = createObjectImplementer<\n\t\tUserContext,\n\t\tDB,\n\t\tRequestEvent,\n\t\tAction,\n\t\tPothosConfig,\n\t\ttypeof schemaBuilder,\n\t\ttypeof whereArg,\n\t\ttypeof orderArg,\n\t\ttypeof enum_,\n\t\ttypeof makePubSubInstance,\n\t\ttypeof abilityBuilder\n\t>({\n\t\t...rumbleInput,\n\t\tschemaBuilder,\n\t\tmakePubSubInstance,\n\t\twhereArgImplementer: whereArg,\n\t\torderArgImplementer: orderArg,\n\t\tenumImplementer: enum_,\n\t\tabilityBuilder,\n\t});\n\tconst query = createQueryImplementer<\n\t\tUserContext,\n\t\tDB,\n\t\tRequestEvent,\n\t\tAction,\n\t\tPothosConfig,\n\t\ttypeof schemaBuilder,\n\t\ttypeof whereArg,\n\t\ttypeof orderArg,\n\t\ttypeof makePubSubInstance\n\t>({\n\t\t...rumbleInput,\n\t\tschemaBuilder,\n\t\twhereArgImplementer: whereArg,\n\t\torderArgImplementer: orderArg,\n\t\tmakePubSubInstance,\n\t});\n\n\tconst builtSchema = lazy(() => schemaBuilder.toSchema());\n\n\tconst createYoga = (\n\t\targs?:\n\t\t\t| (Omit<YogaServerOptions<RequestEvent, any>, \"schema\" | \"context\"> & {\n\t\t\t\t\t/**\n\t\t\t\t\t * Determines if the API should disclose various things about its structure.\n\t\t\t\t\t * Defaults to `process.env.NODE_ENV === \"development\"`.\n\t\t\t\t\t * If enabled, the api will allow introspection requests, provide the graphiql\n\t\t\t\t\t * explorer and will not apply the additional envelop armor plugin.\n\t\t\t\t\t */\n\t\t\t\t\tenableApiDocs?: boolean;\n\t\t\t })\n\t\t\t| undefined,\n\t) => {\n\t\tconst enableApiDocs =\n\t\t\targs?.enableApiDocs ?? process?.env?.NODE_ENV === \"development\" ?? false;\n\n\t\treturn nativeCreateYoga<RequestEvent>({\n\t\t\t...args,\n\t\t\tgraphiql: enableApiDocs,\n\t\t\tplugins: [\n\t\t\t\t...(args?.plugins ?? []),\n\t\t\t\t...(enableApiDocs\n\t\t\t\t\t? []\n\t\t\t\t\t: [useDisableIntrospection(), EnvelopArmorPlugin()]),\n\t\t\t].filter(Boolean),\n\t\t\tschema: builtSchema(),\n\t\t\tcontext,\n\t\t});\n\t};\n\n\tconst createSofa = (\n\t\targs: Omit<Parameters<typeof useSofa>[0], \"schema\" | \"context\">,\n\t) => {\n\t\tif (args.openAPI) {\n\t\t\tmerge(args.openAPI, sofaOpenAPIWebhookDocs);\n\t\t}\n\t\treturn useSofa({\n\t\t\t...args,\n\t\t\tschema: builtSchema(),\n\t\t\tcontext,\n\t\t});\n\t};\n\n\tconst clientCreator = clientCreatorImplementer<\n\t\tUserContext,\n\t\tDB,\n\t\tRequestEvent,\n\t\tAction,\n\t\tPothosConfig,\n\t\ttypeof schemaBuilder\n\t>({\n\t\t...rumbleInput,\n\t\tbuiltSchema,\n\t});\n\n\treturn {\n\t\t/**\n * The ability builder. Use it to declare whats allowed for each entity in your DB.\n * \n * @example\n * \n * ```ts\n * // users can edit themselves\n abilityBuilder.users\n .allow([\"read\", \"update\", \"delete\"])\n .when(({ userId }) => ({ where: eq(schema.users.id, userId) }));\n \n // everyone can read posts\n abilityBuilder.posts.allow(\"read\");\n * \n * ```\n */\n\t\tabilityBuilder,\n\t\t/**\n\t\t * The pothos schema builder. See https://pothos-graphql.dev/docs/plugins/drizzle\n\t\t */\n\t\tschemaBuilder,\n\t\t/**\n * Creates the native yoga instance. Can be used to run an actual HTTP server.\n * \n * @example\n * \n * ```ts\n\t * \n import { createServer } from \"node:http\";\n\t\t* const server = createServer(createYoga());\n\t\tserver.listen(3000, () => {\n console.info(\"Visit http://localhost:3000/graphql\");\n\t\t\t});\n\t\t\t* ```\n\t * https://the-guild.dev/graphql/yoga-server/docs#server\n */\n\t\tcreateYoga,\n\t\t/**\n\t\t * Creates a sofa instance to offer a REST API.\n\t\t```ts\n\t\timport express from 'express';\n\t\t\n\t\tconst app = express();\n\t\tconst sofa = createSofa(...);\n\t\t\n\t\tapp.use('/api', useSofa({ schema }));\n\t\t```\n\t\t* https://the-guild.dev/graphql/sofa-api/docs#usage\n\t\t */\n\t\tcreateSofa,\n\t\t/**\n\t\t * A function for creating default objects for your schema\n\t\t */\n\t\tobject,\n\t\t/**\n\t\t * A function for creating where args to filter entities\n\t\t */\n\t\twhereArg,\n\t\t/**\n\t\t * A function for creating order args to sort entities\n\t\t */\n\t\torderArg,\n\t\t/**\n\t\t * A function for creating default READ queries.\n\t\t * Make sure the objects for the table you are creating the queries for are implemented\n\t\t */\n\t\tquery,\n\t\t/**\n\t\t * A function for creating a pubsub instance for a table. Use this to publish or subscribe events\n\t\t */\n\t\tpubsub: makePubSubInstance,\n\t\t/**\n\t\t * A function to implement enums for graphql usage.\n\t\t * The other helpers use this helper internally so in most cases you do not have to\n\t\t * call this helper directly, unless you need the reference to an enum type\n\t\t */\n\t\tenum_,\n\t\t/**\n\t\t * Create a client to consume a rumble graphql api at the specified location.\n\t\t * Requires GraphQL, does not work with the SOFA REST API.\n\t\t */\n\t\tclientCreator,\n\t};\n};\n"]}
1
+ {"version":3,"sources":["../lib/client/generate/client.ts","../node_modules/graphql/jsutils/devAssert.mjs","../node_modules/graphql/jsutils/isObjectLike.mjs","../node_modules/graphql/jsutils/invariant.mjs","../node_modules/graphql/language/location.mjs","../node_modules/graphql/language/printLocation.mjs","../node_modules/graphql/error/GraphQLError.mjs","../node_modules/graphql/language/ast.mjs","../node_modules/graphql/language/kinds.mjs","../node_modules/graphql/language/characterClasses.mjs","../node_modules/graphql/language/blockString.mjs","../node_modules/graphql/jsutils/inspect.mjs","../node_modules/graphql/jsutils/instanceOf.mjs","../node_modules/graphql/jsutils/didYouMean.mjs","../node_modules/graphql/jsutils/identityFunc.mjs","../node_modules/graphql/jsutils/keyMap.mjs","../node_modules/graphql/jsutils/keyValMap.mjs","../node_modules/graphql/jsutils/mapValue.mjs","../node_modules/graphql/jsutils/naturalCompare.mjs","../node_modules/graphql/jsutils/suggestionList.mjs","../node_modules/graphql/jsutils/toObjMap.mjs","../node_modules/graphql/language/printString.mjs","../node_modules/graphql/language/visitor.mjs","../node_modules/graphql/language/printer.mjs","../node_modules/graphql/utilities/valueFromASTUntyped.mjs","../node_modules/graphql/type/assertName.mjs","../node_modules/graphql/type/definition.mjs","../lib/client/generate/tsRepresentation.ts","../lib/client/generate/generate.ts","../lib/client/request.ts","../lib/client/liveQuery.ts","../lib/client/mutation.ts","../lib/client/query.ts","../lib/client/subscription.ts","../lib/types/rumbleError.ts","../lib/helpers/helper.ts","../lib/helpers/lazy.ts","../lib/helpers/sqlTypes/types.ts","../lib/helpers/sqlTypes/distinctValuesFromSQLType.ts","../lib/helpers/tableHelpers.ts","../lib/abilityBuilder.ts","../lib/client/client.ts","../lib/context.ts","../lib/enum.ts","../lib/helpers/sofaOpenAPIWebhookDocs.ts","../lib/helpers/sqlTypes/mapSQLTypeToTSType.ts","../lib/helpers/determineDialectFromSchema.ts","../lib/search.ts","../lib/object.ts","../lib/orderArg.ts","../lib/pubsub.ts","../lib/query.ts","../lib/runtimeFiltersPlugin/runtimeFiltersPlugin.ts","../lib/whereArg.ts","../lib/schemaBuilder.ts","../lib/rumble.ts"],"names":["generateClient","apiUrl","rumbleImportPath","useExternalUrqlClient","availableSubscriptions","imports","code","value","devAssert","condition","message","isObjectLike","invariant","LineRegExp","getLocation","source","position","lastLineStart","line","match","printLocation","location","printSourceLocation","sourceLocation","firstLineColumnOffset","body","lineIndex","lineOffset","lineNum","columnOffset","columnNum","locationStr","lines","locationLine","subLineIndex","subLineColumnNum","subLines","i","printPrefixedLines","subLine","existingLines","_","padLen","prefix","toNormalizedOptions","args","firstArg","GraphQLError","_GraphQLError","rawArgs","_this$nodes","_nodeLocations$","_ref","nodes","positions","path","originalError","extensions","undefinedIfEmpty","nodeLocations","node","loc","pos","originalExtensions","output","formattedError","array","QueryDocumentKeys","kindValues","isNode","maybeNode","maybeKind","OperationTypeNode","Kind","isWhiteSpace","isDigit","isLetter","isNameStart","isNameContinue","printBlockString","options","escapedValue","isSingleLine","forceLeadingNewLine","hasTrailingTripleQuotes","hasTrailingQuote","hasTrailingSlash","forceTrailingNewline","printAsMultipleLines","result","skipLeadingNewLine","inspect","formatValue","seenValues","formatObjectValue","previouslySeenValues","isJSONable","jsonValue","formatArray","formatObject","object","entries","getObjectTag","key","len","remaining","items","tag","name","isProduction","instanceOf","constructor","_value$constructor","className","valueClassName","stringifiedValue","didYouMean","secondArg","subMessage","suggestionsArg","suggestions","x","selected","lastItem","identityFunc","keyMap","list","keyFn","item","keyValMap","valFn","mapValue","map","fn","naturalCompare","aStr","bStr","aIndex","bIndex","aChar","bChar","aNum","DIGIT_0","bNum","DIGIT_9","suggestionList","input","optionsByDistance","lexicalDistance","LexicalDistance","threshold","option","distance","a","b","distanceDiff","stringToArray","optionLowerCase","tmp","aLength","bLength","rows","j","upRow","currentRow","smallestCell","cost","currentCell","doubleDiagonalCell","str","strLength","toObjMap","obj","printString","escapedRegExp","escapedReplacer","escapeSequences","BREAK","visit","root","visitor","visitorKeys","enterLeaveMap","kind","getEnterLeaveForKind","stack","inArray","keys","index","edits","parent","ancestors","isLeaving","isEdited","editOffset","editKey","editValue","arrayKey","_enterLeaveMap$get","_enterLeaveMap$get2","visitFn","_node$kind","kindVisitor","print","ast","printDocASTReducer","MAX_LINE_LENGTH","join","varDefs","wrap","variable","type","defaultValue","directives","selections","block","alias","selectionSet","argsLine","indent","typeCondition","variableDefinitions","isBlockString","values","fields","description","operationTypes","operation","interfaces","hasMultilineItems","types","repeatable","locations","maybeArray","separator","_maybeArray$filter$jo","start","maybeString","end","_maybeArray$some","valueFromASTUntyped","valueNode","variables","field","assertName","assertEnumValueName","isType","isScalarType","isObjectType","isInterfaceType","isUnionType","isEnumType","isInputObjectType","isListType","isNonNullType","GraphQLScalarType","GraphQLObjectType","GraphQLInterfaceType","GraphQLUnionType","GraphQLEnumType","GraphQLInputObjectType","GraphQLList","GraphQLNonNull","ofType","isNullableType","resolveReadonlyArrayThunk","thunk","resolveObjMapThunk","config","_config$parseValue","_config$serialize","_config$parseLiteral","_config$extensionASTN","parseValue","_config$extensionASTN2","defineFieldMap","defineInterfaces","fieldsToFieldsConfig","_config$interfaces","fieldMap","isPlainObj","fieldConfig","fieldName","_fieldConfig$args","argsConfig","defineArguments","argName","argConfig","argsToArgsConfig","arg","_config$extensionASTN3","_config$extensionASTN4","defineTypes","_config$extensionASTN5","defineEnumValues","outputValue","enumValue","inputValue","valueStr","didYouMeanEnumValue","_variables","enumType","unknownValueStr","allNames","suggestedValues","typeName","valueMap","valueName","valueConfig","_config$extensionASTN6","_config$isOneOf","defineInputFieldMap","makeTSRepresentation","model","makeTSTypeFromObject","mapGraphqlScalarToTSTypeString","makeStringLiteralUnionFromEnum","makeTSTypeFromInputObject","stringifiedFields","makeTSObjectTypeField","makeTSInputObjectTypeField","returnType","isNonNullReturnType","isList","returnTypeString","isRelationType","argsStringMap","stringifyTSObjectArg","makePOptional","ret","isNullable","generateFromSchema","outputPath","schema","access","rm","mkdir","typeMap","c","writeFile","argsKey","makeGraphQLQuery","queryName","client","enableSubscription","otwQueryName","capitalize","argsString","stringifyArgumentObjectToGraphqlList","operationString","operationVerb","stringifySelection","awaitedReturnValueReference","response","pipe","merge","empty","v","data","onPush","promise","resolve","unsub","toObservable","newObservableWithAwaitedValue","fromValue","makeGraphQLMutation","mutationName","otwMutationName","observable","toPromise","res","makeGraphQLSubscription","subscriptionName","otwSubscriptionName","selection","acc","stringifyArgumentValue","makeLiveQuery","urqlClient","_target","prop","makeMutation","makeQuery","makeSubscription","RumbleError","RumbleErrorSafe","assertFindFirstExists","assertFirstEntryExists","applyFilters","filters","entities","context","f","val","mapNullFieldsToUndefined","lazy","initializer","initialized","UnknownTypeRumbleError","sqlType","additionalInfo","createDistinctValuesFromSQLType","nameSymbol","columnsSymbol","tableHelper","dbName","tsName","table","db","tableSchema","k","isSimpleQueryFilter","filter","isFunctionFilter","nothingRegisteredWarningLogger","debounce","action","createAbilityBuilder","actions","defaultLimit","registrators","registeredQueryFilters","registeredRuntimeFilters","createRegistrator","tableName","queryFiltersPerEntity","queryFiltersPerEntityAndAction","queryFilter","explicitFilter","entityKey","userContext","builder","createEntityObject","transformToResponse","queryFilters","where","transformedWhere","relationsFilterToSQL","limit","columns","r","getBlockEverythingFilter","primaryKeyField","distinctValues","simpleQueryFilters","functionQueryFilters","someWildcardFound","allQueryFilters","e","highestLimit","conditionObject","combinedAllowedColumns","accumulatedWhereConditions","o","combinedWhere","clientCreatorImplementer","builtSchema","createContextFunction","makeUserContext","abilityBuilder","req","isEnumSchema","schemaType","PgEnumColumn","createEnumImplementer","schemaBuilder","referenceStorage","enumColumn","refName","enumSchemaName","enumValues","schemaEnum","enumCol","s","schemaEnumEntry","graphqlImplementationName","toCamelCase","sofaOpenAPIWebhookDocs","mapSQLTypeToGraphQLType","determineDBDialectFromSchema","found","PgTable","MySqlTable","SQLiteTable","dialects","isPostgresDB","initSearchIfApplicable","sql","adjustQueryForSearch","search","abilities","originalOrderBy","cloneDeep","argsOrderBySQL","columnsToSearch","searchSQL","originalWhere","isProbablyAConfigObject","t","createObjectImplementer","makePubSubInstance","whereArgImplementer","orderArgImplementer","enumImplementer","readAction","adjust","primaryKey","registerOnInstance","subscriptions","element","_context","primaryKeyValue","mapSQLTypeStringToExposedPothosType","columnName","nullable","gqlType","configMap","userAdjustments","target","params","ref","configObject","creatorFunction","enumImpl","relations","relationSchema","WhereArg","OrderArg","relationTablePubSub","isMany","filterSpecifier","One","subscribe","_element","plural","singular","ctx","makeDefaultName","createOrderArgImplementer","sortingParameterEnumRef","inputTypeName","referenceModel","SUBSCRIPTION_NOTIFIER_RUMBLE_PREFIX","SUBSCRIPTION_NOTIFIER_REMOVED","SUBSCRIPTION_NOTIFIER_UPDATED","SUBSCRIPTION_NOTIFIER_CREATED","createPubSubInstance","pubsub","createPubSub","makePubSubKey","actionKey","instance","uniqueKeys","createQueryImplementer","listAction","manyArgs","_root","_args","_ctx","_info","query","queryInstance","pluginName","runtimeFiltersPlugin_default","applyFiltersKey","ManualFiltersPlugin","BasePlugin","resolver","info","fieldType","resolved","allResolvedValues","allFilters","allowed","SchemaBuilder","createWhereArgImplementer","mapSQLTypeStringToInputPothosType","implementDefaultWhereInputArgs","IntWhereInputArgument","FloatWhereInputArgument","StringWhereInputArgument","DateWhereInputArgument","createSchemaBuilder","disableDefaultObjects","pothosConfig","DrizzlePlugin","SmartSubscriptionsPlugin","subscribeOptionsFromIterator","JSONResolver","DateResolver","DateTimeISOResolver","rumble","rumbleInput","enum_","whereArg","orderArg","createYoga","enableApiDocs","nativeCreateYoga","useDisableIntrospection","EnvelopArmorPlugin","createSofa","useSofa","clientCreator"],"mappings":"s9BAAO,SAASA,EAAAA,CAAe,CAC9B,MAAA,CAAAC,CAAAA,CACA,gBAAA,CAAAC,CAAAA,CACA,qBAAA,CAAAC,CAAAA,CACA,sBAAA,CAAAC,CACD,CAAA,CAKG,CACF,IAAMC,CAAAA,CAAoB,EAAC,CACvBC,CAAAA,CAAe,EAAA,CAEnB,OAAI,OAAOH,CAAAA,EAA0B,QAAA,CACpCE,CAAAA,CAAQ,IAAA,CAAK,CAAA,4BAAA,EAA+BF,CAAqB,CAAA,EAAA,CAAI,CAAA,EAErEE,CAAAA,CAAQ,IAAA,CAAK,qDAAqD,CAAA,CAClEA,CAAAA,CAAQ,IAAA,CAAK,4DAA4D,CAAA,CAAA,CAG1EA,CAAAA,CAAQ,IAAA,CACP,CAAA,0EAAA,EAA6EH,CAAgB,CAAA,EAAA,CAC9F,CAAA,CAEKC,CAAAA,GACJG,CAAAA,EAAQ;AAAA;AAAA,QAAA,EAEAL,GAAU,wEAAwE,CAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,CAAA,CAAA,CAW3FK,CAAAA,EAAQ;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,oCAAA,EAU6BF,CAAAA,CAClC,MAAA,EAAO,CACP,OAAA,EAAQ,CACR,GAAA,CAAKG,CAAAA,EAAU,CAAA,CAAA,EAAIA,CAAK,CAAA,CAAA,CAAG,CAAA,CAC3B,IAAA,CAAK,IAAI,CAAC,CAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,CAAA,CAAA,CAsBN,CACN,OAAA,CAAAF,CAAAA,CACA,IAAA,CAAA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AA,CACA,GACA,EAAA,CACA,EAAA,CACA,EAAA,CACA,EAAA,CACA,GACA,EAAA,CACA,EAAA,CACA,EAAA,CACA,EAAA,CACA,GACA,EAAA,CACA,EAAA,CACA,GACA,EAAA,CACA,EAAA,CACA,GACA,EAAA,CACA,EAAA,CACA,EAAA,CACA,EAAA,CACA,GACA,EAAA,CACA,EAAA,CACA,EAAA,CACA,EAAA,CACA,GACA,EAAA,CACA,EAAA,CACA,EAAA,CACA,EAAA,CACA,GACA,EAAA,CACA,EAAA,CACA,GACA,EAAA,CACA,EAAA,CACA,GACA,EAAA,CACA,MAAA,CACA,EAAA,CACA,EAAA,CACA,GACA,EAAA,CACA,EAAA,CACA,EAAA,CACA,EAAA,CACA,GACA,EAAA,CACA,EAAA,CACA,EAAA,CACA,EAAA,CACA,GACA,EAAA,CACA,EAAA,CACA,EAAA,CACA,EAAA,CACA,GACA,EAAA,CACA,EAAA,CACA,EAAA,CACA,EAAA,CACA,GACA,EAAA,CACA,EAAA,CACA,EAAA,CACA,EAAA,CACA,GACA,EAAA,CACA,EAAA,CACA,EAAA,CACA,EAAA,CACA,GACA,EAAA,CACA,SAAA,CACA,UACA,SAAA,CACA,SAAA,CACA,UACA,SAAA,CACA,SAAA,CACA,SAAA,CACA,SAAA,CACA,UACA,SAAA,CACA,SAAA,CACA,SAAA,CACA,SAAA,CACA,UACA,SAAA,CACA,SAAA,CACA,SAAA,CACA,SAAA,CACA,UACA,SAAA,CACA,SAAA,CACA,UACA,SAAA,CACA,SAAA,CACA,UACA,SAAA,CACA,SAAA,CACA,SAAA,CACA,SAAA,CACA,UACA,SAAA,CACA,SACF,CAAA,CCtKO,IAAMC,GAAQ,MAAA,CAAO,MAAA,CAAO,EAAE,EAgF9B,SAASC,EAAAA,CAAMC,EAAMC,CAAAA,CAASC,CAAAA,CAAclH,GAAmB,CACpE,IAAMmH,CAAAA,CAAgB,IAAI,IAE1B,IAAA,IAAWC,CAAAA,IAAQ,MAAA,CAAO,MAAA,CAAO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,EAAM,aAAA,EAAiB,OAAA,EAAS,GAAA,EAAK,QAAA,GAAa,aAAA,EAAiB,KAAA,CAEpE,OAAO0iB,UAAAA,CAA+B,CACrC,GAAG1iB,CAAAA,CACH,QAAA,CAAUyiB,CAAAA,CACV,OAAA,CAAS,CACR,GAAIziB,CAAAA,EAAM,OAAA,EAAW,EAAC,CACtB,GAAIyiB,CAAAA,CACD,GACA,CAACE,uBAAAA,EAAwB,CAAGC,kBAAAA,EAAoB,CACpD,CAAA,CAAE,MAAA,CAAO,OAAO,CAAA,CAChB,MAAA,CAAQhJ,CAAAA,EAAY,CACpB,OAAA,CAAAjE,CACD,CAAC,CACF,CAAA,CAEMkN,CAAAA,CACL7iB,CAAAA,GAEIA,CAAAA,CAAK,SACRsT,KAAAA,CAAMtT,CAAAA,CAAK,OAAA,CAASib,EAAsB,CAAA,CAEpC6H,OAAAA,CAAQ,CACd,GAAG9iB,CAAAA,CACH,MAAA,CAAQ4Z,CAAAA,EAAY,CACpB,OAAA,CAAAjE,CACD,CAAC,CAAA,CAAA,CAGIoN,CAAAA,CAAgBpJ,EAAAA,CAOpB,CACD,GAAGyI,CAAAA,CACH,YAAAxI,CACD,CAAC,CAAA,CAED,OAAO,CAiBN,cAAA,CAAAG,CAAAA,CAIA,aAAA,CAAAM,CAAAA,CAgBA,UAAA,CAAAmI,CAAAA,CAaA,UAAA,CAAAK,CAAAA,CAIA,MAAA,CAAAtf,EAIA,QAAA,CAAA+e,CAAAA,CAIA,QAAA,CAAAC,CAAAA,CAKA,KAAA,CAAAnC,CAAAA,CAIA,MAAA,CAAQ5D,CAAAA,CAMR,KAAA,CAAA6F,CAAAA,CAKA,aAAA,CAAAU,CACD,CACD","file":"index.js","sourcesContent":["export function generateClient({\n\tapiUrl,\n\trumbleImportPath,\n\tuseExternalUrqlClient,\n\tavailableSubscriptions,\n}: {\n\trumbleImportPath: string;\n\tuseExternalUrqlClient: string | boolean;\n\tapiUrl?: string;\n\tavailableSubscriptions: Set<string>;\n}) {\n\tconst imports: string[] = [];\n\tlet code: string = \"\";\n\n\tif (typeof useExternalUrqlClient === \"string\") {\n\t\timports.push(`import { urqlClient } from \"${useExternalUrqlClient}\";`);\n\t} else {\n\t\timports.push(`import { Client, fetchExchange } from '@urql/core';`);\n\t\timports.push(`import { cacheExchange } from '@urql/exchange-graphcache';`);\n\t}\n\n\timports.push(\n\t\t`import { makeLiveQuery, makeMutation, makeSubscription, makeQuery } from '${rumbleImportPath}';`,\n\t);\n\n\tif (!useExternalUrqlClient) {\n\t\tcode += `\nconst urqlClient = new Client({\n url: \"${apiUrl ?? \"PLEASE PROVIDE A URL WHEN GENERATING OR IMPORT AN EXTERNAL URQL CLIENT\"}\",\n fetchSubscriptions: true,\n exchanges: [cacheExchange({}), fetchExchange],\n fetchOptions: {\n credentials: \"include\",\n },\n requestPolicy: \"cache-and-network\",\n});\n`;\n\t}\n\n\tcode += `\nexport const client = {\n /**\n * A query and subscription combination. First queries and if exists, also subscribes to a subscription of the same name.\n * Combines the results of both, so the result is first the query result and then live updates from the subscription.\n * Assumes that the query and subscription return the same fields as per default when using the rumble query helpers.\n * If no subscription with the same name exists, this will just be a query.\n */\n liveQuery: makeLiveQuery<Query>({\n\t urqlClient,\n\t availableSubscriptions: new Set([${availableSubscriptions\n\t\t\t.values()\n\t\t\t.toArray()\n\t\t\t.map((value) => `\"${value}\"`)\n\t\t\t.join(\", \")}]),\n }),\n /**\n * A mutation that can be used to e.g. create, update or delete data.\n */\n mutate: makeMutation<Mutation>({\n\t urqlClient,\n }),\n /**\n * A continuous stream of results that updates when the server sends new data.\n */\n subscribe: makeSubscription<Subscription>({\n\t urqlClient,\n }),\n /**\n * A one-time fetch of data.\n */\n query: makeQuery<Query>({\n\t urqlClient,\n }),\n}`;\n\n\treturn {\n\t\timports,\n\t\tcode,\n\t};\n}\n","export function devAssert(condition, message) {\n const booleanCondition = Boolean(condition);\n\n if (!booleanCondition) {\n throw new Error(message);\n }\n}\n","/**\n * Return true if `value` is object-like. A value is object-like if it's not\n * `null` and has a `typeof` result of \"object\".\n */\nexport function isObjectLike(value) {\n return typeof value == 'object' && value !== null;\n}\n","export function invariant(condition, message) {\n const booleanCondition = Boolean(condition);\n\n if (!booleanCondition) {\n throw new Error(\n message != null ? message : 'Unexpected invariant triggered.',\n );\n }\n}\n","import { invariant } from '../jsutils/invariant.mjs';\nconst LineRegExp = /\\r\\n|[\\n\\r]/g;\n/**\n * Represents a location in a Source.\n */\n\n/**\n * Takes a Source and a UTF-8 character offset, and returns the corresponding\n * line and column as a SourceLocation.\n */\nexport function getLocation(source, position) {\n let lastLineStart = 0;\n let line = 1;\n\n for (const match of source.body.matchAll(LineRegExp)) {\n typeof match.index === 'number' || invariant(false);\n\n if (match.index >= position) {\n break;\n }\n\n lastLineStart = match.index + match[0].length;\n line += 1;\n }\n\n return {\n line,\n column: position + 1 - lastLineStart,\n };\n}\n","import { getLocation } from './location.mjs';\n\n/**\n * Render a helpful description of the location in the GraphQL Source document.\n */\nexport function printLocation(location) {\n return printSourceLocation(\n location.source,\n getLocation(location.source, location.start),\n );\n}\n/**\n * Render a helpful description of the location in the GraphQL Source document.\n */\n\nexport function printSourceLocation(source, sourceLocation) {\n const firstLineColumnOffset = source.locationOffset.column - 1;\n const body = ''.padStart(firstLineColumnOffset) + source.body;\n const lineIndex = sourceLocation.line - 1;\n const lineOffset = source.locationOffset.line - 1;\n const lineNum = sourceLocation.line + lineOffset;\n const columnOffset = sourceLocation.line === 1 ? firstLineColumnOffset : 0;\n const columnNum = sourceLocation.column + columnOffset;\n const locationStr = `${source.name}:${lineNum}:${columnNum}\\n`;\n const lines = body.split(/\\r\\n|[\\n\\r]/g);\n const locationLine = lines[lineIndex]; // Special case for minified documents\n\n if (locationLine.length > 120) {\n const subLineIndex = Math.floor(columnNum / 80);\n const subLineColumnNum = columnNum % 80;\n const subLines = [];\n\n for (let i = 0; i < locationLine.length; i += 80) {\n subLines.push(locationLine.slice(i, i + 80));\n }\n\n return (\n locationStr +\n printPrefixedLines([\n [`${lineNum} |`, subLines[0]],\n ...subLines.slice(1, subLineIndex + 1).map((subLine) => ['|', subLine]),\n ['|', '^'.padStart(subLineColumnNum)],\n ['|', subLines[subLineIndex + 1]],\n ])\n );\n }\n\n return (\n locationStr +\n printPrefixedLines([\n // Lines specified like this: [\"prefix\", \"string\"],\n [`${lineNum - 1} |`, lines[lineIndex - 1]],\n [`${lineNum} |`, locationLine],\n ['|', '^'.padStart(columnNum)],\n [`${lineNum + 1} |`, lines[lineIndex + 1]],\n ])\n );\n}\n\nfunction printPrefixedLines(lines) {\n const existingLines = lines.filter(([_, line]) => line !== undefined);\n const padLen = Math.max(...existingLines.map(([prefix]) => prefix.length));\n return existingLines\n .map(([prefix, line]) => prefix.padStart(padLen) + (line ? ' ' + line : ''))\n .join('\\n');\n}\n","import { isObjectLike } from '../jsutils/isObjectLike.mjs';\nimport { getLocation } from '../language/location.mjs';\nimport {\n printLocation,\n printSourceLocation,\n} from '../language/printLocation.mjs';\n\nfunction toNormalizedOptions(args) {\n const firstArg = args[0];\n\n if (firstArg == null || 'kind' in firstArg || 'length' in firstArg) {\n return {\n nodes: firstArg,\n source: args[1],\n positions: args[2],\n path: args[3],\n originalError: args[4],\n extensions: args[5],\n };\n }\n\n return firstArg;\n}\n/**\n * A GraphQLError describes an Error found during the parse, validate, or\n * execute phases of performing a GraphQL operation. In addition to a message\n * and stack trace, it also includes information about the locations in a\n * GraphQL document and/or execution result that correspond to the Error.\n */\n\nexport class GraphQLError extends Error {\n /**\n * An array of `{ line, column }` locations within the source GraphQL document\n * which correspond to this error.\n *\n * Errors during validation often contain multiple locations, for example to\n * point out two things with the same name. Errors during execution include a\n * single location, the field which produced the error.\n *\n * Enumerable, and appears in the result of JSON.stringify().\n */\n\n /**\n * An array describing the JSON-path into the execution response which\n * corresponds to this error. Only included for errors during execution.\n *\n * Enumerable, and appears in the result of JSON.stringify().\n */\n\n /**\n * An array of GraphQL AST Nodes corresponding to this error.\n */\n\n /**\n * The source GraphQL document for the first location of this error.\n *\n * Note that if this Error represents more than one node, the source may not\n * represent nodes after the first node.\n */\n\n /**\n * An array of character offsets within the source GraphQL document\n * which correspond to this error.\n */\n\n /**\n * The original error thrown from a field resolver during execution.\n */\n\n /**\n * Extension fields to add to the formatted error.\n */\n\n /**\n * @deprecated Please use the `GraphQLErrorOptions` constructor overload instead.\n */\n constructor(message, ...rawArgs) {\n var _this$nodes, _nodeLocations$, _ref;\n\n const { nodes, source, positions, path, originalError, extensions } =\n toNormalizedOptions(rawArgs);\n super(message);\n this.name = 'GraphQLError';\n this.path = path !== null && path !== void 0 ? path : undefined;\n this.originalError =\n originalError !== null && originalError !== void 0\n ? originalError\n : undefined; // Compute list of blame nodes.\n\n this.nodes = undefinedIfEmpty(\n Array.isArray(nodes) ? nodes : nodes ? [nodes] : undefined,\n );\n const nodeLocations = undefinedIfEmpty(\n (_this$nodes = this.nodes) === null || _this$nodes === void 0\n ? void 0\n : _this$nodes.map((node) => node.loc).filter((loc) => loc != null),\n ); // Compute locations in the source for the given nodes/positions.\n\n this.source =\n source !== null && source !== void 0\n ? source\n : nodeLocations === null || nodeLocations === void 0\n ? void 0\n : (_nodeLocations$ = nodeLocations[0]) === null ||\n _nodeLocations$ === void 0\n ? void 0\n : _nodeLocations$.source;\n this.positions =\n positions !== null && positions !== void 0\n ? positions\n : nodeLocations === null || nodeLocations === void 0\n ? void 0\n : nodeLocations.map((loc) => loc.start);\n this.locations =\n positions && source\n ? positions.map((pos) => getLocation(source, pos))\n : nodeLocations === null || nodeLocations === void 0\n ? void 0\n : nodeLocations.map((loc) => getLocation(loc.source, loc.start));\n const originalExtensions = isObjectLike(\n originalError === null || originalError === void 0\n ? void 0\n : originalError.extensions,\n )\n ? originalError === null || originalError === void 0\n ? void 0\n : originalError.extensions\n : undefined;\n this.extensions =\n (_ref =\n extensions !== null && extensions !== void 0\n ? extensions\n : originalExtensions) !== null && _ref !== void 0\n ? _ref\n : Object.create(null); // Only properties prescribed by the spec should be enumerable.\n // Keep the rest as non-enumerable.\n\n Object.defineProperties(this, {\n message: {\n writable: true,\n enumerable: true,\n },\n name: {\n enumerable: false,\n },\n nodes: {\n enumerable: false,\n },\n source: {\n enumerable: false,\n },\n positions: {\n enumerable: false,\n },\n originalError: {\n enumerable: false,\n },\n }); // Include (non-enumerable) stack trace.\n\n /* c8 ignore start */\n // FIXME: https://github.com/graphql/graphql-js/issues/2317\n\n if (\n originalError !== null &&\n originalError !== void 0 &&\n originalError.stack\n ) {\n Object.defineProperty(this, 'stack', {\n value: originalError.stack,\n writable: true,\n configurable: true,\n });\n } else if (Error.captureStackTrace) {\n Error.captureStackTrace(this, GraphQLError);\n } else {\n Object.defineProperty(this, 'stack', {\n value: Error().stack,\n writable: true,\n configurable: true,\n });\n }\n /* c8 ignore stop */\n }\n\n get [Symbol.toStringTag]() {\n return 'GraphQLError';\n }\n\n toString() {\n let output = this.message;\n\n if (this.nodes) {\n for (const node of this.nodes) {\n if (node.loc) {\n output += '\\n\\n' + printLocation(node.loc);\n }\n }\n } else if (this.source && this.locations) {\n for (const location of this.locations) {\n output += '\\n\\n' + printSourceLocation(this.source, location);\n }\n }\n\n return output;\n }\n\n toJSON() {\n const formattedError = {\n message: this.message,\n };\n\n if (this.locations != null) {\n formattedError.locations = this.locations;\n }\n\n if (this.path != null) {\n formattedError.path = this.path;\n }\n\n if (this.extensions != null && Object.keys(this.extensions).length > 0) {\n formattedError.extensions = this.extensions;\n }\n\n return formattedError;\n }\n}\n\nfunction undefinedIfEmpty(array) {\n return array === undefined || array.length === 0 ? undefined : array;\n}\n/**\n * See: https://spec.graphql.org/draft/#sec-Errors\n */\n\n/**\n * Prints a GraphQLError to a string, representing useful location information\n * about the error's position in the source.\n *\n * @deprecated Please use `error.toString` instead. Will be removed in v17\n */\nexport function printError(error) {\n return error.toString();\n}\n/**\n * Given a GraphQLError, format it according to the rules described by the\n * Response Format, Errors section of the GraphQL Specification.\n *\n * @deprecated Please use `error.toJSON` instead. Will be removed in v17\n */\n\nexport function formatError(error) {\n return error.toJSON();\n}\n","/**\n * Contains a range of UTF-8 character offsets and token references that\n * identify the region of the source from which the AST derived.\n */\nexport class Location {\n /**\n * The character offset at which this Node begins.\n */\n\n /**\n * The character offset at which this Node ends.\n */\n\n /**\n * The Token at which this Node begins.\n */\n\n /**\n * The Token at which this Node ends.\n */\n\n /**\n * The Source document the AST represents.\n */\n constructor(startToken, endToken, source) {\n this.start = startToken.start;\n this.end = endToken.end;\n this.startToken = startToken;\n this.endToken = endToken;\n this.source = source;\n }\n\n get [Symbol.toStringTag]() {\n return 'Location';\n }\n\n toJSON() {\n return {\n start: this.start,\n end: this.end,\n };\n }\n}\n/**\n * Represents a range of characters represented by a lexical token\n * within a Source.\n */\n\nexport class Token {\n /**\n * The kind of Token.\n */\n\n /**\n * The character offset at which this Node begins.\n */\n\n /**\n * The character offset at which this Node ends.\n */\n\n /**\n * The 1-indexed line number on which this Token appears.\n */\n\n /**\n * The 1-indexed column number at which this Token begins.\n */\n\n /**\n * For non-punctuation tokens, represents the interpreted value of the token.\n *\n * Note: is undefined for punctuation tokens, but typed as string for\n * convenience in the parser.\n */\n\n /**\n * Tokens exist as nodes in a double-linked-list amongst all tokens\n * including ignored tokens. <SOF> is always the first node and <EOF>\n * the last.\n */\n constructor(kind, start, end, line, column, value) {\n this.kind = kind;\n this.start = start;\n this.end = end;\n this.line = line;\n this.column = column; // eslint-disable-next-line @typescript-eslint/no-non-null-assertion\n\n this.value = value;\n this.prev = null;\n this.next = null;\n }\n\n get [Symbol.toStringTag]() {\n return 'Token';\n }\n\n toJSON() {\n return {\n kind: this.kind,\n value: this.value,\n line: this.line,\n column: this.column,\n };\n }\n}\n/**\n * The list of all possible AST node types.\n */\n\n/**\n * @internal\n */\nexport const QueryDocumentKeys = {\n Name: [],\n Document: ['definitions'],\n OperationDefinition: [\n 'name',\n 'variableDefinitions',\n 'directives',\n 'selectionSet',\n ],\n VariableDefinition: ['variable', 'type', 'defaultValue', 'directives'],\n Variable: ['name'],\n SelectionSet: ['selections'],\n Field: ['alias', 'name', 'arguments', 'directives', 'selectionSet'],\n Argument: ['name', 'value'],\n FragmentSpread: ['name', 'directives'],\n InlineFragment: ['typeCondition', 'directives', 'selectionSet'],\n FragmentDefinition: [\n 'name', // Note: fragment variable definitions are deprecated and will removed in v17.0.0\n 'variableDefinitions',\n 'typeCondition',\n 'directives',\n 'selectionSet',\n ],\n IntValue: [],\n FloatValue: [],\n StringValue: [],\n BooleanValue: [],\n NullValue: [],\n EnumValue: [],\n ListValue: ['values'],\n ObjectValue: ['fields'],\n ObjectField: ['name', 'value'],\n Directive: ['name', 'arguments'],\n NamedType: ['name'],\n ListType: ['type'],\n NonNullType: ['type'],\n SchemaDefinition: ['description', 'directives', 'operationTypes'],\n OperationTypeDefinition: ['type'],\n ScalarTypeDefinition: ['description', 'name', 'directives'],\n ObjectTypeDefinition: [\n 'description',\n 'name',\n 'interfaces',\n 'directives',\n 'fields',\n ],\n FieldDefinition: ['description', 'name', 'arguments', 'type', 'directives'],\n InputValueDefinition: [\n 'description',\n 'name',\n 'type',\n 'defaultValue',\n 'directives',\n ],\n InterfaceTypeDefinition: [\n 'description',\n 'name',\n 'interfaces',\n 'directives',\n 'fields',\n ],\n UnionTypeDefinition: ['description', 'name', 'directives', 'types'],\n EnumTypeDefinition: ['description', 'name', 'directives', 'values'],\n EnumValueDefinition: ['description', 'name', 'directives'],\n InputObjectTypeDefinition: ['description', 'name', 'directives', 'fields'],\n DirectiveDefinition: ['description', 'name', 'arguments', 'locations'],\n SchemaExtension: ['directives', 'operationTypes'],\n ScalarTypeExtension: ['name', 'directives'],\n ObjectTypeExtension: ['name', 'interfaces', 'directives', 'fields'],\n InterfaceTypeExtension: ['name', 'interfaces', 'directives', 'fields'],\n UnionTypeExtension: ['name', 'directives', 'types'],\n EnumTypeExtension: ['name', 'directives', 'values'],\n InputObjectTypeExtension: ['name', 'directives', 'fields'],\n};\nconst kindValues = new Set(Object.keys(QueryDocumentKeys));\n/**\n * @internal\n */\n\nexport function isNode(maybeNode) {\n const maybeKind =\n maybeNode === null || maybeNode === void 0 ? void 0 : maybeNode.kind;\n return typeof maybeKind === 'string' && kindValues.has(maybeKind);\n}\n/** Name */\n\nvar OperationTypeNode;\n\n(function (OperationTypeNode) {\n OperationTypeNode['QUERY'] = 'query';\n OperationTypeNode['MUTATION'] = 'mutation';\n OperationTypeNode['SUBSCRIPTION'] = 'subscription';\n})(OperationTypeNode || (OperationTypeNode = {}));\n\nexport { OperationTypeNode };\n","/**\n * The set of allowed kind values for AST nodes.\n */\nvar Kind;\n\n(function (Kind) {\n Kind['NAME'] = 'Name';\n Kind['DOCUMENT'] = 'Document';\n Kind['OPERATION_DEFINITION'] = 'OperationDefinition';\n Kind['VARIABLE_DEFINITION'] = 'VariableDefinition';\n Kind['SELECTION_SET'] = 'SelectionSet';\n Kind['FIELD'] = 'Field';\n Kind['ARGUMENT'] = 'Argument';\n Kind['FRAGMENT_SPREAD'] = 'FragmentSpread';\n Kind['INLINE_FRAGMENT'] = 'InlineFragment';\n Kind['FRAGMENT_DEFINITION'] = 'FragmentDefinition';\n Kind['VARIABLE'] = 'Variable';\n Kind['INT'] = 'IntValue';\n Kind['FLOAT'] = 'FloatValue';\n Kind['STRING'] = 'StringValue';\n Kind['BOOLEAN'] = 'BooleanValue';\n Kind['NULL'] = 'NullValue';\n Kind['ENUM'] = 'EnumValue';\n Kind['LIST'] = 'ListValue';\n Kind['OBJECT'] = 'ObjectValue';\n Kind['OBJECT_FIELD'] = 'ObjectField';\n Kind['DIRECTIVE'] = 'Directive';\n Kind['NAMED_TYPE'] = 'NamedType';\n Kind['LIST_TYPE'] = 'ListType';\n Kind['NON_NULL_TYPE'] = 'NonNullType';\n Kind['SCHEMA_DEFINITION'] = 'SchemaDefinition';\n Kind['OPERATION_TYPE_DEFINITION'] = 'OperationTypeDefinition';\n Kind['SCALAR_TYPE_DEFINITION'] = 'ScalarTypeDefinition';\n Kind['OBJECT_TYPE_DEFINITION'] = 'ObjectTypeDefinition';\n Kind['FIELD_DEFINITION'] = 'FieldDefinition';\n Kind['INPUT_VALUE_DEFINITION'] = 'InputValueDefinition';\n Kind['INTERFACE_TYPE_DEFINITION'] = 'InterfaceTypeDefinition';\n Kind['UNION_TYPE_DEFINITION'] = 'UnionTypeDefinition';\n Kind['ENUM_TYPE_DEFINITION'] = 'EnumTypeDefinition';\n Kind['ENUM_VALUE_DEFINITION'] = 'EnumValueDefinition';\n Kind['INPUT_OBJECT_TYPE_DEFINITION'] = 'InputObjectTypeDefinition';\n Kind['DIRECTIVE_DEFINITION'] = 'DirectiveDefinition';\n Kind['SCHEMA_EXTENSION'] = 'SchemaExtension';\n Kind['SCALAR_TYPE_EXTENSION'] = 'ScalarTypeExtension';\n Kind['OBJECT_TYPE_EXTENSION'] = 'ObjectTypeExtension';\n Kind['INTERFACE_TYPE_EXTENSION'] = 'InterfaceTypeExtension';\n Kind['UNION_TYPE_EXTENSION'] = 'UnionTypeExtension';\n Kind['ENUM_TYPE_EXTENSION'] = 'EnumTypeExtension';\n Kind['INPUT_OBJECT_TYPE_EXTENSION'] = 'InputObjectTypeExtension';\n})(Kind || (Kind = {}));\n\nexport { Kind };\n/**\n * The enum type representing the possible kind values of AST nodes.\n *\n * @deprecated Please use `Kind`. Will be remove in v17.\n */\n","/**\n * ```\n * WhiteSpace ::\n * - \"Horizontal Tab (U+0009)\"\n * - \"Space (U+0020)\"\n * ```\n * @internal\n */\nexport function isWhiteSpace(code) {\n return code === 0x0009 || code === 0x0020;\n}\n/**\n * ```\n * Digit :: one of\n * - `0` `1` `2` `3` `4` `5` `6` `7` `8` `9`\n * ```\n * @internal\n */\n\nexport function isDigit(code) {\n return code >= 0x0030 && code <= 0x0039;\n}\n/**\n * ```\n * Letter :: one of\n * - `A` `B` `C` `D` `E` `F` `G` `H` `I` `J` `K` `L` `M`\n * - `N` `O` `P` `Q` `R` `S` `T` `U` `V` `W` `X` `Y` `Z`\n * - `a` `b` `c` `d` `e` `f` `g` `h` `i` `j` `k` `l` `m`\n * - `n` `o` `p` `q` `r` `s` `t` `u` `v` `w` `x` `y` `z`\n * ```\n * @internal\n */\n\nexport function isLetter(code) {\n return (\n (code >= 0x0061 && code <= 0x007a) || // A-Z\n (code >= 0x0041 && code <= 0x005a) // a-z\n );\n}\n/**\n * ```\n * NameStart ::\n * - Letter\n * - `_`\n * ```\n * @internal\n */\n\nexport function isNameStart(code) {\n return isLetter(code) || code === 0x005f;\n}\n/**\n * ```\n * NameContinue ::\n * - Letter\n * - Digit\n * - `_`\n * ```\n * @internal\n */\n\nexport function isNameContinue(code) {\n return isLetter(code) || isDigit(code) || code === 0x005f;\n}\n","import { isWhiteSpace } from './characterClasses.mjs';\n/**\n * Produces the value of a block string from its parsed raw value, similar to\n * CoffeeScript's block string, Python's docstring trim or Ruby's strip_heredoc.\n *\n * This implements the GraphQL spec's BlockStringValue() static algorithm.\n *\n * @internal\n */\n\nexport function dedentBlockStringLines(lines) {\n var _firstNonEmptyLine2;\n\n let commonIndent = Number.MAX_SAFE_INTEGER;\n let firstNonEmptyLine = null;\n let lastNonEmptyLine = -1;\n\n for (let i = 0; i < lines.length; ++i) {\n var _firstNonEmptyLine;\n\n const line = lines[i];\n const indent = leadingWhitespace(line);\n\n if (indent === line.length) {\n continue; // skip empty lines\n }\n\n firstNonEmptyLine =\n (_firstNonEmptyLine = firstNonEmptyLine) !== null &&\n _firstNonEmptyLine !== void 0\n ? _firstNonEmptyLine\n : i;\n lastNonEmptyLine = i;\n\n if (i !== 0 && indent < commonIndent) {\n commonIndent = indent;\n }\n }\n\n return lines // Remove common indentation from all lines but first.\n .map((line, i) => (i === 0 ? line : line.slice(commonIndent))) // Remove leading and trailing blank lines.\n .slice(\n (_firstNonEmptyLine2 = firstNonEmptyLine) !== null &&\n _firstNonEmptyLine2 !== void 0\n ? _firstNonEmptyLine2\n : 0,\n lastNonEmptyLine + 1,\n );\n}\n\nfunction leadingWhitespace(str) {\n let i = 0;\n\n while (i < str.length && isWhiteSpace(str.charCodeAt(i))) {\n ++i;\n }\n\n return i;\n}\n/**\n * @internal\n */\n\nexport function isPrintableAsBlockString(value) {\n if (value === '') {\n return true; // empty string is printable\n }\n\n let isEmptyLine = true;\n let hasIndent = false;\n let hasCommonIndent = true;\n let seenNonEmptyLine = false;\n\n for (let i = 0; i < value.length; ++i) {\n switch (value.codePointAt(i)) {\n case 0x0000:\n case 0x0001:\n case 0x0002:\n case 0x0003:\n case 0x0004:\n case 0x0005:\n case 0x0006:\n case 0x0007:\n case 0x0008:\n case 0x000b:\n case 0x000c:\n case 0x000e:\n case 0x000f:\n return false;\n // Has non-printable characters\n\n case 0x000d:\n // \\r\n return false;\n // Has \\r or \\r\\n which will be replaced as \\n\n\n case 10:\n // \\n\n if (isEmptyLine && !seenNonEmptyLine) {\n return false; // Has leading new line\n }\n\n seenNonEmptyLine = true;\n isEmptyLine = true;\n hasIndent = false;\n break;\n\n case 9: // \\t\n\n case 32:\n // <space>\n hasIndent || (hasIndent = isEmptyLine);\n break;\n\n default:\n hasCommonIndent && (hasCommonIndent = hasIndent);\n isEmptyLine = false;\n }\n }\n\n if (isEmptyLine) {\n return false; // Has trailing empty lines\n }\n\n if (hasCommonIndent && seenNonEmptyLine) {\n return false; // Has internal indent\n }\n\n return true;\n}\n/**\n * Print a block string in the indented block form by adding a leading and\n * trailing blank line. However, if a block string starts with whitespace and is\n * a single-line, adding a leading blank line would strip that whitespace.\n *\n * @internal\n */\n\nexport function printBlockString(value, options) {\n const escapedValue = value.replace(/\"\"\"/g, '\\\\\"\"\"'); // Expand a block string's raw value into independent lines.\n\n const lines = escapedValue.split(/\\r\\n|[\\n\\r]/g);\n const isSingleLine = lines.length === 1; // If common indentation is found we can fix some of those cases by adding leading new line\n\n const forceLeadingNewLine =\n lines.length > 1 &&\n lines\n .slice(1)\n .every((line) => line.length === 0 || isWhiteSpace(line.charCodeAt(0))); // Trailing triple quotes just looks confusing but doesn't force trailing new line\n\n const hasTrailingTripleQuotes = escapedValue.endsWith('\\\\\"\"\"'); // Trailing quote (single or double) or slash forces trailing new line\n\n const hasTrailingQuote = value.endsWith('\"') && !hasTrailingTripleQuotes;\n const hasTrailingSlash = value.endsWith('\\\\');\n const forceTrailingNewline = hasTrailingQuote || hasTrailingSlash;\n const printAsMultipleLines =\n !(options !== null && options !== void 0 && options.minimize) && // add leading and trailing new lines only if it improves readability\n (!isSingleLine ||\n value.length > 70 ||\n forceTrailingNewline ||\n forceLeadingNewLine ||\n hasTrailingTripleQuotes);\n let result = ''; // Format a multi-line block quote to account for leading space.\n\n const skipLeadingNewLine = isSingleLine && isWhiteSpace(value.charCodeAt(0));\n\n if ((printAsMultipleLines && !skipLeadingNewLine) || forceLeadingNewLine) {\n result += '\\n';\n }\n\n result += escapedValue;\n\n if (printAsMultipleLines || forceTrailingNewline) {\n result += '\\n';\n }\n\n return '\"\"\"' + result + '\"\"\"';\n}\n","const MAX_ARRAY_LENGTH = 10;\nconst MAX_RECURSIVE_DEPTH = 2;\n/**\n * Used to print values in error messages.\n */\n\nexport function inspect(value) {\n return formatValue(value, []);\n}\n\nfunction formatValue(value, seenValues) {\n switch (typeof value) {\n case 'string':\n return JSON.stringify(value);\n\n case 'function':\n return value.name ? `[function ${value.name}]` : '[function]';\n\n case 'object':\n return formatObjectValue(value, seenValues);\n\n default:\n return String(value);\n }\n}\n\nfunction formatObjectValue(value, previouslySeenValues) {\n if (value === null) {\n return 'null';\n }\n\n if (previouslySeenValues.includes(value)) {\n return '[Circular]';\n }\n\n const seenValues = [...previouslySeenValues, value];\n\n if (isJSONable(value)) {\n const jsonValue = value.toJSON(); // check for infinite recursion\n\n if (jsonValue !== value) {\n return typeof jsonValue === 'string'\n ? jsonValue\n : formatValue(jsonValue, seenValues);\n }\n } else if (Array.isArray(value)) {\n return formatArray(value, seenValues);\n }\n\n return formatObject(value, seenValues);\n}\n\nfunction isJSONable(value) {\n return typeof value.toJSON === 'function';\n}\n\nfunction formatObject(object, seenValues) {\n const entries = Object.entries(object);\n\n if (entries.length === 0) {\n return '{}';\n }\n\n if (seenValues.length > MAX_RECURSIVE_DEPTH) {\n return '[' + getObjectTag(object) + ']';\n }\n\n const properties = entries.map(\n ([key, value]) => key + ': ' + formatValue(value, seenValues),\n );\n return '{ ' + properties.join(', ') + ' }';\n}\n\nfunction formatArray(array, seenValues) {\n if (array.length === 0) {\n return '[]';\n }\n\n if (seenValues.length > MAX_RECURSIVE_DEPTH) {\n return '[Array]';\n }\n\n const len = Math.min(MAX_ARRAY_LENGTH, array.length);\n const remaining = array.length - len;\n const items = [];\n\n for (let i = 0; i < len; ++i) {\n items.push(formatValue(array[i], seenValues));\n }\n\n if (remaining === 1) {\n items.push('... 1 more item');\n } else if (remaining > 1) {\n items.push(`... ${remaining} more items`);\n }\n\n return '[' + items.join(', ') + ']';\n}\n\nfunction getObjectTag(object) {\n const tag = Object.prototype.toString\n .call(object)\n .replace(/^\\[object /, '')\n .replace(/]$/, '');\n\n if (tag === 'Object' && typeof object.constructor === 'function') {\n const name = object.constructor.name;\n\n if (typeof name === 'string' && name !== '') {\n return name;\n }\n }\n\n return tag;\n}\n","import { inspect } from './inspect.mjs';\n/* c8 ignore next 3 */\n\nconst isProduction =\n globalThis.process && // eslint-disable-next-line no-undef\n process.env.NODE_ENV === 'production';\n/**\n * A replacement for instanceof which includes an error warning when multi-realm\n * constructors are detected.\n * See: https://expressjs.com/en/advanced/best-practice-performance.html#set-node_env-to-production\n * See: https://webpack.js.org/guides/production/\n */\n\nexport const instanceOf =\n /* c8 ignore next 6 */\n // FIXME: https://github.com/graphql/graphql-js/issues/2317\n isProduction\n ? function instanceOf(value, constructor) {\n return value instanceof constructor;\n }\n : function instanceOf(value, constructor) {\n if (value instanceof constructor) {\n return true;\n }\n\n if (typeof value === 'object' && value !== null) {\n var _value$constructor;\n\n // Prefer Symbol.toStringTag since it is immune to minification.\n const className = constructor.prototype[Symbol.toStringTag];\n const valueClassName = // We still need to support constructor's name to detect conflicts with older versions of this library.\n Symbol.toStringTag in value // @ts-expect-error TS bug see, https://github.com/microsoft/TypeScript/issues/38009\n ? value[Symbol.toStringTag]\n : (_value$constructor = value.constructor) === null ||\n _value$constructor === void 0\n ? void 0\n : _value$constructor.name;\n\n if (className === valueClassName) {\n const stringifiedValue = inspect(value);\n throw new Error(`Cannot use ${className} \"${stringifiedValue}\" from another module or realm.\n\nEnsure that there is only one instance of \"graphql\" in the node_modules\ndirectory. If different versions of \"graphql\" are the dependencies of other\nrelied on modules, use \"resolutions\" to ensure only one version is installed.\n\nhttps://yarnpkg.com/en/docs/selective-version-resolutions\n\nDuplicate \"graphql\" modules cannot be used at the same time since different\nversions may have different capabilities and behavior. The data from one\nversion used in the function from another could produce confusing and\nspurious results.`);\n }\n }\n\n return false;\n };\n","const MAX_SUGGESTIONS = 5;\n/**\n * Given [ A, B, C ] return ' Did you mean A, B, or C?'.\n */\n\nexport function didYouMean(firstArg, secondArg) {\n const [subMessage, suggestionsArg] = secondArg\n ? [firstArg, secondArg]\n : [undefined, firstArg];\n let message = ' Did you mean ';\n\n if (subMessage) {\n message += subMessage + ' ';\n }\n\n const suggestions = suggestionsArg.map((x) => `\"${x}\"`);\n\n switch (suggestions.length) {\n case 0:\n return '';\n\n case 1:\n return message + suggestions[0] + '?';\n\n case 2:\n return message + suggestions[0] + ' or ' + suggestions[1] + '?';\n }\n\n const selected = suggestions.slice(0, MAX_SUGGESTIONS);\n const lastItem = selected.pop();\n return message + selected.join(', ') + ', or ' + lastItem + '?';\n}\n","/**\n * Returns the first argument it receives.\n */\nexport function identityFunc(x) {\n return x;\n}\n","/**\n * Creates a keyed JS object from an array, given a function to produce the keys\n * for each value in the array.\n *\n * This provides a convenient lookup for the array items if the key function\n * produces unique results.\n * ```ts\n * const phoneBook = [\n * { name: 'Jon', num: '555-1234' },\n * { name: 'Jenny', num: '867-5309' }\n * ]\n *\n * const entriesByName = keyMap(\n * phoneBook,\n * entry => entry.name\n * )\n *\n * // {\n * // Jon: { name: 'Jon', num: '555-1234' },\n * // Jenny: { name: 'Jenny', num: '867-5309' }\n * // }\n *\n * const jennyEntry = entriesByName['Jenny']\n *\n * // { name: 'Jenny', num: '857-6309' }\n * ```\n */\nexport function keyMap(list, keyFn) {\n const result = Object.create(null);\n\n for (const item of list) {\n result[keyFn(item)] = item;\n }\n\n return result;\n}\n","/**\n * Creates a keyed JS object from an array, given a function to produce the keys\n * and a function to produce the values from each item in the array.\n * ```ts\n * const phoneBook = [\n * { name: 'Jon', num: '555-1234' },\n * { name: 'Jenny', num: '867-5309' }\n * ]\n *\n * // { Jon: '555-1234', Jenny: '867-5309' }\n * const phonesByName = keyValMap(\n * phoneBook,\n * entry => entry.name,\n * entry => entry.num\n * )\n * ```\n */\nexport function keyValMap(list, keyFn, valFn) {\n const result = Object.create(null);\n\n for (const item of list) {\n result[keyFn(item)] = valFn(item);\n }\n\n return result;\n}\n","/**\n * Creates an object map with the same keys as `map` and values generated by\n * running each value of `map` thru `fn`.\n */\nexport function mapValue(map, fn) {\n const result = Object.create(null);\n\n for (const key of Object.keys(map)) {\n result[key] = fn(map[key], key);\n }\n\n return result;\n}\n","/**\n * Returns a number indicating whether a reference string comes before, or after,\n * or is the same as the given string in natural sort order.\n *\n * See: https://en.wikipedia.org/wiki/Natural_sort_order\n *\n */\nexport function naturalCompare(aStr, bStr) {\n let aIndex = 0;\n let bIndex = 0;\n\n while (aIndex < aStr.length && bIndex < bStr.length) {\n let aChar = aStr.charCodeAt(aIndex);\n let bChar = bStr.charCodeAt(bIndex);\n\n if (isDigit(aChar) && isDigit(bChar)) {\n let aNum = 0;\n\n do {\n ++aIndex;\n aNum = aNum * 10 + aChar - DIGIT_0;\n aChar = aStr.charCodeAt(aIndex);\n } while (isDigit(aChar) && aNum > 0);\n\n let bNum = 0;\n\n do {\n ++bIndex;\n bNum = bNum * 10 + bChar - DIGIT_0;\n bChar = bStr.charCodeAt(bIndex);\n } while (isDigit(bChar) && bNum > 0);\n\n if (aNum < bNum) {\n return -1;\n }\n\n if (aNum > bNum) {\n return 1;\n }\n } else {\n if (aChar < bChar) {\n return -1;\n }\n\n if (aChar > bChar) {\n return 1;\n }\n\n ++aIndex;\n ++bIndex;\n }\n }\n\n return aStr.length - bStr.length;\n}\nconst DIGIT_0 = 48;\nconst DIGIT_9 = 57;\n\nfunction isDigit(code) {\n return !isNaN(code) && DIGIT_0 <= code && code <= DIGIT_9;\n}\n","import { naturalCompare } from './naturalCompare.mjs';\n/**\n * Given an invalid input string and a list of valid options, returns a filtered\n * list of valid options sorted based on their similarity with the input.\n */\n\nexport function suggestionList(input, options) {\n const optionsByDistance = Object.create(null);\n const lexicalDistance = new LexicalDistance(input);\n const threshold = Math.floor(input.length * 0.4) + 1;\n\n for (const option of options) {\n const distance = lexicalDistance.measure(option, threshold);\n\n if (distance !== undefined) {\n optionsByDistance[option] = distance;\n }\n }\n\n return Object.keys(optionsByDistance).sort((a, b) => {\n const distanceDiff = optionsByDistance[a] - optionsByDistance[b];\n return distanceDiff !== 0 ? distanceDiff : naturalCompare(a, b);\n });\n}\n/**\n * Computes the lexical distance between strings A and B.\n *\n * The \"distance\" between two strings is given by counting the minimum number\n * of edits needed to transform string A into string B. An edit can be an\n * insertion, deletion, or substitution of a single character, or a swap of two\n * adjacent characters.\n *\n * Includes a custom alteration from Damerau-Levenshtein to treat case changes\n * as a single edit which helps identify mis-cased values with an edit distance\n * of 1.\n *\n * This distance can be useful for detecting typos in input or sorting\n */\n\nclass LexicalDistance {\n constructor(input) {\n this._input = input;\n this._inputLowerCase = input.toLowerCase();\n this._inputArray = stringToArray(this._inputLowerCase);\n this._rows = [\n new Array(input.length + 1).fill(0),\n new Array(input.length + 1).fill(0),\n new Array(input.length + 1).fill(0),\n ];\n }\n\n measure(option, threshold) {\n if (this._input === option) {\n return 0;\n }\n\n const optionLowerCase = option.toLowerCase(); // Any case change counts as a single edit\n\n if (this._inputLowerCase === optionLowerCase) {\n return 1;\n }\n\n let a = stringToArray(optionLowerCase);\n let b = this._inputArray;\n\n if (a.length < b.length) {\n const tmp = a;\n a = b;\n b = tmp;\n }\n\n const aLength = a.length;\n const bLength = b.length;\n\n if (aLength - bLength > threshold) {\n return undefined;\n }\n\n const rows = this._rows;\n\n for (let j = 0; j <= bLength; j++) {\n rows[0][j] = j;\n }\n\n for (let i = 1; i <= aLength; i++) {\n const upRow = rows[(i - 1) % 3];\n const currentRow = rows[i % 3];\n let smallestCell = (currentRow[0] = i);\n\n for (let j = 1; j <= bLength; j++) {\n const cost = a[i - 1] === b[j - 1] ? 0 : 1;\n let currentCell = Math.min(\n upRow[j] + 1, // delete\n currentRow[j - 1] + 1, // insert\n upRow[j - 1] + cost, // substitute\n );\n\n if (i > 1 && j > 1 && a[i - 1] === b[j - 2] && a[i - 2] === b[j - 1]) {\n // transposition\n const doubleDiagonalCell = rows[(i - 2) % 3][j - 2];\n currentCell = Math.min(currentCell, doubleDiagonalCell + 1);\n }\n\n if (currentCell < smallestCell) {\n smallestCell = currentCell;\n }\n\n currentRow[j] = currentCell;\n } // Early exit, since distance can't go smaller than smallest element of the previous row.\n\n if (smallestCell > threshold) {\n return undefined;\n }\n }\n\n const distance = rows[aLength % 3][bLength];\n return distance <= threshold ? distance : undefined;\n }\n}\n\nfunction stringToArray(str) {\n const strLength = str.length;\n const array = new Array(strLength);\n\n for (let i = 0; i < strLength; ++i) {\n array[i] = str.charCodeAt(i);\n }\n\n return array;\n}\n","export function toObjMap(obj) {\n if (obj == null) {\n return Object.create(null);\n }\n\n if (Object.getPrototypeOf(obj) === null) {\n return obj;\n }\n\n const map = Object.create(null);\n\n for (const [key, value] of Object.entries(obj)) {\n map[key] = value;\n }\n\n return map;\n}\n","/**\n * Prints a string as a GraphQL StringValue literal. Replaces control characters\n * and excluded characters (\" U+0022 and \\\\ U+005C) with escape sequences.\n */\nexport function printString(str) {\n return `\"${str.replace(escapedRegExp, escapedReplacer)}\"`;\n} // eslint-disable-next-line no-control-regex\n\nconst escapedRegExp = /[\\x00-\\x1f\\x22\\x5c\\x7f-\\x9f]/g;\n\nfunction escapedReplacer(str) {\n return escapeSequences[str.charCodeAt(0)];\n} // prettier-ignore\n\nconst escapeSequences = [\n '\\\\u0000',\n '\\\\u0001',\n '\\\\u0002',\n '\\\\u0003',\n '\\\\u0004',\n '\\\\u0005',\n '\\\\u0006',\n '\\\\u0007',\n '\\\\b',\n '\\\\t',\n '\\\\n',\n '\\\\u000B',\n '\\\\f',\n '\\\\r',\n '\\\\u000E',\n '\\\\u000F',\n '\\\\u0010',\n '\\\\u0011',\n '\\\\u0012',\n '\\\\u0013',\n '\\\\u0014',\n '\\\\u0015',\n '\\\\u0016',\n '\\\\u0017',\n '\\\\u0018',\n '\\\\u0019',\n '\\\\u001A',\n '\\\\u001B',\n '\\\\u001C',\n '\\\\u001D',\n '\\\\u001E',\n '\\\\u001F',\n '',\n '',\n '\\\\\"',\n '',\n '',\n '',\n '',\n '',\n '',\n '',\n '',\n '',\n '',\n '',\n '',\n '', // 2F\n '',\n '',\n '',\n '',\n '',\n '',\n '',\n '',\n '',\n '',\n '',\n '',\n '',\n '',\n '',\n '', // 3F\n '',\n '',\n '',\n '',\n '',\n '',\n '',\n '',\n '',\n '',\n '',\n '',\n '',\n '',\n '',\n '', // 4F\n '',\n '',\n '',\n '',\n '',\n '',\n '',\n '',\n '',\n '',\n '',\n '',\n '\\\\\\\\',\n '',\n '',\n '', // 5F\n '',\n '',\n '',\n '',\n '',\n '',\n '',\n '',\n '',\n '',\n '',\n '',\n '',\n '',\n '',\n '', // 6F\n '',\n '',\n '',\n '',\n '',\n '',\n '',\n '',\n '',\n '',\n '',\n '',\n '',\n '',\n '',\n '\\\\u007F',\n '\\\\u0080',\n '\\\\u0081',\n '\\\\u0082',\n '\\\\u0083',\n '\\\\u0084',\n '\\\\u0085',\n '\\\\u0086',\n '\\\\u0087',\n '\\\\u0088',\n '\\\\u0089',\n '\\\\u008A',\n '\\\\u008B',\n '\\\\u008C',\n '\\\\u008D',\n '\\\\u008E',\n '\\\\u008F',\n '\\\\u0090',\n '\\\\u0091',\n '\\\\u0092',\n '\\\\u0093',\n '\\\\u0094',\n '\\\\u0095',\n '\\\\u0096',\n '\\\\u0097',\n '\\\\u0098',\n '\\\\u0099',\n '\\\\u009A',\n '\\\\u009B',\n '\\\\u009C',\n '\\\\u009D',\n '\\\\u009E',\n '\\\\u009F',\n];\n","import { devAssert } from '../jsutils/devAssert.mjs';\nimport { inspect } from '../jsutils/inspect.mjs';\nimport { isNode, QueryDocumentKeys } from './ast.mjs';\nimport { Kind } from './kinds.mjs';\n/**\n * A visitor is provided to visit, it contains the collection of\n * relevant functions to be called during the visitor's traversal.\n */\n\nexport const BREAK = Object.freeze({});\n/**\n * visit() will walk through an AST using a depth-first traversal, calling\n * the visitor's enter function at each node in the traversal, and calling the\n * leave function after visiting that node and all of its child nodes.\n *\n * By returning different values from the enter and leave functions, the\n * behavior of the visitor can be altered, including skipping over a sub-tree of\n * the AST (by returning false), editing the AST by returning a value or null\n * to remove the value, or to stop the whole traversal by returning BREAK.\n *\n * When using visit() to edit an AST, the original AST will not be modified, and\n * a new version of the AST with the changes applied will be returned from the\n * visit function.\n *\n * ```ts\n * const editedAST = visit(ast, {\n * enter(node, key, parent, path, ancestors) {\n * // @return\n * // undefined: no action\n * // false: skip visiting this node\n * // visitor.BREAK: stop visiting altogether\n * // null: delete this node\n * // any value: replace this node with the returned value\n * },\n * leave(node, key, parent, path, ancestors) {\n * // @return\n * // undefined: no action\n * // false: no action\n * // visitor.BREAK: stop visiting altogether\n * // null: delete this node\n * // any value: replace this node with the returned value\n * }\n * });\n * ```\n *\n * Alternatively to providing enter() and leave() functions, a visitor can\n * instead provide functions named the same as the kinds of AST nodes, or\n * enter/leave visitors at a named key, leading to three permutations of the\n * visitor API:\n *\n * 1) Named visitors triggered when entering a node of a specific kind.\n *\n * ```ts\n * visit(ast, {\n * Kind(node) {\n * // enter the \"Kind\" node\n * }\n * })\n * ```\n *\n * 2) Named visitors that trigger upon entering and leaving a node of a specific kind.\n *\n * ```ts\n * visit(ast, {\n * Kind: {\n * enter(node) {\n * // enter the \"Kind\" node\n * }\n * leave(node) {\n * // leave the \"Kind\" node\n * }\n * }\n * })\n * ```\n *\n * 3) Generic visitors that trigger upon entering and leaving any node.\n *\n * ```ts\n * visit(ast, {\n * enter(node) {\n * // enter any node\n * },\n * leave(node) {\n * // leave any node\n * }\n * })\n * ```\n */\n\nexport function visit(root, visitor, visitorKeys = QueryDocumentKeys) {\n const enterLeaveMap = new Map();\n\n for (const kind of Object.values(Kind)) {\n enterLeaveMap.set(kind, getEnterLeaveForKind(visitor, kind));\n }\n /* eslint-disable no-undef-init */\n\n let stack = undefined;\n let inArray = Array.isArray(root);\n let keys = [root];\n let index = -1;\n let edits = [];\n let node = root;\n let key = undefined;\n let parent = undefined;\n const path = [];\n const ancestors = [];\n /* eslint-enable no-undef-init */\n\n do {\n index++;\n const isLeaving = index === keys.length;\n const isEdited = isLeaving && edits.length !== 0;\n\n if (isLeaving) {\n key = ancestors.length === 0 ? undefined : path[path.length - 1];\n node = parent;\n parent = ancestors.pop();\n\n if (isEdited) {\n if (inArray) {\n node = node.slice();\n let editOffset = 0;\n\n for (const [editKey, editValue] of edits) {\n const arrayKey = editKey - editOffset;\n\n if (editValue === null) {\n node.splice(arrayKey, 1);\n editOffset++;\n } else {\n node[arrayKey] = editValue;\n }\n }\n } else {\n node = { ...node };\n\n for (const [editKey, editValue] of edits) {\n node[editKey] = editValue;\n }\n }\n }\n\n index = stack.index;\n keys = stack.keys;\n edits = stack.edits;\n inArray = stack.inArray;\n stack = stack.prev;\n } else if (parent) {\n key = inArray ? index : keys[index];\n node = parent[key];\n\n if (node === null || node === undefined) {\n continue;\n }\n\n path.push(key);\n }\n\n let result;\n\n if (!Array.isArray(node)) {\n var _enterLeaveMap$get, _enterLeaveMap$get2;\n\n isNode(node) || devAssert(false, `Invalid AST Node: ${inspect(node)}.`);\n const visitFn = isLeaving\n ? (_enterLeaveMap$get = enterLeaveMap.get(node.kind)) === null ||\n _enterLeaveMap$get === void 0\n ? void 0\n : _enterLeaveMap$get.leave\n : (_enterLeaveMap$get2 = enterLeaveMap.get(node.kind)) === null ||\n _enterLeaveMap$get2 === void 0\n ? void 0\n : _enterLeaveMap$get2.enter;\n result =\n visitFn === null || visitFn === void 0\n ? void 0\n : visitFn.call(visitor, node, key, parent, path, ancestors);\n\n if (result === BREAK) {\n break;\n }\n\n if (result === false) {\n if (!isLeaving) {\n path.pop();\n continue;\n }\n } else if (result !== undefined) {\n edits.push([key, result]);\n\n if (!isLeaving) {\n if (isNode(result)) {\n node = result;\n } else {\n path.pop();\n continue;\n }\n }\n }\n }\n\n if (result === undefined && isEdited) {\n edits.push([key, node]);\n }\n\n if (isLeaving) {\n path.pop();\n } else {\n var _node$kind;\n\n stack = {\n inArray,\n index,\n keys,\n edits,\n prev: stack,\n };\n inArray = Array.isArray(node);\n keys = inArray\n ? node\n : (_node$kind = visitorKeys[node.kind]) !== null &&\n _node$kind !== void 0\n ? _node$kind\n : [];\n index = -1;\n edits = [];\n\n if (parent) {\n ancestors.push(parent);\n }\n\n parent = node;\n }\n } while (stack !== undefined);\n\n if (edits.length !== 0) {\n // New root\n return edits[edits.length - 1][1];\n }\n\n return root;\n}\n/**\n * Creates a new visitor instance which delegates to many visitors to run in\n * parallel. Each visitor will be visited for each node before moving on.\n *\n * If a prior visitor edits a node, no following visitors will see that node.\n */\n\nexport function visitInParallel(visitors) {\n const skipping = new Array(visitors.length).fill(null);\n const mergedVisitor = Object.create(null);\n\n for (const kind of Object.values(Kind)) {\n let hasVisitor = false;\n const enterList = new Array(visitors.length).fill(undefined);\n const leaveList = new Array(visitors.length).fill(undefined);\n\n for (let i = 0; i < visitors.length; ++i) {\n const { enter, leave } = getEnterLeaveForKind(visitors[i], kind);\n hasVisitor || (hasVisitor = enter != null || leave != null);\n enterList[i] = enter;\n leaveList[i] = leave;\n }\n\n if (!hasVisitor) {\n continue;\n }\n\n const mergedEnterLeave = {\n enter(...args) {\n const node = args[0];\n\n for (let i = 0; i < visitors.length; i++) {\n if (skipping[i] === null) {\n var _enterList$i;\n\n const result =\n (_enterList$i = enterList[i]) === null || _enterList$i === void 0\n ? void 0\n : _enterList$i.apply(visitors[i], args);\n\n if (result === false) {\n skipping[i] = node;\n } else if (result === BREAK) {\n skipping[i] = BREAK;\n } else if (result !== undefined) {\n return result;\n }\n }\n }\n },\n\n leave(...args) {\n const node = args[0];\n\n for (let i = 0; i < visitors.length; i++) {\n if (skipping[i] === null) {\n var _leaveList$i;\n\n const result =\n (_leaveList$i = leaveList[i]) === null || _leaveList$i === void 0\n ? void 0\n : _leaveList$i.apply(visitors[i], args);\n\n if (result === BREAK) {\n skipping[i] = BREAK;\n } else if (result !== undefined && result !== false) {\n return result;\n }\n } else if (skipping[i] === node) {\n skipping[i] = null;\n }\n }\n },\n };\n mergedVisitor[kind] = mergedEnterLeave;\n }\n\n return mergedVisitor;\n}\n/**\n * Given a visitor instance and a node kind, return EnterLeaveVisitor for that kind.\n */\n\nexport function getEnterLeaveForKind(visitor, kind) {\n const kindVisitor = visitor[kind];\n\n if (typeof kindVisitor === 'object') {\n // { Kind: { enter() {}, leave() {} } }\n return kindVisitor;\n } else if (typeof kindVisitor === 'function') {\n // { Kind() {} }\n return {\n enter: kindVisitor,\n leave: undefined,\n };\n } // { enter() {}, leave() {} }\n\n return {\n enter: visitor.enter,\n leave: visitor.leave,\n };\n}\n/**\n * Given a visitor instance, if it is leaving or not, and a node kind, return\n * the function the visitor runtime should call.\n *\n * @deprecated Please use `getEnterLeaveForKind` instead. Will be removed in v17\n */\n\n/* c8 ignore next 8 */\n\nexport function getVisitFn(visitor, kind, isLeaving) {\n const { enter, leave } = getEnterLeaveForKind(visitor, kind);\n return isLeaving ? leave : enter;\n}\n","import { printBlockString } from './blockString.mjs';\nimport { printString } from './printString.mjs';\nimport { visit } from './visitor.mjs';\n/**\n * Converts an AST into a string, using one set of reasonable\n * formatting rules.\n */\n\nexport function print(ast) {\n return visit(ast, printDocASTReducer);\n}\nconst MAX_LINE_LENGTH = 80;\nconst printDocASTReducer = {\n Name: {\n leave: (node) => node.value,\n },\n Variable: {\n leave: (node) => '$' + node.name,\n },\n // Document\n Document: {\n leave: (node) => join(node.definitions, '\\n\\n'),\n },\n OperationDefinition: {\n leave(node) {\n const varDefs = wrap('(', join(node.variableDefinitions, ', '), ')');\n const prefix = join(\n [\n node.operation,\n join([node.name, varDefs]),\n join(node.directives, ' '),\n ],\n ' ',\n ); // Anonymous queries with no directives or variable definitions can use\n // the query short form.\n\n return (prefix === 'query' ? '' : prefix + ' ') + node.selectionSet;\n },\n },\n VariableDefinition: {\n leave: ({ variable, type, defaultValue, directives }) =>\n variable +\n ': ' +\n type +\n wrap(' = ', defaultValue) +\n wrap(' ', join(directives, ' ')),\n },\n SelectionSet: {\n leave: ({ selections }) => block(selections),\n },\n Field: {\n leave({ alias, name, arguments: args, directives, selectionSet }) {\n const prefix = wrap('', alias, ': ') + name;\n let argsLine = prefix + wrap('(', join(args, ', '), ')');\n\n if (argsLine.length > MAX_LINE_LENGTH) {\n argsLine = prefix + wrap('(\\n', indent(join(args, '\\n')), '\\n)');\n }\n\n return join([argsLine, join(directives, ' '), selectionSet], ' ');\n },\n },\n Argument: {\n leave: ({ name, value }) => name + ': ' + value,\n },\n // Fragments\n FragmentSpread: {\n leave: ({ name, directives }) =>\n '...' + name + wrap(' ', join(directives, ' ')),\n },\n InlineFragment: {\n leave: ({ typeCondition, directives, selectionSet }) =>\n join(\n [\n '...',\n wrap('on ', typeCondition),\n join(directives, ' '),\n selectionSet,\n ],\n ' ',\n ),\n },\n FragmentDefinition: {\n leave: (\n { name, typeCondition, variableDefinitions, directives, selectionSet }, // Note: fragment variable definitions are experimental and may be changed\n ) =>\n // or removed in the future.\n `fragment ${name}${wrap('(', join(variableDefinitions, ', '), ')')} ` +\n `on ${typeCondition} ${wrap('', join(directives, ' '), ' ')}` +\n selectionSet,\n },\n // Value\n IntValue: {\n leave: ({ value }) => value,\n },\n FloatValue: {\n leave: ({ value }) => value,\n },\n StringValue: {\n leave: ({ value, block: isBlockString }) =>\n isBlockString ? printBlockString(value) : printString(value),\n },\n BooleanValue: {\n leave: ({ value }) => (value ? 'true' : 'false'),\n },\n NullValue: {\n leave: () => 'null',\n },\n EnumValue: {\n leave: ({ value }) => value,\n },\n ListValue: {\n leave: ({ values }) => '[' + join(values, ', ') + ']',\n },\n ObjectValue: {\n leave: ({ fields }) => '{' + join(fields, ', ') + '}',\n },\n ObjectField: {\n leave: ({ name, value }) => name + ': ' + value,\n },\n // Directive\n Directive: {\n leave: ({ name, arguments: args }) =>\n '@' + name + wrap('(', join(args, ', '), ')'),\n },\n // Type\n NamedType: {\n leave: ({ name }) => name,\n },\n ListType: {\n leave: ({ type }) => '[' + type + ']',\n },\n NonNullType: {\n leave: ({ type }) => type + '!',\n },\n // Type System Definitions\n SchemaDefinition: {\n leave: ({ description, directives, operationTypes }) =>\n wrap('', description, '\\n') +\n join(['schema', join(directives, ' '), block(operationTypes)], ' '),\n },\n OperationTypeDefinition: {\n leave: ({ operation, type }) => operation + ': ' + type,\n },\n ScalarTypeDefinition: {\n leave: ({ description, name, directives }) =>\n wrap('', description, '\\n') +\n join(['scalar', name, join(directives, ' ')], ' '),\n },\n ObjectTypeDefinition: {\n leave: ({ description, name, interfaces, directives, fields }) =>\n wrap('', description, '\\n') +\n join(\n [\n 'type',\n name,\n wrap('implements ', join(interfaces, ' & ')),\n join(directives, ' '),\n block(fields),\n ],\n ' ',\n ),\n },\n FieldDefinition: {\n leave: ({ description, name, arguments: args, type, directives }) =>\n wrap('', description, '\\n') +\n name +\n (hasMultilineItems(args)\n ? wrap('(\\n', indent(join(args, '\\n')), '\\n)')\n : wrap('(', join(args, ', '), ')')) +\n ': ' +\n type +\n wrap(' ', join(directives, ' ')),\n },\n InputValueDefinition: {\n leave: ({ description, name, type, defaultValue, directives }) =>\n wrap('', description, '\\n') +\n join(\n [name + ': ' + type, wrap('= ', defaultValue), join(directives, ' ')],\n ' ',\n ),\n },\n InterfaceTypeDefinition: {\n leave: ({ description, name, interfaces, directives, fields }) =>\n wrap('', description, '\\n') +\n join(\n [\n 'interface',\n name,\n wrap('implements ', join(interfaces, ' & ')),\n join(directives, ' '),\n block(fields),\n ],\n ' ',\n ),\n },\n UnionTypeDefinition: {\n leave: ({ description, name, directives, types }) =>\n wrap('', description, '\\n') +\n join(\n ['union', name, join(directives, ' '), wrap('= ', join(types, ' | '))],\n ' ',\n ),\n },\n EnumTypeDefinition: {\n leave: ({ description, name, directives, values }) =>\n wrap('', description, '\\n') +\n join(['enum', name, join(directives, ' '), block(values)], ' '),\n },\n EnumValueDefinition: {\n leave: ({ description, name, directives }) =>\n wrap('', description, '\\n') + join([name, join(directives, ' ')], ' '),\n },\n InputObjectTypeDefinition: {\n leave: ({ description, name, directives, fields }) =>\n wrap('', description, '\\n') +\n join(['input', name, join(directives, ' '), block(fields)], ' '),\n },\n DirectiveDefinition: {\n leave: ({ description, name, arguments: args, repeatable, locations }) =>\n wrap('', description, '\\n') +\n 'directive @' +\n name +\n (hasMultilineItems(args)\n ? wrap('(\\n', indent(join(args, '\\n')), '\\n)')\n : wrap('(', join(args, ', '), ')')) +\n (repeatable ? ' repeatable' : '') +\n ' on ' +\n join(locations, ' | '),\n },\n SchemaExtension: {\n leave: ({ directives, operationTypes }) =>\n join(\n ['extend schema', join(directives, ' '), block(operationTypes)],\n ' ',\n ),\n },\n ScalarTypeExtension: {\n leave: ({ name, directives }) =>\n join(['extend scalar', name, join(directives, ' ')], ' '),\n },\n ObjectTypeExtension: {\n leave: ({ name, interfaces, directives, fields }) =>\n join(\n [\n 'extend type',\n name,\n wrap('implements ', join(interfaces, ' & ')),\n join(directives, ' '),\n block(fields),\n ],\n ' ',\n ),\n },\n InterfaceTypeExtension: {\n leave: ({ name, interfaces, directives, fields }) =>\n join(\n [\n 'extend interface',\n name,\n wrap('implements ', join(interfaces, ' & ')),\n join(directives, ' '),\n block(fields),\n ],\n ' ',\n ),\n },\n UnionTypeExtension: {\n leave: ({ name, directives, types }) =>\n join(\n [\n 'extend union',\n name,\n join(directives, ' '),\n wrap('= ', join(types, ' | ')),\n ],\n ' ',\n ),\n },\n EnumTypeExtension: {\n leave: ({ name, directives, values }) =>\n join(['extend enum', name, join(directives, ' '), block(values)], ' '),\n },\n InputObjectTypeExtension: {\n leave: ({ name, directives, fields }) =>\n join(['extend input', name, join(directives, ' '), block(fields)], ' '),\n },\n};\n/**\n * Given maybeArray, print an empty string if it is null or empty, otherwise\n * print all items together separated by separator if provided\n */\n\nfunction join(maybeArray, separator = '') {\n var _maybeArray$filter$jo;\n\n return (_maybeArray$filter$jo =\n maybeArray === null || maybeArray === void 0\n ? void 0\n : maybeArray.filter((x) => x).join(separator)) !== null &&\n _maybeArray$filter$jo !== void 0\n ? _maybeArray$filter$jo\n : '';\n}\n/**\n * Given array, print each item on its own line, wrapped in an indented `{ }` block.\n */\n\nfunction block(array) {\n return wrap('{\\n', indent(join(array, '\\n')), '\\n}');\n}\n/**\n * If maybeString is not null or empty, then wrap with start and end, otherwise print an empty string.\n */\n\nfunction wrap(start, maybeString, end = '') {\n return maybeString != null && maybeString !== ''\n ? start + maybeString + end\n : '';\n}\n\nfunction indent(str) {\n return wrap(' ', str.replace(/\\n/g, '\\n '));\n}\n\nfunction hasMultilineItems(maybeArray) {\n var _maybeArray$some;\n\n // FIXME: https://github.com/graphql/graphql-js/issues/2203\n\n /* c8 ignore next */\n return (_maybeArray$some =\n maybeArray === null || maybeArray === void 0\n ? void 0\n : maybeArray.some((str) => str.includes('\\n'))) !== null &&\n _maybeArray$some !== void 0\n ? _maybeArray$some\n : false;\n}\n","import { keyValMap } from '../jsutils/keyValMap.mjs';\nimport { Kind } from '../language/kinds.mjs';\n/**\n * Produces a JavaScript value given a GraphQL Value AST.\n *\n * Unlike `valueFromAST()`, no type is provided. The resulting JavaScript value\n * will reflect the provided GraphQL value AST.\n *\n * | GraphQL Value | JavaScript Value |\n * | -------------------- | ---------------- |\n * | Input Object | Object |\n * | List | Array |\n * | Boolean | Boolean |\n * | String / Enum | String |\n * | Int / Float | Number |\n * | Null | null |\n *\n */\n\nexport function valueFromASTUntyped(valueNode, variables) {\n switch (valueNode.kind) {\n case Kind.NULL:\n return null;\n\n case Kind.INT:\n return parseInt(valueNode.value, 10);\n\n case Kind.FLOAT:\n return parseFloat(valueNode.value);\n\n case Kind.STRING:\n case Kind.ENUM:\n case Kind.BOOLEAN:\n return valueNode.value;\n\n case Kind.LIST:\n return valueNode.values.map((node) =>\n valueFromASTUntyped(node, variables),\n );\n\n case Kind.OBJECT:\n return keyValMap(\n valueNode.fields,\n (field) => field.name.value,\n (field) => valueFromASTUntyped(field.value, variables),\n );\n\n case Kind.VARIABLE:\n return variables === null || variables === void 0\n ? void 0\n : variables[valueNode.name.value];\n }\n}\n","import { devAssert } from '../jsutils/devAssert.mjs';\nimport { GraphQLError } from '../error/GraphQLError.mjs';\nimport { isNameContinue, isNameStart } from '../language/characterClasses.mjs';\n/**\n * Upholds the spec rules about naming.\n */\n\nexport function assertName(name) {\n name != null || devAssert(false, 'Must provide name.');\n typeof name === 'string' || devAssert(false, 'Expected name to be a string.');\n\n if (name.length === 0) {\n throw new GraphQLError('Expected name to be a non-empty string.');\n }\n\n for (let i = 1; i < name.length; ++i) {\n if (!isNameContinue(name.charCodeAt(i))) {\n throw new GraphQLError(\n `Names must only contain [_a-zA-Z0-9] but \"${name}\" does not.`,\n );\n }\n }\n\n if (!isNameStart(name.charCodeAt(0))) {\n throw new GraphQLError(\n `Names must start with [_a-zA-Z] but \"${name}\" does not.`,\n );\n }\n\n return name;\n}\n/**\n * Upholds the spec rules about naming enum values.\n *\n * @internal\n */\n\nexport function assertEnumValueName(name) {\n if (name === 'true' || name === 'false' || name === 'null') {\n throw new GraphQLError(`Enum values cannot be named: ${name}`);\n }\n\n return assertName(name);\n}\n","import { devAssert } from '../jsutils/devAssert.mjs';\nimport { didYouMean } from '../jsutils/didYouMean.mjs';\nimport { identityFunc } from '../jsutils/identityFunc.mjs';\nimport { inspect } from '../jsutils/inspect.mjs';\nimport { instanceOf } from '../jsutils/instanceOf.mjs';\nimport { isObjectLike } from '../jsutils/isObjectLike.mjs';\nimport { keyMap } from '../jsutils/keyMap.mjs';\nimport { keyValMap } from '../jsutils/keyValMap.mjs';\nimport { mapValue } from '../jsutils/mapValue.mjs';\nimport { suggestionList } from '../jsutils/suggestionList.mjs';\nimport { toObjMap } from '../jsutils/toObjMap.mjs';\nimport { GraphQLError } from '../error/GraphQLError.mjs';\nimport { Kind } from '../language/kinds.mjs';\nimport { print } from '../language/printer.mjs';\nimport { valueFromASTUntyped } from '../utilities/valueFromASTUntyped.mjs';\nimport { assertEnumValueName, assertName } from './assertName.mjs';\nexport function isType(type) {\n return (\n isScalarType(type) ||\n isObjectType(type) ||\n isInterfaceType(type) ||\n isUnionType(type) ||\n isEnumType(type) ||\n isInputObjectType(type) ||\n isListType(type) ||\n isNonNullType(type)\n );\n}\nexport function assertType(type) {\n if (!isType(type)) {\n throw new Error(`Expected ${inspect(type)} to be a GraphQL type.`);\n }\n\n return type;\n}\n/**\n * There are predicates for each kind of GraphQL type.\n */\n\nexport function isScalarType(type) {\n return instanceOf(type, GraphQLScalarType);\n}\nexport function assertScalarType(type) {\n if (!isScalarType(type)) {\n throw new Error(`Expected ${inspect(type)} to be a GraphQL Scalar type.`);\n }\n\n return type;\n}\nexport function isObjectType(type) {\n return instanceOf(type, GraphQLObjectType);\n}\nexport function assertObjectType(type) {\n if (!isObjectType(type)) {\n throw new Error(`Expected ${inspect(type)} to be a GraphQL Object type.`);\n }\n\n return type;\n}\nexport function isInterfaceType(type) {\n return instanceOf(type, GraphQLInterfaceType);\n}\nexport function assertInterfaceType(type) {\n if (!isInterfaceType(type)) {\n throw new Error(\n `Expected ${inspect(type)} to be a GraphQL Interface type.`,\n );\n }\n\n return type;\n}\nexport function isUnionType(type) {\n return instanceOf(type, GraphQLUnionType);\n}\nexport function assertUnionType(type) {\n if (!isUnionType(type)) {\n throw new Error(`Expected ${inspect(type)} to be a GraphQL Union type.`);\n }\n\n return type;\n}\nexport function isEnumType(type) {\n return instanceOf(type, GraphQLEnumType);\n}\nexport function assertEnumType(type) {\n if (!isEnumType(type)) {\n throw new Error(`Expected ${inspect(type)} to be a GraphQL Enum type.`);\n }\n\n return type;\n}\nexport function isInputObjectType(type) {\n return instanceOf(type, GraphQLInputObjectType);\n}\nexport function assertInputObjectType(type) {\n if (!isInputObjectType(type)) {\n throw new Error(\n `Expected ${inspect(type)} to be a GraphQL Input Object type.`,\n );\n }\n\n return type;\n}\nexport function isListType(type) {\n return instanceOf(type, GraphQLList);\n}\nexport function assertListType(type) {\n if (!isListType(type)) {\n throw new Error(`Expected ${inspect(type)} to be a GraphQL List type.`);\n }\n\n return type;\n}\nexport function isNonNullType(type) {\n return instanceOf(type, GraphQLNonNull);\n}\nexport function assertNonNullType(type) {\n if (!isNonNullType(type)) {\n throw new Error(`Expected ${inspect(type)} to be a GraphQL Non-Null type.`);\n }\n\n return type;\n}\n/**\n * These types may be used as input types for arguments and directives.\n */\n\nexport function isInputType(type) {\n return (\n isScalarType(type) ||\n isEnumType(type) ||\n isInputObjectType(type) ||\n (isWrappingType(type) && isInputType(type.ofType))\n );\n}\nexport function assertInputType(type) {\n if (!isInputType(type)) {\n throw new Error(`Expected ${inspect(type)} to be a GraphQL input type.`);\n }\n\n return type;\n}\n/**\n * These types may be used as output types as the result of fields.\n */\n\nexport function isOutputType(type) {\n return (\n isScalarType(type) ||\n isObjectType(type) ||\n isInterfaceType(type) ||\n isUnionType(type) ||\n isEnumType(type) ||\n (isWrappingType(type) && isOutputType(type.ofType))\n );\n}\nexport function assertOutputType(type) {\n if (!isOutputType(type)) {\n throw new Error(`Expected ${inspect(type)} to be a GraphQL output type.`);\n }\n\n return type;\n}\n/**\n * These types may describe types which may be leaf values.\n */\n\nexport function isLeafType(type) {\n return isScalarType(type) || isEnumType(type);\n}\nexport function assertLeafType(type) {\n if (!isLeafType(type)) {\n throw new Error(`Expected ${inspect(type)} to be a GraphQL leaf type.`);\n }\n\n return type;\n}\n/**\n * These types may describe the parent context of a selection set.\n */\n\nexport function isCompositeType(type) {\n return isObjectType(type) || isInterfaceType(type) || isUnionType(type);\n}\nexport function assertCompositeType(type) {\n if (!isCompositeType(type)) {\n throw new Error(\n `Expected ${inspect(type)} to be a GraphQL composite type.`,\n );\n }\n\n return type;\n}\n/**\n * These types may describe the parent context of a selection set.\n */\n\nexport function isAbstractType(type) {\n return isInterfaceType(type) || isUnionType(type);\n}\nexport function assertAbstractType(type) {\n if (!isAbstractType(type)) {\n throw new Error(`Expected ${inspect(type)} to be a GraphQL abstract type.`);\n }\n\n return type;\n}\n/**\n * List Type Wrapper\n *\n * A list is a wrapping type which points to another type.\n * Lists are often created within the context of defining the fields of\n * an object type.\n *\n * Example:\n *\n * ```ts\n * const PersonType = new GraphQLObjectType({\n * name: 'Person',\n * fields: () => ({\n * parents: { type: new GraphQLList(PersonType) },\n * children: { type: new GraphQLList(PersonType) },\n * })\n * })\n * ```\n */\n\nexport class GraphQLList {\n constructor(ofType) {\n isType(ofType) ||\n devAssert(false, `Expected ${inspect(ofType)} to be a GraphQL type.`);\n this.ofType = ofType;\n }\n\n get [Symbol.toStringTag]() {\n return 'GraphQLList';\n }\n\n toString() {\n return '[' + String(this.ofType) + ']';\n }\n\n toJSON() {\n return this.toString();\n }\n}\n/**\n * Non-Null Type Wrapper\n *\n * A non-null is a wrapping type which points to another type.\n * Non-null types enforce that their values are never null and can ensure\n * an error is raised if this ever occurs during a request. It is useful for\n * fields which you can make a strong guarantee on non-nullability, for example\n * usually the id field of a database row will never be null.\n *\n * Example:\n *\n * ```ts\n * const RowType = new GraphQLObjectType({\n * name: 'Row',\n * fields: () => ({\n * id: { type: new GraphQLNonNull(GraphQLString) },\n * })\n * })\n * ```\n * Note: the enforcement of non-nullability occurs within the executor.\n */\n\nexport class GraphQLNonNull {\n constructor(ofType) {\n isNullableType(ofType) ||\n devAssert(\n false,\n `Expected ${inspect(ofType)} to be a GraphQL nullable type.`,\n );\n this.ofType = ofType;\n }\n\n get [Symbol.toStringTag]() {\n return 'GraphQLNonNull';\n }\n\n toString() {\n return String(this.ofType) + '!';\n }\n\n toJSON() {\n return this.toString();\n }\n}\n/**\n * These types wrap and modify other types\n */\n\nexport function isWrappingType(type) {\n return isListType(type) || isNonNullType(type);\n}\nexport function assertWrappingType(type) {\n if (!isWrappingType(type)) {\n throw new Error(`Expected ${inspect(type)} to be a GraphQL wrapping type.`);\n }\n\n return type;\n}\n/**\n * These types can all accept null as a value.\n */\n\nexport function isNullableType(type) {\n return isType(type) && !isNonNullType(type);\n}\nexport function assertNullableType(type) {\n if (!isNullableType(type)) {\n throw new Error(`Expected ${inspect(type)} to be a GraphQL nullable type.`);\n }\n\n return type;\n}\nexport function getNullableType(type) {\n if (type) {\n return isNonNullType(type) ? type.ofType : type;\n }\n}\n/**\n * These named types do not include modifiers like List or NonNull.\n */\n\nexport function isNamedType(type) {\n return (\n isScalarType(type) ||\n isObjectType(type) ||\n isInterfaceType(type) ||\n isUnionType(type) ||\n isEnumType(type) ||\n isInputObjectType(type)\n );\n}\nexport function assertNamedType(type) {\n if (!isNamedType(type)) {\n throw new Error(`Expected ${inspect(type)} to be a GraphQL named type.`);\n }\n\n return type;\n}\nexport function getNamedType(type) {\n if (type) {\n let unwrappedType = type;\n\n while (isWrappingType(unwrappedType)) {\n unwrappedType = unwrappedType.ofType;\n }\n\n return unwrappedType;\n }\n}\n/**\n * Used while defining GraphQL types to allow for circular references in\n * otherwise immutable type definitions.\n */\n\nexport function resolveReadonlyArrayThunk(thunk) {\n return typeof thunk === 'function' ? thunk() : thunk;\n}\nexport function resolveObjMapThunk(thunk) {\n return typeof thunk === 'function' ? thunk() : thunk;\n}\n/**\n * Custom extensions\n *\n * @remarks\n * Use a unique identifier name for your extension, for example the name of\n * your library or project. Do not use a shortened identifier as this increases\n * the risk of conflicts. We recommend you add at most one extension field,\n * an object which can contain all the values you need.\n */\n\n/**\n * Scalar Type Definition\n *\n * The leaf values of any request and input values to arguments are\n * Scalars (or Enums) and are defined with a name and a series of functions\n * used to parse input from ast or variables and to ensure validity.\n *\n * If a type's serialize function returns `null` or does not return a value\n * (i.e. it returns `undefined`) then an error will be raised and a `null`\n * value will be returned in the response. It is always better to validate\n *\n * Example:\n *\n * ```ts\n * const OddType = new GraphQLScalarType({\n * name: 'Odd',\n * serialize(value) {\n * if (!Number.isFinite(value)) {\n * throw new Error(\n * `Scalar \"Odd\" cannot represent \"${value}\" since it is not a finite number.`,\n * );\n * }\n *\n * if (value % 2 === 0) {\n * throw new Error(`Scalar \"Odd\" cannot represent \"${value}\" since it is even.`);\n * }\n * return value;\n * }\n * });\n * ```\n */\nexport class GraphQLScalarType {\n constructor(config) {\n var _config$parseValue,\n _config$serialize,\n _config$parseLiteral,\n _config$extensionASTN;\n\n const parseValue =\n (_config$parseValue = config.parseValue) !== null &&\n _config$parseValue !== void 0\n ? _config$parseValue\n : identityFunc;\n this.name = assertName(config.name);\n this.description = config.description;\n this.specifiedByURL = config.specifiedByURL;\n this.serialize =\n (_config$serialize = config.serialize) !== null &&\n _config$serialize !== void 0\n ? _config$serialize\n : identityFunc;\n this.parseValue = parseValue;\n this.parseLiteral =\n (_config$parseLiteral = config.parseLiteral) !== null &&\n _config$parseLiteral !== void 0\n ? _config$parseLiteral\n : (node, variables) => parseValue(valueFromASTUntyped(node, variables));\n this.extensions = toObjMap(config.extensions);\n this.astNode = config.astNode;\n this.extensionASTNodes =\n (_config$extensionASTN = config.extensionASTNodes) !== null &&\n _config$extensionASTN !== void 0\n ? _config$extensionASTN\n : [];\n config.specifiedByURL == null ||\n typeof config.specifiedByURL === 'string' ||\n devAssert(\n false,\n `${this.name} must provide \"specifiedByURL\" as a string, ` +\n `but got: ${inspect(config.specifiedByURL)}.`,\n );\n config.serialize == null ||\n typeof config.serialize === 'function' ||\n devAssert(\n false,\n `${this.name} must provide \"serialize\" function. If this custom Scalar is also used as an input type, ensure \"parseValue\" and \"parseLiteral\" functions are also provided.`,\n );\n\n if (config.parseLiteral) {\n (typeof config.parseValue === 'function' &&\n typeof config.parseLiteral === 'function') ||\n devAssert(\n false,\n `${this.name} must provide both \"parseValue\" and \"parseLiteral\" functions.`,\n );\n }\n }\n\n get [Symbol.toStringTag]() {\n return 'GraphQLScalarType';\n }\n\n toConfig() {\n return {\n name: this.name,\n description: this.description,\n specifiedByURL: this.specifiedByURL,\n serialize: this.serialize,\n parseValue: this.parseValue,\n parseLiteral: this.parseLiteral,\n extensions: this.extensions,\n astNode: this.astNode,\n extensionASTNodes: this.extensionASTNodes,\n };\n }\n\n toString() {\n return this.name;\n }\n\n toJSON() {\n return this.toString();\n }\n}\n\n/**\n * Object Type Definition\n *\n * Almost all of the GraphQL types you define will be object types. Object types\n * have a name, but most importantly describe their fields.\n *\n * Example:\n *\n * ```ts\n * const AddressType = new GraphQLObjectType({\n * name: 'Address',\n * fields: {\n * street: { type: GraphQLString },\n * number: { type: GraphQLInt },\n * formatted: {\n * type: GraphQLString,\n * resolve(obj) {\n * return obj.number + ' ' + obj.street\n * }\n * }\n * }\n * });\n * ```\n *\n * When two types need to refer to each other, or a type needs to refer to\n * itself in a field, you can use a function expression (aka a closure or a\n * thunk) to supply the fields lazily.\n *\n * Example:\n *\n * ```ts\n * const PersonType = new GraphQLObjectType({\n * name: 'Person',\n * fields: () => ({\n * name: { type: GraphQLString },\n * bestFriend: { type: PersonType },\n * })\n * });\n * ```\n */\nexport class GraphQLObjectType {\n constructor(config) {\n var _config$extensionASTN2;\n\n this.name = assertName(config.name);\n this.description = config.description;\n this.isTypeOf = config.isTypeOf;\n this.extensions = toObjMap(config.extensions);\n this.astNode = config.astNode;\n this.extensionASTNodes =\n (_config$extensionASTN2 = config.extensionASTNodes) !== null &&\n _config$extensionASTN2 !== void 0\n ? _config$extensionASTN2\n : [];\n\n this._fields = () => defineFieldMap(config);\n\n this._interfaces = () => defineInterfaces(config);\n\n config.isTypeOf == null ||\n typeof config.isTypeOf === 'function' ||\n devAssert(\n false,\n `${this.name} must provide \"isTypeOf\" as a function, ` +\n `but got: ${inspect(config.isTypeOf)}.`,\n );\n }\n\n get [Symbol.toStringTag]() {\n return 'GraphQLObjectType';\n }\n\n getFields() {\n if (typeof this._fields === 'function') {\n this._fields = this._fields();\n }\n\n return this._fields;\n }\n\n getInterfaces() {\n if (typeof this._interfaces === 'function') {\n this._interfaces = this._interfaces();\n }\n\n return this._interfaces;\n }\n\n toConfig() {\n return {\n name: this.name,\n description: this.description,\n interfaces: this.getInterfaces(),\n fields: fieldsToFieldsConfig(this.getFields()),\n isTypeOf: this.isTypeOf,\n extensions: this.extensions,\n astNode: this.astNode,\n extensionASTNodes: this.extensionASTNodes,\n };\n }\n\n toString() {\n return this.name;\n }\n\n toJSON() {\n return this.toString();\n }\n}\n\nfunction defineInterfaces(config) {\n var _config$interfaces;\n\n const interfaces = resolveReadonlyArrayThunk(\n (_config$interfaces = config.interfaces) !== null &&\n _config$interfaces !== void 0\n ? _config$interfaces\n : [],\n );\n Array.isArray(interfaces) ||\n devAssert(\n false,\n `${config.name} interfaces must be an Array or a function which returns an Array.`,\n );\n return interfaces;\n}\n\nfunction defineFieldMap(config) {\n const fieldMap = resolveObjMapThunk(config.fields);\n isPlainObj(fieldMap) ||\n devAssert(\n false,\n `${config.name} fields must be an object with field names as keys or a function which returns such an object.`,\n );\n return mapValue(fieldMap, (fieldConfig, fieldName) => {\n var _fieldConfig$args;\n\n isPlainObj(fieldConfig) ||\n devAssert(\n false,\n `${config.name}.${fieldName} field config must be an object.`,\n );\n fieldConfig.resolve == null ||\n typeof fieldConfig.resolve === 'function' ||\n devAssert(\n false,\n `${config.name}.${fieldName} field resolver must be a function if ` +\n `provided, but got: ${inspect(fieldConfig.resolve)}.`,\n );\n const argsConfig =\n (_fieldConfig$args = fieldConfig.args) !== null &&\n _fieldConfig$args !== void 0\n ? _fieldConfig$args\n : {};\n isPlainObj(argsConfig) ||\n devAssert(\n false,\n `${config.name}.${fieldName} args must be an object with argument names as keys.`,\n );\n return {\n name: assertName(fieldName),\n description: fieldConfig.description,\n type: fieldConfig.type,\n args: defineArguments(argsConfig),\n resolve: fieldConfig.resolve,\n subscribe: fieldConfig.subscribe,\n deprecationReason: fieldConfig.deprecationReason,\n extensions: toObjMap(fieldConfig.extensions),\n astNode: fieldConfig.astNode,\n };\n });\n}\n\nexport function defineArguments(config) {\n return Object.entries(config).map(([argName, argConfig]) => ({\n name: assertName(argName),\n description: argConfig.description,\n type: argConfig.type,\n defaultValue: argConfig.defaultValue,\n deprecationReason: argConfig.deprecationReason,\n extensions: toObjMap(argConfig.extensions),\n astNode: argConfig.astNode,\n }));\n}\n\nfunction isPlainObj(obj) {\n return isObjectLike(obj) && !Array.isArray(obj);\n}\n\nfunction fieldsToFieldsConfig(fields) {\n return mapValue(fields, (field) => ({\n description: field.description,\n type: field.type,\n args: argsToArgsConfig(field.args),\n resolve: field.resolve,\n subscribe: field.subscribe,\n deprecationReason: field.deprecationReason,\n extensions: field.extensions,\n astNode: field.astNode,\n }));\n}\n/**\n * @internal\n */\n\nexport function argsToArgsConfig(args) {\n return keyValMap(\n args,\n (arg) => arg.name,\n (arg) => ({\n description: arg.description,\n type: arg.type,\n defaultValue: arg.defaultValue,\n deprecationReason: arg.deprecationReason,\n extensions: arg.extensions,\n astNode: arg.astNode,\n }),\n );\n}\nexport function isRequiredArgument(arg) {\n return isNonNullType(arg.type) && arg.defaultValue === undefined;\n}\n\n/**\n * Interface Type Definition\n *\n * When a field can return one of a heterogeneous set of types, a Interface type\n * is used to describe what types are possible, what fields are in common across\n * all types, as well as a function to determine which type is actually used\n * when the field is resolved.\n *\n * Example:\n *\n * ```ts\n * const EntityType = new GraphQLInterfaceType({\n * name: 'Entity',\n * fields: {\n * name: { type: GraphQLString }\n * }\n * });\n * ```\n */\nexport class GraphQLInterfaceType {\n constructor(config) {\n var _config$extensionASTN3;\n\n this.name = assertName(config.name);\n this.description = config.description;\n this.resolveType = config.resolveType;\n this.extensions = toObjMap(config.extensions);\n this.astNode = config.astNode;\n this.extensionASTNodes =\n (_config$extensionASTN3 = config.extensionASTNodes) !== null &&\n _config$extensionASTN3 !== void 0\n ? _config$extensionASTN3\n : [];\n this._fields = defineFieldMap.bind(undefined, config);\n this._interfaces = defineInterfaces.bind(undefined, config);\n config.resolveType == null ||\n typeof config.resolveType === 'function' ||\n devAssert(\n false,\n `${this.name} must provide \"resolveType\" as a function, ` +\n `but got: ${inspect(config.resolveType)}.`,\n );\n }\n\n get [Symbol.toStringTag]() {\n return 'GraphQLInterfaceType';\n }\n\n getFields() {\n if (typeof this._fields === 'function') {\n this._fields = this._fields();\n }\n\n return this._fields;\n }\n\n getInterfaces() {\n if (typeof this._interfaces === 'function') {\n this._interfaces = this._interfaces();\n }\n\n return this._interfaces;\n }\n\n toConfig() {\n return {\n name: this.name,\n description: this.description,\n interfaces: this.getInterfaces(),\n fields: fieldsToFieldsConfig(this.getFields()),\n resolveType: this.resolveType,\n extensions: this.extensions,\n astNode: this.astNode,\n extensionASTNodes: this.extensionASTNodes,\n };\n }\n\n toString() {\n return this.name;\n }\n\n toJSON() {\n return this.toString();\n }\n}\n\n/**\n * Union Type Definition\n *\n * When a field can return one of a heterogeneous set of types, a Union type\n * is used to describe what types are possible as well as providing a function\n * to determine which type is actually used when the field is resolved.\n *\n * Example:\n *\n * ```ts\n * const PetType = new GraphQLUnionType({\n * name: 'Pet',\n * types: [ DogType, CatType ],\n * resolveType(value) {\n * if (value instanceof Dog) {\n * return DogType;\n * }\n * if (value instanceof Cat) {\n * return CatType;\n * }\n * }\n * });\n * ```\n */\nexport class GraphQLUnionType {\n constructor(config) {\n var _config$extensionASTN4;\n\n this.name = assertName(config.name);\n this.description = config.description;\n this.resolveType = config.resolveType;\n this.extensions = toObjMap(config.extensions);\n this.astNode = config.astNode;\n this.extensionASTNodes =\n (_config$extensionASTN4 = config.extensionASTNodes) !== null &&\n _config$extensionASTN4 !== void 0\n ? _config$extensionASTN4\n : [];\n this._types = defineTypes.bind(undefined, config);\n config.resolveType == null ||\n typeof config.resolveType === 'function' ||\n devAssert(\n false,\n `${this.name} must provide \"resolveType\" as a function, ` +\n `but got: ${inspect(config.resolveType)}.`,\n );\n }\n\n get [Symbol.toStringTag]() {\n return 'GraphQLUnionType';\n }\n\n getTypes() {\n if (typeof this._types === 'function') {\n this._types = this._types();\n }\n\n return this._types;\n }\n\n toConfig() {\n return {\n name: this.name,\n description: this.description,\n types: this.getTypes(),\n resolveType: this.resolveType,\n extensions: this.extensions,\n astNode: this.astNode,\n extensionASTNodes: this.extensionASTNodes,\n };\n }\n\n toString() {\n return this.name;\n }\n\n toJSON() {\n return this.toString();\n }\n}\n\nfunction defineTypes(config) {\n const types = resolveReadonlyArrayThunk(config.types);\n Array.isArray(types) ||\n devAssert(\n false,\n `Must provide Array of types or a function which returns such an array for Union ${config.name}.`,\n );\n return types;\n}\n\n/**\n * Enum Type Definition\n *\n * Some leaf values of requests and input values are Enums. GraphQL serializes\n * Enum values as strings, however internally Enums can be represented by any\n * kind of type, often integers.\n *\n * Example:\n *\n * ```ts\n * const RGBType = new GraphQLEnumType({\n * name: 'RGB',\n * values: {\n * RED: { value: 0 },\n * GREEN: { value: 1 },\n * BLUE: { value: 2 }\n * }\n * });\n * ```\n *\n * Note: If a value is not provided in a definition, the name of the enum value\n * will be used as its internal value.\n */\nexport class GraphQLEnumType {\n /* <T> */\n constructor(config) {\n var _config$extensionASTN5;\n\n this.name = assertName(config.name);\n this.description = config.description;\n this.extensions = toObjMap(config.extensions);\n this.astNode = config.astNode;\n this.extensionASTNodes =\n (_config$extensionASTN5 = config.extensionASTNodes) !== null &&\n _config$extensionASTN5 !== void 0\n ? _config$extensionASTN5\n : [];\n this._values =\n typeof config.values === 'function'\n ? config.values\n : defineEnumValues(this.name, config.values);\n this._valueLookup = null;\n this._nameLookup = null;\n }\n\n get [Symbol.toStringTag]() {\n return 'GraphQLEnumType';\n }\n\n getValues() {\n if (typeof this._values === 'function') {\n this._values = defineEnumValues(this.name, this._values());\n }\n\n return this._values;\n }\n\n getValue(name) {\n if (this._nameLookup === null) {\n this._nameLookup = keyMap(this.getValues(), (value) => value.name);\n }\n\n return this._nameLookup[name];\n }\n\n serialize(outputValue) {\n if (this._valueLookup === null) {\n this._valueLookup = new Map(\n this.getValues().map((enumValue) => [enumValue.value, enumValue]),\n );\n }\n\n const enumValue = this._valueLookup.get(outputValue);\n\n if (enumValue === undefined) {\n throw new GraphQLError(\n `Enum \"${this.name}\" cannot represent value: ${inspect(outputValue)}`,\n );\n }\n\n return enumValue.name;\n }\n\n parseValue(inputValue) /* T */\n {\n if (typeof inputValue !== 'string') {\n const valueStr = inspect(inputValue);\n throw new GraphQLError(\n `Enum \"${this.name}\" cannot represent non-string value: ${valueStr}.` +\n didYouMeanEnumValue(this, valueStr),\n );\n }\n\n const enumValue = this.getValue(inputValue);\n\n if (enumValue == null) {\n throw new GraphQLError(\n `Value \"${inputValue}\" does not exist in \"${this.name}\" enum.` +\n didYouMeanEnumValue(this, inputValue),\n );\n }\n\n return enumValue.value;\n }\n\n parseLiteral(valueNode, _variables) /* T */\n {\n // Note: variables will be resolved to a value before calling this function.\n if (valueNode.kind !== Kind.ENUM) {\n const valueStr = print(valueNode);\n throw new GraphQLError(\n `Enum \"${this.name}\" cannot represent non-enum value: ${valueStr}.` +\n didYouMeanEnumValue(this, valueStr),\n {\n nodes: valueNode,\n },\n );\n }\n\n const enumValue = this.getValue(valueNode.value);\n\n if (enumValue == null) {\n const valueStr = print(valueNode);\n throw new GraphQLError(\n `Value \"${valueStr}\" does not exist in \"${this.name}\" enum.` +\n didYouMeanEnumValue(this, valueStr),\n {\n nodes: valueNode,\n },\n );\n }\n\n return enumValue.value;\n }\n\n toConfig() {\n const values = keyValMap(\n this.getValues(),\n (value) => value.name,\n (value) => ({\n description: value.description,\n value: value.value,\n deprecationReason: value.deprecationReason,\n extensions: value.extensions,\n astNode: value.astNode,\n }),\n );\n return {\n name: this.name,\n description: this.description,\n values,\n extensions: this.extensions,\n astNode: this.astNode,\n extensionASTNodes: this.extensionASTNodes,\n };\n }\n\n toString() {\n return this.name;\n }\n\n toJSON() {\n return this.toString();\n }\n}\n\nfunction didYouMeanEnumValue(enumType, unknownValueStr) {\n const allNames = enumType.getValues().map((value) => value.name);\n const suggestedValues = suggestionList(unknownValueStr, allNames);\n return didYouMean('the enum value', suggestedValues);\n}\n\nfunction defineEnumValues(typeName, valueMap) {\n isPlainObj(valueMap) ||\n devAssert(\n false,\n `${typeName} values must be an object with value names as keys.`,\n );\n return Object.entries(valueMap).map(([valueName, valueConfig]) => {\n isPlainObj(valueConfig) ||\n devAssert(\n false,\n `${typeName}.${valueName} must refer to an object with a \"value\" key ` +\n `representing an internal value but got: ${inspect(valueConfig)}.`,\n );\n return {\n name: assertEnumValueName(valueName),\n description: valueConfig.description,\n value: valueConfig.value !== undefined ? valueConfig.value : valueName,\n deprecationReason: valueConfig.deprecationReason,\n extensions: toObjMap(valueConfig.extensions),\n astNode: valueConfig.astNode,\n };\n });\n}\n\n/**\n * Input Object Type Definition\n *\n * An input object defines a structured collection of fields which may be\n * supplied to a field argument.\n *\n * Using `NonNull` will ensure that a value must be provided by the query\n *\n * Example:\n *\n * ```ts\n * const GeoPoint = new GraphQLInputObjectType({\n * name: 'GeoPoint',\n * fields: {\n * lat: { type: new GraphQLNonNull(GraphQLFloat) },\n * lon: { type: new GraphQLNonNull(GraphQLFloat) },\n * alt: { type: GraphQLFloat, defaultValue: 0 },\n * }\n * });\n * ```\n */\nexport class GraphQLInputObjectType {\n constructor(config) {\n var _config$extensionASTN6, _config$isOneOf;\n\n this.name = assertName(config.name);\n this.description = config.description;\n this.extensions = toObjMap(config.extensions);\n this.astNode = config.astNode;\n this.extensionASTNodes =\n (_config$extensionASTN6 = config.extensionASTNodes) !== null &&\n _config$extensionASTN6 !== void 0\n ? _config$extensionASTN6\n : [];\n this.isOneOf =\n (_config$isOneOf = config.isOneOf) !== null && _config$isOneOf !== void 0\n ? _config$isOneOf\n : false;\n this._fields = defineInputFieldMap.bind(undefined, config);\n }\n\n get [Symbol.toStringTag]() {\n return 'GraphQLInputObjectType';\n }\n\n getFields() {\n if (typeof this._fields === 'function') {\n this._fields = this._fields();\n }\n\n return this._fields;\n }\n\n toConfig() {\n const fields = mapValue(this.getFields(), (field) => ({\n description: field.description,\n type: field.type,\n defaultValue: field.defaultValue,\n deprecationReason: field.deprecationReason,\n extensions: field.extensions,\n astNode: field.astNode,\n }));\n return {\n name: this.name,\n description: this.description,\n fields,\n extensions: this.extensions,\n astNode: this.astNode,\n extensionASTNodes: this.extensionASTNodes,\n isOneOf: this.isOneOf,\n };\n }\n\n toString() {\n return this.name;\n }\n\n toJSON() {\n return this.toString();\n }\n}\n\nfunction defineInputFieldMap(config) {\n const fieldMap = resolveObjMapThunk(config.fields);\n isPlainObj(fieldMap) ||\n devAssert(\n false,\n `${config.name} fields must be an object with field names as keys or a function which returns such an object.`,\n );\n return mapValue(fieldMap, (fieldConfig, fieldName) => {\n !('resolve' in fieldConfig) ||\n devAssert(\n false,\n `${config.name}.${fieldName} field has a resolve property, but Input Types cannot define resolvers.`,\n );\n return {\n name: assertName(fieldName),\n description: fieldConfig.description,\n type: fieldConfig.type,\n defaultValue: fieldConfig.defaultValue,\n deprecationReason: fieldConfig.deprecationReason,\n extensions: toObjMap(fieldConfig.extensions),\n astNode: fieldConfig.astNode,\n };\n });\n}\n\nexport function isRequiredInputField(field) {\n return isNonNullType(field.type) && field.defaultValue === undefined;\n}\n","import {\n\ttype GraphQLArgument,\n\tGraphQLEnumType,\n\tGraphQLInputObjectType,\n\ttype GraphQLInputType,\n\tGraphQLList,\n\tGraphQLNonNull,\n\tGraphQLObjectType,\n\ttype GraphQLOutputType,\n\tGraphQLScalarType,\n} from \"graphql\";\n\ntype GraphQLType =\n\t| GraphQLObjectType<any, any>\n\t| GraphQLEnumType\n\t| GraphQLInputObjectType\n\t| GraphQLScalarType;\n\nexport function makeTSRepresentation(model: GraphQLType) {\n\tif (model instanceof GraphQLObjectType) {\n\t\treturn makeTSTypeFromObject(model);\n\t} else if (model instanceof GraphQLScalarType) {\n\t\treturn mapGraphqlScalarToTSTypeString(model);\n\t} else if (model instanceof GraphQLEnumType) {\n\t\treturn makeStringLiteralUnionFromEnum(model);\n\t} else if (model instanceof GraphQLInputObjectType) {\n\t\treturn makeTSTypeFromInputObject(model);\n\t}\n}\n\nfunction makeTSTypeFromObject(model: GraphQLObjectType) {\n\tconst stringifiedFields = new Map<string, string>();\n\tfor (const [key, value] of Object.entries(model.getFields())) {\n\t\tstringifiedFields.set(key, makeTSObjectTypeField(value.type, value.args));\n\t}\n\n\treturn `{\n ${stringifiedFields\n\t\t.entries()\n\t\t.map(([key, value]) => `${key}: ${value}`)\n\t\t.toArray()\n\t\t.join(\",\\n \")} \n}`;\n}\n\nfunction makeTSTypeFromInputObject(model: GraphQLInputObjectType) {\n\tconst stringifiedFields = new Map<string, string>();\n\tfor (const [key, value] of Object.entries(model.getFields())) {\n\t\tstringifiedFields.set(key, makeTSInputObjectTypeField(value.type));\n\t}\n\n\treturn `{\n ${stringifiedFields\n\t\t.entries()\n\t\t.map(\n\t\t\t([key, value]) =>\n\t\t\t\t`${key}${value.includes(\"| undefined\") ? \"?\" : \"\"}: ${value}`,\n\t\t)\n\t\t.toArray()\n\t\t.join(\",\\n \")} \n}`;\n}\n\nfunction makeTSObjectTypeField(\n\treturnType: GraphQLOutputType,\n\targs?: readonly GraphQLArgument[],\n) {\n\tlet isNonNullReturnType = false;\n\tlet isList = false;\n\n\tfor (let index = 0; index < 3; index++) {\n\t\tif (returnType instanceof GraphQLList) {\n\t\t\tisList = true;\n\t\t\treturnType = returnType.ofType;\n\t\t}\n\n\t\tif (returnType instanceof GraphQLNonNull) {\n\t\t\tisNonNullReturnType = true;\n\t\t\treturnType = returnType.ofType;\n\t\t}\n\t}\n\n\tlet returnTypeString = (returnType as any).name;\n\n\tif (isList) {\n\t\treturnTypeString += \"[]\";\n\t}\n\n\tif (!isNonNullReturnType) {\n\t\treturnTypeString += \" | null\";\n\t}\n\n\tconst isRelationType = returnType instanceof GraphQLObjectType;\n\n\tconst argsStringMap = new Map<string, string>();\n\n\tfor (const arg of args ?? []) {\n\t\targsStringMap.set(arg.name, stringifyTSObjectArg(arg.type));\n\t}\n\n\tif (isRelationType) {\n\t\tconst makePOptional = argsStringMap\n\t\t\t.entries()\n\t\t\t.every(([, value]) => value.includes(\"| undefined\"));\n\t\tconst argsString =\n\t\t\t(args ?? []).length > 0\n\t\t\t\t? `p${makePOptional ? \"?\" : \"\"}: {\n ${argsStringMap\n\t\t.entries()\n\t\t.map(\n\t\t\t([key, value]) =>\n\t\t\t\t` ${key}${value.includes(\"| undefined\") ? \"?\" : \"\"}: ${value}`,\n\t\t)\n\t\t.toArray()\n\t\t.join(\",\\n \")}\n }`\n\t\t\t\t: \"\";\n\n\t\treturn `(${argsString}) => ${returnTypeString}`;\n\t} else {\n\t\treturn returnTypeString;\n\t}\n}\n\nfunction makeTSInputObjectTypeField(returnType: GraphQLInputType) {\n\tlet isNonNullReturnType = false;\n\tlet isList = false;\n\n\tfor (let index = 0; index < 3; index++) {\n\t\tif (returnType instanceof GraphQLList) {\n\t\t\tisList = true;\n\t\t\treturnType = returnType.ofType;\n\t\t}\n\n\t\tif (returnType instanceof GraphQLNonNull) {\n\t\t\tisNonNullReturnType = true;\n\t\t\treturnType = returnType.ofType;\n\t\t}\n\t}\n\n\tlet returnTypeString = (returnType as any).name;\n\n\tif (isList) {\n\t\treturnTypeString += \"[]\";\n\t}\n\n\tif (!isNonNullReturnType) {\n\t\treturnTypeString += \" | null | undefined\";\n\t} else if (isList) {\n\t\treturnTypeString += \" | undefined\";\n\t}\n\n\treturn returnTypeString;\n}\n\nfunction stringifyTSObjectArg(arg: any) {\n\tlet ret = \"unknown\";\n\tlet isNullable = true;\n\n\tif (arg instanceof GraphQLNonNull) {\n\t\tisNullable = false;\n\t\targ = arg.ofType;\n\t}\n\n\tif (\n\t\targ instanceof GraphQLInputObjectType ||\n\t\targ instanceof GraphQLScalarType\n\t) {\n\t\tret = arg.name;\n\t}\n\n\tif (isNullable) {\n\t\tret += \" | null | undefined\"; // we also want undefined in args\n\t}\n\n\treturn ret;\n}\n\nfunction mapGraphqlScalarToTSTypeString(arg: any) {\n\tswitch (arg.name) {\n\t\tcase \"ID\":\n\t\t\treturn \"string\";\n\t\tcase \"String\":\n\t\t\treturn \"string\";\n\t\tcase \"Boolean\":\n\t\t\treturn \"boolean\";\n\t\tcase \"Int\":\n\t\t\treturn \"number\";\n\t\tcase \"Float\":\n\t\t\treturn \"number\";\n\t\tcase \"Date\":\n\t\t\treturn \"Date\";\n\t\tcase \"DateTime\":\n\t\t\treturn \"Date\";\n\t\tcase \"JSON\":\n\t\t\treturn \"any\";\n\t\tdefault:\n\t\t\treturn \"unknown\";\n\t}\n}\n\nfunction makeStringLiteralUnionFromEnum(enumType: GraphQLEnumType) {\n\treturn enumType\n\t\t.getValues()\n\t\t.map((value) => `\"${value.name}\"`)\n\t\t.join(\" | \");\n}\n","import { access, mkdir, rm, writeFile } from \"node:fs/promises\";\nimport { join } from \"node:path\";\nimport type { GraphQLSchema } from \"graphql\";\nimport { generateClient } from \"./client\";\nimport { makeTSRepresentation } from \"./tsRepresentation\";\n\nexport async function generateFromSchema({\n\toutputPath,\n\tschema,\n\trumbleImportPath = \"@m1212e/rumble\",\n\tapiUrl,\n\tuseExternalUrqlClient = false,\n}: {\n\tschema: GraphQLSchema;\n\toutputPath: string;\n\trumbleImportPath?: string;\n\tapiUrl?: string;\n\tuseExternalUrqlClient?: boolean | string;\n}) {\n\ttry {\n\t\tawait access(outputPath);\n\t\tawait rm(outputPath, { recursive: true, force: true });\n\t} catch (error) {}\n\n\tawait mkdir(outputPath, { recursive: true });\n\n\tif (!outputPath.endsWith(\"/\")) {\n\t\toutputPath += \"/\";\n\t}\n\n\tconst imports: string[] = [];\n\tlet code = \"\";\n\n\tconst typeMap = new Map<string, any>();\n\tfor (const [key, object] of Object.entries(schema.getTypeMap())) {\n\t\tif (key.startsWith(\"__\")) continue;\n\t\ttypeMap.set(key, object);\n\t}\n\n\tfor (const [key, object] of typeMap.entries()) {\n\t\tconst rep = makeTSRepresentation(object);\n\n\t\tif (rep === key) {\n\t\t\tcontinue;\n\t\t}\n\n\t\tcode += `\nexport type ${key} = ${makeTSRepresentation(object)};\n\t\t`;\n\t}\n\n\tconst c = generateClient({\n\t\tapiUrl,\n\t\tuseExternalUrqlClient,\n\t\trumbleImportPath,\n\t\tavailableSubscriptions: new Set(\n\t\t\tObject.keys(schema.getSubscriptionType()?.getFields() || {}),\n\t\t),\n\t});\n\n\timports.push(...c.imports);\n\tcode += c.code;\n\n\tawait writeFile(\n\t\tjoin(outputPath, \"client.ts\"),\n\t\t`${imports.join(\"\\n\")}\\n${code}`,\n\t);\n}\n","import type { Client } from \"@urql/core\";\nimport { capitalize } from \"es-toolkit\";\nimport {\n\tempty,\n\tfromValue,\n\tmap,\n\tmerge,\n\tonPush,\n\tpipe,\n\ttoObservable,\n\ttoPromise,\n} from \"wonka\";\n\nexport const argsKey = \"__args\";\n\nexport function makeGraphQLQuery({\n\tqueryName,\n\tinput,\n\tclient,\n\tenableSubscription = false,\n}: {\n\tqueryName: string;\n\tinput: Record<string, any>;\n\tclient: Client;\n\tenableSubscription?: boolean;\n}) {\n\tconst otwQueryName = `${capitalize(queryName)}Query`;\n\tconst argsString = stringifyArgumentObjectToGraphqlList(input[argsKey] ?? {});\n\tconst operationString = (operationVerb: \"query\" | \"subscription\") =>\n\t\t`${operationVerb} ${otwQueryName} { ${queryName}${argsString} { ${stringifySelection(input)} }}`;\n\n\tlet awaitedReturnValueReference: any;\n\n\tconst response = pipe(\n\t\tmerge([\n\t\t\tclient.query(operationString(\"query\"), {}),\n\t\t\tenableSubscription\n\t\t\t\t? client.subscription(operationString(\"subscription\"), {})\n\t\t\t\t: empty,\n\t\t]),\n\t\tmap((v) => {\n\t\t\tconst data = v.data?.[queryName];\n\t\t\tif (!data && v.error) {\n\t\t\t\tthrow v.error;\n\t\t\t}\n\n\t\t\treturn data;\n\t\t}),\n\t\tonPush((data) => {\n\t\t\tif (awaitedReturnValueReference) {\n\t\t\t\tObject.assign(awaitedReturnValueReference, data);\n\t\t\t}\n\t\t}),\n\t);\n\n\tconst promise = new Promise((resolve) => {\n\t\tconst unsub = toObservable(response).subscribe((v) => {\n\t\t\tunsub();\n\t\t\tconst newObservableWithAwaitedValue = pipe(\n\t\t\t\tmerge([response, fromValue(v)]),\n\t\t\t\ttoObservable,\n\t\t\t);\n\t\t\tawaitedReturnValueReference = { ...v, ...newObservableWithAwaitedValue };\n\t\t\tresolve(awaitedReturnValueReference);\n\t\t}).unsubscribe;\n\t});\n\tObject.assign(promise, toObservable(response));\n\n\treturn promise;\n}\n\nexport function makeGraphQLMutation({\n\tmutationName,\n\tinput,\n\tclient,\n}: {\n\tmutationName: string;\n\tinput: Record<string, any>;\n\tclient: Client;\n}) {\n\tconst otwMutationName = `${capitalize(mutationName)}Mutation`;\n\n\tconst argsString = stringifyArgumentObjectToGraphqlList(input[argsKey] ?? {});\n\n\tconst response = pipe(\n\t\tclient.mutation(\n\t\t\t`mutation ${otwMutationName} { ${mutationName}${argsString} { ${stringifySelection(input)} }}`,\n\t\t\t{},\n\t\t),\n\t\tmap((v) => {\n\t\t\tconst data = v.data?.[mutationName];\n\t\t\tif (!data && v.error) {\n\t\t\t\tthrow v.error;\n\t\t\t}\n\n\t\t\treturn data;\n\t\t}),\n\t);\n\n\tconst observable = toObservable(response);\n\tconst promise = toPromise(response).then((res) => {\n\t\tObject.assign(res, observable);\n\t\treturn res;\n\t});\n\tObject.assign(promise, observable);\n\n\treturn promise;\n}\n\nexport function makeGraphQLSubscription({\n\tsubscriptionName,\n\tinput,\n\tclient,\n}: {\n\tsubscriptionName: string;\n\tinput: Record<string, any>;\n\tclient: Client;\n}) {\n\tconst otwSubscriptionName = `${capitalize(subscriptionName)}Subscription`;\n\tconst argsString = stringifyArgumentObjectToGraphqlList(input[argsKey] ?? {});\n\n\treturn pipe(\n\t\tclient.subscription(\n\t\t\t`subscription ${otwSubscriptionName} { ${subscriptionName}${argsString} { ${stringifySelection(input)} }}`,\n\t\t\t{},\n\t\t),\n\t\tmap((v) => {\n\t\t\tconst data = v.data?.[subscriptionName];\n\t\t\tif (!data && v.error) {\n\t\t\t\tthrow v.error;\n\t\t\t}\n\n\t\t\treturn data;\n\t\t}),\n\t\ttoObservable,\n\t) as any;\n}\n\nfunction stringifySelection(selection: Record<string, any>) {\n\treturn Object.entries(selection)\n\t\t.filter(([key]) => key !== argsKey)\n\t\t.reduce((acc, [key, value]) => {\n\t\t\tif (typeof value === \"object\") {\n\t\t\t\tif (value[argsKey]) {\n\t\t\t\t\tconst argsString = stringifyArgumentObjectToGraphqlList(\n\t\t\t\t\t\tvalue[argsKey],\n\t\t\t\t\t);\n\t\t\t\t\tacc += `${key}${argsString} { ${stringifySelection(value)} }\n`;\n\t\t\t\t\treturn acc;\n\t\t\t\t}\n\n\t\t\t\tacc += `${key} { ${stringifySelection(value)} }\n`;\n\t\t\t} else {\n\t\t\t\tacc += `${key}\n`;\n\t\t\t}\n\t\t\treturn acc;\n\t\t}, \"\");\n}\n\nfunction stringifyArgumentObjectToGraphqlList(args: Record<any, any>) {\n\tconst entries = Object.entries(args);\n\tif (entries.length === 0) {\n\t\treturn \"\";\n\t}\n\n\treturn `(${entries.map(([key, value]) => `${key}: ${stringifyArgumentValue(value)}`).join(\", \")})`;\n}\n\nfunction stringifyArgumentValue(arg: any): string {\n\tswitch (typeof arg) {\n\t\tcase \"string\":\n\t\t\treturn `\"${arg}\"`;\n\t\tcase \"number\":\n\t\t\treturn `${arg}`;\n\t\tcase \"bigint\":\n\t\t\treturn `${arg}`;\n\t\tcase \"boolean\":\n\t\t\treturn `${arg}`;\n\t\tcase \"symbol\":\n\t\t\tthrow new Error(\"Cannot stringify a symbol to send as gql arg\");\n\t\tcase \"undefined\":\n\t\t\treturn \"null\";\n\t\tcase \"object\":\n\t\t\treturn `{ ${Object.entries(arg)\n\t\t\t\t.map(([key, value]) => `${key}: ${stringifyArgumentValue(value)}`)\n\t\t\t\t.join(\", \")} }`;\n\t\tcase \"function\":\n\t\t\tthrow new Error(\"Cannot stringify a function to send as gql arg\");\n\t}\n}\n","import type { Client } from \"@urql/core\";\nimport { makeGraphQLQuery } from \"./request\";\nimport type { QueryableObjectFromGeneratedTypes } from \"./types\";\n\nexport function makeLiveQuery<Query extends Record<string, any>>({\n\turqlClient,\n\tavailableSubscriptions,\n}: {\n\turqlClient: Client;\n\tavailableSubscriptions: Set<string>;\n}) {\n\treturn new Proxy(\n\t\t{},\n\t\t{\n\t\t\tget: (_target, prop) => {\n\t\t\t\treturn (input: Record<string, any>) => {\n\t\t\t\t\treturn makeGraphQLQuery({\n\t\t\t\t\t\tqueryName: prop as string,\n\t\t\t\t\t\tinput,\n\t\t\t\t\t\tclient: urqlClient,\n\t\t\t\t\t\tenableSubscription: availableSubscriptions.has(prop as string),\n\t\t\t\t\t});\n\t\t\t\t};\n\t\t\t},\n\t\t},\n\t) as QueryableObjectFromGeneratedTypes<Query>;\n}\n","import type { Client } from \"@urql/core\";\nimport { makeGraphQLMutation } from \"./request\";\nimport type { QueryableObjectFromGeneratedTypes } from \"./types\";\n\nexport function makeMutation<Mutation extends Record<string, any>>({\n\turqlClient,\n}: {\n\turqlClient: Client;\n}) {\n\treturn new Proxy(\n\t\t{},\n\t\t{\n\t\t\tget: (_target, prop) => {\n\t\t\t\treturn (input: Record<string, any>) => {\n\t\t\t\t\treturn makeGraphQLMutation({\n\t\t\t\t\t\tmutationName: prop as string,\n\t\t\t\t\t\tinput,\n\t\t\t\t\t\tclient: urqlClient,\n\t\t\t\t\t});\n\t\t\t\t};\n\t\t\t},\n\t\t},\n\t) as QueryableObjectFromGeneratedTypes<Mutation>;\n}\n","import type { Client } from \"@urql/core\";\nimport { makeGraphQLQuery } from \"./request\";\nimport type { QueryableObjectFromGeneratedTypes } from \"./types\";\n\nexport function makeQuery<Query extends Record<string, any>>({\n\turqlClient,\n}: {\n\turqlClient: Client;\n}) {\n\treturn new Proxy(\n\t\t{},\n\t\t{\n\t\t\tget: (_target, prop) => {\n\t\t\t\treturn (input: Record<string, any>) => {\n\t\t\t\t\treturn makeGraphQLQuery({\n\t\t\t\t\t\tqueryName: prop as string,\n\t\t\t\t\t\tinput,\n\t\t\t\t\t\tclient: urqlClient,\n\t\t\t\t\t\tenableSubscription: false,\n\t\t\t\t\t});\n\t\t\t\t};\n\t\t\t},\n\t\t},\n\t) as QueryableObjectFromGeneratedTypes<Query>;\n}\n","import type { Client } from \"@urql/core\";\nimport { argsKey, makeGraphQLSubscription } from \"./request\";\nimport type {\n\tApplySelection,\n\tObjectFieldSelection,\n\tSubscribeable,\n} from \"./types\";\nimport type { UnArray } from \"./utilTypes\";\n\nexport function makeSubscription<Subscription extends Record<string, any>>({\n\turqlClient,\n}: {\n\turqlClient: Client;\n}) {\n\treturn new Proxy(\n\t\t{},\n\t\t{\n\t\t\tget: (_target, prop) => {\n\t\t\t\treturn (input: Record<string, any>) => {\n\t\t\t\t\treturn makeGraphQLSubscription({\n\t\t\t\t\t\tsubscriptionName: prop as string,\n\t\t\t\t\t\tinput,\n\t\t\t\t\t\tclient: urqlClient,\n\t\t\t\t\t});\n\t\t\t\t};\n\t\t\t},\n\t\t},\n\t) as SubscriptionObject<Subscription>;\n}\n\nexport type SubscriptionObject<Q> = {\n\t[Key in keyof Q]: QueryableObjectField<Q[Key]>;\n};\n\ntype QueryableObjectField<T> = T extends (\n\tp: infer QueryArgs,\n) => infer QueryResponse\n\t? <\n\t\t\tSelected extends QueryArgs extends Record<string, any>\n\t\t\t\t? ObjectFieldSelection<UnArray<NonNullable<QueryResponse>>> & {\n\t\t\t\t\t\t[argsKey]: QueryArgs;\n\t\t\t\t\t}\n\t\t\t\t: ObjectFieldSelection<UnArray<NonNullable<QueryResponse>>>,\n\t\t>(\n\t\t\ts: Selected,\n\t\t) => QueryResponse extends null\n\t\t\t? Subscribeable<\n\t\t\t\t\tNonNullable<QueryResponse> extends Array<any>\n\t\t\t\t\t\t? ApplySelection<UnArray<NonNullable<QueryResponse>>, Selected>[]\n\t\t\t\t\t\t: ApplySelection<UnArray<NonNullable<QueryResponse>>, Selected>\n\t\t\t\t> | null\n\t\t\t: Subscribeable<\n\t\t\t\t\tQueryResponse extends Array<any>\n\t\t\t\t\t\t? ApplySelection<UnArray<QueryResponse>, Selected>[]\n\t\t\t\t\t\t: ApplySelection<UnArray<QueryResponse>, Selected>\n\t\t\t\t>\n\t: Subscribeable<T>;\n","import { GraphQLError } from \"graphql\";\n/**\n * An error that gets raised by rumble whenever something does not go according to plan.\n * Mostly internals, configuration errors or other unexpected things.\n */\nexport class RumbleError extends Error {\n\tconstructor(message: string) {\n\t\tsuper(message);\n\t\tthis.name = \"RumbleError\";\n\t}\n}\n\n/**\n * An error that gets raised by rumble whenever an error occurs in a resolver, containing\n * information safely exposeable to the user.\n * E.g. the assert helpers issue these.\n */\nexport class RumbleErrorSafe extends GraphQLError {}\n","import type { Filter } from \"../runtimeFiltersPlugin/pluginTypes\";\nimport { RumbleErrorSafe } from \"../types/rumbleError\";\n\n/**\n * \n * Helper function to map a drizzle findFirst query result,\n * which may be optional, to a correct drizzle type.\n * \n * @throws RumbleError\n * \n * @example\n * \n * ```ts\n * schemaBuilder.queryFields((t) => {\n return {\n findFirstUser: t.drizzleField({\n type: UserRef,\n resolve: (query, root, args, ctx, info) => {\n return (\n db.query.users\n .findFirst({\n ...query,\n where: ctx.abilities.users.filter(\"read\").single.where,\n })\n // note that we need to manually raise an error if the value is not found\n .then(assertFindFirstExists)\n );\n },\n }),\n };\n });\n * ```\n */\nexport const assertFindFirstExists = <T>(value: T | undefined): T => {\n\tif (!value)\n\t\tthrow new RumbleErrorSafe(\"Value not found but required (findFirst)\");\n\treturn value;\n};\n\n/**\n * \n * Helper function to map a drizzle findFirst query result,\n * which may be optional, to a correct drizzle type.\n * \n * @throws RumbleError\n * \n * @example\n * \n * ```ts\n schemaBuilder.mutationFields((t) => {\n return {\n updateUsername: t.drizzleField({\n type: UserRef,\n args: {\n userId: t.arg.int({ required: true }),\n newName: t.arg.string({ required: true }),\n },\n resolve: (query, root, args, ctx, info) => {\n return db\n .update(schema.users)\n .set({\n name: args.newName,\n })\n .where(\n and(\n eq(schema.users.id, args.userId),\n ctx.abilities.users.filter(\"update\").single.where\n )\n )\n .returning({ id: schema.users.id, name: schema.users.name })\n // note that we need to manually raise an error if the value is not found\n .then(assertFirstEntryExists);\n },\n }),\n };\n });\n * ```\n */\nexport const assertFirstEntryExists = <T>(value: T[]): T => {\n\tconst v = value.at(0);\n\tif (!v)\n\t\tthrow new RumbleErrorSafe(\"Value not found but required (firstEntry)\");\n\treturn v;\n};\n\n/**\n * A helper to apply a list of filters to a given list of entities.\n * \n * @example\n * \n * ```ts\n * const filtered = await applyFilters({\n filters: abilityBuilder.registeredFilters.posts.update,\n entities: entitiesToFilter,\n context: ctx,\n });\n * ```\n */\nexport const applyFilters = async <Context, T, H extends T>({\n\tfilters,\n\tentities,\n\tcontext,\n}: {\n\tentities: T[];\n\tfilters: Filter<Context, H>[];\n\tcontext: Context;\n}) => {\n\treturn (\n\t\tawait Promise.all(\n\t\t\tfilters.map((f) =>\n\t\t\t\tf({\n\t\t\t\t\tcontext,\n\t\t\t\t\tentities: entities as H[],\n\t\t\t\t}),\n\t\t\t),\n\t\t)\n\t).reduce((acc, val) => {\n\t\tacc.push(...val);\n\t\treturn acc;\n\t}, []) as T[];\n};\n\n/**\n * Helper to map null fields to undefined\n * @param obj The object to map\n * @returns The mapped object with all fields of 'null' transformed to 'undefined'\n * \n * This becomes useful for update mutations where you do not want to pass null (unset value in db)\n * but undefined (do not touch value in db) in case of a value not beeing set in the args of said mutation\n * @example\n * ```ts\n * updateUser: t.drizzleField({\n type: User,\n args: {\n id: t.arg.string({ required: true }),\n email: t.arg.string(),\n lastName: t.arg.string(),\n firstName: t.arg.string(),\n },\n resolve: async (query, root, args, ctx, info) => {\n const mappedArgs = mapNullFieldsToUndefined(args);\n const user = await db.transaction(async (tx) => {\n const user = await tx\n .update(schema.user)\n .set({\n\n // email: args.email ?? undefined,\n // lastName: args.lastName ?? undefined,\n // firstName: args.firstName ?? undefined,\n\n // becomes this\n\n email: mappedArgs.email,\n lastName: mappedArgs.lastName,\n firstName: mappedArgs.firstName,\n })\n .returning()\n .then(assertFirstEntryExists);\n return user;\n });\n\n pubsub.updated(user.id);\n\n return db.query.user\n .findFirst(\n query(\n ctx.abilities.user.filter('read', {\n inject: {\n where: { id: user.id },\n },\n }).query.single,\n ),\n )\n .then(assertFindFirstExists);\n },\n }),\n * \n * \n * ```\n */\nexport function mapNullFieldsToUndefined<T extends object>(obj: T) {\n\treturn Object.fromEntries(\n\t\tObject.entries(obj).map(([key, value]) => [\n\t\t\tkey,\n\t\t\tvalue === null ? undefined : value,\n\t\t]),\n\t) as {\n\t\t[K in keyof T]: T[K] extends null ? undefined : Exclude<T[K], null>;\n\t};\n}\n","/**\n * Creates a lazily initialized function.\n *\n * The returned function will call the initializer function on its first call and\n * store the result. On subsequent calls, it will return the stored result.\n *\n * @param initializer The function to be called for initialization.\n * @returns A function that calls the initializer function on its first call and\n * returns the stored result on subsequent calls.\n */\nexport function lazy<T>(initializer: () => T): () => T {\n\tlet value: T | undefined;\n\tlet initialized = false;\n\n\treturn () => {\n\t\tif (!initialized) {\n\t\t\tvalue = initializer();\n\t\t\tinitialized = true;\n\t\t}\n\t\treturn value!;\n\t};\n}\n","import { RumbleError } from \"../../types/rumbleError\";\n\nexport const possibleSQLTypesStrings = [\n\t\"serial\",\n\t\"int\",\n\t\"integer\",\n\t\"tinyint\",\n\t\"smallint\",\n\t\"mediumint\",\n\t\"real\",\n\t\"decimal\",\n\t\"double\",\n\t\"float\",\n\t\"string\",\n\t\"text\",\n\t\"varchar\",\n\t\"char\",\n\t\"text(256)\",\n\t\"uuid\",\n\t\"boolean\",\n\t\"date\",\n\t\"datetime\",\n\t\"timestamp\",\n\t\"json\",\n] as const;\n\nexport type PossibleSQLType = (typeof possibleSQLTypesStrings)[number];\n\nexport const UnknownTypeRumbleError = (\n\tsqlType: string,\n\tadditionalInfo?: string,\n) =>\n\tnew RumbleError(\n\t\t`RumbleError: Unknown SQL type '${sqlType}'. Please open an issue (https://github.com/m1212e/rumble/issues) so it can be added. (${additionalInfo})`,\n\t);\n","import { type PossibleSQLType, UnknownTypeRumbleError } from \"./types\";\n\nexport function createDistinctValuesFromSQLType(sqlType: PossibleSQLType): {\n\tvalue1: any;\n\tvalue2: any;\n} {\n\tif (\n\t\t[\"serial\", \"int\", \"integer\", \"tinyint\", \"smallint\", \"mediumint\"].includes(\n\t\t\tsqlType,\n\t\t)\n\t) {\n\t\treturn {\n\t\t\tvalue1: 1,\n\t\t\tvalue2: 2,\n\t\t};\n\t}\n\n\tif ([\"real\", \"decimal\", \"double\", \"float\"].includes(sqlType)) {\n\t\treturn {\n\t\t\tvalue1: 1.1,\n\t\t\tvalue2: 2.2,\n\t\t};\n\t}\n\n\tif ([\"string\", \"text\", \"varchar\", \"char\", \"text(256)\"].includes(sqlType)) {\n\t\treturn {\n\t\t\tvalue1: \"a\",\n\t\t\tvalue2: \"b\",\n\t\t};\n\t}\n\n\tif ([\"uuid\"].includes(sqlType)) {\n\t\treturn {\n\t\t\tvalue1: \"fba31870-5528-42d7-b27e-2e5ee657aea5\",\n\t\t\tvalue2: \"fc65db81-c2d1-483d-8a25-a30e2cf6e02d\",\n\t\t};\n\t}\n\n\tif ([\"boolean\"].includes(sqlType)) {\n\t\treturn {\n\t\t\tvalue1: true,\n\t\t\tvalue2: false,\n\t\t};\n\t}\n\n\tif ([\"timestamp\", \"datetime\"].includes(sqlType)) {\n\t\treturn {\n\t\t\tvalue1: new Date(2022, 1, 1),\n\t\t\tvalue2: new Date(2022, 1, 2),\n\t\t};\n\t}\n\n\tif ([\"date\"].includes(sqlType)) {\n\t\treturn {\n\t\t\tvalue1: new Date(2022, 1, 1),\n\t\t\tvalue2: new Date(2022, 1, 2),\n\t\t};\n\t}\n\n\tif ([\"json\"].includes(sqlType)) {\n\t\treturn {\n\t\t\tvalue1: { a: 1 },\n\t\t\tvalue2: { b: 2 },\n\t\t};\n\t}\n\n\tthrow UnknownTypeRumbleError(sqlType, \"Distinct\");\n}\n","import type { Column, Many, One, Table } from \"drizzle-orm\";\nimport type { NonEnumFields } from \"../enum\";\nimport type { GenericDrizzleDbTypeConstraints } from \"../types/genericDrizzleDbType\";\nimport { RumbleError } from \"../types/rumbleError\";\n\nexport type TableIdentifierTSName<DB extends GenericDrizzleDbTypeConstraints> =\n\tkeyof NonEnumFields<NonNullable<DB[\"_\"][\"relations\"][\"schema\"]>>;\n\nconst nameSymbol = Symbol.for(\"drizzle:Name\");\nconst columnsSymbol = Symbol.for(\"drizzle:Columns\");\n\nexport function tableHelper<\n\tDB extends GenericDrizzleDbTypeConstraints,\n\tTSVariable extends TableIdentifierTSName<DB>,\n\tDBVariable extends string,\n\tT extends Table,\n>({\n\tdbName,\n\ttsName,\n\ttable,\n\tdb,\n}: Partial<{\n\ttsName: TSVariable;\n\tdbName: DBVariable;\n\ttable: T;\n}> &\n\t(\n\t\t| {\n\t\t\t\tdbName: DBVariable;\n\t\t }\n\t\t| {\n\t\t\t\ttsName: TSVariable;\n\t\t }\n\t\t| {\n\t\t\t\ttable: T;\n\t\t }\n\t) & { db: DB }) {\n\tlet tableSchema: Table | undefined = table;\n\n\tif (tsName) {\n\t\ttableSchema = db._.relations.schema[tsName as string];\n\t}\n\n\tif (dbName) {\n\t\ttableSchema = Object.values(db._.relations.schema).find(\n\t\t\t(schema: any) => schema[nameSymbol] === dbName,\n\t\t);\n\t}\n\n\tif (!tableSchema) {\n\t\tthrow new RumbleError(\n\t\t\t`Could not find schema for ${JSON.stringify({ tsName, dbName, table: (table as any)?.[nameSymbol] }).toString()}`,\n\t\t);\n\t}\n\n\treturn {\n\t\ttableSchema,\n\t\tcolumns: (tableSchema as any)[columnsSymbol] as Record<string, Column>,\n\t\tget primaryColumns() {\n\t\t\treturn Object.entries((tableSchema as any)[columnsSymbol])\n\t\t\t\t.filter(([, v]) => (v as Column).primary)\n\t\t\t\t.reduce((acc, [k, v]) => {\n\t\t\t\t\t(acc as any)[k] = v;\n\t\t\t\t\treturn acc;\n\t\t\t\t}, {}) as Record<string, Column>;\n\t\t},\n\t\trelations: db._.relations.config[tsName as string] as\n\t\t\t| {\n\t\t\t\t\t[key: string]: One<any, any> | Many<any, any>;\n\t\t\t }\n\t\t\t| undefined,\n\t\tdbName: (tableSchema as any)[nameSymbol] as string,\n\t\tget tsName() {\n\t\t\treturn Object.entries(db._.relations.schema)\n\t\t\t\t.find(([, v]) => v === tableSchema)!\n\t\t\t\t.at(0) as string;\n\t\t},\n\t};\n}\n","import { relationsFilterToSQL } from \"drizzle-orm\";\nimport { debounce } from \"es-toolkit\";\nimport { lazy } from \"./helpers/lazy\";\nimport { createDistinctValuesFromSQLType } from \"./helpers/sqlTypes/distinctValuesFromSQLType\";\nimport { tableHelper } from \"./helpers/tableHelpers\";\nimport type { Filter } from \"./runtimeFiltersPlugin/pluginTypes\";\nimport type { GenericDrizzleDbTypeConstraints } from \"./types/genericDrizzleDbType\";\nimport { RumbleError } from \"./types/rumbleError\";\nimport type {\n\tCustomRumblePothosConfig,\n\tRumbleInput,\n} from \"./types/rumbleInput\";\n\n//TODO: optimize this for v8 & refactor\n\nexport type AbilityBuilderType<\n\tUserContext extends Record<string, any>,\n\tDB extends GenericDrizzleDbTypeConstraints,\n\tRequestEvent extends Record<string, any>,\n\tAction extends string,\n\tPothosConfig extends CustomRumblePothosConfig,\n> = ReturnType<\n\ttypeof createAbilityBuilder<\n\t\tUserContext,\n\t\tDB,\n\t\tRequestEvent,\n\t\tAction,\n\t\tPothosConfig\n\t>\n>;\n\ntype TableName<DB extends GenericDrizzleDbTypeConstraints> = keyof DB[\"query\"];\n\ntype QueryFilterInput<\n\tDB extends GenericDrizzleDbTypeConstraints,\n\tTableKey extends TableName<DB>,\n> = Parameters<DB[\"query\"][TableKey][\"findMany\"]>[0];\n\ntype SimpleQueryFilter<\n\tDB extends GenericDrizzleDbTypeConstraints,\n\tTableKey extends keyof DB[\"query\"],\n\tFilter extends QueryFilterInput<DB, TableKey>,\n> = Filter;\n\ntype FunctionQueryFilter<\n\tDB extends GenericDrizzleDbTypeConstraints,\n\tTableKey extends keyof DB[\"query\"],\n\tFilter extends QueryFilterInput<DB, TableKey>,\n\tContext,\n> = (context: Context) => Filter | undefined | \"allow\";\n\nfunction isSimpleQueryFilter<\n\tDB extends GenericDrizzleDbTypeConstraints,\n\tTableKey extends keyof DB[\"query\"],\n\tFilter extends QueryFilterInput<DB, TableKey>,\n\tContext,\n>(\n\tfilter: QueryFilter<DB, TableKey, Filter, Context>,\n): filter is SimpleQueryFilter<DB, TableKey, Filter> {\n\treturn typeof filter !== \"function\";\n}\n\ntype QueryFilter<\n\tDB extends GenericDrizzleDbTypeConstraints,\n\tTableName extends keyof DB[\"query\"],\n\tFilter extends QueryFilterInput<DB, TableName>,\n\tContext,\n> =\n\t| SimpleQueryFilter<DB, TableName, Filter>\n\t| FunctionQueryFilter<DB, TableName, Filter, Context>;\n\nfunction isFunctionFilter<\n\tDB extends GenericDrizzleDbTypeConstraints,\n\tTableKey extends keyof DB[\"query\"],\n\tFilter extends QueryFilterInput<DB, TableKey>,\n\tContext,\n>(\n\tfilter: QueryFilter<DB, TableKey, Filter, Context>,\n): filter is FunctionQueryFilter<DB, TableKey, Filter, Context> {\n\treturn (\n\t\ttypeof filter === \"function\" && filter.constructor.name !== \"AsyncFunction\"\n\t);\n}\n\nconst nothingRegisteredWarningLogger = debounce(\n\t(model: string, action: string) => {\n\t\tconsole.warn(`\nWarning! No abilities have been registered for\n\n ${model}/${action}\n\nbut has been accessed. This will block everything. If this is intended, you can ignore this warning. If not, please ensure that you register the ability in your ability builder.\n`);\n\t},\n\t1000,\n);\n\nexport const createAbilityBuilder = <\n\tUserContext extends Record<string, any>,\n\tDB extends GenericDrizzleDbTypeConstraints,\n\tRequestEvent extends Record<string, any>,\n\tAction extends string,\n\tPothosConfig extends CustomRumblePothosConfig,\n>({\n\tdb,\n\tactions,\n\tdefaultLimit,\n}: RumbleInput<UserContext, DB, RequestEvent, Action, PothosConfig>) => {\n\tconst registrators: {\n\t\t[key in TableName<DB>]: ReturnType<typeof createRegistrator<key>>;\n\t} = {} as any;\n\n\tconst registeredQueryFilters: {\n\t\t[key in TableName<DB>]: {\n\t\t\t[key in Action]: QueryFilter<DB, key, any, UserContext>[] | \"unspecified\";\n\t\t};\n\t} = {} as any;\n\n\tconst registeredRuntimeFilters: {\n\t\t[key in TableName<DB>]: {\n\t\t\t//TODO add a run all helper\n\t\t\t[key in Action]: Filter<UserContext, any>[];\n\t\t};\n\t} = {} as any;\n\n\tconst createRegistrator = <TableNameT extends TableName<DB>>(\n\t\ttableName: TableNameT,\n\t) => {\n\t\t// we want to init all possible application level filters since we want to ensure\n\t\t// that the implementaiton helpers pass an object by reference when creating\n\t\t// the implementation, instead of a copy like it would be the case with undefined\n\t\tfor (const action of actions!) {\n\t\t\tif (!registeredRuntimeFilters[tableName]) {\n\t\t\t\tregisteredRuntimeFilters[tableName] = {} as any;\n\t\t\t}\n\t\t\tif (!registeredRuntimeFilters[tableName][action]) {\n\t\t\t\tregisteredRuntimeFilters[tableName][action] = [];\n\t\t\t}\n\t\t}\n\n\t\treturn {\n\t\t\t/**\n\t\t\t * Allows to perform a specific action on a specific entity\n\t\t\t */\n\t\t\tallow: (action: Action | Action[]) => {\n\t\t\t\tlet queryFiltersPerEntity = registeredQueryFilters[tableName];\n\t\t\t\tif (!queryFiltersPerEntity) {\n\t\t\t\t\tqueryFiltersPerEntity = {} as any;\n\t\t\t\t\tregisteredQueryFilters[tableName] = queryFiltersPerEntity;\n\t\t\t\t}\n\n\t\t\t\tconst actions = Array.isArray(action) ? action : [action];\n\t\t\t\tfor (const action of actions) {\n\t\t\t\t\tlet queryFiltersPerEntityAndAction = queryFiltersPerEntity[action];\n\t\t\t\t\tif (!queryFiltersPerEntityAndAction) {\n\t\t\t\t\t\tqueryFiltersPerEntityAndAction = \"unspecified\";\n\t\t\t\t\t\tqueryFiltersPerEntity[action] = queryFiltersPerEntityAndAction;\n\t\t\t\t\t}\n\t\t\t\t}\n\n\t\t\t\treturn {\n\t\t\t\t\t/**\n\t\t\t\t\t * Restricts the allowed actions to a filter\n\t\t\t\t\t * @example\n\t\t\t\t\t * ```ts\n\t\t\t\t\t * abilityBuilder.users.allow([\"read\", \"update\", \"delete\"]).when(({ userId }) => ({\n\t\t\t\t\t * where: {\n\t\t\t\t\t * id: userId,\n\t\t\t\t\t * },\n\t\t\t\t\t * }));\n\t\t\t\t\t * ```\n\t\t\t\t\t */\n\t\t\t\t\twhen: (\n\t\t\t\t\t\tqueryFilter: QueryFilter<\n\t\t\t\t\t\t\tDB,\n\t\t\t\t\t\t\tTableNameT,\n\t\t\t\t\t\t\tQueryFilterInput<DB, TableNameT>,\n\t\t\t\t\t\t\tUserContext\n\t\t\t\t\t\t>,\n\t\t\t\t\t) => {\n\t\t\t\t\t\tfor (const action of actions) {\n\t\t\t\t\t\t\tif (queryFiltersPerEntity[action] === \"unspecified\") {\n\t\t\t\t\t\t\t\tqueryFiltersPerEntity[action] = [];\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\tconst queryFiltersPerEntityAndAction =\n\t\t\t\t\t\t\t\tqueryFiltersPerEntity[action];\n\t\t\t\t\t\t\t(\n\t\t\t\t\t\t\t\tqueryFiltersPerEntityAndAction as Exclude<\n\t\t\t\t\t\t\t\t\ttypeof queryFiltersPerEntityAndAction,\n\t\t\t\t\t\t\t\t\t\"unspecified\"\n\t\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t).push(queryFilter);\n\t\t\t\t\t\t}\n\t\t\t\t\t},\n\t\t\t\t};\n\t\t\t},\n\t\t\t/**\n\t\t\t * Allows to register an application level filter to restrict some results\n\t\t\t * which were returned by a query\n\t\t\t */\n\t\t\tfilter: (action: Action | Action[]) => {\n\t\t\t\tconst actions = Array.isArray(action) ? action : [action];\n\t\t\t\treturn {\n\t\t\t\t\t/**\n\t\t\t\t\t * The actual filter function to apply. Returns the allowed values\n\t\t\t\t\t */\n\t\t\t\t\tby: (\n\t\t\t\t\t\texplicitFilter: Filter<\n\t\t\t\t\t\t\tUserContext,\n\t\t\t\t\t\t\tNonNullable<\n\t\t\t\t\t\t\t\tAwaited<ReturnType<DB[\"query\"][TableNameT][\"findFirst\"]>>\n\t\t\t\t\t\t\t>\n\t\t\t\t\t\t>,\n\t\t\t\t\t) => {\n\t\t\t\t\t\tfor (const action of actions) {\n\t\t\t\t\t\t\tregisteredRuntimeFilters[tableName][action].push(explicitFilter);\n\t\t\t\t\t\t}\n\t\t\t\t\t},\n\t\t\t\t};\n\t\t\t},\n\t\t};\n\t};\n\n\tfor (const entityKey of Object.keys(db.query) as TableName<DB>[]) {\n\t\tregistrators[entityKey] = createRegistrator(entityKey);\n\t}\n\n\treturn {\n\t\t...registrators,\n\t\t/**\n\t\t * @internal\n\t\t * @ignore\n\t\t */\n\t\tz_registeredQueryFilters: registeredQueryFilters,\n\t\t/**\n\t\t * @internal\n\t\t * @ignore\n\t\t */\n\t\tz_registeredFilters: registeredRuntimeFilters,\n\t\t/**\n\t\t * @internal\n\t\t * @ignore\n\t\t */\n\t\tz_buildWithUserContext: (userContext: UserContext) => {\n\t\t\tconst builder: {\n\t\t\t\t[key in TableName<DB>]: ReturnType<typeof createEntityObject<key>>;\n\t\t\t} = {} as any;\n\n\t\t\tconst createEntityObject = <TableNameT extends TableName<DB>>(\n\t\t\t\ttableName: TableNameT,\n\t\t\t) => {\n\t\t\t\treturn {\n\t\t\t\t\tfilter: <\n\t\t\t\t\t\tInjection extends SimpleQueryFilter<\n\t\t\t\t\t\t\tDB,\n\t\t\t\t\t\t\tTableNameT,\n\t\t\t\t\t\t\tQueryFilterInput<DB, TableNameT>\n\t\t\t\t\t\t>,\n\t\t\t\t\t>(\n\t\t\t\t\t\taction: Action,\n\t\t\t\t\t\toptions?: {\n\t\t\t\t\t\t\t/**\n\t\t\t\t\t\t\t * Additional query filters applied only for this call. Useful for injecting one time additional filters\n\t\t\t\t\t\t\t * for e.g. user args in a handler.\n\t\t\t\t\t\t\t */\n\t\t\t\t\t\t\tinject?: Injection;\n\t\t\t\t\t\t},\n\t\t\t\t\t) => {\n\t\t\t\t\t\t/**\n\t\t\t\t\t\t * Packs the filters into a response object that can be applied for queries by the user\n\t\t\t\t\t\t */\n\t\t\t\t\t\tconst transformToResponse = <\n\t\t\t\t\t\t\tF extends QueryFilterInput<DB, TableNameT>,\n\t\t\t\t\t\t>(\n\t\t\t\t\t\t\tqueryFilters?: F,\n\t\t\t\t\t\t) => {\n\t\t\t\t\t\t\tconst where = lazy(() => {\n\t\t\t\t\t\t\t\tif (!queryFilters?.where && !options?.inject?.where) {\n\t\t\t\t\t\t\t\t\treturn;\n\t\t\t\t\t\t\t\t}\n\n\t\t\t\t\t\t\t\tif (options?.inject?.where && queryFilters?.where) {\n\t\t\t\t\t\t\t\t\treturn {\n\t\t\t\t\t\t\t\t\t\tAND: [queryFilters?.where, options?.inject?.where],\n\t\t\t\t\t\t\t\t\t};\n\t\t\t\t\t\t\t\t}\n\n\t\t\t\t\t\t\t\tif (options?.inject?.where && !queryFilters?.where) {\n\t\t\t\t\t\t\t\t\treturn options?.inject?.where;\n\t\t\t\t\t\t\t\t}\n\n\t\t\t\t\t\t\t\tif (!options?.inject?.where && queryFilters?.where) {\n\t\t\t\t\t\t\t\t\treturn queryFilters?.where;\n\t\t\t\t\t\t\t\t}\n\n\t\t\t\t\t\t\t\tif (!options?.inject?.where && !queryFilters?.where) {\n\t\t\t\t\t\t\t\t\treturn undefined;\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t});\n\n\t\t\t\t\t\t\tconst transformedWhere = lazy(() => {\n\t\t\t\t\t\t\t\tconst w = where();\n\t\t\t\t\t\t\t\tif (!w) {\n\t\t\t\t\t\t\t\t\treturn;\n\t\t\t\t\t\t\t\t}\n\n\t\t\t\t\t\t\t\tconst table = tableHelper({\n\t\t\t\t\t\t\t\t\ttsName: tableName,\n\t\t\t\t\t\t\t\t\tdb,\n\t\t\t\t\t\t\t\t});\n\n\t\t\t\t\t\t\t\treturn relationsFilterToSQL(table.tableSchema, w);\n\t\t\t\t\t\t\t});\n\n\t\t\t\t\t\t\tconst limit = lazy(() => {\n\t\t\t\t\t\t\t\tlet limit =\n\t\t\t\t\t\t\t\t\tqueryFilters?.limit ?? (defaultLimit as undefined | number);\n\n\t\t\t\t\t\t\t\t// only apply limit if neither default limit or ability limit are set\n\t\t\t\t\t\t\t\t// or lower amount is set\n\t\t\t\t\t\t\t\tif (\n\t\t\t\t\t\t\t\t\toptions?.inject?.limit &&\n\t\t\t\t\t\t\t\t\t(!limit || limit > options.inject.limit)\n\t\t\t\t\t\t\t\t) {\n\t\t\t\t\t\t\t\t\tlimit = options.inject.limit;\n\t\t\t\t\t\t\t\t}\n\n\t\t\t\t\t\t\t\tif (\n\t\t\t\t\t\t\t\t\tqueryFilters?.limit &&\n\t\t\t\t\t\t\t\t\t(!limit || queryFilters.limit > limit)\n\t\t\t\t\t\t\t\t) {\n\t\t\t\t\t\t\t\t\tlimit = queryFilters.limit;\n\t\t\t\t\t\t\t\t}\n\n\t\t\t\t\t\t\t\t// ensure that null is converted to undefined\n\t\t\t\t\t\t\t\treturn limit ?? undefined;\n\t\t\t\t\t\t\t});\n\n\t\t\t\t\t\t\tconst columns = lazy(() => {\n\t\t\t\t\t\t\t\tif (!queryFilters?.columns && !options?.inject?.columns) {\n\t\t\t\t\t\t\t\t\treturn;\n\t\t\t\t\t\t\t\t}\n\n\t\t\t\t\t\t\t\treturn {\n\t\t\t\t\t\t\t\t\t...queryFilters?.columns,\n\t\t\t\t\t\t\t\t\t...options?.inject?.columns,\n\t\t\t\t\t\t\t\t} as undefined;\n\t\t\t\t\t\t\t\t// we need to type this as undefined because TS would\n\t\t\t\t\t\t\t\t// do some funky stuff with query resolve typing otherwise\n\t\t\t\t\t\t\t});\n\n\t\t\t\t\t\t\tconst r = {\n\t\t\t\t\t\t\t\t/**\n\t\t\t\t\t\t\t\t * Query filters for the drizzle query API.\n\t\t\t\t\t\t\t\t * @example\n\t\t\t\t\t\t\t\t * ```ts\n\t\t\t\t\t\t\t\t * author: t.relation(\"author\", {\n\t\t\t\t\t\t\t\t * query: (_args, ctx) => ctx.abilities.users.filter(\"read\").query.single,\n\t\t\t\t\t\t\t\t * }),\n\t\t\t\t\t\t\t\t * ´´´\n\t\t\t\t\t\t\t\t */\n\t\t\t\t\t\t\t\tquery: {\n\t\t\t\t\t\t\t\t\t/**\n\t\t\t\t\t\t\t\t\t * For find first calls\n\t\t\t\t\t\t\t\t\t */\n\t\t\t\t\t\t\t\t\tsingle: {\n\t\t\t\t\t\t\t\t\t\tget where() {\n\t\t\t\t\t\t\t\t\t\t\treturn where();\n\t\t\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t\t\tcolumns: columns(),\n\t\t\t\t\t\t\t\t\t} as Pick<\n\t\t\t\t\t\t\t\t\t\tNonNullable<\n\t\t\t\t\t\t\t\t\t\t\tNonNullable<\n\t\t\t\t\t\t\t\t\t\t\t\tParameters<DB[\"query\"][TableNameT][\"findFirst\"]>[0]\n\t\t\t\t\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t\t\t>,\n\t\t\t\t\t\t\t\t\t\t\"columns\" | \"where\"\n\t\t\t\t\t\t\t\t\t>,\n\t\t\t\t\t\t\t\t\t/**\n\t\t\t\t\t\t\t\t\t * For find many calls\n\t\t\t\t\t\t\t\t\t */\n\t\t\t\t\t\t\t\t\tmany: {\n\t\t\t\t\t\t\t\t\t\tget where() {\n\t\t\t\t\t\t\t\t\t\t\treturn where();\n\t\t\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t\t\tcolumns: columns(),\n\t\t\t\t\t\t\t\t\t\tget limit() {\n\t\t\t\t\t\t\t\t\t\t\treturn limit();\n\t\t\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t\t} as Pick<\n\t\t\t\t\t\t\t\t\t\tNonNullable<\n\t\t\t\t\t\t\t\t\t\t\tNonNullable<\n\t\t\t\t\t\t\t\t\t\t\t\tParameters<DB[\"query\"][TableNameT][\"findMany\"]>[0]\n\t\t\t\t\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t\t\t>,\n\t\t\t\t\t\t\t\t\t\t\"columns\" | \"where\" | \"limit\"\n\t\t\t\t\t\t\t\t\t>,\n\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t/**\n\t\t\t\t\t\t\t\t * Query filters for the drizzle SQL API as used in e.g. updates.\n\t\t\t\t\t\t\t\t * @example\n\t\t\t\t\t\t\t\t *\n\t\t\t\t\t\t\t\t * ```ts\n\t\t\t\t\t\t\t\t * await db\n\t\t\t\t\t\t\t\t *\t.update(schema.users)\n\t\t\t\t\t\t\t\t *\t.set({\n\t\t\t\t\t\t\t\t *\t name: args.newName,\n\t\t\t\t\t\t\t\t * \t})\n\t\t\t\t\t\t\t\t *\t.where(\n\t\t\t\t\t\t\t\t *\t and(\n\t\t\t\t\t\t\t\t *\t eq(schema.users.id, args.userId),\n\t\t\t\t\t\t\t\t *\t ctx.abilities.users.filter(\"update\").sql.where,\n\t\t\t\t\t\t\t\t *\t ),\n\t\t\t\t\t\t\t\t *\t);\n\t\t\t\t\t\t\t\t * ```\n\t\t\t\t\t\t\t\t *\n\t\t\t\t\t\t\t\t */\n\t\t\t\t\t\t\t\tsql: {\n\t\t\t\t\t\t\t\t\tget where() {\n\t\t\t\t\t\t\t\t\t\treturn transformedWhere();\n\t\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t\tcolumns: columns(),\n\t\t\t\t\t\t\t\t\tget limit() {\n\t\t\t\t\t\t\t\t\t\treturn limit();\n\t\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t};\n\n\t\t\t\t\t\t\t// columns can't be set to undefined, drizzle will interpret this\n\t\t\t\t\t\t\t// as: don't return any columns\n\t\t\t\t\t\t\t// therefore we need to delete it\n\t\t\t\t\t\t\tif (!columns()) {\n\t\t\t\t\t\t\t\tdelete r.sql.columns;\n\t\t\t\t\t\t\t\tdelete r.query.many.columns;\n\t\t\t\t\t\t\t\tdelete r.query.single.columns;\n\t\t\t\t\t\t\t}\n\n\t\t\t\t\t\t\treturn r;\n\t\t\t\t\t\t};\n\n\t\t\t\t\t\t/**\n\t\t\t\t\t\t * Creates a filter that will never return any result\n\t\t\t\t\t\t */\n\t\t\t\t\t\tconst getBlockEverythingFilter = () => {\n\t\t\t\t\t\t\tconst tableSchema = tableHelper({\n\t\t\t\t\t\t\t\tdb,\n\t\t\t\t\t\t\t\ttsName: tableName,\n\t\t\t\t\t\t\t});\n\n\t\t\t\t\t\t\tif (Object.keys(tableSchema.primaryColumns).length === 0) {\n\t\t\t\t\t\t\t\tthrow new RumbleError(\n\t\t\t\t\t\t\t\t\t`No primary key found for entity ${tableName.toString()}`,\n\t\t\t\t\t\t\t\t);\n\t\t\t\t\t\t\t}\n\n\t\t\t\t\t\t\tconst primaryKeyField = Object.values(\n\t\t\t\t\t\t\t\ttableSchema.primaryColumns,\n\t\t\t\t\t\t\t)[0];\n\t\t\t\t\t\t\t// we want a filter that excludes everything\n\t\t\t\t\t\t\tconst distinctValues = createDistinctValuesFromSQLType(\n\t\t\t\t\t\t\t\tprimaryKeyField.getSQLType() as any,\n\t\t\t\t\t\t\t);\n\n\t\t\t\t\t\t\t// when the user has no permission for anything, ensure returns nothing\n\t\t\t\t\t\t\treturn {\n\t\t\t\t\t\t\t\twhere: {\n\t\t\t\t\t\t\t\t\tAND: [\n\t\t\t\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t\t\t\t[primaryKeyField.name]: distinctValues.value1,\n\t\t\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t\t\t\t[primaryKeyField.name]: distinctValues.value2,\n\t\t\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t\t],\n\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t};\n\t\t\t\t\t\t};\n\n\t\t\t\t\t\tlet queryFiltersPerEntityAndAction =\n\t\t\t\t\t\t\tregisteredQueryFilters?.[tableName]?.[action];\n\n\t\t\t\t\t\t// in case we have a wildcard ability, skip the rest and only apply the injected\n\t\t\t\t\t\t// filters, if any\n\t\t\t\t\t\tif (queryFiltersPerEntityAndAction === \"unspecified\") {\n\t\t\t\t\t\t\treturn transformToResponse();\n\t\t\t\t\t\t}\n\n\t\t\t\t\t\t// if nothing has been allowed, block everything\n\t\t\t\t\t\tif (!queryFiltersPerEntityAndAction) {\n\t\t\t\t\t\t\tnothingRegisteredWarningLogger(tableName.toString(), action);\n\t\t\t\t\t\t\tqueryFiltersPerEntityAndAction = [getBlockEverythingFilter()];\n\t\t\t\t\t\t}\n\n\t\t\t\t\t\t//TODO: we could maybe improve performance by not filtering at each creation\n\t\t\t\t\t\t// but instead while the user sets the abilities\n\t\t\t\t\t\tconst simpleQueryFilters: SimpleQueryFilter<\n\t\t\t\t\t\t\tDB,\n\t\t\t\t\t\t\tTableNameT,\n\t\t\t\t\t\t\tQueryFilterInput<DB, TableNameT>\n\t\t\t\t\t\t>[] = queryFiltersPerEntityAndAction.filter(isSimpleQueryFilter);\n\n\t\t\t\t\t\tconst functionQueryFilters: ReturnType<\n\t\t\t\t\t\t\tFunctionQueryFilter<\n\t\t\t\t\t\t\t\tDB,\n\t\t\t\t\t\t\t\tTableNameT,\n\t\t\t\t\t\t\t\tQueryFilterInput<DB, TableNameT>,\n\t\t\t\t\t\t\t\tUserContext\n\t\t\t\t\t\t\t>\n\t\t\t\t\t\t>[] = queryFiltersPerEntityAndAction\n\t\t\t\t\t\t\t.filter(isFunctionFilter)\n\t\t\t\t\t\t\t.map((queryFilter) => queryFilter(userContext));\n\n\t\t\t\t\t\t//TODO: we could save some work by not running all the filters at each request\n\t\t\t\t\t\t// whenever one already returned \"allowed\"\n\t\t\t\t\t\tconst someWildcardFound = functionQueryFilters.some(\n\t\t\t\t\t\t\t(c) => c === \"allow\",\n\t\t\t\t\t\t);\n\n\t\t\t\t\t\tlet allQueryFilters = [\n\t\t\t\t\t\t\t...simpleQueryFilters,\n\t\t\t\t\t\t\t...functionQueryFilters,\n\t\t\t\t\t\t]\n\t\t\t\t\t\t\t// we just ignore the ones who did return undefined, since that evaluates to \"allow nothing\"\n\t\t\t\t\t\t\t.filter((e) => e !== undefined)\n\t\t\t\t\t\t\t// we already checked if we have some wildcard, so we can ignore the wildcard entries from now on\n\t\t\t\t\t\t\t.filter((e) => e !== \"allow\");\n\n\t\t\t\t\t\t// if we don't have any permitted filters and don't have a wildcard, then block everything\n\t\t\t\t\t\tif (!someWildcardFound && allQueryFilters.length === 0) {\n\t\t\t\t\t\t\tallQueryFilters = [getBlockEverythingFilter()];\n\t\t\t\t\t\t}\n\n\t\t\t\t\t\tlet highestLimit: number | undefined;\n\t\t\t\t\t\tfor (const conditionObject of allQueryFilters) {\n\t\t\t\t\t\t\tif (conditionObject?.limit) {\n\t\t\t\t\t\t\t\tif (\n\t\t\t\t\t\t\t\t\thighestLimit === undefined ||\n\t\t\t\t\t\t\t\t\tconditionObject.limit > highestLimit\n\t\t\t\t\t\t\t\t) {\n\t\t\t\t\t\t\t\t\thighestLimit = conditionObject.limit;\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}\n\n\t\t\t\t\t\tlet combinedAllowedColumns: Record<string, any> | undefined;\n\t\t\t\t\t\tfor (const conditionObject of [\n\t\t\t\t\t\t\t...allQueryFilters,\n\t\t\t\t\t\t\toptions?.inject,\n\t\t\t\t\t\t]) {\n\t\t\t\t\t\t\tif (conditionObject?.columns) {\n\t\t\t\t\t\t\t\tif (combinedAllowedColumns === undefined) {\n\t\t\t\t\t\t\t\t\tcombinedAllowedColumns = conditionObject.columns;\n\t\t\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\t\t\tcombinedAllowedColumns = {\n\t\t\t\t\t\t\t\t\t\t...combinedAllowedColumns,\n\t\t\t\t\t\t\t\t\t\t...conditionObject.columns,\n\t\t\t\t\t\t\t\t\t};\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}\n\n\t\t\t\t\t\t// in case we have a wildcard, we don't want to apply any where conditions\n\t\t\t\t\t\tconst accumulatedWhereConditions = someWildcardFound\n\t\t\t\t\t\t\t? []\n\t\t\t\t\t\t\t: allQueryFilters.filter((o) => o?.where).map((o) => o.where);\n\n\t\t\t\t\t\tconst combinedWhere =\n\t\t\t\t\t\t\taccumulatedWhereConditions.length > 0\n\t\t\t\t\t\t\t\t? { OR: accumulatedWhereConditions }\n\t\t\t\t\t\t\t\t: undefined;\n\n\t\t\t\t\t\treturn transformToResponse({\n\t\t\t\t\t\t\twhere: combinedWhere,\n\t\t\t\t\t\t\tcolumns: combinedAllowedColumns,\n\t\t\t\t\t\t\tlimit: highestLimit,\n\t\t\t\t\t\t});\n\t\t\t\t\t},\n\t\t\t\t\truntimeFilters: (action: Action) => {\n\t\t\t\t\t\treturn registeredRuntimeFilters[tableName][action];\n\t\t\t\t\t},\n\t\t\t\t};\n\t\t\t};\n\n\t\t\tfor (const entityKey of Object.keys(db.query) as TableName<DB>[]) {\n\t\t\t\tbuilder[entityKey] = createEntityObject(entityKey);\n\t\t\t}\n\n\t\t\treturn builder;\n\t\t},\n\t};\n};\n","import type { SchemaBuilderType } from \"../schemaBuilder\";\nimport type { GenericDrizzleDbTypeConstraints } from \"../types/genericDrizzleDbType\";\nimport type {\n\tCustomRumblePothosConfig,\n\tRumbleInput,\n} from \"../types/rumbleInput\";\nimport { generateFromSchema } from \"./generate/generate\";\n\nexport const clientCreatorImplementer = <\n\tUserContext extends Record<string, any>,\n\tDB extends GenericDrizzleDbTypeConstraints,\n\tRequestEvent extends Record<string, any>,\n\tAction extends string,\n\tPothosConfig extends CustomRumblePothosConfig,\n\tSchemaBuilder extends SchemaBuilderType<\n\t\tUserContext,\n\t\tDB,\n\t\tRequestEvent,\n\t\tAction,\n\t\tPothosConfig\n\t>,\n>({\n\tbuiltSchema,\n}: RumbleInput<UserContext, DB, RequestEvent, Action, PothosConfig> & {\n\tbuiltSchema: () => ReturnType<SchemaBuilder[\"toSchema\"]>;\n}) => {\n\tif (process.env.NODE_ENV !== \"development\") {\n\t\tconsole.warn(\n\t\t\t\"Running rumble client generation in non development mode. Are you sure this is correct?\",\n\t\t);\n\t}\n\n\tconst clientCreator = async ({\n\t\tapiUrl,\n\t\toutputPath,\n\t\trumbleImportPath,\n\t\tuseExternalUrqlClient,\n\t}: {\n\t\t/**\n\t\t * Path to the output directory where the client files will be generated.\n\t\t */\n\t\toutputPath: string;\n\t\t/**\n\t\t * The base URL of the Rumble API.\n\t\t */\n\t\tapiUrl?: string;\n\t\t/**\n\t\t * The import path for the rumble library, defaults to \"@m1212e/rumble\".\n\t\t */\n\t\trumbleImportPath?: string;\n\t\t/**\n\t\t * Set this to use an external urql client exported from a module.\n\t\t * If a string, uses the provided path to the urql client for importing the client.\n\t\t * If false, creates a new urql client with the provided apiUrl.\n\t\t */\n\t\tuseExternalUrqlClient?: string;\n\t}) => {\n\t\tconst schema = builtSchema();\n\t\tawait generateFromSchema({\n\t\t\tschema,\n\t\t\toutputPath,\n\t\t\trumbleImportPath,\n\t\t\tapiUrl,\n\t\t\tuseExternalUrqlClient,\n\t\t});\n\t};\n\n\treturn clientCreator;\n};\n","import type {\n\tAbilityBuilderType,\n\tcreateAbilityBuilder,\n} from \"./abilityBuilder\";\nimport type { GenericDrizzleDbTypeConstraints } from \"./types/genericDrizzleDbType\";\nimport type {\n\tCustomRumblePothosConfig,\n\tRumbleInput,\n} from \"./types/rumbleInput\";\n\nexport type ContextFunctionType<\n\tUserContext extends Record<string, any>,\n\tDB extends GenericDrizzleDbTypeConstraints,\n\tRequestEvent extends Record<string, any>,\n\tAction extends string,\n\tPothosConfig extends CustomRumblePothosConfig,\n> = ReturnType<\n\ttypeof createContextFunction<\n\t\tUserContext,\n\t\tDB,\n\t\tRequestEvent,\n\t\tAction,\n\t\tPothosConfig,\n\t\tAbilityBuilderType<UserContext, DB, RequestEvent, Action, PothosConfig>\n\t>\n>;\n\nexport type ContextType<\n\tUserContext extends Record<string, any>,\n\tDB extends GenericDrizzleDbTypeConstraints,\n\tRequestEvent extends Record<string, any>,\n\tAction extends string,\n\tPothosConfig extends CustomRumblePothosConfig,\n> = Awaited<\n\tReturnType<\n\t\tContextFunctionType<UserContext, DB, RequestEvent, Action, PothosConfig>\n\t>\n>;\n\nexport const createContextFunction = <\n\tUserContext extends Record<string, any>,\n\tDB extends GenericDrizzleDbTypeConstraints,\n\tRequestEvent extends Record<string, any>,\n\tAction extends string,\n\tPothosConfig extends CustomRumblePothosConfig,\n\tAbilityBuilder extends ReturnType<\n\t\ttypeof createAbilityBuilder<\n\t\t\tUserContext,\n\t\t\tDB,\n\t\t\tRequestEvent,\n\t\t\tAction,\n\t\t\tPothosConfig\n\t\t>\n\t>,\n>({\n\tcontext: makeUserContext,\n\tabilityBuilder,\n}: RumbleInput<UserContext, DB, RequestEvent, Action, PothosConfig> & {\n\tabilityBuilder: AbilityBuilder;\n}) => {\n\treturn async (req: RequestEvent) => {\n\t\tconst userContext = makeUserContext\n\t\t\t? await makeUserContext(req)\n\t\t\t: ({} as UserContext);\n\t\treturn {\n\t\t\t...userContext,\n\t\t\tabilities: abilityBuilder.z_buildWithUserContext(userContext),\n\t\t};\n\t};\n};\n","import { toCamelCase } from \"drizzle-orm/casing\";\nimport { type PgEnum, PgEnumColumn } from \"drizzle-orm/pg-core\";\nimport { capitalize } from \"es-toolkit\";\nimport type { SchemaBuilderType } from \"./schemaBuilder\";\nimport type { GenericDrizzleDbTypeConstraints } from \"./types/genericDrizzleDbType\";\nimport { RumbleError } from \"./types/rumbleError\";\nimport type {\n\tCustomRumblePothosConfig,\n\tRumbleInput,\n} from \"./types/rumbleInput\";\n\n/**\n * Checks if a schema type is an enum\n */\nexport function isEnumSchema(schemaType: any): schemaType is PgEnum<any> {\n\t// TODO make this compatible with other db drivers\n\treturn schemaType instanceof PgEnumColumn;\n}\n\n// TODO make this compatible with other db drivers\ntype EnumTypes = PgEnum<any>;\n\ntype EnumFields<T> = {\n\t[K in keyof T as T[K] extends EnumTypes ? K : never]: T[K];\n};\n\nexport type NonEnumFields<T> = {\n\t[K in keyof T as T[K] extends EnumTypes ? never : K]: T[K];\n};\n\nexport type EnumImplementerType<\n\tUserContext extends Record<string, any>,\n\tDB extends GenericDrizzleDbTypeConstraints,\n\tRequestEvent extends Record<string, any>,\n\tAction extends string,\n\tPothosConfig extends CustomRumblePothosConfig,\n> = ReturnType<\n\ttypeof createEnumImplementer<\n\t\tUserContext,\n\t\tDB,\n\t\tRequestEvent,\n\t\tAction,\n\t\tPothosConfig,\n\t\tSchemaBuilderType<UserContext, DB, RequestEvent, Action, PothosConfig>\n\t>\n>;\n\nexport const createEnumImplementer = <\n\tUserContext extends Record<string, any>,\n\tDB extends GenericDrizzleDbTypeConstraints,\n\tRequestEvent extends Record<string, any>,\n\tAction extends string,\n\tPothosConfig extends CustomRumblePothosConfig,\n\tSchemaBuilder extends SchemaBuilderType<\n\t\tUserContext,\n\t\tDB,\n\t\tRequestEvent,\n\t\tAction,\n\t\tPothosConfig\n\t>,\n>({\n\tdb,\n\tschemaBuilder,\n}: RumbleInput<UserContext, DB, RequestEvent, Action, PothosConfig> & {\n\tschemaBuilder: SchemaBuilder;\n}) => {\n\tconst referenceStorage = new Map<string, any>();\n\n\tconst enumImplementer = <\n\t\tExplicitEnumVariableName extends keyof EnumFields<\n\t\t\tNonNullable<DB[\"_\"][\"relations\"][\"schema\"]>\n\t\t>,\n\t\tEnumColumn extends EnumTypes,\n\t\tRefName extends string,\n\t>({\n\t\ttsName,\n\t\tenumColumn,\n\t\trefName,\n\t}: Partial<{\n\t\ttsName: ExplicitEnumVariableName;\n\t\tenumColumn: EnumColumn;\n\t\trefName?: RefName | undefined;\n\t}> &\n\t\t(\n\t\t\t| {\n\t\t\t\t\ttsName: ExplicitEnumVariableName;\n\t\t\t }\n\t\t\t| {\n\t\t\t\t\tenumColumn: EnumColumn;\n\t\t\t }\n\t\t)) => {\n\t\t//TODO check if this can be done typesafe\n\n\t\tlet enumSchemaName: string | undefined;\n\t\tlet enumValues: any[] | undefined;\n\n\t\tif (tsName) {\n\t\t\tconst schemaEnum = db._.relations.schema[tsName as string];\n\n\t\t\tenumSchemaName = tsName.toString();\n\n\t\t\tconst enumCol = Object.values(db._.relations.schema)\n\t\t\t\t.filter((s) => typeof s === \"object\")\n\t\t\t\t.map((s) => Object.values(s[Symbol.for(\"drizzle:Columns\")]))\n\t\t\t\t.flat(2)\n\t\t\t\t.find((s: any) => s.config?.enum === schemaEnum);\n\n\t\t\tif (!enumCol) {\n\t\t\t\tthrow new RumbleError(`Could not find applied enum column for ${tsName.toString()}.\nPlease ensure that you use the enum at least once as a column of a table!`);\n\t\t\t}\n\n\t\t\tenumValues = (enumCol as any).enumValues;\n\t\t} else if (enumColumn) {\n\t\t\tconst schemaEnumEntry = Object.entries(db._.relations.schema).find(\n\t\t\t\t([, value]) => value === (enumColumn as any).config.enum,\n\t\t\t);\n\n\t\t\tif (!schemaEnumEntry) {\n\t\t\t\tthrow new RumbleError(\n\t\t\t\t\t`Could not find enum in schema for ${enumColumn.name}!`,\n\t\t\t\t);\n\t\t\t}\n\n\t\t\tenumSchemaName = schemaEnumEntry[0];\n\t\t\tenumValues = enumColumn.enumValues;\n\t\t}\n\n\t\tif (!enumSchemaName || !enumValues) {\n\t\t\tthrow new RumbleError(\"Could not determine enum structure!\");\n\t\t}\n\n\t\tconst graphqlImplementationName =\n\t\t\trefName ?? `${capitalize(toCamelCase(enumSchemaName))}Enum`;\n\n\t\tlet ret: ReturnType<typeof implement> | undefined = referenceStorage.get(\n\t\t\tgraphqlImplementationName,\n\t\t);\n\t\tif (ret) {\n\t\t\treturn ret;\n\t\t}\n\n\t\tconst implement = () =>\n\t\t\tschemaBuilder.enumType(graphqlImplementationName, {\n\t\t\t\tvalues: enumValues,\n\t\t\t});\n\n\t\tret = implement();\n\t\treferenceStorage.set(graphqlImplementationName, ret);\n\t\treturn ret;\n\t};\n\n\treturn enumImplementer;\n};\n","import type { useSofa } from \"sofa-api\";\n\nexport const sofaOpenAPIWebhookDocs: NonNullable<\n\tParameters<typeof useSofa>[0][\"openAPI\"]\n> = {\n\tpaths: {\n\t\t\"/webhook\": {\n\t\t\tpost: {\n\t\t\t\toperationId: \"webhook_create\",\n\t\t\t\tdescription: \"Creates a webhook subscription.\",\n\t\t\t\ttags: [],\n\t\t\t\tparameters: [],\n\t\t\t\trequestBody: {\n\t\t\t\t\tcontent: {\n\t\t\t\t\t\t\"application/json\": {\n\t\t\t\t\t\t\tschema: {\n\t\t\t\t\t\t\t\t$ref: \"#/components/schemas/WebhookCreateBody\",\n\t\t\t\t\t\t\t},\n\t\t\t\t\t\t},\n\t\t\t\t\t},\n\t\t\t\t},\n\t\t\t\tresponses: {\n\t\t\t\t\t\"200\": {\n\t\t\t\t\t\tdescription: \"\",\n\t\t\t\t\t\tcontent: {\n\t\t\t\t\t\t\t\"application/json\": {\n\t\t\t\t\t\t\t\tschema: {\n\t\t\t\t\t\t\t\t\t$ref: \"#/components/schemas/WebhookDetailResponse\",\n\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t},\n\t\t\t\t\t\t},\n\t\t\t\t\t},\n\t\t\t\t},\n\t\t\t},\n\t\t},\n\t\t\"/webhook/{id}\": {\n\t\t\tpost: {\n\t\t\t\toperationId: \"webhook_update\",\n\t\t\t\tdescription: \"Updates a webhook subscription.\",\n\t\t\t\tparameters: [\n\t\t\t\t\t{\n\t\t\t\t\t\tname: \"id\",\n\t\t\t\t\t\tin: \"path\",\n\t\t\t\t\t\tdescription: \"The ID of the webhook to update\",\n\t\t\t\t\t\trequired: true,\n\t\t\t\t\t\tschema: {\n\t\t\t\t\t\t\ttype: \"string\",\n\t\t\t\t\t\t},\n\t\t\t\t\t} as any,\n\t\t\t\t],\n\t\t\t\trequestBody: {\n\t\t\t\t\tcontent: {\n\t\t\t\t\t\t\"application/json\": {\n\t\t\t\t\t\t\tschema: {\n\t\t\t\t\t\t\t\t$ref: \"#/components/schemas/WebhookCreateBody\",\n\t\t\t\t\t\t\t},\n\t\t\t\t\t\t},\n\t\t\t\t\t},\n\t\t\t\t},\n\t\t\t\tresponses: {\n\t\t\t\t\t\"200\": {\n\t\t\t\t\t\tdescription: \"\",\n\t\t\t\t\t\tcontent: {\n\t\t\t\t\t\t\t\"application/json\": {\n\t\t\t\t\t\t\t\tschema: {\n\t\t\t\t\t\t\t\t\t$ref: \"#/components/schemas/WebhookDetailResponse\",\n\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t},\n\t\t\t\t\t\t},\n\t\t\t\t\t},\n\t\t\t\t},\n\t\t\t},\n\t\t\tdelete: {\n\t\t\t\toperationId: \"webhook_delete\",\n\t\t\t\tdescription: \"Removes a webhook subscription.\",\n\t\t\t\ttags: [],\n\t\t\t\tparameters: [\n\t\t\t\t\t{\n\t\t\t\t\t\tname: \"id\",\n\t\t\t\t\t\tin: \"path\",\n\t\t\t\t\t\tdescription: \"The ID of the webhook to delete\",\n\t\t\t\t\t\trequired: true,\n\t\t\t\t\t\tschema: {\n\t\t\t\t\t\t\ttype: \"string\",\n\t\t\t\t\t\t},\n\t\t\t\t\t} as any,\n\t\t\t\t],\n\t\t\t\tresponses: {\n\t\t\t\t\t\"200\": {\n\t\t\t\t\t\tdescription: \"\",\n\t\t\t\t\t\tcontent: {\n\t\t\t\t\t\t\t\"application/json\": {\n\t\t\t\t\t\t\t\tschema: {\n\t\t\t\t\t\t\t\t\t$ref: \"#/components/schemas/WebhookDetailResponse\",\n\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t},\n\t\t\t\t\t\t},\n\t\t\t\t\t},\n\t\t\t\t},\n\t\t\t},\n\t\t},\n\t},\n\tcomponents: {\n\t\tschemas: {\n\t\t\tWebhookCreateBody: {\n\t\t\t\ttype: \"object\",\n\t\t\t\tproperties: {\n\t\t\t\t\tsubscription: {\n\t\t\t\t\t\tdescription:\n\t\t\t\t\t\t\t\"The subscription to subscribe to. In many cases, these match the available query IDs without the '_query' suffix. E.g., 'findFirstUser_query' -> 'findFirstUser'. See the graphql schema for more details on what subscriptions are available.\",\n\t\t\t\t\t\ttype: \"string\",\n\t\t\t\t\t},\n\t\t\t\t\tvariables: {\n\t\t\t\t\t\tdescription: \"The variables to pass to the subscription.\",\n\t\t\t\t\t\ttype: \"object\",\n\t\t\t\t\t},\n\t\t\t\t\turl: {\n\t\t\t\t\t\tdescription: \"The URL to send the webhook to.\",\n\t\t\t\t\t\ttype: \"string\",\n\t\t\t\t\t},\n\t\t\t\t},\n\t\t\t},\n\t\t\tWebhookDetailResponse: {\n\t\t\t\ttype: \"object\",\n\t\t\t\tproperties: {\n\t\t\t\t\tid: {\n\t\t\t\t\t\tdescription:\n\t\t\t\t\t\t\t\"The ID of the webhook. Can be used as reference in update or delete calls.\",\n\t\t\t\t\t\ttype: \"string\",\n\t\t\t\t\t},\n\t\t\t\t},\n\t\t\t},\n\t\t\tDateTime: {\n\t\t\t\ttype: \"string\",\n\t\t\t\tformat: \"date-time\",\n\t\t\t},\n\t\t\tDate: {\n\t\t\t\ttype: \"string\",\n\t\t\t\tformat: \"date\",\n\t\t\t},\n\t\t},\n\t},\n};\n","import type { SchemaBuilderType } from \"../../schemaBuilder\";\nimport type { GenericDrizzleDbTypeConstraints } from \"../../types/genericDrizzleDbType\";\nimport type { CustomRumblePothosConfig } from \"../../types/rumbleInput\";\nimport { type PossibleSQLType, UnknownTypeRumbleError } from \"./types\";\n\nexport function mapSQLTypeToGraphQLType<\n\tUserContext extends Record<string, any>,\n\tDB extends GenericDrizzleDbTypeConstraints,\n\tRequestEvent extends Record<string, any>,\n\tAction extends string,\n\tPothosConfig extends CustomRumblePothosConfig,\n\tSchemaBuilder extends SchemaBuilderType<\n\t\tUserContext,\n\t\tDB,\n\t\tRequestEvent,\n\t\tAction,\n\t\tPothosConfig\n\t>,\n>({ sqlType, fieldName }: { sqlType: PossibleSQLType; fieldName?: string }) {\n\ttype ReturnType = Parameters<\n\t\tParameters<Parameters<SchemaBuilder[\"queryField\"]>[1]>[0][\"field\"]\n\t>[0][\"type\"];\n\n\tlet ret: ReturnType | undefined;\n\n\tif (\n\t\t[\"serial\", \"int\", \"integer\", \"tinyint\", \"smallint\", \"mediumint\"].includes(\n\t\t\tsqlType,\n\t\t)\n\t) {\n\t\tret = \"Int\";\n\t}\n\n\tif ([\"real\", \"decimal\", \"double\", \"float\"].includes(sqlType)) {\n\t\tret = \"Float\";\n\t}\n\n\tif ([\"string\", \"text\", \"varchar\", \"char\", \"text(256)\"].includes(sqlType)) {\n\t\tif (\n\t\t\tfieldName &&\n\t\t\t(fieldName.toLowerCase().endsWith(\"_id\") ||\n\t\t\t\tfieldName.toLowerCase().endsWith(\"id\"))\n\t\t) {\n\t\t\tret = \"ID\";\n\t\t} else {\n\t\t\tret = \"String\";\n\t\t}\n\t}\n\n\tif ([\"uuid\"].includes(sqlType)) {\n\t\tret = \"ID\";\n\t}\n\n\tif ([\"boolean\"].includes(sqlType)) {\n\t\tret = \"Boolean\";\n\t}\n\n\tif ([\"timestamp\", \"datetime\"].includes(sqlType)) {\n\t\tret = \"DateTime\";\n\t}\n\n\tif ([\"date\"].includes(sqlType)) {\n\t\tret = \"Date\";\n\t}\n\n\tif ([\"json\"].includes(sqlType)) {\n\t\tret = \"JSON\";\n\t}\n\n\tif (ret !== undefined) {\n\t\treturn ret;\n\t}\n\n\tthrow UnknownTypeRumbleError(sqlType, \"SQL to GQL\");\n}\n","import type { MySqlDatabase } from \"drizzle-orm/mysql-core\";\nimport { MySqlTable } from \"drizzle-orm/mysql-core\";\nimport type { PgDatabase } from \"drizzle-orm/pg-core\";\nimport { PgTable } from \"drizzle-orm/pg-core\";\nimport type { BaseSQLiteDatabase } from \"drizzle-orm/sqlite-core\";\nimport { SQLiteTable } from \"drizzle-orm/sqlite-core\";\nimport type { GenericDrizzleDbTypeConstraints } from \"../types/genericDrizzleDbType\";\n\nexport type DBDialect = \"mysql\" | \"postgres\" | \"sqlite\";\n\nexport function determineDBDialectFromSchema<\n\tDB extends GenericDrizzleDbTypeConstraints,\n>(schema: DB[\"_\"][\"relations\"][\"schema\"]) {\n\tconst found = new Set<DBDialect>();\n\n\tfor (const table of Object.values(schema)) {\n\t\tif (typeof table !== \"object\") {\n\t\t\tcontinue;\n\t\t}\n\n\t\tif (table instanceof PgTable) {\n\t\t\tfound.add(\"postgres\");\n\t\t} else if (table instanceof MySqlTable) {\n\t\t\tfound.add(\"mysql\");\n\t\t} else if (table instanceof SQLiteTable) {\n\t\t\tfound.add(\"sqlite\");\n\t\t}\n\t}\n\n\tconst dialects = Array.from(found);\n\n\tif (dialects.length === 1) {\n\t\treturn dialects[0];\n\t}\n\n\tif (dialects.length === 0) {\n\t\tthrow new Error(\"No tables found in schema, could not determine dialect\");\n\t}\n\n\tthrow new Error(`Multiple dialects found in schema: ${dialects.join(\", \")}`);\n}\n\nexport function isPostgresDB<\n\tNarrowed extends PgDatabase<any, any> = PgDatabase<any, any>,\n>(db: GenericDrizzleDbTypeConstraints): db is Narrowed {\n\tconst dialect = determineDBDialectFromSchema(db._.relations.schema);\n\n\treturn dialect === \"postgres\";\n}\n\nexport function isMySQLDB<\n\tNarrowed extends MySqlDatabase<any, any> = MySqlDatabase<any, any>,\n>(db: GenericDrizzleDbTypeConstraints): db is Narrowed {\n\tconst dialect = determineDBDialectFromSchema(db._.relations.schema);\n\n\treturn dialect === \"mysql\";\n}\n\nexport function isSQLiteDB<\n\tNarrowed extends BaseSQLiteDatabase<any, any> = BaseSQLiteDatabase<any, any>,\n>(db: GenericDrizzleDbTypeConstraints): db is Narrowed {\n\tconst dialect = determineDBDialectFromSchema(db._.relations.schema);\n\n\treturn dialect === \"sqlite\";\n}\n","import { sql } from \"drizzle-orm\";\nimport { cloneDeep } from \"es-toolkit\";\nimport { isPostgresDB } from \"./helpers/determineDialectFromSchema\";\nimport type { tableHelper } from \"./helpers/tableHelpers\";\nimport type { GenericDrizzleDbTypeConstraints } from \"./types/genericDrizzleDbType\";\nimport type { RumbleInput } from \"./types/rumbleInput\";\n\nexport async function initSearchIfApplicable<\n\tDB extends GenericDrizzleDbTypeConstraints,\n>(db: DB) {\n\t//TODO: make other dialects compatible\n\tif (!isPostgresDB(db)) {\n\t\tconsole.info(\n\t\t\t\"Database dialect is not compatible with search, skipping search initialization.\",\n\t\t);\n\t\treturn;\n\t}\n\n\tawait db.execute(sql`CREATE EXTENSION IF NOT EXISTS pg_trgm;`);\n}\n\nexport function adjustQueryForSearch({\n\tsearch,\n\targs,\n\ttableSchema,\n\tabilities,\n}: Pick<RumbleInput<any, any, any, any, any>, \"search\"> & {\n\t//TODO types\n\targs: any;\n\ttableSchema: ReturnType<typeof tableHelper>;\n\t//TODO types\n\tabilities: any;\n}) {\n\tif (search?.enabled && args.search && args.search.length > 0) {\n\t\tconst originalOrderBy = cloneDeep(args.orderBy);\n\t\t(args as any).orderBy = (table: any) => {\n\t\t\tconst argsOrderBySQL = sql.join(\n\t\t\t\tObject.entries(originalOrderBy ?? {}).map(([key, value]) => {\n\t\t\t\t\t// value is \"asc\" or \"desc\"\n\t\t\t\t\tif (value === \"asc\") {\n\t\t\t\t\t\treturn sql`${table[key]} ASC`;\n\t\t\t\t\t} else if (value === \"desc\") {\n\t\t\t\t\t\treturn sql`${table[key]} DESC`;\n\t\t\t\t\t} else {\n\t\t\t\t\t\tthrow new Error(`Invalid value ${value} for orderBy`);\n\t\t\t\t\t}\n\t\t\t\t}),\n\t\t\t\tsql.raw(\", \"),\n\t\t\t);\n\n\t\t\t// this prevents columns beeing searched which are not accessible to the user\n\t\t\t// if the abilities defined the user not to be allowed to read something, we need\n\t\t\t// to prevent it from beeing included in the search since this could\n\t\t\t// leak information\n\t\t\tconst columnsToSearch = abilities.query.many.columns\n\t\t\t\t? Object.entries(tableSchema.columns).filter(\n\t\t\t\t\t\t([key]) => abilities.query.many.columns[key],\n\t\t\t\t\t)\n\t\t\t\t: Object.entries(tableSchema.columns);\n\n\t\t\t// GREATEST(similarity(name, ${query.search}), similarity(description, ${query.search})) DESC\n\t\t\tconst searchSQL = sql`GREATEST(${sql.join(\n\t\t\t\tcolumnsToSearch.map(([key]) => {\n\t\t\t\t\treturn sql`similarity(${table[key]}::TEXT, ${args.search})`;\n\t\t\t\t}),\n\t\t\t\tsql.raw(\", \"),\n\t\t\t)}) DESC`;\n\n\t\t\tconst ret = originalOrderBy\n\t\t\t\t? sql.join([argsOrderBySQL, searchSQL], sql.raw(\", \"))\n\t\t\t\t: searchSQL;\n\n\t\t\t// const pgDialect = new PgDialect();\n\t\t\t// console.log(pgDialect.sqlToQuery(ret));\n\n\t\t\treturn ret;\n\t\t};\n\n\t\tconst originalWhere = cloneDeep(args.where);\n\n\t\t// this limits the search to the rows which at least match the threshold score\n\t\t(args as any).where = {\n\t\t\tAND: [\n\t\t\t\toriginalWhere ?? {},\n\t\t\t\t{\n\t\t\t\t\tRAW: (table: any) => {\n\t\t\t\t\t\treturn sql`GREATEST(${sql.join(\n\t\t\t\t\t\t\tObject.entries(tableSchema.columns).map(([key]) => {\n\t\t\t\t\t\t\t\treturn sql`similarity(${table[key]}::TEXT, ${args.search})`;\n\t\t\t\t\t\t\t}),\n\t\t\t\t\t\t\tsql.raw(\", \"),\n\t\t\t\t\t\t)}) > ${search.threshold ?? 0.1}`;\n\t\t\t\t\t},\n\t\t\t\t},\n\t\t\t],\n\t\t};\n\t}\n}\n","import type { FieldMap } from \"@pothos/core\";\nimport type { DrizzleObjectFieldBuilder } from \"@pothos/plugin-drizzle\";\nimport { One, type Table } from \"drizzle-orm\";\nimport { capitalize } from \"es-toolkit\";\nimport { plural, singular } from \"pluralize\";\nimport type { AbilityBuilderType } from \"./abilityBuilder\";\nimport { type EnumImplementerType, isEnumSchema } from \"./enum\";\nimport { mapSQLTypeToGraphQLType } from \"./helpers/sqlTypes/mapSQLTypeToTSType\";\nimport type { PossibleSQLType } from \"./helpers/sqlTypes/types\";\nimport {\n\ttype TableIdentifierTSName,\n\ttableHelper,\n} from \"./helpers/tableHelpers\";\nimport type { OrderArgImplementerType } from \"./orderArg\";\nimport type { MakePubSubInstanceType } from \"./pubsub\";\nimport type { SchemaBuilderType } from \"./schemaBuilder\";\nimport { adjustQueryForSearch } from \"./search\";\nimport type { GenericDrizzleDbTypeConstraints } from \"./types/genericDrizzleDbType\";\nimport { RumbleError } from \"./types/rumbleError\";\nimport type {\n\tCustomRumblePothosConfig,\n\tRumbleInput,\n} from \"./types/rumbleInput\";\nimport type { WhereArgImplementerType } from \"./whereArg\";\n\n//TODO this is a bit flaky, we should check if we can determine the config object more reliably\n//TODO maybe a plugin can place some marker field on these objects?\nconst isProbablyAConfigObject = (t: any) => {\n\tif (typeof t !== \"object\") {\n\t\treturn false;\n\t}\n\n\tif (\n\t\tObject.keys(t).some((k) =>\n\t\t\t[\n\t\t\t\t\"args\",\n\t\t\t\t\"nullable\",\n\t\t\t\t\"query\",\n\t\t\t\t\"subscribe\",\n\t\t\t\t\"description\",\n\t\t\t\t\"type\",\n\t\t\t\t\"resolve\",\n\t\t\t].find((e) => e === k),\n\t\t)\n\t)\n\t\treturn true;\n\treturn false;\n};\n\nexport const createObjectImplementer = <\n\tUserContext extends Record<string, any>,\n\tDB extends GenericDrizzleDbTypeConstraints,\n\tRequestEvent extends Record<string, any>,\n\tAction extends string,\n\tPothosConfig extends CustomRumblePothosConfig,\n\tSchemaBuilder extends SchemaBuilderType<\n\t\tUserContext,\n\t\tDB,\n\t\tRequestEvent,\n\t\tAction,\n\t\tPothosConfig\n\t>,\n\tWhereArgImplementer extends WhereArgImplementerType<\n\t\tUserContext,\n\t\tDB,\n\t\tRequestEvent,\n\t\tAction,\n\t\tPothosConfig\n\t>,\n\tOrderArgImplementer extends OrderArgImplementerType<\n\t\tUserContext,\n\t\tDB,\n\t\tRequestEvent,\n\t\tAction,\n\t\tPothosConfig\n\t>,\n\tEnumImplementer extends EnumImplementerType<\n\t\tUserContext,\n\t\tDB,\n\t\tRequestEvent,\n\t\tAction,\n\t\tPothosConfig\n\t>,\n\tMakePubSubInstance extends MakePubSubInstanceType<\n\t\tUserContext,\n\t\tDB,\n\t\tRequestEvent,\n\t\tAction,\n\t\tPothosConfig\n\t>,\n\tAbilityBuilderInstance extends AbilityBuilderType<\n\t\tUserContext,\n\t\tDB,\n\t\tRequestEvent,\n\t\tAction,\n\t\tPothosConfig\n\t>,\n>({\n\tdb,\n\tsearch,\n\tschemaBuilder,\n\tmakePubSubInstance,\n\twhereArgImplementer,\n\torderArgImplementer,\n\tenumImplementer,\n\tabilityBuilder,\n}: RumbleInput<UserContext, DB, RequestEvent, Action, PothosConfig> & {\n\tschemaBuilder: SchemaBuilder;\n\twhereArgImplementer: WhereArgImplementer;\n\torderArgImplementer: OrderArgImplementer;\n\tenumImplementer: EnumImplementer;\n\tmakePubSubInstance: MakePubSubInstance;\n\tabilityBuilder: AbilityBuilderInstance;\n}) => {\n\treturn <\n\t\tExplicitTableName extends TableIdentifierTSName<DB>,\n\t\tRefName extends string,\n\t>({\n\t\ttable,\n\t\trefName,\n\t\treadAction = \"read\" as Action,\n\t\tadjust,\n\t}: {\n\t\t/**\n\t\t * The table you want to be used as reference for the object creation.\n\t\t */\n\t\ttable: ExplicitTableName;\n\t\t/**\n\t\t * The name you want this object to have in your graphql schema.\n\t\t * Rumble will create a reasonable default if not specified.\n\t\t */\n\t\trefName?: RefName;\n\t\t/**\n\t\t * The action used for read access to the table.\n\t\t * Defaults to \"read\".\n\t\t */\n\t\treadAction?: Action;\n\t\t/**\n\t\t * A function which can be used to adjust the fields of the object.\n\t\t * You can extend the object by specifying fields that do not exist as\n\t\t * per your db schema, or overwrite existing fields with the same name.\n\t\t * In case you do overwrite, rumble will set proper nullability and\n\t\t * subscription properties if you do not specify them explicitly.\n\t\t */\n\t\tadjust?:\n\t\t\t| ((\n\t\t\t\t\tt: DrizzleObjectFieldBuilder<\n\t\t\t\t\t\tSchemaBuilder[\"$inferSchemaTypes\"],\n\t\t\t\t\t\tSchemaBuilder[\"$inferSchemaTypes\"][\"DrizzleRelationsConfig\"][ExplicitTableName],\n\t\t\t\t\t\tNonNullable<\n\t\t\t\t\t\t\tAwaited<ReturnType<DB[\"query\"][ExplicitTableName][\"findFirst\"]>>\n\t\t\t\t\t\t>\n\t\t\t\t\t>,\n\t\t\t ) => FieldMap)\n\t\t\t| undefined;\n\t}) => {\n\t\tconst tableSchema = tableHelper({ db, tsName: table });\n\t\tif (Object.keys(tableSchema.primaryColumns).length === 0) {\n\t\t\tconsole.warn(\n\t\t\t\t`Could not find primary key for ${table.toString()}. Cannot register subscriptions!`,\n\t\t\t);\n\t\t}\n\t\tconst primaryKey = Object.values(tableSchema.primaryColumns)[0];\n\n\t\tconst { registerOnInstance } = makePubSubInstance({ table: table });\n\n\t\treturn schemaBuilder.drizzleObject(table, {\n\t\t\tname: refName ?? capitalize(table.toString()),\n\t\t\tsubscribe: (subscriptions, element, _context) => {\n\t\t\t\tif (!primaryKey) return;\n\t\t\t\tconst primaryKeyValue = (element as any)[primaryKey.name];\n\t\t\t\tif (!primaryKeyValue) {\n\t\t\t\t\tconsole.warn(\n\t\t\t\t\t\t`Could not find primary key value for ${JSON.stringify(\n\t\t\t\t\t\t\telement,\n\t\t\t\t\t\t)}. Cannot register subscription!`,\n\t\t\t\t\t);\n\t\t\t\t\treturn;\n\t\t\t\t}\n\n\t\t\t\t//TODO maybe register non specific update calls aswell?\n\t\t\t\tregisterOnInstance({\n\t\t\t\t\tinstance: subscriptions,\n\t\t\t\t\taction: \"updated\",\n\t\t\t\t\tprimaryKeyValue: primaryKeyValue,\n\t\t\t\t});\n\t\t\t},\n\t\t\tapplyFilters:\n\t\t\t\tabilityBuilder?.z_registeredFilters?.[table as any]?.[readAction],\n\t\t\tfields: (t) => {\n\t\t\t\tconst columns = tableSchema.columns;\n\t\t\t\tconst mapSQLTypeStringToExposedPothosType = <\n\t\t\t\t\tColumn extends keyof typeof columns,\n\t\t\t\t>(\n\t\t\t\t\tsqlType: PossibleSQLType,\n\t\t\t\t\tcolumnName: Column,\n\t\t\t\t\tnullable: boolean,\n\t\t\t\t) => {\n\t\t\t\t\tconst gqlType = mapSQLTypeToGraphQLType({\n\t\t\t\t\t\tsqlType,\n\t\t\t\t\t\tfieldName: columnName,\n\t\t\t\t\t});\n\t\t\t\t\tswitch (gqlType) {\n\t\t\t\t\t\tcase \"Int\":\n\t\t\t\t\t\t\t// @ts-expect-error\n\t\t\t\t\t\t\treturn t.exposeInt(columnName, { nullable });\n\t\t\t\t\t\tcase \"String\":\n\t\t\t\t\t\t\t// @ts-expect-error\n\t\t\t\t\t\t\treturn t.exposeString(columnName, { nullable });\n\t\t\t\t\t\tcase \"Boolean\":\n\t\t\t\t\t\t\t// @ts-expect-error\n\t\t\t\t\t\t\treturn t.exposeBoolean(columnName, { nullable });\n\t\t\t\t\t\tcase \"Date\":\n\t\t\t\t\t\t\treturn t.field({\n\t\t\t\t\t\t\t\ttype: \"Date\",\n\t\t\t\t\t\t\t\tresolve: (element) => (element as any)[columnName] as Date,\n\t\t\t\t\t\t\t\tnullable,\n\t\t\t\t\t\t\t});\n\t\t\t\t\t\tcase \"DateTime\":\n\t\t\t\t\t\t\treturn t.field({\n\t\t\t\t\t\t\t\ttype: \"DateTime\",\n\t\t\t\t\t\t\t\tresolve: (element) => (element as any)[columnName] as Date,\n\t\t\t\t\t\t\t\tnullable,\n\t\t\t\t\t\t\t});\n\t\t\t\t\t\tcase \"Float\":\n\t\t\t\t\t\t\t// @ts-expect-error\n\t\t\t\t\t\t\treturn t.exposeFloat(columnName, { nullable });\n\t\t\t\t\t\tcase \"ID\":\n\t\t\t\t\t\t\t// @ts-expect-error\n\t\t\t\t\t\t\treturn t.exposeID(columnName, { nullable });\n\t\t\t\t\t\tcase \"JSON\":\n\t\t\t\t\t\t\treturn t.field({\n\t\t\t\t\t\t\t\ttype: \"JSON\",\n\t\t\t\t\t\t\t\tresolve: (element) => (element as any)[columnName] as unknown,\n\t\t\t\t\t\t\t\tnullable,\n\t\t\t\t\t\t\t});\n\t\t\t\t\t\tdefault:\n\t\t\t\t\t\t\tthrow new RumbleError(\n\t\t\t\t\t\t\t\t`Unsupported object type ${gqlType} for column ${columnName}`,\n\t\t\t\t\t\t\t);\n\t\t\t\t\t}\n\t\t\t\t};\n\n\t\t\t\t// in case the user makes adjustments we want to store away which\n\t\t\t\t// pothos function was called with what config\n\t\t\t\t// this is mapped to the ref which later can be used to\n\t\t\t\t// reference these parameters while iterating over the fields\n\t\t\t\t// and checking against the userAdjustments object\n\t\t\t\t// this is necessary to e.g. merge nullability info from the database schema\n\t\t\t\t// or register subscriptions on relations\n\t\t\t\tconst configMap = new Map<\n\t\t\t\t\tany,\n\t\t\t\t\t{\n\t\t\t\t\t\tcreatorFunction: (...p: any[]) => any;\n\t\t\t\t\t\tparams: any[];\n\t\t\t\t\t\tconfigObject: any;\n\t\t\t\t\t}\n\t\t\t\t>();\n\t\t\t\t// stores the results of the user adjustments\n\t\t\t\t// also stores all the used pothos functions and the configs\n\t\t\t\t// provided by the user so we can extend that if necessary\n\t\t\t\tconst userAdjustments =\n\t\t\t\t\tadjust?.(\n\t\t\t\t\t\tnew Proxy(t, {\n\t\t\t\t\t\t\tget: (target, prop) => {\n\t\t\t\t\t\t\t\tif (\n\t\t\t\t\t\t\t\t\t// we only care for field/relation functions\n\t\t\t\t\t\t\t\t\ttypeof (target as any)[prop] !== \"function\" ||\n\t\t\t\t\t\t\t\t\tprop === \"arg\" ||\n\t\t\t\t\t\t\t\t\tprop === \"builder\" ||\n\t\t\t\t\t\t\t\t\tprop === \"graphqlKind\" ||\n\t\t\t\t\t\t\t\t\tprop === \"kind\" ||\n\t\t\t\t\t\t\t\t\tprop === \"listRef\" ||\n\t\t\t\t\t\t\t\t\tprop === \"table\" ||\n\t\t\t\t\t\t\t\t\tprop === \"typename\" ||\n\t\t\t\t\t\t\t\t\tprop === \"variant\" ||\n\t\t\t\t\t\t\t\t\tprop.toString().startsWith(\"boolean\") ||\n\t\t\t\t\t\t\t\t\tprop.toString().startsWith(\"float\") ||\n\t\t\t\t\t\t\t\t\tprop.toString().startsWith(\"id\") ||\n\t\t\t\t\t\t\t\t\tprop.toString().startsWith(\"int\") ||\n\t\t\t\t\t\t\t\t\tprop.toString().startsWith(\"string\") ||\n\t\t\t\t\t\t\t\t\tprop.toString().startsWith(\"expose\")\n\t\t\t\t\t\t\t\t) {\n\t\t\t\t\t\t\t\t\treturn (target as any)[prop];\n\t\t\t\t\t\t\t\t}\n\n\t\t\t\t\t\t\t\treturn (...params: any[]) => {\n\t\t\t\t\t\t\t\t\tconst ref = (target as any)[prop](...params);\n\t\t\t\t\t\t\t\t\tconst configObject = params.find(isProbablyAConfigObject);\n\t\t\t\t\t\t\t\t\tif (!configObject)\n\t\t\t\t\t\t\t\t\t\tthrow new RumbleError(\n\t\t\t\t\t\t\t\t\t\t\t\"Expected config object to be passed to adjust field\",\n\t\t\t\t\t\t\t\t\t\t);\n\n\t\t\t\t\t\t\t\t\tconfigMap.set(ref, {\n\t\t\t\t\t\t\t\t\t\tparams,\n\t\t\t\t\t\t\t\t\t\tcreatorFunction: (target as any)[prop],\n\t\t\t\t\t\t\t\t\t\tconfigObject,\n\t\t\t\t\t\t\t\t\t});\n\t\t\t\t\t\t\t\t\treturn ref;\n\t\t\t\t\t\t\t\t};\n\t\t\t\t\t\t\t},\n\t\t\t\t\t\t}) as any,\n\t\t\t\t\t) ?? {};\n\n\t\t\t\tconst fields = Object.entries(columns).reduce(\n\t\t\t\t\t(acc, [key, value]) => {\n\t\t\t\t\t\tif (userAdjustments[key]) {\n\t\t\t\t\t\t\tconst { params, creatorFunction, configObject } = configMap.get(\n\t\t\t\t\t\t\t\tuserAdjustments[key],\n\t\t\t\t\t\t\t)!;\n\n\t\t\t\t\t\t\tif (typeof configObject.nullable !== \"boolean\") {\n\t\t\t\t\t\t\t\tconfigObject.nullable = !value.notNull;\n\t\t\t\t\t\t\t}\n\n\t\t\t\t\t\t\tuserAdjustments[key] = creatorFunction.bind(t)(...params);\n\t\t\t\t\t\t\treturn acc;\n\t\t\t\t\t\t}\n\n\t\t\t\t\t\tif (isEnumSchema(value)) {\n\t\t\t\t\t\t\tconst enumImpl = enumImplementer({\n\t\t\t\t\t\t\t\tenumColumn: value,\n\t\t\t\t\t\t\t});\n\n\t\t\t\t\t\t\tacc[key] = t.field({\n\t\t\t\t\t\t\t\ttype: enumImpl,\n\t\t\t\t\t\t\t\tresolve: (element) => (element as any)[key],\n\t\t\t\t\t\t\t\tnullable: !value.notNull,\n\t\t\t\t\t\t\t});\n\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\tacc[key] = mapSQLTypeStringToExposedPothosType(\n\t\t\t\t\t\t\t\tvalue.getSQLType() as PossibleSQLType,\n\t\t\t\t\t\t\t\tkey,\n\t\t\t\t\t\t\t\t!value.notNull,\n\t\t\t\t\t\t\t);\n\t\t\t\t\t\t}\n\t\t\t\t\t\treturn acc;\n\t\t\t\t\t},\n\t\t\t\t\t{} as Record<\n\t\t\t\t\t\tkeyof typeof columns,\n\t\t\t\t\t\tReturnType<typeof mapSQLTypeStringToExposedPothosType>\n\t\t\t\t\t>,\n\t\t\t\t);\n\n\t\t\t\tconst relations = Object.entries(tableSchema.relations ?? {}).reduce(\n\t\t\t\t\t(acc, [key, value]) => {\n\t\t\t\t\t\tconst relationSchema = tableHelper({\n\t\t\t\t\t\t\tdb,\n\t\t\t\t\t\t\ttable: value.targetTable as Table,\n\t\t\t\t\t\t});\n\t\t\t\t\t\tconst WhereArg = whereArgImplementer({\n\t\t\t\t\t\t\tdbName: relationSchema.dbName,\n\t\t\t\t\t\t});\n\t\t\t\t\t\tconst OrderArg = orderArgImplementer({\n\t\t\t\t\t\t\tdbName: relationSchema.dbName,\n\t\t\t\t\t\t});\n\t\t\t\t\t\tconst relationTablePubSub = makePubSubInstance({\n\t\t\t\t\t\t\ttable: relationSchema.tsName as any,\n\t\t\t\t\t\t});\n\n\t\t\t\t\t\t// many relations will return an empty array so we just don't set them nullable\n\t\t\t\t\t\tlet nullable = false;\n\t\t\t\t\t\tlet isMany = true;\n\t\t\t\t\t\tlet filterSpecifier = \"many\";\n\t\t\t\t\t\tif (value instanceof One) {\n\t\t\t\t\t\t\tisMany = false;\n\t\t\t\t\t\t\tnullable = value.optional;\n\t\t\t\t\t\t\tfilterSpecifier = \"single\";\n\t\t\t\t\t\t}\n\n\t\t\t\t\t\tconst subscribe = (subscriptions: any, _element: any) => {\n\t\t\t\t\t\t\trelationTablePubSub.registerOnInstance({\n\t\t\t\t\t\t\t\tinstance: subscriptions,\n\t\t\t\t\t\t\t\taction: \"created\",\n\t\t\t\t\t\t\t});\n\t\t\t\t\t\t\trelationTablePubSub.registerOnInstance({\n\t\t\t\t\t\t\t\tinstance: subscriptions,\n\t\t\t\t\t\t\t\taction: \"removed\",\n\t\t\t\t\t\t\t});\n\t\t\t\t\t\t};\n\n\t\t\t\t\t\tif (userAdjustments[key]) {\n\t\t\t\t\t\t\tconst { params, creatorFunction, configObject } = configMap.get(\n\t\t\t\t\t\t\t\tuserAdjustments[key],\n\t\t\t\t\t\t\t)!;\n\n\t\t\t\t\t\t\tif (typeof configObject.nullable !== \"boolean\") {\n\t\t\t\t\t\t\t\tconfigObject.nullable = nullable;\n\t\t\t\t\t\t\t}\n\n\t\t\t\t\t\t\tif (typeof configObject.subscribe !== \"function\") {\n\t\t\t\t\t\t\t\tconfigObject.subscribe = subscribe;\n\t\t\t\t\t\t\t}\n\n\t\t\t\t\t\t\tuserAdjustments[key] = creatorFunction.bind(t)(...params);\n\t\t\t\t\t\t\treturn acc;\n\t\t\t\t\t\t}\n\n\t\t\t\t\t\tconst args = {\n\t\t\t\t\t\t\twhere: t.arg({ type: WhereArg, required: false }),\n\t\t\t\t\t\t\torderBy: t.arg({ type: OrderArg, required: false }),\n\t\t\t\t\t\t\t...(isMany\n\t\t\t\t\t\t\t\t? {\n\t\t\t\t\t\t\t\t\t\toffset: t.arg.int({ required: false }),\n\t\t\t\t\t\t\t\t\t\tlimit: t.arg.int({ required: false }),\n\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t: {}),\n\t\t\t\t\t\t\tsearch: t.arg.string({ required: false }),\n\t\t\t\t\t\t};\n\n\t\t\t\t\t\tif (!search?.enabled || !isMany) {\n\t\t\t\t\t\t\tdelete (args as any).search;\n\t\t\t\t\t\t}\n\n\t\t\t\t\t\t(acc as any)[key] = t.relation(key, {\n\t\t\t\t\t\t\targs,\n\t\t\t\t\t\t\tsubscribe,\n\t\t\t\t\t\t\tnullable,\n\t\t\t\t\t\t\tdescription: `Get the ${plural(relationSchema.tsName)} related to this ${singular(tableSchema.tsName)}`,\n\t\t\t\t\t\t\tquery: (args: any, ctx: any) => {\n\t\t\t\t\t\t\t\t// transform null prototyped object\n\t\t\t\t\t\t\t\targs = JSON.parse(JSON.stringify(args));\n\n\t\t\t\t\t\t\t\tif (isMany) {\n\t\t\t\t\t\t\t\t\tadjustQueryForSearch({\n\t\t\t\t\t\t\t\t\t\tsearch,\n\t\t\t\t\t\t\t\t\t\targs,\n\t\t\t\t\t\t\t\t\t\ttableSchema: relationSchema,\n\t\t\t\t\t\t\t\t\t\tabilities:\n\t\t\t\t\t\t\t\t\t\t\tctx.abilities[relationSchema.tsName].filter(readAction),\n\t\t\t\t\t\t\t\t\t});\n\t\t\t\t\t\t\t\t}\n\n\t\t\t\t\t\t\t\tconst filter = ctx.abilities[relationSchema.tsName].filter(\n\t\t\t\t\t\t\t\t\treadAction,\n\t\t\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t\t\tinject: { where: args.where, limit: args.limit },\n\t\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t).query[filterSpecifier];\n\n\t\t\t\t\t\t\t\tif (args.offset) {\n\t\t\t\t\t\t\t\t\t(filter as any).offset = args.offset;\n\t\t\t\t\t\t\t\t}\n\n\t\t\t\t\t\t\t\tif (args.orderBy) {\n\t\t\t\t\t\t\t\t\t(filter as any).orderBy = args.orderBy;\n\t\t\t\t\t\t\t\t}\n\n\t\t\t\t\t\t\t\treturn filter;\n\t\t\t\t\t\t\t},\n\t\t\t\t\t\t} as any) as any;\n\t\t\t\t\t\treturn acc;\n\t\t\t\t\t},\n\t\t\t\t\t{} as Record<\n\t\t\t\t\t\tkeyof typeof tableSchema.relations,\n\t\t\t\t\t\tReturnType<typeof mapSQLTypeStringToExposedPothosType>\n\t\t\t\t\t>,\n\t\t\t\t);\n\n\t\t\t\treturn {\n\t\t\t\t\t...fields,\n\t\t\t\t\t...relations,\n\t\t\t\t\t...userAdjustments,\n\t\t\t\t};\n\t\t\t},\n\t\t});\n\t};\n};\n","import type { Table } from \"drizzle-orm\";\nimport { toCamelCase } from \"drizzle-orm/casing\";\nimport { capitalize } from \"es-toolkit\";\nimport { lazy } from \"./helpers/lazy\";\nimport {\n\ttype TableIdentifierTSName,\n\ttableHelper,\n} from \"./helpers/tableHelpers\";\nimport type { SchemaBuilderType } from \"./schemaBuilder\";\nimport type { GenericDrizzleDbTypeConstraints } from \"./types/genericDrizzleDbType\";\nimport type {\n\tCustomRumblePothosConfig,\n\tRumbleInput,\n} from \"./types/rumbleInput\";\n\nexport type OrderArgImplementerType<\n\tUserContext extends Record<string, any>,\n\tDB extends GenericDrizzleDbTypeConstraints,\n\tRequestEvent extends Record<string, any>,\n\tAction extends string,\n\tPothosConfig extends CustomRumblePothosConfig,\n> = ReturnType<\n\ttypeof createOrderArgImplementer<\n\t\tUserContext,\n\t\tDB,\n\t\tRequestEvent,\n\t\tAction,\n\t\tPothosConfig,\n\t\tSchemaBuilderType<UserContext, DB, RequestEvent, Action, PothosConfig>\n\t>\n>;\n\nconst makeDefaultName = (dbName: string) =>\n\t`${capitalize(toCamelCase(dbName.toString()))}OrderInputArgument`;\n\nexport const createOrderArgImplementer = <\n\tUserContext extends Record<string, any>,\n\tDB extends GenericDrizzleDbTypeConstraints,\n\tRequestEvent extends Record<string, any>,\n\tAction extends string,\n\tPothosConfig extends CustomRumblePothosConfig,\n\tSchemaBuilder extends SchemaBuilderType<\n\t\tUserContext,\n\t\tDB,\n\t\tRequestEvent,\n\t\tAction,\n\t\tPothosConfig\n\t>,\n>({\n\tdb,\n\tschemaBuilder,\n}: RumbleInput<UserContext, DB, RequestEvent, Action, PothosConfig> & {\n\tschemaBuilder: SchemaBuilder;\n}) => {\n\tconst referenceStorage = new Map<string, any>();\n\n\tconst sortingParameterEnumRef = lazy(() =>\n\t\tschemaBuilder.enumType(\"SortingParameter\", {\n\t\t\tvalues: [\"asc\", \"desc\"] as const,\n\t\t}),\n\t);\n\n\tconst orderArgImplementer = <\n\t\tExplicitTableName extends TableIdentifierTSName<DB>,\n\t\tRefName extends string,\n\t>({\n\t\ttable,\n\t\trefName,\n\t\tdbName,\n\t}: Partial<{\n\t\ttable: ExplicitTableName;\n\t\trefName: RefName | undefined;\n\t\tdbName: string;\n\t}> &\n\t\t(\n\t\t\t| {\n\t\t\t\t\ttable: ExplicitTableName;\n\t\t\t }\n\t\t\t| {\n\t\t\t\t\tdbName: string;\n\t\t\t }\n\t\t)) => {\n\t\tconst tableSchema = tableHelper({\n\t\t\tdb,\n\t\t\tdbName,\n\t\t\ttsName: table!,\n\t\t});\n\n\t\tconst inputTypeName = refName ?? makeDefaultName(tableSchema.tsName);\n\n\t\tlet ret: ReturnType<typeof implement> | undefined =\n\t\t\treferenceStorage.get(inputTypeName);\n\t\tif (ret) {\n\t\t\treturn ret;\n\t\t}\n\n\t\tconst implement = () => {\n\t\t\treturn schemaBuilder.inputType(inputTypeName, {\n\t\t\t\tfields: (t) => {\n\t\t\t\t\tconst fields = Object.entries(tableSchema.columns).reduce(\n\t\t\t\t\t\t(acc, [key]) => {\n\t\t\t\t\t\t\tacc[key] = t.field({\n\t\t\t\t\t\t\t\ttype: sortingParameterEnumRef(),\n\t\t\t\t\t\t\t\trequired: false,\n\t\t\t\t\t\t\t});\n\n\t\t\t\t\t\t\treturn acc;\n\t\t\t\t\t\t},\n\t\t\t\t\t\t{} as Record<\n\t\t\t\t\t\t\tkeyof typeof tableSchema.columns,\n\t\t\t\t\t\t\tReturnType<typeof t.field>\n\t\t\t\t\t\t>,\n\t\t\t\t\t);\n\n\t\t\t\t\tconst relations = Object.entries(tableSchema.relations ?? {}).reduce(\n\t\t\t\t\t\t(acc, [key, value]) => {\n\t\t\t\t\t\t\tconst relationSchema = tableHelper({\n\t\t\t\t\t\t\t\tdb,\n\t\t\t\t\t\t\t\ttable: value.targetTable as Table,\n\t\t\t\t\t\t\t});\n\t\t\t\t\t\t\tconst referenceModel = orderArgImplementer({\n\t\t\t\t\t\t\t\tdbName: relationSchema.dbName,\n\t\t\t\t\t\t\t});\n\n\t\t\t\t\t\t\tacc[key] = t.field({\n\t\t\t\t\t\t\t\ttype: referenceModel,\n\t\t\t\t\t\t\t\trequired: false,\n\t\t\t\t\t\t\t});\n\n\t\t\t\t\t\t\treturn acc;\n\t\t\t\t\t\t},\n\t\t\t\t\t\t{} as Record<\n\t\t\t\t\t\t\tkeyof typeof tableSchema.columns,\n\t\t\t\t\t\t\tReturnType<typeof t.field>\n\t\t\t\t\t\t>,\n\t\t\t\t\t);\n\n\t\t\t\t\treturn {\n\t\t\t\t\t\t...fields,\n\t\t\t\t\t\t...relations,\n\t\t\t\t\t};\n\t\t\t\t},\n\t\t\t});\n\t\t};\n\n\t\tret = implement();\n\t\treferenceStorage.set(inputTypeName, ret);\n\t\treturn ret;\n\t};\n\n\treturn orderArgImplementer;\n};\n","import { createPubSub } from \"graphql-yoga\";\nimport type { TableIdentifierTSName } from \"./helpers/tableHelpers\";\nimport type { GenericDrizzleDbTypeConstraints } from \"./types/genericDrizzleDbType\";\nimport type {\n\tCustomRumblePothosConfig,\n\tRumbleInput,\n} from \"./types/rumbleInput\";\n\ntype PubSubAction = \"created\" | \"removed\" | \"updated\";\n\nconst SUBSCRIPTION_NOTIFIER_RUMBLE_PREFIX = \"RUMBLE_SUBSCRIPTION_NOTIFICATION\";\nconst SUBSCRIPTION_NOTIFIER_REMOVED = \"REMOVED\";\nconst SUBSCRIPTION_NOTIFIER_UPDATED = \"UPDATED\";\nconst SUBSCRIPTION_NOTIFIER_CREATED = \"CREATED\";\n\nexport type MakePubSubInstanceType<\n\tUserContext extends Record<string, any>,\n\tDB extends GenericDrizzleDbTypeConstraints,\n\tRequestEvent extends Record<string, any>,\n\tAction extends string,\n\tPothosConfig extends CustomRumblePothosConfig,\n> = ReturnType<\n\ttypeof createPubSubInstance<\n\t\tUserContext,\n\t\tDB,\n\t\tRequestEvent,\n\t\tAction,\n\t\tPothosConfig\n\t>\n>[\"makePubSubInstance\"];\n\nexport const createPubSubInstance = <\n\tUserContext extends Record<string, any>,\n\tDB extends GenericDrizzleDbTypeConstraints,\n\tRequestEvent extends Record<string, any>,\n\tAction extends string,\n\tPothosConfig extends CustomRumblePothosConfig,\n>({\n\tsubscriptions,\n}: RumbleInput<UserContext, DB, RequestEvent, Action, PothosConfig>) => {\n\tconst pubsub = subscriptions\n\t\t? createPubSub(...subscriptions)\n\t\t: createPubSub();\n\n\tconst makePubSubInstance = <\n\t\tExplicitTableName extends TableIdentifierTSName<DB>,\n\t>({\n\t\ttable,\n\t}: {\n\t\ttable: ExplicitTableName;\n\t}) => {\n\t\ttype PrimaryKeyType = any;\n\n\t\tfunction makePubSubKey({\n\t\t\taction,\n\t\t\ttableName,\n\t\t\tprimaryKeyValue,\n\t\t}: {\n\t\t\ttableName: string;\n\t\t\taction: PubSubAction;\n\t\t\tprimaryKeyValue?: PrimaryKeyType;\n\t\t}) {\n\t\t\tlet actionKey: string;\n\n\t\t\tswitch (action) {\n\t\t\t\tcase \"created\":\n\t\t\t\t\tactionKey = SUBSCRIPTION_NOTIFIER_CREATED;\n\t\t\t\t\tbreak;\n\t\t\t\tcase \"removed\":\n\t\t\t\t\tactionKey = SUBSCRIPTION_NOTIFIER_REMOVED;\n\t\t\t\t\tbreak;\n\t\t\t\tcase \"updated\":\n\t\t\t\t\tactionKey = SUBSCRIPTION_NOTIFIER_UPDATED;\n\t\t\t\t\tbreak;\n\t\t\t\tdefault:\n\t\t\t\t\tthrow new Error(`Unknown action: ${action}`);\n\t\t\t}\n\n\t\t\treturn `${SUBSCRIPTION_NOTIFIER_RUMBLE_PREFIX}/${tableName}${\n\t\t\t\tprimaryKeyValue ? `/${primaryKeyValue}` : \"\"\n\t\t\t}/${actionKey}`;\n\t\t}\n\n\t\t// TODO does caching these make sense?\n\t\treturn {\n\t\t\t/**\n\t\t\t * Call this when you want to register a subscription on an instance to this table\n\t\t\t */\n\t\t\tregisterOnInstance({\n\t\t\t\tinstance,\n\t\t\t\taction,\n\t\t\t\tprimaryKeyValue,\n\t\t\t}: {\n\t\t\t\tinstance: { register: (id: string) => void };\n\t\t\t\taction: PubSubAction;\n\t\t\t\tprimaryKeyValue?: string;\n\t\t\t}) {\n\t\t\t\tconst key = makePubSubKey({\n\t\t\t\t\ttableName: table.toString(),\n\t\t\t\t\taction,\n\t\t\t\t\tprimaryKeyValue,\n\t\t\t\t});\n\t\t\t\tinstance.register(key);\n\t\t\t},\n\t\t\t/**\n\t\t\t * Call this when you created an entity of this table\n\t\t\t */\n\t\t\tcreated() {\n\t\t\t\tconst key = makePubSubKey({\n\t\t\t\t\ttableName: table.toString(),\n\t\t\t\t\taction: \"created\",\n\t\t\t\t});\n\t\t\t\treturn pubsub.publish(key);\n\t\t\t},\n\t\t\t/**\n\t\t\t * Call this when you removed one or more entities of this table\n\t\t\t */\n\t\t\t// removed(primaryKeyValue?: PrimaryKeyType | PrimaryKeyType[]) {\n\t\t\tremoved() {\n\t\t\t\tconst key = makePubSubKey({\n\t\t\t\t\ttableName: table.toString(),\n\t\t\t\t\taction: \"removed\",\n\t\t\t\t\t//TODO would it make sense to use specific sub topics here?\n\t\t\t\t\t// primaryKeyValue,\n\t\t\t\t});\n\t\t\t\treturn pubsub.publish(key);\n\t\t\t},\n\t\t\t/**\n\t\t\t * Call this when you updated one or more entities of this table\n\t\t\t */\n\t\t\tupdated(primaryKeyValue?: PrimaryKeyType | PrimaryKeyType[]) {\n\t\t\t\tconst primaryKeys = Array.isArray(primaryKeyValue)\n\t\t\t\t\t? primaryKeyValue\n\t\t\t\t\t: [primaryKeyValue];\n\t\t\t\tconst keys = primaryKeys.map((primaryKeyValue) =>\n\t\t\t\t\tmakePubSubKey({\n\t\t\t\t\t\ttableName: table.toString(),\n\t\t\t\t\t\taction: \"updated\",\n\t\t\t\t\t\tprimaryKeyValue,\n\t\t\t\t\t}),\n\t\t\t\t);\n\t\t\t\tconst uniqueKeys = Array.from(new Set(keys));\n\t\t\t\tfor (const key of uniqueKeys) {\n\t\t\t\t\tpubsub.publish(key);\n\t\t\t\t}\n\t\t\t},\n\t\t};\n\t};\n\n\treturn {\n\t\tpubsub,\n\t\tmakePubSubInstance,\n\t};\n};\n","import { plural, singular } from \"pluralize\";\nimport { assertFindFirstExists } from \"./helpers/helper\";\nimport {\n\ttype TableIdentifierTSName,\n\ttableHelper,\n} from \"./helpers/tableHelpers\";\nimport type { OrderArgImplementerType } from \"./orderArg\";\nimport type { MakePubSubInstanceType } from \"./pubsub\";\nimport type { SchemaBuilderType } from \"./schemaBuilder\";\nimport { adjustQueryForSearch } from \"./search\";\nimport type { GenericDrizzleDbTypeConstraints } from \"./types/genericDrizzleDbType\";\nimport type {\n\tCustomRumblePothosConfig,\n\tRumbleInput,\n} from \"./types/rumbleInput\";\nimport type { WhereArgImplementerType } from \"./whereArg\";\n\n// TODO: consider removing the whole inject helper thing since we dont need a syntax transform anymore\n\nexport const createQueryImplementer = <\n\tUserContext extends Record<string, any>,\n\tDB extends GenericDrizzleDbTypeConstraints,\n\tRequestEvent extends Record<string, any>,\n\tAction extends string,\n\tPothosConfig extends CustomRumblePothosConfig,\n\tSchemaBuilder extends SchemaBuilderType<\n\t\tUserContext,\n\t\tDB,\n\t\tRequestEvent,\n\t\tAction,\n\t\tPothosConfig\n\t>,\n\tWhereArgImplementer extends WhereArgImplementerType<\n\t\tUserContext,\n\t\tDB,\n\t\tRequestEvent,\n\t\tAction,\n\t\tPothosConfig\n\t>,\n\tOrderArgImplementer extends OrderArgImplementerType<\n\t\tUserContext,\n\t\tDB,\n\t\tRequestEvent,\n\t\tAction,\n\t\tPothosConfig\n\t>,\n\tMakePubSubInstance extends MakePubSubInstanceType<\n\t\tUserContext,\n\t\tDB,\n\t\tRequestEvent,\n\t\tAction,\n\t\tPothosConfig\n\t>,\n>({\n\tdb,\n\tschemaBuilder,\n\tsearch,\n\twhereArgImplementer,\n\torderArgImplementer,\n\tmakePubSubInstance,\n}: RumbleInput<UserContext, DB, RequestEvent, Action, PothosConfig> & {\n\tschemaBuilder: SchemaBuilder;\n\twhereArgImplementer: WhereArgImplementer;\n\torderArgImplementer: OrderArgImplementer;\n\tmakePubSubInstance: MakePubSubInstance;\n}) => {\n\treturn <ExplicitTableName extends TableIdentifierTSName<DB>>({\n\t\ttable,\n\t\treadAction = \"read\" as Action,\n\t\tlistAction = \"read\" as Action,\n\t}: {\n\t\t/**\n\t\t * The table for which to implement the query\n\t\t */\n\t\ttable: ExplicitTableName;\n\t\t/**\n\t\t * Which action should be used for reading single entities\n\t\t * @default \"read\"\n\t\t */\n\t\treadAction?: Action;\n\t\t/**\n\t\t * Which action should be used for listing many entities\n\t\t * @default \"read\"\n\t\t */\n\t\tlistAction?: Action;\n\t}) => {\n\t\tconst WhereArg = whereArgImplementer({\n\t\t\ttable: table,\n\t\t});\n\t\tconst OrderArg = orderArgImplementer({\n\t\t\ttable: table,\n\t\t});\n\t\tconst tableSchema = tableHelper({\n\t\t\tdb,\n\t\t\ttsName: table!,\n\t\t});\n\t\tconst primaryKeyField = Object.values(tableSchema.primaryColumns)[0];\n\n\t\tconst { registerOnInstance } = makePubSubInstance({ table: table });\n\n\t\treturn schemaBuilder.queryFields((t) => {\n\t\t\tconst manyArgs = {\n\t\t\t\twhere: t.arg({ type: WhereArg, required: false }),\n\t\t\t\torderBy: t.arg({ type: OrderArg, required: false }),\n\t\t\t\tlimit: t.arg.int({ required: false }),\n\t\t\t\toffset: t.arg.int({ required: false }),\n\t\t\t\tsearch: t.arg.string({ required: false }),\n\t\t\t};\n\n\t\t\tif (!search?.enabled) {\n\t\t\t\tdelete (manyArgs as any).search;\n\t\t\t}\n\n\t\t\treturn {\n\t\t\t\t[plural(table.toString())]: t.drizzleField({\n\t\t\t\t\ttype: [table],\n\t\t\t\t\tnullable: false,\n\t\t\t\t\tsmartSubscription: true,\n\t\t\t\t\tdescription: `List all ${plural(table.toString())}`,\n\t\t\t\t\tsubscribe: (subscriptions, _root, _args, _ctx, _info) => {\n\t\t\t\t\t\tregisterOnInstance({\n\t\t\t\t\t\t\tinstance: subscriptions,\n\t\t\t\t\t\t\taction: \"created\",\n\t\t\t\t\t\t});\n\t\t\t\t\t\tregisterOnInstance({\n\t\t\t\t\t\t\tinstance: subscriptions,\n\t\t\t\t\t\t\taction: \"removed\",\n\t\t\t\t\t\t});\n\t\t\t\t\t},\n\t\t\t\t\targs: manyArgs,\n\t\t\t\t\tresolve: (query, _root, args, ctx, _info) => {\n\t\t\t\t\t\t// transform null prototyped object\n\t\t\t\t\t\targs = JSON.parse(JSON.stringify(args));\n\n\t\t\t\t\t\tadjustQueryForSearch({\n\t\t\t\t\t\t\tsearch,\n\t\t\t\t\t\t\targs,\n\t\t\t\t\t\t\ttableSchema,\n\t\t\t\t\t\t\tabilities: ctx.abilities[table as any].filter(listAction),\n\t\t\t\t\t\t});\n\n\t\t\t\t\t\tconst filter = ctx.abilities[table as any].filter(\n\t\t\t\t\t\t\tlistAction,\n\t\t\t\t\t\t\targs.where || args.limit || args.offset\n\t\t\t\t\t\t\t\t? {\n\t\t\t\t\t\t\t\t\t\tinject: {\n\t\t\t\t\t\t\t\t\t\t\twhere: args.where,\n\t\t\t\t\t\t\t\t\t\t\tlimit: args.limit,\n\t\t\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t: undefined,\n\t\t\t\t\t\t).query.many;\n\n\t\t\t\t\t\tif (args.offset) {\n\t\t\t\t\t\t\t(filter as any).offset = args.offset;\n\t\t\t\t\t\t}\n\n\t\t\t\t\t\tif (args.orderBy) {\n\t\t\t\t\t\t\t(filter as any).orderBy = args.orderBy;\n\t\t\t\t\t\t}\n\n\t\t\t\t\t\tconst queryInstance = query(filter as any);\n\n\t\t\t\t\t\tif (filter.columns) {\n\t\t\t\t\t\t\tqueryInstance.columns = filter.columns;\n\t\t\t\t\t\t}\n\n\t\t\t\t\t\treturn db.query[table as any].findMany(queryInstance);\n\t\t\t\t\t},\n\t\t\t\t}),\n\t\t\t\t[singular(table.toString())]: t.drizzleField({\n\t\t\t\t\ttype: table,\n\t\t\t\t\tnullable: false,\n\t\t\t\t\tsmartSubscription: true,\n\t\t\t\t\tdescription: `Get a single ${singular(table.toString())} by ID`,\n\t\t\t\t\targs: {\n\t\t\t\t\t\t// where: t.arg({ type: WhereArg, required: false }),\n\t\t\t\t\t\tid: t.arg.id({ required: true }),\n\t\t\t\t\t},\n\t\t\t\t\tresolve: (query, _root, args, ctx, _info) => {\n\t\t\t\t\t\t// transform null prototyped object\n\t\t\t\t\t\targs = JSON.parse(JSON.stringify(args));\n\n\t\t\t\t\t\tconst filter = ctx.abilities[table as any].filter(readAction, {\n\t\t\t\t\t\t\tinject: { where: { [primaryKeyField.name]: args.id } },\n\t\t\t\t\t\t}).query.single;\n\n\t\t\t\t\t\tconst queryInstance = query(filter as any);\n\n\t\t\t\t\t\tif (filter.columns) {\n\t\t\t\t\t\t\tqueryInstance.columns = filter.columns;\n\t\t\t\t\t\t}\n\n\t\t\t\t\t\treturn db.query[table as any]\n\t\t\t\t\t\t\t.findFirst(queryInstance)\n\t\t\t\t\t\t\t.then(assertFindFirstExists);\n\t\t\t\t\t},\n\t\t\t\t}),\n\t\t\t};\n\t\t});\n\t};\n};\n","import \"./pluginTypes\";\nimport SchemaBuilder, {\n\tBasePlugin,\n\ttype PothosOutputFieldConfig,\n\ttype SchemaTypes,\n} from \"@pothos/core\";\nimport type { GraphQLFieldResolver } from \"graphql\";\nimport { applyFilters } from \"../helpers/helper\";\nimport type { ApplyFiltersField } from \"./pluginTypes\";\n\nconst pluginName = \"ManualFiltersPlugin\";\n\nexport default pluginName;\n\nexport const applyFiltersKey = \"applyFilters\";\n\nexport class ManualFiltersPlugin<\n\tTypes extends SchemaTypes,\n> extends BasePlugin<Types> {\n\toverride wrapResolve(\n\t\tresolver: GraphQLFieldResolver<unknown, Types[\"Context\"], object>,\n\t\tfieldConfig: PothosOutputFieldConfig<Types>,\n\t): GraphQLFieldResolver<unknown, Types[\"Context\"], object> {\n\t\treturn async (parent, args, context, info) => {\n\t\t\t//TODO: https://github.com/hayes/pothos/discussions/1431#discussioncomment-12974130\n\t\t\tlet filters: ApplyFiltersField<Types[\"Context\"], any> | undefined;\n\t\t\tconst fieldType = fieldConfig?.type as any;\n\n\t\t\tif (fieldType.kind === \"List\") {\n\t\t\t\tfilters =\n\t\t\t\t\tfieldType.type?.ref.currentConfig.pothosOptions[applyFiltersKey];\n\t\t\t} else if (fieldType.kind === \"Object\") {\n\t\t\t\tfilters = fieldType.ref.currentConfig.pothosOptions[applyFiltersKey];\n\t\t\t}\n\n\t\t\tif (!filters || !Array.isArray(filters) || filters.length === 0) {\n\t\t\t\t// if no filter should be applied, just continue\n\t\t\t\treturn resolver(parent, args, context, info);\n\t\t\t}\n\n\t\t\tconst resolved = await resolver(parent, args, context, info);\n\t\t\tconst allResolvedValues = Array.isArray(resolved) ? resolved : [resolved];\n\t\t\tconst allFilters = Array.isArray(filters) ? filters : [filters];\n\n\t\t\tconst allowed = await applyFilters({\n\t\t\t\tfilters: allFilters,\n\t\t\t\tentities: allResolvedValues,\n\t\t\t\tcontext,\n\t\t\t});\n\n\t\t\t// if the original value was an array, return an array\n\t\t\tif (Array.isArray(resolved)) {\n\t\t\t\treturn allowed;\n\t\t\t}\n\n\t\t\t// if the original value was a single value, return the first allowed\n\t\t\t// or null if not allowed\n\t\t\treturn allowed[0] ?? null;\n\t\t};\n\t}\n}\n\nSchemaBuilder.registerPlugin(pluginName, ManualFiltersPlugin);\n","import type { Table } from \"drizzle-orm\";\nimport { toCamelCase } from \"drizzle-orm/casing\";\nimport { capitalize } from \"es-toolkit\";\nimport { type EnumImplementerType, isEnumSchema } from \"./enum\";\nimport { mapSQLTypeToGraphQLType } from \"./helpers/sqlTypes/mapSQLTypeToTSType\";\nimport type { PossibleSQLType } from \"./helpers/sqlTypes/types\";\nimport {\n\ttype TableIdentifierTSName,\n\ttableHelper,\n} from \"./helpers/tableHelpers\";\nimport type { SchemaBuilderType } from \"./schemaBuilder\";\nimport type { GenericDrizzleDbTypeConstraints } from \"./types/genericDrizzleDbType\";\nimport { RumbleError } from \"./types/rumbleError\";\nimport type {\n\tCustomRumblePothosConfig,\n\tRumbleInput,\n} from \"./types/rumbleInput\";\n\n// TODO: in general, several of the filter methods should be more\n// restrictive in case of explicitly allowed columns\n// search, order and filter should be restricted to allowed cols\n// and should completely ignore other fields since one might be ably\n// to narrow down and guess the actual values behind forbidden columns by\n// using the provided args. This way one could guess, e.g. secrets which are forbidden by\n// the column abilitiy settings but will be respected in searches, etc.\n\nexport type WhereArgImplementerType<\n\tUserContext extends Record<string, any>,\n\tDB extends GenericDrizzleDbTypeConstraints,\n\tRequestEvent extends Record<string, any>,\n\tAction extends string,\n\tPothosConfig extends CustomRumblePothosConfig,\n> = ReturnType<\n\ttypeof createWhereArgImplementer<\n\t\tUserContext,\n\t\tDB,\n\t\tRequestEvent,\n\t\tAction,\n\t\tPothosConfig,\n\t\tSchemaBuilderType<UserContext, DB, RequestEvent, Action, PothosConfig>,\n\t\tEnumImplementerType<UserContext, DB, RequestEvent, Action, PothosConfig>\n\t>\n>;\n\nconst makeDefaultName = (dbName: string) =>\n\t`${capitalize(toCamelCase(dbName.toString()))}WhereInputArgument`;\n\nexport const createWhereArgImplementer = <\n\tUserContext extends Record<string, any>,\n\tDB extends GenericDrizzleDbTypeConstraints,\n\tRequestEvent extends Record<string, any>,\n\tAction extends string,\n\tPothosConfig extends CustomRumblePothosConfig,\n\tSchemaBuilder extends SchemaBuilderType<\n\t\tUserContext,\n\t\tDB,\n\t\tRequestEvent,\n\t\tAction,\n\t\tPothosConfig\n\t>,\n\tEnumImplementer extends EnumImplementerType<\n\t\tUserContext,\n\t\tDB,\n\t\tRequestEvent,\n\t\tAction,\n\t\tPothosConfig\n\t>,\n>({\n\tdb,\n\tschemaBuilder,\n\tenumImplementer,\n}: RumbleInput<UserContext, DB, RequestEvent, Action, PothosConfig> & {\n\tenumImplementer: EnumImplementer;\n\tschemaBuilder: SchemaBuilder;\n}) => {\n\tconst referenceStorage = new Map<string, any>();\n\n\tconst whereArgImplementer = <\n\t\tExplicitTableName extends TableIdentifierTSName<DB>,\n\t\tRefName extends string,\n\t>({\n\t\ttable,\n\t\trefName,\n\t\tdbName,\n\t}: Partial<{\n\t\ttable: ExplicitTableName;\n\t\trefName: RefName | undefined;\n\t\tdbName: string;\n\t}> &\n\t\t(\n\t\t\t| {\n\t\t\t\t\ttable: ExplicitTableName;\n\t\t\t }\n\t\t\t| {\n\t\t\t\t\tdbName: string;\n\t\t\t }\n\t\t)) => {\n\t\tconst tableSchema = tableHelper({\n\t\t\tdb,\n\t\t\tdbName,\n\t\t\ttsName: table!,\n\t\t});\n\n\t\tconst inputTypeName = refName ?? makeDefaultName(tableSchema.tsName);\n\n\t\tlet ret: ReturnType<typeof implement> | undefined =\n\t\t\treferenceStorage.get(inputTypeName);\n\t\tif (ret) {\n\t\t\treturn ret;\n\t\t}\n\n\t\tconst implement = () => {\n\t\t\treturn schemaBuilder.inputType(inputTypeName, {\n\t\t\t\tfields: (t) => {\n\t\t\t\t\tconst mapSQLTypeStringToInputPothosType = (\n\t\t\t\t\t\tsqlType: PossibleSQLType,\n\t\t\t\t\t\tfieldName: string,\n\t\t\t\t\t) => {\n\t\t\t\t\t\tconst gqlType = mapSQLTypeToGraphQLType({\n\t\t\t\t\t\t\tsqlType,\n\t\t\t\t\t\t\tfieldName,\n\t\t\t\t\t\t});\n\t\t\t\t\t\tswitch (gqlType) {\n\t\t\t\t\t\t\tcase \"Int\":\n\t\t\t\t\t\t\t\treturn t.field({ type: \"IntWhereInputArgument\" });\n\t\t\t\t\t\t\tcase \"String\":\n\t\t\t\t\t\t\t\treturn t.field({ type: \"StringWhereInputArgument\" });\n\t\t\t\t\t\t\tcase \"Boolean\":\n\t\t\t\t\t\t\t\treturn t.boolean({ required: false });\n\t\t\t\t\t\t\tcase \"Date\":\n\t\t\t\t\t\t\t\treturn t.field({\n\t\t\t\t\t\t\t\t\ttype: \"DateWhereInputArgument\",\n\t\t\t\t\t\t\t\t});\n\t\t\t\t\t\t\tcase \"DateTime\":\n\t\t\t\t\t\t\t\treturn t.field({\n\t\t\t\t\t\t\t\t\ttype: \"DateWhereInputArgument\",\n\t\t\t\t\t\t\t\t});\n\t\t\t\t\t\t\tcase \"Float\":\n\t\t\t\t\t\t\t\treturn t.field({\n\t\t\t\t\t\t\t\t\ttype: \"FloatWhereInputArgument\",\n\t\t\t\t\t\t\t\t});\n\t\t\t\t\t\t\tcase \"ID\":\n\t\t\t\t\t\t\t\treturn t.id({ required: false });\n\t\t\t\t\t\t\tcase \"JSON\":\n\t\t\t\t\t\t\t\treturn t.field({\n\t\t\t\t\t\t\t\t\ttype: \"JSON\",\n\t\t\t\t\t\t\t\t\trequired: false,\n\t\t\t\t\t\t\t\t});\n\t\t\t\t\t\t\tdefault:\n\t\t\t\t\t\t\t\tthrow new RumbleError(\n\t\t\t\t\t\t\t\t\t`Unsupported argument type ${gqlType} for column ${sqlType}`,\n\t\t\t\t\t\t\t\t);\n\t\t\t\t\t\t}\n\t\t\t\t\t};\n\t\t\t\t\tconst fields = Object.entries(tableSchema.columns).reduce(\n\t\t\t\t\t\t(acc, [key, value]) => {\n\t\t\t\t\t\t\tif (isEnumSchema(value)) {\n\t\t\t\t\t\t\t\tconst enumImpl = enumImplementer({\n\t\t\t\t\t\t\t\t\tenumColumn: value,\n\t\t\t\t\t\t\t\t});\n\n\t\t\t\t\t\t\t\tacc[key] = t.field({\n\t\t\t\t\t\t\t\t\ttype: enumImpl,\n\t\t\t\t\t\t\t\t\trequired: false,\n\t\t\t\t\t\t\t\t});\n\t\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\t\tacc[key] = mapSQLTypeStringToInputPothosType(\n\t\t\t\t\t\t\t\t\tvalue.getSQLType() as PossibleSQLType,\n\t\t\t\t\t\t\t\t\tkey,\n\t\t\t\t\t\t\t\t);\n\t\t\t\t\t\t\t}\n\n\t\t\t\t\t\t\treturn acc;\n\t\t\t\t\t\t},\n\t\t\t\t\t\t{} as Record<\n\t\t\t\t\t\t\tkeyof typeof tableSchema.columns,\n\t\t\t\t\t\t\tReturnType<typeof mapSQLTypeStringToInputPothosType>\n\t\t\t\t\t\t>,\n\t\t\t\t\t);\n\n\t\t\t\t\tconst relations = Object.entries(tableSchema.relations ?? {}).reduce(\n\t\t\t\t\t\t(acc, [key, value]) => {\n\t\t\t\t\t\t\tconst relationSchema = tableHelper({\n\t\t\t\t\t\t\t\tdb,\n\t\t\t\t\t\t\t\ttable: value.targetTable as Table,\n\t\t\t\t\t\t\t});\n\t\t\t\t\t\t\tconst referenceModel = whereArgImplementer({\n\t\t\t\t\t\t\t\tdbName: relationSchema.dbName,\n\t\t\t\t\t\t\t});\n\n\t\t\t\t\t\t\tacc[key] = t.field({\n\t\t\t\t\t\t\t\ttype: referenceModel,\n\t\t\t\t\t\t\t\trequired: false,\n\t\t\t\t\t\t\t});\n\n\t\t\t\t\t\t\treturn acc;\n\t\t\t\t\t\t},\n\t\t\t\t\t\t{} as Record<\n\t\t\t\t\t\t\tkeyof typeof tableSchema.columns,\n\t\t\t\t\t\t\tReturnType<typeof mapSQLTypeStringToInputPothosType>\n\t\t\t\t\t\t>,\n\t\t\t\t\t);\n\n\t\t\t\t\treturn {\n\t\t\t\t\t\t...fields,\n\t\t\t\t\t\t...relations,\n\t\t\t\t\t};\n\t\t\t\t},\n\t\t\t});\n\t\t};\n\n\t\tret = implement();\n\t\treferenceStorage.set(inputTypeName, ret);\n\t\treturn ret;\n\t};\n\n\treturn whereArgImplementer;\n};\n\nexport type NumberWhereInputArgument = {\n\teq?: number;\n\tne?: number;\n\tgt?: number;\n\tgte?: number;\n\tlt?: number;\n\tlte?: number;\n\tin?: number[];\n\tnotIn?: number[];\n\tlike?: string;\n\tilike?: string;\n\tnotLike?: string;\n\tnotIlike?: string;\n\tisNull?: boolean;\n\tisNotNull?: boolean;\n\tarrayOverlaps?: number[];\n\tarrayContained?: number[];\n\tarrayContains?: number[];\n\tAND?: NumberWhereInputArgument[];\n\tOR?: NumberWhereInputArgument[];\n\tNOT?: NumberWhereInputArgument;\n};\n\nexport type StringWhereInputArgument = {\n\teq?: string;\n\tne?: string;\n\tgt?: string;\n\tgte?: string;\n\tlt?: string;\n\tlte?: string;\n\tin?: string[];\n\tnotIn?: string[];\n\tlike?: string;\n\tilike?: string;\n\tnotLike?: string;\n\tnotIlike?: string;\n\tisNull?: boolean;\n\tisNotNull?: boolean;\n\tarrayOverlaps?: string[];\n\tarrayContained?: string[];\n\tarrayContains?: string[];\n\tAND?: StringWhereInputArgument[];\n\tOR?: StringWhereInputArgument[];\n\tNOT?: StringWhereInputArgument;\n};\n\nexport type DateWhereInputArgument = {\n\teq?: Date;\n\tne?: Date;\n\tgt?: Date;\n\tgte?: Date;\n\tlt?: Date;\n\tlte?: Date;\n\tin?: Date[];\n\tnotIn?: Date[];\n\tlike?: string;\n\tilike?: string;\n\tnotLike?: string;\n\tnotIlike?: string;\n\tisNull?: boolean;\n\tisNotNull?: boolean;\n\tarrayOverlaps?: Date[];\n\tarrayContained?: Date[];\n\tarrayContains?: Date[];\n\tAND?: DateWhereInputArgument[];\n\tOR?: DateWhereInputArgument[];\n\tNOT?: DateWhereInputArgument;\n};\n\nexport function implementDefaultWhereInputArgs<\n\tUserContext extends Record<string, any>,\n\tDB extends GenericDrizzleDbTypeConstraints,\n\tRequestEvent extends Record<string, any>,\n\tAction extends string,\n\tPothosConfig extends CustomRumblePothosConfig,\n\tT extends SchemaBuilderType<\n\t\tUserContext,\n\t\tDB,\n\t\tRequestEvent,\n\t\tAction,\n\t\tPothosConfig\n\t>,\n>(schemaBuilder: T) {\n\tconst IntWhereInputArgument = schemaBuilder\n\t\t.inputRef<NumberWhereInputArgument>(\"IntWhereInputArgument\")\n\t\t.implement({\n\t\t\tfields: (t) => ({\n\t\t\t\teq: t.int(),\n\t\t\t\tne: t.int(),\n\t\t\t\tgt: t.int(),\n\t\t\t\tgte: t.int(),\n\t\t\t\tlt: t.int(),\n\t\t\t\tlte: t.int(),\n\t\t\t\tin: t.intList(),\n\t\t\t\tnotIn: t.intList(),\n\t\t\t\tlike: t.string(),\n\t\t\t\tilike: t.string(),\n\t\t\t\tnotLike: t.string(),\n\t\t\t\tnotIlike: t.string(),\n\t\t\t\tisNull: t.boolean(),\n\t\t\t\tisNotNull: t.boolean(),\n\t\t\t\tarrayOverlaps: t.intList(),\n\t\t\t\tarrayContained: t.intList(),\n\t\t\t\tarrayContains: t.intList(),\n\t\t\t\tAND: t.field({\n\t\t\t\t\ttype: [IntWhereInputArgument],\n\t\t\t\t}),\n\t\t\t\tOR: t.field({\n\t\t\t\t\ttype: [IntWhereInputArgument],\n\t\t\t\t}),\n\t\t\t\tNOT: t.field({\n\t\t\t\t\ttype: IntWhereInputArgument,\n\t\t\t\t}),\n\t\t\t}),\n\t\t});\n\n\tconst FloatWhereInputArgument = schemaBuilder\n\t\t.inputRef<NumberWhereInputArgument>(\"FloatWhereInputArgument\")\n\t\t.implement({\n\t\t\tfields: (t) => ({\n\t\t\t\teq: t.float(),\n\t\t\t\tne: t.float(),\n\t\t\t\tgt: t.float(),\n\t\t\t\tgte: t.float(),\n\t\t\t\tlt: t.float(),\n\t\t\t\tlte: t.float(),\n\t\t\t\tin: t.floatList(),\n\t\t\t\tnotIn: t.floatList(),\n\t\t\t\tlike: t.string(),\n\t\t\t\tilike: t.string(),\n\t\t\t\tnotLike: t.string(),\n\t\t\t\tnotIlike: t.string(),\n\t\t\t\tisNull: t.boolean(),\n\t\t\t\tisNotNull: t.boolean(),\n\t\t\t\tarrayOverlaps: t.floatList(),\n\t\t\t\tarrayContained: t.floatList(),\n\t\t\t\tarrayContains: t.floatList(),\n\t\t\t\tAND: t.field({\n\t\t\t\t\ttype: [FloatWhereInputArgument],\n\t\t\t\t}),\n\t\t\t\tOR: t.field({\n\t\t\t\t\ttype: [FloatWhereInputArgument],\n\t\t\t\t}),\n\t\t\t\tNOT: t.field({\n\t\t\t\t\ttype: FloatWhereInputArgument,\n\t\t\t\t}),\n\t\t\t}),\n\t\t});\n\n\tconst StringWhereInputArgument = schemaBuilder\n\t\t.inputRef<StringWhereInputArgument>(\"StringWhereInputArgument\")\n\t\t.implement({\n\t\t\tfields: (t) => ({\n\t\t\t\teq: t.string(),\n\t\t\t\tne: t.string(),\n\t\t\t\tgt: t.string(),\n\t\t\t\tgte: t.string(),\n\t\t\t\tlt: t.string(),\n\t\t\t\tlte: t.string(),\n\t\t\t\tin: t.stringList(),\n\t\t\t\tnotIn: t.stringList(),\n\t\t\t\tlike: t.string(),\n\t\t\t\tilike: t.string(),\n\t\t\t\tnotLike: t.string(),\n\t\t\t\tnotIlike: t.string(),\n\t\t\t\tisNull: t.boolean(),\n\t\t\t\tisNotNull: t.boolean(),\n\t\t\t\tarrayOverlaps: t.stringList(),\n\t\t\t\tarrayContained: t.stringList(),\n\t\t\t\tarrayContains: t.stringList(),\n\t\t\t\tAND: t.field({\n\t\t\t\t\ttype: [StringWhereInputArgument],\n\t\t\t\t}),\n\t\t\t\tOR: t.field({\n\t\t\t\t\ttype: [StringWhereInputArgument],\n\t\t\t\t}),\n\t\t\t\tNOT: t.field({\n\t\t\t\t\ttype: StringWhereInputArgument,\n\t\t\t\t}),\n\t\t\t}),\n\t\t});\n\n\tconst DateWhereInputArgument = schemaBuilder\n\t\t.inputRef<DateWhereInputArgument>(\"DateWhereInputArgument\")\n\t\t.implement({\n\t\t\tfields: (t) => ({\n\t\t\t\teq: t.field({ type: \"Date\" }),\n\t\t\t\tne: t.field({ type: \"Date\" }),\n\t\t\t\tgt: t.field({ type: \"Date\" }),\n\t\t\t\tgte: t.field({ type: \"Date\" }),\n\t\t\t\tlt: t.field({ type: \"Date\" }),\n\t\t\t\tlte: t.field({ type: \"Date\" }),\n\t\t\t\tin: t.field({ type: [\"Date\"] }),\n\t\t\t\tnotIn: t.field({ type: [\"Date\"] }),\n\t\t\t\tlike: t.string(),\n\t\t\t\tilike: t.string(),\n\t\t\t\tnotLike: t.string(),\n\t\t\t\tnotIlike: t.string(),\n\t\t\t\tisNull: t.boolean(),\n\t\t\t\tisNotNull: t.boolean(),\n\t\t\t\tarrayOverlaps: t.field({ type: [\"Date\"] }),\n\t\t\t\tarrayContained: t.field({ type: [\"Date\"] }),\n\t\t\t\tarrayContains: t.field({ type: [\"Date\"] }),\n\t\t\t\tAND: t.field({\n\t\t\t\t\ttype: [DateWhereInputArgument],\n\t\t\t\t}),\n\t\t\t\tOR: t.field({\n\t\t\t\t\ttype: [DateWhereInputArgument],\n\t\t\t\t}),\n\t\t\t\tNOT: t.field({\n\t\t\t\t\ttype: DateWhereInputArgument,\n\t\t\t\t}),\n\t\t\t}),\n\t\t});\n}\n","import SchemaBuilder from \"@pothos/core\";\nimport DrizzlePlugin from \"@pothos/plugin-drizzle\";\nimport SmartSubscriptionsPlugin, {\n\tsubscribeOptionsFromIterator,\n} from \"@pothos/plugin-smart-subscriptions\";\nimport {\n\tDateResolver,\n\tDateTimeISOResolver,\n\tJSONResolver,\n} from \"graphql-scalars\";\nimport type { createPubSub } from \"graphql-yoga\";\nimport type { ContextType } from \"./context\";\nimport ExplicitChecksPlugin from \"./runtimeFiltersPlugin/runtimeFiltersPlugin\";\nimport type { GenericDrizzleDbTypeConstraints } from \"./types/genericDrizzleDbType\";\nimport type {\n\tCustomRumblePothosConfig,\n\tRumbleInput,\n} from \"./types/rumbleInput\";\nimport {\n\ttype DateWhereInputArgument,\n\timplementDefaultWhereInputArgs,\n\ttype NumberWhereInputArgument,\n\ttype StringWhereInputArgument,\n} from \"./whereArg\";\n\nexport type SchemaBuilderType<\n\tUserContext extends Record<string, any>,\n\tDB extends GenericDrizzleDbTypeConstraints,\n\tRequestEvent extends Record<string, any>,\n\tAction extends string,\n\tPothosConfig extends CustomRumblePothosConfig,\n> = ReturnType<\n\ttypeof createSchemaBuilder<\n\t\tUserContext,\n\t\tDB,\n\t\tRequestEvent,\n\t\tAction,\n\t\tPothosConfig\n\t>\n>[\"schemaBuilder\"];\n\nexport const createSchemaBuilder = <\n\tUserContext extends Record<string, any>,\n\tDB extends GenericDrizzleDbTypeConstraints,\n\tRequestEvent extends Record<string, any>,\n\tAction extends string,\n\tPothosConfig extends CustomRumblePothosConfig,\n>({\n\tdb,\n\tdisableDefaultObjects,\n\tpubsub,\n\tpothosConfig,\n}: RumbleInput<UserContext, DB, RequestEvent, Action, PothosConfig> & {\n\tpubsub: ReturnType<typeof createPubSub>;\n}) => {\n\tconst schemaBuilder = new SchemaBuilder<{\n\t\tContext: ContextType<UserContext, DB, RequestEvent, Action, PothosConfig>;\n\t\tDrizzleRelations: DB[\"_\"][\"relations\"];\n\t\tScalars: {\n\t\t\tJSON: {\n\t\t\t\tInput: unknown;\n\t\t\t\tOutput: unknown;\n\t\t\t};\n\t\t\tDate: {\n\t\t\t\tInput: Date;\n\t\t\t\tOutput: Date;\n\t\t\t};\n\t\t\tDateTime: {\n\t\t\t\tInput: Date;\n\t\t\t\tOutput: Date;\n\t\t\t};\n\t\t};\n\t\tInputs: {\n\t\t\tIntWhereInputArgument: NumberWhereInputArgument;\n\t\t\tFloatWhereInputArgument: NumberWhereInputArgument;\n\t\t\tStringWhereInputArgument: StringWhereInputArgument;\n\t\t\tDateWhereInputArgument: DateWhereInputArgument;\n\t\t};\n\t}>({\n\t\t...pothosConfig,\n\t\tplugins: [\n\t\t\tExplicitChecksPlugin,\n\t\t\tDrizzlePlugin,\n\t\t\tSmartSubscriptionsPlugin,\n\t\t\t...(pothosConfig?.plugins ?? []),\n\t\t],\n\t\tdrizzle: {\n\t\t\tclient: db,\n\t\t\trelations: db._.relations,\n\t\t\tgetTableConfig(table) {\n\t\t\t\t//TODO support composite primary keys\n\t\t\t\treturn {\n\t\t\t\t\tcolumns: Object.values((table as any)[Symbol.for(\"drizzle:Columns\")]),\n\t\t\t\t\tprimaryKeys: Object.values(\n\t\t\t\t\t\t(table as any)[Symbol.for(\"drizzle:Columns\")],\n\t\t\t\t\t).filter((v: any) => v.primary),\n\t\t\t\t} as any;\n\t\t\t},\n\t\t},\n\t\tsmartSubscriptions: {\n\t\t\t...subscribeOptionsFromIterator((name, _context) => {\n\t\t\t\treturn pubsub.subscribe(name);\n\t\t\t}),\n\t\t},\n\t});\n\n\tschemaBuilder.addScalarType(\"JSON\", JSONResolver);\n\tschemaBuilder.addScalarType(\"Date\", DateResolver);\n\tschemaBuilder.addScalarType(\"DateTime\", DateTimeISOResolver);\n\timplementDefaultWhereInputArgs(schemaBuilder as any);\n\n\tif (!disableDefaultObjects?.query) {\n\t\tschemaBuilder.queryType({});\n\t}\n\n\tif (!disableDefaultObjects?.subscription) {\n\t\tschemaBuilder.subscriptionType({});\n\t}\n\n\tif (!disableDefaultObjects?.mutation) {\n\t\tschemaBuilder.mutationType({});\n\t}\n\n\treturn { schemaBuilder };\n};\n","import { EnvelopArmorPlugin } from \"@escape.tech/graphql-armor\";\nimport { useDisableIntrospection } from \"@graphql-yoga/plugin-disable-introspection\";\nimport { merge } from \"es-toolkit\";\nimport {\n\tcreateYoga as nativeCreateYoga,\n\ttype YogaServerOptions,\n} from \"graphql-yoga\";\nimport { useSofa } from \"sofa-api\";\nimport { createAbilityBuilder } from \"./abilityBuilder\";\nimport { clientCreatorImplementer } from \"./client/client\";\nimport { createContextFunction } from \"./context\";\nimport { createEnumImplementer } from \"./enum\";\nimport { lazy } from \"./helpers/lazy\";\nimport { sofaOpenAPIWebhookDocs } from \"./helpers/sofaOpenAPIWebhookDocs\";\nimport { createObjectImplementer } from \"./object\";\nimport { createOrderArgImplementer } from \"./orderArg\";\nimport { createPubSubInstance } from \"./pubsub\";\nimport { createQueryImplementer } from \"./query\";\nimport { createSchemaBuilder } from \"./schemaBuilder\";\nimport { initSearchIfApplicable } from \"./search\";\nimport type { GenericDrizzleDbTypeConstraints } from \"./types/genericDrizzleDbType\";\nimport type {\n\tCustomRumblePothosConfig,\n\tRumbleInput,\n} from \"./types/rumbleInput\";\nimport { createWhereArgImplementer } from \"./whereArg\";\n\nexport const rumble = <\n\tUserContext extends Record<string, any>,\n\tDB extends GenericDrizzleDbTypeConstraints,\n\tRequestEvent extends Record<string, any>,\n\tPothosConfig extends CustomRumblePothosConfig,\n\tAction extends string = \"read\" | \"update\" | \"delete\",\n>(\n\trumbleInput: RumbleInput<UserContext, DB, RequestEvent, Action, PothosConfig>,\n) => {\n\t// to be able to iterate over the actions, we populate the actions array in case the user does not\n\tif (!rumbleInput.actions) {\n\t\trumbleInput.actions = [\"read\", \"update\", \"delete\"] as Action[];\n\t}\n\n\tif (rumbleInput.defaultLimit === undefined) {\n\t\trumbleInput.defaultLimit = 100;\n\t}\n\n\tif (rumbleInput.search?.enabled) {\n\t\tinitSearchIfApplicable(rumbleInput.db);\n\t}\n\n\tconst abilityBuilder = createAbilityBuilder<\n\t\tUserContext,\n\t\tDB,\n\t\tRequestEvent,\n\t\tAction,\n\t\tPothosConfig\n\t>(rumbleInput);\n\n\tconst context = createContextFunction<\n\t\tUserContext,\n\t\tDB,\n\t\tRequestEvent,\n\t\tAction,\n\t\tPothosConfig,\n\t\ttypeof abilityBuilder\n\t>({\n\t\t...rumbleInput,\n\t\tabilityBuilder,\n\t});\n\n\tconst { makePubSubInstance, pubsub } = createPubSubInstance<\n\t\tUserContext,\n\t\tDB,\n\t\tRequestEvent,\n\t\tAction,\n\t\tPothosConfig\n\t>({\n\t\t...rumbleInput,\n\t});\n\n\tconst { schemaBuilder } = createSchemaBuilder<\n\t\tUserContext,\n\t\tDB,\n\t\tRequestEvent,\n\t\tAction,\n\t\tPothosConfig\n\t>({ ...rumbleInput, pubsub });\n\tconst enum_ = createEnumImplementer<\n\t\tUserContext,\n\t\tDB,\n\t\tRequestEvent,\n\t\tAction,\n\t\tPothosConfig,\n\t\ttypeof schemaBuilder\n\t>({\n\t\t...rumbleInput,\n\t\tschemaBuilder,\n\t});\n\tconst whereArg = createWhereArgImplementer<\n\t\tUserContext,\n\t\tDB,\n\t\tRequestEvent,\n\t\tAction,\n\t\tPothosConfig,\n\t\ttypeof schemaBuilder,\n\t\ttypeof enum_\n\t>({\n\t\t...rumbleInput,\n\t\tschemaBuilder,\n\t\tenumImplementer: enum_,\n\t});\n\tconst orderArg = createOrderArgImplementer<\n\t\tUserContext,\n\t\tDB,\n\t\tRequestEvent,\n\t\tAction,\n\t\tPothosConfig,\n\t\ttypeof schemaBuilder\n\t>({\n\t\t...rumbleInput,\n\t\tschemaBuilder,\n\t});\n\tconst object = createObjectImplementer<\n\t\tUserContext,\n\t\tDB,\n\t\tRequestEvent,\n\t\tAction,\n\t\tPothosConfig,\n\t\ttypeof schemaBuilder,\n\t\ttypeof whereArg,\n\t\ttypeof orderArg,\n\t\ttypeof enum_,\n\t\ttypeof makePubSubInstance,\n\t\ttypeof abilityBuilder\n\t>({\n\t\t...rumbleInput,\n\t\tschemaBuilder,\n\t\tmakePubSubInstance,\n\t\twhereArgImplementer: whereArg,\n\t\torderArgImplementer: orderArg,\n\t\tenumImplementer: enum_,\n\t\tabilityBuilder,\n\t});\n\tconst query = createQueryImplementer<\n\t\tUserContext,\n\t\tDB,\n\t\tRequestEvent,\n\t\tAction,\n\t\tPothosConfig,\n\t\ttypeof schemaBuilder,\n\t\ttypeof whereArg,\n\t\ttypeof orderArg,\n\t\ttypeof makePubSubInstance\n\t>({\n\t\t...rumbleInput,\n\t\tschemaBuilder,\n\t\twhereArgImplementer: whereArg,\n\t\torderArgImplementer: orderArg,\n\t\tmakePubSubInstance,\n\t});\n\n\tconst builtSchema = lazy(() => schemaBuilder.toSchema());\n\n\tconst createYoga = (\n\t\targs?:\n\t\t\t| (Omit<YogaServerOptions<RequestEvent, any>, \"schema\" | \"context\"> & {\n\t\t\t\t\t/**\n\t\t\t\t\t * Determines if the API should disclose various things about its structure.\n\t\t\t\t\t * Defaults to `process.env.NODE_ENV === \"development\"`.\n\t\t\t\t\t * If enabled, the api will allow introspection requests, provide the graphiql\n\t\t\t\t\t * explorer and will not apply the additional envelop armor plugin.\n\t\t\t\t\t */\n\t\t\t\t\tenableApiDocs?: boolean;\n\t\t\t })\n\t\t\t| undefined,\n\t) => {\n\t\tconst enableApiDocs =\n\t\t\targs?.enableApiDocs ?? process?.env?.NODE_ENV === \"development\" ?? false;\n\n\t\treturn nativeCreateYoga<RequestEvent>({\n\t\t\t...args,\n\t\t\tgraphiql: enableApiDocs,\n\t\t\tplugins: [\n\t\t\t\t...(args?.plugins ?? []),\n\t\t\t\t...(enableApiDocs\n\t\t\t\t\t? []\n\t\t\t\t\t: [useDisableIntrospection(), EnvelopArmorPlugin()]),\n\t\t\t].filter(Boolean),\n\t\t\tschema: builtSchema(),\n\t\t\tcontext,\n\t\t});\n\t};\n\n\tconst createSofa = (\n\t\targs: Omit<Parameters<typeof useSofa>[0], \"schema\" | \"context\">,\n\t) => {\n\t\tif (args.openAPI) {\n\t\t\tmerge(args.openAPI, sofaOpenAPIWebhookDocs);\n\t\t}\n\t\treturn useSofa({\n\t\t\t...args,\n\t\t\tschema: builtSchema(),\n\t\t\tcontext,\n\t\t});\n\t};\n\n\tconst clientCreator = clientCreatorImplementer<\n\t\tUserContext,\n\t\tDB,\n\t\tRequestEvent,\n\t\tAction,\n\t\tPothosConfig,\n\t\ttypeof schemaBuilder\n\t>({\n\t\t...rumbleInput,\n\t\tbuiltSchema,\n\t});\n\n\treturn {\n\t\t/**\n * The ability builder. Use it to declare whats allowed for each entity in your DB.\n * \n * @example\n * \n * ```ts\n * // users can edit themselves\n abilityBuilder.users\n .allow([\"read\", \"update\", \"delete\"])\n .when(({ userId }) => ({ where: eq(schema.users.id, userId) }));\n \n // everyone can read posts\n abilityBuilder.posts.allow(\"read\");\n * \n * ```\n */\n\t\tabilityBuilder,\n\t\t/**\n\t\t * The pothos schema builder. See https://pothos-graphql.dev/docs/plugins/drizzle\n\t\t */\n\t\tschemaBuilder,\n\t\t/**\n * Creates the native yoga instance. Can be used to run an actual HTTP server.\n * \n * @example\n * \n * ```ts\n\t * \n import { createServer } from \"node:http\";\n\t\t* const server = createServer(createYoga());\n\t\tserver.listen(3000, () => {\n console.info(\"Visit http://localhost:3000/graphql\");\n\t\t\t});\n\t\t\t* ```\n\t * https://the-guild.dev/graphql/yoga-server/docs#server\n */\n\t\tcreateYoga,\n\t\t/**\n\t\t * Creates a sofa instance to offer a REST API.\n\t\t```ts\n\t\timport express from 'express';\n\t\t\n\t\tconst app = express();\n\t\tconst sofa = createSofa(...);\n\t\t\n\t\tapp.use('/api', useSofa({ schema }));\n\t\t```\n\t\t* https://the-guild.dev/graphql/sofa-api/docs#usage\n\t\t */\n\t\tcreateSofa,\n\t\t/**\n\t\t * A function for creating default objects for your schema\n\t\t */\n\t\tobject,\n\t\t/**\n\t\t * A function for creating where args to filter entities\n\t\t */\n\t\twhereArg,\n\t\t/**\n\t\t * A function for creating order args to sort entities\n\t\t */\n\t\torderArg,\n\t\t/**\n\t\t * A function for creating default READ queries.\n\t\t * Make sure the objects for the table you are creating the queries for are implemented\n\t\t */\n\t\tquery,\n\t\t/**\n\t\t * A function for creating a pubsub instance for a table. Use this to publish or subscribe events\n\t\t */\n\t\tpubsub: makePubSubInstance,\n\t\t/**\n\t\t * A function to implement enums for graphql usage.\n\t\t * The other helpers use this helper internally so in most cases you do not have to\n\t\t * call this helper directly, unless you need the reference to an enum type\n\t\t */\n\t\tenum_,\n\t\t/**\n\t\t * Create a client to consume a rumble graphql api at the specified location.\n\t\t * Requires GraphQL, does not work with the SOFA REST API.\n\t\t */\n\t\tclientCreator,\n\t};\n};\n"]}