{"version":3,"file":"generateConversationsProperty.mjs","sources":["../../../../../../src/runtime/internals/utils/clientProperties/generateConversationsProperty.ts"],"sourcesContent":["// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\nimport { createCreateConversationFunction } from '../../ai/createCreateConversationFunction';\nimport { createGetConversationFunction } from '../../ai/createGetConversationFunction';\nimport { createListConversationsFunction } from '../../ai/createListConversationsFunction';\nimport { createDeleteConversationFunction } from '../../ai/createDeleteConversationFunction';\nimport { createUpdateConversationFunction } from '../../ai/createUpdateConversationFunction';\nexport function generateConversationsProperty(client, apiGraphQLConfig, getInternals) {\n    const modelIntrospection = apiGraphQLConfig?.modelIntrospection;\n    // conversations will be absent from model intro schema if no conversation routes\n    // are present on the source schema.\n    if (!modelIntrospection?.conversations) {\n        return {};\n    }\n    const conversations = {};\n    for (const { name, conversation, message, models, nonModels, enums, } of Object.values(modelIntrospection.conversations)) {\n        const conversationModel = models[conversation.modelName];\n        const conversationMessageModel = models[message.modelName];\n        if (!conversationModel || !conversationMessageModel) {\n            return {};\n        }\n        const conversationModelIntrospection = {\n            ...modelIntrospection,\n            models: {\n                ...modelIntrospection.models,\n                ...models,\n            },\n            nonModels: {\n                ...modelIntrospection.nonModels,\n                ...nonModels,\n            },\n            enums: {\n                ...modelIntrospection.enums,\n                ...enums,\n            },\n        };\n        conversations[name] = {\n            update: createUpdateConversationFunction(client, conversationModelIntrospection, name, conversationModel, conversationMessageModel, getInternals),\n            create: createCreateConversationFunction(client, conversationModelIntrospection, name, conversationModel, conversationMessageModel, getInternals),\n            get: createGetConversationFunction(client, conversationModelIntrospection, name, conversationModel, conversationMessageModel, getInternals),\n            delete: createDeleteConversationFunction(client, conversationModelIntrospection, name, conversationModel, conversationMessageModel, getInternals),\n            list: createListConversationsFunction(client, conversationModelIntrospection, name, conversationModel, conversationMessageModel, getInternals),\n        };\n    }\n    return conversations;\n}\n"],"names":[],"mappings":";;;;;;AAAA;AACA;AAMO,SA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