diff --git a/CODEOWNERS b/CODEOWNERS index 5617f690..94c5e1b7 100644 --- a/CODEOWNERS +++ b/CODEOWNERS @@ -40,4 +40,5 @@ /tools/proxy-endpoint-unifier @anaik91 /tools/sf-dependency-list @yuriylesyuk /tools/target-server-validator @anaik91 -tools/apigee-proxy-modifier-validator @anaik91 \ No newline at end of file +/tools/apigee-proxy-modifier-validator @anaik91 +/tools/apigee-edge-to-x-migration-tool @h-kopalle \ No newline at end of file diff --git a/README.md b/README.md index 154d71bf..dc88363b 100644 --- a/README.md +++ b/README.md @@ -113,6 +113,8 @@ Apigee products. Generate gateways to expose gRPC services with HTTP API management. - [Apigee Proxy Bundle Modifier & Validator](tools/apigee-proxy-modifier-validator) - A tool to do batch modifications of API proxies when migrating to newer Apigee variants. +- [Apigee Edge to X Migration Accelerator](/tools/apigee-edge-to-x-migration-tool) - A tool built on node.js to accelerate Apigee Edge to X migration. + ## Labs This folder contains raw assets used to generate content to teach a particular diff --git a/tools/apigee-edge-to-x-migration-tool/.gitignore b/tools/apigee-edge-to-x-migration-tool/.gitignore new file mode 100644 index 00000000..aa8c61cf --- /dev/null +++ b/tools/apigee-edge-to-x-migration-tool/.gitignore @@ -0,0 +1,5 @@ +.DS_Store +.env +.vscode +node_modules +data \ No newline at end of file diff --git a/tools/apigee-edge-to-x-migration-tool/README.md b/tools/apigee-edge-to-x-migration-tool/README.md new file mode 100644 index 00000000..febb8a6a --- /dev/null +++ b/tools/apigee-edge-to-x-migration-tool/README.md @@ -0,0 +1,204 @@ +# Apigee Edge to X Migration Tool + +## Introduction +The **Apigee Edge to X Migration Tool** is designed to facilitate the seamless transition of entities from Apigee Edge to the new Apigee X platform. This tool streamlines the migration process, ensuring minimal disruption and optimal performance during the transition. + +## Features +- **Automated Migration:** Effortlessly migrate your entities from Edge to X. +- **Custom Module Support:** Extend functionality by adding custom modules. +- **User-Friendly Interface:** Navigate through the migration tool with an intuitive prompts menu. +- **Comprehensive Logging:** Track the migration process with detailed logs for troubleshooting and analysis. + +## Prerequisites +- **Node.js:** Ensure Node.js is installed on your system. +- **Git:** Required for cloning repositories and managing version control. +- **Access:** + - Edge credentials with atleast Read-Only privileges + - Apigee X Service Account Key + +## Setup Instructions + +1. **Clone the Repository** + - Clone the `apigee/devrel` repository to your local machine: + ```bash + git clone + ``` + +2. **Checkout the Relevant Branch** + - For the release version, checkout the `main` branch: + ```bash + git checkout main + ``` + +3. **Custom Modules** + - Custom Modules built in-line to the framework can be used to extend the features. + - If there are any custom modules, add the code base under `src/modules`. + +4. **Environment Setup** + - `.env` file is required with below information + ```bash + # Configure the source gateway type: + # - apigee_edge + # - apigee_x + source_gateway_type="apigee_edge" + + # Configure the base URL for the source gateway's management APIs + source_gateway_base_url="https://api.enterprise.apigee.com/v1/organizations/" + + # When source gateway is Apigee, configure the name of the Apigee org + source_gateway_org="" + + # When source gateway is Apigee X, configure the service account + # used to connect to management APIs. Base64 encode the service account JSON. + # Ignore if source_gateway_type="apigee_edge" + source_gateway_service_account = "" + + # Configure the destination gateway type: + # - apigee_edge + # - apigee_x + destination_gateway_type="apigee_x" + + # Configure the base URL for the destination gateway's management APIs + destination_gateway_base_url="https://apigee.googleapis.com/v1/organizations/" + + # When destination gateway is Apigee, configure the name of the Apigee org + destination_gateway_org="" + + # When destination gateway is Apigee X, configure the service account + # used to connect to management APIs. Base64 encode the service account JSON. + destination_gateway_service_account = "" + + # When source and destination gateways are both Apigee, configure the mapping + # between source gateway environment names to destination gateway environment names. + apigee_environment_map='{"edge-env":"x-env"}' + + # Configure whether to auto-npm-install plugins placed in the ~/src/modules folder + install_modules = 1 + ``` + - Load Apigee Edge credentials into environment variables + ```bash + export source_gateway_username="" + export source_gateway_password="" + ``` + - For building the value for `destination_gateway_service_account`, you need to build a JSON file in below structure and must base64encode. Copy the final result as value for `destination_gateway_service_account` + ```json + {"instance_type":"hybrid","organization":"","account_json_key":} + ``` + + ```bash + base64 <<< 'above_json_value' + ``` + + +## Execution Instructions + +1. **Open Terminal** + - Open the terminal or command line interface in the `apigee-edge-to-x-migration-tool` directory. + +2. **Launch the Tool** + - The tool features a setup helper `tool-setup.sh`. Provide execute permissions to the file. + ```bash + chmod +x tool-setup.sh + ``` + - Use the same for the initial set up and auto launch + ```bash + ./tool-setup.sh + ``` + +3. **Run the Program** + - After the initial launch, tool presents the Menu options. + - Whenever you need to launch the tool without the setup helper, in your terminal use the command + ```bash + apigee-migration-tool + ``` +4. **Selecting from Menu** + - Navigate through the program using the arrow keys. + - Follow the instructions in the menu, user helper text for understanding the option. + - Press `` to proceed with your selection. + - At any time, use `Back` menu option to return to previous menu. + - At any time, use `Exit` menu option to exit the tool. + - Primary Action in tool. + ```bash + apigee-migration-tool + ? Choose a tool (Use arrow keys) + ❯ Apigee Edge to X + ``` + - Features available in the tool + ```bash + apigee-e2x + ✔ Choose a tool Apigee Edge to X + ? Action (Use arrow keys) + ❯ Migrate + View Logs + ``` + +## Migrate + - Menu option to be selected for migrating entities from Apigee Edge to X. +### Supported Apigee Entities +The tool currently features options to migrate + - API Proxies (All revisions included) + - Shared Flows (All revisions included) + - API Products + - Developers + - Developer Apps + - Key Value Maps (Encrypted KVMs excluded) + - Resource Files (Enviroment Level Only) + +### Execution Model: + - Once a supported Entity is selected for migration, the tool presents you the options to select an execution model. + - Recommendation is to select one appropriate to the migration stage. + 1. **Migrate** + + - Description: + - `Migrates entities` only if they do not already exist in the `target environment`. + - Use When: + - You're running the migration for the first time or want to avoid overwriting `any existing resources`. + - Effect: + - `Skips already existing entities` and `logs them as duplicates` in the `migration summary`. + + 2. **Synchronize** + + - Description: + - Compares existing entities between `Apigee Edge (source) and Apigee X (target)`. Only entities with differences are updated. + - Use When: + - You want to sync environments safely, ensuring only updated content is migrated. + - Effect: + - Identical entities are skipped, and only changed ones are updated. No unnecessary overwrites. + - For any conflicting values , data in `Apigee X (target)` is considered as final value. + - Only net new values from `Apigee Edge (source)` will be synchronized. + + 3. **Overwrite** + + - Description: + - `Deletes and fully replaces` existing entities in the target environment with those from the source. + - Use When: + - You want to fully `refresh or replace` outdated entities in the target system. + - Effect: + - Only when entity name matches on both source and target + - Matched entities in `Apigee X (target)` are `deleted and re-created/migrated` from the source. This is a `destructive operation`, so use with caution. + +## View Logs + + - Menu Option to View Status, Summary, Delta Information and Logs. + - Menu Option, `All Entities` collects information of supported Entities. + - All the logs are printed to console only. Adjust the console for a better visibility. + - Any additonal lookup can be done using the data available. + + 1. **Stats** + + - Select to view migration status of one/all entities. + - In the sub-menu, select to view by status of migration + + 2. **Summary** + + - Select to view migration summary of one/all entities. + + 3. **Delta** + + - Select to view the delta information identified by comparing source and target entity + + 4. **Logs** + + - Select to view transaction logs. + - Paginated by 200 records at a time, multiple tables of logs will be provided + diff --git a/tools/apigee-edge-to-x-migration-tool/index.js b/tools/apigee-edge-to-x-migration-tool/index.js new file mode 100755 index 00000000..63437dc5 --- /dev/null +++ b/tools/apigee-edge-to-x-migration-tool/index.js @@ -0,0 +1,47 @@ +#!/usr/bin/env node +/** + * Copyright 2025 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + + +import { select } from '@inquirer/prompts'; +import getSupportedModules from './src/modules/index.js'; + +const modules = await getSupportedModules(); + +if (modules.length == 0) { + console.log('No tools are available for migrating between your configured source and destination gateway types.'); + process.exit(); +} + +const moduleId = await select({ + message: 'Choose a tool', + choices: modules.map((module, idx) => ({ + name: module.name, + value: idx + })) +}); + +const actions = modules[moduleId].actions(); + +const actionId = await select({ + message: 'Action', + choices: actions.map((action, idx) => ({ + name: action.name, + value: idx + })) +}); + +await actions[actionId].execute(); diff --git a/tools/apigee-edge-to-x-migration-tool/install-modules.js b/tools/apigee-edge-to-x-migration-tool/install-modules.js new file mode 100644 index 00000000..2641d0b7 --- /dev/null +++ b/tools/apigee-edge-to-x-migration-tool/install-modules.js @@ -0,0 +1,40 @@ +/** + * Copyright 2025 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +import path from 'path' +import fs from 'fs' +import child_process from 'child_process' +import dotenv from 'dotenv'; + +dotenv.config(); + +if ((process.env.install_modules ?? null) !== "1") { + process.exit(); +} + +const modulesPath = `${process.cwd()}/src/modules`; + +for (let moduleName of fs.readdirSync(modulesPath)) { + const modulePath = path.join(modulesPath, moduleName); + const packageJsonPath = path.join(modulePath, 'package.json'); + + if (!fs.statSync(modulePath).isDirectory() || !fs.existsSync(packageJsonPath)) { + continue; + } + + console.log(`Installing module ${moduleName}`); + child_process.execSync('npm install', { cwd: modulePath, env: process.env, stdio: 'inherit' }) +} diff --git a/tools/apigee-edge-to-x-migration-tool/package-lock.json b/tools/apigee-edge-to-x-migration-tool/package-lock.json new file mode 100644 index 00000000..3f957bcd --- /dev/null +++ b/tools/apigee-edge-to-x-migration-tool/package-lock.json @@ -0,0 +1,5081 @@ +{ + "name": "apigee-migration", + "version": "0.5.0", + "lockfileVersion": 3, + "requires": true, + "packages": { + "": { + "name": "apigee-migration", + "version": "0.5.0", + "hasInstallScript": true, + "license": "Apache-2.0", + "dependencies": { + "@inquirer/prompts": "^7.8.6", + "@inquirer/select": "^4.0.9", + "adm-zip": "^0.5.16", + "bottleneck": "^2.19.5", + "cli-table3": "^0.6.5", + "diff": "^8.0.0-beta", + "dotenv": "^16.4.7", + "inquirer": "^12.4.2", + "libsql": "^0.5.0-pre.6", + "node-fetch": "^2.7.0", + "papaparse": "^5.5.2", + "path": "^0.12.7", + "temp": "^0.9.4", + "url": "^0.11.4", + "wrap-ansi": "^9.0.0", + "xlsx": "^0.18.5", + "xlsx-js-style": "^1.2.0", + "xml-js": "^1.6.11", + "xml2js": "^0.6.2", + "xslx": "^1.0.0" + }, + "bin": { + "apigee-e2x": "index.js" + }, + "devDependencies": { + "jest": "^29.7.0" + } + }, + "../apigee-migration-assessment": { + "version": "1.0.0", + "extraneous": true + }, + "node_modules/@ampproject/remapping": { + "version": "2.3.0", + "resolved": "https://registry.npmjs.org/@ampproject/remapping/-/remapping-2.3.0.tgz", + "integrity": "sha512-30iZtAPgz+LTIYoeivqYo853f02jBYSd5uGnGpkFV0M3xOt9aN73erkgYAmZU43x4VfqcnLxW9Kpg3R5LC4YYw==", + "dev": true, + "license": "Apache-2.0", + "dependencies": { + "@jridgewell/gen-mapping": "^0.3.5", + "@jridgewell/trace-mapping": "^0.3.24" + }, + "engines": { + "node": ">=6.0.0" + } + }, + "node_modules/@babel/code-frame": { + "version": "7.26.2", + "resolved": "https://registry.npmjs.org/@babel/code-frame/-/code-frame-7.26.2.tgz", + "integrity": "sha512-RJlIHRueQgwWitWgF8OdFYGZX328Ax5BCemNGlqHfplnRT9ESi8JkFlvaVYbS+UubVY6dpv87Fs2u5M29iNFVQ==", + "dev": true, + "license": "MIT", + "dependencies": { + "@babel/helper-validator-identifier": "^7.25.9", + "js-tokens": "^4.0.0", + "picocolors": "^1.0.0" + }, + "engines": { + "node": ">=6.9.0" + } + }, + "node_modules/@babel/compat-data": { + "version": "7.26.8", + "resolved": "https://registry.npmjs.org/@babel/compat-data/-/compat-data-7.26.8.tgz", + "integrity": "sha512-oH5UPLMWR3L2wEFLnFJ1TZXqHufiTKAiLfqw5zkhS4dKXLJ10yVztfil/twG8EDTA4F/tvVNw9nOl4ZMslB8rQ==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=6.9.0" + } + }, + "node_modules/@babel/core": { + "version": "7.26.10", + "resolved": "https://registry.npmjs.org/@babel/core/-/core-7.26.10.tgz", + "integrity": "sha512-vMqyb7XCDMPvJFFOaT9kxtiRh42GwlZEg1/uIgtZshS5a/8OaduUfCi7kynKgc3Tw/6Uo2D+db9qBttghhmxwQ==", + "dev": true, + "license": "MIT", + "dependencies": { + "@ampproject/remapping": "^2.2.0", + "@babel/code-frame": "^7.26.2", + "@babel/generator": "^7.26.10", + "@babel/helper-compilation-targets": "^7.26.5", + "@babel/helper-module-transforms": "^7.26.0", + "@babel/helpers": "^7.26.10", + "@babel/parser": "^7.26.10", + "@babel/template": "^7.26.9", + "@babel/traverse": "^7.26.10", + "@babel/types": "^7.26.10", + "convert-source-map": "^2.0.0", + "debug": "^4.1.0", + "gensync": "^1.0.0-beta.2", + "json5": "^2.2.3", + "semver": "^6.3.1" + }, + "engines": { + "node": ">=6.9.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/babel" + } + }, + "node_modules/@babel/generator": { + "version": "7.27.0", + "resolved": "https://registry.npmjs.org/@babel/generator/-/generator-7.27.0.tgz", + "integrity": "sha512-VybsKvpiN1gU1sdMZIp7FcqphVVKEwcuj02x73uvcHE0PTihx1nlBcowYWhDwjpoAXRv43+gDzyggGnn1XZhVw==", + "dev": true, + "license": "MIT", + "dependencies": { + "@babel/parser": "^7.27.0", + "@babel/types": "^7.27.0", + "@jridgewell/gen-mapping": "^0.3.5", + "@jridgewell/trace-mapping": "^0.3.25", + "jsesc": "^3.0.2" + }, + "engines": { + "node": ">=6.9.0" + } + }, + "node_modules/@babel/helper-compilation-targets": { + "version": "7.27.0", + "resolved": "https://registry.npmjs.org/@babel/helper-compilation-targets/-/helper-compilation-targets-7.27.0.tgz", + "integrity": "sha512-LVk7fbXml0H2xH34dFzKQ7TDZ2G4/rVTOrq9V+icbbadjbVxxeFeDsNHv2SrZeWoA+6ZiTyWYWtScEIW07EAcA==", + "dev": true, + "license": "MIT", + "dependencies": { + "@babel/compat-data": "^7.26.8", + "@babel/helper-validator-option": "^7.25.9", + "browserslist": "^4.24.0", + "lru-cache": "^5.1.1", + "semver": "^6.3.1" + }, + "engines": { + "node": ">=6.9.0" + } + }, + "node_modules/@babel/helper-module-imports": { + "version": "7.25.9", + "resolved": "https://registry.npmjs.org/@babel/helper-module-imports/-/helper-module-imports-7.25.9.tgz", + "integrity": "sha512-tnUA4RsrmflIM6W6RFTLFSXITtl0wKjgpnLgXyowocVPrbYrLUXSBXDgTs8BlbmIzIdlBySRQjINYs2BAkiLtw==", + "dev": true, + "license": "MIT", + "dependencies": { + "@babel/traverse": "^7.25.9", + "@babel/types": "^7.25.9" + }, + "engines": { + "node": ">=6.9.0" + } + }, + "node_modules/@babel/helper-module-transforms": { + "version": "7.26.0", + "resolved": "https://registry.npmjs.org/@babel/helper-module-transforms/-/helper-module-transforms-7.26.0.tgz", + "integrity": "sha512-xO+xu6B5K2czEnQye6BHA7DolFFmS3LB7stHZFaOLb1pAwO1HWLS8fXA+eh0A2yIvltPVmx3eNNDBJA2SLHXFw==", + "dev": true, + "license": "MIT", + "dependencies": { + "@babel/helper-module-imports": "^7.25.9", + "@babel/helper-validator-identifier": "^7.25.9", + "@babel/traverse": "^7.25.9" + }, + "engines": { + "node": ">=6.9.0" + }, + "peerDependencies": { + "@babel/core": "^7.0.0" + } + }, + "node_modules/@babel/helper-plugin-utils": { + "version": "7.26.5", + "resolved": "https://registry.npmjs.org/@babel/helper-plugin-utils/-/helper-plugin-utils-7.26.5.tgz", + "integrity": "sha512-RS+jZcRdZdRFzMyr+wcsaqOmld1/EqTghfaBGQQd/WnRdzdlvSZ//kF7U8VQTxf1ynZ4cjUcYgjVGx13ewNPMg==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=6.9.0" + } + }, + "node_modules/@babel/helper-string-parser": { + "version": "7.25.9", + "resolved": "https://registry.npmjs.org/@babel/helper-string-parser/-/helper-string-parser-7.25.9.tgz", + "integrity": "sha512-4A/SCr/2KLd5jrtOMFzaKjVtAei3+2r/NChoBNoZ3EyP/+GlhoaEGoWOZUmFmoITP7zOJyHIMm+DYRd8o3PvHA==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=6.9.0" + } + }, + "node_modules/@babel/helper-validator-identifier": { + "version": "7.25.9", + "resolved": "https://registry.npmjs.org/@babel/helper-validator-identifier/-/helper-validator-identifier-7.25.9.tgz", + "integrity": "sha512-Ed61U6XJc3CVRfkERJWDz4dJwKe7iLmmJsbOGu9wSloNSFttHV0I8g6UAgb7qnK5ly5bGLPd4oXZlxCdANBOWQ==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=6.9.0" + } + }, + "node_modules/@babel/helper-validator-option": { + "version": "7.25.9", + "resolved": "https://registry.npmjs.org/@babel/helper-validator-option/-/helper-validator-option-7.25.9.tgz", + "integrity": "sha512-e/zv1co8pp55dNdEcCynfj9X7nyUKUXoUEwfXqaZt0omVOmDe9oOTdKStH4GmAw6zxMFs50ZayuMfHDKlO7Tfw==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=6.9.0" + } + }, + "node_modules/@babel/helpers": { + "version": "7.27.0", + "resolved": "https://registry.npmjs.org/@babel/helpers/-/helpers-7.27.0.tgz", + "integrity": "sha512-U5eyP/CTFPuNE3qk+WZMxFkp/4zUzdceQlfzf7DdGdhp+Fezd7HD+i8Y24ZuTMKX3wQBld449jijbGq6OdGNQg==", + "dev": true, + "license": "MIT", + "dependencies": { + "@babel/template": "^7.27.0", + "@babel/types": "^7.27.0" + }, + "engines": { + "node": ">=6.9.0" + } + }, + "node_modules/@babel/parser": { + "version": "7.27.0", + "resolved": "https://registry.npmjs.org/@babel/parser/-/parser-7.27.0.tgz", + "integrity": "sha512-iaepho73/2Pz7w2eMS0Q5f83+0RKI7i4xmiYeBmDzfRVbQtTOG7Ts0S4HzJVsTMGI9keU8rNfuZr8DKfSt7Yyg==", + "dev": true, + "license": "MIT", + "dependencies": { + "@babel/types": "^7.27.0" + }, + "bin": { + "parser": "bin/babel-parser.js" + }, + "engines": { + "node": ">=6.0.0" + } + }, + "node_modules/@babel/plugin-syntax-async-generators": { + "version": "7.8.4", + "resolved": "https://registry.npmjs.org/@babel/plugin-syntax-async-generators/-/plugin-syntax-async-generators-7.8.4.tgz", + "integrity": "sha512-tycmZxkGfZaxhMRbXlPXuVFpdWlXpir2W4AMhSJgRKzk/eDlIXOhb2LHWoLpDF7TEHylV5zNhykX6KAgHJmTNw==", + "dev": true, + "license": "MIT", + "dependencies": { + "@babel/helper-plugin-utils": "^7.8.0" + }, + "peerDependencies": { + "@babel/core": "^7.0.0-0" + } + }, + "node_modules/@babel/plugin-syntax-bigint": { + "version": "7.8.3", + "resolved": "https://registry.npmjs.org/@babel/plugin-syntax-bigint/-/plugin-syntax-bigint-7.8.3.tgz", + "integrity": "sha512-wnTnFlG+YxQm3vDxpGE57Pj0srRU4sHE/mDkt1qv2YJJSeUAec2ma4WLUnUPeKjyrfntVwe/N6dCXpU+zL3Npg==", + "dev": true, + "license": "MIT", + "dependencies": { + "@babel/helper-plugin-utils": "^7.8.0" + }, + "peerDependencies": { + "@babel/core": "^7.0.0-0" + } + }, + "node_modules/@babel/plugin-syntax-class-properties": { + "version": "7.12.13", + "resolved": "https://registry.npmjs.org/@babel/plugin-syntax-class-properties/-/plugin-syntax-class-properties-7.12.13.tgz", + "integrity": "sha512-fm4idjKla0YahUNgFNLCB0qySdsoPiZP3iQE3rky0mBUtMZ23yDJ9SJdg6dXTSDnulOVqiF3Hgr9nbXvXTQZYA==", + "dev": true, + "license": "MIT", + "dependencies": { + "@babel/helper-plugin-utils": "^7.12.13" + }, + "peerDependencies": { + "@babel/core": "^7.0.0-0" + } + }, + "node_modules/@babel/plugin-syntax-class-static-block": { + "version": "7.14.5", + "resolved": "https://registry.npmjs.org/@babel/plugin-syntax-class-static-block/-/plugin-syntax-class-static-block-7.14.5.tgz", + "integrity": "sha512-b+YyPmr6ldyNnM6sqYeMWE+bgJcJpO6yS4QD7ymxgH34GBPNDM/THBh8iunyvKIZztiwLH4CJZ0RxTk9emgpjw==", + "dev": true, + "license": "MIT", + "dependencies": { + "@babel/helper-plugin-utils": "^7.14.5" + }, + "engines": { + "node": ">=6.9.0" + }, + "peerDependencies": { + "@babel/core": "^7.0.0-0" + } + }, + "node_modules/@babel/plugin-syntax-import-attributes": { + "version": "7.26.0", + "resolved": "https://registry.npmjs.org/@babel/plugin-syntax-import-attributes/-/plugin-syntax-import-attributes-7.26.0.tgz", + "integrity": "sha512-e2dttdsJ1ZTpi3B9UYGLw41hifAubg19AtCu/2I/F1QNVclOBr1dYpTdmdyZ84Xiz43BS/tCUkMAZNLv12Pi+A==", + "dev": true, + "license": "MIT", + "dependencies": { + "@babel/helper-plugin-utils": "^7.25.9" + }, + "engines": { + "node": ">=6.9.0" + }, + "peerDependencies": { + "@babel/core": "^7.0.0-0" + } + }, + "node_modules/@babel/plugin-syntax-import-meta": { + "version": "7.10.4", + "resolved": "https://registry.npmjs.org/@babel/plugin-syntax-import-meta/-/plugin-syntax-import-meta-7.10.4.tgz", + "integrity": "sha512-Yqfm+XDx0+Prh3VSeEQCPU81yC+JWZ2pDPFSS4ZdpfZhp4MkFMaDC1UqseovEKwSUpnIL7+vK+Clp7bfh0iD7g==", + "dev": true, + "license": "MIT", + "dependencies": { + "@babel/helper-plugin-utils": "^7.10.4" + }, + "peerDependencies": { + "@babel/core": "^7.0.0-0" + } + }, + "node_modules/@babel/plugin-syntax-json-strings": { + "version": "7.8.3", + "resolved": "https://registry.npmjs.org/@babel/plugin-syntax-json-strings/-/plugin-syntax-json-strings-7.8.3.tgz", + "integrity": "sha512-lY6kdGpWHvjoe2vk4WrAapEuBR69EMxZl+RoGRhrFGNYVK8mOPAW8VfbT/ZgrFbXlDNiiaxQnAtgVCZ6jv30EA==", + "dev": true, + "license": "MIT", + "dependencies": { + "@babel/helper-plugin-utils": "^7.8.0" + }, + "peerDependencies": { + "@babel/core": "^7.0.0-0" + } + }, + "node_modules/@babel/plugin-syntax-jsx": { + "version": "7.25.9", + "resolved": "https://registry.npmjs.org/@babel/plugin-syntax-jsx/-/plugin-syntax-jsx-7.25.9.tgz", + "integrity": "sha512-ld6oezHQMZsZfp6pWtbjaNDF2tiiCYYDqQszHt5VV437lewP9aSi2Of99CK0D0XB21k7FLgnLcmQKyKzynfeAA==", + "dev": true, + "license": "MIT", + "dependencies": { + "@babel/helper-plugin-utils": "^7.25.9" + }, + "engines": { + "node": ">=6.9.0" + }, + "peerDependencies": { + "@babel/core": "^7.0.0-0" + } + }, + "node_modules/@babel/plugin-syntax-logical-assignment-operators": { + "version": "7.10.4", + "resolved": "https://registry.npmjs.org/@babel/plugin-syntax-logical-assignment-operators/-/plugin-syntax-logical-assignment-operators-7.10.4.tgz", + "integrity": "sha512-d8waShlpFDinQ5MtvGU9xDAOzKH47+FFoney2baFIoMr952hKOLp1HR7VszoZvOsV/4+RRszNY7D17ba0te0ig==", + "dev": true, + "license": "MIT", + "dependencies": { + "@babel/helper-plugin-utils": "^7.10.4" + }, + "peerDependencies": { + "@babel/core": "^7.0.0-0" + } + }, + "node_modules/@babel/plugin-syntax-nullish-coalescing-operator": { + "version": "7.8.3", + "resolved": "https://registry.npmjs.org/@babel/plugin-syntax-nullish-coalescing-operator/-/plugin-syntax-nullish-coalescing-operator-7.8.3.tgz", + "integrity": "sha512-aSff4zPII1u2QD7y+F8oDsz19ew4IGEJg9SVW+bqwpwtfFleiQDMdzA/R+UlWDzfnHFCxxleFT0PMIrR36XLNQ==", + "dev": true, + "license": "MIT", + "dependencies": { + "@babel/helper-plugin-utils": "^7.8.0" + }, + "peerDependencies": { + "@babel/core": "^7.0.0-0" + } + }, + "node_modules/@babel/plugin-syntax-numeric-separator": { + "version": "7.10.4", + "resolved": "https://registry.npmjs.org/@babel/plugin-syntax-numeric-separator/-/plugin-syntax-numeric-separator-7.10.4.tgz", + "integrity": "sha512-9H6YdfkcK/uOnY/K7/aA2xpzaAgkQn37yzWUMRK7OaPOqOpGS1+n0H5hxT9AUw9EsSjPW8SVyMJwYRtWs3X3ug==", + "dev": true, + "license": "MIT", + "dependencies": { + "@babel/helper-plugin-utils": "^7.10.4" + }, + "peerDependencies": { + "@babel/core": "^7.0.0-0" + } + }, + "node_modules/@babel/plugin-syntax-object-rest-spread": { + "version": "7.8.3", + "resolved": "https://registry.npmjs.org/@babel/plugin-syntax-object-rest-spread/-/plugin-syntax-object-rest-spread-7.8.3.tgz", + "integrity": "sha512-XoqMijGZb9y3y2XskN+P1wUGiVwWZ5JmoDRwx5+3GmEplNyVM2s2Dg8ILFQm8rWM48orGy5YpI5Bl8U1y7ydlA==", + "dev": true, + "license": "MIT", + "dependencies": { + "@babel/helper-plugin-utils": "^7.8.0" + }, + "peerDependencies": { + "@babel/core": "^7.0.0-0" + } + }, + "node_modules/@babel/plugin-syntax-optional-catch-binding": { + "version": "7.8.3", + "resolved": "https://registry.npmjs.org/@babel/plugin-syntax-optional-catch-binding/-/plugin-syntax-optional-catch-binding-7.8.3.tgz", + "integrity": "sha512-6VPD0Pc1lpTqw0aKoeRTMiB+kWhAoT24PA+ksWSBrFtl5SIRVpZlwN3NNPQjehA2E/91FV3RjLWoVTglWcSV3Q==", + "dev": true, + "license": "MIT", + "dependencies": { + "@babel/helper-plugin-utils": "^7.8.0" + }, + "peerDependencies": { + "@babel/core": "^7.0.0-0" + } + }, + "node_modules/@babel/plugin-syntax-optional-chaining": { + "version": "7.8.3", + "resolved": "https://registry.npmjs.org/@babel/plugin-syntax-optional-chaining/-/plugin-syntax-optional-chaining-7.8.3.tgz", + "integrity": "sha512-KoK9ErH1MBlCPxV0VANkXW2/dw4vlbGDrFgz8bmUsBGYkFRcbRwMh6cIJubdPrkxRwuGdtCk0v/wPTKbQgBjkg==", + "dev": true, + "license": "MIT", + "dependencies": { + "@babel/helper-plugin-utils": "^7.8.0" + }, + "peerDependencies": { + "@babel/core": "^7.0.0-0" + } + }, + "node_modules/@babel/plugin-syntax-private-property-in-object": { + "version": "7.14.5", + "resolved": "https://registry.npmjs.org/@babel/plugin-syntax-private-property-in-object/-/plugin-syntax-private-property-in-object-7.14.5.tgz", + "integrity": "sha512-0wVnp9dxJ72ZUJDV27ZfbSj6iHLoytYZmh3rFcxNnvsJF3ktkzLDZPy/mA17HGsaQT3/DQsWYX1f1QGWkCoVUg==", + "dev": true, + "license": "MIT", + "dependencies": { + "@babel/helper-plugin-utils": "^7.14.5" + }, + "engines": { + "node": ">=6.9.0" + }, + "peerDependencies": { + "@babel/core": "^7.0.0-0" + } + }, + "node_modules/@babel/plugin-syntax-top-level-await": { + "version": "7.14.5", + "resolved": "https://registry.npmjs.org/@babel/plugin-syntax-top-level-await/-/plugin-syntax-top-level-await-7.14.5.tgz", + "integrity": "sha512-hx++upLv5U1rgYfwe1xBQUhRmU41NEvpUvrp8jkrSCdvGSnM5/qdRMtylJ6PG5OFkBaHkbTAKTnd3/YyESRHFw==", + "dev": true, + "license": "MIT", + "dependencies": { + "@babel/helper-plugin-utils": "^7.14.5" + }, + "engines": { + "node": ">=6.9.0" + }, + "peerDependencies": { + "@babel/core": "^7.0.0-0" + } + }, + "node_modules/@babel/plugin-syntax-typescript": { + "version": "7.25.9", + "resolved": "https://registry.npmjs.org/@babel/plugin-syntax-typescript/-/plugin-syntax-typescript-7.25.9.tgz", + "integrity": "sha512-hjMgRy5hb8uJJjUcdWunWVcoi9bGpJp8p5Ol1229PoN6aytsLwNMgmdftO23wnCLMfVmTwZDWMPNq/D1SY60JQ==", + "dev": true, + "license": "MIT", + "dependencies": { + "@babel/helper-plugin-utils": "^7.25.9" + }, + "engines": { + "node": ">=6.9.0" + }, + "peerDependencies": { + "@babel/core": "^7.0.0-0" + } + }, + "node_modules/@babel/template": { + "version": "7.27.0", + "resolved": "https://registry.npmjs.org/@babel/template/-/template-7.27.0.tgz", + "integrity": "sha512-2ncevenBqXI6qRMukPlXwHKHchC7RyMuu4xv5JBXRfOGVcTy1mXCD12qrp7Jsoxll1EV3+9sE4GugBVRjT2jFA==", + "dev": true, + "license": "MIT", + "dependencies": { + "@babel/code-frame": "^7.26.2", + "@babel/parser": "^7.27.0", + "@babel/types": "^7.27.0" + }, + "engines": { + "node": ">=6.9.0" + } + }, + "node_modules/@babel/traverse": { + "version": "7.27.0", + "resolved": "https://registry.npmjs.org/@babel/traverse/-/traverse-7.27.0.tgz", + "integrity": "sha512-19lYZFzYVQkkHkl4Cy4WrAVcqBkgvV2YM2TU3xG6DIwO7O3ecbDPfW3yM3bjAGcqcQHi+CCtjMR3dIEHxsd6bA==", + "dev": true, + "license": "MIT", + "dependencies": { + "@babel/code-frame": "^7.26.2", + "@babel/generator": "^7.27.0", + "@babel/parser": "^7.27.0", + "@babel/template": "^7.27.0", + "@babel/types": "^7.27.0", + "debug": "^4.3.1", + "globals": "^11.1.0" + }, + "engines": { + "node": ">=6.9.0" + } + }, + "node_modules/@babel/types": { + "version": "7.27.0", + "resolved": "https://registry.npmjs.org/@babel/types/-/types-7.27.0.tgz", + "integrity": "sha512-H45s8fVLYjbhFH62dIJ3WtmJ6RSPt/3DRO0ZcT2SUiYiQyz3BLVb9ADEnLl91m74aQPS3AzzeajZHYOalWe3bg==", + "dev": true, + "license": "MIT", + "dependencies": { + "@babel/helper-string-parser": "^7.25.9", + "@babel/helper-validator-identifier": "^7.25.9" + }, + "engines": { + "node": ">=6.9.0" + } + }, + "node_modules/@bcoe/v8-coverage": { + "version": "0.2.3", + "resolved": "https://registry.npmjs.org/@bcoe/v8-coverage/-/v8-coverage-0.2.3.tgz", + "integrity": "sha512-0hYQ8SB4Db5zvZB4axdMHGwEaQjkZzFjQiN9LVYvIFB2nSUHW9tYpxWriPrWDASIxiaXax83REcLxuSdnGPZtw==", + "dev": true, + "license": "MIT" + }, + "node_modules/@colors/colors": { + "version": "1.5.0", + "resolved": "https://registry.npmjs.org/@colors/colors/-/colors-1.5.0.tgz", + "integrity": "sha512-ooWCrlZP11i8GImSjTHYHLkvFDP48nS4+204nGb1RiX/WXYHmJA2III9/e2DWVabCESdW7hBAEzHRqUn9OUVvQ==", + "license": "MIT", + "optional": true, + "engines": { + "node": ">=0.1.90" + } + }, + "node_modules/@inquirer/ansi": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/@inquirer/ansi/-/ansi-1.0.0.tgz", + "integrity": "sha512-JWaTfCxI1eTmJ1BIv86vUfjVatOdxwD0DAVKYevY8SazeUUZtW+tNbsdejVO1GYE0GXJW1N1ahmiC3TFd+7wZA==", + "license": "MIT", + "engines": { + "node": ">=18" + } + }, + "node_modules/@inquirer/checkbox": { + "version": "4.2.4", + "resolved": "https://registry.npmjs.org/@inquirer/checkbox/-/checkbox-4.2.4.tgz", + "integrity": "sha512-2n9Vgf4HSciFq8ttKXk+qy+GsyTXPV1An6QAwe/8bkbbqvG4VW1I/ZY1pNu2rf+h9bdzMLPbRSfcNxkHBy/Ydw==", + "license": "MIT", + "dependencies": { + "@inquirer/ansi": "^1.0.0", + "@inquirer/core": "^10.2.2", + "@inquirer/figures": "^1.0.13", + "@inquirer/type": "^3.0.8", + "yoctocolors-cjs": "^2.1.2" + }, + "engines": { + "node": ">=18" + }, + "peerDependencies": { + "@types/node": ">=18" + }, + "peerDependenciesMeta": { + "@types/node": { + "optional": true + } + } + }, + "node_modules/@inquirer/confirm": { + "version": "5.1.18", + "resolved": "https://registry.npmjs.org/@inquirer/confirm/-/confirm-5.1.18.tgz", + "integrity": "sha512-MilmWOzHa3Ks11tzvuAmFoAd/wRuaP3SwlT1IZhyMke31FKLxPiuDWcGXhU+PKveNOpAc4axzAgrgxuIJJRmLw==", + "license": "MIT", + "dependencies": { + "@inquirer/core": "^10.2.2", + "@inquirer/type": "^3.0.8" + }, + "engines": { + "node": ">=18" + }, + "peerDependencies": { + "@types/node": ">=18" + }, + "peerDependenciesMeta": { + "@types/node": { + "optional": true + } + } + }, + "node_modules/@inquirer/core": { + "version": "10.2.2", + "resolved": "https://registry.npmjs.org/@inquirer/core/-/core-10.2.2.tgz", + "integrity": "sha512-yXq/4QUnk4sHMtmbd7irwiepjB8jXU0kkFRL4nr/aDBA2mDz13cMakEWdDwX3eSCTkk03kwcndD1zfRAIlELxA==", + "license": "MIT", + "dependencies": { + "@inquirer/ansi": "^1.0.0", + "@inquirer/figures": "^1.0.13", + "@inquirer/type": "^3.0.8", + "cli-width": "^4.1.0", + "mute-stream": "^2.0.0", + "signal-exit": "^4.1.0", + "wrap-ansi": "^6.2.0", + "yoctocolors-cjs": "^2.1.2" + }, + "engines": { + "node": ">=18" + }, + "peerDependencies": { + "@types/node": ">=18" + }, + "peerDependenciesMeta": { + "@types/node": { + "optional": true + } + } + }, + "node_modules/@inquirer/core/node_modules/wrap-ansi": { + "version": "6.2.0", + "resolved": "https://registry.npmjs.org/wrap-ansi/-/wrap-ansi-6.2.0.tgz", + "integrity": "sha512-r6lPcBGxZXlIcymEu7InxDMhdW0KDxpLgoFLcguasxCaJ/SOIZwINatK9KY/tf+ZrlywOKU0UDj3ATXUBfxJXA==", + "license": "MIT", + "dependencies": { + "ansi-styles": "^4.0.0", + "string-width": "^4.1.0", + "strip-ansi": "^6.0.0" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/@inquirer/editor": { + "version": "4.2.20", + "resolved": "https://registry.npmjs.org/@inquirer/editor/-/editor-4.2.20.tgz", + "integrity": "sha512-7omh5y5bK672Q+Brk4HBbnHNowOZwrb/78IFXdrEB9PfdxL3GudQyDk8O9vQ188wj3xrEebS2M9n18BjJoI83g==", + "license": "MIT", + "dependencies": { + "@inquirer/core": "^10.2.2", + "@inquirer/external-editor": "^1.0.2", + "@inquirer/type": "^3.0.8" + }, + "engines": { + "node": ">=18" + }, + "peerDependencies": { + "@types/node": ">=18" + }, + "peerDependenciesMeta": { + "@types/node": { + "optional": true + } + } + }, + "node_modules/@inquirer/expand": { + "version": "4.0.20", + "resolved": "https://registry.npmjs.org/@inquirer/expand/-/expand-4.0.20.tgz", + "integrity": "sha512-Dt9S+6qUg94fEvgn54F2Syf0Z3U8xmnBI9ATq2f5h9xt09fs2IJXSCIXyyVHwvggKWFXEY/7jATRo2K6Dkn6Ow==", + "license": "MIT", + "dependencies": { + "@inquirer/core": "^10.2.2", + "@inquirer/type": "^3.0.8", + "yoctocolors-cjs": "^2.1.2" + }, + "engines": { + "node": ">=18" + }, + "peerDependencies": { + "@types/node": ">=18" + }, + "peerDependenciesMeta": { + "@types/node": { + "optional": true + } + } + }, + "node_modules/@inquirer/external-editor": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/@inquirer/external-editor/-/external-editor-1.0.2.tgz", + "integrity": "sha512-yy9cOoBnx58TlsPrIxauKIFQTiyH+0MK4e97y4sV9ERbI+zDxw7i2hxHLCIEGIE/8PPvDxGhgzIOTSOWcs6/MQ==", + "license": "MIT", + "dependencies": { + "chardet": "^2.1.0", + "iconv-lite": "^0.7.0" + }, + "engines": { + "node": ">=18" + }, + "peerDependencies": { + "@types/node": ">=18" + }, + "peerDependenciesMeta": { + "@types/node": { + "optional": true + } + } + }, + "node_modules/@inquirer/external-editor/node_modules/iconv-lite": { + "version": "0.7.0", + "resolved": "https://registry.npmjs.org/iconv-lite/-/iconv-lite-0.7.0.tgz", + "integrity": "sha512-cf6L2Ds3h57VVmkZe+Pn+5APsT7FpqJtEhhieDCvrE2MK5Qk9MyffgQyuxQTm6BChfeZNtcOLHp9IcWRVcIcBQ==", + "license": "MIT", + "dependencies": { + "safer-buffer": ">= 2.1.2 < 3.0.0" + }, + "engines": { + "node": ">=0.10.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/express" + } + }, + "node_modules/@inquirer/figures": { + "version": "1.0.13", + "resolved": "https://registry.npmjs.org/@inquirer/figures/-/figures-1.0.13.tgz", + "integrity": "sha512-lGPVU3yO9ZNqA7vTYz26jny41lE7yoQansmqdMLBEfqaGsmdg7V3W9mK9Pvb5IL4EVZ9GnSDGMO/cJXud5dMaw==", + "license": "MIT", + "engines": { + "node": ">=18" + } + }, + "node_modules/@inquirer/input": { + "version": "4.2.4", + "resolved": "https://registry.npmjs.org/@inquirer/input/-/input-4.2.4.tgz", + "integrity": "sha512-cwSGpLBMwpwcZZsc6s1gThm0J+it/KIJ+1qFL2euLmSKUMGumJ5TcbMgxEjMjNHRGadouIYbiIgruKoDZk7klw==", + "license": "MIT", + "dependencies": { + "@inquirer/core": "^10.2.2", + "@inquirer/type": "^3.0.8" + }, + "engines": { + "node": ">=18" + }, + "peerDependencies": { + "@types/node": ">=18" + }, + "peerDependenciesMeta": { + "@types/node": { + "optional": true + } + } + }, + "node_modules/@inquirer/number": { + "version": "3.0.20", + "resolved": "https://registry.npmjs.org/@inquirer/number/-/number-3.0.20.tgz", + "integrity": "sha512-bbooay64VD1Z6uMfNehED2A2YOPHSJnQLs9/4WNiV/EK+vXczf/R988itL2XLDGTgmhMF2KkiWZo+iEZmc4jqg==", + "license": "MIT", + "dependencies": { + "@inquirer/core": "^10.2.2", + "@inquirer/type": "^3.0.8" + }, + "engines": { + "node": ">=18" + }, + "peerDependencies": { + "@types/node": ">=18" + }, + "peerDependenciesMeta": { + "@types/node": { + "optional": true + } + } + }, + "node_modules/@inquirer/password": { + "version": "4.0.20", + "resolved": "https://registry.npmjs.org/@inquirer/password/-/password-4.0.20.tgz", + "integrity": "sha512-nxSaPV2cPvvoOmRygQR+h0B+Av73B01cqYLcr7NXcGXhbmsYfUb8fDdw2Us1bI2YsX+VvY7I7upgFYsyf8+Nug==", + "license": "MIT", + "dependencies": { + "@inquirer/ansi": "^1.0.0", + "@inquirer/core": "^10.2.2", + "@inquirer/type": "^3.0.8" + }, + "engines": { + "node": ">=18" + }, + "peerDependencies": { + "@types/node": ">=18" + }, + "peerDependenciesMeta": { + "@types/node": { + "optional": true + } + } + }, + "node_modules/@inquirer/prompts": { + "version": "7.8.6", + "resolved": "https://registry.npmjs.org/@inquirer/prompts/-/prompts-7.8.6.tgz", + "integrity": "sha512-68JhkiojicX9SBUD8FE/pSKbOKtwoyaVj1kwqLfvjlVXZvOy3iaSWX4dCLsZyYx/5Ur07Fq+yuDNOen+5ce6ig==", + "license": "MIT", + "dependencies": { + "@inquirer/checkbox": "^4.2.4", + "@inquirer/confirm": "^5.1.18", + "@inquirer/editor": "^4.2.20", + "@inquirer/expand": "^4.0.20", + "@inquirer/input": "^4.2.4", + "@inquirer/number": "^3.0.20", + "@inquirer/password": "^4.0.20", + "@inquirer/rawlist": "^4.1.8", + "@inquirer/search": "^3.1.3", + "@inquirer/select": "^4.3.4" + }, + "engines": { + "node": ">=18" + }, + "peerDependencies": { + "@types/node": ">=18" + }, + "peerDependenciesMeta": { + "@types/node": { + "optional": true + } + } + }, + "node_modules/@inquirer/rawlist": { + "version": "4.1.8", + "resolved": "https://registry.npmjs.org/@inquirer/rawlist/-/rawlist-4.1.8.tgz", + "integrity": "sha512-CQ2VkIASbgI2PxdzlkeeieLRmniaUU1Aoi5ggEdm6BIyqopE9GuDXdDOj9XiwOqK5qm72oI2i6J+Gnjaa26ejg==", + "license": "MIT", + "dependencies": { + "@inquirer/core": "^10.2.2", + "@inquirer/type": "^3.0.8", + "yoctocolors-cjs": "^2.1.2" + }, + "engines": { + "node": ">=18" + }, + "peerDependencies": { + "@types/node": ">=18" + }, + "peerDependenciesMeta": { + "@types/node": { + "optional": true + } + } + }, + "node_modules/@inquirer/search": { + "version": "3.1.3", + "resolved": "https://registry.npmjs.org/@inquirer/search/-/search-3.1.3.tgz", + "integrity": "sha512-D5T6ioybJJH0IiSUK/JXcoRrrm8sXwzrVMjibuPs+AgxmogKslaafy1oxFiorNI4s3ElSkeQZbhYQgLqiL8h6Q==", + "license": "MIT", + "dependencies": { + "@inquirer/core": "^10.2.2", + "@inquirer/figures": "^1.0.13", + "@inquirer/type": "^3.0.8", + "yoctocolors-cjs": "^2.1.2" + }, + "engines": { + "node": ">=18" + }, + "peerDependencies": { + "@types/node": ">=18" + }, + "peerDependenciesMeta": { + "@types/node": { + "optional": true + } + } + }, + "node_modules/@inquirer/select": { + "version": "4.3.4", + "resolved": "https://registry.npmjs.org/@inquirer/select/-/select-4.3.4.tgz", + "integrity": "sha512-Qp20nySRmfbuJBBsgPU7E/cL62Hf250vMZRzYDcBHty2zdD1kKCnoDFWRr0WO2ZzaXp3R7a4esaVGJUx0E6zvA==", + "license": "MIT", + "dependencies": { + "@inquirer/ansi": "^1.0.0", + "@inquirer/core": "^10.2.2", + "@inquirer/figures": "^1.0.13", + "@inquirer/type": "^3.0.8", + "yoctocolors-cjs": "^2.1.2" + }, + "engines": { + "node": ">=18" + }, + "peerDependencies": { + "@types/node": ">=18" + }, + "peerDependenciesMeta": { + "@types/node": { + "optional": true + } + } + }, + "node_modules/@inquirer/type": { + "version": "3.0.8", + "resolved": "https://registry.npmjs.org/@inquirer/type/-/type-3.0.8.tgz", + "integrity": "sha512-lg9Whz8onIHRthWaN1Q9EGLa/0LFJjyM8mEUbL1eTi6yMGvBf8gvyDLtxSXztQsxMvhxxNpJYrwa1YHdq+w4Jw==", + "license": "MIT", + "engines": { + "node": ">=18" + }, + "peerDependencies": { + "@types/node": ">=18" + }, + "peerDependenciesMeta": { + "@types/node": { + "optional": true + } + } + }, + "node_modules/@istanbuljs/load-nyc-config": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/@istanbuljs/load-nyc-config/-/load-nyc-config-1.1.0.tgz", + "integrity": "sha512-VjeHSlIzpv/NyD3N0YuHfXOPDIixcA1q2ZV98wsMqcYlPmv2n3Yb2lYP9XMElnaFVXg5A7YLTeLu6V84uQDjmQ==", + "dev": true, + "license": "ISC", + "dependencies": { + "camelcase": "^5.3.1", + "find-up": "^4.1.0", + "get-package-type": "^0.1.0", + "js-yaml": "^3.13.1", + "resolve-from": "^5.0.0" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/@istanbuljs/schema": { + "version": "0.1.3", + "resolved": "https://registry.npmjs.org/@istanbuljs/schema/-/schema-0.1.3.tgz", + "integrity": "sha512-ZXRY4jNvVgSVQ8DL3LTcakaAtXwTVUxE81hslsyD2AtoXW/wVob10HkOJ1X/pAlcI7D+2YoZKg5do8G/w6RYgA==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=8" + } + }, + "node_modules/@jest/console": { + "version": "29.7.0", + "resolved": "https://registry.npmjs.org/@jest/console/-/console-29.7.0.tgz", + "integrity": "sha512-5Ni4CU7XHQi32IJ398EEP4RrB8eV09sXP2ROqD4bksHrnTree52PsxvX8tpL8LvTZ3pFzXyPbNQReSN41CAhOg==", + "dev": true, + "license": "MIT", + "dependencies": { + "@jest/types": "^29.6.3", + "@types/node": "*", + "chalk": "^4.0.0", + "jest-message-util": "^29.7.0", + "jest-util": "^29.7.0", + "slash": "^3.0.0" + }, + "engines": { + "node": "^14.15.0 || ^16.10.0 || >=18.0.0" + } + }, + "node_modules/@jest/core": { + "version": "29.7.0", + "resolved": "https://registry.npmjs.org/@jest/core/-/core-29.7.0.tgz", + "integrity": "sha512-n7aeXWKMnGtDA48y8TLWJPJmLmmZ642Ceo78cYWEpiD7FzDgmNDV/GCVRorPABdXLJZ/9wzzgZAlHjXjxDHGsg==", + "dev": true, + "license": "MIT", + "dependencies": { + "@jest/console": "^29.7.0", + "@jest/reporters": "^29.7.0", + "@jest/test-result": "^29.7.0", + "@jest/transform": "^29.7.0", + "@jest/types": "^29.6.3", + "@types/node": "*", + "ansi-escapes": "^4.2.1", + "chalk": "^4.0.0", + "ci-info": "^3.2.0", + "exit": "^0.1.2", + "graceful-fs": "^4.2.9", + "jest-changed-files": "^29.7.0", + "jest-config": "^29.7.0", + "jest-haste-map": "^29.7.0", + "jest-message-util": "^29.7.0", + "jest-regex-util": "^29.6.3", + "jest-resolve": "^29.7.0", + "jest-resolve-dependencies": "^29.7.0", + "jest-runner": "^29.7.0", + "jest-runtime": "^29.7.0", + "jest-snapshot": "^29.7.0", + "jest-util": "^29.7.0", + "jest-validate": "^29.7.0", + "jest-watcher": "^29.7.0", + "micromatch": "^4.0.4", + "pretty-format": "^29.7.0", + "slash": "^3.0.0", + "strip-ansi": "^6.0.0" + }, + "engines": { + "node": "^14.15.0 || ^16.10.0 || >=18.0.0" + }, + "peerDependencies": { + "node-notifier": "^8.0.1 || ^9.0.0 || ^10.0.0" + }, + "peerDependenciesMeta": { + "node-notifier": { + "optional": true + } + } + }, + "node_modules/@jest/environment": { + "version": "29.7.0", + "resolved": "https://registry.npmjs.org/@jest/environment/-/environment-29.7.0.tgz", + "integrity": "sha512-aQIfHDq33ExsN4jP1NWGXhxgQ/wixs60gDiKO+XVMd8Mn0NWPWgc34ZQDTb2jKaUWQ7MuwoitXAsN2XVXNMpAw==", + "dev": true, + "license": "MIT", + "dependencies": { + "@jest/fake-timers": "^29.7.0", + "@jest/types": "^29.6.3", + "@types/node": "*", + "jest-mock": "^29.7.0" + }, + "engines": { + "node": "^14.15.0 || ^16.10.0 || >=18.0.0" + } + }, + "node_modules/@jest/expect": { + "version": "29.7.0", + "resolved": "https://registry.npmjs.org/@jest/expect/-/expect-29.7.0.tgz", + "integrity": "sha512-8uMeAMycttpva3P1lBHB8VciS9V0XAr3GymPpipdyQXbBcuhkLQOSe8E/p92RyAdToS6ZD1tFkX+CkhoECE0dQ==", + "dev": true, + "license": "MIT", + "dependencies": { + "expect": "^29.7.0", + "jest-snapshot": "^29.7.0" + }, + "engines": { + "node": "^14.15.0 || ^16.10.0 || >=18.0.0" + } + }, + "node_modules/@jest/expect-utils": { + "version": "29.7.0", + "resolved": "https://registry.npmjs.org/@jest/expect-utils/-/expect-utils-29.7.0.tgz", + "integrity": "sha512-GlsNBWiFQFCVi9QVSx7f5AgMeLxe9YCCs5PuP2O2LdjDAA8Jh9eX7lA1Jq/xdXw3Wb3hyvlFNfZIfcRetSzYcA==", + "dev": true, + "license": "MIT", + "dependencies": { + "jest-get-type": "^29.6.3" + }, + "engines": { + "node": "^14.15.0 || ^16.10.0 || >=18.0.0" + } + }, + "node_modules/@jest/fake-timers": { + "version": "29.7.0", + "resolved": "https://registry.npmjs.org/@jest/fake-timers/-/fake-timers-29.7.0.tgz", + "integrity": "sha512-q4DH1Ha4TTFPdxLsqDXK1d3+ioSL7yL5oCMJZgDYm6i+6CygW5E5xVr/D1HdsGxjt1ZWSfUAs9OxSB/BNelWrQ==", + "dev": true, + "license": "MIT", + "dependencies": { + "@jest/types": "^29.6.3", + "@sinonjs/fake-timers": "^10.0.2", + "@types/node": "*", + "jest-message-util": "^29.7.0", + "jest-mock": "^29.7.0", + "jest-util": "^29.7.0" + }, + "engines": { + "node": "^14.15.0 || ^16.10.0 || >=18.0.0" + } + }, + "node_modules/@jest/globals": { + "version": "29.7.0", + "resolved": "https://registry.npmjs.org/@jest/globals/-/globals-29.7.0.tgz", + "integrity": "sha512-mpiz3dutLbkW2MNFubUGUEVLkTGiqW6yLVTA+JbP6fI6J5iL9Y0Nlg8k95pcF8ctKwCS7WVxteBs29hhfAotzQ==", + "dev": true, + "license": "MIT", + "dependencies": { + "@jest/environment": "^29.7.0", + "@jest/expect": "^29.7.0", + "@jest/types": "^29.6.3", + "jest-mock": "^29.7.0" + }, + "engines": { + "node": "^14.15.0 || ^16.10.0 || >=18.0.0" + } + }, + "node_modules/@jest/reporters": { + "version": "29.7.0", + "resolved": "https://registry.npmjs.org/@jest/reporters/-/reporters-29.7.0.tgz", + "integrity": "sha512-DApq0KJbJOEzAFYjHADNNxAE3KbhxQB1y5Kplb5Waqw6zVbuWatSnMjE5gs8FUgEPmNsnZA3NCWl9NG0ia04Pg==", + "dev": true, + "license": "MIT", + "dependencies": { + "@bcoe/v8-coverage": "^0.2.3", + "@jest/console": "^29.7.0", + "@jest/test-result": "^29.7.0", + "@jest/transform": "^29.7.0", + "@jest/types": "^29.6.3", + "@jridgewell/trace-mapping": "^0.3.18", + "@types/node": "*", + "chalk": "^4.0.0", + "collect-v8-coverage": "^1.0.0", + "exit": "^0.1.2", + "glob": "^7.1.3", + "graceful-fs": "^4.2.9", + "istanbul-lib-coverage": "^3.0.0", + "istanbul-lib-instrument": "^6.0.0", + "istanbul-lib-report": "^3.0.0", + "istanbul-lib-source-maps": "^4.0.0", + "istanbul-reports": "^3.1.3", + "jest-message-util": "^29.7.0", + "jest-util": "^29.7.0", + "jest-worker": "^29.7.0", + "slash": "^3.0.0", + "string-length": "^4.0.1", + "strip-ansi": "^6.0.0", + "v8-to-istanbul": "^9.0.1" + }, + "engines": { + "node": "^14.15.0 || ^16.10.0 || >=18.0.0" + }, + "peerDependencies": { + "node-notifier": "^8.0.1 || ^9.0.0 || ^10.0.0" + }, + "peerDependenciesMeta": { + "node-notifier": { + "optional": true + } + } + }, + "node_modules/@jest/schemas": { + "version": "29.6.3", + "resolved": "https://registry.npmjs.org/@jest/schemas/-/schemas-29.6.3.tgz", + "integrity": "sha512-mo5j5X+jIZmJQveBKeS/clAueipV7KgiX1vMgCxam1RNYiqE1w62n0/tJJnHtjW8ZHcQco5gY85jA3mi0L+nSA==", + "dev": true, + "license": "MIT", + "dependencies": { + "@sinclair/typebox": "^0.27.8" + }, + "engines": { + "node": "^14.15.0 || ^16.10.0 || >=18.0.0" + } + }, + "node_modules/@jest/source-map": { + "version": "29.6.3", + "resolved": "https://registry.npmjs.org/@jest/source-map/-/source-map-29.6.3.tgz", + "integrity": "sha512-MHjT95QuipcPrpLM+8JMSzFx6eHp5Bm+4XeFDJlwsvVBjmKNiIAvasGK2fxz2WbGRlnvqehFbh07MMa7n3YJnw==", + "dev": true, + "license": "MIT", + "dependencies": { + "@jridgewell/trace-mapping": "^0.3.18", + "callsites": "^3.0.0", + "graceful-fs": "^4.2.9" + }, + "engines": { + "node": "^14.15.0 || ^16.10.0 || >=18.0.0" + } + }, + "node_modules/@jest/test-result": { + "version": "29.7.0", + "resolved": "https://registry.npmjs.org/@jest/test-result/-/test-result-29.7.0.tgz", + "integrity": "sha512-Fdx+tv6x1zlkJPcWXmMDAG2HBnaR9XPSd5aDWQVsfrZmLVT3lU1cwyxLgRmXR9yrq4NBoEm9BMsfgFzTQAbJYA==", + "dev": true, + "license": "MIT", + "dependencies": { + "@jest/console": "^29.7.0", + "@jest/types": "^29.6.3", + "@types/istanbul-lib-coverage": "^2.0.0", + "collect-v8-coverage": "^1.0.0" + }, + "engines": { + "node": "^14.15.0 || ^16.10.0 || >=18.0.0" + } + }, + "node_modules/@jest/test-sequencer": { + "version": "29.7.0", + "resolved": "https://registry.npmjs.org/@jest/test-sequencer/-/test-sequencer-29.7.0.tgz", + "integrity": "sha512-GQwJ5WZVrKnOJuiYiAF52UNUJXgTZx1NHjFSEB0qEMmSZKAkdMoIzw/Cj6x6NF4AvV23AUqDpFzQkN/eYCYTxw==", + "dev": true, + "license": "MIT", + "dependencies": { + "@jest/test-result": "^29.7.0", + "graceful-fs": "^4.2.9", + "jest-haste-map": "^29.7.0", + "slash": "^3.0.0" + }, + "engines": { + "node": "^14.15.0 || ^16.10.0 || >=18.0.0" + } + }, + "node_modules/@jest/transform": { + "version": "29.7.0", + "resolved": "https://registry.npmjs.org/@jest/transform/-/transform-29.7.0.tgz", + "integrity": "sha512-ok/BTPFzFKVMwO5eOHRrvnBVHdRy9IrsrW1GpMaQ9MCnilNLXQKmAX8s1YXDFaai9xJpac2ySzV0YeRRECr2Vw==", + "dev": true, + "license": "MIT", + "dependencies": { + "@babel/core": "^7.11.6", + "@jest/types": "^29.6.3", + "@jridgewell/trace-mapping": "^0.3.18", + "babel-plugin-istanbul": "^6.1.1", + "chalk": "^4.0.0", + "convert-source-map": "^2.0.0", + "fast-json-stable-stringify": "^2.1.0", + "graceful-fs": "^4.2.9", + "jest-haste-map": "^29.7.0", + "jest-regex-util": "^29.6.3", + "jest-util": "^29.7.0", + "micromatch": "^4.0.4", + "pirates": "^4.0.4", + "slash": "^3.0.0", + "write-file-atomic": "^4.0.2" + }, + "engines": { + "node": "^14.15.0 || ^16.10.0 || >=18.0.0" + } + }, + "node_modules/@jest/types": { + "version": "29.6.3", + "resolved": "https://registry.npmjs.org/@jest/types/-/types-29.6.3.tgz", + "integrity": "sha512-u3UPsIilWKOM3F9CXtrG8LEJmNxwoCQC/XVj4IKYXvvpx7QIi/Kg1LI5uDmDpKlac62NUtX7eLjRh+jVZcLOzw==", + "dev": true, + "license": "MIT", + "dependencies": { + "@jest/schemas": "^29.6.3", + "@types/istanbul-lib-coverage": "^2.0.0", + "@types/istanbul-reports": "^3.0.0", + "@types/node": "*", + "@types/yargs": "^17.0.8", + "chalk": "^4.0.0" + }, + "engines": { + "node": "^14.15.0 || ^16.10.0 || >=18.0.0" + } + }, + "node_modules/@jridgewell/gen-mapping": { + "version": "0.3.8", + "resolved": "https://registry.npmjs.org/@jridgewell/gen-mapping/-/gen-mapping-0.3.8.tgz", + "integrity": "sha512-imAbBGkb+ebQyxKgzv5Hu2nmROxoDOXHh80evxdoXNOrvAnVx7zimzc1Oo5h9RlfV4vPXaE2iM5pOFbvOCClWA==", + "dev": true, + "license": "MIT", + "dependencies": { + "@jridgewell/set-array": "^1.2.1", + "@jridgewell/sourcemap-codec": "^1.4.10", + "@jridgewell/trace-mapping": "^0.3.24" + }, + "engines": { + "node": ">=6.0.0" + } + }, + "node_modules/@jridgewell/resolve-uri": { + "version": "3.1.2", + "resolved": "https://registry.npmjs.org/@jridgewell/resolve-uri/-/resolve-uri-3.1.2.tgz", + "integrity": "sha512-bRISgCIjP20/tbWSPWMEi54QVPRZExkuD9lJL+UIxUKtwVJA8wW1Trb1jMs1RFXo1CBTNZ/5hpC9QvmKWdopKw==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=6.0.0" + } + }, + "node_modules/@jridgewell/set-array": { + "version": "1.2.1", + "resolved": "https://registry.npmjs.org/@jridgewell/set-array/-/set-array-1.2.1.tgz", + "integrity": "sha512-R8gLRTZeyp03ymzP/6Lil/28tGeGEzhx1q2k703KGWRAI1VdvPIXdG70VJc2pAMw3NA6JKL5hhFu1sJX0Mnn/A==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=6.0.0" + } + }, + "node_modules/@jridgewell/sourcemap-codec": { + "version": "1.5.0", + "resolved": "https://registry.npmjs.org/@jridgewell/sourcemap-codec/-/sourcemap-codec-1.5.0.tgz", + "integrity": "sha512-gv3ZRaISU3fjPAgNsriBRqGWQL6quFx04YMPW/zD8XMLsU32mhCCbfbO6KZFLjvYpCZ8zyDEgqsgf+PwPaM7GQ==", + "dev": true, + "license": "MIT" + }, + "node_modules/@jridgewell/trace-mapping": { + "version": "0.3.25", + "resolved": "https://registry.npmjs.org/@jridgewell/trace-mapping/-/trace-mapping-0.3.25.tgz", + "integrity": "sha512-vNk6aEwybGtawWmy/PzwnGDOjCkLWSD2wqvjGGAgOAwCGWySYXfYoxt00IJkTF+8Lb57DwOb3Aa0o9CApepiYQ==", + "dev": true, + "license": "MIT", + "dependencies": { + "@jridgewell/resolve-uri": "^3.1.0", + "@jridgewell/sourcemap-codec": "^1.4.14" + } + }, + "node_modules/@libsql/darwin-arm64": { + "version": "0.5.0-pre.6", + "resolved": "https://registry.npmjs.org/@libsql/darwin-arm64/-/darwin-arm64-0.5.0-pre.6.tgz", + "integrity": "sha512-T99Ap/ui7xqFe9ZjWUWRbSCqh9Bo/uZ/wOFtVi9U/2YlBdG4Vv2A7Uz1USYnivJm0nvyYjcy2N9enaRl2cyKkQ==", + "cpu": [ + "arm64" + ], + "license": "MIT", + "optional": true, + "os": [ + "darwin" + ] + }, + "node_modules/@libsql/darwin-x64": { + "version": "0.5.0-pre.6", + "resolved": "https://registry.npmjs.org/@libsql/darwin-x64/-/darwin-x64-0.5.0-pre.6.tgz", + "integrity": "sha512-09fTHmTrxltuQ4oyM7RCz4qRF1oiZS9uf0IIIOI7do6dQu8830a7rrqhpg33LKBs9eBfKWuzpC6n8SuuatSFOw==", + "cpu": [ + "x64" + ], + "license": "MIT", + "optional": true, + "os": [ + "darwin" + ] + }, + "node_modules/@libsql/linux-arm64-gnu": { + "version": "0.5.0-pre.6", + "resolved": "https://registry.npmjs.org/@libsql/linux-arm64-gnu/-/linux-arm64-gnu-0.5.0-pre.6.tgz", + "integrity": "sha512-HDQH42ZxzhPMcFdcARV2I7oH7LK/jk2eqhODtIbnVn0kiklHY98F4wk1rbqFIzJljMuzq9HSycJtntUyubpnWg==", + "cpu": [ + "arm64" + ], + "license": "MIT", + "optional": true, + "os": [ + "linux" + ] + }, + "node_modules/@libsql/linux-arm64-musl": { + "version": "0.5.0-pre.6", + "resolved": "https://registry.npmjs.org/@libsql/linux-arm64-musl/-/linux-arm64-musl-0.5.0-pre.6.tgz", + "integrity": "sha512-v6NmFwkQutzud5ZWbo0BWhfIe4OyfQ1qXq/uihpcLOjPUFyWl5vHelOQn1hflJeQ2PcaYxFQ6XPQimSs1HsqMw==", + "cpu": [ + "arm64" + ], + "license": "MIT", + "optional": true, + "os": [ + "linux" + ] + }, + "node_modules/@libsql/linux-x64-gnu": { + "version": "0.5.0-pre.6", + "resolved": "https://registry.npmjs.org/@libsql/linux-x64-gnu/-/linux-x64-gnu-0.5.0-pre.6.tgz", + "integrity": "sha512-IOSlRJWNUoEdtL9Y2RrGJyNR4X9t2aWTcbVkYMRtKfDIqylYO8UXDtMLFdLLnjR4p5yZKnO9OqOkbMko8DKdOw==", + "cpu": [ + "x64" + ], + "license": "MIT", + "optional": true, + "os": [ + "linux" + ] + }, + "node_modules/@libsql/linux-x64-musl": { + "version": "0.5.0-pre.6", + "resolved": "https://registry.npmjs.org/@libsql/linux-x64-musl/-/linux-x64-musl-0.5.0-pre.6.tgz", + "integrity": "sha512-BGICFHvEKIZtrD4UYjIg7SfGmak6zGRUAp/MVS+40FMe4eh7d6uvmQFs6JAaHErazLEKHLKbIKIYAXe1srHKVQ==", + "cpu": [ + "x64" + ], + "license": "MIT", + "optional": true, + "os": [ + "linux" + ] + }, + "node_modules/@libsql/win32-x64-msvc": { + "version": "0.5.0-pre.6", + "resolved": "https://registry.npmjs.org/@libsql/win32-x64-msvc/-/win32-x64-msvc-0.5.0-pre.6.tgz", + "integrity": "sha512-1RUqZ9wURWlHOXvafbnhRe2HGh+B7yfqvUQV3RWzS9c7oh1rJbeO7p0XDFFWyRjN8yYFbjlZDmRUcYr1Lo83qQ==", + "cpu": [ + "x64" + ], + "license": "MIT", + "optional": true, + "os": [ + "win32" + ] + }, + "node_modules/@neon-rs/load": { + "version": "0.0.4", + "resolved": "https://registry.npmjs.org/@neon-rs/load/-/load-0.0.4.tgz", + "integrity": "sha512-kTPhdZyTQxB+2wpiRcFWrDcejc4JI6tkPuS7UZCG4l6Zvc5kU/gGQ/ozvHTh1XR5tS+UlfAfGuPajjzQjCiHCw==", + "license": "MIT" + }, + "node_modules/@sinclair/typebox": { + "version": "0.27.8", + "resolved": "https://registry.npmjs.org/@sinclair/typebox/-/typebox-0.27.8.tgz", + "integrity": "sha512-+Fj43pSMwJs4KRrH/938Uf+uAELIgVBmQzg/q1YG10djyfA3TnrU8N8XzqCh/okZdszqBQTZf96idMfE5lnwTA==", + "dev": true, + "license": "MIT" + }, + "node_modules/@sinonjs/commons": { + "version": "3.0.1", + "resolved": "https://registry.npmjs.org/@sinonjs/commons/-/commons-3.0.1.tgz", + "integrity": "sha512-K3mCHKQ9sVh8o1C9cxkwxaOmXoAMlDxC1mYyHrjqOWEcBjYr76t96zL2zlj5dUGZ3HSw240X1qgH3Mjf1yJWpQ==", + "dev": true, + "license": "BSD-3-Clause", + "dependencies": { + "type-detect": "4.0.8" + } + }, + "node_modules/@sinonjs/fake-timers": { + "version": "10.3.0", + "resolved": "https://registry.npmjs.org/@sinonjs/fake-timers/-/fake-timers-10.3.0.tgz", + "integrity": "sha512-V4BG07kuYSUkTCSBHG8G8TNhM+F19jXFWnQtzj+we8DrkpSBCee9Z3Ms8yiGer/dlmhe35/Xdgyo3/0rQKg7YA==", + "dev": true, + "license": "BSD-3-Clause", + "dependencies": { + "@sinonjs/commons": "^3.0.0" + } + }, + "node_modules/@types/babel__core": { + "version": "7.20.5", + "resolved": "https://registry.npmjs.org/@types/babel__core/-/babel__core-7.20.5.tgz", + "integrity": "sha512-qoQprZvz5wQFJwMDqeseRXWv3rqMvhgpbXFfVyWhbx9X47POIA6i/+dXefEmZKoAgOaTdaIgNSMqMIU61yRyzA==", + "dev": true, + "license": "MIT", + "dependencies": { + "@babel/parser": "^7.20.7", + "@babel/types": "^7.20.7", + "@types/babel__generator": "*", + "@types/babel__template": "*", + "@types/babel__traverse": "*" + } + }, + "node_modules/@types/babel__generator": { + "version": "7.6.8", + "resolved": "https://registry.npmjs.org/@types/babel__generator/-/babel__generator-7.6.8.tgz", + "integrity": "sha512-ASsj+tpEDsEiFr1arWrlN6V3mdfjRMZt6LtK/Vp/kreFLnr5QH5+DhvD5nINYZXzwJvXeGq+05iUXcAzVrqWtw==", + "dev": true, + "license": "MIT", + "dependencies": { + "@babel/types": "^7.0.0" + } + }, + "node_modules/@types/babel__template": { + "version": "7.4.4", + "resolved": "https://registry.npmjs.org/@types/babel__template/-/babel__template-7.4.4.tgz", + "integrity": "sha512-h/NUaSyG5EyxBIp8YRxo4RMe2/qQgvyowRwVMzhYhBCONbW8PUsg4lkFMrhgZhUe5z3L3MiLDuvyJ/CaPa2A8A==", + "dev": true, + "license": "MIT", + "dependencies": { + "@babel/parser": "^7.1.0", + "@babel/types": "^7.0.0" + } + }, + "node_modules/@types/babel__traverse": { + "version": "7.20.7", + "resolved": "https://registry.npmjs.org/@types/babel__traverse/-/babel__traverse-7.20.7.tgz", + "integrity": "sha512-dkO5fhS7+/oos4ciWxyEyjWe48zmG6wbCheo/G2ZnHx4fs3EU6YC6UM8rk56gAjNJ9P3MTH2jo5jb92/K6wbng==", + "dev": true, + "license": "MIT", + "dependencies": { + "@babel/types": "^7.20.7" + } + }, + "node_modules/@types/graceful-fs": { + "version": "4.1.9", + "resolved": "https://registry.npmjs.org/@types/graceful-fs/-/graceful-fs-4.1.9.tgz", + "integrity": "sha512-olP3sd1qOEe5dXTSaFvQG+02VdRXcdytWLAZsAq1PecU8uqQAhkrnbli7DagjtXKW/Bl7YJbUsa8MPcuc8LHEQ==", + "dev": true, + "license": "MIT", + "dependencies": { + "@types/node": "*" + } + }, + "node_modules/@types/istanbul-lib-coverage": { + "version": "2.0.6", + "resolved": "https://registry.npmjs.org/@types/istanbul-lib-coverage/-/istanbul-lib-coverage-2.0.6.tgz", + "integrity": "sha512-2QF/t/auWm0lsy8XtKVPG19v3sSOQlJe/YHZgfjb/KBBHOGSV+J2q/S671rcq9uTBrLAXmZpqJiaQbMT+zNU1w==", + "dev": true, + "license": "MIT" + }, + "node_modules/@types/istanbul-lib-report": { + "version": "3.0.3", + "resolved": "https://registry.npmjs.org/@types/istanbul-lib-report/-/istanbul-lib-report-3.0.3.tgz", + "integrity": "sha512-NQn7AHQnk/RSLOxrBbGyJM/aVQ+pjj5HCgasFxc0K/KhoATfQ/47AyUl15I2yBUpihjmas+a+VJBOqecrFH+uA==", + "dev": true, + "license": "MIT", + "dependencies": { + "@types/istanbul-lib-coverage": "*" + } + }, + "node_modules/@types/istanbul-reports": { + "version": "3.0.4", + "resolved": "https://registry.npmjs.org/@types/istanbul-reports/-/istanbul-reports-3.0.4.tgz", + "integrity": "sha512-pk2B1NWalF9toCRu6gjBzR69syFjP4Od8WRAX+0mmf9lAjCRicLOWc+ZrxZHx/0XRjotgkF9t6iaMJ+aXcOdZQ==", + "dev": true, + "license": "MIT", + "dependencies": { + "@types/istanbul-lib-report": "*" + } + }, + "node_modules/@types/node": { + "version": "22.13.13", + "resolved": "https://registry.npmjs.org/@types/node/-/node-22.13.13.tgz", + "integrity": "sha512-ClsL5nMwKaBRwPcCvH8E7+nU4GxHVx1axNvMZTFHMEfNI7oahimt26P5zjVCRrjiIWj6YFXfE1v3dEp94wLcGQ==", + "devOptional": true, + "license": "MIT", + "dependencies": { + "undici-types": "~6.20.0" + } + }, + "node_modules/@types/stack-utils": { + "version": "2.0.3", + "resolved": "https://registry.npmjs.org/@types/stack-utils/-/stack-utils-2.0.3.tgz", + "integrity": "sha512-9aEbYZ3TbYMznPdcdr3SmIrLXwC/AKZXQeCf9Pgao5CKb8CyHuEX5jzWPTkvregvhRJHcpRO6BFoGW9ycaOkYw==", + "dev": true, + "license": "MIT" + }, + "node_modules/@types/yargs": { + "version": "17.0.33", + "resolved": "https://registry.npmjs.org/@types/yargs/-/yargs-17.0.33.tgz", + "integrity": "sha512-WpxBCKWPLr4xSsHgz511rFJAM+wS28w2zEO1QDNY5zM/S8ok70NNfztH0xwhqKyaK0OHCbN98LDAZuy1ctxDkA==", + "dev": true, + "license": "MIT", + "dependencies": { + "@types/yargs-parser": "*" + } + }, + "node_modules/@types/yargs-parser": { + "version": "21.0.3", + "resolved": "https://registry.npmjs.org/@types/yargs-parser/-/yargs-parser-21.0.3.tgz", + "integrity": "sha512-I4q9QU9MQv4oEOz4tAHJtNz1cwuLxn2F3xcc2iV5WdqLPpUnj30aUuxt1mAxYTG+oe8CZMV/+6rU4S4gRDzqtQ==", + "dev": true, + "license": "MIT" + }, + "node_modules/adler-32": { + "version": "1.3.1", + "resolved": "https://registry.npmjs.org/adler-32/-/adler-32-1.3.1.tgz", + "integrity": "sha512-ynZ4w/nUUv5rrsR8UUGoe1VC9hZj6V5hU9Qw1HlMDJGEJw5S7TfTErWTjMys6M7vr0YWcPqs3qAr4ss0nDfP+A==", + "license": "Apache-2.0", + "engines": { + "node": ">=0.8" + } + }, + "node_modules/adm-zip": { + "version": "0.5.16", + "resolved": "https://registry.npmjs.org/adm-zip/-/adm-zip-0.5.16.tgz", + "integrity": "sha512-TGw5yVi4saajsSEgz25grObGHEUaDrniwvA2qwSC060KfqGPdglhvPMA2lPIoxs3PQIItj2iag35fONcQqgUaQ==", + "license": "MIT", + "engines": { + "node": ">=12.0" + } + }, + "node_modules/ansi-escapes": { + "version": "4.3.2", + "resolved": "https://registry.npmjs.org/ansi-escapes/-/ansi-escapes-4.3.2.tgz", + "integrity": "sha512-gKXj5ALrKWQLsYG9jlTRmR/xKluxHV+Z9QEwNIgCfM1/uwPMCuzVVnh5mwTd+OuBZcwSIMbqssNWRm1lE51QaQ==", + "license": "MIT", + "dependencies": { + "type-fest": "^0.21.3" + }, + "engines": { + "node": ">=8" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/ansi-regex": { + "version": "5.0.1", + "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-5.0.1.tgz", + "integrity": "sha512-quJQXlTSUGL2LH9SUXo8VwsY4soanhgo6LNSm84E1LBcE8s3O0wpdiRzyR9z/ZZJMlMWv37qOOb9pdJlMUEKFQ==", + "license": "MIT", + "engines": { + "node": ">=8" + } + }, + "node_modules/ansi-styles": { + "version": "4.3.0", + "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-4.3.0.tgz", + "integrity": "sha512-zbB9rCJAT1rbjiVDb2hqKFHNYLxgtk8NURxZ3IZwD3F6NtxbXZQCnnSi1Lkx+IDohdPlFp222wVALIheZJQSEg==", + "license": "MIT", + "dependencies": { + "color-convert": "^2.0.1" + }, + "engines": { + "node": ">=8" + }, + "funding": { + "url": "https://github.com/chalk/ansi-styles?sponsor=1" + } + }, + "node_modules/anymatch": { + "version": "3.1.3", + "resolved": "https://registry.npmjs.org/anymatch/-/anymatch-3.1.3.tgz", + "integrity": "sha512-KMReFUr0B4t+D+OBkjR3KYqvocp2XaSzO55UcB6mgQMd3KbcE+mWTyvVV7D/zsdEbNnV6acZUutkiHQXvTr1Rw==", + "dev": true, + "license": "ISC", + "dependencies": { + "normalize-path": "^3.0.0", + "picomatch": "^2.0.4" + }, + "engines": { + "node": ">= 8" + } + }, + "node_modules/argparse": { + "version": "1.0.10", + "resolved": "https://registry.npmjs.org/argparse/-/argparse-1.0.10.tgz", + "integrity": "sha512-o5Roy6tNG4SL/FOkCAN6RzjiakZS25RLYFrcMttJqbdd8BWrnA+fGz57iN5Pb06pvBGvl5gQ0B48dJlslXvoTg==", + "dev": true, + "license": "MIT", + "dependencies": { + "sprintf-js": "~1.0.2" + } + }, + "node_modules/babel-jest": { + "version": "29.7.0", + "resolved": "https://registry.npmjs.org/babel-jest/-/babel-jest-29.7.0.tgz", + "integrity": "sha512-BrvGY3xZSwEcCzKvKsCi2GgHqDqsYkOP4/by5xCgIwGXQxIEh+8ew3gmrE1y7XRR6LHZIj6yLYnUi/mm2KXKBg==", + "dev": true, + "license": "MIT", + "dependencies": { + "@jest/transform": "^29.7.0", + "@types/babel__core": "^7.1.14", + "babel-plugin-istanbul": "^6.1.1", + "babel-preset-jest": "^29.6.3", + "chalk": "^4.0.0", + "graceful-fs": "^4.2.9", + "slash": "^3.0.0" + }, + "engines": { + "node": "^14.15.0 || ^16.10.0 || >=18.0.0" + }, + "peerDependencies": { + "@babel/core": "^7.8.0" + } + }, + "node_modules/babel-plugin-istanbul": { + "version": "6.1.1", + "resolved": "https://registry.npmjs.org/babel-plugin-istanbul/-/babel-plugin-istanbul-6.1.1.tgz", + "integrity": "sha512-Y1IQok9821cC9onCx5otgFfRm7Lm+I+wwxOx738M/WLPZ9Q42m4IG5W0FNX8WLL2gYMZo3JkuXIH2DOpWM+qwA==", + "dev": true, + "license": "BSD-3-Clause", + "dependencies": { + "@babel/helper-plugin-utils": "^7.0.0", + "@istanbuljs/load-nyc-config": "^1.0.0", + "@istanbuljs/schema": "^0.1.2", + "istanbul-lib-instrument": "^5.0.4", + "test-exclude": "^6.0.0" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/babel-plugin-istanbul/node_modules/istanbul-lib-instrument": { + "version": "5.2.1", + "resolved": "https://registry.npmjs.org/istanbul-lib-instrument/-/istanbul-lib-instrument-5.2.1.tgz", + "integrity": "sha512-pzqtp31nLv/XFOzXGuvhCb8qhjmTVo5vjVk19XE4CRlSWz0KoeJ3bw9XsA7nOp9YBf4qHjwBxkDzKcME/J29Yg==", + "dev": true, + "license": "BSD-3-Clause", + "dependencies": { + "@babel/core": "^7.12.3", + "@babel/parser": "^7.14.7", + "@istanbuljs/schema": "^0.1.2", + "istanbul-lib-coverage": "^3.2.0", + "semver": "^6.3.0" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/babel-plugin-jest-hoist": { + "version": "29.6.3", + "resolved": "https://registry.npmjs.org/babel-plugin-jest-hoist/-/babel-plugin-jest-hoist-29.6.3.tgz", + "integrity": "sha512-ESAc/RJvGTFEzRwOTT4+lNDk/GNHMkKbNzsvT0qKRfDyyYTskxB5rnU2njIDYVxXCBHHEI1c0YwHob3WaYujOg==", + "dev": true, + "license": "MIT", + "dependencies": { + "@babel/template": "^7.3.3", + "@babel/types": "^7.3.3", + "@types/babel__core": "^7.1.14", + "@types/babel__traverse": "^7.0.6" + }, + "engines": { + "node": "^14.15.0 || ^16.10.0 || >=18.0.0" + } + }, + "node_modules/babel-preset-current-node-syntax": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/babel-preset-current-node-syntax/-/babel-preset-current-node-syntax-1.1.0.tgz", + "integrity": "sha512-ldYss8SbBlWva1bs28q78Ju5Zq1F+8BrqBZZ0VFhLBvhh6lCpC2o3gDJi/5DRLs9FgYZCnmPYIVFU4lRXCkyUw==", + "dev": true, + "license": "MIT", + "dependencies": { + "@babel/plugin-syntax-async-generators": "^7.8.4", + "@babel/plugin-syntax-bigint": "^7.8.3", + "@babel/plugin-syntax-class-properties": "^7.12.13", + "@babel/plugin-syntax-class-static-block": "^7.14.5", + "@babel/plugin-syntax-import-attributes": "^7.24.7", + "@babel/plugin-syntax-import-meta": "^7.10.4", + "@babel/plugin-syntax-json-strings": "^7.8.3", + "@babel/plugin-syntax-logical-assignment-operators": "^7.10.4", + "@babel/plugin-syntax-nullish-coalescing-operator": "^7.8.3", + "@babel/plugin-syntax-numeric-separator": "^7.10.4", + "@babel/plugin-syntax-object-rest-spread": "^7.8.3", + "@babel/plugin-syntax-optional-catch-binding": "^7.8.3", + "@babel/plugin-syntax-optional-chaining": "^7.8.3", + "@babel/plugin-syntax-private-property-in-object": "^7.14.5", + "@babel/plugin-syntax-top-level-await": "^7.14.5" + }, + "peerDependencies": { + "@babel/core": "^7.0.0" + } + }, + "node_modules/babel-preset-jest": { + "version": "29.6.3", + "resolved": "https://registry.npmjs.org/babel-preset-jest/-/babel-preset-jest-29.6.3.tgz", + "integrity": "sha512-0B3bhxR6snWXJZtR/RliHTDPRgn1sNHOR0yVtq/IiQFyuOVjFS+wuio/R4gSNkyYmKmJB4wGZv2NZanmKmTnNA==", + "dev": true, + "license": "MIT", + "dependencies": { + "babel-plugin-jest-hoist": "^29.6.3", + "babel-preset-current-node-syntax": "^1.0.0" + }, + "engines": { + "node": "^14.15.0 || ^16.10.0 || >=18.0.0" + }, + "peerDependencies": { + "@babel/core": "^7.0.0" + } + }, + "node_modules/balanced-match": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/balanced-match/-/balanced-match-1.0.2.tgz", + "integrity": "sha512-3oSeUO0TMV67hN1AmbXsK4yaqU7tjiHlbxRDZOpH0KW9+CeX4bRAaX0Anxt0tx2MrpRpWwQaPwIlISEJhYU5Pw==", + "license": "MIT" + }, + "node_modules/bottleneck": { + "version": "2.19.5", + "resolved": "https://registry.npmjs.org/bottleneck/-/bottleneck-2.19.5.tgz", + "integrity": "sha512-VHiNCbI1lKdl44tGrhNfU3lup0Tj/ZBMJB5/2ZbNXRCPuRCO7ed2mgcK4r17y+KB2EfuYuRaVlwNbAeaWGSpbw==", + "license": "MIT" + }, + "node_modules/brace-expansion": { + "version": "1.1.11", + "resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-1.1.11.tgz", + "integrity": "sha512-iCuPHDFgrHX7H2vEI/5xpz07zSHB00TpugqhmYtVmMO6518mCuRMoOYFldEBl0g187ufozdaHgWKcYFb61qGiA==", + "license": "MIT", + "dependencies": { + "balanced-match": "^1.0.0", + "concat-map": "0.0.1" + } + }, + "node_modules/braces": { + "version": "3.0.3", + "resolved": "https://registry.npmjs.org/braces/-/braces-3.0.3.tgz", + "integrity": "sha512-yQbXgO/OSZVD2IsiLlro+7Hf6Q18EJrKSEsdoMzKePKXct3gvD8oLcOQdIzGupr5Fj+EDe8gO/lxc1BzfMpxvA==", + "dev": true, + "license": "MIT", + "dependencies": { + "fill-range": "^7.1.1" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/browserslist": { + "version": "4.24.4", + "resolved": "https://registry.npmjs.org/browserslist/-/browserslist-4.24.4.tgz", + "integrity": "sha512-KDi1Ny1gSePi1vm0q4oxSF8b4DR44GF4BbmS2YdhPLOEqd8pDviZOGH/GsmRwoWJ2+5Lr085X7naowMwKHDG1A==", + "dev": true, + "funding": [ + { + "type": "opencollective", + "url": "https://opencollective.com/browserslist" + }, + { + "type": "tidelift", + "url": "https://tidelift.com/funding/github/npm/browserslist" + }, + { + "type": "github", + "url": "https://github.com/sponsors/ai" + } + ], + "license": "MIT", + "dependencies": { + "caniuse-lite": "^1.0.30001688", + "electron-to-chromium": "^1.5.73", + "node-releases": "^2.0.19", + "update-browserslist-db": "^1.1.1" + }, + "bin": { + "browserslist": "cli.js" + }, + "engines": { + "node": "^6 || ^7 || ^8 || ^9 || ^10 || ^11 || ^12 || >=13.7" + } + }, + "node_modules/bser": { + "version": "2.1.1", + "resolved": "https://registry.npmjs.org/bser/-/bser-2.1.1.tgz", + "integrity": "sha512-gQxTNE/GAfIIrmHLUE3oJyp5FO6HRBfhjnw4/wMmA63ZGDJnWBmgY/lyQBpnDUkGmAhbSe39tx2d/iTOAfglwQ==", + "dev": true, + "license": "Apache-2.0", + "dependencies": { + "node-int64": "^0.4.0" + } + }, + "node_modules/buffer-from": { + "version": "1.1.2", + "resolved": "https://registry.npmjs.org/buffer-from/-/buffer-from-1.1.2.tgz", + "integrity": "sha512-E+XQCRwSbaaiChtv6k6Dwgc+bx+Bs6vuKJHHl5kox/BaKbhiXzqQOwK4cO22yElGp2OCmjwVhT3HmxgyPGnJfQ==", + "dev": true, + "license": "MIT" + }, + "node_modules/call-bind-apply-helpers": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/call-bind-apply-helpers/-/call-bind-apply-helpers-1.0.2.tgz", + "integrity": "sha512-Sp1ablJ0ivDkSzjcaJdxEunN5/XvksFJ2sMBFfq6x0ryhQV/2b/KwFe21cMpmHtPOSij8K99/wSfoEuTObmuMQ==", + "license": "MIT", + "dependencies": { + "es-errors": "^1.3.0", + "function-bind": "^1.1.2" + }, + "engines": { + "node": ">= 0.4" + } + }, + "node_modules/call-bound": { + "version": "1.0.4", + "resolved": "https://registry.npmjs.org/call-bound/-/call-bound-1.0.4.tgz", + "integrity": "sha512-+ys997U96po4Kx/ABpBCqhA9EuxJaQWDQg7295H4hBphv3IZg0boBKuwYpt4YXp6MZ5AmZQnU/tyMTlRpaSejg==", + "license": "MIT", + "dependencies": { + "call-bind-apply-helpers": "^1.0.2", + "get-intrinsic": "^1.3.0" + }, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/callsites": { + "version": "3.1.0", + "resolved": "https://registry.npmjs.org/callsites/-/callsites-3.1.0.tgz", + "integrity": "sha512-P8BjAsXvZS+VIDUI11hHCQEv74YT67YUi5JJFNWIqL235sBmjX4+qx9Muvls5ivyNENctx46xQLQ3aTuE7ssaQ==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=6" + } + }, + "node_modules/camelcase": { + "version": "5.3.1", + "resolved": "https://registry.npmjs.org/camelcase/-/camelcase-5.3.1.tgz", + "integrity": "sha512-L28STB170nwWS63UjtlEOE3dldQApaJXZkOI1uMFfzf3rRuPegHaHesyee+YxQ+W6SvRDQV6UrdOdRiR153wJg==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=6" + } + }, + "node_modules/caniuse-lite": { + "version": "1.0.30001707", + "resolved": "https://registry.npmjs.org/caniuse-lite/-/caniuse-lite-1.0.30001707.tgz", + "integrity": "sha512-3qtRjw/HQSMlDWf+X79N206fepf4SOOU6SQLMaq/0KkZLmSjPxAkBOQQ+FxbHKfHmYLZFfdWsO3KA90ceHPSnw==", + "dev": true, + "funding": [ + { + "type": "opencollective", + "url": "https://opencollective.com/browserslist" + }, + { + "type": "tidelift", + "url": "https://tidelift.com/funding/github/npm/caniuse-lite" + }, + { + "type": "github", + "url": "https://github.com/sponsors/ai" + } + ], + "license": "CC-BY-4.0" + }, + "node_modules/cfb": { + "version": "1.2.2", + "resolved": "https://registry.npmjs.org/cfb/-/cfb-1.2.2.tgz", + "integrity": "sha512-KfdUZsSOw19/ObEWasvBP/Ac4reZvAGauZhs6S/gqNhXhI7cKwvlH7ulj+dOEYnca4bm4SGo8C1bTAQvnTjgQA==", + "license": "Apache-2.0", + "dependencies": { + "adler-32": "~1.3.0", + "crc-32": "~1.2.0" + }, + "engines": { + "node": ">=0.8" + } + }, + "node_modules/chalk": { + "version": "4.1.2", + "resolved": "https://registry.npmjs.org/chalk/-/chalk-4.1.2.tgz", + "integrity": "sha512-oKnbhFyRIXpUuez8iBMmyEa4nbj4IOQyuhc/wy9kY7/WVPcwIO9VA668Pu8RkO7+0G76SLROeyw9CpQ061i4mA==", + "dev": true, + "license": "MIT", + "dependencies": { + "ansi-styles": "^4.1.0", + "supports-color": "^7.1.0" + }, + "engines": { + "node": ">=10" + }, + "funding": { + "url": "https://github.com/chalk/chalk?sponsor=1" + } + }, + "node_modules/char-regex": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/char-regex/-/char-regex-1.0.2.tgz", + "integrity": "sha512-kWWXztvZ5SBQV+eRgKFeh8q5sLuZY2+8WUIzlxWVTg+oGwY14qylx1KbKzHd8P6ZYkAg0xyIDU9JMHhyJMZ1jw==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=10" + } + }, + "node_modules/chardet": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/chardet/-/chardet-2.1.0.tgz", + "integrity": "sha512-bNFETTG/pM5ryzQ9Ad0lJOTa6HWD/YsScAR3EnCPZRPlQh77JocYktSHOUHelyhm8IARL+o4c4F1bP5KVOjiRA==", + "license": "MIT" + }, + "node_modules/ci-info": { + "version": "3.9.0", + "resolved": "https://registry.npmjs.org/ci-info/-/ci-info-3.9.0.tgz", + "integrity": "sha512-NIxF55hv4nSqQswkAeiOi1r83xy8JldOFDTWiug55KBu9Jnblncd2U6ViHmYgHf01TPZS77NJBhBMKdWj9HQMQ==", + "dev": true, + "funding": [ + { + "type": "github", + "url": "https://github.com/sponsors/sibiraj-s" + } + ], + "license": "MIT", + "engines": { + "node": ">=8" + } + }, + "node_modules/cjs-module-lexer": { + "version": "1.4.3", + "resolved": "https://registry.npmjs.org/cjs-module-lexer/-/cjs-module-lexer-1.4.3.tgz", + "integrity": "sha512-9z8TZaGM1pfswYeXrUpzPrkx8UnWYdhJclsiYMm6x/w5+nN+8Tf/LnAgfLGQCm59qAOxU8WwHEq2vNwF6i4j+Q==", + "dev": true, + "license": "MIT" + }, + "node_modules/cli-table3": { + "version": "0.6.5", + "resolved": "https://registry.npmjs.org/cli-table3/-/cli-table3-0.6.5.tgz", + "integrity": "sha512-+W/5efTR7y5HRD7gACw9yQjqMVvEMLBHmboM/kPWam+H+Hmyrgjh6YncVKK122YZkXrLudzTuAukUw9FnMf7IQ==", + "license": "MIT", + "dependencies": { + "string-width": "^4.2.0" + }, + "engines": { + "node": "10.* || >= 12.*" + }, + "optionalDependencies": { + "@colors/colors": "1.5.0" + } + }, + "node_modules/cli-width": { + "version": "4.1.0", + "resolved": "https://registry.npmjs.org/cli-width/-/cli-width-4.1.0.tgz", + "integrity": "sha512-ouuZd4/dm2Sw5Gmqy6bGyNNNe1qt9RpmxveLSO7KcgsTnU7RXfsw+/bukWGo1abgBiMAic068rclZsO4IWmmxQ==", + "license": "ISC", + "engines": { + "node": ">= 12" + } + }, + "node_modules/cliui": { + "version": "8.0.1", + "resolved": "https://registry.npmjs.org/cliui/-/cliui-8.0.1.tgz", + "integrity": "sha512-BSeNnyus75C4//NQ9gQt1/csTXyo/8Sb+afLAkzAptFuMsod9HFokGNudZpi/oQV73hnVK+sR+5PVRMd+Dr7YQ==", + "dev": true, + "license": "ISC", + "dependencies": { + "string-width": "^4.2.0", + "strip-ansi": "^6.0.1", + "wrap-ansi": "^7.0.0" + }, + "engines": { + "node": ">=12" + } + }, + "node_modules/cliui/node_modules/wrap-ansi": { + "version": "7.0.0", + "resolved": "https://registry.npmjs.org/wrap-ansi/-/wrap-ansi-7.0.0.tgz", + "integrity": "sha512-YVGIj2kamLSTxw6NsZjoBxfSwsn0ycdesmc4p+Q21c5zPuZ1pl+NfxVdxPtdHvmNVOQ6XSYG4AUtyt/Fi7D16Q==", + "dev": true, + "license": "MIT", + "dependencies": { + "ansi-styles": "^4.0.0", + "string-width": "^4.1.0", + "strip-ansi": "^6.0.0" + }, + "engines": { + "node": ">=10" + }, + "funding": { + "url": "https://github.com/chalk/wrap-ansi?sponsor=1" + } + }, + "node_modules/co": { + "version": "4.6.0", + "resolved": "https://registry.npmjs.org/co/-/co-4.6.0.tgz", + "integrity": "sha512-QVb0dM5HvG+uaxitm8wONl7jltx8dqhfU33DcqtOZcLSVIKSDDLDi7+0LbAKiyI8hD9u42m2YxXSkMGWThaecQ==", + "dev": true, + "license": "MIT", + "engines": { + "iojs": ">= 1.0.0", + "node": ">= 0.12.0" + } + }, + "node_modules/codepage": { + "version": "1.15.0", + "resolved": "https://registry.npmjs.org/codepage/-/codepage-1.15.0.tgz", + "integrity": "sha512-3g6NUTPd/YtuuGrhMnOMRjFc+LJw/bnMp3+0r/Wcz3IXUuCosKRJvMphm5+Q+bvTVGcJJuRvVLuYba+WojaFaA==", + "license": "Apache-2.0", + "engines": { + "node": ">=0.8" + } + }, + "node_modules/collect-v8-coverage": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/collect-v8-coverage/-/collect-v8-coverage-1.0.2.tgz", + "integrity": "sha512-lHl4d5/ONEbLlJvaJNtsF/Lz+WvB07u2ycqTYbdrq7UypDXailES4valYb2eWiJFxZlVmpGekfqoxQhzyFdT4Q==", + "dev": true, + "license": "MIT" + }, + "node_modules/color-convert": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/color-convert/-/color-convert-2.0.1.tgz", + "integrity": "sha512-RRECPsj7iu/xb5oKYcsFHSppFNnsj/52OVTRKb4zP5onXwVF3zVmmToNcOfGC+CRDpfK/U584fMg38ZHCaElKQ==", + "license": "MIT", + "dependencies": { + "color-name": "~1.1.4" + }, + "engines": { + "node": ">=7.0.0" + } + }, + "node_modules/color-name": { + "version": "1.1.4", + "resolved": "https://registry.npmjs.org/color-name/-/color-name-1.1.4.tgz", + "integrity": "sha512-dOy+3AuW3a2wNbZHIuMZpTcgjGuLU/uBL/ubcZF9OXbDo8ff4O8yVp5Bf0efS8uEoYo5q4Fx7dY9OgQGXgAsQA==", + "license": "MIT" + }, + "node_modules/commander": { + "version": "2.17.1", + "resolved": "https://registry.npmjs.org/commander/-/commander-2.17.1.tgz", + "integrity": "sha512-wPMUt6FnH2yzG95SA6mzjQOEKUU3aLaDEmzs1ti+1E9h+CsrZghRlqEM/EJ4KscsQVG8uNN4uVreUeT8+drlgg==", + "license": "MIT" + }, + "node_modules/concat-map": { + "version": "0.0.1", + "resolved": "https://registry.npmjs.org/concat-map/-/concat-map-0.0.1.tgz", + "integrity": "sha512-/Srv4dswyQNBfohGpz9o6Yb3Gz3SrUDqBH5rTuhGR7ahtlbYKnVxw2bCFMRljaA7EXHaXZ8wsHdodFvbkhKmqg==", + "license": "MIT" + }, + "node_modules/convert-source-map": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/convert-source-map/-/convert-source-map-2.0.0.tgz", + "integrity": "sha512-Kvp459HrV2FEJ1CAsi1Ku+MY3kasH19TFykTz2xWmMeq6bk2NU3XXvfJ+Q61m0xktWwt+1HSYf3JZsTms3aRJg==", + "dev": true, + "license": "MIT" + }, + "node_modules/crc-32": { + "version": "1.2.2", + "resolved": "https://registry.npmjs.org/crc-32/-/crc-32-1.2.2.tgz", + "integrity": "sha512-ROmzCKrTnOwybPcJApAA6WBWij23HVfGVNKqqrZpuyZOHqK2CwHSvpGuyt/UNNvaIjEd8X5IFGp4Mh+Ie1IHJQ==", + "license": "Apache-2.0", + "bin": { + "crc32": "bin/crc32.njs" + }, + "engines": { + "node": ">=0.8" + } + }, + "node_modules/create-jest": { + "version": "29.7.0", + "resolved": "https://registry.npmjs.org/create-jest/-/create-jest-29.7.0.tgz", + "integrity": "sha512-Adz2bdH0Vq3F53KEMJOoftQFutWCukm6J24wbPWRO4k1kMY7gS7ds/uoJkNuV8wDCtWWnuwGcJwpWcih+zEW1Q==", + "dev": true, + "license": "MIT", + "dependencies": { + "@jest/types": "^29.6.3", + "chalk": "^4.0.0", + "exit": "^0.1.2", + "graceful-fs": "^4.2.9", + "jest-config": "^29.7.0", + "jest-util": "^29.7.0", + "prompts": "^2.0.1" + }, + "bin": { + "create-jest": "bin/create-jest.js" + }, + "engines": { + "node": "^14.15.0 || ^16.10.0 || >=18.0.0" + } + }, + "node_modules/cross-spawn": { + "version": "7.0.6", + "resolved": "https://registry.npmjs.org/cross-spawn/-/cross-spawn-7.0.6.tgz", + "integrity": "sha512-uV2QOWP2nWzsy2aMp8aRibhi9dlzF5Hgh5SHaB9OiTGEyDTiJJyx0uy51QXdyWbtAHNua4XJzUKca3OzKUd3vA==", + "dev": true, + "license": "MIT", + "dependencies": { + "path-key": "^3.1.0", + "shebang-command": "^2.0.0", + "which": "^2.0.1" + }, + "engines": { + "node": ">= 8" + } + }, + "node_modules/debug": { + "version": "4.4.0", + "resolved": "https://registry.npmjs.org/debug/-/debug-4.4.0.tgz", + "integrity": "sha512-6WTZ/IxCY/T6BALoZHaE4ctp9xm+Z5kY/pzYaCHRFeyVhojxlrm+46y68HA6hr0TcwEssoxNiDEUJQjfPZ/RYA==", + "dev": true, + "license": "MIT", + "dependencies": { + "ms": "^2.1.3" + }, + "engines": { + "node": ">=6.0" + }, + "peerDependenciesMeta": { + "supports-color": { + "optional": true + } + } + }, + "node_modules/dedent": { + "version": "1.5.3", + "resolved": "https://registry.npmjs.org/dedent/-/dedent-1.5.3.tgz", + "integrity": "sha512-NHQtfOOW68WD8lgypbLA5oT+Bt0xXJhiYvoR6SmmNXZfpzOGXwdKWmcwG8N7PwVVWV3eF/68nmD9BaJSsTBhyQ==", + "dev": true, + "license": "MIT", + "peerDependencies": { + "babel-plugin-macros": "^3.1.0" + }, + "peerDependenciesMeta": { + "babel-plugin-macros": { + "optional": true + } + } + }, + "node_modules/deepmerge": { + "version": "4.3.1", + "resolved": "https://registry.npmjs.org/deepmerge/-/deepmerge-4.3.1.tgz", + "integrity": "sha512-3sUqbMEc77XqpdNO7FRyRog+eW3ph+GYCbj+rK+uYyRMuwsVy0rMiVtPn+QJlKFvWP/1PYpapqYn0Me2knFn+A==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/detect-libc": { + "version": "2.0.2", + "resolved": "https://registry.npmjs.org/detect-libc/-/detect-libc-2.0.2.tgz", + "integrity": "sha512-UX6sGumvvqSaXgdKGUsgZWqcUyIXZ/vZTrlRT/iobiKhGL0zL4d3osHj3uqllWJK+i+sixDS/3COVEOFbupFyw==", + "license": "Apache-2.0", + "engines": { + "node": ">=8" + } + }, + "node_modules/detect-newline": { + "version": "3.1.0", + "resolved": "https://registry.npmjs.org/detect-newline/-/detect-newline-3.1.0.tgz", + "integrity": "sha512-TLz+x/vEXm/Y7P7wn1EJFNLxYpUD4TgMosxY6fAVJUnJMbupHBOncxyWUG9OpTaH9EBD7uFI5LfEgmMOc54DsA==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=8" + } + }, + "node_modules/diff": { + "version": "8.0.0-beta", + "resolved": "https://registry.npmjs.org/diff/-/diff-8.0.0-beta.tgz", + "integrity": "sha512-8HPs1nLtHTt0/hDBhJbuWrZr7DmUsTUewMxANDVzXm4x35gX4DjPrR2hGaRxweDHkphI9idTBTAI0MAHC/W8OQ==", + "license": "BSD-3-Clause", + "engines": { + "node": ">=0.3.1" + } + }, + "node_modules/diff-sequences": { + "version": "29.6.3", + "resolved": "https://registry.npmjs.org/diff-sequences/-/diff-sequences-29.6.3.tgz", + "integrity": "sha512-EjePK1srD3P08o2j4f0ExnylqRs5B9tJjcp9t1krH2qRi8CCdsYfwe9JgSLurFBWwq4uOlipzfk5fHNvwFKr8Q==", + "dev": true, + "license": "MIT", + "engines": { + "node": "^14.15.0 || ^16.10.0 || >=18.0.0" + } + }, + "node_modules/dotenv": { + "version": "16.4.7", + "resolved": "https://registry.npmjs.org/dotenv/-/dotenv-16.4.7.tgz", + "integrity": "sha512-47qPchRCykZC03FhkYAhrvwU4xDBFIj1QPqaarj6mdM/hgUzfPHcpkHJOn3mJAufFeeAxAzeGsr5X0M4k6fLZQ==", + "license": "BSD-2-Clause", + "engines": { + "node": ">=12" + }, + "funding": { + "url": "https://dotenvx.com" + } + }, + "node_modules/dunder-proto": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/dunder-proto/-/dunder-proto-1.0.1.tgz", + "integrity": "sha512-KIN/nDJBQRcXw0MLVhZE9iQHmG68qAVIBg9CqmUYjmQIhgij9U5MFvrqkUL5FbtyyzZuOeOt0zdeRe4UY7ct+A==", + "license": "MIT", + "dependencies": { + "call-bind-apply-helpers": "^1.0.1", + "es-errors": "^1.3.0", + "gopd": "^1.2.0" + }, + "engines": { + "node": ">= 0.4" + } + }, + "node_modules/electron-to-chromium": { + "version": "1.5.125", + "resolved": "https://registry.npmjs.org/electron-to-chromium/-/electron-to-chromium-1.5.125.tgz", + "integrity": "sha512-A2+qEsSUc95QvyFDl7PNwkDDNphIKBVfBBtWWkPGRbiWEgzLo0SvLygYF6HgzVduHd+4WGPB/WD64POFgwzY3g==", + "dev": true, + "license": "ISC" + }, + "node_modules/emittery": { + "version": "0.13.1", + "resolved": "https://registry.npmjs.org/emittery/-/emittery-0.13.1.tgz", + "integrity": "sha512-DeWwawk6r5yR9jFgnDKYt4sLS0LmHJJi3ZOnb5/JdbYwj3nW+FxQnHIjhBKz8YLC7oRNPVM9NQ47I3CVx34eqQ==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=12" + }, + "funding": { + "url": "https://github.com/sindresorhus/emittery?sponsor=1" + } + }, + "node_modules/emoji-regex": { + "version": "8.0.0", + "resolved": "https://registry.npmjs.org/emoji-regex/-/emoji-regex-8.0.0.tgz", + "integrity": "sha512-MSjYzcWNOA0ewAHpz0MxpYFvwg6yjy1NG3xteoqz644VCo/RPgnr1/GGt+ic3iJTzQ8Eu3TdM14SawnVUmGE6A==", + "license": "MIT" + }, + "node_modules/encoding": { + "version": "0.1.13", + "resolved": "https://registry.npmjs.org/encoding/-/encoding-0.1.13.tgz", + "integrity": "sha512-ETBauow1T35Y/WZMkio9jiM0Z5xjHHmJ4XmjZOq1l/dXz3lr2sRn87nJy20RupqSh1F2m3HHPSp8ShIPQJrJ3A==", + "license": "MIT", + "optional": true, + "peer": true, + "dependencies": { + "iconv-lite": "^0.6.2" + } + }, + "node_modules/error-ex": { + "version": "1.3.2", + "resolved": "https://registry.npmjs.org/error-ex/-/error-ex-1.3.2.tgz", + "integrity": "sha512-7dFHNmqeFSEt2ZBsCriorKnn3Z2pj+fd9kmI6QoWw4//DL+icEBfc0U7qJCisqrTsKTjw4fNFy2pW9OqStD84g==", + "dev": true, + "license": "MIT", + "dependencies": { + "is-arrayish": "^0.2.1" + } + }, + "node_modules/es-define-property": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/es-define-property/-/es-define-property-1.0.1.tgz", + "integrity": "sha512-e3nRfgfUZ4rNGL232gUgX06QNyyez04KdjFrF+LTRoOXmrOgFKDg4BCdsjW8EnT69eqdYGmRpJwiPVYNrCaW3g==", + "license": "MIT", + "engines": { + "node": ">= 0.4" + } + }, + "node_modules/es-errors": { + "version": "1.3.0", + "resolved": "https://registry.npmjs.org/es-errors/-/es-errors-1.3.0.tgz", + "integrity": "sha512-Zf5H2Kxt2xjTvbJvP2ZWLEICxA6j+hAmMzIlypy4xcBg1vKVnx89Wy0GbS+kf5cwCVFFzdCFh2XSCFNULS6csw==", + "license": "MIT", + "engines": { + "node": ">= 0.4" + } + }, + "node_modules/es-object-atoms": { + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/es-object-atoms/-/es-object-atoms-1.1.1.tgz", + "integrity": "sha512-FGgH2h8zKNim9ljj7dankFPcICIK9Cp5bm+c2gQSYePhpaG5+esrLODihIorn+Pe6FGJzWhXQotPv73jTaldXA==", + "license": "MIT", + "dependencies": { + "es-errors": "^1.3.0" + }, + "engines": { + "node": ">= 0.4" + } + }, + "node_modules/escalade": { + "version": "3.2.0", + "resolved": "https://registry.npmjs.org/escalade/-/escalade-3.2.0.tgz", + "integrity": "sha512-WUj2qlxaQtO4g6Pq5c29GTcWGDyd8itL8zTlipgECz3JesAiiOKotd8JU6otB3PACgG6xkJUyVhboMS+bje/jA==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=6" + } + }, + "node_modules/escape-string-regexp": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/escape-string-regexp/-/escape-string-regexp-2.0.0.tgz", + "integrity": "sha512-UpzcLCXolUWcNu5HtVMHYdXJjArjsF9C0aNnquZYY4uW/Vu0miy5YoWvbV345HauVvcAUnpRuhMMcqTcGOY2+w==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=8" + } + }, + "node_modules/esprima": { + "version": "4.0.1", + "resolved": "https://registry.npmjs.org/esprima/-/esprima-4.0.1.tgz", + "integrity": "sha512-eGuFFw7Upda+g4p+QHvnW0RyTX/SVeJBDM/gCtMARO0cLuT2HcEKnTPvhjV6aGeqrCB/sbNop0Kszm0jsaWU4A==", + "dev": true, + "license": "BSD-2-Clause", + "bin": { + "esparse": "bin/esparse.js", + "esvalidate": "bin/esvalidate.js" + }, + "engines": { + "node": ">=4" + } + }, + "node_modules/execa": { + "version": "5.1.1", + "resolved": "https://registry.npmjs.org/execa/-/execa-5.1.1.tgz", + "integrity": "sha512-8uSpZZocAZRBAPIEINJj3Lo9HyGitllczc27Eh5YYojjMFMn8yHMDMaUHE2Jqfq05D/wucwI4JGURyXt1vchyg==", + "dev": true, + "license": "MIT", + "dependencies": { + "cross-spawn": "^7.0.3", + "get-stream": "^6.0.0", + "human-signals": "^2.1.0", + "is-stream": "^2.0.0", + "merge-stream": "^2.0.0", + "npm-run-path": "^4.0.1", + "onetime": "^5.1.2", + "signal-exit": "^3.0.3", + "strip-final-newline": "^2.0.0" + }, + "engines": { + "node": ">=10" + }, + "funding": { + "url": "https://github.com/sindresorhus/execa?sponsor=1" + } + }, + "node_modules/execa/node_modules/signal-exit": { + "version": "3.0.7", + "resolved": "https://registry.npmjs.org/signal-exit/-/signal-exit-3.0.7.tgz", + "integrity": "sha512-wnD2ZE+l+SPC/uoS0vXeE9L1+0wuaMqKlfz9AMUo38JsyLSBWSFcHR1Rri62LZc12vLr1gb3jl7iwQhgwpAbGQ==", + "dev": true, + "license": "ISC" + }, + "node_modules/exit": { + "version": "0.1.2", + "resolved": "https://registry.npmjs.org/exit/-/exit-0.1.2.tgz", + "integrity": "sha512-Zk/eNKV2zbjpKzrsQ+n1G6poVbErQxJ0LBOJXaKZ1EViLzH+hrLu9cdXI4zw9dBQJslwBEpbQ2P1oS7nDxs6jQ==", + "dev": true, + "engines": { + "node": ">= 0.8.0" + } + }, + "node_modules/exit-on-epipe": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/exit-on-epipe/-/exit-on-epipe-1.0.1.tgz", + "integrity": "sha512-h2z5mrROTxce56S+pnvAV890uu7ls7f1kEvVGJbw1OlFH3/mlJ5bkXu0KRyW94v37zzHPiUd55iLn3DA7TjWpw==", + "license": "Apache-2.0", + "engines": { + "node": ">=0.8" + } + }, + "node_modules/expect": { + "version": "29.7.0", + "resolved": "https://registry.npmjs.org/expect/-/expect-29.7.0.tgz", + "integrity": "sha512-2Zks0hf1VLFYI1kbh0I5jP3KHHyCHpkfyHBzsSXRFgl/Bg9mWYfMW8oD+PdMPlEwy5HNsR9JutYy6pMeOh61nw==", + "dev": true, + "license": "MIT", + "dependencies": { + "@jest/expect-utils": "^29.7.0", + "jest-get-type": "^29.6.3", + "jest-matcher-utils": "^29.7.0", + "jest-message-util": "^29.7.0", + "jest-util": "^29.7.0" + }, + "engines": { + "node": "^14.15.0 || ^16.10.0 || >=18.0.0" + } + }, + "node_modules/fast-json-stable-stringify": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/fast-json-stable-stringify/-/fast-json-stable-stringify-2.1.0.tgz", + "integrity": "sha512-lhd/wF+Lk98HZoTCtlVraHtfh5XYijIjalXck7saUtuanSDyLMxnHhSXEDJqHxD7msR8D0uCmqlkwjCV8xvwHw==", + "dev": true, + "license": "MIT" + }, + "node_modules/fb-watchman": { + "version": "2.0.2", + "resolved": "https://registry.npmjs.org/fb-watchman/-/fb-watchman-2.0.2.tgz", + "integrity": "sha512-p5161BqbuCaSnB8jIbzQHOlpgsPmK5rJVDfDKO91Axs5NC1uu3HRQm6wt9cd9/+GtQQIO53JdGXXoyDpTAsgYA==", + "dev": true, + "license": "Apache-2.0", + "dependencies": { + "bser": "2.1.1" + } + }, + "node_modules/fflate": { + "version": "0.3.11", + "resolved": "https://registry.npmjs.org/fflate/-/fflate-0.3.11.tgz", + "integrity": "sha512-Rr5QlUeGN1mbOHlaqcSYMKVpPbgLy0AWT/W0EHxA6NGI12yO1jpoui2zBBvU2G824ltM6Ut8BFgfHSBGfkmS0A==", + "license": "MIT" + }, + "node_modules/fill-range": { + "version": "7.1.1", + "resolved": "https://registry.npmjs.org/fill-range/-/fill-range-7.1.1.tgz", + "integrity": "sha512-YsGpe3WHLK8ZYi4tWDg2Jy3ebRz2rXowDxnld4bkQB00cc/1Zw9AWnC0i9ztDJitivtQvaI9KaLyKrc+hBW0yg==", + "dev": true, + "license": "MIT", + "dependencies": { + "to-regex-range": "^5.0.1" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/find-up": { + "version": "4.1.0", + "resolved": "https://registry.npmjs.org/find-up/-/find-up-4.1.0.tgz", + "integrity": "sha512-PpOwAdQ/YlXQ2vj8a3h8IipDuYRi3wceVQQGYWxNINccq40Anw7BlsEXCMbt1Zt+OLA6Fq9suIpIWD0OsnISlw==", + "dev": true, + "license": "MIT", + "dependencies": { + "locate-path": "^5.0.0", + "path-exists": "^4.0.0" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/frac": { + "version": "1.1.2", + "resolved": "https://registry.npmjs.org/frac/-/frac-1.1.2.tgz", + "integrity": "sha512-w/XBfkibaTl3YDqASwfDUqkna4Z2p9cFSr1aHDt0WoMTECnRfBOv2WArlZILlqgWlmdIlALXGpM2AOhEk5W3IA==", + "license": "Apache-2.0", + "engines": { + "node": ">=0.8" + } + }, + "node_modules/fs.realpath": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/fs.realpath/-/fs.realpath-1.0.0.tgz", + "integrity": "sha512-OO0pH2lK6a0hZnAdau5ItzHPI6pUlvI7jMVnxUQRtw4owF2wk8lOSabtGDCTP4Ggrg2MbGnWO9X8K1t4+fGMDw==", + "license": "ISC" + }, + "node_modules/fsevents": { + "version": "2.3.3", + "resolved": "https://registry.npmjs.org/fsevents/-/fsevents-2.3.3.tgz", + "integrity": "sha512-5xoDfX+fL7faATnagmWPpbFtwh/R77WmMMqqHGS65C3vvB0YHrgF+B1YmZ3441tMj5n63k0212XNoJwzlhffQw==", + "dev": true, + "hasInstallScript": true, + "license": "MIT", + "optional": true, + "os": [ + "darwin" + ], + "engines": { + "node": "^8.16.0 || ^10.6.0 || >=11.0.0" + } + }, + "node_modules/function-bind": { + "version": "1.1.2", + "resolved": "https://registry.npmjs.org/function-bind/-/function-bind-1.1.2.tgz", + "integrity": "sha512-7XHNxH7qX9xG5mIwxkhumTox/MIRNcOgDrxWsMt2pAr23WHp6MrRlN7FBSFpCpr+oVO0F744iUgR82nJMfG2SA==", + "license": "MIT", + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/gensync": { + "version": "1.0.0-beta.2", + "resolved": "https://registry.npmjs.org/gensync/-/gensync-1.0.0-beta.2.tgz", + "integrity": "sha512-3hN7NaskYvMDLQY55gnW3NQ+mesEAepTqlg+VEbj7zzqEMBVNhzcGYYeqFo/TlYz6eQiFcp1HcsCZO+nGgS8zg==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=6.9.0" + } + }, + "node_modules/get-caller-file": { + "version": "2.0.5", + "resolved": "https://registry.npmjs.org/get-caller-file/-/get-caller-file-2.0.5.tgz", + "integrity": "sha512-DyFP3BM/3YHTQOCUL/w0OZHR0lpKeGrxotcHWcqNEdnltqFwXVfhEBQ94eIo34AfQpo0rGki4cyIiftY06h2Fg==", + "dev": true, + "license": "ISC", + "engines": { + "node": "6.* || 8.* || >= 10.*" + } + }, + "node_modules/get-east-asian-width": { + "version": "1.3.0", + "resolved": "https://registry.npmjs.org/get-east-asian-width/-/get-east-asian-width-1.3.0.tgz", + "integrity": "sha512-vpeMIQKxczTD/0s2CdEWHcb0eeJe6TFjxb+J5xgX7hScxqrGuyjmv4c1D4A/gelKfyox0gJJwIHF+fLjeaM8kQ==", + "license": "MIT", + "engines": { + "node": ">=18" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/get-intrinsic": { + "version": "1.3.0", + "resolved": "https://registry.npmjs.org/get-intrinsic/-/get-intrinsic-1.3.0.tgz", + "integrity": "sha512-9fSjSaos/fRIVIp+xSJlE6lfwhES7LNtKaCBIamHsjr2na1BiABJPo0mOjjz8GJDURarmCPGqaiVg5mfjb98CQ==", + "license": "MIT", + "dependencies": { + "call-bind-apply-helpers": "^1.0.2", + "es-define-property": "^1.0.1", + "es-errors": "^1.3.0", + "es-object-atoms": "^1.1.1", + "function-bind": "^1.1.2", + "get-proto": "^1.0.1", + "gopd": "^1.2.0", + "has-symbols": "^1.1.0", + "hasown": "^2.0.2", + "math-intrinsics": "^1.1.0" + }, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/get-package-type": { + "version": "0.1.0", + "resolved": "https://registry.npmjs.org/get-package-type/-/get-package-type-0.1.0.tgz", + "integrity": "sha512-pjzuKtY64GYfWizNAJ0fr9VqttZkNiK2iS430LtIHzjBEr6bX8Am2zm4sW4Ro5wjWW5cAlRL1qAMTcXbjNAO2Q==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=8.0.0" + } + }, + "node_modules/get-proto": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/get-proto/-/get-proto-1.0.1.tgz", + "integrity": "sha512-sTSfBjoXBp89JvIKIefqw7U2CCebsc74kiY6awiGogKtoSGbgjYE/G/+l9sF3MWFPNc9IcoOC4ODfKHfxFmp0g==", + "license": "MIT", + "dependencies": { + "dunder-proto": "^1.0.1", + "es-object-atoms": "^1.0.0" + }, + "engines": { + "node": ">= 0.4" + } + }, + "node_modules/get-stream": { + "version": "6.0.1", + "resolved": "https://registry.npmjs.org/get-stream/-/get-stream-6.0.1.tgz", + "integrity": "sha512-ts6Wi+2j3jQjqi70w5AlN8DFnkSwC+MqmxEzdEALB2qXZYV3X/b1CTfgPLGJNMeAWxdPfU8FO1ms3NUfaHCPYg==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=10" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/glob": { + "version": "7.2.3", + "resolved": "https://registry.npmjs.org/glob/-/glob-7.2.3.tgz", + "integrity": "sha512-nFR0zLpU2YCaRxwoCJvL6UvCH2JFyFVIvwTLsIf21AuHlMskA1hhTdk+LlYJtOlYt9v6dvszD2BGRqBL+iQK9Q==", + "deprecated": "Glob versions prior to v9 are no longer supported", + "license": "ISC", + "dependencies": { + "fs.realpath": "^1.0.0", + "inflight": "^1.0.4", + "inherits": "2", + "minimatch": "^3.1.1", + "once": "^1.3.0", + "path-is-absolute": "^1.0.0" + }, + "engines": { + "node": "*" + }, + "funding": { + "url": "https://github.com/sponsors/isaacs" + } + }, + "node_modules/globals": { + "version": "11.12.0", + "resolved": "https://registry.npmjs.org/globals/-/globals-11.12.0.tgz", + "integrity": "sha512-WOBp/EEGUiIsJSp7wcv/y6MO+lV9UoncWqxuFfm8eBwzWNgyfBd6Gz+IeKQ9jCmyhoH99g15M3T+QaVHFjizVA==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=4" + } + }, + "node_modules/gopd": { + "version": "1.2.0", + "resolved": "https://registry.npmjs.org/gopd/-/gopd-1.2.0.tgz", + "integrity": "sha512-ZUKRh6/kUFoAiTAtTYPZJ3hw9wNxx+BIBOijnlG9PnrJsCcSjs1wyyD6vJpaYtgnzDrKYRSqf3OO6Rfa93xsRg==", + "license": "MIT", + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/graceful-fs": { + "version": "4.2.11", + "resolved": "https://registry.npmjs.org/graceful-fs/-/graceful-fs-4.2.11.tgz", + "integrity": "sha512-RbJ5/jmFcNNCcDV5o9eTnBLJ/HszWV0P73bc+Ff4nS/rJj+YaS6IGyiOL0VoBYX+l1Wrl3k63h/KrH+nhJ0XvQ==", + "dev": true, + "license": "ISC" + }, + "node_modules/has-flag": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/has-flag/-/has-flag-4.0.0.tgz", + "integrity": "sha512-EykJT/Q1KjTWctppgIAgfSO0tKVuZUjhgMr17kqTumMl6Afv3EISleU7qZUzoXDFTAHTDC4NOoG/ZxU3EvlMPQ==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=8" + } + }, + "node_modules/has-symbols": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/has-symbols/-/has-symbols-1.1.0.tgz", + "integrity": "sha512-1cDNdwJ2Jaohmb3sg4OmKaMBwuC48sYni5HUw2DvsC8LjGTLK9h+eb1X6RyuOHe4hT0ULCW68iomhjUoKUqlPQ==", + "license": "MIT", + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/hasown": { + "version": "2.0.2", + "resolved": "https://registry.npmjs.org/hasown/-/hasown-2.0.2.tgz", + "integrity": "sha512-0hJU9SCPvmMzIBdZFqNPXWa6dqh7WdH0cII9y+CyS8rG3nL48Bclra9HmKhVVUHyPWNH5Y7xDwAB7bfgSjkUMQ==", + "license": "MIT", + "dependencies": { + "function-bind": "^1.1.2" + }, + "engines": { + "node": ">= 0.4" + } + }, + "node_modules/html-escaper": { + "version": "2.0.2", + "resolved": "https://registry.npmjs.org/html-escaper/-/html-escaper-2.0.2.tgz", + "integrity": "sha512-H2iMtd0I4Mt5eYiapRdIDjp+XzelXQ0tFE4JS7YFwFevXXMmOp9myNrUvCg0D6ws8iqkRPBfKHgbwig1SmlLfg==", + "dev": true, + "license": "MIT" + }, + "node_modules/human-signals": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/human-signals/-/human-signals-2.1.0.tgz", + "integrity": "sha512-B4FFZ6q/T2jhhksgkbEW3HBvWIfDW85snkQgawt07S7J5QXTk6BkNV+0yAeZrM5QpMAdYlocGoljn0sJ/WQkFw==", + "dev": true, + "license": "Apache-2.0", + "engines": { + "node": ">=10.17.0" + } + }, + "node_modules/iconv-lite": { + "version": "0.6.3", + "resolved": "https://registry.npmjs.org/iconv-lite/-/iconv-lite-0.6.3.tgz", + "integrity": "sha512-4fCk79wshMdzMp2rH06qWrJE4iolqLhCUH+OiuIgU++RB0+94NlDL81atO7GX55uUKueo0txHNtvEyI6D7WdMw==", + "license": "MIT", + "optional": true, + "peer": true, + "dependencies": { + "safer-buffer": ">= 2.1.2 < 3.0.0" + }, + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/import-local": { + "version": "3.2.0", + "resolved": "https://registry.npmjs.org/import-local/-/import-local-3.2.0.tgz", + "integrity": "sha512-2SPlun1JUPWoM6t3F0dw0FkCF/jWY8kttcY4f599GLTSjh2OCuuhdTkJQsEcZzBqbXZGKMK2OqW1oZsjtf/gQA==", + "dev": true, + "license": "MIT", + "dependencies": { + "pkg-dir": "^4.2.0", + "resolve-cwd": "^3.0.0" + }, + "bin": { + "import-local-fixture": "fixtures/cli.js" + }, + "engines": { + "node": ">=8" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/imurmurhash": { + "version": "0.1.4", + "resolved": "https://registry.npmjs.org/imurmurhash/-/imurmurhash-0.1.4.tgz", + "integrity": "sha512-JmXMZ6wuvDmLiHEml9ykzqO6lwFbof0GG4IkcGaENdCRDDmMVnny7s5HsIgHCbaq0w2MyPhDqkhTUgS2LU2PHA==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=0.8.19" + } + }, + "node_modules/inflight": { + "version": "1.0.6", + "resolved": "https://registry.npmjs.org/inflight/-/inflight-1.0.6.tgz", + "integrity": "sha512-k92I/b08q4wvFscXCLvqfsHCrjrF7yiXsQuIVvVE7N82W3+aqpzuUdBbfhWcy/FZR3/4IgflMgKLOsvPDrGCJA==", + "deprecated": "This module is not supported, and leaks memory. Do not use it. Check out lru-cache if you want a good and tested way to coalesce async requests by a key value, which is much more comprehensive and powerful.", + "license": "ISC", + "dependencies": { + "once": "^1.3.0", + "wrappy": "1" + } + }, + "node_modules/inherits": { + "version": "2.0.3", + "resolved": "https://registry.npmjs.org/inherits/-/inherits-2.0.3.tgz", + "integrity": "sha512-x00IRNXNy63jwGkJmzPigoySHbaqpNuzKbBOmzK+g2OdZpQ9w+sxCN+VSB3ja7IAge2OP2qpfxTjeNcyjmW1uw==", + "license": "ISC" + }, + "node_modules/inquirer": { + "version": "12.4.3", + "resolved": "https://registry.npmjs.org/inquirer/-/inquirer-12.4.3.tgz", + "integrity": "sha512-p9+jcDKhFHKTunvpffCk7I9eKt8+NPNWO8hMSSoLPv5vahP5Vhr78qWzDtA+6FBWQtFTuLFUWmxTyhC6G2Xz/Q==", + "license": "MIT", + "dependencies": { + "@inquirer/core": "^10.1.8", + "@inquirer/prompts": "^7.3.3", + "@inquirer/type": "^3.0.5", + "ansi-escapes": "^4.3.2", + "mute-stream": "^2.0.0", + "run-async": "^3.0.0", + "rxjs": "^7.8.2" + }, + "engines": { + "node": ">=18" + }, + "peerDependencies": { + "@types/node": ">=18" + }, + "peerDependenciesMeta": { + "@types/node": { + "optional": true + } + } + }, + "node_modules/is-arrayish": { + "version": "0.2.1", + "resolved": "https://registry.npmjs.org/is-arrayish/-/is-arrayish-0.2.1.tgz", + "integrity": "sha512-zz06S8t0ozoDXMG+ube26zeCTNXcKIPJZJi8hBrF4idCLms4CG9QtK7qBl1boi5ODzFpjswb5JPmHCbMpjaYzg==", + "dev": true, + "license": "MIT" + }, + "node_modules/is-core-module": { + "version": "2.16.1", + "resolved": "https://registry.npmjs.org/is-core-module/-/is-core-module-2.16.1.tgz", + "integrity": "sha512-UfoeMA6fIJ8wTYFEUjelnaGI67v6+N7qXJEvQuIGa99l4xsCruSYOVSQ0uPANn4dAzm8lkYPaKLrrijLq7x23w==", + "dev": true, + "license": "MIT", + "dependencies": { + "hasown": "^2.0.2" + }, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/is-fullwidth-code-point": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/is-fullwidth-code-point/-/is-fullwidth-code-point-3.0.0.tgz", + "integrity": "sha512-zymm5+u+sCsSWyD9qNaejV3DFvhCKclKdizYaJUuHA83RLjb7nSuGnddCHGv0hk+KY7BMAlsWeK4Ueg6EV6XQg==", + "license": "MIT", + "engines": { + "node": ">=8" + } + }, + "node_modules/is-generator-fn": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/is-generator-fn/-/is-generator-fn-2.1.0.tgz", + "integrity": "sha512-cTIB4yPYL/Grw0EaSzASzg6bBy9gqCofvWN8okThAYIxKJZC+udlRAmGbM0XLeniEJSs8uEgHPGuHSe1XsOLSQ==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=6" + } + }, + "node_modules/is-number": { + "version": "7.0.0", + "resolved": "https://registry.npmjs.org/is-number/-/is-number-7.0.0.tgz", + "integrity": "sha512-41Cifkg6e8TylSpdtTpeLVMqvSBEVzTttHvERD741+pnZ8ANv0004MRL43QKPDlK9cGvNp6NZWZUBlbGXYxxng==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=0.12.0" + } + }, + "node_modules/is-stream": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/is-stream/-/is-stream-2.0.1.tgz", + "integrity": "sha512-hFoiJiTl63nn+kstHGBtewWSKnQLpyb155KHheA1l39uvtO9nWIop1p3udqPcUd/xbF1VLMO4n7OI6p7RbngDg==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=8" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/isexe": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/isexe/-/isexe-2.0.0.tgz", + "integrity": "sha512-RHxMLp9lnKHGHRng9QFhRCMbYAcVpn69smSGcq3f36xjgVVWThj4qqLbTLlq7Ssj8B+fIQ1EuCEGI2lKsyQeIw==", + "dev": true, + "license": "ISC" + }, + "node_modules/istanbul-lib-coverage": { + "version": "3.2.2", + "resolved": "https://registry.npmjs.org/istanbul-lib-coverage/-/istanbul-lib-coverage-3.2.2.tgz", + "integrity": "sha512-O8dpsF+r0WV/8MNRKfnmrtCWhuKjxrq2w+jpzBL5UZKTi2LeVWnWOmWRxFlesJONmc+wLAGvKQZEOanko0LFTg==", + "dev": true, + "license": "BSD-3-Clause", + "engines": { + "node": ">=8" + } + }, + "node_modules/istanbul-lib-instrument": { + "version": "6.0.3", + "resolved": "https://registry.npmjs.org/istanbul-lib-instrument/-/istanbul-lib-instrument-6.0.3.tgz", + "integrity": "sha512-Vtgk7L/R2JHyyGW07spoFlB8/lpjiOLTjMdms6AFMraYt3BaJauod/NGrfnVG/y4Ix1JEuMRPDPEj2ua+zz1/Q==", + "dev": true, + "license": "BSD-3-Clause", + "dependencies": { + "@babel/core": "^7.23.9", + "@babel/parser": "^7.23.9", + "@istanbuljs/schema": "^0.1.3", + "istanbul-lib-coverage": "^3.2.0", + "semver": "^7.5.4" + }, + "engines": { + "node": ">=10" + } + }, + "node_modules/istanbul-lib-instrument/node_modules/semver": { + "version": "7.7.1", + "resolved": "https://registry.npmjs.org/semver/-/semver-7.7.1.tgz", + "integrity": "sha512-hlq8tAfn0m/61p4BVRcPzIGr6LKiMwo4VM6dGi6pt4qcRkmNzTcWq6eCEjEh+qXjkMDvPlOFFSGwQjoEa6gyMA==", + "dev": true, + "license": "ISC", + "bin": { + "semver": "bin/semver.js" + }, + "engines": { + "node": ">=10" + } + }, + "node_modules/istanbul-lib-report": { + "version": "3.0.1", + "resolved": "https://registry.npmjs.org/istanbul-lib-report/-/istanbul-lib-report-3.0.1.tgz", + "integrity": "sha512-GCfE1mtsHGOELCU8e/Z7YWzpmybrx/+dSTfLrvY8qRmaY6zXTKWn6WQIjaAFw069icm6GVMNkgu0NzI4iPZUNw==", + "dev": true, + "license": "BSD-3-Clause", + "dependencies": { + "istanbul-lib-coverage": "^3.0.0", + "make-dir": "^4.0.0", + "supports-color": "^7.1.0" + }, + "engines": { + "node": ">=10" + } + }, + "node_modules/istanbul-lib-source-maps": { + "version": "4.0.1", + "resolved": "https://registry.npmjs.org/istanbul-lib-source-maps/-/istanbul-lib-source-maps-4.0.1.tgz", + "integrity": "sha512-n3s8EwkdFIJCG3BPKBYvskgXGoy88ARzvegkitk60NxRdwltLOTaH7CUiMRXvwYorl0Q712iEjcWB+fK/MrWVw==", + "dev": true, + "license": "BSD-3-Clause", + "dependencies": { + "debug": "^4.1.1", + "istanbul-lib-coverage": "^3.0.0", + "source-map": "^0.6.1" + }, + "engines": { + "node": ">=10" + } + }, + "node_modules/istanbul-reports": { + "version": "3.1.7", + "resolved": "https://registry.npmjs.org/istanbul-reports/-/istanbul-reports-3.1.7.tgz", + "integrity": "sha512-BewmUXImeuRk2YY0PVbxgKAysvhRPUQE0h5QRM++nVWyubKGV0l8qQ5op8+B2DOmwSe63Jivj0BjkPQVf8fP5g==", + "dev": true, + "license": "BSD-3-Clause", + "dependencies": { + "html-escaper": "^2.0.0", + "istanbul-lib-report": "^3.0.0" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/jest": { + "version": "29.7.0", + "resolved": "https://registry.npmjs.org/jest/-/jest-29.7.0.tgz", + "integrity": "sha512-NIy3oAFp9shda19hy4HK0HRTWKtPJmGdnvywu01nOqNC2vZg+Z+fvJDxpMQA88eb2I9EcafcdjYgsDthnYTvGw==", + "dev": true, + "license": "MIT", + "dependencies": { + "@jest/core": "^29.7.0", + "@jest/types": "^29.6.3", + "import-local": "^3.0.2", + "jest-cli": "^29.7.0" + }, + "bin": { + "jest": "bin/jest.js" + }, + "engines": { + "node": "^14.15.0 || ^16.10.0 || >=18.0.0" + }, + "peerDependencies": { + "node-notifier": "^8.0.1 || ^9.0.0 || ^10.0.0" + }, + "peerDependenciesMeta": { + "node-notifier": { + "optional": true + } + } + }, + "node_modules/jest-changed-files": { + "version": "29.7.0", + "resolved": "https://registry.npmjs.org/jest-changed-files/-/jest-changed-files-29.7.0.tgz", + "integrity": "sha512-fEArFiwf1BpQ+4bXSprcDc3/x4HSzL4al2tozwVpDFpsxALjLYdyiIK4e5Vz66GQJIbXJ82+35PtysofptNX2w==", + "dev": true, + "license": "MIT", + "dependencies": { + "execa": "^5.0.0", + "jest-util": "^29.7.0", + "p-limit": "^3.1.0" + }, + "engines": { + "node": "^14.15.0 || ^16.10.0 || >=18.0.0" + } + }, + "node_modules/jest-circus": { + "version": "29.7.0", + "resolved": "https://registry.npmjs.org/jest-circus/-/jest-circus-29.7.0.tgz", + "integrity": "sha512-3E1nCMgipcTkCocFwM90XXQab9bS+GMsjdpmPrlelaxwD93Ad8iVEjX/vvHPdLPnFf+L40u+5+iutRdA1N9myw==", + "dev": true, + "license": "MIT", + "dependencies": { + "@jest/environment": "^29.7.0", + "@jest/expect": "^29.7.0", + "@jest/test-result": "^29.7.0", + "@jest/types": "^29.6.3", + "@types/node": "*", + "chalk": "^4.0.0", + "co": "^4.6.0", + "dedent": "^1.0.0", + "is-generator-fn": "^2.0.0", + "jest-each": "^29.7.0", + "jest-matcher-utils": "^29.7.0", + "jest-message-util": "^29.7.0", + "jest-runtime": "^29.7.0", + "jest-snapshot": "^29.7.0", + "jest-util": "^29.7.0", + "p-limit": "^3.1.0", + "pretty-format": "^29.7.0", + "pure-rand": "^6.0.0", + "slash": "^3.0.0", + "stack-utils": "^2.0.3" + }, + "engines": { + "node": "^14.15.0 || ^16.10.0 || >=18.0.0" + } + }, + "node_modules/jest-cli": { + "version": "29.7.0", + "resolved": "https://registry.npmjs.org/jest-cli/-/jest-cli-29.7.0.tgz", + "integrity": "sha512-OVVobw2IubN/GSYsxETi+gOe7Ka59EFMR/twOU3Jb2GnKKeMGJB5SGUUrEz3SFVmJASUdZUzy83sLNNQ2gZslg==", + "dev": true, + "license": "MIT", + "dependencies": { + "@jest/core": "^29.7.0", + "@jest/test-result": "^29.7.0", + "@jest/types": "^29.6.3", + "chalk": "^4.0.0", + "create-jest": "^29.7.0", + "exit": "^0.1.2", + "import-local": "^3.0.2", + "jest-config": "^29.7.0", + "jest-util": "^29.7.0", + "jest-validate": "^29.7.0", + "yargs": "^17.3.1" + }, + "bin": { + "jest": "bin/jest.js" + }, + "engines": { + "node": "^14.15.0 || ^16.10.0 || >=18.0.0" + }, + "peerDependencies": { + "node-notifier": "^8.0.1 || ^9.0.0 || ^10.0.0" + }, + "peerDependenciesMeta": { + "node-notifier": { + "optional": true + } + } + }, + "node_modules/jest-config": { + "version": "29.7.0", + "resolved": "https://registry.npmjs.org/jest-config/-/jest-config-29.7.0.tgz", + "integrity": "sha512-uXbpfeQ7R6TZBqI3/TxCU4q4ttk3u0PJeC+E0zbfSoSjq6bJ7buBPxzQPL0ifrkY4DNu4JUdk0ImlBUYi840eQ==", + "dev": true, + "license": "MIT", + "dependencies": { + "@babel/core": "^7.11.6", + "@jest/test-sequencer": "^29.7.0", + "@jest/types": "^29.6.3", + "babel-jest": "^29.7.0", + "chalk": "^4.0.0", + "ci-info": "^3.2.0", + "deepmerge": "^4.2.2", + "glob": "^7.1.3", + "graceful-fs": "^4.2.9", + "jest-circus": "^29.7.0", + "jest-environment-node": "^29.7.0", + "jest-get-type": "^29.6.3", + "jest-regex-util": "^29.6.3", + "jest-resolve": "^29.7.0", + "jest-runner": "^29.7.0", + "jest-util": "^29.7.0", + "jest-validate": "^29.7.0", + "micromatch": "^4.0.4", + "parse-json": "^5.2.0", + "pretty-format": "^29.7.0", + "slash": "^3.0.0", + "strip-json-comments": "^3.1.1" + }, + "engines": { + "node": "^14.15.0 || ^16.10.0 || >=18.0.0" + }, + "peerDependencies": { + "@types/node": "*", + "ts-node": ">=9.0.0" + }, + "peerDependenciesMeta": { + "@types/node": { + "optional": true + }, + "ts-node": { + "optional": true + } + } + }, + "node_modules/jest-diff": { + "version": "29.7.0", + "resolved": "https://registry.npmjs.org/jest-diff/-/jest-diff-29.7.0.tgz", + "integrity": "sha512-LMIgiIrhigmPrs03JHpxUh2yISK3vLFPkAodPeo0+BuF7wA2FoQbkEg1u8gBYBThncu7e1oEDUfIXVuTqLRUjw==", + "dev": true, + "license": "MIT", + "dependencies": { + "chalk": "^4.0.0", + "diff-sequences": "^29.6.3", + "jest-get-type": "^29.6.3", + "pretty-format": "^29.7.0" + }, + "engines": { + "node": "^14.15.0 || ^16.10.0 || >=18.0.0" + } + }, + "node_modules/jest-docblock": { + "version": "29.7.0", + "resolved": "https://registry.npmjs.org/jest-docblock/-/jest-docblock-29.7.0.tgz", + "integrity": "sha512-q617Auw3A612guyaFgsbFeYpNP5t2aoUNLwBUbc/0kD1R4t9ixDbyFTHd1nok4epoVFpr7PmeWHrhvuV3XaJ4g==", + "dev": true, + "license": "MIT", + "dependencies": { + "detect-newline": "^3.0.0" + }, + "engines": { + "node": "^14.15.0 || ^16.10.0 || >=18.0.0" + } + }, + "node_modules/jest-each": { + "version": "29.7.0", + "resolved": "https://registry.npmjs.org/jest-each/-/jest-each-29.7.0.tgz", + "integrity": "sha512-gns+Er14+ZrEoC5fhOfYCY1LOHHr0TI+rQUHZS8Ttw2l7gl+80eHc/gFf2Ktkw0+SIACDTeWvpFcv3B04VembQ==", + "dev": true, + "license": "MIT", + "dependencies": { + "@jest/types": "^29.6.3", + "chalk": "^4.0.0", + "jest-get-type": "^29.6.3", + "jest-util": "^29.7.0", + "pretty-format": "^29.7.0" + }, + "engines": { + "node": "^14.15.0 || ^16.10.0 || >=18.0.0" + } + }, + "node_modules/jest-environment-node": { + "version": "29.7.0", + "resolved": "https://registry.npmjs.org/jest-environment-node/-/jest-environment-node-29.7.0.tgz", + "integrity": "sha512-DOSwCRqXirTOyheM+4d5YZOrWcdu0LNZ87ewUoywbcb2XR4wKgqiG8vNeYwhjFMbEkfju7wx2GYH0P2gevGvFw==", + "dev": true, + "license": "MIT", + "dependencies": { + "@jest/environment": "^29.7.0", + "@jest/fake-timers": "^29.7.0", + "@jest/types": "^29.6.3", + "@types/node": "*", + "jest-mock": "^29.7.0", + "jest-util": "^29.7.0" + }, + "engines": { + "node": "^14.15.0 || ^16.10.0 || >=18.0.0" + } + }, + "node_modules/jest-get-type": { + "version": "29.6.3", + "resolved": "https://registry.npmjs.org/jest-get-type/-/jest-get-type-29.6.3.tgz", + "integrity": "sha512-zrteXnqYxfQh7l5FHyL38jL39di8H8rHoecLH3JNxH3BwOrBsNeabdap5e0I23lD4HHI8W5VFBZqG4Eaq5LNcw==", + "dev": true, + "license": "MIT", + "engines": { + "node": "^14.15.0 || ^16.10.0 || >=18.0.0" + } + }, + "node_modules/jest-haste-map": { + "version": "29.7.0", + "resolved": "https://registry.npmjs.org/jest-haste-map/-/jest-haste-map-29.7.0.tgz", + "integrity": "sha512-fP8u2pyfqx0K1rGn1R9pyE0/KTn+G7PxktWidOBTqFPLYX0b9ksaMFkhK5vrS3DVun09pckLdlx90QthlW7AmA==", + "dev": true, + "license": "MIT", + "dependencies": { + "@jest/types": "^29.6.3", + "@types/graceful-fs": "^4.1.3", + "@types/node": "*", + "anymatch": "^3.0.3", + "fb-watchman": "^2.0.0", + "graceful-fs": "^4.2.9", + "jest-regex-util": "^29.6.3", + "jest-util": "^29.7.0", + "jest-worker": "^29.7.0", + "micromatch": "^4.0.4", + "walker": "^1.0.8" + }, + "engines": { + "node": "^14.15.0 || ^16.10.0 || >=18.0.0" + }, + "optionalDependencies": { + "fsevents": "^2.3.2" + } + }, + "node_modules/jest-leak-detector": { + "version": "29.7.0", + "resolved": "https://registry.npmjs.org/jest-leak-detector/-/jest-leak-detector-29.7.0.tgz", + "integrity": "sha512-kYA8IJcSYtST2BY9I+SMC32nDpBT3J2NvWJx8+JCuCdl/CR1I4EKUJROiP8XtCcxqgTTBGJNdbB1A8XRKbTetw==", + "dev": true, + "license": "MIT", + "dependencies": { + "jest-get-type": "^29.6.3", + "pretty-format": "^29.7.0" + }, + "engines": { + "node": "^14.15.0 || ^16.10.0 || >=18.0.0" + } + }, + "node_modules/jest-matcher-utils": { + "version": "29.7.0", + "resolved": "https://registry.npmjs.org/jest-matcher-utils/-/jest-matcher-utils-29.7.0.tgz", + "integrity": "sha512-sBkD+Xi9DtcChsI3L3u0+N0opgPYnCRPtGcQYrgXmR+hmt/fYfWAL0xRXYU8eWOdfuLgBe0YCW3AFtnRLagq/g==", + "dev": true, + "license": "MIT", + "dependencies": { + "chalk": "^4.0.0", + "jest-diff": "^29.7.0", + "jest-get-type": "^29.6.3", + "pretty-format": "^29.7.0" + }, + "engines": { + "node": "^14.15.0 || ^16.10.0 || >=18.0.0" + } + }, + "node_modules/jest-message-util": { + "version": "29.7.0", + "resolved": "https://registry.npmjs.org/jest-message-util/-/jest-message-util-29.7.0.tgz", + "integrity": "sha512-GBEV4GRADeP+qtB2+6u61stea8mGcOT4mCtrYISZwfu9/ISHFJ/5zOMXYbpBE9RsS5+Gb63DW4FgmnKJ79Kf6w==", + "dev": true, + "license": "MIT", + "dependencies": { + "@babel/code-frame": "^7.12.13", + "@jest/types": "^29.6.3", + "@types/stack-utils": "^2.0.0", + "chalk": "^4.0.0", + "graceful-fs": "^4.2.9", + "micromatch": "^4.0.4", + "pretty-format": "^29.7.0", + "slash": "^3.0.0", + "stack-utils": "^2.0.3" + }, + "engines": { + "node": "^14.15.0 || ^16.10.0 || >=18.0.0" + } + }, + "node_modules/jest-mock": { + "version": "29.7.0", + "resolved": "https://registry.npmjs.org/jest-mock/-/jest-mock-29.7.0.tgz", + "integrity": "sha512-ITOMZn+UkYS4ZFh83xYAOzWStloNzJFO2s8DWrE4lhtGD+AorgnbkiKERe4wQVBydIGPx059g6riW5Btp6Llnw==", + "dev": true, + "license": "MIT", + "dependencies": { + "@jest/types": "^29.6.3", + "@types/node": "*", + "jest-util": "^29.7.0" + }, + "engines": { + "node": "^14.15.0 || ^16.10.0 || >=18.0.0" + } + }, + "node_modules/jest-pnp-resolver": { + "version": "1.2.3", + "resolved": "https://registry.npmjs.org/jest-pnp-resolver/-/jest-pnp-resolver-1.2.3.tgz", + "integrity": "sha512-+3NpwQEnRoIBtx4fyhblQDPgJI0H1IEIkX7ShLUjPGA7TtUTvI1oiKi3SR4oBR0hQhQR80l4WAe5RrXBwWMA8w==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=6" + }, + "peerDependencies": { + "jest-resolve": "*" + }, + "peerDependenciesMeta": { + "jest-resolve": { + "optional": true + } + } + }, + "node_modules/jest-regex-util": { + "version": "29.6.3", + "resolved": "https://registry.npmjs.org/jest-regex-util/-/jest-regex-util-29.6.3.tgz", + "integrity": "sha512-KJJBsRCyyLNWCNBOvZyRDnAIfUiRJ8v+hOBQYGn8gDyF3UegwiP4gwRR3/SDa42g1YbVycTidUF3rKjyLFDWbg==", + "dev": true, + "license": "MIT", + "engines": { + "node": "^14.15.0 || ^16.10.0 || >=18.0.0" + } + }, + "node_modules/jest-resolve": { + "version": "29.7.0", + "resolved": "https://registry.npmjs.org/jest-resolve/-/jest-resolve-29.7.0.tgz", + "integrity": "sha512-IOVhZSrg+UvVAshDSDtHyFCCBUl/Q3AAJv8iZ6ZjnZ74xzvwuzLXid9IIIPgTnY62SJjfuupMKZsZQRsCvxEgA==", + "dev": true, + "license": "MIT", + "dependencies": { + "chalk": "^4.0.0", + "graceful-fs": "^4.2.9", + "jest-haste-map": "^29.7.0", + "jest-pnp-resolver": "^1.2.2", + "jest-util": "^29.7.0", + "jest-validate": "^29.7.0", + "resolve": "^1.20.0", + "resolve.exports": "^2.0.0", + "slash": "^3.0.0" + }, + "engines": { + "node": "^14.15.0 || ^16.10.0 || >=18.0.0" + } + }, + "node_modules/jest-resolve-dependencies": { + "version": "29.7.0", + "resolved": "https://registry.npmjs.org/jest-resolve-dependencies/-/jest-resolve-dependencies-29.7.0.tgz", + "integrity": "sha512-un0zD/6qxJ+S0et7WxeI3H5XSe9lTBBR7bOHCHXkKR6luG5mwDDlIzVQ0V5cZCuoTgEdcdwzTghYkTWfubi+nA==", + "dev": true, + "license": "MIT", + "dependencies": { + "jest-regex-util": "^29.6.3", + "jest-snapshot": "^29.7.0" + }, + "engines": { + "node": "^14.15.0 || ^16.10.0 || >=18.0.0" + } + }, + "node_modules/jest-runner": { + "version": "29.7.0", + "resolved": "https://registry.npmjs.org/jest-runner/-/jest-runner-29.7.0.tgz", + "integrity": "sha512-fsc4N6cPCAahybGBfTRcq5wFR6fpLznMg47sY5aDpsoejOcVYFb07AHuSnR0liMcPTgBsA3ZJL6kFOjPdoNipQ==", + "dev": true, + "license": "MIT", + "dependencies": { + "@jest/console": "^29.7.0", + "@jest/environment": "^29.7.0", + "@jest/test-result": "^29.7.0", + "@jest/transform": "^29.7.0", + "@jest/types": "^29.6.3", + "@types/node": "*", + "chalk": "^4.0.0", + "emittery": "^0.13.1", + "graceful-fs": "^4.2.9", + "jest-docblock": "^29.7.0", + "jest-environment-node": "^29.7.0", + "jest-haste-map": "^29.7.0", + "jest-leak-detector": "^29.7.0", + "jest-message-util": "^29.7.0", + "jest-resolve": "^29.7.0", + "jest-runtime": "^29.7.0", + "jest-util": "^29.7.0", + "jest-watcher": "^29.7.0", + "jest-worker": "^29.7.0", + "p-limit": "^3.1.0", + "source-map-support": "0.5.13" + }, + "engines": { + "node": "^14.15.0 || ^16.10.0 || >=18.0.0" + } + }, + "node_modules/jest-runtime": { + "version": "29.7.0", + "resolved": "https://registry.npmjs.org/jest-runtime/-/jest-runtime-29.7.0.tgz", + "integrity": "sha512-gUnLjgwdGqW7B4LvOIkbKs9WGbn+QLqRQQ9juC6HndeDiezIwhDP+mhMwHWCEcfQ5RUXa6OPnFF8BJh5xegwwQ==", + "dev": true, + "license": "MIT", + "dependencies": { + "@jest/environment": "^29.7.0", + "@jest/fake-timers": "^29.7.0", + "@jest/globals": "^29.7.0", + "@jest/source-map": "^29.6.3", + "@jest/test-result": "^29.7.0", + "@jest/transform": "^29.7.0", + "@jest/types": "^29.6.3", + "@types/node": "*", + "chalk": "^4.0.0", + "cjs-module-lexer": "^1.0.0", + "collect-v8-coverage": "^1.0.0", + "glob": "^7.1.3", + "graceful-fs": "^4.2.9", + "jest-haste-map": "^29.7.0", + "jest-message-util": "^29.7.0", + "jest-mock": "^29.7.0", + "jest-regex-util": "^29.6.3", + "jest-resolve": "^29.7.0", + "jest-snapshot": "^29.7.0", + "jest-util": "^29.7.0", + "slash": "^3.0.0", + "strip-bom": "^4.0.0" + }, + "engines": { + "node": "^14.15.0 || ^16.10.0 || >=18.0.0" + } + }, + "node_modules/jest-snapshot": { + "version": "29.7.0", + "resolved": "https://registry.npmjs.org/jest-snapshot/-/jest-snapshot-29.7.0.tgz", + "integrity": "sha512-Rm0BMWtxBcioHr1/OX5YCP8Uov4riHvKPknOGs804Zg9JGZgmIBkbtlxJC/7Z4msKYVbIJtfU+tKb8xlYNfdkw==", + "dev": true, + "license": "MIT", + "dependencies": { + "@babel/core": "^7.11.6", + "@babel/generator": "^7.7.2", + "@babel/plugin-syntax-jsx": "^7.7.2", + "@babel/plugin-syntax-typescript": "^7.7.2", + "@babel/types": "^7.3.3", + "@jest/expect-utils": "^29.7.0", + "@jest/transform": "^29.7.0", + "@jest/types": "^29.6.3", + "babel-preset-current-node-syntax": "^1.0.0", + "chalk": "^4.0.0", + "expect": "^29.7.0", + "graceful-fs": "^4.2.9", + "jest-diff": "^29.7.0", + "jest-get-type": "^29.6.3", + "jest-matcher-utils": "^29.7.0", + "jest-message-util": "^29.7.0", + "jest-util": "^29.7.0", + "natural-compare": "^1.4.0", + "pretty-format": "^29.7.0", + "semver": "^7.5.3" + }, + "engines": { + "node": "^14.15.0 || ^16.10.0 || >=18.0.0" + } + }, + "node_modules/jest-snapshot/node_modules/semver": { + "version": "7.7.1", + "resolved": "https://registry.npmjs.org/semver/-/semver-7.7.1.tgz", + "integrity": "sha512-hlq8tAfn0m/61p4BVRcPzIGr6LKiMwo4VM6dGi6pt4qcRkmNzTcWq6eCEjEh+qXjkMDvPlOFFSGwQjoEa6gyMA==", + "dev": true, + "license": "ISC", + "bin": { + "semver": "bin/semver.js" + }, + "engines": { + "node": ">=10" + } + }, + "node_modules/jest-util": { + "version": "29.7.0", + "resolved": "https://registry.npmjs.org/jest-util/-/jest-util-29.7.0.tgz", + "integrity": "sha512-z6EbKajIpqGKU56y5KBUgy1dt1ihhQJgWzUlZHArA/+X2ad7Cb5iF+AK1EWVL/Bo7Rz9uurpqw6SiBCefUbCGA==", + "dev": true, + "license": "MIT", + "dependencies": { + "@jest/types": "^29.6.3", + "@types/node": "*", + "chalk": "^4.0.0", + "ci-info": "^3.2.0", + "graceful-fs": "^4.2.9", + "picomatch": "^2.2.3" + }, + "engines": { + "node": "^14.15.0 || ^16.10.0 || >=18.0.0" + } + }, + "node_modules/jest-validate": { + "version": "29.7.0", + "resolved": "https://registry.npmjs.org/jest-validate/-/jest-validate-29.7.0.tgz", + "integrity": "sha512-ZB7wHqaRGVw/9hST/OuFUReG7M8vKeq0/J2egIGLdvjHCmYqGARhzXmtgi+gVeZ5uXFF219aOc3Ls2yLg27tkw==", + "dev": true, + "license": "MIT", + "dependencies": { + "@jest/types": "^29.6.3", + "camelcase": "^6.2.0", + "chalk": "^4.0.0", + "jest-get-type": "^29.6.3", + "leven": "^3.1.0", + "pretty-format": "^29.7.0" + }, + "engines": { + "node": "^14.15.0 || ^16.10.0 || >=18.0.0" + } + }, + "node_modules/jest-validate/node_modules/camelcase": { + "version": "6.3.0", + "resolved": "https://registry.npmjs.org/camelcase/-/camelcase-6.3.0.tgz", + "integrity": "sha512-Gmy6FhYlCY7uOElZUSbxo2UCDH8owEk996gkbrpsgGtrJLM3J7jGxl9Ic7Qwwj4ivOE5AWZWRMecDdF7hqGjFA==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=10" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/jest-watcher": { + "version": "29.7.0", + "resolved": "https://registry.npmjs.org/jest-watcher/-/jest-watcher-29.7.0.tgz", + "integrity": "sha512-49Fg7WXkU3Vl2h6LbLtMQ/HyB6rXSIX7SqvBLQmssRBGN9I0PNvPmAmCWSOY6SOvrjhI/F7/bGAv9RtnsPA03g==", + "dev": true, + "license": "MIT", + "dependencies": { + "@jest/test-result": "^29.7.0", + "@jest/types": "^29.6.3", + "@types/node": "*", + "ansi-escapes": "^4.2.1", + "chalk": "^4.0.0", + "emittery": "^0.13.1", + "jest-util": "^29.7.0", + "string-length": "^4.0.1" + }, + "engines": { + "node": "^14.15.0 || ^16.10.0 || >=18.0.0" + } + }, + "node_modules/jest-worker": { + "version": "29.7.0", + "resolved": "https://registry.npmjs.org/jest-worker/-/jest-worker-29.7.0.tgz", + "integrity": "sha512-eIz2msL/EzL9UFTFFx7jBTkeZfku0yUAyZZZmJ93H2TYEiroIx2PQjEXcwYtYl8zXCxb+PAmA2hLIt/6ZEkPHw==", + "dev": true, + "license": "MIT", + "dependencies": { + "@types/node": "*", + "jest-util": "^29.7.0", + "merge-stream": "^2.0.0", + "supports-color": "^8.0.0" + }, + "engines": { + "node": "^14.15.0 || ^16.10.0 || >=18.0.0" + } + }, + "node_modules/jest-worker/node_modules/supports-color": { + "version": "8.1.1", + "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-8.1.1.tgz", + "integrity": "sha512-MpUEN2OodtUzxvKQl72cUF7RQ5EiHsGvSsVG0ia9c5RbWGL2CI4C7EpPS8UTBIplnlzZiNuV56w+FuNxy3ty2Q==", + "dev": true, + "license": "MIT", + "dependencies": { + "has-flag": "^4.0.0" + }, + "engines": { + "node": ">=10" + }, + "funding": { + "url": "https://github.com/chalk/supports-color?sponsor=1" + } + }, + "node_modules/js-tokens": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/js-tokens/-/js-tokens-4.0.0.tgz", + "integrity": "sha512-RdJUflcE3cUzKiMqQgsCu06FPu9UdIJO0beYbPhHN4k6apgJtifcoCtT9bcxOpYBtpD2kCM6Sbzg4CausW/PKQ==", + "dev": true, + "license": "MIT" + }, + "node_modules/js-yaml": { + "version": "3.14.1", + "resolved": "https://registry.npmjs.org/js-yaml/-/js-yaml-3.14.1.tgz", + "integrity": "sha512-okMH7OXXJ7YrN9Ok3/SXrnu4iX9yOk+25nqX4imS2npuvTYDmo/QEZoqwZkYaIDk3jVvBOTOIEgEhaLOynBS9g==", + "dev": true, + "license": "MIT", + "dependencies": { + "argparse": "^1.0.7", + "esprima": "^4.0.0" + }, + "bin": { + "js-yaml": "bin/js-yaml.js" + } + }, + "node_modules/jsesc": { + "version": "3.1.0", + "resolved": "https://registry.npmjs.org/jsesc/-/jsesc-3.1.0.tgz", + "integrity": "sha512-/sM3dO2FOzXjKQhJuo0Q173wf2KOo8t4I8vHy6lF9poUp7bKT0/NHE8fPX23PwfhnykfqnC2xRxOnVw5XuGIaA==", + "dev": true, + "license": "MIT", + "bin": { + "jsesc": "bin/jsesc" + }, + "engines": { + "node": ">=6" + } + }, + "node_modules/json-parse-even-better-errors": { + "version": "2.3.1", + "resolved": "https://registry.npmjs.org/json-parse-even-better-errors/-/json-parse-even-better-errors-2.3.1.tgz", + "integrity": "sha512-xyFwyhro/JEof6Ghe2iz2NcXoj2sloNsWr/XsERDK/oiPCfaNhl5ONfp+jQdAZRQQ0IJWNzH9zIZF7li91kh2w==", + "dev": true, + "license": "MIT" + }, + "node_modules/json5": { + "version": "2.2.3", + "resolved": "https://registry.npmjs.org/json5/-/json5-2.2.3.tgz", + "integrity": "sha512-XmOWe7eyHYH14cLdVPoyg+GOH3rYX++KpzrylJwSW98t3Nk+U8XOl8FWKOgwtzdb8lXGf6zYwDUzeHMWfxasyg==", + "dev": true, + "license": "MIT", + "bin": { + "json5": "lib/cli.js" + }, + "engines": { + "node": ">=6" + } + }, + "node_modules/kleur": { + "version": "3.0.3", + "resolved": "https://registry.npmjs.org/kleur/-/kleur-3.0.3.tgz", + "integrity": "sha512-eTIzlVOSUR+JxdDFepEYcBMtZ9Qqdef+rnzWdRZuMbOywu5tO2w2N7rqjoANZ5k9vywhL6Br1VRjUIgTQx4E8w==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=6" + } + }, + "node_modules/leven": { + "version": "3.1.0", + "resolved": "https://registry.npmjs.org/leven/-/leven-3.1.0.tgz", + "integrity": "sha512-qsda+H8jTaUaN/x5vzW2rzc+8Rw4TAQ/4KjB46IwK5VH+IlVeeeje/EoZRpiXvIqjFgK84QffqPztGI3VBLG1A==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=6" + } + }, + "node_modules/libsql": { + "version": "0.5.0-pre.6", + "resolved": "https://registry.npmjs.org/libsql/-/libsql-0.5.0-pre.6.tgz", + "integrity": "sha512-TvugJnL32QiZCvpu6Eh/uh2RjpzsxprqVd2hWygHFUK5abcotaRWYrHmuygXFe43QmsJrmYjN0DAKLqoiy8d2w==", + "cpu": [ + "x64", + "arm64", + "wasm32" + ], + "license": "MIT", + "os": [ + "darwin", + "linux", + "win32" + ], + "dependencies": { + "@neon-rs/load": "^0.0.4", + "detect-libc": "2.0.2" + }, + "optionalDependencies": { + "@libsql/darwin-arm64": "0.5.0-pre.6", + "@libsql/darwin-x64": "0.5.0-pre.6", + "@libsql/linux-arm64-gnu": "0.5.0-pre.6", + "@libsql/linux-arm64-musl": "0.5.0-pre.6", + "@libsql/linux-x64-gnu": "0.5.0-pre.6", + "@libsql/linux-x64-musl": "0.5.0-pre.6", + "@libsql/win32-x64-msvc": "0.5.0-pre.6" + } + }, + "node_modules/lines-and-columns": { + "version": "1.2.4", + "resolved": "https://registry.npmjs.org/lines-and-columns/-/lines-and-columns-1.2.4.tgz", + "integrity": "sha512-7ylylesZQ/PV29jhEDl3Ufjo6ZX7gCqJr5F7PKrqc93v7fzSymt1BpwEU8nAUXs8qzzvqhbjhK5QZg6Mt/HkBg==", + "dev": true, + "license": "MIT" + }, + "node_modules/locate-path": { + "version": "5.0.0", + "resolved": "https://registry.npmjs.org/locate-path/-/locate-path-5.0.0.tgz", + "integrity": "sha512-t7hw9pI+WvuwNJXwk5zVHpyhIqzg2qTlklJOf0mVxGSbe3Fp2VieZcduNYjaLDoy6p9uGpQEGWG87WpMKlNq8g==", + "dev": true, + "license": "MIT", + "dependencies": { + "p-locate": "^4.1.0" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/lru-cache": { + "version": "5.1.1", + "resolved": "https://registry.npmjs.org/lru-cache/-/lru-cache-5.1.1.tgz", + "integrity": "sha512-KpNARQA3Iwv+jTA0utUVVbrh+Jlrr1Fv0e56GGzAFOXN7dk/FviaDW8LHmK52DlcH4WP2n6gI8vN1aesBFgo9w==", + "dev": true, + "license": "ISC", + "dependencies": { + "yallist": "^3.0.2" + } + }, + "node_modules/make-dir": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/make-dir/-/make-dir-4.0.0.tgz", + "integrity": "sha512-hXdUTZYIVOt1Ex//jAQi+wTZZpUpwBj/0QsOzqegb3rGMMeJiSEu5xLHnYfBrRV4RH2+OCSOO95Is/7x1WJ4bw==", + "dev": true, + "license": "MIT", + "dependencies": { + "semver": "^7.5.3" + }, + "engines": { + "node": ">=10" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/make-dir/node_modules/semver": { + "version": "7.7.1", + "resolved": "https://registry.npmjs.org/semver/-/semver-7.7.1.tgz", + "integrity": "sha512-hlq8tAfn0m/61p4BVRcPzIGr6LKiMwo4VM6dGi6pt4qcRkmNzTcWq6eCEjEh+qXjkMDvPlOFFSGwQjoEa6gyMA==", + "dev": true, + "license": "ISC", + "bin": { + "semver": "bin/semver.js" + }, + "engines": { + "node": ">=10" + } + }, + "node_modules/makeerror": { + "version": "1.0.12", + "resolved": "https://registry.npmjs.org/makeerror/-/makeerror-1.0.12.tgz", + "integrity": "sha512-JmqCvUhmt43madlpFzG4BQzG2Z3m6tvQDNKdClZnO3VbIudJYmxsT0FNJMeiB2+JTSlTQTSbU8QdesVmwJcmLg==", + "dev": true, + "license": "BSD-3-Clause", + "dependencies": { + "tmpl": "1.0.5" + } + }, + "node_modules/math-intrinsics": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/math-intrinsics/-/math-intrinsics-1.1.0.tgz", + "integrity": "sha512-/IXtbwEk5HTPyEwyKX6hGkYXxM9nbj64B+ilVJnC/R6B0pH5G4V3b0pVbL7DBj4tkhBAppbQUlf6F6Xl9LHu1g==", + "license": "MIT", + "engines": { + "node": ">= 0.4" + } + }, + "node_modules/merge-stream": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/merge-stream/-/merge-stream-2.0.0.tgz", + "integrity": "sha512-abv/qOcuPfk3URPfDzmZU1LKmuw8kT+0nIHvKrKgFrwifol/doWcdA4ZqsWQ8ENrFKkd67Mfpo/LovbIUsbt3w==", + "dev": true, + "license": "MIT" + }, + "node_modules/micromatch": { + "version": "4.0.8", + "resolved": "https://registry.npmjs.org/micromatch/-/micromatch-4.0.8.tgz", + "integrity": "sha512-PXwfBhYu0hBCPw8Dn0E+WDYb7af3dSLVWKi3HGv84IdF4TyFoC0ysxFd0Goxw7nSv4T/PzEJQxsYsEiFCKo2BA==", + "dev": true, + "license": "MIT", + "dependencies": { + "braces": "^3.0.3", + "picomatch": "^2.3.1" + }, + "engines": { + "node": ">=8.6" + } + }, + "node_modules/mimic-fn": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/mimic-fn/-/mimic-fn-2.1.0.tgz", + "integrity": "sha512-OqbOk5oEQeAZ8WXWydlu9HJjz9WVdEIvamMCcXmuqUYjTknH/sqsWvhQ3vgwKFRR1HpjvNBKQ37nbJgYzGqGcg==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=6" + } + }, + "node_modules/minimatch": { + "version": "3.1.2", + "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-3.1.2.tgz", + "integrity": "sha512-J7p63hRiAjw1NDEww1W7i37+ByIrOWO5XQQAzZ3VOcL0PNybwpfmV/N05zFAzwQ9USyEcX6t3UO+K5aqBQOIHw==", + "license": "ISC", + "dependencies": { + "brace-expansion": "^1.1.7" + }, + "engines": { + "node": "*" + } + }, + "node_modules/minimist": { + "version": "1.2.8", + "resolved": "https://registry.npmjs.org/minimist/-/minimist-1.2.8.tgz", + "integrity": "sha512-2yyAR8qBkN3YuheJanUpWC5U3bb5osDywNB8RzDVlDwDHbocAJveqqj1u8+SVD7jkWT4yvsHCpWqqWqAxb0zCA==", + "license": "MIT", + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/mkdirp": { + "version": "0.5.6", + "resolved": "https://registry.npmjs.org/mkdirp/-/mkdirp-0.5.6.tgz", + "integrity": "sha512-FP+p8RB8OWpF3YZBCrP5gtADmtXApB5AMLn+vdyA+PyxCjrCs00mjyUozssO33cwDeT3wNGdLxJ5M//YqtHAJw==", + "license": "MIT", + "dependencies": { + "minimist": "^1.2.6" + }, + "bin": { + "mkdirp": "bin/cmd.js" + } + }, + "node_modules/ms": { + "version": "2.1.3", + "resolved": "https://registry.npmjs.org/ms/-/ms-2.1.3.tgz", + "integrity": "sha512-6FlzubTLZG3J2a/NVCAleEhjzq5oxgHyaCU9yYXvcLsvoVaHJq/s5xXI6/XXP6tz7R9xAOtHnSO/tXtF3WRTlA==", + "dev": true, + "license": "MIT" + }, + "node_modules/mute-stream": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/mute-stream/-/mute-stream-2.0.0.tgz", + "integrity": "sha512-WWdIxpyjEn+FhQJQQv9aQAYlHoNVdzIzUySNV1gHUPDSdZJ3yZn7pAAbQcV7B56Mvu881q9FZV+0Vx2xC44VWA==", + "license": "ISC", + "engines": { + "node": "^18.17.0 || >=20.5.0" + } + }, + "node_modules/natural-compare": { + "version": "1.4.0", + "resolved": "https://registry.npmjs.org/natural-compare/-/natural-compare-1.4.0.tgz", + "integrity": "sha512-OWND8ei3VtNC9h7V60qff3SVobHr996CTwgxubgyQYEpg290h9J0buyECNNJexkFm5sOajh5G116RYA1c8ZMSw==", + "dev": true, + "license": "MIT" + }, + "node_modules/node-fetch": { + "version": "2.7.0", + "resolved": "https://registry.npmjs.org/node-fetch/-/node-fetch-2.7.0.tgz", + "integrity": "sha512-c4FRfUm/dbcWZ7U+1Wq0AwCyFL+3nt2bEw05wfxSz+DWpWsitgmSgYmy2dQdWyKC1694ELPqMs/YzUSNozLt8A==", + "license": "MIT", + "dependencies": { + "whatwg-url": "^5.0.0" + }, + "engines": { + "node": "4.x || >=6.0.0" + }, + "peerDependencies": { + "encoding": "^0.1.0" + }, + "peerDependenciesMeta": { + "encoding": { + "optional": true + } + } + }, + "node_modules/node-int64": { + "version": "0.4.0", + "resolved": "https://registry.npmjs.org/node-int64/-/node-int64-0.4.0.tgz", + "integrity": "sha512-O5lz91xSOeoXP6DulyHfllpq+Eg00MWitZIbtPfoSEvqIHdl5gfcY6hYzDWnj0qD5tz52PI08u9qUvSVeUBeHw==", + "dev": true, + "license": "MIT" + }, + "node_modules/node-releases": { + "version": "2.0.19", + "resolved": "https://registry.npmjs.org/node-releases/-/node-releases-2.0.19.tgz", + "integrity": "sha512-xxOWJsBKtzAq7DY0J+DTzuz58K8e7sJbdgwkbMWQe8UYB6ekmsQ45q0M/tJDsGaZmbC+l7n57UV8Hl5tHxO9uw==", + "dev": true, + "license": "MIT" + }, + "node_modules/normalize-path": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/normalize-path/-/normalize-path-3.0.0.tgz", + "integrity": "sha512-6eZs5Ls3WtCisHWp9S2GUy8dqkpGi4BVSz3GaqiE6ezub0512ESztXUwUB6C6IKbQkY2Pnb/mD4WYojCRwcwLA==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/npm-run-path": { + "version": "4.0.1", + "resolved": "https://registry.npmjs.org/npm-run-path/-/npm-run-path-4.0.1.tgz", + "integrity": "sha512-S48WzZW777zhNIrn7gxOlISNAqi9ZC/uQFnRdbeIHhZhCA6UqpkOT8T1G7BvfdgP4Er8gF4sUbaS0i7QvIfCWw==", + "dev": true, + "license": "MIT", + "dependencies": { + "path-key": "^3.0.0" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/object-inspect": { + "version": "1.13.4", + "resolved": "https://registry.npmjs.org/object-inspect/-/object-inspect-1.13.4.tgz", + "integrity": "sha512-W67iLl4J2EXEGTbfeHCffrjDfitvLANg0UlX3wFUUSTx92KXRFegMHUVgSqE+wvhAbi4WqjGg9czysTV2Epbew==", + "license": "MIT", + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/once": { + "version": "1.4.0", + "resolved": "https://registry.npmjs.org/once/-/once-1.4.0.tgz", + "integrity": "sha512-lNaJgI+2Q5URQBkccEKHTQOPaXdUxnZZElQTZY0MFUAuaEqe1E+Nyvgdz/aIyNi6Z9MzO5dv1H8n58/GELp3+w==", + "license": "ISC", + "dependencies": { + "wrappy": "1" + } + }, + "node_modules/onetime": { + "version": "5.1.2", + "resolved": "https://registry.npmjs.org/onetime/-/onetime-5.1.2.tgz", + "integrity": "sha512-kbpaSSGJTWdAY5KPVeMOKXSrPtr8C8C7wodJbcsd51jRnmD+GZu8Y0VoU6Dm5Z4vWr0Ig/1NKuWRKf7j5aaYSg==", + "dev": true, + "license": "MIT", + "dependencies": { + "mimic-fn": "^2.1.0" + }, + "engines": { + "node": ">=6" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/p-limit": { + "version": "3.1.0", + "resolved": "https://registry.npmjs.org/p-limit/-/p-limit-3.1.0.tgz", + "integrity": "sha512-TYOanM3wGwNGsZN2cVTYPArw454xnXj5qmWF1bEoAc4+cU/ol7GVh7odevjp1FNHduHc3KZMcFduxU5Xc6uJRQ==", + "dev": true, + "license": "MIT", + "dependencies": { + "yocto-queue": "^0.1.0" + }, + "engines": { + "node": ">=10" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/p-locate": { + "version": "4.1.0", + "resolved": "https://registry.npmjs.org/p-locate/-/p-locate-4.1.0.tgz", + "integrity": "sha512-R79ZZ/0wAxKGu3oYMlz8jy/kbhsNrS7SKZ7PxEHBgJ5+F2mtFW2fK2cOtBh1cHYkQsbzFV7I+EoRKe6Yt0oK7A==", + "dev": true, + "license": "MIT", + "dependencies": { + "p-limit": "^2.2.0" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/p-locate/node_modules/p-limit": { + "version": "2.3.0", + "resolved": "https://registry.npmjs.org/p-limit/-/p-limit-2.3.0.tgz", + "integrity": "sha512-//88mFWSJx8lxCzwdAABTJL2MyWB12+eIY7MDL2SqLmAkeKU9qxRvWuSyTjm3FUmpBEMuFfckAIqEaVGUDxb6w==", + "dev": true, + "license": "MIT", + "dependencies": { + "p-try": "^2.0.0" + }, + "engines": { + "node": ">=6" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/p-try": { + "version": "2.2.0", + "resolved": "https://registry.npmjs.org/p-try/-/p-try-2.2.0.tgz", + "integrity": "sha512-R4nPAVTAU0B9D35/Gk3uJf/7XYbQcyohSKdvAxIRSNghFl4e71hVoGnBNQz9cWaXxO2I10KTC+3jMdvvoKw6dQ==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=6" + } + }, + "node_modules/papaparse": { + "version": "5.5.2", + "resolved": "https://registry.npmjs.org/papaparse/-/papaparse-5.5.2.tgz", + "integrity": "sha512-PZXg8UuAc4PcVwLosEEDYjPyfWnTEhOrUfdv+3Bx+NuAb+5NhDmXzg5fHWmdCh1mP5p7JAZfFr3IMQfcntNAdA==", + "license": "MIT" + }, + "node_modules/parse-json": { + "version": "5.2.0", + "resolved": "https://registry.npmjs.org/parse-json/-/parse-json-5.2.0.tgz", + "integrity": "sha512-ayCKvm/phCGxOkYRSCM82iDwct8/EonSEgCSxWxD7ve6jHggsFl4fZVQBPRNgQoKiuV/odhFrGzQXZwbifC8Rg==", + "dev": true, + "license": "MIT", + "dependencies": { + "@babel/code-frame": "^7.0.0", + "error-ex": "^1.3.1", + "json-parse-even-better-errors": "^2.3.0", + "lines-and-columns": "^1.1.6" + }, + "engines": { + "node": ">=8" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/path": { + "version": "0.12.7", + "resolved": "https://registry.npmjs.org/path/-/path-0.12.7.tgz", + "integrity": "sha512-aXXC6s+1w7otVF9UletFkFcDsJeO7lSZBPUQhtb5O0xJe8LtYhj/GxldoL09bBj9+ZmE2hNoHqQSFMN5fikh4Q==", + "license": "MIT", + "dependencies": { + "process": "^0.11.1", + "util": "^0.10.3" + } + }, + "node_modules/path-exists": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/path-exists/-/path-exists-4.0.0.tgz", + "integrity": "sha512-ak9Qy5Q7jYb2Wwcey5Fpvg2KoAc/ZIhLSLOSBmRmygPsGwkVVt0fZa0qrtMz+m6tJTAHfZQ8FnmB4MG4LWy7/w==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=8" + } + }, + "node_modules/path-is-absolute": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/path-is-absolute/-/path-is-absolute-1.0.1.tgz", + "integrity": "sha512-AVbw3UJ2e9bq64vSaS9Am0fje1Pa8pbGqTTsmXfaIiMpnr5DlDhfJOuLj9Sf95ZPVDAUerDfEk88MPmPe7UCQg==", + "license": "MIT", + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/path-key": { + "version": "3.1.1", + "resolved": "https://registry.npmjs.org/path-key/-/path-key-3.1.1.tgz", + "integrity": "sha512-ojmeN0qd+y0jszEtoY48r0Peq5dwMEkIlCOu6Q5f41lfkswXuKtYrhgoTpLnyIcHm24Uhqx+5Tqm2InSwLhE6Q==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=8" + } + }, + "node_modules/path-parse": { + "version": "1.0.7", + "resolved": "https://registry.npmjs.org/path-parse/-/path-parse-1.0.7.tgz", + "integrity": "sha512-LDJzPVEEEPR+y48z93A0Ed0yXb8pAByGWo/k5YYdYgpY2/2EsOsksJrq7lOHxryrVOn1ejG6oAp8ahvOIQD8sw==", + "dev": true, + "license": "MIT" + }, + "node_modules/picocolors": { + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/picocolors/-/picocolors-1.1.1.tgz", + "integrity": "sha512-xceH2snhtb5M9liqDsmEw56le376mTZkEX/jEb/RxNFyegNul7eNslCXP9FDj/Lcu0X8KEyMceP2ntpaHrDEVA==", + "dev": true, + "license": "ISC" + }, + "node_modules/picomatch": { + "version": "2.3.1", + "resolved": "https://registry.npmjs.org/picomatch/-/picomatch-2.3.1.tgz", + "integrity": "sha512-JU3teHTNjmE2VCGFzuY8EXzCDVwEqB2a8fsIvwaStHhAWJEeVd1o1QD80CU6+ZdEXXSLbSsuLwJjkCBWqRQUVA==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=8.6" + }, + "funding": { + "url": "https://github.com/sponsors/jonschlinkert" + } + }, + "node_modules/pirates": { + "version": "4.0.6", + "resolved": "https://registry.npmjs.org/pirates/-/pirates-4.0.6.tgz", + "integrity": "sha512-saLsH7WeYYPiD25LDuLRRY/i+6HaPYr6G1OUlN39otzkSTxKnubR9RTxS3/Kk50s1g2JTgFwWQDQyplC5/SHZg==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">= 6" + } + }, + "node_modules/pkg-dir": { + "version": "4.2.0", + "resolved": "https://registry.npmjs.org/pkg-dir/-/pkg-dir-4.2.0.tgz", + "integrity": "sha512-HRDzbaKjC+AOWVXxAU/x54COGeIv9eb+6CkDSQoNTt4XyWoIJvuPsXizxu/Fr23EiekbtZwmh1IcIG/l/a10GQ==", + "dev": true, + "license": "MIT", + "dependencies": { + "find-up": "^4.0.0" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/pretty-format": { + "version": "29.7.0", + "resolved": "https://registry.npmjs.org/pretty-format/-/pretty-format-29.7.0.tgz", + "integrity": "sha512-Pdlw/oPxN+aXdmM9R00JVC9WVFoCLTKJvDVLgmJ+qAffBMxsV85l/Lu7sNx4zSzPyoL2euImuEwHhOXdEgNFZQ==", + "dev": true, + "license": "MIT", + "dependencies": { + "@jest/schemas": "^29.6.3", + "ansi-styles": "^5.0.0", + "react-is": "^18.0.0" + }, + "engines": { + "node": "^14.15.0 || ^16.10.0 || >=18.0.0" + } + }, + "node_modules/pretty-format/node_modules/ansi-styles": { + "version": "5.2.0", + "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-5.2.0.tgz", + "integrity": "sha512-Cxwpt2SfTzTtXcfOlzGEee8O+c+MmUgGrNiBcXnuWxuFJHe6a5Hz7qwhwe5OgaSYI0IJvkLqWX1ASG+cJOkEiA==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=10" + }, + "funding": { + "url": "https://github.com/chalk/ansi-styles?sponsor=1" + } + }, + "node_modules/printj": { + "version": "1.1.2", + "resolved": "https://registry.npmjs.org/printj/-/printj-1.1.2.tgz", + "integrity": "sha512-zA2SmoLaxZyArQTOPj5LXecR+RagfPSU5Kw1qP+jkWeNlrq+eJZyY2oS68SU1Z/7/myXM4lo9716laOFAVStCQ==", + "license": "Apache-2.0", + "bin": { + "printj": "bin/printj.njs" + }, + "engines": { + "node": ">=0.8" + } + }, + "node_modules/process": { + "version": "0.11.10", + "resolved": "https://registry.npmjs.org/process/-/process-0.11.10.tgz", + "integrity": "sha512-cdGef/drWFoydD1JsMzuFf8100nZl+GT+yacc2bEced5f9Rjk4z+WtFUTBu9PhOi9j/jfmBPu0mMEY4wIdAF8A==", + "license": "MIT", + "engines": { + "node": ">= 0.6.0" + } + }, + "node_modules/prompts": { + "version": "2.4.2", + "resolved": "https://registry.npmjs.org/prompts/-/prompts-2.4.2.tgz", + "integrity": "sha512-NxNv/kLguCA7p3jE8oL2aEBsrJWgAakBpgmgK6lpPWV+WuOmY6r2/zbAVnP+T8bQlA0nzHXSJSJW0Hq7ylaD2Q==", + "dev": true, + "license": "MIT", + "dependencies": { + "kleur": "^3.0.3", + "sisteransi": "^1.0.5" + }, + "engines": { + "node": ">= 6" + } + }, + "node_modules/punycode": { + "version": "1.4.1", + "resolved": "https://registry.npmjs.org/punycode/-/punycode-1.4.1.tgz", + "integrity": "sha512-jmYNElW7yvO7TV33CjSmvSiE2yco3bV2czu/OzDKdMNVZQWfxCblURLhf+47syQRBntjfLdd/H0egrzIG+oaFQ==", + "license": "MIT" + }, + "node_modules/pure-rand": { + "version": "6.1.0", + "resolved": "https://registry.npmjs.org/pure-rand/-/pure-rand-6.1.0.tgz", + "integrity": "sha512-bVWawvoZoBYpp6yIoQtQXHZjmz35RSVHnUOTefl8Vcjr8snTPY1wnpSPMWekcFwbxI6gtmT7rSYPFvz71ldiOA==", + "dev": true, + "funding": [ + { + "type": "individual", + "url": "https://github.com/sponsors/dubzzz" + }, + { + "type": "opencollective", + "url": "https://opencollective.com/fast-check" + } + ], + "license": "MIT" + }, + "node_modules/qs": { + "version": "6.14.0", + "resolved": "https://registry.npmjs.org/qs/-/qs-6.14.0.tgz", + "integrity": "sha512-YWWTjgABSKcvs/nWBi9PycY/JiPJqOD4JA6o9Sej2AtvSGarXxKC3OQSk4pAarbdQlKAh5D4FCQkJNkW+GAn3w==", + "license": "BSD-3-Clause", + "dependencies": { + "side-channel": "^1.1.0" + }, + "engines": { + "node": ">=0.6" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/react-is": { + "version": "18.3.1", + "resolved": "https://registry.npmjs.org/react-is/-/react-is-18.3.1.tgz", + "integrity": "sha512-/LLMVyas0ljjAtoYiPqYiL8VWXzUUdThrmU5+n20DZv+a+ClRoevUzw5JxU+Ieh5/c87ytoTBV9G1FiKfNJdmg==", + "dev": true, + "license": "MIT" + }, + "node_modules/require-directory": { + "version": "2.1.1", + "resolved": "https://registry.npmjs.org/require-directory/-/require-directory-2.1.1.tgz", + "integrity": "sha512-fGxEI7+wsG9xrvdjsrlmL22OMTTiHRwAMroiEeMgq8gzoLC/PQr7RsRDSTLUg/bZAZtF+TVIkHc6/4RIKrui+Q==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/resolve": { + "version": "1.22.10", + "resolved": "https://registry.npmjs.org/resolve/-/resolve-1.22.10.tgz", + "integrity": "sha512-NPRy+/ncIMeDlTAsuqwKIiferiawhefFJtkNSW0qZJEqMEb+qBt/77B/jGeeek+F0uOeN05CDa6HXbbIgtVX4w==", + "dev": true, + "license": "MIT", + "dependencies": { + "is-core-module": "^2.16.0", + "path-parse": "^1.0.7", + "supports-preserve-symlinks-flag": "^1.0.0" + }, + "bin": { + "resolve": "bin/resolve" + }, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/resolve-cwd": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/resolve-cwd/-/resolve-cwd-3.0.0.tgz", + "integrity": "sha512-OrZaX2Mb+rJCpH/6CpSqt9xFVpN++x01XnN2ie9g6P5/3xelLAkXWVADpdz1IHD/KFfEXyE6V0U01OQ3UO2rEg==", + "dev": true, + "license": "MIT", + "dependencies": { + "resolve-from": "^5.0.0" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/resolve-from": { + "version": "5.0.0", + "resolved": "https://registry.npmjs.org/resolve-from/-/resolve-from-5.0.0.tgz", + "integrity": "sha512-qYg9KP24dD5qka9J47d0aVky0N+b4fTU89LN9iDnjB5waksiC49rvMB0PrUJQGoTmH50XPiqOvAjDfaijGxYZw==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=8" + } + }, + "node_modules/resolve.exports": { + "version": "2.0.3", + "resolved": "https://registry.npmjs.org/resolve.exports/-/resolve.exports-2.0.3.tgz", + "integrity": "sha512-OcXjMsGdhL4XnbShKpAcSqPMzQoYkYyhbEaeSko47MjRP9NfEQMhZkXL1DoFlt9LWQn4YttrdnV6X2OiyzBi+A==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=10" + } + }, + "node_modules/rimraf": { + "version": "2.6.3", + "resolved": "https://registry.npmjs.org/rimraf/-/rimraf-2.6.3.tgz", + "integrity": "sha512-mwqeW5XsA2qAejG46gYdENaxXjx9onRNCfn7L0duuP4hCuTIi/QO7PDK07KJfp1d+izWPrzEJDcSqBa0OZQriA==", + "deprecated": "Rimraf versions prior to v4 are no longer supported", + "license": "ISC", + "dependencies": { + "glob": "^7.1.3" + }, + "bin": { + "rimraf": "bin.js" + } + }, + "node_modules/run-async": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/run-async/-/run-async-3.0.0.tgz", + "integrity": "sha512-540WwVDOMxA6dN6We19EcT9sc3hkXPw5mzRNGM3FkdN/vtE9NFvj5lFAPNwUDmJjXidm3v7TC1cTE7t17Ulm1Q==", + "license": "MIT", + "engines": { + "node": ">=0.12.0" + } + }, + "node_modules/rxjs": { + "version": "7.8.2", + "resolved": "https://registry.npmjs.org/rxjs/-/rxjs-7.8.2.tgz", + "integrity": "sha512-dhKf903U/PQZY6boNNtAGdWbG85WAbjT/1xYoZIC7FAY0yWapOBQVsVrDl58W86//e1VpMNBtRV4MaXfdMySFA==", + "license": "Apache-2.0", + "dependencies": { + "tslib": "^2.1.0" + } + }, + "node_modules/safer-buffer": { + "version": "2.1.2", + "resolved": "https://registry.npmjs.org/safer-buffer/-/safer-buffer-2.1.2.tgz", + "integrity": "sha512-YZo3K82SD7Riyi0E1EQPojLz7kpepnSQI9IyPbHHg1XXXevb5dJI7tpyN2ADxGcQbHG7vcyRHk0cbwqcQriUtg==", + "license": "MIT" + }, + "node_modules/sax": { + "version": "1.4.1", + "resolved": "https://registry.npmjs.org/sax/-/sax-1.4.1.tgz", + "integrity": "sha512-+aWOz7yVScEGoKNd4PA10LZ8sk0A/z5+nXQG5giUO5rprX9jgYsTdov9qCchZiPIZezbZH+jRut8nPodFAX4Jg==", + "license": "ISC" + }, + "node_modules/semver": { + "version": "6.3.1", + "resolved": "https://registry.npmjs.org/semver/-/semver-6.3.1.tgz", + "integrity": "sha512-BR7VvDCVHO+q2xBEWskxS6DJE1qRnb7DxzUrogb71CWoSficBxYsiAGd+Kl0mmq/MprG9yArRkyrQxTO6XjMzA==", + "dev": true, + "license": "ISC", + "bin": { + "semver": "bin/semver.js" + } + }, + "node_modules/shebang-command": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/shebang-command/-/shebang-command-2.0.0.tgz", + "integrity": "sha512-kHxr2zZpYtdmrN1qDjrrX/Z1rR1kG8Dx+gkpK1G4eXmvXswmcE1hTWBWYUzlraYw1/yZp6YuDY77YtvbN0dmDA==", + "dev": true, + "license": "MIT", + "dependencies": { + "shebang-regex": "^3.0.0" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/shebang-regex": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/shebang-regex/-/shebang-regex-3.0.0.tgz", + "integrity": "sha512-7++dFhtcx3353uBaq8DDR4NuxBetBzC7ZQOhmTQInHEd6bSrXdiEyzCvG07Z44UYdLShWUyXt5M/yhz8ekcb1A==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=8" + } + }, + "node_modules/side-channel": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/side-channel/-/side-channel-1.1.0.tgz", + "integrity": "sha512-ZX99e6tRweoUXqR+VBrslhda51Nh5MTQwou5tnUDgbtyM0dBgmhEDtWGP/xbKn6hqfPRHujUNwz5fy/wbbhnpw==", + "license": "MIT", + "dependencies": { + "es-errors": "^1.3.0", + "object-inspect": "^1.13.3", + "side-channel-list": "^1.0.0", + "side-channel-map": "^1.0.1", + "side-channel-weakmap": "^1.0.2" + }, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/side-channel-list": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/side-channel-list/-/side-channel-list-1.0.0.tgz", + "integrity": "sha512-FCLHtRD/gnpCiCHEiJLOwdmFP+wzCmDEkc9y7NsYxeF4u7Btsn1ZuwgwJGxImImHicJArLP4R0yX4c2KCrMrTA==", + "license": "MIT", + "dependencies": { + "es-errors": "^1.3.0", + "object-inspect": "^1.13.3" + }, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/side-channel-map": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/side-channel-map/-/side-channel-map-1.0.1.tgz", + "integrity": "sha512-VCjCNfgMsby3tTdo02nbjtM/ewra6jPHmpThenkTYh8pG9ucZ/1P8So4u4FGBek/BjpOVsDCMoLA/iuBKIFXRA==", + "license": "MIT", + "dependencies": { + "call-bound": "^1.0.2", + "es-errors": "^1.3.0", + "get-intrinsic": "^1.2.5", + "object-inspect": "^1.13.3" + }, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/side-channel-weakmap": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/side-channel-weakmap/-/side-channel-weakmap-1.0.2.tgz", + "integrity": "sha512-WPS/HvHQTYnHisLo9McqBHOJk2FkHO/tlpvldyrnem4aeQp4hai3gythswg6p01oSoTl58rcpiFAjF2br2Ak2A==", + "license": "MIT", + "dependencies": { + "call-bound": "^1.0.2", + "es-errors": "^1.3.0", + "get-intrinsic": "^1.2.5", + "object-inspect": "^1.13.3", + "side-channel-map": "^1.0.1" + }, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/signal-exit": { + "version": "4.1.0", + "resolved": "https://registry.npmjs.org/signal-exit/-/signal-exit-4.1.0.tgz", + "integrity": "sha512-bzyZ1e88w9O1iNJbKnOlvYTrWPDl46O1bG0D3XInv+9tkPrxrN8jUUTiFlDkkmKWgn1M6CfIA13SuGqOa9Korw==", + "license": "ISC", + "engines": { + "node": ">=14" + }, + "funding": { + "url": "https://github.com/sponsors/isaacs" + } + }, + "node_modules/sisteransi": { + "version": "1.0.5", + "resolved": "https://registry.npmjs.org/sisteransi/-/sisteransi-1.0.5.tgz", + "integrity": "sha512-bLGGlR1QxBcynn2d5YmDX4MGjlZvy2MRBDRNHLJ8VI6l6+9FUiyTFNJ0IveOSP0bcXgVDPRcfGqA0pjaqUpfVg==", + "dev": true, + "license": "MIT" + }, + "node_modules/slash": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/slash/-/slash-3.0.0.tgz", + "integrity": "sha512-g9Q1haeby36OSStwb4ntCGGGaKsaVSjQ68fBxoQcutl5fS1vuY18H3wSt3jFyFtrkx+Kz0V1G85A4MyAdDMi2Q==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=8" + } + }, + "node_modules/source-map": { + "version": "0.6.1", + "resolved": "https://registry.npmjs.org/source-map/-/source-map-0.6.1.tgz", + "integrity": "sha512-UjgapumWlbMhkBgzT7Ykc5YXUT46F0iKu8SGXq0bcwP5dz/h0Plj6enJqjz1Zbq2l5WaqYnrVbwWOWMyF3F47g==", + "dev": true, + "license": "BSD-3-Clause", + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/source-map-support": { + "version": "0.5.13", + "resolved": "https://registry.npmjs.org/source-map-support/-/source-map-support-0.5.13.tgz", + "integrity": "sha512-SHSKFHadjVA5oR4PPqhtAVdcBWwRYVd6g6cAXnIbRiIwc2EhPrTuKUBdSLvlEKyIP3GCf89fltvcZiP9MMFA1w==", + "dev": true, + "license": "MIT", + "dependencies": { + "buffer-from": "^1.0.0", + "source-map": "^0.6.0" + } + }, + "node_modules/sprintf-js": { + "version": "1.0.3", + "resolved": "https://registry.npmjs.org/sprintf-js/-/sprintf-js-1.0.3.tgz", + "integrity": "sha512-D9cPgkvLlV3t3IzL0D0YLvGA9Ahk4PcvVwUbN0dSGr1aP0Nrt4AEnTUbuGvquEC0mA64Gqt1fzirlRs5ibXx8g==", + "dev": true, + "license": "BSD-3-Clause" + }, + "node_modules/ssf": { + "version": "0.11.2", + "resolved": "https://registry.npmjs.org/ssf/-/ssf-0.11.2.tgz", + "integrity": "sha512-+idbmIXoYET47hH+d7dfm2epdOMUDjqcB4648sTZ+t2JwoyBFL/insLfB/racrDmsKB3diwsDA696pZMieAC5g==", + "license": "Apache-2.0", + "dependencies": { + "frac": "~1.1.2" + }, + "engines": { + "node": ">=0.8" + } + }, + "node_modules/stack-utils": { + "version": "2.0.6", + "resolved": "https://registry.npmjs.org/stack-utils/-/stack-utils-2.0.6.tgz", + "integrity": "sha512-XlkWvfIm6RmsWtNJx+uqtKLS8eqFbxUg0ZzLXqY0caEy9l7hruX8IpiDnjsLavoBgqCCR71TqWO8MaXYheJ3RQ==", + "dev": true, + "license": "MIT", + "dependencies": { + "escape-string-regexp": "^2.0.0" + }, + "engines": { + "node": ">=10" + } + }, + "node_modules/string-length": { + "version": "4.0.2", + "resolved": "https://registry.npmjs.org/string-length/-/string-length-4.0.2.tgz", + "integrity": "sha512-+l6rNN5fYHNhZZy41RXsYptCjA2Igmq4EG7kZAYFQI1E1VTXarr6ZPXBg6eq7Y6eK4FEhY6AJlyuFIb/v/S0VQ==", + "dev": true, + "license": "MIT", + "dependencies": { + "char-regex": "^1.0.2", + "strip-ansi": "^6.0.0" + }, + "engines": { + "node": ">=10" + } + }, + "node_modules/string-width": { + "version": "4.2.3", + "resolved": "https://registry.npmjs.org/string-width/-/string-width-4.2.3.tgz", + "integrity": "sha512-wKyQRQpjJ0sIp62ErSZdGsjMJWsap5oRNihHhu6G7JVO/9jIB6UyevL+tXuOqrng8j/cxKTWyWUwvSTriiZz/g==", + "license": "MIT", + "dependencies": { + "emoji-regex": "^8.0.0", + "is-fullwidth-code-point": "^3.0.0", + "strip-ansi": "^6.0.1" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/strip-ansi": { + "version": "6.0.1", + "resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-6.0.1.tgz", + "integrity": "sha512-Y38VPSHcqkFrCpFnQ9vuSXmquuv5oXOKpGeT6aGrr3o3Gc9AlVa6JBfUSOCnbxGGZF+/0ooI7KrPuUSztUdU5A==", + "license": "MIT", + "dependencies": { + "ansi-regex": "^5.0.1" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/strip-bom": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/strip-bom/-/strip-bom-4.0.0.tgz", + "integrity": "sha512-3xurFv5tEgii33Zi8Jtp55wEIILR9eh34FAW00PZf+JnSsTmV/ioewSgQl97JHvgjoRGwPShsWm+IdrxB35d0w==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=8" + } + }, + "node_modules/strip-final-newline": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/strip-final-newline/-/strip-final-newline-2.0.0.tgz", + "integrity": "sha512-BrpvfNAE3dcvq7ll3xVumzjKjZQ5tI1sEUIKr3Uoks0XUl45St3FlatVqef9prk4jRDzhW6WZg+3bk93y6pLjA==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=6" + } + }, + "node_modules/strip-json-comments": { + "version": "3.1.1", + "resolved": "https://registry.npmjs.org/strip-json-comments/-/strip-json-comments-3.1.1.tgz", + "integrity": "sha512-6fPc+R4ihwqP6N/aIv2f1gMH8lOVtWQHoqC4yK6oSDVVocumAsfCqjkXnqiYMhmMwS/mEHLp7Vehlt3ql6lEig==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=8" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/supports-color": { + "version": "7.2.0", + "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-7.2.0.tgz", + "integrity": "sha512-qpCAvRl9stuOHveKsn7HncJRvv501qIacKzQlO/+Lwxc9+0q2wLyv4Dfvt80/DPn2pqOBsJdDiogXGR9+OvwRw==", + "dev": true, + "license": "MIT", + "dependencies": { + "has-flag": "^4.0.0" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/supports-preserve-symlinks-flag": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/supports-preserve-symlinks-flag/-/supports-preserve-symlinks-flag-1.0.0.tgz", + "integrity": "sha512-ot0WnXS9fgdkgIcePe6RHNk1WA8+muPa6cSjeR3V8K27q9BB1rTE3R1p7Hv0z1ZyAc8s6Vvv8DIyWf681MAt0w==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/temp": { + "version": "0.9.4", + "resolved": "https://registry.npmjs.org/temp/-/temp-0.9.4.tgz", + "integrity": "sha512-yYrrsWnrXMcdsnu/7YMYAofM1ktpL5By7vZhf15CrXijWWrEYZks5AXBudalfSWJLlnen/QUJUB5aoB0kqZUGA==", + "license": "MIT", + "dependencies": { + "mkdirp": "^0.5.1", + "rimraf": "~2.6.2" + }, + "engines": { + "node": ">=6.0.0" + } + }, + "node_modules/test-exclude": { + "version": "6.0.0", + "resolved": "https://registry.npmjs.org/test-exclude/-/test-exclude-6.0.0.tgz", + "integrity": "sha512-cAGWPIyOHU6zlmg88jwm7VRyXnMN7iV68OGAbYDk/Mh/xC/pzVPlQtY6ngoIH/5/tciuhGfvESU8GrHrcxD56w==", + "dev": true, + "license": "ISC", + "dependencies": { + "@istanbuljs/schema": "^0.1.2", + "glob": "^7.1.4", + "minimatch": "^3.0.4" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/tmpl": { + "version": "1.0.5", + "resolved": "https://registry.npmjs.org/tmpl/-/tmpl-1.0.5.tgz", + "integrity": "sha512-3f0uOEAQwIqGuWW2MVzYg8fV/QNnc/IpuJNG837rLuczAaLVHslWHZQj4IGiEl5Hs3kkbhwL9Ab7Hrsmuj+Smw==", + "dev": true, + "license": "BSD-3-Clause" + }, + "node_modules/to-regex-range": { + "version": "5.0.1", + "resolved": "https://registry.npmjs.org/to-regex-range/-/to-regex-range-5.0.1.tgz", + "integrity": "sha512-65P7iz6X5yEr1cwcgvQxbbIw7Uk3gOy5dIdtZ4rDveLqhrdJP+Li/Hx6tyK0NEb+2GCyneCMJiGqrADCSNk8sQ==", + "dev": true, + "license": "MIT", + "dependencies": { + "is-number": "^7.0.0" + }, + "engines": { + "node": ">=8.0" + } + }, + "node_modules/tr46": { + "version": "0.0.3", + "resolved": "https://registry.npmjs.org/tr46/-/tr46-0.0.3.tgz", + "integrity": "sha512-N3WMsuqV66lT30CrXNbEjx4GEwlow3v6rr4mCcv6prnfwhS01rkgyFdjPNBYd9br7LpXV1+Emh01fHnq2Gdgrw==", + "license": "MIT" + }, + "node_modules/tslib": { + "version": "2.8.1", + "resolved": "https://registry.npmjs.org/tslib/-/tslib-2.8.1.tgz", + "integrity": "sha512-oJFu94HQb+KVduSUQL7wnpmqnfmLsOA/nAh6b6EH0wCEoK0/mPeXU6c3wKDV83MkOuHPRHtSXKKU99IBazS/2w==", + "license": "0BSD" + }, + "node_modules/type-detect": { + "version": "4.0.8", + "resolved": "https://registry.npmjs.org/type-detect/-/type-detect-4.0.8.tgz", + "integrity": "sha512-0fr/mIH1dlO+x7TlcMy+bIDqKPsw/70tVyeHW787goQjhmqaZe10uwLujubK9q9Lg6Fiho1KUKDYz0Z7k7g5/g==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=4" + } + }, + "node_modules/type-fest": { + "version": "0.21.3", + "resolved": "https://registry.npmjs.org/type-fest/-/type-fest-0.21.3.tgz", + "integrity": "sha512-t0rzBq87m3fVcduHDUFhKmyyX+9eo6WQjZvf51Ea/M0Q7+T374Jp1aUiyUl0GKxp8M/OETVHSDvmkyPgvX+X2w==", + "license": "(MIT OR CC0-1.0)", + "engines": { + "node": ">=10" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/undici-types": { + "version": "6.20.0", + "resolved": "https://registry.npmjs.org/undici-types/-/undici-types-6.20.0.tgz", + "integrity": "sha512-Ny6QZ2Nju20vw1SRHe3d9jVu6gJ+4e3+MMpqu7pqE5HT6WsTSlce++GQmK5UXS8mzV8DSYHrQH+Xrf2jVcuKNg==", + "devOptional": true, + "license": "MIT" + }, + "node_modules/update-browserslist-db": { + "version": "1.1.3", + "resolved": "https://registry.npmjs.org/update-browserslist-db/-/update-browserslist-db-1.1.3.tgz", + "integrity": "sha512-UxhIZQ+QInVdunkDAaiazvvT/+fXL5Osr0JZlJulepYu6Jd7qJtDZjlur0emRlT71EN3ScPoE7gvsuIKKNavKw==", + "dev": true, + "funding": [ + { + "type": "opencollective", + "url": "https://opencollective.com/browserslist" + }, + { + "type": "tidelift", + "url": "https://tidelift.com/funding/github/npm/browserslist" + }, + { + "type": "github", + "url": "https://github.com/sponsors/ai" + } + ], + "license": "MIT", + "dependencies": { + "escalade": "^3.2.0", + "picocolors": "^1.1.1" + }, + "bin": { + "update-browserslist-db": "cli.js" + }, + "peerDependencies": { + "browserslist": ">= 4.21.0" + } + }, + "node_modules/url": { + "version": "0.11.4", + "resolved": "https://registry.npmjs.org/url/-/url-0.11.4.tgz", + "integrity": "sha512-oCwdVC7mTuWiPyjLUz/COz5TLk6wgp0RCsN+wHZ2Ekneac9w8uuV0njcbbie2ME+Vs+d6duwmYuR3HgQXs1fOg==", + "license": "MIT", + "dependencies": { + "punycode": "^1.4.1", + "qs": "^6.12.3" + }, + "engines": { + "node": ">= 0.4" + } + }, + "node_modules/util": { + "version": "0.10.4", + "resolved": "https://registry.npmjs.org/util/-/util-0.10.4.tgz", + "integrity": "sha512-0Pm9hTQ3se5ll1XihRic3FDIku70C+iHUdT/W926rSgHV5QgXsYbKZN8MSC3tJtSkhuROzvsQjAaFENRXr+19A==", + "license": "MIT", + "dependencies": { + "inherits": "2.0.3" + } + }, + "node_modules/v8-to-istanbul": { + "version": "9.3.0", + "resolved": "https://registry.npmjs.org/v8-to-istanbul/-/v8-to-istanbul-9.3.0.tgz", + "integrity": "sha512-kiGUalWN+rgBJ/1OHZsBtU4rXZOfj/7rKQxULKlIzwzQSvMJUUNgPwJEEh7gU6xEVxC0ahoOBvN2YI8GH6FNgA==", + "dev": true, + "license": "ISC", + "dependencies": { + "@jridgewell/trace-mapping": "^0.3.12", + "@types/istanbul-lib-coverage": "^2.0.1", + "convert-source-map": "^2.0.0" + }, + "engines": { + "node": ">=10.12.0" + } + }, + "node_modules/walker": { + "version": "1.0.8", + "resolved": "https://registry.npmjs.org/walker/-/walker-1.0.8.tgz", + "integrity": "sha512-ts/8E8l5b7kY0vlWLewOkDXMmPdLcVV4GmOQLyxuSswIJsweeFZtAsMF7k1Nszz+TYBQrlYRmzOnr398y1JemQ==", + "dev": true, + "license": "Apache-2.0", + "dependencies": { + "makeerror": "1.0.12" + } + }, + "node_modules/webidl-conversions": { + "version": "3.0.1", + "resolved": "https://registry.npmjs.org/webidl-conversions/-/webidl-conversions-3.0.1.tgz", + "integrity": "sha512-2JAn3z8AR6rjK8Sm8orRC0h/bcl/DqL7tRPdGZ4I1CjdF+EaMLmYxBHyXuKL849eucPFhvBoxMsflfOb8kxaeQ==", + "license": "BSD-2-Clause" + }, + "node_modules/whatwg-url": { + "version": "5.0.0", + "resolved": "https://registry.npmjs.org/whatwg-url/-/whatwg-url-5.0.0.tgz", + "integrity": "sha512-saE57nupxk6v3HY35+jzBwYa0rKSy0XR8JSxZPwgLr7ys0IBzhGviA1/TUGJLmSVqs8pb9AnvICXEuOHLprYTw==", + "license": "MIT", + "dependencies": { + "tr46": "~0.0.3", + "webidl-conversions": "^3.0.0" + } + }, + "node_modules/which": { + "version": "2.0.2", + "resolved": "https://registry.npmjs.org/which/-/which-2.0.2.tgz", + "integrity": "sha512-BLI3Tl1TW3Pvl70l3yq3Y64i+awpwXqsGBYWkkqMtnbXgrMD+yj7rhW0kuEDxzJaYXGjEW5ogapKNMEKNMjibA==", + "dev": true, + "license": "ISC", + "dependencies": { + "isexe": "^2.0.0" + }, + "bin": { + "node-which": "bin/node-which" + }, + "engines": { + "node": ">= 8" + } + }, + "node_modules/wmf": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/wmf/-/wmf-1.0.2.tgz", + "integrity": "sha512-/p9K7bEh0Dj6WbXg4JG0xvLQmIadrner1bi45VMJTfnbVHsc7yIajZyoSoK60/dtVBs12Fm6WkUI5/3WAVsNMw==", + "license": "Apache-2.0", + "engines": { + "node": ">=0.8" + } + }, + "node_modules/word": { + "version": "0.3.0", + "resolved": "https://registry.npmjs.org/word/-/word-0.3.0.tgz", + "integrity": "sha512-OELeY0Q61OXpdUfTp+oweA/vtLVg5VDOXh+3he3PNzLGG/y0oylSOC1xRVj0+l4vQ3tj/bB1HVHv1ocXkQceFA==", + "license": "Apache-2.0", + "engines": { + "node": ">=0.8" + } + }, + "node_modules/wrap-ansi": { + "version": "9.0.0", + "resolved": "https://registry.npmjs.org/wrap-ansi/-/wrap-ansi-9.0.0.tgz", + "integrity": "sha512-G8ura3S+3Z2G+mkgNRq8dqaFZAuxfsxpBB8OCTGRTCtp+l/v9nbFNmCUP1BZMts3G1142MsZfn6eeUKrr4PD1Q==", + "license": "MIT", + "dependencies": { + "ansi-styles": "^6.2.1", + "string-width": "^7.0.0", + "strip-ansi": "^7.1.0" + }, + "engines": { + "node": ">=18" + }, + "funding": { + "url": "https://github.com/chalk/wrap-ansi?sponsor=1" + } + }, + "node_modules/wrap-ansi/node_modules/ansi-regex": { + "version": "6.1.0", + "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-6.1.0.tgz", + "integrity": "sha512-7HSX4QQb4CspciLpVFwyRe79O3xsIZDDLER21kERQ71oaPodF8jL725AgJMFAYbooIqolJoRLuM81SpeUkpkvA==", + "license": "MIT", + "engines": { + "node": ">=12" + }, + "funding": { + "url": "https://github.com/chalk/ansi-regex?sponsor=1" + } + }, + "node_modules/wrap-ansi/node_modules/ansi-styles": { + "version": "6.2.1", + "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-6.2.1.tgz", + "integrity": "sha512-bN798gFfQX+viw3R7yrGWRqnrN2oRkEkUjjl4JNn4E8GxxbjtG3FbrEIIY3l8/hrwUwIeCZvi4QuOTP4MErVug==", + "license": "MIT", + "engines": { + "node": ">=12" + }, + "funding": { + "url": "https://github.com/chalk/ansi-styles?sponsor=1" + } + }, + "node_modules/wrap-ansi/node_modules/emoji-regex": { + "version": "10.4.0", + "resolved": "https://registry.npmjs.org/emoji-regex/-/emoji-regex-10.4.0.tgz", + "integrity": "sha512-EC+0oUMY1Rqm4O6LLrgjtYDvcVYTy7chDnM4Q7030tP4Kwj3u/pR6gP9ygnp2CJMK5Gq+9Q2oqmrFJAz01DXjw==", + "license": "MIT" + }, + "node_modules/wrap-ansi/node_modules/string-width": { + "version": "7.2.0", + "resolved": "https://registry.npmjs.org/string-width/-/string-width-7.2.0.tgz", + "integrity": "sha512-tsaTIkKW9b4N+AEj+SVA+WhJzV7/zMhcSu78mLKWSk7cXMOSHsBKFWUs0fWwq8QyK3MgJBQRX6Gbi4kYbdvGkQ==", + "license": "MIT", + "dependencies": { + "emoji-regex": "^10.3.0", + "get-east-asian-width": "^1.0.0", + "strip-ansi": "^7.1.0" + }, + "engines": { + "node": ">=18" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/wrap-ansi/node_modules/strip-ansi": { + "version": "7.1.0", + "resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-7.1.0.tgz", + "integrity": "sha512-iq6eVVI64nQQTRYq2KtEg2d2uU7LElhTJwsH4YzIHZshxlgZms/wIc4VoDQTlG/IvVIrBKG06CrZnp0qv7hkcQ==", + "license": "MIT", + "dependencies": { + "ansi-regex": "^6.0.1" + }, + "engines": { + "node": ">=12" + }, + "funding": { + "url": "https://github.com/chalk/strip-ansi?sponsor=1" + } + }, + "node_modules/wrappy": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/wrappy/-/wrappy-1.0.2.tgz", + "integrity": "sha512-l4Sp/DRseor9wL6EvV2+TuQn63dMkPjZ/sp9XkghTEbV9KlPS1xUsZ3u7/IQO4wxtcFB4bgpQPRcR3QCvezPcQ==", + "license": "ISC" + }, + "node_modules/write-file-atomic": { + "version": "4.0.2", + "resolved": "https://registry.npmjs.org/write-file-atomic/-/write-file-atomic-4.0.2.tgz", + "integrity": "sha512-7KxauUdBmSdWnmpaGFg+ppNjKF8uNLry8LyzjauQDOVONfFLNKrKvQOxZ/VuTIcS/gge/YNahf5RIIQWTSarlg==", + "dev": true, + "license": "ISC", + "dependencies": { + "imurmurhash": "^0.1.4", + "signal-exit": "^3.0.7" + }, + "engines": { + "node": "^12.13.0 || ^14.15.0 || >=16.0.0" + } + }, + "node_modules/write-file-atomic/node_modules/signal-exit": { + "version": "3.0.7", + "resolved": "https://registry.npmjs.org/signal-exit/-/signal-exit-3.0.7.tgz", + "integrity": "sha512-wnD2ZE+l+SPC/uoS0vXeE9L1+0wuaMqKlfz9AMUo38JsyLSBWSFcHR1Rri62LZc12vLr1gb3jl7iwQhgwpAbGQ==", + "dev": true, + "license": "ISC" + }, + "node_modules/xlsx": { + "version": "0.18.5", + "resolved": "https://registry.npmjs.org/xlsx/-/xlsx-0.18.5.tgz", + "integrity": "sha512-dmg3LCjBPHZnQp5/F/+nnTa+miPJxUXB6vtk42YjBBKayDNagxGEeIdWApkYPOf3Z3pm3k62Knjzp7lMeTEtFQ==", + "license": "Apache-2.0", + "dependencies": { + "adler-32": "~1.3.0", + "cfb": "~1.2.1", + "codepage": "~1.15.0", + "crc-32": "~1.2.1", + "ssf": "~0.11.2", + "wmf": "~1.0.1", + "word": "~0.3.0" + }, + "bin": { + "xlsx": "bin/xlsx.njs" + }, + "engines": { + "node": ">=0.8" + } + }, + "node_modules/xlsx-js-style": { + "version": "1.2.0", + "resolved": "https://registry.npmjs.org/xlsx-js-style/-/xlsx-js-style-1.2.0.tgz", + "integrity": "sha512-DDT4FXFSWfT4DXMSok/m3TvmP1gvO3dn0Eu/c+eXHW5Kzmp7IczNkxg/iEPnImbG9X0Vb8QhROda5eatSR/97Q==", + "license": "Apache-2.0", + "dependencies": { + "adler-32": "~1.2.0", + "cfb": "^1.1.4", + "codepage": "~1.14.0", + "commander": "~2.17.1", + "crc-32": "~1.2.0", + "exit-on-epipe": "~1.0.1", + "fflate": "^0.3.8", + "ssf": "~0.11.2", + "wmf": "~1.0.1", + "word": "~0.3.0" + }, + "bin": { + "xlsx": "bin/xlsx.njs" + }, + "engines": { + "node": ">=0.8" + } + }, + "node_modules/xlsx-js-style/node_modules/adler-32": { + "version": "1.2.0", + "resolved": "https://registry.npmjs.org/adler-32/-/adler-32-1.2.0.tgz", + "integrity": "sha512-/vUqU/UY4MVeFsg+SsK6c+/05RZXIHZMGJA+PX5JyWI0ZRcBpupnRuPLU/NXXoFwMYCPCoxIfElM2eS+DUXCqQ==", + "license": "Apache-2.0", + "dependencies": { + "exit-on-epipe": "~1.0.1", + "printj": "~1.1.0" + }, + "bin": { + "adler32": "bin/adler32.njs" + }, + "engines": { + "node": ">=0.8" + } + }, + "node_modules/xlsx-js-style/node_modules/codepage": { + "version": "1.14.0", + "resolved": "https://registry.npmjs.org/codepage/-/codepage-1.14.0.tgz", + "integrity": "sha512-iz3zJLhlrg37/gYRWgEPkaFTtzmnEv1h+r7NgZum2lFElYQPi0/5bnmuDfODHxfp0INEfnRqyfyeIJDbb7ahRw==", + "license": "Apache-2.0", + "dependencies": { + "commander": "~2.14.1", + "exit-on-epipe": "~1.0.1" + }, + "bin": { + "codepage": "bin/codepage.njs" + }, + "engines": { + "node": ">=0.8" + } + }, + "node_modules/xlsx-js-style/node_modules/codepage/node_modules/commander": { + "version": "2.14.1", + "resolved": "https://registry.npmjs.org/commander/-/commander-2.14.1.tgz", + "integrity": "sha512-+YR16o3rK53SmWHU3rEM3tPAh2rwb1yPcQX5irVn7mb0gXbwuCCrnkbV5+PBfETdfg1vui07nM6PCG1zndcjQw==", + "license": "MIT" + }, + "node_modules/xml-js": { + "version": "1.6.11", + "resolved": "https://registry.npmjs.org/xml-js/-/xml-js-1.6.11.tgz", + "integrity": "sha512-7rVi2KMfwfWFl+GpPg6m80IVMWXLRjO+PxTq7V2CDhoGak0wzYzFgUY2m4XJ47OGdXd8eLE8EmwfAmdjw7lC1g==", + "license": "MIT", + "dependencies": { + "sax": "^1.2.4" + }, + "bin": { + "xml-js": "bin/cli.js" + } + }, + "node_modules/xml2js": { + "version": "0.6.2", + "resolved": "https://registry.npmjs.org/xml2js/-/xml2js-0.6.2.tgz", + "integrity": "sha512-T4rieHaC1EXcES0Kxxj4JWgaUQHDk+qwHcYOCFHfiwKz7tOVPLq7Hjq9dM1WCMhylqMEfP7hMcOIChvotiZegA==", + "license": "MIT", + "dependencies": { + "sax": ">=0.6.0", + "xmlbuilder": "~11.0.0" + }, + "engines": { + "node": ">=4.0.0" + } + }, + "node_modules/xmlbuilder": { + "version": "11.0.1", + "resolved": "https://registry.npmjs.org/xmlbuilder/-/xmlbuilder-11.0.1.tgz", + "integrity": "sha512-fDlsI/kFEx7gLvbecc0/ohLG50fugQp8ryHzMTuW9vSa1GJ0XYWKnhsUx7oie3G98+r56aTQIUB4kht42R3JvA==", + "license": "MIT", + "engines": { + "node": ">=4.0" + } + }, + "node_modules/xslx": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/xslx/-/xslx-1.0.0.tgz", + "integrity": "sha512-S1ja8iIsnxthzcHk4EpwvC/He27koGMKhDQMBRKEA43UKCCxZfs/lpQVEDr/ohsvm8k6oK53HZWYsnsOD4LeMQ==", + "license": "ISC" + }, + "node_modules/y18n": { + "version": "5.0.8", + "resolved": "https://registry.npmjs.org/y18n/-/y18n-5.0.8.tgz", + "integrity": "sha512-0pfFzegeDWJHJIAmTLRP2DwHjdF5s7jo9tuztdQxAhINCdvS+3nGINqPd00AphqJR/0LhANUS6/+7SCb98YOfA==", + "dev": true, + "license": "ISC", + "engines": { + "node": ">=10" + } + }, + "node_modules/yallist": { + "version": "3.1.1", + "resolved": "https://registry.npmjs.org/yallist/-/yallist-3.1.1.tgz", + "integrity": "sha512-a4UGQaWPH59mOXUYnAG2ewncQS4i4F43Tv3JoAM+s2VDAmS9NsK8GpDMLrCHPksFT7h3K6TOoUNn2pb7RoXx4g==", + "dev": true, + "license": "ISC" + }, + "node_modules/yargs": { + "version": "17.7.2", + "resolved": "https://registry.npmjs.org/yargs/-/yargs-17.7.2.tgz", + "integrity": "sha512-7dSzzRQ++CKnNI/krKnYRV7JKKPUXMEh61soaHKg9mrWEhzFWhFnxPxGl+69cD1Ou63C13NUPCnmIcrvqCuM6w==", + "dev": true, + "license": "MIT", + "dependencies": { + "cliui": "^8.0.1", + "escalade": "^3.1.1", + "get-caller-file": "^2.0.5", + "require-directory": "^2.1.1", + "string-width": "^4.2.3", + "y18n": "^5.0.5", + "yargs-parser": "^21.1.1" + }, + "engines": { + "node": ">=12" + } + }, + "node_modules/yargs-parser": { + "version": "21.1.1", + "resolved": "https://registry.npmjs.org/yargs-parser/-/yargs-parser-21.1.1.tgz", + "integrity": "sha512-tVpsJW7DdjecAiFpbIB1e3qxIQsE6NoPc5/eTdrbbIC4h0LVsWhnoa3g+m2HclBIujHzsxZ4VJVA+GUuc2/LBw==", + "dev": true, + "license": "ISC", + "engines": { + "node": ">=12" + } + }, + "node_modules/yocto-queue": { + "version": "0.1.0", + "resolved": "https://registry.npmjs.org/yocto-queue/-/yocto-queue-0.1.0.tgz", + "integrity": "sha512-rVksvsnNCdJ/ohGc6xgPwyN8eheCxsiLM8mxuE/t/mOVqJewPuO1miLpTHQiRgTKCLexL4MeAFVagts7HmNZ2Q==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=10" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/yoctocolors-cjs": { + "version": "2.1.2", + "resolved": "https://registry.npmjs.org/yoctocolors-cjs/-/yoctocolors-cjs-2.1.2.tgz", + "integrity": "sha512-cYVsTjKl8b+FrnidjibDWskAv7UKOfcwaVZdp/it9n1s9fU3IkgDbhdIRKCW4JDsAlECJY0ytoVPT3sK6kideA==", + "license": "MIT", + "engines": { + "node": ">=18" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "plugins/apigee-migration-assessment": { + "version": "1.0.0", + "extraneous": true + } + } +} diff --git a/tools/apigee-edge-to-x-migration-tool/package.json b/tools/apigee-edge-to-x-migration-tool/package.json new file mode 100644 index 00000000..5facc1c7 --- /dev/null +++ b/tools/apigee-edge-to-x-migration-tool/package.json @@ -0,0 +1,47 @@ +{ + "name": "apigee-migration", + "version": "0.5.0", + "description": "apigee-edge-to-x-migration-tool", + "main": "index.js", + "bin": { + "apigee-e2x": "./index.js" + }, + "scripts": { + "test": "", + "postinstall": "node install-modules.js" + }, + "keywords": [ + "apigee", + "concentrix", + "migration" + ], + "type": "module", + "author": "Hemanth Kopalle ", + "license": "Apache-2.0", + "dependencies": { + "@inquirer/prompts": "^7.8.6", + "@inquirer/select": "^4.0.9", + "adm-zip": "^0.5.16", + "bottleneck": "^2.19.5", + "cli-table3": "^0.6.5", + "diff": "^8.0.0-beta", + "dotenv": "^16.4.7", + "inquirer": "^12.4.2", + "libsql": "^0.5.0-pre.6", + "node-fetch": "^2.7.0", + "papaparse": "^5.5.2", + "path": "^0.12.7", + "temp": "^0.9.4", + "url": "^0.11.4", + "wrap-ansi": "^9.0.0", + "xlsx": "^0.18.5", + "xlsx-js-style": "^1.2.0", + "xml-js": "^1.6.11", + "xml2js": "^0.6.2", + "xslx": "^1.0.0" + }, + "devDependencies": { + "eslint": "^8.57.0", + "jest": "^29.7.0" + } +} \ No newline at end of file diff --git a/tools/apigee-edge-to-x-migration-tool/pipeline.sh b/tools/apigee-edge-to-x-migration-tool/pipeline.sh new file mode 100755 index 00000000..7e010a9b --- /dev/null +++ b/tools/apigee-edge-to-x-migration-tool/pipeline.sh @@ -0,0 +1,17 @@ +#!/bin/sh + +# Copyright 2025 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +echo "no pipeline - this tool requires interactive shell and cannot be run unattended" diff --git a/tools/apigee-edge-to-x-migration-tool/src/gateway-clients/apigee-edge/ApigeeEdgeClient.js b/tools/apigee-edge-to-x-migration-tool/src/gateway-clients/apigee-edge/ApigeeEdgeClient.js new file mode 100644 index 00000000..1df94bf6 --- /dev/null +++ b/tools/apigee-edge-to-x-migration-tool/src/gateway-clients/apigee-edge/ApigeeEdgeClient.js @@ -0,0 +1,242 @@ +/** + * Copyright 2025 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +import fs from 'fs'; +import temp from 'temp'; +import Bottleneck from 'bottleneck'; +import querystring from 'node:querystring'; +import inquirer from 'inquirer'; +import Logger from '../../utils/logHandler.js'; +import { pipeline } from 'node:stream/promises'; + +temp.track(); + +class ApigeeEdgeClient { + /** + * @type {string} + */ + baseUrl = null; + + /** + * @type {string} + */ + org = null; + + /** + * @type {string} + */ + username = null; + + /** + * @type {string} + */ + password = null; + + /** + * @type {string} + */ + token = null; + + /** + * @type {Bottleneck} + */ + limiter = null; + + /** + * Create an Apigee Edge Management API client + * + * @param {string} baseUrl + * @param {string} org + */ + constructor(baseUrl, org, options = {}) { + const { + username = null, + password = null + } = options ?? {}; + + this.baseUrl = baseUrl; + this.org = org; + this.username = username; + this.password = password; + + // Apigee edge has a rate limit of 10,000 calls per minute to its management APIs + const managementApiRateLimitPerMinute = 10000; + + // Set our rate limit to 10% of what Apigee allows, so we don't interrupt day-to-day operations on the production gateway + const rateLimitPerMinute = managementApiRateLimitPerMinute * 0.1; + + // Restrict management API calls to 10% of the Apigee managemnet API rate limit per minute + this.limiter = new Bottleneck({ + reservoir: rateLimitPerMinute, + reservoirRefreshAmount: rateLimitPerMinute, + reservoirRefreshInterval: 60 * 1000, // Every minute + minTime: 5 // Enforce slight spacing between calls + }) + } + + /** + * Make a GET request to the gateway + * + * @param {string} url + * @returns + */ + async get(url, options = {}) { + return this.call(url, 'GET', null, options); + } + + /** + * Make a POST request to the gateway + * + * @param {string} url + * @param {*} body + * @returns + */ + async post(url, body, options = {}) { + return this.call(url, 'POST', body, options); + } + + /** + * Make a PUT request to the gateway + * + * @param {string} url + * @param {*} body + * @returns + */ + async put(url, body, options = {}) { + return this.call(url, 'PUT', body, options); + } + + /** + * Make a DELETE request to the gateway + * + * @param {string} url + * @returns + */ + async delete(url, options = {}) { + return this.call(url, 'DELETE', null, options); + } + + /** + * Get a bearer token to use when calling Apigee Edge Management APIs + * + * @returns {Promise} + */ + async _getToken() { + if (this.token) { + return this.token; + } + + if (!this.username || !this.password) { + const { username, password } = await inquirer.prompt([ + { + name: 'username', + type: 'input', + message: 'Your Apigee Edge username' + }, + { + name: 'password', + type: 'password', + message: 'Your Apigee Edge password' + } + ]); + + this.username = username; + this.password = password; + } + + return fetch('https://login.apigee.com/oauth/token', { + method: 'POST', + body: querystring.stringify({ + username: this.username, + password: this.password, + grant_type: 'password' + }), + headers: { + 'Content-Type': 'application/x-www-form-urlencoded;charset=utf-8', + 'Accept': 'application/json;charset=utf-8', + 'Authorization': 'Basic ZWRnZWNsaTplZGdlY2xpc2VjcmV0' + } + }).then(async res => { + if (!res.ok) { + throw new Error(`Apigee Edge authentication error status: ${res.status}, message: ${await res.text() || res.statusText}`); + } + + const resJson = JSON.parse(await res.text()); + + this.token = resJson?.access_token ?? null; + + if (!this.token) { + throw new Error('Apigee Edge did not return an access token.'); + } + + return this.token; + }).catch(error => { + throw new Error(`Unable to authenticate to Apigee Edge using username and password. ${error.message}`); + }); + } + + /** + * + * @param {string} url + * @param {string} method + * @param {*} body + * @returns + */ + async call(url, method, body, options = {}) { + return this.limiter.schedule(async () => { + + if (!this.bearerToken) { + this.bearerToken = await this._getToken(); + } + + Logger.getInstance().log('apigee_edge_call', `Apigee Edge Call: ${method} ${this.baseUrl}${this.org}${url}`, body); + + return fetch(`${this.baseUrl}${this.org}${url}`, { + method, + body, + headers: { + 'accept': '*/*', + 'Content-type': 'application/json', + 'Authorization': `Bearer ${this.bearerToken}` + } + }).then(async res => { + if (!res.ok) { + throw new Error(await res.text() || res.statusText); + } + + if (res.headers.get('content-type').includes('application/json')) { + return res.json(); + } + + if (res.headers.get('content-type').includes('application/octet-stream')) { + const downloadFilePath = options?.downloadFilePath ?? null; + const writeStream = downloadFilePath ? fs.createWriteStream(downloadFilePath) : temp.createWriteStream(); + const writeStreamPath = writeStream.path; + + return pipeline(res.body, writeStream).then(() => writeStreamPath); + } + + return res.text(); + }).catch(error => { + Logger.getInstance().error('apigee_edge_call', `Error response from Apigee Edge ${method} ${this.baseUrl}${this.org}${url}`, error.message); + + throw error; + }); + }) + } +} + +export default ApigeeEdgeClient; \ No newline at end of file diff --git a/tools/apigee-edge-to-x-migration-tool/src/gateway-clients/apigee-edge/api-products/getApiProducts.js b/tools/apigee-edge-to-x-migration-tool/src/gateway-clients/apigee-edge/api-products/getApiProducts.js new file mode 100755 index 00000000..10e89a22 --- /dev/null +++ b/tools/apigee-edge-to-x-migration-tool/src/gateway-clients/apigee-edge/api-products/getApiProducts.js @@ -0,0 +1,60 @@ +/** + * Copyright 2025 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +import querystring from 'node:querystring'; +import ApigeeEdgeClient from "../ApigeeEdgeClient.js"; + +/** + * + * @param {ApigeeEdgeClient} apigeeEdgeClient + * @param {(string) => Promise} callback + * @param {string|null} startKey + * @returns {array} + */ +export default async function getApigeeEdgeApiProducts(apigeeEdgeClient, callback = null, startKey = null) { + const query = { + expand: true, + count: 1000 // Max results that Apigee cloud can return at once + }; + + if (startKey) { + query.startKey = startKey; + } + + return apigeeEdgeClient.get(`/apiproducts?${querystring.stringify(query)}`).then(async response => { + const apiProducts = response?.apiProduct ?? []; + + if (startKey) { + // Remove the first item from the list, since it will be the last item from the list on the previous call. + apiProducts.shift(); + } + + if (typeof callback === 'function') { + for (let apiProduct of apiProducts) { + await callback(apiProduct); + } + } + + const lastApiProductName = apiProducts.length > 0 ? apiProducts.at(apiProducts.length - 1).name : null; + + if (lastApiProductName && lastApiProductName.length > 0) { + // Keep fetching until there are no more results\ + return getApigeeEdgeApiProducts(apigeeEdgeClient, callback, lastApiProductName).then(results => apiProducts.concat(results)); + } + + return apiProducts; + }); +} \ No newline at end of file diff --git a/tools/apigee-edge-to-x-migration-tool/src/gateway-clients/apigee-edge/api-products/index.js b/tools/apigee-edge-to-x-migration-tool/src/gateway-clients/apigee-edge/api-products/index.js new file mode 100644 index 00000000..a2858750 --- /dev/null +++ b/tools/apigee-edge-to-x-migration-tool/src/gateway-clients/apigee-edge/api-products/index.js @@ -0,0 +1,21 @@ +/** + * Copyright 2025 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +import getApigeeEdgeApiProducts from "./getApiProducts.js"; + +export { + getApigeeEdgeApiProducts +} diff --git a/tools/apigee-edge-to-x-migration-tool/src/gateway-clients/apigee-edge/api-proxies/getApiProxyBundle.js b/tools/apigee-edge-to-x-migration-tool/src/gateway-clients/apigee-edge/api-proxies/getApiProxyBundle.js new file mode 100755 index 00000000..45651b3e --- /dev/null +++ b/tools/apigee-edge-to-x-migration-tool/src/gateway-clients/apigee-edge/api-proxies/getApiProxyBundle.js @@ -0,0 +1,30 @@ +/** + * Copyright 2025 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +import ApigeeEdgeClient from "../ApigeeEdgeClient.js"; + +/** + * + * @param {ApigeeEdgeClient} apigeeEdgeClient + * @param {string} apiProxyName + * @param {string} apiProxyRev + * @returns {Promise} The filepath for the downloaded API proxy bundle + */ +export default async function getApigeeEdgeApiProxyBundle(apigeeEdgeClient, apiProxyName, apiProxyRev, destBundleFilePath = null) { + return apigeeEdgeClient.get(`/apis/${apiProxyName}/revisions/${apiProxyRev}?format=bundle`, { + downloadFilePath: destBundleFilePath + }); +} diff --git a/tools/apigee-edge-to-x-migration-tool/src/gateway-clients/apigee-edge/api-proxies/getApiProxyByName.js b/tools/apigee-edge-to-x-migration-tool/src/gateway-clients/apigee-edge/api-proxies/getApiProxyByName.js new file mode 100755 index 00000000..c4fbd7ca --- /dev/null +++ b/tools/apigee-edge-to-x-migration-tool/src/gateway-clients/apigee-edge/api-proxies/getApiProxyByName.js @@ -0,0 +1,27 @@ +/** + * Copyright 2025 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +import ApigeeEdgeClient from "../ApigeeEdgeClient.js"; + +/** + * + * @param {ApigeeEdgeClient} apigeeEdgeClient + * @param {string} apiProxyName + * @returns + */ +export default async function getApigeeEdgeApiProxyByName(apigeeEdgeClient, apiProxyName) { + return apigeeEdgeClient.get(`/apis/${apiProxyName}`); +} diff --git a/tools/apigee-edge-to-x-migration-tool/src/gateway-clients/apigee-edge/api-proxies/getApiProxyDeployments.js b/tools/apigee-edge-to-x-migration-tool/src/gateway-clients/apigee-edge/api-proxies/getApiProxyDeployments.js new file mode 100755 index 00000000..b377e86f --- /dev/null +++ b/tools/apigee-edge-to-x-migration-tool/src/gateway-clients/apigee-edge/api-proxies/getApiProxyDeployments.js @@ -0,0 +1,27 @@ +/** + * Copyright 2025 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +import ApigeeEdgeClient from "../ApigeeEdgeClient.js"; + +/** + * + * @param {ApigeeEdgeClient} apigeeEdgeClient + * @param {string} apiProxyName + * @returns + */ +export default async function getApigeeEdgeApiProxyDeployments(apigeeEdgeClient, apiProxyName) { + return apigeeEdgeClient.get(`/apis/${apiProxyName}/deployments`); +} diff --git a/tools/apigee-edge-to-x-migration-tool/src/gateway-clients/apigee-edge/api-proxies/getApiProxyNames.js b/tools/apigee-edge-to-x-migration-tool/src/gateway-clients/apigee-edge/api-proxies/getApiProxyNames.js new file mode 100755 index 00000000..633d0173 --- /dev/null +++ b/tools/apigee-edge-to-x-migration-tool/src/gateway-clients/apigee-edge/api-proxies/getApiProxyNames.js @@ -0,0 +1,57 @@ +/** + * Copyright 2025 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +import querystring from 'node:querystring'; +import ApigeeEdgeClient from "../ApigeeEdgeClient.js"; + +/** + * + * @param {ApigeeEdgeClient} apigeeEdgeClient + * @param {(string) => Promise} callback + * @param {string|null} startKey + * @returns {array} + */ +export default async function getApigeeEdgeApiProxyNames(apigeeEdgeClient, callback = null, startKey = null) { + const query = { + count: 100 // Max results that Apigee cloud can return at once + }; + + if (startKey) { + query.startKey = startKey; + } + + return apigeeEdgeClient.get(`/apis?${querystring.stringify(query)}`).then(async proxies => { + if (startKey) { + // Remove the first item from the list, since it will be the last item from the list on the previous call. + proxies.shift(); + } + + if (typeof callback === 'function') { + for (let proxy of proxies) { + await callback(proxy); + } + } + + const lastProxyName = proxies.length > 0 ? proxies.at(proxies.length - 1) : null; + + if (lastProxyName && lastProxyName.length > 0) { + // Keep fetching until there are no more results\ + return getApigeeEdgeApiProxyNames(apigeeEdgeClient, callback, lastProxyName).then(results => proxies.concat(results)); + } + + return proxies; + }); +} diff --git a/tools/apigee-edge-to-x-migration-tool/src/gateway-clients/apigee-edge/api-proxies/index.js b/tools/apigee-edge-to-x-migration-tool/src/gateway-clients/apigee-edge/api-proxies/index.js new file mode 100644 index 00000000..ba25f52b --- /dev/null +++ b/tools/apigee-edge-to-x-migration-tool/src/gateway-clients/apigee-edge/api-proxies/index.js @@ -0,0 +1,27 @@ +/** + * Copyright 2025 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +import getApigeeEdgeApiProxyNames from "./getApiProxyNames.js"; +import getApigeeEdgeApiProxyBundle from "./getApiProxyBundle.js"; +import getApigeeEdgeApiProxyByName from "./getApiProxyByName.js"; +import getApigeeEdgeApiProxyDeployments from "./getApiProxyDeployments.js"; + +export { + getApigeeEdgeApiProxyNames, + getApigeeEdgeApiProxyBundle, + getApigeeEdgeApiProxyByName, + getApigeeEdgeApiProxyDeployments +} diff --git a/tools/apigee-edge-to-x-migration-tool/src/gateway-clients/apigee-edge/developer-apps/getDeveloperAppById.js b/tools/apigee-edge-to-x-migration-tool/src/gateway-clients/apigee-edge/developer-apps/getDeveloperAppById.js new file mode 100755 index 00000000..2359daba --- /dev/null +++ b/tools/apigee-edge-to-x-migration-tool/src/gateway-clients/apigee-edge/developer-apps/getDeveloperAppById.js @@ -0,0 +1,27 @@ +/** + * Copyright 2025 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +import ApigeeEdgeClient from "../ApigeeEdgeClient.js"; + +/** + * + * @param {ApigeeEdgeClient} apigeeEdgeClient + * @param {string} developerAppId + * @returns + */ +export default async function getApigeeEdgeDeveloperAppById(apigeeEdgeClient, developerAppId) { + return apigeeEdgeClient.get(`/apps/${developerAppId}`); +} diff --git a/tools/apigee-edge-to-x-migration-tool/src/gateway-clients/apigee-edge/developer-apps/getDeveloperApps.js b/tools/apigee-edge-to-x-migration-tool/src/gateway-clients/apigee-edge/developer-apps/getDeveloperApps.js new file mode 100755 index 00000000..a91e5367 --- /dev/null +++ b/tools/apigee-edge-to-x-migration-tool/src/gateway-clients/apigee-edge/developer-apps/getDeveloperApps.js @@ -0,0 +1,66 @@ +/** + * Copyright 2025 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + + +import querystring from 'node:querystring'; +import ApigeeEdgeClient from '../ApigeeEdgeClient.js'; + +/** + * + * @param {ApigeeEdgeClient} apigeeEdgeClient + * @param {(app) => Promise} callback + * @param {string} startKey + * @returns + */ +async function getApigeeEdgeDeveloperApps(apigeeEdgeClient, callback = null, startKey = null) { + const limit = 1000; // Max results that Apigee public cloud can return at once + + const query = { + expand: true, + rows: limit, + apptype: 'developer' + }; + + if (startKey) { + query.startKey = startKey; + } + + return apigeeEdgeClient.get(`/apps?${querystring.stringify(query)}`).then(async response => { + const developerApps = response?.app ?? []; + + if (startKey) { + // Remove the first item from the list, since it will be the last item from the list on the previous call. + developerApps.shift(); + } + + if (typeof callback === 'function') { + for (let developerApp of developerApps) { + await callback(developerApp); + } + } + + const lastAppId = developerApps.length > 0 ? developerApps.at(developerApps.length - 1).appId : null; + + if (lastAppId && lastAppId.length > 0) { + // Keep fetching until there are no more results\ + return getApigeeEdgeDeveloperApps(apigeeEdgeClient, callback, lastAppId).then(results => developerApps.concat(results)); + } + + return developerApps; + }); +} + +export default getApigeeEdgeDeveloperApps; \ No newline at end of file diff --git a/tools/apigee-edge-to-x-migration-tool/src/gateway-clients/apigee-edge/developer-apps/index.js b/tools/apigee-edge-to-x-migration-tool/src/gateway-clients/apigee-edge/developer-apps/index.js new file mode 100644 index 00000000..1785ec48 --- /dev/null +++ b/tools/apigee-edge-to-x-migration-tool/src/gateway-clients/apigee-edge/developer-apps/index.js @@ -0,0 +1,23 @@ +/** + * Copyright 2025 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +import getApigeeEdgeDeveloperApps from "./getDeveloperApps.js" +import getApigeeEdgeDeveloperAppById from "./getDeveloperAppById.js" + +export { + getApigeeEdgeDeveloperApps, + getApigeeEdgeDeveloperAppById +} diff --git a/tools/apigee-edge-to-x-migration-tool/src/gateway-clients/apigee-edge/developers/getDeveloperById.js b/tools/apigee-edge-to-x-migration-tool/src/gateway-clients/apigee-edge/developers/getDeveloperById.js new file mode 100755 index 00000000..57b7e78a --- /dev/null +++ b/tools/apigee-edge-to-x-migration-tool/src/gateway-clients/apigee-edge/developers/getDeveloperById.js @@ -0,0 +1,25 @@ +/** + * Copyright 2025 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +/** + * + * @param {ApigeeEdgeClient} apigeeEdgeClient + * @param {string} developerId + * @returns + */ +export default async function getApigeeEdgeDeveloperById(apigeeEdgeClient, developerId) { + return apigeeEdgeClient.get(`/developers/${developerId}`); +} diff --git a/tools/apigee-edge-to-x-migration-tool/src/gateway-clients/apigee-edge/developers/getDevelopers.js b/tools/apigee-edge-to-x-migration-tool/src/gateway-clients/apigee-edge/developers/getDevelopers.js new file mode 100755 index 00000000..0d667072 --- /dev/null +++ b/tools/apigee-edge-to-x-migration-tool/src/gateway-clients/apigee-edge/developers/getDevelopers.js @@ -0,0 +1,65 @@ +/** + * Copyright 2025 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + + +import querystring from 'node:querystring'; +import ApigeeEdgeClient from '../ApigeeEdgeClient.js'; + +/** + * + * @param {ApigeeEdgeClient} apigeeEdgeClient + * @param {(developer) => Promise} callback + * @param {string} startKey + * @returns + */ +async function getApigeeEdgeDevelopers(apigeeEdgeClient, callback = null, startKey = null) { + const limit = 1000; // Max results that Apigee cloud can return at once + + const query = { + expand: true, + count: limit + }; + + if (startKey) { + query.startKey = startKey; + } + + return apigeeEdgeClient.get(`/developers?${querystring.stringify(query)}`).then(async response => { + const developers = response?.developer ?? []; + + if (startKey) { + // Remove the first item from the list, since it will be the last item from the list on the previous call. + developers.shift(); + } + + if (typeof callback === 'function') { + for (let developer of developers) { + await callback(developer); + } + } + + const lastEmail = developers.length > 0 ? developers.at(developers.length - 1).email : null; + + if (lastEmail && lastEmail.length > 0) { + // Keep fetching until there are no more results\ + return getApigeeEdgeDevelopers(apigeeEdgeClient, callback, lastEmail).then(results => developers.concat(results)); + } + + return developers; + }); +} + +export default getApigeeEdgeDevelopers; \ No newline at end of file diff --git a/tools/apigee-edge-to-x-migration-tool/src/gateway-clients/apigee-edge/developers/index.js b/tools/apigee-edge-to-x-migration-tool/src/gateway-clients/apigee-edge/developers/index.js new file mode 100644 index 00000000..da88e14b --- /dev/null +++ b/tools/apigee-edge-to-x-migration-tool/src/gateway-clients/apigee-edge/developers/index.js @@ -0,0 +1,23 @@ +/** + * Copyright 2025 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +import getApigeeEdgeDevelopers from "./getDevelopers.js"; +import getApigeeEdgeDeveloperById from "./getDeveloperById.js"; + +export { + getApigeeEdgeDevelopers, + getApigeeEdgeDeveloperById +} diff --git a/tools/apigee-edge-to-x-migration-tool/src/gateway-clients/apigee-edge/keyValueMaps/getEnvKVMEntry.js b/tools/apigee-edge-to-x-migration-tool/src/gateway-clients/apigee-edge/keyValueMaps/getEnvKVMEntry.js new file mode 100644 index 00000000..57f9ce3d --- /dev/null +++ b/tools/apigee-edge-to-x-migration-tool/src/gateway-clients/apigee-edge/keyValueMaps/getEnvKVMEntry.js @@ -0,0 +1,26 @@ +/** + * Copyright 2025 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +import ApigeeEdgeClient from "../ApigeeEdgeClient.js"; + +/** + * + * @param {ApigeeEdgeClient} apigeeEdgeClient + * @returns + */ +export default async function getApigeeEdgeEnvKVMEntry(apigeeEdgeClient, apigeeEnvironment, mapName, entryName) { + return apigeeEdgeClient.get(`/environments/${apigeeEnvironment}/keyvaluemaps/${mapName}/entries/${entryName}`); +} diff --git a/tools/apigee-edge-to-x-migration-tool/src/gateway-clients/apigee-edge/keyValueMaps/getEnvKVMKeys.js b/tools/apigee-edge-to-x-migration-tool/src/gateway-clients/apigee-edge/keyValueMaps/getEnvKVMKeys.js new file mode 100644 index 00000000..f07068a9 --- /dev/null +++ b/tools/apigee-edge-to-x-migration-tool/src/gateway-clients/apigee-edge/keyValueMaps/getEnvKVMKeys.js @@ -0,0 +1,26 @@ +/** + * Copyright 2025 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +import ApigeeEdgeClient from "../ApigeeEdgeClient.js"; + +/** + * + * @param {ApigeeEdgeClient} apigeeEdgeClient + * @returns + */ +export default async function getApigeeEdgeEnvKVMKeys(apigeeEdgeClient, apigeeEnvironment, mapName) { + return apigeeEdgeClient.get(`/environments/${apigeeEnvironment}/keyvaluemaps/${mapName}/keys`); +} diff --git a/tools/apigee-edge-to-x-migration-tool/src/gateway-clients/apigee-edge/keyValueMaps/getEnvKVMsByMapName.js b/tools/apigee-edge-to-x-migration-tool/src/gateway-clients/apigee-edge/keyValueMaps/getEnvKVMsByMapName.js new file mode 100644 index 00000000..5ed8b8e6 --- /dev/null +++ b/tools/apigee-edge-to-x-migration-tool/src/gateway-clients/apigee-edge/keyValueMaps/getEnvKVMsByMapName.js @@ -0,0 +1,26 @@ +/** + * Copyright 2025 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +import ApigeeEdgeClient from "../ApigeeEdgeClient.js"; + +/** + * + * @param {ApigeeEdgeClient} apigeeEdgeClient + * @returns + */ +export default async function getApigeeEdgeEnvKeyValueMapsByMap(apigeeEdgeClient, apigeeEnvironment, mapName) { + return apigeeEdgeClient.get(`/environments/${apigeeEnvironment}/keyvaluemaps/${mapName}`); +} diff --git a/tools/apigee-edge-to-x-migration-tool/src/gateway-clients/apigee-edge/keyValueMaps/getOrgKVMEntry.js b/tools/apigee-edge-to-x-migration-tool/src/gateway-clients/apigee-edge/keyValueMaps/getOrgKVMEntry.js new file mode 100644 index 00000000..160c625d --- /dev/null +++ b/tools/apigee-edge-to-x-migration-tool/src/gateway-clients/apigee-edge/keyValueMaps/getOrgKVMEntry.js @@ -0,0 +1,26 @@ +/** + * Copyright 2025 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +import ApigeeEdgeClient from "../ApigeeEdgeClient.js"; + +/** + * + * @param {ApigeeEdgeClient} apigeeEdgeClient + * @returns + */ +export default async function getApigeeEdgeOrgKVMEntry(apigeeEdgeClient, mapName, entryName) { + return apigeeEdgeClient.get(`/keyvaluemaps/${mapName}/entries/${entryName}`); +} diff --git a/tools/apigee-edge-to-x-migration-tool/src/gateway-clients/apigee-edge/keyValueMaps/getOrgKVMKeys.js b/tools/apigee-edge-to-x-migration-tool/src/gateway-clients/apigee-edge/keyValueMaps/getOrgKVMKeys.js new file mode 100644 index 00000000..947da315 --- /dev/null +++ b/tools/apigee-edge-to-x-migration-tool/src/gateway-clients/apigee-edge/keyValueMaps/getOrgKVMKeys.js @@ -0,0 +1,26 @@ +/** + * Copyright 2025 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +import ApigeeEdgeClient from "../ApigeeEdgeClient.js"; + +/** + * + * @param {ApigeeEdgeClient} apigeeEdgeClient + * @returns + */ +export default async function getApigeeEdgeOrgKVMKeys(apigeeEdgeClient, mapName) { + return apigeeEdgeClient.get(`/keyvaluemaps/${mapName}/keys`); +} diff --git a/tools/apigee-edge-to-x-migration-tool/src/gateway-clients/apigee-edge/keyValueMaps/getOrgKVMsByMapName.js b/tools/apigee-edge-to-x-migration-tool/src/gateway-clients/apigee-edge/keyValueMaps/getOrgKVMsByMapName.js new file mode 100644 index 00000000..70524cbc --- /dev/null +++ b/tools/apigee-edge-to-x-migration-tool/src/gateway-clients/apigee-edge/keyValueMaps/getOrgKVMsByMapName.js @@ -0,0 +1,26 @@ +/** + * Copyright 2025 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +import ApigeeEdgeClient from "../ApigeeEdgeClient.js"; + +/** + * + * @param {ApigeeEdgeClient} apigeeEdgeClient + * @returns + */ +export default async function getApigeeEdgeOrgKeyValueMapsByMap(apigeeEdgeClient, mapName) { + return apigeeEdgeClient.get(`/keyvaluemaps/${mapName}`); +} diff --git a/tools/apigee-edge-to-x-migration-tool/src/gateway-clients/apigee-edge/keyValueMaps/index.js b/tools/apigee-edge-to-x-migration-tool/src/gateway-clients/apigee-edge/keyValueMaps/index.js new file mode 100644 index 00000000..953abc1e --- /dev/null +++ b/tools/apigee-edge-to-x-migration-tool/src/gateway-clients/apigee-edge/keyValueMaps/index.js @@ -0,0 +1,35 @@ +/** + * Copyright 2025 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +import getApigeeEdgeEnvKeyValueMaps from "./listEnvKeyValueMaps.js"; +import getApigeeEdgeEnvKeyValueMapsByMap from "./getEnvKVMsByMapName.js"; +import getApigeeEdgeEnvKVMEntry from "./getEnvKVMEntry.js"; +import getApigeeEdgeEnvKVMKeys from "./getEnvKVMKeys.js"; +import getApigeeEdgeOrgKeyValueMaps from "./listOrgKeyValueMaps.js"; +import getApigeeEdgeOrgKeyValueMapsByMap from "./getOrgKVMsByMapName.js"; +import getApigeeEdgeOrgKVMEntry from "./getOrgKVMEntry.js"; +import getApigeeEdgeOrgKVMKeys from "./getOrgKVMKeys.js"; + +export { + getApigeeEdgeEnvKeyValueMaps, + getApigeeEdgeEnvKeyValueMapsByMap, + getApigeeEdgeEnvKVMEntry, + getApigeeEdgeEnvKVMKeys, + getApigeeEdgeOrgKeyValueMaps, + getApigeeEdgeOrgKeyValueMapsByMap, + getApigeeEdgeOrgKVMEntry, + getApigeeEdgeOrgKVMKeys +} \ No newline at end of file diff --git a/tools/apigee-edge-to-x-migration-tool/src/gateway-clients/apigee-edge/keyValueMaps/listApiProxyKVMs.js b/tools/apigee-edge-to-x-migration-tool/src/gateway-clients/apigee-edge/keyValueMaps/listApiProxyKVMs.js new file mode 100644 index 00000000..1da06dd0 --- /dev/null +++ b/tools/apigee-edge-to-x-migration-tool/src/gateway-clients/apigee-edge/keyValueMaps/listApiProxyKVMs.js @@ -0,0 +1,28 @@ +/** + * Copyright 2025 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +import ApigeeEdgeClient from "../ApigeeEdgeClient.js"; + +/** + * + * @param {ApigeeEdgeClient} apigeeEdgeClient + * @param {string} apiProxyName + * @param {string} apiProxyRev + * @returns {Promise} + */ +export default async function getApiProxyKeyValueMaps(apigeeEdgeClient, apiProxyName, apiProxyRev) { + return apigeeEdgeClient.get(`/apis/${apiProxyName}/revisions/${apiProxyRev}/keyvaluemaps`); +} diff --git a/tools/apigee-edge-to-x-migration-tool/src/gateway-clients/apigee-edge/keyValueMaps/listEnvKeyValueMaps.js b/tools/apigee-edge-to-x-migration-tool/src/gateway-clients/apigee-edge/keyValueMaps/listEnvKeyValueMaps.js new file mode 100644 index 00000000..8604a2a1 --- /dev/null +++ b/tools/apigee-edge-to-x-migration-tool/src/gateway-clients/apigee-edge/keyValueMaps/listEnvKeyValueMaps.js @@ -0,0 +1,26 @@ +/** + * Copyright 2025 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +import ApigeeEdgeClient from "../ApigeeEdgeClient.js"; + +/** + * + * @param {ApigeeEdgeClient} apigeeEdgeClient + * @returns + */ +export default async function getApigeeEdgeEnvKeyValueMaps(apigeeEdgeClient, apigeeEnvironment) { + return apigeeEdgeClient.get(`/environments/${apigeeEnvironment}/keyvaluemaps`); +} diff --git a/tools/apigee-edge-to-x-migration-tool/src/gateway-clients/apigee-edge/keyValueMaps/listOrgKeyValueMaps.js b/tools/apigee-edge-to-x-migration-tool/src/gateway-clients/apigee-edge/keyValueMaps/listOrgKeyValueMaps.js new file mode 100644 index 00000000..8d4c5bf9 --- /dev/null +++ b/tools/apigee-edge-to-x-migration-tool/src/gateway-clients/apigee-edge/keyValueMaps/listOrgKeyValueMaps.js @@ -0,0 +1,26 @@ +/** + * Copyright 2025 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +import ApigeeEdgeClient from "../ApigeeEdgeClient.js"; + +/** + * + * @param {ApigeeEdgeClient} apigeeEdgeClient + * @returns + */ +export default async function getApigeeEdgeOrgKeyValueMaps(apigeeEdgeClient) { + return apigeeEdgeClient.get(`/keyvaluemaps`); +} diff --git a/tools/apigee-edge-to-x-migration-tool/src/gateway-clients/apigee-edge/resource-files/getResourceFileById.js b/tools/apigee-edge-to-x-migration-tool/src/gateway-clients/apigee-edge/resource-files/getResourceFileById.js new file mode 100755 index 00000000..b8518839 --- /dev/null +++ b/tools/apigee-edge-to-x-migration-tool/src/gateway-clients/apigee-edge/resource-files/getResourceFileById.js @@ -0,0 +1,30 @@ +/** + * Copyright 2025 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +import ApigeeEdgeClient from "../ApigeeEdgeClient.js"; + +/** + * + * @param {ApigeeEdgeClient} apigeeXClient + * @param {*} environment + * @param {*} resourceType + * @param {*} resourceName + * @param {string} environment + * @returns + */ +export default async function getResourceFilesById(apigeeXClient, resourceType, resourceName, environment) { + return apigeeXClient.get(`/environments/${environment}/resourcefiles/${resourceType}/${resourceName}`); +} diff --git a/tools/apigee-edge-to-x-migration-tool/src/gateway-clients/apigee-edge/resource-files/getResourceFiles.js b/tools/apigee-edge-to-x-migration-tool/src/gateway-clients/apigee-edge/resource-files/getResourceFiles.js new file mode 100755 index 00000000..82fb7c05 --- /dev/null +++ b/tools/apigee-edge-to-x-migration-tool/src/gateway-clients/apigee-edge/resource-files/getResourceFiles.js @@ -0,0 +1,41 @@ +/** + * Copyright 2025 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +import ApigeeEdgeClient from '../ApigeeEdgeClient.js'; + +/** + * Get all resource files in the org. + * + * @param {ApigeeEdgeClient} apigeeEdgeClient + * @param {string} environment + * @param {(resourcefile) => Promise} callback + * @returns + */ +async function getApigeeEdgeResourceFiles(apigeeEdgeClient, environment, callback = null) { + return apigeeEdgeClient.get(`/environments/${environment}/resourcefiles`).then(async response => { + const resourceFiles = response?.resourceFile ?? []; + + for (const resourceFile of resourceFiles) { + if (typeof callback === 'function') { + await callback(resourceFile); + } + } + + return resourceFiles; + }); +} + +export default getApigeeEdgeResourceFiles; \ No newline at end of file diff --git a/tools/apigee-edge-to-x-migration-tool/src/gateway-clients/apigee-edge/resource-files/index.js b/tools/apigee-edge-to-x-migration-tool/src/gateway-clients/apigee-edge/resource-files/index.js new file mode 100644 index 00000000..7f633254 --- /dev/null +++ b/tools/apigee-edge-to-x-migration-tool/src/gateway-clients/apigee-edge/resource-files/index.js @@ -0,0 +1,23 @@ +/** + * Copyright 2025 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +import getApigeeEdgeResourceFileById from "./getResourceFileById.js"; +import getApigeeEdgeResourceFiles from "./getResourceFiles.js"; + +export { + getApigeeEdgeResourceFileById, + getApigeeEdgeResourceFiles +} diff --git a/tools/apigee-edge-to-x-migration-tool/src/gateway-clients/apigee-edge/shared-flows/getSharedFlowBundle.js b/tools/apigee-edge-to-x-migration-tool/src/gateway-clients/apigee-edge/shared-flows/getSharedFlowBundle.js new file mode 100755 index 00000000..a1979e3d --- /dev/null +++ b/tools/apigee-edge-to-x-migration-tool/src/gateway-clients/apigee-edge/shared-flows/getSharedFlowBundle.js @@ -0,0 +1,30 @@ +/** + * Copyright 2025 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +import ApigeeEdgeClient from '../ApigeeEdgeClient.js'; + +/** + * + * @param {ApigeeEdgeClient} apigeeEdgeClient + * @param {string} sharedFlowName + * @param {string} sharedFlowRev + * @returns + */ +export default async function getApigeeEdgeSharedFlowBundle(apigeeEdgeClient, sharedFlowName, sharedFlowRev, destBundleFilePath = null) { + return apigeeEdgeClient.get(`/sharedflows/${sharedFlowName}/revisions/${sharedFlowRev}?format=bundle`, { + downloadFilePath: destBundleFilePath + }); +} diff --git a/tools/apigee-edge-to-x-migration-tool/src/gateway-clients/apigee-edge/shared-flows/getSharedFlowByName.js b/tools/apigee-edge-to-x-migration-tool/src/gateway-clients/apigee-edge/shared-flows/getSharedFlowByName.js new file mode 100755 index 00000000..4f61fbaa --- /dev/null +++ b/tools/apigee-edge-to-x-migration-tool/src/gateway-clients/apigee-edge/shared-flows/getSharedFlowByName.js @@ -0,0 +1,27 @@ +/** + * Copyright 2025 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +import ApigeeEdgeClient from "../ApigeeEdgeClient.js"; + +/** + * + * @param {ApigeeEdgeClient} apigeeEdgeClient + * @param {string} sharedFlowName + * @returns + */ +export default async function getApigeeEdgeSharedFlowByName(apigeeEdgeClient, sharedFlowName) { + return apigeeEdgeClient.get(`/sharedflows/${sharedFlowName}`); +} diff --git a/tools/apigee-edge-to-x-migration-tool/src/gateway-clients/apigee-edge/shared-flows/getSharedFlowDeployments.js b/tools/apigee-edge-to-x-migration-tool/src/gateway-clients/apigee-edge/shared-flows/getSharedFlowDeployments.js new file mode 100755 index 00000000..45b96c14 --- /dev/null +++ b/tools/apigee-edge-to-x-migration-tool/src/gateway-clients/apigee-edge/shared-flows/getSharedFlowDeployments.js @@ -0,0 +1,27 @@ +/** + * Copyright 2025 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +import ApigeeEdgeClient from "../ApigeeEdgeClient.js"; + +/** + * + * @param {ApigeeEdgeClient} apigeeEdgeClient + * @param {string} sharedFlowName + * @returns + */ +export default async function getApigeeEdgeSharedFlowDeployments(apigeeEdgeClient, sharedFlowName) { + return apigeeEdgeClient.get(`/sharedflows/${sharedFlowName}/deployments`); +} diff --git a/tools/apigee-edge-to-x-migration-tool/src/gateway-clients/apigee-edge/shared-flows/getSharedFlowNames.js b/tools/apigee-edge-to-x-migration-tool/src/gateway-clients/apigee-edge/shared-flows/getSharedFlowNames.js new file mode 100755 index 00000000..daa41861 --- /dev/null +++ b/tools/apigee-edge-to-x-migration-tool/src/gateway-clients/apigee-edge/shared-flows/getSharedFlowNames.js @@ -0,0 +1,57 @@ +/** + * Copyright 2025 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +import querystring from 'node:querystring'; +import ApigeeEdgeClient from "../ApigeeEdgeClient.js"; + +/** + * + * @param {ApigeeEdgeClient} apigeeEdgeClient + * @param {(string) => Promise} callback + * @param {string|null} startKey + * @returns {array} + */ +export default async function getApigeeEdgeSharedFlowNames(apigeeEdgeClient, callback = null, startKey = null) { + const query = { + count: 100 // Max results that Apigee cloud can return at once + }; + + if (startKey) { + query.startKey = startKey; + } + + return apigeeEdgeClient.get(`/sharedflows?${querystring.stringify(query)}`).then(async sharedFlows => { + if (startKey) { + // Remove the first item from the list, since it will be the last item from the list on the previous call. + sharedFlows.shift(); + } + + if (typeof callback === 'function') { + for (let sharedFlow of sharedFlows) { + await callback(sharedFlow); + } + } + + const lastSharedFlowName = sharedFlows.length > 0 ? sharedFlows.at(sharedFlows.length - 1) : null; + + if (lastSharedFlowName && lastSharedFlowName.length > 0) { + // Keep fetching until there are no more results\ + return getApigeeEdgeSharedFlowNames(apigeeEdgeClient, callback, lastSharedFlowName).then(results => sharedFlows.concat(results)); + } + + return sharedFlows; + }); +} diff --git a/tools/apigee-edge-to-x-migration-tool/src/gateway-clients/apigee-edge/shared-flows/index.js b/tools/apigee-edge-to-x-migration-tool/src/gateway-clients/apigee-edge/shared-flows/index.js new file mode 100644 index 00000000..3290344d --- /dev/null +++ b/tools/apigee-edge-to-x-migration-tool/src/gateway-clients/apigee-edge/shared-flows/index.js @@ -0,0 +1,27 @@ +/** + * Copyright 2025 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +import getApigeeEdgeSharedFlowBundle from "./getSharedFlowBundle.js"; +import getApigeeEdgeSharedFlowByName from "./getSharedFlowByName.js"; +import getApigeeEdgeSharedFlowDeployments from "./getSharedFlowDeployments.js"; +import getApigeeEdgeSharedFlowNames from "./getSharedFlowNames.js"; + +export { + getApigeeEdgeSharedFlowBundle, + getApigeeEdgeSharedFlowByName, + getApigeeEdgeSharedFlowDeployments, + getApigeeEdgeSharedFlowNames +} diff --git a/tools/apigee-edge-to-x-migration-tool/src/gateway-clients/apigee-x/ApigeeXClient.js b/tools/apigee-edge-to-x-migration-tool/src/gateway-clients/apigee-x/ApigeeXClient.js new file mode 100644 index 00000000..b1c183bf --- /dev/null +++ b/tools/apigee-edge-to-x-migration-tool/src/gateway-clients/apigee-x/ApigeeXClient.js @@ -0,0 +1,237 @@ +/** + * Copyright 2025 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +import temp from 'temp'; +import fs from 'fs'; +import Bottleneck from 'bottleneck'; +import querystring from 'node:querystring'; +import crypto from 'crypto'; +import Logger from '../../utils/logHandler.js'; +import urlSafeBase64Encode from '../../utils/urlSafeBase64Encode.js' +import { pipeline } from 'node:stream/promises'; + +temp.track(); + +class ApigeeXClient { + /** + * @type {string} + */ + baseUrl = null; + + /** + * @type {string} + */ + org = null; + + /** + * @type {string} + */ + serviceAccount = null; + + /** + * @type {string} + */ + token = null; + + /** + * @type {Bottleneck} + */ + limiter = null; + + /** + * + * @param {string} baseUrl + * @param {string} org + */ + constructor(baseUrl, org, serviceAccount) { + this.baseUrl = baseUrl; + this.org = org; + this.serviceAccount = serviceAccount; + + // Apigee X has a rate limit of 10,000 calls per minute to its management APIs + const managementApiRateLimitPerMinute = 10000; + const rateLimitPerMinute = managementApiRateLimitPerMinute * 0.1; + + // Restrict management API calls to 10% of the Apigee managemnet API rate limit per minute + this.limiter = new Bottleneck({ + reservoir: rateLimitPerMinute, + reservoirRefreshAmount: rateLimitPerMinute, + reservoirRefreshInterval: 60 * 1000, // Every 60 seconds + minTime: 5 // Enforce slight spacing between calls + }) + } + + /** + * + * @param {string} url + * @returns + */ + async get(url, options = {}) { + return this.call(url, 'GET', null, options); + } + + /** + * + * @param {string} url + * @param {*} body + * @returns + */ + async post(url, body, options = {}) { + return this.call(url, 'POST', body, options); + } + + /** + * + * @param {string} url + * @param {*} body + * @returns + */ + async put(url, body, options = {}) { + return this.call(url, 'PUT', body, options); + } + + /** + * + * @param {string} url + * @returns + */ + async delete(url, options = {}) { + return this.call(url, 'DELETE', null, options); + } + + /** + * Get a bearer token to use when calling Apigee X Management APIs. + * + * @returns {Promise} + */ + async _getToken() { + if (this.token) { + return this.token; + } + + const issueDate = Date.now() / 1000; + const privateKeyId = this.serviceAccount?.account_json_key?.private_key_id ?? null; + const privateKey = this.serviceAccount?.account_json_key?.private_key ?? null; + const clientEmail = this.serviceAccount?.account_json_key?.client_email ?? null; + + const jwtHeader = { + alg: "RS256", + typ: "JWT", + kid: privateKeyId + }; + + const jwtClaims = { + iss: clientEmail, + //sub: 'charles.thomas1@concentrix.com', + scope: "https://www.googleapis.com/auth/cloud-platform", + aud: "https://oauth2.googleapis.com/token", + exp: issueDate + (60 * 15), // 15 minutes + iat: issueDate + } + + const jws = `${urlSafeBase64Encode(JSON.stringify(jwtHeader))}.${urlSafeBase64Encode(JSON.stringify(jwtClaims))}`; + + // Create a sign object + const sign = crypto.createSign('RSA-SHA256'); + + // Update the sign object with the data + sign.update(jws); + + // Sign the data + const signature = sign.sign(privateKey, 'base64').replace(/\+/g, '-').replace(/\//g, '_').replace(/=+$/, ''); + + const jwt = `${jws}.${signature}`; + + return fetch('https://oauth2.googleapis.com/token', { + method: 'POST', + body: querystring.stringify({ + assertion: jwt, + grant_type: 'urn:ietf:params:oauth:grant-type:jwt-bearer' + }), + headers: { + 'Content-Type': 'application/x-www-form-urlencoded;charset=utf-8', + 'Accept': 'application/json;charset=utf-8', + 'Authorization': 'Basic ZWRnZWNsaTplZGdlY2xpc2VjcmV0' + } + }).then(async res => { + if (!res.ok) { + throw new Error(`Apigee X authentication error status: ${res.status}, message: ${await res.text() || res.statusText}`); + } + + const resJson = await res.json(); + + this.token = resJson?.access_token ?? null; + + if (!this.token) { + throw new Error('Apigee X did not return an access token.'); + } + + return this.token; + }).catch(error => { + Logger.getInstance().error('apigee_x_client', 'Unable to get bearer token', error.message); + throw new Error(`Unable to authenticate to Apigee X using service account. ${error.message}`); + }); + } + + /** + * + * @param {string} url + * @param {string} method + * @param {string} body + * @returns + */ + async call(url, method, body, options = {}) { + return this.limiter.schedule(async () => { + const bearerToken = await this._getToken(); + + Logger.getInstance().log('apigee_x_call', `Apigee X Call: ${method} ${this.baseUrl}${this.org}${url}`, body); + + return fetch(`${this.baseUrl}${this.org}${url}`, { + method, + body, + headers: { + 'accept': '*/*', + 'Content-type': body instanceof Buffer ? 'application/octet-stream' : 'application/json', + 'Authorization': `Bearer ${bearerToken}` + } + }).then(async res => { + if (!res.ok) { + throw new Error(await res.text() || res.statusText); + } + + if (res.headers.get('content-type').includes('application/json')) { + return res.json(); + } + + if (res.headers.get('content-type').includes('application/octet-stream')) { + const downloadFilePath = options?.downloadFilePath ?? null; + const writeStream = downloadFilePath ? fs.createWriteStream(downloadFilePath) : temp.createWriteStream(); + const writeStreamPath = writeStream.path; + + return pipeline(res.body, writeStream).then(() => writeStreamPath); + } + + return res.text(); + }).catch(error => { + Logger.getInstance().error('apigee_x_call', `Error response from Apigee X ${method} ${this.baseUrl}${this.org}${url}`, error.message); + + throw error; + }); + }) + } +} + +export default ApigeeXClient; \ No newline at end of file diff --git a/tools/apigee-edge-to-x-migration-tool/src/gateway-clients/apigee-x/api-products/createApiProduct.js b/tools/apigee-edge-to-x-migration-tool/src/gateway-clients/apigee-x/api-products/createApiProduct.js new file mode 100755 index 00000000..9084b2f9 --- /dev/null +++ b/tools/apigee-edge-to-x-migration-tool/src/gateway-clients/apigee-x/api-products/createApiProduct.js @@ -0,0 +1,27 @@ +/** + * Copyright 2025 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +import ApigeeXClient from "../ApigeeXClient.js"; + +/** + * + * @param {ApigeeXClient} apigeeXClient + * @param {string} apiProductName + * @returns {Promise<*>} + */ +export default async function createApigeeXApiProduct(apigeeXClient, apiProduct) { + return apigeeXClient.post(`/apiproducts`, apiProduct); +} diff --git a/tools/apigee-edge-to-x-migration-tool/src/gateway-clients/apigee-x/api-products/deleteApiProductByName.js b/tools/apigee-edge-to-x-migration-tool/src/gateway-clients/apigee-x/api-products/deleteApiProductByName.js new file mode 100755 index 00000000..c50b2400 --- /dev/null +++ b/tools/apigee-edge-to-x-migration-tool/src/gateway-clients/apigee-x/api-products/deleteApiProductByName.js @@ -0,0 +1,27 @@ +/** + * Copyright 2025 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +import ApigeeXClient from "../ApigeeXClient.js"; + +/** + * + * @param {ApigeeXClient} apigeeXClient + * @param {string} apiProductName + * @returns {Promise<*>} + */ +export default async function deleteApigeeXApiProductByName(apigeeXClient, apiProductName) { + return apigeeXClient.delete(`/apiproducts/${apiProductName}`); +} diff --git a/tools/apigee-edge-to-x-migration-tool/src/gateway-clients/apigee-x/api-products/getApiProductByName.js b/tools/apigee-edge-to-x-migration-tool/src/gateway-clients/apigee-x/api-products/getApiProductByName.js new file mode 100755 index 00000000..8ceda3d2 --- /dev/null +++ b/tools/apigee-edge-to-x-migration-tool/src/gateway-clients/apigee-x/api-products/getApiProductByName.js @@ -0,0 +1,27 @@ +/** + * Copyright 2025 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +import ApigeeXClient from "../ApigeeXClient.js"; + +/** + * + * @param {ApigeeXClient} apigeeXClient + * @param {string} apiProductName + * @returns {Promise<*>} + */ +export default async function getApigeeXApiProductByName(apigeeXClient, apiProductName) { + return apigeeXClient.get(`/apiproducts/${apiProductName}`); +} diff --git a/tools/apigee-edge-to-x-migration-tool/src/gateway-clients/apigee-x/api-products/getApiProducts.js b/tools/apigee-edge-to-x-migration-tool/src/gateway-clients/apigee-x/api-products/getApiProducts.js new file mode 100755 index 00000000..38d6b9b7 --- /dev/null +++ b/tools/apigee-edge-to-x-migration-tool/src/gateway-clients/apigee-x/api-products/getApiProducts.js @@ -0,0 +1,58 @@ +/** + * Copyright 2025 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +import querystring from 'node:querystring'; +import ApigeeXClient from "../ApigeeXClient.js"; + +/** + * + * @param {ApigeeXClient} apigeeXClient + * @param {(string) => Promise} callback + * @param {string|null} startKey + * @returns {array} + */ +export default async function getApigeeXApiProducts(apigeeXClient, callback = null, startKey = null) { + const query = { + count: 1000 // Max results that Apigee cloud can return at once + }; + + if (startKey) { + query.startKey = startKey; + } + + return apigeeXClient.get(`/apiproducts?${querystring.stringify(query)}`).then(async apiproducts => { + + if (startKey) { + // Remove the first item from the list, since it will be the last item from the list on the previous call. + apiproducts.shift(); + } + + if (typeof callback === 'function') { + for (let apiproduct of apiproducts) { + await callback(apiproduct); + } + } + + const lastApiProductName = apiproducts.length > 0 ? apiproducts.at(apiproducts.length - 1) : null; + + if (lastApiProductName && lastApiProductName.length > 0) { + // Keep fetching until there are no more results\ + return getApigeeXApiProducts(apigeeXClient, callback, lastApiProductName).then(results => apiproducts.concat(results)); + } + + return apiproducts; + }); +} \ No newline at end of file diff --git a/tools/apigee-edge-to-x-migration-tool/src/gateway-clients/apigee-x/api-products/index.js b/tools/apigee-edge-to-x-migration-tool/src/gateway-clients/apigee-x/api-products/index.js new file mode 100644 index 00000000..70f622e2 --- /dev/null +++ b/tools/apigee-edge-to-x-migration-tool/src/gateway-clients/apigee-x/api-products/index.js @@ -0,0 +1,29 @@ +/** + * Copyright 2025 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +import createApigeeXApiProduct from "./createApiProduct.js"; +import updateApigeeXApiProduct from "./updateApiProduct.js"; +import getApigeeXApiProducts from "./getApiProducts.js"; +import getApigeeXApiProductByName from "./getApiProductByName.js"; +import deleteApigeeXApiProductByName from "./deleteApiProductByName.js"; + +export { + createApigeeXApiProduct, + updateApigeeXApiProduct, + getApigeeXApiProducts, + getApigeeXApiProductByName, + deleteApigeeXApiProductByName +} diff --git a/tools/apigee-edge-to-x-migration-tool/src/gateway-clients/apigee-x/api-products/updateApiProduct.js b/tools/apigee-edge-to-x-migration-tool/src/gateway-clients/apigee-x/api-products/updateApiProduct.js new file mode 100755 index 00000000..b62e7fe4 --- /dev/null +++ b/tools/apigee-edge-to-x-migration-tool/src/gateway-clients/apigee-x/api-products/updateApiProduct.js @@ -0,0 +1,27 @@ +/** + * Copyright 2025 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +import ApigeeXClient from "../ApigeeXClient.js"; + +/** + * + * @param {ApigeeXClient} apigeeXClient + * @param {string} apiProductName + * @returns {Promise<*>} + */ +export default async function updateApigeeXApiProduct(apigeeXClient, apiProductName, apiProduct) { + return apigeeXClient.put(`/apiproducts/${apiProductName}`, apiProduct); +} diff --git a/tools/apigee-edge-to-x-migration-tool/src/gateway-clients/apigee-x/api-proxies/createApiProxy.js b/tools/apigee-edge-to-x-migration-tool/src/gateway-clients/apigee-x/api-proxies/createApiProxy.js new file mode 100755 index 00000000..924b753a --- /dev/null +++ b/tools/apigee-edge-to-x-migration-tool/src/gateway-clients/apigee-x/api-proxies/createApiProxy.js @@ -0,0 +1,33 @@ +/** + * Copyright 2025 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +import querystring from 'node:querystring'; +import ApigeeXClient from "../ApigeeXClient.js"; + +/** + * + * @param {ApigeeXClient} apigeeXClient + * @param {*} bundle + * @returns {Promise} The created API Proxy + */ +export default async function createApigeeXApiProxy(apigeeXClient, proxyName, bundle) { + const query = querystring.stringify({ + name: proxyName, + action: 'import' + }) + + return apigeeXClient.post(`/apis?${query}`, bundle); +} diff --git a/tools/apigee-edge-to-x-migration-tool/src/gateway-clients/apigee-x/api-proxies/deleteApiProxyByName.js b/tools/apigee-edge-to-x-migration-tool/src/gateway-clients/apigee-x/api-proxies/deleteApiProxyByName.js new file mode 100755 index 00000000..0983a813 --- /dev/null +++ b/tools/apigee-edge-to-x-migration-tool/src/gateway-clients/apigee-x/api-proxies/deleteApiProxyByName.js @@ -0,0 +1,27 @@ +/** + * Copyright 2025 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +import ApigeeXClient from "../ApigeeXClient.js"; + +/** + * + * @param {ApigeeXClient} apigeeXClient + * @param {string} apiProxyName + * @returns + */ +export default async function deleteApigeeXApiProxyByName(apigeeXClient, apiProxyName) { + return apigeeXClient.delete(`/apis/${apiProxyName}`); +} diff --git a/tools/apigee-edge-to-x-migration-tool/src/gateway-clients/apigee-x/api-proxies/deployApiRevision.js b/tools/apigee-edge-to-x-migration-tool/src/gateway-clients/apigee-x/api-proxies/deployApiRevision.js new file mode 100644 index 00000000..57ad9401 --- /dev/null +++ b/tools/apigee-edge-to-x-migration-tool/src/gateway-clients/apigee-x/api-proxies/deployApiRevision.js @@ -0,0 +1,34 @@ +/** + * Copyright 2025 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +import ApigeeXClient from "../ApigeeXClient.js"; +import querystring from 'node:querystring'; + +/** + * Deploys a specific revision of an API Proxy to a given environment in Apigee X. + * + * @param {ApigeeXClient} apigeeXClient - An instance of the ApigeeXClient, used to interact with the Apigee X API. + * @param {string} apigeeEnvironment - The environment in Apigee X where the API Proxy should be deployed (e.g., 'test', 'prod'). + * @param {string} apiProxyName - The name of the API Proxy to be deployed. + * @param {string} revision - The specific revision number of the API Proxy to deploy. + * @returns {Promise} A promise that resolves to a string confirming the deployment of the API Proxy revision. + */ +export default async function deployApiRevision(apigeeXClient, apigeeEnvironment, apiProxyName, revision, override = true) { + const query = querystring.stringify({ + override: override + }) + return apigeeXClient.post(`/environments/${apigeeEnvironment}/apis/${apiProxyName}/revisions/${revision}/deployments?${query}`); +} \ No newline at end of file diff --git a/tools/apigee-edge-to-x-migration-tool/src/gateway-clients/apigee-x/api-proxies/getApiProxyBundle.js b/tools/apigee-edge-to-x-migration-tool/src/gateway-clients/apigee-x/api-proxies/getApiProxyBundle.js new file mode 100755 index 00000000..27cd84c5 --- /dev/null +++ b/tools/apigee-edge-to-x-migration-tool/src/gateway-clients/apigee-x/api-proxies/getApiProxyBundle.js @@ -0,0 +1,30 @@ +/** + * Copyright 2025 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +import ApigeeXClient from "../ApigeeXClient.js"; + +/** + * + * @param {ApigeeXClient} apigeeXClient + * @param {string} apiProxyName + * @param {string} apiProxyRev + * @returns {Promise} The filepath for the downloaded API proxy bundle + */ +export default async function getApigeeXApiProxyBundle(apigeeXClient, apiProxyName, apiProxyRevision, destBundleFilePath = null) { + return apigeeXClient.get(`/apis/${apiProxyName}/revisions/${apiProxyRevision}?format=bundle`, { + downloadFilePath: destBundleFilePath + }); +} diff --git a/tools/apigee-edge-to-x-migration-tool/src/gateway-clients/apigee-x/api-proxies/getApiProxyDeployments.js b/tools/apigee-edge-to-x-migration-tool/src/gateway-clients/apigee-x/api-proxies/getApiProxyDeployments.js new file mode 100755 index 00000000..f063e7cd --- /dev/null +++ b/tools/apigee-edge-to-x-migration-tool/src/gateway-clients/apigee-x/api-proxies/getApiProxyDeployments.js @@ -0,0 +1,27 @@ +/** + * Copyright 2025 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +import ApigeeXClient from "../ApigeeXClient.js"; + +/** + * + * @param {ApigeeXClient} apigeeXClient + * @param {string} apiProxyName + * @returns + */ +export default async function getApigeeXApiProxyDeployments(apigeeXClient, apiProxyName) { + return apigeeXClient.get(`/apis/${apiProxyName}/deployments`); +} diff --git a/tools/apigee-edge-to-x-migration-tool/src/gateway-clients/apigee-x/api-proxies/getApiProxyNames.js b/tools/apigee-edge-to-x-migration-tool/src/gateway-clients/apigee-x/api-proxies/getApiProxyNames.js new file mode 100755 index 00000000..925040b1 --- /dev/null +++ b/tools/apigee-edge-to-x-migration-tool/src/gateway-clients/apigee-x/api-proxies/getApiProxyNames.js @@ -0,0 +1,35 @@ +/** + * Copyright 2025 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +import ApigeeXClient from "../ApigeeXClient.js"; + +/** + * + * @param {ApigeeXClient} apigeeXClient + * @param {(string) => Promise} callback + * @returns {array} + */ +export default async function getApigeeXApiProxyNames(apigeeXClient, callback = null) { + return apigeeXClient.get(`/apis`).then(async proxies => { + if (typeof callback === 'function') { + for (let proxy of proxies) { + await callback(proxy); + } + } + + return proxies; + }); +} diff --git a/tools/apigee-edge-to-x-migration-tool/src/gateway-clients/apigee-x/api-proxies/getApiProxyRevisionDeployment.js b/tools/apigee-edge-to-x-migration-tool/src/gateway-clients/apigee-x/api-proxies/getApiProxyRevisionDeployment.js new file mode 100755 index 00000000..6c3f6acd --- /dev/null +++ b/tools/apigee-edge-to-x-migration-tool/src/gateway-clients/apigee-x/api-proxies/getApiProxyRevisionDeployment.js @@ -0,0 +1,30 @@ +/** + * Copyright 2025 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +import ApigeeXClient from "../ApigeeXClient.js"; + +/** + * Deploys a specific revision of an API Proxy to a given environment in Apigee X. + * + * @param {ApigeeXClient} apigeeXClient - An instance of the ApigeeXClient, used to interact with the Apigee X API. + * @param {string} apigeeEnvironment - The environment in Apigee X where the API Proxy should be deployed (e.g., 'test', 'prod'). + * @param {string} apiProxyName - The name of the API Proxy to be deployed. + * @param {string} revision - The specific revision number of the API Proxy to deploy. + * @returns {Promise} A promise that resolves to a string confirming the deployment of the API Proxy revision. + */ +export default async function getApiProxyRevisionDeployment(apigeeXClient, apigeeEnvironment, apiProxyName, revision) { + return apigeeXClient.get(`/environments/${apigeeEnvironment}/apis/${apiProxyName}/revisions/${revision}/deployments`); +} \ No newline at end of file diff --git a/tools/apigee-edge-to-x-migration-tool/src/gateway-clients/apigee-x/api-proxies/getApiProxyRevisions.js b/tools/apigee-edge-to-x-migration-tool/src/gateway-clients/apigee-x/api-proxies/getApiProxyRevisions.js new file mode 100755 index 00000000..244294a9 --- /dev/null +++ b/tools/apigee-edge-to-x-migration-tool/src/gateway-clients/apigee-x/api-proxies/getApiProxyRevisions.js @@ -0,0 +1,27 @@ +/** + * Copyright 2025 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +import ApigeeXClient from "../ApigeeXClient.js"; + +/** + * + * @param {ApigeeXClient} apigeeXClient + * @param {string} apiProxyName + * @returns + */ +export default async function getApigeeXApiProxyRevisions(apigeeXClient, apiProxyName) { + return apigeeXClient.get(`/apis/${apiProxyName}/revisions`); +} diff --git a/tools/apigee-edge-to-x-migration-tool/src/gateway-clients/apigee-x/api-proxies/index.js b/tools/apigee-edge-to-x-migration-tool/src/gateway-clients/apigee-x/api-proxies/index.js new file mode 100644 index 00000000..f86e67ed --- /dev/null +++ b/tools/apigee-edge-to-x-migration-tool/src/gateway-clients/apigee-x/api-proxies/index.js @@ -0,0 +1,41 @@ +/** + * Copyright 2025 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +import getApigeeXApiProxyNames from "./getApiProxyNames.js"; +import getApigeeXApiProxyBundle from "./getApiProxyBundle.js"; +import getApigeeXApiProxyDeployments from "./getApiProxyDeployments.js"; +import getApigeeXApiProxyRevisions from "./getApiProxyRevisions.js"; +import getApiProxyRevisionDeployment from "./getApiProxyRevisionDeployment.js" +import validateApigeeXApiProxyBundle from "./validateApiProxyBundle.js"; +import createApigeeXApiProxy from "./createApiProxy.js"; +import updateApigeeXApiProxy from "./updateApiProxy.js"; +import deleteApigeeXApiProxyByName from "./deleteApiProxyByName.js" +import deployApiRevision from "./deployApiRevision.js"; +import undeployApiProxyRevision from "./undeployApiProxyRevision.js" + +export { + getApigeeXApiProxyNames, + getApigeeXApiProxyBundle, + getApigeeXApiProxyDeployments, + getApigeeXApiProxyRevisions, + getApiProxyRevisionDeployment, + validateApigeeXApiProxyBundle, + createApigeeXApiProxy, + updateApigeeXApiProxy, + deleteApigeeXApiProxyByName, + deployApiRevision, + undeployApiProxyRevision +} diff --git a/tools/apigee-edge-to-x-migration-tool/src/gateway-clients/apigee-x/api-proxies/undeployApiProxyRevision.js b/tools/apigee-edge-to-x-migration-tool/src/gateway-clients/apigee-x/api-proxies/undeployApiProxyRevision.js new file mode 100755 index 00000000..7b518e51 --- /dev/null +++ b/tools/apigee-edge-to-x-migration-tool/src/gateway-clients/apigee-x/api-proxies/undeployApiProxyRevision.js @@ -0,0 +1,30 @@ +/** + * Copyright 2025 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +import ApigeeXClient from "../ApigeeXClient.js"; + +/** + * Undeploys a specific revision of an API Proxy to a given environment in Apigee X. + * + * @param {ApigeeXClient} apigeeXClient - An instance of the ApigeeXClient, used to interact with the Apigee X API. + * @param {string} apigeeEnvironment - The environment in Apigee X where the API Proxy is deployed (e.g., 'test', 'prod'). + * @param {string} apiProxyName - The name of the API Proxy to be deployed. + * @param {string} revision - The specific revision number of the API Proxy to undeploy. + * @returns {Promise} A promise that resolves to a string confirming the undeployment of the API Proxy revision. + */ +export default async function undeployApiProxyRevision(apigeeXClient, apigeeEnvironment, apiProxyName, revision) { + return apigeeXClient.delete(`/environments/${apigeeEnvironment}/apis/${apiProxyName}/revisions/${revision}/deployments`); +} \ No newline at end of file diff --git a/tools/apigee-edge-to-x-migration-tool/src/gateway-clients/apigee-x/api-proxies/updateApiProxy.js b/tools/apigee-edge-to-x-migration-tool/src/gateway-clients/apigee-x/api-proxies/updateApiProxy.js new file mode 100755 index 00000000..70568530 --- /dev/null +++ b/tools/apigee-edge-to-x-migration-tool/src/gateway-clients/apigee-x/api-proxies/updateApiProxy.js @@ -0,0 +1,29 @@ +/** + * Copyright 2025 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +import ApigeeXClient from "../ApigeeXClient.js"; + +/** + * + * @param {ApigeeXClient} apigeeXClient + * @param {*} bundle + * @returns {Promise} The created API Proxy + */ +export default async function createApiProxy(apigeeXClient, apiProxyId, bundle) { + const results = await apigeeXClient.put(`/apis/${apiProxyId}`, bundle); + + return results; +} diff --git a/tools/apigee-edge-to-x-migration-tool/src/gateway-clients/apigee-x/api-proxies/validateApiProxyBundle.js b/tools/apigee-edge-to-x-migration-tool/src/gateway-clients/apigee-x/api-proxies/validateApiProxyBundle.js new file mode 100755 index 00000000..a31c9897 --- /dev/null +++ b/tools/apigee-edge-to-x-migration-tool/src/gateway-clients/apigee-x/api-proxies/validateApiProxyBundle.js @@ -0,0 +1,33 @@ +/** + * Copyright 2025 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +import querystring from 'node:querystring'; +import ApigeeXClient from "../ApigeeXClient.js"; + +/** + * + * @param {ApigeeXClient} apigeeXClient + * @param {*} bundle + * @returns {Promise} The filepath for the downloaded API proxy bundle + */ +export default async function validateApiProxyBundle(apigeeXClient, proxyName, bundle) { + const query = querystring.stringify({ + name: proxyName, + action: 'validate' + }) + + return apigeeXClient.post(`/apis?${query}`, bundle); +} diff --git a/tools/apigee-edge-to-x-migration-tool/src/gateway-clients/apigee-x/developer-apps/createDeveloperApp.js b/tools/apigee-edge-to-x-migration-tool/src/gateway-clients/apigee-x/developer-apps/createDeveloperApp.js new file mode 100644 index 00000000..3aad30b0 --- /dev/null +++ b/tools/apigee-edge-to-x-migration-tool/src/gateway-clients/apigee-x/developer-apps/createDeveloperApp.js @@ -0,0 +1,28 @@ +/** + * Copyright 2025 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +import ApigeeXClient from "../ApigeeXClient.js"; + +/** + * + * @param {ApigeeXClient} apigeeXClient + * @param {string} developerID + * @param {object} app + * @returns + */ +export default async function createDeveloperApp(apigeeXClient, developerID, app) { + return apigeeXClient.post(`/developers/${developerID}/apps`, app); +} \ No newline at end of file diff --git a/tools/apigee-edge-to-x-migration-tool/src/gateway-clients/apigee-x/developer-apps/createDeveloperAppKeys.js b/tools/apigee-edge-to-x-migration-tool/src/gateway-clients/apigee-x/developer-apps/createDeveloperAppKeys.js new file mode 100644 index 00000000..3407e342 --- /dev/null +++ b/tools/apigee-edge-to-x-migration-tool/src/gateway-clients/apigee-x/developer-apps/createDeveloperAppKeys.js @@ -0,0 +1,29 @@ +/** + * Copyright 2025 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +import ApigeeXClient from "../ApigeeXClient.js"; + +/** + * + * @param {ApigeeXClient} apigeeXClient + * @param {string} developerID + * @param {string} appName + * @param {object} keyObj + * @returns + */ +export default async function createDeveloperAppKeys(apigeeXClient, developerID, appName, keyObj) { + return apigeeXClient.post(`/developers/${developerID}/apps/${appName}/keys`, keyObj); +} \ No newline at end of file diff --git a/tools/apigee-edge-to-x-migration-tool/src/gateway-clients/apigee-x/developer-apps/deleteDeveloperAppById.js b/tools/apigee-edge-to-x-migration-tool/src/gateway-clients/apigee-x/developer-apps/deleteDeveloperAppById.js new file mode 100755 index 00000000..72eb9e30 --- /dev/null +++ b/tools/apigee-edge-to-x-migration-tool/src/gateway-clients/apigee-x/developer-apps/deleteDeveloperAppById.js @@ -0,0 +1,28 @@ +/** + * Copyright 2025 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +import ApigeeXClient from "../ApigeeXClient.js"; + +/** + * + * @param {ApigeeXClient} apigeeXClient + * @param {string} developerEmail + * @param {string} developerAppId + * @returns + */ +export default async function deleteApigeeXDeveloperAppById(apigeeXClient, developerEmail, developerAppId) { + return apigeeXClient.delete(`/developers/${developerEmail}/apps/${developerAppId}`); +} diff --git a/tools/apigee-edge-to-x-migration-tool/src/gateway-clients/apigee-x/developer-apps/deleteDeveloperAppKeys.js b/tools/apigee-edge-to-x-migration-tool/src/gateway-clients/apigee-x/developer-apps/deleteDeveloperAppKeys.js new file mode 100644 index 00000000..d53efc58 --- /dev/null +++ b/tools/apigee-edge-to-x-migration-tool/src/gateway-clients/apigee-x/developer-apps/deleteDeveloperAppKeys.js @@ -0,0 +1,29 @@ +/** + * Copyright 2025 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +import ApigeeXClient from "../ApigeeXClient.js"; + +/** + * + * @param {ApigeeXClient} apigeeXClient + * @param {string} developerID + * @param {string} appName + * @param {string} key + * @returns + */ +export default async function deleteDeveloperAppKeys(apigeeXClient, developerID, appName, key) { + return apigeeXClient.delete(`/developers/${developerID}/apps/${appName}/keys/${key}`); +} \ No newline at end of file diff --git a/tools/apigee-edge-to-x-migration-tool/src/gateway-clients/apigee-x/developer-apps/getDeveloperAppById.js b/tools/apigee-edge-to-x-migration-tool/src/gateway-clients/apigee-x/developer-apps/getDeveloperAppById.js new file mode 100755 index 00000000..f26fe2c8 --- /dev/null +++ b/tools/apigee-edge-to-x-migration-tool/src/gateway-clients/apigee-x/developer-apps/getDeveloperAppById.js @@ -0,0 +1,27 @@ +/** + * Copyright 2025 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +import ApigeeXClient from "../ApigeeXClient.js"; + +/** + * + * @param {ApigeeXClient} apigeeXClient + * @param {string} appName + * @returns + */ +export default async function getApigeeXDeveloperAppById(apigeeXClient, appName) { + return apigeeXClient.get(`/apps/${appName}`); +} diff --git a/tools/apigee-edge-to-x-migration-tool/src/gateway-clients/apigee-x/developer-apps/getDeveloperApps.js b/tools/apigee-edge-to-x-migration-tool/src/gateway-clients/apigee-x/developer-apps/getDeveloperApps.js new file mode 100755 index 00000000..dac66b2f --- /dev/null +++ b/tools/apigee-edge-to-x-migration-tool/src/gateway-clients/apigee-x/developer-apps/getDeveloperApps.js @@ -0,0 +1,66 @@ +/** + * Copyright 2025 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + + +import querystring from 'node:querystring'; +import ApigeeXClient from '../ApigeeXClient.js'; + +/** + * + * @param {ApigeeXClient} apigeeXClient + * @param {(app) => Promise} callback + * @param {string} startKey + * @returns + */ +async function getApigeeXDeveloperApps(apigeeXClient, callback = null, startKey = null) { + const limit = 1000; // Max results that Apigee public cloud can return at once + + const query = { + expand: true, + rows: limit, + apptype: 'developer' + }; + + if (startKey) { + query.startKey = startKey; + } + + return apigeeXClient.get(`/apps?${querystring.stringify(query)}`).then(async response => { + const developerApps = response?.app ?? []; + + if (startKey) { + // Remove the first item from the list, since it will be the last item from the list on the previous call. + developerApps.shift(); + } + + if (typeof callback === 'function') { + for (let developerApp of developerApps) { + await callback(developerApp); + } + } + + const lastAppId = developerApps.length > 0 ? developerApps.at(developerApps.length - 1).appId : null; + + if (lastAppId && lastAppId.length > 0) { + // Keep fetching until there are no more results\ + return getApigeeXDeveloperApps(apigeeXClient, callback, lastAppId).then(results => developerApps.concat(results)); + } + + return developerApps; + }); +} + +export default getApigeeXDeveloperApps; \ No newline at end of file diff --git a/tools/apigee-edge-to-x-migration-tool/src/gateway-clients/apigee-x/developer-apps/getDeveloperAppsByDeveloperId.js b/tools/apigee-edge-to-x-migration-tool/src/gateway-clients/apigee-x/developer-apps/getDeveloperAppsByDeveloperId.js new file mode 100755 index 00000000..111590b0 --- /dev/null +++ b/tools/apigee-edge-to-x-migration-tool/src/gateway-clients/apigee-x/developer-apps/getDeveloperAppsByDeveloperId.js @@ -0,0 +1,66 @@ +/** + * Copyright 2025 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + + +import querystring from 'node:querystring'; +import ApigeeXClient from '../ApigeeXClient.js'; + +/** + * + * @param {ApigeeXClient} apigeeXClient + * @param {(app) => Promise} callback + * @param {string} startKey + * @returns + */ +async function getApigeeXDeveloperAppsByDeveloperId(apigeeXClient, developerEmail, callback = null, startKey = null) { + const limit = 100; // Max results that Apigee public cloud can return at once + + const query = { + expand: true, + rows: limit, + apptype: 'developer' + }; + + if (startKey) { + query.startKey = startKey; + } + + return apigeeXClient.get(`/developers/${developerEmail}/apps?${querystring.stringify(query)}`).then(async response => { + const developerApps = response?.app ?? []; + + if (startKey) { + // Remove the first item from the list, since it will be the last item from the list on the previous call. + developerApps.shift(); + } + + if (typeof callback === 'function') { + for (let developerApp of developerApps) { + await callback(developerApp); + } + } + + const lastAppId = developerApps.length > 0 ? developerApps.at(developerApps.length - 1).appId : null; + + if (lastAppId && lastAppId.length > 0) { + // Keep fetching until there are no more results\ + return getApigeeXDeveloperAppsByDeveloperId(apigeeXClient, developerEmail, callback, lastAppId).then(results => developerApps.concat(results)); + } + + return developerApps; + }); +} + +export default getApigeeXDeveloperAppsByDeveloperId; \ No newline at end of file diff --git a/tools/apigee-edge-to-x-migration-tool/src/gateway-clients/apigee-x/developer-apps/index.js b/tools/apigee-edge-to-x-migration-tool/src/gateway-clients/apigee-x/developer-apps/index.js new file mode 100644 index 00000000..f987b7d9 --- /dev/null +++ b/tools/apigee-edge-to-x-migration-tool/src/gateway-clients/apigee-x/developer-apps/index.js @@ -0,0 +1,37 @@ +/** + * Copyright 2025 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +import getApigeeXDeveloperApps from "./getDeveloperApps.js"; +import getApigeeXDeveloperAppsByDeveloperId from "./getDeveloperAppsByDeveloperId.js"; +import getApigeeXDeveloperAppById from "./getDeveloperAppById.js"; +import createDeveloperApp from "./createDeveloperApp.js"; +import createDeveloperAppKeys from "./createDeveloperAppKeys.js"; +import updateDeveloperApp from "./updateDeveloperApp.js" +import updateDeveloperAppKeys from "./updateDeveloperAppKeys.js"; +import deleteDeveloperAppKeys from "./deleteDeveloperAppKeys.js"; +import deleteApigeeXDeveloperAppById from "./deleteDeveloperAppById.js"; + +export { + getApigeeXDeveloperApps, + getApigeeXDeveloperAppsByDeveloperId, + getApigeeXDeveloperAppById, + createDeveloperApp, + updateDeveloperApp, + createDeveloperAppKeys, + updateDeveloperAppKeys, + deleteDeveloperAppKeys, + deleteApigeeXDeveloperAppById +} diff --git a/tools/apigee-edge-to-x-migration-tool/src/gateway-clients/apigee-x/developer-apps/updateDeveloperApp.js b/tools/apigee-edge-to-x-migration-tool/src/gateway-clients/apigee-x/developer-apps/updateDeveloperApp.js new file mode 100644 index 00000000..03920d97 --- /dev/null +++ b/tools/apigee-edge-to-x-migration-tool/src/gateway-clients/apigee-x/developer-apps/updateDeveloperApp.js @@ -0,0 +1,28 @@ +/** + * Copyright 2025 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +import ApigeeXClient from "../ApigeeXClient.js"; + +/** + * + * @param {ApigeeXClient} apigeeXClient + * @param {string} developerID + * @param {object} app + * @returns + */ +export default async function updateDeveloperApp(apigeeXClient, developerEmail, appName, app) { + return apigeeXClient.put(`/developers/${developerEmail}/apps/${appName}`, app); +} \ No newline at end of file diff --git a/tools/apigee-edge-to-x-migration-tool/src/gateway-clients/apigee-x/developer-apps/updateDeveloperAppKeys.js b/tools/apigee-edge-to-x-migration-tool/src/gateway-clients/apigee-x/developer-apps/updateDeveloperAppKeys.js new file mode 100644 index 00000000..a08840d1 --- /dev/null +++ b/tools/apigee-edge-to-x-migration-tool/src/gateway-clients/apigee-x/developer-apps/updateDeveloperAppKeys.js @@ -0,0 +1,30 @@ +/** + * Copyright 2025 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +import ApigeeXClient from "../ApigeeXClient.js"; + +/** + * + * @param {ApigeeXClient} apigeeXClient + * @param {string} developerID + * @param {string} appName + * @param {string} key + * @param {object} keyObj + * @returns + */ +export default async function updateDeveloperAppKeys(apigeeXClient, developerID, appName, key, keyObj) { + return apigeeXClient.post(`/developers/${developerID}/apps/${appName}/keys/${key}`, keyObj); +} \ No newline at end of file diff --git a/tools/apigee-edge-to-x-migration-tool/src/gateway-clients/apigee-x/developers/createDevelopers.js b/tools/apigee-edge-to-x-migration-tool/src/gateway-clients/apigee-x/developers/createDevelopers.js new file mode 100644 index 00000000..24153c37 --- /dev/null +++ b/tools/apigee-edge-to-x-migration-tool/src/gateway-clients/apigee-x/developers/createDevelopers.js @@ -0,0 +1,27 @@ +/** + * Copyright 2025 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +import ApigeeXClient from "../ApigeeXClient.js"; + +/** + * + * @param {ApigeeXClient} apigeeXClient + * @param {object} developer + * @returns + */ +export default async function createApigeeXDeveloper(apigeeXClient, developer) { + return apigeeXClient.post(`/developers`, developer); +} \ No newline at end of file diff --git a/tools/apigee-edge-to-x-migration-tool/src/gateway-clients/apigee-x/developers/deleteDeveloperById.js b/tools/apigee-edge-to-x-migration-tool/src/gateway-clients/apigee-x/developers/deleteDeveloperById.js new file mode 100755 index 00000000..35d28d9c --- /dev/null +++ b/tools/apigee-edge-to-x-migration-tool/src/gateway-clients/apigee-x/developers/deleteDeveloperById.js @@ -0,0 +1,27 @@ +/** + * Copyright 2025 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +import ApigeeXClient from "../ApigeeXClient.js"; + +/** + * + * @param {ApigeeXClient} apigeeXClient + * @param {string} developerId + * @returns + */ +export default async function deleteApigeeXDeveloperById(apigeeXClient, developerId) { + return apigeeXClient.delete(`/developers/${developerId}`); +} diff --git a/tools/apigee-edge-to-x-migration-tool/src/gateway-clients/apigee-x/developers/getDeveloperById.js b/tools/apigee-edge-to-x-migration-tool/src/gateway-clients/apigee-x/developers/getDeveloperById.js new file mode 100755 index 00000000..90b0290b --- /dev/null +++ b/tools/apigee-edge-to-x-migration-tool/src/gateway-clients/apigee-x/developers/getDeveloperById.js @@ -0,0 +1,27 @@ +/** + * Copyright 2025 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +import ApigeeXClient from "../ApigeeXClient.js"; + +/** + * + * @param {ApigeeXClient} apigeeXClient + * @param {string} developerId + * @returns + */ +export default async function getApigeeXDeveloperById(apigeeXClient, developerId) { + return apigeeXClient.get(`/developers/${developerId}`); +} \ No newline at end of file diff --git a/tools/apigee-edge-to-x-migration-tool/src/gateway-clients/apigee-x/developers/getDevelopers.js b/tools/apigee-edge-to-x-migration-tool/src/gateway-clients/apigee-x/developers/getDevelopers.js new file mode 100755 index 00000000..f8fa0dc8 --- /dev/null +++ b/tools/apigee-edge-to-x-migration-tool/src/gateway-clients/apigee-x/developers/getDevelopers.js @@ -0,0 +1,65 @@ +/** + * Copyright 2025 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + + +import querystring from 'node:querystring'; +import ApigeeXClient from '../ApigeeXClient.js'; + +/** + * + * @param {ApigeeXClient} apigeeXClient + * @param {(developer)} callback + * @param {string} startKey + * @returns + */ +async function getApigeeXDevelopers(apigeeXClient, callback = null, startKey = null) { + const limit = 1000; // Max results that Apigee cloud can return at once + + const query = { + expand: true, + count: limit + }; + + if (startKey) { + query.startKey = startKey; + } + + return apigeeXClient.get(`/developers?${querystring.stringify(query)}`).then(async response => { + const developers = response?.developer ?? []; + + if (startKey) { + // Remove the first item from the list, since it will be the last item from the list on the previous call. + developers.shift(); + } + + if (typeof callback === 'function') { + for (let developer of developers) { + callback(developer); + } + } + + const lastEmail = developers.length > 0 ? developers.at(developers.length - 1).email : null; + + if (lastEmail && lastEmail.length > 0) { + // Keep fetching until there are no more results\ + return getApigeeXDevelopers(apigeeXClient, callback, lastEmail).then(results => developers.concat(results)); + } + + return developers; + }); +} + +export default getApigeeXDevelopers; \ No newline at end of file diff --git a/tools/apigee-edge-to-x-migration-tool/src/gateway-clients/apigee-x/developers/index.js b/tools/apigee-edge-to-x-migration-tool/src/gateway-clients/apigee-x/developers/index.js new file mode 100644 index 00000000..7142086a --- /dev/null +++ b/tools/apigee-edge-to-x-migration-tool/src/gateway-clients/apigee-x/developers/index.js @@ -0,0 +1,29 @@ +/** + * Copyright 2025 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +import getApigeeXDevelopers from "./getDevelopers.js"; +import getApigeeXDeveloperById from "./getDeveloperById.js"; +import deleteApigeeXDeveloperById from "./deleteDeveloperById.js"; +import createApigeeXDeveloper from "./createDevelopers.js" +import updateApigeeXDeveloperById from "./updateDeveloperById.js" + +export { + getApigeeXDevelopers, + getApigeeXDeveloperById, + deleteApigeeXDeveloperById, + createApigeeXDeveloper, + updateApigeeXDeveloperById +} \ No newline at end of file diff --git a/tools/apigee-edge-to-x-migration-tool/src/gateway-clients/apigee-x/developers/updateDeveloperById.js b/tools/apigee-edge-to-x-migration-tool/src/gateway-clients/apigee-x/developers/updateDeveloperById.js new file mode 100644 index 00000000..0e5b5f04 --- /dev/null +++ b/tools/apigee-edge-to-x-migration-tool/src/gateway-clients/apigee-x/developers/updateDeveloperById.js @@ -0,0 +1,28 @@ +/** + * Copyright 2025 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +import ApigeeXClient from "../ApigeeXClient.js"; + +/** + * + * @param {ApigeeXClient} apigeeXClient + * @param {string} developerID + * @param {object} app + * @returns + */ +export default async function updateApigeeXDeveloperById(apigeeXClient, developerId, developer) { + return apigeeXClient.put(`/developers/${developerId}`, developer); +} \ No newline at end of file diff --git a/tools/apigee-edge-to-x-migration-tool/src/gateway-clients/apigee-x/keyValueMaps/createEnvKVMEntries.js b/tools/apigee-edge-to-x-migration-tool/src/gateway-clients/apigee-x/keyValueMaps/createEnvKVMEntries.js new file mode 100644 index 00000000..22b4a679 --- /dev/null +++ b/tools/apigee-edge-to-x-migration-tool/src/gateway-clients/apigee-x/keyValueMaps/createEnvKVMEntries.js @@ -0,0 +1,26 @@ +/** + * Copyright 2025 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +import ApigeeXClient from "../ApigeeXClient.js"; + +/** + * + * @param {ApigeeXClient} apigeeXClient + * @returns + */ +export default async function createApigeeXEnvKVMEntries(apigeeXClient, apigeeEnvironment, mapName, keyValueEntry) { + return apigeeXClient.post(`/environments/${apigeeEnvironment}/keyvaluemaps/${mapName}/entries`, keyValueEntry); +} diff --git a/tools/apigee-edge-to-x-migration-tool/src/gateway-clients/apigee-x/keyValueMaps/createEnvKeyValueMaps.js b/tools/apigee-edge-to-x-migration-tool/src/gateway-clients/apigee-x/keyValueMaps/createEnvKeyValueMaps.js new file mode 100644 index 00000000..7a40a68b --- /dev/null +++ b/tools/apigee-edge-to-x-migration-tool/src/gateway-clients/apigee-x/keyValueMaps/createEnvKeyValueMaps.js @@ -0,0 +1,28 @@ +/** + * Copyright 2025 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +import ApigeeXClient from "../ApigeeXClient.js"; + +/** + * + * @param {ApigeeXClient} apigeeXClient + * @param {string} apigeeEnvironment + * @param {object} keyValueMap + * @returns + */ +export default async function createApigeeXEnvKeyValueMaps(apigeeXClient, apigeeEnvironment, keyValueMap) { + return apigeeXClient.post(`/environments/${apigeeEnvironment}/keyvaluemaps`, keyValueMap); +} diff --git a/tools/apigee-edge-to-x-migration-tool/src/gateway-clients/apigee-x/keyValueMaps/createOrgKVMEntries.js b/tools/apigee-edge-to-x-migration-tool/src/gateway-clients/apigee-x/keyValueMaps/createOrgKVMEntries.js new file mode 100644 index 00000000..69a09cc2 --- /dev/null +++ b/tools/apigee-edge-to-x-migration-tool/src/gateway-clients/apigee-x/keyValueMaps/createOrgKVMEntries.js @@ -0,0 +1,26 @@ +/** + * Copyright 2025 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +import ApigeeXClient from "../ApigeeXClient.js"; + +/** + * + * @param {ApigeeXClient} apigeeXClient + * @returns + */ +export default async function createApigeeXOrgKVMEntries(apigeeXClient, mapName, keyValueEntry) { + return apigeeXClient.post(`/keyvaluemaps/${mapName}/entries`, keyValueEntry); +} diff --git a/tools/apigee-edge-to-x-migration-tool/src/gateway-clients/apigee-x/keyValueMaps/createOrgKeyValueMaps.js b/tools/apigee-edge-to-x-migration-tool/src/gateway-clients/apigee-x/keyValueMaps/createOrgKeyValueMaps.js new file mode 100644 index 00000000..a10dbc09 --- /dev/null +++ b/tools/apigee-edge-to-x-migration-tool/src/gateway-clients/apigee-x/keyValueMaps/createOrgKeyValueMaps.js @@ -0,0 +1,27 @@ +/** + * Copyright 2025 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +import ApigeeXClient from "../ApigeeXClient.js"; + +/** + * + * @param {ApigeeXClient} apigeeXClient + * @param {object} keyValueMap + * @returns + */ +export default async function createApigeeXOrgKeyValueMaps(apigeeXClient, keyValueMap) { + return apigeeXClient.post(`/keyvaluemaps`, keyValueMap); +} diff --git a/tools/apigee-edge-to-x-migration-tool/src/gateway-clients/apigee-x/keyValueMaps/deleteEnvKVM.js b/tools/apigee-edge-to-x-migration-tool/src/gateway-clients/apigee-x/keyValueMaps/deleteEnvKVM.js new file mode 100644 index 00000000..507c5ba1 --- /dev/null +++ b/tools/apigee-edge-to-x-migration-tool/src/gateway-clients/apigee-x/keyValueMaps/deleteEnvKVM.js @@ -0,0 +1,28 @@ +/** + * Copyright 2025 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +import ApigeeXClient from "../ApigeeXClient.js"; + +/** + * + * @param {ApigeeXClient} apigeeXClient + * @param {string} environment + * @param {string} kvmId + * @returns {Promise<*>} + */ +export default async function deleteApigeeXEnvKeyValueMap(apigeeXClient, environment, kvmId) { + return apigeeXClient.delete(`/environments/${environment}/keyvaluemaps/${kvmId}`); +} diff --git a/tools/apigee-edge-to-x-migration-tool/src/gateway-clients/apigee-x/keyValueMaps/deleteOrgKVM.js b/tools/apigee-edge-to-x-migration-tool/src/gateway-clients/apigee-x/keyValueMaps/deleteOrgKVM.js new file mode 100755 index 00000000..21ae66aa --- /dev/null +++ b/tools/apigee-edge-to-x-migration-tool/src/gateway-clients/apigee-x/keyValueMaps/deleteOrgKVM.js @@ -0,0 +1,27 @@ +/** + * Copyright 2025 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +import ApigeeXClient from "../ApigeeXClient.js"; + +/** + * + * @param {ApigeeXClient} apigeeXClient + * @param {string} kvmId + * @returns {Promise<*>} + */ +export default async function deleteApigeeXOrgKeyValueMap(apigeeXClient, kvmId) { + return apigeeXClient.delete(`/keyvaluemaps/${kvmId}`); +} diff --git a/tools/apigee-edge-to-x-migration-tool/src/gateway-clients/apigee-x/keyValueMaps/getEnvKVMEntry.js b/tools/apigee-edge-to-x-migration-tool/src/gateway-clients/apigee-x/keyValueMaps/getEnvKVMEntry.js new file mode 100644 index 00000000..3c3af174 --- /dev/null +++ b/tools/apigee-edge-to-x-migration-tool/src/gateway-clients/apigee-x/keyValueMaps/getEnvKVMEntry.js @@ -0,0 +1,26 @@ +/** + * Copyright 2025 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +import ApigeeXClient from "../ApigeeXClient.js"; + +/** + * + * @param {ApigeeXClient} apigeeXClient + * @returns + */ +export default async function getApigeeXEnvKVMEntry(apigeeXClient, apigeeEnvironment, mapName, entryName) { + return apigeeXClient.get(`/environments/${apigeeEnvironment}/keyvaluemaps/${mapName}/entries/${entryName}`); +} diff --git a/tools/apigee-edge-to-x-migration-tool/src/gateway-clients/apigee-x/keyValueMaps/getEnvKVMKeys.js b/tools/apigee-edge-to-x-migration-tool/src/gateway-clients/apigee-x/keyValueMaps/getEnvKVMKeys.js new file mode 100644 index 00000000..4ba8fd4e --- /dev/null +++ b/tools/apigee-edge-to-x-migration-tool/src/gateway-clients/apigee-x/keyValueMaps/getEnvKVMKeys.js @@ -0,0 +1,26 @@ +/** + * Copyright 2025 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +import ApigeeXClient from "../ApigeeXClient.js"; + +/** + * + * @param {ApigeeXClient} apigeeXClient + * @returns + */ +export default async function getApigeeXEnvKVMKeys(apigeeXClient, apigeeEnvironment, mapName) { + return apigeeXClient.get(`/environments/${apigeeEnvironment}/keyvaluemaps/${mapName}/keys`); +} diff --git a/tools/apigee-edge-to-x-migration-tool/src/gateway-clients/apigee-x/keyValueMaps/getEnvKVMsByMapName.js b/tools/apigee-edge-to-x-migration-tool/src/gateway-clients/apigee-x/keyValueMaps/getEnvKVMsByMapName.js new file mode 100644 index 00000000..58a41473 --- /dev/null +++ b/tools/apigee-edge-to-x-migration-tool/src/gateway-clients/apigee-x/keyValueMaps/getEnvKVMsByMapName.js @@ -0,0 +1,26 @@ +/** + * Copyright 2025 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +import ApigeeXClient from "../ApigeeXClient.js"; + +/** + * + * @param {ApigeeXClient} apigeeXClient + * @returns + */ +export default async function getApigeeXEnvKeyValueMapsByMap(apigeeXClient, apigeeEnvironment, mapName) { + return apigeeXClient.get(`/environments/${apigeeEnvironment}/keyvaluemaps/${mapName}`); +} diff --git a/tools/apigee-edge-to-x-migration-tool/src/gateway-clients/apigee-x/keyValueMaps/getOrgKVMEntry.js b/tools/apigee-edge-to-x-migration-tool/src/gateway-clients/apigee-x/keyValueMaps/getOrgKVMEntry.js new file mode 100644 index 00000000..75d6170c --- /dev/null +++ b/tools/apigee-edge-to-x-migration-tool/src/gateway-clients/apigee-x/keyValueMaps/getOrgKVMEntry.js @@ -0,0 +1,26 @@ +/** + * Copyright 2025 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +import ApigeeXClient from "../ApigeeXClient.js"; + +/** + * + * @param {ApigeeXClient} apigeeXClient + * @returns + */ +export default async function getApigeeXOrgKVMEntry(apigeeXClient, mapName, entryName) { + return apigeeXClient.get(`/keyvaluemaps/${mapName}/entries/${entryName}`); +} diff --git a/tools/apigee-edge-to-x-migration-tool/src/gateway-clients/apigee-x/keyValueMaps/getOrgKVMKeys.js b/tools/apigee-edge-to-x-migration-tool/src/gateway-clients/apigee-x/keyValueMaps/getOrgKVMKeys.js new file mode 100644 index 00000000..1f1a3c70 --- /dev/null +++ b/tools/apigee-edge-to-x-migration-tool/src/gateway-clients/apigee-x/keyValueMaps/getOrgKVMKeys.js @@ -0,0 +1,26 @@ +/** + * Copyright 2025 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +import ApigeeXClient from "../ApigeeXClient.js"; + +/** + * + * @param {ApigeeXClient} apigeeXClient + * @returns + */ +export default async function getApigeeXOrgKVMKeys(apigeeXClient, mapName) { + return apigeeXClient.get(`/keyvaluemaps/${mapName}/keys`); +} diff --git a/tools/apigee-edge-to-x-migration-tool/src/gateway-clients/apigee-x/keyValueMaps/getOrgKVMsByMapName.js b/tools/apigee-edge-to-x-migration-tool/src/gateway-clients/apigee-x/keyValueMaps/getOrgKVMsByMapName.js new file mode 100644 index 00000000..fbaefce0 --- /dev/null +++ b/tools/apigee-edge-to-x-migration-tool/src/gateway-clients/apigee-x/keyValueMaps/getOrgKVMsByMapName.js @@ -0,0 +1,26 @@ +/** + * Copyright 2025 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +import ApigeeXClient from "../ApigeeXClient.js"; + +/** + * + * @param {ApigeeXClient} apigeeXClient + * @returns + */ +export default async function getApigeeXOrgKeyValueMapsByMap(apigeeXClient, mapName) { + return apigeeXClient.get(`/keyvaluemaps/${mapName}`); +} diff --git a/tools/apigee-edge-to-x-migration-tool/src/gateway-clients/apigee-x/keyValueMaps/index.js b/tools/apigee-edge-to-x-migration-tool/src/gateway-clients/apigee-x/keyValueMaps/index.js new file mode 100644 index 00000000..93d069e7 --- /dev/null +++ b/tools/apigee-edge-to-x-migration-tool/src/gateway-clients/apigee-x/keyValueMaps/index.js @@ -0,0 +1,47 @@ +/** + * Copyright 2025 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +import getApigeeXEnvKeyValueMaps from "./listEnvKeyValueMaps.js"; +import getApigeeXEnvKeyValueMapsByMap from "./getEnvKVMsByMapName.js"; +import getApigeeXEnvKVMEntry from "./getEnvKVMEntry.js"; +import getApigeeXEnvKVMKeys from "./getEnvKVMKeys.js"; +import getApigeeXOrgKeyValueMaps from "./listOrgKeyValueMaps.js"; +import getApigeeXOrgKeyValueMapsByMap from "./getOrgKVMsByMapName.js"; +import getApigeeXOrgKVMEntry from "./getOrgKVMEntry.js"; +import getApigeeXOrgKVMKeys from "./getOrgKVMKeys.js"; +import createApigeeXEnvKeyValueMaps from "./createEnvKeyValueMaps.js"; +import createApigeeXEnvKVMEntries from "./createEnvKVMEntries.js"; +import createApigeeXOrgKeyValueMaps from "./createOrgKeyValueMaps.js"; +import createApigeeXOrgKVMEntries from "./createOrgKVMEntries.js"; +import deleteApigeeXOrgKeyValueMap from "./deleteOrgKVM.js"; +import deleteApigeeXEnvKeyValueMap from "./deleteEnvKVM.js"; + +export { + getApigeeXEnvKeyValueMaps, + getApigeeXEnvKeyValueMapsByMap, + getApigeeXEnvKVMEntry, + getApigeeXEnvKVMKeys, + getApigeeXOrgKeyValueMaps, + getApigeeXOrgKeyValueMapsByMap, + getApigeeXOrgKVMEntry, + getApigeeXOrgKVMKeys, + createApigeeXEnvKeyValueMaps, + createApigeeXEnvKVMEntries, + createApigeeXOrgKeyValueMaps, + createApigeeXOrgKVMEntries, + deleteApigeeXOrgKeyValueMap, + deleteApigeeXEnvKeyValueMap +} \ No newline at end of file diff --git a/tools/apigee-edge-to-x-migration-tool/src/gateway-clients/apigee-x/keyValueMaps/listEnvKeyValueMaps.js b/tools/apigee-edge-to-x-migration-tool/src/gateway-clients/apigee-x/keyValueMaps/listEnvKeyValueMaps.js new file mode 100644 index 00000000..02530580 --- /dev/null +++ b/tools/apigee-edge-to-x-migration-tool/src/gateway-clients/apigee-x/keyValueMaps/listEnvKeyValueMaps.js @@ -0,0 +1,26 @@ +/** + * Copyright 2025 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +import ApigeeXClient from "../ApigeeXClient.js"; + +/** + * + * @param {ApigeeXClient} apigeeXClient + * @returns + */ +export default async function getApigeeXEnvKeyValueMaps(apigeeXClient, apigeeEnvironment) { + return apigeeXClient.get(`/environments/${apigeeEnvironment}/keyvaluemaps`); +} diff --git a/tools/apigee-edge-to-x-migration-tool/src/gateway-clients/apigee-x/keyValueMaps/listOrgKeyValueMaps.js b/tools/apigee-edge-to-x-migration-tool/src/gateway-clients/apigee-x/keyValueMaps/listOrgKeyValueMaps.js new file mode 100644 index 00000000..f1d8641a --- /dev/null +++ b/tools/apigee-edge-to-x-migration-tool/src/gateway-clients/apigee-x/keyValueMaps/listOrgKeyValueMaps.js @@ -0,0 +1,26 @@ +/** + * Copyright 2025 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +import ApigeeXClient from "../ApigeeXClient.js"; + +/** + * + * @param {ApigeeXClient} apigeeXClient + * @returns + */ +export default async function getApigeeXOrgKeyValueMaps(apigeeXClient) { + return apigeeXClient.get(`/keyvaluemaps`); +} diff --git a/tools/apigee-edge-to-x-migration-tool/src/gateway-clients/apigee-x/resource-files/createResourceFile.js b/tools/apigee-edge-to-x-migration-tool/src/gateway-clients/apigee-x/resource-files/createResourceFile.js new file mode 100755 index 00000000..2e049751 --- /dev/null +++ b/tools/apigee-edge-to-x-migration-tool/src/gateway-clients/apigee-x/resource-files/createResourceFile.js @@ -0,0 +1,41 @@ +/** + * Copyright 2025 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +import querystring from 'node:querystring'; +import { promises as fs } from 'fs'; +import ApigeeXClient from "../ApigeeXClient.js"; + +/** + * + * @param {ApigeeXClient} apigeeXClient + * @param {string} environment + * @param {string} type + * @param {string} name + * @param {*} fileData + * @returns {Promise<*>} + */ +export default async function createApigeeXResourceFile(apigeeXClient, environment, type, name, filePath) { + const query = { + type, + name + }; + + const fileData = await fs.readFile(filePath).catch(err => { + console.error(`Failed to fetch resourceFile bundle for ${name} type ${type}: ${err.message}`); + }); + + return apigeeXClient.post(`/environments/${environment}/resourcefiles?${querystring.stringify(query)}`, fileData); +} diff --git a/tools/apigee-edge-to-x-migration-tool/src/gateway-clients/apigee-x/resource-files/deleteResourceFile.js b/tools/apigee-edge-to-x-migration-tool/src/gateway-clients/apigee-x/resource-files/deleteResourceFile.js new file mode 100644 index 00000000..25c7171a --- /dev/null +++ b/tools/apigee-edge-to-x-migration-tool/src/gateway-clients/apigee-x/resource-files/deleteResourceFile.js @@ -0,0 +1,29 @@ +/** + * Copyright 2025 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +import ApigeeXClient from "../ApigeeXClient.js"; + +/** + * + * @param {ApigeeXClient} apigeeXClient + * @param {string} environment + * @param {string} type + * @param {string} name + * @returns {Promise<*>} + */ +export default async function deleteApigeeXResourceFile(apigeeXClient, environment, type, name) { + return apigeeXClient.delete(`/environments/${environment}/resourcefiles/${type}/${name}`); +} diff --git a/tools/apigee-edge-to-x-migration-tool/src/gateway-clients/apigee-x/resource-files/getResourceFileById.js b/tools/apigee-edge-to-x-migration-tool/src/gateway-clients/apigee-x/resource-files/getResourceFileById.js new file mode 100755 index 00000000..d48edc0a --- /dev/null +++ b/tools/apigee-edge-to-x-migration-tool/src/gateway-clients/apigee-x/resource-files/getResourceFileById.js @@ -0,0 +1,29 @@ +/** + * Copyright 2025 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +import ApigeeXClient from "../ApigeeXClient.js"; + +/** + * + * @param {ApigeeXClient} apigeeXClient + * @param {*} environment + * @param {*} resourceType + * @param {*} resourceName + * @returns + */ +export default async function getResourceFileById(apigeeXClient, environment, resourceType, resourceName) { + return apigeeXClient.get(`/environments/${environment}/resourcefiles/${resourceType}/${resourceName}`); +} diff --git a/tools/apigee-edge-to-x-migration-tool/src/gateway-clients/apigee-x/resource-files/getResourceFiles.js b/tools/apigee-edge-to-x-migration-tool/src/gateway-clients/apigee-x/resource-files/getResourceFiles.js new file mode 100755 index 00000000..ec2fae3d --- /dev/null +++ b/tools/apigee-edge-to-x-migration-tool/src/gateway-clients/apigee-x/resource-files/getResourceFiles.js @@ -0,0 +1,41 @@ +/** + * Copyright 2025 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +import ApigeeXClient from '../ApigeeXClient.js'; + +/** + * Get all resource files in the environment. + * + * @param {ApigeeXClient} apigeeXClient + * @param {string} environment + * @param {(resourcefile) => Promise} callback + * @returns + */ +async function getApigeeXResourceFiles(apigeeXClient, environment, callback = null) { + return apigeeXClient.get(`/environments/${environment}/resourcefiles`).then(async response => { + const resourceFiles = response?.resourceFile ?? []; + + for (const resourceFile of resourceFiles) { + if (typeof callback === 'function') { + await callback(resourceFile); + } + } + + return resourceFiles; + }); +} + +export default getApigeeXResourceFiles; \ No newline at end of file diff --git a/tools/apigee-edge-to-x-migration-tool/src/gateway-clients/apigee-x/resource-files/index.js b/tools/apigee-edge-to-x-migration-tool/src/gateway-clients/apigee-x/resource-files/index.js new file mode 100644 index 00000000..d18fdce3 --- /dev/null +++ b/tools/apigee-edge-to-x-migration-tool/src/gateway-clients/apigee-x/resource-files/index.js @@ -0,0 +1,27 @@ +/** + * Copyright 2025 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +import getApigeeXResourceFiles from "./getResourceFiles.js"; +import getApigeeXResourceFileById from "./getResourceFileById.js"; +import createApigeeXResourceFile from "./createResourceFile.js"; +import updateApigeeXResourceFile from "./updateResourceFile.js"; + +export { + getApigeeXResourceFiles, + getApigeeXResourceFileById, + createApigeeXResourceFile, + updateApigeeXResourceFile +} diff --git a/tools/apigee-edge-to-x-migration-tool/src/gateway-clients/apigee-x/resource-files/updateResourceFile.js b/tools/apigee-edge-to-x-migration-tool/src/gateway-clients/apigee-x/resource-files/updateResourceFile.js new file mode 100755 index 00000000..19706b0c --- /dev/null +++ b/tools/apigee-edge-to-x-migration-tool/src/gateway-clients/apigee-x/resource-files/updateResourceFile.js @@ -0,0 +1,34 @@ +/** + * Copyright 2025 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +import ApigeeXClient from "../ApigeeXClient.js"; +import { promises as fs } from 'fs'; + +/** + * + * @param {ApigeeXClient} apigeeXClient + * @param {string} environment + * @param {string} type + * @param {string} name + * @param {*} fileData + * @returns {Promise<*>} + */ +export default async function updateApigeeXResourceFile(apigeeXClient, environment, type, name, filePath) { + const fileData = await fs.readFile(filePath).catch(err => { + console.error(`Failed to fetch resourceFile bundle for ${name} type ${type}: ${err.message}`); + }); + return apigeeXClient.put(`/environments/${environment}/resourcefiles/${type}/${name}`, fileData); +} diff --git a/tools/apigee-edge-to-x-migration-tool/src/gateway-clients/apigee-x/shared-flows/createSharedFlow.js b/tools/apigee-edge-to-x-migration-tool/src/gateway-clients/apigee-x/shared-flows/createSharedFlow.js new file mode 100755 index 00000000..6b3de0fd --- /dev/null +++ b/tools/apigee-edge-to-x-migration-tool/src/gateway-clients/apigee-x/shared-flows/createSharedFlow.js @@ -0,0 +1,33 @@ +/** + * Copyright 2025 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +import querystring from 'node:querystring'; +import ApigeeXClient from "../ApigeeXClient.js"; + +/** + * + * @param {ApigeeXClient} apigeeXClient + * @param {*} bundle + * @returns {Promise} The created shared flow + */ +export default async function createSharedFlow(apigeeXClient, sharedFlowName, bundle) { + const query = querystring.stringify({ + name: sharedFlowName, + action: 'import' + }) + + return apigeeXClient.post(`/sharedflows?${query}`, bundle); +} diff --git a/tools/apigee-edge-to-x-migration-tool/src/gateway-clients/apigee-x/shared-flows/deleteSharedFlowByName.js b/tools/apigee-edge-to-x-migration-tool/src/gateway-clients/apigee-x/shared-flows/deleteSharedFlowByName.js new file mode 100755 index 00000000..e38c6295 --- /dev/null +++ b/tools/apigee-edge-to-x-migration-tool/src/gateway-clients/apigee-x/shared-flows/deleteSharedFlowByName.js @@ -0,0 +1,27 @@ +/** + * Copyright 2025 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +import ApigeeXClient from "../ApigeeXClient.js"; + +/** + * + * @param {ApigeeXClient} apigeeXClient + * @param {string} sharedFlowName + * @returns + */ +export default async function deleteApigeeXSharedFlowByName(apigeeXClient, sharedFlowName) { + return apigeeXClient.delete(`/sharedflows/${sharedFlowName}`); +} diff --git a/tools/apigee-edge-to-x-migration-tool/src/gateway-clients/apigee-x/shared-flows/deploySharedFlowRevision.js b/tools/apigee-edge-to-x-migration-tool/src/gateway-clients/apigee-x/shared-flows/deploySharedFlowRevision.js new file mode 100644 index 00000000..98d8a8e6 --- /dev/null +++ b/tools/apigee-edge-to-x-migration-tool/src/gateway-clients/apigee-x/shared-flows/deploySharedFlowRevision.js @@ -0,0 +1,34 @@ +/** + * Copyright 2025 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +import ApigeeXClient from "../ApigeeXClient.js"; +import querystring from 'node:querystring'; + +/** + * Deploys a specific revision of an Shared Flow to a given environment in Apigee X. + * + * @param {ApigeeXClient} apigeeXClient - An instance of the ApigeeXClient, used to interact with the Apigee X API. + * @param {string} apigeeEnvironment - The environment in Apigee X where the Shared Flow should be deployed (e.g., 'test', 'prod'). + * @param {string} sharedFlowName - The name of the Shared Flow to be deployed. + * @param {string} revision - The specific revision number of the Shared Flow to deploy. + * @returns {Promise} A promise that resolves to a string confirming the deployment of the Shared Flow revision. + */ +export default async function deploySharedFlowRevision(apigeeXClient, apigeeEnvironment, sharedFlowName, revision, override = true) { + const query = querystring.stringify({ + override: override + }) + return apigeeXClient.post(`/environments/${apigeeEnvironment}/sharedflows/${sharedFlowName}/revisions/${revision}/deployments?${query}`); +} \ No newline at end of file diff --git a/tools/apigee-edge-to-x-migration-tool/src/gateway-clients/apigee-x/shared-flows/getSharedFlowBundle.js b/tools/apigee-edge-to-x-migration-tool/src/gateway-clients/apigee-x/shared-flows/getSharedFlowBundle.js new file mode 100755 index 00000000..450bab08 --- /dev/null +++ b/tools/apigee-edge-to-x-migration-tool/src/gateway-clients/apigee-x/shared-flows/getSharedFlowBundle.js @@ -0,0 +1,30 @@ +/** + * Copyright 2025 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +import fs from 'fs'; +import ApigeeXClient from '../ApigeeXClient.js'; +import getDataDirectory from '../../../utils/getDataDirectory.js'; + +/** + * + * @param {ApigeeXClient} apigeeXClient + * @param {string} sharedFlowName + * @param {string} sharedFlowRev + * @returns + */ +export default async function getApigeeXSharedFlowBundle(apigeeXClient, sharedFlowName, sharedFlowRev) { + return apigeeXClient.get(`/sharedflows/${sharedFlowName}/revisions/${sharedFlowRev}?format=bundle`); +} diff --git a/tools/apigee-edge-to-x-migration-tool/src/gateway-clients/apigee-x/shared-flows/getSharedFlowDeployments.js b/tools/apigee-edge-to-x-migration-tool/src/gateway-clients/apigee-x/shared-flows/getSharedFlowDeployments.js new file mode 100644 index 00000000..71088717 --- /dev/null +++ b/tools/apigee-edge-to-x-migration-tool/src/gateway-clients/apigee-x/shared-flows/getSharedFlowDeployments.js @@ -0,0 +1,27 @@ +/** + * Copyright 2025 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +import ApigeeXClient from "../ApigeeXClient.js"; + +/** + * + * @param {ApigeeXClient} apigeeXClient + * @param {string} sharedFlowName + * @returns + */ +export default async function getApigeeXSharedFlowDeployments(apigeeXClient, sharedFlowName) { + return apigeeXClient.get(`/sharedflows/${sharedFlowName}/deployments`); +} diff --git a/tools/apigee-edge-to-x-migration-tool/src/gateway-clients/apigee-x/shared-flows/getSharedFlowNames.js b/tools/apigee-edge-to-x-migration-tool/src/gateway-clients/apigee-x/shared-flows/getSharedFlowNames.js new file mode 100755 index 00000000..6319b43a --- /dev/null +++ b/tools/apigee-edge-to-x-migration-tool/src/gateway-clients/apigee-x/shared-flows/getSharedFlowNames.js @@ -0,0 +1,27 @@ +/** + * Copyright 2025 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +import ApigeeXClient from "../ApigeeXClient.js"; + +/** + * Retrieve all shared flows in the organization. + * + * @param {ApigeeXClient} apigeeXClient + * @returns + */ +export default async function getApigeeXSharedFlowNames(apigeeXClient) { + return apigeeXClient.get(`/sharedflows`); +} \ No newline at end of file diff --git a/tools/apigee-edge-to-x-migration-tool/src/gateway-clients/apigee-x/shared-flows/getSharedFlowRevisionDeployment.js b/tools/apigee-edge-to-x-migration-tool/src/gateway-clients/apigee-x/shared-flows/getSharedFlowRevisionDeployment.js new file mode 100755 index 00000000..65f7f6e9 --- /dev/null +++ b/tools/apigee-edge-to-x-migration-tool/src/gateway-clients/apigee-x/shared-flows/getSharedFlowRevisionDeployment.js @@ -0,0 +1,30 @@ +/** + * Copyright 2025 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +import ApigeeXClient from "../ApigeeXClient.js"; + +/** + * Deploys a specific revision of an Shared Flow to a given environment in Apigee X. + * + * @param {ApigeeXClient} apigeeXClient - An instance of the ApigeeXClient, used to interact with the Apigee X API. + * @param {string} apigeeEnvironment - The environment in Apigee X where the Shared Flow should be deployed (e.g., 'test', 'prod'). + * @param {string} sharedFlowName - The name of the Shared Flow to be deployed. + * @param {string} revision - The specific revision number of the Shared Flow to deploy. + * @returns {Promise} A promise that resolves to a string confirming the deployment of the Shared Flow revision. + */ +export default async function getSharedFlowRevisionDeployment(apigeeXClient, apigeeEnvironment, sharedFlowName, revision) { + return apigeeXClient.get(`/environments/${apigeeEnvironment}/sharedflows/${sharedFlowName}/revisions/${revision}/deployments`); +} \ No newline at end of file diff --git a/tools/apigee-edge-to-x-migration-tool/src/gateway-clients/apigee-x/shared-flows/getSharedFlowRevisions.js b/tools/apigee-edge-to-x-migration-tool/src/gateway-clients/apigee-x/shared-flows/getSharedFlowRevisions.js new file mode 100755 index 00000000..f9b17dd1 --- /dev/null +++ b/tools/apigee-edge-to-x-migration-tool/src/gateway-clients/apigee-x/shared-flows/getSharedFlowRevisions.js @@ -0,0 +1,28 @@ +/** + * Copyright 2025 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +import ApigeeXClient from "../ApigeeXClient.js"; + +/** + * Get all revisions of a shared flow. + * + * @param {ApigeeXClient} apigeeXClient + * @param {string} sharedFlowName + * @returns + */ +export default async function getApigeeXSharedFlowRevisions(apigeeXClient, sharedFlowName) { + return apigeeXClient.get(`/sharedflows/${sharedFlowName}/revisions`); +} diff --git a/tools/apigee-edge-to-x-migration-tool/src/gateway-clients/apigee-x/shared-flows/index.js b/tools/apigee-edge-to-x-migration-tool/src/gateway-clients/apigee-x/shared-flows/index.js new file mode 100644 index 00000000..5c0238d3 --- /dev/null +++ b/tools/apigee-edge-to-x-migration-tool/src/gateway-clients/apigee-x/shared-flows/index.js @@ -0,0 +1,41 @@ +/** + * Copyright 2025 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +import getApigeeXSharedFlowBundle from "./getSharedFlowBundle.js"; +import createApigeeXSharedFlow from "./createSharedFlow.js"; +import updateApigeeXSharedFlow from "./updateSharedFlow.js"; +import validateApigeeXSharedFlowBundle from "./validateSharedFlowBundle.js"; +import deleteApigeeXSharedFlowByName from "./deleteSharedFlowByName.js"; +import deploySharedFlowRevision from "./deploySharedFlowRevision.js"; +import getApigeeXSharedFlowDeployments from "./getSharedFlowDeployments.js"; +import getApigeeXSharedFlowNames from "./getSharedFlowNames.js"; +import getSharedFlowRevisionDeployment from "./getSharedFlowRevisionDeployment.js"; +import undeploySharedFlowRevision from "./undeploySharedFlowRevision.js"; +import getApigeeXSharedFlowRevisions from "./getSharedFlowRevisions.js"; + +export { + getApigeeXSharedFlowBundle, + createApigeeXSharedFlow, + updateApigeeXSharedFlow, + validateApigeeXSharedFlowBundle, + deleteApigeeXSharedFlowByName, + deploySharedFlowRevision, + getApigeeXSharedFlowDeployments, + getApigeeXSharedFlowNames, + getSharedFlowRevisionDeployment, + undeploySharedFlowRevision, + getApigeeXSharedFlowRevisions +} diff --git a/tools/apigee-edge-to-x-migration-tool/src/gateway-clients/apigee-x/shared-flows/undeploySharedFlowRevision.js b/tools/apigee-edge-to-x-migration-tool/src/gateway-clients/apigee-x/shared-flows/undeploySharedFlowRevision.js new file mode 100755 index 00000000..6aafbfa4 --- /dev/null +++ b/tools/apigee-edge-to-x-migration-tool/src/gateway-clients/apigee-x/shared-flows/undeploySharedFlowRevision.js @@ -0,0 +1,30 @@ +/** + * Copyright 2025 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +import ApigeeXClient from "../ApigeeXClient.js"; + +/** + * Deploys a specific revision of an Shared Flow to a given environment in Apigee X. + * + * @param {ApigeeXClient} apigeeXClient - An instance of the ApigeeXClient, used to interact with the Apigee X API. + * @param {string} apigeeEnvironment - The environment in Apigee X where the Shared Flow should be undeployed (e.g., 'test', 'prod'). + * @param {string} sharedFlowName - The name of the Shared Flow to be undeployed. + * @param {string} revision - The specific revision number of the Shared Flow to undeploy. + * @returns {Promise} A promise that resolves to a string confirming the undeployment of the Shared Flow revision. + */ +export default async function undeploySharedFlowRevision(apigeeXClient, apigeeEnvironment, sharedFlowName, revision) { + return apigeeXClient.delete(`/environments/${apigeeEnvironment}/sharedflows/${sharedFlowName}/revisions/${revision}/deployments`); +} \ No newline at end of file diff --git a/tools/apigee-edge-to-x-migration-tool/src/gateway-clients/apigee-x/shared-flows/updateSharedFlow.js b/tools/apigee-edge-to-x-migration-tool/src/gateway-clients/apigee-x/shared-flows/updateSharedFlow.js new file mode 100755 index 00000000..ea4dbb90 --- /dev/null +++ b/tools/apigee-edge-to-x-migration-tool/src/gateway-clients/apigee-x/shared-flows/updateSharedFlow.js @@ -0,0 +1,29 @@ +/** + * Copyright 2025 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +import ApigeeXClient from "../ApigeeXClient.js"; + +/** + * + * @param {ApigeeXClient} apigeeXClient + * @param {*} bundle + * @returns {Promise} The created shared flow + */ +export default async function updateApigeeXSharedFlow(apigeeXClient, sharedFlowId, bundle) { + const results = await apigeeXClient.put(`/sharedflows/${sharedFlowId}`, bundle); + + return results; +} diff --git a/tools/apigee-edge-to-x-migration-tool/src/gateway-clients/apigee-x/shared-flows/validateSharedFlowBundle.js b/tools/apigee-edge-to-x-migration-tool/src/gateway-clients/apigee-x/shared-flows/validateSharedFlowBundle.js new file mode 100755 index 00000000..d52f39c0 --- /dev/null +++ b/tools/apigee-edge-to-x-migration-tool/src/gateway-clients/apigee-x/shared-flows/validateSharedFlowBundle.js @@ -0,0 +1,33 @@ +/** + * Copyright 2025 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +import querystring from 'node:querystring'; +import ApigeeXClient from "../ApigeeXClient.js"; + +/** + * + * @param {ApigeeXClient} apigeeXClient + * @param {*} bundle + * @returns {Promise} The filepath for the downloaded shared flow bundle + */ +export default async function validateApigeeXSharedFlowBundle(apigeeXClient, sharedFlowName, bundle) { + const query = querystring.stringify({ + name: sharedFlowName, + action: 'validate' + }) + + return apigeeXClient.post(`/sharedflows?${query}`, bundle); +} diff --git a/tools/apigee-edge-to-x-migration-tool/src/modules/apigee-edge-to-x-essentials/actions/migration-log/migrationLog.js b/tools/apigee-edge-to-x-migration-tool/src/modules/apigee-edge-to-x-essentials/actions/migration-log/migrationLog.js new file mode 100644 index 00000000..2fdc4c0a --- /dev/null +++ b/tools/apigee-edge-to-x-migration-tool/src/modules/apigee-edge-to-x-essentials/actions/migration-log/migrationLog.js @@ -0,0 +1,167 @@ +/** + * Copyright 2025 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +// Import necessary modules +import Logger from "../../../../utils/logHandler.js"; +import { select } from '@inquirer/prompts'; + +// Define log options for navigation +const logOptions = [ + { name: 'Status', option: 'viewMigrationStatus', description: 'Select to view migration status of one/all entities.' }, + { name: 'Summary', option: 'viewMigrationSummary', description: 'Select to view the migration status summary of one/all entities.' }, + { name: 'Delta', option: 'viewDeviations', description: 'Select to view the delta information identified by comparing source and target entity.' }, + { name: 'Logs', option: 'viewLogs', description: 'Select to view transaction logs.' }, + { name: 'Exit', option: 'Exit', description: 'Exit Tool' } +]; + +// Define entity types for selection +const entityTypes = [ + { name: 'Back', type: 'Back', description: 'Navigate to previous menu.' }, + { name: 'All Entities', type: null, description: 'All entity types.' }, + { name: 'API Proxies', type: 'APIProxy', description: 'API proxies entity type.' }, + { name: 'API Products', type: 'APIProduct', description: 'API products entity type.' }, + { name: 'Developer Apps', type: 'DeveloperApp', description: 'Developer apps entity type.' }, + { name: 'Developers', type: 'Developer', description: 'Developer entity type.' }, + { name: 'KeyValueMaps', type: 'KeyValueMap', description: 'Key value maps entity type.' }, + { name: 'Resource Files', type: 'ResourceFiles', description: 'Resource files entity type.' }, + { name: 'Shared Flows', type: 'SharedFlow', description: 'Shared flows entity type.' }, + { name: 'Exit', type: 'Exit', description: 'Exit Tool' } +]; + +// Define migration status options +const migrationStatus = [ + { name: 'Back', state: 'Back', description: 'Navigate to previous menu.' }, + { name: 'All', state: null, description: 'All migration states.' }, + { name: 'Migrated', state: 'Migrated', description: 'Entities that have been migrated.' }, + { name: 'Skipped', state: 'Skipped', description: 'Entities that have been skipped.' }, + { name: 'Error', state: 'Failed', description: 'Entities with errors.' }, + { name: 'Exit', state: 'Exit', description: 'Exit Tool' } +]; + +// Define log levels for viewing +const logLevel = [ + { name: 'Back', level: 'Back', description: 'Navigate to previous menu.' }, + { name: 'All', level: null, description: 'All log levels.' }, + { name: 'Log', level: 'log', description: 'Standard log messages.' }, + { name: 'Warning', level: 'warning', description: 'Warning messages.' }, + { name: 'Error', level: 'error', description: 'Error messages.' }, + { name: 'Exit', level: 'Exit', description: 'Exit Tool' } +]; + +/** + * Main function to navigate through migration logs using a menu system. + */ +async function migrationLog() { + let continueNavigation = true; + const menuStack = []; + + // Function to navigate menu choices + const navigateMenu = async (choices, message) => { + const selectedOption = await select({ + name: 'menuOption', + message, + choices: choices.map(choice => ({ + name: choice.name, + value: choice.option || choice.type || choice.state || choice.level, + description: choice.description + })), + }); + + // Handle menu navigation and exit conditions + if (selectedOption === 'Exit') { + continueNavigation = false; + menuStack.length = 0; // Clear stack for a fresh start + } else if (selectedOption === 'Back') { + if (menuStack.length > 0) { + menuStack.pop(); // Go back to the previous menu + } + } else { + if (menuStack[menuStack.length - 1] !== selectedOption) { + menuStack.push(selectedOption); + } + } + + return selectedOption; + }; + + while (continueNavigation) { + const currentMenu = menuStack[menuStack.length - 1] || 'mainMenu'; + + let selectedLogType, selectedEntityType, selectedMigrationState, selectedLogLevel; + + // Switch between different menus and actions based on the current menu + switch (currentMenu) { + case 'mainMenu': + selectedLogType = await navigateMenu(logOptions, 'Choose Log Type'); + if (selectedLogType === 'Back' || selectedLogType === 'Exit') { + continue; + } else if (selectedLogType === 'viewMigrationStatus' || selectedLogType === 'viewMigrationSummary' || selectedLogType === 'viewDeviations' || selectedLogType === 'viewLogs') { + if (!menuStack.includes(selectedLogType)) { + menuStack.push(selectedLogType); + } + console.log(menuStack); + } + break; + + case 'viewMigrationStatus': + selectedEntityType = await navigateMenu(entityTypes, 'Choose Entity'); + if (selectedEntityType === 'Back' || selectedEntityType === 'Exit') { + continue; + } + + selectedMigrationState = await navigateMenu(migrationStatus, 'Choose Migration State'); + if (selectedMigrationState === 'Back' || selectedMigrationState === 'Exit') { + continue; + } + + await Logger.getInstance().viewMigrationStatus(selectedEntityType, selectedMigrationState); + break; + + case 'viewMigrationSummary': + selectedEntityType = await navigateMenu(entityTypes, 'Choose Entity'); + if (selectedEntityType === 'Back' || selectedEntityType === 'Exit') { + continue; + } + + await Logger.getInstance().viewMigrationSummary(selectedEntityType); + break; + + case 'viewDeviations': + selectedEntityType = await navigateMenu(entityTypes, 'Choose Entity'); + if (selectedEntityType === 'Back' || selectedEntityType === 'Exit') { + continue; + } + + await Logger.getInstance().viewDeviations(selectedEntityType); + break; + + case 'viewLogs': + selectedLogLevel = await navigateMenu(logLevel, 'Choose Log Level'); + if (selectedLogLevel === 'Back' || selectedLogLevel === 'Exit') { + continue; + } + + await Logger.getInstance().viewLogs(selectedLogLevel); + break; + + default: + break; + } + } +} + +// Export the migrationLog function as default +export default migrationLog; \ No newline at end of file diff --git a/tools/apigee-edge-to-x-migration-tool/src/modules/apigee-edge-to-x-essentials/actions/run-migration/migrateApiProducts.js b/tools/apigee-edge-to-x-migration-tool/src/modules/apigee-edge-to-x-essentials/actions/run-migration/migrateApiProducts.js new file mode 100644 index 00000000..d8a57885 --- /dev/null +++ b/tools/apigee-edge-to-x-migration-tool/src/modules/apigee-edge-to-x-essentials/actions/run-migration/migrateApiProducts.js @@ -0,0 +1,203 @@ +/** + * Copyright 2025 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +// Import necessary modules and utilities +import Context from "../../../../utils/context.js"; +import mergeData from "../../../../utils/mergeData.js"; +import { + getApigeeEdgeApiProducts +} from "../../../../gateway-clients/apigee-edge/api-products/index.js"; +import { + getApigeeXApiProducts, + getApigeeXApiProductByName, + createApigeeXApiProduct, + updateApigeeXApiProduct +} from "../../../../gateway-clients/apigee-x/api-products/index.js"; +import { + logMigrationStatus, + handleMigrationError, + markAsDuplicate, + logDeviations +} from "./migrationLogHelper.js"; + +/** + * Migrate API products from Apigee Edge to Apigee X using the specified execution model. + * + * @param {Object} options - Options for migration, including executionModel. + */ +async function migrateApiProducts(options) { + try { + // Retrieve API products from Apigee Edge and Apigee X + const edgeProducts = await getApigeeEdgeApiProducts(Context.sourceClient); + const apiProductNames = await getApigeeXApiProducts(Context.destinationClient); + + // Extract product names from Apigee X + const xProductNames = apiProductNames.apiProduct?.map(product => product.name) || []; + + // Initialize a counter for tracking migration summary + const counter = { + entityType: 'APIProduct', + edgeTotal: edgeProducts.length, + migrated: 0, + duplicates: 0, + skipped: 0, + failed: 0 + }; + + // Process each API product from Apigee Edge + for (let apiProduct of edgeProducts) { + await processApiProduct(apiProduct, xProductNames, options.executionModel, counter); + } + + // Log the final migration summary + console.log(counter); + } catch (error) { + console.error("Error migrating API products:", error); + } +} + +/** + * Process an individual API product based on the execution model. + * + * @param {Object} apiProduct - API product from Apigee Edge. + * @param {Array} xProductNames - List of API product names in Apigee X. + * @param {String} executionModel - The execution model ('create', 'merge', 'overwrite'). + * @param {Object} counter - Migration summary counter. + */ +async function processApiProduct(apiProduct, xProductNames, executionModel, counter) { + switch (executionModel) { + case 'create': + await handleCreateProduct(apiProduct, xProductNames, counter); + break; + case 'merge': + await handleMergeProduct(apiProduct, xProductNames, counter); + break; + case 'overwrite': + await handleOverwriteProduct(apiProduct, xProductNames, counter); + break; + default: + console.error("Invalid execution model specified."); + } +} + +/** + * Handle the 'create' execution model for API product migration. + * + * @param {Object} apiProduct - API product from Apigee Edge. + * @param {Array} xProductNames - List of API product names in Apigee X. + * @param {Object} counter - Migration summary counter. + */ +async function handleCreateProduct(apiProduct, xProductNames, counter) { + if (!xProductNames.includes(apiProduct.name)) { + try { + const edgeProduct = await prepareProductPayload(apiProduct); + const x_product = await createApigeeXApiProduct(Context.destinationClient, JSON.stringify(edgeProduct)); + counter.migrated++; + logMigrationStatus('APIProduct', apiProduct.name, 'Migrated', x_product.createdAt); + } catch (creationError) { + handleMigrationError('APIProduct', apiProduct.name, creationError, counter); + } + } else { + markAsDuplicate('APIProduct', apiProduct.name, counter); + } +} + +/** + * Handle the 'merge' execution model for API product migration. + * + * @param {Object} apiProduct - API product from Apigee Edge. + * @param {Array} xProductNames - List of API product names in Apigee X. + * @param {Object} counter - Migration summary counter. + */ +async function handleMergeProduct(apiProduct, xProductNames, counter) { + if (xProductNames.includes(apiProduct.name)) { + try { + const edgeProduct = await prepareProductPayload(apiProduct); + const existingXProduct = await getApigeeXApiProductByName(Context.destinationClient, apiProduct.name); + const xProductFormatted = { + ...await prepareProductPayload(existingXProduct), + environments: existingXProduct.environments + }; + const mergeResults = await mergeData(xProductFormatted, edgeProduct, true); + + if (mergeResults.mergedData) { + const mergedProduct = mergeResults.mergedData; + const x_product = await updateApigeeXApiProduct(Context.destinationClient, mergedProduct.name, JSON.stringify(mergedProduct)); + counter.migrated++; + logMigrationStatus('APIProduct', mergedProduct.name, 'Migrated', x_product.createdAt); + logDeviations('APIProduct', mergedProduct.name, mergeResults, x_product.createdAt); + } else { + markAsDuplicate('APIProduct', apiProduct.name, counter); + } + } catch (mergeError) { + handleMigrationError('APIProduct', apiProduct.name, mergeError, counter); + } + } else { + // Create new entity in X if it does not exist + await handleCreateProduct(apiProduct, xProductNames, counter); + } +} + +/** + * Handle the 'overwrite' execution model for API product migration. + * + * @param {Object} apiProduct - API product from Apigee Edge. + * @param {Array} xProductNames - List of API product names in Apigee X. + * @param {Object} counter - Migration summary counter. + */ +async function handleOverwriteProduct(apiProduct, xProductNames, counter) { + if (xProductNames.includes(apiProduct.name)) { + try { + const edgeProduct = await prepareProductPayload(apiProduct); + const x_product = await updateApigeeXApiProduct(Context.destinationClient, edgeProduct.name, JSON.stringify(edgeProduct)); + counter.migrated++; + logMigrationStatus('APIProduct', apiProduct.name, 'Migrated', x_product.createdAt); + } catch (overwriteError) { + handleMigrationError('APIProduct', apiProduct.name, overwriteError, counter); + } + } else { + // Create new entity in X if it does not exist + await handleCreateProduct(apiProduct, xProductNames, counter); + } +} + +/** + * Prepare the payload for an API product. + * + * @param {Object} apiProduct - API product data. + * @returns {Object} - Prepared API product payload. + */ +async function prepareProductPayload(apiProduct) { + const environmentMap = JSON.parse(process.env?.apigee_environment_map ?? '{}'); + + return { + name: apiProduct.name || '', + displayName: apiProduct.displayName || '', + approvalType: apiProduct.approvalType || '', + attributes: apiProduct.attributes || [], + description: apiProduct.description || '', + apiResources: apiProduct.apiResources || [], + environments: (apiProduct.environments ?? []).map(environment => environmentMap[environment]), + proxies: apiProduct.proxies || [], + quota: apiProduct.quota || '', + quotaInterval: apiProduct.quotaInterval || '', + quotaTimeUnit: apiProduct.quotaTimeUnit || '', + scopes: apiProduct.scopes || [] + }; +} + +// Export the migrateApiProducts function as default +export default migrateApiProducts; \ No newline at end of file diff --git a/tools/apigee-edge-to-x-migration-tool/src/modules/apigee-edge-to-x-essentials/actions/run-migration/migrateApiProxies.js b/tools/apigee-edge-to-x-migration-tool/src/modules/apigee-edge-to-x-essentials/actions/run-migration/migrateApiProxies.js new file mode 100644 index 00000000..e53f50bb --- /dev/null +++ b/tools/apigee-edge-to-x-migration-tool/src/modules/apigee-edge-to-x-essentials/actions/run-migration/migrateApiProxies.js @@ -0,0 +1,234 @@ +/** + * Copyright 2025 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +// Import necessary modules and utilities +import fs from 'fs/promises'; +import { setTimeout } from 'timers/promises'; +import Context from "../../../../utils/context.js"; +import { + getApigeeEdgeApiProxyNames, + getApigeeEdgeApiProxyBundle, + getApigeeEdgeApiProxyByName, + getApigeeEdgeApiProxyDeployments +} from "../../../../gateway-clients/apigee-edge/api-proxies/index.js"; +import { + getApigeeXApiProxyNames, + getApigeeXApiProxyDeployments, + getApiProxyRevisionDeployment, + createApigeeXApiProxy, + deleteApigeeXApiProxyByName, + deployApiRevision, + undeployApiProxyRevision +} from "../../../../gateway-clients/apigee-x/api-proxies/index.js"; +import { + logMigrationStatus, + handleMigrationError, + markAsDuplicate +} from "./migrationLogHelper.js"; + +/** + * Migrate API proxies from Apigee Edge to Apigee X using the specified execution model. + * + * @param {Object} options - Options for migration, including executionModel. + */ +async function migrateApiProxies(options) { + try { + // Retrieve API proxy names from Apigee Edge and Apigee X + const edge_proxyNames = await getApigeeEdgeApiProxyNames(Context.sourceClient); + const apiProxyNames = await getApigeeXApiProxyNames(Context.destinationClient); + let x_apiProxyNames = []; + + // Check if apiProxyNames.proxies is not an empty array + if (apiProxyNames.proxies && apiProxyNames.proxies.length > 0) { + x_apiProxyNames = apiProxyNames.proxies.map(proxy => proxy.name); + } + + // Initialize a counter for migration summary + const counter = { + entityType: 'APIProxy', + edgeTotal: edge_proxyNames.length, + migrated: 0, + duplicates: 0, + skipped: 0, + failed: 0 + }; + + // Process each API proxy from Apigee Edge + for (let proxyName of edge_proxyNames) { + await processApiProxy(proxyName, x_apiProxyNames, options.executionModel, counter); + } + + // Log the final migration summary + console.log(counter); + } catch (error) { + console.error("Error migrating API proxies:", error); + } +} + +/** + * Process an individual API proxy based on the execution model. + * + * @param {String} proxyName - API proxy name from Apigee Edge. + * @param {String} executionModel - The execution model ('create', 'merge', 'overwrite'). + * @param {Object} counter - Migration summary counter. + */ +async function processApiProxy(proxyName, x_apiProxyNames, executionModel, counter) { + switch (executionModel) { + case 'create': + await handleCreateProxy(proxyName, x_apiProxyNames, counter); + break; + case 'merge': + console.log("Synchronize is not a valid option for API Proxies"); + break; + case 'overwrite': + await handleOverwriteProxy(proxyName, x_apiProxyNames, counter); + break; + default: + console.error("Invalid execution model specified."); + } +} + +/** + * Handle the 'create' execution model for API proxy migration. + * + * @param {String} proxyName - API proxy name from Apigee Edge. + * @param {Array} x_apiProxyNames - List of API Proxy names in Apigee X. + * @param {Object} counter - Migration summary counter. + */ +async function handleCreateProxy(proxyName, x_apiProxyNames, counter) { + if (!x_apiProxyNames.includes(proxyName)) { + try { + // Retrieve proxy and deployment details from Apigee Edge + const environmentMap = JSON.parse(process.env.apigee_environment_map || '{}'); + const proxy = await getApigeeEdgeApiProxyByName(Context.sourceClient, proxyName); + const edgeProxyDeployments = await getApigeeEdgeApiProxyDeployments(Context.sourceClient, proxyName); + const edgeDeployments = []; + + // Gather all deployment information + for (const env of edgeProxyDeployments.environment || []) { + for (const rev of env.revision) { + edgeDeployments.push({ + environment: env.name, + revision: rev.name + }); + } + } + let revisionMigrated = 0; + let envMigratedTotal = 0; + // Process each revision for the proxy + for (const revisionId of proxy.revision) { + const bundleFilePath = await getApigeeEdgeApiProxyBundle( + Context.sourceClient, + proxyName, + revisionId + ); + + const buffer = await fs.readFile(bundleFilePath); + + if (!Buffer.isBuffer(buffer)) { + console.error(`Not a buffer`); + } + + try { + // Create API proxy in Apigee X + const x_proxy = await createApigeeXApiProxy(Context.destinationClient, proxyName, buffer); + revisionMigrated++; + let envMigrated = 0; + // Deploy to appropriate environments in X + for (const deployments of edgeDeployments) { + const deployedRevision = deployments.revision; + const edgeEnvironment = deployments.environment; + const xEnvironments = environmentMap[edgeEnvironment]; + + if (!xEnvironments) { + console.warn(`Skipping deployment for '${proxyName}' - No mapping for Edge environment '${edgeEnvironment}'.`); + counter.skipped++; + continue; + } + + if (Number(revisionId) === Number(deployedRevision)) { + const deploy = await deployApiRevision(Context.destinationClient, xEnvironments, proxyName, x_proxy.revision); + + let deploymentStatus = ''; + const pollInterval = 15000; // 15 seconds interval + + // Polling until deployment is ready + while (deploymentStatus !== 'READY') { + const deployment = await getApiProxyRevisionDeployment(Context.destinationClient, xEnvironments, proxyName, x_proxy.revision); + deploymentStatus = deployment.state; + + if (deploymentStatus !== 'READY') { + await setTimeout(pollInterval); // Wait before checking again + } + } + + if (deploymentStatus === 'READY') { + envMigrated++; + logMigrationStatus('APIProxy', proxyName, 'Migrated', x_proxy.createdAt) + } + } + } + envMigratedTotal += envMigrated; //totalDeployments + } catch (creationError) { + handleMigrationError('APIProxy', proxyName, creationError, counter); + } + } + if (revisionMigrated > 0) { + if (edgeDeployments.length === 0) { + counter.migrated++; // No deployments in Edge, but import succeeded + } else if (envMigratedTotal === edgeDeployments.length) { + counter.migrated++; // All environments migrated + } + } + } catch (error) { + handleMigrationError('APIProxy', proxyName, error, counter); + } + } else { + markAsDuplicate('APIProxy', proxyName, counter); + } +} + +/** + * Handle the 'overwrite' execution model for API proxy migration. + * + * @param {String} proxyName - API proxy name from Apigee Edge. + * @param {Array} x_apiProxyNames - List of API proxy names in Apigee X. + * @param {Object} counter - Migration summary counter. + */ +async function handleOverwriteProxy(proxyName, x_apiProxyNames, counter) { + + if (x_apiProxyNames.includes(proxyName)) { + try { + // Retrieve deployments and undeploy from Apigee X + const xProxyDeployments = await getApigeeXApiProxyDeployments(Context.destinationClient, proxyName); + + if (Array.isArray(xProxyDeployments.deployments)) { + for (const deployment of xProxyDeployments.deployments) { + await undeployApiProxyRevision(Context.destinationClient, deployment.environment, proxyName, deployment.revision); + } + } + // Delete the API proxy in Apigee X + await deleteApigeeXApiProxyByName(Context.destinationClient, proxyName); + } catch (overwriteError) { + handleMigrationError('APIProxy', proxyName, overwriteError, counter); + } + } + // Proceed to create a new entity in X + await handleCreateProxy(proxyName, [], counter); +} + +// Export the migrateApiProxies function as default +export default migrateApiProxies; \ No newline at end of file diff --git a/tools/apigee-edge-to-x-migration-tool/src/modules/apigee-edge-to-x-essentials/actions/run-migration/migrateDeveloperApps.js b/tools/apigee-edge-to-x-migration-tool/src/modules/apigee-edge-to-x-essentials/actions/run-migration/migrateDeveloperApps.js new file mode 100644 index 00000000..54b9d4ec --- /dev/null +++ b/tools/apigee-edge-to-x-migration-tool/src/modules/apigee-edge-to-x-essentials/actions/run-migration/migrateDeveloperApps.js @@ -0,0 +1,332 @@ +/** + * Copyright 2025 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +// Import necessary modules and utilities +import Context from "../../../../utils/context.js"; +import mergeData from "../../../../utils/mergeData.js"; + +import { + getApigeeEdgeDeveloperApps, + getApigeeEdgeDeveloperAppById +} from "../../../../gateway-clients/apigee-edge/developer-apps/index.js"; +import { + getApigeeEdgeDevelopers +} from "../../../../gateway-clients/apigee-edge/developers/index.js"; +import { + getApigeeXDeveloperApps, + getApigeeXDeveloperAppsByDeveloperId, + getApigeeXDeveloperAppById, + createDeveloperApp, + updateDeveloperApp, + createDeveloperAppKeys, + updateDeveloperAppKeys, + deleteDeveloperAppKeys, + deleteApigeeXDeveloperAppById +} from "../../../../gateway-clients/apigee-x/developer-apps/index.js"; +import { + getApigeeXDevelopers +} from "../../../../gateway-clients/apigee-x/developers/index.js"; +import { + logMigrationStatus, + handleMigrationError, + markAsDuplicate, + logDeviations +} from "./migrationLogHelper.js"; + +/** + * Migrate developer apps from Apigee Edge to Apigee X. + * + * @param {Object} options - Options for migration, including developerEmailMap and executionModel. + */ +async function migrateDeveloperApps(options) { + try { + // Counter for tracking migration status + const appCounter = { + entityType: 'DeveloperApp', + edgeTotal: 0, + migrated: 0, + skipped: 0, + failed: 0, + duplicates: 0, + credentialErrors: 0 + }; + + // Fetch developer apps from Apigee Edge + const edgeDeveloperApps = await getApigeeEdgeDeveloperApps(Context.sourceClient); + const xDeveloperApps = await getApigeeXDeveloperApps(Context.destinationClient); + const edgeDevelopers = await getApigeeEdgeDevelopers(Context.sourceClient); + + // Process each developer app from Apigee Edge + for (const edgeApp of edgeDeveloperApps) { + appCounter.edgeTotal++; + const appName = edgeApp.name; + if (edgeApp.developerId !== undefined) { + const developer = edgeDevelopers.find(developer => developer.developerId === edgeApp.developerId); + const developerEmail = developer ? developer.email : null; + await migrateDeveloperApp(edgeApp, xDeveloperApps, developerEmail, options.executionModel, appCounter); + } else { + console.warn(`Skipping migration of Company App: ${appName}`); + appCounter.skipped++; + } + } + + // Log the summary of the migration process + console.log(appCounter); + } catch (error) { + console.error("Error migrating Developer Apps:", error); + } +} + +/** + * Helper function to migrate an individual developer app. + * + * @param {Object} edgeApp - The app to migrate. + * @param {Array} xDeveloperApps - Developer apps from Apigee X. + * @param {String} developerEmail - The email of the developer. + * @param {String} executionModel - The execution model ('create', 'merge', 'overwrite'). + * @param {Object} counter - Counter for tracking migration status. + */ +async function migrateDeveloperApp(edgeApp, xDeveloperApps, developerEmail, executionModel, counter) { + switch (executionModel) { + case 'create': + await handleCreateApp(edgeApp, xDeveloperApps, developerEmail, counter); + break; + case 'merge': + await handleMergeApp(edgeApp, xDeveloperApps, developerEmail, counter); + break; + case 'overwrite': + await handleOverwriteApp(edgeApp, xDeveloperApps, developerEmail, counter); + break; + default: + console.error("Invalid execution model specified."); + } +} + +/** + * Handle the 'create' execution model for Developer Apps migration. + * + * @param {Object} edgeApp - Developer Apps from Apigee Edge. + * @param {Array} xDeveloperApps - List of Developer Apps names in Apigee X. + * @param {String} developerEmail - The email of the developer. + * @param {Object} counter - Migration summary counter. + */ +async function handleCreateApp(edgeApp, xDeveloperApps, developerEmail, counter) { + const xDeveloperAppNames = (xDeveloperApps && xDeveloperApps.length > 0) + ? xDeveloperApps.map(app => app.name) + : []; + + if (!xDeveloperAppNames.includes(edgeApp.name)) { + try { + await processMigration(edgeApp, developerEmail, counter); + } catch (creationError) { + handleMigrationError('DeveloperApp', edgeApp.name, creationError, counter); + } + } else { + markAsDuplicate('DeveloperApp', edgeApp.name, counter); + } +} + +/** + * Handle the 'merge' execution model for Developer Apps migration. + * + * @param {Object} edgeApp - Developer Apps from Apigee Edge. + * @param {Array} xDeveloperApps - List of Developer Apps names in Apigee X. + * @param {String} developerEmail - The email of the developer. + * @param {Object} counter - Migration summary counter. + */ +async function handleMergeApp(edgeApp, xDeveloperApps, developerEmail, counter) { + const xDeveloperAppNames = (xDeveloperApps && xDeveloperApps.length > 0) + ? xDeveloperApps.map(app => app.name) + : []; + + if (xDeveloperAppNames.includes(edgeApp.name)) { + try { + const edgeAppFormatted = await prepareAppPayload(edgeApp); + const existingXApp = xDeveloperApps.find(app => app.name === edgeApp.name); + const xDeveloperAppFormatted = await prepareAppPayload(existingXApp); + const mergeResults = await mergeData(xDeveloperAppFormatted, edgeAppFormatted, true); + + let appSync = false; + + if (mergeResults.mergedData) { + const mergedDeveloperApp = mergeResults.mergedData; + const x_app = await updateDeveloperApp(Context.destinationClient, developerEmail, mergedDeveloperApp.name, JSON.stringify(mergedDeveloperApp)); + appSync = true; + logDeviations('DeveloperApp', mergedDeveloperApp.name, mergeResults, x_app.createdAt); + } else { + appSync = true; + } + + if (appSync) { + let allCredentialsMigrated = true; + const existingXKeys = (existingXApp.credentials || []).map(c => c.consumerKey); + + // Handle each set of credentials for the app + for (const credential of edgeApp.credentials) { + try { + if (!existingXKeys.includes(credential.consumerKey)) { + await processCredential(credential, edgeApp.name, developerEmail, true); + existingXKeys.push(credential.consumerKey); // After create, update list + } else { + await processCredential(credential, edgeApp.name, developerEmail, false); + } + } catch (keyError) { + handleMigrationError('DeveloperAppCredential', edgeApp.name, keyError, counter); + counter.credentialErrors++; + allCredentialsMigrated = false; + } + } + + if (allCredentialsMigrated) { + counter.migrated++; + logMigrationStatus('DeveloperApp', edgeApp.name, 'Migrated', ''); + } else { + counter.failed++; + logMigrationStatus('DeveloperApp', edgeApp.name, 'Failed', ''); + } + } + } catch (mergeError) { + handleMigrationError('DeveloperApp', edgeApp.name, mergeError, counter); + } + } else { + // Create new entity in X + await handleCreateApp(edgeApp, xDeveloperApps, developerEmail, counter); + } +} + +/** + * Handle the 'overwrite' execution model for Developer Apps migration. + * + * @param {Object} edgeApp - Developer Apps from Apigee Edge. + * @param {Array} xDeveloperApps - List of Developer Apps names in Apigee X. + * @param {String} developerEmail - The email of the developer. + * @param {Object} counter - Migration summary counter. + */ +async function handleOverwriteApp(edgeApp, xDeveloperApps, developerEmail, counter) { + const xDeveloperAppNames = (xDeveloperApps && xDeveloperApps.length > 0) + ? xDeveloperApps.map(app => app.name) + : []; + + if (xDeveloperAppNames.includes(edgeApp.name)) { + try { + await deleteApigeeXDeveloperAppById(Context.destinationClient, developerEmail, edgeApp.name); + } catch (overwriteError) { + handleMigrationError('DeveloperApp', edgeApp.name, overwriteError, counter); + } + } + + await handleCreateApp(edgeApp, [], developerEmail, counter); +} + +/** + * Prepare the payload for a developer app. + * + * @param {Object} app - Developer app data. + * @returns {Object} - Prepared developer app payload. + */ +async function prepareAppPayload(app) { + const appPayload = { + name: app.name, + apiProducts: app.apiProducts, + attributes: app.attributes, + appFamily: app.appFamily, + callbackUrl: app.callbackUrl, + scopes: app.scopes, + status: app.status, + keyExpiresIn: 1 // Expire Temp Key immediately after creation + }; + + return appPayload; +} + +/** + * Process migration for a developer app. + * + * @param {Object} app - The app to migrate. + * @param {String} developerEmail - The email of the developer. + * @param {Object} counter - Counter for tracking migration status. + */ +async function processMigration(app, developerEmail, counter) { + try { + const appPayload = await prepareAppPayload(app); + const createdApp = await createDeveloperApp(Context.destinationClient, developerEmail, JSON.stringify(appPayload)); + + if (createdApp) { + const appName = createdApp.name; + const developerID = createdApp.developerId; + const deleteKey = createdApp.credentials[0].consumerKey; + + // Delete existing keys + await deleteDeveloperAppKeys(Context.destinationClient, developerID, appName, deleteKey); + + let allCredentialsMigrated = true; + + // Handle each set of credentials for the app + for (const credential of app.credentials) { + try { + await processCredential(credential, appName, developerID, true); + } catch (keyError) { + handleMigrationError('DeveloperAppCredential', appName, keyError, counter); + counter.credentialErrors++; + allCredentialsMigrated = false; + } + } + + if (allCredentialsMigrated) { + counter.migrated++; + logMigrationStatus('DeveloperApp', appName, 'Migrated', createdApp.createdAt); + } else { + counter.failed++; + logMigrationStatus('DeveloperApp', appName, 'Failed', createdApp.createdAt); + } + } + } catch (appError) { + handleMigrationError('DeveloperApp', app.name, appError, counter); + } +} + +/** + * Processes each credential for an app. + * + * @param {Object} credential - Credential to be processed. + * @param {String} appName - Name of the application. + * @param {String} developerID - ID of the developer. + * @param {Boolean} isNew - Flag indicating if the credential is new. + */ +async function processCredential(credential, appName, developerID, isNew = true) { + const apiProducts = credential.apiProducts.map(product => product.apiproduct); + credential.apiProducts = apiProducts; + + if (credential.expiresAt !== -1) { + const expiryInSeconds = Math.floor(credential.expiresAt / 1000) - Math.floor(Date.now() / 1000); + credential.expiresInSeconds = expiryInSeconds; + delete credential.expiresAt; + } + + try { + if (isNew) { + // Create new App credentials + await createDeveloperAppKeys(Context.destinationClient, developerID, appName, JSON.stringify(credential)); + } + // Update App credentials to attach API Products + await updateDeveloperAppKeys(Context.destinationClient, developerID, appName, credential.consumerKey, JSON.stringify(credential)); + } catch (error) { + throw error; // Re-throw the error to parse as keyError. + } +} + +// Export the migrateDeveloperApps function as default +export default migrateDeveloperApps; \ No newline at end of file diff --git a/tools/apigee-edge-to-x-migration-tool/src/modules/apigee-edge-to-x-essentials/actions/run-migration/migrateDevelopers.js b/tools/apigee-edge-to-x-migration-tool/src/modules/apigee-edge-to-x-essentials/actions/run-migration/migrateDevelopers.js new file mode 100644 index 00000000..5940a7e9 --- /dev/null +++ b/tools/apigee-edge-to-x-migration-tool/src/modules/apigee-edge-to-x-essentials/actions/run-migration/migrateDevelopers.js @@ -0,0 +1,212 @@ +/** + * Copyright 2025 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +// Import necessary modules and utilities +import Context from "../../../../utils/context.js"; +import mergeData from "../../../../utils/mergeData.js"; + +// Import necessary modules and utilities for developer migration +import { + getApigeeEdgeDevelopers +} from "../../../../gateway-clients/apigee-edge/developers/index.js"; +import { + getApigeeXDevelopers, + getApigeeXDeveloperById, + createApigeeXDeveloper, + deleteApigeeXDeveloperById, + updateApigeeXDeveloperById +} from "../../../../gateway-clients/apigee-x/developers/index.js"; +import { + logMigrationStatus, + handleMigrationError, + markAsDuplicate, + logDeviations +} from "./migrationLogHelper.js"; + +/** + * Migrate developers from Apigee Edge to Apigee X. + * + * @param {Object} options - Options for migration, including executionModel. + */ +async function migrateDevelopers(options) { + try { + // Fetch developers from Apigee Edge + const edgeDevelopers = await getApigeeEdgeDevelopers(Context.sourceClient); + let xDeveloperEmails = []; + + // Fetch and extract developer emails from Apigee X + const developerEmails = await getApigeeXDevelopers(Context.destinationClient); + if (developerEmails && developerEmails.length > 0) { + xDeveloperEmails = developerEmails.map(developer => developer.email); + } + + // Initialize a counter for migration summary + const counter = { + entityType: 'Developer', + edgeTotal: edgeDevelopers.length, + migrated: 0, + duplicates: 0, + failed: 0 + }; + + // Process each developer from Apigee Edge + for (let developer of edgeDevelopers) { + await processDeveloper(developer, xDeveloperEmails, options.executionModel, counter); + } + + // Log the final migration summary + console.log(counter); + } catch (error) { + console.error("Error migrating developers:", error); + } +} + +/** + * Process an individual developer based on the execution model. + * + * @param {Object} developer - Developer from Apigee Edge. + * @param {Array} xDeveloperEmails - List of developer emails in Apigee X. + * @param {String} executionModel - The execution model ('create', 'merge', 'overwrite'). + * @param {Object} counter - Migration summary counter. + */ +async function processDeveloper(developer, xDeveloperEmails, executionModel, counter) { + switch (executionModel) { + case 'create': + await handleCreateDeveloper(developer, xDeveloperEmails, counter); + break; + case 'merge': + await handleMergeDeveloper(developer, xDeveloperEmails, counter); + break; + case 'overwrite': + await handleOverwriteDeveloper(developer, xDeveloperEmails, counter); + break; + default: + console.error("Invalid execution model specified for developer."); + } +} + +/** + * Handle the 'create' execution model for developer migration. + * + * @param {Object} developer - Developer from Apigee Edge. + * @param {Array} xDeveloperEmails - List of developer emails in Apigee X. + * @param {Object} counter - Migration summary counter. + */ +async function handleCreateDeveloper(developer, xDeveloperEmails, counter) { + if (!xDeveloperEmails.includes(developer.email)) { + try { + const developerPayload = await prepareDeveloperPayload(developer); + const x_developer = await createApigeeXDeveloper(Context.destinationClient, JSON.stringify(developerPayload)); + counter.migrated++; + logMigrationStatus('Developer', developer.email, 'Migrated', x_developer.createdAt); + } catch (creationError) { + handleMigrationError('Developer', developer.email, creationError, counter); + } + } else { + markAsDuplicate('Developer', developer.email, counter); + } +} + +/** + * Handle the 'merge' execution model for developer migration. + * + * @param {Object} developer - Developer from Apigee Edge. + * @param {Array} xDeveloperEmails - List of developer emails in Apigee X. + * @param {Object} counter - Migration summary counter. + */ +async function handleMergeDeveloper(developer, xDeveloperEmails, counter) { + if (xDeveloperEmails.includes(developer.email)) { + try { + // Prepare the developer payload from Edge + const edgeDeveloper = await prepareDeveloperPayload(developer); + + // Fetch the existing developer from Apigee X + const existingXDeveloper = await getApigeeXDeveloperById(Context.destinationClient, developer.email); + const xDeveloperFormatted = await prepareDeveloperPayload(existingXDeveloper); + + // Merge the existing X developer data with Edge developer data + const mergeResults = await mergeData(xDeveloperFormatted, edgeDeveloper, true); + + // If merged data exists, update the developer in Apigee X + if (mergeResults.mergedData) { + const mergedDeveloper = mergeResults.mergedData; + const x_developer = await updateApigeeXDeveloperById(Context.destinationClient, mergedDeveloper.email, JSON.stringify(mergedDeveloper)); + counter.migrated++; + + // Log the migration status and deviations + logMigrationStatus('Developer', mergedDeveloper.email, 'Migrated', x_developer.createdAt); + logDeviations('Developer', mergedDeveloper.email, mergeResults, x_developer.createdAt); + } else { + markAsDuplicate('Developer', developer.email, counter); + } + } catch (mergeError) { + // Handle any errors during the merge process + handleMigrationError('Developer', developer.email, mergeError, counter); + } + } else { + // If developer does not exist in Apigee X, create a new one + await handleCreateDeveloper(developer, xDeveloperEmails, counter); + } +} + +/** + * Handle the 'overwrite' execution model for developer migration. + * + * @param {Object} developer - Developer from Apigee Edge. + * @param {Array} xDeveloperEmails - List of developer emails in Apigee X. + * @param {Object} counter - Migration summary counter. + */ +async function handleOverwriteDeveloper(developer, xDeveloperEmails, counter) { + if (xDeveloperEmails.includes(developer.email)) { + try { + // Prepare the developer payload from Edge + const edgeDeveloper = await prepareDeveloperPayload(developer); + + // Overwrite the existing developer in Apigee X with Edge data + const x_developer = await updateApigeeXDeveloperById(Context.destinationClient, edgeDeveloper.email, JSON.stringify(edgeDeveloper)); + counter.migrated++; + + // Log the successful migration + logMigrationStatus('Developer', developer.email, 'Migrated', x_developer.createdAt); + } catch (overwriteError) { + // Handle any errors during the overwrite process + handleMigrationError('Developer', developer.email, overwriteError, counter); + } + } else { + // If developer does not exist in Apigee X, create a new one + await handleCreateDeveloper(developer, xDeveloperEmails, counter); + } +} + +/** + * Prepare the payload for a developer. + * + * @param {Object} developer - Developer data. + * @returns {Object} - Prepared developer payload. + */ +async function prepareDeveloperPayload(developer) { + const developerPayload = developer; + + // Remove specific properties not needed for Apigee X + delete developerPayload['organizationName']; + delete developerPayload['createdBy']; + delete developerPayload['lastModifiedBy']; + + return developerPayload; +} + +// Export the migrateDevelopers function as default +export default migrateDevelopers; \ No newline at end of file diff --git a/tools/apigee-edge-to-x-migration-tool/src/modules/apigee-edge-to-x-essentials/actions/run-migration/migrateKeyValueMaps.js b/tools/apigee-edge-to-x-migration-tool/src/modules/apigee-edge-to-x-essentials/actions/run-migration/migrateKeyValueMaps.js new file mode 100644 index 00000000..c546eabd --- /dev/null +++ b/tools/apigee-edge-to-x-migration-tool/src/modules/apigee-edge-to-x-essentials/actions/run-migration/migrateKeyValueMaps.js @@ -0,0 +1,309 @@ +/** + * Copyright 2025 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +// Import necessary modules and utilities +import Context from "../../../../utils/context.js"; +import { + getApigeeEdgeEnvKeyValueMaps, + getApigeeEdgeEnvKeyValueMapsByMap, + getApigeeEdgeEnvKVMEntry, + getApigeeEdgeEnvKVMKeys, + getApigeeEdgeOrgKeyValueMaps, + getApigeeEdgeOrgKeyValueMapsByMap, + getApigeeEdgeOrgKVMEntry, + getApigeeEdgeOrgKVMKeys +} from "../../../../gateway-clients/apigee-edge/keyValueMaps/index.js"; +import { + getApigeeXEnvKeyValueMaps, + getApigeeXEnvKeyValueMapsByMap, + getApigeeXEnvKVMEntry, + getApigeeXEnvKVMKeys, + getApigeeXOrgKeyValueMaps, + getApigeeXOrgKeyValueMapsByMap, + getApigeeXOrgKVMEntry, + getApigeeXOrgKVMKeys, + createApigeeXEnvKeyValueMaps, + createApigeeXEnvKVMEntries, + createApigeeXOrgKeyValueMaps, + createApigeeXOrgKVMEntries, + deleteApigeeXOrgKeyValueMap, + deleteApigeeXEnvKeyValueMap +} from "../../../../gateway-clients/apigee-x/keyValueMaps/index.js"; +import { + logMigrationStatus, + handleMigrationError, + markAsDuplicate +} from "./migrationLogHelper.js"; + +/** + * Migrate key-value maps from Apigee Edge to Apigee X. + * + * @param {Object} options - Options for migration, including executionModel. + */ +async function migrateKeyValueMaps(options) { + try { + // Handle org-scope migrations + const orgKVMCounter = { + entityType: 'KeyValueMap', + scope: 'organization', + edgeMapsInScope: 0, + migrated: 0, + duplicates: 0, + skipped: 0, + failed: 0, + totalEntries: 0 + }; + const edgeOrgKVMs = await getApigeeEdgeOrgKeyValueMaps(Context.sourceClient); + const xOrgKVMs = await getApigeeXOrgKeyValueMaps(Context.destinationClient); + + const edgeOrgKVMNames = (Array.isArray(edgeOrgKVMs) && edgeOrgKVMs.length > 0) ? edgeOrgKVMs : []; + orgKVMCounter.edgeMapsInScope = edgeOrgKVMNames.length; + const xOrgKVMNames = (Array.isArray(xOrgKVMs) && xOrgKVMs.length > 0) ? xOrgKVMs : []; + + await migrateKVMs(edgeOrgKVMNames, xOrgKVMNames, 'organization', '', '', orgKVMCounter, options.executionModel); + + const envResults = []; + const environmentMap = JSON.parse(process.env?.apigee_environment_map ?? '{}'); + for (const [sourceEnvironment, targetEnvironment] of Object.entries(environmentMap)) { + // Handle environment-scope migrations + const envKVMCounter = { + entityType: 'KeyValueMap', + scope: 'environment', + edgeEnvironment: sourceEnvironment, + xEnvironment: targetEnvironment, + edgeMapsInScope: 0, + migrated: 0, + duplicates: 0, + skipped: 0, + failed: 0, + totalEntries: 0 + }; + + const edgeEnvKVMs = await getApigeeEdgeEnvKeyValueMaps(Context.sourceClient, sourceEnvironment); + const xEnvKVMs = await getApigeeXEnvKeyValueMaps(Context.destinationClient, targetEnvironment); + + const edgeEnvKVMNames = (Array.isArray(edgeEnvKVMs) && edgeEnvKVMs.length > 0) ? edgeEnvKVMs : []; + envKVMCounter.edgeMapsInScope = edgeEnvKVMNames.length; + const xEnvKVMNames = (Array.isArray(xEnvKVMs) && xEnvKVMs.length > 0) ? xEnvKVMs : []; + + await migrateKVMs(edgeEnvKVMNames, xEnvKVMNames, 'environment', sourceEnvironment, targetEnvironment, envKVMCounter, options.executionModel); + envResults.push({ ...envKVMCounter }); + } + + // Counter Summary of both Org and Env Level + console.log(orgKVMCounter); + console.log(envResults); + + } catch (error) { + console.error("Error migrating KeyValueMaps:", error); + } +} + +/** + * Migrate key-value maps based on the execution model. + * + * @param {Array} edgeKVMs - List of key-value maps in Apigee Edge. + * @param {Array} xKVMs - List of key-value maps in Apigee X. + * @param {String} scope - Migration scope ('organization' or environment name). + * @param {String} sourceEnvironment - Source Environment if scope is environment. + * @param {String} targetEnvironment - Target Environment if scope is environment. + * @param {String} executionModel - The execution model ('create', 'merge', 'overwrite'). + */ +async function migrateKVMs(edgeKVMs, xKVMs, scope, sourceEnvironment, targetEnvironment, counter, executionModel) { + switch (executionModel) { + case 'create': + await handleCreateKVMs(edgeKVMs, xKVMs, scope, sourceEnvironment, targetEnvironment, counter); + break; + case 'merge': + await handleMergeKVMs(edgeKVMs, xKVMs, scope, sourceEnvironment, targetEnvironment, counter); + break; + case 'overwrite': + await handleOverwriteKVMs(edgeKVMs, xKVMs, scope, sourceEnvironment, targetEnvironment, counter); + break; + default: + console.error("Invalid execution model specified."); + } +} + +/** + * Handle the 'create' execution model for KVM migration. + */ +async function handleCreateKVMs(edgeKVMs, xKVMs, scope, sourceEnvironment, targetEnvironment, counter) { + for (const kvm of edgeKVMs) { + try { + // In Apigee X, KVM is encrypted by default. + const KeyValueMap = { + name: kvm, + encrypted: true + }; + + let kvmState = ''; + + if (xKVMs.includes(kvm)) { + kvmState = 'duplicate'; + counter.duplicates++; + logMigrationStatus('KeyValueMap', kvm, 'Duplicate', ''); + continue; + } + + let isEncrypted, kvmEntries, entryCounter; + switch (scope) { + case 'organization': + const orgKVMData = await getApigeeEdgeOrgKeyValueMapsByMap(Context.sourceClient, kvm); + isEncrypted = orgKVMData.encrypted === true; + kvmEntries = orgKVMData.entry || []; + if (isEncrypted) { + console.log(`Skipping migration of Encrypted KVM from ${scope}: ${kvm}`); + counter.skipped++; + logMigrationStatus('KeyValueMap', kvm, 'Skipped', ''); + continue; + } + if (kvmState !== 'duplicate') { + await createApigeeXOrgKeyValueMaps(Context.destinationClient, JSON.stringify(KeyValueMap)); + } + // Proceed adding Entries + entryCounter = await processKVMEntries(kvm, scope, '', '', kvmEntries, counter); + + counter.migrated++; + logMigrationStatus('KeyValueMap', kvm, 'Migrated', ''); + break; + case 'environment': + const envKVMData = await getApigeeEdgeEnvKeyValueMapsByMap(Context.sourceClient, sourceEnvironment, kvm); + isEncrypted = envKVMData.encrypted === true; + kvmEntries = envKVMData.entry || []; + if (isEncrypted) { + console.log(`Skipping migration of Encrypted KVM from ${scope}: ${kvm}`); + counter.skipped++; + logMigrationStatus('KeyValueMap', kvm, 'Skipped', ''); + continue; + } + if (kvmState !== 'duplicate') { + await createApigeeXEnvKeyValueMaps(Context.destinationClient, targetEnvironment, JSON.stringify(KeyValueMap)); + } + // Proceed adding Entries + entryCounter = await processKVMEntries(kvm, scope, sourceEnvironment, targetEnvironment, kvmEntries, counter); + counter.migrated++; + logMigrationStatus('KeyValueMap', kvm, 'Migrated', ''); + break; + default: + break; + } + + if (entryCounter) { + counter.totalEntries = (counter.totalEntries || 0) + entryCounter.totalEntries; + counter.migratedEntries = (counter.migratedEntries || 0) + entryCounter.migrated; + counter.failedEntries = (counter.failedEntries || 0) + entryCounter.failed; + } + } catch (error) { + handleMigrationError('KeyValueMap', kvm, error, counter); + } + } +} + +/** + * Handle the 'merge' execution model for KVM migration. + */ +async function handleMergeKVMs(edgeKVMs, xKVMs, scope, sourceEnvironment, targetEnvironment, counter) { + console.log("Synchronize KeyValue Maps is not available"); +} + +/** + * Handle the 'overwrite' execution model for KVM migration. + */ +async function handleOverwriteKVMs(edgeKVMs, xKVMs, scope, sourceEnvironment, targetEnvironment, counter) { + for (const kvm of edgeKVMs) { + if (xKVMs.includes(kvm)) { + try { + switch (scope) { + case 'organization': + await deleteApigeeXOrgKeyValueMap(Context.destinationClient, kvm); + break; + case 'environment': + await deleteApigeeXEnvKeyValueMap(Context.destinationClient, targetEnvironment, kvm); + break; + default: + break; + } + } catch (overwriteError) { + handleMigrationError('KeyValueMap', kvm, overwriteError, counter); + } + } + await handleCreateKVMs([kvm], [], scope, sourceEnvironment, targetEnvironment, counter); + } +} + +/** + * Processes and creates entries for key-value maps. + * @param {Object} kvmName - The name of KVM to which entry is to be added. + * @param {Object} kvmEntry - The KVM entry containing key-value information. + * @param {string} scope - Scope of key value map 'organization' or 'environment'. + * @param {string} environment - The environment where the map should be created. + */ +async function processKVMEntries(kvmName, scope, sourceEnvironment, targetEnvironment, kvmEntries, counter) { + const orgEntryCounter = { + entityType: 'KeyValueMapEntry', + entityName: kvmName, + scope: scope, + totalEntries: 0, + migrated: 0, + duplicates: 0, + skipped: 0, + failed: 0 + }; + + const envEntryCounter = { + entityType: 'KeyValueMapEntry', + entityName: kvmName, + scope: scope, + edgeEnvironment: sourceEnvironment, + xEnvironment: targetEnvironment, + totalEntries: 0, + migrated: 0, + duplicates: 0, + skipped: 0, + failed: 0 + }; + + switch (scope) { + case 'organization': + for (const keyValuePair of kvmEntries) { + orgEntryCounter.totalEntries++; + try { + await createApigeeXOrgKVMEntries(Context.destinationClient, kvmName, JSON.stringify(keyValuePair)); + orgEntryCounter.migrated++; + } catch (entryError) { + orgEntryCounter.failed++; + } + } + return orgEntryCounter; + case 'environment': + for (const keyValuePair of kvmEntries) { + envEntryCounter.totalEntries++; + try { + await createApigeeXEnvKVMEntries(Context.destinationClient, targetEnvironment, kvmName, JSON.stringify(keyValuePair)); + envEntryCounter.migrated++; + } catch (entryError) { + envEntryCounter.failed++; + } + } + return envEntryCounter; + default: + return null; + } +} + +// Export the migrateKeyValueMaps function as default +export default migrateKeyValueMaps; \ No newline at end of file diff --git a/tools/apigee-edge-to-x-migration-tool/src/modules/apigee-edge-to-x-essentials/actions/run-migration/migrateResourceFiles.js b/tools/apigee-edge-to-x-migration-tool/src/modules/apigee-edge-to-x-essentials/actions/run-migration/migrateResourceFiles.js new file mode 100644 index 00000000..682aa314 --- /dev/null +++ b/tools/apigee-edge-to-x-migration-tool/src/modules/apigee-edge-to-x-essentials/actions/run-migration/migrateResourceFiles.js @@ -0,0 +1,162 @@ +/** + * Copyright 2025 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +// Import necessary modules and utilities +import Context from "../../../../utils/context.js"; +import fs from "fs/promises"; +import { setTimeout } from "timers/promises"; + +import { + getApigeeEdgeResourceFiles, + getApigeeEdgeResourceFileById +} from "../../../../gateway-clients/apigee-edge/resource-files/index.js"; + +import { + getApigeeXResourceFiles, + createApigeeXResourceFile, + updateApigeeXResourceFile +} from "../../../../gateway-clients/apigee-x/resource-files/index.js"; + +import { + logMigrationStatus, + handleMigrationError, + markAsDuplicate +} from "./migrationLogHelper.js"; +import deleteApigeeXResourceFile from "../../../../gateway-clients/apigee-x/resource-files/deleteResourceFile.js"; + +/** + * Migrate environment-level resource files from Apigee Edge to Apigee X. + * + * @param {Object} options - Options for migration, including executionModel. + */ +async function migrateResourceFiles(options) { + try { + // Load the environment mapping + const environmentMap = JSON.parse(process.env.apigee_environment_map || '{}'); + const countersSummary = []; + + // Iterate over each environment mapping + for (const [sourceEnv, targetEnv] of Object.entries(environmentMap)) { + // Fetch resource files from Apigee Edge and Apigee X + const edgeResourceFiles = await getApigeeEdgeResourceFiles(Context.sourceClient, sourceEnv); + const xResourceFiles = await getApigeeXResourceFiles(Context.destinationClient, targetEnv); + + const x_resourceFileNames = xResourceFiles.map(r => `${r.type}/${r.name}`); + const counter = { + entityType: `ResourceFile (${sourceEnv} → ${targetEnv})`, + edgeTotal: edgeResourceFiles.length, + migrated: 0, + duplicates: 0, + skipped: 0, + failed: 0 + }; + + // Process each resource file + for (let file of edgeResourceFiles) { + const identifier = `${file.type}/${file.name}@${sourceEnv}`; + await processResourceFile(file, identifier, sourceEnv, targetEnv, x_resourceFileNames, options.executionModel, counter); + } + + countersSummary.push(counter); + } + // Log the counters summary for visibility + console.log(countersSummary); + } catch (error) { + console.error("Error migrating environment-level resource files:", error); + } +} + +/** + * Process an individual resource file based on the execution model. + * + * @param {Object} resourceFile - Resource file metadata from Apigee Edge. + * @param {String} identifier - A unique ID for logging (e.g., "jsc/pathsetter.js@dev"). + * @param {String} sourceEnv - Source environment. + * @param {String} targetEnv - Target environment. + * @param {Array} x_resourceFileNames - List of resource file names already present in Apigee X. + * @param {String} executionModel - The execution model ('create', 'merge', 'overwrite'). + * @param {Object} counter - Migration summary counter. + */ +async function processResourceFile(resourceFile, identifier, sourceEnv, targetEnv, x_resourceFileNames, executionModel, counter) { + switch (executionModel) { + case 'create': + await handleCreateResourceFile(resourceFile, identifier, sourceEnv, targetEnv, x_resourceFileNames, counter); + break; + case 'merge': + console.log("Synchronize is not a valid option for ResourceFile"); + break; + case 'overwrite': + await handleOverwriteResourceFile(resourceFile, identifier, sourceEnv, targetEnv, x_resourceFileNames, counter); + break; + default: + console.error("Invalid execution model specified."); + } +} + +/** + * Handle create mode for ResourceFiles. + * + * @param {Object} resourceFile - Resource file metadata from Apigee Edge. + * @param {String} identifier - A unique ID for logging (e.g., "jsc/pathsetter.js@dev"). + * @param {String} sourceEnv - Source environment. + * @param {String} targetEnv - Target environment. + * @param {Array} x_resourceFileNames - List of resource file names already present in Apigee X. + * @param {Object} counter - Migration summary counter. + * @param {Boolean} [isOverwrite=false] - Flag to indicate if overwrite mode is enabled. + */ +async function handleCreateResourceFile(resourceFile, identifier, sourceEnv, targetEnv, x_resourceFileNames, counter, isOverwrite = false) { + const shortName = `${resourceFile.type}/${resourceFile.name}`; + if (isOverwrite || !x_resourceFileNames.includes(shortName)) { + try { + const resourceFileData = await getApigeeEdgeResourceFileById(Context.sourceClient, resourceFile.type, resourceFile.name, sourceEnv); + await createApigeeXResourceFile(Context.destinationClient, targetEnv, resourceFile.type, resourceFile.name, resourceFileData); + + counter.migrated++; + logMigrationStatus('ResourceFile', identifier, 'Migrated'); + } catch (err) { + handleMigrationError('ResourceFile', identifier, err, counter); + } + } else { + markAsDuplicate('ResourceFile', identifier, counter); + } +} + +/** + * Handle overwrite mode for ResourceFiles. + * + * @param {Object} resourceFile - Resource file metadata from Apigee Edge. + * @param {String} identifier - A unique ID for logging (e.g., "jsc/pathsetter.js@dev"). + * @param {String} sourceEnv - Source environment. + * @param {String} targetEnv - Target environment. + * @param {Array} x_resourceFileNames - List of resource file names already present in Apigee X. + * @param {Object} counter - Migration summary counter. + */ +async function handleOverwriteResourceFile(resourceFile, identifier, sourceEnv, targetEnv, x_resourceFileNames, counter) { + const shortName = `${resourceFile.type}/${resourceFile.name}`; + + if (x_resourceFileNames.includes(shortName)) { + try { + await deleteApigeeXResourceFile(Context.destinationClient, targetEnv, resourceFile.type, resourceFile.name, x_resourceFileNames); + } catch (err) { + handleMigrationError('ResourceFile', identifier, err, counter); + } + } + + await handleCreateResourceFile(resourceFile, identifier, sourceEnv, targetEnv, x_resourceFileNames, counter, true); +} + +// Export the migrateResourceFiles function as default +export default migrateResourceFiles; \ No newline at end of file diff --git a/tools/apigee-edge-to-x-migration-tool/src/modules/apigee-edge-to-x-essentials/actions/run-migration/migrateSharedFlows.js b/tools/apigee-edge-to-x-migration-tool/src/modules/apigee-edge-to-x-essentials/actions/run-migration/migrateSharedFlows.js new file mode 100644 index 00000000..6b612a6e --- /dev/null +++ b/tools/apigee-edge-to-x-migration-tool/src/modules/apigee-edge-to-x-essentials/actions/run-migration/migrateSharedFlows.js @@ -0,0 +1,234 @@ +/** + * Copyright 2025 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +// Import necessary modules and utilities +import fs from 'fs/promises'; +import { setTimeout } from 'timers/promises'; +import Context from "../../../../utils/context.js"; +import { + getApigeeEdgeSharedFlowNames, + getApigeeEdgeSharedFlowBundle, + getApigeeEdgeSharedFlowByName, + getApigeeEdgeSharedFlowDeployments +} from "../../../../gateway-clients/apigee-edge/shared-flows/index.js"; +import { + getApigeeXSharedFlowNames, + getApigeeXSharedFlowDeployments, + getSharedFlowRevisionDeployment, + validateApigeeXSharedFlowBundle, + createApigeeXSharedFlow, + deleteApigeeXSharedFlowByName, + deploySharedFlowRevision, + undeploySharedFlowRevision +} from "../../../../gateway-clients/apigee-x/shared-flows/index.js"; +import { logMigrationStatus, handleMigrationError, markAsDuplicate } from "./migrationLogHelper.js"; + +/** + * Migrate shared flows from Apigee Edge to Apigee X using the specified execution model. + * + * @param {Object} options - Options for migration, including executionModel. + */ +async function migrateSharedFlows(options) { + try { + // Retrieve shared flow names from Apigee Edge and Apigee X + const edge_sharedFlowNames = await getApigeeEdgeSharedFlowNames(Context.sourceClient); + const sharedFlowNames = await getApigeeXSharedFlowNames(Context.destinationClient); + let x_sharedFlowNames = []; + + // Check if sharedFlowNames.sharedFlows is not an empty array + if (sharedFlowNames.sharedFlows && sharedFlowNames.sharedFlows.length > 0) { + x_sharedFlowNames = sharedFlowNames.sharedFlows.map(flow => flow.name); + } + + // Initialize a counter for migration summary + const counter = { + entityType: 'SharedFlow', + edgeTotal: edge_sharedFlowNames.length, + migrated: 0, + duplicates: 0, + skipped: 0, + failed: 0 + }; + + // Process each shared flow + for (let flowName of edge_sharedFlowNames) { + await processSharedFlow(flowName, x_sharedFlowNames, options.executionModel, counter); + } + + // Log the final migration summary + console.log(counter); + } catch (error) { + console.error("Error migrating shared flows:", error); + } +} + +/** + * Process an individual shared flow based on the execution model. + * + * @param {String} flowName - Shared flow name from Apigee Edge. + * @param {Array} x_sharedFlowNames - List of shared flow names in Apigee X. + * @param {String} executionModel - The execution model ('create', 'merge', 'overwrite'). + * @param {Object} counter - Migration summary counter. + */ +async function processSharedFlow(flowName, x_sharedFlowNames, executionModel, counter) { + switch (executionModel) { + case 'create': + await handleCreateSharedFlow(flowName, x_sharedFlowNames, counter); + break; + case 'merge': + console.log("Synchronize is not a valid option for Shared Flows"); + break; + case 'overwrite': + await handleOverwriteSharedFlow(flowName, x_sharedFlowNames, counter); + break; + default: + console.error("Invalid execution model specified."); + } +} + +/** + * Handle the 'create' execution model for shared flow migration. + * + * @param {String} flowName - Shared flow name from Apigee Edge. + * @param {Array} x_sharedFlowNames - List of shared flow names in Apigee X. + * @param {Object} counter - Migration summary counter. + */ +async function handleCreateSharedFlow(flowName, x_sharedFlowNames, counter) { + if (!x_sharedFlowNames.includes(flowName)) { + try { + // Retrieve shared flow and deployment details from Apigee Edge + const environmentMap = JSON.parse(process.env.apigee_environment_map || '{}'); + const sharedFlow = await getApigeeEdgeSharedFlowByName(Context.sourceClient, flowName); + const edgeSharedFlowDeployments = await getApigeeEdgeSharedFlowDeployments(Context.sourceClient, flowName); + const edgeDeployments = []; + + for (const env of edgeSharedFlowDeployments.environment || []) { + for (const rev of env.revision) { + edgeDeployments.push({ + environment: env.name, + revision: rev.name + }); + } + } + let revisionMigrated = 0; + let envMigratedTotal = 0; + // Process each revision for the shared flow + for (const revisionId of sharedFlow.revision) { + const bundleFilePath = await getApigeeEdgeSharedFlowBundle( + Context.sourceClient, + flowName, + revisionId + ); + + const buffer = await fs.readFile(bundleFilePath); + + if (!Buffer.isBuffer(buffer)) { + console.error(`Not a buffer`); + } + + try { + // Create shared flow in Apigee X + const x_sharedFlow = await createApigeeXSharedFlow(Context.destinationClient, flowName, buffer); + revisionMigrated++; + let envMigrated = 0; + // Deploy to appropriate environments in X + for (const deployments of edgeDeployments) { + const deployedRevision = deployments.revision; + const edgeEnvironment = deployments.environment; + const xEnvironments = environmentMap[edgeEnvironment]; + + if (!xEnvironments) { + console.warn(`Skipping deployment for '${flowName}' - No mapping for Edge environment '${edgeEnvironment}'.`); + counter.skipped++; + continue; + } + + if (Number(revisionId) === Number(deployedRevision)) { + const deploy = await deploySharedFlowRevision(Context.destinationClient, xEnvironments, flowName, x_sharedFlow.revision); + + let deploymentStatus = ''; + const pollInterval = 15000; // 15 seconds interval + + // Polling until deployment is ready + while (deploymentStatus !== 'READY') { + const deployment = await getSharedFlowRevisionDeployment(Context.destinationClient, xEnvironments, flowName, x_sharedFlow.revision); + deploymentStatus = deployment.state; + + if (deploymentStatus !== 'READY') { + await setTimeout(pollInterval); // Wait before checking again + } + } + + if (deploymentStatus === 'READY') { + envMigrated++; + logMigrationStatus('SharedFlow', flowName, 'Migrated', x_sharedFlow.createdAt); + } + } + } + envMigratedTotal += envMigrated; //totalDeployments + } catch (creationError) { + console.log(`creationError : ${flowName}`); + handleMigrationError('SharedFlow', flowName, creationError, counter); + } + } + if (revisionMigrated > 0) { + if (edgeDeployments.length === 0) { + counter.migrated++; // No deployments in Edge, but import succeeded + } else if (envMigratedTotal === edgeDeployments.length) { + counter.migrated++; // All environments migrated + } + } + } catch (error) { + console.log(`error: ${flowName}`); + handleMigrationError('SharedFlow', flowName, error, counter); + } + } else { + markAsDuplicate('SharedFlow', flowName, counter); + } +} + +/** + * Handle the 'overwrite' execution model for shared flow migration. + * + * @param {String} flowName - Shared flow name from Apigee Edge. + * @param {Array} x_sharedFlowNames - List of shared flow names in Apigee X. + * @param {Object} counter - Migration summary counter. + */ +async function handleOverwriteSharedFlow(flowName, x_sharedFlowNames, counter) { + if (x_sharedFlowNames.includes(flowName)) { + // Perform clean up in Apigee X. + try { + // Identify the deployed environments and revisions. + const xSharedFlowDeployments = await getApigeeXSharedFlowDeployments(Context.destinationClient, flowName); + + // Undeploy and delete shared flow Apigee X + if (Array.isArray(xSharedFlowDeployments.deployments)) { + for (const deployment of xSharedFlowDeployments.deployments) { + await undeploySharedFlowRevision(Context.destinationClient, deployment.environment, flowName, deployment.revision); + } + } + await deleteApigeeXSharedFlowByName(Context.destinationClient, flowName); + } catch (overwriteError) { + handleMigrationError('SharedFlow', flowName, overwriteError, counter); + } + } + + // Create new entity in X + await handleCreateSharedFlow(flowName, [], counter); +} + +// Export the migrateSharedFlows function as default +export default migrateSharedFlows; \ No newline at end of file diff --git a/tools/apigee-edge-to-x-migration-tool/src/modules/apigee-edge-to-x-essentials/actions/run-migration/migrationLogHelper.js b/tools/apigee-edge-to-x-migration-tool/src/modules/apigee-edge-to-x-essentials/actions/run-migration/migrationLogHelper.js new file mode 100644 index 00000000..34600fb3 --- /dev/null +++ b/tools/apigee-edge-to-x-migration-tool/src/modules/apigee-edge-to-x-essentials/actions/run-migration/migrationLogHelper.js @@ -0,0 +1,114 @@ +/** + * Copyright 2025 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +import errorHandler from "../../../../utils/errorHandler.js"; +import Logger from "../../../../utils/logHandler.js"; + +/** + * Log migration status for an Entity Type. + * + * @param {String} name - Name of the Entity Type. + * @param {String} state - Migration state (e.g., 'Migrated', 'Failed'). + * @param {String} attemptedAt - Timestamp of the migration attempt. + */ +export function logMigrationStatus(entityType, name, state, attemptedAt) { + Logger.getInstance().createStatusEntry({ + entityType: entityType, + entityName: name, + migrationState: state, + migrationAttempted: attemptedAt ? epochToIso(Number(attemptedAt)) : new Date().toISOString(), + cause: '' + }); +} +/** + * Handle migration errors for an Entity Type. + * + * @param {String} name - Name of the Entity Type. + * @param {Error} error - Error encountered during migration. + * @param {Object} counter - Migration summary counter. + */ +export async function handleMigrationError(entityType, name, error, counter) { + const { code, message } = await errorHandler(error); + switch (Number(code)) { + case 409: + markAsDuplicate(entityType, name, counter) + return code; + default: + counter.failed++; + Logger.getInstance().createStatusEntry({ + entityType: entityType, + entityName: name, + migrationState: 'Failed', + migrationAttempted: new Date().toISOString(), + cause: `${entityType} Creation Error [${code}]: ${message}` + }); + break; + } +} +/** + * Mark an Entity Type as a duplicate during migration. + * + * @param {String} name - Name of the Entity Type. + * @param {Object} counter - Migration summary counter. + */ +export function markAsDuplicate(entityType, name, counter) { + counter.duplicates++; + Logger.getInstance().createStatusEntry({ + entityType: entityType, + entityName: name, + migrationState: 'Skipped', + migrationAttempted: new Date().toISOString(), + cause: `Duplicate` + }); +} +/** + * Log deviations found during the merge process of an Entity Type. + * + * @param {String} name - Name of the Entity Type. + * @param {Object} mergeResults - Results of the merge operation. + * @param {String} attemptedAt - Timestamp of the migration attempt. + */ +export function logDeviations(entityType, name, mergeResults, attemptedAt) { + Logger.getInstance().createDeviationsEntry({ + entityType: entityType, + entityName: name, + source_data: mergeResults.source, + target_data: mergeResults.target, + deviations: mergeResults.deviations, + merged_data: mergeResults.mergedData, + migrationAttempted: attemptedAt ? epochToIso(Number(attemptedAt)) : new Date().toISOString() + }); +} + +export function epochToIso(epochTimestamp) { + // Ensure the timestamp is a number + if (typeof epochTimestamp !== 'number' || isNaN(epochTimestamp)) { + throw new Error('Invalid epoch timestamp'); + } + // Determine if the epoch timestamp is in seconds or milliseconds + const isMilliseconds = epochTimestamp > 9999999999; + + // Convert the epoch timestamp to milliseconds if it's in seconds + const timestampInMs = isMilliseconds ? epochTimestamp : epochTimestamp * 1000; + + // Create a new Date object using the timestamp in milliseconds + const date = new Date(timestampInMs); + + // Convert the Date object to an ISO 8601 formatted string + const isoString = date.toISOString(); + + return isoString; +} diff --git a/tools/apigee-edge-to-x-migration-tool/src/modules/apigee-edge-to-x-essentials/actions/run-migration/runMigration.js b/tools/apigee-edge-to-x-migration-tool/src/modules/apigee-edge-to-x-essentials/actions/run-migration/runMigration.js new file mode 100644 index 00000000..1c89fa86 --- /dev/null +++ b/tools/apigee-edge-to-x-migration-tool/src/modules/apigee-edge-to-x-essentials/actions/run-migration/runMigration.js @@ -0,0 +1,157 @@ +/** + * Copyright 2025 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +import { select } from '@inquirer/prompts'; + +// List of migration types, now includes Back and Home options +const migrationTypes = [ + { + name: 'API Proxies', + migrationHandler: `./migrateApiProxies.js`, + description: 'Select to migrate API Proxies.', + }, + { + name: 'API Products', + migrationHandler: `./migrateApiProducts.js`, + description: 'Select to migrate API Products.', + }, + { + name: 'Developer Apps', + migrationHandler: `./migrateDeveloperApps.js`, + description: 'Select to migrate Developer Apps.', + }, + { + name: 'Developers', + migrationHandler: `./migrateDevelopers.js`, + description: 'Select to migrate Developers.', + }, + { + name: 'KeyValueMaps', + migrationHandler: `./migrateKeyValueMaps.js`, + description: 'Select to migrate Unencrypted Key Value Maps.', + }, + { + name: 'Resource Files', + migrationHandler: `./migrateResourceFiles.js`, + description: 'Select to migrate Environment Level Resource files.', + }, + { + name: 'Shared Flows', + migrationHandler: `./migrateSharedFlows.js`, + description: 'Select to migrate Shared Flows.', + }, + { name: 'Exit', value: 'Exit', description: 'Exit Tool' } +]; + +async function runMigration() { + let continueNavigation = true; + const menuStack = []; + + const navigateMenu = async (choices, message) => { + const selectedOption = await select({ + name: 'menuOption', + message, + choices: choices.map(choice => ({ + name: choice.name, + value: choice.migrationHandler || choice.value, + description: choice.description, + })), + }); + + if (selectedOption === 'Exit') { + // console.log("Exit Tool..."); + continueNavigation = false; + menuStack.length = 0; // Clear stack for a fresh start + } else if (selectedOption === 'Back') { + if (menuStack.length > 0) { + menuStack.pop(); // Go back to the previous menu + } else { + // If at main menu and back is selected, end navigation + continueNavigation = false; + } + } else { + menuStack.push(selectedOption); // Add to stack if navigating deeper + } + + return selectedOption; + }; + + while (continueNavigation) { + const currentMenu = menuStack[menuStack.length - 1] || 'mainMenu'; + + switch (currentMenu) { + case 'mainMenu': + const selectedMigration = await navigateMenu(migrationTypes, 'Choose what to migrate'); + + if (selectedMigration === 'Back' || selectedMigration === 'Exit') { + continue; + } + + menuStack.push(selectedMigration); // Push the chosen migration for context in the next menu + break; + + default: + const nonSyncTypes = [ + './migrateApiProxies.js', + './migrateSharedFlows.js', + './migrateKeyValueMaps.js', + './migrateResourceFiles.js' + ]; + + const executionModelOptions = [ + { + name: 'Migrate', + value: 'create', + description: `Creates an entity if it doesn't exist. Skips if exists` + }, + { + name: 'Overwrite', + value: 'overwrite', + description: `Overwrites matching entities using data from Apigee Edge. Any changes done to same entity in Apigee X will be overwritten. Choose with caution.` + }, + { name: 'Back', value: 'Back', description: 'Navigate to previous menu.' }, + { name: 'Exit', value: 'Exit', description: 'Exit Tool' } + ]; + + if (!nonSyncTypes.includes(currentMenu)) { + executionModelOptions.splice(1, 0, { + name: 'Synchronize', + value: 'merge', + description: `Compares Entity data between Edge and X. Synchronizes net new values from Edge to X. Any changed values in Apigee X will be left intact.` + }); + } + + const executionModel = await navigateMenu(executionModelOptions, 'Select the execution model'); + + if (executionModel === 'Back') { + menuStack.pop(); + continue; + } else if (executionModel === 'Exit') { + // console.log("Exit Tool..."); + continueNavigation = false; + break; + } + + const { default: migrationHandler } = await import(currentMenu); + migrationHandler({ executionModel }); + + continueNavigation = false; + break; + } + } +} + +export default runMigration; \ No newline at end of file diff --git a/tools/apigee-edge-to-x-migration-tool/src/modules/apigee-edge-to-x-essentials/module.js b/tools/apigee-edge-to-x-migration-tool/src/modules/apigee-edge-to-x-essentials/module.js new file mode 100644 index 00000000..acd5da2e --- /dev/null +++ b/tools/apigee-edge-to-x-migration-tool/src/modules/apigee-edge-to-x-essentials/module.js @@ -0,0 +1,46 @@ +/** + * Copyright 2025 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +import runMigration from './actions/run-migration/runMigration.js'; +import migrationLog from './actions/migration-log/migrationLog.js'; + +/** + * Module for migrating essential data from Apigee Edge to Apigee X, including: + * API Proxies, API Proxy Deployments, Shared Flows, Shared Flow Deployments, Developers, + * Developer Apps, API Products, and Resources + */ +const module = { + name: 'Apigee Edge to X', + + isSupported: (sourceGatewayId, destinationGatewayId) => { + return sourceGatewayId === 'apigee_edge' && destinationGatewayId === 'apigee_x'; + }, + + actions: () => { + return [ + { + name: 'Migrate', + execute: runMigration + }, + { + name: 'View Logs', + execute: migrationLog + } + ] + } +} + +export default module; \ No newline at end of file diff --git a/tools/apigee-edge-to-x-migration-tool/src/modules/index.js b/tools/apigee-edge-to-x-migration-tool/src/modules/index.js new file mode 100644 index 00000000..0fb12313 --- /dev/null +++ b/tools/apigee-edge-to-x-migration-tool/src/modules/index.js @@ -0,0 +1,56 @@ +/** + * Copyright 2025 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +import { fileURLToPath, pathToFileURL } from 'url'; +import fs from 'fs'; +import path from 'path'; +import Context from '../utils/context.js'; + +const __filename = fileURLToPath(import.meta.url); +const __dirname = path.dirname(__filename); + +/** + * Get a list of modules that support migrating content from the configured source + * and destination gateways. + * + * @returns {array<{name: string,isSupported: () => bool,actions: () => array<{name: string, execute: ()}>} + */ +async function getSupportedModules() { + const modulesDir = path.resolve(__dirname); + const modules = []; + + for (let file of fs.readdirSync(modulesDir)) { + if (fs.statSync(path.join(modulesDir, file)).isDirectory() == false) { + continue; + } + + const moduleFile = `${modulesDir}/${file}/module.js`; + + if (!fs.existsSync(moduleFile)) { + continue; + } + + const { default: module } = await import(pathToFileURL(moduleFile)); + + if (module?.isSupported(Context.sourceGatewayId, Context.destinationGatewayId) && module.name && module.actions) { + modules.push(module); + } + } + + return modules; +} + +export default getSupportedModules; \ No newline at end of file diff --git a/tools/apigee-edge-to-x-migration-tool/src/utils/context.js b/tools/apigee-edge-to-x-migration-tool/src/utils/context.js new file mode 100644 index 00000000..9f8a277b --- /dev/null +++ b/tools/apigee-edge-to-x-migration-tool/src/utils/context.js @@ -0,0 +1,80 @@ +/** + * Copyright 2025 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +import dotenv from 'dotenv'; + +import ApigeeEdgeClient from "../gateway-clients/apigee-edge/ApigeeEdgeClient.js"; +import ApigeeXClient from "../gateway-clients/apigee-x/ApigeeXClient.js"; + +dotenv.config(); + +const sourceGatewayId = process.env.source_gateway_type; +const destinationGatewayId = process.env.destination_gateway_type; + +function getSourceClient() { + switch (sourceGatewayId) { + case 'apigee_edge': + return new ApigeeEdgeClient( + process.env.source_gateway_base_url, + process.env.source_gateway_org, + { + username: process.env.source_gateway_username ?? null, + password: process.env.source_gateway_password ?? null + } + ); + + case 'apigee_x': + return new ApigeeXClient( + process.env.source_gateway_base_url, + process.env.source_gateway_org, + JSON.parse(Buffer.from(process.env.source_gateway_service_account, 'base64').toString('ascii')) + ); + } + + throw new Error(`Unknown source gateway type ${sourceGatewayId}`); +} + +function getDestinationClient() { + switch (destinationGatewayId) { + case 'apigee_edge': + return new ApigeeEdgeClient( + process.env.destination_gateway_base_url, + process.env.destination_gateway_org, + { + username: process.env.destination_gateway_username ?? null, + password: process.env.destination_gateway_password ?? null + } + ); + + case 'apigee_x': + return new ApigeeXClient( + process.env.destination_gateway_base_url, + process.env.destination_gateway_org, + JSON.parse(Buffer.from(process.env.destination_gateway_service_account, 'base64').toString('ascii')) + ); + } + + throw new Error(`Unknown destination gateway type ${destinationGatewayId}`); +} + +const Context = { + sourceGatewayId, + sourceClient: getSourceClient(), + destinationGatewayId, + destinationClient: getDestinationClient() +} + +export default Context; \ No newline at end of file diff --git a/tools/apigee-edge-to-x-migration-tool/src/utils/errorHandler.js b/tools/apigee-edge-to-x-migration-tool/src/utils/errorHandler.js new file mode 100644 index 00000000..5055e43a --- /dev/null +++ b/tools/apigee-edge-to-x-migration-tool/src/utils/errorHandler.js @@ -0,0 +1,31 @@ +/** + * Copyright 2025 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +/** + * Parses error message to extract code and message + * @param {Object} error - Error object + * @returns {Object} Parsed error with code and message + */ +export default async function errorHandler(error) { + try { + const errorDetails = JSON.parse(error.message); + const code = errorDetails.error.code; + const message = errorDetails.error.message || 'Unknown Error'; + return { code, message }; + } catch { + return { code: 'Unknown', message: error.message || 'Unknown Error' }; + } +} diff --git a/tools/apigee-edge-to-x-migration-tool/src/utils/getDataDirectory.js b/tools/apigee-edge-to-x-migration-tool/src/utils/getDataDirectory.js new file mode 100644 index 00000000..9e9d401c --- /dev/null +++ b/tools/apigee-edge-to-x-migration-tool/src/utils/getDataDirectory.js @@ -0,0 +1,40 @@ +/** + * Copyright 2025 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +import fs from 'fs'; + +/** + * + * @param {string} moduleName + * @returns {string} + */ +function getDataDirectory(moduleName) { + if (typeof moduleName !== 'string' || !moduleName.match(/^[-_A-Za-z0-9]{1,32}$/g)) { + throw new Error(`Invalid module name "${moduleName}" when requesting data directory.`); + } + + const migrationDataDirectory = `${process.cwd()}/data/${moduleName}`; + + if (!fs.existsSync(migrationDataDirectory)) { + fs.mkdirSync(migrationDataDirectory, { + recursive: true + }); + } + + return migrationDataDirectory; +} + +export default getDataDirectory; \ No newline at end of file diff --git a/tools/apigee-edge-to-x-migration-tool/src/utils/logHandler.js b/tools/apigee-edge-to-x-migration-tool/src/utils/logHandler.js new file mode 100644 index 00000000..d12f4324 --- /dev/null +++ b/tools/apigee-edge-to-x-migration-tool/src/utils/logHandler.js @@ -0,0 +1,325 @@ +/** + * Copyright 2025 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +import libsql from 'libsql'; +import Table from 'cli-table3'; +import wrapAnsi from 'wrap-ansi'; +import getDataDirectory from './getDataDirectory.js'; + +class Logger { + static _instance = null; + _db = null; + _batchSize = 200; // Set the batch size for pagination + + constructor() { + if (Logger._instance) { + return Logger._instance; + } + + const dataDirectory = getDataDirectory(process.env.source_gateway_org); + const dbPath = `${dataDirectory}/${process.env.destination_gateway_org}.db`; + + try { + this._db = new libsql(dbPath); + // console.log(`Database created or opened at: ${dbPath}`); + this._initializeTables(); + } catch (error) { + console.error('Failed to create or open database:', error); + } + + Logger._instance = this; + } + + _initializeTables() { + this._initializeLogTable(); + this._initializeDeviationsTable(); + this._initializeEntitiesTable(); + } + + _initializeLogTable() { + try { + this._db.exec("CREATE TABLE IF NOT EXISTS log (id INTEGER PRIMARY KEY AUTOINCREMENT, type TEXT NOT NULL, timestamp INTEGER NOT NULL, key TEXT NOT NULL, message TEXT NOT NULL, metadata TEXT)"); + // console.log('Log table initialized successfully.'); + } catch (error) { + console.error('Failed to initialize log table:', error); + } + } + + _initializeDeviationsTable() { + try { + this._db.exec("CREATE TABLE IF NOT EXISTS deviations (entity_type TEXT NOT NULL, entity_name TEXT NOT NULL, source_data TEXT, target_data TEXT, deviations TEXT, merged_data TEXT, migrationAttempted TEXT NOT NULL, PRIMARY KEY (entity_type, entity_name, migrationAttempted))"); + // console.log('Deviations table initialized successfully.'); + } catch (error) { + console.error('Failed to initialize deviations table:', error); + } + } + + _initializeEntitiesTable() { + try { + this._db.exec("CREATE TABLE IF NOT EXISTS entities (entity_type TEXT NOT NULL, entity_name TEXT NOT NULL, migration_state TEXT, migration_attempted TEXT, cause TEXT, PRIMARY KEY (entity_type, entity_name))"); + // console.log('MigrationStatus table initialized successfully.'); + } catch (error) { + console.error('Failed to initialize migrations table:', error); + } + } + + static getInstance() { + if (!Logger._instance) { + Logger._instance = new Logger(); + } + return Logger._instance; + } + + // Method for migrationStatus + createStatusEntry(record) { + try { + const { entityType, entityName, migrationState, migrationAttempted, cause } = record; + this._db.prepare(`INSERT INTO entities (entity_type, entity_name, migration_state, migration_attempted, cause) + VALUES (?, ?, ?, ?, ?) ON CONFLICT(entity_type, entity_name) DO UPDATE SET migration_state=?, migration_attempted=?, cause=?`).run( + entityType, entityName, migrationState, migrationAttempted, cause, migrationState, migrationAttempted, cause + ); + } catch (err) { + console.error('Error creating migration entry:', err); + } + } + + // Method for deviations + createDeviationsEntry(record) { + try { + const { entityType, entityName, source_data, target_data, deviations, merged_data, migrationAttempted } = record; + this._db.prepare(`INSERT INTO deviations (entity_type, entity_name, source_data, target_data, deviations, merged_data, migrationAttempted) + VALUES (?, ?, ?, ?, ?, ?, ?) ON CONFLICT(entity_type, entity_name, migrationAttempted) DO UPDATE SET source_data=?, target_data=?, deviations=?, merged_data=?`).run( + entityType, entityName, + JSON.stringify(source_data), JSON.stringify(target_data), JSON.stringify(deviations), JSON.stringify(merged_data), migrationAttempted, + JSON.stringify(source_data), JSON.stringify(target_data), JSON.stringify(deviations), JSON.stringify(merged_data) + ); + } catch (err) { + console.error('Error creating migration entry:', err); + } + } + + // Method for accessLog + createLogEntry(type, key, message, metadata = '') { + if (!message) return; + + try { + const results = this._db.prepare('INSERT INTO log (type, timestamp, key, message, metadata) VALUES (?, ?, ?, ?, ?)').run( + type, Date.now(), key, message, typeof metadata === 'string' ? metadata : JSON.stringify(metadata) + ); + const displayLogLevel = process.env.TERMINAL_LOG_LVL !== undefined ? process.env.TERMINAL_LOG_LVL.toUpperCase() : type.toUpperCase(); + if (displayLogLevel === type.toUpperCase()) { + console.log(`[${type.toUpperCase()} ${results.lastInsertRowid}] ${message}.`, 'See log database for more info.'); + } + } catch (err) { + console.error('Error creating log entry:', err); + } + } + + // Logger methods as class methods + log(key, message, metadata) { + this.createLogEntry('log', key, message, metadata); + } + + warning(key, message, metadata) { + this.createLogEntry('warning', key, message, metadata); + } + + error(key, message, metadata) { + this.createLogEntry('error', key, message, metadata); + } + + viewLogs(type = null) { + try { + let query = `SELECT + *, + CASE + WHEN metadata LIKE '%Buffer%' THEN 'Bundle logged as buffer in DB.' + ELSE metadata + END AS metadata + FROM + log`; + const params = []; + + if (type) { + query += ` AND type = ?`; + // query += ` WHERE type = ?`; + params.push(type); + } + + let offset = 0; + let hasMoreRecords = true; + + while (hasMoreRecords) { + const paginatedQuery = `${query} ORDER BY "id" desc LIMIT ${this._batchSize} OFFSET ${offset}`; + const logs = this._db.prepare(paginatedQuery).all(...params); + + if (logs.length > 0) { + this.printLogTable(logs, this._batchSize); + offset += this._batchSize; + } else { + hasMoreRecords = false; + } + } + + process.exit(0); // Exit the tool after printing logs + + } catch (err) { + console.error('Error fetching logs:', err); + } + } + + viewDeviations(entityType = null) { + try { + let query = 'SELECT * FROM deviations'; + const params = []; + + if (entityType) { + query += ' WHERE entity_type=?'; + params.push(entityType); + } + + const deviations = this._db.prepare(query).all(...params); + this.printLogTable(deviations); + + process.exit(0); // Exit the tool after printing logs + + } catch (err) { + console.error('Error fetching deviations:', err); + } + } + + async viewMigrationStatus(entityType = null, migrationState = null) { + try { + let query = 'SELECT * FROM entities'; + const conditions = []; + const params = []; + + if (entityType) { + conditions.push('entity_type=?'); + params.push(entityType); + } + + if (migrationState) { + conditions.push('migration_state=?'); + params.push(migrationState); + } + + if (conditions.length > 0) { + query += ' WHERE ' + conditions.join(' AND '); + } + + const records = this._db.prepare(query).all(...params); + + this.printLogTable(records); + + process.exit(0); // Exit the tool after printing logs + + } catch (err) { + console.error('Error fetching migration status records:', err); + } + } + + async viewMigrationSummary(entityType = null) { + try { + const query = ` + SELECT + entity_type AS entityType, + COUNT(*) AS total, + SUM(CASE WHEN migration_state = 'Migrated' THEN 1 ELSE 0 END) AS migrated, + SUM(CASE WHEN migration_state = 'Skipped' THEN 1 ELSE 0 END) AS skipped, + SUM(CASE WHEN migration_state = 'Failed' THEN 1 ELSE 0 END) AS failed + FROM entities + ${entityType ? 'WHERE entity_type = ?' : ''} + GROUP BY entity_type + `; + const params = entityType ? [entityType] : []; + + const summary = this._db.prepare(query).all(...params); + + if (summary.length > 0) { + this.printSummaryTable(summary); + } else { + console.log('No summary data found.'); + } + + process.exit(0); // Exit the tool after printing logs + + } catch (err) { + console.error('Error fetching migration summary:', err); + } + } + + printSummaryTable(summaryData) { + if (!summaryData.length) { + console.log('No summary data found.'); + return; + } + + const headers = ['ENTITY TYPE', 'TOTAL RECORDS', 'MIGRATED', 'SKIPPED', 'FAILED']; + + const table = new Table({ + head: headers, + colWidths: [20, 15, 15, 15, 15], // Adjust column widths as needed + wordWrap: true + }); + + summaryData.forEach(data => { + table.push([ + data.entityType, + data.total, + data.migrated, + data.skipped, + data.failed + ]); + }); + + console.log(table.toString()); + } + + printLogTable(records) { + if (!records.length) { + console.log('No records found.'); + return; + } + + const headers = ['INDEX', ...Object.keys(records[0]).map(header => header.toUpperCase())]; + const availableWidth = Math.max(200, process.stdout.columns || 200); + + // Calculate appropriate column widths + const colWidths = headers.map(header => { + const maxContentWidth = Math.max( + header.length, + ...records.map((record, index) => (header === 'INDEX' ? index.toString().length : (record[header.toLowerCase()] || '').toString().length)) + ); + return Math.min(maxContentWidth + 2, Math.floor(availableWidth / headers.length)); + }); + + const table = new Table({ + head: headers, + colWidths, + wordWrap: true + }); + + records.forEach((record, index) => { + const row = [index, ...headers.slice(1).map(header => wrapAnsi((record[header.toLowerCase()] || '').toString(), colWidths[headers.indexOf(header)], { hard: true }))]; + table.push(row); + }); + console.log(table.toString()); + } + +} + +export default Logger; \ No newline at end of file diff --git a/tools/apigee-edge-to-x-migration-tool/src/utils/md5.js b/tools/apigee-edge-to-x-migration-tool/src/utils/md5.js new file mode 100644 index 00000000..6e130290 --- /dev/null +++ b/tools/apigee-edge-to-x-migration-tool/src/utils/md5.js @@ -0,0 +1,33 @@ +/** + * Copyright 2025 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +import crypto from 'crypto'; + +export default function md5(data) { + if (data === null || typeof data === 'undefined') { + return null; + } + + if (data instanceof Buffer) { + return crypto.createHash('md5').update(data).digest('hex'); + } + + if (typeof data === 'object') { + return crypto.createHash('md5').update(JSON.stringify(data)).digest('hex'); + } + + return crypto.createHash('md5').update(data).digest('hex'); +} diff --git a/tools/apigee-edge-to-x-migration-tool/src/utils/mergeData.js b/tools/apigee-edge-to-x-migration-tool/src/utils/mergeData.js new file mode 100644 index 00000000..97f9e94e --- /dev/null +++ b/tools/apigee-edge-to-x-migration-tool/src/utils/mergeData.js @@ -0,0 +1,168 @@ +/** + * Copyright 2025 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +/** + * Checks if the provided argument is a valid object. + * + * @param {any} obj - The argument to check. + * @returns {boolean} - Returns true if the argument is an object, false otherwise. + */ +function isObject(obj) { + return obj !== null && typeof obj === 'object' && !Array.isArray(obj); +} + +/** + * Recursively merges two objects, with optional precedence determination. + * + * @param {Object} target - The target object to merge into. + * @param {Object} source - The source object to merge from. + * @param {boolean} [targetPrecedence=true] - Determines if the target should take precedence. + * @returns {Object|null} - The merged object, or null if both are identical. + */ +function mergeDeep(target, source, targetPrecedence = true) { + if (!isObject(target) || !isObject(source)) { + return source; + } + + // Check if both target and source are identical + if (JSON.stringify(target) === JSON.stringify(source)) { + return null; // Return null if they are the same + } + + Object.keys(source).forEach(key => { + const targetValue = target[key]; + const sourceValue = source[key]; + + if (Array.isArray(targetValue) && Array.isArray(sourceValue)) { + target[key] = mergeArrays(targetValue, sourceValue, targetPrecedence); + } else if (isObject(targetValue) && isObject(sourceValue)) { + target[key] = mergeDeep({ ...targetValue }, sourceValue, targetPrecedence); // Use spread operator for shallow copy + } else { + target[key] = targetPrecedence && targetValue !== undefined ? targetValue : sourceValue; + } + }); + + return target; +} + +/** + * Merges two arrays, resolving conflicts based on object properties. + * + * @param {Array} targetArray - The target array to merge into. + * @param {Array} sourceArray - The source array to merge from. + * @param {boolean} targetPrecedence - Determines if the target should take precedence. + * @returns {Array} - The merged array. + */ +function mergeArrays(targetArray, sourceArray, targetPrecedence) { + const mergedArray = [...targetArray]; // Create a copy to avoid mutation + + sourceArray.forEach(sourceItem => { + if (isObject(sourceItem)) { + const conflictIndex = mergedArray.findIndex(targetItem => + isObject(targetItem) && targetItem.name === sourceItem.name + ); + + if (conflictIndex === -1) { + mergedArray.push(sourceItem); + } else { + mergedArray[conflictIndex] = targetPrecedence ? mergedArray[conflictIndex] : sourceItem; + } + } else { + if (!mergedArray.includes(sourceItem)) { + mergedArray.push(sourceItem); + } + } + }); + + return mergedArray; +} + +/** + * Function to find differences between two objects. + * + * @param {Object} target - The target object. + * @param {Object} source - The source object. + * @returns {Array} - An array of differences with key, source and target values. + */ +function findDeviations(target, source) { + const differences = []; + + // Function to compare objects and collect differences + function compareObjects(obj1, obj2, path = '') { + const allKeys = new Set([...Object.keys(obj1), ...Object.keys(obj2)]); + + allKeys.forEach(key => { + const fullPath = path ? `${path}.${key}` : key; + const value1 = obj1[key]; + const value2 = obj2[key]; + + if (isObject(value1) && isObject(value2)) { + compareObjects(value1, value2, fullPath); + } else if (Array.isArray(value1) && Array.isArray(value2)) { + if (JSON.stringify(value1) !== JSON.stringify(value2)) { + differences.push({ deviations: fullPath, source: value2, target: value1 }); + } + } else if (value1 !== value2) { + differences.push({ deviations: fullPath, source: value2, target: value1 }); + } + }); + } + + // Compare target and source objects + compareObjects(target, source); + + return differences.length > 0 ? differences : null; +} + +/** + * Removes specified keys from an object. + * + * @param {Object} obj - The object from which to remove keys. + * @param {Array} keysToRemove - An array of keys to remove. + * @returns {Object} - A new object with specified keys removed. + */ +function dropKeys(obj, keysToRemove) { + return Object.fromEntries( + Object.entries(obj).filter(([key]) => !keysToRemove.includes(key)) + ); +} + +/** + * Main function to merge two data sets after removing specified metadata keys. + * + * @param {Object} target - The target object. + * @param {Object} source - The source object. + * @param {boolean} [targetPrecedence=true] - Determines if the target should take precedence in conflicts. + * @returns {Object|null} - The merged object, or null if both are identical. + */ +export default async function mergeData(target, source, targetPrecedence = true) { + // Metadata keys that should be excluded during merging + const keysToRemove = ["createdAt", "createdBy", "lastModifiedAt", "lastModifiedBy"]; + + const cleanedSource = dropKeys(source, keysToRemove); + const cleanedTarget = dropKeys(target, keysToRemove); + const finalResult = { deviations: '', mergedData: '' }; + + // Check if cleaned objects are identical + if (JSON.stringify(cleanedTarget) === JSON.stringify(cleanedSource)) { + return finalResult + } + finalResult.source = cleanedSource; + finalResult.target = cleanedTarget; + finalResult.mergedData = mergeDeep(cleanedTarget, cleanedSource, targetPrecedence); + finalResult.deviations = findDeviations(cleanedTarget, cleanedSource); + return finalResult; +} \ No newline at end of file diff --git a/tools/apigee-edge-to-x-migration-tool/src/utils/urlSafeBase64Encode.js b/tools/apigee-edge-to-x-migration-tool/src/utils/urlSafeBase64Encode.js new file mode 100644 index 00000000..5cc52549 --- /dev/null +++ b/tools/apigee-edge-to-x-migration-tool/src/utils/urlSafeBase64Encode.js @@ -0,0 +1,28 @@ +/** + * Copyright 2025 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +/** + * Return a url-safe, base64-encoded representation of the input string. + * + * @param {string} str + * @returns + */ +export default function urlSafeBase64Encode(str) { + const utf8 = Buffer.from(str, 'utf-8'); + const base64 = utf8.toString('base64'); + + return base64.replace(/\+/g, '-').replace(/\//g, '_').replace(/=+$/, ''); +} diff --git a/tools/apigee-edge-to-x-migration-tool/tool-setup.sh b/tools/apigee-edge-to-x-migration-tool/tool-setup.sh new file mode 100755 index 00000000..2a1b27c1 --- /dev/null +++ b/tools/apigee-edge-to-x-migration-tool/tool-setup.sh @@ -0,0 +1,72 @@ +#!/usr/bin/env bash +# Copyright 2025 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +# Define tool name +TOOL_NAME="apigee-edge-to-x-migration-tool" + +# Function to display banner +display_banner() { + echo "===================================" + echo " $TOOL_NAME setup " + echo "===================================" +} + +# Function to check if Node.js is installed +check_node() { + if command -v node >/dev/null 2>&1; then + echo "Node.js is installed." + else + echo "Node.js is not installed. Please install Node.js first." + exit 1 + fi +} + +# Function to set up the tool +setup_tool() { + echo "Setting up $TOOL_NAME..." + + # Check if package.json exists, if not initialize npm + if [ ! -f package.json ]; then + echo "Initializing npm..." + npm init -y + fi + + # Install necessary packages + echo "Installing necessary packages..." + npm install @inquirer/prompts + node install-modules.js + echo "$TOOL_NAME setup complete." +} + +# Function to initialize the tool +init_tool() { + echo "Initializing $TOOL_NAME..." + + npm link + + echo "Initialization done" + echo "Command to Launch Tool : apigee-e2x" + echo "Launching the tool" + apigee-e2x + +} + +# Main script execution +display_banner +check_node +setup_tool +init_tool + +exit 0