@aws-amplify/graphql-api-construct 1.12.0-gen2-migration-0809.0 → 1.12.0
Sign up to get free protection for your applications and to get access to all the features.
- package/.jsii +311 -227
- package/API.md +3 -15
- package/CHANGELOG.md +25 -3
- package/lib/amplify-dynamodb-table-wrapper.js +1 -1
- package/lib/amplify-graphql-api.js +5 -12
- package/lib/amplify-graphql-definition.js +1 -1
- package/lib/internal/default-parameters.js +1 -2
- package/lib/model-datasource-strategy-types.d.ts +1 -19
- package/lib/model-datasource-strategy-types.js +1 -1
- package/lib/sql-model-datasource-strategy.js +1 -1
- package/lib/types.d.ts +5 -28
- package/lib/types.js +1 -1
- package/node_modules/@aws-amplify/ai-constructs/README.md +66 -0
- package/node_modules/@aws-amplify/ai-constructs/lib/conversation/conversation_handler_construct.d.ts +28 -0
- package/node_modules/@aws-amplify/ai-constructs/lib/conversation/conversation_handler_construct.js +74 -0
- package/node_modules/@aws-amplify/ai-constructs/lib/conversation/index.d.ts +3 -0
- package/node_modules/@aws-amplify/ai-constructs/lib/conversation/index.js +6 -0
- package/node_modules/@aws-amplify/ai-constructs/lib/conversation/runtime/bedrock_converse_adapter.d.ts +30 -0
- package/node_modules/@aws-amplify/ai-constructs/lib/conversation/runtime/bedrock_converse_adapter.js +191 -0
- package/node_modules/@aws-amplify/ai-constructs/lib/conversation/runtime/conversation_turn_executor.d.ts +30 -0
- package/node_modules/@aws-amplify/ai-constructs/lib/conversation/runtime/conversation_turn_executor.js +47 -0
- package/node_modules/@aws-amplify/ai-constructs/lib/conversation/runtime/conversation_turn_response_sender.d.ts +18 -0
- package/node_modules/@aws-amplify/ai-constructs/lib/conversation/runtime/conversation_turn_response_sender.js +66 -0
- package/node_modules/@aws-amplify/ai-constructs/lib/conversation/runtime/default_handler.d.ts +8 -0
- package/node_modules/@aws-amplify/ai-constructs/lib/conversation/runtime/default_handler.js +10 -0
- package/node_modules/@aws-amplify/ai-constructs/lib/conversation/runtime/event-tools-provider/event_tools_provider.d.ts +15 -0
- package/node_modules/@aws-amplify/ai-constructs/lib/conversation/runtime/event-tools-provider/event_tools_provider.js +32 -0
- package/node_modules/@aws-amplify/ai-constructs/lib/conversation/runtime/event-tools-provider/graphql_query_factory.d.ts +9 -0
- package/node_modules/@aws-amplify/ai-constructs/lib/conversation/runtime/event-tools-provider/graphql_query_factory.js +44 -0
- package/node_modules/@aws-amplify/ai-constructs/lib/conversation/runtime/event-tools-provider/graphql_tool.d.ts +22 -0
- package/node_modules/@aws-amplify/ai-constructs/lib/conversation/runtime/event-tools-provider/graphql_tool.js +48 -0
- package/node_modules/@aws-amplify/ai-constructs/lib/conversation/runtime/event-tools-provider/index.d.ts +3 -0
- package/node_modules/@aws-amplify/ai-constructs/lib/conversation/runtime/event-tools-provider/index.js +6 -0
- package/node_modules/@aws-amplify/ai-constructs/lib/conversation/runtime/event-tools-provider/types.d.ts +3 -0
- package/node_modules/@aws-amplify/ai-constructs/lib/conversation/runtime/event-tools-provider/types.js +3 -0
- package/node_modules/@aws-amplify/ai-constructs/lib/conversation/runtime/index.d.ts +4 -0
- package/node_modules/@aws-amplify/ai-constructs/lib/conversation/runtime/index.js +6 -0
- package/node_modules/@aws-amplify/ai-constructs/lib/conversation/runtime/types.d.ts +61 -0
- package/node_modules/@aws-amplify/ai-constructs/lib/conversation/runtime/types.js +3 -0
- package/node_modules/@aws-amplify/ai-constructs/lib/conversation/test-assets/custom_handler.d.ts +5 -0
- package/node_modules/@aws-amplify/ai-constructs/lib/conversation/test-assets/custom_handler.js +11 -0
- package/node_modules/@aws-amplify/ai-constructs/lib/index.d.ts +3 -0
- package/node_modules/@aws-amplify/ai-constructs/lib/index.internal.d.ts +4 -0
- package/node_modules/@aws-amplify/ai-constructs/lib/index.internal.js +34 -0
- package/node_modules/@aws-amplify/ai-constructs/lib/index.js +29 -0
- package/node_modules/@aws-amplify/ai-constructs/node_modules/@aws-amplify/plugin-types/README.md +9 -0
- package/node_modules/@aws-amplify/ai-constructs/node_modules/@aws-amplify/plugin-types/lib/amplify_function.d.ts +4 -0
- package/node_modules/@aws-amplify/ai-constructs/node_modules/@aws-amplify/plugin-types/lib/amplify_function.js +3 -0
- package/node_modules/@aws-amplify/ai-constructs/node_modules/@aws-amplify/plugin-types/lib/auth_resources.d.ts +66 -0
- package/node_modules/@aws-amplify/ai-constructs/node_modules/@aws-amplify/plugin-types/lib/auth_resources.js +3 -0
- package/node_modules/@aws-amplify/ai-constructs/node_modules/@aws-amplify/plugin-types/lib/aws_client_provider.d.ts +5 -0
- package/node_modules/@aws-amplify/ai-constructs/node_modules/@aws-amplify/plugin-types/lib/aws_client_provider.js +3 -0
- package/node_modules/@aws-amplify/ai-constructs/node_modules/@aws-amplify/plugin-types/lib/backend_identifier.d.ts +56 -0
- package/node_modules/@aws-amplify/ai-constructs/node_modules/@aws-amplify/plugin-types/lib/backend_identifier.js +3 -0
- package/node_modules/@aws-amplify/ai-constructs/node_modules/@aws-amplify/plugin-types/lib/backend_output.d.ts +6 -0
- package/node_modules/@aws-amplify/ai-constructs/node_modules/@aws-amplify/plugin-types/lib/backend_output.js +3 -0
- package/node_modules/@aws-amplify/ai-constructs/node_modules/@aws-amplify/plugin-types/lib/backend_secret_resolver.d.ts +22 -0
- package/node_modules/@aws-amplify/ai-constructs/node_modules/@aws-amplify/plugin-types/lib/backend_secret_resolver.js +3 -0
- package/node_modules/@aws-amplify/ai-constructs/node_modules/@aws-amplify/plugin-types/lib/backend_stack_creator.d.ts +8 -0
- package/node_modules/@aws-amplify/ai-constructs/node_modules/@aws-amplify/plugin-types/lib/backend_stack_creator.js +3 -0
- package/node_modules/@aws-amplify/ai-constructs/node_modules/@aws-amplify/plugin-types/lib/backend_stack_resolver.d.ts +7 -0
- package/node_modules/@aws-amplify/ai-constructs/node_modules/@aws-amplify/plugin-types/lib/backend_stack_resolver.js +3 -0
- package/node_modules/@aws-amplify/ai-constructs/node_modules/@aws-amplify/plugin-types/lib/construct_container.d.ts +35 -0
- package/node_modules/@aws-amplify/ai-constructs/node_modules/@aws-amplify/plugin-types/lib/construct_container.js +3 -0
- package/node_modules/@aws-amplify/ai-constructs/node_modules/@aws-amplify/plugin-types/lib/construct_factory.d.ts +24 -0
- package/node_modules/@aws-amplify/ai-constructs/node_modules/@aws-amplify/plugin-types/lib/construct_factory.js +3 -0
- package/node_modules/@aws-amplify/ai-constructs/node_modules/@aws-amplify/plugin-types/lib/deep_partial.d.ts +17 -0
- package/node_modules/@aws-amplify/ai-constructs/node_modules/@aws-amplify/plugin-types/lib/deep_partial.js +3 -0
- package/node_modules/@aws-amplify/ai-constructs/node_modules/@aws-amplify/plugin-types/lib/deployment_type.d.ts +8 -0
- package/node_modules/@aws-amplify/ai-constructs/node_modules/@aws-amplify/plugin-types/lib/deployment_type.js +3 -0
- package/node_modules/@aws-amplify/ai-constructs/node_modules/@aws-amplify/plugin-types/lib/function_resources.d.ts +8 -0
- package/node_modules/@aws-amplify/ai-constructs/node_modules/@aws-amplify/plugin-types/lib/function_resources.js +3 -0
- package/node_modules/@aws-amplify/ai-constructs/node_modules/@aws-amplify/plugin-types/lib/import_path_verifier.d.ts +14 -0
- package/node_modules/@aws-amplify/ai-constructs/node_modules/@aws-amplify/plugin-types/lib/import_path_verifier.js +3 -0
- package/node_modules/@aws-amplify/ai-constructs/node_modules/@aws-amplify/plugin-types/lib/index.d.ts +23 -0
- package/node_modules/@aws-amplify/ai-constructs/node_modules/@aws-amplify/plugin-types/lib/index.js +39 -0
- package/node_modules/@aws-amplify/ai-constructs/node_modules/@aws-amplify/plugin-types/lib/output_retrieval_strategy.d.ts +11 -0
- package/node_modules/@aws-amplify/ai-constructs/node_modules/@aws-amplify/plugin-types/lib/output_retrieval_strategy.js +3 -0
- package/node_modules/@aws-amplify/ai-constructs/node_modules/@aws-amplify/plugin-types/lib/output_storage_strategy.d.ts +10 -0
- package/node_modules/@aws-amplify/ai-constructs/node_modules/@aws-amplify/plugin-types/lib/output_storage_strategy.js +3 -0
- package/node_modules/@aws-amplify/ai-constructs/node_modules/@aws-amplify/plugin-types/lib/package_manager_controller.d.ts +16 -0
- package/node_modules/@aws-amplify/ai-constructs/node_modules/@aws-amplify/plugin-types/lib/package_manager_controller.js +3 -0
- package/node_modules/@aws-amplify/ai-constructs/node_modules/@aws-amplify/plugin-types/lib/resource_access_acceptor.d.ts +27 -0
- package/node_modules/@aws-amplify/ai-constructs/node_modules/@aws-amplify/plugin-types/lib/resource_access_acceptor.js +3 -0
- package/node_modules/@aws-amplify/ai-constructs/node_modules/@aws-amplify/plugin-types/lib/resource_name_validator.d.ts +10 -0
- package/node_modules/@aws-amplify/ai-constructs/node_modules/@aws-amplify/plugin-types/lib/resource_name_validator.js +3 -0
- package/node_modules/@aws-amplify/ai-constructs/node_modules/@aws-amplify/plugin-types/lib/resource_provider.d.ts +10 -0
- package/node_modules/@aws-amplify/ai-constructs/node_modules/@aws-amplify/plugin-types/lib/resource_provider.js +3 -0
- package/node_modules/@aws-amplify/ai-constructs/node_modules/@aws-amplify/plugin-types/lib/ssm_environment_entries_generator.d.ts +5 -0
- package/node_modules/@aws-amplify/ai-constructs/node_modules/@aws-amplify/plugin-types/lib/ssm_environment_entries_generator.js +3 -0
- package/node_modules/@aws-amplify/ai-constructs/node_modules/@aws-amplify/plugin-types/lib/stable_backend_identifiers.d.ts +4 -0
- package/node_modules/@aws-amplify/ai-constructs/node_modules/@aws-amplify/plugin-types/lib/stable_backend_identifiers.js +3 -0
- package/node_modules/@aws-amplify/ai-constructs/node_modules/@aws-amplify/plugin-types/package.json +24 -0
- package/node_modules/@aws-amplify/ai-constructs/package.json +37 -0
- package/node_modules/@aws-amplify/graphql-auth-transformer/CHANGELOG.md +19 -1
- 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 +6 -1
- 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 +26 -20
- package/node_modules/@aws-amplify/graphql-conversation-transformer/API.md +33 -0
- package/node_modules/@aws-amplify/graphql-conversation-transformer/CHANGELOG.md +10 -0
- package/node_modules/@aws-amplify/graphql-conversation-transformer/LICENSE +201 -0
- package/node_modules/@aws-amplify/graphql-conversation-transformer/README.md +145 -0
- package/node_modules/@aws-amplify/graphql-conversation-transformer/lib/graphql-types/message-model.d.ts +13 -0
- package/node_modules/@aws-amplify/graphql-conversation-transformer/lib/graphql-types/message-model.d.ts.map +1 -0
- package/node_modules/@aws-amplify/graphql-conversation-transformer/lib/graphql-types/message-model.js +111 -0
- package/node_modules/@aws-amplify/graphql-conversation-transformer/lib/graphql-types/message-model.js.map +1 -0
- package/node_modules/@aws-amplify/graphql-conversation-transformer/lib/graphql-types/session-model.d.ts +10 -0
- package/node_modules/@aws-amplify/graphql-conversation-transformer/lib/graphql-types/session-model.d.ts.map +1 -0
- package/node_modules/@aws-amplify/graphql-conversation-transformer/lib/graphql-types/session-model.js +81 -0
- package/node_modules/@aws-amplify/graphql-conversation-transformer/lib/graphql-types/session-model.js.map +1 -0
- package/node_modules/@aws-amplify/graphql-conversation-transformer/lib/grapqhl-conversation-transformer.d.ts +39 -0
- package/node_modules/@aws-amplify/graphql-conversation-transformer/lib/grapqhl-conversation-transformer.d.ts.map +1 -0
- package/node_modules/@aws-amplify/graphql-conversation-transformer/lib/grapqhl-conversation-transformer.js +35 -0
- package/node_modules/@aws-amplify/graphql-conversation-transformer/lib/grapqhl-conversation-transformer.js.map +1 -0
- package/node_modules/@aws-amplify/graphql-conversation-transformer/lib/index.d.ts +2 -0
- package/node_modules/@aws-amplify/graphql-conversation-transformer/lib/index.d.ts.map +1 -0
- package/node_modules/@aws-amplify/graphql-conversation-transformer/lib/index.js +6 -0
- package/node_modules/@aws-amplify/graphql-conversation-transformer/lib/index.js.map +1 -0
- package/node_modules/@aws-amplify/graphql-conversation-transformer/lib/resolvers/assistant-messages-subscription-resolver.d.ts +3 -0
- package/node_modules/@aws-amplify/graphql-conversation-transformer/lib/resolvers/assistant-messages-subscription-resolver.d.ts.map +1 -0
- package/node_modules/@aws-amplify/graphql-conversation-transformer/lib/resolvers/assistant-messages-subscription-resolver.js +62 -0
- package/node_modules/@aws-amplify/graphql-conversation-transformer/lib/resolvers/assistant-messages-subscription-resolver.js.map +1 -0
- package/node_modules/@aws-amplify/graphql-conversation-transformer/lib/resolvers/assistant-mutation-resolver.d.ts +3 -0
- package/node_modules/@aws-amplify/graphql-conversation-transformer/lib/resolvers/assistant-mutation-resolver.d.ts.map +1 -0
- package/node_modules/@aws-amplify/graphql-conversation-transformer/lib/resolvers/assistant-mutation-resolver.js +77 -0
- package/node_modules/@aws-amplify/graphql-conversation-transformer/lib/resolvers/assistant-mutation-resolver.js.map +1 -0
- package/node_modules/@aws-amplify/graphql-conversation-transformer/lib/resolvers/auth-resolver.d.ts +3 -0
- package/node_modules/@aws-amplify/graphql-conversation-transformer/lib/resolvers/auth-resolver.d.ts.map +1 -0
- package/node_modules/@aws-amplify/graphql-conversation-transformer/lib/resolvers/auth-resolver.js +57 -0
- package/node_modules/@aws-amplify/graphql-conversation-transformer/lib/resolvers/auth-resolver.js.map +1 -0
- package/node_modules/@aws-amplify/graphql-conversation-transformer/lib/resolvers/init-resolver.d.ts +3 -0
- package/node_modules/@aws-amplify/graphql-conversation-transformer/lib/resolvers/init-resolver.d.ts.map +1 -0
- package/node_modules/@aws-amplify/graphql-conversation-transformer/lib/resolvers/init-resolver.js +34 -0
- package/node_modules/@aws-amplify/graphql-conversation-transformer/lib/resolvers/init-resolver.js.map +1 -0
- package/node_modules/@aws-amplify/graphql-conversation-transformer/lib/resolvers/invoke-lambda-resolver.d.ts +5 -0
- package/node_modules/@aws-amplify/graphql-conversation-transformer/lib/resolvers/invoke-lambda-resolver.d.ts.map +1 -0
- package/node_modules/@aws-amplify/graphql-conversation-transformer/lib/resolvers/invoke-lambda-resolver.js +104 -0
- package/node_modules/@aws-amplify/graphql-conversation-transformer/lib/resolvers/invoke-lambda-resolver.js.map +1 -0
- package/node_modules/@aws-amplify/graphql-conversation-transformer/lib/resolvers/js-resolver-function-provider.d.ts +6 -0
- package/node_modules/@aws-amplify/graphql-conversation-transformer/lib/resolvers/js-resolver-function-provider.d.ts.map +1 -0
- package/node_modules/@aws-amplify/graphql-conversation-transformer/lib/resolvers/js-resolver-function-provider.js +3 -0
- package/node_modules/@aws-amplify/graphql-conversation-transformer/lib/resolvers/js-resolver-function-provider.js.map +1 -0
- package/node_modules/@aws-amplify/graphql-conversation-transformer/lib/resolvers/message-history-resolver.d.ts +3 -0
- package/node_modules/@aws-amplify/graphql-conversation-transformer/lib/resolvers/message-history-resolver.d.ts.map +1 -0
- package/node_modules/@aws-amplify/graphql-conversation-transformer/lib/resolvers/message-history-resolver.js +59 -0
- package/node_modules/@aws-amplify/graphql-conversation-transformer/lib/resolvers/message-history-resolver.js.map +1 -0
- package/node_modules/@aws-amplify/graphql-conversation-transformer/lib/resolvers/verify-session-owner-resolver.d.ts +3 -0
- package/node_modules/@aws-amplify/graphql-conversation-transformer/lib/resolvers/verify-session-owner-resolver.d.ts.map +1 -0
- package/node_modules/@aws-amplify/graphql-conversation-transformer/lib/resolvers/verify-session-owner-resolver.js +50 -0
- package/node_modules/@aws-amplify/graphql-conversation-transformer/lib/resolvers/verify-session-owner-resolver.js.map +1 -0
- package/node_modules/@aws-amplify/graphql-conversation-transformer/lib/resolvers/write-message-to-table-resolver.d.ts +3 -0
- package/node_modules/@aws-amplify/graphql-conversation-transformer/lib/resolvers/write-message-to-table-resolver.d.ts.map +1 -0
- package/node_modules/@aws-amplify/graphql-conversation-transformer/lib/resolvers/write-message-to-table-resolver.js +45 -0
- package/node_modules/@aws-amplify/graphql-conversation-transformer/lib/resolvers/write-message-to-table-resolver.js.map +1 -0
- package/node_modules/@aws-amplify/graphql-conversation-transformer/lib/transformer-steps/conversation-field-handler.d.ts +12 -0
- package/node_modules/@aws-amplify/graphql-conversation-transformer/lib/transformer-steps/conversation-field-handler.d.ts.map +1 -0
- package/node_modules/@aws-amplify/graphql-conversation-transformer/lib/transformer-steps/conversation-field-handler.js +68 -0
- package/node_modules/@aws-amplify/graphql-conversation-transformer/lib/transformer-steps/conversation-field-handler.js.map +1 -0
- package/node_modules/@aws-amplify/graphql-conversation-transformer/lib/transformer-steps/conversation-prepare-handler.d.ts +15 -0
- package/node_modules/@aws-amplify/graphql-conversation-transformer/lib/transformer-steps/conversation-prepare-handler.d.ts.map +1 -0
- package/node_modules/@aws-amplify/graphql-conversation-transformer/lib/transformer-steps/conversation-prepare-handler.js +44 -0
- package/node_modules/@aws-amplify/graphql-conversation-transformer/lib/transformer-steps/conversation-prepare-handler.js.map +1 -0
- package/node_modules/@aws-amplify/graphql-conversation-transformer/lib/transformer-steps/conversation-resolver-generator.d.ts +20 -0
- package/node_modules/@aws-amplify/graphql-conversation-transformer/lib/transformer-steps/conversation-resolver-generator.d.ts.map +1 -0
- package/node_modules/@aws-amplify/graphql-conversation-transformer/lib/transformer-steps/conversation-resolver-generator.js +184 -0
- package/node_modules/@aws-amplify/graphql-conversation-transformer/lib/transformer-steps/conversation-resolver-generator.js.map +1 -0
- package/node_modules/@aws-amplify/graphql-conversation-transformer/lib/utils/graphql-json-schema-type.d.ts +5 -0
- package/node_modules/@aws-amplify/graphql-conversation-transformer/lib/utils/graphql-json-schema-type.d.ts.map +1 -0
- package/node_modules/@aws-amplify/graphql-conversation-transformer/lib/utils/graphql-json-schema-type.js +81 -0
- package/node_modules/@aws-amplify/graphql-conversation-transformer/lib/utils/graphql-json-schema-type.js.map +1 -0
- package/node_modules/@aws-amplify/graphql-conversation-transformer/lib/utils/tools.d.ts +25 -0
- package/node_modules/@aws-amplify/graphql-conversation-transformer/lib/utils/tools.d.ts.map +1 -0
- package/node_modules/@aws-amplify/graphql-conversation-transformer/lib/utils/tools.js +116 -0
- package/node_modules/@aws-amplify/graphql-conversation-transformer/lib/utils/tools.js.map +1 -0
- package/node_modules/@aws-amplify/graphql-conversation-transformer/package.json +82 -0
- package/node_modules/@aws-amplify/graphql-default-value-transformer/CHANGELOG.md +17 -1
- package/node_modules/@aws-amplify/graphql-default-value-transformer/package.json +19 -13
- package/node_modules/@aws-amplify/graphql-directives/API.md +6 -0
- package/node_modules/@aws-amplify/graphql-directives/CHANGELOG.md +10 -2
- package/node_modules/@aws-amplify/graphql-directives/lib/directives/belongs-to.d.ts.map +1 -1
- package/node_modules/@aws-amplify/graphql-directives/lib/directives/belongs-to.js +1 -1
- package/node_modules/@aws-amplify/graphql-directives/lib/directives/belongs-to.js.map +1 -1
- package/node_modules/@aws-amplify/graphql-directives/lib/directives/conversation.d.ts +3 -0
- package/node_modules/@aws-amplify/graphql-directives/lib/directives/conversation.d.ts.map +1 -0
- package/node_modules/@aws-amplify/graphql-directives/lib/directives/conversation.js +31 -0
- package/node_modules/@aws-amplify/graphql-directives/lib/directives/conversation.js.map +1 -0
- package/node_modules/@aws-amplify/graphql-directives/lib/directives/generation.d.ts +3 -0
- package/node_modules/@aws-amplify/graphql-directives/lib/directives/generation.d.ts.map +1 -0
- package/node_modules/@aws-amplify/graphql-directives/lib/directives/generation.js +24 -0
- package/node_modules/@aws-amplify/graphql-directives/lib/directives/generation.js.map +1 -0
- package/node_modules/@aws-amplify/graphql-directives/lib/directives/index.d.ts +2 -0
- package/node_modules/@aws-amplify/graphql-directives/lib/directives/index.d.ts.map +1 -1
- package/node_modules/@aws-amplify/graphql-directives/lib/directives/index.js +5 -1
- package/node_modules/@aws-amplify/graphql-directives/lib/directives/index.js.map +1 -1
- package/node_modules/@aws-amplify/graphql-directives/lib/index.d.ts.map +1 -1
- package/node_modules/@aws-amplify/graphql-directives/lib/index.js +2 -0
- package/node_modules/@aws-amplify/graphql-directives/lib/index.js.map +1 -1
- package/node_modules/@aws-amplify/graphql-directives/package.json +12 -6
- package/node_modules/@aws-amplify/graphql-function-transformer/CHANGELOG.md +13 -1
- package/node_modules/@aws-amplify/graphql-function-transformer/package.json +16 -12
- package/node_modules/@aws-amplify/graphql-generation-transformer/API.md +26 -0
- package/node_modules/@aws-amplify/graphql-generation-transformer/CHANGELOG.md +11 -0
- package/node_modules/@aws-amplify/graphql-generation-transformer/LICENSE +201 -0
- package/node_modules/@aws-amplify/graphql-generation-transformer/README.md +85 -0
- package/node_modules/@aws-amplify/graphql-generation-transformer/lib/grapqhl-generation-transformer.d.ts +32 -0
- package/node_modules/@aws-amplify/graphql-generation-transformer/lib/grapqhl-generation-transformer.d.ts.map +1 -0
- package/node_modules/@aws-amplify/graphql-generation-transformer/lib/grapqhl-generation-transformer.js +119 -0
- package/node_modules/@aws-amplify/graphql-generation-transformer/lib/grapqhl-generation-transformer.js.map +1 -0
- package/node_modules/@aws-amplify/graphql-generation-transformer/lib/index.d.ts +2 -0
- package/node_modules/@aws-amplify/graphql-generation-transformer/lib/index.d.ts.map +1 -0
- package/node_modules/@aws-amplify/graphql-generation-transformer/lib/index.js +6 -0
- package/node_modules/@aws-amplify/graphql-generation-transformer/lib/index.js.map +1 -0
- package/node_modules/@aws-amplify/graphql-generation-transformer/lib/resolvers/invoke-bedrock.d.ts +7 -0
- package/node_modules/@aws-amplify/graphql-generation-transformer/lib/resolvers/invoke-bedrock.d.ts.map +1 -0
- package/node_modules/@aws-amplify/graphql-generation-transformer/lib/resolvers/invoke-bedrock.js +72 -0
- package/node_modules/@aws-amplify/graphql-generation-transformer/lib/resolvers/invoke-bedrock.js.map +1 -0
- package/node_modules/@aws-amplify/graphql-generation-transformer/lib/utils/graphql-json-schema-type.d.ts +5 -0
- package/node_modules/@aws-amplify/graphql-generation-transformer/lib/utils/graphql-json-schema-type.d.ts.map +1 -0
- package/node_modules/@aws-amplify/graphql-generation-transformer/lib/utils/graphql-json-schema-type.js +78 -0
- package/node_modules/@aws-amplify/graphql-generation-transformer/lib/utils/graphql-json-schema-type.js.map +1 -0
- package/node_modules/@aws-amplify/graphql-generation-transformer/lib/utils/tools.d.ts +27 -0
- package/node_modules/@aws-amplify/graphql-generation-transformer/lib/utils/tools.d.ts.map +1 -0
- package/node_modules/@aws-amplify/graphql-generation-transformer/lib/utils/tools.js +31 -0
- package/node_modules/@aws-amplify/graphql-generation-transformer/lib/utils/tools.js.map +1 -0
- package/node_modules/@aws-amplify/graphql-generation-transformer/lib/validation.d.ts +4 -0
- package/node_modules/@aws-amplify/graphql-generation-transformer/lib/validation.d.ts.map +1 -0
- package/node_modules/@aws-amplify/graphql-generation-transformer/lib/validation.js +29 -0
- package/node_modules/@aws-amplify/graphql-generation-transformer/lib/validation.js.map +1 -0
- package/node_modules/@aws-amplify/graphql-generation-transformer/package.json +78 -0
- package/node_modules/@aws-amplify/graphql-http-transformer/CHANGELOG.md +13 -1
- package/node_modules/@aws-amplify/graphql-http-transformer/package.json +16 -12
- package/node_modules/@aws-amplify/graphql-index-transformer/CHANGELOG.md +17 -1
- package/node_modules/@aws-amplify/graphql-index-transformer/package.json +17 -13
- package/node_modules/@aws-amplify/graphql-maps-to-transformer/CHANGELOG.md +17 -1
- 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 +20 -16
- package/node_modules/@aws-amplify/graphql-model-transformer/CHANGELOG.md +15 -7
- package/node_modules/@aws-amplify/graphql-model-transformer/lib/graphql-model-transformer.d.ts.map +1 -1
- package/node_modules/@aws-amplify/graphql-model-transformer/lib/graphql-model-transformer.js +2 -47
- package/node_modules/@aws-amplify/graphql-model-transformer/lib/graphql-model-transformer.js.map +1 -1
- 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/rds/resolver.d.ts +2 -2
- package/node_modules/@aws-amplify/graphql-model-transformer/lib/resolvers/rds/resolver.d.ts.map +1 -1
- package/node_modules/@aws-amplify/graphql-model-transformer/lib/resolvers/rds/resolver.js +22 -4
- package/node_modules/@aws-amplify/graphql-model-transformer/lib/resolvers/rds/resolver.js.map +1 -1
- package/node_modules/@aws-amplify/graphql-model-transformer/lib/resources/amplify-dynamodb-table/amplify-dynamo-model-resource-generator.d.ts.map +1 -1
- package/node_modules/@aws-amplify/graphql-model-transformer/lib/resources/amplify-dynamodb-table/amplify-dynamo-model-resource-generator.js +3 -12
- package/node_modules/@aws-amplify/graphql-model-transformer/lib/resources/amplify-dynamodb-table/amplify-dynamo-model-resource-generator.js.map +1 -1
- package/node_modules/@aws-amplify/graphql-model-transformer/lib/resources/amplify-dynamodb-table/amplify-dynamodb-table-construct/index.d.ts +0 -2
- package/node_modules/@aws-amplify/graphql-model-transformer/lib/resources/amplify-dynamodb-table/amplify-dynamodb-table-construct/index.d.ts.map +1 -1
- package/node_modules/@aws-amplify/graphql-model-transformer/lib/resources/amplify-dynamodb-table/amplify-dynamodb-table-construct/index.js +2 -4
- package/node_modules/@aws-amplify/graphql-model-transformer/lib/resources/amplify-dynamodb-table/amplify-dynamodb-table-construct/index.js.map +1 -1
- package/node_modules/@aws-amplify/graphql-model-transformer/lib/resources/amplify-dynamodb-table/amplify-table-manager-lambda/amplify-table-manager-handler.d.ts +0 -3
- package/node_modules/@aws-amplify/graphql-model-transformer/lib/resources/amplify-dynamodb-table/amplify-table-manager-lambda/amplify-table-manager-handler.d.ts.map +1 -1
- package/node_modules/@aws-amplify/graphql-model-transformer/lib/resources/amplify-dynamodb-table/amplify-table-manager-lambda/amplify-table-manager-handler.js +1 -111
- package/node_modules/@aws-amplify/graphql-model-transformer/lib/resources/amplify-dynamodb-table/amplify-table-manager-lambda/amplify-table-manager-handler.js.map +1 -1
- package/node_modules/@aws-amplify/graphql-model-transformer/lib/resources/dynamo-model-resource-generator.d.ts.map +1 -1
- package/node_modules/@aws-amplify/graphql-model-transformer/lib/resources/dynamo-model-resource-generator.js +1 -3
- package/node_modules/@aws-amplify/graphql-model-transformer/lib/resources/dynamo-model-resource-generator.js.map +1 -1
- package/node_modules/@aws-amplify/graphql-model-transformer/lib/resources/model-resource-generator.d.ts +0 -1
- package/node_modules/@aws-amplify/graphql-model-transformer/lib/resources/model-resource-generator.d.ts.map +1 -1
- package/node_modules/@aws-amplify/graphql-model-transformer/lib/resources/model-resource-generator.js +0 -3
- 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/lib/resources/rds-model-resource-generator.js +2 -2
- package/node_modules/@aws-amplify/graphql-model-transformer/lib/resources/rds-model-resource-generator.js.map +1 -1
- package/node_modules/@aws-amplify/graphql-model-transformer/package.json +18 -16
- package/node_modules/@aws-amplify/graphql-predictions-transformer/CHANGELOG.md +19 -1
- package/node_modules/@aws-amplify/graphql-predictions-transformer/lib/graphql-predictions-transformer.d.ts.map +1 -1
- package/node_modules/@aws-amplify/graphql-predictions-transformer/lib/graphql-predictions-transformer.js +3 -0
- 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 +16 -12
- package/node_modules/@aws-amplify/graphql-relational-transformer/CHANGELOG.md +23 -3
- package/node_modules/@aws-amplify/graphql-relational-transformer/lib/graphql-belongs-to-transformer.d.ts.map +1 -1
- package/node_modules/@aws-amplify/graphql-relational-transformer/lib/graphql-belongs-to-transformer.js +12 -13
- package/node_modules/@aws-amplify/graphql-relational-transformer/lib/graphql-belongs-to-transformer.js.map +1 -1
- package/node_modules/@aws-amplify/graphql-relational-transformer/lib/graphql-has-many-transformer.d.ts.map +1 -1
- package/node_modules/@aws-amplify/graphql-relational-transformer/lib/graphql-has-many-transformer.js +13 -11
- package/node_modules/@aws-amplify/graphql-relational-transformer/lib/graphql-has-many-transformer.js.map +1 -1
- package/node_modules/@aws-amplify/graphql-relational-transformer/lib/graphql-has-one-transformer.d.ts.map +1 -1
- package/node_modules/@aws-amplify/graphql-relational-transformer/lib/graphql-has-one-transformer.js +13 -11
- package/node_modules/@aws-amplify/graphql-relational-transformer/lib/graphql-has-one-transformer.js.map +1 -1
- package/node_modules/@aws-amplify/graphql-relational-transformer/lib/graphql-many-to-many-transformer.d.ts.map +1 -1
- package/node_modules/@aws-amplify/graphql-relational-transformer/lib/graphql-many-to-many-transformer.js +7 -0
- package/node_modules/@aws-amplify/graphql-relational-transformer/lib/graphql-many-to-many-transformer.js.map +1 -1
- package/node_modules/@aws-amplify/graphql-relational-transformer/lib/has-many/has-many-directive-ddb-references-transformer.d.ts.map +1 -1
- package/node_modules/@aws-amplify/graphql-relational-transformer/lib/has-many/has-many-directive-ddb-references-transformer.js +1 -7
- package/node_modules/@aws-amplify/graphql-relational-transformer/lib/has-many/has-many-directive-ddb-references-transformer.js.map +1 -1
- package/node_modules/@aws-amplify/graphql-relational-transformer/lib/has-one/has-one-directive-ddb-references-transformer.d.ts.map +1 -1
- package/node_modules/@aws-amplify/graphql-relational-transformer/lib/has-one/has-one-directive-ddb-references-transformer.js +1 -7
- package/node_modules/@aws-amplify/graphql-relational-transformer/lib/has-one/has-one-directive-ddb-references-transformer.js.map +1 -1
- package/node_modules/@aws-amplify/graphql-relational-transformer/lib/types.d.ts +0 -1
- package/node_modules/@aws-amplify/graphql-relational-transformer/lib/types.d.ts.map +1 -1
- package/node_modules/@aws-amplify/graphql-relational-transformer/lib/utils.d.ts +0 -1
- package/node_modules/@aws-amplify/graphql-relational-transformer/lib/utils.d.ts.map +1 -1
- package/node_modules/@aws-amplify/graphql-relational-transformer/lib/utils.js +8 -10
- package/node_modules/@aws-amplify/graphql-relational-transformer/lib/utils.js.map +1 -1
- package/node_modules/@aws-amplify/graphql-relational-transformer/package.json +18 -14
- package/node_modules/@aws-amplify/graphql-searchable-transformer/CHANGELOG.md +23 -1
- package/node_modules/@aws-amplify/graphql-searchable-transformer/lib/graphql-searchable-transformer.d.ts.map +1 -1
- package/node_modules/@aws-amplify/graphql-searchable-transformer/lib/graphql-searchable-transformer.js +3 -0
- 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 +21 -15
- package/node_modules/@aws-amplify/graphql-sql-transformer/CHANGELOG.md +17 -1
- package/node_modules/@aws-amplify/graphql-sql-transformer/package.json +17 -13
- package/node_modules/@aws-amplify/graphql-transformer/API.md +0 -1
- package/node_modules/@aws-amplify/graphql-transformer/CHANGELOG.md +23 -2
- package/node_modules/@aws-amplify/graphql-transformer/lib/graphql-transformer.d.ts +0 -1
- package/node_modules/@aws-amplify/graphql-transformer/lib/graphql-transformer.d.ts.map +1 -1
- package/node_modules/@aws-amplify/graphql-transformer/lib/graphql-transformer.js +11 -6
- package/node_modules/@aws-amplify/graphql-transformer/lib/graphql-transformer.js.map +1 -1
- package/node_modules/@aws-amplify/graphql-transformer/package.json +31 -22
- package/node_modules/@aws-amplify/graphql-transformer/src/graphql-transformer.ts +11 -8
- package/node_modules/@aws-amplify/graphql-transformer-core/API.md +54 -7
- package/node_modules/@aws-amplify/graphql-transformer-core/CHANGELOG.md +14 -3
- package/node_modules/@aws-amplify/graphql-transformer-core/lib/appsync-function.d.ts +2 -1
- 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 +3 -9
- package/node_modules/@aws-amplify/graphql-transformer-core/lib/appsync-function.js.map +1 -1
- package/node_modules/@aws-amplify/graphql-transformer-core/lib/graphql-api.d.ts +5 -11
- package/node_modules/@aws-amplify/graphql-transformer-core/lib/graphql-api.d.ts.map +1 -1
- package/node_modules/@aws-amplify/graphql-transformer-core/lib/graphql-api.js +6 -31
- package/node_modules/@aws-amplify/graphql-transformer-core/lib/graphql-api.js.map +1 -1
- package/node_modules/@aws-amplify/graphql-transformer-core/lib/index.d.ts +2 -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 +8 -3
- 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 +3 -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 +12 -16
- package/node_modules/@aws-amplify/graphql-transformer-core/lib/transform-host.js.map +1 -1
- package/node_modules/@aws-amplify/graphql-transformer-core/lib/transformer-context/resolver.d.ts +6 -2
- 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 +71 -23
- 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/transformer-context/transform-parameters.d.ts.map +1 -1
- package/node_modules/@aws-amplify/graphql-transformer-core/lib/transformer-context/transform-parameters.js +0 -1
- package/node_modules/@aws-amplify/graphql-transformer-core/lib/transformer-context/transform-parameters.js.map +1 -1
- package/node_modules/@aws-amplify/graphql-transformer-core/lib/utils/ai/graphql-scalar-json-schema-definitions.d.ts +20 -0
- package/node_modules/@aws-amplify/graphql-transformer-core/lib/utils/ai/graphql-scalar-json-schema-definitions.d.ts.map +1 -0
- package/node_modules/@aws-amplify/graphql-transformer-core/lib/utils/ai/graphql-scalar-json-schema-definitions.js +89 -0
- package/node_modules/@aws-amplify/graphql-transformer-core/lib/utils/ai/graphql-scalar-json-schema-definitions.js.map +1 -0
- package/node_modules/@aws-amplify/graphql-transformer-core/lib/utils/ai/index.d.ts +4 -0
- package/node_modules/@aws-amplify/graphql-transformer-core/lib/utils/ai/index.d.ts.map +1 -0
- package/node_modules/@aws-amplify/graphql-transformer-core/lib/utils/ai/index.js +10 -0
- package/node_modules/@aws-amplify/graphql-transformer-core/lib/utils/ai/index.js.map +1 -0
- package/node_modules/@aws-amplify/graphql-transformer-core/lib/utils/ai/json-schema.d.ts +21 -0
- package/node_modules/@aws-amplify/graphql-transformer-core/lib/utils/ai/json-schema.d.ts.map +1 -0
- package/node_modules/@aws-amplify/graphql-transformer-core/lib/utils/ai/json-schema.js +3 -0
- package/node_modules/@aws-amplify/graphql-transformer-core/lib/utils/ai/json-schema.js.map +1 -0
- package/node_modules/@aws-amplify/graphql-transformer-core/lib/utils/ai/named-type-conversion.d.ts +4 -0
- package/node_modules/@aws-amplify/graphql-transformer-core/lib/utils/ai/named-type-conversion.d.ts.map +1 -0
- package/node_modules/@aws-amplify/graphql-transformer-core/lib/utils/ai/named-type-conversion.js +44 -0
- package/node_modules/@aws-amplify/graphql-transformer-core/lib/utils/ai/named-type-conversion.js.map +1 -0
- package/node_modules/@aws-amplify/graphql-transformer-core/lib/utils/function-runtime.d.ts +21 -0
- package/node_modules/@aws-amplify/graphql-transformer-core/lib/utils/function-runtime.d.ts.map +1 -0
- package/node_modules/@aws-amplify/graphql-transformer-core/lib/utils/function-runtime.js +27 -0
- package/node_modules/@aws-amplify/graphql-transformer-core/lib/utils/function-runtime.js.map +1 -0
- package/node_modules/@aws-amplify/graphql-transformer-core/lib/utils/model-datasource-strategy-utils.d.ts +1 -2
- 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 +1 -9
- 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 +18 -12
- package/node_modules/@aws-amplify/graphql-transformer-interfaces/API.md +12 -23
- package/node_modules/@aws-amplify/graphql-transformer-interfaces/CHANGELOG.md +14 -3
- package/node_modules/@aws-amplify/graphql-transformer-interfaces/lib/graphql-api-provider.d.ts +3 -4
- package/node_modules/@aws-amplify/graphql-transformer-interfaces/lib/graphql-api-provider.d.ts.map +1 -1
- package/node_modules/@aws-amplify/graphql-transformer-interfaces/lib/graphql-api-provider.js.map +1 -1
- package/node_modules/@aws-amplify/graphql-transformer-interfaces/lib/index.d.ts +1 -1
- package/node_modules/@aws-amplify/graphql-transformer-interfaces/lib/index.d.ts.map +1 -1
- package/node_modules/@aws-amplify/graphql-transformer-interfaces/lib/index.js.map +1 -1
- package/node_modules/@aws-amplify/graphql-transformer-interfaces/lib/model-datasource/types.d.ts +1 -6
- package/node_modules/@aws-amplify/graphql-transformer-interfaces/lib/model-datasource/types.d.ts.map +1 -1
- package/node_modules/@aws-amplify/graphql-transformer-interfaces/lib/model-datasource/types.js.map +1 -1
- package/node_modules/@aws-amplify/graphql-transformer-interfaces/lib/transform-host-provider.d.ts +4 -4
- 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/synth-parameters.d.ts +1 -0
- package/node_modules/@aws-amplify/graphql-transformer-interfaces/lib/transformer-context/synth-parameters.d.ts.map +1 -1
- package/node_modules/@aws-amplify/graphql-transformer-interfaces/lib/transformer-context/transform-parameters.d.ts +0 -1
- package/node_modules/@aws-amplify/graphql-transformer-interfaces/lib/transformer-context/transform-parameters.d.ts.map +1 -1
- package/node_modules/@aws-amplify/graphql-transformer-interfaces/package.json +13 -6
- package/node_modules/@aws-amplify/graphql-transformer-interfaces/src/graphql-api-provider.ts +3 -10
- package/node_modules/@aws-amplify/graphql-transformer-interfaces/src/index.ts +0 -1
- package/node_modules/@aws-amplify/graphql-transformer-interfaces/src/model-datasource/types.ts +0 -10
- package/node_modules/@aws-amplify/graphql-transformer-interfaces/src/transform-host-provider.ts +5 -1
- package/node_modules/@aws-amplify/graphql-transformer-interfaces/src/transformer-context/synth-parameters.ts +1 -0
- package/node_modules/@aws-amplify/graphql-transformer-interfaces/src/transformer-context/transform-parameters.ts +0 -3
- package/node_modules/@aws-amplify/graphql-transformer-interfaces/tsconfig.tsbuildinfo +1 -1
- package/node_modules/graphql-mapping-template/CHANGELOG.md +12 -0
- package/node_modules/graphql-mapping-template/LICENSE +201 -0
- package/node_modules/graphql-mapping-template/package.json +13 -5
- package/node_modules/graphql-transformer-common/API.md +0 -1
- package/node_modules/graphql-transformer-common/CHANGELOG.md +9 -3
- package/node_modules/graphql-transformer-common/lib/ResourceConstants.d.ts +0 -1
- package/node_modules/graphql-transformer-common/lib/ResourceConstants.d.ts.map +1 -1
- package/node_modules/graphql-transformer-common/lib/ResourceConstants.js +0 -1
- package/node_modules/graphql-transformer-common/lib/ResourceConstants.js.map +1 -1
- package/node_modules/graphql-transformer-common/package.json +13 -6
- package/package.json +40 -29
- package/src/amplify-graphql-api.ts +3 -11
- package/src/internal/default-parameters.ts +0 -1
- package/src/model-datasource-strategy-types.ts +0 -21
- package/src/types.ts +5 -29
- package/node_modules/@aws-amplify/graphql-model-transformer/lib/resources/amplify-dynamodb-table/amplify-table-manager-lambda/node_modules/.package-lock.json +0 -13
- package/node_modules/@aws-amplify/graphql-model-transformer/lib/resources/amplify-dynamodb-table/amplify-table-manager-lambda/node_modules/lodash.isequal/LICENSE +0 -47
- package/node_modules/@aws-amplify/graphql-model-transformer/lib/resources/amplify-dynamodb-table/amplify-table-manager-lambda/node_modules/lodash.isequal/README.md +0 -18
- package/node_modules/@aws-amplify/graphql-model-transformer/lib/resources/amplify-dynamodb-table/amplify-table-manager-lambda/node_modules/lodash.isequal/index.js +0 -1848
- package/node_modules/@aws-amplify/graphql-model-transformer/lib/resources/amplify-dynamodb-table/amplify-table-manager-lambda/node_modules/lodash.isequal/package.json +0 -16
- package/node_modules/@aws-amplify/graphql-model-transformer/lib/resources/amplify-dynamodb-table/amplify-table-manager-lambda/package-lock.json +0 -21
- package/node_modules/@aws-amplify/graphql-model-transformer/lib/resources/amplify-dynamodb-table/amplify-table-manager-lambda/package.json +0 -11
@@ -0,0 +1,201 @@
|
|
1
|
+
Apache License
|
2
|
+
Version 2.0, January 2004
|
3
|
+
http://www.apache.org/licenses/
|
4
|
+
|
5
|
+
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
|
6
|
+
|
7
|
+
1. Definitions.
|
8
|
+
|
9
|
+
"License" shall mean the terms and conditions for use, reproduction,
|
10
|
+
and distribution as defined by Sections 1 through 9 of this document.
|
11
|
+
|
12
|
+
"Licensor" shall mean the copyright owner or entity authorized by
|
13
|
+
the copyright owner that is granting the License.
|
14
|
+
|
15
|
+
"Legal Entity" shall mean the union of the acting entity and all
|
16
|
+
other entities that control, are controlled by, or are under common
|
17
|
+
control with that entity. For the purposes of this definition,
|
18
|
+
"control" means (i) the power, direct or indirect, to cause the
|
19
|
+
direction or management of such entity, whether by contract or
|
20
|
+
otherwise, or (ii) ownership of fifty percent (50%) or more of the
|
21
|
+
outstanding shares, or (iii) beneficial ownership of such entity.
|
22
|
+
|
23
|
+
"You" (or "Your") shall mean an individual or Legal Entity
|
24
|
+
exercising permissions granted by this License.
|
25
|
+
|
26
|
+
"Source" form shall mean the preferred form for making modifications,
|
27
|
+
including but not limited to software source code, documentation
|
28
|
+
source, and configuration files.
|
29
|
+
|
30
|
+
"Object" form shall mean any form resulting from mechanical
|
31
|
+
transformation or translation of a Source form, including but
|
32
|
+
not limited to compiled object code, generated documentation,
|
33
|
+
and conversions to other media types.
|
34
|
+
|
35
|
+
"Work" shall mean the work of authorship, whether in Source or
|
36
|
+
Object form, made available under the License, as indicated by a
|
37
|
+
copyright notice that is included in or attached to the work
|
38
|
+
(an example is provided in the Appendix below).
|
39
|
+
|
40
|
+
"Derivative Works" shall mean any work, whether in Source or Object
|
41
|
+
form, that is based on (or derived from) the Work and for which the
|
42
|
+
editorial revisions, annotations, elaborations, or other modifications
|
43
|
+
represent, as a whole, an original work of authorship. For the purposes
|
44
|
+
of this License, Derivative Works shall not include works that remain
|
45
|
+
separable from, or merely link (or bind by name) to the interfaces of,
|
46
|
+
the Work and Derivative Works thereof.
|
47
|
+
|
48
|
+
"Contribution" shall mean any work of authorship, including
|
49
|
+
the original version of the Work and any modifications or additions
|
50
|
+
to that Work or Derivative Works thereof, that is intentionally
|
51
|
+
submitted to Licensor for inclusion in the Work by the copyright owner
|
52
|
+
or by an individual or Legal Entity authorized to submit on behalf of
|
53
|
+
the copyright owner. For the purposes of this definition, "submitted"
|
54
|
+
means any form of electronic, verbal, or written communication sent
|
55
|
+
to the Licensor or its representatives, including but not limited to
|
56
|
+
communication on electronic mailing lists, source code control systems,
|
57
|
+
and issue tracking systems that are managed by, or on behalf of, the
|
58
|
+
Licensor for the purpose of discussing and improving the Work, but
|
59
|
+
excluding communication that is conspicuously marked or otherwise
|
60
|
+
designated in writing by the copyright owner as "Not a Contribution."
|
61
|
+
|
62
|
+
"Contributor" shall mean Licensor and any individual or Legal Entity
|
63
|
+
on behalf of whom a Contribution has been received by Licensor and
|
64
|
+
subsequently incorporated within the Work.
|
65
|
+
|
66
|
+
2. Grant of Copyright License. Subject to the terms and conditions of
|
67
|
+
this License, each Contributor hereby grants to You a perpetual,
|
68
|
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
69
|
+
copyright license to reproduce, prepare Derivative Works of,
|
70
|
+
publicly display, publicly perform, sublicense, and distribute the
|
71
|
+
Work and such Derivative Works in Source or Object form.
|
72
|
+
|
73
|
+
3. Grant of Patent License. Subject to the terms and conditions of
|
74
|
+
this License, each Contributor hereby grants to You a perpetual,
|
75
|
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
76
|
+
(except as stated in this section) patent license to make, have made,
|
77
|
+
use, offer to sell, sell, import, and otherwise transfer the Work,
|
78
|
+
where such license applies only to those patent claims licensable
|
79
|
+
by such Contributor that are necessarily infringed by their
|
80
|
+
Contribution(s) alone or by combination of their Contribution(s)
|
81
|
+
with the Work to which such Contribution(s) was submitted. If You
|
82
|
+
institute patent litigation against any entity (including a
|
83
|
+
cross-claim or counterclaim in a lawsuit) alleging that the Work
|
84
|
+
or a Contribution incorporated within the Work constitutes direct
|
85
|
+
or contributory patent infringement, then any patent licenses
|
86
|
+
granted to You under this License for that Work shall terminate
|
87
|
+
as of the date such litigation is filed.
|
88
|
+
|
89
|
+
4. Redistribution. You may reproduce and distribute copies of the
|
90
|
+
Work or Derivative Works thereof in any medium, with or without
|
91
|
+
modifications, and in Source or Object form, provided that You
|
92
|
+
meet the following conditions:
|
93
|
+
|
94
|
+
(a) You must give any other recipients of the Work or
|
95
|
+
Derivative Works a copy of this License; and
|
96
|
+
|
97
|
+
(b) You must cause any modified files to carry prominent notices
|
98
|
+
stating that You changed the files; and
|
99
|
+
|
100
|
+
(c) You must retain, in the Source form of any Derivative Works
|
101
|
+
that You distribute, all copyright, patent, trademark, and
|
102
|
+
attribution notices from the Source form of the Work,
|
103
|
+
excluding those notices that do not pertain to any part of
|
104
|
+
the Derivative Works; and
|
105
|
+
|
106
|
+
(d) If the Work includes a "NOTICE" text file as part of its
|
107
|
+
distribution, then any Derivative Works that You distribute must
|
108
|
+
include a readable copy of the attribution notices contained
|
109
|
+
within such NOTICE file, excluding those notices that do not
|
110
|
+
pertain to any part of the Derivative Works, in at least one
|
111
|
+
of the following places: within a NOTICE text file distributed
|
112
|
+
as part of the Derivative Works; within the Source form or
|
113
|
+
documentation, if provided along with the Derivative Works; or,
|
114
|
+
within a display generated by the Derivative Works, if and
|
115
|
+
wherever such third-party notices normally appear. The contents
|
116
|
+
of the NOTICE file are for informational purposes only and
|
117
|
+
do not modify the License. You may add Your own attribution
|
118
|
+
notices within Derivative Works that You distribute, alongside
|
119
|
+
or as an addendum to the NOTICE text from the Work, provided
|
120
|
+
that such additional attribution notices cannot be construed
|
121
|
+
as modifying the License.
|
122
|
+
|
123
|
+
You may add Your own copyright statement to Your modifications and
|
124
|
+
may provide additional or different license terms and conditions
|
125
|
+
for use, reproduction, or distribution of Your modifications, or
|
126
|
+
for any such Derivative Works as a whole, provided Your use,
|
127
|
+
reproduction, and distribution of the Work otherwise complies with
|
128
|
+
the conditions stated in this License.
|
129
|
+
|
130
|
+
5. Submission of Contributions. Unless You explicitly state otherwise,
|
131
|
+
any Contribution intentionally submitted for inclusion in the Work
|
132
|
+
by You to the Licensor shall be under the terms and conditions of
|
133
|
+
this License, without any additional terms or conditions.
|
134
|
+
Notwithstanding the above, nothing herein shall supersede or modify
|
135
|
+
the terms of any separate license agreement you may have executed
|
136
|
+
with Licensor regarding such Contributions.
|
137
|
+
|
138
|
+
6. Trademarks. This License does not grant permission to use the trade
|
139
|
+
names, trademarks, service marks, or product names of the Licensor,
|
140
|
+
except as required for reasonable and customary use in describing the
|
141
|
+
origin of the Work and reproducing the content of the NOTICE file.
|
142
|
+
|
143
|
+
7. Disclaimer of Warranty. Unless required by applicable law or
|
144
|
+
agreed to in writing, Licensor provides the Work (and each
|
145
|
+
Contributor provides its Contributions) on an "AS IS" BASIS,
|
146
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
|
147
|
+
implied, including, without limitation, any warranties or conditions
|
148
|
+
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
|
149
|
+
PARTICULAR PURPOSE. You are solely responsible for determining the
|
150
|
+
appropriateness of using or redistributing the Work and assume any
|
151
|
+
risks associated with Your exercise of permissions under this License.
|
152
|
+
|
153
|
+
8. Limitation of Liability. In no event and under no legal theory,
|
154
|
+
whether in tort (including negligence), contract, or otherwise,
|
155
|
+
unless required by applicable law (such as deliberate and grossly
|
156
|
+
negligent acts) or agreed to in writing, shall any Contributor be
|
157
|
+
liable to You for damages, including any direct, indirect, special,
|
158
|
+
incidental, or consequential damages of any character arising as a
|
159
|
+
result of this License or out of the use or inability to use the
|
160
|
+
Work (including but not limited to damages for loss of goodwill,
|
161
|
+
work stoppage, computer failure or malfunction, or any and all
|
162
|
+
other commercial damages or losses), even if such Contributor
|
163
|
+
has been advised of the possibility of such damages.
|
164
|
+
|
165
|
+
9. Accepting Warranty or Additional Liability. While redistributing
|
166
|
+
the Work or Derivative Works thereof, You may choose to offer,
|
167
|
+
and charge a fee for, acceptance of support, warranty, indemnity,
|
168
|
+
or other liability obligations and/or rights consistent with this
|
169
|
+
License. However, in accepting such obligations, You may act only
|
170
|
+
on Your own behalf and on Your sole responsibility, not on behalf
|
171
|
+
of any other Contributor, and only if You agree to indemnify,
|
172
|
+
defend, and hold each Contributor harmless for any liability
|
173
|
+
incurred by, or claims asserted against, such Contributor by reason
|
174
|
+
of your accepting any such warranty or additional liability.
|
175
|
+
|
176
|
+
END OF TERMS AND CONDITIONS
|
177
|
+
|
178
|
+
APPENDIX: How to apply the Apache License to your work.
|
179
|
+
|
180
|
+
To apply the Apache License to your work, attach the following
|
181
|
+
boilerplate notice, with the fields enclosed by brackets "{}"
|
182
|
+
replaced with your own identifying information. (Don't include
|
183
|
+
the brackets!) The text should be enclosed in the appropriate
|
184
|
+
comment syntax for the file format. We also recommend that a
|
185
|
+
file or class name and description of purpose be included on the
|
186
|
+
same "printed page" as the copyright notice for easier
|
187
|
+
identification within third-party archives.
|
188
|
+
|
189
|
+
Copyright 2017 - 2022 Amazon.com, Inc. or its affiliates. All Rights Reserved.
|
190
|
+
|
191
|
+
Licensed under the Apache License, Version 2.0 (the "License");
|
192
|
+
you may not use this file except in compliance with the License.
|
193
|
+
You may obtain a copy of the License at
|
194
|
+
|
195
|
+
http://www.apache.org/licenses/LICENSE-2.0
|
196
|
+
|
197
|
+
Unless required by applicable law or agreed to in writing, software
|
198
|
+
distributed under the License is distributed on an "AS IS" BASIS,
|
199
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
200
|
+
See the License for the specific language governing permissions and
|
201
|
+
limitations under the License.
|
@@ -0,0 +1,85 @@
|
|
1
|
+
# Amplify GraphQL Generation Transformer
|
2
|
+
|
3
|
+
The Amplify GraphQL Generation Transformer is a tool that enables the quick and easy creation of AI-powered Generation routes within your AWS AppSync API. This transformer can be leveraged by using the `@generation` directive to configure AI models and system prompts for generating content.
|
4
|
+
|
5
|
+
## Installation
|
6
|
+
|
7
|
+
```bash
|
8
|
+
npm install @aws-amplify/graphql-generation-transformer
|
9
|
+
```
|
10
|
+
|
11
|
+
## Directive Definition
|
12
|
+
|
13
|
+
The `@generation` directive is defined as follows:
|
14
|
+
|
15
|
+
```graphql
|
16
|
+
directive @generation(aiModel: String!, systemPrompt: String!, inferenceConfiguration: GenerationInferenceConfiguration) on FIELD_DEFINITION
|
17
|
+
```
|
18
|
+
|
19
|
+
## Features
|
20
|
+
|
21
|
+
1. AI Model Integration: Specify the AI model to be used for generation.
|
22
|
+
2. System Prompt Configuration: Define a system prompt to guide the AI's output.
|
23
|
+
3. Inference Configuration: Fine-tune generation parameters like max tokens, temperature, and top-p.
|
24
|
+
4. Integrates with `@auth` Directive: Supports existing auth modes like IAM, API key, and Amazon Cognito User Pools.
|
25
|
+
5. Resolver Creation: Generates resolvers with tool definitions based on the Query field's return type to interact with the specified AI model.
|
26
|
+
6. Bedrock HTTP Data Source Creation: Creates a AppSync HTTP Data Source for Bedrock to interact with the specified AI model.
|
27
|
+
|
28
|
+
## Examples
|
29
|
+
|
30
|
+
### Basic Usage
|
31
|
+
|
32
|
+
#### Scalar Type Generation
|
33
|
+
|
34
|
+
```graphql
|
35
|
+
type Query {
|
36
|
+
generateStory(topic: String!): String
|
37
|
+
@generation(
|
38
|
+
aiModel: "anthropic.claude-3-haiku-20240307-v1:0"
|
39
|
+
systemPrompt: "You are a creative storyteller. Generate a short story based on the given topic."
|
40
|
+
)
|
41
|
+
}
|
42
|
+
```
|
43
|
+
|
44
|
+
#### Complex Type Generation
|
45
|
+
|
46
|
+
```graphql
|
47
|
+
type Recipe {
|
48
|
+
name: String!
|
49
|
+
ingredients: [String!]!
|
50
|
+
instructions: [String!]!
|
51
|
+
prepTime: Int!
|
52
|
+
cookTime: Int!
|
53
|
+
servings: Int!
|
54
|
+
difficulty: String!
|
55
|
+
}
|
56
|
+
|
57
|
+
type Query {
|
58
|
+
generateRecipe(cuisine: String!, dietaryRestrictions: [String]): Recipe
|
59
|
+
@generation(
|
60
|
+
aiModel: "anthropic.claude-3-haiku-20240307-v1:0"
|
61
|
+
systemPrompt: "You are a professional chef specializing in creating recipes. Generate a detailed recipe based on the given cuisine and dietary restrictions."
|
62
|
+
)
|
63
|
+
}
|
64
|
+
```
|
65
|
+
|
66
|
+
### Advanced Configuration
|
67
|
+
|
68
|
+
```graphql
|
69
|
+
type Query {
|
70
|
+
generateCode(description: String!): String
|
71
|
+
@generation(
|
72
|
+
aiModel: "anthropic.claude-3-haiku-20240307-v1:0"
|
73
|
+
systemPrompt: "You are an expert programmer. Generate code based on the given description."
|
74
|
+
inferenceConfiguration: { maxTokens: 500, temperature: 0.7, topP: 0.9 }
|
75
|
+
)
|
76
|
+
}
|
77
|
+
```
|
78
|
+
|
79
|
+
## Limitations
|
80
|
+
|
81
|
+
- The `@generation` directive can only be used on Query fields.
|
82
|
+
- The AI model specified must:
|
83
|
+
- be supported by Amazon Bedrock's /converse API
|
84
|
+
- support tool usage
|
85
|
+
- Some AppSync scalar types are not currently supported.
|
@@ -0,0 +1,32 @@
|
|
1
|
+
import { TransformerPluginBase } from '@aws-amplify/graphql-transformer-core';
|
2
|
+
import { TransformerContextProvider, TransformerSchemaVisitStepContextProvider } from '@aws-amplify/graphql-transformer-interfaces';
|
3
|
+
import { DirectiveNode, FieldDefinitionNode, InterfaceTypeDefinitionNode, ObjectTypeDefinitionNode } from 'graphql';
|
4
|
+
import { ToolConfig } from './utils/tools';
|
5
|
+
export type GenerationDirectiveConfiguration = {
|
6
|
+
parent: ObjectTypeDefinitionNode;
|
7
|
+
directive: DirectiveNode;
|
8
|
+
aiModel: string;
|
9
|
+
field: FieldDefinitionNode;
|
10
|
+
systemPrompt: string;
|
11
|
+
inferenceConfiguration: InferenceConfiguration;
|
12
|
+
};
|
13
|
+
export type InferenceConfiguration = {
|
14
|
+
maxTokens?: number;
|
15
|
+
temperature?: number;
|
16
|
+
topP?: number;
|
17
|
+
};
|
18
|
+
export type GenerationConfigurationWithToolConfig = GenerationDirectiveConfiguration & {
|
19
|
+
toolConfig: ToolConfig;
|
20
|
+
};
|
21
|
+
export declare class GenerationTransformer extends TransformerPluginBase {
|
22
|
+
private directives;
|
23
|
+
constructor();
|
24
|
+
field: (parent: ObjectTypeDefinitionNode | InterfaceTypeDefinitionNode, definition: FieldDefinitionNode, directive: DirectiveNode, context: TransformerSchemaVisitStepContextProvider) => void;
|
25
|
+
generateResolvers: (ctx: TransformerContextProvider) => void;
|
26
|
+
private createStack;
|
27
|
+
private createPipelineResolver;
|
28
|
+
private createBedrockDataSource;
|
29
|
+
private createBedrockDataSourceRole;
|
30
|
+
private bedrockDataSourceName;
|
31
|
+
}
|
32
|
+
//# sourceMappingURL=grapqhl-generation-transformer.d.ts.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"grapqhl-generation-transformer.d.ts","sourceRoot":"","sources":["../src/grapqhl-generation-transformer.ts"],"names":[],"mappings":"AACA,OAAO,EAEL,qBAAqB,EAGtB,MAAM,uCAAuC,CAAC;AAC/C,OAAO,EAEL,0BAA0B,EAC1B,yCAAyC,EAC1C,MAAM,6CAA6C,CAAC;AACrD,OAAO,EAAE,aAAa,EAAE,mBAAmB,EAAE,2BAA2B,EAAE,wBAAwB,EAAE,MAAM,SAAS,CAAC;AAEpH,OAAO,EAAE,UAAU,EAA0B,MAAM,eAAe,CAAC;AAQnE,MAAM,MAAM,gCAAgC,GAAG;IAC7C,MAAM,EAAE,wBAAwB,CAAC;IACjC,SAAS,EAAE,aAAa,CAAC;IACzB,OAAO,EAAE,MAAM,CAAC;IAChB,KAAK,EAAE,mBAAmB,CAAC;IAC3B,YAAY,EAAE,MAAM,CAAC;IACrB,sBAAsB,EAAE,sBAAsB,CAAC;CAChD,CAAC;AAEF,MAAM,MAAM,sBAAsB,GAAG;IACnC,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,IAAI,CAAC,EAAE,MAAM,CAAC;CACf,CAAC;AAEF,MAAM,MAAM,qCAAqC,GAAG,gCAAgC,GAAG;IACrF,UAAU,EAAE,UAAU,CAAC;CACxB,CAAC;AAEF,qBAAa,qBAAsB,SAAQ,qBAAqB;IAC9D,OAAO,CAAC,UAAU,CAA0C;;IAM5D,KAAK,WACK,wBAAwB,GAAG,2BAA2B,cAClD,mBAAmB,aACpB,aAAa,WACf,yCAAyC,KACjD,IAAI,CAcL;IAEF,iBAAiB,QAAS,0BAA0B,KAAG,IAAI,CAuBzD;IAQF,OAAO,CAAC,WAAW;IAenB,OAAO,CAAC,sBAAsB;IAgC9B,OAAO,CAAC,uBAAuB;IA8C/B,OAAO,CAAC,2BAA2B;IAwBnC,OAAO,CAAC,qBAAqB;CAG9B"}
|
@@ -0,0 +1,119 @@
|
|
1
|
+
"use strict";
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
3
|
+
if (k2 === undefined) k2 = k;
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
7
|
+
}
|
8
|
+
Object.defineProperty(o, k2, desc);
|
9
|
+
}) : (function(o, m, k, k2) {
|
10
|
+
if (k2 === undefined) k2 = k;
|
11
|
+
o[k2] = m[k];
|
12
|
+
}));
|
13
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
14
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
15
|
+
}) : function(o, v) {
|
16
|
+
o["default"] = v;
|
17
|
+
});
|
18
|
+
var __importStar = (this && this.__importStar) || function (mod) {
|
19
|
+
if (mod && mod.__esModule) return mod;
|
20
|
+
var result = {};
|
21
|
+
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
22
|
+
__setModuleDefault(result, mod);
|
23
|
+
return result;
|
24
|
+
};
|
25
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
26
|
+
exports.GenerationTransformer = void 0;
|
27
|
+
const graphql_directives_1 = require("@aws-amplify/graphql-directives");
|
28
|
+
const graphql_transformer_core_1 = require("@aws-amplify/graphql-transformer-core");
|
29
|
+
const graphql_transformer_common_1 = require("graphql-transformer-common");
|
30
|
+
const tools_1 = require("./utils/tools");
|
31
|
+
const invoke_bedrock_1 = require("./resolvers/invoke-bedrock");
|
32
|
+
const iam = __importStar(require("aws-cdk-lib/aws-iam"));
|
33
|
+
const validation_1 = require("./validation");
|
34
|
+
const graphql_transformer_common_2 = require("graphql-transformer-common");
|
35
|
+
class GenerationTransformer extends graphql_transformer_core_1.TransformerPluginBase {
|
36
|
+
constructor() {
|
37
|
+
super('amplify-generation-transformer', graphql_directives_1.GenerationDirective.definition);
|
38
|
+
this.directives = [];
|
39
|
+
this.field = (parent, definition, directive, context) => {
|
40
|
+
const directiveWrapped = new graphql_transformer_core_1.DirectiveWrapper(directive);
|
41
|
+
const config = directiveWrapped.getArguments({
|
42
|
+
parent,
|
43
|
+
directive,
|
44
|
+
field: definition,
|
45
|
+
inferenceConfiguration: {},
|
46
|
+
}, (0, graphql_transformer_core_1.generateGetArgumentsInput)(context.transformParameters));
|
47
|
+
(0, validation_1.validate)(config, context);
|
48
|
+
this.directives.push(config);
|
49
|
+
};
|
50
|
+
this.generateResolvers = (ctx) => {
|
51
|
+
if (this.directives.length === 0)
|
52
|
+
return;
|
53
|
+
this.directives.forEach((directive) => {
|
54
|
+
const { parent, field } = directive;
|
55
|
+
const fieldName = field.name.value;
|
56
|
+
const parentName = parent.name.value;
|
57
|
+
const directiveWithToolConfig = {
|
58
|
+
...directive,
|
59
|
+
toolConfig: (0, tools_1.createResponseTypeTool)(field, ctx),
|
60
|
+
};
|
61
|
+
const stackName = this.bedrockDataSourceName(fieldName) + 'Stack';
|
62
|
+
const stack = this.createStack(ctx, stackName);
|
63
|
+
const resolverResourceId = graphql_transformer_common_1.ResolverResourceIDs.ResolverResourceID(parentName, fieldName);
|
64
|
+
const httpDataSourceId = graphql_transformer_common_1.HttpResourceIDs.HttpDataSourceID(this.bedrockDataSourceName(fieldName));
|
65
|
+
const dataSource = this.createBedrockDataSource(ctx, directive, stack.region, stackName, httpDataSourceId);
|
66
|
+
const invokeBedrockFunction = (0, invoke_bedrock_1.createInvokeBedrockResolverFunction)(directiveWithToolConfig);
|
67
|
+
this.createPipelineResolver(ctx, parentName, fieldName, resolverResourceId, invokeBedrockFunction, dataSource);
|
68
|
+
});
|
69
|
+
};
|
70
|
+
}
|
71
|
+
createStack(ctx, stackName) {
|
72
|
+
const stack = ctx.stackManager.createStack(stackName);
|
73
|
+
stack.templateOptions.templateFormatVersion = '2010-09-09';
|
74
|
+
stack.templateOptions.description = 'An auto-generated nested stack for the @generation directive.';
|
75
|
+
return stack;
|
76
|
+
}
|
77
|
+
createPipelineResolver(ctx, parentName, fieldName, resolverResourceId, invokeBedrockFunction, dataSource) {
|
78
|
+
const conversationPipelineResolver = new graphql_transformer_core_1.TransformerResolver(parentName, fieldName, resolverResourceId, invokeBedrockFunction.req, invokeBedrockFunction.res, ['auth'], [], dataSource, { name: 'APPSYNC_JS', runtimeVersion: '1.0.0' });
|
79
|
+
ctx.resolvers.addResolver(parentName, fieldName, conversationPipelineResolver);
|
80
|
+
}
|
81
|
+
createBedrockDataSource(ctx, directive, region, stackName, httpDataSourceId) {
|
82
|
+
const { field: { name: { value: fieldName }, }, aiModel, } = directive;
|
83
|
+
const bedrockUrl = `https://bedrock-runtime.${region}.amazonaws.com`;
|
84
|
+
const dataSourceScope = ctx.stackManager.getScopeFor(httpDataSourceId, stackName);
|
85
|
+
const dataSource = ctx.api.host.addHttpDataSource(httpDataSourceId, bedrockUrl, {
|
86
|
+
authorizationConfig: {
|
87
|
+
signingRegion: region,
|
88
|
+
signingServiceName: 'bedrock',
|
89
|
+
},
|
90
|
+
}, dataSourceScope);
|
91
|
+
const roleLogicalId = this.bedrockDataSourceName(fieldName) + 'IAMRole';
|
92
|
+
const roleName = ctx.resourceHelper.generateIAMRoleName(roleLogicalId);
|
93
|
+
const role = this.createBedrockDataSourceRole(dataSourceScope, roleLogicalId, roleName, region, aiModel);
|
94
|
+
dataSource.ds.serviceRoleArn = role.roleArn;
|
95
|
+
return dataSource;
|
96
|
+
}
|
97
|
+
createBedrockDataSourceRole(dataSourceScope, roleLogicalId, roleName, region, bedrockModelId) {
|
98
|
+
return new iam.Role(dataSourceScope, roleLogicalId, {
|
99
|
+
roleName,
|
100
|
+
assumedBy: new iam.ServicePrincipal('appsync.amazonaws.com'),
|
101
|
+
inlinePolicies: {
|
102
|
+
BedrockRuntimeAccess: new iam.PolicyDocument({
|
103
|
+
statements: [
|
104
|
+
new iam.PolicyStatement({
|
105
|
+
effect: iam.Effect.ALLOW,
|
106
|
+
actions: ['bedrock:InvokeModel'],
|
107
|
+
resources: [`arn:aws:bedrock:${region}::foundation-model/${bedrockModelId}`],
|
108
|
+
}),
|
109
|
+
],
|
110
|
+
}),
|
111
|
+
},
|
112
|
+
});
|
113
|
+
}
|
114
|
+
bedrockDataSourceName(fieldName) {
|
115
|
+
return `GenerationBedrockDataSource${(0, graphql_transformer_common_2.toUpper)(fieldName)}`;
|
116
|
+
}
|
117
|
+
}
|
118
|
+
exports.GenerationTransformer = GenerationTransformer;
|
119
|
+
//# sourceMappingURL=grapqhl-generation-transformer.js.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"grapqhl-generation-transformer.js","sourceRoot":"","sources":["../src/grapqhl-generation-transformer.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,wEAAsE;AACtE,oFAK+C;AAO/C,2EAAkF;AAClF,yCAAmE;AAEnE,+DAAiF;AACjF,yDAA2C;AAE3C,6CAAwC;AACxC,2EAAqD;AAqBrD,MAAa,qBAAsB,SAAQ,gDAAqB;IAG9D;QACE,KAAK,CAAC,gCAAgC,EAAE,wCAAmB,CAAC,UAAU,CAAC,CAAC;QAHlE,eAAU,GAAuC,EAAE,CAAC;QAM5D,UAAK,GAAG,CACN,MAA8D,EAC9D,UAA+B,EAC/B,SAAwB,EACxB,OAAkD,EAC5C,EAAE;YACR,MAAM,gBAAgB,GAAG,IAAI,2CAAgB,CAAC,SAAS,CAAC,CAAC;YACzD,MAAM,MAAM,GAAG,gBAAgB,CAAC,YAAY,CAC1C;gBACE,MAAM;gBACN,SAAS;gBACT,KAAK,EAAE,UAAU;gBACjB,sBAAsB,EAAE,EAAE;aACS,EACrC,IAAA,oDAAyB,EAAC,OAAO,CAAC,mBAAmB,CAAC,CACvD,CAAC;YAEF,IAAA,qBAAQ,EAAC,MAAM,EAAE,OAAqC,CAAC,CAAC;YACxD,IAAI,CAAC,UAAU,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC;QAC/B,CAAC,CAAC;QAEF,sBAAiB,GAAG,CAAC,GAA+B,EAAQ,EAAE;YAC5D,IAAI,IAAI,CAAC,UAAU,CAAC,MAAM,KAAK,CAAC;gBAAE,OAAO;YAEzC,IAAI,CAAC,UAAU,CAAC,OAAO,CAAC,CAAC,SAAS,EAAE,EAAE;gBACpC,MAAM,EAAE,MAAM,EAAE,KAAK,EAAE,GAAG,SAAS,CAAC;gBACpC,MAAM,SAAS,GAAG,KAAK,CAAC,IAAI,CAAC,KAAK,CAAC;gBACnC,MAAM,UAAU,GAAG,MAAM,CAAC,IAAI,CAAC,KAAK,CAAC;gBAErC,MAAM,uBAAuB,GAA0C;oBACrE,GAAG,SAAS;oBACZ,UAAU,EAAE,IAAA,8BAAsB,EAAC,KAAK,EAAE,GAAG,CAAC;iBAC/C,CAAC;gBAEF,MAAM,SAAS,GAAG,IAAI,CAAC,qBAAqB,CAAC,SAAS,CAAC,GAAG,OAAO,CAAC;gBAClE,MAAM,KAAK,GAAG,IAAI,CAAC,WAAW,CAAC,GAAG,EAAE,SAAS,CAAC,CAAC;gBAE/C,MAAM,kBAAkB,GAAG,gDAAmB,CAAC,kBAAkB,CAAC,UAAU,EAAE,SAAS,CAAC,CAAC;gBACzF,MAAM,gBAAgB,GAAG,4CAAe,CAAC,gBAAgB,CAAC,IAAI,CAAC,qBAAqB,CAAC,SAAS,CAAC,CAAC,CAAC;gBACjG,MAAM,UAAU,GAAG,IAAI,CAAC,uBAAuB,CAAC,GAAG,EAAE,SAAS,EAAE,KAAK,CAAC,MAAM,EAAE,SAAS,EAAE,gBAAgB,CAAC,CAAC;gBAC3G,MAAM,qBAAqB,GAAG,IAAA,oDAAmC,EAAC,uBAAuB,CAAC,CAAC;gBAE3F,IAAI,CAAC,sBAAsB,CAAC,GAAG,EAAE,UAAU,EAAE,SAAS,EAAE,kBAAkB,EAAE,qBAAqB,EAAE,UAAU,CAAC,CAAC;YACjH,CAAC,CAAC,CAAC;QACL,CAAC,CAAC;IA9CF,CAAC;IAsDO,WAAW,CAAC,GAA+B,EAAE,SAAiB;QACpE,MAAM,KAAK,GAAG,GAAG,CAAC,YAAY,CAAC,WAAW,CAAC,SAAS,CAAC,CAAC;QACtD,KAAK,CAAC,eAAe,CAAC,qBAAqB,GAAG,YAAY,CAAC;QAC3D,KAAK,CAAC,eAAe,CAAC,WAAW,GAAG,+DAA+D,CAAC;QACpG,OAAO,KAAK,CAAC;IACf,CAAC;IAUO,sBAAsB,CAC5B,GAA+B,EAC/B,UAAkB,EAClB,SAAiB,EACjB,kBAA0B,EAC1B,qBAAqF,EACrF,UAA0C;QAE1C,MAAM,4BAA4B,GAAG,IAAI,8CAAmB,CAC1D,UAAU,EACV,SAAS,EACT,kBAAkB,EAClB,qBAAqB,CAAC,GAAG,EACzB,qBAAqB,CAAC,GAAG,EACzB,CAAC,MAAM,CAAC,EACR,EAAE,EACF,UAAiB,EACjB,EAAE,IAAI,EAAE,YAAY,EAAE,cAAc,EAAE,OAAO,EAAE,CAChD,CAAC;QAEF,GAAG,CAAC,SAAS,CAAC,WAAW,CAAC,UAAU,EAAE,SAAS,EAAE,4BAA4B,CAAC,CAAC;IACjF,CAAC;IAWO,uBAAuB,CAC7B,GAA+B,EAC/B,SAA2C,EAC3C,MAAc,EACd,SAAiB,EACjB,gBAAwB;QAExB,MAAM,EACJ,KAAK,EAAE,EACL,IAAI,EAAE,EAAE,KAAK,EAAE,SAAS,EAAE,GAC3B,EACD,OAAO,GACR,GAAG,SAAS,CAAC;QAEd,MAAM,UAAU,GAAG,2BAA2B,MAAM,gBAAgB,CAAC;QAErE,MAAM,eAAe,GAAG,GAAG,CAAC,YAAY,CAAC,WAAW,CAAC,gBAAgB,EAAE,SAAS,CAAC,CAAC;QAClF,MAAM,UAAU,GAAG,GAAG,CAAC,GAAG,CAAC,IAAI,CAAC,iBAAiB,CAC/C,gBAAgB,EAChB,UAAU,EACV;YACE,mBAAmB,EAAE;gBACnB,aAAa,EAAE,MAAM;gBACrB,kBAAkB,EAAE,SAAS;aAC9B;SACF,EACD,eAAe,CAChB,CAAC;QAGF,MAAM,aAAa,GAAG,IAAI,CAAC,qBAAqB,CAAC,SAAS,CAAC,GAAG,SAAS,CAAC;QACxE,MAAM,QAAQ,GAAG,GAAG,CAAC,cAAc,CAAC,mBAAmB,CAAC,aAAa,CAAC,CAAC;QACvE,MAAM,IAAI,GAAG,IAAI,CAAC,2BAA2B,CAAC,eAAe,EAAE,aAAa,EAAE,QAAQ,EAAE,MAAM,EAAE,OAAO,CAAC,CAAC;QACzG,UAAU,CAAC,EAAE,CAAC,cAAc,GAAG,IAAI,CAAC,OAAO,CAAC;QAC5C,OAAO,UAAU,CAAC;IACpB,CAAC;IAWO,2BAA2B,CACjC,eAA0B,EAC1B,aAAqB,EACrB,QAAgB,EAChB,MAAc,EACd,cAAsB;QAEtB,OAAO,IAAI,GAAG,CAAC,IAAI,CAAC,eAAe,EAAE,aAAa,EAAE;YAClD,QAAQ;YACR,SAAS,EAAE,IAAI,GAAG,CAAC,gBAAgB,CAAC,uBAAuB,CAAC;YAC5D,cAAc,EAAE;gBACd,oBAAoB,EAAE,IAAI,GAAG,CAAC,cAAc,CAAC;oBAC3C,UAAU,EAAE;wBACV,IAAI,GAAG,CAAC,eAAe,CAAC;4BACtB,MAAM,EAAE,GAAG,CAAC,MAAM,CAAC,KAAK;4BACxB,OAAO,EAAE,CAAC,qBAAqB,CAAC;4BAChC,SAAS,EAAE,CAAC,mBAAmB,MAAM,sBAAsB,cAAc,EAAE,CAAC;yBAC7E,CAAC;qBACH;iBACF,CAAC;aACH;SACF,CAAC,CAAC;IACL,CAAC;IAEO,qBAAqB,CAAC,SAAiB;QAC7C,OAAO,8BAA8B,IAAA,oCAAO,EAAC,SAAS,CAAC,EAAE,CAAC;IAC5D,CAAC;CACF;AAnLD,sDAmLC"}
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,qBAAqB,EAAE,MAAM,kCAAkC,CAAC"}
|
@@ -0,0 +1,6 @@
|
|
1
|
+
"use strict";
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
3
|
+
exports.GenerationTransformer = void 0;
|
4
|
+
var grapqhl_generation_transformer_1 = require("./grapqhl-generation-transformer");
|
5
|
+
Object.defineProperty(exports, "GenerationTransformer", { enumerable: true, get: function () { return grapqhl_generation_transformer_1.GenerationTransformer; } });
|
6
|
+
//# sourceMappingURL=index.js.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";;;AAAA,mFAAyE;AAAhE,uIAAA,qBAAqB,OAAA"}
|
package/node_modules/@aws-amplify/graphql-generation-transformer/lib/resolvers/invoke-bedrock.d.ts
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
import { MappingTemplateProvider } from '@aws-amplify/graphql-transformer-interfaces';
|
2
|
+
import { GenerationConfigurationWithToolConfig } from '../grapqhl-generation-transformer';
|
3
|
+
export declare const createInvokeBedrockResolverFunction: (config: GenerationConfigurationWithToolConfig) => {
|
4
|
+
req: MappingTemplateProvider;
|
5
|
+
res: MappingTemplateProvider;
|
6
|
+
};
|
7
|
+
//# sourceMappingURL=invoke-bedrock.d.ts.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"invoke-bedrock.d.ts","sourceRoot":"","sources":["../../src/resolvers/invoke-bedrock.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,uBAAuB,EAAE,MAAM,6CAA6C,CAAC;AAEtF,OAAO,EAAE,qCAAqC,EAA0B,MAAM,mCAAmC,CAAC;AASlH,eAAO,MAAM,mCAAmC,WACtC,qCAAqC;SACrC,uBAAuB;SAAO,uBAAuB;CAI9D,CAAC"}
|
package/node_modules/@aws-amplify/graphql-generation-transformer/lib/resolvers/invoke-bedrock.js
ADDED
@@ -0,0 +1,72 @@
|
|
1
|
+
"use strict";
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
3
|
+
exports.createInvokeBedrockResolverFunction = void 0;
|
4
|
+
const graphql_transformer_core_1 = require("@aws-amplify/graphql-transformer-core");
|
5
|
+
const ts_dedent_1 = require("ts-dedent");
|
6
|
+
const createInvokeBedrockResolverFunction = (config) => {
|
7
|
+
const req = createInvokeBedrockRequestFunction(config);
|
8
|
+
const res = createInvokeBedrockResponseFunction();
|
9
|
+
return { req, res };
|
10
|
+
};
|
11
|
+
exports.createInvokeBedrockResolverFunction = createInvokeBedrockResolverFunction;
|
12
|
+
const createInvokeBedrockRequestFunction = (config) => {
|
13
|
+
const { aiModel, toolConfig, inferenceConfiguration } = config;
|
14
|
+
const stringifiedToolConfig = JSON.stringify(toolConfig);
|
15
|
+
const stringifiedSystemPrompt = JSON.stringify(config.systemPrompt);
|
16
|
+
const inferenceConfig = getInferenceConfigResolverDefinition(inferenceConfiguration);
|
17
|
+
const requestFunctionString = `
|
18
|
+
export function request(ctx) {
|
19
|
+
const toolConfig = ${stringifiedToolConfig};
|
20
|
+
const prompt = ${stringifiedSystemPrompt};
|
21
|
+
const args = JSON.stringify(ctx.args);
|
22
|
+
|
23
|
+
return {
|
24
|
+
resourcePath: '/model/${aiModel}/converse',
|
25
|
+
method: 'POST',
|
26
|
+
params: {
|
27
|
+
headers: { 'Content-Type': 'application/json' },
|
28
|
+
body: {
|
29
|
+
messages: [{
|
30
|
+
role: 'user',
|
31
|
+
content: [{ text: args }],
|
32
|
+
}],
|
33
|
+
system: [{ text: prompt }],
|
34
|
+
toolConfig,
|
35
|
+
${inferenceConfig}
|
36
|
+
}
|
37
|
+
}
|
38
|
+
}
|
39
|
+
}
|
40
|
+
`;
|
41
|
+
return graphql_transformer_core_1.MappingTemplate.inlineTemplateFromString((0, ts_dedent_1.dedent)(requestFunctionString));
|
42
|
+
};
|
43
|
+
const createInvokeBedrockResponseFunction = () => {
|
44
|
+
const responseFunctionString = `
|
45
|
+
export function response(ctx) {
|
46
|
+
if (ctx.error) {
|
47
|
+
util.error(ctx.error.message, ctx.error.type);
|
48
|
+
}
|
49
|
+
const body = JSON.parse(ctx.result.body);
|
50
|
+
const { content } = body.output.message;
|
51
|
+
|
52
|
+
if (content.length < 1) {
|
53
|
+
util.error('No content block in assistant response.', 'error');
|
54
|
+
}
|
55
|
+
|
56
|
+
const toolUse = content[0].toolUse;
|
57
|
+
if (!toolUse) {
|
58
|
+
util.error('Missing tool use block in assistant response.', 'error');
|
59
|
+
}
|
60
|
+
|
61
|
+
const response = toolUse.input.value;
|
62
|
+
return response;
|
63
|
+
}
|
64
|
+
`;
|
65
|
+
return graphql_transformer_core_1.MappingTemplate.inlineTemplateFromString((0, ts_dedent_1.dedent)(responseFunctionString));
|
66
|
+
};
|
67
|
+
const getInferenceConfigResolverDefinition = (inferenceConfiguration) => {
|
68
|
+
return inferenceConfiguration && Object.keys(inferenceConfiguration).length > 0
|
69
|
+
? `inferenceConfig: ${JSON.stringify(inferenceConfiguration)},`
|
70
|
+
: '// default inference config';
|
71
|
+
};
|
72
|
+
//# sourceMappingURL=invoke-bedrock.js.map
|
package/node_modules/@aws-amplify/graphql-generation-transformer/lib/resolvers/invoke-bedrock.js.map
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"invoke-bedrock.js","sourceRoot":"","sources":["../../src/resolvers/invoke-bedrock.ts"],"names":[],"mappings":";;;AAAA,oFAAwE;AAExE,yCAAmC;AAU5B,MAAM,mCAAmC,GAAG,CACjD,MAA6C,EACmB,EAAE;IAClE,MAAM,GAAG,GAAG,kCAAkC,CAAC,MAAM,CAAC,CAAC;IACvD,MAAM,GAAG,GAAG,mCAAmC,EAAE,CAAC;IAClD,OAAO,EAAE,GAAG,EAAE,GAAG,EAAE,CAAC;AACtB,CAAC,CAAC;AANW,QAAA,mCAAmC,uCAM9C;AAQF,MAAM,kCAAkC,GAAG,CAAC,MAA6C,EAA2B,EAAE;IACpH,MAAM,EAAE,OAAO,EAAE,UAAU,EAAE,sBAAsB,EAAE,GAAG,MAAM,CAAC;IAC/D,MAAM,qBAAqB,GAAG,IAAI,CAAC,SAAS,CAAC,UAAU,CAAC,CAAC;IACzD,MAAM,uBAAuB,GAAG,IAAI,CAAC,SAAS,CAAC,MAAM,CAAC,YAAY,CAAC,CAAC;IAEpE,MAAM,eAAe,GAAG,oCAAoC,CAAC,sBAAsB,CAAC,CAAC;IACrF,MAAM,qBAAqB,GAAG;;yBAEP,qBAAqB;qBACzB,uBAAuB;;;;8BAId,OAAO;;;;;;;;;;;YAWzB,eAAe;;;;;CAK1B,CAAC;IAEA,OAAO,0CAAe,CAAC,wBAAwB,CAAC,IAAA,kBAAM,EAAC,qBAAqB,CAAC,CAAC,CAAC;AACjF,CAAC,CAAC;AAOF,MAAM,mCAAmC,GAAG,GAA4B,EAAE;IAExE,MAAM,sBAAsB,GAAG;;;;;;;;;;;;;;;;;;;;CAoBhC,CAAC;IAEA,OAAO,0CAAe,CAAC,wBAAwB,CAAC,IAAA,kBAAM,EAAC,sBAAsB,CAAC,CAAC,CAAC;AAClF,CAAC,CAAC;AAQF,MAAM,oCAAoC,GAAG,CAAC,sBAA+C,EAAU,EAAE;IACvG,OAAO,sBAAsB,IAAI,MAAM,CAAC,IAAI,CAAC,sBAAsB,CAAC,CAAC,MAAM,GAAG,CAAC;QAC7E,CAAC,CAAC,oBAAoB,IAAI,CAAC,SAAS,CAAC,sBAAsB,CAAC,GAAG;QAC/D,CAAC,CAAC,6BAA6B,CAAC;AACpC,CAAC,CAAC"}
|
@@ -0,0 +1,5 @@
|
|
1
|
+
import { TransformerContextProvider } from '@aws-amplify/graphql-transformer-interfaces';
|
2
|
+
import { TypeNode } from 'graphql';
|
3
|
+
import { type JSONSchema } from '@aws-amplify/graphql-transformer-core';
|
4
|
+
export declare const generateJSONSchemaFromTypeNode: (typeNode: TypeNode, ctx: TransformerContextProvider, schema?: JSONSchema) => JSONSchema;
|
5
|
+
//# sourceMappingURL=graphql-json-schema-type.d.ts.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"graphql-json-schema-type.d.ts","sourceRoot":"","sources":["../../src/utils/graphql-json-schema-type.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,0BAA0B,EAAE,MAAM,6CAA6C,CAAC;AACzF,OAAO,EAOL,QAAQ,EAET,MAAM,SAAS,CAAC;AAEjB,OAAO,EACL,KAAK,UAAU,EAIhB,MAAM,uCAAuC,CAAC;AAS/C,eAAO,MAAM,8BAA8B,aAC/B,QAAQ,OACb,0BAA0B,WACvB,UAAU,KACjB,UASF,CAAC"}
|
@@ -0,0 +1,78 @@
|
|
1
|
+
"use strict";
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
3
|
+
exports.generateJSONSchemaFromTypeNode = void 0;
|
4
|
+
const graphql_1 = require("graphql");
|
5
|
+
const graphql_transformer_common_1 = require("graphql-transformer-common");
|
6
|
+
const graphql_transformer_core_1 = require("@aws-amplify/graphql-transformer-core");
|
7
|
+
const generateJSONSchemaFromTypeNode = (typeNode, ctx, schema = { type: '' }) => {
|
8
|
+
switch (typeNode.kind) {
|
9
|
+
case graphql_1.Kind.NAMED_TYPE:
|
10
|
+
return handleNamedType(typeNode, ctx, schema);
|
11
|
+
case graphql_1.Kind.NON_NULL_TYPE:
|
12
|
+
return handleNonNullType(typeNode, ctx, schema);
|
13
|
+
case graphql_1.Kind.LIST_TYPE:
|
14
|
+
return handleListType(typeNode, ctx);
|
15
|
+
}
|
16
|
+
};
|
17
|
+
exports.generateJSONSchemaFromTypeNode = generateJSONSchemaFromTypeNode;
|
18
|
+
const handleNamedType = (typeNode, ctx, schema) => {
|
19
|
+
const namedTypeSchema = (0, graphql_transformer_core_1.convertNamedTypeToJSONSchema)(typeNode);
|
20
|
+
Object.assign(schema, namedTypeSchema);
|
21
|
+
if ((0, graphql_transformer_common_1.isScalar)(typeNode)) {
|
22
|
+
return schema;
|
23
|
+
}
|
24
|
+
const baseTypeName = (0, graphql_transformer_common_1.getBaseType)(typeNode);
|
25
|
+
const typeDef = ctx.output.getType(baseTypeName);
|
26
|
+
if (!typeDef) {
|
27
|
+
throw new Error(`Type ${baseTypeName} not found`);
|
28
|
+
}
|
29
|
+
schema.properties = generateJSONSchemaForDef(typeDef, ctx, schema);
|
30
|
+
return schema;
|
31
|
+
};
|
32
|
+
const handleNonNullType = (typeNode, ctx, schema) => {
|
33
|
+
const baseType = (0, graphql_transformer_common_1.getBaseType)(typeNode);
|
34
|
+
if ((0, graphql_transformer_core_1.isDisallowedScalarType)(baseType)) {
|
35
|
+
throw new Error(`
|
36
|
+
Disallowed required field type ${baseType} without a default value.
|
37
|
+
Use one of the supported scalar types for generation routes: [${graphql_transformer_core_1.supportedScalarTypes.join(', ')}]
|
38
|
+
`);
|
39
|
+
}
|
40
|
+
return (0, exports.generateJSONSchemaFromTypeNode)(typeNode.type, ctx, schema);
|
41
|
+
};
|
42
|
+
const handleListType = (typeNode, ctx) => {
|
43
|
+
return {
|
44
|
+
type: 'array',
|
45
|
+
items: (0, exports.generateJSONSchemaFromTypeNode)(typeNode.type, ctx),
|
46
|
+
};
|
47
|
+
};
|
48
|
+
const generateJSONSchemaForDef = (def, ctx, schema) => {
|
49
|
+
switch (def.kind) {
|
50
|
+
case 'ObjectTypeDefinition':
|
51
|
+
return handleObjectTypeDefinition(def, ctx, schema);
|
52
|
+
case 'EnumTypeDefinition':
|
53
|
+
return handleEnumTypeDefinition(def);
|
54
|
+
default:
|
55
|
+
throw new Error(`Unsupported type definition: ${def.kind}`);
|
56
|
+
}
|
57
|
+
};
|
58
|
+
const handleObjectTypeDefinition = (def, ctx, schema) => {
|
59
|
+
var _a;
|
60
|
+
const properties = ((_a = def.fields) !== null && _a !== void 0 ? _a : []).reduce((acc, field) => {
|
61
|
+
acc[field.name.value] = (0, exports.generateJSONSchemaFromTypeNode)(field.type, ctx, { type: '' });
|
62
|
+
if (field.type.kind === graphql_1.Kind.NON_NULL_TYPE) {
|
63
|
+
schema.required = [...(schema.required || []), field.name.value];
|
64
|
+
}
|
65
|
+
return acc;
|
66
|
+
}, {});
|
67
|
+
return properties;
|
68
|
+
};
|
69
|
+
const handleEnumTypeDefinition = (def) => {
|
70
|
+
var _a;
|
71
|
+
return {
|
72
|
+
[def.name.value]: {
|
73
|
+
type: 'string',
|
74
|
+
enum: (_a = def.values) === null || _a === void 0 ? void 0 : _a.map((value) => value.name.value),
|
75
|
+
},
|
76
|
+
};
|
77
|
+
};
|
78
|
+
//# sourceMappingURL=graphql-json-schema-type.js.map
|