@aws-amplify/data-schema 1.6.1 → 1.6.3
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/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/clientUtils.js +5 -0
- package/dist/cjs/runtime/internals/clientUtils.js.map +1 -1
- 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/generateGenerationsProperty.js +2 -1
- package/dist/cjs/runtime/internals/utils/clientProperties/generateGenerationsProperty.js.map +1 -1
- 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/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/clientUtils.mjs +5 -0
- package/dist/esm/runtime/internals/clientUtils.mjs.map +1 -1
- 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/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/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/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/clientUtils.ts +6 -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/generateGenerationsProperty.ts +5 -0
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"get.js","sources":["../../../../../src/runtime/internals/operations/get.ts"],"sourcesContent":["\"use strict\";\nObject.defineProperty(exports, \"__esModule\", { value: true });\nexports.getFactory = void 0;\nconst APIClient_1 = require(\"../APIClient\");\nconst utils_1 = require(\"./utils\");\nconst utils_2 = require(\"../../utils\");\nconst cancellation_1 = require(\"../cancellation\");\nfunction getFactory(client, modelIntrospection, model, operation, getInternals, useContext = false) {\n const getWithContext = (contextSpec, arg, options) => {\n return _get(client, modelIntrospection, model, arg, options, operation, getInternals, contextSpec);\n };\n const get = (arg, options) => {\n return _get(client, modelIntrospection, model, arg, options, operation, getInternals);\n };\n return useContext ? getWithContext : get;\n}\nexports.getFactory = getFactory;\nfunction _get(client, modelIntrospection, model, arg, options, operation, getInternals, context) {\n return (0, utils_2.selfAwareAsync)(async (resultPromise) => {\n const { name } = model;\n const query = (0, APIClient_1.generateGraphQLDocument)(modelIntrospection, name, operation, options);\n const variables = (0, APIClient_1.buildGraphQLVariables)(model, operation, arg, modelIntrospection);\n const auth = (0, APIClient_1.authModeParams)(client, getInternals, options);\n
|
|
1
|
+
{"version":3,"file":"get.js","sources":["../../../../../src/runtime/internals/operations/get.ts"],"sourcesContent":["\"use strict\";\nObject.defineProperty(exports, \"__esModule\", { value: true });\nexports.getFactory = 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 getFactory(client, modelIntrospection, model, operation, getInternals, useContext = false, customUserAgentDetails) {\n const getWithContext = (contextSpec, arg, options) => {\n return _get(client, modelIntrospection, model, arg, options, operation, getInternals, contextSpec, customUserAgentDetails);\n };\n const get = (arg, options) => {\n return _get(client, modelIntrospection, model, arg, options, operation, getInternals, undefined, customUserAgentDetails);\n };\n return useContext ? getWithContext : get;\n}\nexports.getFactory = getFactory;\nfunction _get(client, modelIntrospection, model, arg, options, operation, getInternals, context, customUserAgentDetails) {\n return (0, utils_2.selfAwareAsync)(async (resultPromise) => {\n const { name } = model;\n const query = (0, APIClient_1.generateGraphQLDocument)(modelIntrospection, name, operation, options);\n const variables = (0, APIClient_1.buildGraphQLVariables)(model, operation, arg, modelIntrospection);\n const auth = (0, APIClient_1.authModeParams)(client, getInternals, options);\n const headers = (0, APIClient_1.getCustomHeaders)(client, getInternals, options?.headers);\n const userAgentOverride = (0, getCustomUserAgentDetails_1.createUserAgentOverride)(customUserAgentDetails);\n try {\n const basePromise = context\n ? client.graphql(context, {\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) {\n const [key] = Object.keys(data);\n const flattenedResult = (0, APIClient_1.flattenItems)(modelIntrospection, name, data[key]);\n if (flattenedResult === null) {\n return { data: null, extensions };\n }\n else if (options?.selectionSet) {\n return { data: flattenedResult, extensions };\n }\n else {\n // TODO: refactor to avoid destructuring here\n const [initialized] = (0, APIClient_1.initializeModel)(client, name, [flattenedResult], modelIntrospection, auth.authMode, auth.authToken, !!context);\n return { data: initialized, extensions };\n }\n }\n else {\n return { data: null, extensions };\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 `{ getPost: null }`\n * 4) an actual record `{ getPost: { id: '1', title: 'Hello, World!' } }`\n */\n const { data, errors } = error;\n /**\n * `data` is not `null`, and is not an empty object:\n */\n if (data && Object.keys(data).length !== 0 && errors) {\n const [key] = Object.keys(data);\n const flattenedResult = (0, APIClient_1.flattenItems)(modelIntrospection, name, data[key]);\n /**\n * `flattenedResult` could be `null` here (e.g. `data: { getPost: null }`)\n * if `flattenedResult`, result is an actual record:\n */\n if (flattenedResult) {\n if (options?.selectionSet) {\n return { data: flattenedResult, errors };\n }\n else {\n // TODO: refactor to avoid destructuring here\n const [initialized] = (0, APIClient_1.initializeModel)(client, name, [flattenedResult], modelIntrospection, auth.authMode, auth.authToken, !!context);\n return { data: initialized, errors };\n }\n }\n else {\n // was `data: { getPost: null }`)\n return (0, utils_1.handleSingularGraphQlError)(error);\n }\n }\n else {\n // `data` is `null`:\n return (0, utils_1.handleSingularGraphQlError)(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,UAAU,GAAG,KAAK,CAAC,CAAC;AAC5B,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,UAAU,CAAC,MAAM,EAAE,kBAAkB,EAAE,KAAK,EAAE,SAAS,EAAE,YAAY,EAAE,UAAU,GAAG,KAAK,EAAE,sBAAsB,EAAE;AAC5H,IAAI,MAAM,cAAc,GAAG,CAAC,WAAW,EAAE,GAAG,EAAE,OAAO,KAAK;AAC1D,QAAQ,OAAO,IAAI,CAAC,MAAM,EAAE,kBAAkB,EAAE,KAAK,EAAE,GAAG,EAAE,OAAO,EAAE,SAAS,EAAE,YAAY,EAAE,WAAW,EAAE,sBAAsB,CAAC,CAAC;AACnI,KAAK,CAAC;AACN,IAAI,MAAM,GAAG,GAAG,CAAC,GAAG,EAAE,OAAO,KAAK;AAClC,QAAQ,OAAO,IAAI,CAAC,MAAM,EAAE,kBAAkB,EAAE,KAAK,EAAE,GAAG,EAAE,OAAO,EAAE,SAAS,EAAE,YAAY,EAAE,SAAS,EAAE,sBAAsB,CAAC,CAAC;AACjI,KAAK,CAAC;AACN,IAAI,OAAO,UAAU,GAAG,cAAc,GAAG,GAAG,CAAC;AAC7C,CAAC;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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,WA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AgB,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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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;;"}
|
|
@@ -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;;"}
|
|
@@ -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;;;;"}
|
|
@@ -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
|
+
SendMessage = "4",
|
|
17
|
+
ListMessages = "5",
|
|
18
|
+
OnMessage = "6",
|
|
19
|
+
Generation = "7",
|
|
20
|
+
Delete = "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["SendMessage"] = "4";
|
|
18
|
+
AiAction["ListMessages"] = "5";
|
|
19
|
+
AiAction["OnMessage"] = "6";
|
|
20
|
+
AiAction["Generation"] = "7";
|
|
21
|
+
AiAction["Delete"] = "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[\"SendMessage\"] = \"4\";\n AiAction[\"ListMessages\"] = \"5\";\n AiAction[\"OnMessage\"] = \"6\";\n AiAction[\"Generation\"] = \"7\";\n AiAction[\"Delete\"] = \"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,aAAa,CAAC,GAAG,GAAG,CAAC;AAClC,IAAI,QAAQ,CAAC,cAAc,CAAC,GAAG,GAAG,CAAC;AACnC,IAAI,QAAQ,CAAC,WAAW,CAAC,GAAG,GAAG,CAAC;AAChC,IAAI,QAAQ,CAAC,YAAY,CAAC,GAAG,GAAG,CAAC;AACjC,IAAI,QAAQ,CAAC,QAAQ,CAAC,GAAG,GAAG,CAAC;AAC7B,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;;;;"}
|
|
@@ -30,6 +30,7 @@ const excludeDisabledOps = (mis, modelName) => {
|
|
|
30
30
|
"properties": {
|
|
31
31
|
"subscriptions": null,
|
|
32
32
|
"mutations": { "delete": null }
|
|
33
|
+
"timestamps": null
|
|
33
34
|
} }*/
|
|
34
35
|
const modelAttrs = mis.models[modelName].attributes?.find((attr) => attr.type === 'model');
|
|
35
36
|
const coarseToFineDict = {
|
|
@@ -43,6 +44,10 @@ const excludeDisabledOps = (mis, modelName) => {
|
|
|
43
44
|
}
|
|
44
45
|
if (modelAttrs.properties) {
|
|
45
46
|
for (const [key, value] of Object.entries(modelAttrs.properties)) {
|
|
47
|
+
// model.properties can contain other values that are not relevant to disabling ops, e.g. timestamps
|
|
48
|
+
if (!(key in coarseToFineDict)) {
|
|
49
|
+
continue;
|
|
50
|
+
}
|
|
46
51
|
if (value === null) {
|
|
47
52
|
// coarse-grained disable, e.g. "subscriptions": null,
|
|
48
53
|
disabledOps.push(...coarseToFineDict[key]);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"clientUtils.mjs","sources":["../../../../src/runtime/internals/clientUtils.ts"],"sourcesContent":["import { graphQLOperationsInfo } from './APIClient';\nconst attributeIsSecondaryIndex = (attr) => {\n return (attr.type === 'key' &&\n // presence of `name` property distinguishes GSI from primary index\n attr.properties?.name &&\n attr.properties?.queryField &&\n attr.properties?.fields.length > 0);\n};\nexport const getSecondaryIndexesFromSchemaModel = (model) => {\n const idxs = model.attributes\n ?.filter(attributeIsSecondaryIndex)\n .map((attr) => {\n const queryField = attr.properties.queryField;\n const [pk, ...sk] = attr.properties.fields;\n return {\n queryField,\n pk,\n sk,\n };\n });\n return idxs || [];\n};\n/**\n * returns graphQLOperationsInfo, but filters out operations that were disabled via model().disableOperations([...])\n */\nexport const excludeDisabledOps = (mis, modelName) => {\n /* Example model attributes in MIS {\n \"type\": \"model\",\n \"properties\": {\n \"subscriptions\": null,\n \"mutations\": { \"delete\": null }\n } }*/\n const modelAttrs = mis.models[modelName].attributes?.find((attr) => attr.type === 'model');\n const coarseToFineDict = {\n queries: ['list', 'get', 'observeQuery'],\n mutations: ['create', 'update', 'delete'],\n subscriptions: ['onCreate', 'onUpdate', 'onDelete'],\n };\n const disabledOps = [];\n if (!modelAttrs) {\n return graphQLOperationsInfo;\n }\n if (modelAttrs.properties) {\n for (const [key, value] of Object.entries(modelAttrs.properties)) {\n if (value === null) {\n // coarse-grained disable, e.g. \"subscriptions\": null,\n disabledOps.push(...coarseToFineDict[key]);\n }\n else if (value instanceof Object) {\n // fine-grained, e.g. \"mutations\": { \"delete\": null }\n disabledOps.push(...Object.keys(value));\n }\n }\n }\n // observeQuery only exists on the client side, so can't be explicitly disabled via schema builder.\n // It's unusable without `list`\n if (disabledOps.includes('list')) {\n disabledOps.push('observeQuery');\n }\n // graphQLOperationsInfo keys are in caps\n const disabledOpsUpper = disabledOps.map((op) => op.toUpperCase());\n const filteredGraphQLOperations = Object.fromEntries(Object.entries(graphQLOperationsInfo).filter(([key]) => !disabledOpsUpper.includes(key)));\n return filteredGraphQLOperations;\n};\n"],"names":[],"mappings":";;AACA,MAAM,yBAAyB,GAAG,CAAC,IAAI,KAAK;AAC5C,IAAI,QAAQ,IAAI,CAAC,IAAI,KAAK,KAAK;AAC/B;AACA,QAAQ,IAAI,CAAC,UAAU,EAAE,IAAI;AAC7B,QAAQ,IAAI,CAAC,UAAU,EAAE,UAAU;AACnC,QAAQ,IAAI,CAAC,UAAU,EAAE,MAAM,CAAC,MAAM,GAAG,CAAC,EAAE;AAC5C,CAAC,CAAC;AACU,MAAC,kCAAkC,GAAG,CAAC,KAAK,KAAK;AAC7D,IAAI,MAAM,IAAI,GAAG,KAAK,CAAC,UAAU;AACjC,UAAU,MAAM,CAAC,yBAAyB,CAAC;AAC3C,SAAS,GAAG,CAAC,CAAC,IAAI,KAAK;AACvB,QAAQ,MAAM,UAAU,GAAG,IAAI,CAAC,UAAU,CAAC,UAAU,CAAC;AACtD,QAAQ,MAAM,CAAC,EAAE,EAAE,GAAG,EAAE,CAAC,GAAG,IAAI,CAAC,UAAU,CAAC,MAAM,CAAC;AACnD,QAAQ,OAAO;AACf,YAAY,UAAU;AACtB,YAAY,EAAE;AACd,YAAY,EAAE;AACd,SAAS,CAAC;AACV,KAAK,CAAC,CAAC;AACP,IAAI,OAAO,IAAI,IAAI,EAAE,CAAC;AACtB,EAAE;AACF;AACA;AACA;AACY,MAAC,kBAAkB,GAAG,CAAC,GAAG,EAAE,SAAS,KAAK;AACtD;AACA;AACA;AACA;AACA;AACA;AACA,IAAI,MAAM,UAAU,GAAG,GAAG,CAAC,MAAM,CAAC,S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yBAAyB,GAAG,MAAM,CAAC,WAAW,CAAC,MAAM,CAAC,OAAO,CAAC,qBAAqB,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,GAAG,CAAC,KAAK,CAAC,gBAAgB,CAAC,QAAQ,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC;AACnJ,IAAI,OAAO,yBAAyB,CAAC;AACrC;;;;"}
|
|
1
|
+
{"version":3,"file":"clientUtils.mjs","sources":["../../../../src/runtime/internals/clientUtils.ts"],"sourcesContent":["import { graphQLOperationsInfo } from './APIClient';\nconst attributeIsSecondaryIndex = (attr) => {\n return (attr.type === 'key' &&\n // presence of `name` property distinguishes GSI from primary index\n attr.properties?.name &&\n attr.properties?.queryField &&\n attr.properties?.fields.length > 0);\n};\nexport const getSecondaryIndexesFromSchemaModel = (model) => {\n const idxs = model.attributes\n ?.filter(attributeIsSecondaryIndex)\n .map((attr) => {\n const queryField = attr.properties.queryField;\n const [pk, ...sk] = attr.properties.fields;\n return {\n queryField,\n pk,\n sk,\n };\n });\n return idxs || [];\n};\n/**\n * returns graphQLOperationsInfo, but filters out operations that were disabled via model().disableOperations([...])\n */\nexport const excludeDisabledOps = (mis, modelName) => {\n /* Example model attributes in MIS {\n \"type\": \"model\",\n \"properties\": {\n \"subscriptions\": null,\n \"mutations\": { \"delete\": null }\n \"timestamps\": null\n } }*/\n const modelAttrs = mis.models[modelName].attributes?.find((attr) => attr.type === 'model');\n const coarseToFineDict = {\n queries: ['list', 'get', 'observeQuery'],\n mutations: ['create', 'update', 'delete'],\n subscriptions: ['onCreate', 'onUpdate', 'onDelete'],\n };\n const disabledOps = [];\n if (!modelAttrs) {\n return graphQLOperationsInfo;\n }\n if (modelAttrs.properties) {\n for (const [key, value] of Object.entries(modelAttrs.properties)) {\n // model.properties can contain other values that are not relevant to disabling ops, e.g. timestamps\n if (!(key in coarseToFineDict)) {\n continue;\n }\n if (value === null) {\n // coarse-grained disable, e.g. \"subscriptions\": null,\n disabledOps.push(...coarseToFineDict[key]);\n }\n else if (value instanceof Object) {\n // fine-grained, e.g. \"mutations\": { \"delete\": null }\n disabledOps.push(...Object.keys(value));\n }\n }\n }\n // observeQuery only exists on the client side, so can't be explicitly disabled via schema builder.\n // It's unusable without `list`\n if (disabledOps.includes('list')) {\n disabledOps.push('observeQuery');\n }\n // graphQLOperationsInfo keys are in caps\n const disabledOpsUpper = disabledOps.map((op) => op.toUpperCase());\n const filteredGraphQLOperations = Object.fromEntries(Object.entries(graphQLOperationsInfo).filter(([key]) => !disabledOpsUpper.includes(key)));\n return filteredGraphQLOperations;\n};\n"],"names":[],"mappings":";;AACA,MAAM,yBAAyB,GAAG,CAAC,IAAI,KAAK;AAC5C,IAAI,QAAQ,IAAI,CAAC,IAAI,KAAK,KAAK;AAC/B;AACA,QAAQ,IAAI,CAAC,UAAU,EAAE,IAAI;AAC7B,QAAQ,IAAI,CAAC,UAAU,EAAE,UAAU;AACnC,QAAQ,IAAI,CAAC,UAAU,EAAE,MAAM,CAAC,MAAM,GAAG,CAAC,EAAE;AAC5C,CAAC,CAAC;AACU,MAAC,kCAAkC,GAAG,CAAC,KAAK,KAAK;AAC7D,IAAI,MAAM,IAAI,GAAG,KAAK,CAAC,UAAU;AACjC,UAAU,MAAM,CAAC,yBAAyB,CAAC;AAC3C,SAAS,GAAG,CAAC,CAAC,IAAI,KAAK;AACvB,QAAQ,MAAM,UAAU,GAAG,IAAI,CAAC,UAAU,CAAC,UAAU,CAAC;AACtD,QAAQ,MAAM,CAAC,EAAE,EAAE,GAAG,EAAE,CAAC,GAAG,IAAI,CAAC,UAAU,CAAC,MAAM,CAAC;AACnD,QAAQ,OAAO;AACf,YAAY,UAAU;AACtB,YAAY,EAAE;AACd,YAAY,EAAE;AACd,SAAS,CAAC;AACV,KAAK,CAAC,CAAC;AACP,IAAI,OAAO,IAAI,IAAI,EAAE,CAAC;AACtB,EAAE;AACF;AACA;AACA;AACY,MAAC,kBAAkB,GAAG,CAAC,GAAG,EAAE,SAAS,KAAK;AAC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CAAC,IAAI,CAAC,cAAc,CAAC,CAAC;AACzC,KAAK;AACL;AACA,IAAI,MAAM,gBAAgB,GAAG,WAAW,CAAC,GAAG,CAAC,CAAC,EAAE,KAAK,EAAE,CAAC,WAAW,EAAE,CAAC,CAAC;AACvE,IAAI,MAAM,yBAAyB,GAAG,MAAM,CAAC,WAAW,CAAC,MAAM,CAAC,OAAO,CAAC,qBAAqB,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,GAAG,CAAC,KAAK,CAAC,gBAAgB,CAAC,QAAQ,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC;AACnJ,IAAI,OAAO,yBAAyB,CAAC;AACrC;;;;"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { AuthModeParams, AmplifyServer, BaseClient, ClientInternalsGetter, CustomOperation, ListArgs, QueryArgs, ModelIntrospectionSchema } from '../../bridge-types';
|
|
1
|
+
import { AuthModeParams, AmplifyServer, BaseClient, ClientInternalsGetter, CustomOperation, ListArgs, QueryArgs, ModelIntrospectionSchema, CustomUserAgentDetails } from '../../bridge-types';
|
|
2
2
|
type CustomOperationOptions = AuthModeParams & ListArgs;
|
|
3
3
|
type OpArgs = [AmplifyServer.ContextSpec, QueryArgs, CustomOperationOptions] | [AmplifyServer.ContextSpec, CustomOperationOptions] | [QueryArgs, CustomOperationOptions] | [CustomOperationOptions];
|
|
4
4
|
/**
|
|
@@ -57,5 +57,5 @@ type OpArgs = [AmplifyServer.ContextSpec, QueryArgs, CustomOperationOptions] | [
|
|
|
57
57
|
* @param useContext Whether the function needs to accept an SSR context.
|
|
58
58
|
* @returns The operation function to attach to query, mutations, etc.
|
|
59
59
|
*/
|
|
60
|
-
export declare function customOpFactory(client: BaseClient, modelIntrospection: ModelIntrospectionSchema, operationType: 'query' | 'mutation' | 'subscription', operation: CustomOperation, useContext: boolean, getInternals: ClientInternalsGetter): (...args: OpArgs) => import("rxjs").Observable<any> | Promise<unknown>;
|
|
60
|
+
export declare function customOpFactory(client: BaseClient, modelIntrospection: ModelIntrospectionSchema, operationType: 'query' | 'mutation' | 'subscription', operation: CustomOperation, useContext: boolean, getInternals: ClientInternalsGetter, customUserAgentDetails?: CustomUserAgentDetails): (...args: OpArgs) => import("rxjs").Observable<any> | Promise<unknown>;
|
|
61
61
|
export {};
|