@aws-amplify/data-schema 1.6.3 → 1.8.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.
- package/dist/cjs/runtime/internals/ai/createDeleteConversationFunction.js +21 -0
- package/dist/cjs/runtime/internals/ai/createDeleteConversationFunction.js.map +1 -0
- package/dist/cjs/runtime/internals/ai/createSendMessageFunction.js +3 -1
- package/dist/cjs/runtime/internals/ai/createSendMessageFunction.js.map +1 -1
- package/dist/cjs/runtime/internals/ai/getCustomUserAgentDetails.js +5 -5
- package/dist/cjs/runtime/internals/ai/getCustomUserAgentDetails.js.map +1 -1
- package/dist/cjs/runtime/internals/utils/clientProperties/generateConversationsProperty.js +2 -0
- package/dist/cjs/runtime/internals/utils/clientProperties/generateConversationsProperty.js.map +1 -1
- package/dist/esm/ai/ConversationType.d.ts +11 -2
- package/dist/esm/runtime/internals/ai/createDeleteConversationFunction.d.ts +3 -0
- package/dist/esm/runtime/internals/ai/createDeleteConversationFunction.mjs +19 -0
- package/dist/esm/runtime/internals/ai/createDeleteConversationFunction.mjs.map +1 -0
- package/dist/esm/runtime/internals/ai/createSendMessageFunction.mjs +3 -1
- package/dist/esm/runtime/internals/ai/createSendMessageFunction.mjs.map +1 -1
- package/dist/esm/runtime/internals/ai/getCustomUserAgentDetails.d.ts +5 -5
- package/dist/esm/runtime/internals/ai/getCustomUserAgentDetails.mjs +5 -5
- package/dist/esm/runtime/internals/ai/getCustomUserAgentDetails.mjs.map +1 -1
- package/dist/esm/runtime/internals/utils/clientProperties/generateConversationsProperty.mjs +2 -0
- package/dist/esm/runtime/internals/utils/clientProperties/generateConversationsProperty.mjs.map +1 -1
- package/dist/meta/cjs.tsbuildinfo +1 -1
- package/package.json +1 -1
- package/src/ai/ConversationType.ts +14 -2
- package/src/runtime/internals/ai/createDeleteConversationFunction.ts +54 -0
- package/src/runtime/internals/ai/createSendMessageFunction.ts +8 -1
- package/src/runtime/internals/ai/getCustomUserAgentDetails.ts +5 -5
- package/src/runtime/internals/utils/clientProperties/generateConversationsProperty.ts +9 -0
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
|
|
4
|
+
// SPDX-License-Identifier: Apache-2.0
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
exports.createDeleteConversationFunction = void 0;
|
|
7
|
+
const get_1 = require("../operations/get");
|
|
8
|
+
const convertItemToConversation_1 = require("./convertItemToConversation");
|
|
9
|
+
const getCustomUserAgentDetails_1 = require("./getCustomUserAgentDetails");
|
|
10
|
+
const createDeleteConversationFunction = (client, modelIntrospection, conversationRouteName, conversationModel, conversationMessageModel, getInternals) => async ({ id }) => {
|
|
11
|
+
const deleteOperation = (0, get_1.getFactory)(client, modelIntrospection, conversationModel, 'DELETE', getInternals, false, (0, getCustomUserAgentDetails_1.getCustomUserAgentDetails)(getCustomUserAgentDetails_1.AiAction.DeleteConversation));
|
|
12
|
+
const { data, errors } = await deleteOperation({ id });
|
|
13
|
+
return {
|
|
14
|
+
data: data
|
|
15
|
+
? (0, convertItemToConversation_1.convertItemToConversation)(client, modelIntrospection, data?.id, conversationRouteName, conversationMessageModel, getInternals)
|
|
16
|
+
: data,
|
|
17
|
+
errors,
|
|
18
|
+
};
|
|
19
|
+
};
|
|
20
|
+
exports.createDeleteConversationFunction = createDeleteConversationFunction;
|
|
21
|
+
//# sourceMappingURL=createDeleteConversationFunction.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"createDeleteConversationFunction.js","sources":["../../../../../src/runtime/internals/ai/createDeleteConversationFunction.ts"],"sourcesContent":["\"use strict\";\n// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\nObject.defineProperty(exports, \"__esModule\", { value: true });\nexports.createDeleteConversationFunction = void 0;\nconst get_1 = require(\"../operations/get\");\nconst convertItemToConversation_1 = require(\"./convertItemToConversation\");\nconst getCustomUserAgentDetails_1 = require(\"./getCustomUserAgentDetails\");\nconst createDeleteConversationFunction = (client, modelIntrospection, conversationRouteName, conversationModel, conversationMessageModel, getInternals) => async ({ id }) => {\n const deleteOperation = (0, get_1.getFactory)(client, modelIntrospection, conversationModel, 'DELETE', getInternals, false, (0, getCustomUserAgentDetails_1.getCustomUserAgentDetails)(getCustomUserAgentDetails_1.AiAction.DeleteConversation));\n const { data, errors } = await deleteOperation({ id });\n return {\n data: data\n ? (0, convertItemToConversation_1.convertItemToConversation)(client, modelIntrospection, data?.id, conversationRouteName, conversationMessageModel, getInternals)\n : data,\n errors,\n };\n};\nexports.createDeleteConversationFunction = createDeleteConversationFunction;\n"],"names":[],"mappings":";;AACA;AACA;AACA,MAAM,CAAC,cAAc,CAAC,OAAO,EAAE,YAAY,EAAE,EAAE,KAAK,EAAE,IAAI,EAAE,CAAC,CAAC;AAC9D,OAAO,CAAC,gCAAgC,GAAG,KAAK,CAAC,CAAC;AAClD,MAAM,KAAK,GAAG,OAAO,CAAC,mBAAmB,CAAC,CAAC;AAC3C,MAAM,2BAA2B,GAAG,OAAO,CAAC,6BAA6B,CAAC,CAAC;AAC3E,MAAM,2BAA2B,GAAG,OAAO,CAAC,6BAA6B,CAAC,CAAC;AAC3E,MAAM,gCAAgC,GAAG,CAAC,MAAM,EAAE,kBAAkB,EAAE,qBAAqB,EAAE,iBAAiB,EAAE,wBAAwB,EAAE,YAAY,KAAK,OAAO,EAAE,EAAE,EAAE,KAAK;AAC7K,IAAI,MAAM,eAAe,GAAG,IAAI,KAAK,CAAC,UAAU,EAAE,MAAM,EAAE,kBAAkB,EAAE,iBAAiB,EAAE,QAAQ,EAAE,YAAY,EAAE,KAAK,EAAE,IAAI,2BAA2B,CAAC,yBAAyB,EAAE,2BAA2B,CAAC,QAAQ,CAAC,kBAAkB,CAAC,CAAC,CAAC;AACrP,IAAI,MAAM,EAAE,IAAI,EAAE,MAAM,EAAE,GAAG,MAAM,eAAe,CAAC,EAAE,EAAE,EAAE,CAAC,CAAC;AAC3D,IAAI,OAAO;AACX,QAAQ,IAAI,EAAE,IAAI;AAClB,cAAc,IAAI,2BAA2B,CAAC,yBAAyB,EAAE,MAAM,EAAE,kBAAkB,EAAE,IAAI,EAAE,EAAE,EAAE,qBAAqB,EAAE,wBAAwB,EAAE,YAAY,CAAC;AAC7K,cAAc,IAAI;AAClB,QAAQ,MAAM;AACd,KAAK,CAAC;AACN,CAAC,CAAC;AACF,OAAO,CAAC,gCAAgC,GAAG,gCAAgC;;"}
|
|
@@ -8,12 +8,14 @@ const custom_1 = require("../operations/custom");
|
|
|
8
8
|
const convertItemToConversationMessage_1 = require("./convertItemToConversationMessage");
|
|
9
9
|
const conversationMessageSerializers_1 = require("./conversationMessageSerializers");
|
|
10
10
|
const getCustomUserAgentDetails_1 = require("./getCustomUserAgentDetails");
|
|
11
|
-
const createSendMessageFunction = (client, modelIntrospection, conversationId, conversationRouteName, getInternals) => async (
|
|
11
|
+
const createSendMessageFunction = (client, modelIntrospection, conversationId, conversationRouteName, getInternals) => async (input) => {
|
|
12
12
|
const { conversations } = modelIntrospection;
|
|
13
13
|
// Safe guard for standalone function. When called as part of client generation, this should never be falsy.
|
|
14
14
|
if (!conversations) {
|
|
15
15
|
return {};
|
|
16
16
|
}
|
|
17
|
+
const processedInput = typeof input === 'string' ? { content: [{ text: input }] } : input;
|
|
18
|
+
const { content, aiContext, toolConfiguration } = processedInput;
|
|
17
19
|
const sendSchema = conversations[conversationRouteName].message.send;
|
|
18
20
|
const sendOperation = (0, custom_1.customOpFactory)(client, modelIntrospection, 'mutation', sendSchema, false, getInternals, (0, getCustomUserAgentDetails_1.getCustomUserAgentDetails)(getCustomUserAgentDetails_1.AiAction.SendMessage));
|
|
19
21
|
const { data, errors } = await sendOperation({
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"createSendMessageFunction.js","sources":["../../../../../src/runtime/internals/ai/createSendMessageFunction.ts"],"sourcesContent":["\"use strict\";\n// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\nObject.defineProperty(exports, \"__esModule\", { value: true });\nexports.createSendMessageFunction = void 0;\nconst custom_1 = require(\"../operations/custom\");\nconst convertItemToConversationMessage_1 = require(\"./convertItemToConversationMessage\");\nconst conversationMessageSerializers_1 = require(\"./conversationMessageSerializers\");\nconst getCustomUserAgentDetails_1 = require(\"./getCustomUserAgentDetails\");\nconst createSendMessageFunction = (client, modelIntrospection, conversationId, conversationRouteName, getInternals) => async (
|
|
1
|
+
{"version":3,"file":"createSendMessageFunction.js","sources":["../../../../../src/runtime/internals/ai/createSendMessageFunction.ts"],"sourcesContent":["\"use strict\";\n// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\nObject.defineProperty(exports, \"__esModule\", { value: true });\nexports.createSendMessageFunction = void 0;\nconst custom_1 = require(\"../operations/custom\");\nconst convertItemToConversationMessage_1 = require(\"./convertItemToConversationMessage\");\nconst conversationMessageSerializers_1 = require(\"./conversationMessageSerializers\");\nconst getCustomUserAgentDetails_1 = require(\"./getCustomUserAgentDetails\");\nconst createSendMessageFunction = (client, modelIntrospection, conversationId, conversationRouteName, getInternals) => async (input) => {\n const { conversations } = modelIntrospection;\n // Safe guard for standalone function. When called as part of client generation, this should never be falsy.\n if (!conversations) {\n return {};\n }\n const processedInput = typeof input === 'string' ? { content: [{ text: input }] } : input;\n const { content, aiContext, toolConfiguration } = processedInput;\n const sendSchema = conversations[conversationRouteName].message.send;\n const sendOperation = (0, custom_1.customOpFactory)(client, modelIntrospection, 'mutation', sendSchema, false, getInternals, (0, getCustomUserAgentDetails_1.getCustomUserAgentDetails)(getCustomUserAgentDetails_1.AiAction.SendMessage));\n const { data, errors } = await sendOperation({\n conversationId,\n content: (0, conversationMessageSerializers_1.serializeContent)(content),\n ...(aiContext && { aiContext: (0, conversationMessageSerializers_1.serializeAiContext)(aiContext) }),\n ...(toolConfiguration && {\n toolConfiguration: (0, conversationMessageSerializers_1.serializeToolConfiguration)(toolConfiguration),\n }),\n });\n return {\n data: data ? (0, convertItemToConversationMessage_1.convertItemToConversationMessage)(data) : data,\n errors,\n };\n};\nexports.createSendMessageFunction = createSendMessageFunction;\n"],"names":[],"mappings":";;AACA;AACA;AACA,MAAM,CAAC,cAAc,CAAC,OAAO,EAAE,YAAY,EAAE,EAAE,KAAK,EAAE,IAAI,EAAE,CAAC,CAAC;AAC9D,OAAO,CAAC,yBAAyB,GAAG,KAAK,CAAC,CAAC;AAC3C,MAAM,QAAQ,GAAG,OAAO,CAAC,sBAAsB,CAAC,CAAC;AACjD,MAAM,kCAAkC,GAAG,OAAO,CAAC,oCAAoC,CAAC,CAAC;AACzF,MAAM,gCAAgC,GAAG,OAAO,CAAC,kCAAkC,CAAC,CAAC;AACrF,MAAM,2BAA2B,GAAG,OAAO,CAAC,6BAA6B,CAAC,CAAC;AAC3E,MAAM,yBAAyB,GAAG,CAAC,MAAM,EAAE,kBAAkB,EAAE,cAAc,EAAE,qBAAqB,EAAE,YAAY,KAAK,OAAO,KAAK,KAAK;AACxI,IAAI,MAAM,EAAE,aAAa,EAAE,GAAG,kBAAkB,CAAC;AACjD;AACA,IAAI,IAAI,CAAC,aAAa,EAAE;AACxB,QAAQ,OAAO,EAAE,CAAC;AAClB,KAAK;AACL,IAAI,MAAM,cAAc,GAAG,OAAO,KAAK,KAAK,QAAQ,GAAG,EAAE,OAAO,EAAE,CAAC,EAAE,IAAI,EAAE,KAAK,EAAE,CAAC,EAAE,GAAG,KAAK,CAAC;AAC9F,IAAI,MAAM,EAAE,OAAO,EAAE,SAAS,EAAE,iBAAiB,EAAE,GAAG,cAAc,CAAC;AACrE,IAAI,MAAM,UAAU,GAAG,aAAa,CAAC,qBAAqB,CAAC,CAAC,OAAO,CAAC,IAAI,CAAC;AACzE,IAAI,MAAM,aAAa,GAAG,IAAI,QAAQ,CAAC,eAAe,EAAE,MAAM,EAAE,kBAAkB,EAAE,UAAU,EAAE,UAAU,EAAE,KAAK,EAAE,YAAY,EAAE,IAAI,2BAA2B,CAAC,yBAAyB,EAAE,2BAA2B,CAAC,QAAQ,CAAC,WAAW,CAAC,CAAC,CAAC;AAC/O,IAAI,MAAM,EAAE,IAAI,EAAE,MAAM,EAAE,GAAG,MAAM,aAAa,CAAC;AACjD,QAAQ,cAAc;AACtB,QAAQ,OAAO,EAAE,IAAI,gCAAgC,CAAC,gBAAgB,EAAE,OAAO,CAAC;AAChF,QAAQ,IAAI,SAAS,IAAI,EAAE,SAAS,EAAE,IAAI,gCAAgC,CAAC,kBAAkB,EAAE,SAAS,CAAC,EAAE;AAC3G,QAAQ,IAAI,iBAAiB,IAAI;AACjC,YAAY,iBAAiB,EAAE,IAAI,gCAAgC,CAAC,0BAA0B,EAAE,iBAAiB,CAAC;AAClH,SAAS;AACT,KAAK,CAAC,CAAC;AACP,IAAI,OAAO;AACX,QAAQ,IAAI,EAAE,IAAI,GAAG,IAAI,kCAAkC,CAAC,gCAAgC,EAAE,IAAI,CAAC,GAAG,IAAI;AAC1G,QAAQ,MAAM;AACd,KAAK,CAAC;AACN,CAAC,CAAC;AACF,OAAO,CAAC,yBAAyB,GAAG,yBAAyB;;"}
|
|
@@ -18,11 +18,11 @@ var AiAction;
|
|
|
18
18
|
AiAction["CreateConversation"] = "1";
|
|
19
19
|
AiAction["GetConversation"] = "2";
|
|
20
20
|
AiAction["ListConversations"] = "3";
|
|
21
|
-
AiAction["
|
|
22
|
-
AiAction["
|
|
23
|
-
AiAction["
|
|
24
|
-
AiAction["
|
|
25
|
-
AiAction["
|
|
21
|
+
AiAction["DeleteConversation"] = "4";
|
|
22
|
+
AiAction["SendMessage"] = "5";
|
|
23
|
+
AiAction["ListMessages"] = "6";
|
|
24
|
+
AiAction["OnMessage"] = "7";
|
|
25
|
+
AiAction["Generation"] = "8";
|
|
26
26
|
})(AiAction || (exports.AiAction = AiAction = {}));
|
|
27
27
|
const getCustomUserAgentDetails = (action) => ({
|
|
28
28
|
category: 'ai',
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"getCustomUserAgentDetails.js","sources":["../../../../../src/runtime/internals/ai/getCustomUserAgentDetails.ts"],"sourcesContent":["\"use strict\";\n// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\nObject.defineProperty(exports, \"__esModule\", { value: true });\nexports.createUserAgentOverride = exports.getCustomUserAgentDetails = exports.AiAction = exports.INTERNAL_USER_AGENT_OVERRIDE = void 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 */\nexports.INTERNAL_USER_AGENT_OVERRIDE = Symbol('INTERNAL_USER_AGENT_OVERRIDE');\nvar AiAction;\n(function (AiAction) {\n AiAction[\"CreateConversation\"] = \"1\";\n AiAction[\"GetConversation\"] = \"2\";\n AiAction[\"ListConversations\"] = \"3\";\n AiAction[\"
|
|
1
|
+
{"version":3,"file":"getCustomUserAgentDetails.js","sources":["../../../../../src/runtime/internals/ai/getCustomUserAgentDetails.ts"],"sourcesContent":["\"use strict\";\n// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\nObject.defineProperty(exports, \"__esModule\", { value: true });\nexports.createUserAgentOverride = exports.getCustomUserAgentDetails = exports.AiAction = exports.INTERNAL_USER_AGENT_OVERRIDE = void 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 */\nexports.INTERNAL_USER_AGENT_OVERRIDE = Symbol('INTERNAL_USER_AGENT_OVERRIDE');\nvar 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 || (exports.AiAction = AiAction = {}));\nconst getCustomUserAgentDetails = (action) => ({\n category: 'ai',\n action,\n});\nexports.getCustomUserAgentDetails = getCustomUserAgentDetails;\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 */\nfunction createUserAgentOverride(customUserAgentDetails) {\n return customUserAgentDetails\n ? { [exports.INTERNAL_USER_AGENT_OVERRIDE]: customUserAgentDetails }\n : undefined;\n}\nexports.createUserAgentOverride = createUserAgentOverride;\n"],"names":[],"mappings":";;AACA;AACA;AACA,MAAM,CAAC,cAAc,CAAC,OAAO,EAAE,YAAY,EAAE,EAAE,KAAK,EAAE,IAAI,EAAE,CAAC,CAAC;AAC9D,OAAO,CAAC,uBAAuB,GAAG,OAAO,CAAC,yBAAyB,GAAG,OAAO,CAAC,QAAQ,GAAG,OAAO,CAAC,4BAA4B,GAAG,KAAK,CAAC,CAAC;AACvI;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO,CAAC,4BAA4B,GAAG,MAAM,CAAC,8BAA8B,CAAC,CAAC;AAC9E,IAAI,QAAQ,CAAC;AACb,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,OAAO,CAAC,QAAQ,GAAG,QAAQ,GAAG,EAAE,CAAC,CAAC,CAAC;AACnD,MAAM,yBAAyB,GAAG,CAAC,MAAM,MAAM;AAC/C,IAAI,QAAQ,EAAE,IAAI;AAClB,IAAI,MAAM;AACV,CAAC,CAAC,CAAC;AACH,OAAO,CAAC,yBAAyB,GAAG,yBAAyB,CAAC;AAC9D;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAAS,uBAAuB,CAAC,sBAAsB,EAAE;AACzD,IAAI,OAAO,sBAAsB;AACjC,UAAU,EAAE,CAAC,OAAO,CAAC,4BAA4B,GAAG,sBAAsB,EAAE;AAC5E,UAAU,SAAS,CAAC;AACpB,CAAC;AACD,OAAO,CAAC,uBAAuB,GAAG,uBAAuB;;"}
|
|
@@ -7,6 +7,7 @@ exports.generateConversationsProperty = void 0;
|
|
|
7
7
|
const createCreateConversationFunction_1 = require("../../ai/createCreateConversationFunction");
|
|
8
8
|
const createGetConversationFunction_1 = require("../../ai/createGetConversationFunction");
|
|
9
9
|
const createListConversationsFunction_1 = require("../../ai/createListConversationsFunction");
|
|
10
|
+
const createDeleteConversationFunction_1 = require("../../ai/createDeleteConversationFunction");
|
|
10
11
|
function generateConversationsProperty(client, apiGraphQLConfig, getInternals) {
|
|
11
12
|
const modelIntrospection = apiGraphQLConfig?.modelIntrospection;
|
|
12
13
|
// conversations will be absent from model intro schema if no conversation routes
|
|
@@ -39,6 +40,7 @@ function generateConversationsProperty(client, apiGraphQLConfig, getInternals) {
|
|
|
39
40
|
conversations[name] = {
|
|
40
41
|
create: (0, createCreateConversationFunction_1.createCreateConversationFunction)(client, conversationModelIntrospection, name, conversationModel, conversationMessageModel, getInternals),
|
|
41
42
|
get: (0, createGetConversationFunction_1.createGetConversationFunction)(client, conversationModelIntrospection, name, conversationModel, conversationMessageModel, getInternals),
|
|
43
|
+
delete: (0, createDeleteConversationFunction_1.createDeleteConversationFunction)(client, conversationModelIntrospection, name, conversationModel, conversationMessageModel, getInternals),
|
|
42
44
|
list: (0, createListConversationsFunction_1.createListConversationsFunction)(client, conversationModelIntrospection, name, conversationModel, conversationMessageModel, getInternals),
|
|
43
45
|
};
|
|
44
46
|
}
|
package/dist/cjs/runtime/internals/utils/clientProperties/generateConversationsProperty.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"generateConversationsProperty.js","sources":["../../../../../../src/runtime/internals/utils/clientProperties/generateConversationsProperty.ts"],"sourcesContent":["\"use strict\";\n// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\nObject.defineProperty(exports, \"__esModule\", { value: true });\nexports.generateConversationsProperty = void 0;\nconst createCreateConversationFunction_1 = require(\"../../ai/createCreateConversationFunction\");\nconst createGetConversationFunction_1 = require(\"../../ai/createGetConversationFunction\");\nconst createListConversationsFunction_1 = require(\"../../ai/createListConversationsFunction\");\nfunction 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: (0, createCreateConversationFunction_1.createCreateConversationFunction)(client, conversationModelIntrospection, name, conversationModel, conversationMessageModel, getInternals),\n get: (0, createGetConversationFunction_1.createGetConversationFunction)(client, conversationModelIntrospection, name, conversationModel, conversationMessageModel, getInternals),\n list: (0, createListConversationsFunction_1.createListConversationsFunction)(client, conversationModelIntrospection, name, conversationModel, conversationMessageModel, getInternals),\n };\n }\n return conversations;\n}\nexports.generateConversationsProperty = generateConversationsProperty;\n"],"names":[],"mappings":";;AACA;AACA;AACA,MAAM,CAAC,cAAc,CAAC,OAAO,EAAE,YAAY,EAAE,EAAE,KAAK,EAAE,IAAI,EAAE,CAAC,CAAC;AAC9D,OAAO,CAAC,6BAA6B,GAAG,KAAK,CAAC,CAAC;AAC/C,MAAM,kCAAkC,GAAG,OAAO,CAAC,2CAA2C,CAAC,CAAC;AAChG,MAAM,+BAA+B,GAAG,OAAO,CAAC,wCAAwC,CAAC,CAAC;AAC1F,MAAM,iCAAiC,GAAG,OAAO,CAAC,0CAA0C,CAAC,CAAC;AAC9F,SAAS,6BAA6B,CAAC,MAAM,EAAE,gBAAgB,EAAE,YAAY,EAAE;AAC/E,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,IAAI,kCAAkC,CAAC,gCAAgC,EAAE,MAAM,EAAE,8BAA8B,EAAE,IAAI,EAAE,iBAAiB,EAAE,wBAAwB,EAAE,YAAY,CAAC;AACrM,YAAY,GAAG,EAAE,IAAI,+BAA+B,CAAC,6BAA6B,EAAE,MAAM,EAAE,8BAA8B,EAAE,IAAI,EAAE,iBAAiB,EAAE,wBAAwB,EAAE,YAAY,CAAC;AAC5L,YAAY,IAAI,EAAE,IAAI,iCAAiC,CAAC,+BAA+B,EAAE,MAAM,EAAE,8BAA8B,EAAE,IAAI,EAAE,iBAAiB,EAAE,wBAAwB,EAAE,YAAY,CAAC;AACjM,SAAS,CAAC;AACV,KAAK;AACL,IAAI,OAAO,aAAa,CAAC;AACzB,CAAC;AACD,OAAO,CAAC,6BAA6B,GAAG,6BAA6B;;"}
|
|
1
|
+
{"version":3,"file":"generateConversationsProperty.js","sources":["../../../../../../src/runtime/internals/utils/clientProperties/generateConversationsProperty.ts"],"sourcesContent":["\"use strict\";\n// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\nObject.defineProperty(exports, \"__esModule\", { value: true });\nexports.generateConversationsProperty = void 0;\nconst createCreateConversationFunction_1 = require(\"../../ai/createCreateConversationFunction\");\nconst createGetConversationFunction_1 = require(\"../../ai/createGetConversationFunction\");\nconst createListConversationsFunction_1 = require(\"../../ai/createListConversationsFunction\");\nconst createDeleteConversationFunction_1 = require(\"../../ai/createDeleteConversationFunction\");\nfunction 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: (0, createCreateConversationFunction_1.createCreateConversationFunction)(client, conversationModelIntrospection, name, conversationModel, conversationMessageModel, getInternals),\n get: (0, createGetConversationFunction_1.createGetConversationFunction)(client, conversationModelIntrospection, name, conversationModel, conversationMessageModel, getInternals),\n delete: (0, createDeleteConversationFunction_1.createDeleteConversationFunction)(client, conversationModelIntrospection, name, conversationModel, conversationMessageModel, getInternals),\n list: (0, createListConversationsFunction_1.createListConversationsFunction)(client, conversationModelIntrospection, name, conversationModel, conversationMessageModel, getInternals),\n };\n }\n return conversations;\n}\nexports.generateConversationsProperty = generateConversationsProperty;\n"],"names":[],"mappings":";;AACA;AACA;AACA,MAAM,CAAC,cAAc,CAAC,OAAO,EAAE,YAAY,EAAE,EAAE,KAAK,EAAE,IAAI,EAAE,CAAC,CAAC;AAC9D,OAAO,CAAC,6BAA6B,GAAG,KAAK,CAAC,CAAC;AAC/C,MAAM,kCAAkC,GAAG,OAAO,CAAC,2CAA2C,CAAC,CAAC;AAChG,MAAM,+BAA+B,GAAG,OAAO,CAAC,wCAAwC,CAAC,CAAC;AAC1F,MAAM,iCAAiC,GAAG,OAAO,CAAC,0CAA0C,CAAC,CAAC;AAC9F,MAAM,kCAAkC,GAAG,OAAO,CAAC,2CAA2C,CAAC,CAAC;AAChG,SAAS,6BAA6B,CAAC,MAAM,EAAE,gBAAgB,EAAE,YAAY,EAAE;AAC/E,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,IAAI,kCAAkC,CAAC,gCAAgC,EAAE,MAAM,EAAE,8BAA8B,EAAE,IAAI,EAAE,iBAAiB,EAAE,wBAAwB,EAAE,YAAY,CAAC;AACrM,YAAY,GAAG,EAAE,IAAI,+BAA+B,CAAC,6BAA6B,EAAE,MAAM,EAAE,8BAA8B,EAAE,IAAI,EAAE,iBAAiB,EAAE,wBAAwB,EAAE,YAAY,CAAC;AAC5L,YAAY,MAAM,EAAE,IAAI,kCAAkC,CAAC,gCAAgC,EAAE,MAAM,EAAE,8BAA8B,EAAE,IAAI,EAAE,iBAAiB,EAAE,wBAAwB,EAAE,YAAY,CAAC;AACrM,YAAY,IAAI,EAAE,IAAI,iCAAiC,CAAC,+BAA+B,EAAE,MAAM,EAAE,8BAA8B,EAAE,IAAI,EAAE,iBAAiB,EAAE,wBAAwB,EAAE,YAAY,CAAC;AACjM,SAAS,CAAC;AACV,KAAK;AACL,IAAI,OAAO,aAAa,CAAC;AACzB,CAAC;AACD,OAAO,CAAC,6BAA6B,GAAG,6BAA6B;;"}
|
|
@@ -17,6 +17,9 @@ export interface ConversationMessage {
|
|
|
17
17
|
interface ConversationRouteGetInput {
|
|
18
18
|
id: string;
|
|
19
19
|
}
|
|
20
|
+
interface ConversationRouteDeleteInput {
|
|
21
|
+
id: string;
|
|
22
|
+
}
|
|
20
23
|
interface ConversationRouteListInput {
|
|
21
24
|
limit?: number;
|
|
22
25
|
nextToken?: string | null;
|
|
@@ -34,6 +37,12 @@ export interface ConversationRoute {
|
|
|
34
37
|
* Gets an existing {@link Conversation} based on ID.
|
|
35
38
|
*/
|
|
36
39
|
get: (input: ConversationRouteGetInput) => SingularReturnValue<Conversation>;
|
|
40
|
+
/**
|
|
41
|
+
* @experimental
|
|
42
|
+
*
|
|
43
|
+
* Deletes an existing {@link Conversation} based on ID.
|
|
44
|
+
*/
|
|
45
|
+
delete: (input: ConversationRouteDeleteInput) => SingularReturnValue<Conversation>;
|
|
37
46
|
/**
|
|
38
47
|
* @experimental
|
|
39
48
|
*
|
|
@@ -41,7 +50,7 @@ export interface ConversationRoute {
|
|
|
41
50
|
*/
|
|
42
51
|
list: (input?: ConversationRouteListInput) => ListReturnValue<Conversation>;
|
|
43
52
|
}
|
|
44
|
-
interface ConversationSendMessageInput {
|
|
53
|
+
export interface ConversationSendMessageInput {
|
|
45
54
|
content: ConversationSendMessageInputContent[];
|
|
46
55
|
aiContext?: string | Record<string, any>;
|
|
47
56
|
toolConfiguration?: ToolConfiguration;
|
|
@@ -58,7 +67,7 @@ export interface Conversation {
|
|
|
58
67
|
*
|
|
59
68
|
* Sends a message to the current conversation.
|
|
60
69
|
*/
|
|
61
|
-
sendMessage: (input: ConversationSendMessageInput) => SingularReturnValue<ConversationMessage>;
|
|
70
|
+
sendMessage: (input: ConversationSendMessageInput | string) => SingularReturnValue<ConversationMessage>;
|
|
62
71
|
/**
|
|
63
72
|
* @experimental
|
|
64
73
|
*
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
import type { ConversationRoute } from '../../../ai/ConversationType';
|
|
2
|
+
import { BaseClient, ClientInternalsGetter, ModelIntrospectionSchema, SchemaModel } from '../../bridge-types';
|
|
3
|
+
export declare const createDeleteConversationFunction: (client: BaseClient, modelIntrospection: ModelIntrospectionSchema, conversationRouteName: string, conversationModel: SchemaModel, conversationMessageModel: SchemaModel, getInternals: ClientInternalsGetter) => ConversationRoute['delete'];
|
|
@@ -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 createDeleteConversationFunction = (client, modelIntrospection, conversationRouteName, conversationModel, conversationMessageModel, getInternals) => async ({ id }) => {
|
|
8
|
+
const deleteOperation = getFactory(client, modelIntrospection, conversationModel, 'DELETE', getInternals, false, getCustomUserAgentDetails(AiAction.DeleteConversation));
|
|
9
|
+
const { data, errors } = await deleteOperation({ id });
|
|
10
|
+
return {
|
|
11
|
+
data: data
|
|
12
|
+
? convertItemToConversation(client, modelIntrospection, data?.id, conversationRouteName, conversationMessageModel, getInternals)
|
|
13
|
+
: data,
|
|
14
|
+
errors,
|
|
15
|
+
};
|
|
16
|
+
};
|
|
17
|
+
|
|
18
|
+
export { createDeleteConversationFunction };
|
|
19
|
+
//# sourceMappingURL=createDeleteConversationFunction.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"createDeleteConversationFunction.mjs","sources":["../../../../../src/runtime/internals/ai/createDeleteConversationFunction.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 createDeleteConversationFunction = (client, modelIntrospection, conversationRouteName, conversationModel, conversationMessageModel, getInternals) => async ({ id }) => {\n const deleteOperation = getFactory(client, modelIntrospection, conversationModel, 'DELETE', getInternals, false, getCustomUserAgentDetails(AiAction.DeleteConversation));\n const { data, errors } = await deleteOperation({ id });\n return {\n data: data\n ? convertItemToConversation(client, modelIntrospection, data?.id, conversationRouteName, conversationMessageModel, getInternals)\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,KAAK;AACpL,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,CAAC,CAAC;AAC3D,IAAI,OAAO;AACX,QAAQ,IAAI,EAAE,IAAI;AAClB,cAAc,yBAAyB,CAAC,MAAM,EAAE,kBAAkB,EAAE,IAAI,EAAE,EAAE,EAAE,qBAAqB,EAAE,wBAAwB,EAAE,YAAY,CAAC;AAC5I,cAAc,IAAI;AAClB,QAAQ,MAAM;AACd,KAAK,CAAC;AACN;;;;"}
|
|
@@ -5,12 +5,14 @@ import { getCustomUserAgentDetails, AiAction } from './getCustomUserAgentDetails
|
|
|
5
5
|
|
|
6
6
|
// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
|
|
7
7
|
// SPDX-License-Identifier: Apache-2.0
|
|
8
|
-
const createSendMessageFunction = (client, modelIntrospection, conversationId, conversationRouteName, getInternals) => async (
|
|
8
|
+
const createSendMessageFunction = (client, modelIntrospection, conversationId, conversationRouteName, getInternals) => async (input) => {
|
|
9
9
|
const { conversations } = modelIntrospection;
|
|
10
10
|
// Safe guard for standalone function. When called as part of client generation, this should never be falsy.
|
|
11
11
|
if (!conversations) {
|
|
12
12
|
return {};
|
|
13
13
|
}
|
|
14
|
+
const processedInput = typeof input === 'string' ? { content: [{ text: input }] } : input;
|
|
15
|
+
const { content, aiContext, toolConfiguration } = processedInput;
|
|
14
16
|
const sendSchema = conversations[conversationRouteName].message.send;
|
|
15
17
|
const sendOperation = customOpFactory(client, modelIntrospection, 'mutation', sendSchema, false, getInternals, getCustomUserAgentDetails(AiAction.SendMessage));
|
|
16
18
|
const { data, errors } = await sendOperation({
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"createSendMessageFunction.mjs","sources":["../../../../../src/runtime/internals/ai/createSendMessageFunction.ts"],"sourcesContent":["// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\nimport { customOpFactory } from '../operations/custom';\nimport { convertItemToConversationMessage } from './convertItemToConversationMessage';\nimport { serializeAiContext, serializeContent, serializeToolConfiguration, } from './conversationMessageSerializers';\nimport { AiAction, getCustomUserAgentDetails, } from './getCustomUserAgentDetails';\nexport const createSendMessageFunction = (client, modelIntrospection, conversationId, conversationRouteName, getInternals) => async (
|
|
1
|
+
{"version":3,"file":"createSendMessageFunction.mjs","sources":["../../../../../src/runtime/internals/ai/createSendMessageFunction.ts"],"sourcesContent":["// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\nimport { customOpFactory } from '../operations/custom';\nimport { convertItemToConversationMessage } from './convertItemToConversationMessage';\nimport { serializeAiContext, serializeContent, serializeToolConfiguration, } from './conversationMessageSerializers';\nimport { AiAction, getCustomUserAgentDetails, } from './getCustomUserAgentDetails';\nexport const createSendMessageFunction = (client, modelIntrospection, conversationId, conversationRouteName, getInternals) => async (input) => {\n const { conversations } = modelIntrospection;\n // Safe guard for standalone function. When called as part of client generation, this should never be falsy.\n if (!conversations) {\n return {};\n }\n const processedInput = typeof input === 'string' ? { content: [{ text: input }] } : input;\n const { content, aiContext, toolConfiguration } = processedInput;\n const sendSchema = conversations[conversationRouteName].message.send;\n const sendOperation = customOpFactory(client, modelIntrospection, 'mutation', sendSchema, false, getInternals, getCustomUserAgentDetails(AiAction.SendMessage));\n const { data, errors } = await sendOperation({\n conversationId,\n content: serializeContent(content),\n ...(aiContext && { aiContext: serializeAiContext(aiContext) }),\n ...(toolConfiguration && {\n toolConfiguration: serializeToolConfiguration(toolConfiguration),\n }),\n });\n return {\n data: data ? convertItemToConversationMessage(data) : data,\n errors,\n };\n};\n"],"names":[],"mappings":";;;;;AAAA;AACA;AAKY,MAAC,yBAAyB,GAAG,CAAC,MAAM,EAAE,kBAAkB,EAAE,cAAc,EAAE,qBAAqB,EAAE,YAAY,KAAK,OAAO,KAAK,KAAK;AAC/I,IAAI,MAAM,EAAE,aAAa,EAAE,GAAG,kBAAkB,CAAC;AACjD;AACA,IAAI,IAAI,CAAC,aAAa,EAAE;AACxB,QAAQ,OAAO,EAAE,CAAC;AAClB,KAAK;AACL,IAAI,MAAM,cAAc,GAAG,OAAO,KAAK,KAAK,QAAQ,GAAG,EAAE,OAAO,EAAE,CAAC,EAAE,IAAI,EAAE,KAAK,EAAE,CAAC,EAAE,GAAG,KAAK,CAAC;AAC9F,IAAI,MAAM,EAAE,OAAO,EAAE,SAAS,EAAE,iBAAiB,EAAE,GAAG,cAAc,CAAC;AACrE,IAAI,MAAM,UAAU,GAAG,aAAa,CAAC,qBAAqB,CAAC,CAAC,OAAO,CAAC,IAAI,CAAC;AACzE,IAAI,MAAM,aAAa,GAAG,eAAe,CAAC,MAAM,EAAE,kBAAkB,EAAE,UAAU,EAAE,UAAU,EAAE,KAAK,EAAE,YAAY,EAAE,yBAAyB,CAAC,QAAQ,CAAC,WAAW,CAAC,CAAC,CAAC;AACpK,IAAI,MAAM,EAAE,IAAI,EAAE,MAAM,EAAE,GAAG,MAAM,aAAa,CAAC;AACjD,QAAQ,cAAc;AACtB,QAAQ,OAAO,EAAE,gBAAgB,CAAC,OAAO,CAAC;AAC1C,QAAQ,IAAI,SAAS,IAAI,EAAE,SAAS,EAAE,kBAAkB,CAAC,SAAS,CAAC,EAAE;AACrE,QAAQ,IAAI,iBAAiB,IAAI;AACjC,YAAY,iBAAiB,EAAE,0BAA0B,CAAC,iBAAiB,CAAC;AAC5E,SAAS;AACT,KAAK,CAAC,CAAC;AACP,IAAI,OAAO;AACX,QAAQ,IAAI,EAAE,IAAI,GAAG,gCAAgC,CAAC,IAAI,CAAC,GAAG,IAAI;AAClE,QAAQ,MAAM;AACd,KAAK,CAAC;AACN;;;;"}
|
|
@@ -13,11 +13,11 @@ export declare enum AiAction {
|
|
|
13
13
|
CreateConversation = "1",
|
|
14
14
|
GetConversation = "2",
|
|
15
15
|
ListConversations = "3",
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
16
|
+
DeleteConversation = "4",
|
|
17
|
+
SendMessage = "5",
|
|
18
|
+
ListMessages = "6",
|
|
19
|
+
OnMessage = "7",
|
|
20
|
+
Generation = "8"
|
|
21
21
|
}
|
|
22
22
|
export declare const getCustomUserAgentDetails: (action: AiAction) => CustomUserAgentDetails;
|
|
23
23
|
/**
|
|
@@ -14,11 +14,11 @@ var AiAction;
|
|
|
14
14
|
AiAction["CreateConversation"] = "1";
|
|
15
15
|
AiAction["GetConversation"] = "2";
|
|
16
16
|
AiAction["ListConversations"] = "3";
|
|
17
|
-
AiAction["
|
|
18
|
-
AiAction["
|
|
19
|
-
AiAction["
|
|
20
|
-
AiAction["
|
|
21
|
-
AiAction["
|
|
17
|
+
AiAction["DeleteConversation"] = "4";
|
|
18
|
+
AiAction["SendMessage"] = "5";
|
|
19
|
+
AiAction["ListMessages"] = "6";
|
|
20
|
+
AiAction["OnMessage"] = "7";
|
|
21
|
+
AiAction["Generation"] = "8";
|
|
22
22
|
})(AiAction || (AiAction = {}));
|
|
23
23
|
const getCustomUserAgentDetails = (action) => ({
|
|
24
24
|
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[\"
|
|
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,6 +1,7 @@
|
|
|
1
1
|
import { createCreateConversationFunction } from '../../ai/createCreateConversationFunction.mjs';
|
|
2
2
|
import { createGetConversationFunction } from '../../ai/createGetConversationFunction.mjs';
|
|
3
3
|
import { createListConversationsFunction } from '../../ai/createListConversationsFunction.mjs';
|
|
4
|
+
import { createDeleteConversationFunction } from '../../ai/createDeleteConversationFunction.mjs';
|
|
4
5
|
|
|
5
6
|
// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
|
|
6
7
|
// SPDX-License-Identifier: Apache-2.0
|
|
@@ -36,6 +37,7 @@ function generateConversationsProperty(client, apiGraphQLConfig, getInternals) {
|
|
|
36
37
|
conversations[name] = {
|
|
37
38
|
create: createCreateConversationFunction(client, conversationModelIntrospection, name, conversationModel, conversationMessageModel, getInternals),
|
|
38
39
|
get: createGetConversationFunction(client, conversationModelIntrospection, name, conversationModel, conversationMessageModel, getInternals),
|
|
40
|
+
delete: createDeleteConversationFunction(client, conversationModelIntrospection, name, conversationModel, conversationMessageModel, getInternals),
|
|
39
41
|
list: createListConversationsFunction(client, conversationModelIntrospection, name, conversationModel, conversationMessageModel, getInternals),
|
|
40
42
|
};
|
|
41
43
|
}
|
package/dist/esm/runtime/internals/utils/clientProperties/generateConversationsProperty.mjs.map
CHANGED
|
@@ -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';\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 list: createListConversationsFunction(client, conversationModelIntrospection, name, conversationModel, conversationMessageModel, getInternals),\n };\n }\n return conversations;\n}\n"],"names":[],"mappings":"
|
|
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;;;;"}
|