From a311b2ef8bef6e5a605a7586813f99a9ab7f7f62 Mon Sep 17 00:00:00 2001 From: shafeeqd959 Date: Mon, 19 Aug 2024 10:53:43 +0530 Subject: [PATCH] axios upgraded --- package-lock.json | 96 ++++++++++++++----- packages/contentstack-utilities/package.json | 2 +- .../src/utils/personalization-api-adapter.ts | 20 ++-- pnpm-lock.yaml | 16 +++- 4 files changed, 98 insertions(+), 36 deletions(-) diff --git a/package-lock.json b/package-lock.json index 4d78ce0192..a9ca3278da 100644 --- a/package-lock.json +++ b/package-lock.json @@ -440,6 +440,36 @@ "@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, + "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.24.7", + "resolved": "https://registry.npmjs.org/@babel/plugin-syntax-import-attributes/-/plugin-syntax-import-attributes-7.24.7.tgz", + "integrity": "sha512-hbX+lKKeUMGihnK8nvKqmXBInriT3GVjzXKFriV3YC6APGxMbP8RZNFwy91+hocLXq90Mta+HshoB31802bb8A==", + "dev": true, + "dependencies": { + "@babel/helper-plugin-utils": "^7.24.7" + }, + "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", @@ -551,6 +581,21 @@ "@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, + "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", @@ -4352,9 +4397,9 @@ } }, "node_modules/aws-sdk": { - "version": "2.1672.0", - "resolved": "https://registry.npmjs.org/aws-sdk/-/aws-sdk-2.1672.0.tgz", - "integrity": "sha512-en4uaVWE/wPa9YsF2XAYtKP0hLQ10s93/nWe+SQ8Yox1xrDn1Tr32MMOtSLRXLxPRKcvmI7Yzw7jiQMgs1jqBQ==", + "version": "2.1676.0", + "resolved": "https://registry.npmjs.org/aws-sdk/-/aws-sdk-2.1676.0.tgz", + "integrity": "sha512-Kzg9931GroRG6uLoUEF5Pcp005D1xilgQ8ntH0fKFxiYKGkQqkU/3JkV6k7jNRzouxTypaozzXYVNXsHRgH6JA==", "dev": true, "hasInstallScript": true, "dependencies": { @@ -4383,9 +4428,9 @@ } }, "node_modules/axios": { - "version": "1.7.3", - "resolved": "https://registry.npmjs.org/axios/-/axios-1.7.3.tgz", - "integrity": "sha512-Ar7ND9pU99eJ9GpoGQKhKf58GpUOgnzuaB7ueNQ5BMi0p+LZ5oaEnfF999fAArcTIBwXTCHAmGcHOZJaWPq9Nw==", + "version": "1.7.4", + "resolved": "https://registry.npmjs.org/axios/-/axios-1.7.4.tgz", + "integrity": "sha512-DukmaFRnY6AzAALSH4J2M3k6PkaC+MfaAGdEERRWcC9q3/TWQwLpHR8ZRLKTdQ3aBDL64EdluRDjJqKw+BPZEw==", "dependencies": { "follow-redirects": "^1.15.6", "form-data": "^4.0.0", @@ -4470,23 +4515,26 @@ } }, "node_modules/babel-preset-current-node-syntax": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/babel-preset-current-node-syntax/-/babel-preset-current-node-syntax-1.0.1.tgz", - "integrity": "sha512-M7LQ0bxarkxQoN+vz5aJPsLBn77n8QgTFmo8WK0/44auK2xlCXrYcUxHFxgU7qW5Yzw/CjmLRK2uJzaCd7LvqQ==", + "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, "dependencies": { "@babel/plugin-syntax-async-generators": "^7.8.4", "@babel/plugin-syntax-bigint": "^7.8.3", - "@babel/plugin-syntax-class-properties": "^7.8.3", - "@babel/plugin-syntax-import-meta": "^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.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.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-top-level-await": "^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" @@ -6662,9 +6710,9 @@ } }, "node_modules/electron-to-chromium": { - "version": "1.5.6", - "resolved": "https://registry.npmjs.org/electron-to-chromium/-/electron-to-chromium-1.5.6.tgz", - "integrity": "sha512-jwXWsM5RPf6j9dPYzaorcBSUg6AiqocPEyMpkchkvntaH9HGfOOMZwxMJjDY/XEs3T5dM7uyH1VhRMkqUU9qVw==", + "version": "1.5.9", + "resolved": "https://registry.npmjs.org/electron-to-chromium/-/electron-to-chromium-1.5.9.tgz", + "integrity": "sha512-HfkT8ndXR0SEkU8gBQQM3rz035bpE/hxkZ1YIt4KJPEFES68HfIU6LzKukH0H794Lm83WJtkSAMfEToxCs15VA==", "dev": true }, "node_modules/elegant-spinner": { @@ -9721,9 +9769,9 @@ "integrity": "sha512-4vf7I2LYV/HaWerSo3XmlMkp5eZ83i+/CDluXi/IGTs/O1sejBNhTtnxzmRZfvOUqj7lZjqHkeTvpgSFDlWZTg==" }, "node_modules/ignore": { - "version": "5.3.1", - "resolved": "https://registry.npmjs.org/ignore/-/ignore-5.3.1.tgz", - "integrity": "sha512-5Fytz/IraMjqpwfd34ke28PTVMjZjJG2MPn5t7OE4eUCUNf8BAa7b5WUS9/Qvr6mwOQS7Mk6vdsMno5he+T8Xw==", + "version": "5.3.2", + "resolved": "https://registry.npmjs.org/ignore/-/ignore-5.3.2.tgz", + "integrity": "sha512-hsBTNUqQTDwkWtcdYI2i06Y/nUBEsNEDJKjWdigLvegy8kDuJAS8uRlpkkcQpyEXL0Z/pjDy5HBmMjRCJ2gq+g==", "engines": { "node": ">= 4" } @@ -22946,9 +22994,9 @@ } }, "node_modules/winston": { - "version": "3.14.1", - "resolved": "https://registry.npmjs.org/winston/-/winston-3.14.1.tgz", - "integrity": "sha512-CJi4Il/msz8HkdDfXOMu+r5Au/oyEjFiOZzbX2d23hRLY0narGjqfE5lFlrT5hfYJhPtM8b85/GNFsxIML/RVA==", + "version": "3.14.2", + "resolved": "https://registry.npmjs.org/winston/-/winston-3.14.2.tgz", + "integrity": "sha512-CO8cdpBB2yqzEf8v895L+GNKYJiEq8eKlHU38af3snQBQ+sdAIUepjMSguOIJC7ICbzm0ZI+Af2If4vIJrtmOg==", "dependencies": { "@colors/colors": "^1.6.0", "@dabh/diagnostics": "^2.0.2", @@ -26679,7 +26727,7 @@ "@contentstack/management": "~1.17.0", "@contentstack/marketplace-sdk": "^1.2.1", "@oclif/core": "^3.26.5", - "axios": "^1.6.4", + "axios": "^1.7.4", "chalk": "^4.0.0", "cli-cursor": "^3.1.0", "cli-table": "^0.3.11", diff --git a/packages/contentstack-utilities/package.json b/packages/contentstack-utilities/package.json index bc98a3f7a9..514b5558c9 100644 --- a/packages/contentstack-utilities/package.json +++ b/packages/contentstack-utilities/package.json @@ -35,7 +35,7 @@ "@contentstack/management": "~1.17.0", "@contentstack/marketplace-sdk": "^1.2.1", "@oclif/core": "^3.26.5", - "axios": "^1.6.4", + "axios": "^1.7.4", "chalk": "^4.0.0", "cli-cursor": "^3.1.0", "cli-table": "^0.3.11", diff --git a/packages/contentstack-variants/src/utils/personalization-api-adapter.ts b/packages/contentstack-variants/src/utils/personalization-api-adapter.ts index 4c672e226b..531b22d698 100644 --- a/packages/contentstack-variants/src/utils/personalization-api-adapter.ts +++ b/packages/contentstack-variants/src/utils/personalization-api-adapter.ts @@ -78,17 +78,21 @@ export class PersonalizationAdapter extends AdapterHelper impl } async getVariantGroup(input: GetVariantGroupInput): Promise { - const getVariantGroupEndPoint = `/variant_groups`; - const data = await this.cmaAPIClient - .queryParams({ experience_uid: input.experienceUid }) - .get(getVariantGroupEndPoint); - return this.handleVariantAPIRes(data) as VariantGroupStruct; + if (this.cmaAPIClient) { + const getVariantGroupEndPoint = `/variant_groups`; + const data = await this.cmaAPIClient + .queryParams({ experience_uid: input.experienceUid }) + .get(getVariantGroupEndPoint); + return this.handleVariantAPIRes(data) as VariantGroupStruct; + } } async updateVariantGroup(input: VariantGroup): Promise { - const updateVariantGroupEndPoint = `/variant_groups/${input.uid}`; - const data = await this.cmaAPIClient.put(updateVariantGroupEndPoint, input); - return this.handleVariantAPIRes(data) as VariantGroup; + if (this.cmaAPIClient) { + const updateVariantGroupEndPoint = `/variant_groups/${input.uid}`; + const data = await this.cmaAPIClient.put(updateVariantGroupEndPoint, input); + return this.handleVariantAPIRes(data) as VariantGroup; + } } async getEvents(): Promise { diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index 76952779b9..76ee584af1 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -1057,7 +1057,7 @@ importers: '@types/node': ^14.14.32 '@types/sinon': ^10.0.2 '@types/traverse': ^0.6.34 - axios: ^1.6.4 + axios: ^1.7.4 chai: ^4.3.4 chalk: ^4.0.0 cli-cursor: ^3.1.0 @@ -1098,7 +1098,7 @@ importers: '@contentstack/management': 1.17.0_debug@4.3.6 '@contentstack/marketplace-sdk': 1.2.2_debug@4.3.6 '@oclif/core': 3.27.0 - axios: 1.7.3_debug@4.3.6 + axios: 1.7.4_debug@4.3.6 chalk: 4.1.2 cli-cursor: 3.1.0 cli-table: 0.3.11 @@ -1611,7 +1611,7 @@ packages: /@contentstack/marketplace-sdk/1.2.2_debug@4.3.6: resolution: {integrity: sha512-qJ6VuNcr24zyNnLj8PfKooMRxmE3OqGMkXwfKZbJAhI2SXNn7qDNVdAwYixaOc7WzgJXHiMoH2lDv6yq1fvFtg==} dependencies: - axios: 1.7.3_debug@4.3.6 + axios: 1.7.4_debug@4.3.6 transitivePeerDependencies: - debug dev: false @@ -4726,6 +4726,16 @@ packages: - debug dev: false + /axios/1.7.4_debug@4.3.6: + resolution: {integrity: sha512-DukmaFRnY6AzAALSH4J2M3k6PkaC+MfaAGdEERRWcC9q3/TWQwLpHR8ZRLKTdQ3aBDL64EdluRDjJqKw+BPZEw==} + dependencies: + follow-redirects: 1.15.6_debug@4.3.6 + form-data: 4.0.0 + proxy-from-env: 1.1.0 + transitivePeerDependencies: + - debug + dev: false + /babel-jest/29.7.0_@babel+core@7.25.2: resolution: {integrity: sha512-BrvGY3xZSwEcCzKvKsCi2GgHqDqsYkOP4/by5xCgIwGXQxIEh+8ew3gmrE1y7XRR6LHZIj6yLYnUi/mm2KXKBg==} engines: {node: ^14.15.0 || ^16.10.0 || >=18.0.0}