@aws-amplify/graphql-api-construct 1.14.0 → 1.15.1-ai-streaming.0
Sign up to get free protection for your applications and to get access to all the features.
- package/.jsii +91 -34
- package/CHANGELOG.md +15 -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/internal/authorization-modes.js +3 -3
- package/lib/sql-model-datasource-strategy.js +1 -1
- package/node_modules/@aws-amplify/ai-constructs/lib/conversation/conversation_handler_construct.d.ts +12 -1
- package/node_modules/@aws-amplify/ai-constructs/lib/conversation/conversation_handler_construct.js +19 -2
- package/node_modules/@aws-amplify/ai-constructs/lib/conversation/index.d.ts +2 -2
- package/node_modules/@aws-amplify/ai-constructs/lib/conversation/index.js +1 -1
- package/node_modules/@aws-amplify/ai-constructs/lib/conversation/runtime/bedrock_converse_adapter.d.ts +13 -1
- package/node_modules/@aws-amplify/ai-constructs/lib/conversation/runtime/bedrock_converse_adapter.js +182 -45
- 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_executor.d.ts +3 -5
- package/node_modules/@aws-amplify/ai-constructs/lib/conversation/runtime/conversation_turn_executor.js +10 -7
- package/node_modules/@aws-amplify/ai-constructs/lib/conversation/runtime/conversation_turn_response_sender.d.ts +11 -2
- package/node_modules/@aws-amplify/ai-constructs/lib/conversation/runtime/conversation_turn_response_sender.js +9 -23
- package/node_modules/@aws-amplify/ai-constructs/lib/conversation/runtime/conversation_turn_streaming_response_sender.d.ts +33 -0
- package/node_modules/@aws-amplify/ai-constructs/lib/conversation/runtime/conversation_turn_streaming_response_sender.js +38 -0
- package/node_modules/@aws-amplify/ai-constructs/lib/conversation/runtime/default_handler.d.ts +1 -1
- package/node_modules/@aws-amplify/ai-constructs/lib/conversation/runtime/event-tools-provider/event_tools_provider.js +2 -2
- package/node_modules/@aws-amplify/ai-constructs/lib/conversation/runtime/event-tools-provider/graphql_tool.d.ts +11 -11
- package/node_modules/@aws-amplify/ai-constructs/lib/conversation/runtime/event-tools-provider/graphql_tool.js +10 -24
- package/node_modules/@aws-amplify/ai-constructs/lib/conversation/runtime/executable_tool_factory.d.ts +7 -0
- package/node_modules/@aws-amplify/ai-constructs/lib/conversation/runtime/executable_tool_factory.js +16 -0
- package/node_modules/@aws-amplify/ai-constructs/lib/conversation/runtime/graphql_request_executor.d.ts +22 -0
- package/node_modules/@aws-amplify/ai-constructs/lib/conversation/runtime/graphql_request_executor.js +47 -0
- package/node_modules/@aws-amplify/ai-constructs/lib/conversation/runtime/index.d.ts +3 -2
- package/node_modules/@aws-amplify/ai-constructs/lib/conversation/runtime/index.js +4 -2
- package/node_modules/@aws-amplify/ai-constructs/lib/conversation/runtime/types.d.ts +22 -11
- package/node_modules/@aws-amplify/ai-constructs/lib/conversation/runtime/types.js +1 -1
- package/node_modules/@aws-amplify/ai-constructs/node_modules/@aws-amplify/backend-output-schemas/README.md +4 -0
- package/node_modules/@aws-amplify/ai-constructs/node_modules/@aws-amplify/backend-output-schemas/lib/ai/conversation/index.d.ts +23 -0
- package/node_modules/@aws-amplify/ai-constructs/node_modules/@aws-amplify/backend-output-schemas/lib/ai/conversation/index.js +10 -0
- package/node_modules/@aws-amplify/ai-constructs/node_modules/@aws-amplify/backend-output-schemas/lib/ai/conversation/v1.d.ts +22 -0
- package/node_modules/@aws-amplify/ai-constructs/node_modules/@aws-amplify/backend-output-schemas/lib/ai/conversation/v1.js +11 -0
- package/node_modules/@aws-amplify/ai-constructs/node_modules/@aws-amplify/backend-output-schemas/lib/auth/index.d.ts +113 -0
- package/node_modules/@aws-amplify/ai-constructs/node_modules/@aws-amplify/backend-output-schemas/lib/auth/index.js +10 -0
- package/node_modules/@aws-amplify/ai-constructs/node_modules/@aws-amplify/backend-output-schemas/lib/auth/v1.d.ts +112 -0
- package/node_modules/@aws-amplify/ai-constructs/node_modules/@aws-amplify/backend-output-schemas/lib/auth/v1.js +30 -0
- package/node_modules/@aws-amplify/ai-constructs/node_modules/@aws-amplify/backend-output-schemas/lib/custom/index.d.ts +23 -0
- package/node_modules/@aws-amplify/ai-constructs/node_modules/@aws-amplify/backend-output-schemas/lib/custom/index.js +10 -0
- package/node_modules/@aws-amplify/ai-constructs/node_modules/@aws-amplify/backend-output-schemas/lib/custom/v1.d.ts +22 -0
- package/node_modules/@aws-amplify/ai-constructs/node_modules/@aws-amplify/backend-output-schemas/lib/custom/v1.js +11 -0
- package/node_modules/@aws-amplify/ai-constructs/node_modules/@aws-amplify/backend-output-schemas/lib/function/index.d.ts +23 -0
- package/node_modules/@aws-amplify/ai-constructs/node_modules/@aws-amplify/backend-output-schemas/lib/function/index.js +10 -0
- package/node_modules/@aws-amplify/ai-constructs/node_modules/@aws-amplify/backend-output-schemas/lib/function/v1.d.ts +22 -0
- package/node_modules/@aws-amplify/ai-constructs/node_modules/@aws-amplify/backend-output-schemas/lib/function/v1.js +11 -0
- package/node_modules/@aws-amplify/ai-constructs/node_modules/@aws-amplify/backend-output-schemas/lib/graphql/index.d.ts +59 -0
- package/node_modules/@aws-amplify/ai-constructs/node_modules/@aws-amplify/backend-output-schemas/lib/graphql/index.js +12 -0
- package/node_modules/@aws-amplify/ai-constructs/node_modules/@aws-amplify/backend-output-schemas/lib/graphql/v1.d.ts +59 -0
- package/node_modules/@aws-amplify/ai-constructs/node_modules/@aws-amplify/backend-output-schemas/lib/graphql/v1.js +25 -0
- package/node_modules/@aws-amplify/ai-constructs/node_modules/@aws-amplify/backend-output-schemas/lib/index.d.ts +508 -0
- package/node_modules/@aws-amplify/ai-constructs/node_modules/@aws-amplify/backend-output-schemas/lib/index.js +112 -0
- package/node_modules/@aws-amplify/ai-constructs/node_modules/@aws-amplify/backend-output-schemas/lib/platform/index.d.ts +2 -0
- package/node_modules/@aws-amplify/ai-constructs/node_modules/@aws-amplify/backend-output-schemas/lib/platform/index.js +18 -0
- package/node_modules/@aws-amplify/ai-constructs/node_modules/@aws-amplify/backend-output-schemas/lib/platform/stack_metadata_schemas.d.ts +42 -0
- package/node_modules/@aws-amplify/ai-constructs/node_modules/@aws-amplify/backend-output-schemas/lib/platform/stack_metadata_schemas.js +22 -0
- package/node_modules/@aws-amplify/ai-constructs/node_modules/@aws-amplify/backend-output-schemas/lib/stack/index.d.ts +28 -0
- package/node_modules/@aws-amplify/ai-constructs/node_modules/@aws-amplify/backend-output-schemas/lib/stack/index.js +10 -0
- package/node_modules/@aws-amplify/ai-constructs/node_modules/@aws-amplify/backend-output-schemas/lib/stack/v1.d.ts +27 -0
- package/node_modules/@aws-amplify/ai-constructs/node_modules/@aws-amplify/backend-output-schemas/lib/stack/v1.js +12 -0
- package/node_modules/@aws-amplify/ai-constructs/node_modules/@aws-amplify/backend-output-schemas/lib/storage/index.d.ts +33 -0
- package/node_modules/@aws-amplify/ai-constructs/node_modules/@aws-amplify/backend-output-schemas/lib/storage/index.js +10 -0
- package/node_modules/@aws-amplify/ai-constructs/node_modules/@aws-amplify/backend-output-schemas/lib/storage/v1.d.ts +32 -0
- package/node_modules/@aws-amplify/ai-constructs/node_modules/@aws-amplify/backend-output-schemas/lib/storage/v1.js +33 -0
- package/node_modules/@aws-amplify/ai-constructs/node_modules/@aws-amplify/backend-output-schemas/package.json +27 -0
- package/node_modules/@aws-amplify/ai-constructs/package.json +9 -2
- package/node_modules/@aws-amplify/graphql-auth-transformer/API.md +2 -0
- package/node_modules/@aws-amplify/graphql-auth-transformer/CHANGELOG.md +6 -0
- package/node_modules/@aws-amplify/graphql-auth-transformer/lib/graphql-auth-transformer.d.ts +1 -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 +18 -0
- 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 +13 -14
- package/node_modules/@aws-amplify/graphql-conversation-transformer/API.md +2 -1
- package/node_modules/@aws-amplify/graphql-conversation-transformer/CHANGELOG.md +15 -0
- package/node_modules/@aws-amplify/graphql-conversation-transformer/lib/graphql-types/message-model.d.ts +2 -0
- package/node_modules/@aws-amplify/graphql-conversation-transformer/lib/graphql-types/message-model.d.ts.map +1 -1
- package/node_modules/@aws-amplify/graphql-conversation-transformer/lib/graphql-types/message-model.js +36 -5
- 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/grapqhl-conversation-transformer.d.ts +2 -1
- package/node_modules/@aws-amplify/graphql-conversation-transformer/lib/grapqhl-conversation-transformer.d.ts.map +1 -1
- package/node_modules/@aws-amplify/graphql-conversation-transformer/lib/grapqhl-conversation-transformer.js +2 -2
- package/node_modules/@aws-amplify/graphql-conversation-transformer/lib/grapqhl-conversation-transformer.js.map +1 -1
- package/node_modules/@aws-amplify/graphql-conversation-transformer/lib/resolvers/assistant-mutation-resolver-fn.template.js +16 -33
- 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 +10 -1
- 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/assistant-streaming-mutation-reduce-chunks-resolver-fn.template.js +101 -0
- package/node_modules/@aws-amplify/graphql-conversation-transformer/lib/resolvers/assistant-streaming-mutation-reduce-chunks-resolver.d.ts +4 -0
- package/node_modules/@aws-amplify/graphql-conversation-transformer/lib/resolvers/assistant-streaming-mutation-reduce-chunks-resolver.d.ts.map +1 -0
- package/node_modules/@aws-amplify/graphql-conversation-transformer/lib/resolvers/assistant-streaming-mutation-reduce-chunks-resolver.js +25 -0
- package/node_modules/@aws-amplify/graphql-conversation-transformer/lib/resolvers/assistant-streaming-mutation-reduce-chunks-resolver.js.map +1 -0
- package/node_modules/@aws-amplify/graphql-conversation-transformer/lib/resolvers/assistant-streaming-mutation-resolver-fn.template.js +121 -0
- package/node_modules/@aws-amplify/graphql-conversation-transformer/lib/resolvers/assistant-streaming-mutation-resolver.d.ts +4 -0
- package/node_modules/@aws-amplify/graphql-conversation-transformer/lib/resolvers/assistant-streaming-mutation-resolver.d.ts.map +1 -0
- package/node_modules/@aws-amplify/graphql-conversation-transformer/lib/resolvers/assistant-streaming-mutation-resolver.js +25 -0
- package/node_modules/@aws-amplify/graphql-conversation-transformer/lib/resolvers/assistant-streaming-mutation-resolver.js.map +1 -0
- package/node_modules/@aws-amplify/graphql-conversation-transformer/lib/resolvers/init-resolver-fn.template.js +1 -0
- package/node_modules/@aws-amplify/graphql-conversation-transformer/lib/resolvers/init-resolver.d.ts +2 -3
- 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 +10 -4
- 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 +28 -5
- package/node_modules/@aws-amplify/graphql-conversation-transformer/lib/resolvers/invoke-lambda-resolver.d.ts +2 -2
- 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 +21 -4
- 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 +4 -0
- package/node_modules/@aws-amplify/graphql-conversation-transformer/lib/resolvers/list-messages-init-resolver.d.ts.map +1 -0
- package/node_modules/@aws-amplify/graphql-conversation-transformer/lib/resolvers/{message-history-resolver.js → list-messages-init-resolver.js} +6 -6
- package/node_modules/@aws-amplify/graphql-conversation-transformer/lib/resolvers/list-messages-init-resolver.js.map +1 -0
- package/node_modules/@aws-amplify/graphql-conversation-transformer/lib/resolvers/verify-session-owner-resolver-fn.template.js +2 -1
- package/node_modules/@aws-amplify/graphql-conversation-transformer/lib/resolvers/verify-session-owner-resolver.d.ts +2 -1
- 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 +23 -5
- 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.d.ts +2 -1
- 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 +4 -2
- 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-prepare-handler.d.ts.map +1 -1
- package/node_modules/@aws-amplify/graphql-conversation-transformer/lib/transformer-steps/conversation-prepare-handler.js +3 -2
- package/node_modules/@aws-amplify/graphql-conversation-transformer/lib/transformer-steps/conversation-prepare-handler.js.map +1 -1
- package/node_modules/@aws-amplify/graphql-conversation-transformer/lib/transformer-steps/conversation-resolver-generator.d.ts +5 -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 +66 -30
- 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 +12 -11
- package/node_modules/@aws-amplify/graphql-default-value-transformer/CHANGELOG.md +6 -0
- package/node_modules/@aws-amplify/graphql-default-value-transformer/lib/graphql-default-value-transformer.d.ts.map +1 -1
- package/node_modules/@aws-amplify/graphql-default-value-transformer/lib/graphql-default-value-transformer.js +19 -7
- 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 +9 -9
- package/node_modules/@aws-amplify/graphql-directives/CHANGELOG.md +6 -0
- package/node_modules/@aws-amplify/graphql-directives/lib/directives/default.js +1 -1
- package/node_modules/@aws-amplify/graphql-directives/package.json +1 -1
- package/node_modules/@aws-amplify/graphql-function-transformer/CHANGELOG.md +4 -0
- package/node_modules/@aws-amplify/graphql-function-transformer/package.json +7 -8
- package/node_modules/@aws-amplify/graphql-generation-transformer/CHANGELOG.md +7 -0
- package/node_modules/@aws-amplify/graphql-generation-transformer/lib/resolvers/invoke-bedrock-resolver-fn.template.js +24 -9
- 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 +11 -1
- package/node_modules/@aws-amplify/graphql-generation-transformer/lib/resolvers/invoke-bedrock.js.map +1 -1
- package/node_modules/@aws-amplify/graphql-generation-transformer/lib/utils/tools.d.ts.map +1 -1
- package/node_modules/@aws-amplify/graphql-generation-transformer/lib/utils/tools.js +2 -1
- package/node_modules/@aws-amplify/graphql-generation-transformer/lib/utils/tools.js.map +1 -1
- package/node_modules/@aws-amplify/graphql-generation-transformer/package.json +7 -8
- package/node_modules/@aws-amplify/graphql-http-transformer/CHANGELOG.md +4 -0
- package/node_modules/@aws-amplify/graphql-http-transformer/package.json +7 -8
- package/node_modules/@aws-amplify/graphql-index-transformer/CHANGELOG.md +4 -0
- package/node_modules/@aws-amplify/graphql-index-transformer/package.json +8 -9
- 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/package.json +11 -12
- 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/resolvers/dynamodb/query.js +1 -1
- package/node_modules/@aws-amplify/graphql-model-transformer/lib/resolvers/dynamodb/query.js.map +1 -1
- package/node_modules/@aws-amplify/graphql-model-transformer/package.json +7 -8
- package/node_modules/@aws-amplify/graphql-predictions-transformer/CHANGELOG.md +4 -0
- package/node_modules/@aws-amplify/graphql-predictions-transformer/lib/predictionsLambdaFunction.zip +0 -0
- package/node_modules/@aws-amplify/graphql-predictions-transformer/package.json +7 -8
- package/node_modules/@aws-amplify/graphql-relational-transformer/CHANGELOG.md +4 -0
- package/node_modules/@aws-amplify/graphql-relational-transformer/package.json +9 -10
- package/node_modules/@aws-amplify/graphql-searchable-transformer/CHANGELOG.md +4 -0
- package/node_modules/@aws-amplify/graphql-searchable-transformer/lib/streaming-lambda.zip +0 -0
- package/node_modules/@aws-amplify/graphql-searchable-transformer/package.json +8 -9
- package/node_modules/@aws-amplify/graphql-sql-transformer/CHANGELOG.md +4 -0
- package/node_modules/@aws-amplify/graphql-sql-transformer/package.json +8 -9
- package/node_modules/@aws-amplify/graphql-transformer/CHANGELOG.md +10 -0
- package/node_modules/@aws-amplify/graphql-transformer/lib/graphql-transformer.js +1 -1
- package/node_modules/@aws-amplify/graphql-transformer/lib/graphql-transformer.js.map +1 -1
- package/node_modules/@aws-amplify/graphql-transformer/package.json +19 -19
- package/node_modules/@aws-amplify/graphql-transformer/src/graphql-transformer.ts +1 -1
- package/node_modules/@aws-amplify/graphql-transformer-core/API.md +13 -7
- package/node_modules/@aws-amplify/graphql-transformer-core/CHANGELOG.md +10 -0
- 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 +4 -2
- package/node_modules/@aws-amplify/graphql-transformer-core/lib/index.js.map +1 -1
- package/node_modules/@aws-amplify/graphql-transformer-core/lib/utils/graphql-utils.d.ts +9 -9
- package/node_modules/@aws-amplify/graphql-transformer-core/lib/utils/graphql-utils.d.ts.map +1 -1
- package/node_modules/@aws-amplify/graphql-transformer-core/lib/utils/graphql-utils.js.map +1 -1
- package/node_modules/@aws-amplify/graphql-transformer-core/lib/utils/model-datasource-strategy-utils.d.ts +2 -0
- package/node_modules/@aws-amplify/graphql-transformer-core/lib/utils/model-datasource-strategy-utils.d.ts.map +1 -1
- package/node_modules/@aws-amplify/graphql-transformer-core/lib/utils/model-datasource-strategy-utils.js +13 -1
- package/node_modules/@aws-amplify/graphql-transformer-core/lib/utils/model-datasource-strategy-utils.js.map +1 -1
- package/node_modules/@aws-amplify/graphql-transformer-core/package.json +5 -6
- package/node_modules/@aws-amplify/graphql-transformer-interfaces/CHANGELOG.md +4 -0
- package/node_modules/@aws-amplify/graphql-transformer-interfaces/package.json +3 -4
- package/node_modules/@aws-amplify/graphql-transformer-interfaces/tsconfig.tsbuildinfo +1 -1
- package/package.json +23 -23
- package/src/internal/authorization-modes.ts +2 -2
- package/node_modules/@aws-amplify/graphql-auth-transformer/LICENSE +0 -201
- package/node_modules/@aws-amplify/graphql-conversation-transformer/lib/resolvers/message-history-resolver-fn.template.js +0 -40
- package/node_modules/@aws-amplify/graphql-conversation-transformer/lib/resolvers/message-history-resolver.d.ts +0 -4
- 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.map +0 -1
- package/node_modules/@aws-amplify/graphql-default-value-transformer/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
- package/node_modules/@aws-amplify/graphql-transformer-interfaces/LICENSE +0 -201
@@ -3,14 +3,14 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
3
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
4
4
|
};
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
6
|
-
exports.
|
6
|
+
exports.listMessageInitMappingTemplate = void 0;
|
7
7
|
const graphql_transformer_core_1 = require("@aws-amplify/graphql-transformer-core");
|
8
8
|
const fs_1 = __importDefault(require("fs"));
|
9
9
|
const path_1 = __importDefault(require("path"));
|
10
|
-
const
|
11
|
-
const resolver = fs_1.default.readFileSync(path_1.default.join(__dirname, '
|
12
|
-
const templateName = `
|
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-messages-init.js`;
|
13
13
|
return graphql_transformer_core_1.MappingTemplate.s3MappingFunctionCodeFromString(resolver, templateName);
|
14
14
|
};
|
15
|
-
exports.
|
16
|
-
//# sourceMappingURL=
|
15
|
+
exports.listMessageInitMappingTemplate = listMessageInitMappingTemplate;
|
16
|
+
//# sourceMappingURL=list-messages-init-resolver.js.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"list-messages-init-resolver.js","sourceRoot":"","sources":["../../src/resolvers/list-messages-init-resolver.ts"],"names":[],"mappings":";;;;;;AAAA,oFAAwE;AAExE,4CAAoB;AACpB,gDAAwB;AAQjB,MAAM,8BAA8B,GAAG,CAAC,MAA0C,EAA2B,EAAE;IACpH,MAAM,QAAQ,GAAG,YAAE,CAAC,YAAY,CAAC,cAAI,CAAC,IAAI,CAAC,SAAS,EAAE,4CAA4C,CAAC,EAAE,MAAM,CAAC,CAAC;IAC7G,MAAM,YAAY,GAAG,SAAS,MAAM,CAAC,KAAK,CAAC,IAAI,CAAC,KAAK,wBAAwB,CAAC;IAC9E,OAAO,0CAAe,CAAC,+BAA+B,CAAC,QAAQ,EAAE,YAAY,CAAC,CAAC;AACjF,CAAC,CAAC;AAJW,QAAA,8BAA8B,kCAIzC"}
|
@@ -1,10 +1,11 @@
|
|
1
1
|
export function request(ctx) {
|
2
2
|
const { authFilter } = ctx.stash;
|
3
|
+
const { conversationId } = [[CONVERSATION_ID_PARENT]];
|
3
4
|
|
4
5
|
const query = {
|
5
6
|
expression: 'id = :id',
|
6
7
|
expressionValues: util.dynamodb.toMapValues({
|
7
|
-
':id':
|
8
|
+
':id': conversationId,
|
8
9
|
}),
|
9
10
|
};
|
10
11
|
|
@@ -1,4 +1,5 @@
|
|
1
1
|
import { MappingTemplateProvider } from '@aws-amplify/graphql-transformer-interfaces';
|
2
2
|
import { ConversationDirectiveConfiguration } from '../grapqhl-conversation-transformer';
|
3
|
-
export declare const
|
3
|
+
export declare const verifySessionOwnerSendMessageMappingTemplate: (config: ConversationDirectiveConfiguration) => MappingTemplateProvider;
|
4
|
+
export declare const verifySessionOwnerAssistantResponseMappingTemplate: (config: ConversationDirectiveConfiguration) => MappingTemplateProvider;
|
4
5
|
//# sourceMappingURL=verify-session-owner-resolver.d.ts.map
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"verify-session-owner-resolver.d.ts","sourceRoot":"","sources":["../../src/resolvers/verify-session-owner-resolver.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,uBAAuB,EAAE,MAAM,6CAA6C,CAAC;AAGtF,OAAO,EAAE,kCAAkC,EAAE,MAAM,qCAAqC,CAAC;AAOzF,eAAO,MAAM,
|
1
|
+
{"version":3,"file":"verify-session-owner-resolver.d.ts","sourceRoot":"","sources":["../../src/resolvers/verify-session-owner-resolver.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,uBAAuB,EAAE,MAAM,6CAA6C,CAAC;AAGtF,OAAO,EAAE,kCAAkC,EAAE,MAAM,qCAAqC,CAAC;AAOzF,eAAO,MAAM,4CAA4C,WAAY,kCAAkC,KAAG,uBAMzG,CAAC;AAOF,eAAO,MAAM,kDAAkD,WAAY,kCAAkC,KAAG,uBAM/G,CAAC"}
|
@@ -3,14 +3,32 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
3
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
4
4
|
};
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
6
|
-
exports.
|
6
|
+
exports.verifySessionOwnerAssistantResponseMappingTemplate = exports.verifySessionOwnerSendMessageMappingTemplate = void 0;
|
7
7
|
const graphql_transformer_core_1 = require("@aws-amplify/graphql-transformer-core");
|
8
8
|
const fs_1 = __importDefault(require("fs"));
|
9
9
|
const path_1 = __importDefault(require("path"));
|
10
|
-
const
|
11
|
-
const
|
10
|
+
const verifySessionOwnerSendMessageMappingTemplate = (config) => {
|
11
|
+
const substitutions = {
|
12
|
+
CONVERSATION_ID_PARENT: 'ctx.args',
|
13
|
+
};
|
12
14
|
const templateName = `Mutation.${config.field.name.value}.verify-session-owner.js`;
|
13
|
-
return
|
15
|
+
return verifySessionOwnerMappingTemplate(templateName, substitutions);
|
16
|
+
};
|
17
|
+
exports.verifySessionOwnerSendMessageMappingTemplate = verifySessionOwnerSendMessageMappingTemplate;
|
18
|
+
const verifySessionOwnerAssistantResponseMappingTemplate = (config) => {
|
19
|
+
const substitutions = {
|
20
|
+
CONVERSATION_ID_PARENT: 'ctx.args.input',
|
21
|
+
};
|
22
|
+
const templateName = `Mutation.${config.field.name.value}AssistantResponse.verify-session-owner.js`;
|
23
|
+
return verifySessionOwnerMappingTemplate(templateName, substitutions);
|
24
|
+
};
|
25
|
+
exports.verifySessionOwnerAssistantResponseMappingTemplate = verifySessionOwnerAssistantResponseMappingTemplate;
|
26
|
+
const verifySessionOwnerMappingTemplate = (name, substitute) => {
|
27
|
+
let resolver = fs_1.default.readFileSync(path_1.default.join(__dirname, 'verify-session-owner-resolver-fn.template.js'), 'utf8');
|
28
|
+
Object.entries(substitute).forEach(([key, value]) => {
|
29
|
+
const replaced = resolver.replace(new RegExp(`\\[\\[${key}\\]\\]`, 'g'), value);
|
30
|
+
resolver = replaced;
|
31
|
+
});
|
32
|
+
return graphql_transformer_core_1.MappingTemplate.s3MappingFunctionCodeFromString(resolver, name);
|
14
33
|
};
|
15
|
-
exports.verifySessionOwnerMappingTemplate = verifySessionOwnerMappingTemplate;
|
16
34
|
//# sourceMappingURL=verify-session-owner-resolver.js.map
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"verify-session-owner-resolver.js","sourceRoot":"","sources":["../../src/resolvers/verify-session-owner-resolver.ts"],"names":[],"mappings":";;;;;;AAAA,oFAAwE;AAExE,4CAAoB;AACpB,gDAAwB;AAQjB,MAAM,iCAAiC,GAAG,CAAC,MAA0C,EAA2B,EAAE;
|
1
|
+
{"version":3,"file":"verify-session-owner-resolver.js","sourceRoot":"","sources":["../../src/resolvers/verify-session-owner-resolver.ts"],"names":[],"mappings":";;;;;;AAAA,oFAAwE;AAExE,4CAAoB;AACpB,gDAAwB;AAQjB,MAAM,4CAA4C,GAAG,CAAC,MAA0C,EAA2B,EAAE;IAClI,MAAM,aAAa,GAAG;QACpB,sBAAsB,EAAE,UAAU;KACnC,CAAC;IACF,MAAM,YAAY,GAAG,YAAY,MAAM,CAAC,KAAK,CAAC,IAAI,CAAC,KAAK,0BAA0B,CAAC;IACnF,OAAO,iCAAiC,CAAC,YAAY,EAAE,aAAa,CAAC,CAAC;AACxE,CAAC,CAAC;AANW,QAAA,4CAA4C,gDAMvD;AAOK,MAAM,kDAAkD,GAAG,CAAC,MAA0C,EAA2B,EAAE;IACxI,MAAM,aAAa,GAAG;QACpB,sBAAsB,EAAE,gBAAgB;KACzC,CAAC;IACF,MAAM,YAAY,GAAG,YAAY,MAAM,CAAC,KAAK,CAAC,IAAI,CAAC,KAAK,2CAA2C,CAAC;IACpG,OAAO,iCAAiC,CAAC,YAAY,EAAE,aAAa,CAAC,CAAC;AACxE,CAAC,CAAC;AANW,QAAA,kDAAkD,sDAM7D;AAEF,MAAM,iCAAiC,GAAG,CAAC,IAAY,EAAE,UAAkC,EAAE,EAAE;IAC7F,IAAI,QAAQ,GAAG,YAAE,CAAC,YAAY,CAAC,cAAI,CAAC,IAAI,CAAC,SAAS,EAAE,8CAA8C,CAAC,EAAE,MAAM,CAAC,CAAC;IAC7G,MAAM,CAAC,OAAO,CAAC,UAAU,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,GAAG,EAAE,KAAK,CAAC,EAAE,EAAE;QAClD,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,OAAO,0CAAe,CAAC,+BAA+B,CAAC,QAAQ,EAAE,IAAI,CAAC,CAAC;AACzE,CAAC,CAAC"}
|
@@ -1,3 +1,4 @@
|
|
1
1
|
import { MappingTemplateProvider } from '@aws-amplify/graphql-transformer-interfaces';
|
2
|
-
|
2
|
+
import { ConversationDirectiveConfiguration } from '../grapqhl-conversation-transformer';
|
3
|
+
export declare const writeMessageToTableMappingTemplate: (config: ConversationDirectiveConfiguration) => MappingTemplateProvider;
|
3
4
|
//# sourceMappingURL=write-message-to-table-resolver.d.ts.map
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"write-message-to-table-resolver.d.ts","sourceRoot":"","sources":["../../src/resolvers/write-message-to-table-resolver.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,uBAAuB,EAAE,MAAM,6CAA6C,CAAC;
|
1
|
+
{"version":3,"file":"write-message-to-table-resolver.d.ts","sourceRoot":"","sources":["../../src/resolvers/write-message-to-table-resolver.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,uBAAuB,EAAE,MAAM,6CAA6C,CAAC;AAGtF,OAAO,EAAE,kCAAkC,EAAE,MAAM,qCAAqC,CAAC;AAQzF,eAAO,MAAM,kCAAkC,WAAY,kCAAkC,KAAG,uBAa/F,CAAC"}
|
@@ -7,9 +7,11 @@ exports.writeMessageToTableMappingTemplate = void 0;
|
|
7
7
|
const graphql_transformer_core_1 = require("@aws-amplify/graphql-transformer-core");
|
8
8
|
const fs_1 = __importDefault(require("fs"));
|
9
9
|
const path_1 = __importDefault(require("path"));
|
10
|
-
const
|
10
|
+
const graphql_transformer_common_1 = require("graphql-transformer-common");
|
11
|
+
const writeMessageToTableMappingTemplate = (config) => {
|
12
|
+
const fieldName = config.field.name.value;
|
11
13
|
const substitutions = {
|
12
|
-
CONVERSATION_MESSAGE_TYPE_NAME: `ConversationMessage${fieldName}`,
|
14
|
+
CONVERSATION_MESSAGE_TYPE_NAME: `ConversationMessage${(0, graphql_transformer_common_1.toUpper)(fieldName)}`,
|
13
15
|
};
|
14
16
|
let resolver = fs_1.default.readFileSync(path_1.default.join(__dirname, 'write-message-to-table-resolver-fn.template.js'), 'utf8');
|
15
17
|
Object.entries(substitutions).forEach(([key, value]) => {
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"write-message-to-table-resolver.js","sourceRoot":"","sources":["../../src/resolvers/write-message-to-table-resolver.ts"],"names":[],"mappings":";;;;;;AAAA,oFAAwE;AAExE,4CAAoB;AACpB,gDAAwB;
|
1
|
+
{"version":3,"file":"write-message-to-table-resolver.js","sourceRoot":"","sources":["../../src/resolvers/write-message-to-table-resolver.ts"],"names":[],"mappings":";;;;;;AAAA,oFAAwE;AAExE,4CAAoB;AACpB,gDAAwB;AAExB,2EAAqD;AAO9C,MAAM,kCAAkC,GAAG,CAAC,MAA0C,EAA2B,EAAE;IACxH,MAAM,SAAS,GAAG,MAAM,CAAC,KAAK,CAAC,IAAI,CAAC,KAAK,CAAC;IAC1C,MAAM,aAAa,GAAG;QACpB,8BAA8B,EAAE,sBAAsB,IAAA,oCAAO,EAAC,SAAS,CAAC,EAAE;KAC3E,CAAC;IACF,IAAI,QAAQ,GAAG,YAAE,CAAC,YAAY,CAAC,cAAI,CAAC,IAAI,CAAC,SAAS,EAAE,gDAAgD,CAAC,EAAE,MAAM,CAAC,CAAC;IAC/G,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;IAEH,MAAM,YAAY,GAAG,YAAY,SAAS,4BAA4B,CAAC;IACvE,OAAO,0CAAe,CAAC,+BAA+B,CAAC,QAAQ,EAAE,YAAY,CAAC,CAAC;AACjF,CAAC,CAAC;AAbW,QAAA,kCAAkC,sCAa7C"}
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"conversation-prepare-handler.d.ts","sourceRoot":"","sources":["../../src/transformer-steps/conversation-prepare-handler.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,qCAAqC,EAAE,MAAM,6CAA6C,CAAC;AACpG,OAAO,EAAE,gBAAgB,EAAE,MAAM,wCAAwC,CAAC;AAC1E,OAAO,EAAE,oBAAoB,EAAE,kBAAkB,EAAE,MAAM,6CAA6C,CAAC;AACvG,OAAO,EAAE,uBAAuB,EAAE,MAAM,6CAA6C,CAAC;AAEtF,OAAO,EAAE,kCAAkC,EAAE,MAAM,qCAAqC,CAAC;AAOzF,qBAAa,0BAA0B;IACrC,OAAO,CAAC,gBAAgB,CAAmB;IAC3C,OAAO,CAAC,kBAAkB,CAAqB;IAC/C,OAAO,CAAC,oBAAoB,CAAuB;IACnD,OAAO,CAAC,YAAY,CAA0B;gBAU5C,gBAAgB,EAAE,gBAAgB,EAClC,kBAAkB,EAAE,kBAAkB,EACtC,oBAAoB,EAAE,oBAAoB,EAC1C,YAAY,EAAE,uBAAuB;IAmBvC,OAAO,CAAC,GAAG,EAAE,qCAAqC,EAAE,UAAU,EAAE,kCAAkC,EAAE,GAAG,IAAI;IAkB3G,OAAO,CAAC,4BAA4B;
|
1
|
+
{"version":3,"file":"conversation-prepare-handler.d.ts","sourceRoot":"","sources":["../../src/transformer-steps/conversation-prepare-handler.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,qCAAqC,EAAE,MAAM,6CAA6C,CAAC;AACpG,OAAO,EAAE,gBAAgB,EAAE,MAAM,wCAAwC,CAAC;AAC1E,OAAO,EAAE,oBAAoB,EAAE,kBAAkB,EAAE,MAAM,6CAA6C,CAAC;AACvG,OAAO,EAAE,uBAAuB,EAAE,MAAM,6CAA6C,CAAC;AAEtF,OAAO,EAAE,kCAAkC,EAAE,MAAM,qCAAqC,CAAC;AAOzF,qBAAa,0BAA0B;IACrC,OAAO,CAAC,gBAAgB,CAAmB;IAC3C,OAAO,CAAC,kBAAkB,CAAqB;IAC/C,OAAO,CAAC,oBAAoB,CAAuB;IACnD,OAAO,CAAC,YAAY,CAA0B;gBAU5C,gBAAgB,EAAE,gBAAgB,EAClC,kBAAkB,EAAE,kBAAkB,EACtC,oBAAoB,EAAE,oBAAoB,EAC1C,YAAY,EAAE,uBAAuB;IAmBvC,OAAO,CAAC,GAAG,EAAE,qCAAqC,EAAE,UAAU,EAAE,kCAAkC,EAAE,GAAG,IAAI;IAkB3G,OAAO,CAAC,4BAA4B;CAkErC"}
|
@@ -16,11 +16,12 @@ class ConversationPrepareHandler {
|
|
16
16
|
}
|
17
17
|
prepareResourcesForDirective(directive, ctx) {
|
18
18
|
const { conversationAuthDirective, conversationModelDirective, conversationHasManyMessagesDirective, conversationMessagesField, conversationModel, } = directive.conversationModel;
|
19
|
-
const { messageAuthDirective, messageModelDirective, messageBelongsToConversationDirective, messageConversationField, messageModel, messageSubscription, assistantMutationField, assistantMutationInput, } = directive.messageModel;
|
19
|
+
const { messageAuthDirective, messageModelDirective, messageBelongsToConversationDirective, messageConversationField, messageModel, messageSubscription, assistantMutationField, assistantMutationInput, assistantStreamingMutationField, assistantStreamingMutationInput, } = directive.messageModel;
|
20
20
|
const sessionModelName = conversationModel.name.value;
|
21
21
|
const messageModelName = messageModel.name.value;
|
22
22
|
ctx.output.addInput(assistantMutationInput);
|
23
|
-
ctx.output.
|
23
|
+
ctx.output.addInput(assistantStreamingMutationInput);
|
24
|
+
ctx.output.addMutationFields([assistantMutationField, assistantStreamingMutationField]);
|
24
25
|
ctx.output.addSubscriptionFields([messageSubscription]);
|
25
26
|
ctx.output.addObject(conversationModel);
|
26
27
|
ctx.output.addObject(messageModel);
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"conversation-prepare-handler.js","sourceRoot":"","sources":["../../src/transformer-steps/conversation-prepare-handler.ts"],"names":[],"mappings":";;;AAIA,oFAAyH;AAQzH,MAAa,0BAA0B;IAarC,YACE,gBAAkC,EAClC,kBAAsC,EACtC,oBAA0C,EAC1C,YAAqC;QAErC,IAAI,CAAC,gBAAgB,GAAG,gBAAgB,CAAC;QACzC,IAAI,CAAC,kBAAkB,GAAG,kBAAkB,CAAC;QAC7C,IAAI,CAAC,oBAAoB,GAAG,oBAAoB,CAAC;QACjD,IAAI,CAAC,YAAY,GAAG,YAAY,CAAC;IACnC,CAAC;IAaD,OAAO,CAAC,GAA0C,EAAE,UAAgD;QAClG,KAAK,MAAM,SAAS,IAAI,UAAU,EAAE;YAClC,IAAI,CAAC,4BAA4B,CAAC,SAAS,EAAE,GAAG,CAAC,CAAC;SACnD;IACH,CAAC;IAcO,4BAA4B,CAAC,SAA6C,EAAE,GAA0C;QAI5H,MAAM,EACJ,yBAAyB,EACzB,0BAA0B,EAC1B,oCAAoC,EACpC,yBAAyB,EACzB,iBAAiB,GAClB,GAAG,SAAS,CAAC,iBAAiB,CAAC;QAGhC,MAAM,EACJ,oBAAoB,EACpB,qBAAqB,EACrB,qCAAqC,EACrC,wBAAwB,EACxB,YAAY,EACZ,mBAAmB,EACnB,sBAAsB,EACtB,sBAAsB,
|
1
|
+
{"version":3,"file":"conversation-prepare-handler.js","sourceRoot":"","sources":["../../src/transformer-steps/conversation-prepare-handler.ts"],"names":[],"mappings":";;;AAIA,oFAAyH;AAQzH,MAAa,0BAA0B;IAarC,YACE,gBAAkC,EAClC,kBAAsC,EACtC,oBAA0C,EAC1C,YAAqC;QAErC,IAAI,CAAC,gBAAgB,GAAG,gBAAgB,CAAC;QACzC,IAAI,CAAC,kBAAkB,GAAG,kBAAkB,CAAC;QAC7C,IAAI,CAAC,oBAAoB,GAAG,oBAAoB,CAAC;QACjD,IAAI,CAAC,YAAY,GA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,CAAC,YAAY,EAAE,IAAI,CAAC,gBAAgB,CAAC,CAAC;QAGrF,GAAG,CAAC,oBAAoB,CAAC,gBAAgB,CAAC,GAAG,kEAAuC,CAAC;QACrF,GAAG,CAAC,oBAAoB,CAAC,gBAAgB,CAAC,GAAG,kEAAuC,CAAC;QAGrF,IAAI,CAAC,gBAAgB,CAAC,MAAM,CAAC,iBAAiB,EAAE,0BAA0B,EAAE,GAAG,CAAC,CAAC;QACjF,IAAI,CAAC,gBAAgB,CAAC,MAAM,CAAC,YAAY,EAAE,qBAAqB,EAAE,GAAG,CAAC,CAAC;QAKvE,IAAI,CAAC,gBAAgB,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC;QAGlC,IAAI,CAAC,oBAAoB,CAAC,KAAK,CAAC,YAAY,EAAE,wBAAwB,EAAE,qCAAqC,EAAE,GAAG,CAAC,CAAC;QACpH,IAAI,CAAC,kBAAkB,CAAC,KAAK,CAAC,iBAAiB,EAAE,yBAAyB,EAAE,oCAAoC,EAAE,GAAG,CAAC,CAAC;QAGvH,IAAI,CAAC,IAAI,CAAC,YAAY,CAAC,MAAM,EAAE;YAC7B,MAAM,IAAI,kDAAuB,CAAC,mCAAmC,CAAC,CAAC;SACxE;QACD,IAAI,CAAC,YAAY,CAAC,MAAM,CAAC,iBAAiB,EAAE,yBAAyB,EAAE,GAAG,CAAC,CAAC;QAC5E,IAAI,CAAC,YAAY,CAAC,MAAM,CAAC,YAAY,EAAE,oBAAoB,EAAE,GAAG,CAAC,CAAC;IACpE,CAAC;CACF;AAxHD,gEAwHC"}
|
@@ -1,19 +1,23 @@
|
|
1
1
|
import { TransformerContextProvider } from '@aws-amplify/graphql-transformer-interfaces';
|
2
2
|
import { ConversationDirectiveConfiguration } from '../grapqhl-conversation-transformer';
|
3
|
+
import * as cdk from 'aws-cdk-lib';
|
3
4
|
export declare class ConversationResolverGenerator {
|
5
|
+
private readonly functionNameMap?;
|
6
|
+
constructor(functionNameMap?: Record<string, cdk.aws_lambda.IFunction> | undefined);
|
4
7
|
generateResolvers(directives: ConversationDirectiveConfiguration[], ctx: TransformerContextProvider): void;
|
5
8
|
private processToolsForDirective;
|
6
9
|
private generateResolversForDirective;
|
7
10
|
private createFunctionStack;
|
8
11
|
private setupFunctionDataSource;
|
9
12
|
private setupExistingFunctionDataSource;
|
10
|
-
private lambdaArnResource;
|
11
13
|
private setupDefaultConversationHandler;
|
12
14
|
private createConversationPipelineResolver;
|
13
15
|
private addPipelineResolverFunctions;
|
14
16
|
private createAssistantResponseResolver;
|
17
|
+
private createAssistantStreamingResponseResolver;
|
15
18
|
private createAssistantResponseSubscriptionResolver;
|
16
19
|
private addLambdaDataSource;
|
20
|
+
private addInitSlotToListMessagesPipeline;
|
17
21
|
private setupMessageTableIndex;
|
18
22
|
private addGlobalSecondaryIndex;
|
19
23
|
}
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"conversation-resolver-generator.d.ts","sourceRoot":"","sources":["../../src/transformer-steps/conversation-resolver-generator.ts"],"names":[],"mappings":"AAAA,OAAO,EAA2B,0BAA0B,EAAE,MAAM,6CAA6C,CAAC;AAClH,OAAO,EAAE,kCAAkC,EAAE,MAAM,qCAAqC,CAAC;
|
1
|
+
{"version":3,"file":"conversation-resolver-generator.d.ts","sourceRoot":"","sources":["../../src/transformer-steps/conversation-resolver-generator.ts"],"names":[],"mappings":"AAAA,OAAO,EAA2B,0BAA0B,EAAE,MAAM,6CAA6C,CAAC;AAClH,OAAO,EAAE,kCAAkC,EAAE,MAAM,qCAAqC,CAAC;AAIzF,OAAO,KAAK,GAAG,MAAM,aAAa,CAAC;AAyBnC,qBAAa,6BAA6B;IAC5B,OAAO,CAAC,QAAQ,CAAC,eAAe,CAAC;gBAAhB,eAAe,CAAC,sDAA2B;IAExE,iBAAiB,CAAC,UAAU,EAAE,kCAAkC,EAAE,EAAE,GAAG,EAAE,0BAA0B,GAAG,IAAI;IAQ1G,OAAO,CAAC,wBAAwB;IAOhC,OAAO,CAAC,6BAA6B;IA0DrC,OAAO,CAAC,mBAAmB;IAW3B,OAAO,CAAC,uBAAuB;IAkB/B,OAAO,CAAC,+BAA+B;IAmBvC,OAAO,CAAC,+BAA+B;IAgCvC,OAAO,CAAC,kCAAkC;IA6C1C,OAAO,CAAC,4BAA4B;IAkCpC,OAAO,CAAC,+BAA+B;IAsCvC,OAAO,CAAC,wCAAwC;IA2ChD,OAAO,CAAC,2CAA2C;IAqCnD,OAAO,CAAC,mBAAmB;IAa3B,OAAO,CAAC,iCAAiC;IAazC,OAAO,CAAC,sBAAsB;IAsB9B,OAAO,CAAC,uBAAuB;CAgChC"}
|
@@ -22,6 +22,9 @@ var __importStar = (this && this.__importStar) || function (mod) {
|
|
22
22
|
__setModuleDefault(result, mod);
|
23
23
|
return result;
|
24
24
|
};
|
25
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
26
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
27
|
+
};
|
25
28
|
Object.defineProperty(exports, "__esModule", { value: true });
|
26
29
|
exports.ConversationResolverGenerator = void 0;
|
27
30
|
const tools_1 = require("../utils/tools");
|
@@ -29,22 +32,27 @@ const graphql_transformer_core_1 = require("@aws-amplify/graphql-transformer-cor
|
|
29
32
|
const graphql_transformer_common_1 = require("graphql-transformer-common");
|
30
33
|
const cdk = __importStar(require("aws-cdk-lib"));
|
31
34
|
const ai_constructs_1 = require("@aws-amplify/ai-constructs");
|
32
|
-
const aws_lambda_1 = require("aws-cdk-lib/aws-lambda");
|
33
35
|
const graphql_transformer_core_2 = require("@aws-amplify/graphql-transformer-core");
|
34
36
|
const init_resolver_1 = require("../resolvers/init-resolver");
|
35
37
|
const auth_resolver_1 = require("../resolvers/auth-resolver");
|
36
38
|
const verify_session_owner_resolver_1 = require("../resolvers/verify-session-owner-resolver");
|
37
39
|
const write_message_to_table_resolver_1 = require("../resolvers/write-message-to-table-resolver");
|
38
|
-
const message_history_resolver_1 = require("../resolvers/message-history-resolver");
|
39
40
|
const invoke_lambda_resolver_1 = require("../resolvers/invoke-lambda-resolver");
|
40
41
|
const assistant_mutation_resolver_1 = require("../resolvers/assistant-mutation-resolver");
|
41
42
|
const assistant_messages_subscription_resolver_1 = require("../resolvers/assistant-messages-subscription-resolver");
|
42
43
|
const graphql_index_transformer_1 = require("@aws-amplify/graphql-index-transformer");
|
44
|
+
const pluralize_1 = __importDefault(require("pluralize"));
|
45
|
+
const list_messages_init_resolver_1 = require("../resolvers/list-messages-init-resolver");
|
46
|
+
const assistant_streaming_mutation_resolver_1 = require("../resolvers/assistant-streaming-mutation-resolver");
|
43
47
|
class ConversationResolverGenerator {
|
48
|
+
constructor(functionNameMap) {
|
49
|
+
this.functionNameMap = functionNameMap;
|
50
|
+
}
|
44
51
|
generateResolvers(directives, ctx) {
|
45
52
|
for (const directive of directives) {
|
46
53
|
this.processToolsForDirective(directive, ctx);
|
47
54
|
this.generateResolversForDirective(directive, ctx);
|
55
|
+
this.addInitSlotToListMessagesPipeline(ctx, directive);
|
48
56
|
}
|
49
57
|
}
|
50
58
|
processToolsForDirective(directive, ctx) {
|
@@ -60,34 +68,41 @@ class ConversationResolverGenerator {
|
|
60
68
|
const fieldName = field.name.value;
|
61
69
|
const functionStack = this.createFunctionStack(ctx, capitalizedFieldName);
|
62
70
|
const { functionDataSourceId, referencedFunction } = this.setupFunctionDataSource(directive, functionStack, capitalizedFieldName);
|
63
|
-
this.createAssistantResponseResolver(ctx, directive, capitalizedFieldName);
|
64
|
-
this.createAssistantResponseSubscriptionResolver(ctx, directive, capitalizedFieldName);
|
65
71
|
const functionDataSource = this.addLambdaDataSource(ctx, functionDataSourceId, referencedFunction, capitalizedFieldName);
|
66
|
-
const invokeLambdaFunction = (0, invoke_lambda_resolver_1.invokeLambdaMappingTemplate)(directive
|
72
|
+
const invokeLambdaFunction = (0, invoke_lambda_resolver_1.invokeLambdaMappingTemplate)(directive);
|
67
73
|
this.setupMessageTableIndex(ctx, directive);
|
68
|
-
|
74
|
+
const initResolverFunction = (0, init_resolver_1.initMappingTemplate)(ctx);
|
75
|
+
const authResolverFunction = (0, auth_resolver_1.authMappingTemplate)(directive);
|
76
|
+
const verifySessionOwnerSendMessageResolverFunction = (0, verify_session_owner_resolver_1.verifySessionOwnerSendMessageMappingTemplate)(directive);
|
77
|
+
const verifySessionOwnerAssistantResponseResolverFunction = (0, verify_session_owner_resolver_1.verifySessionOwnerAssistantResponseMappingTemplate)(directive);
|
78
|
+
const writeMessageToTableFunction = (0, write_message_to_table_resolver_1.writeMessageToTableMappingTemplate)(directive);
|
79
|
+
this.createConversationPipelineResolver(ctx, parentName, fieldName, capitalizedFieldName, functionDataSource, invokeLambdaFunction, initResolverFunction, authResolverFunction, verifySessionOwnerSendMessageResolverFunction, writeMessageToTableFunction);
|
80
|
+
this.createAssistantResponseResolver(ctx, directive, capitalizedFieldName, initResolverFunction, authResolverFunction, verifySessionOwnerAssistantResponseResolverFunction);
|
81
|
+
this.createAssistantStreamingResponseResolver(ctx, directive, capitalizedFieldName, initResolverFunction, authResolverFunction, verifySessionOwnerAssistantResponseResolverFunction);
|
82
|
+
this.createAssistantResponseSubscriptionResolver(ctx, directive, capitalizedFieldName);
|
69
83
|
}
|
70
84
|
createFunctionStack(ctx, capitalizedFieldName) {
|
71
85
|
return ctx.stackManager.createStack(`${capitalizedFieldName}ConversationDirectiveLambdaStack`);
|
72
86
|
}
|
73
87
|
setupFunctionDataSource(directive, functionStack, capitalizedFieldName) {
|
74
88
|
if (directive.functionName) {
|
75
|
-
return this.setupExistingFunctionDataSource(directive.functionName
|
89
|
+
return this.setupExistingFunctionDataSource(directive.functionName);
|
76
90
|
}
|
77
91
|
else {
|
78
92
|
return this.setupDefaultConversationHandler(functionStack, capitalizedFieldName, directive.aiModel);
|
79
93
|
}
|
80
94
|
}
|
81
|
-
setupExistingFunctionDataSource(functionName
|
95
|
+
setupExistingFunctionDataSource(functionName) {
|
82
96
|
const functionDataSourceId = graphql_transformer_common_1.FunctionResourceIDs.FunctionDataSourceID(functionName);
|
83
|
-
|
84
|
-
|
85
|
-
}
|
97
|
+
if (!this.functionNameMap) {
|
98
|
+
throw new Error('Function name map is not provided');
|
99
|
+
}
|
100
|
+
const referencedFunction = this.functionNameMap[functionName];
|
101
|
+
if (!referencedFunction) {
|
102
|
+
throw new Error(`Function ${functionName} not found in function name map`);
|
103
|
+
}
|
86
104
|
return { functionDataSourceId, referencedFunction };
|
87
105
|
}
|
88
|
-
lambdaArnResource(name) {
|
89
|
-
return cdk.Fn.sub('arn:aws:lambda:${AWS::Region}:${AWS::AccountId}:function:${name}', { name });
|
90
|
-
}
|
91
106
|
setupDefaultConversationHandler(functionStack, capitalizedFieldName, aiModel) {
|
92
107
|
const defaultConversationHandler = new ai_constructs_1.conversation.ConversationHandlerFunction(functionStack, `${capitalizedFieldName}DefaultConversationHandler`, {
|
93
108
|
models: [
|
@@ -100,38 +115,52 @@ class ConversationResolverGenerator {
|
|
100
115
|
const referencedFunction = defaultConversationHandler.resources.lambda;
|
101
116
|
return { functionDataSourceId, referencedFunction };
|
102
117
|
}
|
103
|
-
createConversationPipelineResolver(ctx, parentName, fieldName, capitalizedFieldName, functionDataSource, invokeLambdaFunction,
|
118
|
+
createConversationPipelineResolver(ctx, parentName, fieldName, capitalizedFieldName, functionDataSource, invokeLambdaFunction, initResolverFunction, authResolverFunction, verifySessionOwnerResolverFunction, writeMessageToTableFunction) {
|
104
119
|
const resolverResourceId = graphql_transformer_common_1.ResolverResourceIDs.ResolverResourceID(parentName, fieldName);
|
105
120
|
const runtime = graphql_transformer_core_1.APPSYNC_JS_RUNTIME;
|
106
|
-
const conversationPipelineResolver = new graphql_transformer_core_1.TransformerResolver(parentName, fieldName, resolverResourceId, { codeMappingTemplate: invokeLambdaFunction }, ['init', 'auth', 'verifySessionOwner', 'writeMessageToTable'
|
107
|
-
this.addPipelineResolverFunctions(ctx, conversationPipelineResolver, capitalizedFieldName,
|
121
|
+
const conversationPipelineResolver = new graphql_transformer_core_1.TransformerResolver(parentName, fieldName, resolverResourceId, { codeMappingTemplate: invokeLambdaFunction }, ['init', 'auth', 'verifySessionOwner', 'writeMessageToTable'], ['handleLambdaResponse', 'finish'], functionDataSource, runtime);
|
122
|
+
this.addPipelineResolverFunctions(ctx, conversationPipelineResolver, capitalizedFieldName, initResolverFunction, authResolverFunction, verifySessionOwnerResolverFunction, writeMessageToTableFunction);
|
108
123
|
ctx.resolvers.addResolver(parentName, fieldName, conversationPipelineResolver);
|
109
124
|
}
|
110
|
-
addPipelineResolverFunctions(ctx, resolver, capitalizedFieldName,
|
111
|
-
|
112
|
-
resolver.addJsFunctionToSlot('
|
113
|
-
const authFunction = (0, auth_resolver_1.authMappingTemplate)(directive);
|
114
|
-
resolver.addJsFunctionToSlot('auth', authFunction);
|
115
|
-
const verifySessionOwnerFunction = (0, verify_session_owner_resolver_1.verifySessionOwnerMappingTemplate)(directive);
|
125
|
+
addPipelineResolverFunctions(ctx, resolver, capitalizedFieldName, initResolverFunction, authResolverFunction, verifySessionOwnerResolverFunction, writeMessageToTableFunction) {
|
126
|
+
resolver.addJsFunctionToSlot('init', initResolverFunction);
|
127
|
+
resolver.addJsFunctionToSlot('auth', authResolverFunction);
|
116
128
|
const sessionModelName = `Conversation${capitalizedFieldName}`;
|
117
129
|
const sessionModelDDBDataSourceName = (0, graphql_transformer_core_2.getModelDataSourceNameForTypeName)(ctx, sessionModelName);
|
118
130
|
const conversationSessionDDBDataSource = ctx.api.host.getDataSource(sessionModelDDBDataSourceName);
|
119
|
-
resolver.addJsFunctionToSlot('verifySessionOwner',
|
120
|
-
const writeMessageToTableFunction = (0, write_message_to_table_resolver_1.writeMessageToTableMappingTemplate)(capitalizedFieldName);
|
131
|
+
resolver.addJsFunctionToSlot('verifySessionOwner', verifySessionOwnerResolverFunction, conversationSessionDDBDataSource);
|
121
132
|
const messageModelName = `ConversationMessage${capitalizedFieldName}`;
|
122
133
|
const messageModelDDBDataSourceName = (0, graphql_transformer_core_2.getModelDataSourceNameForTypeName)(ctx, messageModelName);
|
123
134
|
const messageDDBDataSource = ctx.api.host.getDataSource(messageModelDDBDataSourceName);
|
124
135
|
resolver.addJsFunctionToSlot('writeMessageToTable', writeMessageToTableFunction, messageDDBDataSource);
|
125
|
-
const retrieveMessageHistoryFunction = (0, message_history_resolver_1.readHistoryMappingTemplate)(directive);
|
126
|
-
resolver.addJsFunctionToSlot('retrieveMessageHistory', retrieveMessageHistoryFunction, messageDDBDataSource);
|
127
136
|
}
|
128
|
-
createAssistantResponseResolver(ctx, directive, capitalizedFieldName) {
|
137
|
+
createAssistantResponseResolver(ctx, directive, capitalizedFieldName, initResolverFunction, authResolverFunction, verifySessionOwnerResolverFunction) {
|
129
138
|
const assistantResponseResolverResourceId = graphql_transformer_common_1.ResolverResourceIDs.ResolverResourceID('Mutation', directive.responseMutationName);
|
130
139
|
const assistantResponseResolverFunction = (0, assistant_mutation_resolver_1.assistantMutationResolver)(directive);
|
131
140
|
const conversationMessageDataSourceName = (0, graphql_transformer_core_2.getModelDataSourceNameForTypeName)(ctx, `ConversationMessage${capitalizedFieldName}`);
|
132
141
|
const conversationMessageDataSource = ctx.api.host.getDataSource(conversationMessageDataSourceName);
|
133
|
-
const
|
134
|
-
|
142
|
+
const resolver = new graphql_transformer_core_1.TransformerResolver('Mutation', directive.responseMutationName, assistantResponseResolverResourceId, { codeMappingTemplate: assistantResponseResolverFunction }, ['init', 'auth', 'verifySessionOwner'], [], conversationMessageDataSource, graphql_transformer_core_1.APPSYNC_JS_RUNTIME);
|
143
|
+
resolver.addJsFunctionToSlot('init', initResolverFunction);
|
144
|
+
resolver.addJsFunctionToSlot('auth', authResolverFunction);
|
145
|
+
const sessionModelName = `Conversation${capitalizedFieldName}`;
|
146
|
+
const sessionModelDDBDataSourceName = (0, graphql_transformer_core_2.getModelDataSourceNameForTypeName)(ctx, sessionModelName);
|
147
|
+
const conversationSessionDDBDataSource = ctx.api.host.getDataSource(sessionModelDDBDataSourceName);
|
148
|
+
resolver.addJsFunctionToSlot('verifySessionOwner', verifySessionOwnerResolverFunction, conversationSessionDDBDataSource);
|
149
|
+
ctx.resolvers.addResolver('Mutation', directive.responseMutationName, resolver);
|
150
|
+
}
|
151
|
+
createAssistantStreamingResponseResolver(ctx, directive, capitalizedFieldName, initResolverFunction, authResolverFunction, verifySessionOwnerResolverFunction) {
|
152
|
+
const assistantResponseResolverResourceId = graphql_transformer_common_1.ResolverResourceIDs.ResolverResourceID('Mutation', directive.messageModel.assistantStreamingMutationField.name.value);
|
153
|
+
const assistantResponseResolverFunction = (0, assistant_streaming_mutation_resolver_1.assistantStreamingMutationResolver)(directive);
|
154
|
+
const conversationMessageDataSourceName = (0, graphql_transformer_core_2.getModelDataSourceNameForTypeName)(ctx, `ConversationMessage${capitalizedFieldName}`);
|
155
|
+
const conversationMessageDataSource = ctx.api.host.getDataSource(conversationMessageDataSourceName);
|
156
|
+
const resolver = new graphql_transformer_core_1.TransformerResolver('Mutation', directive.messageModel.assistantStreamingMutationField.name.value, assistantResponseResolverResourceId, { codeMappingTemplate: assistantResponseResolverFunction }, ['init', 'auth', 'verifySessionOwner'], [], conversationMessageDataSource, graphql_transformer_core_1.APPSYNC_JS_RUNTIME);
|
157
|
+
resolver.addJsFunctionToSlot('init', initResolverFunction);
|
158
|
+
resolver.addJsFunctionToSlot('auth', authResolverFunction);
|
159
|
+
const sessionModelName = `Conversation${capitalizedFieldName}`;
|
160
|
+
const sessionModelDDBDataSourceName = (0, graphql_transformer_core_2.getModelDataSourceNameForTypeName)(ctx, sessionModelName);
|
161
|
+
const conversationSessionDDBDataSource = ctx.api.host.getDataSource(sessionModelDDBDataSourceName);
|
162
|
+
resolver.addJsFunctionToSlot('verifySessionOwner', verifySessionOwnerResolverFunction, conversationSessionDDBDataSource);
|
163
|
+
ctx.resolvers.addResolver('Mutation', directive.messageModel.assistantStreamingMutationField.name.value, resolver);
|
135
164
|
}
|
136
165
|
createAssistantResponseSubscriptionResolver(ctx, directive, capitalizedFieldName) {
|
137
166
|
const onAssistantResponseSubscriptionFieldName = `onCreateAssistantResponse${capitalizedFieldName}`;
|
@@ -147,6 +176,13 @@ class ConversationResolverGenerator {
|
|
147
176
|
const functionDataSourceScope = ctx.stackManager.getScopeFor(functionDataSourceId, `${capitalizedFieldName}ConversationDirectiveLambdaStack`);
|
148
177
|
return ctx.api.host.addLambdaDataSource(functionDataSourceId, referencedFunction, {}, functionDataSourceScope);
|
149
178
|
}
|
179
|
+
addInitSlotToListMessagesPipeline(ctx, directive) {
|
180
|
+
const messageModelName = directive.messageModel.messageModel.name.value;
|
181
|
+
const pluralized = (0, pluralize_1.default)(messageModelName);
|
182
|
+
const listMessagesResolver = ctx.resolvers.getResolver('Query', `list${pluralized}`);
|
183
|
+
const initResolverFn = (0, list_messages_init_resolver_1.listMessageInitMappingTemplate)(directive);
|
184
|
+
listMessagesResolver.addJsFunctionToSlot('init', initResolverFn);
|
185
|
+
}
|
150
186
|
setupMessageTableIndex(ctx, directive) {
|
151
187
|
const messageModelName = directive.messageModel.messageModel.name.value;
|
152
188
|
const referenceFieldName = 'conversationId';
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"conversation-resolver-generator.js","sourceRoot":"","sources":["../../src/transformer-steps/conversation-resolver-generator.ts"],"names":[],"mappings":"
|
1
|
+
{"version":3,"file":"conversation-resolver-generator.js","sourceRoot":"","sources":["../../src/transformer-steps/conversation-resolver-generator.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAEA,0CAA8C;AAC9C,oFAAgG;AAChG,2EAAkH;AAClH,iDAAmC;AACnC,8DAA0D;AAE1D,oFAAoG;AACpG,8DAAiE;AACjE,8DAAiE;AACjE,8FAGoD;AACpD,kGAAkG;AAClG,gFAAkF;AAClF,0FAAqF;AACrF,oHAAuH;AACvH,sFAAiF;AACjF,0DAAkC;AAClC,0FAA0F;AAC1F,8GAAwG;AAQxG,MAAa,6BAA6B;IACxC,YAA6B,eAA2C;QAA3C,oBAAe,GAAf,eAAe,CAA4B;IAAG,CAAC;IAE5E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AC/B,GAA+B,EAC/B,QAAgB;QAEhB,KAAK,CAAC,uBAAuB,CAAC;YAC5B,SAAS;YAET,cAAc,EAAE,KAAK;YACrB,YAAY;YACZ,OAAO;YACP,YAAY,EAAE,GAAG,CAAC,EAAE,CAAC,GAAG,CAAC,8CAAiB,CAAC,UAAU,CAAC,0BAA0B,CAAC;YACjF,aAAa,EAAE,GAAG,CAAC,EAAE,CAAC,GAAG,CAAC,8CAAiB,CAAC,UAAU,CAAC,2BAA2B,CAAC;SACpF,CAAC,CAAC;QAEH,MAAM,GAAG,GAAG,KAAK,CAAC,sBAAsB,CAAC,IAAI,CAAC,CAAC,CAAM,EAAE,EAAE,CAAC,CAAC,CAAC,SAAS,KAAK,SAAS,CAAC,CAAC;QAErF,MAAM,QAAQ,GAAG;YACf,SAAS;YACT,SAAS,EAAE,GAAG,CAAC,SAAS;YACxB,UAAU,EAAE,EAAE,cAAc,EAAE,KAAK,EAAE;YACrC,qBAAqB,EAAE,GAAG,CAAC,EAAE,CAAC,WAAW,CAAC,8CAAiB,CAAC,UAAU,CAAC,6BAA6B,EAAE,GAAG,CAAC,EAAE,CAAC,GAAG,CAAC,cAAc,CAAC,EAAE;gBAChI,iBAAiB,EAAE,GAAG,CAAC,EAAE,CAAC,GAAG,CAAC,8CAAiB,CAAC,UAAU,CAAC,0BAA0B,CAAC;gBACtF,kBAAkB,EAAE,GAAG,CAAC,EAAE,CAAC,GAAG,CAAC,8CAAiB,CAAC,UAAU,CAAC,2BAA2B,CAAC;aACzF,CAAC;SACH,CAAC;QAEF,IAAA,mDAAuB,EAAC,GAAG,EAAE,QAAQ,EAAE,KAAK,EAAE,QAAQ,CAAC,CAAC;IAC1D,CAAC;CACF;AAjbD,sEAibC"}
|
@@ -1,6 +1,6 @@
|
|
1
1
|
{
|
2
2
|
"name": "@aws-amplify/graphql-conversation-transformer",
|
3
|
-
"version": "0.
|
3
|
+
"version": "0.3.1-ai-streaming.0",
|
4
4
|
"description": "Amplify GraphQL @conversation transformer",
|
5
5
|
"repository": {
|
6
6
|
"type": "git",
|
@@ -24,23 +24,24 @@
|
|
24
24
|
"extract-api": "ts-node ../../scripts/extract-api.ts"
|
25
25
|
},
|
26
26
|
"dependencies": {
|
27
|
-
"@aws-amplify/ai-constructs": "
|
28
|
-
"@aws-amplify/graphql-directives": "2.
|
29
|
-
"@aws-amplify/graphql-index-transformer": "3.0.
|
30
|
-
"@aws-amplify/graphql-model-transformer": "3.0.
|
31
|
-
"@aws-amplify/graphql-relational-transformer": "3.0.
|
32
|
-
"@aws-amplify/graphql-transformer-core": "3.
|
33
|
-
"@aws-amplify/graphql-transformer-interfaces": "4.1.
|
27
|
+
"@aws-amplify/ai-constructs": "0.0.0-test-20241010141034",
|
28
|
+
"@aws-amplify/graphql-directives": "2.3.0",
|
29
|
+
"@aws-amplify/graphql-index-transformer": "3.0.5",
|
30
|
+
"@aws-amplify/graphql-model-transformer": "3.0.5",
|
31
|
+
"@aws-amplify/graphql-relational-transformer": "3.0.5",
|
32
|
+
"@aws-amplify/graphql-transformer-core": "3.2.0",
|
33
|
+
"@aws-amplify/graphql-transformer-interfaces": "4.1.2",
|
34
34
|
"graphql": "^15.5.0",
|
35
35
|
"graphql-mapping-template": "5.0.1",
|
36
36
|
"graphql-transformer-common": "5.0.1",
|
37
37
|
"immer": "^9.0.12"
|
38
38
|
},
|
39
39
|
"devDependencies": {
|
40
|
-
"@aws-amplify/graphql-transformer-test-utils": "1.0.
|
40
|
+
"@aws-amplify/graphql-transformer-test-utils": "1.0.4",
|
41
|
+
"esbuild": "^0.24.0"
|
41
42
|
},
|
42
43
|
"peerDependencies": {
|
43
|
-
"aws-cdk-lib": "^2.
|
44
|
+
"aws-cdk-lib": "^2.158.0",
|
44
45
|
"constructs": "^10.3.0"
|
45
46
|
},
|
46
47
|
"jest": {
|
@@ -79,5 +80,5 @@
|
|
79
80
|
"/__tests__/"
|
80
81
|
]
|
81
82
|
},
|
82
|
-
"gitHead": "
|
83
|
+
"gitHead": "38ea1510097f7ac52b4ca130cab35f2c3a0abc77"
|
83
84
|
}
|
@@ -3,6 +3,12 @@
|
|
3
3
|
All notable changes to this project will be documented in this file.
|
4
4
|
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
|
5
5
|
|
6
|
+
# [3.1.0](https://github.com/aws-amplify/amplify-category-api/compare/@aws-amplify/graphql-default-value-transformer@3.0.4...@aws-amplify/graphql-default-value-transformer@3.1.0) (2024-10-10)
|
7
|
+
|
8
|
+
### Features
|
9
|
+
|
10
|
+
- auto increment support ([#2883](https://github.com/aws-amplify/amplify-category-api/issues/2883)) ([4e66ac3](https://github.com/aws-amplify/amplify-category-api/commit/4e66ac3a9d276ca063c76a97aee791618b3c71ab))
|
11
|
+
|
6
12
|
## [3.0.4](https://github.com/aws-amplify/amplify-category-api/compare/@aws-amplify/graphql-default-value-transformer@3.0.3...@aws-amplify/graphql-default-value-transformer@3.0.4) (2024-10-01)
|
7
13
|
|
8
14
|
**Note:** Version bump only for package @aws-amplify/graphql-default-value-transformer
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"graphql-default-value-transformer.d.ts","sourceRoot":"","sources":["../src/graphql-default-value-transformer.ts"],"names":[],"mappings":"AAAA,OAAO,
|
1
|
+
{"version":3,"file":"graphql-default-value-transformer.d.ts","sourceRoot":"","sources":["../src/graphql-default-value-transformer.ts"],"names":[],"mappings":"AAAA,OAAO,EAQL,qBAAqB,EACtB,MAAM,uCAAuC,CAAC;AAC/C,OAAO,EACL,0BAA0B,EAE1B,yCAAyC,EACzC,6CAA6C,EAC9C,MAAM,6CAA6C,CAAC;AAErD,OAAO,EACL,aAAa,EAEb,mBAAmB,EACnB,2BAA2B,EAE3B,wBAAwB,EAEzB,MAAM,SAAS,CAAC;AAsEjB,qBAAa,uBAAwB,SAAQ,qBAAqB;IAChE,OAAO,CAAC,YAAY,CAA2D;;IAM/E,KAAK,WACK,wBAAwB,GAAG,2BAA2B,cAClD,mBAAmB,aACpB,aAAa,OACnB,yCAAyC,KAC7C,IAAI,CAiBL;IAEF,eAAe,QAAS,6CAA6C,KAAG,IAAI,CAa1E;IAEF,iBAAiB,QAAS,0BAA0B,KAAG,IAAI,CAoBzD;IAEF,OAAO,CAAC,uBAAuB,CAS3B;IAEJ,OAAO,CAAC,+BAA+B,CAKrC;IAEF,OAAO,CAAC,iBAAiB,CAQvB;IAEF,OAAO,CAAC,wBAAwB,CAU9B;CACH"}
|
@@ -8,16 +8,25 @@ const graphql_mapping_template_1 = require("graphql-mapping-template");
|
|
8
8
|
const graphql_transformer_common_1 = require("graphql-transformer-common");
|
9
9
|
const validators_1 = require("./validators");
|
10
10
|
const nonStringTypes = ['Int', 'Float', 'Boolean', 'AWSTimestamp', 'AWSJSON'];
|
11
|
-
const validateFieldType = (ctx,
|
11
|
+
const validateFieldType = (ctx, config) => {
|
12
|
+
var _a, _b;
|
13
|
+
const type = config.field.type;
|
14
|
+
const argc = (_b = (_a = config.directive.arguments) === null || _a === void 0 ? void 0 : _a.length) !== null && _b !== void 0 ? _b : 0;
|
12
15
|
const enums = ctx.output.getTypeDefinitionsOfKind(graphql_1.Kind.ENUM_TYPE_DEFINITION);
|
13
16
|
if ((0, graphql_transformer_common_1.isListType)(type) || !(0, graphql_transformer_common_1.isScalarOrEnum)(type, enums)) {
|
14
17
|
throw new graphql_transformer_core_1.InvalidDirectiveError('The @default directive may only be added to scalar or enum field types.');
|
15
18
|
}
|
19
|
+
if ((0, graphql_transformer_core_1.isPostgresModel)(ctx, config.object.name.value) && argc === 0 && (0, graphql_transformer_common_1.getBaseType)(type) !== 'Int') {
|
20
|
+
throw new graphql_transformer_core_1.InvalidDirectiveError('The @default directive requires a value property on non-Int types.');
|
21
|
+
}
|
16
22
|
};
|
17
|
-
const validateDirectiveArguments = (
|
18
|
-
|
19
|
-
|
20
|
-
|
23
|
+
const validateDirectiveArguments = (ctx, config) => {
|
24
|
+
var _a, _b;
|
25
|
+
const argc = (_b = (_a = config.directive.arguments) === null || _a === void 0 ? void 0 : _a.length) !== null && _b !== void 0 ? _b : 0;
|
26
|
+
const isPostgres = (0, graphql_transformer_core_1.isPostgresModel)(ctx, config.object.name.value);
|
27
|
+
if (!isPostgres && argc === 0)
|
28
|
+
throw new graphql_transformer_core_1.InvalidDirectiveError('The @default directive requires a value property on non-Postgres datasources.');
|
29
|
+
if (argc > 1)
|
21
30
|
throw new graphql_transformer_core_1.InvalidDirectiveError('The @default directive only takes a value property');
|
22
31
|
};
|
23
32
|
const validateModelDirective = (config) => {
|
@@ -43,8 +52,8 @@ const validateDefaultValueType = (ctx, config) => {
|
|
43
52
|
};
|
44
53
|
const validate = (ctx, config) => {
|
45
54
|
validateModelDirective(config);
|
46
|
-
validateFieldType(ctx, config
|
47
|
-
validateDirectiveArguments(config
|
55
|
+
validateFieldType(ctx, config);
|
56
|
+
validateDirectiveArguments(ctx, config);
|
48
57
|
const isDynamoDB = (0, graphql_transformer_core_1.isDynamoDbModel)(ctx, config.object.name.value);
|
49
58
|
if (isDynamoDB) {
|
50
59
|
validateDefaultValueType(ctx, config);
|
@@ -74,6 +83,9 @@ class DefaultValueTransformer extends graphql_transformer_core_1.TransformerPlug
|
|
74
83
|
const input = graphql_transformer_core_1.InputObjectDefinitionWrapper.fromObject(name, config.object, ctx.inputDocument);
|
75
84
|
const fieldWrapper = input.fields.find((f) => f.name === config.field.name.value);
|
76
85
|
fieldWrapper === null || fieldWrapper === void 0 ? void 0 : fieldWrapper.makeNullable();
|
86
|
+
if ((0, graphql_transformer_core_1.isPostgresModel)(ctx, typeName)) {
|
87
|
+
ctx.output.updateInput(input.serialize());
|
88
|
+
}
|
77
89
|
}
|
78
90
|
}
|
79
91
|
};
|