@aws-amplify/data-schema 1.10.2 → 1.12.0

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.
Files changed (28) hide show
  1. package/dist/cjs/SchemaProcessor.js +40 -5
  2. package/dist/cjs/SchemaProcessor.js.map +1 -1
  3. package/dist/cjs/runtime/internals/ai/createUpdateConversationFunction.js +21 -0
  4. package/dist/cjs/runtime/internals/ai/createUpdateConversationFunction.js.map +1 -0
  5. package/dist/cjs/runtime/internals/ai/getCustomUserAgentDetails.js +1 -0
  6. package/dist/cjs/runtime/internals/ai/getCustomUserAgentDetails.js.map +1 -1
  7. package/dist/cjs/runtime/internals/utils/clientProperties/generateConversationsProperty.js +2 -0
  8. package/dist/cjs/runtime/internals/utils/clientProperties/generateConversationsProperty.js.map +1 -1
  9. package/dist/esm/ModelType.d.ts +3 -3
  10. package/dist/esm/SchemaProcessor.mjs +40 -5
  11. package/dist/esm/SchemaProcessor.mjs.map +1 -1
  12. package/dist/esm/ai/ConversationType.d.ts +16 -1
  13. package/dist/esm/runtime/internals/ai/createUpdateConversationFunction.d.ts +3 -0
  14. package/dist/esm/runtime/internals/ai/createUpdateConversationFunction.mjs +19 -0
  15. package/dist/esm/runtime/internals/ai/createUpdateConversationFunction.mjs.map +1 -0
  16. package/dist/esm/runtime/internals/ai/getCustomUserAgentDetails.d.ts +2 -1
  17. package/dist/esm/runtime/internals/ai/getCustomUserAgentDetails.mjs +1 -0
  18. package/dist/esm/runtime/internals/ai/getCustomUserAgentDetails.mjs.map +1 -1
  19. package/dist/esm/runtime/internals/utils/clientProperties/generateConversationsProperty.mjs +2 -0
  20. package/dist/esm/runtime/internals/utils/clientProperties/generateConversationsProperty.mjs.map +1 -1
  21. package/dist/meta/cjs.tsbuildinfo +1 -1
  22. package/package.json +1 -1
  23. package/src/ModelType.ts +2 -7
  24. package/src/SchemaProcessor.ts +55 -1
  25. package/src/ai/ConversationType.ts +25 -2
  26. package/src/runtime/internals/ai/createUpdateConversationFunction.ts +58 -0
  27. package/src/runtime/internals/ai/getCustomUserAgentDetails.ts +1 -0
  28. package/src/runtime/internals/utils/clientProperties/generateConversationsProperty.ts +9 -0
