{"version":3,"file":"generateCustomOperationsProperty.mjs","sources":["../../../../src/runtime/internals/generateCustomOperationsProperty.ts"],"sourcesContent":["import { customOpFactory } from './operations/custom';\nconst operationTypeMap = {\n    queries: 'query',\n    mutations: 'mutation',\n    subscriptions: 'subscription',\n};\nexport function generateCustomOperationsProperty(client, config, operationsType, getInternals) {\n    // some bundlers end up with `Amplify.configure` being called *after* generate client.\n    // if that occurs, we need to *not error* while we wait. handling for late configuration\n    // occurs in `generateClient()`. we do not need to subscribe to Hub events here.\n    if (!config) {\n        return {};\n    }\n    const modelIntrospection = config.modelIntrospection;\n    // model intro schema might be absent if there's not actually a configured GraphQL API\n    if (!modelIntrospection) {\n        return {};\n    }\n    // custom operations will be absent from model intro schema if no custom ops\n    // are present on the source schema.\n    const operations = modelIntrospection[operationsType];\n    if (!operations) {\n        return {};\n    }\n    const ops = {};\n    const useContext = getInternals(client).amplify === null;\n    for (const operation of Object.values(operations)) {\n        ops[operation.name] = customOpFactory(client, modelIntrospection, operationTypeMap[operationsType], operation, useContext, getInternals);\n    }\n    return ops;\n}\nexport function generateCustomMutationsProperty(client, config, getInternals) {\n    return generateCustomOperationsProperty(client, config, 'mutations', getInternals);\n}\nexport function generateCustomQueriesProperty(client, config, getInternals) {\n    return generateCustomOperationsProperty(client, config, 'queries', getInternals);\n}\nexport function generateCustomSubscriptionsProperty(client, config, getInternals) {\n    return generateCustomOperationsProperty(client, config, 'subscriptions', getInternals);\n}\n"],"names":[],"mappings":";;AACA,MAAM,gBAAgB,GAAG;AACzB,IAAI,OAAO,EAAE,OAAO;AACpB,IAAI,SAAS,EAAE,UAAU;AACzB,IAAI,aAAa,EAAE,cAAc;AACjC,CAAC;AACM,SAAS,gCAAgC,CAAC,MAAM,EAAE,MAAM,EAAE,cAAc,EAAE,YAAY,EAAE;AAC/F;AACA;AACA;AACA,IAAI,IAAI,CAAC,MAAM,EAAE;AACjB,QAAQ,OAAO,EAAE;AACjB,IAAI;AACJ,IAAI,MAAM,kBAAkB,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