From 061a74e15aa172fa1d047de80f9fbd2cbd0ad5db Mon Sep 17 00:00:00 2001 From: "Peter Droogmans (attiks)" Date: Mon, 29 Jul 2024 16:53:36 +0200 Subject: [PATCH 01/25] feat: Index entities Refs: #RW-1035 --- .../custom/reliefweb_semantic/README.md | 4 + .../reliefweb_semantic/drush.services.yml | 6 + .../reliefweb_semantic.info.yml | 5 + .../Commands/ReliefWebSemanticCommands.php | 465 ++++++++++++++++++ 4 files changed, 480 insertions(+) create mode 100644 html/modules/custom/reliefweb_semantic/README.md create mode 100644 html/modules/custom/reliefweb_semantic/drush.services.yml create mode 100644 html/modules/custom/reliefweb_semantic/reliefweb_semantic.info.yml create mode 100644 html/modules/custom/reliefweb_semantic/src/Commands/ReliefWebSemanticCommands.php diff --git a/html/modules/custom/reliefweb_semantic/README.md b/html/modules/custom/reliefweb_semantic/README.md new file mode 100644 index 000000000..ba5b309a4 --- /dev/null +++ b/html/modules/custom/reliefweb_semantic/README.md @@ -0,0 +1,4 @@ +ReliefWeb - Semantic module +=========================== + +This module provides integration with the ReliefWeb Semantic API. diff --git a/html/modules/custom/reliefweb_semantic/drush.services.yml b/html/modules/custom/reliefweb_semantic/drush.services.yml new file mode 100644 index 000000000..c47c86cd0 --- /dev/null +++ b/html/modules/custom/reliefweb_semantic/drush.services.yml @@ -0,0 +1,6 @@ +services: + reliefweb_semantic.commands: + class: \Drupal\reliefweb_semantic\Commands\ReliefWebSemanticCommands + arguments: ['@config.factory', '@entity_field.manager', '@entity_type.manager', '@module_handler', '@state', '@http_client'] + tags: + - { name: drush.command } diff --git a/html/modules/custom/reliefweb_semantic/reliefweb_semantic.info.yml b/html/modules/custom/reliefweb_semantic/reliefweb_semantic.info.yml new file mode 100644 index 000000000..4e7d3e7e5 --- /dev/null +++ b/html/modules/custom/reliefweb_semantic/reliefweb_semantic.info.yml @@ -0,0 +1,5 @@ +type: module +name: ReliefWeb Semantic +description: 'Provides integration with the ReliefWeb Semantic API.' +package: reliefweb +core_version_requirement: ^9 || ^10 diff --git a/html/modules/custom/reliefweb_semantic/src/Commands/ReliefWebSemanticCommands.php b/html/modules/custom/reliefweb_semantic/src/Commands/ReliefWebSemanticCommands.php new file mode 100644 index 000000000..a93ded811 --- /dev/null +++ b/html/modules/custom/reliefweb_semantic/src/Commands/ReliefWebSemanticCommands.php @@ -0,0 +1,465 @@ + [ + 'type' => 'node', + 'index' => 'reports', + ], + 'job' => [ + 'type' => 'node', + 'index' => 'jobs', + 'field-list' => [ + 'nid' => 'id', + 'uuid' => 'uuid', + 'created' => 'created', + 'changed' => 'changed', + 'title' => 'title', + 'status' => 'status', + 'body' => 'body', + 'field_career_categories' => 'career_categories', + 'field_city' => 'city', + 'field_job_closing_date' => 'job_closing_date', + 'field_country' => 'country', + 'field_how_to_apply' => 'how_to_apply', + 'field_job_type' => 'job_type', + 'field_job_experience' => 'job_experience', + 'field_source' => 'source', + 'field_theme' => 'theme', + ], + ], + 'training' => [ + 'type' => 'node', + 'index' => 'training', + ], + 'blog_post' => [ + 'type' => 'node', + 'index' => 'blog', + ], + 'book' => [ + 'type' => 'node', + 'index' => 'book', + ], + 'topic' => [ + 'type' => 'node', + 'index' => 'topics', + ], + 'country' => [ + 'type' => 'taxonomy_term', + 'index' => 'countries', + ], + 'disaster' => [ + 'type' => 'taxonomy_term', + 'index' => 'disasters', + ], + 'source' => [ + 'type' => 'taxonomy_term', + 'index' => 'sources', + ], + ]; + + /** + * {@inheritdoc} + */ + public function __construct( + ConfigFactoryInterface $config_factory, + EntityFieldManagerInterface $entity_field_manager, + EntityTypeManagerInterface $entity_type_manager, + ModuleHandlerInterface $module_handler, + StateInterface $state, + ClientInterface $http_client, + ) { + $this->config = $config_factory->get('reliefweb_semantic.settings'); + $this->entityFieldManager = $entity_field_manager; + $this->entityTypeManager = $entity_type_manager; + $this->moduleHandler = $module_handler; + $this->state = $state; + $this->httpClient = $http_client; + } + + /** + * Index content in the ReliefWeb API. + * + * @param string $bundle + * Entity bundle to index. + * @param array $options + * Additional options for the command. + * + * @command reliefweb-semantic:index + * + * @option limit Maximum number of entities to index, defaults to 0 (all). + * @option offset ID of the entity from which to start the indexing, defaults + * to the most recent one. + * + * @default $options [] + * + * @usage reliefweb-semantic:index --id=123 report + * Index the report with ID 123. + * @usagereliefweb-semantic:index --limit=10 report + * Index latest 10 reports. + */ + public function index( + $bundle = '', + array $options = [ + 'limit' => 500, + 'id' => 0, + ], + ) { + // Index all the resources. + if ($bundle === 'all') { + foreach ($this->bundles as $bundle => $info) { + $this->index($bundle, $options); + } + return; + } + + if (!empty($options['id'])) { + $this->processItem($bundle, $options['id']); + } + + // Index the given bundles. + elseif (strpos($bundle, ',') > 0) { + $bundles = explode(',', $bundle); + foreach ($bundles as $bundle) { + if (isset($this->bundles[$bundle])) { + $this->index($bundle, $options); + } + } + return; + } + + // Index indexing options. + $limit = (int) ($options['limit'] ?: 500); + + // Launch the indexing or index removal. + try { + $num_items = $this->indexItems($bundle, $limit); + if ($num_items == 0) { + $this->logger->notice(strtr('Nothing left to index for @bundle', [ + '@bundle' => $bundle, + ])); + } + else { + $this->logger->notice(strtr('Indexed @num_items for @bundle', [ + '@num_items' => $num_items, + '@bundle' => $bundle, + ])); + } + } + catch (\Exception $exception) { + if ($exception->getMessage() !== 'No entity to index.') { + $this->logger->error('(' . $exception->getCode() . ') ' . $exception->getMessage()); + } + else { + $this->logger->notice($exception->getMessage()); + } + } + } + + /** + * Index items. + */ + protected function indexItems($bundle, $limit = 500) : int { + $entity_type = $this->bundles[$bundle]['type'] ?? ''; + if (empty($entity_type)) { + $this->logger->notice(strtr('Unknown entity type for @bundle', [ + '@bundle' => $bundle, + ])); + } + + $key = 'nid'; + if ($entity_type == 'taxonomy_term') { + $key = 'tid'; + } + + $query = $this->entityTypeManager + ->getStorage($entity_type) + ->getQuery() + ->accessCheck(FALSE) + ->range(0, $limit) + ->sort($key, 'DESC') + ->condition($key, $this->state->get('reliefweb_semantic_last_indexed_' . $bundle, 0), '>'); + + if ($entity_type == 'node') { + $query->condition('type', $bundle); + } + elseif ($entity_type == 'taxonomy_term') { + $query->condition('vid', $bundle); + } + + $ids = $query->execute(); + if (empty($ids)) { + return 0; + } + + $entities = $this->entityTypeManager->getStorage($entity_type)->loadMultiple($ids); + $count = 0; + foreach ($entities as $id => $entity) { + $data = $this->prepareItem($entity); + if (empty($data)) { + continue; + } + + try { + $this->indexItem($bundle, $data); + + $this->state->set('reliefweb_semantic_last_indexed_' . $bundle, $id); + $count++; + } + catch (\Throwable $th) { + $this->logger->notice(strtr('Unable to index @id for @bundle', [ + '@id' => $data['id'], + '@bundle' => $bundle, + ])); + } + } + + return $count; + } + + /** + * Process an item. + */ + protected function processItem(string $bundle, string $id) { + $entity_type = $this->bundles[$bundle]['type'] ?? ''; + if (empty($entity_type)) { + $this->logger->notice('Unknown entity type for @bundle', [ + '@bundle' => $bundle, + ]); + } + + $entity = $this->entityTypeManager->getStorage($entity_type)->load($id); + if (empty($entity)) { + $this->logger->notice(strtr('Unable to load @id for @bundle', [ + '@id' => $id, + '@bundle' => $bundle, + ])); + + return; + } + + $data = $this->prepareItem($entity); + if (empty($data)) { + return FALSE; + } + + try { + $this->indexItem($bundle, $data); + return TRUE; + } + catch (\Throwable $th) { + $this->logger->notice(strtr('Unable to index @id for @bundle', [ + '@id' => $data['id'], + '@bundle' => $bundle, + ])); + } + + return FALSE; + } + + /** + * Prepare data for the index. + */ + protected function prepareItem(ContentEntityInterface $entity) : array { + $data = []; + $field_list = $this->bundles[$entity->bundle()]['field-list'] ?? []; + if (empty($field_list)) { + $this->logger->notice(strtr('No field list found for @bundle', [ + '@bundle' => $entity->bundle(), + ])); + + return []; + } + + $date = new \DateTime('now', new \DateTimeZone('UTC')); + $data['timestamp'] = $date->format(\DateTime::ATOM); + + foreach ($field_list as $field_name => $property_name) { + if (!$entity->hasField($field_name)) { + continue; + } + + $field_type = $entity->get($field_name)->getFieldDefinition()->getFieldStorageDefinition()->getType(); + switch ($field_type) { + case 'entity_reference': + $data[$property_name] = []; + foreach ($entity->get($field_name)->referencedEntities() as $ref) { + $data[$property_name][] = [ + 'id' => $ref->id(), + 'name' => $ref->label(), + ]; + } + break; + + case 'datetime': + $date = new \DateTime($entity->get($field_name)->value, new \DateTimeZone('UTC')); + $item[$property_name] = $date->format(\DateTime::ATOM); + break; + + default: + $data[$property_name] = $entity->get($field_name)->value; + } + } + + return $data; + } + + /** + * Index the index. + */ + protected function indexItem(string $bundle, array $data) { + $index = $this->bundles[$bundle]['index'] ?? []; + if (empty($index)) { + $this->logger->notice(strtr('No index found for @bundle', [ + '@bundle' => $bundle, + ])); + + return []; + } + + // Ensure the index exist. + if (!$this->createIndex($bundle, $index)) { + return FALSE; + } + + if (isset($data['id'])) { + $data['_id'] = $data['id']; + } + + $payload[] = json_encode($data); + $payload = implode("\n", $payload) . "\n"; + + $response = $this->request('POST', $index . '/_bulk?refresh=true', $payload, 'application/x-ndjson'); + + if (is_null($response)) { + return FALSE; + } + } + + /** + * Perform a request against the elasticsearch cluster. + * + * @param string $method + * Request method. + * @param string $endpoint + * Request endpoint. + * @param mixed|null $payload + * Optional payload (will be converted to JSON if not content type is + * provided). + * @param string|null $content_type + * Optional content type of the payload. If not defined it is assumed to be + * JSON. + * @param array $valid_status_codes + * List of valid status codes that should not be logged as errors. + * + * @return \Psr\Http\Message\ResponseInterface|null + * The response or NULL if the request was not successful. + */ + protected function request(string $method, string $endpoint, $payload = NULL, ?string $content_type = NULL, array $valid_status_codes = []): ?ResponseInterface { + $url = rtrim($this->config->get('url'), '/') . '/' . ltrim($endpoint, '/'); + $options = []; + + if (isset($payload)) { + if (empty($content_type)) { + $options['json'] = $payload; + } + else { + $options['body'] = $payload; + $options['headers']['Content-Type'] = $content_type; + } + } + + try { + /** @var \Psr\Http\Message\ResponseInterface $response */ + $response = $this->httpClient->request($method, $url, $options); + return $response; + } + catch (BadResponseException $exception) { + $response = $exception->getResponse(); + $status_code = $response->getStatusCode(); + if (!in_array($status_code, $valid_status_codes)) { + $this->logger()->error(strtr('@method request to @endpoint failed with @status error: @error', [ + '@method' => $method, + '@endpoint' => $endpoint, + '@status' => $status_code, + '@error' => $exception->getMessage(), + ])); + } + } + catch (\Exception $exception) { + $this->logger()->error(strtr('@method request to @endpoint failed with @status error: @error', [ + '@method' => $method, + '@endpoint' => $endpoint, + '@status' => $exception->getCode(), + '@error' => $exception->getMessage(), + ])); + } + + return NULL; + } + +} From 678424324aea49b88c51cdaa18408c22ba733390 Mon Sep 17 00:00:00 2001 From: "Peter Droogmans (attiks)" Date: Tue, 30 Jul 2024 09:22:26 +0200 Subject: [PATCH 02/25] feat: Index entities Refs: #RW-1035 --- .../src/Commands/ReliefWebSemanticCommands.php | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/html/modules/custom/reliefweb_semantic/src/Commands/ReliefWebSemanticCommands.php b/html/modules/custom/reliefweb_semantic/src/Commands/ReliefWebSemanticCommands.php index a93ded811..dd7d757a6 100644 --- a/html/modules/custom/reliefweb_semantic/src/Commands/ReliefWebSemanticCommands.php +++ b/html/modules/custom/reliefweb_semantic/src/Commands/ReliefWebSemanticCommands.php @@ -393,7 +393,8 @@ protected function indexItem(string $bundle, array $data) { $payload[] = json_encode($data); $payload = implode("\n", $payload) . "\n"; - $response = $this->request('POST', $index . '/_bulk?refresh=true', $payload, 'application/x-ndjson'); + // Send to AWS API. + $response = $this->request('POST', $index, $payload, 'application/x-ndjson'); if (is_null($response)) { return FALSE; @@ -401,14 +402,14 @@ protected function indexItem(string $bundle, array $data) { } /** - * Perform a request against the elasticsearch cluster. + * Perform a request against the AWS API. * * @param string $method * Request method. * @param string $endpoint * Request endpoint. * @param mixed|null $payload - * Optional payload (will be converted to JSON if not content type is + * Optional payload (will be converted to JSON if no content type is * provided). * @param string|null $content_type * Optional content type of the payload. If not defined it is assumed to be From 4029e02f2437b690362668357c26975436f87149 Mon Sep 17 00:00:00 2001 From: "Peter Droogmans (attiks)" Date: Mon, 5 Aug 2024 16:20:57 +0200 Subject: [PATCH 03/25] feat: Use S3 for body Refs: #RW-1035 --- composer.json | 1 + composer.lock | 133 +++++++++++++++++- .../reliefweb_semantic/drush.services.yml | 2 +- .../reliefweb_semantic.module | 52 +++++++ .../Commands/ReliefWebSemanticCommands.php | 103 +++++++++++--- .../reliefweb_semantic/src/Commands/test.json | 44 ++++++ 6 files changed, 315 insertions(+), 20 deletions(-) create mode 100644 html/modules/custom/reliefweb_semantic/reliefweb_semantic.module create mode 100644 html/modules/custom/reliefweb_semantic/src/Commands/test.json diff --git a/composer.json b/composer.json index 1c271512f..26a703466 100644 --- a/composer.json +++ b/composer.json @@ -76,6 +76,7 @@ "reliefweb/api-indexer": "^v2.8", "reliefweb/simple-autocomplete": "^v1.3", "reliefweb/simple-datepicker": "^v1.3", + "spipu/html2pdf": "^5.2", "symfony/uid": "^6.2", "unocha/common_design": "^9.4", "unocha/gtm_barebones": "^1.1", diff --git a/composer.lock b/composer.lock index 39b89d9a0..8510f7f2b 100644 --- a/composer.lock +++ b/composer.lock @@ -4,7 +4,7 @@ "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies", "This file is @generated automatically" ], - "content-hash": "11492ff3aa8fea505fef1aca47e50810", + "content-hash": "85d48f707ed1b83293b5a0cccb92777a", "packages": [ { "name": "asm89/stack-cors", @@ -12679,6 +12679,63 @@ ], "time": "2024-03-09T15:20:58+00:00" }, + { + "name": "spipu/html2pdf", + "version": "v5.2.8", + "source": { + "type": "git", + "url": "https://github.com/spipu/html2pdf.git", + "reference": "6c94dcd48c94c6c73f206629839c1ebd81e8c726" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/spipu/html2pdf/zipball/6c94dcd48c94c6c73f206629839c1ebd81e8c726", + "reference": "6c94dcd48c94c6c73f206629839c1ebd81e8c726", + "shasum": "" + }, + "require": { + "ext-gd": "*", + "ext-mbstring": "*", + "php": "^5.6 || ^7.0 || ^8.0", + "tecnickcom/tcpdf": "^6.3" + }, + "require-dev": { + "phpunit/phpunit": "^5.0 || ^9.0" + }, + "suggest": { + "ext-gd": "Allows to embed images into the PDF", + "fagundes/zff-html2pdf": "if you need to integrate Html2Pdf with Zend Framework 2 (zf2)" + }, + "type": "library", + "autoload": { + "psr-4": { + "Spipu\\Html2Pdf\\": "src/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "OSL-3.0" + ], + "authors": [ + { + "name": "Spipu", + "homepage": "https://github.com/spipu", + "role": "Developer" + } + ], + "description": "Html2Pdf is a HTML to PDF converter written in PHP5 (it uses TCPDF). OFFICIAL PACKAGE", + "homepage": "http://html2pdf.fr/", + "keywords": [ + "html", + "html2pdf", + "pdf" + ], + "support": { + "issues": "https://github.com/spipu/html2pdf/issues", + "source": "https://github.com/spipu/html2pdf/tree/v5.2.8" + }, + "time": "2023-07-18T14:52:59+00:00" + }, { "name": "squizlabs/php_codesniffer", "version": "3.10.1", @@ -16095,6 +16152,78 @@ ], "time": "2024-05-31T14:49:08+00:00" }, + { + "name": "tecnickcom/tcpdf", + "version": "6.7.5", + "source": { + "type": "git", + "url": "https://github.com/tecnickcom/TCPDF.git", + "reference": "951eabf0338ec2522bd0d5d9c79b08a3a3d36b36" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/tecnickcom/TCPDF/zipball/951eabf0338ec2522bd0d5d9c79b08a3a3d36b36", + "reference": "951eabf0338ec2522bd0d5d9c79b08a3a3d36b36", + "shasum": "" + }, + "require": { + "php": ">=5.5.0" + }, + "type": "library", + "autoload": { + "classmap": [ + "config", + "include", + "tcpdf.php", + "tcpdf_parser.php", + "tcpdf_import.php", + "tcpdf_barcodes_1d.php", + "tcpdf_barcodes_2d.php", + "include/tcpdf_colors.php", + "include/tcpdf_filters.php", + "include/tcpdf_font_data.php", + "include/tcpdf_fonts.php", + "include/tcpdf_images.php", + "include/tcpdf_static.php", + "include/barcodes/datamatrix.php", + "include/barcodes/pdf417.php", + "include/barcodes/qrcode.php" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "LGPL-3.0-or-later" + ], + "authors": [ + { + "name": "Nicola Asuni", + "email": "info@tecnick.com", + "role": "lead" + } + ], + "description": "TCPDF is a PHP class for generating PDF documents and barcodes.", + "homepage": "http://www.tcpdf.org/", + "keywords": [ + "PDFD32000-2008", + "TCPDF", + "barcodes", + "datamatrix", + "pdf", + "pdf417", + "qrcode" + ], + "support": { + "issues": "https://github.com/tecnickcom/TCPDF/issues", + "source": "https://github.com/tecnickcom/TCPDF/tree/6.7.5" + }, + "funding": [ + { + "url": "https://www.paypal.com/cgi-bin/webscr?cmd=_donations¤cy_code=GBP&business=paypal@tecnick.com&item_name=donation%20for%20tcpdf%20project", + "type": "custom" + } + ], + "time": "2024-04-20T17:25:10+00:00" + }, { "name": "theseer/tokenizer", "version": "1.2.3", @@ -17314,5 +17443,5 @@ "php": ">=8.2" }, "platform-dev": [], - "plugin-api-version": "2.6.0" + "plugin-api-version": "2.3.0" } diff --git a/html/modules/custom/reliefweb_semantic/drush.services.yml b/html/modules/custom/reliefweb_semantic/drush.services.yml index c47c86cd0..514acbaf9 100644 --- a/html/modules/custom/reliefweb_semantic/drush.services.yml +++ b/html/modules/custom/reliefweb_semantic/drush.services.yml @@ -1,6 +1,6 @@ services: reliefweb_semantic.commands: class: \Drupal\reliefweb_semantic\Commands\ReliefWebSemanticCommands - arguments: ['@config.factory', '@entity_field.manager', '@entity_type.manager', '@module_handler', '@state', '@http_client'] + arguments: ['@config.factory', '@entity_field.manager', '@entity_type.manager', '@module_handler', '@state', '@http_client', '@file_system'] tags: - { name: drush.command } diff --git a/html/modules/custom/reliefweb_semantic/reliefweb_semantic.module b/html/modules/custom/reliefweb_semantic/reliefweb_semantic.module new file mode 100644 index 000000000..11946462c --- /dev/null +++ b/html/modules/custom/reliefweb_semantic/reliefweb_semantic.module @@ -0,0 +1,52 @@ +get('aws_bedrock_region'); + $role_arn = $config->get('aws_bedrole_role_arn', NULL); + + if (!empty($role_arn)) { + $stsClient = new StsClient([ + 'region' => $region, + 'version' => 'latest', + ]); + + $result = $stsClient->AssumeRole([ + 'RoleArn' => $role_arn, + 'RoleSessionName' => 'aws-bedrock-ocha-ai-summarize', + ]); + + $credentials = [ + 'key' => $result['Credentials']['AccessKeyId'], + 'secret' => $result['Credentials']['SecretAccessKey'], + 'token' => $result['Credentials']['SessionToken'], + ]; + } + else { + $credentials = [ + 'key' => $config->get('bedrock_access_key'), + 'secret' => $config->get('bedrock_secret_key'), + ]; + } + + return [ + 'credentials' => $credentials, + 'region' => $region, + ]; +} diff --git a/html/modules/custom/reliefweb_semantic/src/Commands/ReliefWebSemanticCommands.php b/html/modules/custom/reliefweb_semantic/src/Commands/ReliefWebSemanticCommands.php index dd7d757a6..1bfe8a620 100644 --- a/html/modules/custom/reliefweb_semantic/src/Commands/ReliefWebSemanticCommands.php +++ b/html/modules/custom/reliefweb_semantic/src/Commands/ReliefWebSemanticCommands.php @@ -2,16 +2,19 @@ namespace Drupal\reliefweb_semantic\Commands; +use Aws\S3\S3Client; use Drupal\Core\Config\ConfigFactoryInterface; use Drupal\Core\Entity\ContentEntityInterface; use Drupal\Core\Entity\EntityFieldManagerInterface; use Drupal\Core\Entity\EntityTypeManagerInterface; use Drupal\Core\Extension\ModuleHandlerInterface; +use Drupal\Core\File\FileSystemInterface; use Drupal\Core\State\StateInterface; use Drush\Commands\DrushCommands; use GuzzleHttp\ClientInterface; use GuzzleHttp\Exception\BadResponseException; use Psr\Http\Message\ResponseInterface; +use Spipu\Html2Pdf\Html2Pdf; /** * ReliefWeb API Drush commandfile. @@ -60,6 +63,13 @@ class ReliefWebSemanticCommands extends DrushCommands { */ protected $httpClient; + /** + * File system. + * + * @var \Drupal\Core\File\FileSystemInterface + */ + protected $fileSystem; + /** * List of config for each bundle. * @@ -69,6 +79,16 @@ class ReliefWebSemanticCommands extends DrushCommands { 'report' => [ 'type' => 'node', 'index' => 'reports', + 'field-list' => [ + 'nid' => 'id', + 'uuid' => 'uuid', + 'created' => 'created', + 'changed' => 'changed', + 'title' => 'title', + 'status' => 'status', + 'body' => 'body', + 'field_file' => 'files', + ], ], 'job' => [ 'type' => 'node', @@ -132,6 +152,7 @@ public function __construct( ModuleHandlerInterface $module_handler, StateInterface $state, ClientInterface $http_client, + FileSystemInterface $file_system, ) { $this->config = $config_factory->get('reliefweb_semantic.settings'); $this->entityFieldManager = $entity_field_manager; @@ -139,6 +160,7 @@ public function __construct( $this->moduleHandler = $module_handler; $this->state = $state; $this->httpClient = $http_client; + $this->fileSystem = $file_system; } /** @@ -179,10 +201,11 @@ public function index( if (!empty($options['id'])) { $this->processItem($bundle, $options['id']); + return; } // Index the given bundles. - elseif (strpos($bundle, ',') > 0) { + if (strpos($bundle, ',') > 0) { $bundles = explode(',', $bundle); foreach ($bundles as $bundle) { if (isset($this->bundles[$bundle])) { @@ -348,10 +371,7 @@ protected function prepareItem(ContentEntityInterface $entity) : array { case 'entity_reference': $data[$property_name] = []; foreach ($entity->get($field_name)->referencedEntities() as $ref) { - $data[$property_name][] = [ - 'id' => $ref->id(), - 'name' => $ref->label(), - ]; + $data[$property_name][] = (string) $ref->id(); } break; @@ -360,6 +380,14 @@ protected function prepareItem(ContentEntityInterface $entity) : array { $item[$property_name] = $date->format(\DateTime::ATOM); break; + case 'reliefweb_file': + $data['files'] = []; + /** @var \Drupal\reliefweb_files\Plugin\Field\FieldType\ReliefWebFile $item */ + foreach ($entity->get($field_name) as $item) { + $data['files'][] = $item->loadFile()->getFileUri(); + } + break; + default: $data[$property_name] = $entity->get($field_name)->value; } @@ -371,7 +399,7 @@ protected function prepareItem(ContentEntityInterface $entity) : array { /** * Index the index. */ - protected function indexItem(string $bundle, array $data) { + protected function indexItem(string $bundle, array $data, array $files = []) { $index = $this->bundles[$bundle]['index'] ?? []; if (empty($index)) { $this->logger->notice(strtr('No index found for @bundle', [ @@ -381,24 +409,65 @@ protected function indexItem(string $bundle, array $data) { return []; } - // Ensure the index exist. - if (!$this->createIndex($bundle, $index)) { - return FALSE; + if (empty($files) && isset($data['files'])) { + $files = $data['files']; + unset($data['files']); } - if (isset($data['id'])) { - $data['_id'] = $data['id']; + // Dump title and body field into a PDF. + // @see https://docs.aws.amazon.com/bedrock/latest/userguide/kb-chunking-parsing.html#kb-advanced-parsing + if (!empty($data['body'])) { + $content = $data['title'] . "\n\n" . $data['body']; + $destination = 'temporary://' . $data['id'] . '.pdf'; + + $html2pdf = new Html2Pdf(); + $html2pdf->writeHTML($content); + $content = $html2pdf->output($data['id'] . '.pdf', 'S'); + + $this->fileSystem->saveData($content, $destination, FileSystemInterface::EXISTS_REPLACE); + $files[] = $destination; } - $payload[] = json_encode($data); - $payload = implode("\n", $payload) . "\n"; + // Dump metadata. + $content = json_encode([ + 'metadataAttributes' => $data, + ]); + $metadata_file = 'temporary://' . $data['id'] . '.pdf.metadata.json'; + $this->fileSystem->saveData($content, $metadata_file, FileSystemInterface::EXISTS_REPLACE); + + foreach ($files as $file) { + $absolute_path = $this->fileSystem->realpath($file); + if (!$absolute_path) { + $this->logger->notice(strtr('Unable to process @file for @id', [ + '@file' => $file, + '@id' => $data['id'], + ])); + continue; + } - // Send to AWS API. - $response = $this->request('POST', $index, $payload, 'application/x-ndjson'); + $this->sendToS3($absolute_path); + $basename = basename($absolute_path); + $this->sendToS3($metadata_file, $basename . '.metadata.json'); + } + } - if (is_null($response)) { - return FALSE; + /** + * Store file and metadata on S3. + */ + protected function sendToS3(string $file_name, string $save_as = '') { + $client_options = reliefweb_semantic_get_aws_client_options(); + $client = new S3Client($client_options); + + $bucket_name = 'rw-api-bucket-2'; + if (empty($save_as)) { + $save_as = basename($file_name); } + + $client->putObject([ + 'Bucket' => $bucket_name, + 'Key' => $save_as, + 'SourceFile' => $file_name, + ]); } /** diff --git a/html/modules/custom/reliefweb_semantic/src/Commands/test.json b/html/modules/custom/reliefweb_semantic/src/Commands/test.json new file mode 100644 index 000000000..c9e3ef4de --- /dev/null +++ b/html/modules/custom/reliefweb_semantic/src/Commands/test.json @@ -0,0 +1,44 @@ +{ + "timestamp": "2024-08-01T11:52:09+00:00", + "id": "4071448", + "uuid": "c2c24018-b0d3-4c15-87bf-1a3436fbe56c", + "created": "1718799733", + "changed": "1718799733", + "title": "Human Resources Director", + "status": "1", + "body": "The International Rescue Committee (IRC) responds to the world\u2019s worst humanitarian crises, helping to restore health, safety, education, economic wellbeing, and power to people devastated by conflict and disaster. Founded in 1933 at the call of Albert Einstein, the IRC is one of the world's largest international humanitarian non-governmental organizations (INGO), at work in more than 50 countries and more than 25 U.S. cities helping people to survive, reclaim control of their future and strengthen their communities. A force for humanity, IRC employees deliver lasting impact by restoring safety, dignity and hope to millions. If you're a solutions-driven, passionate change-maker, come join us in positively impacting the lives of millions of people world-wide for a better future.\n\nThe Syria crisis is often described as the worst humanitarian catastrophe since the end of the Cold War. Today 16.2 million people in Syria are in need of humanitarian assistance with needs increasingly being exacerbated by economic decline. This is no short-term humanitarian episode.\n\nIRC is providing a robust humanitarian response in Syria, supported by more than 800+ staff across Syria, Jordan, T\u00fcrkiye and Iraq. IRC is undertaking programs in the fields of health, child protection, early childhood development, women\u2019s protection and empowerment, cash assistance, protection and rule of law, and economic recovery and livelihood programming. Our work in these challenging settings gives rise to some of the most pressing issues facing contemporary humanitarian action, including questions of access, security, funding and coordination.\n\n**Job Overview\/Summary**\n\nThe Human Resource Director is accountable for providing strategic leadership for over 800 staff and incentive workers in the Syria Country Program, across multiple geographical locations. S\/he will lead a HR team to ensure high quality and efficient staff recruitment, contracts management, orientation, learning and development, performance management, compensation and benefits, code of conduct compliance, employee engagement, diversity and inclusion, and staff care. The position holder operates within the scope of IRC management in partnership model and reports directly to both, Syria Country Director and Regional People and Culture Director \u2013 MENA.\n\nThe HR Director will adapt and implement Global and Regional HR initiatives and practices, and serve as an advisor to maximize organizational staffing resources and performance, minimize risk and ensure economy and efficiency of work processes. Importantly the HR Director will promote and cultivate a positive and healthy organizational culture, and work to ensure that this culture is practiced and lived across the Country Program. The position holder will serve as a key member in the Senior Management Team (SMT) and work collaboratively with country leadership to establish and maintain an organizational culture in line with IRC\u2019s values. In this role, the HR Director serves as a strategic partner, advisor, and coach to ensure a safe and welcoming culture for all people.\n\n**Key Responsibilities**\n\n**Strategic HR Leadership and Management**\n\n\u2022 Strategic leadership on al HR related matters, working with Country Director and partnering with SMT to ensure the IRC Syria Country Program embodies organizational culture and values and that all team members feel valued through all aspects of the employment lifecycle.\n\n\u2022 Manage and lead the HR team across all locations, and overall accountable for quality of services and success of the HR department progress against agreed goals. Monitor key HR KPIs, analyzing monthly data to diagnose and identify priorities and evaluate effectiveness of HR functions.\n\n\u2022 Serve as a model of supervisory excellence; supervise and mentor direct-report staff, including communicating clear expectations, setting performance objectives, providing regular and timely performance feedback, and leading documented semi-annual performance reviews.\n\n\u2022 Lead the performance management process, creating a plan to implement the annual and mid-year reviews. Conduct training on goal-setting, utilize budgets to organize development activities and work one-on-one with managers and employees to create country wide development plans.\n\n\u2022 Support senior staff to pursue nationalization\/regionalization of senior and middle management positions.\n\n\u2022 Promote and actively participate in initiatives and efforts to foster team culture, through team engagement, inclusion and cohesion.\n\n\u2022 Foster ongoing learning, honest dialogue and reflection to strengthen safeguarding and to promote IRC values and adherence to IRC policies.\n\n\u2022 Advise and coach supervisors in determining appropriate disciplinary plans of action in a judicious manner. Follow-up disciplinary measures and related employment law matters. Ensure all legal obligations are fulfilled in Syria, Jordan and T\u00fcrkiye.\n\n\u2022 Partner with IRC global investigations teams and the IRC Syria CD and Risk and Compliance Director to ensure that recommendations arising out of all investigations, particularly disciplinary action against subjects, are actioned within 2 weeks.\n\n\u2022 Participate in and support staff meetings, and propose and lead other staff engagement initiatives in order to bridge the gap between the field and remote support offices.\n\n\u2022 Support the Country Director in other occasional strategic people related tasks that may arise.\n\n**HR Operations\/Foundations**\n\n\u2022 Accountable for salary payroll for all national staff.\n\n\u2022 Participate in budget preparation and provide strategic compensation analysis to attract high-quality talent. Define and review the salary structure; coordinate the annual compensation review process and compensation adjustments.\n\n\u2022 Devise and deliver a planned HR approach to attracting, developing, inspiring and retaining the right people with the right skills to achieve strategic, high-quality programmatic outcomes.\n\n\u2022 Lead exit management procedure to ensure seamless and positive transition for departing employees and analyze turnover and exit interviews to make real-time, continuous improvement utilizing learnings to formulate retention strategies.\n\n\u2022 Ensure high quality and efficient context-specific strategies for all HR fundamentals.\n\n**Gender Equality, Diversity and Inclusion (GEDI) and Safeguarding**\n\n\u2022 Oversee the implementation IRC Syria\u2019s GEDI priorities, including facilitating key conversations across all levels of the Country Program to ensure understanding and commitment to context specific GEDI principles, and successful implementation of the GEDI Action Plan.\n\n\u2022 Accountable for incorporation of GEDI best practice and IRC values in employee lifecycle and in operations.\n\n\u2022 Ensure leadership create and empower a diverse and safe organizational environment. One that is respectful and inclusive and grants each employee an equal opportunity to learn, grow and contribute to the IRC.\n\n\u2022 Partner with country and regional specialized safeguarding staff to convene functional stakeholders in country, and to promote uptake and progress on the Safeguarding Minimum Standards.\n\n\u2022 Ensure that the Syria SMT is updated regularly (minimum bi-annually) on progress \u2013 including analysis of barriers, enablers and resources required \u2013 on the Safeguarding Minimum Standards.\n\n\u2022 Partner with country and regional specialized safeguarding staff to communicate clearly and consistently with all staff regarding IRC reporting and support channels related to ethical misconduct, including IRC\u2019s survivor-centered reporting guidelines.\n\n**Duty of Care**\n\n\u2022 Advise and provide support for all staff related to duty of care efforts\/initiatives.\n\n\u2022 Devise staff care action plans that elevate morale and support the social, physical, and psychological well-being of staff; create emergency staff care interventions \u2013 both in collaboration with the Regional Staff Care unit. Promote and assess staff care and well-being. Model healthy work-life balance practices.\n\n\u2022 Maintain a healthy and empowering office environment that encourages open, honest, and productive communication among IRC staff and is devised to meet the remote management context, by delivering an employee engagement and communication strategy.\n\n***Key Working Relationships:***\n\nPosition Reports to: Country Director and Regional People and Culture Director\n\nPosition directly Supervises: HR leads in northwest Syria, northeast Syria, T\u00fcrkiye and Jordan.\n\nKey Internal Contacts:\n\n\uf0a7 Country Program: Senior Management Team members\n\n\uf0a7 Regional: Regional People and Culture Director, Compensation and Benefit Duty of Care and GEDI team members\n\n\uf0a7 HQ: People and Culture Team, Employee Relations and Duty of Care teams\n\nKey External Contacts:\n\n\uf0a7 HR counter parts at other I\/NGOs\n\n**Job Requirements**\n\n\u2022 Bachelor\u2019s degree required. Master\u2019s university degree in HR management, organizational behavior, international relations or development, MBA, Law or related field is preferred.\n\n\u2022 Minimum of 7 tears progressive experience as a HR practitioner, including recruitment, employee relations, compensation, training and development and HR Administration.\n\n\u2022 Demonstrated success as a HR leader supporting groups of 500 + employees at multiple organizational levels, cultures, and locations within a regional or global environment required.\n\n\u2022 Demonstrated success as a HR professional in emergency response, conflict zones and\/or humanitarian aid sector preferred.\n\n\u2022 Demonstrated success in supporting key senior management and building strong, trusted relationships.\n\n\u2022 Proven track-record of excellent management and leadership skills including capacity-building, coaching, mentoring, performance management and delivering individual and group training.\n\n\u2022 Strong collaborator with effective interpersonal and analytical skills who can work seamlessly across countries, cultures, and organizational units required.\n\n\u2022 Demonstrated ability to work, manage, and meet competing deadlines in a fast-paced, high-volume environment and on deadline; aptitude for problem solving and decision making needed\n\n\u2022 I\/NGO experience required.\n\n\u2022 English and Arabic are required\n\n\u2022 25% travel to the field (Syria and T\u00fcrkiye) and attending regional\/global workshops and meetings\n\n**Standard of Professional Conduct:** The IRC and the IRC workers must adhere to the values and principles outlined in the IRC Way \u2013 our Code of Conduct. These are Integrity, Service, Accountability, and Equality.\n\n \n**Commitment to Gender, Equality, Diversity, and Inclusion:** The IRC is committed to creating a diverse, inclusive, respectful, and safe work environment where all persons are treated fairly, with dignity and respect. The IRC expressly prohibits and will not tolerate discrimination, harassment, retaliation, or bullying of the IRC persons in any work setting. We aim to increase the representation of women, people that are from country and communities we serve, and people who identify as races and ethnicities that are under-represented in global power structures.", + "career_categories": [ + { + "id": "6863", + "name": "Human Resources" + } + ], + "city": "Amman", + "country": [ + { + "id": "129", + "name": "Jordan" + } + ], + "how_to_apply": "https:\/\/careers.rescue.org\/us\/en\/job\/req52467\/Human-Resources-Director", + "job_type": [ + { + "id": "263", + "name": "Job" + } + ], + "job_experience": [ + { + "id": "260", + "name": "5-9 years" + } + ], + "source": [ + { + "id": "2012", + "name": "International Rescue Committee" + } + ], + "theme": [], + "_id": "4071448" +} From 09170fd9638531b6ec94e91a3bbab8d6b4e66d17 Mon Sep 17 00:00:00 2001 From: "Peter Droogmans (attiks)" Date: Tue, 6 Aug 2024 10:32:46 +0200 Subject: [PATCH 04/25] feat: Use S3 for body Refs: #RW-1035 --- .../custom/reliefweb_semantic/README.md | 38 +++++++++++++ .../reliefweb_semantic/drush.services.yml | 2 +- .../Commands/ReliefWebSemanticCommands.php | 57 ++++++++++++++++++- 3 files changed, 93 insertions(+), 4 deletions(-) diff --git a/html/modules/custom/reliefweb_semantic/README.md b/html/modules/custom/reliefweb_semantic/README.md index ba5b309a4..e6e413899 100644 --- a/html/modules/custom/reliefweb_semantic/README.md +++ b/html/modules/custom/reliefweb_semantic/README.md @@ -2,3 +2,41 @@ ReliefWeb - Semantic module =========================== This module provides integration with the ReliefWeb Semantic API. + + +``` +GET /bedrock-knowledge-base-default-index/_search +{ + "query": { + "match_all": {} + } +} +``` + +``` +GET /bedrock-knowledge-base-default-index/_search +{ + "query": { + "match": { + "country": "*" + } + + } +} +``` + +``` +GET /bedrock-knowledge-base-default-index/_search +{ + "query": { + "match": { + "title": { + "query": "china", + "fuzziness": "AUTO" + } + } + } +} +``` + +Describe the weather in china in june 2024 diff --git a/html/modules/custom/reliefweb_semantic/drush.services.yml b/html/modules/custom/reliefweb_semantic/drush.services.yml index 514acbaf9..920c74370 100644 --- a/html/modules/custom/reliefweb_semantic/drush.services.yml +++ b/html/modules/custom/reliefweb_semantic/drush.services.yml @@ -1,6 +1,6 @@ services: reliefweb_semantic.commands: class: \Drupal\reliefweb_semantic\Commands\ReliefWebSemanticCommands - arguments: ['@config.factory', '@entity_field.manager', '@entity_type.manager', '@module_handler', '@state', '@http_client', '@file_system'] + arguments: ['@config.factory', '@entity_field.manager', '@entity_type.manager', '@module_handler', '@state', '@http_client', '@file_system', '@renderer'] tags: - { name: drush.command } diff --git a/html/modules/custom/reliefweb_semantic/src/Commands/ReliefWebSemanticCommands.php b/html/modules/custom/reliefweb_semantic/src/Commands/ReliefWebSemanticCommands.php index 1bfe8a620..4b701d63a 100644 --- a/html/modules/custom/reliefweb_semantic/src/Commands/ReliefWebSemanticCommands.php +++ b/html/modules/custom/reliefweb_semantic/src/Commands/ReliefWebSemanticCommands.php @@ -9,6 +9,7 @@ use Drupal\Core\Entity\EntityTypeManagerInterface; use Drupal\Core\Extension\ModuleHandlerInterface; use Drupal\Core\File\FileSystemInterface; +use Drupal\Core\Render\RendererInterface; use Drupal\Core\State\StateInterface; use Drush\Commands\DrushCommands; use GuzzleHttp\ClientInterface; @@ -70,6 +71,13 @@ class ReliefWebSemanticCommands extends DrushCommands { */ protected $fileSystem; + /** + * The render service. + * + * @var \Drupal\Core\Render\Renderer + */ + protected $renderer; + /** * List of config for each bundle. * @@ -88,6 +96,13 @@ class ReliefWebSemanticCommands extends DrushCommands { 'status' => 'status', 'body' => 'body', 'field_file' => 'files', + 'field_country' => 'country', + 'field_disaster' => 'disaster', + 'field_disaster_type' => 'disaster_type', + 'field_feature' => 'feature', + 'field_primary_country' => 'primary_country', + 'field_source' => 'source', + 'field_theme' => 'theme', ], ], 'job' => [ @@ -153,6 +168,7 @@ public function __construct( StateInterface $state, ClientInterface $http_client, FileSystemInterface $file_system, + RendererInterface $renderer, ) { $this->config = $config_factory->get('reliefweb_semantic.settings'); $this->entityFieldManager = $entity_field_manager; @@ -161,6 +177,7 @@ public function __construct( $this->state = $state; $this->httpClient = $http_client; $this->fileSystem = $file_system; + $this->renderer = $renderer; } /** @@ -360,6 +377,15 @@ protected function prepareItem(ContentEntityInterface $entity) : array { $date = new \DateTime('now', new \DateTimeZone('UTC')); $data['timestamp'] = $date->format(\DateTime::ATOM); + $data['bundle'] = $entity->bundle(); + $data['nid'] = $entity->id(); + + /** @var \Drupal\node\NodeViewBuilder */ + $view_builder = $this->entityTypeManager->getViewBuilder('node'); + + if (!isset($data['html'])) { + $data['html'] = ''; + } foreach ($field_list as $field_name => $property_name) { if (!$entity->hasField($field_name)) { @@ -368,10 +394,25 @@ protected function prepareItem(ContentEntityInterface $entity) : array { $field_type = $entity->get($field_name)->getFieldDefinition()->getFieldStorageDefinition()->getType(); switch ($field_type) { + case 'text_with_summary': + case 'text_long': + $data[$property_name] = $entity->get($field_name)->value; + + $build = $view_builder->viewField($entity->get($field_name), 'full'); + $data['html'] .= $this->renderer->renderPlain($build); + $data['html'] .= "\n\n"; + break; + case 'entity_reference': $data[$property_name] = []; + $as_string = []; foreach ($entity->get($field_name)->referencedEntities() as $ref) { $data[$property_name][] = (string) $ref->id(); + $as_string[] = $ref->label(); + } + + if (!empty($as_string)) { + $data['html'] .= '

' . $property_name . ': ' . implode(', ', $as_string) . '

'; } break; @@ -414,10 +455,10 @@ protected function indexItem(string $bundle, array $data, array $files = []) { unset($data['files']); } - // Dump title and body field into a PDF. + // Dump title and html field into a PDF. // @see https://docs.aws.amazon.com/bedrock/latest/userguide/kb-chunking-parsing.html#kb-advanced-parsing - if (!empty($data['body'])) { - $content = $data['title'] . "\n\n" . $data['body']; + if (!empty($data['html'])) { + $content = '

' . $data['title'] . '

' . "\n\n" . $data['html']; $destination = 'temporary://' . $data['id'] . '.pdf'; $html2pdf = new Html2Pdf(); @@ -429,6 +470,16 @@ protected function indexItem(string $bundle, array $data, array $files = []) { } // Dump metadata. + if (isset($data['html'])) { + unset($data['html']); + } + if (isset($data['body'])) { + unset($data['body']); + } + + // Remove empty fields. + $data = array_filter($data); + $content = json_encode([ 'metadataAttributes' => $data, ]); From 91a8c0056fa6e8e8dabe5d5b739dadb6c56d85be Mon Sep 17 00:00:00 2001 From: "Peter Droogmans (attiks)" Date: Tue, 6 Aug 2024 14:12:32 +0200 Subject: [PATCH 05/25] feat: Use S3 for body Refs: #RW-1035 --- .../custom/reliefweb_semantic/README.md | 20 ++++- .../Commands/ReliefWebSemanticCommands.php | 85 ++++++++++++++++--- 2 files changed, 92 insertions(+), 13 deletions(-) diff --git a/html/modules/custom/reliefweb_semantic/README.md b/html/modules/custom/reliefweb_semantic/README.md index e6e413899..9235fc1dc 100644 --- a/html/modules/custom/reliefweb_semantic/README.md +++ b/html/modules/custom/reliefweb_semantic/README.md @@ -1,8 +1,24 @@ -ReliefWeb - Semantic module -=========================== +# ReliefWeb - Semantic module This module provides integration with the ReliefWeb Semantic API. +## AWS + +- Role: `BedrockRoleKbRw` +- Collection: `arn:aws:aoss:us-east-1:694216630861:collection/b2h8ajgjb3x87ur892hc` +- Vector field: `embedding` +- Text field name: `AMAZON_BEDROCK_TEXT_CHUNK` +- Metadata field name: `AMAZON_BEDROCK_METADATA` + +| Bundle | S3 source | Bucket | Index | KB | +| - | - | - | - | - | +| report | kb-data-source-rw-reports | rw-kb-reports | rw-reports | rw-knowledge-base-reports | +| job | kb-data-source-rw-jobs | rw-kb-jobs | rw-jobs | rw-knowledge-base-jobs | +| training | kb-data-source-rw-trainings | rw-kb-trainings | rw-trainings-2 | rw-knowledge-base-trainings | +| blog_post | kb-data-source-rw-blog-posts | rw-kb-blog-posts | rw-blog-posts-2 | rw-knowledge-base-blog-posts | +| book | kb-data-source-rw-books | rw-kb-books | rw-books-2 | rw-knowledge-base-books | +| topic | kb-data-source-rw-topics | rw-kb-topics | rw-topics | rw-knowledge-base-topics | + ``` GET /bedrock-knowledge-base-default-index/_search diff --git a/html/modules/custom/reliefweb_semantic/src/Commands/ReliefWebSemanticCommands.php b/html/modules/custom/reliefweb_semantic/src/Commands/ReliefWebSemanticCommands.php index 4b701d63a..0766b454f 100644 --- a/html/modules/custom/reliefweb_semantic/src/Commands/ReliefWebSemanticCommands.php +++ b/html/modules/custom/reliefweb_semantic/src/Commands/ReliefWebSemanticCommands.php @@ -86,7 +86,8 @@ class ReliefWebSemanticCommands extends DrushCommands { protected $bundles = [ 'report' => [ 'type' => 'node', - 'index' => 'reports', + 'index' => 'rw-reports', + 'bucket' => 'rw-kb-reports', 'field-list' => [ 'nid' => 'id', 'uuid' => 'uuid', @@ -107,7 +108,8 @@ class ReliefWebSemanticCommands extends DrushCommands { ], 'job' => [ 'type' => 'node', - 'index' => 'jobs', + 'index' => 'rw-jobs', + 'bucket' => 'rw-kb-jobs', 'field-list' => [ 'nid' => 'id', 'uuid' => 'uuid', @@ -120,6 +122,7 @@ class ReliefWebSemanticCommands extends DrushCommands { 'field_city' => 'city', 'field_job_closing_date' => 'job_closing_date', 'field_country' => 'country', + 'field_city' => 'city', 'field_how_to_apply' => 'how_to_apply', 'field_job_type' => 'job_type', 'field_job_experience' => 'job_experience', @@ -129,19 +132,63 @@ class ReliefWebSemanticCommands extends DrushCommands { ], 'training' => [ 'type' => 'node', - 'index' => 'training', + 'index' => 'rw-trainings-2', + 'bucket' => 'rw-kb-trainings', + 'field-list' => [ + 'nid' => 'id', + 'uuid' => 'uuid', + 'created' => 'created', + 'changed' => 'changed', + 'title' => 'title', + 'status' => 'status', + 'body' => 'body', + 'field_country' => 'country', + 'field_city' => 'city', + 'field_source' => 'source', + 'field_theme' => 'theme', + ], ], 'blog_post' => [ 'type' => 'node', - 'index' => 'blog', + 'index' => 'rw-blog-posts-2', + 'bucket' => 'rw-kb-blog-posts', + 'field-list' => [ + 'nid' => 'id', + 'uuid' => 'uuid', + 'created' => 'created', + 'changed' => 'changed', + 'title' => 'title', + 'status' => 'status', + 'body' => 'body', + ], ], 'book' => [ 'type' => 'node', - 'index' => 'book', + 'index' => 'rw-books-2', + 'bucket' => 'rw-kb-books', + 'field-list' => [ + 'nid' => 'id', + 'uuid' => 'uuid', + 'created' => 'created', + 'changed' => 'changed', + 'title' => 'title', + 'status' => 'status', + 'body' => 'body', + ], ], 'topic' => [ 'type' => 'node', - 'index' => 'topics', + 'index' => 'rw-topics', + 'bucket' => 'rw-kb-topics', + 'field-list' => [ + 'nid' => 'id', + 'uuid' => 'uuid', + 'created' => 'created', + 'changed' => 'changed', + 'title' => 'title', + 'status' => 'status', + 'body' => 'body', + ], ], 'country' => [ 'type' => 'taxonomy_term', @@ -342,6 +389,16 @@ protected function processItem(string $bundle, string $id) { return; } + if ($entity->bundle() != $bundle) { + $this->logger->notice(strtr('Bundle @a found for @id instead of @b', [ + '@a' => $entity->bundle(), + '@id' => $id, + '@b' => $bundle, + ])); + + return; + } + $data = $this->prepareItem($entity); if (empty($data)) { return FALSE; @@ -450,6 +507,13 @@ protected function indexItem(string $bundle, array $data, array $files = []) { return []; } + $bucket = $this->bundles[$bundle]['bucket'] ?? ''; + if (empty($bucket)) { + $this->logger->notice('Unknown bucket for @bundle', [ + '@bundle' => $bundle, + ]); + } + if (empty($files) && isset($data['files'])) { $files = $data['files']; unset($data['files']); @@ -496,26 +560,25 @@ protected function indexItem(string $bundle, array $data, array $files = []) { continue; } - $this->sendToS3($absolute_path); + $this->sendToS3($bucket, $absolute_path); $basename = basename($absolute_path); - $this->sendToS3($metadata_file, $basename . '.metadata.json'); + $this->sendToS3($bucket, $metadata_file, $basename . '.metadata.json'); } } /** * Store file and metadata on S3. */ - protected function sendToS3(string $file_name, string $save_as = '') { + protected function sendToS3(string $bucket, string $file_name, string $save_as = '') { $client_options = reliefweb_semantic_get_aws_client_options(); $client = new S3Client($client_options); - $bucket_name = 'rw-api-bucket-2'; if (empty($save_as)) { $save_as = basename($file_name); } $client->putObject([ - 'Bucket' => $bucket_name, + 'Bucket' => $bucket, 'Key' => $save_as, 'SourceFile' => $file_name, ]); From 0ad32780cb290b7e97652892a38615e3889fc821 Mon Sep 17 00:00:00 2001 From: "Peter Droogmans (attiks)" Date: Tue, 6 Aug 2024 16:05:24 +0200 Subject: [PATCH 06/25] feat: Add drush commands Refs: #RW-1035 --- .../custom/reliefweb_semantic/README.md | 33 ++- .../reliefweb_semantic/drush.services.yml | 6 + .../Commands/ReliefWebSemanticAwsCommands.php | 247 ++++++++++++++++++ .../Commands/ReliefWebSemanticCommands.php | 40 +-- 4 files changed, 284 insertions(+), 42 deletions(-) create mode 100644 html/modules/custom/reliefweb_semantic/src/Commands/ReliefWebSemanticAwsCommands.php diff --git a/html/modules/custom/reliefweb_semantic/README.md b/html/modules/custom/reliefweb_semantic/README.md index 9235fc1dc..e76e72bd9 100644 --- a/html/modules/custom/reliefweb_semantic/README.md +++ b/html/modules/custom/reliefweb_semantic/README.md @@ -4,23 +4,30 @@ This module provides integration with the ReliefWeb Semantic API. ## AWS +Dashboards: + +- https://us-east-1.console.aws.amazon.com/s3/lens/dashboard/RW-KB?region=us-east-1&bucketType=general + +Config: + - Role: `BedrockRoleKbRw` - Collection: `arn:aws:aoss:us-east-1:694216630861:collection/b2h8ajgjb3x87ur892hc` - Vector field: `embedding` - Text field name: `AMAZON_BEDROCK_TEXT_CHUNK` - Metadata field name: `AMAZON_BEDROCK_METADATA` -| Bundle | S3 source | Bucket | Index | KB | -| - | - | - | - | - | -| report | kb-data-source-rw-reports | rw-kb-reports | rw-reports | rw-knowledge-base-reports | -| job | kb-data-source-rw-jobs | rw-kb-jobs | rw-jobs | rw-knowledge-base-jobs | -| training | kb-data-source-rw-trainings | rw-kb-trainings | rw-trainings-2 | rw-knowledge-base-trainings | -| blog_post | kb-data-source-rw-blog-posts | rw-kb-blog-posts | rw-blog-posts-2 | rw-knowledge-base-blog-posts | -| book | kb-data-source-rw-books | rw-kb-books | rw-books-2 | rw-knowledge-base-books | -| topic | kb-data-source-rw-topics | rw-kb-topics | rw-topics | rw-knowledge-base-topics | +| KB Id | Data Id | Bundle | S3 source | Bucket | Index | KB | +| ---------- | ---------- | --------- | ---------------------------- | ---------------- | --------------- | ---------------------------- | +| VIEPSPYNSS | 6KGHOEXLGY | report | kb-data-source-rw-reports | rw-kb-reports | rw-reports | rw-knowledge-base-reports | +| WYBGQOFQLN | ZQW6GY0WYE | job | kb-data-source-rw-jobs | rw-kb-jobs | rw-jobs | rw-knowledge-base-jobs | +| VDQ6RY0K5K | XJMXTP72QA | training | kb-data-source-rw-trainings | rw-kb-trainings | rw-trainings-2 | rw-knowledge-base-trainings | +| D2E5HCYCTQ | URINLN9HIR | blog_post | kb-data-source-rw-blog-posts | rw-kb-blog-posts | rw-blog-posts-2 | rw-knowledge-base-blog-posts | +| NZTC9LPLJN | XETKAPIJKB | book | kb-data-source-rw-books | rw-kb-books | rw-books-2 | rw-knowledge-base-books | +| Y5EU13DU6Q | AXCARFTXKS | topic | kb-data-source-rw-topics | rw-kb-topics | rw-topics | rw-knowledge-base-topics | +## Openseach -``` +```json GET /bedrock-knowledge-base-default-index/_search { "query": { @@ -29,7 +36,7 @@ GET /bedrock-knowledge-base-default-index/_search } ``` -``` +```json GET /bedrock-knowledge-base-default-index/_search { "query": { @@ -41,7 +48,7 @@ GET /bedrock-knowledge-base-default-index/_search } ``` -``` +```json GET /bedrock-knowledge-base-default-index/_search { "query": { @@ -55,4 +62,6 @@ GET /bedrock-knowledge-base-default-index/_search } ``` -Describe the weather in china in june 2024 +## Questions + +- Describe the weather in china in june 2024 diff --git a/html/modules/custom/reliefweb_semantic/drush.services.yml b/html/modules/custom/reliefweb_semantic/drush.services.yml index 920c74370..9ffbdcadf 100644 --- a/html/modules/custom/reliefweb_semantic/drush.services.yml +++ b/html/modules/custom/reliefweb_semantic/drush.services.yml @@ -4,3 +4,9 @@ services: arguments: ['@config.factory', '@entity_field.manager', '@entity_type.manager', '@module_handler', '@state', '@http_client', '@file_system', '@renderer'] tags: - { name: drush.command } + reliefweb_semantic.aws_commands: + class: \Drupal\reliefweb_semantic\Commands\ReliefWebSemanticAwsCommands + arguments: ['@config.factory', '@state'] + tags: + - { name: drush.command } + diff --git a/html/modules/custom/reliefweb_semantic/src/Commands/ReliefWebSemanticAwsCommands.php b/html/modules/custom/reliefweb_semantic/src/Commands/ReliefWebSemanticAwsCommands.php new file mode 100644 index 000000000..0db821dde --- /dev/null +++ b/html/modules/custom/reliefweb_semantic/src/Commands/ReliefWebSemanticAwsCommands.php @@ -0,0 +1,247 @@ +config = $config_factory->get('reliefweb_semantic.settings'); + $this->state = $state; + } + + /** + * List kbs. + * + * @param array $options + * Additional options for the command. + * + * @command reliefweb-semantic:list-kbs + * + * @option reset. + * + * @default $options [] + * + * @usage reliefweb-semantic:list-kbs + * List kbs. + */ + public function listKbs( + array $options = [ + 'reset' => 0, + 'format' => 'table', + ], + ) : RowsOfFields { + $data = $this->getKbs($options['reset']); + return new RowsOfFields($data); + } + + /** + * List datasources. + * + * @param array $options + * Additional options for the command. + * + * @command reliefweb-semantic:list-datasources + * + * @option reset. + * + * @default $options [] + * + * @usage reliefweb-semantic:list-datasources + * List datasources. + */ + public function listDatasources( + array $options = [ + 'reset' => 0, + 'format' => 'table', + ], + ) : RowsOfFields { + $data = $this->getDatasources($options['reset']); + return new RowsOfFields($data); + } + + /** + * List j=ingestion jobs. + * + * @param array $options + * Additional options for the command. + * + * @command reliefweb-semantic:list-jobs + * + * @option reset. + * + * @default $options [] + * + * @usage reliefweb-semantic:list-jobs + * List jobs. + */ + public function listJobs( + array $options = [ + 'id' => 0, + 'format' => 'table', + ], + ) : null|RowsOfFields { + $aws_options = reliefweb_semantic_get_aws_client_options(); + $bedrock = new BedrockAgentClient($aws_options); + + if (empty($options['id'])) { + return NULL; + } + + $datasources = $this->getDatasources(); + $result = $bedrock->listIngestionJobs([ + 'dataSourceId' => $datasources[$options['id']]['id'], + 'knowledgeBaseId' => $datasources[$options['id']]['kb_id'], + ]); + + $jobs = $result->toArray()['ingestionJobSummaries']; + $data = []; + + foreach ($jobs as $job) { + $data[$job['ingestionJobId']] = [ + 'id' => $job['ingestionJobId'], + 'status' => $job['status'], + 'updated' => $job['updatedAt'], + 'numberOfDocumentsScanned' => $job['statistics']['numberOfDocumentsScanned'], + 'numberOfDocumentsFailed' => $job['statistics']['numberOfDocumentsFailed'], + 'numberOfNewDocumentsIndexed' => $job['statistics']['numberOfNewDocumentsIndexed'], + ]; + } + + return new RowsOfFields($data); + } + + /** + * Trigger sync. + * + * @param array $options + * Additional options for the command. + * + * @command reliefweb-semantic:trigger-sync + * + * @option reset. + * + * @default $options [] + * + * @usage reliefweb-semantic:trigger-sync --id=xxx + * List datasources. + */ + public function triggerSync( + array $options = [ + 'id' => 0, + ], + ) { + $datasources = $this->getDatasources(); + + $aws_options = reliefweb_semantic_get_aws_client_options(); + $bedrock = new BedrockAgentClient($aws_options); + + if (!empty($options['id'])) { + $bedrock->startIngestionJob([ + 'dataSourceId' => $datasources[$options['id']]['id'], + 'knowledgeBaseId' => $datasources[$options['id']]['kb_id'], + ]); + + return; + } + + foreach ($datasources as $id => $datasource) { + $bedrock->startIngestionJob([ + 'dataSourceId' => $id, + 'knowledgeBaseId' => $datasource['kb_id'], + ]); + + // Rate limit is 0.1 / sec. + sleep(15); + } + } + + /** + * Get kbs. + */ + protected function getKbs($reset = 0) : array { + $data = $this->state->get('reliefweb_semantic_kbs', []); + if (empty($data) || !empty($reset)) { + $data = []; + $aws_options = reliefweb_semantic_get_aws_client_options(); + $bedrock = new BedrockAgentClient($aws_options); + $result = $bedrock->listKnowledgeBases(); + + $kbs = $result->toArray()['knowledgeBaseSummaries']; + foreach ($kbs as $kb) { + $data[$kb['knowledgeBaseId']] = [ + 'id' => $kb['knowledgeBaseId'], + 'name' => $kb['name'], + 'status' => $kb['status'], + ]; + } + + $this->state->set('reliefweb_semantic_kbs', $data); + } + + return $data; + } + + /** + * Get data sources. + */ + protected function getDatasources($reset = 0) { + $data = $this->state->get('reliefweb_semantic_datasources', []); + if (empty($data) || !empty($reset)) { + $kbs = $this->getKbs(); + $aws_options = reliefweb_semantic_get_aws_client_options(); + $bedrock = new BedrockAgentClient($aws_options); + + foreach ($kbs as $id => $kb) { + $result = $bedrock->listDataSources([ + 'knowledgeBaseId' => $id, + ]); + + $datasources = $result->toArray()['dataSourceSummaries']; + foreach ($datasources as $datasource) { + $data[$datasource['dataSourceId']] = [ + 'id' => $datasource['dataSourceId'], + 'name' => $datasource['name'], + 'status' => $datasource['status'], + 'kb_id' => $kb['id'], + 'kb_name' => $kb['name'], + 'kb_status' => $kb['status'], + ]; + } + } + + $this->state->set('reliefweb_semantic_datasources', $data); + } + + return $data; + } + +} diff --git a/html/modules/custom/reliefweb_semantic/src/Commands/ReliefWebSemanticCommands.php b/html/modules/custom/reliefweb_semantic/src/Commands/ReliefWebSemanticCommands.php index 0766b454f..f02a74ee3 100644 --- a/html/modules/custom/reliefweb_semantic/src/Commands/ReliefWebSemanticCommands.php +++ b/html/modules/custom/reliefweb_semantic/src/Commands/ReliefWebSemanticCommands.php @@ -162,20 +162,6 @@ class ReliefWebSemanticCommands extends DrushCommands { 'body' => 'body', ], ], - 'book' => [ - 'type' => 'node', - 'index' => 'rw-books-2', - 'bucket' => 'rw-kb-books', - 'field-list' => [ - 'nid' => 'id', - 'uuid' => 'uuid', - 'created' => 'created', - 'changed' => 'changed', - 'title' => 'title', - 'status' => 'status', - 'body' => 'body', - ], - ], 'topic' => [ 'type' => 'node', 'index' => 'rw-topics', @@ -190,18 +176,6 @@ class ReliefWebSemanticCommands extends DrushCommands { 'body' => 'body', ], ], - 'country' => [ - 'type' => 'taxonomy_term', - 'index' => 'countries', - ], - 'disaster' => [ - 'type' => 'taxonomy_term', - 'index' => 'disasters', - ], - 'source' => [ - 'type' => 'taxonomy_term', - 'index' => 'sources', - ], ]; /** @@ -251,7 +225,7 @@ public function __construct( public function index( $bundle = '', array $options = [ - 'limit' => 500, + 'limit' => 10, 'id' => 0, ], ) { @@ -280,7 +254,7 @@ public function index( } // Index indexing options. - $limit = (int) ($options['limit'] ?: 500); + $limit = (int) ($options['limit'] ?: 10); // Launch the indexing or index removal. try { @@ -291,7 +265,7 @@ public function index( ])); } else { - $this->logger->notice(strtr('Indexed @num_items for @bundle', [ + $this->logger->notice(strtr('Indexed @num_items items for @bundle', [ '@num_items' => $num_items, '@bundle' => $bundle, ])); @@ -310,7 +284,7 @@ public function index( /** * Index items. */ - protected function indexItems($bundle, $limit = 500) : int { + protected function indexItems($bundle, $limit = 10) : int { $entity_type = $this->bundles[$bundle]['type'] ?? ''; if (empty($entity_type)) { $this->logger->notice(strtr('Unknown entity type for @bundle', [ @@ -422,6 +396,12 @@ protected function processItem(string $bundle, string $id) { * Prepare data for the index. */ protected function prepareItem(ContentEntityInterface $entity) : array { + $this->logger->notice(strtr('Preparing @bundle: @title (@id)', [ + '@bundle' => $entity->bundle(), + '@title' => $entity->label(), + '@id' => $entity->id(), + ])); + $data = []; $field_list = $this->bundles[$entity->bundle()]['field-list'] ?? []; if (empty($field_list)) { From 17a31cc107335718372a84751715bbecda69096e Mon Sep 17 00:00:00 2001 From: "Peter Droogmans (attiks)" Date: Tue, 6 Aug 2024 16:23:23 +0200 Subject: [PATCH 07/25] feat: Add drush commands Refs: #RW-1035 --- .../src/Commands/ReliefWebSemanticAwsCommands.php | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/html/modules/custom/reliefweb_semantic/src/Commands/ReliefWebSemanticAwsCommands.php b/html/modules/custom/reliefweb_semantic/src/Commands/ReliefWebSemanticAwsCommands.php index 0db821dde..1dcd86ea9 100644 --- a/html/modules/custom/reliefweb_semantic/src/Commands/ReliefWebSemanticAwsCommands.php +++ b/html/modules/custom/reliefweb_semantic/src/Commands/ReliefWebSemanticAwsCommands.php @@ -189,6 +189,7 @@ public function triggerSync( */ protected function getKbs($reset = 0) : array { $data = $this->state->get('reliefweb_semantic_kbs', []); + if (empty($data) || !empty($reset)) { $data = []; $aws_options = reliefweb_semantic_get_aws_client_options(); @@ -204,6 +205,9 @@ protected function getKbs($reset = 0) : array { ]; } + // Remove tests. + unset($data['FV9YWTCSHX']); + unset($data['2ZOGICT5IP']); $this->state->set('reliefweb_semantic_kbs', $data); } From ded0d1d0ad0c88726456174df6a43a1579787017 Mon Sep 17 00:00:00 2001 From: "Peter Droogmans (attiks)" Date: Tue, 6 Aug 2024 16:25:54 +0200 Subject: [PATCH 08/25] feat: Add drush commands Refs: #RW-1035 --- html/modules/custom/reliefweb_semantic/README.md | 14 ++++++++++++++ .../src/Commands/ReliefWebSemanticAwsCommands.php | 2 +- 2 files changed, 15 insertions(+), 1 deletion(-) diff --git a/html/modules/custom/reliefweb_semantic/README.md b/html/modules/custom/reliefweb_semantic/README.md index e76e72bd9..bd20c6c9b 100644 --- a/html/modules/custom/reliefweb_semantic/README.md +++ b/html/modules/custom/reliefweb_semantic/README.md @@ -2,6 +2,10 @@ This module provides integration with the ReliefWeb Semantic API. +## To do + +- Add service to query API + ## AWS Dashboards: @@ -25,6 +29,16 @@ Config: | NZTC9LPLJN | XETKAPIJKB | book | kb-data-source-rw-books | rw-kb-books | rw-books-2 | rw-knowledge-base-books | | Y5EU13DU6Q | AXCARFTXKS | topic | kb-data-source-rw-topics | rw-kb-topics | rw-topics | rw-knowledge-base-topics | +## Drush + +```bash +drush reliefweb-semantic:index Index content in the ReliefWeb API. +drush reliefweb-semantic:list-kbs List kbs. +drush reliefweb-semantic:list-datasources List datasources. +drush reliefweb-semantic:list-jobs List ingestion jobs. +drush reliefweb-semantic:trigger-sync Trigger sync.. +``` + ## Openseach ```json diff --git a/html/modules/custom/reliefweb_semantic/src/Commands/ReliefWebSemanticAwsCommands.php b/html/modules/custom/reliefweb_semantic/src/Commands/ReliefWebSemanticAwsCommands.php index 1dcd86ea9..0d50739a7 100644 --- a/html/modules/custom/reliefweb_semantic/src/Commands/ReliefWebSemanticAwsCommands.php +++ b/html/modules/custom/reliefweb_semantic/src/Commands/ReliefWebSemanticAwsCommands.php @@ -89,7 +89,7 @@ public function listDatasources( } /** - * List j=ingestion jobs. + * List ingestion jobs. * * @param array $options * Additional options for the command. From 32ad0338801031a6236fc0d949cc3a6e9e88d05f Mon Sep 17 00:00:00 2001 From: "Peter Droogmans (attiks)" Date: Mon, 12 Aug 2024 16:15:57 +0200 Subject: [PATCH 09/25] chore: Remove promo link from pdfs --- PATCHES/remove-tcpdf-footer.patch | 39 +++++++++++++++++++++++++++++++ composer.patches.json | 3 +++ 2 files changed, 42 insertions(+) create mode 100644 PATCHES/remove-tcpdf-footer.patch diff --git a/PATCHES/remove-tcpdf-footer.patch b/PATCHES/remove-tcpdf-footer.patch new file mode 100644 index 000000000..707544eff --- /dev/null +++ b/PATCHES/remove-tcpdf-footer.patch @@ -0,0 +1,39 @@ +diff --git a/src/MyPdf.php b/src/MyPdf.php +index 082131a..bb3cb96 100644 +--- a/src/MyPdf.php ++++ b/src/MyPdf.php +@@ -21,6 +21,7 @@ class MyPdf extends TCPDF + protected $_transf = array(); + protected $_myLastPageGroup = null; + protected $_myLastPageGroupNb = 0; ++ protected $tcpdflink = false; + + // used to make a radius with bezier : (4/3 * (sqrt(2) - 1)) + const MY_ARC = 0.5522847498; +@@ -267,7 +268,7 @@ class MyPdf extends TCPDF + $cornerBL = null, + $cornerBR = null + ) { +- ++ + // init the path + $path = ''; + +@@ -1087,7 +1088,7 @@ class MyPdf extends TCPDF + $drawFirst = true, + $trans = false + ) { +- ++ + // if we want the no trigo direction : add 2PI to the begin angle, to invert the direction + if (!$direction) { + $angleBegin+= M_PI*2.; +@@ -1387,7 +1388,7 @@ class MyPdf extends TCPDF + $page = null, + $fontName = 'helvetica' + ) { +- ++ + // bookmark the Title if wanted + if ($bookmarkTitle) { + $this->Bookmark($titre, 0, -1); diff --git a/composer.patches.json b/composer.patches.json index 794cfb478..454e0f499 100644 --- a/composer.patches.json +++ b/composer.patches.json @@ -28,6 +28,9 @@ "drush/drush": { "https://humanitarian.atlassian.net/browse/OPS-8026": "PATCHES/drush--timeout-override.patch" }, + "spipu/html2pdf": { + "Remove promo link": "PATCHES/remove-tcpdf-footer.patch" + }, "unocha/common_design": { "https://humanitarian.atlassian.net/browse/CD-519": "PATCHES/common_design--default-logo-remove.patch" } From 27c0999fd96513948ffecbaf6993f5170d203ced Mon Sep 17 00:00:00 2001 From: "Peter Droogmans (attiks)" Date: Mon, 12 Aug 2024 17:05:37 +0200 Subject: [PATCH 10/25] feat: Drush command to query --- .../custom/reliefweb_semantic/README.md | 1 + .../Commands/ReliefWebSemanticAwsCommands.php | 52 +++++++++++++++++++ 2 files changed, 53 insertions(+) diff --git a/html/modules/custom/reliefweb_semantic/README.md b/html/modules/custom/reliefweb_semantic/README.md index bd20c6c9b..471387053 100644 --- a/html/modules/custom/reliefweb_semantic/README.md +++ b/html/modules/custom/reliefweb_semantic/README.md @@ -37,6 +37,7 @@ drush reliefweb-semantic:list-kbs List kbs. drush reliefweb-semantic:list-datasources List datasources. drush reliefweb-semantic:list-jobs List ingestion jobs. drush reliefweb-semantic:trigger-sync Trigger sync.. +drush reliefweb-semantic:query-kb --id=WYBGQOFQLN --q="Any jobs in Europe" ``` ## Openseach diff --git a/html/modules/custom/reliefweb_semantic/src/Commands/ReliefWebSemanticAwsCommands.php b/html/modules/custom/reliefweb_semantic/src/Commands/ReliefWebSemanticAwsCommands.php index 0d50739a7..0235df852 100644 --- a/html/modules/custom/reliefweb_semantic/src/Commands/ReliefWebSemanticAwsCommands.php +++ b/html/modules/custom/reliefweb_semantic/src/Commands/ReliefWebSemanticAwsCommands.php @@ -3,6 +3,7 @@ namespace Drupal\reliefweb_semantic\Commands; use Aws\BedrockAgent\BedrockAgentClient; +use Aws\BedrockAgentRuntime\BedrockAgentRuntimeClient; use Consolidation\OutputFormatters\StructuredData\RowsOfFields; use Drupal\Core\Config\ConfigFactoryInterface; use Drupal\Core\State\StateInterface; @@ -139,6 +140,57 @@ public function listJobs( return new RowsOfFields($data); } + /** + * Query KB. + * + * @param array $options + * Additional options for the command. + * + * @command reliefweb-semantic:query-kb + * + * @option reset. + * + * @default $options [] + * + * @usage reliefweb-semantic:query-kb id + * List jobs. + */ + public function queryKb( + array $options = [ + 'id' => 0, + 'q' => 0, + 'format' => 'table', + ], + ) : null|RowsOfFields { + $aws_options = reliefweb_semantic_get_aws_client_options(); + $bedrock = new BedrockAgentRuntimeClient($aws_options); + + if (empty($options['id'])) { + return NULL; + } + + $result = $bedrock->retrieve([ + 'knowledgeBaseId' => $options['id'], + 'retrievalQuery' => [ + 'text' => $options['q'], + ], + ]); + + $result = $result->toArray()['retrievalResults'] ?? []; + $data = []; + + foreach ($result as $item) { + $data[$item['metadata']['nid']] = [ + 'id' => $item['metadata']['nid'], + 'title' => $item['metadata']['title'], + 'score' => round(100 * $item['score'], 2) . '%', + 'file' => $item['location']['s3Location']['uri'], + ]; + } + + return new RowsOfFields($data); + } + /** * Trigger sync. * From 9e73ba0fb730eddcd83f1639a3793af6b00a6a1a Mon Sep 17 00:00:00 2001 From: "Peter Droogmans (attiks)" Date: Fri, 16 Aug 2024 14:09:49 +0200 Subject: [PATCH 11/25] bug: Indexing feat: Filters --- .../Commands/ReliefWebSemanticAwsCommands.php | 69 ++++++++++++++++++- .../Commands/ReliefWebSemanticCommands.php | 2 +- 2 files changed, 68 insertions(+), 3 deletions(-) diff --git a/html/modules/custom/reliefweb_semantic/src/Commands/ReliefWebSemanticAwsCommands.php b/html/modules/custom/reliefweb_semantic/src/Commands/ReliefWebSemanticAwsCommands.php index 0235df852..32f6d5a92 100644 --- a/html/modules/custom/reliefweb_semantic/src/Commands/ReliefWebSemanticAwsCommands.php +++ b/html/modules/custom/reliefweb_semantic/src/Commands/ReliefWebSemanticAwsCommands.php @@ -160,6 +160,8 @@ public function queryKb( 'id' => 0, 'q' => 0, 'format' => 'table', + 'theme' => '', + 'country' => '', ], ) : null|RowsOfFields { $aws_options = reliefweb_semantic_get_aws_client_options(); @@ -169,12 +171,73 @@ public function queryKb( return NULL; } - $result = $bedrock->retrieve([ + $filters = []; + if (!empty($options['theme'])) { + $filters['theme'] = str_replace(' ', '', $options['theme']); + } + if (!empty($options['country'])) { + $filters['country'] = str_replace(' ', '', $options['country']); + } + + $kb_filter = [ + 'retrievalConfiguration' => [ + 'vectorSearchConfiguration' => [ + 'numberOfResults' => 10, + ], + ], + ]; + + if (!empty($filters)) { + if (count($filters) == 1) { + $key = reset(array_keys($filters)); + $value = reset($filters); + $kb_filter = [ + 'retrievalConfiguration' => [ + 'vectorSearchConfiguration' => [ + 'filter' => [ + 'in' => [ + 'key' => $key, + 'value' => explode(',', $value), + ], + ], + 'numberOfResults' => 10, + ], + ], + ]; + } + else { + $all_filters = []; + foreach ($filters as $key => $value) { + $all_filters[] = [ + 'in' => [ + 'key' => $key, + 'value' => explode(',', $value), + ], + ]; + } + + $kb_filter = [ + 'retrievalConfiguration' => [ + 'vectorSearchConfiguration' => [ + 'numberOfResults' => 10, + 'overrideSearchType' => 'HYBRID', + 'filter' => [ + 'andAll' => $all_filters, + ], + ], + ], + ]; + } + } + + $br_options = [ 'knowledgeBaseId' => $options['id'], 'retrievalQuery' => [ 'text' => $options['q'], ], - ]); + ] + $kb_filter; + + $result = $bedrock->retrieve($br_options); $result = $result->toArray()['retrievalResults'] ?? []; $data = []; @@ -185,6 +248,8 @@ public function queryKb( 'title' => $item['metadata']['title'], 'score' => round(100 * $item['score'], 2) . '%', 'file' => $item['location']['s3Location']['uri'], + 'theme' => implode(', ', $item['metadata']['theme'] ?? []), + 'country' => implode(', ', $item['metadata']['country'] ?? []), ]; } diff --git a/html/modules/custom/reliefweb_semantic/src/Commands/ReliefWebSemanticCommands.php b/html/modules/custom/reliefweb_semantic/src/Commands/ReliefWebSemanticCommands.php index f02a74ee3..f661416aa 100644 --- a/html/modules/custom/reliefweb_semantic/src/Commands/ReliefWebSemanticCommands.php +++ b/html/modules/custom/reliefweb_semantic/src/Commands/ReliefWebSemanticCommands.php @@ -303,7 +303,7 @@ protected function indexItems($bundle, $limit = 10) : int { ->accessCheck(FALSE) ->range(0, $limit) ->sort($key, 'DESC') - ->condition($key, $this->state->get('reliefweb_semantic_last_indexed_' . $bundle, 0), '>'); + ->condition($key, $this->state->get('reliefweb_semantic_last_indexed_' . $bundle, 0), '<'); if ($entity_type == 'node') { $query->condition('type', $bundle); From 7bf9c4a095002b01e96587badabe3cf9fc459235 Mon Sep 17 00:00:00 2001 From: "Peter Droogmans (attiks)" Date: Fri, 16 Aug 2024 16:38:57 +0200 Subject: [PATCH 12/25] feat: Service for kb queries --- .../reliefweb_semantic/drush.services.yml | 2 +- .../reliefweb_semantic.services.yml | 4 + .../Commands/ReliefWebSemanticAwsCommands.php | 96 +++----------- .../reliefweb_semantic/src/Commands/test.json | 44 ------- .../src/Services/ReliefWebSemanticService.php | 119 ++++++++++++++++++ 5 files changed, 141 insertions(+), 124 deletions(-) create mode 100644 html/modules/custom/reliefweb_semantic/reliefweb_semantic.services.yml delete mode 100644 html/modules/custom/reliefweb_semantic/src/Commands/test.json create mode 100644 html/modules/custom/reliefweb_semantic/src/Services/ReliefWebSemanticService.php diff --git a/html/modules/custom/reliefweb_semantic/drush.services.yml b/html/modules/custom/reliefweb_semantic/drush.services.yml index 9ffbdcadf..50273e477 100644 --- a/html/modules/custom/reliefweb_semantic/drush.services.yml +++ b/html/modules/custom/reliefweb_semantic/drush.services.yml @@ -6,7 +6,7 @@ services: - { name: drush.command } reliefweb_semantic.aws_commands: class: \Drupal\reliefweb_semantic\Commands\ReliefWebSemanticAwsCommands - arguments: ['@config.factory', '@state'] + arguments: ['@config.factory', '@state', '@reliefweb_semantic.search_service'] tags: - { name: drush.command } diff --git a/html/modules/custom/reliefweb_semantic/reliefweb_semantic.services.yml b/html/modules/custom/reliefweb_semantic/reliefweb_semantic.services.yml new file mode 100644 index 000000000..5cb4f87c4 --- /dev/null +++ b/html/modules/custom/reliefweb_semantic/reliefweb_semantic.services.yml @@ -0,0 +1,4 @@ +services: + reliefweb_semantic.search_service: + class: Drupal\reliefweb_semantic\Services\ReliefWebSemanticService + arguments: [] diff --git a/html/modules/custom/reliefweb_semantic/src/Commands/ReliefWebSemanticAwsCommands.php b/html/modules/custom/reliefweb_semantic/src/Commands/ReliefWebSemanticAwsCommands.php index 32f6d5a92..42c2eb753 100644 --- a/html/modules/custom/reliefweb_semantic/src/Commands/ReliefWebSemanticAwsCommands.php +++ b/html/modules/custom/reliefweb_semantic/src/Commands/ReliefWebSemanticAwsCommands.php @@ -3,10 +3,10 @@ namespace Drupal\reliefweb_semantic\Commands; use Aws\BedrockAgent\BedrockAgentClient; -use Aws\BedrockAgentRuntime\BedrockAgentRuntimeClient; use Consolidation\OutputFormatters\StructuredData\RowsOfFields; use Drupal\Core\Config\ConfigFactoryInterface; use Drupal\Core\State\StateInterface; +use Drupal\reliefweb_semantic\Services\ReliefWebSemanticService; use Drush\Commands\DrushCommands; /** @@ -28,15 +28,24 @@ class ReliefWebSemanticAwsCommands extends DrushCommands { */ protected $state; + /** + * The state service. + * + * @var \Drupal\reliefweb_semantic\Services\ReliefWebSemanticService + */ + protected $rwService; + /** * {@inheritdoc} */ public function __construct( ConfigFactoryInterface $config_factory, StateInterface $state, + ReliefWebSemanticService $rw_service, ) { $this->config = $config_factory->get('reliefweb_semantic.settings'); $this->state = $state; + $this->rwService = $rw_service; } /** @@ -164,92 +173,21 @@ public function queryKb( 'country' => '', ], ) : null|RowsOfFields { - $aws_options = reliefweb_semantic_get_aws_client_options(); - $bedrock = new BedrockAgentRuntimeClient($aws_options); - if (empty($options['id'])) { return NULL; } - $filters = []; - if (!empty($options['theme'])) { - $filters['theme'] = str_replace(' ', '', $options['theme']); - } - if (!empty($options['country'])) { - $filters['country'] = str_replace(' ', '', $options['country']); - } - - $kb_filter = [ - 'retrievalConfiguration' => [ - 'vectorSearchConfiguration' => [ - 'numberOfResults' => 10, - ], - ], - ]; - - if (!empty($filters)) { - if (count($filters) == 1) { - $key = reset(array_keys($filters)); - $value = reset($filters); - $kb_filter = [ - 'retrievalConfiguration' => [ - 'vectorSearchConfiguration' => [ - 'filter' => [ - 'in' => [ - 'key' => $key, - 'value' => explode(',', $value), - ], - ], - 'numberOfResults' => 10, - ], - ], - ]; - } - else { - $all_filters = []; - foreach ($filters as $key => $value) { - $all_filters[] = [ - 'in' => [ - 'key' => $key, - 'value' => explode(',', $value), - ], - ]; - } - - $kb_filter = [ - 'retrievalConfiguration' => [ - 'vectorSearchConfiguration' => [ - 'numberOfResults' => 10, - 'overrideSearchType' => 'HYBRID', - 'filter' => [ - 'andAll' => $all_filters, - ], - ], - ], - ]; - } - } - - $br_options = [ - 'knowledgeBaseId' => $options['id'], - 'retrievalQuery' => [ - 'text' => $options['q'], - ], - ] + $kb_filter; - - $result = $bedrock->retrieve($br_options); - - $result = $result->toArray()['retrievalResults'] ?? []; + $result = $this->rwService->queryKb($options['id'], $options['q'], $options['theme'], $options['country']); $data = []; foreach ($result as $item) { - $data[$item['metadata']['nid']] = [ - 'id' => $item['metadata']['nid'], - 'title' => $item['metadata']['title'], + $data[$item['id']] = [ + 'id' => $item['id'], + 'title' => $item['title'], 'score' => round(100 * $item['score'], 2) . '%', - 'file' => $item['location']['s3Location']['uri'], - 'theme' => implode(', ', $item['metadata']['theme'] ?? []), - 'country' => implode(', ', $item['metadata']['country'] ?? []), + 'file' => $item['file'], + 'theme' => implode(', ', $item['theme'] ?? []), + 'country' => implode(', ', $item['country'] ?? []), ]; } diff --git a/html/modules/custom/reliefweb_semantic/src/Commands/test.json b/html/modules/custom/reliefweb_semantic/src/Commands/test.json deleted file mode 100644 index c9e3ef4de..000000000 --- a/html/modules/custom/reliefweb_semantic/src/Commands/test.json +++ /dev/null @@ -1,44 +0,0 @@ -{ - "timestamp": "2024-08-01T11:52:09+00:00", - "id": "4071448", - "uuid": "c2c24018-b0d3-4c15-87bf-1a3436fbe56c", - "created": "1718799733", - "changed": "1718799733", - "title": "Human Resources Director", - "status": "1", - "body": "The International Rescue Committee (IRC) responds to the world\u2019s worst humanitarian crises, helping to restore health, safety, education, economic wellbeing, and power to people devastated by conflict and disaster. Founded in 1933 at the call of Albert Einstein, the IRC is one of the world's largest international humanitarian non-governmental organizations (INGO), at work in more than 50 countries and more than 25 U.S. cities helping people to survive, reclaim control of their future and strengthen their communities. A force for humanity, IRC employees deliver lasting impact by restoring safety, dignity and hope to millions. If you're a solutions-driven, passionate change-maker, come join us in positively impacting the lives of millions of people world-wide for a better future.\n\nThe Syria crisis is often described as the worst humanitarian catastrophe since the end of the Cold War. Today 16.2 million people in Syria are in need of humanitarian assistance with needs increasingly being exacerbated by economic decline. This is no short-term humanitarian episode.\n\nIRC is providing a robust humanitarian response in Syria, supported by more than 800+ staff across Syria, Jordan, T\u00fcrkiye and Iraq. IRC is undertaking programs in the fields of health, child protection, early childhood development, women\u2019s protection and empowerment, cash assistance, protection and rule of law, and economic recovery and livelihood programming. Our work in these challenging settings gives rise to some of the most pressing issues facing contemporary humanitarian action, including questions of access, security, funding and coordination.\n\n**Job Overview\/Summary**\n\nThe Human Resource Director is accountable for providing strategic leadership for over 800 staff and incentive workers in the Syria Country Program, across multiple geographical locations. S\/he will lead a HR team to ensure high quality and efficient staff recruitment, contracts management, orientation, learning and development, performance management, compensation and benefits, code of conduct compliance, employee engagement, diversity and inclusion, and staff care. The position holder operates within the scope of IRC management in partnership model and reports directly to both, Syria Country Director and Regional People and Culture Director \u2013 MENA.\n\nThe HR Director will adapt and implement Global and Regional HR initiatives and practices, and serve as an advisor to maximize organizational staffing resources and performance, minimize risk and ensure economy and efficiency of work processes. Importantly the HR Director will promote and cultivate a positive and healthy organizational culture, and work to ensure that this culture is practiced and lived across the Country Program. The position holder will serve as a key member in the Senior Management Team (SMT) and work collaboratively with country leadership to establish and maintain an organizational culture in line with IRC\u2019s values. In this role, the HR Director serves as a strategic partner, advisor, and coach to ensure a safe and welcoming culture for all people.\n\n**Key Responsibilities**\n\n**Strategic HR Leadership and Management**\n\n\u2022 Strategic leadership on al HR related matters, working with Country Director and partnering with SMT to ensure the IRC Syria Country Program embodies organizational culture and values and that all team members feel valued through all aspects of the employment lifecycle.\n\n\u2022 Manage and lead the HR team across all locations, and overall accountable for quality of services and success of the HR department progress against agreed goals. Monitor key HR KPIs, analyzing monthly data to diagnose and identify priorities and evaluate effectiveness of HR functions.\n\n\u2022 Serve as a model of supervisory excellence; supervise and mentor direct-report staff, including communicating clear expectations, setting performance objectives, providing regular and timely performance feedback, and leading documented semi-annual performance reviews.\n\n\u2022 Lead the performance management process, creating a plan to implement the annual and mid-year reviews. Conduct training on goal-setting, utilize budgets to organize development activities and work one-on-one with managers and employees to create country wide development plans.\n\n\u2022 Support senior staff to pursue nationalization\/regionalization of senior and middle management positions.\n\n\u2022 Promote and actively participate in initiatives and efforts to foster team culture, through team engagement, inclusion and cohesion.\n\n\u2022 Foster ongoing learning, honest dialogue and reflection to strengthen safeguarding and to promote IRC values and adherence to IRC policies.\n\n\u2022 Advise and coach supervisors in determining appropriate disciplinary plans of action in a judicious manner. Follow-up disciplinary measures and related employment law matters. Ensure all legal obligations are fulfilled in Syria, Jordan and T\u00fcrkiye.\n\n\u2022 Partner with IRC global investigations teams and the IRC Syria CD and Risk and Compliance Director to ensure that recommendations arising out of all investigations, particularly disciplinary action against subjects, are actioned within 2 weeks.\n\n\u2022 Participate in and support staff meetings, and propose and lead other staff engagement initiatives in order to bridge the gap between the field and remote support offices.\n\n\u2022 Support the Country Director in other occasional strategic people related tasks that may arise.\n\n**HR Operations\/Foundations**\n\n\u2022 Accountable for salary payroll for all national staff.\n\n\u2022 Participate in budget preparation and provide strategic compensation analysis to attract high-quality talent. Define and review the salary structure; coordinate the annual compensation review process and compensation adjustments.\n\n\u2022 Devise and deliver a planned HR approach to attracting, developing, inspiring and retaining the right people with the right skills to achieve strategic, high-quality programmatic outcomes.\n\n\u2022 Lead exit management procedure to ensure seamless and positive transition for departing employees and analyze turnover and exit interviews to make real-time, continuous improvement utilizing learnings to formulate retention strategies.\n\n\u2022 Ensure high quality and efficient context-specific strategies for all HR fundamentals.\n\n**Gender Equality, Diversity and Inclusion (GEDI) and Safeguarding**\n\n\u2022 Oversee the implementation IRC Syria\u2019s GEDI priorities, including facilitating key conversations across all levels of the Country Program to ensure understanding and commitment to context specific GEDI principles, and successful implementation of the GEDI Action Plan.\n\n\u2022 Accountable for incorporation of GEDI best practice and IRC values in employee lifecycle and in operations.\n\n\u2022 Ensure leadership create and empower a diverse and safe organizational environment. One that is respectful and inclusive and grants each employee an equal opportunity to learn, grow and contribute to the IRC.\n\n\u2022 Partner with country and regional specialized safeguarding staff to convene functional stakeholders in country, and to promote uptake and progress on the Safeguarding Minimum Standards.\n\n\u2022 Ensure that the Syria SMT is updated regularly (minimum bi-annually) on progress \u2013 including analysis of barriers, enablers and resources required \u2013 on the Safeguarding Minimum Standards.\n\n\u2022 Partner with country and regional specialized safeguarding staff to communicate clearly and consistently with all staff regarding IRC reporting and support channels related to ethical misconduct, including IRC\u2019s survivor-centered reporting guidelines.\n\n**Duty of Care**\n\n\u2022 Advise and provide support for all staff related to duty of care efforts\/initiatives.\n\n\u2022 Devise staff care action plans that elevate morale and support the social, physical, and psychological well-being of staff; create emergency staff care interventions \u2013 both in collaboration with the Regional Staff Care unit. Promote and assess staff care and well-being. Model healthy work-life balance practices.\n\n\u2022 Maintain a healthy and empowering office environment that encourages open, honest, and productive communication among IRC staff and is devised to meet the remote management context, by delivering an employee engagement and communication strategy.\n\n***Key Working Relationships:***\n\nPosition Reports to: Country Director and Regional People and Culture Director\n\nPosition directly Supervises: HR leads in northwest Syria, northeast Syria, T\u00fcrkiye and Jordan.\n\nKey Internal Contacts:\n\n\uf0a7 Country Program: Senior Management Team members\n\n\uf0a7 Regional: Regional People and Culture Director, Compensation and Benefit Duty of Care and GEDI team members\n\n\uf0a7 HQ: People and Culture Team, Employee Relations and Duty of Care teams\n\nKey External Contacts:\n\n\uf0a7 HR counter parts at other I\/NGOs\n\n**Job Requirements**\n\n\u2022 Bachelor\u2019s degree required. Master\u2019s university degree in HR management, organizational behavior, international relations or development, MBA, Law or related field is preferred.\n\n\u2022 Minimum of 7 tears progressive experience as a HR practitioner, including recruitment, employee relations, compensation, training and development and HR Administration.\n\n\u2022 Demonstrated success as a HR leader supporting groups of 500 + employees at multiple organizational levels, cultures, and locations within a regional or global environment required.\n\n\u2022 Demonstrated success as a HR professional in emergency response, conflict zones and\/or humanitarian aid sector preferred.\n\n\u2022 Demonstrated success in supporting key senior management and building strong, trusted relationships.\n\n\u2022 Proven track-record of excellent management and leadership skills including capacity-building, coaching, mentoring, performance management and delivering individual and group training.\n\n\u2022 Strong collaborator with effective interpersonal and analytical skills who can work seamlessly across countries, cultures, and organizational units required.\n\n\u2022 Demonstrated ability to work, manage, and meet competing deadlines in a fast-paced, high-volume environment and on deadline; aptitude for problem solving and decision making needed\n\n\u2022 I\/NGO experience required.\n\n\u2022 English and Arabic are required\n\n\u2022 25% travel to the field (Syria and T\u00fcrkiye) and attending regional\/global workshops and meetings\n\n**Standard of Professional Conduct:** The IRC and the IRC workers must adhere to the values and principles outlined in the IRC Way \u2013 our Code of Conduct. These are Integrity, Service, Accountability, and Equality.\n\n \n**Commitment to Gender, Equality, Diversity, and Inclusion:** The IRC is committed to creating a diverse, inclusive, respectful, and safe work environment where all persons are treated fairly, with dignity and respect. The IRC expressly prohibits and will not tolerate discrimination, harassment, retaliation, or bullying of the IRC persons in any work setting. We aim to increase the representation of women, people that are from country and communities we serve, and people who identify as races and ethnicities that are under-represented in global power structures.", - "career_categories": [ - { - "id": "6863", - "name": "Human Resources" - } - ], - "city": "Amman", - "country": [ - { - "id": "129", - "name": "Jordan" - } - ], - "how_to_apply": "https:\/\/careers.rescue.org\/us\/en\/job\/req52467\/Human-Resources-Director", - "job_type": [ - { - "id": "263", - "name": "Job" - } - ], - "job_experience": [ - { - "id": "260", - "name": "5-9 years" - } - ], - "source": [ - { - "id": "2012", - "name": "International Rescue Committee" - } - ], - "theme": [], - "_id": "4071448" -} diff --git a/html/modules/custom/reliefweb_semantic/src/Services/ReliefWebSemanticService.php b/html/modules/custom/reliefweb_semantic/src/Services/ReliefWebSemanticService.php new file mode 100644 index 000000000..ef89a961a --- /dev/null +++ b/html/modules/custom/reliefweb_semantic/src/Services/ReliefWebSemanticService.php @@ -0,0 +1,119 @@ + [ + 'vectorSearchConfiguration' => [ + 'numberOfResults' => 10, + ], + ], + ]; + + if (!empty($filters)) { + if (count($filters) == 1) { + $key = reset(array_keys($filters)); + $value = reset($filters); + $kb_filter = [ + 'retrievalConfiguration' => [ + 'vectorSearchConfiguration' => [ + 'filter' => [ + 'in' => [ + 'key' => $key, + 'value' => explode(',', $value), + ], + ], + 'numberOfResults' => 10, + ], + ], + ]; + } + else { + $all_filters = []; + foreach ($filters as $key => $value) { + $all_filters[] = [ + 'in' => [ + 'key' => $key, + 'value' => explode(',', $value), + ], + ]; + } + + $kb_filter = [ + 'retrievalConfiguration' => [ + 'vectorSearchConfiguration' => [ + 'numberOfResults' => 10, + 'overrideSearchType' => 'HYBRID', + 'filter' => [ + 'andAll' => $all_filters, + ], + ], + ], + ]; + } + } + + $br_options = [ + 'knowledgeBaseId' => $id, + 'retrievalQuery' => [ + 'text' => $q, + ], + ] + $kb_filter; + + $result = $bedrock->retrieve($br_options); + + $result = $result->toArray()['retrievalResults'] ?? []; + $data = []; + + foreach ($result as $item) { + $data[$item['metadata']['nid']] = [ + 'id' => $item['metadata']['nid'], + 'title' => $item['metadata']['title'], + 'score' => $item['score'], + 'file' => $item['location']['s3Location']['uri'], + 'theme' => $item['metadata']['theme'] ?? [], + 'country' => $item['metadata']['country'] ?? [], + ]; + } + + return $data; + } + +} From df456fa34145192e5fee70b5d250dbc881c0c16a Mon Sep 17 00:00:00 2001 From: "Peter Droogmans (attiks)" Date: Tue, 3 Sep 2024 11:34:46 +0200 Subject: [PATCH 13/25] feat: Lambda function --- lamda/.env.example | 3 + lamda/.gitignore | 2 + lamda/README.md | 7 + lamda/index.js | 47 ++ lamda/package-lock.json | 1363 +++++++++++++++++++++++++++++++++++++++ lamda/package.json | 15 + 6 files changed, 1437 insertions(+) create mode 100644 lamda/.env.example create mode 100644 lamda/.gitignore create mode 100644 lamda/README.md create mode 100644 lamda/index.js create mode 100644 lamda/package-lock.json create mode 100644 lamda/package.json diff --git a/lamda/.env.example b/lamda/.env.example new file mode 100644 index 000000000..b0fcaf1b9 --- /dev/null +++ b/lamda/.env.example @@ -0,0 +1,3 @@ +AWS_BEDROCK_ACCESS_KEY_ID="" +AWS_BEDROCK_SECRET_ACCESS_KEY="" +AWS_BEDROCK_REGION="us-east-1" diff --git a/lamda/.gitignore b/lamda/.gitignore new file mode 100644 index 000000000..6ed48a986 --- /dev/null +++ b/lamda/.gitignore @@ -0,0 +1,2 @@ +.env +node_modules diff --git a/lamda/README.md b/lamda/README.md new file mode 100644 index 000000000..8e234a463 --- /dev/null +++ b/lamda/README.md @@ -0,0 +1,7 @@ +# Lambda function for KB + +## Run + +```bash +nodejs --env-file=.env index.js +``` diff --git a/lamda/index.js b/lamda/index.js new file mode 100644 index 000000000..a4f119b88 --- /dev/null +++ b/lamda/index.js @@ -0,0 +1,47 @@ +import { + BedrockAgentRuntimeClient, + RetrieveCommand, +} from "@aws-sdk/client-bedrock-agent-runtime"; + + +const client = new BedrockAgentRuntimeClient({region: process.env.AWS_BEDROCK_REGION, + credentials:{ + secretAccessKey:process.env.AWS_BEDROCK_SECRET_ACCESS_KEY, + accessKeyId:process.env.AWS_BEDROCK_ACCESS_KEY_ID + } +}); + +const input = { + knowledgeBaseId: "VIEPSPYNSS", + retrievalQuery: { + text: "Are people starving in Kenya", + }, + retrievalConfiguration: { + vectorSearchConfiguration: { + numberOfResults: 10, + overrideSearchType: "HYBRID", + filter: { + andAll: [ + { + equals: { + key: "status", + value: "1" + }, + }, + { + listContains: { + key: "country", + value: "220" + } + } + ] + } + } + }, +}; + +const command = new RetrieveCommand(input); +const results = await client.send(command); +for (let row of results.retrievalResults) { + console.log(row); +} diff --git a/lamda/package-lock.json b/lamda/package-lock.json new file mode 100644 index 000000000..f8892ff1f --- /dev/null +++ b/lamda/package-lock.json @@ -0,0 +1,1363 @@ +{ + "name": "unocha-kb-lambda", + "version": "1.0.0", + "lockfileVersion": 3, + "requires": true, + "packages": { + "": { + "name": "unocha-kb-lambda", + "version": "1.0.0", + "license": "MIT", + "dependencies": { + "@aws-sdk/client-bedrock-agent-runtime": "^3.642.0" + } + }, + "node_modules/@aws-crypto/crc32": { + "version": "5.2.0", + "resolved": "https://registry.npmjs.org/@aws-crypto/crc32/-/crc32-5.2.0.tgz", + "integrity": "sha512-nLbCWqQNgUiwwtFsen1AdzAtvuLRsQS8rYgMuxCrdKf9kOssamGLuPwyTY9wyYblNr9+1XM8v6zoDTPPSIeANg==", + "license": "Apache-2.0", + "dependencies": { + "@aws-crypto/util": "^5.2.0", + "@aws-sdk/types": "^3.222.0", + "tslib": "^2.6.2" + }, + "engines": { + "node": ">=16.0.0" + } + }, + "node_modules/@aws-crypto/sha256-browser": { + "version": "5.2.0", + "resolved": "https://registry.npmjs.org/@aws-crypto/sha256-browser/-/sha256-browser-5.2.0.tgz", + "integrity": "sha512-AXfN/lGotSQwu6HNcEsIASo7kWXZ5HYWvfOmSNKDsEqC4OashTp8alTmaz+F7TC2L083SFv5RdB+qU3Vs1kZqw==", + "license": "Apache-2.0", + "dependencies": { + "@aws-crypto/sha256-js": "^5.2.0", + "@aws-crypto/supports-web-crypto": "^5.2.0", + "@aws-crypto/util": "^5.2.0", + "@aws-sdk/types": "^3.222.0", + "@aws-sdk/util-locate-window": "^3.0.0", + "@smithy/util-utf8": "^2.0.0", + "tslib": "^2.6.2" + } + }, + "node_modules/@aws-crypto/sha256-browser/node_modules/@smithy/is-array-buffer": { + "version": "2.2.0", + "resolved": "https://registry.npmjs.org/@smithy/is-array-buffer/-/is-array-buffer-2.2.0.tgz", + "integrity": "sha512-GGP3O9QFD24uGeAXYUjwSTXARoqpZykHadOmA8G5vfJPK0/DC67qa//0qvqrJzL1xc8WQWX7/yc7fwudjPHPhA==", + "license": "Apache-2.0", + "dependencies": { + "tslib": "^2.6.2" + }, + "engines": { + "node": ">=14.0.0" + } + }, + "node_modules/@aws-crypto/sha256-browser/node_modules/@smithy/util-buffer-from": { + "version": "2.2.0", + "resolved": "https://registry.npmjs.org/@smithy/util-buffer-from/-/util-buffer-from-2.2.0.tgz", + "integrity": "sha512-IJdWBbTcMQ6DA0gdNhh/BwrLkDR+ADW5Kr1aZmd4k3DIF6ezMV4R2NIAmT08wQJ3yUK82thHWmC/TnK/wpMMIA==", + "license": "Apache-2.0", + "dependencies": { + "@smithy/is-array-buffer": "^2.2.0", + "tslib": "^2.6.2" + }, + "engines": { + "node": ">=14.0.0" + } + }, + "node_modules/@aws-crypto/sha256-browser/node_modules/@smithy/util-utf8": { + "version": "2.3.0", + "resolved": "https://registry.npmjs.org/@smithy/util-utf8/-/util-utf8-2.3.0.tgz", + "integrity": "sha512-R8Rdn8Hy72KKcebgLiv8jQcQkXoLMOGGv5uI1/k0l+snqkOzQ1R0ChUBCxWMlBsFMekWjq0wRudIweFs7sKT5A==", + "license": "Apache-2.0", + "dependencies": { + "@smithy/util-buffer-from": "^2.2.0", + "tslib": "^2.6.2" + }, + "engines": { + "node": ">=14.0.0" + } + }, + "node_modules/@aws-crypto/sha256-js": { + "version": "5.2.0", + "resolved": "https://registry.npmjs.org/@aws-crypto/sha256-js/-/sha256-js-5.2.0.tgz", + "integrity": "sha512-FFQQyu7edu4ufvIZ+OadFpHHOt+eSTBaYaki44c+akjg7qZg9oOQeLlk77F6tSYqjDAFClrHJk9tMf0HdVyOvA==", + "license": "Apache-2.0", + "dependencies": { + "@aws-crypto/util": "^5.2.0", + "@aws-sdk/types": "^3.222.0", + "tslib": "^2.6.2" + }, + "engines": { + "node": ">=16.0.0" + } + }, + "node_modules/@aws-crypto/supports-web-crypto": { + "version": "5.2.0", + "resolved": "https://registry.npmjs.org/@aws-crypto/supports-web-crypto/-/supports-web-crypto-5.2.0.tgz", + "integrity": "sha512-iAvUotm021kM33eCdNfwIN//F77/IADDSs58i+MDaOqFrVjZo9bAal0NK7HurRuWLLpF1iLX7gbWrjHjeo+YFg==", + "license": "Apache-2.0", + "dependencies": { + "tslib": "^2.6.2" + } + }, + "node_modules/@aws-crypto/util": { + "version": "5.2.0", + "resolved": "https://registry.npmjs.org/@aws-crypto/util/-/util-5.2.0.tgz", + "integrity": "sha512-4RkU9EsI6ZpBve5fseQlGNUWKMa1RLPQ1dnjnQoe07ldfIzcsGb5hC5W0Dm7u423KWzawlrpbjXBrXCEv9zazQ==", + "license": "Apache-2.0", + "dependencies": { + "@aws-sdk/types": "^3.222.0", + "@smithy/util-utf8": "^2.0.0", + "tslib": "^2.6.2" + } + }, + "node_modules/@aws-crypto/util/node_modules/@smithy/is-array-buffer": { + "version": "2.2.0", + "resolved": "https://registry.npmjs.org/@smithy/is-array-buffer/-/is-array-buffer-2.2.0.tgz", + "integrity": "sha512-GGP3O9QFD24uGeAXYUjwSTXARoqpZykHadOmA8G5vfJPK0/DC67qa//0qvqrJzL1xc8WQWX7/yc7fwudjPHPhA==", + "license": "Apache-2.0", + "dependencies": { + "tslib": "^2.6.2" + }, + "engines": { + "node": ">=14.0.0" + } + }, + "node_modules/@aws-crypto/util/node_modules/@smithy/util-buffer-from": { + "version": "2.2.0", + "resolved": "https://registry.npmjs.org/@smithy/util-buffer-from/-/util-buffer-from-2.2.0.tgz", + "integrity": "sha512-IJdWBbTcMQ6DA0gdNhh/BwrLkDR+ADW5Kr1aZmd4k3DIF6ezMV4R2NIAmT08wQJ3yUK82thHWmC/TnK/wpMMIA==", + "license": "Apache-2.0", + "dependencies": { + "@smithy/is-array-buffer": "^2.2.0", + "tslib": "^2.6.2" + }, + "engines": { + "node": ">=14.0.0" + } + }, + "node_modules/@aws-crypto/util/node_modules/@smithy/util-utf8": { + "version": "2.3.0", + "resolved": "https://registry.npmjs.org/@smithy/util-utf8/-/util-utf8-2.3.0.tgz", + "integrity": "sha512-R8Rdn8Hy72KKcebgLiv8jQcQkXoLMOGGv5uI1/k0l+snqkOzQ1R0ChUBCxWMlBsFMekWjq0wRudIweFs7sKT5A==", + "license": "Apache-2.0", + "dependencies": { + "@smithy/util-buffer-from": "^2.2.0", + "tslib": "^2.6.2" + }, + "engines": { + "node": ">=14.0.0" + } + }, + "node_modules/@aws-sdk/client-bedrock-agent-runtime": { + "version": "3.642.0", + "resolved": "https://registry.npmjs.org/@aws-sdk/client-bedrock-agent-runtime/-/client-bedrock-agent-runtime-3.642.0.tgz", + "integrity": "sha512-SKVP5CGRvkNu9xNK7ZUm8I6DhLyq+wjC3Q8hFHxISmr/RTlaJBVGOLnakM9tE0BHGayC6xBQNSuDgBYBK2TfBg==", + "license": "Apache-2.0", + "dependencies": { + "@aws-crypto/sha256-browser": "5.2.0", + "@aws-crypto/sha256-js": "5.2.0", + "@aws-sdk/client-sso-oidc": "3.637.0", + "@aws-sdk/client-sts": "3.637.0", + "@aws-sdk/core": "3.635.0", + "@aws-sdk/credential-provider-node": "3.637.0", + "@aws-sdk/middleware-host-header": "3.620.0", + "@aws-sdk/middleware-logger": "3.609.0", + "@aws-sdk/middleware-recursion-detection": "3.620.0", + "@aws-sdk/middleware-user-agent": "3.637.0", + "@aws-sdk/region-config-resolver": "3.614.0", + "@aws-sdk/types": "3.609.0", + "@aws-sdk/util-endpoints": "3.637.0", + "@aws-sdk/util-user-agent-browser": "3.609.0", + "@aws-sdk/util-user-agent-node": "3.614.0", + "@smithy/config-resolver": "^3.0.5", + "@smithy/core": "^2.4.0", + "@smithy/eventstream-serde-browser": "^3.0.6", + "@smithy/eventstream-serde-config-resolver": "^3.0.3", + "@smithy/eventstream-serde-node": "^3.0.5", + "@smithy/fetch-http-handler": "^3.2.4", + "@smithy/hash-node": "^3.0.3", + "@smithy/invalid-dependency": "^3.0.3", + "@smithy/middleware-content-length": "^3.0.5", + "@smithy/middleware-endpoint": "^3.1.0", + "@smithy/middleware-retry": "^3.0.15", + "@smithy/middleware-serde": "^3.0.3", + "@smithy/middleware-stack": "^3.0.3", + "@smithy/node-config-provider": "^3.1.4", + "@smithy/node-http-handler": "^3.1.4", + "@smithy/protocol-http": "^4.1.0", + "@smithy/smithy-client": "^3.2.0", + "@smithy/types": "^3.3.0", + "@smithy/url-parser": "^3.0.3", + "@smithy/util-base64": "^3.0.0", + "@smithy/util-body-length-browser": "^3.0.0", + "@smithy/util-body-length-node": "^3.0.0", + "@smithy/util-defaults-mode-browser": "^3.0.15", + "@smithy/util-defaults-mode-node": "^3.0.15", + "@smithy/util-endpoints": "^2.0.5", + "@smithy/util-middleware": "^3.0.3", + "@smithy/util-retry": "^3.0.3", + "@smithy/util-utf8": "^3.0.0", + "tslib": "^2.6.2" + }, + "engines": { + "node": ">=16.0.0" + } + }, + "node_modules/@aws-sdk/client-sso": { + "version": "3.637.0", + "resolved": "https://registry.npmjs.org/@aws-sdk/client-sso/-/client-sso-3.637.0.tgz", + "integrity": "sha512-+KjLvgX5yJYROWo3TQuwBJlHCY0zz9PsLuEolmXQn0BVK1L/m9GteZHtd+rEdAoDGBpE0Xqjy1oz5+SmtsaRUw==", + "license": "Apache-2.0", + "dependencies": { + "@aws-crypto/sha256-browser": "5.2.0", + "@aws-crypto/sha256-js": "5.2.0", + "@aws-sdk/core": "3.635.0", + "@aws-sdk/middleware-host-header": "3.620.0", + "@aws-sdk/middleware-logger": "3.609.0", + "@aws-sdk/middleware-recursion-detection": "3.620.0", + "@aws-sdk/middleware-user-agent": "3.637.0", + "@aws-sdk/region-config-resolver": "3.614.0", + "@aws-sdk/types": "3.609.0", + "@aws-sdk/util-endpoints": "3.637.0", + "@aws-sdk/util-user-agent-browser": "3.609.0", + "@aws-sdk/util-user-agent-node": "3.614.0", + "@smithy/config-resolver": "^3.0.5", + "@smithy/core": "^2.4.0", + "@smithy/fetch-http-handler": "^3.2.4", + "@smithy/hash-node": "^3.0.3", + "@smithy/invalid-dependency": "^3.0.3", + "@smithy/middleware-content-length": "^3.0.5", + "@smithy/middleware-endpoint": "^3.1.0", + "@smithy/middleware-retry": "^3.0.15", + "@smithy/middleware-serde": "^3.0.3", + "@smithy/middleware-stack": "^3.0.3", + "@smithy/node-config-provider": "^3.1.4", + "@smithy/node-http-handler": "^3.1.4", + "@smithy/protocol-http": "^4.1.0", + "@smithy/smithy-client": "^3.2.0", + "@smithy/types": "^3.3.0", + "@smithy/url-parser": "^3.0.3", + "@smithy/util-base64": "^3.0.0", + "@smithy/util-body-length-browser": "^3.0.0", + "@smithy/util-body-length-node": "^3.0.0", + "@smithy/util-defaults-mode-browser": "^3.0.15", + "@smithy/util-defaults-mode-node": "^3.0.15", + "@smithy/util-endpoints": "^2.0.5", + "@smithy/util-middleware": "^3.0.3", + "@smithy/util-retry": "^3.0.3", + "@smithy/util-utf8": "^3.0.0", + "tslib": "^2.6.2" + }, + "engines": { + "node": ">=16.0.0" + } + }, + "node_modules/@aws-sdk/client-sso-oidc": { + "version": "3.637.0", + "resolved": "https://registry.npmjs.org/@aws-sdk/client-sso-oidc/-/client-sso-oidc-3.637.0.tgz", + "integrity": "sha512-27bHALN6Qb6m6KZmPvRieJ/QRlj1lyac/GT2Rn5kJpre8Mpp+yxrtvp3h9PjNBty4lCeFEENfY4dGNSozBuBcw==", + "license": "Apache-2.0", + "dependencies": { + "@aws-crypto/sha256-browser": "5.2.0", + "@aws-crypto/sha256-js": "5.2.0", + "@aws-sdk/core": "3.635.0", + "@aws-sdk/credential-provider-node": "3.637.0", + "@aws-sdk/middleware-host-header": "3.620.0", + "@aws-sdk/middleware-logger": "3.609.0", + "@aws-sdk/middleware-recursion-detection": "3.620.0", + "@aws-sdk/middleware-user-agent": "3.637.0", + "@aws-sdk/region-config-resolver": "3.614.0", + "@aws-sdk/types": "3.609.0", + "@aws-sdk/util-endpoints": "3.637.0", + "@aws-sdk/util-user-agent-browser": "3.609.0", + "@aws-sdk/util-user-agent-node": "3.614.0", + "@smithy/config-resolver": "^3.0.5", + "@smithy/core": "^2.4.0", + "@smithy/fetch-http-handler": "^3.2.4", + "@smithy/hash-node": "^3.0.3", + "@smithy/invalid-dependency": "^3.0.3", + "@smithy/middleware-content-length": "^3.0.5", + "@smithy/middleware-endpoint": "^3.1.0", + "@smithy/middleware-retry": "^3.0.15", + "@smithy/middleware-serde": "^3.0.3", + "@smithy/middleware-stack": "^3.0.3", + "@smithy/node-config-provider": "^3.1.4", + "@smithy/node-http-handler": "^3.1.4", + "@smithy/protocol-http": "^4.1.0", + "@smithy/smithy-client": "^3.2.0", + "@smithy/types": "^3.3.0", + "@smithy/url-parser": "^3.0.3", + "@smithy/util-base64": "^3.0.0", + "@smithy/util-body-length-browser": "^3.0.0", + "@smithy/util-body-length-node": "^3.0.0", + "@smithy/util-defaults-mode-browser": "^3.0.15", + "@smithy/util-defaults-mode-node": "^3.0.15", + "@smithy/util-endpoints": "^2.0.5", + "@smithy/util-middleware": "^3.0.3", + "@smithy/util-retry": "^3.0.3", + "@smithy/util-utf8": "^3.0.0", + "tslib": "^2.6.2" + }, + "engines": { + "node": ">=16.0.0" + }, + "peerDependencies": { + "@aws-sdk/client-sts": "^3.637.0" + } + }, + "node_modules/@aws-sdk/client-sts": { + "version": "3.637.0", + "resolved": "https://registry.npmjs.org/@aws-sdk/client-sts/-/client-sts-3.637.0.tgz", + "integrity": "sha512-xUi7x4qDubtA8QREtlblPuAcn91GS/09YVEY/RwU7xCY0aqGuFwgszAANlha4OUIqva8oVj2WO4gJuG+iaSnhw==", + "license": "Apache-2.0", + "dependencies": { + "@aws-crypto/sha256-browser": "5.2.0", + "@aws-crypto/sha256-js": "5.2.0", + "@aws-sdk/client-sso-oidc": "3.637.0", + "@aws-sdk/core": "3.635.0", + "@aws-sdk/credential-provider-node": "3.637.0", + "@aws-sdk/middleware-host-header": "3.620.0", + "@aws-sdk/middleware-logger": "3.609.0", + "@aws-sdk/middleware-recursion-detection": "3.620.0", + "@aws-sdk/middleware-user-agent": "3.637.0", + "@aws-sdk/region-config-resolver": "3.614.0", + "@aws-sdk/types": "3.609.0", + "@aws-sdk/util-endpoints": "3.637.0", + "@aws-sdk/util-user-agent-browser": "3.609.0", + "@aws-sdk/util-user-agent-node": "3.614.0", + "@smithy/config-resolver": "^3.0.5", + "@smithy/core": "^2.4.0", + "@smithy/fetch-http-handler": "^3.2.4", + "@smithy/hash-node": "^3.0.3", + "@smithy/invalid-dependency": "^3.0.3", + "@smithy/middleware-content-length": "^3.0.5", + "@smithy/middleware-endpoint": "^3.1.0", + "@smithy/middleware-retry": "^3.0.15", + "@smithy/middleware-serde": "^3.0.3", + "@smithy/middleware-stack": "^3.0.3", + "@smithy/node-config-provider": "^3.1.4", + "@smithy/node-http-handler": "^3.1.4", + "@smithy/protocol-http": "^4.1.0", + "@smithy/smithy-client": "^3.2.0", + "@smithy/types": "^3.3.0", + "@smithy/url-parser": "^3.0.3", + "@smithy/util-base64": "^3.0.0", + "@smithy/util-body-length-browser": "^3.0.0", + "@smithy/util-body-length-node": "^3.0.0", + "@smithy/util-defaults-mode-browser": "^3.0.15", + "@smithy/util-defaults-mode-node": "^3.0.15", + "@smithy/util-endpoints": "^2.0.5", + "@smithy/util-middleware": "^3.0.3", + "@smithy/util-retry": "^3.0.3", + "@smithy/util-utf8": "^3.0.0", + "tslib": "^2.6.2" + }, + "engines": { + "node": ">=16.0.0" + } + }, + "node_modules/@aws-sdk/core": { + "version": "3.635.0", + "resolved": "https://registry.npmjs.org/@aws-sdk/core/-/core-3.635.0.tgz", + "integrity": "sha512-i1x/E/sgA+liUE1XJ7rj1dhyXpAKO1UKFUcTTHXok2ARjWTvszHnSXMOsB77aPbmn0fUp1JTx2kHUAZ1LVt5Bg==", + "license": "Apache-2.0", + "dependencies": { + "@smithy/core": "^2.4.0", + "@smithy/node-config-provider": "^3.1.4", + "@smithy/property-provider": "^3.1.3", + "@smithy/protocol-http": "^4.1.0", + "@smithy/signature-v4": "^4.1.0", + "@smithy/smithy-client": "^3.2.0", + "@smithy/types": "^3.3.0", + "@smithy/util-middleware": "^3.0.3", + "fast-xml-parser": "4.4.1", + "tslib": "^2.6.2" + }, + "engines": { + "node": ">=16.0.0" + } + }, + "node_modules/@aws-sdk/credential-provider-env": { + "version": "3.620.1", + "resolved": "https://registry.npmjs.org/@aws-sdk/credential-provider-env/-/credential-provider-env-3.620.1.tgz", + "integrity": "sha512-ExuILJ2qLW5ZO+rgkNRj0xiAipKT16Rk77buvPP8csR7kkCflT/gXTyzRe/uzIiETTxM7tr8xuO9MP/DQXqkfg==", + "license": "Apache-2.0", + "dependencies": { + "@aws-sdk/types": "3.609.0", + "@smithy/property-provider": "^3.1.3", + "@smithy/types": "^3.3.0", + "tslib": "^2.6.2" + }, + "engines": { + "node": ">=16.0.0" + } + }, + "node_modules/@aws-sdk/credential-provider-http": { + "version": "3.635.0", + "resolved": "https://registry.npmjs.org/@aws-sdk/credential-provider-http/-/credential-provider-http-3.635.0.tgz", + "integrity": "sha512-iJyRgEjOCQlBMXqtwPLIKYc7Bsc6nqjrZybdMDenPDa+kmLg7xh8LxHsu9088e+2/wtLicE34FsJJIfzu3L82g==", + "license": "Apache-2.0", + "dependencies": { + "@aws-sdk/types": "3.609.0", + "@smithy/fetch-http-handler": "^3.2.4", + "@smithy/node-http-handler": "^3.1.4", + "@smithy/property-provider": "^3.1.3", + "@smithy/protocol-http": "^4.1.0", + "@smithy/smithy-client": "^3.2.0", + "@smithy/types": "^3.3.0", + "@smithy/util-stream": "^3.1.3", + "tslib": "^2.6.2" + }, + "engines": { + "node": ">=16.0.0" + } + }, + "node_modules/@aws-sdk/credential-provider-ini": { + "version": "3.637.0", + "resolved": "https://registry.npmjs.org/@aws-sdk/credential-provider-ini/-/credential-provider-ini-3.637.0.tgz", + "integrity": "sha512-h+PFCWfZ0Q3Dx84SppET/TFpcQHmxFW8/oV9ArEvMilw4EBN+IlxgbL0CnHwjHW64szcmrM0mbebjEfHf4FXmw==", + "license": "Apache-2.0", + "dependencies": { + "@aws-sdk/credential-provider-env": "3.620.1", + "@aws-sdk/credential-provider-http": "3.635.0", + "@aws-sdk/credential-provider-process": "3.620.1", + "@aws-sdk/credential-provider-sso": "3.637.0", + "@aws-sdk/credential-provider-web-identity": "3.621.0", + "@aws-sdk/types": "3.609.0", + "@smithy/credential-provider-imds": "^3.2.0", + "@smithy/property-provider": "^3.1.3", + "@smithy/shared-ini-file-loader": "^3.1.4", + "@smithy/types": "^3.3.0", + "tslib": "^2.6.2" + }, + "engines": { + "node": ">=16.0.0" + }, + "peerDependencies": { + "@aws-sdk/client-sts": "^3.637.0" + } + }, + "node_modules/@aws-sdk/credential-provider-node": { + "version": "3.637.0", + "resolved": "https://registry.npmjs.org/@aws-sdk/credential-provider-node/-/credential-provider-node-3.637.0.tgz", + "integrity": "sha512-yoEhoxJJfs7sPVQ6Is939BDQJZpZCoUgKr/ySse4YKOZ24t4VqgHA6+wV7rYh+7IW24Rd91UTvEzSuHYTlxlNA==", + "license": "Apache-2.0", + "dependencies": { + "@aws-sdk/credential-provider-env": "3.620.1", + "@aws-sdk/credential-provider-http": "3.635.0", + "@aws-sdk/credential-provider-ini": "3.637.0", + "@aws-sdk/credential-provider-process": "3.620.1", + "@aws-sdk/credential-provider-sso": "3.637.0", + "@aws-sdk/credential-provider-web-identity": "3.621.0", + "@aws-sdk/types": "3.609.0", + "@smithy/credential-provider-imds": "^3.2.0", + "@smithy/property-provider": "^3.1.3", + "@smithy/shared-ini-file-loader": "^3.1.4", + "@smithy/types": "^3.3.0", + "tslib": "^2.6.2" + }, + "engines": { + "node": ">=16.0.0" + } + }, + "node_modules/@aws-sdk/credential-provider-process": { + "version": "3.620.1", + "resolved": "https://registry.npmjs.org/@aws-sdk/credential-provider-process/-/credential-provider-process-3.620.1.tgz", + "integrity": "sha512-hWqFMidqLAkaV9G460+1at6qa9vySbjQKKc04p59OT7lZ5cO5VH5S4aI05e+m4j364MBROjjk2ugNvfNf/8ILg==", + "license": "Apache-2.0", + "dependencies": { + "@aws-sdk/types": "3.609.0", + "@smithy/property-provider": "^3.1.3", + "@smithy/shared-ini-file-loader": "^3.1.4", + "@smithy/types": "^3.3.0", + "tslib": "^2.6.2" + }, + "engines": { + "node": ">=16.0.0" + } + }, + "node_modules/@aws-sdk/credential-provider-sso": { + "version": "3.637.0", + "resolved": "https://registry.npmjs.org/@aws-sdk/credential-provider-sso/-/credential-provider-sso-3.637.0.tgz", + "integrity": "sha512-Mvz+h+e62/tl+dVikLafhv+qkZJ9RUb8l2YN/LeKMWkxQylPT83CPk9aimVhCV89zth1zpREArl97+3xsfgQvA==", + "license": "Apache-2.0", + "dependencies": { + "@aws-sdk/client-sso": "3.637.0", + "@aws-sdk/token-providers": "3.614.0", + "@aws-sdk/types": "3.609.0", + "@smithy/property-provider": "^3.1.3", + "@smithy/shared-ini-file-loader": "^3.1.4", + "@smithy/types": "^3.3.0", + "tslib": "^2.6.2" + }, + "engines": { + "node": ">=16.0.0" + } + }, + "node_modules/@aws-sdk/credential-provider-web-identity": { + "version": "3.621.0", + "resolved": "https://registry.npmjs.org/@aws-sdk/credential-provider-web-identity/-/credential-provider-web-identity-3.621.0.tgz", + "integrity": "sha512-w7ASSyfNvcx7+bYGep3VBgC3K6vEdLmlpjT7nSIHxxQf+WSdvy+HynwJosrpZax0sK5q0D1Jpn/5q+r5lwwW6w==", + "license": "Apache-2.0", + "dependencies": { + "@aws-sdk/types": "3.609.0", + "@smithy/property-provider": "^3.1.3", + "@smithy/types": "^3.3.0", + "tslib": "^2.6.2" + }, + "engines": { + "node": ">=16.0.0" + }, + "peerDependencies": { + "@aws-sdk/client-sts": "^3.621.0" + } + }, + "node_modules/@aws-sdk/middleware-host-header": { + "version": "3.620.0", + "resolved": "https://registry.npmjs.org/@aws-sdk/middleware-host-header/-/middleware-host-header-3.620.0.tgz", + "integrity": "sha512-VMtPEZwqYrII/oUkffYsNWY9PZ9xpNJpMgmyU0rlDQ25O1c0Hk3fJmZRe6pEkAJ0omD7kLrqGl1DUjQVxpd/Rg==", + "license": "Apache-2.0", + "dependencies": { + "@aws-sdk/types": "3.609.0", + "@smithy/protocol-http": "^4.1.0", + "@smithy/types": "^3.3.0", + "tslib": "^2.6.2" + }, + "engines": { + "node": ">=16.0.0" + } + }, + "node_modules/@aws-sdk/middleware-logger": { + "version": "3.609.0", + "resolved": "https://registry.npmjs.org/@aws-sdk/middleware-logger/-/middleware-logger-3.609.0.tgz", + "integrity": "sha512-S62U2dy4jMDhDFDK5gZ4VxFdWzCtLzwbYyFZx2uvPYTECkepLUfzLic2BHg2Qvtu4QjX+oGE3P/7fwaGIsGNuQ==", + "license": "Apache-2.0", + "dependencies": { + "@aws-sdk/types": "3.609.0", + "@smithy/types": "^3.3.0", + "tslib": "^2.6.2" + }, + "engines": { + "node": ">=16.0.0" + } + }, + "node_modules/@aws-sdk/middleware-recursion-detection": { + "version": "3.620.0", + "resolved": "https://registry.npmjs.org/@aws-sdk/middleware-recursion-detection/-/middleware-recursion-detection-3.620.0.tgz", + "integrity": "sha512-nh91S7aGK3e/o1ck64sA/CyoFw+gAYj2BDOnoNa6ouyCrVJED96ZXWbhye/fz9SgmNUZR2g7GdVpiLpMKZoI5w==", + "license": "Apache-2.0", + "dependencies": { + "@aws-sdk/types": "3.609.0", + "@smithy/protocol-http": "^4.1.0", + "@smithy/types": "^3.3.0", + "tslib": "^2.6.2" + }, + "engines": { + "node": ">=16.0.0" + } + }, + "node_modules/@aws-sdk/middleware-user-agent": { + "version": "3.637.0", + "resolved": "https://registry.npmjs.org/@aws-sdk/middleware-user-agent/-/middleware-user-agent-3.637.0.tgz", + "integrity": "sha512-EYo0NE9/da/OY8STDsK2LvM4kNa79DBsf4YVtaG4P5pZ615IeFsD8xOHZeuJmUrSMlVQ8ywPRX7WMucUybsKug==", + "license": "Apache-2.0", + "dependencies": { + "@aws-sdk/types": "3.609.0", + "@aws-sdk/util-endpoints": "3.637.0", + "@smithy/protocol-http": "^4.1.0", + "@smithy/types": "^3.3.0", + "tslib": "^2.6.2" + }, + "engines": { + "node": ">=16.0.0" + } + }, + "node_modules/@aws-sdk/region-config-resolver": { + "version": "3.614.0", + "resolved": "https://registry.npmjs.org/@aws-sdk/region-config-resolver/-/region-config-resolver-3.614.0.tgz", + "integrity": "sha512-vDCeMXvic/LU0KFIUjpC3RiSTIkkvESsEfbVHiHH0YINfl8HnEqR5rj+L8+phsCeVg2+LmYwYxd5NRz4PHxt5g==", + "license": "Apache-2.0", + "dependencies": { + "@aws-sdk/types": "3.609.0", + "@smithy/node-config-provider": "^3.1.4", + "@smithy/types": "^3.3.0", + "@smithy/util-config-provider": "^3.0.0", + "@smithy/util-middleware": "^3.0.3", + "tslib": "^2.6.2" + }, + "engines": { + "node": ">=16.0.0" + } + }, + "node_modules/@aws-sdk/token-providers": { + "version": "3.614.0", + "resolved": "https://registry.npmjs.org/@aws-sdk/token-providers/-/token-providers-3.614.0.tgz", + "integrity": "sha512-okItqyY6L9IHdxqs+Z116y5/nda7rHxLvROxtAJdLavWTYDydxrZstImNgGWTeVdmc0xX2gJCI77UYUTQWnhRw==", + "license": "Apache-2.0", + "dependencies": { + "@aws-sdk/types": "3.609.0", + "@smithy/property-provider": "^3.1.3", + "@smithy/shared-ini-file-loader": "^3.1.4", + "@smithy/types": "^3.3.0", + "tslib": "^2.6.2" + }, + "engines": { + "node": ">=16.0.0" + }, + "peerDependencies": { + "@aws-sdk/client-sso-oidc": "^3.614.0" + } + }, + "node_modules/@aws-sdk/types": { + "version": "3.609.0", + "resolved": "https://registry.npmjs.org/@aws-sdk/types/-/types-3.609.0.tgz", + "integrity": "sha512-+Tqnh9w0h2LcrUsdXyT1F8mNhXz+tVYBtP19LpeEGntmvHwa2XzvLUCWpoIAIVsHp5+HdB2X9Sn0KAtmbFXc2Q==", + "license": "Apache-2.0", + "dependencies": { + "@smithy/types": "^3.3.0", + "tslib": "^2.6.2" + }, + "engines": { + "node": ">=16.0.0" + } + }, + "node_modules/@aws-sdk/util-endpoints": { + "version": "3.637.0", + "resolved": "https://registry.npmjs.org/@aws-sdk/util-endpoints/-/util-endpoints-3.637.0.tgz", + "integrity": "sha512-pAqOKUHeVWHEXXDIp/qoMk/6jyxIb6GGjnK1/f8dKHtKIEs4tKsnnL563gceEvdad53OPXIt86uoevCcCzmBnw==", + "license": "Apache-2.0", + "dependencies": { + "@aws-sdk/types": "3.609.0", + "@smithy/types": "^3.3.0", + "@smithy/util-endpoints": "^2.0.5", + "tslib": "^2.6.2" + }, + "engines": { + "node": ">=16.0.0" + } + }, + "node_modules/@aws-sdk/util-locate-window": { + "version": "3.568.0", + "resolved": "https://registry.npmjs.org/@aws-sdk/util-locate-window/-/util-locate-window-3.568.0.tgz", + "integrity": "sha512-3nh4TINkXYr+H41QaPelCceEB2FXP3fxp93YZXB/kqJvX0U9j0N0Uk45gvsjmEPzG8XxkPEeLIfT2I1M7A6Lig==", + "license": "Apache-2.0", + "dependencies": { + "tslib": "^2.6.2" + }, + "engines": { + "node": ">=16.0.0" + } + }, + "node_modules/@aws-sdk/util-user-agent-browser": { + "version": "3.609.0", + "resolved": "https://registry.npmjs.org/@aws-sdk/util-user-agent-browser/-/util-user-agent-browser-3.609.0.tgz", + "integrity": "sha512-fojPU+mNahzQ0YHYBsx0ZIhmMA96H+ZIZ665ObU9tl+SGdbLneVZVikGve+NmHTQwHzwkFsZYYnVKAkreJLAtA==", + "license": "Apache-2.0", + "dependencies": { + "@aws-sdk/types": "3.609.0", + "@smithy/types": "^3.3.0", + "bowser": "^2.11.0", + "tslib": "^2.6.2" + } + }, + "node_modules/@aws-sdk/util-user-agent-node": { + "version": "3.614.0", + "resolved": "https://registry.npmjs.org/@aws-sdk/util-user-agent-node/-/util-user-agent-node-3.614.0.tgz", + "integrity": "sha512-15ElZT88peoHnq5TEoEtZwoXTXRxNrk60TZNdpl/TUBJ5oNJ9Dqb5Z4ryb8ofN6nm9aFf59GVAerFDz8iUoHBA==", + "license": "Apache-2.0", + "dependencies": { + "@aws-sdk/types": "3.609.0", + "@smithy/node-config-provider": "^3.1.4", + "@smithy/types": "^3.3.0", + "tslib": "^2.6.2" + }, + "engines": { + "node": ">=16.0.0" + }, + "peerDependencies": { + "aws-crt": ">=1.0.0" + }, + "peerDependenciesMeta": { + "aws-crt": { + "optional": true + } + } + }, + "node_modules/@smithy/abort-controller": { + "version": "3.1.1", + "resolved": "https://registry.npmjs.org/@smithy/abort-controller/-/abort-controller-3.1.1.tgz", + "integrity": "sha512-MBJBiidoe+0cTFhyxT8g+9g7CeVccLM0IOKKUMCNQ1CNMJ/eIfoo0RTfVrXOONEI1UCN1W+zkiHSbzUNE9dZtQ==", + "license": "Apache-2.0", + "dependencies": { + "@smithy/types": "^3.3.0", + "tslib": "^2.6.2" + }, + "engines": { + "node": ">=16.0.0" + } + }, + "node_modules/@smithy/config-resolver": { + "version": "3.0.5", + "resolved": "https://registry.npmjs.org/@smithy/config-resolver/-/config-resolver-3.0.5.tgz", + "integrity": "sha512-SkW5LxfkSI1bUC74OtfBbdz+grQXYiPYolyu8VfpLIjEoN/sHVBlLeGXMQ1vX4ejkgfv6sxVbQJ32yF2cl1veA==", + "license": "Apache-2.0", + "dependencies": { + "@smithy/node-config-provider": "^3.1.4", + "@smithy/types": "^3.3.0", + "@smithy/util-config-provider": "^3.0.0", + "@smithy/util-middleware": "^3.0.3", + "tslib": "^2.6.2" + }, + "engines": { + "node": ">=16.0.0" + } + }, + "node_modules/@smithy/core": { + "version": "2.4.0", + "resolved": "https://registry.npmjs.org/@smithy/core/-/core-2.4.0.tgz", + "integrity": "sha512-cHXq+FneIF/KJbt4q4pjN186+Jf4ZB0ZOqEaZMBhT79srEyGDDBV31NqBRBjazz8ppQ1bJbDJMY9ba5wKFV36w==", + "license": "Apache-2.0", + "dependencies": { + "@smithy/middleware-endpoint": "^3.1.0", + "@smithy/middleware-retry": "^3.0.15", + "@smithy/middleware-serde": "^3.0.3", + "@smithy/protocol-http": "^4.1.0", + "@smithy/smithy-client": "^3.2.0", + "@smithy/types": "^3.3.0", + "@smithy/util-body-length-browser": "^3.0.0", + "@smithy/util-middleware": "^3.0.3", + "@smithy/util-utf8": "^3.0.0", + "tslib": "^2.6.2" + }, + "engines": { + "node": ">=16.0.0" + } + }, + "node_modules/@smithy/credential-provider-imds": { + "version": "3.2.0", + "resolved": "https://registry.npmjs.org/@smithy/credential-provider-imds/-/credential-provider-imds-3.2.0.tgz", + "integrity": "sha512-0SCIzgd8LYZ9EJxUjLXBmEKSZR/P/w6l7Rz/pab9culE/RWuqelAKGJvn5qUOl8BgX8Yj5HWM50A5hiB/RzsgA==", + "license": "Apache-2.0", + "dependencies": { + "@smithy/node-config-provider": "^3.1.4", + "@smithy/property-provider": "^3.1.3", + "@smithy/types": "^3.3.0", + "@smithy/url-parser": "^3.0.3", + "tslib": "^2.6.2" + }, + "engines": { + "node": ">=16.0.0" + } + }, + "node_modules/@smithy/eventstream-codec": { + "version": "3.1.2", + "resolved": "https://registry.npmjs.org/@smithy/eventstream-codec/-/eventstream-codec-3.1.2.tgz", + "integrity": "sha512-0mBcu49JWt4MXhrhRAlxASNy0IjDRFU+aWNDRal9OtUJvJNiwDuyKMUONSOjLjSCeGwZaE0wOErdqULer8r7yw==", + "license": "Apache-2.0", + "dependencies": { + "@aws-crypto/crc32": "5.2.0", + "@smithy/types": "^3.3.0", + "@smithy/util-hex-encoding": "^3.0.0", + "tslib": "^2.6.2" + } + }, + "node_modules/@smithy/eventstream-serde-browser": { + "version": "3.0.6", + "resolved": "https://registry.npmjs.org/@smithy/eventstream-serde-browser/-/eventstream-serde-browser-3.0.6.tgz", + "integrity": "sha512-2hM54UWQUOrki4BtsUI1WzmD13/SeaqT/AB3EUJKbcver/WgKNaiJ5y5F5XXuVe6UekffVzuUDrBZVAA3AWRpQ==", + "license": "Apache-2.0", + "dependencies": { + "@smithy/eventstream-serde-universal": "^3.0.5", + "@smithy/types": "^3.3.0", + "tslib": "^2.6.2" + }, + "engines": { + "node": ">=16.0.0" + } + }, + "node_modules/@smithy/eventstream-serde-config-resolver": { + "version": "3.0.3", + "resolved": "https://registry.npmjs.org/@smithy/eventstream-serde-config-resolver/-/eventstream-serde-config-resolver-3.0.3.tgz", + "integrity": "sha512-NVTYjOuYpGfrN/VbRQgn31x73KDLfCXCsFdad8DiIc3IcdxL+dYA9zEQPyOP7Fy2QL8CPy2WE4WCUD+ZsLNfaQ==", + "license": "Apache-2.0", + "dependencies": { + "@smithy/types": "^3.3.0", + "tslib": "^2.6.2" + }, + "engines": { + "node": ">=16.0.0" + } + }, + "node_modules/@smithy/eventstream-serde-node": { + "version": "3.0.5", + "resolved": "https://registry.npmjs.org/@smithy/eventstream-serde-node/-/eventstream-serde-node-3.0.5.tgz", + "integrity": "sha512-+upXvnHNyZP095s11jF5dhGw/Ihzqwl5G+/KtMnoQOpdfC3B5HYCcDVG9EmgkhJMXJlM64PyN5gjJl0uXFQehQ==", + "license": "Apache-2.0", + "dependencies": { + "@smithy/eventstream-serde-universal": "^3.0.5", + "@smithy/types": "^3.3.0", + "tslib": "^2.6.2" + }, + "engines": { + "node": ">=16.0.0" + } + }, + "node_modules/@smithy/eventstream-serde-universal": { + "version": "3.0.5", + "resolved": "https://registry.npmjs.org/@smithy/eventstream-serde-universal/-/eventstream-serde-universal-3.0.5.tgz", + "integrity": "sha512-5u/nXbyoh1s4QxrvNre9V6vfyoLWuiVvvd5TlZjGThIikc3G+uNiG9uOTCWweSRjv1asdDIWK7nOmN7le4RYHQ==", + "license": "Apache-2.0", + "dependencies": { + "@smithy/eventstream-codec": "^3.1.2", + "@smithy/types": "^3.3.0", + "tslib": "^2.6.2" + }, + "engines": { + "node": ">=16.0.0" + } + }, + "node_modules/@smithy/fetch-http-handler": { + "version": "3.2.4", + "resolved": "https://registry.npmjs.org/@smithy/fetch-http-handler/-/fetch-http-handler-3.2.4.tgz", + "integrity": "sha512-kBprh5Gs5h7ug4nBWZi1FZthdqSM+T7zMmsZxx0IBvWUn7dK3diz2SHn7Bs4dQGFDk8plDv375gzenDoNwrXjg==", + "license": "Apache-2.0", + "dependencies": { + "@smithy/protocol-http": "^4.1.0", + "@smithy/querystring-builder": "^3.0.3", + "@smithy/types": "^3.3.0", + "@smithy/util-base64": "^3.0.0", + "tslib": "^2.6.2" + } + }, + "node_modules/@smithy/hash-node": { + "version": "3.0.3", + "resolved": "https://registry.npmjs.org/@smithy/hash-node/-/hash-node-3.0.3.tgz", + "integrity": "sha512-2ctBXpPMG+B3BtWSGNnKELJ7SH9e4TNefJS0cd2eSkOOROeBnnVBnAy9LtJ8tY4vUEoe55N4CNPxzbWvR39iBw==", + "license": "Apache-2.0", + "dependencies": { + "@smithy/types": "^3.3.0", + "@smithy/util-buffer-from": "^3.0.0", + "@smithy/util-utf8": "^3.0.0", + "tslib": "^2.6.2" + }, + "engines": { + "node": ">=16.0.0" + } + }, + "node_modules/@smithy/invalid-dependency": { + "version": "3.0.3", + "resolved": "https://registry.npmjs.org/@smithy/invalid-dependency/-/invalid-dependency-3.0.3.tgz", + "integrity": "sha512-ID1eL/zpDULmHJbflb864k72/SNOZCADRc9i7Exq3RUNJw6raWUSlFEQ+3PX3EYs++bTxZB2dE9mEHTQLv61tw==", + "license": "Apache-2.0", + "dependencies": { + "@smithy/types": "^3.3.0", + "tslib": "^2.6.2" + } + }, + "node_modules/@smithy/is-array-buffer": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/@smithy/is-array-buffer/-/is-array-buffer-3.0.0.tgz", + "integrity": "sha512-+Fsu6Q6C4RSJiy81Y8eApjEB5gVtM+oFKTffg+jSuwtvomJJrhUJBu2zS8wjXSgH/g1MKEWrzyChTBe6clb5FQ==", + "license": "Apache-2.0", + "dependencies": { + "tslib": "^2.6.2" + }, + "engines": { + "node": ">=16.0.0" + } + }, + "node_modules/@smithy/middleware-content-length": { + "version": "3.0.5", + "resolved": "https://registry.npmjs.org/@smithy/middleware-content-length/-/middleware-content-length-3.0.5.tgz", + "integrity": "sha512-ILEzC2eyxx6ncej3zZSwMpB5RJ0zuqH7eMptxC4KN3f+v9bqT8ohssKbhNR78k/2tWW+KS5Spw+tbPF4Ejyqvw==", + "license": "Apache-2.0", + "dependencies": { + "@smithy/protocol-http": "^4.1.0", + "@smithy/types": "^3.3.0", + "tslib": "^2.6.2" + }, + "engines": { + "node": ">=16.0.0" + } + }, + "node_modules/@smithy/middleware-endpoint": { + "version": "3.1.0", + "resolved": "https://registry.npmjs.org/@smithy/middleware-endpoint/-/middleware-endpoint-3.1.0.tgz", + "integrity": "sha512-5y5aiKCEwg9TDPB4yFE7H6tYvGFf1OJHNczeY10/EFF8Ir8jZbNntQJxMWNfeQjC1mxPsaQ6mR9cvQbf+0YeMw==", + "license": "Apache-2.0", + "dependencies": { + "@smithy/middleware-serde": "^3.0.3", + "@smithy/node-config-provider": "^3.1.4", + "@smithy/shared-ini-file-loader": "^3.1.4", + "@smithy/types": "^3.3.0", + "@smithy/url-parser": "^3.0.3", + "@smithy/util-middleware": "^3.0.3", + "tslib": "^2.6.2" + }, + "engines": { + "node": ">=16.0.0" + } + }, + "node_modules/@smithy/middleware-retry": { + "version": "3.0.15", + "resolved": "https://registry.npmjs.org/@smithy/middleware-retry/-/middleware-retry-3.0.15.tgz", + "integrity": "sha512-iTMedvNt1ApdvkaoE8aSDuwaoc+BhvHqttbA/FO4Ty+y/S5hW6Ci/CTScG7vam4RYJWZxdTElc3MEfHRVH6cgQ==", + "license": "Apache-2.0", + "dependencies": { + "@smithy/node-config-provider": "^3.1.4", + "@smithy/protocol-http": "^4.1.0", + "@smithy/service-error-classification": "^3.0.3", + "@smithy/smithy-client": "^3.2.0", + "@smithy/types": "^3.3.0", + "@smithy/util-middleware": "^3.0.3", + "@smithy/util-retry": "^3.0.3", + "tslib": "^2.6.2", + "uuid": "^9.0.1" + }, + "engines": { + "node": ">=16.0.0" + } + }, + "node_modules/@smithy/middleware-retry/node_modules/uuid": { + "version": "9.0.1", + "resolved": "https://registry.npmjs.org/uuid/-/uuid-9.0.1.tgz", + "integrity": "sha512-b+1eJOlsR9K8HJpow9Ok3fiWOWSIcIzXodvv0rQjVoOVNpWMpxf1wZNpt4y9h10odCNrqnYp1OBzRktckBe3sA==", + "funding": [ + "https://github.com/sponsors/broofa", + "https://github.com/sponsors/ctavan" + ], + "license": "MIT", + "bin": { + "uuid": "dist/bin/uuid" + } + }, + "node_modules/@smithy/middleware-serde": { + "version": "3.0.3", + "resolved": "https://registry.npmjs.org/@smithy/middleware-serde/-/middleware-serde-3.0.3.tgz", + "integrity": "sha512-puUbyJQBcg9eSErFXjKNiGILJGtiqmuuNKEYNYfUD57fUl4i9+mfmThtQhvFXU0hCVG0iEJhvQUipUf+/SsFdA==", + "license": "Apache-2.0", + "dependencies": { + "@smithy/types": "^3.3.0", + "tslib": "^2.6.2" + }, + "engines": { + "node": ">=16.0.0" + } + }, + "node_modules/@smithy/middleware-stack": { + "version": "3.0.3", + "resolved": "https://registry.npmjs.org/@smithy/middleware-stack/-/middleware-stack-3.0.3.tgz", + "integrity": "sha512-r4klY9nFudB0r9UdSMaGSyjyQK5adUyPnQN/ZM6M75phTxOdnc/AhpvGD1fQUvgmqjQEBGCwpnPbDm8pH5PapA==", + "license": "Apache-2.0", + "dependencies": { + "@smithy/types": "^3.3.0", + "tslib": "^2.6.2" + }, + "engines": { + "node": ">=16.0.0" + } + }, + "node_modules/@smithy/node-config-provider": { + "version": "3.1.4", + "resolved": "https://registry.npmjs.org/@smithy/node-config-provider/-/node-config-provider-3.1.4.tgz", + "integrity": "sha512-YvnElQy8HR4vDcAjoy7Xkx9YT8xZP4cBXcbJSgm/kxmiQu08DwUwj8rkGnyoJTpfl/3xYHH+d8zE+eHqoDCSdQ==", + "license": "Apache-2.0", + "dependencies": { + "@smithy/property-provider": "^3.1.3", + "@smithy/shared-ini-file-loader": "^3.1.4", + "@smithy/types": "^3.3.0", + "tslib": "^2.6.2" + }, + "engines": { + "node": ">=16.0.0" + } + }, + "node_modules/@smithy/node-http-handler": { + "version": "3.1.4", + "resolved": "https://registry.npmjs.org/@smithy/node-http-handler/-/node-http-handler-3.1.4.tgz", + "integrity": "sha512-+UmxgixgOr/yLsUxcEKGH0fMNVteJFGkmRltYFHnBMlogyFdpzn2CwqWmxOrfJELhV34v0WSlaqG1UtE1uXlJg==", + "license": "Apache-2.0", + "dependencies": { + "@smithy/abort-controller": "^3.1.1", + "@smithy/protocol-http": "^4.1.0", + "@smithy/querystring-builder": "^3.0.3", + "@smithy/types": "^3.3.0", + "tslib": "^2.6.2" + }, + "engines": { + "node": ">=16.0.0" + } + }, + "node_modules/@smithy/property-provider": { + "version": "3.1.3", + "resolved": "https://registry.npmjs.org/@smithy/property-provider/-/property-provider-3.1.3.tgz", + "integrity": "sha512-zahyOVR9Q4PEoguJ/NrFP4O7SMAfYO1HLhB18M+q+Z4KFd4V2obiMnlVoUFzFLSPeVt1POyNWneHHrZaTMoc/g==", + "license": "Apache-2.0", + "dependencies": { + "@smithy/types": "^3.3.0", + "tslib": "^2.6.2" + }, + "engines": { + "node": ">=16.0.0" + } + }, + "node_modules/@smithy/protocol-http": { + "version": "4.1.0", + "resolved": "https://registry.npmjs.org/@smithy/protocol-http/-/protocol-http-4.1.0.tgz", + "integrity": "sha512-dPVoHYQ2wcHooGXg3LQisa1hH0e4y0pAddPMeeUPipI1tEOqL6A4N0/G7abeq+K8wrwSgjk4C0wnD1XZpJm5aA==", + "license": "Apache-2.0", + "dependencies": { + "@smithy/types": "^3.3.0", + "tslib": "^2.6.2" + }, + "engines": { + "node": ">=16.0.0" + } + }, + "node_modules/@smithy/querystring-builder": { + "version": "3.0.3", + "resolved": "https://registry.npmjs.org/@smithy/querystring-builder/-/querystring-builder-3.0.3.tgz", + "integrity": "sha512-vyWckeUeesFKzCDaRwWLUA1Xym9McaA6XpFfAK5qI9DKJ4M33ooQGqvM4J+LalH4u/Dq9nFiC8U6Qn1qi0+9zw==", + "license": "Apache-2.0", + "dependencies": { + "@smithy/types": "^3.3.0", + "@smithy/util-uri-escape": "^3.0.0", + "tslib": "^2.6.2" + }, + "engines": { + "node": ">=16.0.0" + } + }, + "node_modules/@smithy/querystring-parser": { + "version": "3.0.3", + "resolved": "https://registry.npmjs.org/@smithy/querystring-parser/-/querystring-parser-3.0.3.tgz", + "integrity": "sha512-zahM1lQv2YjmznnfQsWbYojFe55l0SLG/988brlLv1i8z3dubloLF+75ATRsqPBboUXsW6I9CPGE5rQgLfY0vQ==", + "license": "Apache-2.0", + "dependencies": { + "@smithy/types": "^3.3.0", + "tslib": "^2.6.2" + }, + "engines": { + "node": ">=16.0.0" + } + }, + "node_modules/@smithy/service-error-classification": { + "version": "3.0.3", + "resolved": "https://registry.npmjs.org/@smithy/service-error-classification/-/service-error-classification-3.0.3.tgz", + "integrity": "sha512-Jn39sSl8cim/VlkLsUhRFq/dKDnRUFlfRkvhOJaUbLBXUsLRLNf9WaxDv/z9BjuQ3A6k/qE8af1lsqcwm7+DaQ==", + "license": "Apache-2.0", + "dependencies": { + "@smithy/types": "^3.3.0" + }, + "engines": { + "node": ">=16.0.0" + } + }, + "node_modules/@smithy/shared-ini-file-loader": { + "version": "3.1.4", + "resolved": "https://registry.npmjs.org/@smithy/shared-ini-file-loader/-/shared-ini-file-loader-3.1.4.tgz", + "integrity": "sha512-qMxS4hBGB8FY2GQqshcRUy1K6k8aBWP5vwm8qKkCT3A9K2dawUwOIJfqh9Yste/Bl0J2lzosVyrXDj68kLcHXQ==", + "license": "Apache-2.0", + "dependencies": { + "@smithy/types": "^3.3.0", + "tslib": "^2.6.2" + }, + "engines": { + "node": ">=16.0.0" + } + }, + "node_modules/@smithy/signature-v4": { + "version": "4.1.0", + "resolved": "https://registry.npmjs.org/@smithy/signature-v4/-/signature-v4-4.1.0.tgz", + "integrity": "sha512-aRryp2XNZeRcOtuJoxjydO6QTaVhxx/vjaR+gx7ZjaFgrgPRyZ3HCTbfwqYj6ZWEBHkCSUfcaymKPURaByukag==", + "license": "Apache-2.0", + "dependencies": { + "@smithy/is-array-buffer": "^3.0.0", + "@smithy/protocol-http": "^4.1.0", + "@smithy/types": "^3.3.0", + "@smithy/util-hex-encoding": "^3.0.0", + "@smithy/util-middleware": "^3.0.3", + "@smithy/util-uri-escape": "^3.0.0", + "@smithy/util-utf8": "^3.0.0", + "tslib": "^2.6.2" + }, + "engines": { + "node": ">=16.0.0" + } + }, + "node_modules/@smithy/smithy-client": { + "version": "3.2.0", + "resolved": "https://registry.npmjs.org/@smithy/smithy-client/-/smithy-client-3.2.0.tgz", + "integrity": "sha512-pDbtxs8WOhJLJSeaF/eAbPgXg4VVYFlRcL/zoNYA5WbG3wBL06CHtBSg53ppkttDpAJ/hdiede+xApip1CwSLw==", + "license": "Apache-2.0", + "dependencies": { + "@smithy/middleware-endpoint": "^3.1.0", + "@smithy/middleware-stack": "^3.0.3", + "@smithy/protocol-http": "^4.1.0", + "@smithy/types": "^3.3.0", + "@smithy/util-stream": "^3.1.3", + "tslib": "^2.6.2" + }, + "engines": { + "node": ">=16.0.0" + } + }, + "node_modules/@smithy/types": { + "version": "3.3.0", + "resolved": "https://registry.npmjs.org/@smithy/types/-/types-3.3.0.tgz", + "integrity": "sha512-IxvBBCTFDHbVoK7zIxqA1ZOdc4QfM5HM7rGleCuHi7L1wnKv5Pn69xXJQ9hgxH60ZVygH9/JG0jRgtUncE3QUA==", + "license": "Apache-2.0", + "dependencies": { + "tslib": "^2.6.2" + }, + "engines": { + "node": ">=16.0.0" + } + }, + "node_modules/@smithy/url-parser": { + "version": "3.0.3", + "resolved": "https://registry.npmjs.org/@smithy/url-parser/-/url-parser-3.0.3.tgz", + "integrity": "sha512-pw3VtZtX2rg+s6HMs6/+u9+hu6oY6U7IohGhVNnjbgKy86wcIsSZwgHrFR+t67Uyxvp4Xz3p3kGXXIpTNisq8A==", + "license": "Apache-2.0", + "dependencies": { + "@smithy/querystring-parser": "^3.0.3", + "@smithy/types": "^3.3.0", + "tslib": "^2.6.2" + } + }, + "node_modules/@smithy/util-base64": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/@smithy/util-base64/-/util-base64-3.0.0.tgz", + "integrity": "sha512-Kxvoh5Qtt0CDsfajiZOCpJxgtPHXOKwmM+Zy4waD43UoEMA+qPxxa98aE/7ZhdnBFZFXMOiBR5xbcaMhLtznQQ==", + "license": "Apache-2.0", + "dependencies": { + "@smithy/util-buffer-from": "^3.0.0", + "@smithy/util-utf8": "^3.0.0", + "tslib": "^2.6.2" + }, + "engines": { + "node": ">=16.0.0" + } + }, + "node_modules/@smithy/util-body-length-browser": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/@smithy/util-body-length-browser/-/util-body-length-browser-3.0.0.tgz", + "integrity": "sha512-cbjJs2A1mLYmqmyVl80uoLTJhAcfzMOyPgjwAYusWKMdLeNtzmMz9YxNl3/jRLoxSS3wkqkf0jwNdtXWtyEBaQ==", + "license": "Apache-2.0", + "dependencies": { + "tslib": "^2.6.2" + } + }, + "node_modules/@smithy/util-body-length-node": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/@smithy/util-body-length-node/-/util-body-length-node-3.0.0.tgz", + "integrity": "sha512-Tj7pZ4bUloNUP6PzwhN7K386tmSmEET9QtQg0TgdNOnxhZvCssHji+oZTUIuzxECRfG8rdm2PMw2WCFs6eIYkA==", + "license": "Apache-2.0", + "dependencies": { + "tslib": "^2.6.2" + }, + "engines": { + "node": ">=16.0.0" + } + }, + "node_modules/@smithy/util-buffer-from": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/@smithy/util-buffer-from/-/util-buffer-from-3.0.0.tgz", + "integrity": "sha512-aEOHCgq5RWFbP+UDPvPot26EJHjOC+bRgse5A8V3FSShqd5E5UN4qc7zkwsvJPPAVsf73QwYcHN1/gt/rtLwQA==", + "license": "Apache-2.0", + "dependencies": { + "@smithy/is-array-buffer": "^3.0.0", + "tslib": "^2.6.2" + }, + "engines": { + "node": ">=16.0.0" + } + }, + "node_modules/@smithy/util-config-provider": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/@smithy/util-config-provider/-/util-config-provider-3.0.0.tgz", + "integrity": "sha512-pbjk4s0fwq3Di/ANL+rCvJMKM5bzAQdE5S/6RL5NXgMExFAi6UgQMPOm5yPaIWPpr+EOXKXRonJ3FoxKf4mCJQ==", + "license": "Apache-2.0", + "dependencies": { + "tslib": "^2.6.2" + }, + "engines": { + "node": ">=16.0.0" + } + }, + "node_modules/@smithy/util-defaults-mode-browser": { + "version": "3.0.15", + "resolved": "https://registry.npmjs.org/@smithy/util-defaults-mode-browser/-/util-defaults-mode-browser-3.0.15.tgz", + "integrity": "sha512-FZ4Psa3vjp8kOXcd3HJOiDPBCWtiilLl57r0cnNtq/Ga9RSDrM5ERL6xt+tO43+2af6Pn5Yp92x2n5vPuduNfg==", + "license": "Apache-2.0", + "dependencies": { + "@smithy/property-provider": "^3.1.3", + "@smithy/smithy-client": "^3.2.0", + "@smithy/types": "^3.3.0", + "bowser": "^2.11.0", + "tslib": "^2.6.2" + }, + "engines": { + "node": ">= 10.0.0" + } + }, + "node_modules/@smithy/util-defaults-mode-node": { + "version": "3.0.15", + "resolved": "https://registry.npmjs.org/@smithy/util-defaults-mode-node/-/util-defaults-mode-node-3.0.15.tgz", + "integrity": "sha512-KSyAAx2q6d0t6f/S4XB2+3+6aQacm3aLMhs9aLMqn18uYGUepbdssfogW5JQZpc6lXNBnp0tEnR5e9CEKmEd7A==", + "license": "Apache-2.0", + "dependencies": { + "@smithy/config-resolver": "^3.0.5", + "@smithy/credential-provider-imds": "^3.2.0", + "@smithy/node-config-provider": "^3.1.4", + "@smithy/property-provider": "^3.1.3", + "@smithy/smithy-client": "^3.2.0", + "@smithy/types": "^3.3.0", + "tslib": "^2.6.2" + }, + "engines": { + "node": ">= 10.0.0" + } + }, + "node_modules/@smithy/util-endpoints": { + "version": "2.0.5", + "resolved": "https://registry.npmjs.org/@smithy/util-endpoints/-/util-endpoints-2.0.5.tgz", + "integrity": "sha512-ReQP0BWihIE68OAblC/WQmDD40Gx+QY1Ez8mTdFMXpmjfxSyz2fVQu3A4zXRfQU9sZXtewk3GmhfOHswvX+eNg==", + "license": "Apache-2.0", + "dependencies": { + "@smithy/node-config-provider": "^3.1.4", + "@smithy/types": "^3.3.0", + "tslib": "^2.6.2" + }, + "engines": { + "node": ">=16.0.0" + } + }, + "node_modules/@smithy/util-hex-encoding": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/@smithy/util-hex-encoding/-/util-hex-encoding-3.0.0.tgz", + "integrity": "sha512-eFndh1WEK5YMUYvy3lPlVmYY/fZcQE1D8oSf41Id2vCeIkKJXPcYDCZD+4+xViI6b1XSd7tE+s5AmXzz5ilabQ==", + "license": "Apache-2.0", + "dependencies": { + "tslib": "^2.6.2" + }, + "engines": { + "node": ">=16.0.0" + } + }, + "node_modules/@smithy/util-middleware": { + "version": "3.0.3", + "resolved": "https://registry.npmjs.org/@smithy/util-middleware/-/util-middleware-3.0.3.tgz", + "integrity": "sha512-l+StyYYK/eO3DlVPbU+4Bi06Jjal+PFLSMmlWM1BEwyLxZ3aKkf1ROnoIakfaA7mC6uw3ny7JBkau4Yc+5zfWw==", + "license": "Apache-2.0", + "dependencies": { + "@smithy/types": "^3.3.0", + "tslib": "^2.6.2" + }, + "engines": { + "node": ">=16.0.0" + } + }, + "node_modules/@smithy/util-retry": { + "version": "3.0.3", + "resolved": "https://registry.npmjs.org/@smithy/util-retry/-/util-retry-3.0.3.tgz", + "integrity": "sha512-AFw+hjpbtVApzpNDhbjNG5NA3kyoMs7vx0gsgmlJF4s+yz1Zlepde7J58zpIRIsdjc+emhpAITxA88qLkPF26w==", + "license": "Apache-2.0", + "dependencies": { + "@smithy/service-error-classification": "^3.0.3", + "@smithy/types": "^3.3.0", + "tslib": "^2.6.2" + }, + "engines": { + "node": ">=16.0.0" + } + }, + "node_modules/@smithy/util-stream": { + "version": "3.1.3", + "resolved": "https://registry.npmjs.org/@smithy/util-stream/-/util-stream-3.1.3.tgz", + "integrity": "sha512-FIv/bRhIlAxC0U7xM1BCnF2aDRPq0UaelqBHkM2lsCp26mcBbgI0tCVTv+jGdsQLUmAMybua/bjDsSu8RQHbmw==", + "license": "Apache-2.0", + "dependencies": { + "@smithy/fetch-http-handler": "^3.2.4", + "@smithy/node-http-handler": "^3.1.4", + "@smithy/types": "^3.3.0", + "@smithy/util-base64": "^3.0.0", + "@smithy/util-buffer-from": "^3.0.0", + "@smithy/util-hex-encoding": "^3.0.0", + "@smithy/util-utf8": "^3.0.0", + "tslib": "^2.6.2" + }, + "engines": { + "node": ">=16.0.0" + } + }, + "node_modules/@smithy/util-uri-escape": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/@smithy/util-uri-escape/-/util-uri-escape-3.0.0.tgz", + "integrity": "sha512-LqR7qYLgZTD7nWLBecUi4aqolw8Mhza9ArpNEQ881MJJIU2sE5iHCK6TdyqqzcDLy0OPe10IY4T8ctVdtynubg==", + "license": "Apache-2.0", + "dependencies": { + "tslib": "^2.6.2" + }, + "engines": { + "node": ">=16.0.0" + } + }, + "node_modules/@smithy/util-utf8": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/@smithy/util-utf8/-/util-utf8-3.0.0.tgz", + "integrity": "sha512-rUeT12bxFnplYDe815GXbq/oixEGHfRFFtcTF3YdDi/JaENIM6aSYYLJydG83UNzLXeRI5K8abYd/8Sp/QM0kA==", + "license": "Apache-2.0", + "dependencies": { + "@smithy/util-buffer-from": "^3.0.0", + "tslib": "^2.6.2" + }, + "engines": { + "node": ">=16.0.0" + } + }, + "node_modules/bowser": { + "version": "2.11.0", + "resolved": "https://registry.npmjs.org/bowser/-/bowser-2.11.0.tgz", + "integrity": "sha512-AlcaJBi/pqqJBIQ8U9Mcpc9i8Aqxn88Skv5d+xBX006BY5u8N3mGLHa5Lgppa7L/HfwgwLgZ6NYs+Ag6uUmJRA==", + "license": "MIT" + }, + "node_modules/fast-xml-parser": { + "version": "4.4.1", + "resolved": "https://registry.npmjs.org/fast-xml-parser/-/fast-xml-parser-4.4.1.tgz", + "integrity": "sha512-xkjOecfnKGkSsOwtZ5Pz7Us/T6mrbPQrq0nh+aCO5V9nk5NLWmasAHumTKjiPJPWANe+kAZ84Jc8ooJkzZ88Sw==", + "funding": [ + { + "type": "github", + "url": "https://github.com/sponsors/NaturalIntelligence" + }, + { + "type": "paypal", + "url": "https://paypal.me/naturalintelligence" + } + ], + "license": "MIT", + "dependencies": { + "strnum": "^1.0.5" + }, + "bin": { + "fxparser": "src/cli/cli.js" + } + }, + "node_modules/strnum": { + "version": "1.0.5", + "resolved": "https://registry.npmjs.org/strnum/-/strnum-1.0.5.tgz", + "integrity": "sha512-J8bbNyKKXl5qYcR36TIO8W3mVGVHrmmxsd5PAItGkmyzwJvybiw2IVq5nqd0i4LSNSkB/sx9VHllbfFdr9k1JA==", + "license": "MIT" + }, + "node_modules/tslib": { + "version": "2.7.0", + "resolved": "https://registry.npmjs.org/tslib/-/tslib-2.7.0.tgz", + "integrity": "sha512-gLXCKdN1/j47AiHiOkJN69hJmcbGTHI0ImLmbYLHykhgeN0jVGola9yVjFgzCUklsZQMW55o+dW7IXv3RCXDzA==", + "license": "0BSD" + } + } +} diff --git a/lamda/package.json b/lamda/package.json new file mode 100644 index 000000000..102dbf777 --- /dev/null +++ b/lamda/package.json @@ -0,0 +1,15 @@ +{ + "name": "unocha-kb-lambda", + "version": "1.0.0", + "description": "Lambda function to call KB", + "main": "index.js", + "scripts": { + "test": "echo \"Error: no test specified\" && exit 1" + }, + "author": "Attiks", + "type": "module", + "license": "MIT", + "dependencies": { + "@aws-sdk/client-bedrock-agent-runtime": "^3.642.0" + } +} From ed448ecce43876d66a9aa31d5b3f909e707677e9 Mon Sep 17 00:00:00 2001 From: "Peter Droogmans (attiks)" Date: Tue, 3 Sep 2024 11:55:43 +0200 Subject: [PATCH 14/25] feat: Lambda function --- lamda/index2.js | 60 +++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 60 insertions(+) create mode 100644 lamda/index2.js diff --git a/lamda/index2.js b/lamda/index2.js new file mode 100644 index 000000000..d6548f466 --- /dev/null +++ b/lamda/index2.js @@ -0,0 +1,60 @@ +import { + BedrockAgentRuntimeClient, + RetrieveAndGenerateCommand, +} from "@aws-sdk/client-bedrock-agent-runtime"; + + +const client = new BedrockAgentRuntimeClient({region: process.env.AWS_BEDROCK_REGION, + credentials:{ + secretAccessKey:process.env.AWS_BEDROCK_SECRET_ACCESS_KEY, + accessKeyId:process.env.AWS_BEDROCK_ACCESS_KEY_ID + } +}); + +const input = { + input: { text: "Are people starving in Kenya?" }, + retrieveAndGenerateConfiguration: { + type: "KNOWLEDGE_BASE", + knowledgeBaseConfiguration: { + knowledgeBaseId: "VIEPSPYNSS", + modelArn: "arn:aws:bedrock:us-east-1::foundation-model/amazon.titan-text-premier-v1:0", + retrievalConfiguration: { + vectorSearchConfiguration: { + numberOfResults: 10, + overrideSearchType: "HYBRID", + filter: { + andAll: [ + { + equals: { + key: "status", + value: "1" + }, + }, + { + listContains: { + key: "country", + value: "220" + } + } + ] + } + } + } + } + } +}; + +const command = new RetrieveAndGenerateCommand(input); + +const {citations, output} = await client.send(command); + +console.log(output); + +for (let row of citations) { + console.log(row.generatedResponsePart.textResponsePart.text); + for (let ref of row.retrievedReferences) { + console.log(ref.metadata); + } +} + + From cece91869c16c9eea6c3dd06295c08c9a2f71daa Mon Sep 17 00:00:00 2001 From: "Peter Droogmans (attiks)" Date: Tue, 3 Sep 2024 16:12:41 +0200 Subject: [PATCH 15/25] feat: Lambda function called from API + filters --- README.md | 22 ++++++++++++++++++++++ lamda/README.md | 36 ++++++++++++++++++++++++++++++++++++ lamda/index2.js | 6 ++---- 3 files changed, 60 insertions(+), 4 deletions(-) diff --git a/README.md b/README.md index e0fdf4cfc..ee628d0fb 100644 --- a/README.md +++ b/README.md @@ -96,3 +96,25 @@ XDEBUG_MODE=coverage vendor/bin/phpunit # without coverage vendor/bin/phpunit ``` + +## For dev + +```bash +drush rapi-i --alias job --verbose +drush rw-job:index --verbose + +cget ocha_ai.settings --include-overridden +cget ocha_ai_tag.settings --include-overridden +cget ocha_ai_chat.settings --include-overridden +cget reliefweb_api.settings --include-overridden + +cset ocha_ai.settings plugins.source.reliefweb.api_url https://dev.api-reliefweb-int.ahconu.org/v1 +cset ocha_ai.settings plugins.source.reliefweb.converter_url https://xxx:xxx@dev.reliefweb-int.ahconu.org/search/converter/json +cset reliefweb_api.settings api_url https://dev.api-reliefweb-int.ahconu.org/v1 +cset reliefweb_api.settings api_url_external https://dev.api-reliefweb-int.ahconu.org/v1 +cset reliefweb_api.settings website: https://dev.reliefweb-int.ahconu.org + +queue:list +queue:run --verbose reliefweb_job_tagger + +``` diff --git a/lamda/README.md b/lamda/README.md index 8e234a463..72f6ad39b 100644 --- a/lamda/README.md +++ b/lamda/README.md @@ -5,3 +5,39 @@ ```bash nodejs --env-file=.env index.js ``` + +## API mapping template + +```vtl +#set($allParams = $input.params()) +#set($params = $allParams.get('querystring')) +{ + #foreach($paramName in $params.keySet()) + #if($paramName != "text") + "$paramName": "$util.escapeJavaScript($params.get($paramName))", + #end + #end + "text": "$util.escapeJavaScript($params.get('text'))", + "kb": "VIEPSPYNSS", + "api-id": "$context.apiId", + "api-key": "$context.identity.apiKey", + "source-ip": "$context.identity.sourceIp", + "user": "$context.identity.user", + "user-arn": "$context.identity.userArn", + "request-id": "$context.requestId", + "resource-id": "$context.resourceId", + "resource-path": "$context.resourcePath" +} +``` + +## Query parameters + +- text: Question +- country: List of comma separated country ids +- disaster: List of comma separated disaster ids +- disaster_type: List of comma separated disaster_type ids +- feature: List of comma separated feature ids +- primary_country: List of comma separated primary_country ids +- source: List of comma separated source ids +- theme: List of comma separated theme ids + diff --git a/lamda/index2.js b/lamda/index2.js index d6548f466..c1f9882be 100644 --- a/lamda/index2.js +++ b/lamda/index2.js @@ -12,7 +12,7 @@ const client = new BedrockAgentRuntimeClient({region: process.env.AWS_BEDROCK_RE }); const input = { - input: { text: "Are people starving in Kenya?" }, + input: { text: "Which African countries do need to most support from the World Food Program?" }, retrieveAndGenerateConfiguration: { type: "KNOWLEDGE_BASE", knowledgeBaseConfiguration: { @@ -47,9 +47,7 @@ const input = { const command = new RetrieveAndGenerateCommand(input); const {citations, output} = await client.send(command); - -console.log(output); - +console.log(output.text) for (let row of citations) { console.log(row.generatedResponsePart.textResponsePart.text); for (let ref of row.retrievedReferences) { From 67bb17685b90f719d6ccae9329be3208dcbd6074 Mon Sep 17 00:00:00 2001 From: "Peter Droogmans (attiks)" Date: Tue, 10 Sep 2024 17:00:57 +0200 Subject: [PATCH 16/25] chore: API + lambda --- lamda/README.md | 24 ++ lamda/RW-api.json | 753 ++++++++++++++++++++++++++++++++++++ lamda/rw-api-authorizer.mjs | 109 ++++++ lamda/rw-kb-answer.mjs | 167 ++++++++ lamda/rw-kb-search.mjs | 152 ++++++++ 5 files changed, 1205 insertions(+) create mode 100644 lamda/RW-api.json create mode 100644 lamda/rw-api-authorizer.mjs create mode 100644 lamda/rw-kb-answer.mjs create mode 100644 lamda/rw-kb-search.mjs diff --git a/lamda/README.md b/lamda/README.md index 72f6ad39b..f6a0dc068 100644 --- a/lamda/README.md +++ b/lamda/README.md @@ -41,3 +41,27 @@ nodejs --env-file=.env index.js - source: List of comma separated source ids - theme: List of comma separated theme ids +## API + +### Working + +```bash +curl -H "X-API-KEY: api1" \ + "https://y0crb0xdcj.execute-api.us-east-1.amazonaws.com/rw-api-test-1/search?text=Give%20me%20the%205%20most%20relevant%20doucments%20about%20famine%20in%20Kenya" + +curl -H "X-API-KEY: api1" \ + "https://y0crb0xdcj.execute-api.us-east-1.amazonaws.com/rw-api-test-1/jobs/answer?text=Any%20job%20offers%20in%20Kenya" + +curl -H "X-API-KEY: api2" \ + "https://y0crb0xdcj.execute-api.us-east-1.amazonaws.com/rw-api-test-1/jobs/answer?text=Any%20job%20offers%20in%20Kenya" + +curl -H "X-API-KEY: api2" \ + "https://y0crb0xdcj.execute-api.us-east-1.amazonaws.com/rw-api-test-1/jobs/search?text=IT%20Assistant%20in%20North%20Africa" | jq [].metadata +``` + +### Should fail + +```bash +curl -H "X-API-KEY: api2" \ + "https://y0crb0xdcj.execute-api.us-east-1.amazonaws.com/rw-api-test-1/jobs/answer?text=Any%20job%20offers%20in%20Kenya" +``` diff --git a/lamda/RW-api.json b/lamda/RW-api.json new file mode 100644 index 000000000..485cc1038 --- /dev/null +++ b/lamda/RW-api.json @@ -0,0 +1,753 @@ +{ + "openapi" : "3.0.1", + "info" : { + "title" : "RW-api", + "version" : "2024-09-03T15:24:39Z" + }, + "servers" : [ { + "url" : "https://y0crb0xdcj.execute-api.us-east-1.amazonaws.com/{basePath}", + "variables" : { + "basePath" : { + "default" : "rw-api-test-1" + } + } + } ], + "paths" : { + "/reports/answer" : { + "get" : { + "parameters" : [ { + "name" : "feature", + "in" : "query", + "schema" : { + "type" : "string" + } + }, { + "name" : "primary_country", + "in" : "query", + "schema" : { + "type" : "string" + } + }, { + "name" : "theme", + "in" : "query", + "schema" : { + "type" : "string" + } + }, { + "name" : "text", + "in" : "query", + "required" : true, + "schema" : { + "type" : "string" + } + }, { + "name" : "source", + "in" : "query", + "schema" : { + "type" : "string" + } + }, { + "name" : "disaster", + "in" : "query", + "schema" : { + "type" : "string" + } + }, { + "name" : "disaster_type", + "in" : "query", + "schema" : { + "type" : "string" + } + }, { + "name" : "country", + "in" : "query", + "schema" : { + "type" : "string" + } + } ], + "responses" : { + "200" : { + "description" : "200 response", + "content" : { + "application/json" : { + "schema" : { + "$ref" : "#/components/schemas/Empty" + } + } + } + } + }, + "security" : [ { + "rw-api-authorize-key" : [ ] + }, { + "api_key" : [ ] + } ], + "x-amazon-apigateway-integration" : { + "httpMethod" : "POST", + "uri" : "arn:aws:apigateway:us-east-1:lambda:path/2015-03-31/functions/arn:aws:lambda:us-east-1:694216630861:function:rw-kb-answer/invocations", + "responses" : { + "default" : { + "statusCode" : "200" + } + }, + "requestTemplates" : { + "application/json" : "#set($allParams = $input.params())\n#set($params = $allParams.get('querystring'))\n{\n #foreach($paramName in $params.keySet())\n #if($paramName != \"text\")\n \"$paramName\": \"$util.escapeJavaScript($params.get($paramName))\",\n #end\n #end\n \"text\": \"$util.escapeJavaScript($params.get('text'))\",\n \"siteid\": \"reliefweb\",\n \"bundle\": \"report\",\n \"api-id\": \"$context.apiId\",\n \"api-key\": \"$context.identity.apiKey\",\n \"source-ip\": \"$context.identity.sourceIp\",\n \"user\": \"$context.identity.user\",\n \"user-arn\": \"$context.identity.userArn\",\n \"request-id\": \"$context.requestId\",\n \"resource-id\": \"$context.resourceId\",\n \"resource-path\": \"$context.resourcePath\"\n}\n" + }, + "passthroughBehavior" : "when_no_match", + "timeoutInMillis" : 29000, + "contentHandling" : "CONVERT_TO_TEXT", + "type" : "aws" + } + } + }, + "/answer" : { + "get" : { + "parameters" : [ { + "name" : "theme", + "in" : "query", + "schema" : { + "type" : "string" + } + }, { + "name" : "text", + "in" : "query", + "required" : true, + "schema" : { + "type" : "string" + } + }, { + "name" : "job_experience", + "in" : "query", + "schema" : { + "type" : "string" + } + }, { + "name" : "job_type", + "in" : "query", + "schema" : { + "type" : "string" + } + }, { + "name" : "source", + "in" : "query", + "schema" : { + "type" : "string" + } + }, { + "name" : "career_categories", + "in" : "query", + "schema" : { + "type" : "string" + } + }, { + "name" : "city", + "in" : "query", + "schema" : { + "type" : "string" + } + }, { + "name" : "country", + "in" : "query", + "schema" : { + "type" : "string" + } + } ], + "responses" : { + "200" : { + "description" : "200 response", + "content" : { + "application/json" : { + "schema" : { + "$ref" : "#/components/schemas/Empty" + } + } + } + } + }, + "security" : [ { + "rw-api-authorize-key" : [ ] + }, { + "api_key" : [ ] + } ], + "x-amazon-apigateway-integration" : { + "httpMethod" : "POST", + "uri" : "arn:aws:apigateway:us-east-1:lambda:path/2015-03-31/functions/arn:aws:lambda:us-east-1:694216630861:function:rw-kb-answer/invocations", + "responses" : { + "default" : { + "statusCode" : "200" + } + }, + "requestTemplates" : { + "application/json" : "#set($allParams = $input.params())\n#set($params = $allParams.get('querystring'))\n{\n #foreach($paramName in $params.keySet())\n #if($paramName != \"text\")\n \"$paramName\": \"$util.escapeJavaScript($params.get($paramName))\",\n #end\n #end\n \"text\": \"$util.escapeJavaScript($params.get('text'))\",\n \"siteid\": \"reliefweb\",\n \"api-id\": \"$context.apiId\",\n \"api-key\": \"$context.identity.apiKey\",\n \"source-ip\": \"$context.identity.sourceIp\",\n \"user\": \"$context.identity.user\",\n \"user-arn\": \"$context.identity.userArn\",\n \"request-id\": \"$context.requestId\",\n \"resource-id\": \"$context.resourceId\",\n \"resource-path\": \"$context.resourcePath\"\n}\n" + }, + "passthroughBehavior" : "when_no_match", + "timeoutInMillis" : 29000, + "contentHandling" : "CONVERT_TO_TEXT", + "type" : "aws" + } + } + }, + "/jobs/search" : { + "get" : { + "parameters" : [ { + "name" : "theme", + "in" : "query", + "schema" : { + "type" : "string" + } + }, { + "name" : "text", + "in" : "query", + "required" : true, + "schema" : { + "type" : "string" + } + }, { + "name" : "job_experience", + "in" : "query", + "schema" : { + "type" : "string" + } + }, { + "name" : "job_type", + "in" : "query", + "schema" : { + "type" : "string" + } + }, { + "name" : "source", + "in" : "query", + "schema" : { + "type" : "string" + } + }, { + "name" : "career_categories", + "in" : "query", + "schema" : { + "type" : "string" + } + }, { + "name" : "city", + "in" : "query", + "schema" : { + "type" : "string" + } + }, { + "name" : "country", + "in" : "query", + "schema" : { + "type" : "string" + } + } ], + "responses" : { + "200" : { + "description" : "200 response", + "content" : { + "application/json" : { + "schema" : { + "$ref" : "#/components/schemas/Empty" + } + } + } + } + }, + "security" : [ { + "rw-api-authorize-key" : [ ] + }, { + "api_key" : [ ] + } ], + "x-amazon-apigateway-request-validator" : "Validate query string parameters and headers", + "x-amazon-apigateway-integration" : { + "httpMethod" : "POST", + "uri" : "arn:aws:apigateway:us-east-1:lambda:path/2015-03-31/functions/arn:aws:lambda:us-east-1:694216630861:function:rw-kb-search/invocations", + "responses" : { + "default" : { + "statusCode" : "200" + } + }, + "requestTemplates" : { + "application/json" : "#set($allParams = $input.params())\n#set($params = $allParams.get('querystring'))\n{\n #foreach($paramName in $params.keySet())\n #if($paramName != \"text\")\n \"$paramName\": \"$util.escapeJavaScript($params.get($paramName))\",\n #end\n #end\n \"text\": \"$util.escapeJavaScript($params.get('text'))\",\n \"siteid\": \"reliefweb\",\n \"bundle\": \"job\",\n \"api-id\": \"$context.apiId\",\n \"api-key\": \"$context.identity.apiKey\",\n \"source-ip\": \"$context.identity.sourceIp\",\n \"user\": \"$context.identity.user\",\n \"user-arn\": \"$context.identity.userArn\",\n \"request-id\": \"$context.requestId\",\n \"resource-id\": \"$context.resourceId\",\n \"resource-path\": \"$context.resourcePath\"\n}" + }, + "passthroughBehavior" : "when_no_match", + "timeoutInMillis" : 29000, + "contentHandling" : "CONVERT_TO_TEXT", + "type" : "aws" + } + } + }, + "/trainings/answer" : { + "get" : { + "parameters" : [ { + "name" : "city", + "in" : "query", + "schema" : { + "type" : "string" + } + }, { + "name" : "theme", + "in" : "query", + "schema" : { + "type" : "string" + } + }, { + "name" : "text", + "in" : "query", + "required" : true, + "schema" : { + "type" : "string" + } + }, { + "name" : "source", + "in" : "query", + "schema" : { + "type" : "string" + } + }, { + "name" : "country", + "in" : "query", + "schema" : { + "type" : "string" + } + } ], + "responses" : { + "200" : { + "description" : "200 response", + "content" : { + "application/json" : { + "schema" : { + "$ref" : "#/components/schemas/Empty" + } + } + } + } + }, + "security" : [ { + "rw-api-authorize-key" : [ ] + }, { + "api_key" : [ ] + } ], + "x-amazon-apigateway-integration" : { + "httpMethod" : "POST", + "uri" : "arn:aws:apigateway:us-east-1:lambda:path/2015-03-31/functions/arn:aws:lambda:us-east-1:694216630861:function:rw-kb-answer/invocations", + "responses" : { + "default" : { + "statusCode" : "200" + } + }, + "requestTemplates" : { + "application/json" : "#set($allParams = $input.params())\n#set($params = $allParams.get('querystring'))\n{\n #foreach($paramName in $params.keySet())\n #if($paramName != \"text\")\n \"$paramName\": \"$util.escapeJavaScript($params.get($paramName))\",\n #end\n #end\n \"text\": \"$util.escapeJavaScript($params.get('text'))\",\n \"siteid\": \"reliefweb\",\n \"bundle\": \"training\",\n \"api-id\": \"$context.apiId\",\n \"api-key\": \"$context.identity.apiKey\",\n \"source-ip\": \"$context.identity.sourceIp\",\n \"user\": \"$context.identity.user\",\n \"user-arn\": \"$context.identity.userArn\",\n \"request-id\": \"$context.requestId\",\n \"resource-id\": \"$context.resourceId\",\n \"resource-path\": \"$context.resourcePath\"\n}" + }, + "passthroughBehavior" : "when_no_match", + "timeoutInMillis" : 29000, + "contentHandling" : "CONVERT_TO_TEXT", + "type" : "aws" + } + } + }, + "/search" : { + "get" : { + "parameters" : [ { + "name" : "feature", + "in" : "query", + "schema" : { + "type" : "string" + } + }, { + "name" : "primary_country", + "in" : "query", + "schema" : { + "type" : "string" + } + }, { + "name" : "theme", + "in" : "query", + "schema" : { + "type" : "string" + } + }, { + "name" : "text", + "in" : "query", + "required" : true, + "schema" : { + "type" : "string" + } + }, { + "name" : "source", + "in" : "query", + "schema" : { + "type" : "string" + } + }, { + "name" : "disaster", + "in" : "query", + "schema" : { + "type" : "string" + } + }, { + "name" : "disaster_type", + "in" : "query", + "schema" : { + "type" : "string" + } + }, { + "name" : "country", + "in" : "query", + "schema" : { + "type" : "string" + } + }, { + "name" : "city", + "in" : "query", + "schema" : { + "type" : "string" + } + } ], + "responses" : { + "200" : { + "description" : "200 response", + "content" : { + "application/json" : { + "schema" : { + "$ref" : "#/components/schemas/Empty" + } + } + } + } + }, + "security" : [ { + "rw-api-authorize-key" : [ ] + }, { + "api_key" : [ ] + } ], + "x-amazon-apigateway-request-validator" : "Validate query string parameters and headers", + "x-amazon-apigateway-integration" : { + "httpMethod" : "POST", + "uri" : "arn:aws:apigateway:us-east-1:lambda:path/2015-03-31/functions/arn:aws:lambda:us-east-1:694216630861:function:rw-kb-search/invocations", + "responses" : { + "default" : { + "statusCode" : "200" + } + }, + "requestTemplates" : { + "application/json" : "#set($allParams = $input.params())\n#set($params = $allParams.get('querystring'))\n{\n #foreach($paramName in $params.keySet())\n #if($paramName != \"text\")\n \"$paramName\": \"$util.escapeJavaScript($params.get($paramName))\",\n #end\n #end\n \"text\": \"$util.escapeJavaScript($params.get('text'))\",\n \"siteid\": \"reliefweb\",\n \"api-id\": \"$context.apiId\",\n \"api-key\": \"$context.identity.apiKey\",\n \"source-ip\": \"$context.identity.sourceIp\",\n \"user\": \"$context.identity.user\",\n \"user-arn\": \"$context.identity.userArn\",\n \"request-id\": \"$context.requestId\",\n \"resource-id\": \"$context.resourceId\",\n \"resource-path\": \"$context.resourcePath\"\n}" + }, + "passthroughBehavior" : "when_no_match", + "timeoutInMillis" : 29000, + "contentHandling" : "CONVERT_TO_TEXT", + "type" : "aws" + } + } + }, + "/jobs/answer" : { + "get" : { + "parameters" : [ { + "name" : "theme", + "in" : "query", + "schema" : { + "type" : "string" + } + }, { + "name" : "text", + "in" : "query", + "required" : true, + "schema" : { + "type" : "string" + } + }, { + "name" : "job_experience", + "in" : "query", + "schema" : { + "type" : "string" + } + }, { + "name" : "job_type", + "in" : "query", + "schema" : { + "type" : "string" + } + }, { + "name" : "source", + "in" : "query", + "schema" : { + "type" : "string" + } + }, { + "name" : "career_categories", + "in" : "query", + "schema" : { + "type" : "string" + } + }, { + "name" : "city", + "in" : "query", + "schema" : { + "type" : "string" + } + }, { + "name" : "country", + "in" : "query", + "schema" : { + "type" : "string" + } + } ], + "responses" : { + "200" : { + "description" : "200 response", + "content" : { + "application/json" : { + "schema" : { + "$ref" : "#/components/schemas/Empty" + } + } + } + } + }, + "security" : [ { + "rw-api-authorize-key" : [ ] + }, { + "api_key" : [ ] + } ], + "x-amazon-apigateway-integration" : { + "httpMethod" : "POST", + "uri" : "arn:aws:apigateway:us-east-1:lambda:path/2015-03-31/functions/arn:aws:lambda:us-east-1:694216630861:function:rw-kb-answer/invocations", + "responses" : { + "default" : { + "statusCode" : "200" + } + }, + "requestTemplates" : { + "application/json" : "#set($allParams = $input.params())\n#set($params = $allParams.get('querystring'))\n{\n #foreach($paramName in $params.keySet())\n #if($paramName != \"text\")\n \"$paramName\": \"$util.escapeJavaScript($params.get($paramName))\",\n #end\n #end\n \"text\": \"$util.escapeJavaScript($params.get('text'))\",\n \"siteid\": \"reliefweb\",\n \"bundle\": \"job\",\n \"api-id\": \"$context.apiId\",\n \"api-key\": \"$context.identity.apiKey\",\n \"source-ip\": \"$context.identity.sourceIp\",\n \"user\": \"$context.identity.user\",\n \"user-arn\": \"$context.identity.userArn\",\n \"request-id\": \"$context.requestId\",\n \"resource-id\": \"$context.resourceId\",\n \"resource-path\": \"$context.resourcePath\"\n}" + }, + "passthroughBehavior" : "when_no_match", + "timeoutInMillis" : 29000, + "contentHandling" : "CONVERT_TO_TEXT", + "type" : "aws" + } + } + }, + "/trainings/search" : { + "get" : { + "parameters" : [ { + "name" : "city", + "in" : "query", + "schema" : { + "type" : "string" + } + }, { + "name" : "theme", + "in" : "query", + "schema" : { + "type" : "string" + } + }, { + "name" : "text", + "in" : "query", + "required" : true, + "schema" : { + "type" : "string" + } + }, { + "name" : "source", + "in" : "query", + "schema" : { + "type" : "string" + } + }, { + "name" : "country", + "in" : "query", + "schema" : { + "type" : "string" + } + } ], + "responses" : { + "200" : { + "description" : "200 response", + "content" : { + "application/json" : { + "schema" : { + "$ref" : "#/components/schemas/Empty" + } + } + } + } + }, + "security" : [ { + "rw-api-authorize-key" : [ ] + }, { + "api_key" : [ ] + } ], + "x-amazon-apigateway-request-validator" : "Validate query string parameters and headers", + "x-amazon-apigateway-integration" : { + "httpMethod" : "POST", + "uri" : "arn:aws:apigateway:us-east-1:lambda:path/2015-03-31/functions/arn:aws:lambda:us-east-1:694216630861:function:rw-kb-search/invocations", + "responses" : { + "default" : { + "statusCode" : "200" + } + }, + "requestTemplates" : { + "application/json" : "#set($allParams = $input.params())\n#set($params = $allParams.get('querystring'))\n{\n #foreach($paramName in $params.keySet())\n #if($paramName != \"text\")\n \"$paramName\": \"$util.escapeJavaScript($params.get($paramName))\",\n #end\n #end\n \"text\": \"$util.escapeJavaScript($params.get('text'))\",\n \"siteid\": \"reliefweb\",\n \"bundle\": \"training\",\n \"api-id\": \"$context.apiId\",\n \"api-key\": \"$context.identity.apiKey\",\n \"source-ip\": \"$context.identity.sourceIp\",\n \"user\": \"$context.identity.user\",\n \"user-arn\": \"$context.identity.userArn\",\n \"request-id\": \"$context.requestId\",\n \"resource-id\": \"$context.resourceId\",\n \"resource-path\": \"$context.resourcePath\"\n}" + }, + "passthroughBehavior" : "when_no_match", + "timeoutInMillis" : 29000, + "contentHandling" : "CONVERT_TO_TEXT", + "type" : "aws" + } + } + }, + "/reports/search" : { + "get" : { + "parameters" : [ { + "name" : "feature", + "in" : "query", + "schema" : { + "type" : "string" + } + }, { + "name" : "primary_country", + "in" : "query", + "schema" : { + "type" : "string" + } + }, { + "name" : "theme", + "in" : "query", + "schema" : { + "type" : "string" + } + }, { + "name" : "text", + "in" : "query", + "required" : true, + "schema" : { + "type" : "string" + } + }, { + "name" : "source", + "in" : "query", + "schema" : { + "type" : "string" + } + }, { + "name" : "disaster", + "in" : "query", + "schema" : { + "type" : "string" + } + }, { + "name" : "disaster_type", + "in" : "query", + "schema" : { + "type" : "string" + } + }, { + "name" : "country", + "in" : "query", + "schema" : { + "type" : "string" + } + } ], + "responses" : { + "200" : { + "description" : "200 response", + "content" : { + "application/json" : { + "schema" : { + "$ref" : "#/components/schemas/Empty" + } + } + } + } + }, + "security" : [ { + "rw-api-authorize-key" : [ ] + }, { + "api_key" : [ ] + } ], + "x-amazon-apigateway-request-validator" : "Validate query string parameters and headers", + "x-amazon-apigateway-integration" : { + "httpMethod" : "POST", + "uri" : "arn:aws:apigateway:us-east-1:lambda:path/2015-03-31/functions/arn:aws:lambda:us-east-1:694216630861:function:rw-kb-search/invocations", + "responses" : { + "default" : { + "statusCode" : "200" + } + }, + "requestTemplates" : { + "application/json" : "#set($allParams = $input.params())\n#set($params = $allParams.get('querystring'))\n{\n #foreach($paramName in $params.keySet())\n #if($paramName != \"text\")\n \"$paramName\": \"$util.escapeJavaScript($params.get($paramName))\",\n #end\n #end\n \"text\": \"$util.escapeJavaScript($params.get('text'))\",\n \"siteid\": \"reliefweb\",\n \"bundle\": \"report\",\n \"api-id\": \"$context.apiId\",\n \"api-key\": \"$context.identity.apiKey\",\n \"source-ip\": \"$context.identity.sourceIp\",\n \"user\": \"$context.identity.user\",\n \"user-arn\": \"$context.identity.userArn\",\n \"request-id\": \"$context.requestId\",\n \"resource-id\": \"$context.resourceId\",\n \"resource-path\": \"$context.resourcePath\"\n}" + }, + "passthroughBehavior" : "when_no_match", + "timeoutInMillis" : 29000, + "contentHandling" : "CONVERT_TO_TEXT", + "type" : "aws" + } + } + }, + "/" : { + "get" : { + "responses" : { + "200" : { + "description" : "200 response", + "content" : { + "application/json" : { + "schema" : { + "$ref" : "#/components/schemas/Empty" + } + } + } + } + }, + "security" : [ { + "rw-api-authorize-key" : [ ] + }, { + "api_key" : [ ] + } ], + "x-amazon-apigateway-integration" : { + "responses" : { + "default" : { + "statusCode" : "200" + } + }, + "requestTemplates" : { + "application/json" : "{\"statusCode\": 200}" + }, + "passthroughBehavior" : "when_no_match", + "type" : "mock" + } + } + } + }, + "components" : { + "schemas" : { + "Empty" : { + "title" : "Empty Schema", + "type" : "object" + } + }, + "securitySchemes" : { + "rw-api-authorize-key" : { + "type" : "apiKey", + "name" : "x-api-key", + "in" : "header", + "x-amazon-apigateway-authtype" : "custom", + "x-amazon-apigateway-authorizer" : { + "authorizerUri" : "arn:aws:apigateway:us-east-1:lambda:path/2015-03-31/functions/arn:aws:lambda:us-east-1:694216630861:function:rw-api-authorizer/invocations", + "authorizerResultTtlInSeconds" : 60, + "identitySource" : "method.request.header.x-api-key", + "type" : "request" + } + }, + "api_key" : { + "type" : "apiKey", + "name" : "x-api-key", + "in" : "header" + } + } + }, + "x-amazon-apigateway-request-validators" : { + "Validate query string parameters and headers" : { + "validateRequestParameters" : true, + "validateRequestBody" : false + } + } +} \ No newline at end of file diff --git a/lamda/rw-api-authorizer.mjs b/lamda/rw-api-authorizer.mjs new file mode 100644 index 000000000..63b97815f --- /dev/null +++ b/lamda/rw-api-authorizer.mjs @@ -0,0 +1,109 @@ +const allowedPaths = { + 'api1': { + allow: [ + '/', + '/answer', + '/search', + '/jobs/answer', + '/jobs/search', + '/reports/answer', + '/reports/search', + ], + deny: [ + ], + }, + 'api2': { + allow: [ + '/jobs/answer', + '/jobs/search', + ], + deny: [ + '/', + '/answer', + '/search', + '/reports/answer', + '/reports/search', + ], + }, + 'api3': { + allow: [ + '/jobs/answer', + '/jobs/search', + ], + deny: [ + '/', + '/answer', + '/search', + '/reports/answer', + '/reports/search', + ], + } +}; + +export const handler = function(event, context, callback) { + console.log('Received event:', JSON.stringify(event, null, 2)); + console.log('Context:', JSON.stringify(context, null, 2)); + + // Retrieve request parameters from the Lambda function input: + var headers = event.headers || {}; + var apikey = headers['x-api-key']; + + // Deny access for unknown keys. + if (!allowedPaths[apikey]) { + callback("Unauthorized"); + } + + // Rebuild arn prefix. + let parts = event.methodArn.split(':'); + let apiGatewayArnTmp = parts[5].split('/'); + + parts = parts.slice(0, 5); + apiGatewayArnTmp = apiGatewayArnTmp.slice(0, 3); + apiGatewayArnTmp = apiGatewayArnTmp.join('/'); + apiGatewayArnTmp = apiGatewayArnTmp.split('?')[0]; + + let prefix = parts.join(':') + ':' + apiGatewayArnTmp; + + // Account. + let accountId = event.requestContext.accountId; + callback(null, generatePolicies(apikey, prefix, accountId)); +} + +// Help function to generate an IAM policy +var generatePolicies = function(apikey, prefix, accountId) { + // Required output: + var authResponse = {}; + authResponse.principalId = accountId; + authResponse.usageIdentifierKey = apikey; + + var policyDocument = {}; + policyDocument.Version = '2012-10-17'; // default version + policyDocument.Statement = []; + + // Allows. + var statementAllow = {}; + statementAllow.Action = 'execute-api:Invoke'; // default action + statementAllow.Effect = 'Allow'; + statementAllow.Resource = []; + + for (let pol in allowedPaths[apikey].allow) { + statementAllow.Resource.push(prefix + allowedPaths[apikey].allow[pol]); + } + policyDocument.Statement.push(statementAllow); + + // Denies. + var statementDeny = {}; + statementDeny.Action = 'execute-api:Invoke'; // default action + statementDeny.Effect = 'Deny'; + statementDeny.Resource = []; + + for (let pol in allowedPaths[apikey].deny) { + statementDeny.Resource.push(prefix + allowedPaths[apikey].deny[pol]); + } + policyDocument.Statement.push(statementDeny); + + authResponse.policyDocument = policyDocument; + + console.log(JSON.stringify(authResponse)); + return authResponse; +} diff --git a/lamda/rw-kb-answer.mjs b/lamda/rw-kb-answer.mjs new file mode 100644 index 000000000..313f79edf --- /dev/null +++ b/lamda/rw-kb-answer.mjs @@ -0,0 +1,167 @@ +import { + BedrockAgentRuntimeClient, + RetrieveAndGenerateCommand, +} from "@aws-sdk/client-bedrock-agent-runtime"; + + +// @todo add mapping between content type and KB Id. + +export const handler = async (event) => { + let kb = 'VIEPSPYNSS'; + let siteid = event.siteid || ''; + let bundle = event.bundle || ''; + let text = event.text || ''; + + const client = new BedrockAgentRuntimeClient({region: 'us-east-1'}); + + // Make sure there are at least 2 filters. + const filters = [ + { + equals: { + key: "status", + value: "1" + }, + }, + { + notEquals: { + key: "status", + value: "0" + }, + } + ]; + + // Limit to source site, ex. ReliefWeb. + if (siteid != '') { + filters.push({ + equals: { + key: 'site', + value: siteid + } + }); + } + + // Limit to bundle, ex. report. + if (bundle != '') { + filters.push({ + equals: { + key: 'bundle', + value: bundle + } + }); + } + + // Add user filters. + if (event.city) { + filters.push({ + equals: { + key: 'city', + value: event.city + } + }); + } + + if (event.country) { + filters.push({ + in: { + key: 'country', + value: event.country.split(',') + } + }); + } + + if (event.disaster) { + filters.push({ + in: { + key: 'disaster', + value: event.disaster.split(',') + } + }); + } + + if (event.disaster_type) { + filters.push({ + in: { + key: 'disaster_type', + value: event.disaster_type.split(',') + } + }); + } + + if (event.feature) { + filters.push({ + in: { + key: 'feature', + value: event.feature.split(',') + } + }); + } + + if (event.primary_country) { + filters.push({ + in: { + key: 'primary_country', + value: event.primary_country.split(',') + } + }); + } + + if (event.source) { + filters.push({ + in: { + key: 'source', + value: event.source.split(',') + } + }); + } + + if (event.theme) { + filters.push({ + in: { + key: 'theme', + value: event.theme.split(',') + } + }); + } + + const input = { + input: { + text: text + }, + retrieveAndGenerateConfiguration: { + type: "KNOWLEDGE_BASE", + knowledgeBaseConfiguration: { + knowledgeBaseId: kb, + modelArn: "arn:aws:bedrock:us-east-1::foundation-model/amazon.titan-text-premier-v1:0", + retrievalConfiguration: { + vectorSearchConfiguration: { + numberOfResults: 10, + overrideSearchType: "HYBRID", + filter: { + andAll: filters + } + } + } + } + } + }; + + const command = new RetrieveAndGenerateCommand(input); + + const {citations, output} = await client.send(command); + + let data = { + answer: output.text || '', + citations: [], + }; + + for (let row of citations) { + for (let ref of row.retrievedReferences) { + data.citations.push({ + text: ref.content.text, + metadata: ref.metadata + }); + } + } + + return data; +}; diff --git a/lamda/rw-kb-search.mjs b/lamda/rw-kb-search.mjs new file mode 100644 index 000000000..f8c6d49ec --- /dev/null +++ b/lamda/rw-kb-search.mjs @@ -0,0 +1,152 @@ +import { + BedrockAgentRuntimeClient, + RetrieveCommand, +} from "@aws-sdk/client-bedrock-agent-runtime"; + + +export const handler = async (event) => { + let kb = 'VIEPSPYNSS'; + let siteid = event.siteid || ''; + let bundle = event.bundle || ''; + let text = event.text || ''; + const client = new BedrockAgentRuntimeClient({region: 'us-east-1'}); + + // Make sure there are at least 2 filters. + const filters = [ + { + equals: { + key: "status", + value: "1" + }, + }, + { + notEquals: { + key: "status", + value: "0" + }, + } + ]; + + // Limit to source site, ex. ReliefWeb. + if (siteid != '') { + filters.push({ + equals: { + key: 'site', + value: siteid + } + }); + } + + // Limit to bundle, ex. report. + if (bundle != '') { + filters.push({ + equals: { + key: 'bundle', + value: bundle + } + }); + } + + // Add user filters. + if (event.city) { + filters.push({ + equals: { + key: 'city', + value: event.city + } + }); + } + + if (event.country) { + filters.push({ + in: { + key: 'country', + value: event.country.split(',') + } + }); + } + + if (event.disaster) { + filters.push({ + in: { + key: 'disaster', + value: event.disaster.split(',') + } + }); + } + + if (event.disaster_type) { + filters.push({ + in: { + key: 'disaster_type', + value: event.disaster_type.split(',') + } + }); + } + + if (event.feature) { + filters.push({ + in: { + key: 'feature', + value: event.feature.split(',') + } + }); + } + + if (event.primary_country) { + filters.push({ + in: { + key: 'primary_country', + value: event.primary_country.split(',') + } + }); + } + + if (event.source) { + filters.push({ + in: { + key: 'source', + value: event.source.split(',') + } + }); + } + + if (event.theme) { + filters.push({ + in: { + key: 'theme', + value: event.theme.split(',') + } + }); + } + + const input = { + knowledgeBaseId: kb, + retrievalQuery: { + text: text, + }, + retrievalConfiguration: { + vectorSearchConfiguration: { + numberOfResults: 10, + overrideSearchType: "HYBRID", + filter: { + andAll: filters + } + } + }, + }; + + const command = new RetrieveCommand(input); + const results = await client.send(command); + + let output = []; + for (let row of results.retrievalResults) { + output.push({ + text: row.content.text || '', + metadata: row.metadata, + score: row.score, + }); + } + + return output; +}; From 919eb147cd6f1c836c09cebd6ea3ead1a26bf033 Mon Sep 17 00:00:00 2001 From: "Peter Droogmans (attiks)" Date: Fri, 13 Sep 2024 14:06:30 +0200 Subject: [PATCH 17/25] chore: Move lambda functions --- .../Commands/ReliefWebSemanticAwsCommands.php | 56 + .../Commands/ReliefWebSemanticCommands.php | 21 +- lamda/.env.example | 3 - lamda/.gitignore | 2 - lamda/README.md | 67 - lamda/RW-api.json | 753 --------- lamda/index.js | 47 - lamda/index2.js | 58 - lamda/package-lock.json | 1363 ----------------- lamda/package.json | 15 - lamda/rw-api-authorizer.mjs | 109 -- lamda/rw-kb-answer.mjs | 167 -- lamda/rw-kb-search.mjs | 152 -- 13 files changed, 67 insertions(+), 2746 deletions(-) delete mode 100644 lamda/.env.example delete mode 100644 lamda/.gitignore delete mode 100644 lamda/README.md delete mode 100644 lamda/RW-api.json delete mode 100644 lamda/index.js delete mode 100644 lamda/index2.js delete mode 100644 lamda/package-lock.json delete mode 100644 lamda/package.json delete mode 100644 lamda/rw-api-authorizer.mjs delete mode 100644 lamda/rw-kb-answer.mjs delete mode 100644 lamda/rw-kb-search.mjs diff --git a/html/modules/custom/reliefweb_semantic/src/Commands/ReliefWebSemanticAwsCommands.php b/html/modules/custom/reliefweb_semantic/src/Commands/ReliefWebSemanticAwsCommands.php index 42c2eb753..d524e15ad 100644 --- a/html/modules/custom/reliefweb_semantic/src/Commands/ReliefWebSemanticAwsCommands.php +++ b/html/modules/custom/reliefweb_semantic/src/Commands/ReliefWebSemanticAwsCommands.php @@ -2,6 +2,7 @@ namespace Drupal\reliefweb_semantic\Commands; +use Aws\ApiGateway\ApiGatewayClient; use Aws\BedrockAgent\BedrockAgentClient; use Consolidation\OutputFormatters\StructuredData\RowsOfFields; use Drupal\Core\Config\ConfigFactoryInterface; @@ -303,4 +304,59 @@ protected function getDatasources($reset = 0) { return $data; } + /** + * List API keys. + * + * @param array $options + * Additional options for the command. + * + * @command reliefweb-semantic:list-apikeys + * + * @option reset. + * + * @default $options [] + * + * @usage reliefweb-semantic:list-apikeys + * List datasources. + */ + public function listApikeys( + array $options = [ + 'reset' => 0, + 'format' => 'table', + ], + ) : RowsOfFields { + $data = $this->getApikeys($options['reset']); + return new RowsOfFields($data); + } + + /** + * Get data sources. + */ + protected function getApikeys($reset = 0) { + $data = $this->state->get('reliefweb_semantic_apikeys', []); + if (empty($data) || !empty($reset)) { + $data = []; + $aws_options = reliefweb_semantic_get_aws_client_options(); + $api = new ApiGatewayClient($aws_options); + + $result = $api->getApiKeys([ + 'includeValues' => TRUE, + ]); + + $apikeys = $result->toArray()['items']; + foreach ($apikeys as $apikey) { + $data[$apikey['id']] = [ + 'id' => $apikey['id'], + 'name' => $apikey['name'], + 'key' => $apikey['value'], + 'status' => $apikey['enabled'], + ]; + } + } + + $this->state->set('reliefweb_semantic_apikeys', $data); + + return $data; + } + } diff --git a/html/modules/custom/reliefweb_semantic/src/Commands/ReliefWebSemanticCommands.php b/html/modules/custom/reliefweb_semantic/src/Commands/ReliefWebSemanticCommands.php index f661416aa..83b0cc6ae 100644 --- a/html/modules/custom/reliefweb_semantic/src/Commands/ReliefWebSemanticCommands.php +++ b/html/modules/custom/reliefweb_semantic/src/Commands/ReliefWebSemanticCommands.php @@ -78,6 +78,13 @@ class ReliefWebSemanticCommands extends DrushCommands { */ protected $renderer; + /** + * S3 bucket. + * + * @var string + */ + protected $bucket = 'rw-kb-reports'; + /** * List of config for each bundle. * @@ -219,7 +226,7 @@ public function __construct( * * @usage reliefweb-semantic:index --id=123 report * Index the report with ID 123. - * @usagereliefweb-semantic:index --limit=10 report + * @usage reliefweb-semantic:index --limit=10 report * Index latest 10 reports. */ public function index( @@ -413,6 +420,7 @@ protected function prepareItem(ContentEntityInterface $entity) : array { } $date = new \DateTime('now', new \DateTimeZone('UTC')); + $data['site'] = 'reliefweb'; $data['timestamp'] = $date->format(\DateTime::ATOM); $data['bundle'] = $entity->bundle(); $data['nid'] = $entity->id(); @@ -487,13 +495,6 @@ protected function indexItem(string $bundle, array $data, array $files = []) { return []; } - $bucket = $this->bundles[$bundle]['bucket'] ?? ''; - if (empty($bucket)) { - $this->logger->notice('Unknown bucket for @bundle', [ - '@bundle' => $bundle, - ]); - } - if (empty($files) && isset($data['files'])) { $files = $data['files']; unset($data['files']); @@ -540,9 +541,9 @@ protected function indexItem(string $bundle, array $data, array $files = []) { continue; } - $this->sendToS3($bucket, $absolute_path); + $this->sendToS3($this->bucket, $absolute_path); $basename = basename($absolute_path); - $this->sendToS3($bucket, $metadata_file, $basename . '.metadata.json'); + $this->sendToS3($this->bucket, $metadata_file, $basename . '.metadata.json'); } } diff --git a/lamda/.env.example b/lamda/.env.example deleted file mode 100644 index b0fcaf1b9..000000000 --- a/lamda/.env.example +++ /dev/null @@ -1,3 +0,0 @@ -AWS_BEDROCK_ACCESS_KEY_ID="" -AWS_BEDROCK_SECRET_ACCESS_KEY="" -AWS_BEDROCK_REGION="us-east-1" diff --git a/lamda/.gitignore b/lamda/.gitignore deleted file mode 100644 index 6ed48a986..000000000 --- a/lamda/.gitignore +++ /dev/null @@ -1,2 +0,0 @@ -.env -node_modules diff --git a/lamda/README.md b/lamda/README.md deleted file mode 100644 index f6a0dc068..000000000 --- a/lamda/README.md +++ /dev/null @@ -1,67 +0,0 @@ -# Lambda function for KB - -## Run - -```bash -nodejs --env-file=.env index.js -``` - -## API mapping template - -```vtl -#set($allParams = $input.params()) -#set($params = $allParams.get('querystring')) -{ - #foreach($paramName in $params.keySet()) - #if($paramName != "text") - "$paramName": "$util.escapeJavaScript($params.get($paramName))", - #end - #end - "text": "$util.escapeJavaScript($params.get('text'))", - "kb": "VIEPSPYNSS", - "api-id": "$context.apiId", - "api-key": "$context.identity.apiKey", - "source-ip": "$context.identity.sourceIp", - "user": "$context.identity.user", - "user-arn": "$context.identity.userArn", - "request-id": "$context.requestId", - "resource-id": "$context.resourceId", - "resource-path": "$context.resourcePath" -} -``` - -## Query parameters - -- text: Question -- country: List of comma separated country ids -- disaster: List of comma separated disaster ids -- disaster_type: List of comma separated disaster_type ids -- feature: List of comma separated feature ids -- primary_country: List of comma separated primary_country ids -- source: List of comma separated source ids -- theme: List of comma separated theme ids - -## API - -### Working - -```bash -curl -H "X-API-KEY: api1" \ - "https://y0crb0xdcj.execute-api.us-east-1.amazonaws.com/rw-api-test-1/search?text=Give%20me%20the%205%20most%20relevant%20doucments%20about%20famine%20in%20Kenya" - -curl -H "X-API-KEY: api1" \ - "https://y0crb0xdcj.execute-api.us-east-1.amazonaws.com/rw-api-test-1/jobs/answer?text=Any%20job%20offers%20in%20Kenya" - -curl -H "X-API-KEY: api2" \ - "https://y0crb0xdcj.execute-api.us-east-1.amazonaws.com/rw-api-test-1/jobs/answer?text=Any%20job%20offers%20in%20Kenya" - -curl -H "X-API-KEY: api2" \ - "https://y0crb0xdcj.execute-api.us-east-1.amazonaws.com/rw-api-test-1/jobs/search?text=IT%20Assistant%20in%20North%20Africa" | jq [].metadata -``` - -### Should fail - -```bash -curl -H "X-API-KEY: api2" \ - "https://y0crb0xdcj.execute-api.us-east-1.amazonaws.com/rw-api-test-1/jobs/answer?text=Any%20job%20offers%20in%20Kenya" -``` diff --git a/lamda/RW-api.json b/lamda/RW-api.json deleted file mode 100644 index 485cc1038..000000000 --- a/lamda/RW-api.json +++ /dev/null @@ -1,753 +0,0 @@ -{ - "openapi" : "3.0.1", - "info" : { - "title" : "RW-api", - "version" : "2024-09-03T15:24:39Z" - }, - "servers" : [ { - "url" : "https://y0crb0xdcj.execute-api.us-east-1.amazonaws.com/{basePath}", - "variables" : { - "basePath" : { - "default" : "rw-api-test-1" - } - } - } ], - "paths" : { - "/reports/answer" : { - "get" : { - "parameters" : [ { - "name" : "feature", - "in" : "query", - "schema" : { - "type" : "string" - } - }, { - "name" : "primary_country", - "in" : "query", - "schema" : { - "type" : "string" - } - }, { - "name" : "theme", - "in" : "query", - "schema" : { - "type" : "string" - } - }, { - "name" : "text", - "in" : "query", - "required" : true, - "schema" : { - "type" : "string" - } - }, { - "name" : "source", - "in" : "query", - "schema" : { - "type" : "string" - } - }, { - "name" : "disaster", - "in" : "query", - "schema" : { - "type" : "string" - } - }, { - "name" : "disaster_type", - "in" : "query", - "schema" : { - "type" : "string" - } - }, { - "name" : "country", - "in" : "query", - "schema" : { - "type" : "string" - } - } ], - "responses" : { - "200" : { - "description" : "200 response", - "content" : { - "application/json" : { - "schema" : { - "$ref" : "#/components/schemas/Empty" - } - } - } - } - }, - "security" : [ { - "rw-api-authorize-key" : [ ] - }, { - "api_key" : [ ] - } ], - "x-amazon-apigateway-integration" : { - "httpMethod" : "POST", - "uri" : "arn:aws:apigateway:us-east-1:lambda:path/2015-03-31/functions/arn:aws:lambda:us-east-1:694216630861:function:rw-kb-answer/invocations", - "responses" : { - "default" : { - "statusCode" : "200" - } - }, - "requestTemplates" : { - "application/json" : "#set($allParams = $input.params())\n#set($params = $allParams.get('querystring'))\n{\n #foreach($paramName in $params.keySet())\n #if($paramName != \"text\")\n \"$paramName\": \"$util.escapeJavaScript($params.get($paramName))\",\n #end\n #end\n \"text\": \"$util.escapeJavaScript($params.get('text'))\",\n \"siteid\": \"reliefweb\",\n \"bundle\": \"report\",\n \"api-id\": \"$context.apiId\",\n \"api-key\": \"$context.identity.apiKey\",\n \"source-ip\": \"$context.identity.sourceIp\",\n \"user\": \"$context.identity.user\",\n \"user-arn\": \"$context.identity.userArn\",\n \"request-id\": \"$context.requestId\",\n \"resource-id\": \"$context.resourceId\",\n \"resource-path\": \"$context.resourcePath\"\n}\n" - }, - "passthroughBehavior" : "when_no_match", - "timeoutInMillis" : 29000, - "contentHandling" : "CONVERT_TO_TEXT", - "type" : "aws" - } - } - }, - "/answer" : { - "get" : { - "parameters" : [ { - "name" : "theme", - "in" : "query", - "schema" : { - "type" : "string" - } - }, { - "name" : "text", - "in" : "query", - "required" : true, - "schema" : { - "type" : "string" - } - }, { - "name" : "job_experience", - "in" : "query", - "schema" : { - "type" : "string" - } - }, { - "name" : "job_type", - "in" : "query", - "schema" : { - "type" : "string" - } - }, { - "name" : "source", - "in" : "query", - "schema" : { - "type" : "string" - } - }, { - "name" : "career_categories", - "in" : "query", - "schema" : { - "type" : "string" - } - }, { - "name" : "city", - "in" : "query", - "schema" : { - "type" : "string" - } - }, { - "name" : "country", - "in" : "query", - "schema" : { - "type" : "string" - } - } ], - "responses" : { - "200" : { - "description" : "200 response", - "content" : { - "application/json" : { - "schema" : { - "$ref" : "#/components/schemas/Empty" - } - } - } - } - }, - "security" : [ { - "rw-api-authorize-key" : [ ] - }, { - "api_key" : [ ] - } ], - "x-amazon-apigateway-integration" : { - "httpMethod" : "POST", - "uri" : "arn:aws:apigateway:us-east-1:lambda:path/2015-03-31/functions/arn:aws:lambda:us-east-1:694216630861:function:rw-kb-answer/invocations", - "responses" : { - "default" : { - "statusCode" : "200" - } - }, - "requestTemplates" : { - "application/json" : "#set($allParams = $input.params())\n#set($params = $allParams.get('querystring'))\n{\n #foreach($paramName in $params.keySet())\n #if($paramName != \"text\")\n \"$paramName\": \"$util.escapeJavaScript($params.get($paramName))\",\n #end\n #end\n \"text\": \"$util.escapeJavaScript($params.get('text'))\",\n \"siteid\": \"reliefweb\",\n \"api-id\": \"$context.apiId\",\n \"api-key\": \"$context.identity.apiKey\",\n \"source-ip\": \"$context.identity.sourceIp\",\n \"user\": \"$context.identity.user\",\n \"user-arn\": \"$context.identity.userArn\",\n \"request-id\": \"$context.requestId\",\n \"resource-id\": \"$context.resourceId\",\n \"resource-path\": \"$context.resourcePath\"\n}\n" - }, - "passthroughBehavior" : "when_no_match", - "timeoutInMillis" : 29000, - "contentHandling" : "CONVERT_TO_TEXT", - "type" : "aws" - } - } - }, - "/jobs/search" : { - "get" : { - "parameters" : [ { - "name" : "theme", - "in" : "query", - "schema" : { - "type" : "string" - } - }, { - "name" : "text", - "in" : "query", - "required" : true, - "schema" : { - "type" : "string" - } - }, { - "name" : "job_experience", - "in" : "query", - "schema" : { - "type" : "string" - } - }, { - "name" : "job_type", - "in" : "query", - "schema" : { - "type" : "string" - } - }, { - "name" : "source", - "in" : "query", - "schema" : { - "type" : "string" - } - }, { - "name" : "career_categories", - "in" : "query", - "schema" : { - "type" : "string" - } - }, { - "name" : "city", - "in" : "query", - "schema" : { - "type" : "string" - } - }, { - "name" : "country", - "in" : "query", - "schema" : { - "type" : "string" - } - } ], - "responses" : { - "200" : { - "description" : "200 response", - "content" : { - "application/json" : { - "schema" : { - "$ref" : "#/components/schemas/Empty" - } - } - } - } - }, - "security" : [ { - "rw-api-authorize-key" : [ ] - }, { - "api_key" : [ ] - } ], - "x-amazon-apigateway-request-validator" : "Validate query string parameters and headers", - "x-amazon-apigateway-integration" : { - "httpMethod" : "POST", - "uri" : "arn:aws:apigateway:us-east-1:lambda:path/2015-03-31/functions/arn:aws:lambda:us-east-1:694216630861:function:rw-kb-search/invocations", - "responses" : { - "default" : { - "statusCode" : "200" - } - }, - "requestTemplates" : { - "application/json" : "#set($allParams = $input.params())\n#set($params = $allParams.get('querystring'))\n{\n #foreach($paramName in $params.keySet())\n #if($paramName != \"text\")\n \"$paramName\": \"$util.escapeJavaScript($params.get($paramName))\",\n #end\n #end\n \"text\": \"$util.escapeJavaScript($params.get('text'))\",\n \"siteid\": \"reliefweb\",\n \"bundle\": \"job\",\n \"api-id\": \"$context.apiId\",\n \"api-key\": \"$context.identity.apiKey\",\n \"source-ip\": \"$context.identity.sourceIp\",\n \"user\": \"$context.identity.user\",\n \"user-arn\": \"$context.identity.userArn\",\n \"request-id\": \"$context.requestId\",\n \"resource-id\": \"$context.resourceId\",\n \"resource-path\": \"$context.resourcePath\"\n}" - }, - "passthroughBehavior" : "when_no_match", - "timeoutInMillis" : 29000, - "contentHandling" : "CONVERT_TO_TEXT", - "type" : "aws" - } - } - }, - "/trainings/answer" : { - "get" : { - "parameters" : [ { - "name" : "city", - "in" : "query", - "schema" : { - "type" : "string" - } - }, { - "name" : "theme", - "in" : "query", - "schema" : { - "type" : "string" - } - }, { - "name" : "text", - "in" : "query", - "required" : true, - "schema" : { - "type" : "string" - } - }, { - "name" : "source", - "in" : "query", - "schema" : { - "type" : "string" - } - }, { - "name" : "country", - "in" : "query", - "schema" : { - "type" : "string" - } - } ], - "responses" : { - "200" : { - "description" : "200 response", - "content" : { - "application/json" : { - "schema" : { - "$ref" : "#/components/schemas/Empty" - } - } - } - } - }, - "security" : [ { - "rw-api-authorize-key" : [ ] - }, { - "api_key" : [ ] - } ], - "x-amazon-apigateway-integration" : { - "httpMethod" : "POST", - "uri" : "arn:aws:apigateway:us-east-1:lambda:path/2015-03-31/functions/arn:aws:lambda:us-east-1:694216630861:function:rw-kb-answer/invocations", - "responses" : { - "default" : { - "statusCode" : "200" - } - }, - "requestTemplates" : { - "application/json" : "#set($allParams = $input.params())\n#set($params = $allParams.get('querystring'))\n{\n #foreach($paramName in $params.keySet())\n #if($paramName != \"text\")\n \"$paramName\": \"$util.escapeJavaScript($params.get($paramName))\",\n #end\n #end\n \"text\": \"$util.escapeJavaScript($params.get('text'))\",\n \"siteid\": \"reliefweb\",\n \"bundle\": \"training\",\n \"api-id\": \"$context.apiId\",\n \"api-key\": \"$context.identity.apiKey\",\n \"source-ip\": \"$context.identity.sourceIp\",\n \"user\": \"$context.identity.user\",\n \"user-arn\": \"$context.identity.userArn\",\n \"request-id\": \"$context.requestId\",\n \"resource-id\": \"$context.resourceId\",\n \"resource-path\": \"$context.resourcePath\"\n}" - }, - "passthroughBehavior" : "when_no_match", - "timeoutInMillis" : 29000, - "contentHandling" : "CONVERT_TO_TEXT", - "type" : "aws" - } - } - }, - "/search" : { - "get" : { - "parameters" : [ { - "name" : "feature", - "in" : "query", - "schema" : { - "type" : "string" - } - }, { - "name" : "primary_country", - "in" : "query", - "schema" : { - "type" : "string" - } - }, { - "name" : "theme", - "in" : "query", - "schema" : { - "type" : "string" - } - }, { - "name" : "text", - "in" : "query", - "required" : true, - "schema" : { - "type" : "string" - } - }, { - "name" : "source", - "in" : "query", - "schema" : { - "type" : "string" - } - }, { - "name" : "disaster", - "in" : "query", - "schema" : { - "type" : "string" - } - }, { - "name" : "disaster_type", - "in" : "query", - "schema" : { - "type" : "string" - } - }, { - "name" : "country", - "in" : "query", - "schema" : { - "type" : "string" - } - }, { - "name" : "city", - "in" : "query", - "schema" : { - "type" : "string" - } - } ], - "responses" : { - "200" : { - "description" : "200 response", - "content" : { - "application/json" : { - "schema" : { - "$ref" : "#/components/schemas/Empty" - } - } - } - } - }, - "security" : [ { - "rw-api-authorize-key" : [ ] - }, { - "api_key" : [ ] - } ], - "x-amazon-apigateway-request-validator" : "Validate query string parameters and headers", - "x-amazon-apigateway-integration" : { - "httpMethod" : "POST", - "uri" : "arn:aws:apigateway:us-east-1:lambda:path/2015-03-31/functions/arn:aws:lambda:us-east-1:694216630861:function:rw-kb-search/invocations", - "responses" : { - "default" : { - "statusCode" : "200" - } - }, - "requestTemplates" : { - "application/json" : "#set($allParams = $input.params())\n#set($params = $allParams.get('querystring'))\n{\n #foreach($paramName in $params.keySet())\n #if($paramName != \"text\")\n \"$paramName\": \"$util.escapeJavaScript($params.get($paramName))\",\n #end\n #end\n \"text\": \"$util.escapeJavaScript($params.get('text'))\",\n \"siteid\": \"reliefweb\",\n \"api-id\": \"$context.apiId\",\n \"api-key\": \"$context.identity.apiKey\",\n \"source-ip\": \"$context.identity.sourceIp\",\n \"user\": \"$context.identity.user\",\n \"user-arn\": \"$context.identity.userArn\",\n \"request-id\": \"$context.requestId\",\n \"resource-id\": \"$context.resourceId\",\n \"resource-path\": \"$context.resourcePath\"\n}" - }, - "passthroughBehavior" : "when_no_match", - "timeoutInMillis" : 29000, - "contentHandling" : "CONVERT_TO_TEXT", - "type" : "aws" - } - } - }, - "/jobs/answer" : { - "get" : { - "parameters" : [ { - "name" : "theme", - "in" : "query", - "schema" : { - "type" : "string" - } - }, { - "name" : "text", - "in" : "query", - "required" : true, - "schema" : { - "type" : "string" - } - }, { - "name" : "job_experience", - "in" : "query", - "schema" : { - "type" : "string" - } - }, { - "name" : "job_type", - "in" : "query", - "schema" : { - "type" : "string" - } - }, { - "name" : "source", - "in" : "query", - "schema" : { - "type" : "string" - } - }, { - "name" : "career_categories", - "in" : "query", - "schema" : { - "type" : "string" - } - }, { - "name" : "city", - "in" : "query", - "schema" : { - "type" : "string" - } - }, { - "name" : "country", - "in" : "query", - "schema" : { - "type" : "string" - } - } ], - "responses" : { - "200" : { - "description" : "200 response", - "content" : { - "application/json" : { - "schema" : { - "$ref" : "#/components/schemas/Empty" - } - } - } - } - }, - "security" : [ { - "rw-api-authorize-key" : [ ] - }, { - "api_key" : [ ] - } ], - "x-amazon-apigateway-integration" : { - "httpMethod" : "POST", - "uri" : "arn:aws:apigateway:us-east-1:lambda:path/2015-03-31/functions/arn:aws:lambda:us-east-1:694216630861:function:rw-kb-answer/invocations", - "responses" : { - "default" : { - "statusCode" : "200" - } - }, - "requestTemplates" : { - "application/json" : "#set($allParams = $input.params())\n#set($params = $allParams.get('querystring'))\n{\n #foreach($paramName in $params.keySet())\n #if($paramName != \"text\")\n \"$paramName\": \"$util.escapeJavaScript($params.get($paramName))\",\n #end\n #end\n \"text\": \"$util.escapeJavaScript($params.get('text'))\",\n \"siteid\": \"reliefweb\",\n \"bundle\": \"job\",\n \"api-id\": \"$context.apiId\",\n \"api-key\": \"$context.identity.apiKey\",\n \"source-ip\": \"$context.identity.sourceIp\",\n \"user\": \"$context.identity.user\",\n \"user-arn\": \"$context.identity.userArn\",\n \"request-id\": \"$context.requestId\",\n \"resource-id\": \"$context.resourceId\",\n \"resource-path\": \"$context.resourcePath\"\n}" - }, - "passthroughBehavior" : "when_no_match", - "timeoutInMillis" : 29000, - "contentHandling" : "CONVERT_TO_TEXT", - "type" : "aws" - } - } - }, - "/trainings/search" : { - "get" : { - "parameters" : [ { - "name" : "city", - "in" : "query", - "schema" : { - "type" : "string" - } - }, { - "name" : "theme", - "in" : "query", - "schema" : { - "type" : "string" - } - }, { - "name" : "text", - "in" : "query", - "required" : true, - "schema" : { - "type" : "string" - } - }, { - "name" : "source", - "in" : "query", - "schema" : { - "type" : "string" - } - }, { - "name" : "country", - "in" : "query", - "schema" : { - "type" : "string" - } - } ], - "responses" : { - "200" : { - "description" : "200 response", - "content" : { - "application/json" : { - "schema" : { - "$ref" : "#/components/schemas/Empty" - } - } - } - } - }, - "security" : [ { - "rw-api-authorize-key" : [ ] - }, { - "api_key" : [ ] - } ], - "x-amazon-apigateway-request-validator" : "Validate query string parameters and headers", - "x-amazon-apigateway-integration" : { - "httpMethod" : "POST", - "uri" : "arn:aws:apigateway:us-east-1:lambda:path/2015-03-31/functions/arn:aws:lambda:us-east-1:694216630861:function:rw-kb-search/invocations", - "responses" : { - "default" : { - "statusCode" : "200" - } - }, - "requestTemplates" : { - "application/json" : "#set($allParams = $input.params())\n#set($params = $allParams.get('querystring'))\n{\n #foreach($paramName in $params.keySet())\n #if($paramName != \"text\")\n \"$paramName\": \"$util.escapeJavaScript($params.get($paramName))\",\n #end\n #end\n \"text\": \"$util.escapeJavaScript($params.get('text'))\",\n \"siteid\": \"reliefweb\",\n \"bundle\": \"training\",\n \"api-id\": \"$context.apiId\",\n \"api-key\": \"$context.identity.apiKey\",\n \"source-ip\": \"$context.identity.sourceIp\",\n \"user\": \"$context.identity.user\",\n \"user-arn\": \"$context.identity.userArn\",\n \"request-id\": \"$context.requestId\",\n \"resource-id\": \"$context.resourceId\",\n \"resource-path\": \"$context.resourcePath\"\n}" - }, - "passthroughBehavior" : "when_no_match", - "timeoutInMillis" : 29000, - "contentHandling" : "CONVERT_TO_TEXT", - "type" : "aws" - } - } - }, - "/reports/search" : { - "get" : { - "parameters" : [ { - "name" : "feature", - "in" : "query", - "schema" : { - "type" : "string" - } - }, { - "name" : "primary_country", - "in" : "query", - "schema" : { - "type" : "string" - } - }, { - "name" : "theme", - "in" : "query", - "schema" : { - "type" : "string" - } - }, { - "name" : "text", - "in" : "query", - "required" : true, - "schema" : { - "type" : "string" - } - }, { - "name" : "source", - "in" : "query", - "schema" : { - "type" : "string" - } - }, { - "name" : "disaster", - "in" : "query", - "schema" : { - "type" : "string" - } - }, { - "name" : "disaster_type", - "in" : "query", - "schema" : { - "type" : "string" - } - }, { - "name" : "country", - "in" : "query", - "schema" : { - "type" : "string" - } - } ], - "responses" : { - "200" : { - "description" : "200 response", - "content" : { - "application/json" : { - "schema" : { - "$ref" : "#/components/schemas/Empty" - } - } - } - } - }, - "security" : [ { - "rw-api-authorize-key" : [ ] - }, { - "api_key" : [ ] - } ], - "x-amazon-apigateway-request-validator" : "Validate query string parameters and headers", - "x-amazon-apigateway-integration" : { - "httpMethod" : "POST", - "uri" : "arn:aws:apigateway:us-east-1:lambda:path/2015-03-31/functions/arn:aws:lambda:us-east-1:694216630861:function:rw-kb-search/invocations", - "responses" : { - "default" : { - "statusCode" : "200" - } - }, - "requestTemplates" : { - "application/json" : "#set($allParams = $input.params())\n#set($params = $allParams.get('querystring'))\n{\n #foreach($paramName in $params.keySet())\n #if($paramName != \"text\")\n \"$paramName\": \"$util.escapeJavaScript($params.get($paramName))\",\n #end\n #end\n \"text\": \"$util.escapeJavaScript($params.get('text'))\",\n \"siteid\": \"reliefweb\",\n \"bundle\": \"report\",\n \"api-id\": \"$context.apiId\",\n \"api-key\": \"$context.identity.apiKey\",\n \"source-ip\": \"$context.identity.sourceIp\",\n \"user\": \"$context.identity.user\",\n \"user-arn\": \"$context.identity.userArn\",\n \"request-id\": \"$context.requestId\",\n \"resource-id\": \"$context.resourceId\",\n \"resource-path\": \"$context.resourcePath\"\n}" - }, - "passthroughBehavior" : "when_no_match", - "timeoutInMillis" : 29000, - "contentHandling" : "CONVERT_TO_TEXT", - "type" : "aws" - } - } - }, - "/" : { - "get" : { - "responses" : { - "200" : { - "description" : "200 response", - "content" : { - "application/json" : { - "schema" : { - "$ref" : "#/components/schemas/Empty" - } - } - } - } - }, - "security" : [ { - "rw-api-authorize-key" : [ ] - }, { - "api_key" : [ ] - } ], - "x-amazon-apigateway-integration" : { - "responses" : { - "default" : { - "statusCode" : "200" - } - }, - "requestTemplates" : { - "application/json" : "{\"statusCode\": 200}" - }, - "passthroughBehavior" : "when_no_match", - "type" : "mock" - } - } - } - }, - "components" : { - "schemas" : { - "Empty" : { - "title" : "Empty Schema", - "type" : "object" - } - }, - "securitySchemes" : { - "rw-api-authorize-key" : { - "type" : "apiKey", - "name" : "x-api-key", - "in" : "header", - "x-amazon-apigateway-authtype" : "custom", - "x-amazon-apigateway-authorizer" : { - "authorizerUri" : "arn:aws:apigateway:us-east-1:lambda:path/2015-03-31/functions/arn:aws:lambda:us-east-1:694216630861:function:rw-api-authorizer/invocations", - "authorizerResultTtlInSeconds" : 60, - "identitySource" : "method.request.header.x-api-key", - "type" : "request" - } - }, - "api_key" : { - "type" : "apiKey", - "name" : "x-api-key", - "in" : "header" - } - } - }, - "x-amazon-apigateway-request-validators" : { - "Validate query string parameters and headers" : { - "validateRequestParameters" : true, - "validateRequestBody" : false - } - } -} \ No newline at end of file diff --git a/lamda/index.js b/lamda/index.js deleted file mode 100644 index a4f119b88..000000000 --- a/lamda/index.js +++ /dev/null @@ -1,47 +0,0 @@ -import { - BedrockAgentRuntimeClient, - RetrieveCommand, -} from "@aws-sdk/client-bedrock-agent-runtime"; - - -const client = new BedrockAgentRuntimeClient({region: process.env.AWS_BEDROCK_REGION, - credentials:{ - secretAccessKey:process.env.AWS_BEDROCK_SECRET_ACCESS_KEY, - accessKeyId:process.env.AWS_BEDROCK_ACCESS_KEY_ID - } -}); - -const input = { - knowledgeBaseId: "VIEPSPYNSS", - retrievalQuery: { - text: "Are people starving in Kenya", - }, - retrievalConfiguration: { - vectorSearchConfiguration: { - numberOfResults: 10, - overrideSearchType: "HYBRID", - filter: { - andAll: [ - { - equals: { - key: "status", - value: "1" - }, - }, - { - listContains: { - key: "country", - value: "220" - } - } - ] - } - } - }, -}; - -const command = new RetrieveCommand(input); -const results = await client.send(command); -for (let row of results.retrievalResults) { - console.log(row); -} diff --git a/lamda/index2.js b/lamda/index2.js deleted file mode 100644 index c1f9882be..000000000 --- a/lamda/index2.js +++ /dev/null @@ -1,58 +0,0 @@ -import { - BedrockAgentRuntimeClient, - RetrieveAndGenerateCommand, -} from "@aws-sdk/client-bedrock-agent-runtime"; - - -const client = new BedrockAgentRuntimeClient({region: process.env.AWS_BEDROCK_REGION, - credentials:{ - secretAccessKey:process.env.AWS_BEDROCK_SECRET_ACCESS_KEY, - accessKeyId:process.env.AWS_BEDROCK_ACCESS_KEY_ID - } -}); - -const input = { - input: { text: "Which African countries do need to most support from the World Food Program?" }, - retrieveAndGenerateConfiguration: { - type: "KNOWLEDGE_BASE", - knowledgeBaseConfiguration: { - knowledgeBaseId: "VIEPSPYNSS", - modelArn: "arn:aws:bedrock:us-east-1::foundation-model/amazon.titan-text-premier-v1:0", - retrievalConfiguration: { - vectorSearchConfiguration: { - numberOfResults: 10, - overrideSearchType: "HYBRID", - filter: { - andAll: [ - { - equals: { - key: "status", - value: "1" - }, - }, - { - listContains: { - key: "country", - value: "220" - } - } - ] - } - } - } - } - } -}; - -const command = new RetrieveAndGenerateCommand(input); - -const {citations, output} = await client.send(command); -console.log(output.text) -for (let row of citations) { - console.log(row.generatedResponsePart.textResponsePart.text); - for (let ref of row.retrievedReferences) { - console.log(ref.metadata); - } -} - - diff --git a/lamda/package-lock.json b/lamda/package-lock.json deleted file mode 100644 index f8892ff1f..000000000 --- a/lamda/package-lock.json +++ /dev/null @@ -1,1363 +0,0 @@ -{ - "name": "unocha-kb-lambda", - "version": "1.0.0", - "lockfileVersion": 3, - "requires": true, - "packages": { - "": { - "name": "unocha-kb-lambda", - "version": "1.0.0", - "license": "MIT", - "dependencies": { - "@aws-sdk/client-bedrock-agent-runtime": "^3.642.0" - } - }, - "node_modules/@aws-crypto/crc32": { - "version": "5.2.0", - "resolved": "https://registry.npmjs.org/@aws-crypto/crc32/-/crc32-5.2.0.tgz", - "integrity": "sha512-nLbCWqQNgUiwwtFsen1AdzAtvuLRsQS8rYgMuxCrdKf9kOssamGLuPwyTY9wyYblNr9+1XM8v6zoDTPPSIeANg==", - "license": "Apache-2.0", - "dependencies": { - "@aws-crypto/util": "^5.2.0", - "@aws-sdk/types": "^3.222.0", - "tslib": "^2.6.2" - }, - "engines": { - "node": ">=16.0.0" - } - }, - "node_modules/@aws-crypto/sha256-browser": { - "version": "5.2.0", - "resolved": "https://registry.npmjs.org/@aws-crypto/sha256-browser/-/sha256-browser-5.2.0.tgz", - "integrity": "sha512-AXfN/lGotSQwu6HNcEsIASo7kWXZ5HYWvfOmSNKDsEqC4OashTp8alTmaz+F7TC2L083SFv5RdB+qU3Vs1kZqw==", - "license": "Apache-2.0", - "dependencies": { - "@aws-crypto/sha256-js": "^5.2.0", - "@aws-crypto/supports-web-crypto": "^5.2.0", - "@aws-crypto/util": "^5.2.0", - "@aws-sdk/types": "^3.222.0", - "@aws-sdk/util-locate-window": "^3.0.0", - "@smithy/util-utf8": "^2.0.0", - "tslib": "^2.6.2" - } - }, - "node_modules/@aws-crypto/sha256-browser/node_modules/@smithy/is-array-buffer": { - "version": "2.2.0", - "resolved": "https://registry.npmjs.org/@smithy/is-array-buffer/-/is-array-buffer-2.2.0.tgz", - "integrity": "sha512-GGP3O9QFD24uGeAXYUjwSTXARoqpZykHadOmA8G5vfJPK0/DC67qa//0qvqrJzL1xc8WQWX7/yc7fwudjPHPhA==", - "license": "Apache-2.0", - "dependencies": { - "tslib": "^2.6.2" - }, - "engines": { - "node": ">=14.0.0" - } - }, - "node_modules/@aws-crypto/sha256-browser/node_modules/@smithy/util-buffer-from": { - "version": "2.2.0", - "resolved": "https://registry.npmjs.org/@smithy/util-buffer-from/-/util-buffer-from-2.2.0.tgz", - "integrity": "sha512-IJdWBbTcMQ6DA0gdNhh/BwrLkDR+ADW5Kr1aZmd4k3DIF6ezMV4R2NIAmT08wQJ3yUK82thHWmC/TnK/wpMMIA==", - "license": "Apache-2.0", - "dependencies": { - "@smithy/is-array-buffer": "^2.2.0", - "tslib": "^2.6.2" - }, - "engines": { - "node": ">=14.0.0" - } - }, - "node_modules/@aws-crypto/sha256-browser/node_modules/@smithy/util-utf8": { - "version": "2.3.0", - "resolved": "https://registry.npmjs.org/@smithy/util-utf8/-/util-utf8-2.3.0.tgz", - "integrity": "sha512-R8Rdn8Hy72KKcebgLiv8jQcQkXoLMOGGv5uI1/k0l+snqkOzQ1R0ChUBCxWMlBsFMekWjq0wRudIweFs7sKT5A==", - "license": "Apache-2.0", - "dependencies": { - "@smithy/util-buffer-from": "^2.2.0", - "tslib": "^2.6.2" - }, - "engines": { - "node": ">=14.0.0" - } - }, - "node_modules/@aws-crypto/sha256-js": { - "version": "5.2.0", - "resolved": "https://registry.npmjs.org/@aws-crypto/sha256-js/-/sha256-js-5.2.0.tgz", - "integrity": "sha512-FFQQyu7edu4ufvIZ+OadFpHHOt+eSTBaYaki44c+akjg7qZg9oOQeLlk77F6tSYqjDAFClrHJk9tMf0HdVyOvA==", - "license": "Apache-2.0", - "dependencies": { - "@aws-crypto/util": "^5.2.0", - "@aws-sdk/types": "^3.222.0", - "tslib": "^2.6.2" - }, - "engines": { - "node": ">=16.0.0" - } - }, - "node_modules/@aws-crypto/supports-web-crypto": { - "version": "5.2.0", - "resolved": "https://registry.npmjs.org/@aws-crypto/supports-web-crypto/-/supports-web-crypto-5.2.0.tgz", - "integrity": "sha512-iAvUotm021kM33eCdNfwIN//F77/IADDSs58i+MDaOqFrVjZo9bAal0NK7HurRuWLLpF1iLX7gbWrjHjeo+YFg==", - "license": "Apache-2.0", - "dependencies": { - "tslib": "^2.6.2" - } - }, - "node_modules/@aws-crypto/util": { - "version": "5.2.0", - "resolved": "https://registry.npmjs.org/@aws-crypto/util/-/util-5.2.0.tgz", - "integrity": "sha512-4RkU9EsI6ZpBve5fseQlGNUWKMa1RLPQ1dnjnQoe07ldfIzcsGb5hC5W0Dm7u423KWzawlrpbjXBrXCEv9zazQ==", - "license": "Apache-2.0", - "dependencies": { - "@aws-sdk/types": "^3.222.0", - "@smithy/util-utf8": "^2.0.0", - "tslib": "^2.6.2" - } - }, - "node_modules/@aws-crypto/util/node_modules/@smithy/is-array-buffer": { - "version": "2.2.0", - "resolved": "https://registry.npmjs.org/@smithy/is-array-buffer/-/is-array-buffer-2.2.0.tgz", - "integrity": "sha512-GGP3O9QFD24uGeAXYUjwSTXARoqpZykHadOmA8G5vfJPK0/DC67qa//0qvqrJzL1xc8WQWX7/yc7fwudjPHPhA==", - "license": "Apache-2.0", - "dependencies": { - "tslib": "^2.6.2" - }, - "engines": { - "node": ">=14.0.0" - } - }, - "node_modules/@aws-crypto/util/node_modules/@smithy/util-buffer-from": { - "version": "2.2.0", - "resolved": "https://registry.npmjs.org/@smithy/util-buffer-from/-/util-buffer-from-2.2.0.tgz", - "integrity": "sha512-IJdWBbTcMQ6DA0gdNhh/BwrLkDR+ADW5Kr1aZmd4k3DIF6ezMV4R2NIAmT08wQJ3yUK82thHWmC/TnK/wpMMIA==", - "license": "Apache-2.0", - "dependencies": { - "@smithy/is-array-buffer": "^2.2.0", - "tslib": "^2.6.2" - }, - "engines": { - "node": ">=14.0.0" - } - }, - "node_modules/@aws-crypto/util/node_modules/@smithy/util-utf8": { - "version": "2.3.0", - "resolved": "https://registry.npmjs.org/@smithy/util-utf8/-/util-utf8-2.3.0.tgz", - "integrity": "sha512-R8Rdn8Hy72KKcebgLiv8jQcQkXoLMOGGv5uI1/k0l+snqkOzQ1R0ChUBCxWMlBsFMekWjq0wRudIweFs7sKT5A==", - "license": "Apache-2.0", - "dependencies": { - "@smithy/util-buffer-from": "^2.2.0", - "tslib": "^2.6.2" - }, - "engines": { - "node": ">=14.0.0" - } - }, - "node_modules/@aws-sdk/client-bedrock-agent-runtime": { - "version": "3.642.0", - "resolved": "https://registry.npmjs.org/@aws-sdk/client-bedrock-agent-runtime/-/client-bedrock-agent-runtime-3.642.0.tgz", - "integrity": "sha512-SKVP5CGRvkNu9xNK7ZUm8I6DhLyq+wjC3Q8hFHxISmr/RTlaJBVGOLnakM9tE0BHGayC6xBQNSuDgBYBK2TfBg==", - "license": "Apache-2.0", - "dependencies": { - "@aws-crypto/sha256-browser": "5.2.0", - "@aws-crypto/sha256-js": "5.2.0", - "@aws-sdk/client-sso-oidc": "3.637.0", - "@aws-sdk/client-sts": "3.637.0", - "@aws-sdk/core": "3.635.0", - "@aws-sdk/credential-provider-node": "3.637.0", - "@aws-sdk/middleware-host-header": "3.620.0", - "@aws-sdk/middleware-logger": "3.609.0", - "@aws-sdk/middleware-recursion-detection": "3.620.0", - "@aws-sdk/middleware-user-agent": "3.637.0", - "@aws-sdk/region-config-resolver": "3.614.0", - "@aws-sdk/types": "3.609.0", - "@aws-sdk/util-endpoints": "3.637.0", - "@aws-sdk/util-user-agent-browser": "3.609.0", - "@aws-sdk/util-user-agent-node": "3.614.0", - "@smithy/config-resolver": "^3.0.5", - "@smithy/core": "^2.4.0", - "@smithy/eventstream-serde-browser": "^3.0.6", - "@smithy/eventstream-serde-config-resolver": "^3.0.3", - "@smithy/eventstream-serde-node": "^3.0.5", - "@smithy/fetch-http-handler": "^3.2.4", - "@smithy/hash-node": "^3.0.3", - "@smithy/invalid-dependency": "^3.0.3", - "@smithy/middleware-content-length": "^3.0.5", - "@smithy/middleware-endpoint": "^3.1.0", - "@smithy/middleware-retry": "^3.0.15", - "@smithy/middleware-serde": "^3.0.3", - "@smithy/middleware-stack": "^3.0.3", - "@smithy/node-config-provider": "^3.1.4", - "@smithy/node-http-handler": "^3.1.4", - "@smithy/protocol-http": "^4.1.0", - "@smithy/smithy-client": "^3.2.0", - "@smithy/types": "^3.3.0", - "@smithy/url-parser": "^3.0.3", - "@smithy/util-base64": "^3.0.0", - "@smithy/util-body-length-browser": "^3.0.0", - "@smithy/util-body-length-node": "^3.0.0", - "@smithy/util-defaults-mode-browser": "^3.0.15", - "@smithy/util-defaults-mode-node": "^3.0.15", - "@smithy/util-endpoints": "^2.0.5", - "@smithy/util-middleware": "^3.0.3", - "@smithy/util-retry": "^3.0.3", - "@smithy/util-utf8": "^3.0.0", - "tslib": "^2.6.2" - }, - "engines": { - "node": ">=16.0.0" - } - }, - "node_modules/@aws-sdk/client-sso": { - "version": "3.637.0", - "resolved": "https://registry.npmjs.org/@aws-sdk/client-sso/-/client-sso-3.637.0.tgz", - "integrity": "sha512-+KjLvgX5yJYROWo3TQuwBJlHCY0zz9PsLuEolmXQn0BVK1L/m9GteZHtd+rEdAoDGBpE0Xqjy1oz5+SmtsaRUw==", - "license": "Apache-2.0", - "dependencies": { - "@aws-crypto/sha256-browser": "5.2.0", - "@aws-crypto/sha256-js": "5.2.0", - "@aws-sdk/core": "3.635.0", - "@aws-sdk/middleware-host-header": "3.620.0", - "@aws-sdk/middleware-logger": "3.609.0", - "@aws-sdk/middleware-recursion-detection": "3.620.0", - "@aws-sdk/middleware-user-agent": "3.637.0", - "@aws-sdk/region-config-resolver": "3.614.0", - "@aws-sdk/types": "3.609.0", - "@aws-sdk/util-endpoints": "3.637.0", - "@aws-sdk/util-user-agent-browser": "3.609.0", - "@aws-sdk/util-user-agent-node": "3.614.0", - "@smithy/config-resolver": "^3.0.5", - "@smithy/core": "^2.4.0", - "@smithy/fetch-http-handler": "^3.2.4", - "@smithy/hash-node": "^3.0.3", - "@smithy/invalid-dependency": "^3.0.3", - "@smithy/middleware-content-length": "^3.0.5", - "@smithy/middleware-endpoint": "^3.1.0", - "@smithy/middleware-retry": "^3.0.15", - "@smithy/middleware-serde": "^3.0.3", - "@smithy/middleware-stack": "^3.0.3", - "@smithy/node-config-provider": "^3.1.4", - "@smithy/node-http-handler": "^3.1.4", - "@smithy/protocol-http": "^4.1.0", - "@smithy/smithy-client": "^3.2.0", - "@smithy/types": "^3.3.0", - "@smithy/url-parser": "^3.0.3", - "@smithy/util-base64": "^3.0.0", - "@smithy/util-body-length-browser": "^3.0.0", - "@smithy/util-body-length-node": "^3.0.0", - "@smithy/util-defaults-mode-browser": "^3.0.15", - "@smithy/util-defaults-mode-node": "^3.0.15", - "@smithy/util-endpoints": "^2.0.5", - "@smithy/util-middleware": "^3.0.3", - "@smithy/util-retry": "^3.0.3", - "@smithy/util-utf8": "^3.0.0", - "tslib": "^2.6.2" - }, - "engines": { - "node": ">=16.0.0" - } - }, - "node_modules/@aws-sdk/client-sso-oidc": { - "version": "3.637.0", - "resolved": "https://registry.npmjs.org/@aws-sdk/client-sso-oidc/-/client-sso-oidc-3.637.0.tgz", - "integrity": "sha512-27bHALN6Qb6m6KZmPvRieJ/QRlj1lyac/GT2Rn5kJpre8Mpp+yxrtvp3h9PjNBty4lCeFEENfY4dGNSozBuBcw==", - "license": "Apache-2.0", - "dependencies": { - "@aws-crypto/sha256-browser": "5.2.0", - "@aws-crypto/sha256-js": "5.2.0", - "@aws-sdk/core": "3.635.0", - "@aws-sdk/credential-provider-node": "3.637.0", - "@aws-sdk/middleware-host-header": "3.620.0", - "@aws-sdk/middleware-logger": "3.609.0", - "@aws-sdk/middleware-recursion-detection": "3.620.0", - "@aws-sdk/middleware-user-agent": "3.637.0", - "@aws-sdk/region-config-resolver": "3.614.0", - "@aws-sdk/types": "3.609.0", - "@aws-sdk/util-endpoints": "3.637.0", - "@aws-sdk/util-user-agent-browser": "3.609.0", - "@aws-sdk/util-user-agent-node": "3.614.0", - "@smithy/config-resolver": "^3.0.5", - "@smithy/core": "^2.4.0", - "@smithy/fetch-http-handler": "^3.2.4", - "@smithy/hash-node": "^3.0.3", - "@smithy/invalid-dependency": "^3.0.3", - "@smithy/middleware-content-length": "^3.0.5", - "@smithy/middleware-endpoint": "^3.1.0", - "@smithy/middleware-retry": "^3.0.15", - "@smithy/middleware-serde": "^3.0.3", - "@smithy/middleware-stack": "^3.0.3", - "@smithy/node-config-provider": "^3.1.4", - "@smithy/node-http-handler": "^3.1.4", - "@smithy/protocol-http": "^4.1.0", - "@smithy/smithy-client": "^3.2.0", - "@smithy/types": "^3.3.0", - "@smithy/url-parser": "^3.0.3", - "@smithy/util-base64": "^3.0.0", - "@smithy/util-body-length-browser": "^3.0.0", - "@smithy/util-body-length-node": "^3.0.0", - "@smithy/util-defaults-mode-browser": "^3.0.15", - "@smithy/util-defaults-mode-node": "^3.0.15", - "@smithy/util-endpoints": "^2.0.5", - "@smithy/util-middleware": "^3.0.3", - "@smithy/util-retry": "^3.0.3", - "@smithy/util-utf8": "^3.0.0", - "tslib": "^2.6.2" - }, - "engines": { - "node": ">=16.0.0" - }, - "peerDependencies": { - "@aws-sdk/client-sts": "^3.637.0" - } - }, - "node_modules/@aws-sdk/client-sts": { - "version": "3.637.0", - "resolved": "https://registry.npmjs.org/@aws-sdk/client-sts/-/client-sts-3.637.0.tgz", - "integrity": "sha512-xUi7x4qDubtA8QREtlblPuAcn91GS/09YVEY/RwU7xCY0aqGuFwgszAANlha4OUIqva8oVj2WO4gJuG+iaSnhw==", - "license": "Apache-2.0", - "dependencies": { - "@aws-crypto/sha256-browser": "5.2.0", - "@aws-crypto/sha256-js": "5.2.0", - "@aws-sdk/client-sso-oidc": "3.637.0", - "@aws-sdk/core": "3.635.0", - "@aws-sdk/credential-provider-node": "3.637.0", - "@aws-sdk/middleware-host-header": "3.620.0", - "@aws-sdk/middleware-logger": "3.609.0", - "@aws-sdk/middleware-recursion-detection": "3.620.0", - "@aws-sdk/middleware-user-agent": "3.637.0", - "@aws-sdk/region-config-resolver": "3.614.0", - "@aws-sdk/types": "3.609.0", - "@aws-sdk/util-endpoints": "3.637.0", - "@aws-sdk/util-user-agent-browser": "3.609.0", - "@aws-sdk/util-user-agent-node": "3.614.0", - "@smithy/config-resolver": "^3.0.5", - "@smithy/core": "^2.4.0", - "@smithy/fetch-http-handler": "^3.2.4", - "@smithy/hash-node": "^3.0.3", - "@smithy/invalid-dependency": "^3.0.3", - "@smithy/middleware-content-length": "^3.0.5", - "@smithy/middleware-endpoint": "^3.1.0", - "@smithy/middleware-retry": "^3.0.15", - "@smithy/middleware-serde": "^3.0.3", - "@smithy/middleware-stack": "^3.0.3", - "@smithy/node-config-provider": "^3.1.4", - "@smithy/node-http-handler": "^3.1.4", - "@smithy/protocol-http": "^4.1.0", - "@smithy/smithy-client": "^3.2.0", - "@smithy/types": "^3.3.0", - "@smithy/url-parser": "^3.0.3", - "@smithy/util-base64": "^3.0.0", - "@smithy/util-body-length-browser": "^3.0.0", - "@smithy/util-body-length-node": "^3.0.0", - "@smithy/util-defaults-mode-browser": "^3.0.15", - "@smithy/util-defaults-mode-node": "^3.0.15", - "@smithy/util-endpoints": "^2.0.5", - "@smithy/util-middleware": "^3.0.3", - "@smithy/util-retry": "^3.0.3", - "@smithy/util-utf8": "^3.0.0", - "tslib": "^2.6.2" - }, - "engines": { - "node": ">=16.0.0" - } - }, - "node_modules/@aws-sdk/core": { - "version": "3.635.0", - "resolved": "https://registry.npmjs.org/@aws-sdk/core/-/core-3.635.0.tgz", - "integrity": "sha512-i1x/E/sgA+liUE1XJ7rj1dhyXpAKO1UKFUcTTHXok2ARjWTvszHnSXMOsB77aPbmn0fUp1JTx2kHUAZ1LVt5Bg==", - "license": "Apache-2.0", - "dependencies": { - "@smithy/core": "^2.4.0", - "@smithy/node-config-provider": "^3.1.4", - "@smithy/property-provider": "^3.1.3", - "@smithy/protocol-http": "^4.1.0", - "@smithy/signature-v4": "^4.1.0", - "@smithy/smithy-client": "^3.2.0", - "@smithy/types": "^3.3.0", - "@smithy/util-middleware": "^3.0.3", - "fast-xml-parser": "4.4.1", - "tslib": "^2.6.2" - }, - "engines": { - "node": ">=16.0.0" - } - }, - "node_modules/@aws-sdk/credential-provider-env": { - "version": "3.620.1", - "resolved": "https://registry.npmjs.org/@aws-sdk/credential-provider-env/-/credential-provider-env-3.620.1.tgz", - "integrity": "sha512-ExuILJ2qLW5ZO+rgkNRj0xiAipKT16Rk77buvPP8csR7kkCflT/gXTyzRe/uzIiETTxM7tr8xuO9MP/DQXqkfg==", - "license": "Apache-2.0", - "dependencies": { - "@aws-sdk/types": "3.609.0", - "@smithy/property-provider": "^3.1.3", - "@smithy/types": "^3.3.0", - "tslib": "^2.6.2" - }, - "engines": { - "node": ">=16.0.0" - } - }, - "node_modules/@aws-sdk/credential-provider-http": { - "version": "3.635.0", - "resolved": "https://registry.npmjs.org/@aws-sdk/credential-provider-http/-/credential-provider-http-3.635.0.tgz", - "integrity": "sha512-iJyRgEjOCQlBMXqtwPLIKYc7Bsc6nqjrZybdMDenPDa+kmLg7xh8LxHsu9088e+2/wtLicE34FsJJIfzu3L82g==", - "license": "Apache-2.0", - "dependencies": { - "@aws-sdk/types": "3.609.0", - "@smithy/fetch-http-handler": "^3.2.4", - "@smithy/node-http-handler": "^3.1.4", - "@smithy/property-provider": "^3.1.3", - "@smithy/protocol-http": "^4.1.0", - "@smithy/smithy-client": "^3.2.0", - "@smithy/types": "^3.3.0", - "@smithy/util-stream": "^3.1.3", - "tslib": "^2.6.2" - }, - "engines": { - "node": ">=16.0.0" - } - }, - "node_modules/@aws-sdk/credential-provider-ini": { - "version": "3.637.0", - "resolved": "https://registry.npmjs.org/@aws-sdk/credential-provider-ini/-/credential-provider-ini-3.637.0.tgz", - "integrity": "sha512-h+PFCWfZ0Q3Dx84SppET/TFpcQHmxFW8/oV9ArEvMilw4EBN+IlxgbL0CnHwjHW64szcmrM0mbebjEfHf4FXmw==", - "license": "Apache-2.0", - "dependencies": { - "@aws-sdk/credential-provider-env": "3.620.1", - "@aws-sdk/credential-provider-http": "3.635.0", - "@aws-sdk/credential-provider-process": "3.620.1", - "@aws-sdk/credential-provider-sso": "3.637.0", - "@aws-sdk/credential-provider-web-identity": "3.621.0", - "@aws-sdk/types": "3.609.0", - "@smithy/credential-provider-imds": "^3.2.0", - "@smithy/property-provider": "^3.1.3", - "@smithy/shared-ini-file-loader": "^3.1.4", - "@smithy/types": "^3.3.0", - "tslib": "^2.6.2" - }, - "engines": { - "node": ">=16.0.0" - }, - "peerDependencies": { - "@aws-sdk/client-sts": "^3.637.0" - } - }, - "node_modules/@aws-sdk/credential-provider-node": { - "version": "3.637.0", - "resolved": "https://registry.npmjs.org/@aws-sdk/credential-provider-node/-/credential-provider-node-3.637.0.tgz", - "integrity": "sha512-yoEhoxJJfs7sPVQ6Is939BDQJZpZCoUgKr/ySse4YKOZ24t4VqgHA6+wV7rYh+7IW24Rd91UTvEzSuHYTlxlNA==", - "license": "Apache-2.0", - "dependencies": { - "@aws-sdk/credential-provider-env": "3.620.1", - "@aws-sdk/credential-provider-http": "3.635.0", - "@aws-sdk/credential-provider-ini": "3.637.0", - "@aws-sdk/credential-provider-process": "3.620.1", - "@aws-sdk/credential-provider-sso": "3.637.0", - "@aws-sdk/credential-provider-web-identity": "3.621.0", - "@aws-sdk/types": "3.609.0", - "@smithy/credential-provider-imds": "^3.2.0", - "@smithy/property-provider": "^3.1.3", - "@smithy/shared-ini-file-loader": "^3.1.4", - "@smithy/types": "^3.3.0", - "tslib": "^2.6.2" - }, - "engines": { - "node": ">=16.0.0" - } - }, - "node_modules/@aws-sdk/credential-provider-process": { - "version": "3.620.1", - "resolved": "https://registry.npmjs.org/@aws-sdk/credential-provider-process/-/credential-provider-process-3.620.1.tgz", - "integrity": "sha512-hWqFMidqLAkaV9G460+1at6qa9vySbjQKKc04p59OT7lZ5cO5VH5S4aI05e+m4j364MBROjjk2ugNvfNf/8ILg==", - "license": "Apache-2.0", - "dependencies": { - "@aws-sdk/types": "3.609.0", - "@smithy/property-provider": "^3.1.3", - "@smithy/shared-ini-file-loader": "^3.1.4", - "@smithy/types": "^3.3.0", - "tslib": "^2.6.2" - }, - "engines": { - "node": ">=16.0.0" - } - }, - "node_modules/@aws-sdk/credential-provider-sso": { - "version": "3.637.0", - "resolved": "https://registry.npmjs.org/@aws-sdk/credential-provider-sso/-/credential-provider-sso-3.637.0.tgz", - "integrity": "sha512-Mvz+h+e62/tl+dVikLafhv+qkZJ9RUb8l2YN/LeKMWkxQylPT83CPk9aimVhCV89zth1zpREArl97+3xsfgQvA==", - "license": "Apache-2.0", - "dependencies": { - "@aws-sdk/client-sso": "3.637.0", - "@aws-sdk/token-providers": "3.614.0", - "@aws-sdk/types": "3.609.0", - "@smithy/property-provider": "^3.1.3", - "@smithy/shared-ini-file-loader": "^3.1.4", - "@smithy/types": "^3.3.0", - "tslib": "^2.6.2" - }, - "engines": { - "node": ">=16.0.0" - } - }, - "node_modules/@aws-sdk/credential-provider-web-identity": { - "version": "3.621.0", - "resolved": "https://registry.npmjs.org/@aws-sdk/credential-provider-web-identity/-/credential-provider-web-identity-3.621.0.tgz", - "integrity": "sha512-w7ASSyfNvcx7+bYGep3VBgC3K6vEdLmlpjT7nSIHxxQf+WSdvy+HynwJosrpZax0sK5q0D1Jpn/5q+r5lwwW6w==", - "license": "Apache-2.0", - "dependencies": { - "@aws-sdk/types": "3.609.0", - "@smithy/property-provider": "^3.1.3", - "@smithy/types": "^3.3.0", - "tslib": "^2.6.2" - }, - "engines": { - "node": ">=16.0.0" - }, - "peerDependencies": { - "@aws-sdk/client-sts": "^3.621.0" - } - }, - "node_modules/@aws-sdk/middleware-host-header": { - "version": "3.620.0", - "resolved": "https://registry.npmjs.org/@aws-sdk/middleware-host-header/-/middleware-host-header-3.620.0.tgz", - "integrity": "sha512-VMtPEZwqYrII/oUkffYsNWY9PZ9xpNJpMgmyU0rlDQ25O1c0Hk3fJmZRe6pEkAJ0omD7kLrqGl1DUjQVxpd/Rg==", - "license": "Apache-2.0", - "dependencies": { - "@aws-sdk/types": "3.609.0", - "@smithy/protocol-http": "^4.1.0", - "@smithy/types": "^3.3.0", - "tslib": "^2.6.2" - }, - "engines": { - "node": ">=16.0.0" - } - }, - "node_modules/@aws-sdk/middleware-logger": { - "version": "3.609.0", - "resolved": "https://registry.npmjs.org/@aws-sdk/middleware-logger/-/middleware-logger-3.609.0.tgz", - "integrity": "sha512-S62U2dy4jMDhDFDK5gZ4VxFdWzCtLzwbYyFZx2uvPYTECkepLUfzLic2BHg2Qvtu4QjX+oGE3P/7fwaGIsGNuQ==", - "license": "Apache-2.0", - "dependencies": { - "@aws-sdk/types": "3.609.0", - "@smithy/types": "^3.3.0", - "tslib": "^2.6.2" - }, - "engines": { - "node": ">=16.0.0" - } - }, - "node_modules/@aws-sdk/middleware-recursion-detection": { - "version": "3.620.0", - "resolved": "https://registry.npmjs.org/@aws-sdk/middleware-recursion-detection/-/middleware-recursion-detection-3.620.0.tgz", - "integrity": "sha512-nh91S7aGK3e/o1ck64sA/CyoFw+gAYj2BDOnoNa6ouyCrVJED96ZXWbhye/fz9SgmNUZR2g7GdVpiLpMKZoI5w==", - "license": "Apache-2.0", - "dependencies": { - "@aws-sdk/types": "3.609.0", - "@smithy/protocol-http": "^4.1.0", - "@smithy/types": "^3.3.0", - "tslib": "^2.6.2" - }, - "engines": { - "node": ">=16.0.0" - } - }, - "node_modules/@aws-sdk/middleware-user-agent": { - "version": "3.637.0", - "resolved": "https://registry.npmjs.org/@aws-sdk/middleware-user-agent/-/middleware-user-agent-3.637.0.tgz", - "integrity": "sha512-EYo0NE9/da/OY8STDsK2LvM4kNa79DBsf4YVtaG4P5pZ615IeFsD8xOHZeuJmUrSMlVQ8ywPRX7WMucUybsKug==", - "license": "Apache-2.0", - "dependencies": { - "@aws-sdk/types": "3.609.0", - "@aws-sdk/util-endpoints": "3.637.0", - "@smithy/protocol-http": "^4.1.0", - "@smithy/types": "^3.3.0", - "tslib": "^2.6.2" - }, - "engines": { - "node": ">=16.0.0" - } - }, - "node_modules/@aws-sdk/region-config-resolver": { - "version": "3.614.0", - "resolved": "https://registry.npmjs.org/@aws-sdk/region-config-resolver/-/region-config-resolver-3.614.0.tgz", - "integrity": "sha512-vDCeMXvic/LU0KFIUjpC3RiSTIkkvESsEfbVHiHH0YINfl8HnEqR5rj+L8+phsCeVg2+LmYwYxd5NRz4PHxt5g==", - "license": "Apache-2.0", - "dependencies": { - "@aws-sdk/types": "3.609.0", - "@smithy/node-config-provider": "^3.1.4", - "@smithy/types": "^3.3.0", - "@smithy/util-config-provider": "^3.0.0", - "@smithy/util-middleware": "^3.0.3", - "tslib": "^2.6.2" - }, - "engines": { - "node": ">=16.0.0" - } - }, - "node_modules/@aws-sdk/token-providers": { - "version": "3.614.0", - "resolved": "https://registry.npmjs.org/@aws-sdk/token-providers/-/token-providers-3.614.0.tgz", - "integrity": "sha512-okItqyY6L9IHdxqs+Z116y5/nda7rHxLvROxtAJdLavWTYDydxrZstImNgGWTeVdmc0xX2gJCI77UYUTQWnhRw==", - "license": "Apache-2.0", - "dependencies": { - "@aws-sdk/types": "3.609.0", - "@smithy/property-provider": "^3.1.3", - "@smithy/shared-ini-file-loader": "^3.1.4", - "@smithy/types": "^3.3.0", - "tslib": "^2.6.2" - }, - "engines": { - "node": ">=16.0.0" - }, - "peerDependencies": { - "@aws-sdk/client-sso-oidc": "^3.614.0" - } - }, - "node_modules/@aws-sdk/types": { - "version": "3.609.0", - "resolved": "https://registry.npmjs.org/@aws-sdk/types/-/types-3.609.0.tgz", - "integrity": "sha512-+Tqnh9w0h2LcrUsdXyT1F8mNhXz+tVYBtP19LpeEGntmvHwa2XzvLUCWpoIAIVsHp5+HdB2X9Sn0KAtmbFXc2Q==", - "license": "Apache-2.0", - "dependencies": { - "@smithy/types": "^3.3.0", - "tslib": "^2.6.2" - }, - "engines": { - "node": ">=16.0.0" - } - }, - "node_modules/@aws-sdk/util-endpoints": { - "version": "3.637.0", - "resolved": "https://registry.npmjs.org/@aws-sdk/util-endpoints/-/util-endpoints-3.637.0.tgz", - "integrity": "sha512-pAqOKUHeVWHEXXDIp/qoMk/6jyxIb6GGjnK1/f8dKHtKIEs4tKsnnL563gceEvdad53OPXIt86uoevCcCzmBnw==", - "license": "Apache-2.0", - "dependencies": { - "@aws-sdk/types": "3.609.0", - "@smithy/types": "^3.3.0", - "@smithy/util-endpoints": "^2.0.5", - "tslib": "^2.6.2" - }, - "engines": { - "node": ">=16.0.0" - } - }, - "node_modules/@aws-sdk/util-locate-window": { - "version": "3.568.0", - "resolved": "https://registry.npmjs.org/@aws-sdk/util-locate-window/-/util-locate-window-3.568.0.tgz", - "integrity": "sha512-3nh4TINkXYr+H41QaPelCceEB2FXP3fxp93YZXB/kqJvX0U9j0N0Uk45gvsjmEPzG8XxkPEeLIfT2I1M7A6Lig==", - "license": "Apache-2.0", - "dependencies": { - "tslib": "^2.6.2" - }, - "engines": { - "node": ">=16.0.0" - } - }, - "node_modules/@aws-sdk/util-user-agent-browser": { - "version": "3.609.0", - "resolved": "https://registry.npmjs.org/@aws-sdk/util-user-agent-browser/-/util-user-agent-browser-3.609.0.tgz", - "integrity": "sha512-fojPU+mNahzQ0YHYBsx0ZIhmMA96H+ZIZ665ObU9tl+SGdbLneVZVikGve+NmHTQwHzwkFsZYYnVKAkreJLAtA==", - "license": "Apache-2.0", - "dependencies": { - "@aws-sdk/types": "3.609.0", - "@smithy/types": "^3.3.0", - "bowser": "^2.11.0", - "tslib": "^2.6.2" - } - }, - "node_modules/@aws-sdk/util-user-agent-node": { - "version": "3.614.0", - "resolved": "https://registry.npmjs.org/@aws-sdk/util-user-agent-node/-/util-user-agent-node-3.614.0.tgz", - "integrity": "sha512-15ElZT88peoHnq5TEoEtZwoXTXRxNrk60TZNdpl/TUBJ5oNJ9Dqb5Z4ryb8ofN6nm9aFf59GVAerFDz8iUoHBA==", - "license": "Apache-2.0", - "dependencies": { - "@aws-sdk/types": "3.609.0", - "@smithy/node-config-provider": "^3.1.4", - "@smithy/types": "^3.3.0", - "tslib": "^2.6.2" - }, - "engines": { - "node": ">=16.0.0" - }, - "peerDependencies": { - "aws-crt": ">=1.0.0" - }, - "peerDependenciesMeta": { - "aws-crt": { - "optional": true - } - } - }, - "node_modules/@smithy/abort-controller": { - "version": "3.1.1", - "resolved": "https://registry.npmjs.org/@smithy/abort-controller/-/abort-controller-3.1.1.tgz", - "integrity": "sha512-MBJBiidoe+0cTFhyxT8g+9g7CeVccLM0IOKKUMCNQ1CNMJ/eIfoo0RTfVrXOONEI1UCN1W+zkiHSbzUNE9dZtQ==", - "license": "Apache-2.0", - "dependencies": { - "@smithy/types": "^3.3.0", - "tslib": "^2.6.2" - }, - "engines": { - "node": ">=16.0.0" - } - }, - "node_modules/@smithy/config-resolver": { - "version": "3.0.5", - "resolved": "https://registry.npmjs.org/@smithy/config-resolver/-/config-resolver-3.0.5.tgz", - "integrity": "sha512-SkW5LxfkSI1bUC74OtfBbdz+grQXYiPYolyu8VfpLIjEoN/sHVBlLeGXMQ1vX4ejkgfv6sxVbQJ32yF2cl1veA==", - "license": "Apache-2.0", - "dependencies": { - "@smithy/node-config-provider": "^3.1.4", - "@smithy/types": "^3.3.0", - "@smithy/util-config-provider": "^3.0.0", - "@smithy/util-middleware": "^3.0.3", - "tslib": "^2.6.2" - }, - "engines": { - "node": ">=16.0.0" - } - }, - "node_modules/@smithy/core": { - "version": "2.4.0", - "resolved": "https://registry.npmjs.org/@smithy/core/-/core-2.4.0.tgz", - "integrity": "sha512-cHXq+FneIF/KJbt4q4pjN186+Jf4ZB0ZOqEaZMBhT79srEyGDDBV31NqBRBjazz8ppQ1bJbDJMY9ba5wKFV36w==", - "license": "Apache-2.0", - "dependencies": { - "@smithy/middleware-endpoint": "^3.1.0", - "@smithy/middleware-retry": "^3.0.15", - "@smithy/middleware-serde": "^3.0.3", - "@smithy/protocol-http": "^4.1.0", - "@smithy/smithy-client": "^3.2.0", - "@smithy/types": "^3.3.0", - "@smithy/util-body-length-browser": "^3.0.0", - "@smithy/util-middleware": "^3.0.3", - "@smithy/util-utf8": "^3.0.0", - "tslib": "^2.6.2" - }, - "engines": { - "node": ">=16.0.0" - } - }, - "node_modules/@smithy/credential-provider-imds": { - "version": "3.2.0", - "resolved": "https://registry.npmjs.org/@smithy/credential-provider-imds/-/credential-provider-imds-3.2.0.tgz", - "integrity": "sha512-0SCIzgd8LYZ9EJxUjLXBmEKSZR/P/w6l7Rz/pab9culE/RWuqelAKGJvn5qUOl8BgX8Yj5HWM50A5hiB/RzsgA==", - "license": "Apache-2.0", - "dependencies": { - "@smithy/node-config-provider": "^3.1.4", - "@smithy/property-provider": "^3.1.3", - "@smithy/types": "^3.3.0", - "@smithy/url-parser": "^3.0.3", - "tslib": "^2.6.2" - }, - "engines": { - "node": ">=16.0.0" - } - }, - "node_modules/@smithy/eventstream-codec": { - "version": "3.1.2", - "resolved": "https://registry.npmjs.org/@smithy/eventstream-codec/-/eventstream-codec-3.1.2.tgz", - "integrity": "sha512-0mBcu49JWt4MXhrhRAlxASNy0IjDRFU+aWNDRal9OtUJvJNiwDuyKMUONSOjLjSCeGwZaE0wOErdqULer8r7yw==", - "license": "Apache-2.0", - "dependencies": { - "@aws-crypto/crc32": "5.2.0", - "@smithy/types": "^3.3.0", - "@smithy/util-hex-encoding": "^3.0.0", - "tslib": "^2.6.2" - } - }, - "node_modules/@smithy/eventstream-serde-browser": { - "version": "3.0.6", - "resolved": "https://registry.npmjs.org/@smithy/eventstream-serde-browser/-/eventstream-serde-browser-3.0.6.tgz", - "integrity": "sha512-2hM54UWQUOrki4BtsUI1WzmD13/SeaqT/AB3EUJKbcver/WgKNaiJ5y5F5XXuVe6UekffVzuUDrBZVAA3AWRpQ==", - "license": "Apache-2.0", - "dependencies": { - "@smithy/eventstream-serde-universal": "^3.0.5", - "@smithy/types": "^3.3.0", - "tslib": "^2.6.2" - }, - "engines": { - "node": ">=16.0.0" - } - }, - "node_modules/@smithy/eventstream-serde-config-resolver": { - "version": "3.0.3", - "resolved": "https://registry.npmjs.org/@smithy/eventstream-serde-config-resolver/-/eventstream-serde-config-resolver-3.0.3.tgz", - "integrity": "sha512-NVTYjOuYpGfrN/VbRQgn31x73KDLfCXCsFdad8DiIc3IcdxL+dYA9zEQPyOP7Fy2QL8CPy2WE4WCUD+ZsLNfaQ==", - "license": "Apache-2.0", - "dependencies": { - "@smithy/types": "^3.3.0", - "tslib": "^2.6.2" - }, - "engines": { - "node": ">=16.0.0" - } - }, - "node_modules/@smithy/eventstream-serde-node": { - "version": "3.0.5", - "resolved": "https://registry.npmjs.org/@smithy/eventstream-serde-node/-/eventstream-serde-node-3.0.5.tgz", - "integrity": "sha512-+upXvnHNyZP095s11jF5dhGw/Ihzqwl5G+/KtMnoQOpdfC3B5HYCcDVG9EmgkhJMXJlM64PyN5gjJl0uXFQehQ==", - "license": "Apache-2.0", - "dependencies": { - "@smithy/eventstream-serde-universal": "^3.0.5", - "@smithy/types": "^3.3.0", - "tslib": "^2.6.2" - }, - "engines": { - "node": ">=16.0.0" - } - }, - "node_modules/@smithy/eventstream-serde-universal": { - "version": "3.0.5", - "resolved": "https://registry.npmjs.org/@smithy/eventstream-serde-universal/-/eventstream-serde-universal-3.0.5.tgz", - "integrity": "sha512-5u/nXbyoh1s4QxrvNre9V6vfyoLWuiVvvd5TlZjGThIikc3G+uNiG9uOTCWweSRjv1asdDIWK7nOmN7le4RYHQ==", - "license": "Apache-2.0", - "dependencies": { - "@smithy/eventstream-codec": "^3.1.2", - "@smithy/types": "^3.3.0", - "tslib": "^2.6.2" - }, - "engines": { - "node": ">=16.0.0" - } - }, - "node_modules/@smithy/fetch-http-handler": { - "version": "3.2.4", - "resolved": "https://registry.npmjs.org/@smithy/fetch-http-handler/-/fetch-http-handler-3.2.4.tgz", - "integrity": "sha512-kBprh5Gs5h7ug4nBWZi1FZthdqSM+T7zMmsZxx0IBvWUn7dK3diz2SHn7Bs4dQGFDk8plDv375gzenDoNwrXjg==", - "license": "Apache-2.0", - "dependencies": { - "@smithy/protocol-http": "^4.1.0", - "@smithy/querystring-builder": "^3.0.3", - "@smithy/types": "^3.3.0", - "@smithy/util-base64": "^3.0.0", - "tslib": "^2.6.2" - } - }, - "node_modules/@smithy/hash-node": { - "version": "3.0.3", - "resolved": "https://registry.npmjs.org/@smithy/hash-node/-/hash-node-3.0.3.tgz", - "integrity": "sha512-2ctBXpPMG+B3BtWSGNnKELJ7SH9e4TNefJS0cd2eSkOOROeBnnVBnAy9LtJ8tY4vUEoe55N4CNPxzbWvR39iBw==", - "license": "Apache-2.0", - "dependencies": { - "@smithy/types": "^3.3.0", - "@smithy/util-buffer-from": "^3.0.0", - "@smithy/util-utf8": "^3.0.0", - "tslib": "^2.6.2" - }, - "engines": { - "node": ">=16.0.0" - } - }, - "node_modules/@smithy/invalid-dependency": { - "version": "3.0.3", - "resolved": "https://registry.npmjs.org/@smithy/invalid-dependency/-/invalid-dependency-3.0.3.tgz", - "integrity": "sha512-ID1eL/zpDULmHJbflb864k72/SNOZCADRc9i7Exq3RUNJw6raWUSlFEQ+3PX3EYs++bTxZB2dE9mEHTQLv61tw==", - "license": "Apache-2.0", - "dependencies": { - "@smithy/types": "^3.3.0", - "tslib": "^2.6.2" - } - }, - "node_modules/@smithy/is-array-buffer": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/@smithy/is-array-buffer/-/is-array-buffer-3.0.0.tgz", - "integrity": "sha512-+Fsu6Q6C4RSJiy81Y8eApjEB5gVtM+oFKTffg+jSuwtvomJJrhUJBu2zS8wjXSgH/g1MKEWrzyChTBe6clb5FQ==", - "license": "Apache-2.0", - "dependencies": { - "tslib": "^2.6.2" - }, - "engines": { - "node": ">=16.0.0" - } - }, - "node_modules/@smithy/middleware-content-length": { - "version": "3.0.5", - "resolved": "https://registry.npmjs.org/@smithy/middleware-content-length/-/middleware-content-length-3.0.5.tgz", - "integrity": "sha512-ILEzC2eyxx6ncej3zZSwMpB5RJ0zuqH7eMptxC4KN3f+v9bqT8ohssKbhNR78k/2tWW+KS5Spw+tbPF4Ejyqvw==", - "license": "Apache-2.0", - "dependencies": { - "@smithy/protocol-http": "^4.1.0", - "@smithy/types": "^3.3.0", - "tslib": "^2.6.2" - }, - "engines": { - "node": ">=16.0.0" - } - }, - "node_modules/@smithy/middleware-endpoint": { - "version": "3.1.0", - "resolved": "https://registry.npmjs.org/@smithy/middleware-endpoint/-/middleware-endpoint-3.1.0.tgz", - "integrity": "sha512-5y5aiKCEwg9TDPB4yFE7H6tYvGFf1OJHNczeY10/EFF8Ir8jZbNntQJxMWNfeQjC1mxPsaQ6mR9cvQbf+0YeMw==", - "license": "Apache-2.0", - "dependencies": { - "@smithy/middleware-serde": "^3.0.3", - "@smithy/node-config-provider": "^3.1.4", - "@smithy/shared-ini-file-loader": "^3.1.4", - "@smithy/types": "^3.3.0", - "@smithy/url-parser": "^3.0.3", - "@smithy/util-middleware": "^3.0.3", - "tslib": "^2.6.2" - }, - "engines": { - "node": ">=16.0.0" - } - }, - "node_modules/@smithy/middleware-retry": { - "version": "3.0.15", - "resolved": "https://registry.npmjs.org/@smithy/middleware-retry/-/middleware-retry-3.0.15.tgz", - "integrity": "sha512-iTMedvNt1ApdvkaoE8aSDuwaoc+BhvHqttbA/FO4Ty+y/S5hW6Ci/CTScG7vam4RYJWZxdTElc3MEfHRVH6cgQ==", - "license": "Apache-2.0", - "dependencies": { - "@smithy/node-config-provider": "^3.1.4", - "@smithy/protocol-http": "^4.1.0", - "@smithy/service-error-classification": "^3.0.3", - "@smithy/smithy-client": "^3.2.0", - "@smithy/types": "^3.3.0", - "@smithy/util-middleware": "^3.0.3", - "@smithy/util-retry": "^3.0.3", - "tslib": "^2.6.2", - "uuid": "^9.0.1" - }, - "engines": { - "node": ">=16.0.0" - } - }, - "node_modules/@smithy/middleware-retry/node_modules/uuid": { - "version": "9.0.1", - "resolved": "https://registry.npmjs.org/uuid/-/uuid-9.0.1.tgz", - "integrity": "sha512-b+1eJOlsR9K8HJpow9Ok3fiWOWSIcIzXodvv0rQjVoOVNpWMpxf1wZNpt4y9h10odCNrqnYp1OBzRktckBe3sA==", - "funding": [ - "https://github.com/sponsors/broofa", - "https://github.com/sponsors/ctavan" - ], - "license": "MIT", - "bin": { - "uuid": "dist/bin/uuid" - } - }, - "node_modules/@smithy/middleware-serde": { - "version": "3.0.3", - "resolved": "https://registry.npmjs.org/@smithy/middleware-serde/-/middleware-serde-3.0.3.tgz", - "integrity": "sha512-puUbyJQBcg9eSErFXjKNiGILJGtiqmuuNKEYNYfUD57fUl4i9+mfmThtQhvFXU0hCVG0iEJhvQUipUf+/SsFdA==", - "license": "Apache-2.0", - "dependencies": { - "@smithy/types": "^3.3.0", - "tslib": "^2.6.2" - }, - "engines": { - "node": ">=16.0.0" - } - }, - "node_modules/@smithy/middleware-stack": { - "version": "3.0.3", - "resolved": "https://registry.npmjs.org/@smithy/middleware-stack/-/middleware-stack-3.0.3.tgz", - "integrity": "sha512-r4klY9nFudB0r9UdSMaGSyjyQK5adUyPnQN/ZM6M75phTxOdnc/AhpvGD1fQUvgmqjQEBGCwpnPbDm8pH5PapA==", - "license": "Apache-2.0", - "dependencies": { - "@smithy/types": "^3.3.0", - "tslib": "^2.6.2" - }, - "engines": { - "node": ">=16.0.0" - } - }, - "node_modules/@smithy/node-config-provider": { - "version": "3.1.4", - "resolved": "https://registry.npmjs.org/@smithy/node-config-provider/-/node-config-provider-3.1.4.tgz", - "integrity": "sha512-YvnElQy8HR4vDcAjoy7Xkx9YT8xZP4cBXcbJSgm/kxmiQu08DwUwj8rkGnyoJTpfl/3xYHH+d8zE+eHqoDCSdQ==", - "license": "Apache-2.0", - "dependencies": { - "@smithy/property-provider": "^3.1.3", - "@smithy/shared-ini-file-loader": "^3.1.4", - "@smithy/types": "^3.3.0", - "tslib": "^2.6.2" - }, - "engines": { - "node": ">=16.0.0" - } - }, - "node_modules/@smithy/node-http-handler": { - "version": "3.1.4", - "resolved": "https://registry.npmjs.org/@smithy/node-http-handler/-/node-http-handler-3.1.4.tgz", - "integrity": "sha512-+UmxgixgOr/yLsUxcEKGH0fMNVteJFGkmRltYFHnBMlogyFdpzn2CwqWmxOrfJELhV34v0WSlaqG1UtE1uXlJg==", - "license": "Apache-2.0", - "dependencies": { - "@smithy/abort-controller": "^3.1.1", - "@smithy/protocol-http": "^4.1.0", - "@smithy/querystring-builder": "^3.0.3", - "@smithy/types": "^3.3.0", - "tslib": "^2.6.2" - }, - "engines": { - "node": ">=16.0.0" - } - }, - "node_modules/@smithy/property-provider": { - "version": "3.1.3", - "resolved": "https://registry.npmjs.org/@smithy/property-provider/-/property-provider-3.1.3.tgz", - "integrity": "sha512-zahyOVR9Q4PEoguJ/NrFP4O7SMAfYO1HLhB18M+q+Z4KFd4V2obiMnlVoUFzFLSPeVt1POyNWneHHrZaTMoc/g==", - "license": "Apache-2.0", - "dependencies": { - "@smithy/types": "^3.3.0", - "tslib": "^2.6.2" - }, - "engines": { - "node": ">=16.0.0" - } - }, - "node_modules/@smithy/protocol-http": { - "version": "4.1.0", - "resolved": "https://registry.npmjs.org/@smithy/protocol-http/-/protocol-http-4.1.0.tgz", - "integrity": "sha512-dPVoHYQ2wcHooGXg3LQisa1hH0e4y0pAddPMeeUPipI1tEOqL6A4N0/G7abeq+K8wrwSgjk4C0wnD1XZpJm5aA==", - "license": "Apache-2.0", - "dependencies": { - "@smithy/types": "^3.3.0", - "tslib": "^2.6.2" - }, - "engines": { - "node": ">=16.0.0" - } - }, - "node_modules/@smithy/querystring-builder": { - "version": "3.0.3", - "resolved": "https://registry.npmjs.org/@smithy/querystring-builder/-/querystring-builder-3.0.3.tgz", - "integrity": "sha512-vyWckeUeesFKzCDaRwWLUA1Xym9McaA6XpFfAK5qI9DKJ4M33ooQGqvM4J+LalH4u/Dq9nFiC8U6Qn1qi0+9zw==", - "license": "Apache-2.0", - "dependencies": { - "@smithy/types": "^3.3.0", - "@smithy/util-uri-escape": "^3.0.0", - "tslib": "^2.6.2" - }, - "engines": { - "node": ">=16.0.0" - } - }, - "node_modules/@smithy/querystring-parser": { - "version": "3.0.3", - "resolved": "https://registry.npmjs.org/@smithy/querystring-parser/-/querystring-parser-3.0.3.tgz", - "integrity": "sha512-zahM1lQv2YjmznnfQsWbYojFe55l0SLG/988brlLv1i8z3dubloLF+75ATRsqPBboUXsW6I9CPGE5rQgLfY0vQ==", - "license": "Apache-2.0", - "dependencies": { - "@smithy/types": "^3.3.0", - "tslib": "^2.6.2" - }, - "engines": { - "node": ">=16.0.0" - } - }, - "node_modules/@smithy/service-error-classification": { - "version": "3.0.3", - "resolved": "https://registry.npmjs.org/@smithy/service-error-classification/-/service-error-classification-3.0.3.tgz", - "integrity": "sha512-Jn39sSl8cim/VlkLsUhRFq/dKDnRUFlfRkvhOJaUbLBXUsLRLNf9WaxDv/z9BjuQ3A6k/qE8af1lsqcwm7+DaQ==", - "license": "Apache-2.0", - "dependencies": { - "@smithy/types": "^3.3.0" - }, - "engines": { - "node": ">=16.0.0" - } - }, - "node_modules/@smithy/shared-ini-file-loader": { - "version": "3.1.4", - "resolved": "https://registry.npmjs.org/@smithy/shared-ini-file-loader/-/shared-ini-file-loader-3.1.4.tgz", - "integrity": "sha512-qMxS4hBGB8FY2GQqshcRUy1K6k8aBWP5vwm8qKkCT3A9K2dawUwOIJfqh9Yste/Bl0J2lzosVyrXDj68kLcHXQ==", - "license": "Apache-2.0", - "dependencies": { - "@smithy/types": "^3.3.0", - "tslib": "^2.6.2" - }, - "engines": { - "node": ">=16.0.0" - } - }, - "node_modules/@smithy/signature-v4": { - "version": "4.1.0", - "resolved": "https://registry.npmjs.org/@smithy/signature-v4/-/signature-v4-4.1.0.tgz", - "integrity": "sha512-aRryp2XNZeRcOtuJoxjydO6QTaVhxx/vjaR+gx7ZjaFgrgPRyZ3HCTbfwqYj6ZWEBHkCSUfcaymKPURaByukag==", - "license": "Apache-2.0", - "dependencies": { - "@smithy/is-array-buffer": "^3.0.0", - "@smithy/protocol-http": "^4.1.0", - "@smithy/types": "^3.3.0", - "@smithy/util-hex-encoding": "^3.0.0", - "@smithy/util-middleware": "^3.0.3", - "@smithy/util-uri-escape": "^3.0.0", - "@smithy/util-utf8": "^3.0.0", - "tslib": "^2.6.2" - }, - "engines": { - "node": ">=16.0.0" - } - }, - "node_modules/@smithy/smithy-client": { - "version": "3.2.0", - "resolved": "https://registry.npmjs.org/@smithy/smithy-client/-/smithy-client-3.2.0.tgz", - "integrity": "sha512-pDbtxs8WOhJLJSeaF/eAbPgXg4VVYFlRcL/zoNYA5WbG3wBL06CHtBSg53ppkttDpAJ/hdiede+xApip1CwSLw==", - "license": "Apache-2.0", - "dependencies": { - "@smithy/middleware-endpoint": "^3.1.0", - "@smithy/middleware-stack": "^3.0.3", - "@smithy/protocol-http": "^4.1.0", - "@smithy/types": "^3.3.0", - "@smithy/util-stream": "^3.1.3", - "tslib": "^2.6.2" - }, - "engines": { - "node": ">=16.0.0" - } - }, - "node_modules/@smithy/types": { - "version": "3.3.0", - "resolved": "https://registry.npmjs.org/@smithy/types/-/types-3.3.0.tgz", - "integrity": "sha512-IxvBBCTFDHbVoK7zIxqA1ZOdc4QfM5HM7rGleCuHi7L1wnKv5Pn69xXJQ9hgxH60ZVygH9/JG0jRgtUncE3QUA==", - "license": "Apache-2.0", - "dependencies": { - "tslib": "^2.6.2" - }, - "engines": { - "node": ">=16.0.0" - } - }, - "node_modules/@smithy/url-parser": { - "version": "3.0.3", - "resolved": "https://registry.npmjs.org/@smithy/url-parser/-/url-parser-3.0.3.tgz", - "integrity": "sha512-pw3VtZtX2rg+s6HMs6/+u9+hu6oY6U7IohGhVNnjbgKy86wcIsSZwgHrFR+t67Uyxvp4Xz3p3kGXXIpTNisq8A==", - "license": "Apache-2.0", - "dependencies": { - "@smithy/querystring-parser": "^3.0.3", - "@smithy/types": "^3.3.0", - "tslib": "^2.6.2" - } - }, - "node_modules/@smithy/util-base64": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/@smithy/util-base64/-/util-base64-3.0.0.tgz", - "integrity": "sha512-Kxvoh5Qtt0CDsfajiZOCpJxgtPHXOKwmM+Zy4waD43UoEMA+qPxxa98aE/7ZhdnBFZFXMOiBR5xbcaMhLtznQQ==", - "license": "Apache-2.0", - "dependencies": { - "@smithy/util-buffer-from": "^3.0.0", - "@smithy/util-utf8": "^3.0.0", - "tslib": "^2.6.2" - }, - "engines": { - "node": ">=16.0.0" - } - }, - "node_modules/@smithy/util-body-length-browser": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/@smithy/util-body-length-browser/-/util-body-length-browser-3.0.0.tgz", - "integrity": "sha512-cbjJs2A1mLYmqmyVl80uoLTJhAcfzMOyPgjwAYusWKMdLeNtzmMz9YxNl3/jRLoxSS3wkqkf0jwNdtXWtyEBaQ==", - "license": "Apache-2.0", - "dependencies": { - "tslib": "^2.6.2" - } - }, - "node_modules/@smithy/util-body-length-node": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/@smithy/util-body-length-node/-/util-body-length-node-3.0.0.tgz", - "integrity": "sha512-Tj7pZ4bUloNUP6PzwhN7K386tmSmEET9QtQg0TgdNOnxhZvCssHji+oZTUIuzxECRfG8rdm2PMw2WCFs6eIYkA==", - "license": "Apache-2.0", - "dependencies": { - "tslib": "^2.6.2" - }, - "engines": { - "node": ">=16.0.0" - } - }, - "node_modules/@smithy/util-buffer-from": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/@smithy/util-buffer-from/-/util-buffer-from-3.0.0.tgz", - "integrity": "sha512-aEOHCgq5RWFbP+UDPvPot26EJHjOC+bRgse5A8V3FSShqd5E5UN4qc7zkwsvJPPAVsf73QwYcHN1/gt/rtLwQA==", - "license": "Apache-2.0", - "dependencies": { - "@smithy/is-array-buffer": "^3.0.0", - "tslib": "^2.6.2" - }, - "engines": { - "node": ">=16.0.0" - } - }, - "node_modules/@smithy/util-config-provider": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/@smithy/util-config-provider/-/util-config-provider-3.0.0.tgz", - "integrity": "sha512-pbjk4s0fwq3Di/ANL+rCvJMKM5bzAQdE5S/6RL5NXgMExFAi6UgQMPOm5yPaIWPpr+EOXKXRonJ3FoxKf4mCJQ==", - "license": "Apache-2.0", - "dependencies": { - "tslib": "^2.6.2" - }, - "engines": { - "node": ">=16.0.0" - } - }, - "node_modules/@smithy/util-defaults-mode-browser": { - "version": "3.0.15", - "resolved": "https://registry.npmjs.org/@smithy/util-defaults-mode-browser/-/util-defaults-mode-browser-3.0.15.tgz", - "integrity": "sha512-FZ4Psa3vjp8kOXcd3HJOiDPBCWtiilLl57r0cnNtq/Ga9RSDrM5ERL6xt+tO43+2af6Pn5Yp92x2n5vPuduNfg==", - "license": "Apache-2.0", - "dependencies": { - "@smithy/property-provider": "^3.1.3", - "@smithy/smithy-client": "^3.2.0", - "@smithy/types": "^3.3.0", - "bowser": "^2.11.0", - "tslib": "^2.6.2" - }, - "engines": { - "node": ">= 10.0.0" - } - }, - "node_modules/@smithy/util-defaults-mode-node": { - "version": "3.0.15", - "resolved": "https://registry.npmjs.org/@smithy/util-defaults-mode-node/-/util-defaults-mode-node-3.0.15.tgz", - "integrity": "sha512-KSyAAx2q6d0t6f/S4XB2+3+6aQacm3aLMhs9aLMqn18uYGUepbdssfogW5JQZpc6lXNBnp0tEnR5e9CEKmEd7A==", - "license": "Apache-2.0", - "dependencies": { - "@smithy/config-resolver": "^3.0.5", - "@smithy/credential-provider-imds": "^3.2.0", - "@smithy/node-config-provider": "^3.1.4", - "@smithy/property-provider": "^3.1.3", - "@smithy/smithy-client": "^3.2.0", - "@smithy/types": "^3.3.0", - "tslib": "^2.6.2" - }, - "engines": { - "node": ">= 10.0.0" - } - }, - "node_modules/@smithy/util-endpoints": { - "version": "2.0.5", - "resolved": "https://registry.npmjs.org/@smithy/util-endpoints/-/util-endpoints-2.0.5.tgz", - "integrity": "sha512-ReQP0BWihIE68OAblC/WQmDD40Gx+QY1Ez8mTdFMXpmjfxSyz2fVQu3A4zXRfQU9sZXtewk3GmhfOHswvX+eNg==", - "license": "Apache-2.0", - "dependencies": { - "@smithy/node-config-provider": "^3.1.4", - "@smithy/types": "^3.3.0", - "tslib": "^2.6.2" - }, - "engines": { - "node": ">=16.0.0" - } - }, - "node_modules/@smithy/util-hex-encoding": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/@smithy/util-hex-encoding/-/util-hex-encoding-3.0.0.tgz", - "integrity": "sha512-eFndh1WEK5YMUYvy3lPlVmYY/fZcQE1D8oSf41Id2vCeIkKJXPcYDCZD+4+xViI6b1XSd7tE+s5AmXzz5ilabQ==", - "license": "Apache-2.0", - "dependencies": { - "tslib": "^2.6.2" - }, - "engines": { - "node": ">=16.0.0" - } - }, - "node_modules/@smithy/util-middleware": { - "version": "3.0.3", - "resolved": "https://registry.npmjs.org/@smithy/util-middleware/-/util-middleware-3.0.3.tgz", - "integrity": "sha512-l+StyYYK/eO3DlVPbU+4Bi06Jjal+PFLSMmlWM1BEwyLxZ3aKkf1ROnoIakfaA7mC6uw3ny7JBkau4Yc+5zfWw==", - "license": "Apache-2.0", - "dependencies": { - "@smithy/types": "^3.3.0", - "tslib": "^2.6.2" - }, - "engines": { - "node": ">=16.0.0" - } - }, - "node_modules/@smithy/util-retry": { - "version": "3.0.3", - "resolved": "https://registry.npmjs.org/@smithy/util-retry/-/util-retry-3.0.3.tgz", - "integrity": "sha512-AFw+hjpbtVApzpNDhbjNG5NA3kyoMs7vx0gsgmlJF4s+yz1Zlepde7J58zpIRIsdjc+emhpAITxA88qLkPF26w==", - "license": "Apache-2.0", - "dependencies": { - "@smithy/service-error-classification": "^3.0.3", - "@smithy/types": "^3.3.0", - "tslib": "^2.6.2" - }, - "engines": { - "node": ">=16.0.0" - } - }, - "node_modules/@smithy/util-stream": { - "version": "3.1.3", - "resolved": "https://registry.npmjs.org/@smithy/util-stream/-/util-stream-3.1.3.tgz", - "integrity": "sha512-FIv/bRhIlAxC0U7xM1BCnF2aDRPq0UaelqBHkM2lsCp26mcBbgI0tCVTv+jGdsQLUmAMybua/bjDsSu8RQHbmw==", - "license": "Apache-2.0", - "dependencies": { - "@smithy/fetch-http-handler": "^3.2.4", - "@smithy/node-http-handler": "^3.1.4", - "@smithy/types": "^3.3.0", - "@smithy/util-base64": "^3.0.0", - "@smithy/util-buffer-from": "^3.0.0", - "@smithy/util-hex-encoding": "^3.0.0", - "@smithy/util-utf8": "^3.0.0", - "tslib": "^2.6.2" - }, - "engines": { - "node": ">=16.0.0" - } - }, - "node_modules/@smithy/util-uri-escape": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/@smithy/util-uri-escape/-/util-uri-escape-3.0.0.tgz", - "integrity": "sha512-LqR7qYLgZTD7nWLBecUi4aqolw8Mhza9ArpNEQ881MJJIU2sE5iHCK6TdyqqzcDLy0OPe10IY4T8ctVdtynubg==", - "license": "Apache-2.0", - "dependencies": { - "tslib": "^2.6.2" - }, - "engines": { - "node": ">=16.0.0" - } - }, - "node_modules/@smithy/util-utf8": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/@smithy/util-utf8/-/util-utf8-3.0.0.tgz", - "integrity": "sha512-rUeT12bxFnplYDe815GXbq/oixEGHfRFFtcTF3YdDi/JaENIM6aSYYLJydG83UNzLXeRI5K8abYd/8Sp/QM0kA==", - "license": "Apache-2.0", - "dependencies": { - "@smithy/util-buffer-from": "^3.0.0", - "tslib": "^2.6.2" - }, - "engines": { - "node": ">=16.0.0" - } - }, - "node_modules/bowser": { - "version": "2.11.0", - "resolved": "https://registry.npmjs.org/bowser/-/bowser-2.11.0.tgz", - "integrity": "sha512-AlcaJBi/pqqJBIQ8U9Mcpc9i8Aqxn88Skv5d+xBX006BY5u8N3mGLHa5Lgppa7L/HfwgwLgZ6NYs+Ag6uUmJRA==", - "license": "MIT" - }, - "node_modules/fast-xml-parser": { - "version": "4.4.1", - "resolved": "https://registry.npmjs.org/fast-xml-parser/-/fast-xml-parser-4.4.1.tgz", - "integrity": "sha512-xkjOecfnKGkSsOwtZ5Pz7Us/T6mrbPQrq0nh+aCO5V9nk5NLWmasAHumTKjiPJPWANe+kAZ84Jc8ooJkzZ88Sw==", - "funding": [ - { - "type": "github", - "url": "https://github.com/sponsors/NaturalIntelligence" - }, - { - "type": "paypal", - "url": "https://paypal.me/naturalintelligence" - } - ], - "license": "MIT", - "dependencies": { - "strnum": "^1.0.5" - }, - "bin": { - "fxparser": "src/cli/cli.js" - } - }, - "node_modules/strnum": { - "version": "1.0.5", - "resolved": "https://registry.npmjs.org/strnum/-/strnum-1.0.5.tgz", - "integrity": "sha512-J8bbNyKKXl5qYcR36TIO8W3mVGVHrmmxsd5PAItGkmyzwJvybiw2IVq5nqd0i4LSNSkB/sx9VHllbfFdr9k1JA==", - "license": "MIT" - }, - "node_modules/tslib": { - "version": "2.7.0", - "resolved": "https://registry.npmjs.org/tslib/-/tslib-2.7.0.tgz", - "integrity": "sha512-gLXCKdN1/j47AiHiOkJN69hJmcbGTHI0ImLmbYLHykhgeN0jVGola9yVjFgzCUklsZQMW55o+dW7IXv3RCXDzA==", - "license": "0BSD" - } - } -} diff --git a/lamda/package.json b/lamda/package.json deleted file mode 100644 index 102dbf777..000000000 --- a/lamda/package.json +++ /dev/null @@ -1,15 +0,0 @@ -{ - "name": "unocha-kb-lambda", - "version": "1.0.0", - "description": "Lambda function to call KB", - "main": "index.js", - "scripts": { - "test": "echo \"Error: no test specified\" && exit 1" - }, - "author": "Attiks", - "type": "module", - "license": "MIT", - "dependencies": { - "@aws-sdk/client-bedrock-agent-runtime": "^3.642.0" - } -} diff --git a/lamda/rw-api-authorizer.mjs b/lamda/rw-api-authorizer.mjs deleted file mode 100644 index 63b97815f..000000000 --- a/lamda/rw-api-authorizer.mjs +++ /dev/null @@ -1,109 +0,0 @@ -const allowedPaths = { - 'api1': { - allow: [ - '/', - '/answer', - '/search', - '/jobs/answer', - '/jobs/search', - '/reports/answer', - '/reports/search', - ], - deny: [ - ], - }, - 'api2': { - allow: [ - '/jobs/answer', - '/jobs/search', - ], - deny: [ - '/', - '/answer', - '/search', - '/reports/answer', - '/reports/search', - ], - }, - 'api3': { - allow: [ - '/jobs/answer', - '/jobs/search', - ], - deny: [ - '/', - '/answer', - '/search', - '/reports/answer', - '/reports/search', - ], - } -}; - -export const handler = function(event, context, callback) { - console.log('Received event:', JSON.stringify(event, null, 2)); - console.log('Context:', JSON.stringify(context, null, 2)); - - // Retrieve request parameters from the Lambda function input: - var headers = event.headers || {}; - var apikey = headers['x-api-key']; - - // Deny access for unknown keys. - if (!allowedPaths[apikey]) { - callback("Unauthorized"); - } - - // Rebuild arn prefix. - let parts = event.methodArn.split(':'); - let apiGatewayArnTmp = parts[5].split('/'); - - parts = parts.slice(0, 5); - apiGatewayArnTmp = apiGatewayArnTmp.slice(0, 3); - apiGatewayArnTmp = apiGatewayArnTmp.join('/'); - apiGatewayArnTmp = apiGatewayArnTmp.split('?')[0]; - - let prefix = parts.join(':') + ':' + apiGatewayArnTmp; - - // Account. - let accountId = event.requestContext.accountId; - callback(null, generatePolicies(apikey, prefix, accountId)); -} - -// Help function to generate an IAM policy -var generatePolicies = function(apikey, prefix, accountId) { - // Required output: - var authResponse = {}; - authResponse.principalId = accountId; - authResponse.usageIdentifierKey = apikey; - - var policyDocument = {}; - policyDocument.Version = '2012-10-17'; // default version - policyDocument.Statement = []; - - // Allows. - var statementAllow = {}; - statementAllow.Action = 'execute-api:Invoke'; // default action - statementAllow.Effect = 'Allow'; - statementAllow.Resource = []; - - for (let pol in allowedPaths[apikey].allow) { - statementAllow.Resource.push(prefix + allowedPaths[apikey].allow[pol]); - } - policyDocument.Statement.push(statementAllow); - - // Denies. - var statementDeny = {}; - statementDeny.Action = 'execute-api:Invoke'; // default action - statementDeny.Effect = 'Deny'; - statementDeny.Resource = []; - - for (let pol in allowedPaths[apikey].deny) { - statementDeny.Resource.push(prefix + allowedPaths[apikey].deny[pol]); - } - policyDocument.Statement.push(statementDeny); - - authResponse.policyDocument = policyDocument; - - console.log(JSON.stringify(authResponse)); - return authResponse; -} diff --git a/lamda/rw-kb-answer.mjs b/lamda/rw-kb-answer.mjs deleted file mode 100644 index 313f79edf..000000000 --- a/lamda/rw-kb-answer.mjs +++ /dev/null @@ -1,167 +0,0 @@ -import { - BedrockAgentRuntimeClient, - RetrieveAndGenerateCommand, -} from "@aws-sdk/client-bedrock-agent-runtime"; - - -// @todo add mapping between content type and KB Id. - -export const handler = async (event) => { - let kb = 'VIEPSPYNSS'; - let siteid = event.siteid || ''; - let bundle = event.bundle || ''; - let text = event.text || ''; - - const client = new BedrockAgentRuntimeClient({region: 'us-east-1'}); - - // Make sure there are at least 2 filters. - const filters = [ - { - equals: { - key: "status", - value: "1" - }, - }, - { - notEquals: { - key: "status", - value: "0" - }, - } - ]; - - // Limit to source site, ex. ReliefWeb. - if (siteid != '') { - filters.push({ - equals: { - key: 'site', - value: siteid - } - }); - } - - // Limit to bundle, ex. report. - if (bundle != '') { - filters.push({ - equals: { - key: 'bundle', - value: bundle - } - }); - } - - // Add user filters. - if (event.city) { - filters.push({ - equals: { - key: 'city', - value: event.city - } - }); - } - - if (event.country) { - filters.push({ - in: { - key: 'country', - value: event.country.split(',') - } - }); - } - - if (event.disaster) { - filters.push({ - in: { - key: 'disaster', - value: event.disaster.split(',') - } - }); - } - - if (event.disaster_type) { - filters.push({ - in: { - key: 'disaster_type', - value: event.disaster_type.split(',') - } - }); - } - - if (event.feature) { - filters.push({ - in: { - key: 'feature', - value: event.feature.split(',') - } - }); - } - - if (event.primary_country) { - filters.push({ - in: { - key: 'primary_country', - value: event.primary_country.split(',') - } - }); - } - - if (event.source) { - filters.push({ - in: { - key: 'source', - value: event.source.split(',') - } - }); - } - - if (event.theme) { - filters.push({ - in: { - key: 'theme', - value: event.theme.split(',') - } - }); - } - - const input = { - input: { - text: text - }, - retrieveAndGenerateConfiguration: { - type: "KNOWLEDGE_BASE", - knowledgeBaseConfiguration: { - knowledgeBaseId: kb, - modelArn: "arn:aws:bedrock:us-east-1::foundation-model/amazon.titan-text-premier-v1:0", - retrievalConfiguration: { - vectorSearchConfiguration: { - numberOfResults: 10, - overrideSearchType: "HYBRID", - filter: { - andAll: filters - } - } - } - } - } - }; - - const command = new RetrieveAndGenerateCommand(input); - - const {citations, output} = await client.send(command); - - let data = { - answer: output.text || '', - citations: [], - }; - - for (let row of citations) { - for (let ref of row.retrievedReferences) { - data.citations.push({ - text: ref.content.text, - metadata: ref.metadata - }); - } - } - - return data; -}; diff --git a/lamda/rw-kb-search.mjs b/lamda/rw-kb-search.mjs deleted file mode 100644 index f8c6d49ec..000000000 --- a/lamda/rw-kb-search.mjs +++ /dev/null @@ -1,152 +0,0 @@ -import { - BedrockAgentRuntimeClient, - RetrieveCommand, -} from "@aws-sdk/client-bedrock-agent-runtime"; - - -export const handler = async (event) => { - let kb = 'VIEPSPYNSS'; - let siteid = event.siteid || ''; - let bundle = event.bundle || ''; - let text = event.text || ''; - const client = new BedrockAgentRuntimeClient({region: 'us-east-1'}); - - // Make sure there are at least 2 filters. - const filters = [ - { - equals: { - key: "status", - value: "1" - }, - }, - { - notEquals: { - key: "status", - value: "0" - }, - } - ]; - - // Limit to source site, ex. ReliefWeb. - if (siteid != '') { - filters.push({ - equals: { - key: 'site', - value: siteid - } - }); - } - - // Limit to bundle, ex. report. - if (bundle != '') { - filters.push({ - equals: { - key: 'bundle', - value: bundle - } - }); - } - - // Add user filters. - if (event.city) { - filters.push({ - equals: { - key: 'city', - value: event.city - } - }); - } - - if (event.country) { - filters.push({ - in: { - key: 'country', - value: event.country.split(',') - } - }); - } - - if (event.disaster) { - filters.push({ - in: { - key: 'disaster', - value: event.disaster.split(',') - } - }); - } - - if (event.disaster_type) { - filters.push({ - in: { - key: 'disaster_type', - value: event.disaster_type.split(',') - } - }); - } - - if (event.feature) { - filters.push({ - in: { - key: 'feature', - value: event.feature.split(',') - } - }); - } - - if (event.primary_country) { - filters.push({ - in: { - key: 'primary_country', - value: event.primary_country.split(',') - } - }); - } - - if (event.source) { - filters.push({ - in: { - key: 'source', - value: event.source.split(',') - } - }); - } - - if (event.theme) { - filters.push({ - in: { - key: 'theme', - value: event.theme.split(',') - } - }); - } - - const input = { - knowledgeBaseId: kb, - retrievalQuery: { - text: text, - }, - retrievalConfiguration: { - vectorSearchConfiguration: { - numberOfResults: 10, - overrideSearchType: "HYBRID", - filter: { - andAll: filters - } - } - }, - }; - - const command = new RetrieveCommand(input); - const results = await client.send(command); - - let output = []; - for (let row of results.retrievalResults) { - output.push({ - text: row.content.text || '', - metadata: row.metadata, - score: row.score, - }); - } - - return output; -}; From 6f47eefb0217449ae498cf6dd4971c9caadd7865 Mon Sep 17 00:00:00 2001 From: "Peter Droogmans (attiks)" Date: Fri, 13 Sep 2024 14:16:12 +0200 Subject: [PATCH 18/25] chore: composer update --- composer.lock | 449 +++++++++--------- composer.patches.json | 3 +- .../custom/reliefweb_semantic/README.md | 12 +- 3 files changed, 236 insertions(+), 228 deletions(-) diff --git a/composer.lock b/composer.lock index e44f2ed78..65924d225 100644 --- a/composer.lock +++ b/composer.lock @@ -4,7 +4,7 @@ "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies", "This file is @generated automatically" ], - "content-hash": "ef61109ad92cfb8a5719745fbef232bc", + "content-hash": "3dd180159ee64576d287b7d9f3428aae", "packages": [ { "name": "asm89/stack-cors", @@ -118,16 +118,16 @@ }, { "name": "aws/aws-sdk-php", - "version": "3.321.4", + "version": "3.321.10", "source": { "type": "git", "url": "https://github.com/aws/aws-sdk-php.git", - "reference": "986326efde1d0598ec9fc1b185716550be8ef522" + "reference": "a81a9a2cb5f451e03f8ef68b02ebfecfbf1fa7f2" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/aws/aws-sdk-php/zipball/986326efde1d0598ec9fc1b185716550be8ef522", - "reference": "986326efde1d0598ec9fc1b185716550be8ef522", + "url": "https://api.github.com/repos/aws/aws-sdk-php/zipball/a81a9a2cb5f451e03f8ef68b02ebfecfbf1fa7f2", + "reference": "a81a9a2cb5f451e03f8ef68b02ebfecfbf1fa7f2", "shasum": "" }, "require": { @@ -210,9 +210,9 @@ "support": { "forum": "https://forums.aws.amazon.com/forum.jspa?forumID=80", "issues": "https://github.com/aws/aws-sdk-php/issues", - "source": "https://github.com/aws/aws-sdk-php/tree/3.321.4" + "source": "https://github.com/aws/aws-sdk-php/tree/3.321.10" }, - "time": "2024-09-04T18:09:31+00:00" + "time": "2024-09-12T18:08:32+00:00" }, { "name": "behat/mink", @@ -2050,16 +2050,16 @@ }, { "name": "doctrine/annotations", - "version": "1.14.3", + "version": "1.14.4", "source": { "type": "git", "url": "https://github.com/doctrine/annotations.git", - "reference": "fb0d71a7393298a7b232cbf4c8b1f73f3ec3d5af" + "reference": "253dca476f70808a5aeed3a47cc2cc88c5cab915" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/doctrine/annotations/zipball/fb0d71a7393298a7b232cbf4c8b1f73f3ec3d5af", - "reference": "fb0d71a7393298a7b232cbf4c8b1f73f3ec3d5af", + "url": "https://api.github.com/repos/doctrine/annotations/zipball/253dca476f70808a5aeed3a47cc2cc88c5cab915", + "reference": "253dca476f70808a5aeed3a47cc2cc88c5cab915", "shasum": "" }, "require": { @@ -2070,11 +2070,11 @@ }, "require-dev": { "doctrine/cache": "^1.11 || ^2.0", - "doctrine/coding-standard": "^9 || ^10", - "phpstan/phpstan": "~1.4.10 || ^1.8.0", + "doctrine/coding-standard": "^9 || ^12", + "phpstan/phpstan": "~1.4.10 || ^1.10.28", "phpunit/phpunit": "^7.5 || ^8.5 || ^9.5", - "symfony/cache": "^4.4 || ^5.4 || ^6", - "vimeo/psalm": "^4.10" + "symfony/cache": "^4.4 || ^5.4 || ^6.4 || ^7", + "vimeo/psalm": "^4.30 || ^5.14" }, "suggest": { "php": "PHP 8.0 or higher comes with attributes, a native replacement for annotations" @@ -2120,9 +2120,9 @@ ], "support": { "issues": "https://github.com/doctrine/annotations/issues", - "source": "https://github.com/doctrine/annotations/tree/1.14.3" + "source": "https://github.com/doctrine/annotations/tree/1.14.4" }, - "time": "2023-02-01T09:20:38+00:00" + "time": "2024-09-05T10:15:52+00:00" }, { "name": "doctrine/deprecations", @@ -2534,7 +2534,7 @@ "source": { "type": "git", "url": "https://git.drupalcode.org/project/aws.git", - "reference": "be61670b6b693440e840e73d1c5ac16afde98320" + "reference": "8189f4bf5967349815fdac013fe6c331a956b24b" }, "require": { "aws/aws-sdk-php": "^3.54", @@ -2546,8 +2546,8 @@ "dev-2.0.x": "2.0.x-dev" }, "drupal": { - "version": "2.0.3+7-dev", - "datestamp": "1725464452", + "version": "2.0.4+1-dev", + "datestamp": "1725630062", "security-coverage": { "status": "not-covered", "message": "Dev releases are not covered by Drupal security advisories." @@ -2695,29 +2695,29 @@ }, { "name": "drupal/components", - "version": "3.0.0-beta3", + "version": "3.1.0", "source": { "type": "git", "url": "https://git.drupalcode.org/project/components.git", - "reference": "3.0.0-beta3" + "reference": "3.1.0" }, "dist": { "type": "zip", - "url": "https://ftp.drupal.org/files/projects/components-3.0.0-beta3.zip", - "reference": "3.0.0-beta3", - "shasum": "47ced4332f0a655ca38ae1b54e97a8e78d59f0bc" + "url": "https://ftp.drupal.org/files/projects/components-3.1.0.zip", + "reference": "3.1.0", + "shasum": "a9d9f7517f54038d0d6fa68185d80e26d2ad1d8d" }, "require": { - "drupal/core": "^9 || ^10" + "drupal/core": "^10.2 || ^11" }, "type": "drupal-module", "extra": { "drupal": { - "version": "3.0.0-beta3", - "datestamp": "1651759488", + "version": "3.1.0", + "datestamp": "1725921122", "security-coverage": { - "status": "not-covered", - "message": "Beta releases are not covered by Drupal security advisories." + "status": "covered", + "message": "Covered by Drupal's security advisory policy" } } }, @@ -2728,9 +2728,13 @@ "authors": [ { "name": "JohnAlbin", - "homepage": "https://www.drupal.org/user/32095", + "homepage": "https://www.drupal.org/user/1036766", "email": "virtually.johnalbin@gmail.com" }, + { + "name": "johnalbin", + "homepage": "https://www.drupal.org/user/32095" + }, { "name": "robloach", "homepage": "https://www.drupal.org/user/61114" @@ -2936,16 +2940,16 @@ }, { "name": "drupal/core", - "version": "10.3.2", + "version": "10.3.5", "source": { "type": "git", "url": "https://github.com/drupal/core.git", - "reference": "10e79c67a903844bef02a5cf10475d9a8b623e7a" + "reference": "831a269a4d99957638977ec325c3346f896d9f08" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/drupal/core/zipball/10e79c67a903844bef02a5cf10475d9a8b623e7a", - "reference": "10e79c67a903844bef02a5cf10475d9a8b623e7a", + "url": "https://api.github.com/repos/drupal/core/zipball/831a269a4d99957638977ec325c3346f896d9f08", + "reference": "831a269a4d99957638977ec325c3346f896d9f08", "shasum": "" }, "require": { @@ -2991,7 +2995,7 @@ "symfony/serializer": "^6.4", "symfony/validator": "^6.4", "symfony/yaml": "^6.4", - "twig/twig": "^3.9.3" + "twig/twig": "^3.14.0" }, "conflict": { "drush/drush": "<12.4.3" @@ -3094,22 +3098,22 @@ ], "description": "Drupal is an open source content management platform powering millions of websites and applications.", "support": { - "source": "https://github.com/drupal/core/tree/10.3.2" + "source": "https://github.com/drupal/core/tree/10.3.5" }, - "time": "2024-08-08T09:23:57+00:00" + "time": "2024-09-12T09:45:37+00:00" }, { "name": "drupal/core-composer-scaffold", - "version": "10.3.2", + "version": "10.3.5", "source": { "type": "git", "url": "https://github.com/drupal/core-composer-scaffold.git", - "reference": "a1a186caeb89899143e0c6912ccee9d3d7181dbe" + "reference": "f58ab5c0d02d275c5aa226c4505b457e41b161cc" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/drupal/core-composer-scaffold/zipball/a1a186caeb89899143e0c6912ccee9d3d7181dbe", - "reference": "a1a186caeb89899143e0c6912ccee9d3d7181dbe", + "url": "https://api.github.com/repos/drupal/core-composer-scaffold/zipball/f58ab5c0d02d275c5aa226c4505b457e41b161cc", + "reference": "f58ab5c0d02d275c5aa226c4505b457e41b161cc", "shasum": "" }, "require": { @@ -3144,13 +3148,13 @@ "drupal" ], "support": { - "source": "https://github.com/drupal/core-composer-scaffold/tree/10.3.2" + "source": "https://github.com/drupal/core-composer-scaffold/tree/10.3.5" }, - "time": "2024-05-11T08:21:39+00:00" + "time": "2024-08-22T14:31:34+00:00" }, { "name": "drupal/core-dev", - "version": "10.3.2", + "version": "10.3.5", "source": { "type": "git", "url": "https://github.com/drupal/core-dev.git", @@ -3200,22 +3204,22 @@ ], "description": "require-dev dependencies from drupal/drupal; use in addition to drupal/core-recommended to run tests from drupal/core.", "support": { - "source": "https://github.com/drupal/core-dev/tree/10.3.2" + "source": "https://github.com/drupal/core-dev/tree/10.3.5" }, "time": "2024-07-04T10:19:29+00:00" }, { "name": "drupal/core-recommended", - "version": "10.3.2", + "version": "10.3.5", "source": { "type": "git", "url": "https://github.com/drupal/core-recommended.git", - "reference": "18b7288d2e661afadfff4a714c5a166bf2554124" + "reference": "055a27d032e1fdcbac90976a14bdd152b368d761" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/drupal/core-recommended/zipball/18b7288d2e661afadfff4a714c5a166bf2554124", - "reference": "18b7288d2e661afadfff4a714c5a166bf2554124", + "url": "https://api.github.com/repos/drupal/core-recommended/zipball/055a27d032e1fdcbac90976a14bdd152b368d761", + "reference": "055a27d032e1fdcbac90976a14bdd152b368d761", "shasum": "" }, "require": { @@ -3224,7 +3228,7 @@ "doctrine/annotations": "~1.14.3", "doctrine/deprecations": "~1.1.3", "doctrine/lexer": "~2.1.1", - "drupal/core": "10.3.2", + "drupal/core": "10.3.5", "egulias/email-validator": "~4.0.2", "guzzlehttp/guzzle": "~7.8.1", "guzzlehttp/promises": "~2.0.2", @@ -3273,7 +3277,7 @@ "symfony/var-dumper": "~v6.4.7", "symfony/var-exporter": "~v6.4.7", "symfony/yaml": "~v6.4.7", - "twig/twig": "~v3.10.2" + "twig/twig": "~v3.14.0" }, "conflict": { "webflo/drupal-core-strict": "*" @@ -3285,9 +3289,9 @@ ], "description": "Core and its dependencies with known-compatible minor versions. Require this project INSTEAD OF drupal/core.", "support": { - "source": "https://github.com/drupal/core-recommended/tree/10.3.2" + "source": "https://github.com/drupal/core-recommended/tree/10.3.5" }, - "time": "2024-08-08T09:23:57+00:00" + "time": "2024-09-12T09:45:37+00:00" }, { "name": "drupal/ctools", @@ -4492,7 +4496,7 @@ "role": "Developer" }, { - "name": "Dave Reid", + "name": "dave reid", "homepage": "https://www.drupal.org/user/53892" } ], @@ -4890,17 +4894,17 @@ }, { "name": "drupal/seckit", - "version": "2.0.2", + "version": "2.0.3", "source": { "type": "git", "url": "https://git.drupalcode.org/project/seckit.git", - "reference": "2.0.2" + "reference": "2.0.3" }, "dist": { "type": "zip", - "url": "https://ftp.drupal.org/files/projects/seckit-2.0.2.zip", - "reference": "2.0.2", - "shasum": "19c421c0c5b966d20903024e6029599c33b4707d" + "url": "https://ftp.drupal.org/files/projects/seckit-2.0.3.zip", + "reference": "2.0.3", + "shasum": "34d38f2daaf99781ef6b7e7fbe2eeabc73a7ca16" }, "require": { "drupal/core": "^9.5 || ^10 || ^11" @@ -4908,8 +4912,8 @@ "type": "drupal-module", "extra": { "drupal": { - "version": "2.0.2", - "datestamp": "1724766049", + "version": "2.0.3", + "datestamp": "1726075930", "security-coverage": { "status": "covered", "message": "Covered by Drupal's security advisory policy" @@ -5736,26 +5740,26 @@ }, { "name": "drupal/username_enumeration_prevention", - "version": "1.3.0", + "version": "1.4.0", "source": { "type": "git", "url": "https://git.drupalcode.org/project/username_enumeration_prevention.git", - "reference": "8.x-1.3" + "reference": "8.x-1.4" }, "dist": { "type": "zip", - "url": "https://ftp.drupal.org/files/projects/username_enumeration_prevention-8.x-1.3.zip", - "reference": "8.x-1.3", - "shasum": "fa3f1f57a9d5ad77943c484ff7e1e40f5cd73df7" + "url": "https://ftp.drupal.org/files/projects/username_enumeration_prevention-8.x-1.4.zip", + "reference": "8.x-1.4", + "shasum": "29fab36a86de64694b3074d42ac948547459aea6" }, "require": { - "drupal/core": "^8 || ^9 || ^10" + "drupal/core": "^9.5 || ^10 || ^11" }, "type": "drupal-module", "extra": { "drupal": { - "version": "8.x-1.3", - "datestamp": "1670892402", + "version": "8.x-1.4", + "datestamp": "1725566327", "security-coverage": { "status": "covered", "message": "Covered by Drupal's security advisory policy" @@ -5995,20 +5999,21 @@ }, { "name": "elastic/transport", - "version": "v8.8.0", + "version": "v8.10.0", "source": { "type": "git", "url": "https://github.com/elastic/elastic-transport-php.git", - "reference": "cdf9f63a16ec6bfb4c881ab89aa0e2a61fb7c20b" + "reference": "8be37d679637545e50b1cea9f8ee903888783021" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/elastic/elastic-transport-php/zipball/cdf9f63a16ec6bfb4c881ab89aa0e2a61fb7c20b", - "reference": "cdf9f63a16ec6bfb4c881ab89aa0e2a61fb7c20b", + "url": "https://api.github.com/repos/elastic/elastic-transport-php/zipball/8be37d679637545e50b1cea9f8ee903888783021", + "reference": "8be37d679637545e50b1cea9f8ee903888783021", "shasum": "" }, "require": { "composer-runtime-api": "^2.0", + "open-telemetry/api": "^1.0", "php": "^7.4 || ^8.0", "php-http/discovery": "^1.14", "php-http/httplug": "^2.3", @@ -6019,9 +6024,11 @@ }, "require-dev": { "nyholm/psr7": "^1.5", + "open-telemetry/sdk": "^1.0", "php-http/mock-client": "^1.5", "phpstan/phpstan": "^1.4", - "phpunit/phpunit": "^9.5" + "phpunit/phpunit": "^9.5", + "symfony/http-client": "^5.4" }, "type": "library", "autoload": { @@ -6044,26 +6051,26 @@ ], "support": { "issues": "https://github.com/elastic/elastic-transport-php/issues", - "source": "https://github.com/elastic/elastic-transport-php/tree/v8.8.0" + "source": "https://github.com/elastic/elastic-transport-php/tree/v8.10.0" }, - "time": "2023-11-08T10:51:51+00:00" + "time": "2024-08-14T08:55:07+00:00" }, { "name": "elasticsearch/elasticsearch", - "version": "v8.14.0", + "version": "v8.15.0", "source": { "type": "git", "url": "https://github.com/elastic/elasticsearch-php.git", - "reference": "bff3c3e2402f6a20449404637f91a5ae214eff46" + "reference": "34c2444fa8d4c3e6c8b009bd8dea90bca007203b" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/elastic/elasticsearch-php/zipball/bff3c3e2402f6a20449404637f91a5ae214eff46", - "reference": "bff3c3e2402f6a20449404637f91a5ae214eff46", + "url": "https://api.github.com/repos/elastic/elasticsearch-php/zipball/34c2444fa8d4c3e6c8b009bd8dea90bca007203b", + "reference": "34c2444fa8d4c3e6c8b009bd8dea90bca007203b", "shasum": "" }, "require": { - "elastic/transport": "^8.8", + "elastic/transport": "^8.10", "guzzlehttp/guzzle": "^7.0", "php": "^7.4 || ^8.0", "psr/http-client": "^1.0", @@ -6102,31 +6109,31 @@ ], "support": { "issues": "https://github.com/elastic/elasticsearch-php/issues", - "source": "https://github.com/elastic/elasticsearch-php/tree/v8.14.0" + "source": "https://github.com/elastic/elasticsearch-php/tree/v8.15.0" }, - "time": "2024-06-12T19:58:31+00:00" + "time": "2024-08-14T14:32:50+00:00" }, { "name": "enshrined/svg-sanitize", - "version": "0.19.0", + "version": "0.20.0", "source": { "type": "git", "url": "https://github.com/darylldoyle/svg-sanitizer.git", - "reference": "e95cd17be68e45f523cbfb0fe50cdd891b0cf20e" + "reference": "068d9fcf912c88a0471d101d95a2caa87c50aee7" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/darylldoyle/svg-sanitizer/zipball/e95cd17be68e45f523cbfb0fe50cdd891b0cf20e", - "reference": "e95cd17be68e45f523cbfb0fe50cdd891b0cf20e", + "url": "https://api.github.com/repos/darylldoyle/svg-sanitizer/zipball/068d9fcf912c88a0471d101d95a2caa87c50aee7", + "reference": "068d9fcf912c88a0471d101d95a2caa87c50aee7", "shasum": "" }, "require": { "ext-dom": "*", "ext-libxml": "*", - "php": "^5.6 || ^7.0 || ^8.0" + "php": "^7.1 || ^8.0" }, "require-dev": { - "phpunit/phpunit": "^5.7 || ^6.5 || ^8.5" + "phpunit/phpunit": "^6.5 || ^8.5" }, "type": "library", "autoload": { @@ -6147,9 +6154,9 @@ "description": "An SVG sanitizer for PHP", "support": { "issues": "https://github.com/darylldoyle/svg-sanitizer/issues", - "source": "https://github.com/darylldoyle/svg-sanitizer/tree/0.19.0" + "source": "https://github.com/darylldoyle/svg-sanitizer/tree/0.20.0" }, - "time": "2024-06-18T10:27:15+00:00" + "time": "2024-09-05T10:18:12+00:00" }, { "name": "fileeye/mimemap", @@ -6387,16 +6394,16 @@ }, { "name": "google/auth", - "version": "v1.41.0", + "version": "v1.42.0", "source": { "type": "git", "url": "https://github.com/googleapis/google-auth-library-php.git", - "reference": "1043ea18fe7f5dfbf5b208ce3ee6d6b6ab8cb038" + "reference": "0c25599a91530b5847f129b271c536f75a7563f5" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/googleapis/google-auth-library-php/zipball/1043ea18fe7f5dfbf5b208ce3ee6d6b6ab8cb038", - "reference": "1043ea18fe7f5dfbf5b208ce3ee6d6b6ab8cb038", + "url": "https://api.github.com/repos/googleapis/google-auth-library-php/zipball/0c25599a91530b5847f129b271c536f75a7563f5", + "reference": "0c25599a91530b5847f129b271c536f75a7563f5", "shasum": "" }, "require": { @@ -6441,22 +6448,22 @@ "support": { "docs": "https://googleapis.github.io/google-auth-library-php/main/", "issues": "https://github.com/googleapis/google-auth-library-php/issues", - "source": "https://github.com/googleapis/google-auth-library-php/tree/v1.41.0" + "source": "https://github.com/googleapis/google-auth-library-php/tree/v1.42.0" }, - "time": "2024-07-10T15:21:07+00:00" + "time": "2024-08-26T18:33:48+00:00" }, { "name": "google/common-protos", - "version": "v4.7.0", + "version": "4.8.3", "source": { "type": "git", "url": "https://github.com/googleapis/common-protos-php.git", - "reference": "e58068776f57605c336e32c7db373f0a81da17b8" + "reference": "38a9a8bb459fa618da797d25d7bf36bb21d1103d" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/googleapis/common-protos-php/zipball/e58068776f57605c336e32c7db373f0a81da17b8", - "reference": "e58068776f57605c336e32c7db373f0a81da17b8", + "url": "https://api.github.com/repos/googleapis/common-protos-php/zipball/38a9a8bb459fa618da797d25d7bf36bb21d1103d", + "reference": "38a9a8bb459fa618da797d25d7bf36bb21d1103d", "shasum": "" }, "require": { @@ -6467,6 +6474,14 @@ "phpunit/phpunit": "^9.6" }, "type": "library", + "extra": { + "component": { + "id": "common-protos", + "target": "googleapis/common-protos-php.git", + "path": "CommonProtos", + "entry": "README.md" + } + }, "autoload": { "psr-4": { "Google\\Api\\": "src/Api", @@ -6492,23 +6507,22 @@ "google" ], "support": { - "issues": "https://github.com/googleapis/common-protos-php/issues", - "source": "https://github.com/googleapis/common-protos-php/tree/v4.7.0" + "source": "https://github.com/googleapis/common-protos-php/tree/v4.8.3" }, - "time": "2024-07-25T20:20:43+00:00" + "time": "2024-09-07T01:37:15+00:00" }, { "name": "google/gax", - "version": "v1.34.0", + "version": "v1.34.1", "source": { "type": "git", "url": "https://github.com/googleapis/gax-php.git", - "reference": "28aa3e95969a75b278606a88448992a6396a119e" + "reference": "173f0a97323284f91fd453c4ed7ed8317ecf6cfa" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/googleapis/gax-php/zipball/28aa3e95969a75b278606a88448992a6396a119e", - "reference": "28aa3e95969a75b278606a88448992a6396a119e", + "url": "https://api.github.com/repos/googleapis/gax-php/zipball/173f0a97323284f91fd453c4ed7ed8317ecf6cfa", + "reference": "173f0a97323284f91fd453c4ed7ed8317ecf6cfa", "shasum": "" }, "require": { @@ -6550,9 +6564,9 @@ ], "support": { "issues": "https://github.com/googleapis/gax-php/issues", - "source": "https://github.com/googleapis/gax-php/tree/v1.34.0" + "source": "https://github.com/googleapis/gax-php/tree/v1.34.1" }, - "time": "2024-05-30T00:35:13+00:00" + "time": "2024-08-15T18:00:58+00:00" }, { "name": "google/grpc-gcp", @@ -6645,16 +6659,16 @@ }, { "name": "google/protobuf", - "version": "v4.28.0", + "version": "v4.28.1", "source": { "type": "git", "url": "https://github.com/protocolbuffers/protobuf-php.git", - "reference": "17e3d804bf6631c2744c99575698f9cd4878b84f" + "reference": "80c95a932b0323d40a1cbcfdac721a0dffb23e12" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/protocolbuffers/protobuf-php/zipball/17e3d804bf6631c2744c99575698f9cd4878b84f", - "reference": "17e3d804bf6631c2744c99575698f9cd4878b84f", + "url": "https://api.github.com/repos/protocolbuffers/protobuf-php/zipball/80c95a932b0323d40a1cbcfdac721a0dffb23e12", + "reference": "80c95a932b0323d40a1cbcfdac721a0dffb23e12", "shasum": "" }, "require": { @@ -6683,9 +6697,9 @@ "proto" ], "support": { - "source": "https://github.com/protocolbuffers/protobuf-php/tree/v4.28.0" + "source": "https://github.com/protocolbuffers/protobuf-php/tree/v4.28.1" }, - "time": "2024-08-28T17:54:02+00:00" + "time": "2024-09-11T15:26:51+00:00" }, { "name": "grasmash/expander", @@ -7415,16 +7429,16 @@ }, { "name": "league/commonmark", - "version": "2.5.1", + "version": "2.5.3", "source": { "type": "git", "url": "https://github.com/thephpleague/commonmark.git", - "reference": "ac815920de0eff6de947eac0a6a94e5ed0fb147c" + "reference": "b650144166dfa7703e62a22e493b853b58d874b0" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/thephpleague/commonmark/zipball/ac815920de0eff6de947eac0a6a94e5ed0fb147c", - "reference": "ac815920de0eff6de947eac0a6a94e5ed0fb147c", + "url": "https://api.github.com/repos/thephpleague/commonmark/zipball/b650144166dfa7703e62a22e493b853b58d874b0", + "reference": "b650144166dfa7703e62a22e493b853b58d874b0", "shasum": "" }, "require": { @@ -7437,8 +7451,8 @@ }, "require-dev": { "cebe/markdown": "^1.0", - "commonmark/cmark": "0.31.0", - "commonmark/commonmark.js": "0.31.0", + "commonmark/cmark": "0.31.1", + "commonmark/commonmark.js": "0.31.1", "composer/package-versions-deprecated": "^1.8", "embed/embed": "^4.4", "erusev/parsedown": "^1.0", @@ -7517,7 +7531,7 @@ "type": "tidelift" } ], - "time": "2024-07-24T12:52:09+00:00" + "time": "2024-08-16T11:46:16+00:00" }, { "name": "league/config", @@ -10542,16 +10556,16 @@ }, { "name": "phpstan/phpdoc-parser", - "version": "1.30.0", + "version": "1.30.1", "source": { "type": "git", "url": "https://github.com/phpstan/phpdoc-parser.git", - "reference": "5ceb0e384997db59f38774bf79c2a6134252c08f" + "reference": "51b95ec8670af41009e2b2b56873bad96682413e" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/phpstan/phpdoc-parser/zipball/5ceb0e384997db59f38774bf79c2a6134252c08f", - "reference": "5ceb0e384997db59f38774bf79c2a6134252c08f", + "url": "https://api.github.com/repos/phpstan/phpdoc-parser/zipball/51b95ec8670af41009e2b2b56873bad96682413e", + "reference": "51b95ec8670af41009e2b2b56873bad96682413e", "shasum": "" }, "require": { @@ -10583,22 +10597,22 @@ "description": "PHPDoc parser with support for nullable, intersection and generic types", "support": { "issues": "https://github.com/phpstan/phpdoc-parser/issues", - "source": "https://github.com/phpstan/phpdoc-parser/tree/1.30.0" + "source": "https://github.com/phpstan/phpdoc-parser/tree/1.30.1" }, - "time": "2024-08-29T09:54:52+00:00" + "time": "2024-09-07T20:13:05+00:00" }, { "name": "phpstan/phpstan", - "version": "1.12.1", + "version": "1.12.3", "source": { "type": "git", "url": "https://github.com/phpstan/phpstan.git", - "reference": "d8ed7fffa66de1db0d2972267d8ed1d8fa0fe5a2" + "reference": "0fcbf194ab63d8159bb70d9aa3e1350051632009" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/phpstan/phpstan/zipball/d8ed7fffa66de1db0d2972267d8ed1d8fa0fe5a2", - "reference": "d8ed7fffa66de1db0d2972267d8ed1d8fa0fe5a2", + "url": "https://api.github.com/repos/phpstan/phpstan/zipball/0fcbf194ab63d8159bb70d9aa3e1350051632009", + "reference": "0fcbf194ab63d8159bb70d9aa3e1350051632009", "shasum": "" }, "require": { @@ -10643,25 +10657,25 @@ "type": "github" } ], - "time": "2024-09-03T19:55:22+00:00" + "time": "2024-09-09T08:10:35+00:00" }, { "name": "phpstan/phpstan-deprecation-rules", - "version": "1.2.0", + "version": "1.2.1", "source": { "type": "git", "url": "https://github.com/phpstan/phpstan-deprecation-rules.git", - "reference": "fa8cce7720fa782899a0aa97b6a41225d1bb7b26" + "reference": "f94d246cc143ec5a23da868f8f7e1393b50eaa82" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/phpstan/phpstan-deprecation-rules/zipball/fa8cce7720fa782899a0aa97b6a41225d1bb7b26", - "reference": "fa8cce7720fa782899a0aa97b6a41225d1bb7b26", + "url": "https://api.github.com/repos/phpstan/phpstan-deprecation-rules/zipball/f94d246cc143ec5a23da868f8f7e1393b50eaa82", + "reference": "f94d246cc143ec5a23da868f8f7e1393b50eaa82", "shasum": "" }, "require": { "php": "^7.2 || ^8.0", - "phpstan/phpstan": "^1.11" + "phpstan/phpstan": "^1.12" }, "require-dev": { "php-parallel-lint/php-parallel-lint": "^1.2", @@ -10688,9 +10702,9 @@ "description": "PHPStan rules for detecting usage of deprecated classes, methods, properties, constants and traits.", "support": { "issues": "https://github.com/phpstan/phpstan-deprecation-rules/issues", - "source": "https://github.com/phpstan/phpstan-deprecation-rules/tree/1.2.0" + "source": "https://github.com/phpstan/phpstan-deprecation-rules/tree/1.2.1" }, - "time": "2024-04-20T06:39:48+00:00" + "time": "2024-09-11T15:52:35+00:00" }, { "name": "phpstan/phpstan-phpunit", @@ -11528,16 +11542,16 @@ }, { "name": "psr/log", - "version": "3.0.1", + "version": "3.0.2", "source": { "type": "git", "url": "https://github.com/php-fig/log.git", - "reference": "79dff0b268932c640297f5208d6298f71855c03e" + "reference": "f16e1d5863e37f8d8c2a01719f5b34baa2b714d3" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/php-fig/log/zipball/79dff0b268932c640297f5208d6298f71855c03e", - "reference": "79dff0b268932c640297f5208d6298f71855c03e", + "url": "https://api.github.com/repos/php-fig/log/zipball/f16e1d5863e37f8d8c2a01719f5b34baa2b714d3", + "reference": "f16e1d5863e37f8d8c2a01719f5b34baa2b714d3", "shasum": "" }, "require": { @@ -11572,9 +11586,9 @@ "psr-3" ], "support": { - "source": "https://github.com/php-fig/log/tree/3.0.1" + "source": "https://github.com/php-fig/log/tree/3.0.2" }, - "time": "2024-08-21T13:31:24+00:00" + "time": "2024-09-11T13:17:53+00:00" }, { "name": "psy/psysh", @@ -15327,36 +15341,28 @@ }, { "name": "symfony/polyfill-php72", - "version": "v1.30.0", + "version": "v1.31.0", "source": { "type": "git", "url": "https://github.com/symfony/polyfill-php72.git", - "reference": "10112722600777e02d2745716b70c5db4ca70442" + "reference": "fa2ae56c44f03bed91a39bfc9822e31e7c5c38ce" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/polyfill-php72/zipball/10112722600777e02d2745716b70c5db4ca70442", - "reference": "10112722600777e02d2745716b70c5db4ca70442", + "url": "https://api.github.com/repos/symfony/polyfill-php72/zipball/fa2ae56c44f03bed91a39bfc9822e31e7c5c38ce", + "reference": "fa2ae56c44f03bed91a39bfc9822e31e7c5c38ce", "shasum": "" }, "require": { - "php": ">=7.1" + "php": ">=7.2" }, - "type": "library", + "type": "metapackage", "extra": { "thanks": { "name": "symfony/polyfill", "url": "https://github.com/symfony/polyfill" } }, - "autoload": { - "files": [ - "bootstrap.php" - ], - "psr-4": { - "Symfony\\Polyfill\\Php72\\": "" - } - }, "notification-url": "https://packagist.org/downloads/", "license": [ "MIT" @@ -15380,7 +15386,7 @@ "shim" ], "support": { - "source": "https://github.com/symfony/polyfill-php72/tree/v1.30.0" + "source": "https://github.com/symfony/polyfill-php72/tree/v1.31.0" }, "funding": [ { @@ -15396,24 +15402,24 @@ "type": "tidelift" } ], - "time": "2024-06-19T12:30:46+00:00" + "time": "2024-09-09T11:45:10+00:00" }, { "name": "symfony/polyfill-php73", - "version": "v1.30.0", + "version": "v1.31.0", "source": { "type": "git", "url": "https://github.com/symfony/polyfill-php73.git", - "reference": "ec444d3f3f6505bb28d11afa41e75faadebc10a1" + "reference": "0f68c03565dcaaf25a890667542e8bd75fe7e5bb" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/polyfill-php73/zipball/ec444d3f3f6505bb28d11afa41e75faadebc10a1", - "reference": "ec444d3f3f6505bb28d11afa41e75faadebc10a1", + "url": "https://api.github.com/repos/symfony/polyfill-php73/zipball/0f68c03565dcaaf25a890667542e8bd75fe7e5bb", + "reference": "0f68c03565dcaaf25a890667542e8bd75fe7e5bb", "shasum": "" }, "require": { - "php": ">=7.1" + "php": ">=7.2" }, "type": "library", "extra": { @@ -15456,7 +15462,7 @@ "shim" ], "support": { - "source": "https://github.com/symfony/polyfill-php73/tree/v1.30.0" + "source": "https://github.com/symfony/polyfill-php73/tree/v1.31.0" }, "funding": [ { @@ -15472,24 +15478,24 @@ "type": "tidelift" } ], - "time": "2024-05-31T15:07:36+00:00" + "time": "2024-09-09T11:45:10+00:00" }, { "name": "symfony/polyfill-php80", - "version": "v1.30.0", + "version": "v1.31.0", "source": { "type": "git", "url": "https://github.com/symfony/polyfill-php80.git", - "reference": "77fa7995ac1b21ab60769b7323d600a991a90433" + "reference": "60328e362d4c2c802a54fcbf04f9d3fb892b4cf8" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/polyfill-php80/zipball/77fa7995ac1b21ab60769b7323d600a991a90433", - "reference": "77fa7995ac1b21ab60769b7323d600a991a90433", + "url": "https://api.github.com/repos/symfony/polyfill-php80/zipball/60328e362d4c2c802a54fcbf04f9d3fb892b4cf8", + "reference": "60328e362d4c2c802a54fcbf04f9d3fb892b4cf8", "shasum": "" }, "require": { - "php": ">=7.1" + "php": ">=7.2" }, "type": "library", "extra": { @@ -15536,7 +15542,7 @@ "shim" ], "support": { - "source": "https://github.com/symfony/polyfill-php80/tree/v1.30.0" + "source": "https://github.com/symfony/polyfill-php80/tree/v1.31.0" }, "funding": [ { @@ -15552,24 +15558,24 @@ "type": "tidelift" } ], - "time": "2024-05-31T15:07:36+00:00" + "time": "2024-09-09T11:45:10+00:00" }, { "name": "symfony/polyfill-php81", - "version": "v1.30.0", + "version": "v1.31.0", "source": { "type": "git", "url": "https://github.com/symfony/polyfill-php81.git", - "reference": "3fb075789fb91f9ad9af537c4012d523085bd5af" + "reference": "4a4cfc2d253c21a5ad0e53071df248ed48c6ce5c" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/polyfill-php81/zipball/3fb075789fb91f9ad9af537c4012d523085bd5af", - "reference": "3fb075789fb91f9ad9af537c4012d523085bd5af", + "url": "https://api.github.com/repos/symfony/polyfill-php81/zipball/4a4cfc2d253c21a5ad0e53071df248ed48c6ce5c", + "reference": "4a4cfc2d253c21a5ad0e53071df248ed48c6ce5c", "shasum": "" }, "require": { - "php": ">=7.1" + "php": ">=7.2" }, "type": "library", "extra": { @@ -15612,7 +15618,7 @@ "shim" ], "support": { - "source": "https://github.com/symfony/polyfill-php81/tree/v1.30.0" + "source": "https://github.com/symfony/polyfill-php81/tree/v1.31.0" }, "funding": [ { @@ -15628,24 +15634,24 @@ "type": "tidelift" } ], - "time": "2024-06-19T12:30:46+00:00" + "time": "2024-09-09T11:45:10+00:00" }, { "name": "symfony/polyfill-php82", - "version": "v1.30.0", + "version": "v1.31.0", "source": { "type": "git", "url": "https://github.com/symfony/polyfill-php82.git", - "reference": "77ff49780f56906788a88974867ed68bc49fae5b" + "reference": "5d2ed36f7734637dacc025f179698031951b1692" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/polyfill-php82/zipball/77ff49780f56906788a88974867ed68bc49fae5b", - "reference": "77ff49780f56906788a88974867ed68bc49fae5b", + "url": "https://api.github.com/repos/symfony/polyfill-php82/zipball/5d2ed36f7734637dacc025f179698031951b1692", + "reference": "5d2ed36f7734637dacc025f179698031951b1692", "shasum": "" }, "require": { - "php": ">=7.1" + "php": ">=7.2" }, "type": "library", "extra": { @@ -15688,7 +15694,7 @@ "shim" ], "support": { - "source": "https://github.com/symfony/polyfill-php82/tree/v1.30.0" + "source": "https://github.com/symfony/polyfill-php82/tree/v1.31.0" }, "funding": [ { @@ -15704,7 +15710,7 @@ "type": "tidelift" } ], - "time": "2024-06-19T12:30:46+00:00" + "time": "2024-09-09T11:45:10+00:00" }, { "name": "symfony/polyfill-php83", @@ -15785,20 +15791,20 @@ }, { "name": "symfony/polyfill-uuid", - "version": "v1.30.0", + "version": "v1.31.0", "source": { "type": "git", "url": "https://github.com/symfony/polyfill-uuid.git", - "reference": "2ba1f33797470debcda07fe9dce20a0003df18e9" + "reference": "21533be36c24be3f4b1669c4725c7d1d2bab4ae2" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/polyfill-uuid/zipball/2ba1f33797470debcda07fe9dce20a0003df18e9", - "reference": "2ba1f33797470debcda07fe9dce20a0003df18e9", + "url": "https://api.github.com/repos/symfony/polyfill-uuid/zipball/21533be36c24be3f4b1669c4725c7d1d2bab4ae2", + "reference": "21533be36c24be3f4b1669c4725c7d1d2bab4ae2", "shasum": "" }, "require": { - "php": ">=7.1" + "php": ">=7.2" }, "provide": { "ext-uuid": "*" @@ -15844,7 +15850,7 @@ "uuid" ], "support": { - "source": "https://github.com/symfony/polyfill-uuid/tree/v1.30.0" + "source": "https://github.com/symfony/polyfill-uuid/tree/v1.31.0" }, "funding": [ { @@ -15860,7 +15866,7 @@ "type": "tidelift" } ], - "time": "2024-05-31T15:07:36+00:00" + "time": "2024-09-09T11:45:10+00:00" }, { "name": "symfony/process", @@ -16963,24 +16969,24 @@ }, { "name": "twig/twig", - "version": "v3.10.3", + "version": "v3.14.0", "source": { "type": "git", "url": "https://github.com/twigphp/Twig.git", - "reference": "67f29781ffafa520b0bbfbd8384674b42db04572" + "reference": "126b2c97818dbff0cdf3fbfc881aedb3d40aae72" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/twigphp/Twig/zipball/67f29781ffafa520b0bbfbd8384674b42db04572", - "reference": "67f29781ffafa520b0bbfbd8384674b42db04572", + "url": "https://api.github.com/repos/twigphp/Twig/zipball/126b2c97818dbff0cdf3fbfc881aedb3d40aae72", + "reference": "126b2c97818dbff0cdf3fbfc881aedb3d40aae72", "shasum": "" }, "require": { - "php": ">=7.2.5", + "php": ">=8.0.2", "symfony/deprecation-contracts": "^2.5|^3", "symfony/polyfill-ctype": "^1.8", "symfony/polyfill-mbstring": "^1.3", - "symfony/polyfill-php80": "^1.22" + "symfony/polyfill-php81": "^1.29" }, "require-dev": { "psr/container": "^1.0|^2.0", @@ -17026,7 +17032,7 @@ ], "support": { "issues": "https://github.com/twigphp/Twig/issues", - "source": "https://github.com/twigphp/Twig/tree/v3.10.3" + "source": "https://github.com/twigphp/Twig/tree/v3.14.0" }, "funding": [ { @@ -17038,7 +17044,7 @@ "type": "tidelift" } ], - "time": "2024-05-16T10:04:27+00:00" + "time": "2024-09-09T17:55:12+00:00" }, { "name": "un-ocha/oauth2-hid", @@ -17157,16 +17163,16 @@ }, { "name": "unocha/ocha_ai", - "version": "v1.5.1", + "version": "v1.6.1", "source": { "type": "git", "url": "https://github.com/UN-OCHA/ocha_ai.git", - "reference": "02bf7a6bee3771ad07bc8d83fc2a4ca5be51feac" + "reference": "839856d3a14891f75b04acba328dc4dc9a0ec725" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/UN-OCHA/ocha_ai/zipball/02bf7a6bee3771ad07bc8d83fc2a4ca5be51feac", - "reference": "02bf7a6bee3771ad07bc8d83fc2a4ca5be51feac", + "url": "https://api.github.com/repos/UN-OCHA/ocha_ai/zipball/839856d3a14891f75b04acba328dc4dc9a0ec725", + "reference": "839856d3a14891f75b04acba328dc4dc9a0ec725", "shasum": "" }, "require": { @@ -17198,9 +17204,9 @@ "description": "OCHA AI module", "support": { "issues": "https://github.com/UN-OCHA/ocha_ai/issues", - "source": "https://github.com/UN-OCHA/ocha_ai/tree/v1.5.1" + "source": "https://github.com/UN-OCHA/ocha_ai/tree/v1.6.1" }, - "time": "2024-08-27T07:57:48+00:00" + "time": "2024-09-13T03:48:18+00:00" }, { "name": "unocha/ocha_monitoring", @@ -18078,11 +18084,17 @@ }, { "name": "weitzman/drupal-test-traits", - "version": "2.3.0", + "version": "2.3.1", "source": { "type": "git", - "url": "https://git.drupalcode.org/project/dtt/", - "reference": "9385da6be0db48ecdb27e6646ae2bb0864c1dcee" + "url": "https://git.drupalcode.org/project/dtt.git", + "reference": "5e3df23c93f4f3e4f34fd7677df10bc06616f4ce" + }, + "dist": { + "type": "zip", + "url": "https://git.drupalcode.org/api/v4/projects/project%2Fdtt/repository/archive.zip?sha=5e3df23c93f4f3e4f34fd7677df10bc06616f4ce", + "reference": "5e3df23c93f4f3e4f34fd7677df10bc06616f4ce", + "shasum": "" }, "require": { "php": ">=8.1" @@ -18125,7 +18137,10 @@ } ], "description": "Traits for testing Drupal sites that have user content (versus unpopulated sites).", - "time": "2024-05-08T13:42:59+00:00" + "support": { + "source": "https://git.drupalcode.org/project/dtt/-/tree/2.3.1" + }, + "time": "2024-08-10T19:01:22+00:00" } ], "aliases": [], diff --git a/composer.patches.json b/composer.patches.json index 58ff98e70..021cd7086 100644 --- a/composer.patches.json +++ b/composer.patches.json @@ -6,8 +6,7 @@ "drupal/core" : { "https://www.drupal.org/project/drupal/issues/3008292": "PATCHES/core--drupal--3008292-image-upload-validators.patch", "https://www.drupal.org/project/drupal/issues/3143617": "PATCHES/core--drupal--3143617-pager-parameter.patch", - "https://www.drupal.org/project/drupal/issues/3418098": "PATCHES/core--drupal--3418098-php-mailer.patch", - "https://www.drupal.org/project/drupal/issues/3467860": "PATCHES/core--drupal--3467860-aggregation.patch" + "https://www.drupal.org/project/drupal/issues/3418098": "PATCHES/core--drupal--3418098-php-mailer.patch" }, "drupal/guidelines": { "Drupal 10 compatibility": "PATCHES/guidelines-drupal-10-compatibility.patch" diff --git a/html/modules/custom/reliefweb_semantic/README.md b/html/modules/custom/reliefweb_semantic/README.md index 471387053..ab4dc9166 100644 --- a/html/modules/custom/reliefweb_semantic/README.md +++ b/html/modules/custom/reliefweb_semantic/README.md @@ -4,7 +4,7 @@ This module provides integration with the ReliefWeb Semantic API. ## To do -- Add service to query API +- [x] Add service to query API ## AWS @@ -20,14 +20,7 @@ Config: - Text field name: `AMAZON_BEDROCK_TEXT_CHUNK` - Metadata field name: `AMAZON_BEDROCK_METADATA` -| KB Id | Data Id | Bundle | S3 source | Bucket | Index | KB | -| ---------- | ---------- | --------- | ---------------------------- | ---------------- | --------------- | ---------------------------- | -| VIEPSPYNSS | 6KGHOEXLGY | report | kb-data-source-rw-reports | rw-kb-reports | rw-reports | rw-knowledge-base-reports | -| WYBGQOFQLN | ZQW6GY0WYE | job | kb-data-source-rw-jobs | rw-kb-jobs | rw-jobs | rw-knowledge-base-jobs | -| VDQ6RY0K5K | XJMXTP72QA | training | kb-data-source-rw-trainings | rw-kb-trainings | rw-trainings-2 | rw-knowledge-base-trainings | -| D2E5HCYCTQ | URINLN9HIR | blog_post | kb-data-source-rw-blog-posts | rw-kb-blog-posts | rw-blog-posts-2 | rw-knowledge-base-blog-posts | -| NZTC9LPLJN | XETKAPIJKB | book | kb-data-source-rw-books | rw-kb-books | rw-books-2 | rw-knowledge-base-books | -| Y5EU13DU6Q | AXCARFTXKS | topic | kb-data-source-rw-topics | rw-kb-topics | rw-topics | rw-knowledge-base-topics | +All content is using a single KB, current Id is `VIEPSPYNSS` ## Drush @@ -38,6 +31,7 @@ drush reliefweb-semantic:list-datasources List datasources. drush reliefweb-semantic:list-jobs List ingestion jobs. drush reliefweb-semantic:trigger-sync Trigger sync.. drush reliefweb-semantic:query-kb --id=WYBGQOFQLN --q="Any jobs in Europe" +drush reliefweb-semantic:list-apikeys ``` ## Openseach From e51a4d28ebaf4477803b376f69da32661c6201f3 Mon Sep 17 00:00:00 2001 From: unocha-jenkins Date: Thu, 19 Sep 2024 06:43:37 +0000 Subject: [PATCH 19/25] chore: Update all outdated drupal/* unocha/* drush/* packages. --- composer.lock | 58 +++++++++---------- config/aws.profile.amazon_ses.yml | 1 + ....entity_form_display.user.user.default.yml | 8 +++ ...splay.media.image_announcement.default.yml | 4 +- ...media.image_announcement.media_library.yml | 4 +- ..._display.media.image_blog_post.default.yml | 4 +- ...ay.media.image_blog_post.media_library.yml | 4 +- ..._view_display.media.image_book.default.yml | 4 +- ...display.media.image_book.media_library.yml | 4 +- ...iew_display.media.image_report.default.yml | 4 +- ...splay.media.image_report.media_library.yml | 4 +- ...iew_display.media.image_source.default.yml | 4 +- ...splay.media.image_source.media_library.yml | 4 +- ...view_display.media.image_topic.default.yml | 4 +- ...isplay.media.image_topic.media_library.yml | 4 +- ....entity_view_display.user.user.default.yml | 1 + .../environment_indicator.switcher.demo.yml | 2 +- config/environment_indicator.switcher.dev.yml | 2 +- .../environment_indicator.switcher.prod.yml | 2 +- .../environment_indicator.switcher.stage.yml | 2 +- .../environment_indicator.switcher.test.yml | 2 +- ...g.sensor_config.core_cron_last_run_age.yml | 2 +- ...or_config.monitoring_installed_modules.yml | 2 +- ...itoring.sensor_config.ocha_admin_paths.yml | 2 +- ...oring.sensor_config.ocha_common_design.yml | 2 +- ...r_config.ocha_current_composer_version.yml | 2 +- ...sor_config.ocha_current_drupal_version.yml | 2 +- ...sensor_config.ocha_current_php_version.yml | 2 +- ...ing.sensor_config.ocha_current_release.yml | 2 +- ...nsor_config.ocha_deployment_identifier.yml | 2 +- ...ring.sensor_config.ocha_env_link_fixer.yml | 2 +- ...oring.sensor_config.ocha_gtm_barebones.yml | 2 +- ...ing.sensor_config.ocha_ocha_monitoring.yml | 2 +- .../monitoring.sensor_config.ocha_un_date.yml | 2 +- ...onitoring.sensor_config.update_contrib.yml | 2 +- .../monitoring.sensor_config.update_core.yml | 2 +- config/ocha_ai_chat.settings.yml | 2 +- config/openid_connect.settings.yml | 4 +- config/theme_switcher.rule.content_type.yml | 1 + config/theme_switcher.rule.request_path.yml | 1 + config/theme_switcher.rule.vocabulary.yml | 1 + 41 files changed, 89 insertions(+), 76 deletions(-) diff --git a/composer.lock b/composer.lock index c31076985..47dd603cb 100644 --- a/composer.lock +++ b/composer.lock @@ -118,16 +118,16 @@ }, { "name": "aws/aws-sdk-php", - "version": "3.321.10", + "version": "3.322.0", "source": { "type": "git", "url": "https://github.com/aws/aws-sdk-php.git", - "reference": "a81a9a2cb5f451e03f8ef68b02ebfecfbf1fa7f2" + "reference": "3eeb8d400acc902965f7de5bc85635853f27c109" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/aws/aws-sdk-php/zipball/a81a9a2cb5f451e03f8ef68b02ebfecfbf1fa7f2", - "reference": "a81a9a2cb5f451e03f8ef68b02ebfecfbf1fa7f2", + "url": "https://api.github.com/repos/aws/aws-sdk-php/zipball/3eeb8d400acc902965f7de5bc85635853f27c109", + "reference": "3eeb8d400acc902965f7de5bc85635853f27c109", "shasum": "" }, "require": { @@ -210,9 +210,9 @@ "support": { "forum": "https://forums.aws.amazon.com/forum.jspa?forumID=80", "issues": "https://github.com/aws/aws-sdk-php/issues", - "source": "https://github.com/aws/aws-sdk-php/tree/3.321.10" + "source": "https://github.com/aws/aws-sdk-php/tree/3.322.0" }, - "time": "2024-09-12T18:08:32+00:00" + "time": "2024-09-18T18:09:42+00:00" }, { "name": "behat/mink", @@ -3761,7 +3761,7 @@ "homepage": "https://www.drupal.org/user/213194" }, { - "name": "TR", + "name": "tr", "homepage": "https://www.drupal.org/user/202830" }, { @@ -4207,7 +4207,7 @@ ], "authors": [ { - "name": "Cellar Door", + "name": "cellar door", "homepage": "https://www.drupal.org/user/658076" }, { @@ -4328,7 +4328,7 @@ "shasum": "fc8ea60619b6b4682bade340e13fb4565d3a7e0c" }, "require": { - "drupal/core": "^10" + "drupal/core": "^9.1 || ^10" }, "type": "drupal-module", "extra": { @@ -4527,7 +4527,7 @@ "shasum": "c25246747dac4372c7d5a5a5fd0f276d9e468eff" }, "require": { - "drupal/core": "^10", + "drupal/core": "^9.3 || ^10", "drupal/mailsystem": "^4" }, "require-dev": { @@ -5432,7 +5432,7 @@ "shasum": "77906ae731878b68a181f82b073617b798e5f110" }, "require": { - "drupal/core": "^10", + "drupal/core": "^9.3 || ^10", "enshrined/svg-sanitize": ">=0.15 <1.0" }, "type": "drupal-module", @@ -5580,7 +5580,7 @@ "shasum": "9ea9eee91cf75f21fcc939704baa6a7ec10d7748" }, "require": { - "drupal/core": "^10" + "drupal/core": "^8.9 || ^9 || ^10" }, "type": "drupal-module", "extra": { @@ -6659,16 +6659,16 @@ }, { "name": "google/protobuf", - "version": "v4.28.1", + "version": "v4.28.2", "source": { "type": "git", "url": "https://github.com/protocolbuffers/protobuf-php.git", - "reference": "80c95a932b0323d40a1cbcfdac721a0dffb23e12" + "reference": "96021a9a8a5aa7770427b1e7ef1b2e543792684e" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/protocolbuffers/protobuf-php/zipball/80c95a932b0323d40a1cbcfdac721a0dffb23e12", - "reference": "80c95a932b0323d40a1cbcfdac721a0dffb23e12", + "url": "https://api.github.com/repos/protocolbuffers/protobuf-php/zipball/96021a9a8a5aa7770427b1e7ef1b2e543792684e", + "reference": "96021a9a8a5aa7770427b1e7ef1b2e543792684e", "shasum": "" }, "require": { @@ -6697,9 +6697,9 @@ "proto" ], "support": { - "source": "https://github.com/protocolbuffers/protobuf-php/tree/v4.28.1" + "source": "https://github.com/protocolbuffers/protobuf-php/tree/v4.28.2" }, - "time": "2024-09-11T15:26:51+00:00" + "time": "2024-09-18T20:56:15+00:00" }, { "name": "grasmash/expander", @@ -8641,16 +8641,16 @@ }, { "name": "nikic/php-parser", - "version": "v5.1.0", + "version": "v5.2.0", "source": { "type": "git", "url": "https://github.com/nikic/PHP-Parser.git", - "reference": "683130c2ff8c2739f4822ff7ac5c873ec529abd1" + "reference": "23c79fbbfb725fb92af9bcf41065c8e9a0d49ddb" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/nikic/PHP-Parser/zipball/683130c2ff8c2739f4822ff7ac5c873ec529abd1", - "reference": "683130c2ff8c2739f4822ff7ac5c873ec529abd1", + "url": "https://api.github.com/repos/nikic/PHP-Parser/zipball/23c79fbbfb725fb92af9bcf41065c8e9a0d49ddb", + "reference": "23c79fbbfb725fb92af9bcf41065c8e9a0d49ddb", "shasum": "" }, "require": { @@ -8693,9 +8693,9 @@ ], "support": { "issues": "https://github.com/nikic/PHP-Parser/issues", - "source": "https://github.com/nikic/PHP-Parser/tree/v5.1.0" + "source": "https://github.com/nikic/PHP-Parser/tree/v5.2.0" }, - "time": "2024-07-01T20:03:41+00:00" + "time": "2024-09-15T16:40:33+00:00" }, { "name": "open-telemetry/api", @@ -13402,16 +13402,16 @@ }, { "name": "squizlabs/php_codesniffer", - "version": "3.10.2", + "version": "3.10.3", "source": { "type": "git", "url": "https://github.com/PHPCSStandards/PHP_CodeSniffer.git", - "reference": "86e5f5dd9a840c46810ebe5ff1885581c42a3017" + "reference": "62d32998e820bddc40f99f8251958aed187a5c9c" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/PHPCSStandards/PHP_CodeSniffer/zipball/86e5f5dd9a840c46810ebe5ff1885581c42a3017", - "reference": "86e5f5dd9a840c46810ebe5ff1885581c42a3017", + "url": "https://api.github.com/repos/PHPCSStandards/PHP_CodeSniffer/zipball/62d32998e820bddc40f99f8251958aed187a5c9c", + "reference": "62d32998e820bddc40f99f8251958aed187a5c9c", "shasum": "" }, "require": { @@ -13478,7 +13478,7 @@ "type": "open_collective" } ], - "time": "2024-07-21T23:26:44+00:00" + "time": "2024-09-18T10:38:58+00:00" }, { "name": "symfony/browser-kit", diff --git a/config/aws.profile.amazon_ses.yml b/config/aws.profile.amazon_ses.yml index 0b0a2668a..a832450ed 100644 --- a/config/aws.profile.amazon_ses.yml +++ b/config/aws.profile.amazon_ses.yml @@ -6,6 +6,7 @@ id: amazon_ses name: 'Amazon SES' default: 1 aws_role_arn: '' +aws_role_session_name: null aws_access_key_id: '' aws_secret_access_key: '' region: us-east-1 diff --git a/config/core.entity_form_display.user.user.default.yml b/config/core.entity_form_display.user.user.default.yml index e7563b3c8..7fbdc7a9f 100644 --- a/config/core.entity_form_display.user.user.default.yml +++ b/config/core.entity_form_display.user.user.default.yml @@ -22,6 +22,14 @@ content: region: content settings: { } third_party_settings: { } + display_name: + type: text_textfield + weight: -1 + region: content + settings: + size: 60 + placeholder: '' + third_party_settings: { } field_email_confirmed: type: boolean_checkbox weight: 2 diff --git a/config/core.entity_view_display.media.image_announcement.default.yml b/config/core.entity_view_display.media.image_announcement.default.yml index bdc530a8b..8c484cba3 100644 --- a/config/core.entity_view_display.media.image_announcement.default.yml +++ b/config/core.entity_view_display.media.image_announcement.default.yml @@ -19,12 +19,12 @@ content: settings: image_link: '' image_style: announcement + image_loading: + attribute: lazy svg_attributes: width: null height: null svg_render_as_image: true - image_loading: - attribute: lazy third_party_settings: { } weight: 0 region: content diff --git a/config/core.entity_view_display.media.image_announcement.media_library.yml b/config/core.entity_view_display.media.image_announcement.media_library.yml index 94ab0b12e..2ec103e3c 100644 --- a/config/core.entity_view_display.media.image_announcement.media_library.yml +++ b/config/core.entity_view_display.media.image_announcement.media_library.yml @@ -20,12 +20,12 @@ content: settings: image_link: '' image_style: announcement + image_loading: + attribute: lazy svg_attributes: width: null height: null svg_render_as_image: true - image_loading: - attribute: lazy third_party_settings: { } weight: 0 region: content diff --git a/config/core.entity_view_display.media.image_blog_post.default.yml b/config/core.entity_view_display.media.image_blog_post.default.yml index ff4192471..0980dd615 100644 --- a/config/core.entity_view_display.media.image_blog_post.default.yml +++ b/config/core.entity_view_display.media.image_blog_post.default.yml @@ -29,12 +29,12 @@ content: settings: image_link: '' image_style: large + image_loading: + attribute: lazy svg_attributes: width: null height: null svg_render_as_image: true - image_loading: - attribute: lazy third_party_settings: { } weight: 0 region: content diff --git a/config/core.entity_view_display.media.image_blog_post.media_library.yml b/config/core.entity_view_display.media.image_blog_post.media_library.yml index 95d2a6d79..5ef9d40be 100644 --- a/config/core.entity_view_display.media.image_blog_post.media_library.yml +++ b/config/core.entity_view_display.media.image_blog_post.media_library.yml @@ -22,12 +22,12 @@ content: settings: image_link: file image_style: media_library + image_loading: + attribute: lazy svg_attributes: width: null height: null svg_render_as_image: true - image_loading: - attribute: lazy third_party_settings: { } weight: 0 region: content diff --git a/config/core.entity_view_display.media.image_book.default.yml b/config/core.entity_view_display.media.image_book.default.yml index 1282382da..bac1e7f46 100644 --- a/config/core.entity_view_display.media.image_book.default.yml +++ b/config/core.entity_view_display.media.image_book.default.yml @@ -29,12 +29,12 @@ content: settings: image_link: '' image_style: large + image_loading: + attribute: lazy svg_attributes: width: null height: null svg_render_as_image: true - image_loading: - attribute: lazy third_party_settings: { } weight: 0 region: content diff --git a/config/core.entity_view_display.media.image_book.media_library.yml b/config/core.entity_view_display.media.image_book.media_library.yml index 02fbd9535..547c53d15 100644 --- a/config/core.entity_view_display.media.image_book.media_library.yml +++ b/config/core.entity_view_display.media.image_book.media_library.yml @@ -22,12 +22,12 @@ content: settings: image_link: file image_style: media_library + image_loading: + attribute: lazy svg_attributes: width: null height: null svg_render_as_image: true - image_loading: - attribute: lazy third_party_settings: { } weight: 0 region: content diff --git a/config/core.entity_view_display.media.image_report.default.yml b/config/core.entity_view_display.media.image_report.default.yml index 944144a4d..569c12a85 100644 --- a/config/core.entity_view_display.media.image_report.default.yml +++ b/config/core.entity_view_display.media.image_report.default.yml @@ -37,12 +37,12 @@ content: settings: image_link: '' image_style: large + image_loading: + attribute: lazy svg_attributes: width: null height: null svg_render_as_image: true - image_loading: - attribute: lazy third_party_settings: { } weight: 0 region: content diff --git a/config/core.entity_view_display.media.image_report.media_library.yml b/config/core.entity_view_display.media.image_report.media_library.yml index cbf03805e..7031f1fb4 100644 --- a/config/core.entity_view_display.media.image_report.media_library.yml +++ b/config/core.entity_view_display.media.image_report.media_library.yml @@ -22,12 +22,12 @@ content: settings: image_link: file image_style: media_library + image_loading: + attribute: lazy svg_attributes: width: null height: null svg_render_as_image: true - image_loading: - attribute: lazy third_party_settings: { } weight: 0 region: content diff --git a/config/core.entity_view_display.media.image_source.default.yml b/config/core.entity_view_display.media.image_source.default.yml index 2593bf9f7..b54017063 100644 --- a/config/core.entity_view_display.media.image_source.default.yml +++ b/config/core.entity_view_display.media.image_source.default.yml @@ -19,12 +19,12 @@ content: settings: image_link: '' image_style: thumbnail + image_loading: + attribute: lazy svg_attributes: width: null height: null svg_render_as_image: true - image_loading: - attribute: lazy third_party_settings: { } weight: 0 region: content diff --git a/config/core.entity_view_display.media.image_source.media_library.yml b/config/core.entity_view_display.media.image_source.media_library.yml index b5e113dcc..de4c7d89d 100644 --- a/config/core.entity_view_display.media.image_source.media_library.yml +++ b/config/core.entity_view_display.media.image_source.media_library.yml @@ -20,12 +20,12 @@ content: settings: image_link: '' image_style: thumbnail + image_loading: + attribute: lazy svg_attributes: width: null height: null svg_render_as_image: true - image_loading: - attribute: lazy third_party_settings: { } weight: 0 region: content diff --git a/config/core.entity_view_display.media.image_topic.default.yml b/config/core.entity_view_display.media.image_topic.default.yml index 8735a0793..5120b0e4a 100644 --- a/config/core.entity_view_display.media.image_topic.default.yml +++ b/config/core.entity_view_display.media.image_topic.default.yml @@ -19,12 +19,12 @@ content: settings: image_link: '' image_style: icon + image_loading: + attribute: lazy svg_attributes: width: 64 height: 64 svg_render_as_image: true - image_loading: - attribute: lazy third_party_settings: { } weight: 0 region: content diff --git a/config/core.entity_view_display.media.image_topic.media_library.yml b/config/core.entity_view_display.media.image_topic.media_library.yml index 55e28069c..c92de7d07 100644 --- a/config/core.entity_view_display.media.image_topic.media_library.yml +++ b/config/core.entity_view_display.media.image_topic.media_library.yml @@ -20,12 +20,12 @@ content: settings: image_link: '' image_style: icon + image_loading: + attribute: lazy svg_attributes: width: null height: null svg_render_as_image: true - image_loading: - attribute: lazy third_party_settings: { } weight: 0 region: content diff --git a/config/core.entity_view_display.user.user.default.yml b/config/core.entity_view_display.user.user.default.yml index a263d9d41..7faface77 100644 --- a/config/core.entity_view_display.user.user.default.yml +++ b/config/core.entity_view_display.user.user.default.yml @@ -13,6 +13,7 @@ bundle: user mode: default content: { } hidden: + display_name: true field_email_confirmed: true field_notes: true langcode: true diff --git a/config/environment_indicator.switcher.demo.yml b/config/environment_indicator.switcher.demo.yml index face8654d..4393e46cb 100644 --- a/config/environment_indicator.switcher.demo.yml +++ b/config/environment_indicator.switcher.demo.yml @@ -5,7 +5,7 @@ dependencies: { } machine: demo description: null name: Demo -weight: '' +weight: null url: '' fg_color: '#000000' bg_color: '#34ccc1' diff --git a/config/environment_indicator.switcher.dev.yml b/config/environment_indicator.switcher.dev.yml index 87a75db05..4738731b0 100644 --- a/config/environment_indicator.switcher.dev.yml +++ b/config/environment_indicator.switcher.dev.yml @@ -5,7 +5,7 @@ dependencies: { } machine: dev description: null name: Dev -weight: '' +weight: null url: '' fg_color: '#ffffff' bg_color: '#db7b18' diff --git a/config/environment_indicator.switcher.prod.yml b/config/environment_indicator.switcher.prod.yml index 252f600c4..28b60a923 100644 --- a/config/environment_indicator.switcher.prod.yml +++ b/config/environment_indicator.switcher.prod.yml @@ -5,7 +5,7 @@ dependencies: { } machine: prod description: null name: Prod -weight: '' +weight: null url: '' fg_color: '#ffffff' bg_color: '#6937ac' diff --git a/config/environment_indicator.switcher.stage.yml b/config/environment_indicator.switcher.stage.yml index 237742b3c..de4414180 100644 --- a/config/environment_indicator.switcher.stage.yml +++ b/config/environment_indicator.switcher.stage.yml @@ -5,7 +5,7 @@ dependencies: { } machine: stage description: null name: Stage -weight: '' +weight: null url: '' fg_color: '#000000' bg_color: '#34cc32' diff --git a/config/environment_indicator.switcher.test.yml b/config/environment_indicator.switcher.test.yml index 55437b65a..d503f817a 100644 --- a/config/environment_indicator.switcher.test.yml +++ b/config/environment_indicator.switcher.test.yml @@ -5,7 +5,7 @@ dependencies: { } machine: test description: null name: Test -weight: '' +weight: null url: '' fg_color: '#ffffff' bg_color: '#b23c72' diff --git a/config/monitoring.sensor_config.core_cron_last_run_age.yml b/config/monitoring.sensor_config.core_cron_last_run_age.yml index f1b073007..358ab19b8 100644 --- a/config/monitoring.sensor_config.core_cron_last_run_age.yml +++ b/config/monitoring.sensor_config.core_cron_last_run_age.yml @@ -1,4 +1,4 @@ -uuid: null +uuid: 648106bf-5098-4a48-a63f-28b6b9cd6471 langcode: en status: true dependencies: { } diff --git a/config/monitoring.sensor_config.monitoring_installed_modules.yml b/config/monitoring.sensor_config.monitoring_installed_modules.yml index 01d258a8e..dc392cb1c 100644 --- a/config/monitoring.sensor_config.monitoring_installed_modules.yml +++ b/config/monitoring.sensor_config.monitoring_installed_modules.yml @@ -1,4 +1,4 @@ -uuid: null +uuid: 5110183d-9d64-43b3-80a9-413029579f72 langcode: en status: true dependencies: { } diff --git a/config/monitoring.sensor_config.ocha_admin_paths.yml b/config/monitoring.sensor_config.ocha_admin_paths.yml index f69e90113..4d9d1e2bf 100644 --- a/config/monitoring.sensor_config.ocha_admin_paths.yml +++ b/config/monitoring.sensor_config.ocha_admin_paths.yml @@ -1,4 +1,4 @@ -uuid: null +uuid: 81552277-8b3c-4f67-8198-a53233b971c9 langcode: en status: true dependencies: diff --git a/config/monitoring.sensor_config.ocha_common_design.yml b/config/monitoring.sensor_config.ocha_common_design.yml index 2b9ce4a14..fb9f7e13f 100644 --- a/config/monitoring.sensor_config.ocha_common_design.yml +++ b/config/monitoring.sensor_config.ocha_common_design.yml @@ -1,4 +1,4 @@ -uuid: null +uuid: bdf7c77b-988b-4a0b-94d9-6bd9105a8ca9 langcode: en status: true dependencies: diff --git a/config/monitoring.sensor_config.ocha_current_composer_version.yml b/config/monitoring.sensor_config.ocha_current_composer_version.yml index f776f8851..f5f05cb09 100644 --- a/config/monitoring.sensor_config.ocha_current_composer_version.yml +++ b/config/monitoring.sensor_config.ocha_current_composer_version.yml @@ -1,4 +1,4 @@ -uuid: null +uuid: 681e767a-c52e-49da-b818-9e1021b85bac langcode: en status: true dependencies: diff --git a/config/monitoring.sensor_config.ocha_current_drupal_version.yml b/config/monitoring.sensor_config.ocha_current_drupal_version.yml index 8752fe8bc..2f95d6cab 100644 --- a/config/monitoring.sensor_config.ocha_current_drupal_version.yml +++ b/config/monitoring.sensor_config.ocha_current_drupal_version.yml @@ -1,4 +1,4 @@ -uuid: null +uuid: eb689f4d-a6bf-4726-bcd4-a6e2f6214ef4 langcode: en status: true dependencies: diff --git a/config/monitoring.sensor_config.ocha_current_php_version.yml b/config/monitoring.sensor_config.ocha_current_php_version.yml index 562d7a153..f89add460 100644 --- a/config/monitoring.sensor_config.ocha_current_php_version.yml +++ b/config/monitoring.sensor_config.ocha_current_php_version.yml @@ -1,4 +1,4 @@ -uuid: null +uuid: 4df1165a-727d-4d3d-a243-c1c4ae44959b langcode: en status: true dependencies: diff --git a/config/monitoring.sensor_config.ocha_current_release.yml b/config/monitoring.sensor_config.ocha_current_release.yml index 9718893d8..a2148720b 100644 --- a/config/monitoring.sensor_config.ocha_current_release.yml +++ b/config/monitoring.sensor_config.ocha_current_release.yml @@ -1,4 +1,4 @@ -uuid: null +uuid: 1a920b1c-ad79-46c9-a94f-460017403065 langcode: en status: true dependencies: diff --git a/config/monitoring.sensor_config.ocha_deployment_identifier.yml b/config/monitoring.sensor_config.ocha_deployment_identifier.yml index 177806b05..2fc6054ad 100644 --- a/config/monitoring.sensor_config.ocha_deployment_identifier.yml +++ b/config/monitoring.sensor_config.ocha_deployment_identifier.yml @@ -1,4 +1,4 @@ -uuid: null +uuid: 55d895ec-d959-4e30-a50c-be4205d338cb langcode: en status: true dependencies: diff --git a/config/monitoring.sensor_config.ocha_env_link_fixer.yml b/config/monitoring.sensor_config.ocha_env_link_fixer.yml index 706170679..22f6b5728 100644 --- a/config/monitoring.sensor_config.ocha_env_link_fixer.yml +++ b/config/monitoring.sensor_config.ocha_env_link_fixer.yml @@ -1,4 +1,4 @@ -uuid: null +uuid: 178b0691-0573-41a2-b78e-39354c6d6f8a langcode: en status: true dependencies: diff --git a/config/monitoring.sensor_config.ocha_gtm_barebones.yml b/config/monitoring.sensor_config.ocha_gtm_barebones.yml index 8cc266f70..a639dcfdf 100644 --- a/config/monitoring.sensor_config.ocha_gtm_barebones.yml +++ b/config/monitoring.sensor_config.ocha_gtm_barebones.yml @@ -1,4 +1,4 @@ -uuid: null +uuid: 3e985c4d-01d9-41a2-9239-81231aeedb2d langcode: en status: true dependencies: diff --git a/config/monitoring.sensor_config.ocha_ocha_monitoring.yml b/config/monitoring.sensor_config.ocha_ocha_monitoring.yml index 072e5591d..88bc7b581 100644 --- a/config/monitoring.sensor_config.ocha_ocha_monitoring.yml +++ b/config/monitoring.sensor_config.ocha_ocha_monitoring.yml @@ -1,4 +1,4 @@ -uuid: null +uuid: 07741598-6bb1-4bf3-8f05-4df391f11086 langcode: en status: true dependencies: diff --git a/config/monitoring.sensor_config.ocha_un_date.yml b/config/monitoring.sensor_config.ocha_un_date.yml index cde3f1dac..1c3840e66 100644 --- a/config/monitoring.sensor_config.ocha_un_date.yml +++ b/config/monitoring.sensor_config.ocha_un_date.yml @@ -1,4 +1,4 @@ -uuid: null +uuid: 1a435b3c-5728-4c3d-8bb0-e8f171adce54 langcode: en status: true dependencies: diff --git a/config/monitoring.sensor_config.update_contrib.yml b/config/monitoring.sensor_config.update_contrib.yml index f4040028e..6b5f27ae6 100644 --- a/config/monitoring.sensor_config.update_contrib.yml +++ b/config/monitoring.sensor_config.update_contrib.yml @@ -1,4 +1,4 @@ -uuid: null +uuid: e7dec8e2-6541-40f2-b3f4-0d3c0cb5da9b langcode: en status: true dependencies: diff --git a/config/monitoring.sensor_config.update_core.yml b/config/monitoring.sensor_config.update_core.yml index 9469a7cb2..a851278fa 100644 --- a/config/monitoring.sensor_config.update_core.yml +++ b/config/monitoring.sensor_config.update_core.yml @@ -1,4 +1,4 @@ -uuid: null +uuid: 6d4cb84c-6960-410f-80a9-fca29ba1bc9d langcode: en status: true dependencies: diff --git a/config/ocha_ai_chat.settings.yml b/config/ocha_ai_chat.settings.yml index 02a05712a..eb7c21dea 100644 --- a/config/ocha_ai_chat.settings.yml +++ b/config/ocha_ai_chat.settings.yml @@ -22,7 +22,7 @@ defaults: embedding: plugin_id: aws_bedrock_titan_embed_text_v2 ranker: - plugin_id: NULL + plugin_id: null limit: 5 source: plugin_id: reliefweb diff --git a/config/openid_connect.settings.yml b/config/openid_connect.settings.yml index 438b2aed6..d362cf6fe 100644 --- a/config/openid_connect.settings.yml +++ b/config/openid_connect.settings.yml @@ -4,8 +4,8 @@ override_registration_settings: false end_session_enabled: true user_login_display: below redirect_login: '' -redirect_logout: '/' +redirect_logout: / userinfo_mappings: timezone: zoneinfo user_picture: picture -role_mappings: { } +role_mappings: { } diff --git a/config/theme_switcher.rule.content_type.yml b/config/theme_switcher.rule.content_type.yml index 290c3bb0b..25acadcb1 100644 --- a/config/theme_switcher.rule.content_type.yml +++ b/config/theme_switcher.rule.content_type.yml @@ -9,6 +9,7 @@ label: 'Content type' weight: -8 theme: common_design_subtheme admin_theme: common_design_subtheme +conjunction: and visibility: 'entity_bundle:node': id: 'entity_bundle:node' diff --git a/config/theme_switcher.rule.request_path.yml b/config/theme_switcher.rule.request_path.yml index 9b23b4675..fd4fbf6fb 100644 --- a/config/theme_switcher.rule.request_path.yml +++ b/config/theme_switcher.rule.request_path.yml @@ -9,6 +9,7 @@ label: 'Request path' weight: -10 theme: common_design_subtheme admin_theme: common_design_subtheme +conjunction: and visibility: request_path: id: request_path diff --git a/config/theme_switcher.rule.vocabulary.yml b/config/theme_switcher.rule.vocabulary.yml index 470620059..f5d6b70a0 100644 --- a/config/theme_switcher.rule.vocabulary.yml +++ b/config/theme_switcher.rule.vocabulary.yml @@ -9,6 +9,7 @@ label: Vocabulary weight: -9 theme: common_design_subtheme admin_theme: common_design_subtheme +conjunction: and visibility: 'entity_bundle:taxonomy_term': id: 'entity_bundle:taxonomy_term' From 9eb1d4067f9d7e5e4ab596719bc1855d86844ca9 Mon Sep 17 00:00:00 2001 From: "Peter Droogmans (attiks)" Date: Thu, 19 Sep 2024 13:52:27 +0200 Subject: [PATCH 20/25] chore: Add missing training fields --- .../Commands/ReliefWebSemanticCommands.php | 34 ++++--------------- 1 file changed, 6 insertions(+), 28 deletions(-) diff --git a/html/modules/custom/reliefweb_semantic/src/Commands/ReliefWebSemanticCommands.php b/html/modules/custom/reliefweb_semantic/src/Commands/ReliefWebSemanticCommands.php index 83b0cc6ae..5f2d4bd6c 100644 --- a/html/modules/custom/reliefweb_semantic/src/Commands/ReliefWebSemanticCommands.php +++ b/html/modules/custom/reliefweb_semantic/src/Commands/ReliefWebSemanticCommands.php @@ -153,34 +153,12 @@ class ReliefWebSemanticCommands extends DrushCommands { 'field_city' => 'city', 'field_source' => 'source', 'field_theme' => 'theme', - ], - ], - 'blog_post' => [ - 'type' => 'node', - 'index' => 'rw-blog-posts-2', - 'bucket' => 'rw-kb-blog-posts', - 'field-list' => [ - 'nid' => 'id', - 'uuid' => 'uuid', - 'created' => 'created', - 'changed' => 'changed', - 'title' => 'title', - 'status' => 'status', - 'body' => 'body', - ], - ], - 'topic' => [ - 'type' => 'node', - 'index' => 'rw-topics', - 'bucket' => 'rw-kb-topics', - 'field-list' => [ - 'nid' => 'id', - 'uuid' => 'uuid', - 'created' => 'created', - 'changed' => 'changed', - 'title' => 'title', - 'status' => 'status', - 'body' => 'body', + 'field_training_type' => 'training_type', + 'field_cost' => 'cost', + 'field_training_language' => 'training_language', + 'field_fee_information' => 'fee_information', + 'field_career_categories' => 'career_categories', + 'field_training_format' => 'training_format', ], ], ]; From b826f66f0023b1eece4c381f71a3cb7653856797 Mon Sep 17 00:00:00 2001 From: "Peter Droogmans (attiks)" Date: Thu, 19 Sep 2024 13:56:49 +0200 Subject: [PATCH 21/25] Do not remove patches --- composer.lock | 6 +++--- composer.patches.json | 3 ++- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/composer.lock b/composer.lock index 5804776ae..c0d8ff9fc 100644 --- a/composer.lock +++ b/composer.lock @@ -4,7 +4,7 @@ "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies", "This file is @generated automatically" ], - "content-hash": "fa83edf0d251608ba959078e1ce18d02", + "content-hash": "ce442efcb68ed1c8c63a469cd7f7566a", "packages": [ { "name": "asm89/stack-cors", @@ -3761,7 +3761,7 @@ "homepage": "https://www.drupal.org/user/213194" }, { - "name": "TR", + "name": "tr", "homepage": "https://www.drupal.org/user/202830" }, { @@ -4207,7 +4207,7 @@ ], "authors": [ { - "name": "Cellar Door", + "name": "cellar door", "homepage": "https://www.drupal.org/user/658076" }, { diff --git a/composer.patches.json b/composer.patches.json index 021cd7086..58ff98e70 100644 --- a/composer.patches.json +++ b/composer.patches.json @@ -6,7 +6,8 @@ "drupal/core" : { "https://www.drupal.org/project/drupal/issues/3008292": "PATCHES/core--drupal--3008292-image-upload-validators.patch", "https://www.drupal.org/project/drupal/issues/3143617": "PATCHES/core--drupal--3143617-pager-parameter.patch", - "https://www.drupal.org/project/drupal/issues/3418098": "PATCHES/core--drupal--3418098-php-mailer.patch" + "https://www.drupal.org/project/drupal/issues/3418098": "PATCHES/core--drupal--3418098-php-mailer.patch", + "https://www.drupal.org/project/drupal/issues/3467860": "PATCHES/core--drupal--3467860-aggregation.patch" }, "drupal/guidelines": { "Drupal 10 compatibility": "PATCHES/guidelines-drupal-10-compatibility.patch" From e9890452b1e0745bde2191ca51b5b965381660fe Mon Sep 17 00:00:00 2001 From: orakili Date: Fri, 20 Sep 2024 00:51:57 +0000 Subject: [PATCH 22/25] chore: add simple script to get historical data about job retagging Refs: RW-1078 --- scripts/job-tagging/RW-1078.php | 168 ++++++++++++++++++++++++++++++++ 1 file changed, 168 insertions(+) create mode 100644 scripts/job-tagging/RW-1078.php diff --git a/scripts/job-tagging/RW-1078.php b/scripts/job-tagging/RW-1078.php new file mode 100644 index 000000000..54c8fbf82 --- /dev/null +++ b/scripts/job-tagging/RW-1078.php @@ -0,0 +1,168 @@ +query(" + SELECT + nr.nid AS nid, + nr.vid AS vid, + n.created AS created, + IFNULL(GROUP_CONCAT(DISTINCT ur.roles_target_id ORDER BY ur.roles_target_id SEPARATOR :separator), :empty_string) AS roles, + GROUP_CONCAT(DISTINCT nfcc.field_career_categories_target_id ORDER BY nfcc.field_career_categories_target_id SEPARATOR :separator) AS career_categories, + GROUP_CONCAT(DISTINCT nft.field_theme_target_id ORDER BY nft.field_theme_target_id SEPARATOR :separator) AS themes, + SUM(IF(njts.reliefweb_job_tagger_status_value IS NOT NULL OR njts.reliefweb_job_tagger_status_value = :empty_string, 1, 0)) AS ai_tagged + FROM node_revision AS nr + INNER JOIN node_field_data AS n + ON n.nid = nr.nid + LEFT JOIN user__roles AS urn + ON urn.entity_id = n.uid + LEFT JOIN node_revision__reliefweb_job_tagger_status AS njts + ON njts.entity_id = n.nid + AND njts.revision_id = nr.vid + AND njts.reliefweb_job_tagger_status_value = :job_tagger_status + LEFT JOIN user__roles AS ur + ON ur.entity_id = nr.revision_uid + LEFT JOIN node_revision__field_career_categories AS nfcc + ON nfcc.entity_id = nr.nid + AND nfcc.revision_id = nr.vid + LEFT JOIN node_revision__field_theme AS nft + ON nft.entity_id = nr.nid + AND nft.revision_id = nr.vid + WHERE n.type = :type + AND FROM_UNIXTIME(n.created) BETWEEN :date_start AND :date_end + AND urn.roles_target_id IS NULL + GROUP BY nr.vid + ORDER BY nr.vid +", [ + ":type" => "job", + ":separator" => ",", + ":empty_string" => "", + ":job_tagger_status" => "processed", + ":date_start" => $date_start, + ":date_end" => $date_end, +])->fetchAll(\PDO::FETCH_ASSOC); + +if (empty($records)) { + return $data; +} + +$jobs = []; +$changed_career_categories = []; +$changed_themes = []; +$jobs_tagged_by_ai = []; + +// Group the records into the categories we want to report. +foreach ($records as $record) { + $nid = $record["nid"]; + + if (!empty($record["ai_tagged"])) { + $jobs_tagged_by_ai[$nid] = TRUE; + } + + if (isset($jobs[$nid])) { + $previous = $jobs[$nid]; + + if (strpos($record["roles"], "editor") !== FALSE) { + if ($record["career_categories"] !== $previous["career_categories"]) { + $changed_career_categories[$nid] = TRUE; + } + if ($record["themes"] !== $previous["themes"]) { + $changed_themes[$nid] = TRUE; + } + } + } + + $jobs[$nid] = $record; +} + +$jobs_changed_by_editors = []; +$jobs_tagged_by_ai_changed_by_editors = []; +$jobs_tagged_by_ai_career_category_changed_by_editors = []; +$jobs_tagged_by_ai_theme_changed_by_editors = []; + +foreach ($changed_career_categories as $nid => $changed) { + $jobs_changed_by_editors[$nid] = $changed; + + if (isset($jobs_tagged_by_ai[$nid])) { + $jobs_tagged_by_ai_changed_by_editors[$nid] = $changed; + $jobs_tagged_by_ai_career_category_changed_by_editors[$nid] = $changed; + } +} + +foreach ($changed_themes as $nid => $changed) { + $jobs_changed_by_editors[$nid] = $changed; + + if (isset($jobs_tagged_by_ai[$nid])) { + $jobs_tagged_by_ai_changed_by_editors[$nid] = $changed; + $jobs_tagged_by_ai_theme_changed_by_editors[$nid] = $changed; + } +} + +$ordered_jobs = []; +foreach ($jobs as $nid => $record) { + $ordered_jobs[$nid] = $record["created"]; +} +asort($ordered_jobs); + +$timezone = new DateTimeZone("UTC"); + + $data = []; + foreach ($ordered_jobs as $nid => $timestamp) { + $date = new DateTime("@" . $timestamp); + // Move to the coming Sunday if not already a Sunday. + if ($date->format("w") != 0) { + $date->modify("next Sunday"); + } + $key = $date->format("Y-m-d"); + + if (!isset($data[$key])) { + $data[$key] = [ + "date" => $key, + "jobs_created" => 0, + "jobs_changed_by_editors" => 0, + "jobs_career_category_changed_by_editors" => 0, + "jobs_career_theme_by_editors" => 0, + "jobs_tagged_by_ai" => 0, + "jobs_tagged_by_ai_changed_by_editors" => 0, + "jobs_tagged_by_ai_career_category_changed_by_editors" => 0, + "jobs_tagged_by_ai_theme_changed_by_editors" => 0, + ]; + } + + $data[$key]["jobs_created"] += 1; + $data[$key]["jobs_changed_by_editors"] += isset($jobs_changed_by_editors[$nid]) ? 1 : 0; + $data[$key]["jobs_career_category_changed_by_editors"] += isset($changed_career_categories[$nid]) ? 1 : 0; + $data[$key]["jobs_career_theme_by_editors"] += isset($changed_themes[$nid]) ? 1 : 0; + $data[$key]["jobs_tagged_by_ai"] += isset($jobs_tagged_by_ai[$nid]) ? 1 : 0; + $data[$key]["jobs_tagged_by_ai_changed_by_editors"] += isset($jobs_tagged_by_ai_changed_by_editors[$nid]) ? 1 : 0; + $data[$key]["jobs_tagged_by_ai_career_category_changed_by_editors"] += isset($jobs_tagged_by_ai_career_category_changed_by_editors[$nid]) ? 1 : 0; + $data[$key]["jobs_tagged_by_ai_theme_changed_by_editors"] += isset($jobs_tagged_by_ai_theme_changed_by_editors[$nid]) ? 1 : 0; + } + +$headers = [ + "date", + "jobs_created", + "jobs_changed_by_editors", + "jobs_career_category_changed_by_editors", + "jobs_career_theme_by_editors", + "jobs_tagged_by_ai", + "jobs_tagged_by_ai_changed_by_editors", + "jobs_tagged_by_ai_career_category_changed_by_editors", + "jobs_tagged_by_ai_theme_changed_by_editors", +]; + +$output = fopen("php://output", "w"); + +if ($output !== FALSE) { + fputcsv($output, $headers); + foreach ($data as $row) { + fputcsv($output, $row); + } + fclose($output); +} From 3915baea0b8f9ce614f3e5ab198c9da3219536fe Mon Sep 17 00:00:00 2001 From: orakili Date: Fri, 20 Sep 2024 00:55:05 +0000 Subject: [PATCH 23/25] chore: allow authenticated users to access to AI chat Refs: RW-1041 --- config/user.role.authenticated.yml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/config/user.role.authenticated.yml b/config/user.role.authenticated.yml index 0ac05b79c..7556166b6 100644 --- a/config/user.role.authenticated.yml +++ b/config/user.role.authenticated.yml @@ -13,6 +13,7 @@ dependencies: - filter - media - node + - ocha_ai_chat - reliefweb_bookmarks - reliefweb_form - reliefweb_job_tagger @@ -28,6 +29,7 @@ weight: 1 is_admin: false permissions: - 'access content' + - 'access ocha ai chat' - 'bookmark content' - 'clone content entities' - 'create job content' From 52d41e2e99637d21d81feece0630d68f9d2f1ae6 Mon Sep 17 00:00:00 2001 From: orakili Date: Fri, 20 Sep 2024 06:30:18 +0000 Subject: [PATCH 24/25] chore: hide interactive content format Refs: RW-1077 --- .../reliefweb_entities/src/Services/ReportFormAlter.php | 8 ++++++++ .../custom/reliefweb_rivers/src/Services/ReportRiver.php | 4 ++++ 2 files changed, 12 insertions(+) diff --git a/html/modules/custom/reliefweb_entities/src/Services/ReportFormAlter.php b/html/modules/custom/reliefweb_entities/src/Services/ReportFormAlter.php index be44f632c..ee73f401e 100644 --- a/html/modules/custom/reliefweb_entities/src/Services/ReportFormAlter.php +++ b/html/modules/custom/reliefweb_entities/src/Services/ReportFormAlter.php @@ -6,6 +6,7 @@ use Drupal\Core\Datetime\DrupalDateTime; use Drupal\Core\Form\FormStateInterface; use Drupal\Core\Url; +use Drupal\reliefweb_entities\Entity\Report; use Drupal\reliefweb_entities\EntityFormAlterServiceBase; use Drupal\reliefweb_form\Helpers\FormHelper; use Drupal\reliefweb_utility\Helpers\UrlHelper; @@ -74,6 +75,13 @@ protected function addBundleFormAlterations(array &$form, FormStateInterface $fo // Remove data (9420) option for content format field (Collab #3679). FormHelper::removeOptions($form, 'field_content_format', [9420]); + // Remove interactive (38974) format if the report is not tagged with it. + // @see https://humanitarian.atlassian.net/browse/RW-1077 + $report = $form_state?->getFormObject()?->getEntity(); + if ($report instanceof Report && $report?->field_content_format?->target_id != 38974) { + FormHelper::removeOptions($form, 'field_content_format', [38974]); + } + // Remove Key document (2) option for feature field. FormHelper::removeOptions($form, 'field_feature', [2]); diff --git a/html/modules/custom/reliefweb_rivers/src/Services/ReportRiver.php b/html/modules/custom/reliefweb_rivers/src/Services/ReportRiver.php index 526e843bd..0ec9b80da 100644 --- a/html/modules/custom/reliefweb_rivers/src/Services/ReportRiver.php +++ b/html/modules/custom/reliefweb_rivers/src/Services/ReportRiver.php @@ -173,6 +173,10 @@ public function getFilters() { 'name' => $this->t('Content format'), 'type' => 'reference', 'vocabulary' => 'content_format', + 'exclude' => [ + // Interactive (RW-1077). + 38974, + ], 'field' => 'format.id', 'widget' => [ 'type' => 'options', From 62ec71ed2d9b6efb3ee62620137005629973e195 Mon Sep 17 00:00:00 2001 From: orakili Date: Fri, 20 Sep 2024 06:30:48 +0000 Subject: [PATCH 25/25] chore: add script to archive interactive content Refs: RW-1077 --- scripts/retagging/RW-1077.php | 52 +++++++++++++++++++++++++++++++++++ 1 file changed, 52 insertions(+) create mode 100644 scripts/retagging/RW-1077.php diff --git a/scripts/retagging/RW-1077.php b/scripts/retagging/RW-1077.php new file mode 100644 index 000000000..faf6ce6a2 --- /dev/null +++ b/scripts/retagging/RW-1077.php @@ -0,0 +1,52 @@ +query(" + SELECT DISTINCT n.nid + FROM {node_field_data} AS n + INNER JOIN {node__field_content_format} AS fcf + ON fcf.entity_id = n.nid + WHERE n.type = :bundle + AND fcf.field_content_format_target_id = :content_format + ORDER BY nid ASC +", [ + ":bundle" => "report", + ":content_format" => $content_format, +])->fetchCol(); + +$total = count($nids); + +echo "Found " . $total . " nodes to update" . PHP_EOL; + +if (!empty($proceed)) { + $storage = \Drupal::entityTypeManager()->getStorage("node"); + $chunk_size = 100; + $now = time(); + $progress = 1; + + foreach (array_chunk($nids, $chunk_size) as $chunk) { + foreach ($storage->loadMultiple($chunk) as $node) { + $node->setModerationStatus('archive'); + $node->notifications_content_disable = TRUE; + $node->setRevisionLogMessage("Automatic archiving of interactive content (Ref: RW-1077)."); + $node->setRevisionUserId(2); + $node->setRevisionCreationTime($now); + $node->setNewRevision(TRUE); + if ($save) { + $node->save(); + } + + echo "Progress: $progress / $total..." . PHP_EOL; + $progress++; + } + } +}