@@ -20,6 +20,15 @@ interface ConversationRouteGetInput {
20
20
  interface ConversationRouteDeleteInput {
21
21
  id: string;
22
22
  }
23
+ interface ConversationRouteCreateInput {
24
+ metadata?: Record<string, any>;
25
+ name?: string;
26
+ }
27
+ interface ConversationRouteUpdateInput {
28
+ id: string;
29
+ metadata?: Record<string, any>;
30
+ name?: string;
31
+ }
23
32
  interface ConversationRouteListInput {
24
33
  limit?: number;
25
34
  nextToken?: string | null;
@@ -30,7 +39,13 @@ export interface ConversationRoute {
30
39
  *
31
40
  * Creates a {@link Conversation} from the current conversation route.
32
41
  */
33
- create: () => SingularReturnValue<Conversation>;
42
+ create: (input?: ConversationRouteCreateInput) => SingularReturnValue<Conversation>;
43
+ /**
44
+ * @experimental
45
+ *
46
+ * Creates a {@link Conversation} from the current conversation route.
47
+ */
48
+ update: (input: ConversationRouteUpdateInput) => SingularReturnValue<Conversation>;
34
49
  /**
35
50
  * @experimental
36
51
  *
@@ -0,0 +1,3 @@
1
+ import type { ConversationRoute } from '../../../ai/ConversationType';
2
+ import { BaseClient, ClientInternalsGetter, ModelIntrospectionSchema, SchemaModel } from '../../bridge-types';
3
+ export declare const createUpdateConversationFunction: (client: BaseClient, modelIntrospection: ModelIntrospectionSchema, conversationRouteName: string, conversationModel: SchemaModel, conversationMessageModel: SchemaModel, getInternals: ClientInternalsGetter) => ConversationRoute['update'];
@@ -0,0 +1,19 @@
1
+ import { getFactory } from '../operations/get.mjs';
2
+ import { convertItemToConversation } from './convertItemToConversation.mjs';
3
+ import { getCustomUserAgentDetails, AiAction } from './getCustomUserAgentDetails.mjs';
4
+
5
+ // Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
6
+ // SPDX-License-Identifier: Apache-2.0
7
+ const createUpdateConversationFunction = (client, modelIntrospection, conversationRouteName, conversationModel, conversationMessageModel, getInternals) => async ({ id, metadata, name }) => {
8
+ const updateOperation = getFactory(client, modelIntrospection, conversationModel, 'UPDATE', getInternals, false, getCustomUserAgentDetails(AiAction.UpdateConversation));
9
+ const { data, errors } = await updateOperation({ id, metadata, name });
10
+ return {
11
+ data: data
12
+ ? convertItemToConversation(client, modelIntrospection, data?.id, data?.createdAt, data?.updatedAt, conversationRouteName, conversationMessageModel, getInternals, data?.metadata, data?.name)
13
+ : data,
14
+ errors,
15
+ };
16
+ };
17
+
18
+ export { createUpdateConversationFunction };
19
+ //# sourceMappingURL=createUpdateConversationFunction.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"createUpdateConversationFunction.mjs","sources":["../../../../../src/runtime/internals/ai/createUpdateConversationFunction.ts"],"sourcesContent":["// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\nimport { getFactory } from '../operations/get';\nimport { convertItemToConversation } from './convertItemToConversation';\nimport { AiAction, getCustomUserAgentDetails, } from './getCustomUserAgentDetails';\nexport const createUpdateConversationFunction = (client, modelIntrospection, conversationRouteName, conversationModel, conversationMessageModel, getInternals) => async ({ id, metadata, name }) => {\n const updateOperation = getFactory(client, modelIntrospection, conversationModel, 'UPDATE', getInternals, false, getCustomUserAgentDetails(AiAction.UpdateConversation));\n const { data, errors } = await updateOperation({ id, metadata, name });\n return {\n data: data\n ? convertItemToConversation(client, modelIntrospection, data?.id, data?.createdAt, data?.updatedAt, conversationRouteName, conversationMessageModel, getInternals, data?.metadata, data?.name)\n : data,\n errors,\n };\n};\n"],"names":[],"mappings":";;;;AAAA;AACA;AAIY,MAAC,gCAAgC,GAAG,CAAC,MAAM,EAAE,kBAAkB,EAAE,qBAAqB,EAAE,iBAAiB,EAAE,wBAAwB,EAAE,YAAY,KAAK,OAAO,EAAE,EAAE,EAAE,QAAQ,EAAE,IAAI,EAAE,KAAK;AACpM,IAAI,MAAM,eAAe,GAAG,UAAU,CAAC,MAAM,EAAE,kBAAkB,EAAE,iBAAiB,EAAE,QAAQ,EAAE,YAAY,EAAE,KAAK,EAAE,yBAAyB,CAAC,QAAQ,CAAC,kBAAkB,CAAC,CAAC,CAAC;AAC7K,IAAI,MAAM,EAAE,IAAI,EAAE,MAAM,EAAE,GAAG,MAAM,eAAe,CAAC,EAAE,EAAE,EAAE,QAAQ,EAAE,IAAI,EAAE,CAAC,CAAC;AAC3E,IAAI,OAAO;AACX,QAAQ,IAAI,EAAE,IAAI;AAClB,cAAc,yBAAyB,CAAC,MAAM,EAAE,kBAAkB,EAAE,IAAI,EAAE,EAAE,EAAE,IAAI,EAAE,SAAS,EAAE,IAAI,EAAE,SAAS,EAAE,qBAAqB,EAAE,wBAAwB,EAAE,YAAY,EAAE,IAAI,EAAE,QAAQ,EAAE,IAAI,EAAE,IAAI,CAAC;AAC1M,cAAc,IAAI;AAClB,QAAQ,MAAM;AACd,KAAK,CAAC;AACN;;;;"}
@@ -17,7 +17,8 @@ export declare enum AiAction {
17
17
  SendMessage = "5",
18
18
  ListMessages = "6",
19
19
  OnMessage = "7",
20
- Generation = "8"
20
+ Generation = "8",
21
+ UpdateConversation = "9"
21
22
  }
22
23
  export declare const getCustomUserAgentDetails: (action: AiAction) => CustomUserAgentDetails;
23
24
  /**
@@ -19,6 +19,7 @@ var AiAction;
19
19
  AiAction["ListMessages"] = "6";
20
20
  AiAction["OnMessage"] = "7";
21
21
  AiAction["Generation"] = "8";
22
+ AiAction["UpdateConversation"] = "9";
22
23
  })(AiAction || (AiAction = {}));
23
24
  const getCustomUserAgentDetails = (action) => ({
24
25
  category: 'ai',
@@ -1 +1 @@
1
- {"version":3,"file":"getCustomUserAgentDetails.mjs","sources":["../../../../../src/runtime/internals/ai/getCustomUserAgentDetails.ts"],"sourcesContent":["// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\n/**\n * Symbol used for internal user agent overrides.\n *\n * @internal\n * This symbol is intended for internal use within the Amplify library.\n * It may change or be removed in future versions without notice.\n * External usage of this symbol is discouraged and may lead to unexpected behavior.\n */\nexport const INTERNAL_USER_AGENT_OVERRIDE = Symbol('INTERNAL_USER_AGENT_OVERRIDE');\nexport var AiAction;\n(function (AiAction) {\n AiAction[\"CreateConversation\"] = \"1\";\n AiAction[\"GetConversation\"] = \"2\";\n AiAction[\"ListConversations\"] = \"3\";\n AiAction[\"DeleteConversation\"] = \"4\";\n AiAction[\"SendMessage\"] = \"5\";\n AiAction[\"ListMessages\"] = \"6\";\n AiAction[\"OnMessage\"] = \"7\";\n AiAction[\"Generation\"] = \"8\";\n})(AiAction || (AiAction = {}));\nexport const getCustomUserAgentDetails = (action) => ({\n category: 'ai',\n action,\n});\n/**\n * Creates a user agent override object based on custom details.\n *\n * @internal\n * This function is intended for internal use within the Amplify library.\n * It may change or be removed in future versions without notice.\n *\n * @param customUserAgentDetails - Optional custom user agent details\n * @returns An object with INTERNAL_USER_AGENT_OVERRIDE symbol as key and customUserAgentDetails as value, or undefined if no details provided\n */\nexport function createUserAgentOverride(customUserAgentDetails) {\n return customUserAgentDetails\n ? { [INTERNAL_USER_AGENT_OVERRIDE]: customUserAgentDetails }\n : undefined;\n}\n"],"names":[],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACY,MAAC,4BAA4B,GAAG,MAAM,CAAC,8BAA8B,EAAE;AACzE,IAAC,SAAS;AACpB,CAAC,UAAU,QAAQ,EAAE;AACrB,IAAI,QAAQ,CAAC,oBAAoB,CAAC,GAAG,GAAG,CAAC;AACzC,IAAI,QAAQ,CAAC,iBAAiB,CAAC,GAAG,GAAG,CAAC;AACtC,IAAI,QAAQ,CAAC,mBAAmB,CAAC,GAAG,GAAG,CAAC;AACxC,IAAI,QAAQ,CAAC,oBAAoB,CAAC,GAAG,GAAG,CAAC;AACzC,IAAI,QAAQ,CAAC,aAAa,CAAC,GAAG,GAAG,CAAC;AAClC,IAAI,QAAQ,CAAC,cAAc,CAAC,GAAG,GAAG,CAAC;AACnC,IAAI,QAAQ,CAAC,WAAW,CAAC,GAAG,GAAG,CAAC;AAChC,IAAI,QAAQ,CAAC,YAAY,CAAC,GAAG,GAAG,CAAC;AACjC,CAAC,EAAE,QAAQ,KAAK,QAAQ,GAAG,EAAE,CAAC,CAAC,CAAC;AACpB,MAAC,yBAAyB,GAAG,CAAC,MAAM,MAAM;AACtD,IAAI,QAAQ,EAAE,IAAI;AAClB,IAAI,MAAM;AACV,CAAC,EAAE;AACH;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACO,SAAS,uBAAuB,CAAC,sBAAsB,EAAE;AAChE,IAAI,OAAO,sBAAsB;AACjC,UAAU,EAAE,CAAC,4BAA4B,GAAG,sBAAsB,EAAE;AACpE,UAAU,SAAS,CAAC;AACpB;;;;"}
1
+ {"version":3,"file":"getCustomUserAgentDetails.mjs","sources":["../../../../../src/runtime/internals/ai/getCustomUserAgentDetails.ts"],"sourcesContent":["// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\n/**\n * Symbol used for internal user agent overrides.\n *\n * @internal\n * This symbol is intended for internal use within the Amplify library.\n * It may change or be removed in future versions without notice.\n * External usage of this symbol is discouraged and may lead to unexpected behavior.\n */\nexport const INTERNAL_USER_AGENT_OVERRIDE = Symbol('INTERNAL_USER_AGENT_OVERRIDE');\nexport var AiAction;\n(function (AiAction) {\n AiAction[\"CreateConversation\"] = \"1\";\n AiAction[\"GetConversation\"] = \"2\";\n AiAction[\"ListConversations\"] = \"3\";\n AiAction[\"DeleteConversation\"] = \"4\";\n AiAction[\"SendMessage\"] = \"5\";\n AiAction[\"ListMessages\"] = \"6\";\n AiAction[\"OnMessage\"] = \"7\";\n AiAction[\"Generation\"] = \"8\";\n AiAction[\"UpdateConversation\"] = \"9\";\n})(AiAction || (AiAction = {}));\nexport const getCustomUserAgentDetails = (action) => ({\n category: 'ai',\n action,\n});\n/**\n * Creates a user agent override object based on custom details.\n *\n * @internal\n * This function is intended for internal use within the Amplify library.\n * It may change or be removed in future versions without notice.\n *\n * @param customUserAgentDetails - Optional custom user agent details\n * @returns An object with INTERNAL_USER_AGENT_OVERRIDE symbol as key and customUserAgentDetails as value, or undefined if no details provided\n */\nexport function createUserAgentOverride(customUserAgentDetails) {\n return customUserAgentDetails\n ? { [INTERNAL_USER_AGENT_OVERRIDE]: customUserAgentDetails }\n : undefined;\n}\n"],"names":[],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACY,MAAC,4BAA4B,GAAG,MAAM,CAAC,8BAA8B,EAAE;AACzE,IAAC,SAAS;AACpB,CAAC,UAAU,QAAQ,EAAE;AACrB,IAAI,QAAQ,CAAC,oBAAoB,CAAC,GAAG,GAAG,CAAC;AACzC,IAAI,QAAQ,CAAC,iBAAiB,CAAC,GAAG,GAAG,CAAC;AACtC,IAAI,QAAQ,CAAC,mBAAmB,CAAC,GAAG,GAAG,CAAC;AACxC,IAAI,QAAQ,CAAC,oBAAoB,CAAC,GAAG,GAAG,CAAC;AACzC,IAAI,QAAQ,CAAC,aAAa,CAAC,GAAG,GAAG,CAAC;AAClC,IAAI,QAAQ,CAAC,cAAc,CAAC,GAAG,GAAG,CAAC;AACnC,IAAI,QAAQ,CAAC,WAAW,CAAC,GAAG,GAAG,CAAC;AAChC,IAAI,QAAQ,CAAC,YAAY,CAAC,GAAG,GAAG,CAAC;AACjC,IAAI,QAAQ,CAAC,oBAAoB,CAAC,GAAG,GAAG,CAAC;AACzC,CAAC,EAAE,QAAQ,KAAK,QAAQ,GAAG,EAAE,CAAC,CAAC,CAAC;AACpB,MAAC,yBAAyB,GAAG,CAAC,MAAM,MAAM;AACtD,IAAI,QAAQ,EAAE,IAAI;AAClB,IAAI,MAAM;AACV,CAAC,EAAE;AACH;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACO,SAAS,uBAAuB,CAAC,sBAAsB,EAAE;AAChE,IAAI,OAAO,sBAAsB;AACjC,UAAU,EAAE,CAAC,4BAA4B,GAAG,sBAAsB,EAAE;AACpE,UAAU,SAAS,CAAC;AACpB;;;;"}
@@ -2,6 +2,7 @@ import { createCreateConversationFunction } from '../../ai/createCreateConversat
2
2
  import { createGetConversationFunction } from '../../ai/createGetConversationFunction.mjs';
3
3
  import { createListConversationsFunction } from '../../ai/createListConversationsFunction.mjs';
4
4
  import { createDeleteConversationFunction } from '../../ai/createDeleteConversationFunction.mjs';
5
+ import { createUpdateConversationFunction } from '../../ai/createUpdateConversationFunction.mjs';
5
6
 
6
7
  // Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
7
8
  // SPDX-License-Identifier: Apache-2.0
@@ -35,6 +36,7 @@ function generateConversationsProperty(client, apiGraphQLConfig, getInternals) {
35
36
  },
36
37
  };
37
38
  conversations[name] = {
39
+ update: createUpdateConversationFunction(client, conversationModelIntrospection, name, conversationModel, conversationMessageModel, getInternals),
38
40
  create: createCreateConversationFunction(client, conversationModelIntrospection, name, conversationModel, conversationMessageModel, getInternals),
39
41
  get: createGetConversationFunction(client, conversationModelIntrospection, name, conversationModel, conversationMessageModel, getInternals),
40
42
  delete: createDeleteConversationFunction(client, conversationModelIntrospection, name, conversationModel, conversationMessageModel, getInternals),
@@ -1 +1 @@
1
- {"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';\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 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;AAKO,SAAS,6BAA6B,CAAC,MAAM,EAAE,gBAAgB,EAAE,YAAY,EAAE;AACtF,IAAI,MAAM,kBAAkB,GAAG,gBAAgB,EAAE,kBAAkB,CAAC;AACpE;AACA;AACA,IAAI,IAAI,CAAC,kBAAkB,EAAE,aAAa,EAAE;AAC5C,QAAQ,OAAO,EAAE,CAAC;AAClB,KAAK;AACL,IAAI,MAAM,aAAa,GAAG,EAAE,CAAC;AAC7B,IAAI,KAAK,MAAM,EAAE,IAAI,EAAE,YAAY,EAAE,OAAO,EAAE,MAAM,EAAE,SAAS,EAAE,KAAK,GAAG,IAAI,MAAM,CAAC,MAAM,CAAC,kBAAkB,CAAC,aAAa,CAAC,EAAE;AAC9H,QAAQ,MAAM,iBAAiB,GAAG,MAAM,CAAC,YAAY,CAAC,SAAS,CAAC,CAAC;AACjE,QAAQ,MAAM,wBAAwB,GAAG,MAAM,CAAC,OAAO,CAAC,SAAS,CAAC,CAAC;AACnE,QAAQ,IAAI,CAAC,iBAAiB,IAAI,CAAC,wBAAwB,EAAE;AAC7D,YAAY,OAAO,EAAE,CAAC;AACtB,SAAS;AACT,QAAQ,MAAM,8BAA8B,GAAG;AAC/C,YAAY,GAAG,kBAAkB;AACjC,YAAY,MAAM,EAAE;AACpB,gBAAgB,GAAG,kBAAkB,CAAC,MAAM;AAC5C,gBAAgB,GAAG,MAAM;AACzB,aAAa;AACb,YAAY,SAAS,EAAE;AACvB,gBAAgB,GAAG,kBAAkB,CAAC,SAAS;AAC/C,gBAAgB,GAAG,SAAS;AAC5B,aAAa;AACb,YAAY,KAAK,EAAE;AACnB,gBAAgB,GAAG,kBAAkB,CAAC,KAAK;AAC3C,gBAAgB,GAAG,KAAK;AACxB,aAAa;AACb,SAAS,CAAC;AACV,QAAQ,aAAa,CAAC,IAAI,CAAC,GAAG;AAC9B,YAAY,MAAM,EAAE,gCAAgC,CAAC,MAAM,EAAE,8BAA8B,EAAE,IAAI,EAAE,iBAAiB,EAAE,wBAAwB,EAAE,YAAY,CAAC;AAC7J,YAAY,GAAG,EAAE,6BAA6B,CAAC,MAAM,EAAE,8BAA8B,EAAE,IAAI,EAAE,iBAAiB,EAAE,wBAAwB,EAAE,YAAY,CAAC;AACvJ,YAAY,MAAM,EAAE,gCAAgC,CAAC,MAAM,EAAE,8BAA8B,EAAE,IAAI,EAAE,iBAAiB,EAAE,wBAAwB,EAAE,YAAY,CAAC;AAC7J,YAAY,IAAI,EAAE,+BAA+B,CAAC,MAAM,EAAE,8BAA8B,EAAE,IAAI,EAAE,iBAAiB,EAAE,wBAAwB,EAAE,YAAY,CAAC;AAC1J,SAAS,CAAC;AACV,KAAK;AACL,IAAI,OAAO,aAAa,CAAC;AACzB;;;;"}
1
+ {"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,SAAS,6BAA6B,CAAC,MAAM,EAAE,gBAAgB,EAAE,YAAY,EAAE;AACtF,IAAI,MAAM,kBAAkB,GAAG,gBAAgB,EAAE,kBAAkB,CAAC;AACpE;AACA;AACA,IAAI,IAAI,CAAC,kBAAkB,EAAE,aAAa,EAA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