@aws-amplify/data-schema 1.6.2 → 1.7.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/index.js +3 -1
- package/dist/cjs/runtime/index.js.map +1 -1
- package/dist/cjs/runtime/internals/ai/createCreateConversationFunction.js +2 -1
- package/dist/cjs/runtime/internals/ai/createCreateConversationFunction.js.map +1 -1
- 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/createGetConversationFunction.js +2 -1
- package/dist/cjs/runtime/internals/ai/createGetConversationFunction.js.map +1 -1
- package/dist/cjs/runtime/internals/ai/createListConversationsFunction.js +2 -1
- package/dist/cjs/runtime/internals/ai/createListConversationsFunction.js.map +1 -1
- package/dist/cjs/runtime/internals/ai/createListMessagesFunction.js +2 -1
- package/dist/cjs/runtime/internals/ai/createListMessagesFunction.js.map +1 -1
- package/dist/cjs/runtime/internals/ai/createOnMessageFunction.js +2 -1
- package/dist/cjs/runtime/internals/ai/createOnMessageFunction.js.map +1 -1
- package/dist/cjs/runtime/internals/ai/createSendMessageFunction.js +2 -1
- package/dist/cjs/runtime/internals/ai/createSendMessageFunction.js.map +1 -1
- package/dist/cjs/runtime/internals/ai/getCustomUserAgentDetails.js +48 -0
- package/dist/cjs/runtime/internals/ai/getCustomUserAgentDetails.js.map +1 -0
- package/dist/cjs/runtime/internals/operations/custom.js +10 -5
- package/dist/cjs/runtime/internals/operations/custom.js.map +1 -1
- package/dist/cjs/runtime/internals/operations/get.js +8 -5
- package/dist/cjs/runtime/internals/operations/get.js.map +1 -1
- package/dist/cjs/runtime/internals/operations/list.js +8 -5
- package/dist/cjs/runtime/internals/operations/list.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/cjs/runtime/internals/utils/clientProperties/generateGenerationsProperty.js +2 -1
- package/dist/cjs/runtime/internals/utils/clientProperties/generateGenerationsProperty.js.map +1 -1
- package/dist/esm/ai/ConversationType.d.ts +9 -0
- package/dist/esm/runtime/addSchemaToClientWithInstance.mjs +1 -0
- package/dist/esm/runtime/addSchemaToClientWithInstance.mjs.map +1 -1
- package/dist/esm/runtime/bridge-types.d.ts +6 -1
- package/dist/esm/runtime/index.d.ts +1 -0
- package/dist/esm/runtime/index.mjs +1 -0
- package/dist/esm/runtime/index.mjs.map +1 -1
- package/dist/esm/runtime/internals/ai/createCreateConversationFunction.d.ts +1 -1
- package/dist/esm/runtime/internals/ai/createCreateConversationFunction.mjs +2 -1
- package/dist/esm/runtime/internals/ai/createCreateConversationFunction.mjs.map +1 -1
- 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/createGetConversationFunction.d.ts +1 -1
- package/dist/esm/runtime/internals/ai/createGetConversationFunction.mjs +2 -1
- package/dist/esm/runtime/internals/ai/createGetConversationFunction.mjs.map +1 -1
- package/dist/esm/runtime/internals/ai/createListConversationsFunction.d.ts +1 -1
- package/dist/esm/runtime/internals/ai/createListConversationsFunction.mjs +2 -1
- package/dist/esm/runtime/internals/ai/createListConversationsFunction.mjs.map +1 -1
- package/dist/esm/runtime/internals/ai/createListMessagesFunction.d.ts +1 -1
- package/dist/esm/runtime/internals/ai/createListMessagesFunction.mjs +2 -1
- package/dist/esm/runtime/internals/ai/createListMessagesFunction.mjs.map +1 -1
- package/dist/esm/runtime/internals/ai/createOnMessageFunction.d.ts +1 -1
- package/dist/esm/runtime/internals/ai/createOnMessageFunction.mjs +2 -1
- package/dist/esm/runtime/internals/ai/createOnMessageFunction.mjs.map +1 -1
- package/dist/esm/runtime/internals/ai/createSendMessageFunction.d.ts +1 -1
- package/dist/esm/runtime/internals/ai/createSendMessageFunction.mjs +2 -1
- package/dist/esm/runtime/internals/ai/createSendMessageFunction.mjs.map +1 -1
- package/dist/esm/runtime/internals/ai/getCustomUserAgentDetails.d.ts +35 -0
- package/dist/esm/runtime/internals/ai/getCustomUserAgentDetails.mjs +44 -0
- package/dist/esm/runtime/internals/ai/getCustomUserAgentDetails.mjs.map +1 -0
- package/dist/esm/runtime/internals/operations/custom.d.ts +2 -2
- package/dist/esm/runtime/internals/operations/custom.mjs +10 -5
- package/dist/esm/runtime/internals/operations/custom.mjs.map +1 -1
- package/dist/esm/runtime/internals/operations/get.d.ts +2 -2
- package/dist/esm/runtime/internals/operations/get.mjs +8 -5
- package/dist/esm/runtime/internals/operations/get.mjs.map +1 -1
- package/dist/esm/runtime/internals/operations/list.d.ts +2 -2
- package/dist/esm/runtime/internals/operations/list.mjs +8 -5
- package/dist/esm/runtime/internals/operations/list.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/esm/runtime/internals/utils/clientProperties/generateGenerationsProperty.mjs +2 -1
- package/dist/esm/runtime/internals/utils/clientProperties/generateGenerationsProperty.mjs.map +1 -1
- package/dist/meta/cjs.tsbuildinfo +1 -1
- package/package.json +1 -1
- package/src/ai/ConversationType.ts +10 -0
- package/src/runtime/bridge-types.ts +8 -0
- package/src/runtime/index.ts +1 -0
- package/src/runtime/internals/ai/createCreateConversationFunction.ts +7 -1
- package/src/runtime/internals/ai/createDeleteConversationFunction.ts +54 -0
- package/src/runtime/internals/ai/createGetConversationFunction.ts +7 -1
- package/src/runtime/internals/ai/createListConversationsFunction.ts +7 -1
- package/src/runtime/internals/ai/createListMessagesFunction.ts +7 -1
- package/src/runtime/internals/ai/createOnMessageFunction.ts +3 -1
- package/src/runtime/internals/ai/createSendMessageFunction.ts +6 -1
- package/src/runtime/internals/ai/getCustomUserAgentDetails.ts +54 -0
- package/src/runtime/internals/operations/custom.ts +13 -0
- package/src/runtime/internals/operations/get.ts +11 -2
- package/src/runtime/internals/operations/list.ts +18 -3
- package/src/runtime/internals/utils/clientProperties/generateConversationsProperty.ts +9 -0
- package/src/runtime/internals/utils/clientProperties/generateGenerationsProperty.ts +5 -0
|
@@ -6,24 +6,26 @@ const APIClient_1 = require("../APIClient");
|
|
|
6
6
|
const utils_1 = require("./utils");
|
|
7
7
|
const utils_2 = require("../../utils");
|
|
8
8
|
const cancellation_1 = require("../cancellation");
|
|
9
|
-
|
|
9
|
+
const getCustomUserAgentDetails_1 = require("../ai/getCustomUserAgentDetails");
|
|
10
|
+
function listFactory(client, modelIntrospection, model, getInternals, context = false, customUserAgentDetails) {
|
|
10
11
|
const listWithContext = (contextSpec, args) => {
|
|
11
|
-
return _list(client, modelIntrospection, model, getInternals, args, contextSpec);
|
|
12
|
+
return _list(client, modelIntrospection, model, getInternals, args, contextSpec, customUserAgentDetails);
|
|
12
13
|
};
|
|
13
14
|
const list = (args) => {
|
|
14
|
-
return _list(client, modelIntrospection, model, getInternals, args);
|
|
15
|
+
return _list(client, modelIntrospection, model, getInternals, args, undefined, customUserAgentDetails);
|
|
15
16
|
};
|
|
16
17
|
return context ? listWithContext : list;
|
|
17
18
|
}
|
|
18
19
|
exports.listFactory = listFactory;
|
|
19
|
-
function _list(client, modelIntrospection, model, getInternals, args, contextSpec) {
|
|
20
|
+
function _list(client, modelIntrospection, model, getInternals, args, contextSpec, customUserAgentDetails) {
|
|
20
21
|
return (0, utils_2.selfAwareAsync)(async (resultPromise) => {
|
|
21
22
|
const { name } = model;
|
|
22
23
|
const query = (0, APIClient_1.generateGraphQLDocument)(modelIntrospection, name, 'LIST', args);
|
|
23
24
|
const variables = (0, APIClient_1.buildGraphQLVariables)(model, 'LIST', args, modelIntrospection);
|
|
24
25
|
const auth = (0, APIClient_1.authModeParams)(client, getInternals, args);
|
|
26
|
+
const headers = (0, APIClient_1.getCustomHeaders)(client, getInternals, args?.headers);
|
|
27
|
+
const userAgentOverride = (0, getCustomUserAgentDetails_1.createUserAgentOverride)(customUserAgentDetails);
|
|
25
28
|
try {
|
|
26
|
-
const headers = (0, APIClient_1.getCustomHeaders)(client, getInternals, args?.headers);
|
|
27
29
|
const basePromise = contextSpec
|
|
28
30
|
? client.graphql(contextSpec, {
|
|
29
31
|
...auth,
|
|
@@ -34,6 +36,7 @@ function _list(client, modelIntrospection, model, getInternals, args, contextSpe
|
|
|
34
36
|
...auth,
|
|
35
37
|
query,
|
|
36
38
|
variables,
|
|
39
|
+
...userAgentOverride,
|
|
37
40
|
}, headers);
|
|
38
41
|
const extendedPromise = (0, cancellation_1.extendCancellability)(basePromise, resultPromise);
|
|
39
42
|
const { data, extensions } = await extendedPromise;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"list.js","sources":["../../../../../src/runtime/internals/operations/list.ts"],"sourcesContent":["\"use strict\";\nObject.defineProperty(exports, \"__esModule\", { value: true });\nexports.listFactory = void 0;\nconst APIClient_1 = require(\"../APIClient\");\nconst utils_1 = require(\"./utils\");\nconst utils_2 = require(\"../../utils\");\nconst cancellation_1 = require(\"../cancellation\");\nfunction listFactory(client, modelIntrospection, model, getInternals, context = false) {\n const listWithContext = (contextSpec, args) => {\n return _list(client, modelIntrospection, model, getInternals, args, contextSpec);\n };\n const list = (args) => {\n return _list(client, modelIntrospection, model, getInternals, args);\n };\n return context ? listWithContext : list;\n}\nexports.listFactory = listFactory;\nfunction _list(client, modelIntrospection, model, getInternals, args, contextSpec) {\n return (0, utils_2.selfAwareAsync)(async (resultPromise) => {\n const { name } = model;\n const query = (0, APIClient_1.generateGraphQLDocument)(modelIntrospection, name, 'LIST', args);\n const variables = (0, APIClient_1.buildGraphQLVariables)(model, 'LIST', args, modelIntrospection);\n const auth = (0, APIClient_1.authModeParams)(client, getInternals, args);\n try {\n const headers = (0, APIClient_1.getCustomHeaders)(client, getInternals, args?.headers);\n const basePromise = contextSpec\n ? client.graphql(contextSpec, {\n ...auth,\n query,\n variables,\n }, headers)\n : client.graphql({\n ...auth,\n query,\n variables,\n }, headers);\n const extendedPromise = (0, cancellation_1.extendCancellability)(basePromise, resultPromise);\n const { data, extensions } = await extendedPromise;\n // flatten response\n if (data !== undefined) {\n const [key] = Object.keys(data);\n if (data[key].items) {\n const flattenedResult = data[key].items.map((value) => (0, APIClient_1.flattenItems)(modelIntrospection, name, value));\n // don't init if custom selection set\n if (args?.selectionSet) {\n return {\n data: flattenedResult,\n nextToken: data[key].nextToken,\n extensions,\n };\n }\n else {\n const initialized = (0, APIClient_1.initializeModel)(client, name, flattenedResult, modelIntrospection, auth.authMode, auth.authToken, !!contextSpec);\n return {\n data: initialized,\n nextToken: data[key].nextToken,\n extensions,\n };\n }\n }\n return {\n data: data[key],\n nextToken: data[key].nextToken,\n extensions,\n };\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 `data: { listPosts: null }`\n * 4) actual records `data: { listPosts: items: [{ id: '1', ...etc }] }`\n */\n const { data, errors } = error;\n // `data` is not `null`, and is not an empty object:\n if (data !== undefined &&\n data !== null &&\n Object.keys(data).length !== 0 &&\n errors) {\n const [key] = Object.keys(data);\n if (data[key]?.items) {\n const flattenedResult = data[key].items.map((value) => (0, APIClient_1.flattenItems)(modelIntrospection, name, value));\n /**\n * Check exists since `flattenedResult` could be `null`.\n * if `flattenedResult` exists, result is an actual record.\n */\n if (flattenedResult) {\n // don't init if custom selection set\n if (args?.selectionSet) {\n return {\n data: flattenedResult,\n nextToken: data[key]?.nextToken,\n errors,\n };\n }\n else {\n const initialized = (0, APIClient_1.initializeModel)(client, name, flattenedResult, modelIntrospection, auth.authMode, auth.authToken, !!contextSpec);\n // data is full record w/out selection set:\n return {\n data: initialized,\n nextToken: data[key]?.nextToken,\n errors,\n };\n }\n }\n return {\n data: data[key],\n nextToken: data[key]?.nextToken,\n errors,\n };\n }\n else {\n // response is of type `data: { getPost: null }`)\n return (0, utils_1.handleListGraphQlError)(error);\n }\n }\n else {\n // `data` is `null` or an empty object:\n return (0, utils_1.handleListGraphQlError)(error);\n }\n }\n });\n}\n"],"names":[],"mappings":";;AACA,MAAM,CAAC,cAAc,CAAC,OAAO,EAAE,YAAY,EAAE,EAAE,KAAK,EAAE,IAAI,EAAE,CAAC,CAAC;AAC9D,OAAO,CAAC,WAAW,GAAG,KAAK,CAAC,CAAC;AAC7B,MAAM,WAAW,GAAG,OAAO,CAAC,cAAc,CAAC,CAAC;AAC5C,MAAM,OAAO,GAAG,OAAO,CAAC,SAAS,CAAC,CAAC;AACnC,MAAM,OAAO,GAAG,OAAO,CAAC,aAAa,CAAC,CAAC;AACvC,MAAM,cAAc,GAAG,OAAO,CAAC,iBAAiB,CAAC,CAAC;AAClD,SAAS,WAAW,CAAC,MAAM,EAAE,kBAAkB,EAAE,KAAK,EAAE,YAAY,EAAE,OAAO,GAAG,KAAK,EAAE;AACvF,IAAI,MAAM,eAAe,GAAG,CAAC,WAAW,EAAE,IAAI,KAAK;AACnD,QAAQ,OAAO,KAAK,CAAC,MAAM,EAAE,kBAAkB,EAAE,KAAK,EAAE,YAAY,EAAE,IAAI,EAAE,WAAW,CAAC,CAAC;AACzF,KAAK,CAAC;AACN,IAAI,MAAM,IAAI,GAAG,CAAC,IAAI,KAAK;AAC3B,QAAQ,OAAO,KAAK,CAAC,MAAM,EAAE,kBAAkB,EAAE,KAAK,EAAE,YAAY,EAAE,IAAI,CAAC,CAAC;AAC5E,KAAK,CAAC;AACN,IAAI,OAAO,OAAO,GAAG,eAAe,GAAG,IAAI,CAAC;AAC5C,CAAC;AACD,OAAO,CAAC,WAAW,GAAG,WAAW,CAAC;AAClC,SAAS,KAAK,CAAC,MAAM,EAAE,kBAAkB,EAAE,KAAK,EAAE,YAAY,EAAE,IAAI,EAAE,WAAW,EAAE;AACnF,IAAI,O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wBAAwB,IAAI,EAAE,IAAI,CAAC,GAAG,CAAC;AACvC,wBAAwB,SAAS,EAAE,IAAI,CAAC,GAAG,CAAC,EAAE,SAAS;AACvD,wBAAwB,MAAM;AAC9B,qBAAqB,CAAC;AACtB,iBAAiB;AACjB,qBAAqB;AACrB;AACA,oBAAoB,OAAO,IAAI,OAAO,CAAC,sBAAsB,EAAE,KAAK,CAAC,CAAC;AACtE,iBAAiB;AACjB,aAAa;AACb,iBAAiB;AACjB;AACA,gBAAgB,OAAO,IAAI,OAAO,CAAC,sBAAsB,EAAE,KAAK,CAAC,CAAC;AAClE,aAAa;AACb,SAAS;AACT,KAAK,CAAC,CAAC;AACP;;"}
|
|
1
|
+
{"version":3,"file":"list.js","sources":["../../../../../src/runtime/internals/operations/list.ts"],"sourcesContent":["\"use strict\";\nObject.defineProperty(exports, \"__esModule\", { value: true });\nexports.listFactory = void 0;\nconst APIClient_1 = require(\"../APIClient\");\nconst utils_1 = require(\"./utils\");\nconst utils_2 = require(\"../../utils\");\nconst cancellation_1 = require(\"../cancellation\");\nconst getCustomUserAgentDetails_1 = require(\"../ai/getCustomUserAgentDetails\");\nfunction listFactory(client, modelIntrospection, model, getInternals, context = false, customUserAgentDetails) {\n const listWithContext = (contextSpec, args) => {\n return _list(client, modelIntrospection, model, getInternals, args, contextSpec, customUserAgentDetails);\n };\n const list = (args) => {\n return _list(client, modelIntrospection, model, getInternals, args, undefined, customUserAgentDetails);\n };\n return context ? listWithContext : list;\n}\nexports.listFactory = listFactory;\nfunction _list(client, modelIntrospection, model, getInternals, args, contextSpec, customUserAgentDetails) {\n return (0, utils_2.selfAwareAsync)(async (resultPromise) => {\n const { name } = model;\n const query = (0, APIClient_1.generateGraphQLDocument)(modelIntrospection, name, 'LIST', args);\n const variables = (0, APIClient_1.buildGraphQLVariables)(model, 'LIST', args, modelIntrospection);\n const auth = (0, APIClient_1.authModeParams)(client, getInternals, args);\n const headers = (0, APIClient_1.getCustomHeaders)(client, getInternals, args?.headers);\n const userAgentOverride = (0, getCustomUserAgentDetails_1.createUserAgentOverride)(customUserAgentDetails);\n try {\n const basePromise = contextSpec\n ? client.graphql(contextSpec, {\n ...auth,\n query,\n variables,\n }, headers)\n : client.graphql({\n ...auth,\n query,\n variables,\n ...userAgentOverride,\n }, headers);\n const extendedPromise = (0, cancellation_1.extendCancellability)(basePromise, resultPromise);\n const { data, extensions } = await extendedPromise;\n // flatten response\n if (data !== undefined) {\n const [key] = Object.keys(data);\n if (data[key].items) {\n const flattenedResult = data[key].items.map((value) => (0, APIClient_1.flattenItems)(modelIntrospection, name, value));\n // don't init if custom selection set\n if (args?.selectionSet) {\n return {\n data: flattenedResult,\n nextToken: data[key].nextToken,\n extensions,\n };\n }\n else {\n const initialized = (0, APIClient_1.initializeModel)(client, name, flattenedResult, modelIntrospection, auth.authMode, auth.authToken, !!contextSpec);\n return {\n data: initialized,\n nextToken: data[key].nextToken,\n extensions,\n };\n }\n }\n return {\n data: data[key],\n nextToken: data[key].nextToken,\n extensions,\n };\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 `data: { listPosts: null }`\n * 4) actual records `data: { listPosts: items: [{ id: '1', ...etc }] }`\n */\n const { data, errors } = error;\n // `data` is not `null`, and is not an empty object:\n if (data !== undefined &&\n data !== null &&\n Object.keys(data).length !== 0 &&\n errors) {\n const [key] = Object.keys(data);\n if (data[key]?.items) {\n const flattenedResult = data[key].items.map((value) => (0, APIClient_1.flattenItems)(modelIntrospection, name, value));\n /**\n * Check exists since `flattenedResult` could be `null`.\n * if `flattenedResult` exists, result is an actual record.\n */\n if (flattenedResult) {\n // don't init if custom selection set\n if (args?.selectionSet) {\n return {\n data: flattenedResult,\n nextToken: data[key]?.nextToken,\n errors,\n };\n }\n else {\n const initialized = (0, APIClient_1.initializeModel)(client, name, flattenedResult, modelIntrospection, auth.authMode, auth.authToken, !!contextSpec);\n // data is full record w/out selection set:\n return {\n data: initialized,\n nextToken: data[key]?.nextToken,\n errors,\n };\n }\n }\n return {\n data: data[key],\n nextToken: data[key]?.nextToken,\n errors,\n };\n }\n else {\n // response is of type `data: { getPost: null }`)\n return (0, utils_1.handleListGraphQlError)(error);\n }\n }\n else {\n // `data` is `null` or an empty object:\n return (0, utils_1.handleListGraphQlError)(error);\n }\n }\n });\n}\n"],"names":[],"mappings":";;AACA,MAAM,CAAC,cAAc,CAAC,OAAO,EAAE,YAAY,EAAE,EAAE,KAAK,EAAE,IAAI,EAAE,CAAC,CAAC;AAC9D,OAAO,CAAC,WAAW,GAAG,KAAK,CAAC,CAAC;AAC7B,MAAM,WAAW,GAAG,OAAO,CAAC,cAAc,CAAC,CAAC;AAC5C,MAAM,OAAO,GAAG,OAAO,CAAC,SAAS,CAAC,CAAC;AACnC,MAAM,OAAO,GAAG,OAAO,CAAC,aAAa,CAAC,CAAC;AACvC,MAAM,cAAc,GAAG,OAAO,CAAC,iBAAiB,CAAC,CAAC;AAClD,MAAM,2BAA2B,GAAG,OAAO,CAAC,iCAAiC,CAAC,CAAC;AAC/E,SAAS,WAAW,CAAC,MAAM,EAAE,kBAAkB,EAAE,KAAK,EAAE,YAAY,EAAE,OAAO,GAAG,KAAK,EAAE,sBAAsB,EAAE;AAC/G,IAAI,MAAM,eAAe,GAAG,CAAC,WAAW,EAAE,IAAI,KAAK;AACnD,QAAQ,OAAO,KAAK,CAAC,MAAM,EAAE,kBAAkB,EAAE,KAAK,EAAE,YAAY,EAAE,IAAI,EAAE,WAAW,EAAE,sBAAsB,CAAC,CAAC;AACjH,KAAK,CAAC;AACN,IAAI,MAAM,IAAI,GAAG,CAAC,IAAI,KAAK;AAC3B,QAAQ,OAAO,KAAK,CAAC,MAAM,EAAE,kBAAkB,EAAE,KAAK,EAAE,YAAY,EAAE,IAAI,EAAE,SAAS,EAAE,sBAAsB,CAAC,CAAC;AAC/G,KAAK,CAAC;AACN,IAAI,OAAO,OAAO,GAAG,eAAe,GAAG,IAAI,CA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CAAC,QAAQ,EAAE,IAAI,CAAC,SAAS,EAAE,CAAC,CAAC,WAAW,CAAC,CAAC;AAClL;AACA,4BAA4B,OAAO;AACnC,gCAAgC,IAAI,EAAE,WAAW;AACjD,gCAAgC,SAAS,EAAE,IAAI,CAAC,GAAG,CAAC,EAAE,SAAS;AAC/D,gCAAgC,MAAM;AACtC,6BAA6B,CAAC;AAC9B,yBAAyB;AACzB,qBAAqB;AACrB,oBAAoB,OAAO;AAC3B,wBAAwB,IAAI,EAAE,IAAI,CAAC,GAAG,CAAC;AACvC,wBAAwB,SAAS,EAAE,IAAI,CAAC,GAAG,CAAC,EAAE,SAAS;AACvD,wBAAwB,MAAM;AAC9B,qBAAqB,CAAC;AACtB,iBAAiB;AACjB,qBAAqB;AACrB;AACA,oBAAoB,OAAO,IAAI,OAAO,CAAC,sBAAsB,EAAE,KAAK,CAAC,CAAC;AACtE,iBAAiB;AACjB,aAAa;AACb,iBAAiB;AACjB;AACA,gBAAgB,OAAO,IAAI,OAAO,CAAC,sBAAsB,EAAE,KAAK,CAAC,CAAC;AAClE,aAAa;AACb,SAAS;AACT,KAAK,CAAC,CAAC;AACP;;"}
|
|
@@ -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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/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;;"}
|
|
@@ -5,6 +5,7 @@
|
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
6
|
exports.generateGenerationsProperty = void 0;
|
|
7
7
|
const custom_1 = require("../../operations/custom");
|
|
8
|
+
const getCustomUserAgentDetails_1 = require("../../ai/getCustomUserAgentDetails");
|
|
8
9
|
function generateGenerationsProperty(client, apiGraphQLConfig, getInternals) {
|
|
9
10
|
const modelIntrospection = apiGraphQLConfig?.modelIntrospection;
|
|
10
11
|
// generations will be absent from model intro schema if no generation routes
|
|
@@ -14,7 +15,7 @@ function generateGenerationsProperty(client, apiGraphQLConfig, getInternals) {
|
|
|
14
15
|
}
|
|
15
16
|
const generations = {};
|
|
16
17
|
for (const generation of Object.values(modelIntrospection.generations)) {
|
|
17
|
-
generations[generation.name] = (0, custom_1.customOpFactory)(client, modelIntrospection, 'query', generation, false, getInternals);
|
|
18
|
+
generations[generation.name] = (0, custom_1.customOpFactory)(client, modelIntrospection, 'query', generation, false, getInternals, (0, getCustomUserAgentDetails_1.getCustomUserAgentDetails)(getCustomUserAgentDetails_1.AiAction.Generation));
|
|
18
19
|
}
|
|
19
20
|
return generations;
|
|
20
21
|
}
|
package/dist/cjs/runtime/internals/utils/clientProperties/generateGenerationsProperty.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"generateGenerationsProperty.js","sources":["../../../../../../src/runtime/internals/utils/clientProperties/generateGenerationsProperty.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.generateGenerationsProperty = void 0;\nconst custom_1 = require(\"../../operations/custom\");\nfunction generateGenerationsProperty(client, apiGraphQLConfig, getInternals) {\n const modelIntrospection = apiGraphQLConfig?.modelIntrospection;\n // generations will be absent from model intro schema if no generation routes\n // are present on the source schema.\n if (!modelIntrospection?.generations) {\n return {};\n }\n const generations = {};\n for (const generation of Object.values(modelIntrospection.generations)) {\n generations[generation.name] = (0, custom_1.customOpFactory)(client, modelIntrospection, 'query', generation, false, getInternals);\n }\n return generations;\n}\nexports.generateGenerationsProperty = generateGenerationsProperty;\n"],"names":[],"mappings":";;AACA;AACA;AACA,MAAM,CAAC,cAAc,CAAC,OAAO,EAAE,YAAY,EAAE,EAAE,KAAK,EAAE,IAAI,EAAE,CAAC,CAAC;AAC9D,OAAO,CAAC,2BAA2B,GAAG,KAAK,CAAC,CAAC;AAC7C,MAAM,QAAQ,GAAG,OAAO,CAAC,yBAAyB,CAAC,CAAC;AACpD,SAAS,2BAA2B,CAAC,MAAM,EAAE,gBAAgB,EAAE,YAAY,EAAE;AAC7E,IAAI,MAAM,kBAAkB,GAAG,gBAAgB,EAAE,kBAAkB,CAAC;AACpE;AACA;AACA,IAAI,IAAI,CAAC,kBAAkB,EAAE,WAAW,EAAE;AAC1C,QAAQ,OAAO,EAAE,CAAC;AAClB,KAAK;AACL,IAAI,MAAM,WAAW,GAAG,EAAE,CAAC;AAC3B,IAAI,KAAK,MAAM,UAAU,IAAI,MAAM,CAAC,MAAM,CAAC,kBAAkB,CAAC,WAAW,CAAC,EAAE;AAC5E,QAAQ,WAAW,CAAC,UAAU,CAAC,IAAI,CAAC,GAAG,IAAI,QAAQ,CAAC,eAAe,EAAE,MAAM,EAAE,kBAAkB,EAAE,OAAO,EAAE,UAAU,EAAE,KAAK,EAAE,YAAY,CAAC,CAAC;
|
|
1
|
+
{"version":3,"file":"generateGenerationsProperty.js","sources":["../../../../../../src/runtime/internals/utils/clientProperties/generateGenerationsProperty.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.generateGenerationsProperty = void 0;\nconst custom_1 = require(\"../../operations/custom\");\nconst getCustomUserAgentDetails_1 = require(\"../../ai/getCustomUserAgentDetails\");\nfunction generateGenerationsProperty(client, apiGraphQLConfig, getInternals) {\n const modelIntrospection = apiGraphQLConfig?.modelIntrospection;\n // generations will be absent from model intro schema if no generation routes\n // are present on the source schema.\n if (!modelIntrospection?.generations) {\n return {};\n }\n const generations = {};\n for (const generation of Object.values(modelIntrospection.generations)) {\n generations[generation.name] = (0, custom_1.customOpFactory)(client, modelIntrospection, 'query', generation, false, getInternals, (0, getCustomUserAgentDetails_1.getCustomUserAgentDetails)(getCustomUserAgentDetails_1.AiAction.Generation));\n }\n return generations;\n}\nexports.generateGenerationsProperty = generateGenerationsProperty;\n"],"names":[],"mappings":";;AACA;AACA;AACA,MAAM,CAAC,cAAc,CAAC,OAAO,EAAE,YAAY,EAAE,EAAE,KAAK,EAAE,IAAI,EAAE,CAAC,CAAC;AAC9D,OAAO,CAAC,2BAA2B,GAAG,KAAK,CAAC,CAAC;AAC7C,MAAM,QAAQ,GAAG,OAAO,CAAC,yBAAyB,CAAC,CAAC;AACpD,MAAM,2BAA2B,GAAG,OAAO,CAAC,oCAAoC,CAAC,CAAC;AAClF,SAAS,2BAA2B,CAAC,MAAM,EAAE,gBAAgB,EAAE,YAAY,EAAE;AAC7E,IAAI,MAAM,kBAAkB,GAAG,gBAAgB,EAAE,kBAAkB,CAAC;AACpE;AACA;AACA,IAAI,IAAI,CAAC,kBAAkB,EAAE,WAAW,EAAE;AAC1C,QAAQ,OAAO,EAAE,CAAC;AAClB,KAAK;AACL,IAAI,MAAM,WAAW,GAAG,EAAE,CAAC;AAC3B,IAAI,KAAK,MAAM,UAAU,IAAI,MAAM,CAAC,MAAM,CAAC,kBAAkB,CAAC,WAAW,CAAC,EAAE;AAC5E,QAAQ,WAAW,CAAC,UAAU,CAAC,IAAI,CAAC,GAAG,IAAI,QAAQ,CAAC,eAAe,EAAE,MAAM,EAAE,kBAAkB,EAAE,OAAO,EAAE,UAAU,EAAE,KAAK,EAAE,YAAY,EAAE,IAAI,2BAA2B,CAAC,yBAAyB,EAAE,2BAA2B,CAAC,QAAQ,CAAC,UAAU,CAAC,CAAC,CAAC;AACxP,KAAK;AACL,IAAI,OAAO,WAAW,CAAC;AACvB,CAAC;AACD,OAAO,CAAC,2BAA2B,GAAG,2BAA2B;;"}
|
|
@@ -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
|
*
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { isApiGraphQLConfig } from './internals/utils/runtimeTypeGuards/isApiGraphQLProviderConfig.mjs';
|
|
2
2
|
import { generateCustomQueriesProperty, generateCustomMutationsProperty } from './internals/generateCustomOperationsProperty.mjs';
|
|
3
3
|
import { upgradeClientCancellation } from './internals/cancellation.mjs';
|
|
4
|
+
import './internals/ai/getCustomUserAgentDetails.mjs';
|
|
4
5
|
import '@smithy/util-base64';
|
|
5
6
|
import 'rxjs';
|
|
6
7
|
import { generateEnumsProperty } from './internals/utils/clientProperties/generateEnumsProperty.mjs';
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"addSchemaToClientWithInstance.mjs","sources":["../../../src/runtime/addSchemaToClientWithInstance.ts"],"sourcesContent":["// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\nimport { isApiGraphQLConfig } from './internals/utils/runtimeTypeGuards/isApiGraphQLProviderConfig';\nimport { generateCustomQueriesProperty, generateCustomMutationsProperty, generateEnumsProperty, upgradeClientCancellation, } from './internals';\nimport { generateModelsProperty as generateModelsPropertyServer } from './internals/server';\n// TODO: separate import path\nexport function addSchemaToClientWithInstance(client, params, getInternals) {\n const apiGraphqlConfig = params.config?.API?.GraphQL;\n if (isApiGraphQLConfig(apiGraphqlConfig)) {\n upgradeClientCancellation(client);\n client.models = generateModelsPropertyServer(client, params, getInternals);\n client.enums = generateEnumsProperty(apiGraphqlConfig);\n client.queries = generateCustomQueriesProperty(client, apiGraphqlConfig, getInternals);\n client.mutations = generateCustomMutationsProperty(client, apiGraphqlConfig, getInternals);\n }\n return client;\n}\n"],"names":["generateModelsPropertyServer"],"mappings":"
|
|
1
|
+
{"version":3,"file":"addSchemaToClientWithInstance.mjs","sources":["../../../src/runtime/addSchemaToClientWithInstance.ts"],"sourcesContent":["// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\nimport { isApiGraphQLConfig } from './internals/utils/runtimeTypeGuards/isApiGraphQLProviderConfig';\nimport { generateCustomQueriesProperty, generateCustomMutationsProperty, generateEnumsProperty, upgradeClientCancellation, } from './internals';\nimport { generateModelsProperty as generateModelsPropertyServer } from './internals/server';\n// TODO: separate import path\nexport function addSchemaToClientWithInstance(client, params, getInternals) {\n const apiGraphqlConfig = params.config?.API?.GraphQL;\n if (isApiGraphQLConfig(apiGraphqlConfig)) {\n upgradeClientCancellation(client);\n client.models = generateModelsPropertyServer(client, params, getInternals);\n client.enums = generateEnumsProperty(apiGraphqlConfig);\n client.queries = generateCustomQueriesProperty(client, apiGraphqlConfig, getInternals);\n client.mutations = generateCustomMutationsProperty(client, apiGraphqlConfig, getInternals);\n }\n return client;\n}\n"],"names":["generateModelsPropertyServer"],"mappings":";;;;;;;;;AAAA;AACA;AAIA;AACO,SAAS,6BAA6B,CAAC,MAAM,EAAE,MAAM,EAAE,YAAY,EAAE;AAC5E,IAAI,MAAM,gBAAgB,GAAG,MAAM,CAAC,MAAM,EAAE,GAAG,EAAE,OAAO,CAAC;AACzD,IAAI,IAAI,kBAAkB,CAAC,gBAAgB,CAAC,EAAE;AAC9C,QAAQ,yBAAyB,CAAC,MAAM,CAAC,CAAC;AAC1C,QAAQ,MAAM,CAAC,MAAM,GAAGA,sBAA4B,CAAC,MAAM,EAAE,MAAM,EAAE,YAAY,CAAC,CAAC;AACnF,QAAQ,MAAM,CAAC,KAAK,GAAG,qBAAqB,CAAC,gBAAgB,CAAC,CAAC;AAC/D,QAAQ,MAAM,CAAC,OAAO,GAAG,6BAA6B,CAAC,MAAM,EAAE,gBAAgB,EAAE,YAAY,CAAC,CAAC;AAC/F,QAAQ,MAAM,CAAC,SAAS,GAAG,+BAA+B,CAAC,MAAM,EAAE,gBAAgB,EAAE,YAAY,CAAC,CAAC;AACnG,KAAK;AACL,IAAI,OAAO,MAAM,CAAC;AAClB;;;;"}
|
|
@@ -10,6 +10,7 @@
|
|
|
10
10
|
*/
|
|
11
11
|
import { Observable } from 'rxjs';
|
|
12
12
|
import { CustomHeaders, ModelSortDirection } from './client';
|
|
13
|
+
import { AiAction, AiCategory } from './internals/ai/getCustomUserAgentDetails';
|
|
13
14
|
export declare namespace AmplifyServer {
|
|
14
15
|
interface ContextToken {
|
|
15
16
|
readonly value: symbol;
|
|
@@ -302,6 +303,10 @@ export type BaseSSRClient = {
|
|
|
302
303
|
cancel(promise: Promise<any>, message?: string): boolean;
|
|
303
304
|
isCancelError(error: any): boolean;
|
|
304
305
|
};
|
|
305
|
-
export
|
|
306
|
+
export interface CustomUserAgentDetails {
|
|
307
|
+
category: AiCategory;
|
|
308
|
+
action: AiAction;
|
|
309
|
+
}
|
|
310
|
+
export type GraphQLMethod = (options: GraphQLOptions, additionalHeaders?: CustomHeaders | undefined, customUserAgentDetails?: CustomUserAgentDetails) => Promise<GraphQLResult> | GraphqlSubscriptionResult;
|
|
306
311
|
export type GraphQLMethodSSR = (contextSpec: AmplifyServer.ContextSpec, options: GraphQLOptions, additionalHeaders?: CustomHeaders | undefined) => Promise<GraphQLResult> | GraphqlSubscriptionResult;
|
|
307
312
|
export {};
|
|
@@ -2,3 +2,4 @@ export * from './client';
|
|
|
2
2
|
export { addSchemaToClient } from './addSchemaToClient';
|
|
3
3
|
export { addSchemaToClientWithInstance } from './addSchemaToClientWithInstance';
|
|
4
4
|
export { BaseClient, ClientInternals } from './bridge-types';
|
|
5
|
+
export { INTERNAL_USER_AGENT_OVERRIDE } from './internals/ai/getCustomUserAgentDetails';
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
export { __modelMeta__ } from '@aws-amplify/data-schema-types';
|
|
2
2
|
export { addSchemaToClient } from './addSchemaToClient.mjs';
|
|
3
3
|
export { addSchemaToClientWithInstance } from './addSchemaToClientWithInstance.mjs';
|
|
4
|
+
export { INTERNAL_USER_AGENT_OVERRIDE } from './internals/ai/getCustomUserAgentDetails.mjs';
|
|
4
5
|
//# sourceMappingURL=index.mjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.mjs","sources":[],"sourcesContent":[],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.mjs","sources":[],"sourcesContent":[],"names":[],"mappings":";;;"}
|
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
import type { ConversationRoute } from '../../../ai/ConversationType';
|
|
2
|
-
import
|
|
2
|
+
import { BaseClient, ClientInternalsGetter, ModelIntrospectionSchema, SchemaModel } from '../../bridge-types';
|
|
3
3
|
export declare const createCreateConversationFunction: (client: BaseClient, modelIntrospection: ModelIntrospectionSchema, conversationRouteName: string, conversationModel: SchemaModel, conversationMessageModel: SchemaModel, getInternals: ClientInternalsGetter) => ConversationRoute['create'];
|
|
@@ -1,10 +1,11 @@
|
|
|
1
1
|
import { getFactory } from '../operations/get.mjs';
|
|
2
2
|
import { convertItemToConversation } from './convertItemToConversation.mjs';
|
|
3
|
+
import { getCustomUserAgentDetails, AiAction } from './getCustomUserAgentDetails.mjs';
|
|
3
4
|
|
|
4
5
|
// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
|
|
5
6
|
// SPDX-License-Identifier: Apache-2.0
|
|
6
7
|
const createCreateConversationFunction = (client, modelIntrospection, conversationRouteName, conversationModel, conversationMessageModel, getInternals) => async () => {
|
|
7
|
-
const get = getFactory(client, modelIntrospection, conversationModel, 'CREATE', getInternals);
|
|
8
|
+
const get = getFactory(client, modelIntrospection, conversationModel, 'CREATE', getInternals, false, getCustomUserAgentDetails(AiAction.CreateConversation));
|
|
8
9
|
const { data, errors } = await get();
|
|
9
10
|
return {
|
|
10
11
|
data: convertItemToConversation(client, modelIntrospection, data?.id, conversationRouteName, conversationMessageModel, getInternals),
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"createCreateConversationFunction.mjs","sources":["../../../../../src/runtime/internals/ai/createCreateConversationFunction.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';\nexport const createCreateConversationFunction = (client, modelIntrospection, conversationRouteName, conversationModel, conversationMessageModel, getInternals) => async () => {\n const get = getFactory(client, modelIntrospection, conversationModel, 'CREATE', getInternals);\n const { data, errors } = await get();\n return {\n data: convertItemToConversation(client, modelIntrospection, data?.id, conversationRouteName, conversationMessageModel, getInternals),\n errors,\n };\n};\n"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"createCreateConversationFunction.mjs","sources":["../../../../../src/runtime/internals/ai/createCreateConversationFunction.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 createCreateConversationFunction = (client, modelIntrospection, conversationRouteName, conversationModel, conversationMessageModel, getInternals) => async () => {\n const get = getFactory(client, modelIntrospection, conversationModel, 'CREATE', getInternals, false, getCustomUserAgentDetails(AiAction.CreateConversation));\n const { data, errors } = await get();\n return {\n data: convertItemToConversation(client, modelIntrospection, data?.id, conversationRouteName, conversationMessageModel, getInternals),\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,YAAY;AAC9K,IAAI,MAAM,GAAG,GAAG,UAAU,CAAC,MAAM,EAAE,kBAAkB,EAAE,iBAAiB,EAAE,QAAQ,EAAE,YAAY,EAAE,KAAK,EAAE,yBAAyB,CAAC,QAAQ,CAAC,kBAAkB,CAAC,CAAC,CAAC;AACjK,IAAI,MAAM,EAAE,IAAI,EAAE,MAAM,EAAE,GAAG,MAAM,GAAG,EAAE,CAAC;AACzC,IAAI,OAAO;AACX,QAAQ,IAAI,EAAE,yBAAyB,CAAC,MAAM,EAAE,kBAAkB,EAAE,IAAI,EAAE,EAAE,EAAE,qBAAqB,EAAE,wBAAwB,EAAE,YAAY,CAAC;AAC5I,QAAQ,MAAM;AACd,KAAK,CAAC;AACN;;;;"}
|
|
@@ -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;;;;"}
|
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
import type { ConversationRoute } from '../../../ai/ConversationType';
|
|
2
|
-
import
|
|
2
|
+
import { BaseClient, ClientInternalsGetter, ModelIntrospectionSchema, SchemaModel } from '../../bridge-types';
|
|
3
3
|
export declare const createGetConversationFunction: (client: BaseClient, modelIntrospection: ModelIntrospectionSchema, conversationRouteName: string, conversationModel: SchemaModel, conversationMessageModel: SchemaModel, getInternals: ClientInternalsGetter) => ConversationRoute['get'];
|
|
@@ -1,10 +1,11 @@
|
|
|
1
1
|
import { getFactory } from '../operations/get.mjs';
|
|
2
2
|
import { convertItemToConversation } from './convertItemToConversation.mjs';
|
|
3
|
+
import { getCustomUserAgentDetails, AiAction } from './getCustomUserAgentDetails.mjs';
|
|
3
4
|
|
|
4
5
|
// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
|
|
5
6
|
// SPDX-License-Identifier: Apache-2.0
|
|
6
7
|
const createGetConversationFunction = (client, modelIntrospection, conversationRouteName, conversationModel, conversationMessageModel, getInternals) => async ({ id }) => {
|
|
7
|
-
const get = getFactory(client, modelIntrospection, conversationModel, 'GET', getInternals);
|
|
8
|
+
const get = getFactory(client, modelIntrospection, conversationModel, 'GET', getInternals, false, getCustomUserAgentDetails(AiAction.GetConversation));
|
|
8
9
|
const { data, errors } = await get({ id });
|
|
9
10
|
return {
|
|
10
11
|
data: data
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"createGetConversationFunction.mjs","sources":["../../../../../src/runtime/internals/ai/createGetConversationFunction.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';\nexport const createGetConversationFunction = (client, modelIntrospection, conversationRouteName, conversationModel, conversationMessageModel, getInternals) => async ({ id }) => {\n const get = getFactory(client, modelIntrospection, conversationModel, 'GET', getInternals);\n const { data, errors } = await get({ id });\n return {\n data: data\n ? convertItemToConversation(client, modelIntrospection, data.id, conversationRouteName, conversationMessageModel, getInternals)\n : data,\n errors,\n };\n};\n"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"createGetConversationFunction.mjs","sources":["../../../../../src/runtime/internals/ai/createGetConversationFunction.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 createGetConversationFunction = (client, modelIntrospection, conversationRouteName, conversationModel, conversationMessageModel, getInternals) => async ({ id }) => {\n const get = getFactory(client, modelIntrospection, conversationModel, 'GET', getInternals, false, getCustomUserAgentDetails(AiAction.GetConversation));\n const { data, errors } = await get({ 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,6BAA6B,GAAG,CAAC,MAAM,EAAE,kBAAkB,EAAE,qBAAqB,EAAE,iBAAiB,EAAE,wBAAwB,EAAE,YAAY,KAAK,OAAO,EAAE,EAAE,EAAE,KAAK;AACjL,IAAI,MAAM,GAAG,GAAG,UAAU,CAAC,MAAM,EAAE,kBAAkB,EAAE,iBAAiB,EAAE,KAAK,EAAE,YAAY,EAAE,KAAK,EAAE,yBAAyB,CAAC,QAAQ,CAAC,eAAe,CAAC,CAAC,CAAC;AAC3J,IAAI,MAAM,EAAE,IAAI,EAAE,MAAM,EAAE,GAAG,MAAM,GAAG,CAAC,EAAE,EAAE,EAAE,CAAC,CAAC;AAC/C,IAAI,OAAO;AACX,QAAQ,IAAI,EAAE,IAAI;AAClB,cAAc,yBAAyB,CAAC,MAAM,EAAE,kBAAkB,EAAE,IAAI,CAAC,EAAE,EAAE,qBAAqB,EAAE,wBAAwB,EAAE,YAAY,CAAC;AAC3I,cAAc,IAAI;AAClB,QAAQ,MAAM;AACd,KAAK,CAAC;AACN;;;;"}
|
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
import type { ConversationRoute } from '../../../ai/ConversationType';
|
|
2
|
-
import
|
|
2
|
+
import { BaseClient, ClientInternalsGetter, ModelIntrospectionSchema, SchemaModel } from '../../bridge-types';
|
|
3
3
|
export declare const createListConversationsFunction: (client: BaseClient, modelIntrospection: ModelIntrospectionSchema, conversationRouteName: string, conversationModel: SchemaModel, conversationMessageModel: SchemaModel, getInternals: ClientInternalsGetter) => ConversationRoute['list'];
|
|
@@ -1,10 +1,11 @@
|
|
|
1
1
|
import { listFactory } from '../operations/list.mjs';
|
|
2
2
|
import { convertItemToConversation } from './convertItemToConversation.mjs';
|
|
3
|
+
import { getCustomUserAgentDetails, AiAction } from './getCustomUserAgentDetails.mjs';
|
|
3
4
|
|
|
4
5
|
// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
|
|
5
6
|
// SPDX-License-Identifier: Apache-2.0
|
|
6
7
|
const createListConversationsFunction = (client, modelIntrospection, conversationRouteName, conversationModel, conversationMessageModel, getInternals) => async (input) => {
|
|
7
|
-
const list = listFactory(client, modelIntrospection, conversationModel, getInternals);
|
|
8
|
+
const list = listFactory(client, modelIntrospection, conversationModel, getInternals, false, getCustomUserAgentDetails(AiAction.ListConversations));
|
|
8
9
|
const { data, nextToken, errors } = await list(input);
|
|
9
10
|
return {
|
|
10
11
|
data: data.map((datum) => {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"createListConversationsFunction.mjs","sources":["../../../../../src/runtime/internals/ai/createListConversationsFunction.ts"],"sourcesContent":["// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\nimport { listFactory } from '../operations/list';\nimport { convertItemToConversation } from './convertItemToConversation';\nexport const createListConversationsFunction = (client, modelIntrospection, conversationRouteName, conversationModel, conversationMessageModel, getInternals) => async (input) => {\n const list = listFactory(client, modelIntrospection, conversationModel, getInternals);\n const { data, nextToken, errors } = await list(input);\n return {\n data: data.map((datum) => {\n return convertItemToConversation(client, modelIntrospection, datum.id, conversationRouteName, conversationMessageModel, getInternals);\n }),\n nextToken,\n errors,\n };\n};\n"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"createListConversationsFunction.mjs","sources":["../../../../../src/runtime/internals/ai/createListConversationsFunction.ts"],"sourcesContent":["// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\nimport { listFactory } from '../operations/list';\nimport { convertItemToConversation } from './convertItemToConversation';\nimport { AiAction, getCustomUserAgentDetails, } from './getCustomUserAgentDetails';\nexport const createListConversationsFunction = (client, modelIntrospection, conversationRouteName, conversationModel, conversationMessageModel, getInternals) => async (input) => {\n const list = listFactory(client, modelIntrospection, conversationModel, getInternals, false, getCustomUserAgentDetails(AiAction.ListConversations));\n const { data, nextToken, errors } = await list(input);\n return {\n data: data.map((datum) => {\n return convertItemToConversation(client, modelIntrospection, datum.id, conversationRouteName, conversationMessageModel, getInternals);\n }),\n nextToken,\n errors,\n };\n};\n"],"names":[],"mappings":";;;;AAAA;AACA;AAIY,MAAC,+BAA+B,GAAG,CAAC,MAAM,EAAE,kBAAkB,EAAE,qBAAqB,EAAE,iBAAiB,EAAE,wBAAwB,EAAE,YAAY,KAAK,OAAO,KAAK,KAAK;AAClL,IAAI,MAAM,IAAI,GAAG,WAAW,CAAC,MAAM,EAAE,kBAAkB,EAAE,iBAAiB,EAAE,YAAY,EAAE,KAAK,EAAE,yBAAyB,CAAC,QAAQ,CAAC,iBAAiB,CAAC,CAAC,CAAC;AACxJ,IAAI,MAAM,EAAE,IAAI,EAAE,SAAS,EAAE,MAAM,EAAE,GAAG,MAAM,IAAI,CAAC,KAAK,CAAC,CAAC;AAC1D,IAAI,OAAO;AACX,QAAQ,IAAI,EAAE,IAAI,CAAC,GAAG,CAAC,CAAC,KAAK,KAAK;AAClC,YAAY,OAAO,yBAAyB,CAAC,MAAM,EAAE,kBAAkB,EAAE,KAAK,CAAC,EAAE,EAAE,qBAAqB,EAAE,wBAAwB,EAAE,YAAY,CAAC,CAAC;AAClJ,SAAS,CAAC;AACV,QAAQ,SAAS;AACjB,QAAQ,MAAM;AACd,KAAK,CAAC;AACN;;;;"}
|
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
import type { Conversation } from '../../../ai/ConversationType';
|
|
2
|
-
import
|
|
2
|
+
import { BaseClient, ClientInternalsGetter, ModelIntrospectionSchema, SchemaModel } from '../../bridge-types';
|
|
3
3
|
export declare const createListMessagesFunction: (client: BaseClient, modelIntrospection: ModelIntrospectionSchema, conversationId: string, conversationMessageModel: SchemaModel, getInternals: ClientInternalsGetter) => Conversation['listMessages'];
|
|
@@ -1,10 +1,11 @@
|
|
|
1
1
|
import { listFactory } from '../operations/list.mjs';
|
|
2
2
|
import { convertItemToConversationMessage } from './convertItemToConversationMessage.mjs';
|
|
3
|
+
import { getCustomUserAgentDetails, AiAction } from './getCustomUserAgentDetails.mjs';
|
|
3
4
|
|
|
4
5
|
// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
|
|
5
6
|
// SPDX-License-Identifier: Apache-2.0
|
|
6
7
|
const createListMessagesFunction = (client, modelIntrospection, conversationId, conversationMessageModel, getInternals) => async (input) => {
|
|
7
|
-
const list = listFactory(client, modelIntrospection, conversationMessageModel, getInternals);
|
|
8
|
+
const list = listFactory(client, modelIntrospection, conversationMessageModel, getInternals, false, getCustomUserAgentDetails(AiAction.ListMessages));
|
|
8
9
|
const { data, nextToken, errors } = await list({
|
|
9
10
|
...input,
|
|
10
11
|
filter: { conversationId: { eq: conversationId } },
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"createListMessagesFunction.mjs","sources":["../../../../../src/runtime/internals/ai/createListMessagesFunction.ts"],"sourcesContent":["// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\nimport { listFactory } from '../operations/list';\nimport { convertItemToConversationMessage } from './convertItemToConversationMessage';\nexport const createListMessagesFunction = (client, modelIntrospection, conversationId, conversationMessageModel, getInternals) => async (input) => {\n const list = listFactory(client, modelIntrospection, conversationMessageModel, getInternals);\n const { data, nextToken, errors } = await list({\n ...input,\n filter: { conversationId: { eq: conversationId } },\n });\n return {\n data: data.map((item) => convertItemToConversationMessage(item)),\n nextToken,\n errors,\n };\n};\n"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"createListMessagesFunction.mjs","sources":["../../../../../src/runtime/internals/ai/createListMessagesFunction.ts"],"sourcesContent":["// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\nimport { listFactory } from '../operations/list';\nimport { convertItemToConversationMessage } from './convertItemToConversationMessage';\nimport { AiAction, getCustomUserAgentDetails, } from './getCustomUserAgentDetails';\nexport const createListMessagesFunction = (client, modelIntrospection, conversationId, conversationMessageModel, getInternals) => async (input) => {\n const list = listFactory(client, modelIntrospection, conversationMessageModel, getInternals, false, getCustomUserAgentDetails(AiAction.ListMessages));\n const { data, nextToken, errors } = await list({\n ...input,\n filter: { conversationId: { eq: conversationId } },\n });\n return {\n data: data.map((item) => convertItemToConversationMessage(item)),\n nextToken,\n errors,\n };\n};\n"],"names":[],"mappings":";;;;AAAA;AACA;AAIY,MAAC,0BAA0B,GAAG,CAAC,MAAM,EAAE,kBAAkB,EAAE,cAAc,EAAE,wBAAwB,EAAE,YAAY,KAAK,OAAO,KAAK,KAAK;AACnJ,IAAI,MAAM,IAAI,GAAG,WAAW,CAAC,MAAM,EAAE,kBAAkB,EAAE,wBAAwB,EAAE,YAAY,EAAE,KAAK,EAAE,yBAAyB,CAAC,QAAQ,CAAC,YAAY,CAAC,CAAC,CAAC;AAC1J,IAAI,MAAM,EAAE,IAAI,EAAE,SAAS,EAAE,MAAM,EAAE,GAAG,MAAM,IAAI,CAAC;AACnD,QAAQ,GAAG,KAAK;AAChB,QAAQ,MAAM,EAAE,EAAE,cAAc,EAAE,EAAE,EAAE,EAAE,cAAc,EAAE,EAAE;AAC1D,KAAK,CAAC,CAAC;AACP,IAAI,OAAO;AACX,QAAQ,IAAI,EAAE,IAAI,CAAC,GAAG,CAAC,CAAC,IAAI,KAAK,gCAAgC,CAAC,IAAI,CAAC,CAAC;AACxE,QAAQ,SAAS;AACjB,QAAQ,MAAM;AACd,KAAK,CAAC;AACN;;;;"}
|
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
import type { Conversation } from '../../../ai/ConversationType';
|
|
2
|
-
import
|
|
2
|
+
import { BaseClient, ClientInternalsGetter, ModelIntrospectionSchema } from '../../bridge-types';
|
|
3
3
|
export declare const createOnMessageFunction: (client: BaseClient, modelIntrospection: ModelIntrospectionSchema, conversationId: string, conversationRouteName: string, getInternals: ClientInternalsGetter) => Conversation['onMessage'];
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { customOpFactory } from '../operations/custom.mjs';
|
|
2
2
|
import { convertItemToConversationMessage } from './convertItemToConversationMessage.mjs';
|
|
3
|
+
import { getCustomUserAgentDetails, AiAction } from './getCustomUserAgentDetails.mjs';
|
|
3
4
|
|
|
4
5
|
// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
|
|
5
6
|
// SPDX-License-Identifier: Apache-2.0
|
|
@@ -10,7 +11,7 @@ const createOnMessageFunction = (client, modelIntrospection, conversationId, con
|
|
|
10
11
|
return {};
|
|
11
12
|
}
|
|
12
13
|
const subscribeSchema = conversations[conversationRouteName].message.subscribe;
|
|
13
|
-
const subscribeOperation = customOpFactory(client, modelIntrospection, 'subscription', subscribeSchema, false, getInternals);
|
|
14
|
+
const subscribeOperation = customOpFactory(client, modelIntrospection, 'subscription', subscribeSchema, false, getInternals, getCustomUserAgentDetails(AiAction.OnMessage));
|
|
14
15
|
return subscribeOperation({ conversationId }).subscribe((data) => {
|
|
15
16
|
handler(convertItemToConversationMessage(data));
|
|
16
17
|
});
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"createOnMessageFunction.mjs","sources":["../../../../../src/runtime/internals/ai/createOnMessageFunction.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';\nexport const createOnMessageFunction = (client, modelIntrospection, conversationId, conversationRouteName, getInternals) => (handler) => {\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 subscribeSchema = conversations[conversationRouteName].message.subscribe;\n const subscribeOperation = customOpFactory(client, modelIntrospection, 'subscription', subscribeSchema, false, getInternals);\n return subscribeOperation({ conversationId }).subscribe((data) => {\n handler(convertItemToConversationMessage(data));\n });\n};\n"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"createOnMessageFunction.mjs","sources":["../../../../../src/runtime/internals/ai/createOnMessageFunction.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 { AiAction, getCustomUserAgentDetails } from './getCustomUserAgentDetails';\nexport const createOnMessageFunction = (client, modelIntrospection, conversationId, conversationRouteName, getInternals) => (handler) => {\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 subscribeSchema = conversations[conversationRouteName].message.subscribe;\n const subscribeOperation = customOpFactory(client, modelIntrospection, 'subscription', subscribeSchema, false, getInternals, getCustomUserAgentDetails(AiAction.OnMessage));\n return subscribeOperation({ conversationId }).subscribe((data) => {\n handler(convertItemToConversationMessage(data));\n });\n};\n"],"names":[],"mappings":";;;;AAAA;AACA;AAIY,MAAC,uBAAuB,GAAG,CAAC,MAAM,EAAE,kBAAkB,EAAE,cAAc,EAAE,qBAAqB,EAAE,YAAY,KAAK,CAAC,OAAO,KAAK;AACzI,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,eAAe,GAAG,aAAa,CAAC,qBAAqB,CAAC,CAAC,OAAO,CAAC,SAAS,CAAC;AACnF,IAAI,MAAM,kBAAkB,GAAG,eAAe,CAAC,MAAM,EAAE,kBAAkB,EAAE,cAAc,EAAE,eAAe,EAAE,KAAK,EAAE,YAAY,EAAE,yBAAyB,CAAC,QAAQ,CAAC,SAAS,CAAC,CAAC,CAAC;AAChL,IAAI,OAAO,kBAAkB,CAAC,EAAE,cAAc,EAAE,CAAC,CAAC,SAAS,CAAC,CAAC,IAAI,KAAK;AACtE,QAAQ,OAAO,CAAC,gCAAgC,CAAC,IAAI,CAAC,CAAC,CAAC;AACxD,KAAK,CAAC,CAAC;AACP;;;;"}
|
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
import type { Conversation } from '../../../ai/ConversationType';
|
|
2
|
-
import
|
|
2
|
+
import { BaseClient, ClientInternalsGetter, ModelIntrospectionSchema } from '../../bridge-types';
|
|
3
3
|
export declare const createSendMessageFunction: (client: BaseClient, modelIntrospection: ModelIntrospectionSchema, conversationId: string, conversationRouteName: string, getInternals: ClientInternalsGetter) => Conversation['sendMessage'];
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { customOpFactory } from '../operations/custom.mjs';
|
|
2
2
|
import { convertItemToConversationMessage } from './convertItemToConversationMessage.mjs';
|
|
3
3
|
import { serializeContent, serializeAiContext, serializeToolConfiguration } from './conversationMessageSerializers.mjs';
|
|
4
|
+
import { getCustomUserAgentDetails, AiAction } from './getCustomUserAgentDetails.mjs';
|
|
4
5
|
|
|
5
6
|
// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
|
|
6
7
|
// SPDX-License-Identifier: Apache-2.0
|
|
@@ -11,7 +12,7 @@ const createSendMessageFunction = (client, modelIntrospection, conversationId, c
|
|
|
11
12
|
return {};
|
|
12
13
|
}
|
|
13
14
|
const sendSchema = conversations[conversationRouteName].message.send;
|
|
14
|
-
const sendOperation = customOpFactory(client, modelIntrospection, 'mutation', sendSchema, false, getInternals);
|
|
15
|
+
const sendOperation = customOpFactory(client, modelIntrospection, 'mutation', sendSchema, false, getInternals, getCustomUserAgentDetails(AiAction.SendMessage));
|
|
15
16
|
const { data, errors } = await sendOperation({
|
|
16
17
|
conversationId,
|
|
17
18
|
content: serializeContent(content),
|
|
@@ -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';\nexport const createSendMessageFunction = (client, modelIntrospection, conversationId, conversationRouteName, getInternals) => async ({ aiContext, content, toolConfiguration }) => {\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 sendSchema = conversations[conversationRouteName].message.send;\n const sendOperation = customOpFactory(client, modelIntrospection, 'mutation', sendSchema, false, getInternals);\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":"
|
|
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 ({ aiContext, content, toolConfiguration }) => {\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 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,EAAE,SAAS,EAAE,OAAO,EAAE,iBAAiB,EAAE,KAAK;AACnL,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,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;;;;"}
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import { CustomUserAgentDetails } from '../../bridge-types';
|
|
2
|
+
/**
|
|
3
|
+
* Symbol used for internal user agent overrides.
|
|
4
|
+
*
|
|
5
|
+
* @internal
|
|
6
|
+
* This symbol is intended for internal use within the Amplify library.
|
|
7
|
+
* It may change or be removed in future versions without notice.
|
|
8
|
+
* External usage of this symbol is discouraged and may lead to unexpected behavior.
|
|
9
|
+
*/
|
|
10
|
+
export declare const INTERNAL_USER_AGENT_OVERRIDE: unique symbol;
|
|
11
|
+
export type AiCategory = 'ai';
|
|
12
|
+
export declare enum AiAction {
|
|
13
|
+
CreateConversation = "1",
|
|
14
|
+
GetConversation = "2",
|
|
15
|
+
ListConversations = "3",
|
|
16
|
+
DeleteConversation = "4",
|
|
17
|
+
SendMessage = "5",
|
|
18
|
+
ListMessages = "6",
|
|
19
|
+
OnMessage = "7",
|
|
20
|
+
Generation = "8"
|
|
21
|
+
}
|
|
22
|
+
export declare const getCustomUserAgentDetails: (action: AiAction) => CustomUserAgentDetails;
|
|
23
|
+
/**
|
|
24
|
+
* Creates a user agent override object based on custom details.
|
|
25
|
+
*
|
|
26
|
+
* @internal
|
|
27
|
+
* This function is intended for internal use within the Amplify library.
|
|
28
|
+
* It may change or be removed in future versions without notice.
|
|
29
|
+
*
|
|
30
|
+
* @param customUserAgentDetails - Optional custom user agent details
|
|
31
|
+
* @returns An object with INTERNAL_USER_AGENT_OVERRIDE symbol as key and customUserAgentDetails as value, or undefined if no details provided
|
|
32
|
+
*/
|
|
33
|
+
export declare function createUserAgentOverride(customUserAgentDetails?: CustomUserAgentDetails): {
|
|
34
|
+
[INTERNAL_USER_AGENT_OVERRIDE]?: CustomUserAgentDetails;
|
|
35
|
+
} | undefined;
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
|
|
2
|
+
// SPDX-License-Identifier: Apache-2.0
|
|
3
|
+
/**
|
|
4
|
+
* Symbol used for internal user agent overrides.
|
|
5
|
+
*
|
|
6
|
+
* @internal
|
|
7
|
+
* This symbol is intended for internal use within the Amplify library.
|
|
8
|
+
* It may change or be removed in future versions without notice.
|
|
9
|
+
* External usage of this symbol is discouraged and may lead to unexpected behavior.
|
|
10
|
+
*/
|
|
11
|
+
const INTERNAL_USER_AGENT_OVERRIDE = Symbol('INTERNAL_USER_AGENT_OVERRIDE');
|
|
12
|
+
var AiAction;
|
|
13
|
+
(function (AiAction) {
|
|
14
|
+
AiAction["CreateConversation"] = "1";
|
|
15
|
+
AiAction["GetConversation"] = "2";
|
|
16
|
+
AiAction["ListConversations"] = "3";
|
|
17
|
+
AiAction["DeleteConversation"] = "4";
|
|
18
|
+
AiAction["SendMessage"] = "5";
|
|
19
|
+
AiAction["ListMessages"] = "6";
|
|
20
|
+
AiAction["OnMessage"] = "7";
|
|
21
|
+
AiAction["Generation"] = "8";
|
|
22
|
+
})(AiAction || (AiAction = {}));
|
|
23
|
+
const getCustomUserAgentDetails = (action) => ({
|
|
24
|
+
category: 'ai',
|
|
25
|
+
action,
|
|
26
|
+
});
|
|
27
|
+
/**
|
|
28
|
+
* Creates a user agent override object based on custom details.
|
|
29
|
+
*
|
|
30
|
+
* @internal
|
|
31
|
+
* This function is intended for internal use within the Amplify library.
|
|
32
|
+
* It may change or be removed in future versions without notice.
|
|
33
|
+
*
|
|
34
|
+
* @param customUserAgentDetails - Optional custom user agent details
|
|
35
|
+
* @returns An object with INTERNAL_USER_AGENT_OVERRIDE symbol as key and customUserAgentDetails as value, or undefined if no details provided
|
|
36
|
+
*/
|
|
37
|
+
function createUserAgentOverride(customUserAgentDetails) {
|
|
38
|
+
return customUserAgentDetails
|
|
39
|
+
? { [INTERNAL_USER_AGENT_OVERRIDE]: customUserAgentDetails }
|
|
40
|
+
: undefined;
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
export { AiAction, INTERNAL_USER_AGENT_OVERRIDE, createUserAgentOverride, getCustomUserAgentDetails };
|
|
44
|
+
//# sourceMappingURL=getCustomUserAgentDetails.mjs.map
|
|
@@ -0,0 +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;;;;"}
|