@aws-amplify/graphql-api-construct 1.13.0-ai.2 → 1.13.0-ai.4
Sign up to get free protection for your applications and to get access to all the features.
- package/.jsii +19 -19
- package/CHANGELOG.md +8 -0
- package/lib/amplify-dynamodb-table-wrapper.js +1 -1
- package/lib/amplify-graphql-api.js +1 -1
- package/lib/amplify-graphql-definition.js +1 -1
- package/lib/sql-model-datasource-strategy.js +1 -1
- package/node_modules/@aws-amplify/ai-constructs/lib/conversation/runtime/bedrock_converse_adapter.d.ts +3 -1
- package/node_modules/@aws-amplify/ai-constructs/lib/conversation/runtime/bedrock_converse_adapter.js +8 -5
- package/node_modules/@aws-amplify/ai-constructs/lib/conversation/runtime/conversation_message_history_retriever.d.ts +44 -0
- package/node_modules/@aws-amplify/ai-constructs/lib/conversation/runtime/conversation_message_history_retriever.js +173 -0
- package/node_modules/@aws-amplify/ai-constructs/lib/conversation/runtime/conversation_turn_response_sender.d.ts +10 -3
- package/node_modules/@aws-amplify/ai-constructs/lib/conversation/runtime/conversation_turn_response_sender.js +10 -23
- package/node_modules/@aws-amplify/ai-constructs/lib/conversation/runtime/event-tools-provider/graphql_tool.d.ts +5 -5
- package/node_modules/@aws-amplify/ai-constructs/lib/conversation/runtime/event-tools-provider/graphql_tool.js +9 -24
- package/node_modules/@aws-amplify/ai-constructs/lib/conversation/runtime/graphql_request_executor.d.ts +21 -0
- package/node_modules/@aws-amplify/ai-constructs/lib/conversation/runtime/graphql_request_executor.js +45 -0
- package/node_modules/@aws-amplify/ai-constructs/lib/conversation/runtime/types.d.ts +11 -1
- package/node_modules/@aws-amplify/ai-constructs/lib/conversation/runtime/types.js +1 -1
- package/node_modules/@aws-amplify/ai-constructs/package.json +1 -1
- package/node_modules/@aws-amplify/graphql-auth-transformer/CHANGELOG.md +4 -0
- package/node_modules/@aws-amplify/graphql-auth-transformer/lib/graphql-auth-transformer.d.ts.map +1 -1
- package/node_modules/@aws-amplify/graphql-auth-transformer/lib/graphql-auth-transformer.js +19 -15
- package/node_modules/@aws-amplify/graphql-auth-transformer/lib/graphql-auth-transformer.js.map +1 -1
- package/node_modules/@aws-amplify/graphql-auth-transformer/package.json +11 -12
- package/node_modules/@aws-amplify/graphql-conversation-transformer/CHANGELOG.md +11 -0
- package/node_modules/@aws-amplify/graphql-conversation-transformer/lib/graphql-types/message-model.js +2 -2
- package/node_modules/@aws-amplify/graphql-conversation-transformer/lib/graphql-types/message-model.js.map +1 -1
- package/node_modules/@aws-amplify/graphql-conversation-transformer/lib/resolvers/assistant-messages-subscription-resolver-fn.template.js +43 -0
- package/node_modules/@aws-amplify/graphql-conversation-transformer/lib/resolvers/assistant-messages-subscription-resolver.d.ts +3 -2
- package/node_modules/@aws-amplify/graphql-conversation-transformer/lib/resolvers/assistant-messages-subscription-resolver.d.ts.map +1 -1
- package/node_modules/@aws-amplify/graphql-conversation-transformer/lib/resolvers/assistant-messages-subscription-resolver.js +9 -55
- package/node_modules/@aws-amplify/graphql-conversation-transformer/lib/resolvers/assistant-messages-subscription-resolver.js.map +1 -1
- package/node_modules/@aws-amplify/graphql-conversation-transformer/lib/resolvers/assistant-mutation-resolver-fn.template.js +41 -0
- package/node_modules/@aws-amplify/graphql-conversation-transformer/lib/resolvers/assistant-mutation-resolver.d.ts +3 -2
- package/node_modules/@aws-amplify/graphql-conversation-transformer/lib/resolvers/assistant-mutation-resolver.d.ts.map +1 -1
- package/node_modules/@aws-amplify/graphql-conversation-transformer/lib/resolvers/assistant-mutation-resolver.js +18 -70
- package/node_modules/@aws-amplify/graphql-conversation-transformer/lib/resolvers/assistant-mutation-resolver.js.map +1 -1
- package/node_modules/@aws-amplify/graphql-conversation-transformer/lib/resolvers/auth-resolver-fn.template.js +38 -0
- package/node_modules/@aws-amplify/graphql-conversation-transformer/lib/resolvers/auth-resolver.d.ts +3 -2
- package/node_modules/@aws-amplify/graphql-conversation-transformer/lib/resolvers/auth-resolver.d.ts.map +1 -1
- package/node_modules/@aws-amplify/graphql-conversation-transformer/lib/resolvers/auth-resolver.js +9 -50
- package/node_modules/@aws-amplify/graphql-conversation-transformer/lib/resolvers/auth-resolver.js.map +1 -1
- package/node_modules/@aws-amplify/graphql-conversation-transformer/lib/resolvers/init-resolver-fn.template.js +15 -0
- package/node_modules/@aws-amplify/graphql-conversation-transformer/lib/resolvers/init-resolver.d.ts +3 -2
- package/node_modules/@aws-amplify/graphql-conversation-transformer/lib/resolvers/init-resolver.d.ts.map +1 -1
- package/node_modules/@aws-amplify/graphql-conversation-transformer/lib/resolvers/init-resolver.js +9 -27
- package/node_modules/@aws-amplify/graphql-conversation-transformer/lib/resolvers/init-resolver.js.map +1 -1
- package/node_modules/@aws-amplify/graphql-conversation-transformer/lib/resolvers/invoke-lambda-resolver-fn.template.js +65 -0
- package/node_modules/@aws-amplify/graphql-conversation-transformer/lib/resolvers/invoke-lambda-resolver.d.ts +2 -3
- package/node_modules/@aws-amplify/graphql-conversation-transformer/lib/resolvers/invoke-lambda-resolver.d.ts.map +1 -1
- package/node_modules/@aws-amplify/graphql-conversation-transformer/lib/resolvers/invoke-lambda-resolver.js +49 -77
- package/node_modules/@aws-amplify/graphql-conversation-transformer/lib/resolvers/invoke-lambda-resolver.js.map +1 -1
- package/node_modules/@aws-amplify/graphql-conversation-transformer/lib/resolvers/list-messages-init-resolver-fn.template.js +8 -0
- package/node_modules/@aws-amplify/graphql-conversation-transformer/lib/resolvers/list-messages-init-resolver.d.ts +3 -2
- package/node_modules/@aws-amplify/graphql-conversation-transformer/lib/resolvers/list-messages-init-resolver.d.ts.map +1 -1
- package/node_modules/@aws-amplify/graphql-conversation-transformer/lib/resolvers/list-messages-init-resolver.js +9 -20
- package/node_modules/@aws-amplify/graphql-conversation-transformer/lib/resolvers/list-messages-init-resolver.js.map +1 -1
- package/node_modules/@aws-amplify/graphql-conversation-transformer/lib/resolvers/verify-session-owner-resolver-fn.template.js +31 -0
- package/node_modules/@aws-amplify/graphql-conversation-transformer/lib/resolvers/verify-session-owner-resolver.d.ts +4 -2
- package/node_modules/@aws-amplify/graphql-conversation-transformer/lib/resolvers/verify-session-owner-resolver.d.ts.map +1 -1
- package/node_modules/@aws-amplify/graphql-conversation-transformer/lib/resolvers/verify-session-owner-resolver.js +28 -43
- package/node_modules/@aws-amplify/graphql-conversation-transformer/lib/resolvers/verify-session-owner-resolver.js.map +1 -1
- package/node_modules/@aws-amplify/graphql-conversation-transformer/lib/resolvers/write-message-to-table-resolver-fn.template.js +24 -0
- package/node_modules/@aws-amplify/graphql-conversation-transformer/lib/resolvers/write-message-to-table-resolver.d.ts +2 -2
- package/node_modules/@aws-amplify/graphql-conversation-transformer/lib/resolvers/write-message-to-table-resolver.d.ts.map +1 -1
- package/node_modules/@aws-amplify/graphql-conversation-transformer/lib/resolvers/write-message-to-table-resolver.js +15 -37
- package/node_modules/@aws-amplify/graphql-conversation-transformer/lib/resolvers/write-message-to-table-resolver.js.map +1 -1
- package/node_modules/@aws-amplify/graphql-conversation-transformer/lib/transformer-steps/conversation-resolver-generator.d.ts +1 -1
- package/node_modules/@aws-amplify/graphql-conversation-transformer/lib/transformer-steps/conversation-resolver-generator.d.ts.map +1 -1
- package/node_modules/@aws-amplify/graphql-conversation-transformer/lib/transformer-steps/conversation-resolver-generator.js +43 -46
- package/node_modules/@aws-amplify/graphql-conversation-transformer/lib/transformer-steps/conversation-resolver-generator.js.map +1 -1
- package/node_modules/@aws-amplify/graphql-conversation-transformer/package.json +14 -13
- package/node_modules/@aws-amplify/graphql-default-value-transformer/CHANGELOG.md +4 -0
- package/node_modules/@aws-amplify/graphql-default-value-transformer/lib/graphql-default-value-transformer.js +1 -1
- package/node_modules/@aws-amplify/graphql-default-value-transformer/lib/graphql-default-value-transformer.js.map +1 -1
- package/node_modules/@aws-amplify/graphql-default-value-transformer/package.json +6 -7
- package/node_modules/@aws-amplify/graphql-directives/package.json +1 -2
- package/node_modules/@aws-amplify/graphql-function-transformer/CHANGELOG.md +4 -0
- package/node_modules/@aws-amplify/graphql-function-transformer/lib/graphql-function-transformer.js +2 -2
- package/node_modules/@aws-amplify/graphql-function-transformer/lib/graphql-function-transformer.js.map +1 -1
- package/node_modules/@aws-amplify/graphql-function-transformer/package.json +5 -6
- package/node_modules/@aws-amplify/graphql-generation-transformer/CHANGELOG.md +4 -0
- package/node_modules/@aws-amplify/graphql-generation-transformer/lib/grapqhl-generation-transformer.d.ts.map +1 -1
- package/node_modules/@aws-amplify/graphql-generation-transformer/lib/grapqhl-generation-transformer.js +1 -1
- package/node_modules/@aws-amplify/graphql-generation-transformer/lib/grapqhl-generation-transformer.js.map +1 -1
- package/node_modules/@aws-amplify/graphql-generation-transformer/lib/resolvers/invoke-bedrock-resolver-fn.template.js +45 -0
- package/node_modules/@aws-amplify/graphql-generation-transformer/lib/resolvers/invoke-bedrock.d.ts +1 -4
- package/node_modules/@aws-amplify/graphql-generation-transformer/lib/resolvers/invoke-bedrock.d.ts.map +1 -1
- package/node_modules/@aws-amplify/graphql-generation-transformer/lib/resolvers/invoke-bedrock.js +27 -60
- package/node_modules/@aws-amplify/graphql-generation-transformer/lib/resolvers/invoke-bedrock.js.map +1 -1
- package/node_modules/@aws-amplify/graphql-generation-transformer/package.json +7 -7
- package/node_modules/@aws-amplify/graphql-http-transformer/CHANGELOG.md +4 -0
- package/node_modules/@aws-amplify/graphql-http-transformer/lib/graphql-http-transformer.js +2 -2
- package/node_modules/@aws-amplify/graphql-http-transformer/lib/graphql-http-transformer.js.map +1 -1
- package/node_modules/@aws-amplify/graphql-http-transformer/package.json +5 -6
- package/node_modules/@aws-amplify/graphql-index-transformer/CHANGELOG.md +4 -0
- package/node_modules/@aws-amplify/graphql-index-transformer/lib/resolvers/resolvers.js +2 -2
- package/node_modules/@aws-amplify/graphql-index-transformer/lib/resolvers/resolvers.js.map +1 -1
- package/node_modules/@aws-amplify/graphql-index-transformer/package.json +6 -7
- package/node_modules/@aws-amplify/graphql-maps-to-transformer/CHANGELOG.md +4 -0
- package/node_modules/@aws-amplify/graphql-maps-to-transformer/lib/assets/mapping-lambda.zip +0 -0
- package/node_modules/@aws-amplify/graphql-maps-to-transformer/lib/field-mapping-resolvers.js +4 -4
- package/node_modules/@aws-amplify/graphql-maps-to-transformer/lib/field-mapping-resolvers.js.map +1 -1
- package/node_modules/@aws-amplify/graphql-maps-to-transformer/package.json +9 -10
- package/node_modules/@aws-amplify/graphql-model-transformer/CHANGELOG.md +4 -0
- package/node_modules/@aws-amplify/graphql-model-transformer/lib/rds-lambda.zip +0 -0
- package/node_modules/@aws-amplify/graphql-model-transformer/lib/rds-notification-lambda.zip +0 -0
- package/node_modules/@aws-amplify/graphql-model-transformer/lib/rds-patching-lambda.zip +0 -0
- package/node_modules/@aws-amplify/graphql-model-transformer/lib/resources/model-resource-generator.js +5 -5
- package/node_modules/@aws-amplify/graphql-model-transformer/lib/resources/model-resource-generator.js.map +1 -1
- package/node_modules/@aws-amplify/graphql-model-transformer/package.json +5 -6
- package/node_modules/@aws-amplify/graphql-predictions-transformer/CHANGELOG.md +4 -0
- package/node_modules/@aws-amplify/graphql-predictions-transformer/lib/graphql-predictions-transformer.js +2 -2
- package/node_modules/@aws-amplify/graphql-predictions-transformer/lib/graphql-predictions-transformer.js.map +1 -1
- package/node_modules/@aws-amplify/graphql-predictions-transformer/lib/predictionsLambdaFunction.zip +0 -0
- package/node_modules/@aws-amplify/graphql-predictions-transformer/package.json +5 -6
- package/node_modules/@aws-amplify/graphql-relational-transformer/CHANGELOG.md +4 -0
- package/node_modules/@aws-amplify/graphql-relational-transformer/lib/resolvers.js +1 -1
- package/node_modules/@aws-amplify/graphql-relational-transformer/lib/resolvers.js.map +1 -1
- package/node_modules/@aws-amplify/graphql-relational-transformer/package.json +7 -8
- package/node_modules/@aws-amplify/graphql-searchable-transformer/CHANGELOG.md +4 -0
- package/node_modules/@aws-amplify/graphql-searchable-transformer/lib/graphql-searchable-transformer.js +1 -1
- package/node_modules/@aws-amplify/graphql-searchable-transformer/lib/graphql-searchable-transformer.js.map +1 -1
- package/node_modules/@aws-amplify/graphql-searchable-transformer/lib/streaming-lambda.zip +0 -0
- package/node_modules/@aws-amplify/graphql-searchable-transformer/package.json +6 -7
- package/node_modules/@aws-amplify/graphql-sql-transformer/CHANGELOG.md +4 -0
- package/node_modules/@aws-amplify/graphql-sql-transformer/lib/graphql-sql-transformer.js +1 -1
- package/node_modules/@aws-amplify/graphql-sql-transformer/lib/graphql-sql-transformer.js.map +1 -1
- package/node_modules/@aws-amplify/graphql-sql-transformer/package.json +6 -7
- package/node_modules/@aws-amplify/graphql-transformer/CHANGELOG.md +8 -0
- package/node_modules/@aws-amplify/graphql-transformer/package.json +18 -18
- package/node_modules/@aws-amplify/graphql-transformer-core/API.md +23 -5
- package/node_modules/@aws-amplify/graphql-transformer-core/CHANGELOG.md +4 -0
- package/node_modules/@aws-amplify/graphql-transformer-core/lib/appsync-function.d.ts +2 -3
- package/node_modules/@aws-amplify/graphql-transformer-core/lib/appsync-function.d.ts.map +1 -1
- package/node_modules/@aws-amplify/graphql-transformer-core/lib/appsync-function.js.map +1 -1
- package/node_modules/@aws-amplify/graphql-transformer-core/lib/cdk-compat/template-asset.d.ts +10 -0
- package/node_modules/@aws-amplify/graphql-transformer-core/lib/cdk-compat/template-asset.d.ts.map +1 -1
- package/node_modules/@aws-amplify/graphql-transformer-core/lib/cdk-compat/template-asset.js +26 -1
- package/node_modules/@aws-amplify/graphql-transformer-core/lib/cdk-compat/template-asset.js.map +1 -1
- package/node_modules/@aws-amplify/graphql-transformer-core/lib/index.d.ts +1 -1
- package/node_modules/@aws-amplify/graphql-transformer-core/lib/index.d.ts.map +1 -1
- package/node_modules/@aws-amplify/graphql-transformer-core/lib/index.js +3 -1
- package/node_modules/@aws-amplify/graphql-transformer-core/lib/index.js.map +1 -1
- package/node_modules/@aws-amplify/graphql-transformer-core/lib/transform-host.d.ts +9 -3
- package/node_modules/@aws-amplify/graphql-transformer-core/lib/transform-host.d.ts.map +1 -1
- package/node_modules/@aws-amplify/graphql-transformer-core/lib/transform-host.js +43 -10
- package/node_modules/@aws-amplify/graphql-transformer-core/lib/transform-host.js.map +1 -1
- package/node_modules/@aws-amplify/graphql-transformer-core/lib/transformation/transform.d.ts.map +1 -1
- package/node_modules/@aws-amplify/graphql-transformer-core/lib/transformation/transform.js +1 -1
- package/node_modules/@aws-amplify/graphql-transformer-core/lib/transformation/transform.js.map +1 -1
- package/node_modules/@aws-amplify/graphql-transformer-core/lib/transformer-context/resolver.d.ts +12 -10
- package/node_modules/@aws-amplify/graphql-transformer-core/lib/transformer-context/resolver.d.ts.map +1 -1
- package/node_modules/@aws-amplify/graphql-transformer-core/lib/transformer-context/resolver.js +107 -38
- package/node_modules/@aws-amplify/graphql-transformer-core/lib/transformer-context/resolver.js.map +1 -1
- package/node_modules/@aws-amplify/graphql-transformer-core/lib/types/function-runtime-types.d.ts +4 -0
- package/node_modules/@aws-amplify/graphql-transformer-core/lib/types/function-runtime-types.d.ts.map +1 -0
- package/node_modules/@aws-amplify/graphql-transformer-core/lib/types/function-runtime-types.js +6 -0
- package/node_modules/@aws-amplify/graphql-transformer-core/lib/types/function-runtime-types.js.map +1 -0
- package/node_modules/@aws-amplify/graphql-transformer-core/lib/types/index.d.ts +1 -0
- package/node_modules/@aws-amplify/graphql-transformer-core/lib/types/index.d.ts.map +1 -1
- package/node_modules/@aws-amplify/graphql-transformer-core/lib/types/index.js +4 -1
- package/node_modules/@aws-amplify/graphql-transformer-core/lib/types/index.js.map +1 -1
- package/node_modules/@aws-amplify/graphql-transformer-core/lib/utils/function-runtime.d.ts +4 -3
- package/node_modules/@aws-amplify/graphql-transformer-core/lib/utils/function-runtime.d.ts.map +1 -1
- package/node_modules/@aws-amplify/graphql-transformer-core/lib/utils/function-runtime.js +19 -9
- package/node_modules/@aws-amplify/graphql-transformer-core/lib/utils/function-runtime.js.map +1 -1
- package/node_modules/@aws-amplify/graphql-transformer-core/package.json +3 -4
- package/node_modules/@aws-amplify/graphql-transformer-interfaces/API.md +27 -3
- package/node_modules/@aws-amplify/graphql-transformer-interfaces/CHANGELOG.md +4 -0
- package/node_modules/@aws-amplify/graphql-transformer-interfaces/lib/transform-host-provider.d.ts +8 -3
- package/node_modules/@aws-amplify/graphql-transformer-interfaces/lib/transform-host-provider.d.ts.map +1 -1
- package/node_modules/@aws-amplify/graphql-transformer-interfaces/lib/transformer-context/index.d.ts +1 -1
- package/node_modules/@aws-amplify/graphql-transformer-interfaces/lib/transformer-context/index.d.ts.map +1 -1
- package/node_modules/@aws-amplify/graphql-transformer-interfaces/lib/transformer-context/index.js.map +1 -1
- package/node_modules/@aws-amplify/graphql-transformer-interfaces/lib/transformer-context/transformer-resolver-provider.d.ts +10 -1
- package/node_modules/@aws-amplify/graphql-transformer-interfaces/lib/transformer-context/transformer-resolver-provider.d.ts.map +1 -1
- package/node_modules/@aws-amplify/graphql-transformer-interfaces/package.json +1 -1
- package/node_modules/@aws-amplify/graphql-transformer-interfaces/src/transform-host-provider.ts +38 -3
- package/node_modules/@aws-amplify/graphql-transformer-interfaces/src/transformer-context/index.ts +7 -1
- package/node_modules/@aws-amplify/graphql-transformer-interfaces/src/transformer-context/transformer-resolver-provider.ts +6 -1
- package/node_modules/@aws-amplify/graphql-transformer-interfaces/tsconfig.tsbuildinfo +1 -1
- package/package.json +20 -20
- package/node_modules/@aws-amplify/graphql-auth-transformer/LICENSE +0 -201
- package/node_modules/@aws-amplify/graphql-conversation-transformer/lib/resolvers/js-resolver-function-provider.d.ts +0 -6
- package/node_modules/@aws-amplify/graphql-conversation-transformer/lib/resolvers/js-resolver-function-provider.d.ts.map +0 -1
- package/node_modules/@aws-amplify/graphql-conversation-transformer/lib/resolvers/js-resolver-function-provider.js +0 -3
- package/node_modules/@aws-amplify/graphql-conversation-transformer/lib/resolvers/js-resolver-function-provider.js.map +0 -1
- package/node_modules/@aws-amplify/graphql-conversation-transformer/lib/resolvers/list-message-post-data-load-resolver.d.ts +0 -3
- package/node_modules/@aws-amplify/graphql-conversation-transformer/lib/resolvers/list-message-post-data-load-resolver.d.ts.map +0 -1
- package/node_modules/@aws-amplify/graphql-conversation-transformer/lib/resolvers/list-message-post-data-load-resolver.js +0 -48
- package/node_modules/@aws-amplify/graphql-conversation-transformer/lib/resolvers/list-message-post-data-load-resolver.js.map +0 -1
- package/node_modules/@aws-amplify/graphql-conversation-transformer/lib/resolvers/message-history-resolver.d.ts +0 -3
- package/node_modules/@aws-amplify/graphql-conversation-transformer/lib/resolvers/message-history-resolver.d.ts.map +0 -1
- package/node_modules/@aws-amplify/graphql-conversation-transformer/lib/resolvers/message-history-resolver.js +0 -68
- package/node_modules/@aws-amplify/graphql-conversation-transformer/lib/resolvers/message-history-resolver.js.map +0 -1
- package/node_modules/@aws-amplify/graphql-default-value-transformer/LICENSE +0 -201
- package/node_modules/@aws-amplify/graphql-directives/LICENSE +0 -201
- package/node_modules/@aws-amplify/graphql-function-transformer/LICENSE +0 -201
- package/node_modules/@aws-amplify/graphql-generation-transformer/LICENSE +0 -201
- package/node_modules/@aws-amplify/graphql-http-transformer/LICENSE +0 -201
- package/node_modules/@aws-amplify/graphql-index-transformer/LICENSE +0 -201
- package/node_modules/@aws-amplify/graphql-maps-to-transformer/LICENSE +0 -201
- package/node_modules/@aws-amplify/graphql-model-transformer/LICENSE +0 -201
- package/node_modules/@aws-amplify/graphql-predictions-transformer/LICENSE +0 -201
- package/node_modules/@aws-amplify/graphql-relational-transformer/LICENSE +0 -201
- package/node_modules/@aws-amplify/graphql-searchable-transformer/LICENSE +0 -201
- package/node_modules/@aws-amplify/graphql-sql-transformer/LICENSE +0 -201
- package/node_modules/@aws-amplify/graphql-transformer-core/LICENSE +0 -201
@@ -1,77 +1,25 @@
|
|
1
1
|
"use strict";
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
4
|
+
};
|
2
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
3
6
|
exports.assistantMutationResolver = void 0;
|
4
7
|
const graphql_transformer_core_1 = require("@aws-amplify/graphql-transformer-core");
|
5
|
-
const
|
6
|
-
const
|
7
|
-
|
8
|
-
|
9
|
-
|
8
|
+
const fs_1 = __importDefault(require("fs"));
|
9
|
+
const path_1 = __importDefault(require("path"));
|
10
|
+
const graphql_transformer_common_1 = require("graphql-transformer-common");
|
11
|
+
const assistantMutationResolver = (config) => {
|
12
|
+
let resolver = fs_1.default.readFileSync(path_1.default.join(__dirname, 'assistant-mutation-resolver-fn.template.js'), 'utf8');
|
13
|
+
const fieldName = (0, graphql_transformer_common_1.toUpper)(config.field.name.value);
|
14
|
+
const substitutions = {
|
15
|
+
CONVERSATION_MESSAGE_TYPE_NAME: `ConversationMessage${fieldName}`,
|
16
|
+
};
|
17
|
+
Object.entries(substitutions).forEach(([key, value]) => {
|
18
|
+
const replaced = resolver.replace(new RegExp(`\\[\\[${key}\\]\\]`, 'g'), value);
|
19
|
+
resolver = replaced;
|
20
|
+
});
|
21
|
+
const templateName = `Mutation.${config.field.name.value}.assistant-response.js`;
|
22
|
+
return graphql_transformer_core_1.MappingTemplate.s3MappingFunctionCodeFromString(resolver, templateName);
|
10
23
|
};
|
11
24
|
exports.assistantMutationResolver = assistantMutationResolver;
|
12
|
-
const createAssistantMutationRequestFunction = () => {
|
13
|
-
const requestFunctionString = `
|
14
|
-
import { util } from '@aws-appsync/utils';
|
15
|
-
|
16
|
-
/**
|
17
|
-
* Sends a request to the attached data source
|
18
|
-
* @param {import('@aws-appsync/utils').Context} ctx the context
|
19
|
-
* @returns {*} the request
|
20
|
-
*/
|
21
|
-
export function request(ctx) {
|
22
|
-
const owner = ctx.identity['claims']['sub'];
|
23
|
-
ctx.stash.owner = owner;
|
24
|
-
const { conversationId, content, associatedUserMessageId } = ctx.args.input;
|
25
|
-
const updatedAt = util.time.nowISO8601();
|
26
|
-
|
27
|
-
const expression = 'SET #assistantContent = :assistantContent, #updatedAt = :updatedAt';
|
28
|
-
const expressionNames = { '#assistantContent': 'assistantContent', '#updatedAt': 'updatedAt' };
|
29
|
-
const expressionValues = { ':assistantContent': content, ':updatedAt': updatedAt };
|
30
|
-
const condition = JSON.parse(
|
31
|
-
util.transform.toDynamoDBConditionExpression({
|
32
|
-
owner: { eq: owner },
|
33
|
-
conversationId: { eq: conversationId }
|
34
|
-
})
|
35
|
-
);
|
36
|
-
return {
|
37
|
-
operation: 'UpdateItem',
|
38
|
-
key: util.dynamodb.toMapValues({ id: associatedUserMessageId }),
|
39
|
-
condition,
|
40
|
-
update: {
|
41
|
-
expression,
|
42
|
-
expressionNames,
|
43
|
-
expressionValues: util.dynamodb.toMapValues(expressionValues),
|
44
|
-
}
|
45
|
-
};
|
46
|
-
}`;
|
47
|
-
return graphql_transformer_core_1.MappingTemplate.inlineTemplateFromString((0, ts_dedent_1.dedent)(requestFunctionString));
|
48
|
-
};
|
49
|
-
const createAssistantMutationResponseFunction = () => {
|
50
|
-
const responseFunctionString = `
|
51
|
-
/**
|
52
|
-
* Returns the resolver result
|
53
|
-
* @param {import('@aws-appsync/utils').Context} ctx the context
|
54
|
-
* @returns {*} the result
|
55
|
-
*/
|
56
|
-
export function response(ctx) {
|
57
|
-
// Update with response logic
|
58
|
-
if (ctx.error) {
|
59
|
-
util.error(ctx.error.message, ctx.error.type);
|
60
|
-
}
|
61
|
-
|
62
|
-
const { conversationId, content, associatedUserMessageId } = ctx.args.input;
|
63
|
-
const { createdAt, updatedAt } = ctx.result;
|
64
|
-
|
65
|
-
return {
|
66
|
-
id: associatedUserMessageId,
|
67
|
-
content,
|
68
|
-
conversationId,
|
69
|
-
role: 'assistant',
|
70
|
-
owner: ctx.stash.owner,
|
71
|
-
createdAt,
|
72
|
-
updatedAt,
|
73
|
-
};
|
74
|
-
}`;
|
75
|
-
return graphql_transformer_core_1.MappingTemplate.inlineTemplateFromString((0, ts_dedent_1.dedent)(responseFunctionString));
|
76
|
-
};
|
77
25
|
//# sourceMappingURL=assistant-mutation-resolver.js.map
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"assistant-mutation-resolver.js","sourceRoot":"","sources":["../../src/resolvers/assistant-mutation-resolver.ts"],"names":[],"mappings":"
|
1
|
+
{"version":3,"file":"assistant-mutation-resolver.js","sourceRoot":"","sources":["../../src/resolvers/assistant-mutation-resolver.ts"],"names":[],"mappings":";;;;;;AAAA,oFAAwE;AAExE,4CAAoB;AACpB,gDAAwB;AAExB,2EAAqD;AAQ9C,MAAM,yBAAyB,GAAG,CAAC,MAA0C,EAA2B,EAAE;IAC/G,IAAI,QAAQ,GAAG,YAAE,CAAC,YAAY,CAAC,cAAI,CAAC,IAAI,CAAC,SAAS,EAAE,4CAA4C,CAAC,EAAE,MAAM,CAAC,CAAC;IAC3G,MAAM,SAAS,GAAG,IAAA,oCAAO,EAAC,MAAM,CAAC,KAAK,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC;IACnD,MAAM,aAAa,GAAG;QACpB,8BAA8B,EAAE,sBAAsB,SAAS,EAAE;KAClE,CAAC;IACF,MAAM,CAAC,OAAO,CAAC,aAAa,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,GAAG,EAAE,KAAK,CAAC,EAAE,EAAE;QACrD,MAAM,QAAQ,GAAG,QAAQ,CAAC,OAAO,CAAC,IAAI,MAAM,CAAC,SAAS,GAAG,QAAQ,EAAE,GAAG,CAAC,EAAE,KAAK,CAAC,CAAC;QAChF,QAAQ,GAAG,QAAQ,CAAC;IACtB,CAAC,CAAC,CAAC;IACH,MAAM,YAAY,GAAG,YAAY,MAAM,CAAC,KAAK,CAAC,IAAI,CAAC,KAAK,wBAAwB,CAAC;IACjF,OAAO,0CAAe,CAAC,+BAA+B,CAAC,QAAQ,EAAE,YAAY,CAAC,CAAC;AACjF,CAAC,CAAC;AAZW,QAAA,yBAAyB,6BAYpC"}
|
@@ -0,0 +1,38 @@
|
|
1
|
+
export function request(ctx) {
|
2
|
+
ctx.stash.hasAuth = true;
|
3
|
+
const isAuthorized = false;
|
4
|
+
|
5
|
+
if (util.authType() === 'User Pool Authorization') {
|
6
|
+
if (!isAuthorized) {
|
7
|
+
const authFilter = [];
|
8
|
+
let ownerClaim0 = ctx.identity['claims']['sub'];
|
9
|
+
ctx.args.owner = ownerClaim0;
|
10
|
+
const currentClaim1 = ctx.identity['claims']['username'] ?? ctx.identity['claims']['cognito:username'];
|
11
|
+
if (ownerClaim0 && currentClaim1) {
|
12
|
+
ownerClaim0 = ownerClaim0 + '::' + currentClaim1;
|
13
|
+
authFilter.push({ owner: { eq: ownerClaim0 } });
|
14
|
+
}
|
15
|
+
const role0_0 = ctx.identity['claims']['sub'];
|
16
|
+
if (role0_0) {
|
17
|
+
authFilter.push({ owner: { eq: role0_0 } });
|
18
|
+
}
|
19
|
+
// we can just reuse currentClaim1 here, but doing this (for now) to mirror the existing
|
20
|
+
// vtl auth resolver.
|
21
|
+
const role0_1 = ctx.identity['claims']['username'] ?? ctx.identity['claims']['cognito:username'];
|
22
|
+
if (role0_1) {
|
23
|
+
authFilter.push({ owner: { eq: role0_1 } });
|
24
|
+
}
|
25
|
+
if (authFilter.length !== 0) {
|
26
|
+
ctx.stash.authFilter = { or: authFilter };
|
27
|
+
}
|
28
|
+
}
|
29
|
+
}
|
30
|
+
if (!isAuthorized && ctx.stash.authFilter.length === 0) {
|
31
|
+
util.unauthorized();
|
32
|
+
}
|
33
|
+
return { version: '2018-05-29', payload: {} };
|
34
|
+
}
|
35
|
+
|
36
|
+
export function response(ctx) {
|
37
|
+
return {};
|
38
|
+
}
|
package/node_modules/@aws-amplify/graphql-conversation-transformer/lib/resolvers/auth-resolver.d.ts
CHANGED
@@ -1,3 +1,4 @@
|
|
1
|
-
import {
|
2
|
-
|
1
|
+
import { MappingTemplateProvider } from '@aws-amplify/graphql-transformer-interfaces';
|
2
|
+
import { ConversationDirectiveConfiguration } from '../grapqhl-conversation-transformer';
|
3
|
+
export declare const authMappingTemplate: (config: ConversationDirectiveConfiguration) => MappingTemplateProvider;
|
3
4
|
//# sourceMappingURL=auth-resolver.d.ts.map
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"auth-resolver.d.ts","sourceRoot":"","sources":["../../src/resolvers/auth-resolver.ts"],"names":[],"mappings":"
|
1
|
+
{"version":3,"file":"auth-resolver.d.ts","sourceRoot":"","sources":["../../src/resolvers/auth-resolver.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,uBAAuB,EAAE,MAAM,6CAA6C,CAAC;AAGtF,OAAO,EAAE,kCAAkC,EAAE,MAAM,qCAAqC,CAAC;AAQzF,eAAO,MAAM,mBAAmB,WAAY,kCAAkC,KAAG,uBAIhF,CAAC"}
|
package/node_modules/@aws-amplify/graphql-conversation-transformer/lib/resolvers/auth-resolver.js
CHANGED
@@ -1,57 +1,16 @@
|
|
1
1
|
"use strict";
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
4
|
+
};
|
2
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
3
6
|
exports.authMappingTemplate = void 0;
|
4
7
|
const graphql_transformer_core_1 = require("@aws-amplify/graphql-transformer-core");
|
5
|
-
const
|
6
|
-
const
|
7
|
-
|
8
|
-
const
|
9
|
-
|
8
|
+
const fs_1 = __importDefault(require("fs"));
|
9
|
+
const path_1 = __importDefault(require("path"));
|
10
|
+
const authMappingTemplate = (config) => {
|
11
|
+
const resolver = fs_1.default.readFileSync(path_1.default.join(__dirname, 'auth-resolver-fn.template.js'), 'utf8');
|
12
|
+
const templateName = `Mutation.${config.field.name.value}.auth.js`;
|
13
|
+
return graphql_transformer_core_1.MappingTemplate.s3MappingFunctionCodeFromString(resolver, templateName);
|
10
14
|
};
|
11
15
|
exports.authMappingTemplate = authMappingTemplate;
|
12
|
-
const createAuthRequestFunction = () => {
|
13
|
-
const requestFunctionString = `
|
14
|
-
export function request(ctx) {
|
15
|
-
ctx.stash.hasAuth = true;
|
16
|
-
const isAuthorized = false;
|
17
|
-
|
18
|
-
if (util.authType() === 'User Pool Authorization') {
|
19
|
-
if (!isAuthorized) {
|
20
|
-
const authFilter = [];
|
21
|
-
let ownerClaim0 = ctx.identity['claims']['sub'];
|
22
|
-
ctx.args.owner = ownerClaim0;
|
23
|
-
const currentClaim1 = ctx.identity['claims']['username'] ?? ctx.identity['claims']['cognito:username'];
|
24
|
-
if (ownerClaim0 && currentClaim1) {
|
25
|
-
ownerClaim0 = ownerClaim0 + '::' + currentClaim1;
|
26
|
-
authFilter.push({ owner: { eq: ownerClaim0 } })
|
27
|
-
}
|
28
|
-
const role0_0 = ctx.identity['claims']['sub'];
|
29
|
-
if (role0_0) {
|
30
|
-
authFilter.push({ owner: { eq: role0_0 } });
|
31
|
-
}
|
32
|
-
// we can just reuse currentClaim1 here, but doing this (for now) to mirror the existing
|
33
|
-
// vtl auth resolver.
|
34
|
-
const role0_1 = ctx.identity['claims']['username'] ?? ctx.identity['claims']['cognito:username'];
|
35
|
-
if (role0_1) {
|
36
|
-
authFilter.push({ owner: { eq: role0_1 }});
|
37
|
-
}
|
38
|
-
if (authFilter.length !== 0) {
|
39
|
-
ctx.stash.authFilter = { or: authFilter };
|
40
|
-
}
|
41
|
-
}
|
42
|
-
}
|
43
|
-
if (!isAuthorized && ctx.stash.authFilter.length === 0) {
|
44
|
-
util.unauthorized();
|
45
|
-
}
|
46
|
-
return { version: '2018-05-29', payload: {} };
|
47
|
-
}`;
|
48
|
-
return graphql_transformer_core_1.MappingTemplate.inlineTemplateFromString((0, ts_dedent_1.dedent)(requestFunctionString));
|
49
|
-
};
|
50
|
-
const createAuthResponseFunction = () => {
|
51
|
-
const responseFunctionString = `
|
52
|
-
export function response(ctx) {
|
53
|
-
return {};
|
54
|
-
}`;
|
55
|
-
return graphql_transformer_core_1.MappingTemplate.inlineTemplateFromString((0, ts_dedent_1.dedent)(responseFunctionString));
|
56
|
-
};
|
57
16
|
//# sourceMappingURL=auth-resolver.js.map
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"auth-resolver.js","sourceRoot":"","sources":["../../src/resolvers/auth-resolver.ts"],"names":[],"mappings":"
|
1
|
+
{"version":3,"file":"auth-resolver.js","sourceRoot":"","sources":["../../src/resolvers/auth-resolver.ts"],"names":[],"mappings":";;;;;;AAAA,oFAAwE;AAExE,4CAAoB;AACpB,gDAAwB;AASjB,MAAM,mBAAmB,GAAG,CAAC,MAA0C,EAA2B,EAAE;IACzG,MAAM,QAAQ,GAAG,YAAE,CAAC,YAAY,CAAC,cAAI,CAAC,IAAI,CAAC,SAAS,EAAE,8BAA8B,CAAC,EAAE,MAAM,CAAC,CAAC;IAC/F,MAAM,YAAY,GAAG,YAAY,MAAM,CAAC,KAAK,CAAC,IAAI,CAAC,KAAK,UAAU,CAAC;IACnE,OAAO,0CAAe,CAAC,+BAA+B,CAAC,QAAQ,EAAE,YAAY,CAAC,CAAC;AACjF,CAAC,CAAC;AAJW,QAAA,mBAAmB,uBAI9B"}
|
@@ -0,0 +1,15 @@
|
|
1
|
+
export function request(ctx) {
|
2
|
+
ctx.stash.defaultValues = ctx.stash.defaultValues ?? {};
|
3
|
+
ctx.stash.defaultValues.id = util.autoId();
|
4
|
+
const createdAt = util.time.nowISO8601();
|
5
|
+
ctx.stash.defaultValues.createdAt = createdAt;
|
6
|
+
ctx.stash.defaultValues.updatedAt = createdAt;
|
7
|
+
return {
|
8
|
+
version: '2018-05-09',
|
9
|
+
payload: {},
|
10
|
+
};
|
11
|
+
}
|
12
|
+
|
13
|
+
export function response(ctx) {
|
14
|
+
return {};
|
15
|
+
}
|
package/node_modules/@aws-amplify/graphql-conversation-transformer/lib/resolvers/init-resolver.d.ts
CHANGED
@@ -1,3 +1,4 @@
|
|
1
|
-
import {
|
2
|
-
|
1
|
+
import { MappingTemplateProvider } from '@aws-amplify/graphql-transformer-interfaces';
|
2
|
+
import { ConversationDirectiveConfiguration } from '../grapqhl-conversation-transformer';
|
3
|
+
export declare const initMappingTemplate: (config: ConversationDirectiveConfiguration) => MappingTemplateProvider;
|
3
4
|
//# sourceMappingURL=init-resolver.d.ts.map
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"init-resolver.d.ts","sourceRoot":"","sources":["../../src/resolvers/init-resolver.ts"],"names":[],"mappings":"
|
1
|
+
{"version":3,"file":"init-resolver.d.ts","sourceRoot":"","sources":["../../src/resolvers/init-resolver.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,uBAAuB,EAAE,MAAM,6CAA6C,CAAC;AAGtF,OAAO,EAAE,kCAAkC,EAAE,MAAM,qCAAqC,CAAC;AAQzF,eAAO,MAAM,mBAAmB,WAAY,kCAAkC,KAAG,uBAIhF,CAAC"}
|
package/node_modules/@aws-amplify/graphql-conversation-transformer/lib/resolvers/init-resolver.js
CHANGED
@@ -1,34 +1,16 @@
|
|
1
1
|
"use strict";
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
4
|
+
};
|
2
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
3
6
|
exports.initMappingTemplate = void 0;
|
4
7
|
const graphql_transformer_core_1 = require("@aws-amplify/graphql-transformer-core");
|
5
|
-
const
|
6
|
-
const
|
7
|
-
|
8
|
-
const
|
9
|
-
|
8
|
+
const fs_1 = __importDefault(require("fs"));
|
9
|
+
const path_1 = __importDefault(require("path"));
|
10
|
+
const initMappingTemplate = (config) => {
|
11
|
+
const resolver = fs_1.default.readFileSync(path_1.default.join(__dirname, 'init-resolver-fn.template.js'), 'utf8');
|
12
|
+
const templateName = `Mutation.${config.field.name.value}.init.js`;
|
13
|
+
return graphql_transformer_core_1.MappingTemplate.s3MappingFunctionCodeFromString(resolver, templateName);
|
10
14
|
};
|
11
15
|
exports.initMappingTemplate = initMappingTemplate;
|
12
|
-
const createInitRequestFunction = () => {
|
13
|
-
const requestFunctionString = `
|
14
|
-
export function request(ctx) {
|
15
|
-
ctx.stash.defaultValues = ctx.stash.defaultValues ?? {};
|
16
|
-
ctx.stash.defaultValues.id = util.autoId();
|
17
|
-
const createdAt = util.time.nowISO8601();
|
18
|
-
ctx.stash.defaultValues.createdAt = createdAt;
|
19
|
-
ctx.stash.defaultValues.updatedAt = createdAt;
|
20
|
-
return {
|
21
|
-
version: '2018-05-09',
|
22
|
-
payload: {}
|
23
|
-
};
|
24
|
-
}`;
|
25
|
-
return graphql_transformer_core_1.MappingTemplate.inlineTemplateFromString((0, ts_dedent_1.dedent)(requestFunctionString));
|
26
|
-
};
|
27
|
-
const createInitResponseFunction = () => {
|
28
|
-
const responseFunctionString = `
|
29
|
-
export function response(ctx) {
|
30
|
-
return {};
|
31
|
-
}`;
|
32
|
-
return graphql_transformer_core_1.MappingTemplate.inlineTemplateFromString((0, ts_dedent_1.dedent)(responseFunctionString));
|
33
|
-
};
|
34
16
|
//# sourceMappingURL=init-resolver.js.map
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"init-resolver.js","sourceRoot":"","sources":["../../src/resolvers/init-resolver.ts"],"names":[],"mappings":"
|
1
|
+
{"version":3,"file":"init-resolver.js","sourceRoot":"","sources":["../../src/resolvers/init-resolver.ts"],"names":[],"mappings":";;;;;;AAAA,oFAAwE;AAExE,4CAAoB;AACpB,gDAAwB;AASjB,MAAM,mBAAmB,GAAG,CAAC,MAA0C,EAA2B,EAAE;IACzG,MAAM,QAAQ,GAAG,YAAE,CAAC,YAAY,CAAC,cAAI,CAAC,IAAI,CAAC,SAAS,EAAE,8BAA8B,CAAC,EAAE,MAAM,CAAC,CAAC;IAC/F,MAAM,YAAY,GAAG,YAAY,MAAM,CAAC,KAAK,CAAC,IAAI,CAAC,KAAK,UAAU,CAAC;IACnE,OAAO,0CAAe,CAAC,+BAA+B,CAAC,QAAQ,EAAE,YAAY,CAAC,CAAC;AACjF,CAAC,CAAC;AAJW,QAAA,mBAAmB,uBAI9B"}
|
@@ -0,0 +1,65 @@
|
|
1
|
+
import { util } from '@aws-appsync/utils';
|
2
|
+
|
3
|
+
export function request(ctx) {
|
4
|
+
const { args, request } = ctx;
|
5
|
+
[[TOOL_DEFINITIONS_LINE]]
|
6
|
+
const selectionSet = '[[SELECTION_SET]]';
|
7
|
+
const graphqlApiEndpoint = '[[GRAPHQL_API_ENDPOINT]]';
|
8
|
+
|
9
|
+
const responseMutation = {
|
10
|
+
name: '[[RESPONSE_MUTATION_NAME]]',
|
11
|
+
inputTypeName: '[[RESPONSE_MUTATION_INPUT_TYPE_NAME]]',
|
12
|
+
selectionSet,
|
13
|
+
};
|
14
|
+
const currentMessageId = ctx.stash.defaultValues.id;
|
15
|
+
[[MODEL_CONFIGURATION_LINE]]
|
16
|
+
|
17
|
+
const clientTools = args.toolConfiguration?.tools?.map((tool) => {
|
18
|
+
return { ...tool.toolSpec };
|
19
|
+
});
|
20
|
+
[[TOOLS_CONFIGURATION_LINE]]
|
21
|
+
|
22
|
+
const messageHistoryQuery = {
|
23
|
+
getQueryName: '[[GET_QUERY_NAME]]',
|
24
|
+
getQueryInputTypeName: '[[GET_QUERY_INPUT_TYPE_NAME]]',
|
25
|
+
listQueryName: '[[LIST_QUERY_NAME]]',
|
26
|
+
listQueryInputTypeName: '[[LIST_QUERY_INPUT_TYPE_NAME]]',
|
27
|
+
listQueryLimit: [[LIST_QUERY_LIMIT]],
|
28
|
+
};
|
29
|
+
|
30
|
+
const authHeader = request.headers['authorization'];
|
31
|
+
const payload = {
|
32
|
+
conversationId: args.conversationId,
|
33
|
+
currentMessageId,
|
34
|
+
responseMutation,
|
35
|
+
graphqlApiEndpoint,
|
36
|
+
modelConfiguration,
|
37
|
+
request: { headers: { authorization: authHeader } },
|
38
|
+
messageHistoryQuery,
|
39
|
+
toolsConfiguration,
|
40
|
+
};
|
41
|
+
|
42
|
+
return {
|
43
|
+
operation: 'Invoke',
|
44
|
+
payload,
|
45
|
+
invocationType: 'Event',
|
46
|
+
};
|
47
|
+
}
|
48
|
+
|
49
|
+
export function response(ctx) {
|
50
|
+
if (ctx.error) {
|
51
|
+
util.appendError(ctx.error.message, ctx.error.type);
|
52
|
+
}
|
53
|
+
const response = {
|
54
|
+
__typename: '[[MESSAGE_MODEL_NAME]]',
|
55
|
+
id: ctx.stash.defaultValues.id,
|
56
|
+
conversationId: ctx.args.conversationId,
|
57
|
+
role: 'user',
|
58
|
+
content: ctx.args.content,
|
59
|
+
aiContext: ctx.args.aiContext,
|
60
|
+
toolConfiguration: ctx.args.toolConfiguration,
|
61
|
+
createdAt: ctx.stash.defaultValues.createdAt,
|
62
|
+
updatedAt: ctx.stash.defaultValues.updatedAt,
|
63
|
+
};
|
64
|
+
return response;
|
65
|
+
}
|
@@ -1,5 +1,4 @@
|
|
1
|
-
import { TransformerContextProvider } from '@aws-amplify/graphql-transformer-interfaces';
|
1
|
+
import { TransformerContextProvider, MappingTemplateProvider } from '@aws-amplify/graphql-transformer-interfaces';
|
2
2
|
import { ConversationDirectiveConfiguration } from '../grapqhl-conversation-transformer';
|
3
|
-
|
4
|
-
export declare const invokeLambdaMappingTemplate: (config: ConversationDirectiveConfiguration, ctx: TransformerContextProvider) => JSResolverFunctionProvider;
|
3
|
+
export declare const invokeLambdaMappingTemplate: (config: ConversationDirectiveConfiguration, ctx: TransformerContextProvider) => MappingTemplateProvider;
|
5
4
|
//# sourceMappingURL=invoke-lambda-resolver.d.ts.map
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"invoke-lambda-resolver.d.ts","sourceRoot":"","sources":["../../src/resolvers/invoke-lambda-resolver.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,0BAA0B,
|
1
|
+
{"version":3,"file":"invoke-lambda-resolver.d.ts","sourceRoot":"","sources":["../../src/resolvers/invoke-lambda-resolver.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,0BAA0B,EAAE,uBAAuB,EAAE,MAAM,6CAA6C,CAAC;AAElH,OAAO,EAAE,kCAAkC,EAAE,MAAM,qCAAqC,CAAC;AAczF,eAAO,MAAM,2BAA2B,WAC9B,kCAAkC,OACrC,0BAA0B,KAC9B,uBA2CF,CAAC"}
|
@@ -1,96 +1,68 @@
|
|
1
1
|
"use strict";
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
4
|
+
};
|
2
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
3
6
|
exports.invokeLambdaMappingTemplate = void 0;
|
4
7
|
const graphql_transformer_core_1 = require("@aws-amplify/graphql-transformer-core");
|
5
|
-
const
|
8
|
+
const fs_1 = __importDefault(require("fs"));
|
9
|
+
const path_1 = __importDefault(require("path"));
|
10
|
+
const ts_dedent_1 = __importDefault(require("ts-dedent"));
|
11
|
+
const graphql_transformer_common_1 = require("graphql-transformer-common");
|
12
|
+
const pluralize_1 = __importDefault(require("pluralize"));
|
6
13
|
const invokeLambdaMappingTemplate = (config, ctx) => {
|
7
|
-
const
|
8
|
-
const
|
9
|
-
|
14
|
+
const { TOOL_DEFINITIONS_LINE, TOOLS_CONFIGURATION_LINE } = generateToolLines(config);
|
15
|
+
const SELECTION_SET = selectionSet;
|
16
|
+
const GRAPHQL_API_ENDPOINT = ctx.api.graphqlUrl;
|
17
|
+
const MODEL_CONFIGURATION_LINE = generateModelConfigurationLine(config);
|
18
|
+
const RESPONSE_MUTATION_NAME = config.responseMutationName;
|
19
|
+
const RESPONSE_MUTATION_INPUT_TYPE_NAME = config.responseMutationInputTypeName;
|
20
|
+
const MESSAGE_MODEL_NAME = config.messageModel.messageModel.name.value;
|
21
|
+
const GET_QUERY_NAME = `getConversationMessage${(0, graphql_transformer_common_1.toUpper)(config.field.name.value)}`;
|
22
|
+
const GET_QUERY_INPUT_TYPE_NAME = 'ID';
|
23
|
+
const LIST_QUERY_NAME = `listConversationMessage${(0, graphql_transformer_common_1.toUpper)((0, pluralize_1.default)(config.field.name.value))}`;
|
24
|
+
const LIST_QUERY_INPUT_TYPE_NAME = `ModelConversationMessage${(0, graphql_transformer_common_1.toUpper)(config.field.name.value)}FilterInput`;
|
25
|
+
const LIST_QUERY_LIMIT = 'undefined';
|
26
|
+
const substitutions = {
|
27
|
+
TOOL_DEFINITIONS_LINE,
|
28
|
+
TOOLS_CONFIGURATION_LINE,
|
29
|
+
SELECTION_SET,
|
30
|
+
GRAPHQL_API_ENDPOINT,
|
31
|
+
MODEL_CONFIGURATION_LINE,
|
32
|
+
RESPONSE_MUTATION_NAME,
|
33
|
+
RESPONSE_MUTATION_INPUT_TYPE_NAME,
|
34
|
+
MESSAGE_MODEL_NAME,
|
35
|
+
GET_QUERY_NAME,
|
36
|
+
GET_QUERY_INPUT_TYPE_NAME,
|
37
|
+
LIST_QUERY_NAME,
|
38
|
+
LIST_QUERY_INPUT_TYPE_NAME,
|
39
|
+
LIST_QUERY_LIMIT,
|
40
|
+
};
|
41
|
+
let resolver = fs_1.default.readFileSync(path_1.default.join(__dirname, 'invoke-lambda-resolver-fn.template.js'), 'utf8');
|
42
|
+
Object.entries(substitutions).forEach(([key, value]) => {
|
43
|
+
const replaced = resolver.replace(new RegExp(`\\[\\[${key}\\]\\]`, 'g'), value);
|
44
|
+
resolver = replaced;
|
45
|
+
});
|
46
|
+
return graphql_transformer_core_1.MappingTemplate.inlineTemplateFromString(resolver);
|
10
47
|
};
|
11
48
|
exports.invokeLambdaMappingTemplate = invokeLambdaMappingTemplate;
|
12
|
-
const
|
13
|
-
const { responseMutationInputTypeName, responseMutationName } = config;
|
49
|
+
const generateToolLines = (config) => {
|
14
50
|
const toolDefinitions = JSON.stringify(config.toolSpec);
|
15
|
-
const
|
16
|
-
const
|
17
|
-
|
18
|
-
const toolsConfigurationLine = toolDefinitions
|
19
|
-
? (0, ts_dedent_1.dedent) `const dataTools = toolDefinitions.tools;
|
51
|
+
const TOOL_DEFINITIONS_LINE = toolDefinitions ? `const toolDefinitions = ${toolDefinitions};` : '';
|
52
|
+
const TOOLS_CONFIGURATION_LINE = toolDefinitions
|
53
|
+
? (0, ts_dedent_1.default) `const dataTools = toolDefinitions.tools;
|
20
54
|
const toolsConfiguration = {
|
21
55
|
dataTools,
|
22
56
|
clientTools,
|
23
57
|
};`
|
24
|
-
: (0, ts_dedent_1.
|
58
|
+
: (0, ts_dedent_1.default) `const toolsConfiguration = {
|
25
59
|
clientTools
|
26
60
|
};`;
|
27
|
-
|
28
|
-
import { util } from '@aws-appsync/utils';
|
29
|
-
|
30
|
-
export function request(ctx) {
|
31
|
-
const { args, identity, request, prev } = ctx;
|
32
|
-
${toolDefinitionsLine}
|
33
|
-
const selectionSet = '${selectionSet}';
|
34
|
-
const graphqlApiEndpoint = '${graphqlEndpoint}';
|
35
|
-
|
36
|
-
const messages = prev.result.items;
|
37
|
-
const responseMutation = {
|
38
|
-
name: '${responseMutationName}',
|
39
|
-
inputTypeName: '${responseMutationInputTypeName}',
|
40
|
-
selectionSet,
|
41
|
-
};
|
42
|
-
const currentMessageId = ctx.stash.defaultValues.id;
|
43
|
-
${modelConfigurationLine}
|
44
|
-
|
45
|
-
const clientTools = args.toolConfiguration?.tools?.map((tool) => { return { ...tool.toolSpec }});
|
46
|
-
${toolsConfigurationLine}
|
47
|
-
|
48
|
-
const authHeader = request.headers['authorization'];
|
49
|
-
const payload = {
|
50
|
-
conversationId: args.conversationId,
|
51
|
-
currentMessageId,
|
52
|
-
responseMutation,
|
53
|
-
graphqlApiEndpoint,
|
54
|
-
modelConfiguration,
|
55
|
-
request: { headers: { authorization: authHeader }},
|
56
|
-
messages,
|
57
|
-
toolsConfiguration,
|
58
|
-
};
|
59
|
-
|
60
|
-
return {
|
61
|
-
operation: 'Invoke',
|
62
|
-
payload,
|
63
|
-
invocationType: 'Event'
|
64
|
-
};
|
65
|
-
}`;
|
66
|
-
return graphql_transformer_core_1.MappingTemplate.inlineTemplateFromString((0, ts_dedent_1.dedent)(requestFunctionString));
|
67
|
-
};
|
68
|
-
const createInvokeLambdaResponseFunction = (config) => {
|
69
|
-
const responseFunctionString = `
|
70
|
-
export function response(ctx) {
|
71
|
-
let success = true;
|
72
|
-
if (ctx.error) {
|
73
|
-
util.appendError(ctx.error.message, ctx.error.type);
|
74
|
-
success = false;
|
75
|
-
}
|
76
|
-
const response = {
|
77
|
-
__typename: '${config.messageModel.messageModel.name.value}',
|
78
|
-
id: ctx.stash.defaultValues.id,
|
79
|
-
conversationId: ctx.args.conversationId,
|
80
|
-
role: 'user',
|
81
|
-
content: ctx.args.content,
|
82
|
-
aiContext: ctx.args.aiContext,
|
83
|
-
toolConfiguration: ctx.args.toolConfiguration,
|
84
|
-
createdAt: ctx.stash.defaultValues.createdAt,
|
85
|
-
updatedAt: ctx.stash.defaultValues.updatedAt,
|
86
|
-
};
|
87
|
-
return response;
|
88
|
-
}`;
|
89
|
-
return graphql_transformer_core_1.MappingTemplate.inlineTemplateFromString((0, ts_dedent_1.dedent)(responseFunctionString));
|
61
|
+
return { TOOL_DEFINITIONS_LINE, TOOLS_CONFIGURATION_LINE };
|
90
62
|
};
|
91
63
|
const generateModelConfigurationLine = (config) => {
|
92
64
|
const { aiModel, systemPrompt } = config;
|
93
|
-
return (0, ts_dedent_1.
|
65
|
+
return (0, ts_dedent_1.default) `const modelConfiguration = {
|
94
66
|
modelId: '${aiModel}',
|
95
67
|
systemPrompt: ${JSON.stringify(systemPrompt)},
|
96
68
|
${generateModelInferenceConfigurationLine(config)}
|
@@ -99,7 +71,7 @@ const generateModelConfigurationLine = (config) => {
|
|
99
71
|
const generateModelInferenceConfigurationLine = (config) => {
|
100
72
|
const { inferenceConfiguration } = config;
|
101
73
|
return inferenceConfiguration && Object.keys(inferenceConfiguration).length > 0
|
102
|
-
? (0, ts_dedent_1.
|
74
|
+
? (0, ts_dedent_1.default) `inferenceConfiguration: ${JSON.stringify(config.inferenceConfiguration)},`
|
103
75
|
: '';
|
104
76
|
};
|
105
77
|
const selectionSet = `id conversationId content { image { format source { bytes }} text toolUse { toolUseId name input } toolResult { status toolUseId content { json text image { format source { bytes }} document { format name source { bytes }} }}} role owner createdAt updatedAt`;
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"invoke-lambda-resolver.js","sourceRoot":"","sources":["../../src/resolvers/invoke-lambda-resolver.ts"],"names":[],"mappings":"
|
1
|
+
{"version":3,"file":"invoke-lambda-resolver.js","sourceRoot":"","sources":["../../src/resolvers/invoke-lambda-resolver.ts"],"names":[],"mappings":"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"}
|
@@ -1,3 +1,4 @@
|
|
1
|
-
import {
|
2
|
-
|
1
|
+
import { MappingTemplateProvider } from '@aws-amplify/graphql-transformer-interfaces';
|
2
|
+
import { ConversationDirectiveConfiguration } from '../grapqhl-conversation-transformer';
|
3
|
+
export declare const listMessageInitMappingTemplate: (config: ConversationDirectiveConfiguration) => MappingTemplateProvider;
|
3
4
|
//# sourceMappingURL=list-messages-init-resolver.d.ts.map
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"list-messages-init-resolver.d.ts","sourceRoot":"","sources":["../../src/resolvers/list-messages-init-resolver.ts"],"names":[],"mappings":"
|
1
|
+
{"version":3,"file":"list-messages-init-resolver.d.ts","sourceRoot":"","sources":["../../src/resolvers/list-messages-init-resolver.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,uBAAuB,EAAE,MAAM,6CAA6C,CAAC;AAGtF,OAAO,EAAE,kCAAkC,EAAE,MAAM,qCAAqC,CAAC;AAOzF,eAAO,MAAM,8BAA8B,WAAY,kCAAkC,KAAG,uBAI3F,CAAC"}
|
@@ -1,27 +1,16 @@
|
|
1
1
|
"use strict";
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
4
|
+
};
|
2
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
3
6
|
exports.listMessageInitMappingTemplate = void 0;
|
4
7
|
const graphql_transformer_core_1 = require("@aws-amplify/graphql-transformer-core");
|
5
|
-
const
|
6
|
-
const
|
7
|
-
|
8
|
-
const
|
9
|
-
|
8
|
+
const fs_1 = __importDefault(require("fs"));
|
9
|
+
const path_1 = __importDefault(require("path"));
|
10
|
+
const listMessageInitMappingTemplate = (config) => {
|
11
|
+
const resolver = fs_1.default.readFileSync(path_1.default.join(__dirname, 'list-messages-init-resolver-fn.template.js'), 'utf8');
|
12
|
+
const templateName = `Query.${config.field.name.value}.list-message-init.js`;
|
13
|
+
return graphql_transformer_core_1.MappingTemplate.s3MappingFunctionCodeFromString(resolver, templateName);
|
10
14
|
};
|
11
15
|
exports.listMessageInitMappingTemplate = listMessageInitMappingTemplate;
|
12
|
-
const createListMessageInitRequestFunction = () => {
|
13
|
-
const requestFunctionString = `
|
14
|
-
export function request(ctx) {
|
15
|
-
ctx.stash.metadata.index = 'gsi-ConversationMessage.conversationId.createdAt';
|
16
|
-
return {};
|
17
|
-
}`;
|
18
|
-
return graphql_transformer_core_1.MappingTemplate.inlineTemplateFromString((0, ts_dedent_1.dedent)(requestFunctionString));
|
19
|
-
};
|
20
|
-
const createListMessageInitResponseFunction = () => {
|
21
|
-
const responseFunctionString = `
|
22
|
-
export function response(ctx) {
|
23
|
-
return {};
|
24
|
-
}`;
|
25
|
-
return graphql_transformer_core_1.MappingTemplate.inlineTemplateFromString((0, ts_dedent_1.dedent)(responseFunctionString));
|
26
|
-
};
|
27
16
|
//# sourceMappingURL=list-messages-init-resolver.js.map
|