{"version":3,"file":"custom.mjs","sources":["../../../../../src/runtime/internals/operations/custom.ts"],"sourcesContent":["import { map } from 'rxjs';\nimport { authModeParams, getDefaultSelectionSetForNonModelWithIR, generateSelectionSet, getCustomHeaders, initializeModel, selectionSetIRToString, } from '../APIClient';\nimport { handleSingularGraphQlError } from './utils';\nimport { selfAwareAsync } from '../../utils';\nimport { extendCancellability } from '../cancellation';\nimport { createUserAgentOverride } from '../ai/getCustomUserAgentDetails';\n/**\n * Type guard for checking whether a Custom Operation argument is a contextSpec object\n */\nconst argIsContextSpec = (arg) => {\n    return typeof arg?.token?.value === 'symbol';\n};\n/**\n * Builds an operation function, embedded with all client and context data, that\n * can be attached to a client as a custom query or mutation.\n *\n * If we have this source schema:\n *\n * ```typescript\n * a.schema({\n *   echo: a.query()\n *     .arguments({input: a.string().required()})\n *     .returns(a.string())\n * })\n * ```\n *\n * Our model intro schema will contain an entry like this:\n *\n * ```ts\n * {\n *   queries: {\n *     echo: {\n *       name: \"echo\",\n *       isArray: false,\n *       type: 'String',\n *       isRequired: false,\n *       arguments: {\n *         input: {\n *           name: 'input',\n *           isArray: false,\n *           type: String,\n *           isRequired: true\n *         }\n *       }\n *     }\n *   }\n * }\n * ```\n *\n * The `echo` object is used to build the `echo' method that goes here:\n *\n * ```typescript\n * const client = generateClent()\n * const { data } = await client.queries.echo({input: 'a string'});\n * //                                    ^\n * //                                    |\n * //                                    +-- This one right here.\n * //\n * ```\n *\n *\n * @param client The client to run graphql queries through.\n * @param modelIntrospection The model introspection schema the op comes from.\n * @param operationType The broad category of graphql operation.\n * @param operation The operation definition from the introspection schema.\n * @param useContext Whether the function needs to accept an SSR context.\n * @returns The operation function to attach to query, mutations, etc.\n */\nexport function customOpFactory(client, modelIntrospection, operationType, operation, useContext, getInternals, customUserAgentDetails) {\n    // .arguments() are defined for the custom operation in the schema builder\n    // and are present in the model introspection schema\n    const argsDefined = operation.arguments !== undefined;\n    const op = (...args) => {\n        // options is always the last argument\n        const options = args[args.length - 1];\n        let contextSpec;\n        let arg;\n        if (useContext) {\n            if (argIsContextSpec(args[0])) {\n                contextSpec = args[0];\n            }\n            else {\n                throw new Error(`Invalid first argument passed to ${operation.name}. Expected contextSpec`);\n            }\n        }\n        if (argsDefined) {\n            if (useContext) {\n                arg = args[1];\n            }\n            else {\n                arg = args[0];\n            }\n        }\n        if (operationType === 'subscription') {\n            return _opSubscription(\n            // subscriptions are only enabled on the clientside\n            client, modelIntrospection, operation, getInternals, arg, options, customUserAgentDetails);\n        }\n        return _op(client, modelIntrospection, operationType, operation, getInternals, arg, options, contextSpec, customUserAgentDetails);\n    };\n    return op;\n}\n/**\n * Runtime test and type guard to check whether `o[field]` is a `String`.\n *\n * ```typescript\n * if (hasStringField(o, 'prop')) {\n *   const s = o.prop;\n *   //    ^? const s: string\n * }\n * ```\n *\n * @param o Object to inspect\n * @param field Field to look for\n * @returns Boolean: `true` if the `o[field]` is a `string`\n */\nfunction hasStringField(o, field) {\n    return typeof o[field] === 'string';\n}\nfunction isEnumType(type) {\n    return type instanceof Object && 'enum' in type;\n}\nfunction isInputType(type) {\n    return type instanceof Object && 'input' in type;\n}\n/**\n * @param argDef A single argument definition from a custom operation\n * @returns A string naming the base type including the `!` if the arg is required.\n */\nfunction argumentBaseTypeString({ type, isRequired }) {\n    const requiredFlag = isRequired ? '!' : '';\n    if (isEnumType(type)) {\n        return `${type.enum}${requiredFlag}`;\n    }\n    if (isInputType(type)) {\n        return `${type.input}${requiredFlag}`;\n    }\n    return `${type}${requiredFlag}`;\n}\n/**\n * Generates \"outer\" arguments string for a custom operation. For example,\n * in this operation:\n *\n * ```graphql\n * query MyQuery(InputString: String!) {\n *   echoString(InputString: $InputString)\n * }\n * ```\n *\n * This function returns the top/outer level arguments as a string:\n *\n * ```json\n * \"InputString: String!\"\n * ```\n *\n * @param operation Operation object from model introspection schema.\n * @returns \"outer\" arguments string\n */\nfunction outerArguments(operation) {\n    if (operation.arguments === undefined) {\n        return '';\n    }\n    const args = Object.entries(operation.arguments)\n        .map(([k, argument]) => {\n        const baseType = argumentBaseTypeString(argument);\n        const finalType = argument.isArray\n            ? `[${baseType}]${argument.isArrayNullable ? '' : '!'}`\n            : baseType;\n        return `$${k}: ${finalType}`;\n    })\n        .join(', ');\n    return args.length > 0 ? `(${args})` : '';\n}\n/**\n * Generates \"inner\" arguments string for a custom operation. For example,\n * in this operation:\n *\n * ```graphql\n * query MyQuery(InputString: String!) {\n *   echoString(InputString: $InputString)\n * }\n * ```\n *\n * This function returns the inner arguments as a string:\n *\n * ```json\n * \"InputString: $InputString\"\n * ```\n *\n * @param operation Operation object from model introspection schema.\n * @returns \"outer\" arguments string\n */\nfunction innerArguments(operation) {\n    if (operation.arguments === undefined) {\n        return '';\n    }\n    const args = Object.keys(operation.arguments)\n        .map((k) => `${k}: $${k}`)\n        .join(', ');\n    return args.length > 0 ? `(${args})` : '';\n}\n/**\n * Generates the selection set string for a custom operation. This is slightly\n * different than the selection set generation for models. If the custom op returns\n * a primitive or enum types, it doesn't require a selection set at all.\n *\n * E.g., the graphql might look like this:\n *\n * ```graphql\n * query MyQuery {\n *   echoString(inputString: \"whatever\")\n * }\n * #                                     ^\n * #                                     |\n * #                                     +-- no selection set\n * ```\n *\n * Non-primitive return type selection set generation will be similar to other\n * model operations.\n *\n * @param modelIntrospection The full code-generated introspection schema.\n * @param operation The operation object from the schema.\n * @returns The selection set as a string.\n */\nfunction operationSelectionSet(modelIntrospection, operation) {\n    if (hasStringField(operation, 'type') ||\n        hasStringField(operation.type, 'enum')) {\n        return '';\n    }\n    else if (hasStringField(operation.type, 'nonModel')) {\n        const nonModel = modelIntrospection.nonModels[operation.type.nonModel];\n        return `{${selectionSetIRToString(getDefaultSelectionSetForNonModelWithIR(nonModel, modelIntrospection))}}`;\n    }\n    else if (hasStringField(operation.type, 'model')) {\n        return `{${generateSelectionSet(modelIntrospection, operation.type.model)}}`;\n    }\n    else {\n        return '';\n    }\n}\n/**\n * Maps an arguments objec to graphql variables, removing superfluous args and\n * screaming loudly when required args are missing.\n *\n * @param operation The operation to construct graphql request variables for.\n * @param args The arguments to map variables from.\n * @returns The graphql variables object.\n */\nfunction operationVariables(operation, args = {}) {\n    const variables = {};\n    if (operation.arguments === undefined) {\n        return variables;\n    }\n    for (const argDef of Object.values(operation.arguments)) {\n        if (typeof args[argDef.name] !== 'undefined') {\n            variables[argDef.name] = args[argDef.name];\n        }\n        else if (argDef.isRequired) {\n            // At this point, the variable is both required and missing: We don't need\n            // to continue. The operation is expected to fail.\n            throw new Error(`${operation.name} requires arguments '${argDef.name}'`);\n        }\n    }\n    return variables;\n}\n/**\n * Executes an operation from the given model intro schema against a client, returning\n * a fully instantiated model when relevant.\n *\n * @param client The client to operate `graphql()` calls through.\n * @param modelIntrospection The model intro schema to construct requests from.\n * @param operationType The high level graphql operation type.\n * @param operation The specific operation name, args, return type details.\n * @param args The arguments to provide to the operation as variables.\n * @param options Request options like headers, etc.\n * @param context SSR context if relevant.\n * @returns Result from the graphql request, model-instantiated when relevant.\n */\nfunction _op(client, modelIntrospection, operationType, operation, getInternals, args, options, context, customUserAgentDetails) {\n    return selfAwareAsync(async (resultPromise) => {\n        const { name: operationName } = operation;\n        const auth = authModeParams(client, getInternals, options);\n        const headers = getCustomHeaders(client, getInternals, options?.headers);\n        const outerArgsString = outerArguments(operation);\n        const innerArgsString = innerArguments(operation);\n        const selectionSet = operationSelectionSet(modelIntrospection, operation);\n        const returnTypeModelName = hasStringField(operation.type, 'model')\n            ? operation.type.model\n            : undefined;\n        const query = `\n    ${operationType.toLocaleLowerCase()}${outerArgsString} {\n      ${operationName}${innerArgsString} ${selectionSet}\n    }\n  `;\n        const variables = operationVariables(operation, args);\n        const userAgentOverride = createUserAgentOverride(customUserAgentDetails);\n        try {\n            const basePromise = context\n                ? client.graphql(context, {\n                    ...auth,\n                    query,\n                    variables,\n                }, headers)\n                : client.graphql({\n                    ...auth,\n                    query,\n                    variables,\n                    ...userAgentOverride,\n                }, headers);\n            const extendedPromise = extendCancellability(basePromise, resultPromise);\n            const { data, extensions } = await extendedPromise;\n            // flatten response\n            if (data) {\n                const [key] = Object.keys(data);\n                const isArrayResult = Array.isArray(data[key]);\n                // TODO: when adding support for custom selection set, flattening will need\n                // to occur recursively. For now, it's expected that related models are not\n                // present in the result. Only FK's are present. Any related model properties\n                // should be replaced with lazy loaders under the current implementation.\n                const flattenedResult = isArrayResult\n                    ? data[key].filter((x) => x)\n                    : data[key];\n                // TODO: custom selection set. current selection set is default selection set only\n                // custom selection set requires data-schema-type + runtime updates above.\n                const initialized = returnTypeModelName\n                    ? initializeModel(client, returnTypeModelName, isArrayResult ? flattenedResult : [flattenedResult], modelIntrospection, auth.authMode, auth.authToken, !!context)\n                    : flattenedResult;\n                return {\n                    data: !isArrayResult && Array.isArray(initialized)\n                        ? initialized.shift()\n                        : initialized,\n                    extensions,\n                };\n            }\n            else {\n                return { data: null, extensions };\n            }\n        }\n        catch (error) {\n            /**\n             * The `data` type returned by `error` here could be:\n             * 1) `null`\n             * 2) an empty object\n             * 3) \"populated\" but with a `null` value `{ getPost: null }`\n             * 4) an actual record `{ getPost: { id: '1', title: 'Hello, World!' } }`\n             */\n            const { data, errors } = error;\n            /**\n             * `data` is not `null`, and is not an empty object:\n             */\n            if (data && Object.keys(data).length !== 0 && errors) {\n                const [key] = Object.keys(data);\n                const isArrayResult = Array.isArray(data[key]);\n                // TODO: when adding support for custom selection set, flattening will need\n                // to occur recursively. For now, it's expected that related models are not\n                // present in the result. Only FK's are present. Any related model properties\n                // should be replaced with lazy loaders under the current implementation.\n                const flattenedResult = isArrayResult\n                    ? data[key].filter((x) => x)\n                    : data[key];\n                /**\n                 * `flattenedResult` could be `null` here (e.g. `data: { getPost: null }`)\n                 * if `flattenedResult`, result is an actual record:\n                 */\n                if (flattenedResult) {\n                    // TODO: custom selection set. current selection set is default selection set only\n                    // custom selection set requires data-schema-type + runtime updates above.\n                    const initialized = returnTypeModelName\n                        ? initializeModel(client, returnTypeModelName, isArrayResult ? flattenedResult : [flattenedResult], modelIntrospection, auth.authMode, auth.authToken, !!context)\n                        : flattenedResult;\n                    return {\n                        data: !isArrayResult && Array.isArray(initialized)\n                            ? initialized.shift()\n                            : initialized,\n                        errors,\n                    };\n                }\n                else {\n                    // was `data: { getPost: null }`)\n                    return handleSingularGraphQlError(error);\n                }\n            }\n            else {\n                // `data` is `null`:\n                return handleSingularGraphQlError(error);\n            }\n        }\n    });\n}\n/**\n * Executes an operation from the given model intro schema against a client, returning\n * a fully instantiated model when relevant.\n *\n * @param client The client to operate `graphql()` calls through.\n * @param modelIntrospection The model intro schema to construct requests from.\n * @param operation The specific operation name, args, return type details.\n * @param args The arguments to provide to the operation as variables.\n * @param options Request options like headers, etc.\n * @returns Result from the graphql request, model-instantiated when relevant.\n */\nfunction _opSubscription(client, modelIntrospection, operation, getInternals, args, options, customUserAgentDetails) {\n    const operationType = 'subscription';\n    const { name: operationName } = operation;\n    const auth = authModeParams(client, getInternals, options);\n    const headers = getCustomHeaders(client, getInternals, options?.headers);\n    const outerArgsString = outerArguments(operation);\n    const innerArgsString = innerArguments(operation);\n    const selectionSet = operationSelectionSet(modelIntrospection, operation);\n    const returnTypeModelName = hasStringField(operation.type, 'model')\n        ? operation.type.model\n        : undefined;\n    const query = `\n    ${operationType.toLocaleLowerCase()}${outerArgsString} {\n      ${operationName}${innerArgsString} ${selectionSet}\n    }\n  `;\n    const variables = operationVariables(operation, args);\n    const userAgentOverride = createUserAgentOverride(customUserAgentDetails);\n    const observable = client.graphql({\n        ...auth,\n        query,\n        variables,\n        ...userAgentOverride,\n    }, headers);\n    return observable.pipe(map((value) => {\n        const [key] = Object.keys(value.data);\n        const data = value.data[key];\n        const [initialized] = returnTypeModelName\n            ? initializeModel(client, returnTypeModelName, [data], modelIntrospection, auth.authMode, auth.authToken)\n            : [data];\n        return initialized;\n    }));\n}\n"],"names":[],"mappings":";;;;;;;AAMA;AACA;AACA;AACA,MAAM,gBAAgB,GAAG,CAAC,GAAG,KAAK;AAClC,IAAI,O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