From fe0fda63c32eadafcb12c56a5fbe348994f6d3c5 Mon Sep 17 00:00:00 2001 From: Nadeem Patwekar Date: Thu, 4 Sep 2025 16:39:58 +0530 Subject: [PATCH 1/4] refactor: update package dependencies and improve stack configuration - Changed dependencies in package.json to use local tarball files for @contentstack/core and @contentstack/utils. - Updated versions of various dependencies in package-lock.json, including @slack/oauth, @slack/socket-mode, browserslist, caniuse-lite, electron-to-chromium, path-to-regexp, rollup, and terser. - Modified contentstack.ts to enhance request handling by utilizing internal Axios request configuration. - Updated StackConfig interface in types.ts to change the type of region from Region enum to string for better flexibility. --- .talismanrc | 2 +- package-lock.json | 257 +++++++++++++++++++++------------------- package.json | 4 +- src/lib/contentstack.ts | 28 ++++- src/lib/types.ts | 2 +- 5 files changed, 163 insertions(+), 130 deletions(-) diff --git a/.talismanrc b/.talismanrc index 65ba163..8f7e141 100644 --- a/.talismanrc +++ b/.talismanrc @@ -1,6 +1,6 @@ fileignoreconfig: - filename: package-lock.json - checksum: dffbcb14c5761976a9b6ab90b96c7e4fc5784eebe381cf48014618cc93355dbc + checksum: 2f932522b599050c23c6a2490897301a3efd9258f0c8bef512d099960c76617f - filename: test/unit/query-optimization-comprehensive.spec.ts checksum: f5aaf6c784d7c101a05ca513c584bbd6e95f963d1e42779f2596050d9bcbac96 version: "" diff --git a/package-lock.json b/package-lock.json index b07ed71..49b1fa3 100644 --- a/package-lock.json +++ b/package-lock.json @@ -9,8 +9,8 @@ "version": "4.9.0", "license": "MIT", "dependencies": { - "@contentstack/core": "^1.3.0", - "@contentstack/utils": "^1.4.1", + "@contentstack/core": "file:../contentstack-js-core/contentstack-core-1.2.4.tgz", + "@contentstack/utils": "file:../../contentstack-utils-javascript/contentstack-utils-1.5.0.tgz", "axios": "^1.11.0", "humps": "^2.0.1" }, @@ -1903,9 +1903,9 @@ "license": "MIT" }, "node_modules/@contentstack/core": { - "version": "1.3.0", - "resolved": "https://registry.npmjs.org/@contentstack/core/-/core-1.3.0.tgz", - "integrity": "sha512-WT1+o9Vv42gKMIqy0sel6tD6OyIY681hawB4sstrioBfxpN3HaE2b/MxQpuSq259vbddoleG4525Dwpq9uAEcw==", + "version": "1.2.4", + "resolved": "file:../contentstack-js-core/contentstack-core-1.2.4.tgz", + "integrity": "sha512-9kgdyfSRNAE+ulq6bMNPUjlY7+mQ/hSnyRu3M9FDGr5hUWLMfwW2JvvMNWv9bpxSwDSUahgw9sYE5yRVZOXPsg==", "license": "MIT", "dependencies": { "axios": "^1.11.0", @@ -1930,9 +1930,9 @@ } }, "node_modules/@contentstack/utils": { - "version": "1.4.1", - "resolved": "https://registry.npmjs.org/@contentstack/utils/-/utils-1.4.1.tgz", - "integrity": "sha512-P/1Xk3kku1WUHPd+djjZq1NQrUP/OhmiMLRkdNzixMaS4U9LXEJP6iU02YoYnXXjlFuI2dz/OzthCoI5/DPWQQ==", + "version": "1.5.0", + "resolved": "file:../../contentstack-utils-javascript/contentstack-utils-1.5.0.tgz", + "integrity": "sha512-PM3e4Iru4YcWODZHewtiLg3IoPGaNtOwQUyqS54qjLw8y7s/5rzK4DEwaeHaPVWh2JvuyVbUbY+QL8lGthFX1A==", "license": "MIT" }, "node_modules/@cspotcode/source-map-support": { @@ -3660,9 +3660,9 @@ } }, "node_modules/@rollup/rollup-android-arm-eabi": { - "version": "4.48.1", - "resolved": "https://registry.npmjs.org/@rollup/rollup-android-arm-eabi/-/rollup-android-arm-eabi-4.48.1.tgz", - "integrity": "sha512-rGmb8qoG/zdmKoYELCBwu7vt+9HxZ7Koos3pD0+sH5fR3u3Wb/jGcpnqxcnWsPEKDUyzeLSqksN8LJtgXjqBYw==", + "version": "4.50.0", + "resolved": "https://registry.npmjs.org/@rollup/rollup-android-arm-eabi/-/rollup-android-arm-eabi-4.50.0.tgz", + "integrity": "sha512-lVgpeQyy4fWN5QYebtW4buT/4kn4p4IJ+kDNB4uYNT5b8c8DLJDg6titg20NIg7E8RWwdWZORW6vUFfrLyG3KQ==", "cpu": [ "arm" ], @@ -3674,9 +3674,9 @@ ] }, "node_modules/@rollup/rollup-android-arm64": { - "version": "4.48.1", - "resolved": "https://registry.npmjs.org/@rollup/rollup-android-arm64/-/rollup-android-arm64-4.48.1.tgz", - "integrity": "sha512-4e9WtTxrk3gu1DFE+imNJr4WsL13nWbD/Y6wQcyku5qadlKHY3OQ3LJ/INrrjngv2BJIHnIzbqMk1GTAC2P8yQ==", + "version": "4.50.0", + "resolved": "https://registry.npmjs.org/@rollup/rollup-android-arm64/-/rollup-android-arm64-4.50.0.tgz", + "integrity": "sha512-2O73dR4Dc9bp+wSYhviP6sDziurB5/HCym7xILKifWdE9UsOe2FtNcM+I4xZjKrfLJnq5UR8k9riB87gauiQtw==", "cpu": [ "arm64" ], @@ -3688,9 +3688,9 @@ ] }, "node_modules/@rollup/rollup-darwin-arm64": { - "version": "4.48.1", - "resolved": "https://registry.npmjs.org/@rollup/rollup-darwin-arm64/-/rollup-darwin-arm64-4.48.1.tgz", - "integrity": "sha512-+XjmyChHfc4TSs6WUQGmVf7Hkg8ferMAE2aNYYWjiLzAS/T62uOsdfnqv+GHRjq7rKRnYh4mwWb4Hz7h/alp8A==", + "version": "4.50.0", + "resolved": "https://registry.npmjs.org/@rollup/rollup-darwin-arm64/-/rollup-darwin-arm64-4.50.0.tgz", + "integrity": "sha512-vwSXQN8T4sKf1RHr1F0s98Pf8UPz7pS6P3LG9NSmuw0TVh7EmaE+5Ny7hJOZ0M2yuTctEsHHRTMi2wuHkdS6Hg==", "cpu": [ "arm64" ], @@ -3702,9 +3702,9 @@ ] }, "node_modules/@rollup/rollup-darwin-x64": { - "version": "4.48.1", - "resolved": "https://registry.npmjs.org/@rollup/rollup-darwin-x64/-/rollup-darwin-x64-4.48.1.tgz", - "integrity": "sha512-upGEY7Ftw8M6BAJyGwnwMw91rSqXTcOKZnnveKrVWsMTF8/k5mleKSuh7D4v4IV1pLxKAk3Tbs0Lo9qYmii5mQ==", + "version": "4.50.0", + "resolved": "https://registry.npmjs.org/@rollup/rollup-darwin-x64/-/rollup-darwin-x64-4.50.0.tgz", + "integrity": "sha512-cQp/WG8HE7BCGyFVuzUg0FNmupxC+EPZEwWu2FCGGw5WDT1o2/YlENbm5e9SMvfDFR6FRhVCBePLqj0o8MN7Vw==", "cpu": [ "x64" ], @@ -3716,9 +3716,9 @@ ] }, "node_modules/@rollup/rollup-freebsd-arm64": { - "version": "4.48.1", - "resolved": "https://registry.npmjs.org/@rollup/rollup-freebsd-arm64/-/rollup-freebsd-arm64-4.48.1.tgz", - "integrity": "sha512-P9ViWakdoynYFUOZhqq97vBrhuvRLAbN/p2tAVJvhLb8SvN7rbBnJQcBu8e/rQts42pXGLVhfsAP0k9KXWa3nQ==", + "version": "4.50.0", + "resolved": "https://registry.npmjs.org/@rollup/rollup-freebsd-arm64/-/rollup-freebsd-arm64-4.50.0.tgz", + "integrity": "sha512-UR1uTJFU/p801DvvBbtDD7z9mQL8J80xB0bR7DqW7UGQHRm/OaKzp4is7sQSdbt2pjjSS72eAtRh43hNduTnnQ==", "cpu": [ "arm64" ], @@ -3730,9 +3730,9 @@ ] }, "node_modules/@rollup/rollup-freebsd-x64": { - "version": "4.48.1", - "resolved": "https://registry.npmjs.org/@rollup/rollup-freebsd-x64/-/rollup-freebsd-x64-4.48.1.tgz", - "integrity": "sha512-VLKIwIpnBya5/saccM8JshpbxfyJt0Dsli0PjXozHwbSVaHTvWXJH1bbCwPXxnMzU4zVEfgD1HpW3VQHomi2AQ==", + "version": "4.50.0", + "resolved": "https://registry.npmjs.org/@rollup/rollup-freebsd-x64/-/rollup-freebsd-x64-4.50.0.tgz", + "integrity": "sha512-G/DKyS6PK0dD0+VEzH/6n/hWDNPDZSMBmqsElWnCRGrYOb2jC0VSupp7UAHHQ4+QILwkxSMaYIbQ72dktp8pKA==", "cpu": [ "x64" ], @@ -3744,9 +3744,9 @@ ] }, "node_modules/@rollup/rollup-linux-arm-gnueabihf": { - "version": "4.48.1", - "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-arm-gnueabihf/-/rollup-linux-arm-gnueabihf-4.48.1.tgz", - "integrity": "sha512-3zEuZsXfKaw8n/yF7t8N6NNdhyFw3s8xJTqjbTDXlipwrEHo4GtIKcMJr5Ed29leLpB9AugtAQpAHW0jvtKKaQ==", + "version": "4.50.0", + "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-arm-gnueabihf/-/rollup-linux-arm-gnueabihf-4.50.0.tgz", + "integrity": "sha512-u72Mzc6jyJwKjJbZZcIYmd9bumJu7KNmHYdue43vT1rXPm2rITwmPWF0mmPzLm9/vJWxIRbao/jrQmxTO0Sm9w==", "cpu": [ "arm" ], @@ -3758,9 +3758,9 @@ ] }, "node_modules/@rollup/rollup-linux-arm-musleabihf": { - "version": "4.48.1", - "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-arm-musleabihf/-/rollup-linux-arm-musleabihf-4.48.1.tgz", - "integrity": "sha512-leo9tOIlKrcBmmEypzunV/2w946JeLbTdDlwEZ7OnnsUyelZ72NMnT4B2vsikSgwQifjnJUbdXzuW4ToN1wV+Q==", + "version": "4.50.0", + "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-arm-musleabihf/-/rollup-linux-arm-musleabihf-4.50.0.tgz", + "integrity": "sha512-S4UefYdV0tnynDJV1mdkNawp0E5Qm2MtSs330IyHgaccOFrwqsvgigUD29uT+B/70PDY1eQ3t40+xf6wIvXJyg==", "cpu": [ "arm" ], @@ -3772,9 +3772,9 @@ ] }, "node_modules/@rollup/rollup-linux-arm64-gnu": { - "version": "4.48.1", - "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-arm64-gnu/-/rollup-linux-arm64-gnu-4.48.1.tgz", - "integrity": "sha512-Vy/WS4z4jEyvnJm+CnPfExIv5sSKqZrUr98h03hpAMbE2aI0aD2wvK6GiSe8Gx2wGp3eD81cYDpLLBqNb2ydwQ==", + "version": "4.50.0", + "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-arm64-gnu/-/rollup-linux-arm64-gnu-4.50.0.tgz", + "integrity": "sha512-1EhkSvUQXJsIhk4msxP5nNAUWoB4MFDHhtc4gAYvnqoHlaL9V3F37pNHabndawsfy/Tp7BPiy/aSa6XBYbaD1g==", "cpu": [ "arm64" ], @@ -3786,9 +3786,9 @@ ] }, "node_modules/@rollup/rollup-linux-arm64-musl": { - "version": "4.48.1", - "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-arm64-musl/-/rollup-linux-arm64-musl-4.48.1.tgz", - "integrity": "sha512-x5Kzn7XTwIssU9UYqWDB9VpLpfHYuXw5c6bJr4Mzv9kIv242vmJHbI5PJJEnmBYitUIfoMCODDhR7KoZLot2VQ==", + "version": "4.50.0", + "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-arm64-musl/-/rollup-linux-arm64-musl-4.50.0.tgz", + "integrity": "sha512-EtBDIZuDtVg75xIPIK1l5vCXNNCIRM0OBPUG+tbApDuJAy9mKago6QxX+tfMzbCI6tXEhMuZuN1+CU8iDW+0UQ==", "cpu": [ "arm64" ], @@ -3800,9 +3800,9 @@ ] }, "node_modules/@rollup/rollup-linux-loongarch64-gnu": { - "version": "4.48.1", - "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-loongarch64-gnu/-/rollup-linux-loongarch64-gnu-4.48.1.tgz", - "integrity": "sha512-yzCaBbwkkWt/EcgJOKDUdUpMHjhiZT/eDktOPWvSRpqrVE04p0Nd6EGV4/g7MARXXeOqstflqsKuXVM3H9wOIQ==", + "version": "4.50.0", + "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-loongarch64-gnu/-/rollup-linux-loongarch64-gnu-4.50.0.tgz", + "integrity": "sha512-BGYSwJdMP0hT5CCmljuSNx7+k+0upweM2M4YGfFBjnFSZMHOLYR0gEEj/dxyYJ6Zc6AiSeaBY8dWOa11GF/ppQ==", "cpu": [ "loong64" ], @@ -3814,9 +3814,9 @@ ] }, "node_modules/@rollup/rollup-linux-ppc64-gnu": { - "version": "4.48.1", - "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-ppc64-gnu/-/rollup-linux-ppc64-gnu-4.48.1.tgz", - "integrity": "sha512-UK0WzWUjMAJccHIeOpPhPcKBqax7QFg47hwZTp6kiMhQHeOYJeaMwzeRZe1q5IiTKsaLnHu9s6toSYVUlZ2QtQ==", + "version": "4.50.0", + "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-ppc64-gnu/-/rollup-linux-ppc64-gnu-4.50.0.tgz", + "integrity": "sha512-I1gSMzkVe1KzAxKAroCJL30hA4DqSi+wGc5gviD0y3IL/VkvcnAqwBf4RHXHyvH66YVHxpKO8ojrgc4SrWAnLg==", "cpu": [ "ppc64" ], @@ -3828,9 +3828,9 @@ ] }, "node_modules/@rollup/rollup-linux-riscv64-gnu": { - "version": "4.48.1", - "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-riscv64-gnu/-/rollup-linux-riscv64-gnu-4.48.1.tgz", - "integrity": "sha512-3NADEIlt+aCdCbWVZ7D3tBjBX1lHpXxcvrLt/kdXTiBrOds8APTdtk2yRL2GgmnSVeX4YS1JIf0imFujg78vpw==", + "version": "4.50.0", + "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-riscv64-gnu/-/rollup-linux-riscv64-gnu-4.50.0.tgz", + "integrity": "sha512-bSbWlY3jZo7molh4tc5dKfeSxkqnf48UsLqYbUhnkdnfgZjgufLS/NTA8PcP/dnvct5CCdNkABJ56CbclMRYCA==", "cpu": [ "riscv64" ], @@ -3842,9 +3842,9 @@ ] }, "node_modules/@rollup/rollup-linux-riscv64-musl": { - "version": "4.48.1", - "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-riscv64-musl/-/rollup-linux-riscv64-musl-4.48.1.tgz", - "integrity": "sha512-euuwm/QTXAMOcyiFCcrx0/S2jGvFlKJ2Iro8rsmYL53dlblp3LkUQVFzEidHhvIPPvcIsxDhl2wkBE+I6YVGzA==", + "version": "4.50.0", + "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-riscv64-musl/-/rollup-linux-riscv64-musl-4.50.0.tgz", + "integrity": "sha512-LSXSGumSURzEQLT2e4sFqFOv3LWZsEF8FK7AAv9zHZNDdMnUPYH3t8ZlaeYYZyTXnsob3htwTKeWtBIkPV27iQ==", "cpu": [ "riscv64" ], @@ -3856,9 +3856,9 @@ ] }, "node_modules/@rollup/rollup-linux-s390x-gnu": { - "version": "4.48.1", - "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-s390x-gnu/-/rollup-linux-s390x-gnu-4.48.1.tgz", - "integrity": "sha512-w8mULUjmPdWLJgmTYJx/W6Qhln1a+yqvgwmGXcQl2vFBkWsKGUBRbtLRuKJUln8Uaimf07zgJNxOhHOvjSQmBQ==", + "version": "4.50.0", + "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-s390x-gnu/-/rollup-linux-s390x-gnu-4.50.0.tgz", + "integrity": "sha512-CxRKyakfDrsLXiCyucVfVWVoaPA4oFSpPpDwlMcDFQvrv3XY6KEzMtMZrA+e/goC8xxp2WSOxHQubP8fPmmjOQ==", "cpu": [ "s390x" ], @@ -3870,9 +3870,9 @@ ] }, "node_modules/@rollup/rollup-linux-x64-gnu": { - "version": "4.48.1", - "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-x64-gnu/-/rollup-linux-x64-gnu-4.48.1.tgz", - "integrity": "sha512-90taWXCWxTbClWuMZD0DKYohY1EovA+W5iytpE89oUPmT5O1HFdf8cuuVIylE6vCbrGdIGv85lVRzTcpTRZ+kA==", + "version": "4.50.0", + "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-x64-gnu/-/rollup-linux-x64-gnu-4.50.0.tgz", + "integrity": "sha512-8PrJJA7/VU8ToHVEPu14FzuSAqVKyo5gg/J8xUerMbyNkWkO9j2ExBho/68RnJsMGNJq4zH114iAttgm7BZVkA==", "cpu": [ "x64" ], @@ -3884,9 +3884,9 @@ ] }, "node_modules/@rollup/rollup-linux-x64-musl": { - "version": "4.48.1", - "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-x64-musl/-/rollup-linux-x64-musl-4.48.1.tgz", - "integrity": "sha512-2Gu29SkFh1FfTRuN1GR1afMuND2GKzlORQUP3mNMJbqdndOg7gNsa81JnORctazHRokiDzQ5+MLE5XYmZW5VWg==", + "version": "4.50.0", + "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-x64-musl/-/rollup-linux-x64-musl-4.50.0.tgz", + "integrity": "sha512-SkE6YQp+CzpyOrbw7Oc4MgXFvTw2UIBElvAvLCo230pyxOLmYwRPwZ/L5lBe/VW/qT1ZgND9wJfOsdy0XptRvw==", "cpu": [ "x64" ], @@ -3897,10 +3897,24 @@ "linux" ] }, + "node_modules/@rollup/rollup-openharmony-arm64": { + "version": "4.50.0", + "resolved": "https://registry.npmjs.org/@rollup/rollup-openharmony-arm64/-/rollup-openharmony-arm64-4.50.0.tgz", + "integrity": "sha512-PZkNLPfvXeIOgJWA804zjSFH7fARBBCpCXxgkGDRjjAhRLOR8o0IGS01ykh5GYfod4c2yiiREuDM8iZ+pVsT+Q==", + "cpu": [ + "arm64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "openharmony" + ] + }, "node_modules/@rollup/rollup-win32-arm64-msvc": { - "version": "4.48.1", - "resolved": "https://registry.npmjs.org/@rollup/rollup-win32-arm64-msvc/-/rollup-win32-arm64-msvc-4.48.1.tgz", - "integrity": "sha512-6kQFR1WuAO50bxkIlAVeIYsz3RUx+xymwhTo9j94dJ+kmHe9ly7muH23sdfWduD0BA8pD9/yhonUvAjxGh34jQ==", + "version": "4.50.0", + "resolved": "https://registry.npmjs.org/@rollup/rollup-win32-arm64-msvc/-/rollup-win32-arm64-msvc-4.50.0.tgz", + "integrity": "sha512-q7cIIdFvWQoaCbLDUyUc8YfR3Jh2xx3unO8Dn6/TTogKjfwrax9SyfmGGK6cQhKtjePI7jRfd7iRYcxYs93esg==", "cpu": [ "arm64" ], @@ -3912,9 +3926,9 @@ ] }, "node_modules/@rollup/rollup-win32-ia32-msvc": { - "version": "4.48.1", - "resolved": "https://registry.npmjs.org/@rollup/rollup-win32-ia32-msvc/-/rollup-win32-ia32-msvc-4.48.1.tgz", - "integrity": "sha512-RUyZZ/mga88lMI3RlXFs4WQ7n3VyU07sPXmMG7/C1NOi8qisUg57Y7LRarqoGoAiopmGmChUhSwfpvQ3H5iGSQ==", + "version": "4.50.0", + "resolved": "https://registry.npmjs.org/@rollup/rollup-win32-ia32-msvc/-/rollup-win32-ia32-msvc-4.50.0.tgz", + "integrity": "sha512-XzNOVg/YnDOmFdDKcxxK410PrcbcqZkBmz+0FicpW5jtjKQxcW1BZJEQOF0NJa6JO7CZhett8GEtRN/wYLYJuw==", "cpu": [ "ia32" ], @@ -3926,9 +3940,9 @@ ] }, "node_modules/@rollup/rollup-win32-x64-msvc": { - "version": "4.48.1", - "resolved": "https://registry.npmjs.org/@rollup/rollup-win32-x64-msvc/-/rollup-win32-x64-msvc-4.48.1.tgz", - "integrity": "sha512-8a/caCUN4vkTChxkaIJcMtwIVcBhi4X2PQRoT+yCK3qRYaZ7cURrmJFL5Ux9H9RaMIXj9RuihckdmkBX3zZsgg==", + "version": "4.50.0", + "resolved": "https://registry.npmjs.org/@rollup/rollup-win32-x64-msvc/-/rollup-win32-x64-msvc-4.50.0.tgz", + "integrity": "sha512-xMmiWRR8sp72Zqwjgtf3QbZfF1wdh8X2ABu3EaozvZcyHJeU0r+XAnXdKgs4cCAp6ORoYoCygipYP1mjmbjrsg==", "cpu": [ "x64" ], @@ -4007,18 +4021,17 @@ } }, "node_modules/@slack/oauth": { - "version": "3.0.3", - "resolved": "https://registry.npmjs.org/@slack/oauth/-/oauth-3.0.3.tgz", - "integrity": "sha512-N3pLJPacZ57bqmD1HzHDmHe/CNsL9pESZXRw7pfv6QXJVRgufPIW84aRpAez2Xb0616RpGBYZW5dZH0Nbskwyg==", + "version": "3.0.4", + "resolved": "https://registry.npmjs.org/@slack/oauth/-/oauth-3.0.4.tgz", + "integrity": "sha512-+8H0g7mbrHndEUbYCP7uYyBCbwqmm3E6Mo3nfsDvZZW74zKk1ochfH/fWSvGInYNCVvaBUbg3RZBbTp0j8yJCg==", "dev": true, "license": "MIT", "dependencies": { "@slack/logger": "^4", - "@slack/web-api": "^7.9.1", + "@slack/web-api": "^7.10.0", "@types/jsonwebtoken": "^9", "@types/node": ">=18", - "jsonwebtoken": "^9", - "lodash.isstring": "^4" + "jsonwebtoken": "^9" }, "engines": { "node": ">=18", @@ -4026,14 +4039,14 @@ } }, "node_modules/@slack/socket-mode": { - "version": "2.0.4", - "resolved": "https://registry.npmjs.org/@slack/socket-mode/-/socket-mode-2.0.4.tgz", - "integrity": "sha512-PB2fO4TSv47TXJ6WlKY7BeVNdcHcpPOxZsztGyG7isWXp69MVj+xAzQ3KSZ8aVTgV59f8xFJPXSHipn1x2Z5IQ==", + "version": "2.0.5", + "resolved": "https://registry.npmjs.org/@slack/socket-mode/-/socket-mode-2.0.5.tgz", + "integrity": "sha512-VaapvmrAifeFLAFaDPfGhEwwunTKsI6bQhYzxRXw7BSujZUae5sANO76WqlVsLXuhVtCVrBWPiS2snAQR2RHJQ==", "dev": true, "license": "MIT", "dependencies": { "@slack/logger": "^4", - "@slack/web-api": "^7.9.1", + "@slack/web-api": "^7.10.0", "@types/node": ">=18", "@types/ws": "^8", "eventemitter3": "^5", @@ -5304,9 +5317,9 @@ } }, "node_modules/browserslist": { - "version": "4.25.3", - "resolved": "https://registry.npmjs.org/browserslist/-/browserslist-4.25.3.tgz", - "integrity": "sha512-cDGv1kkDI4/0e5yON9yM5G/0A5u8sf5TnmdX5C9qHzI9PPu++sQ9zjm1k9NiOrf3riY4OkK0zSGqfvJyJsgCBQ==", + "version": "4.25.4", + "resolved": "https://registry.npmjs.org/browserslist/-/browserslist-4.25.4.tgz", + "integrity": "sha512-4jYpcjabC606xJ3kw2QwGEZKX0Aw7sgQdZCvIK9dhVSPh76BKo+C+btT1RRofH7B+8iNpEbgGNVWiLki5q93yg==", "dev": true, "funding": [ { @@ -5324,8 +5337,8 @@ ], "license": "MIT", "dependencies": { - "caniuse-lite": "^1.0.30001735", - "electron-to-chromium": "^1.5.204", + "caniuse-lite": "^1.0.30001737", + "electron-to-chromium": "^1.5.211", "node-releases": "^2.0.19", "update-browserslist-db": "^1.1.3" }, @@ -5484,9 +5497,9 @@ } }, "node_modules/caniuse-lite": { - "version": "1.0.30001737", - "resolved": "https://registry.npmjs.org/caniuse-lite/-/caniuse-lite-1.0.30001737.tgz", - "integrity": "sha512-BiloLiXtQNrY5UyF0+1nSJLXUENuhka2pzy2Fx5pGxqavdrxSCW4U6Pn/PoG3Efspi2frRbHpBV2XsrPE6EDlw==", + "version": "1.0.30001739", + "resolved": "https://registry.npmjs.org/caniuse-lite/-/caniuse-lite-1.0.30001739.tgz", + "integrity": "sha512-y+j60d6ulelrNSwpPyrHdl+9mJnQzHBr08xm48Qno0nSk4h3Qojh+ziv2qE6rXf4k3tadF4o1J/1tAbVm1NtnA==", "dev": true, "funding": [ { @@ -6153,9 +6166,9 @@ } }, "node_modules/electron-to-chromium": { - "version": "1.5.208", - "resolved": "https://registry.npmjs.org/electron-to-chromium/-/electron-to-chromium-1.5.208.tgz", - "integrity": "sha512-ozZyibehoe7tOhNaf16lKmljVf+3npZcJIEbJRVftVsmAg5TeA1mGS9dVCZzOwr2xT7xK15V0p7+GZqSPgkuPg==", + "version": "1.5.213", + "resolved": "https://registry.npmjs.org/electron-to-chromium/-/electron-to-chromium-1.5.213.tgz", + "integrity": "sha512-xr9eRzSLNa4neDO0xVFrkXu3vyIzG4Ay08dApecw42Z1NbmCt+keEpXdvlYGVe0wtvY5dhW0Ay0lY0IOfsCg0Q==", "dev": true, "license": "ISC" }, @@ -9796,13 +9809,14 @@ "license": "ISC" }, "node_modules/path-to-regexp": { - "version": "8.2.0", - "resolved": "https://registry.npmjs.org/path-to-regexp/-/path-to-regexp-8.2.0.tgz", - "integrity": "sha512-TdrF7fW9Rphjq4RjrW0Kp2AW0Ahwu9sRGTkS6bvDi0SCwZlEZYmcfDbEsTz8RVk0EHIS/Vd1bv3JhG+1xZuAyQ==", + "version": "8.3.0", + "resolved": "https://registry.npmjs.org/path-to-regexp/-/path-to-regexp-8.3.0.tgz", + "integrity": "sha512-7jdwVIRtsP8MYpdXSwOS0YdD0Du+qOoF/AEPIt88PcCFrZCzx41oxku1jD88hZBwbNUIEfpqvuhjFaMAqMTWnA==", "dev": true, "license": "MIT", - "engines": { - "node": ">=16" + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/express" } }, "node_modules/path-type": { @@ -10307,9 +10321,9 @@ } }, "node_modules/rollup": { - "version": "4.48.1", - "resolved": "https://registry.npmjs.org/rollup/-/rollup-4.48.1.tgz", - "integrity": "sha512-jVG20NvbhTYDkGAty2/Yh7HK6/q3DGSRH4o8ALKGArmMuaauM9kLfoMZ+WliPwA5+JHr2lTn3g557FxBV87ifg==", + "version": "4.50.0", + "resolved": "https://registry.npmjs.org/rollup/-/rollup-4.50.0.tgz", + "integrity": "sha512-/Zl4D8zPifNmyGzJS+3kVoyXeDeT/GrsJM94sACNg9RtUE0hrHa1bNPtRSrfHTMH5HjRzce6K7rlTh3Khiw+pw==", "dev": true, "license": "MIT", "dependencies": { @@ -10323,26 +10337,27 @@ "npm": ">=8.0.0" }, "optionalDependencies": { - "@rollup/rollup-android-arm-eabi": "4.48.1", - "@rollup/rollup-android-arm64": "4.48.1", - "@rollup/rollup-darwin-arm64": "4.48.1", - "@rollup/rollup-darwin-x64": "4.48.1", - "@rollup/rollup-freebsd-arm64": "4.48.1", - "@rollup/rollup-freebsd-x64": "4.48.1", - "@rollup/rollup-linux-arm-gnueabihf": "4.48.1", - "@rollup/rollup-linux-arm-musleabihf": "4.48.1", - "@rollup/rollup-linux-arm64-gnu": "4.48.1", - "@rollup/rollup-linux-arm64-musl": "4.48.1", - "@rollup/rollup-linux-loongarch64-gnu": "4.48.1", - "@rollup/rollup-linux-ppc64-gnu": "4.48.1", - "@rollup/rollup-linux-riscv64-gnu": "4.48.1", - "@rollup/rollup-linux-riscv64-musl": "4.48.1", - "@rollup/rollup-linux-s390x-gnu": "4.48.1", - "@rollup/rollup-linux-x64-gnu": "4.48.1", - "@rollup/rollup-linux-x64-musl": "4.48.1", - "@rollup/rollup-win32-arm64-msvc": "4.48.1", - "@rollup/rollup-win32-ia32-msvc": "4.48.1", - "@rollup/rollup-win32-x64-msvc": "4.48.1", + "@rollup/rollup-android-arm-eabi": "4.50.0", + "@rollup/rollup-android-arm64": "4.50.0", + "@rollup/rollup-darwin-arm64": "4.50.0", + "@rollup/rollup-darwin-x64": "4.50.0", + "@rollup/rollup-freebsd-arm64": "4.50.0", + "@rollup/rollup-freebsd-x64": "4.50.0", + "@rollup/rollup-linux-arm-gnueabihf": "4.50.0", + "@rollup/rollup-linux-arm-musleabihf": "4.50.0", + "@rollup/rollup-linux-arm64-gnu": "4.50.0", + "@rollup/rollup-linux-arm64-musl": "4.50.0", + "@rollup/rollup-linux-loongarch64-gnu": "4.50.0", + "@rollup/rollup-linux-ppc64-gnu": "4.50.0", + "@rollup/rollup-linux-riscv64-gnu": "4.50.0", + "@rollup/rollup-linux-riscv64-musl": "4.50.0", + "@rollup/rollup-linux-s390x-gnu": "4.50.0", + "@rollup/rollup-linux-x64-gnu": "4.50.0", + "@rollup/rollup-linux-x64-musl": "4.50.0", + "@rollup/rollup-openharmony-arm64": "4.50.0", + "@rollup/rollup-win32-arm64-msvc": "4.50.0", + "@rollup/rollup-win32-ia32-msvc": "4.50.0", + "@rollup/rollup-win32-x64-msvc": "4.50.0", "fsevents": "~2.3.2" } }, @@ -10974,15 +10989,15 @@ } }, "node_modules/terser": { - "version": "5.43.1", - "resolved": "https://registry.npmjs.org/terser/-/terser-5.43.1.tgz", - "integrity": "sha512-+6erLbBm0+LROX2sPXlUYx/ux5PyE9K/a92Wrt6oA+WDAoFTdpHE5tCYCI5PNzq2y8df4rA+QgHLJuR4jNymsg==", + "version": "5.44.0", + "resolved": "https://registry.npmjs.org/terser/-/terser-5.44.0.tgz", + "integrity": "sha512-nIVck8DK+GM/0Frwd+nIhZ84pR/BX7rmXMfYwyg+Sri5oGVE99/E3KvXqpC2xHFxyqXyGHTKBSioxxplrO4I4w==", "dev": true, "license": "BSD-2-Clause", "peer": true, "dependencies": { "@jridgewell/source-map": "^0.3.3", - "acorn": "^8.14.0", + "acorn": "^8.15.0", "commander": "^2.20.0", "source-map-support": "~0.5.20" }, diff --git a/package.json b/package.json index 7672c84..060c30f 100644 --- a/package.json +++ b/package.json @@ -35,8 +35,8 @@ "husky-check": "npm run build && husky && chmod +x .husky/pre-commit" }, "dependencies": { - "@contentstack/core": "^1.3.0", - "@contentstack/utils": "^1.4.1", + "@contentstack/core": "file:../contentstack-js-core/contentstack-core-1.2.4.tgz", + "@contentstack/utils": "file:../../contentstack-utils-javascript/contentstack-utils-1.5.0.tgz", "axios": "^1.11.0", "humps": "^2.0.1" }, diff --git a/src/lib/contentstack.ts b/src/lib/contentstack.ts index c6d62f4..7f6ab03 100644 --- a/src/lib/contentstack.ts +++ b/src/lib/contentstack.ts @@ -1,10 +1,11 @@ import { httpClient, retryRequestHandler, retryResponseErrorHandler, retryResponseHandler } from '@contentstack/core'; -import { AxiosRequestHeaders } from 'axios'; +import { AxiosRequestHeaders, InternalAxiosRequestConfig } from 'axios'; import { handleRequest } from './cache'; import { Stack as StackClass } from './stack'; import { Policy, StackConfig } from './types'; import * as Utility from './utils'; -export * as Utils from '@contentstack/utils'; +import * as Utils from '@contentstack/utils'; +export { Utils }; let version = '{{VERSION}}'; @@ -34,7 +35,6 @@ let version = '{{VERSION}}'; // eslint-disable-next-line @typescript-eslint/naming-convention export function stack(config: StackConfig): StackClass { let defaultConfig = { - defaultHostname: 'cdn.contentstack.io', headers: {} as AxiosRequestHeaders, params: {} as any, live_preview: {} as any, @@ -42,8 +42,8 @@ export function stack(config: StackConfig): StackClass { ...config }; - defaultConfig.defaultHostname = config.host || Utility.getHost(config.region, config.host); - config.host = defaultConfig.defaultHostname; + // defaultConfig.defaultHostname = config.host || Utility.getHost(config.region, config.host); + // config.host = defaultConfig.defaultHostname; if (config.apiKey) { defaultConfig.headers.api_key = config.apiKey; @@ -111,6 +111,24 @@ export function stack(config: StackConfig): StackClass { client.interceptors.request.use(retryRequestHandler); client.interceptors.response.use(retryResponseHandler, errorHandler); + client.interceptors.request.use( + async (reqConfig: InternalAxiosRequestConfig): Promise => { + if (config.region) { + const hostt = await Utils.getContentstackEndpoint(config.region, 'CDA', true); + config.defaultHostname = hostt as string; + const protocol = config.insecure ? 'http' : 'https'; + const hostname = config.defaultHostname; + const port = config.port || 443; + const version = config.version || 'v3'; + + reqConfig.baseURL = config.endpoint || `${protocol}://${hostname}:${port}/${version}`; + } else { + reqConfig.baseURL = 'https://cdn.contentstack.io:443/v3'; + } + + return reqConfig; + }); + if (config.plugins) { client.interceptors.request.use((reqConfig: any): any => { if (config && config.plugins) diff --git a/src/lib/types.ts b/src/lib/types.ts index f9c0fd5..ab9a5eb 100644 --- a/src/lib/types.ts +++ b/src/lib/types.ts @@ -28,7 +28,7 @@ export interface StackConfig extends HttpClientParams { environment: string; branch?: string; early_access?: string[]; - region?: Region; + region?: string; locale?: string; plugins?: any[]; logHandler?: (level: string, data: any) => void; From a48ed7388e3d760a450a38d18822621073db3a79 Mon Sep 17 00:00:00 2001 From: Nadeem Patwekar Date: Tue, 28 Oct 2025 18:30:29 +0530 Subject: [PATCH 2/4] feat: Update package dependencies and add postinstall/postupdate scripts - Updated @contentstack/core to version ^1.3.1 and @contentstack/utils to version ^1.5.0 in package.json. - Added postinstall and postupdate scripts to download regions.json from the Contentstack artifacts. refactor: Enhance stack configuration with dynamic host resolution - Introduced getHostforRegion function to resolve host based on cloud region. - Updated stack function to utilize the new host resolution logic. - Removed legacy host resolution code from stack function. test: Add comprehensive tests for getHostforRegion and stack methods - Implemented unit tests for getHostforRegion function covering various regions and edge cases. - Added integration tests for stack class to ensure correct baseURL setting based on region. - Enhanced existing tests for stack and utils to validate new functionality. chore: Enable JSON module resolution in TypeScript configuration - Updated tsconfig.json to include resolveJsonModule for importing JSON files. --- .gitignore | 1 + .npmignore | 3 +- .talismanrc | 6 +- package-lock.json | 168 ++++++---------------------- package.json | 8 +- src/lib/contentstack.ts | 24 +--- src/lib/stack.ts | 17 +++ src/lib/utils.ts | 22 +++- test/unit/contentstack.spec.ts | 146 ++++++++++++++++++++++++- test/unit/stack.spec.ts | 67 ++++++++++++ test/unit/utils.spec.ts | 193 ++++++++++++++++++++++++++++----- tsconfig.json | 1 + 12 files changed, 464 insertions(+), 192 deletions(-) diff --git a/.gitignore b/.gitignore index 0041e52..4887fe2 100644 --- a/.gitignore +++ b/.gitignore @@ -15,3 +15,4 @@ coverage dist/* *.log .nx/ +regions.json \ No newline at end of file diff --git a/.npmignore b/.npmignore index 47e14fe..fce3424 100644 --- a/.npmignore +++ b/.npmignore @@ -19,4 +19,5 @@ src *.tgz .talismanrc tap-html.html -.github \ No newline at end of file +.github +regions.json \ No newline at end of file diff --git a/.talismanrc b/.talismanrc index 8f7e141..41b14d3 100644 --- a/.talismanrc +++ b/.talismanrc @@ -1,6 +1,10 @@ fileignoreconfig: - filename: package-lock.json - checksum: 2f932522b599050c23c6a2490897301a3efd9258f0c8bef512d099960c76617f + checksum: 2d01a92de8d55b56ba719b8c1a497ecda99b084d9a0f35687a363d99265a1d7c +- filename: test/unit/contentstack.spec.ts + checksum: d5b99c01459ab8bc597baaa9e6cc4aa91ac6d9bf78af08e1d0220d0c5db3d0b3 +- filename: test/unit/utils.spec.ts + checksum: 79ce5bd78376db37a34df82c0fea19031e995b66a5a246e73f8262fa05d65a9c - filename: test/unit/query-optimization-comprehensive.spec.ts checksum: f5aaf6c784d7c101a05ca513c584bbd6e95f963d1e42779f2596050d9bcbac96 version: "" diff --git a/package-lock.json b/package-lock.json index 49b1fa3..ae1c7a7 100644 --- a/package-lock.json +++ b/package-lock.json @@ -7,10 +7,11 @@ "": { "name": "@contentstack/delivery-sdk", "version": "4.9.0", + "hasInstallScript": true, "license": "MIT", "dependencies": { - "@contentstack/core": "file:../contentstack-js-core/contentstack-core-1.2.4.tgz", - "@contentstack/utils": "file:../../contentstack-utils-javascript/contentstack-utils-1.5.0.tgz", + "@contentstack/core": "^1.3.1", + "@contentstack/utils": "^1.5.0", "axios": "^1.11.0", "humps": "^2.0.1" }, @@ -84,6 +85,7 @@ "integrity": "sha512-yDBHV9kQNcr2/sUr9jghVyz9C3Y5G2zUM2H2lo+9mKv4sFgbA8s8Z9t8D1jiTkGoO/NoIfKMyKWr4s6CN23ZwQ==", "dev": true, "license": "MIT", + "peer": true, "dependencies": { "@ampproject/remapping": "^2.2.0", "@babel/code-frame": "^7.27.1", @@ -1903,9 +1905,9 @@ "license": "MIT" }, "node_modules/@contentstack/core": { - "version": "1.2.4", - "resolved": "file:../contentstack-js-core/contentstack-core-1.2.4.tgz", - "integrity": "sha512-9kgdyfSRNAE+ulq6bMNPUjlY7+mQ/hSnyRu3M9FDGr5hUWLMfwW2JvvMNWv9bpxSwDSUahgw9sYE5yRVZOXPsg==", + "version": "1.3.1", + "resolved": "https://registry.npmjs.org/@contentstack/core/-/core-1.3.1.tgz", + "integrity": "sha512-RuaqNMZreN/ihnFJtGvtxK5NYuQuar1qBwWf0wqMsESHZCp+7Ohk1iSwq5E+7JN8Rzz40eiBiXklllzhoC0+5g==", "license": "MIT", "dependencies": { "axios": "^1.11.0", @@ -1931,8 +1933,8 @@ }, "node_modules/@contentstack/utils": { "version": "1.5.0", - "resolved": "file:../../contentstack-utils-javascript/contentstack-utils-1.5.0.tgz", - "integrity": "sha512-PM3e4Iru4YcWODZHewtiLg3IoPGaNtOwQUyqS54qjLw8y7s/5rzK4DEwaeHaPVWh2JvuyVbUbY+QL8lGthFX1A==", + "resolved": "https://registry.npmjs.org/@contentstack/utils/-/utils-1.5.0.tgz", + "integrity": "sha512-tL1pcC4hJ+zcrvHq9c/ShTLjCVg8ACWahLDZvqT5VAalTsnR5Ik7QltjEcRsfpz/ucLQ1GVyRQRpezELCIon4A==", "license": "MIT" }, "node_modules/@cspotcode/source-map-support": { @@ -2860,7 +2862,6 @@ "integrity": "sha512-ZMp1V8ZFcPG5dIWnQLr3NSI1MiCU7UETdS/A0G8V/XWHvJv3ZsFqutJn1Y5RPmAPX6F3BiE397OqveU/9NCuIA==", "dev": true, "license": "MIT", - "peer": true, "dependencies": { "@jridgewell/gen-mapping": "^0.3.5", "@jridgewell/trace-mapping": "^0.3.25" @@ -2958,7 +2959,6 @@ "integrity": "sha512-gB7Vxa6FReZZEGva03Eh+84W8BSZOjsNyXboglOINu6d8iZZ0eotSXGziKgjpkj3feZ1ofKZMs0PRObVAOROVw==", "dev": true, "license": "MIT", - "peer": true, "dependencies": { "nx": "18.3.5", "tslib": "^2.3.0" @@ -3150,7 +3150,6 @@ "os": [ "darwin" ], - "peer": true, "engines": { "node": ">= 10" } @@ -3168,7 +3167,6 @@ "os": [ "darwin" ], - "peer": true, "engines": { "node": ">= 10" } @@ -3186,7 +3184,6 @@ "os": [ "freebsd" ], - "peer": true, "engines": { "node": ">= 10" } @@ -3204,7 +3201,6 @@ "os": [ "linux" ], - "peer": true, "engines": { "node": ">= 10" } @@ -3222,7 +3218,6 @@ "os": [ "linux" ], - "peer": true, "engines": { "node": ">= 10" } @@ -3240,7 +3235,6 @@ "os": [ "linux" ], - "peer": true, "engines": { "node": ">= 10" } @@ -3258,7 +3252,6 @@ "os": [ "linux" ], - "peer": true, "engines": { "node": ">= 10" } @@ -3276,7 +3269,6 @@ "os": [ "linux" ], - "peer": true, "engines": { "node": ">= 10" } @@ -3294,7 +3286,6 @@ "os": [ "win32" ], - "peer": true, "engines": { "node": ">= 10" } @@ -3312,7 +3303,6 @@ "os": [ "win32" ], - "peer": true, "engines": { "node": ">= 10" } @@ -4182,7 +4172,6 @@ "integrity": "sha512-HLFeCYgz89uk22N5Qg3dvGvsv46B8GLvKKo1zKG4NybA8U2DiEO3w9lqGg29t/tfLRJpJ6iQxnVw4OnB7MoM9g==", "dev": true, "license": "MIT", - "peer": true, "dependencies": { "@types/connect": "*", "@types/node": "*" @@ -4194,7 +4183,6 @@ "integrity": "sha512-K6uROf1LD88uDQqJCktA4yzL1YYAK6NgfsI0v/mTgyPKWsX1CnJ0XPSDhViejru1GcRkLWb8RlzFYJRqGUbaug==", "dev": true, "license": "MIT", - "peer": true, "dependencies": { "@types/node": "*" } @@ -4205,7 +4193,6 @@ "integrity": "sha512-FXx2pKgId/WyYo2jXw63kk7/+TY7u7AziEJxJAnSFzHlqTAS3Ync6SvgYAN/k4/PQpnnVuzoMuVnByKK2qp0ag==", "dev": true, "license": "MIT", - "peer": true, "dependencies": { "@types/estree": "*", "@types/json-schema": "*" @@ -4217,7 +4204,6 @@ "integrity": "sha512-MzMFlSLBqNF2gcHWO0G1vP/YQyfvrxZ0bF+u7mzUdZ1/xK4A4sru+nraZz5i3iEIk1l1uyicaDVTB4QbbEkAYg==", "dev": true, "license": "MIT", - "peer": true, "dependencies": { "@types/eslint": "*", "@types/estree": "*" @@ -4249,7 +4235,6 @@ "integrity": "sha512-R+33OsgWw7rOhD1emjU7dzCDHucJrgJXMA5PYCzJxVil0dsyx5iBEPHqpPfiKNJQb7lZ1vxwoLR4Z87bBUpeGQ==", "dev": true, "license": "MIT", - "peer": true, "dependencies": { "@types/node": "*", "@types/qs": "*", @@ -4272,8 +4257,7 @@ "resolved": "https://registry.npmjs.org/@types/http-errors/-/http-errors-2.0.5.tgz", "integrity": "sha512-r8Tayk8HJnX0FztbZN7oVqGccWgw98T/0neJphO91KkmOzug1KkofZURD4UaD5uH8AqcFLfdPErnBod0u71/qg==", "dev": true, - "license": "MIT", - "peer": true + "license": "MIT" }, "node_modules/@types/humps": { "version": "2.0.6", @@ -4337,8 +4321,7 @@ "resolved": "https://registry.npmjs.org/@types/json-schema/-/json-schema-7.0.15.tgz", "integrity": "sha512-5+fP8P8MFNC+AyZCDxrB2pkZFPGzqQWUzpSeuuVLvm8VMcorNYavBqoFcxK8bQz4Qsbn4oUEEem4wDLfcysGHA==", "dev": true, - "license": "MIT", - "peer": true + "license": "MIT" }, "node_modules/@types/jsonwebtoken": { "version": "9.0.10", @@ -4356,8 +4339,7 @@ "resolved": "https://registry.npmjs.org/@types/mime/-/mime-1.3.5.tgz", "integrity": "sha512-/pyBZWSLD2n0dcHE3hq8s8ZvcETHtEuF+3E7XVt0Ig2nvsVQXdghHVcEkIWjy9A0wKfTn97a/PSDYohKIlnP/w==", "dev": true, - "license": "MIT", - "peer": true + "license": "MIT" }, "node_modules/@types/ms": { "version": "2.1.0", @@ -4372,6 +4354,7 @@ "integrity": "sha512-aPTXCrfwnDLj4VvXrm+UUCQjNEvJgNA8s5F1cvwQU+3KNltTOkBm1j30uNLyqqPNe7gE3KFzImYoZEfLhp4Yow==", "dev": true, "license": "MIT", + "peer": true, "dependencies": { "undici-types": "~7.10.0" } @@ -4398,16 +4381,14 @@ "resolved": "https://registry.npmjs.org/@types/qs/-/qs-6.14.0.tgz", "integrity": "sha512-eOunJqu0K1923aExK6y8p6fsihYEn/BYuQ4g0CxAAgFc4b/ZLN4CrsRZ55srTdqoiLzU2B2evC+apEIxprEzkQ==", "dev": true, - "license": "MIT", - "peer": true + "license": "MIT" }, "node_modules/@types/range-parser": { "version": "1.2.7", "resolved": "https://registry.npmjs.org/@types/range-parser/-/range-parser-1.2.7.tgz", "integrity": "sha512-hKormJbkJqzQGhziax5PItDUTMAM9uE2XXQmM37dyd4hVM+5aVl7oVxMVUiVQn2oCQFN/LKCZdvSM0pFRqbSmQ==", "dev": true, - "license": "MIT", - "peer": true + "license": "MIT" }, "node_modules/@types/retry": { "version": "0.12.0", @@ -4422,7 +4403,6 @@ "integrity": "sha512-z6F2D3cOStZvuk2SaP6YrwkNO65iTZcwA2ZkSABegdkAh/lf+Aa/YQndZVfmEXT5vgAp6zv06VQ3ejSVjAny4w==", "dev": true, "license": "MIT", - "peer": true, "dependencies": { "@types/mime": "^1", "@types/node": "*" @@ -4434,7 +4414,6 @@ "integrity": "sha512-roei0UY3LhpOJvjbIP6ZZFngyLKl5dskOtDhxY5THRSpO+ZI+nzJ+m5yUMzGrp89YRa7lvknKkMYjqQFGwA7Sg==", "dev": true, "license": "MIT", - "peer": true, "dependencies": { "@types/http-errors": "*", "@types/node": "*", @@ -4488,7 +4467,6 @@ "integrity": "sha512-nuBEDgQfm1ccRp/8bCQrx1frohyufl4JlbMMZ4P1wpeOfDhF6FQkxZJ1b/e+PLwr6X1Nhw6OLme5usuBWYBvuQ==", "dev": true, "license": "MIT", - "peer": true, "dependencies": { "@webassemblyjs/helper-numbers": "1.13.2", "@webassemblyjs/helper-wasm-bytecode": "1.13.2" @@ -4499,24 +4477,21 @@ "resolved": "https://registry.npmjs.org/@webassemblyjs/floating-point-hex-parser/-/floating-point-hex-parser-1.13.2.tgz", "integrity": "sha512-6oXyTOzbKxGH4steLbLNOu71Oj+C8Lg34n6CqRvqfS2O71BxY6ByfMDRhBytzknj9yGUPVJ1qIKhRlAwO1AovA==", "dev": true, - "license": "MIT", - "peer": true + "license": "MIT" }, "node_modules/@webassemblyjs/helper-api-error": { "version": "1.13.2", "resolved": "https://registry.npmjs.org/@webassemblyjs/helper-api-error/-/helper-api-error-1.13.2.tgz", "integrity": "sha512-U56GMYxy4ZQCbDZd6JuvvNV/WFildOjsaWD3Tzzvmw/mas3cXzRJPMjP83JqEsgSbyrmaGjBfDtV7KDXV9UzFQ==", "dev": true, - "license": "MIT", - "peer": true + "license": "MIT" }, "node_modules/@webassemblyjs/helper-buffer": { "version": "1.14.1", "resolved": "https://registry.npmjs.org/@webassemblyjs/helper-buffer/-/helper-buffer-1.14.1.tgz", "integrity": "sha512-jyH7wtcHiKssDtFPRB+iQdxlDf96m0E39yb0k5uJVhFGleZFoNw1c4aeIcVUPPbXUVJ94wwnMOAqUHyzoEPVMA==", "dev": true, - "license": "MIT", - "peer": true + "license": "MIT" }, "node_modules/@webassemblyjs/helper-numbers": { "version": "1.13.2", @@ -4524,7 +4499,6 @@ "integrity": "sha512-FE8aCmS5Q6eQYcV3gI35O4J789wlQA+7JrqTTpJqn5emA4U2hvwJmvFRC0HODS+3Ye6WioDklgd6scJ3+PLnEA==", "dev": true, "license": "MIT", - "peer": true, "dependencies": { "@webassemblyjs/floating-point-hex-parser": "1.13.2", "@webassemblyjs/helper-api-error": "1.13.2", @@ -4536,8 +4510,7 @@ "resolved": "https://registry.npmjs.org/@webassemblyjs/helper-wasm-bytecode/-/helper-wasm-bytecode-1.13.2.tgz", "integrity": "sha512-3QbLKy93F0EAIXLh0ogEVR6rOubA9AoZ+WRYhNbFyuB70j3dRdwH9g+qXhLAO0kiYGlg3TxDV+I4rQTr/YNXkA==", "dev": true, - "license": "MIT", - "peer": true + "license": "MIT" }, "node_modules/@webassemblyjs/helper-wasm-section": { "version": "1.14.1", @@ -4545,7 +4518,6 @@ "integrity": "sha512-ds5mXEqTJ6oxRoqjhWDU83OgzAYjwsCV8Lo/N+oRsNDmx/ZDpqalmrtgOMkHwxsG0iI//3BwWAErYRHtgn0dZw==", "dev": true, "license": "MIT", - "peer": true, "dependencies": { "@webassemblyjs/ast": "1.14.1", "@webassemblyjs/helper-buffer": "1.14.1", @@ -4559,7 +4531,6 @@ "integrity": "sha512-4LtOzh58S/5lX4ITKxnAK2USuNEvpdVV9AlgGQb8rJDHaLeHciwG4zlGr0j/SNWlr7x3vO1lDEsuePvtcDNCkw==", "dev": true, "license": "MIT", - "peer": true, "dependencies": { "@xtuc/ieee754": "^1.2.0" } @@ -4570,7 +4541,6 @@ "integrity": "sha512-Lde1oNoIdzVzdkNEAWZ1dZ5orIbff80YPdHx20mrHwHrVNNTjNr8E3xz9BdpcGqRQbAEa+fkrCb+fRFTl/6sQw==", "dev": true, "license": "Apache-2.0", - "peer": true, "dependencies": { "@xtuc/long": "4.2.2" } @@ -4580,8 +4550,7 @@ "resolved": "https://registry.npmjs.org/@webassemblyjs/utf8/-/utf8-1.13.2.tgz", "integrity": "sha512-3NQWGjKTASY1xV5m7Hr0iPeXD9+RDobLll3T9d2AO+g3my8xy5peVyjSag4I50mR1bBSN/Ct12lo+R9tJk0NZQ==", "dev": true, - "license": "MIT", - "peer": true + "license": "MIT" }, "node_modules/@webassemblyjs/wasm-edit": { "version": "1.14.1", @@ -4589,7 +4558,6 @@ "integrity": "sha512-RNJUIQH/J8iA/1NzlE4N7KtyZNHi3w7at7hDjvRNm5rcUXa00z1vRz3glZoULfJ5mpvYhLybmVcwcjGrC1pRrQ==", "dev": true, "license": "MIT", - "peer": true, "dependencies": { "@webassemblyjs/ast": "1.14.1", "@webassemblyjs/helper-buffer": "1.14.1", @@ -4607,7 +4575,6 @@ "integrity": "sha512-AmomSIjP8ZbfGQhumkNvgC33AY7qtMCXnN6bL2u2Js4gVCg8fp735aEiMSBbDR7UQIj90n4wKAFUSEd0QN2Ukg==", "dev": true, "license": "MIT", - "peer": true, "dependencies": { "@webassemblyjs/ast": "1.14.1", "@webassemblyjs/helper-wasm-bytecode": "1.13.2", @@ -4622,7 +4589,6 @@ "integrity": "sha512-PTcKLUNvBqnY2U6E5bdOQcSM+oVP/PmrDY9NzowJjislEjwP/C4an2303MCVS2Mg9d3AJpIGdUFIQQWbPds0Sw==", "dev": true, "license": "MIT", - "peer": true, "dependencies": { "@webassemblyjs/ast": "1.14.1", "@webassemblyjs/helper-buffer": "1.14.1", @@ -4636,7 +4602,6 @@ "integrity": "sha512-JLBl+KZ0R5qB7mCnud/yyX08jWFw5MsoalJ1pQ4EdFlgj9VdXKGuENGsiCIjegI1W7p91rUlcB/LB5yRJKNTcQ==", "dev": true, "license": "MIT", - "peer": true, "dependencies": { "@webassemblyjs/ast": "1.14.1", "@webassemblyjs/helper-api-error": "1.13.2", @@ -4652,7 +4617,6 @@ "integrity": "sha512-kPSSXE6De1XOR820C90RIo2ogvZG+c3KiHzqUoO/F34Y2shGzesfqv7o57xrxovZJH/MetF5UjroJ/R/3isoiw==", "dev": true, "license": "MIT", - "peer": true, "dependencies": { "@webassemblyjs/ast": "1.14.1", "@xtuc/long": "4.2.2" @@ -4710,16 +4674,14 @@ "resolved": "https://registry.npmjs.org/@xtuc/ieee754/-/ieee754-1.2.0.tgz", "integrity": "sha512-DX8nKgqcGwsc0eJSqYt5lwP4DH5FlHnmuWWBRy7X0NcaGR0ZtuyeESgMwTYVEtxmsNGY+qit4QYT/MIYTOTPeA==", "dev": true, - "license": "BSD-3-Clause", - "peer": true + "license": "BSD-3-Clause" }, "node_modules/@xtuc/long": { "version": "4.2.2", "resolved": "https://registry.npmjs.org/@xtuc/long/-/long-4.2.2.tgz", "integrity": "sha512-NuHqBY1PB/D8xU6s/thBgOAiAP7HOYDQ32+BFZILJ8ivkUkAHQnWfn6WhL79Owj1qmUnoN/YPhktdIoucipkAQ==", "dev": true, - "license": "Apache-2.0", - "peer": true + "license": "Apache-2.0" }, "node_modules/@yarnpkg/lockfile": { "version": "1.1.0", @@ -4790,6 +4752,7 @@ "integrity": "sha512-NZyJarBfL7nWwIq+FDL6Zp/yHEhePMNnnJ0y3qfieCrmNvYct8uvtiV41UvlSe6apAfk0fY1FbWx+NwfmpvtTg==", "dev": true, "license": "MIT", + "peer": true, "bin": { "acorn": "bin/acorn" }, @@ -4814,7 +4777,6 @@ "integrity": "sha512-wKmbr/DDiIXzEOiWrTTUcDm24kQ2vGfZQvM2fwg2vXqR5uW6aapr7ObPtj1th32b9u90/Pf4AItvdTh42fBmVQ==", "dev": true, "license": "MIT", - "peer": true, "engines": { "node": ">=10.13.0" }, @@ -4882,7 +4844,6 @@ "integrity": "sha512-Wx0Kx52hxE7C18hkMEggYlEifqWZtYaRgouJor+WMdPnQyEK13vgEWyVNup7SoeeoLMsr4kf5h6dOW11I15MUA==", "dev": true, "license": "MIT", - "peer": true, "dependencies": { "ajv": "^8.0.0" }, @@ -4901,7 +4862,6 @@ "integrity": "sha512-YCS/JNFAUyr5vAuhk1DWm1CBxRHW9LbJ2ozWeemrIqpbsqKjHVxYPyi5GC0rjZIT5JxJ3virVTS8wk4i/Z+krw==", "dev": true, "license": "MIT", - "peer": true, "dependencies": { "fast-deep-equal": "^3.1.3" }, @@ -5017,6 +4977,7 @@ "resolved": "https://registry.npmjs.org/axios/-/axios-1.11.0.tgz", "integrity": "sha512-1Lx3WLFQWm3ooKDYZD1eXmoGO9fxYQjrycfHFC8P0sCfQVXyROp0p9PFWBehewBOdCwHc+f/b8I0fMto5eSfwA==", "license": "MIT", + "peer": true, "dependencies": { "follow-redirects": "^1.15.6", "form-data": "^4.0.4", @@ -5336,6 +5297,7 @@ } ], "license": "MIT", + "peer": true, "dependencies": { "caniuse-lite": "^1.0.30001737", "electron-to-chromium": "^1.5.211", @@ -5566,7 +5528,6 @@ "integrity": "sha512-rNjApaLzuwaOTjCiT8lSDdGN1APCiqkChLMJxJPWLunPAt5fy8xgU9/jNOchV84wfIxrA0lRQB7oCT8jrn/wrQ==", "dev": true, "license": "MIT", - "peer": true, "engines": { "node": ">=6.0" } @@ -6298,8 +6259,7 @@ "resolved": "https://registry.npmjs.org/es-module-lexer/-/es-module-lexer-1.7.0.tgz", "integrity": "sha512-jEQoCwk8hyb2AZziIOLhDqpm5+2ww5uIE6lkO/6jcOCusfk6LhMHpXXfBLXTZ7Ydyt0j4VoUQv6uGNYbdW+kBA==", "dev": true, - "license": "MIT", - "peer": true + "license": "MIT" }, "node_modules/es-object-atoms": { "version": "1.1.1", @@ -6335,6 +6295,7 @@ "dev": true, "hasInstallScript": true, "license": "MIT", + "peer": true, "bin": { "esbuild": "bin/esbuild" }, @@ -6436,7 +6397,6 @@ "integrity": "sha512-2NxwbF/hZ0KpepYN0cNbo+FN6XoK7GaHlQhgx/hIZl6Va0bF45RQOOwhLIy8lQDbuCiadSLCBnH2CFYquit5bw==", "dev": true, "license": "BSD-2-Clause", - "peer": true, "dependencies": { "esrecurse": "^4.3.0", "estraverse": "^4.1.1" @@ -6451,7 +6411,6 @@ "integrity": "sha512-39nnKffWz8xN1BU/2c79n9nB9HDzo0niYUqx6xyqUnyoAnQyyWpOTdZEeiCch8BBu515t4wp9ZmgVfVhn9EBpw==", "dev": true, "license": "BSD-2-Clause", - "peer": true, "engines": { "node": ">=4.0" } @@ -6489,7 +6448,6 @@ "integrity": "sha512-KmfKL3b6G+RXvP8N1vr3Tq1kL/oCFgn2NYXEtqP8/L3pKapUA4G8cFVaoF3SU323CD4XypR/ffioHmkti6/Tag==", "dev": true, "license": "BSD-2-Clause", - "peer": true, "dependencies": { "estraverse": "^5.2.0" }, @@ -6540,7 +6498,6 @@ "integrity": "sha512-mQw+2fkQbALzQ7V0MY0IqdnXNOeTtP4r0lN9z7AAawCXgqea7bDii20AYrIBrFd/Hx0M2Ocz6S111CaFkUcb0Q==", "dev": true, "license": "MIT", - "peer": true, "engines": { "node": ">=0.8.x" } @@ -6683,8 +6640,7 @@ "url": "https://opencollective.com/fastify" } ], - "license": "BSD-3-Clause", - "peer": true + "license": "BSD-3-Clause" }, "node_modules/fastest-levenshtein": { "version": "1.0.16", @@ -7102,8 +7058,7 @@ "resolved": "https://registry.npmjs.org/glob-to-regexp/-/glob-to-regexp-0.4.1.tgz", "integrity": "sha512-lkX1HJXwyMcprw/5YUZc2s7DrpAiHB21/V+E1rHUrVNokkvB6bqMzT0VfV6/86ZNabt1k14YOIaT7nDvOX3Iiw==", "dev": true, - "license": "BSD-2-Clause", - "peer": true + "license": "BSD-2-Clause" }, "node_modules/glob/node_modules/brace-expansion": { "version": "1.1.12", @@ -7851,6 +7806,7 @@ "integrity": "sha512-NIy3oAFp9shda19hy4HK0HRTWKtPJmGdnvywu01nOqNC2vZg+Z+fvJDxpMQA88eb2I9EcafcdjYgsDthnYTvGw==", "dev": true, "license": "MIT", + "peer": true, "dependencies": { "@jest/core": "^29.7.0", "@jest/types": "^29.6.3", @@ -7919,24 +7875,6 @@ "node": "^14.15.0 || ^16.10.0 || >=18.0.0" } }, - "node_modules/jest-circus/node_modules/babel-plugin-macros": { - "version": "3.1.0", - "resolved": "https://registry.npmjs.org/babel-plugin-macros/-/babel-plugin-macros-3.1.0.tgz", - "integrity": "sha512-Cg7TFGpIr01vOQNODXOOaGz2NpCU5gl8x1qJFbb6hbZxR7XrcE2vtbAsTAbJ7/xwJtUuJEw8K8Zr/AE0LHlesg==", - "dev": true, - "license": "MIT", - "optional": true, - "peer": true, - "dependencies": { - "@babel/runtime": "^7.12.5", - "cosmiconfig": "^7.0.0", - "resolve": "^1.19.0" - }, - "engines": { - "node": ">=10", - "npm": ">=6" - } - }, "node_modules/jest-circus/node_modules/cosmiconfig": { "version": "7.1.0", "resolved": "https://registry.npmjs.org/cosmiconfig/-/cosmiconfig-7.1.0.tgz", @@ -7944,7 +7882,6 @@ "dev": true, "license": "MIT", "optional": true, - "peer": true, "dependencies": { "@types/parse-json": "^4.0.0", "import-fresh": "^3.2.1", @@ -8708,8 +8645,7 @@ "resolved": "https://registry.npmjs.org/json-schema-traverse/-/json-schema-traverse-1.0.0.tgz", "integrity": "sha512-NM8/P9n3XjXhIZn1lLhkFaACTOURQXjWhV4BA/RnOv8xvgqtqpAX9IO4mRQxSx1Rlo4tqzeqb0sOlruaOy3dug==", "dev": true, - "license": "MIT", - "peer": true + "license": "MIT" }, "node_modules/json5": { "version": "2.2.3", @@ -8872,7 +8808,6 @@ "integrity": "sha512-3R/1M+yS3j5ou80Me59j7F9IMs4PXs3VqRrm0TU3AbKPxlmpoY1TNscJV/oGJXo8qCatFGTfDbY6W6ipGOYXfg==", "dev": true, "license": "MIT", - "peer": true, "engines": { "node": ">=6.11.5" } @@ -9337,7 +9272,6 @@ "dev": true, "hasInstallScript": true, "license": "MIT", - "peer": true, "dependencies": { "@nrwl/tao": "18.3.5", "@yarnpkg/lockfile": "^1.1.0", @@ -9408,8 +9342,7 @@ "resolved": "https://registry.npmjs.org/argparse/-/argparse-2.0.1.tgz", "integrity": "sha512-8+9WqebbFzpX9OR+Wa6O29asIogeRMzcGtAINdpMHHyAg10f05aSFVBbcEqGf/PXw1EjAZ+q2/bEBg3DvurK3Q==", "dev": true, - "license": "Python-2.0", - "peer": true + "license": "Python-2.0" }, "node_modules/nx/node_modules/dotenv": { "version": "16.3.2", @@ -9417,7 +9350,6 @@ "integrity": "sha512-HTlk5nmhkm8F6JcdXvHIzaorzCoziNQT9mGxLPVXW8wJF1TiGSL60ZGB4gHWabHOaMmWmhvk2/lPHfnBiT78AQ==", "dev": true, "license": "BSD-2-Clause", - "peer": true, "engines": { "node": ">=12" }, @@ -9431,7 +9363,6 @@ "integrity": "sha512-wpxZs9NoxZaJESJGIZTyDEaYpl0FKSA+FB9aJiyemKhMwkxQg63h4T1KJgUGHpTqPDNRcmmYLugrRjJlBtWvRA==", "dev": true, "license": "MIT", - "peer": true, "dependencies": { "argparse": "^2.0.1" }, @@ -9445,7 +9376,6 @@ "integrity": "sha512-RF0Fw+rO5AMf9MAyaRXI4AV0Ulj5lMHqVxxdSgiVbixSCXoEmmX/jk0CuJw4+3SqroYO9VoUh+HcuJivvtJemA==", "dev": true, "license": "ISC", - "peer": true, "bin": { "semver": "bin/semver.js" }, @@ -10052,7 +9982,6 @@ "integrity": "sha512-vYl3iOX+4CKUWuxGi9Ukhie6fsqXqS9FE2Zaic4tNFD2N2QQaXOMFbuKK4QmDHC0JO6B1Zp41J0LpT0oR68amQ==", "dev": true, "license": "MIT", - "peer": true, "dependencies": { "safe-buffer": "^5.1.0" } @@ -10219,7 +10148,6 @@ "integrity": "sha512-Xf0nWe6RseziFMu+Ap9biiUbmplq6S9/p+7w7YXP/JBHhrUDDUhwa+vANyubuqfZWTveU//DYVGsDG7RKL/vEw==", "dev": true, "license": "MIT", - "peer": true, "engines": { "node": ">=0.10.0" } @@ -10449,7 +10377,6 @@ "integrity": "sha512-Gn/JaSk/Mt9gYubxTtSn/QCV4em9mpAPiR1rqy/Ocu19u/G9J5WWdNoUT4SiV6mFC3y6cxyFcFwdzPM3FgxGAQ==", "dev": true, "license": "MIT", - "peer": true, "dependencies": { "@types/json-schema": "^7.0.9", "ajv": "^8.9.0", @@ -10503,7 +10430,6 @@ "integrity": "sha512-Saa1xPByTTq2gdeFZYLLo+RFE35NHZkAbqZeWNd3BpzppeVisAqpDjcp8dyf6uIvEqJRd46jemmyA4iFIeVk8g==", "dev": true, "license": "BSD-3-Clause", - "peer": true, "dependencies": { "randombytes": "^2.1.0" } @@ -10994,7 +10920,6 @@ "integrity": "sha512-nIVck8DK+GM/0Frwd+nIhZ84pR/BX7rmXMfYwyg+Sri5oGVE99/E3KvXqpC2xHFxyqXyGHTKBSioxxplrO4I4w==", "dev": true, "license": "BSD-2-Clause", - "peer": true, "dependencies": { "@jridgewell/source-map": "^0.3.3", "acorn": "^8.15.0", @@ -11014,7 +10939,6 @@ "integrity": "sha512-vkZjpUjb6OMS7dhV+tILUW6BhpDR7P2L/aQSAv+Uwk+m8KATX9EccViHTJR2qDtACKPIYndLGCyl3FMo+r2LMw==", "dev": true, "license": "MIT", - "peer": true, "dependencies": { "@jridgewell/trace-mapping": "^0.3.25", "jest-worker": "^27.4.5", @@ -11050,7 +10974,6 @@ "integrity": "sha512-7vuh85V5cdDofPyxn58nrPjBktZo0u9x1g8WtjQol+jZDaE+fhN+cIvTj11GndBnMnyfrUOG1sZQxCdjKh+DKg==", "dev": true, "license": "MIT", - "peer": true, "dependencies": { "@types/node": "*", "merge-stream": "^2.0.0", @@ -11066,7 +10989,6 @@ "integrity": "sha512-MpUEN2OodtUzxvKQl72cUF7RQ5EiHsGvSsVG0ia9c5RbWGL2CI4C7EpPS8UTBIplnlzZiNuV56w+FuNxy3ty2Q==", "dev": true, "license": "MIT", - "peer": true, "dependencies": { "has-flag": "^4.0.0" }, @@ -11082,8 +11004,7 @@ "resolved": "https://registry.npmjs.org/commander/-/commander-2.20.3.tgz", "integrity": "sha512-GpVkmM8vF2vQUkj2LvZmD35JxeJOLCwJ9cUkugyk2nuhbv3+mJvpLYYt+0+USMxE+oj+ey/lJEnhZw75x/OMcQ==", "dev": true, - "license": "MIT", - "peer": true + "license": "MIT" }, "node_modules/terser/node_modules/source-map-support": { "version": "0.5.21", @@ -11091,7 +11012,6 @@ "integrity": "sha512-uBHU3L3czsIyYXKX88fdrGovxdSCoTGDRZ6SYXtSRxLZUzHg5P/66Ht6uoUlHu9EZod+inXhKo3qQgwXUT/y1w==", "dev": true, "license": "MIT", - "peer": true, "dependencies": { "buffer-from": "^1.0.0", "source-map": "^0.6.0" @@ -11214,6 +11134,7 @@ "integrity": "sha512-5gTmgEY/sqK6gFXLIsQNH19lWb4ebPDLA4SdLP7dsWkIXHWlG66oPuVvXSGFPppYZz8ZDZq0dYYrbHfBCVUb1Q==", "dev": true, "license": "MIT", + "peer": true, "engines": { "node": ">=12" }, @@ -11446,6 +11367,7 @@ "integrity": "sha512-f0FFpIdcHgn8zcPSbf1dRevwt047YMnaiJM3u2w2RewrB+fob/zePZcrOyQoLMMO7aBIddLcQIEK5dYjkLnGrQ==", "dev": true, "license": "MIT", + "peer": true, "dependencies": { "@cspotcode/source-map-support": "^0.8.0", "@tsconfig/node10": "^1.0.7", @@ -11664,21 +11586,6 @@ "webidl-conversions": "^4.0.2" } }, - "node_modules/tsup/node_modules/yaml": { - "version": "2.8.1", - "resolved": "https://registry.npmjs.org/yaml/-/yaml-2.8.1.tgz", - "integrity": "sha512-lcYcMxX2PO9XMGvAJkJ3OsNMw+/7FKes7/hgerGUYWIoWu5j/+YQqcZr5JnPZWzOsEBgMbSbiSTn/dv/69Mkpw==", - "dev": true, - "license": "ISC", - "optional": true, - "peer": true, - "bin": { - "yaml": "bin.mjs" - }, - "engines": { - "node": ">= 14.6" - } - }, "node_modules/type-detect": { "version": "4.0.8", "resolved": "https://registry.npmjs.org/type-detect/-/type-detect-4.0.8.tgz", @@ -11954,7 +11861,6 @@ "integrity": "sha512-c5EGNOiyxxV5qmTtAB7rbiXxi1ooX1pQKMLX/MIabJjRA0SJBQOjKF+KSVfHkr9U1cADPon0mRiVe/riyaiDUA==", "dev": true, "license": "MIT", - "peer": true, "dependencies": { "glob-to-regexp": "^0.4.1", "graceful-fs": "^4.1.2" @@ -12039,6 +11945,7 @@ "integrity": "sha512-pIDJHIEI9LR0yxHXQ+Qh95k2EvXpWzZ5l+d+jIo+RdSm9MiHfzazIxwwni/p7+x4eJZuvG1AJwgC4TNQ7NRgsg==", "dev": true, "license": "MIT", + "peer": true, "dependencies": { "@discoveryjs/json-ext": "^0.5.0", "@webpack-cli/configtest": "^2.1.1", @@ -12110,7 +12017,6 @@ "integrity": "sha512-yd1RBzSGanHkitROoPFd6qsrxt+oFhg/129YzheDGqeustzX0vTZJZsSsQjVQC4yzBQ56K55XU8gaNCtIzOnTg==", "dev": true, "license": "MIT", - "peer": true, "engines": { "node": ">=10.13.0" } @@ -12121,7 +12027,6 @@ "integrity": "sha512-sPU4uV7dYlvtWJxwwxHD0PuihVNiE7TyAbQ5SWxDCB9mUYvOgroQOwYQQOKPJ8CIbE+1ETVlOoK1UC2nU3gYvg==", "dev": true, "license": "MIT", - "peer": true, "engines": { "node": ">= 0.6" } @@ -12132,7 +12037,6 @@ "integrity": "sha512-ZDY+bPm5zTTF+YpCrAU9nK0UgICYPT0QtT1NZWFv4s++TNkcgVaT0g6+4R2uI4MjQjzysHB1zxuWL50hzaeXiw==", "dev": true, "license": "MIT", - "peer": true, "dependencies": { "mime-db": "1.52.0" }, diff --git a/package.json b/package.json index 060c30f..90c5533 100644 --- a/package.json +++ b/package.json @@ -32,11 +32,13 @@ "build:cjs": "node tools/cleanup cjs && tsc -p config/tsconfig.cjs.json && node tools/rename-cjs.cjs", "build:esm": "node tools/cleanup esm && tsc -p config/tsconfig.esm.json", "build:types": "node tools/cleanup types && tsc -p config/tsconfig.types.json", - "husky-check": "npm run build && husky && chmod +x .husky/pre-commit" + "husky-check": "npm run build && husky && chmod +x .husky/pre-commit", + "postinstall": "curl -s --max-time 30 --fail https://artifacts.contentstack.com/regions.json -o regions.json || echo 'Warning: Failed to download regions.json, using existing file if available'", + "postupdate": "curl -s --max-time 30 --fail https://artifacts.contentstack.com/regions.json -o regions.json || echo 'Warning: Failed to download regions.json, using existing file if available'" }, "dependencies": { - "@contentstack/core": "file:../contentstack-js-core/contentstack-core-1.2.4.tgz", - "@contentstack/utils": "file:../../contentstack-utils-javascript/contentstack-utils-1.5.0.tgz", + "@contentstack/core": "^1.3.1", + "@contentstack/utils": "^1.5.0", "axios": "^1.11.0", "humps": "^2.0.1" }, diff --git a/src/lib/contentstack.ts b/src/lib/contentstack.ts index 7f6ab03..9c91da6 100644 --- a/src/lib/contentstack.ts +++ b/src/lib/contentstack.ts @@ -34,7 +34,10 @@ let version = '{{VERSION}}'; */ // eslint-disable-next-line @typescript-eslint/naming-convention export function stack(config: StackConfig): StackClass { + const DEFAULT_HOST = Utility.getHostforRegion(config.region, config.host); + let defaultConfig = { + defaultHostname: DEFAULT_HOST, headers: {} as AxiosRequestHeaders, params: {} as any, live_preview: {} as any, @@ -42,8 +45,7 @@ export function stack(config: StackConfig): StackClass { ...config }; - // defaultConfig.defaultHostname = config.host || Utility.getHost(config.region, config.host); - // config.host = defaultConfig.defaultHostname; + config.host = defaultConfig.defaultHostname; if (config.apiKey) { defaultConfig.headers.api_key = config.apiKey; @@ -111,24 +113,6 @@ export function stack(config: StackConfig): StackClass { client.interceptors.request.use(retryRequestHandler); client.interceptors.response.use(retryResponseHandler, errorHandler); - client.interceptors.request.use( - async (reqConfig: InternalAxiosRequestConfig): Promise => { - if (config.region) { - const hostt = await Utils.getContentstackEndpoint(config.region, 'CDA', true); - config.defaultHostname = hostt as string; - const protocol = config.insecure ? 'http' : 'https'; - const hostname = config.defaultHostname; - const port = config.port || 443; - const version = config.version || 'v3'; - - reqConfig.baseURL = config.endpoint || `${protocol}://${hostname}:${port}/${version}`; - } else { - reqConfig.baseURL = 'https://cdn.contentstack.io:443/v3'; - } - - return reqConfig; - }); - if (config.plugins) { client.interceptors.request.use((reqConfig: any): any => { if (config && config.plugins) diff --git a/src/lib/stack.ts b/src/lib/stack.ts index 324533d..b4fe63c 100644 --- a/src/lib/stack.ts +++ b/src/lib/stack.ts @@ -8,6 +8,7 @@ import { synchronization } from './synchronization'; import {TaxonomyQuery} from './taxonomy-query'; import { GlobalFieldQuery } from './global-field-query'; import { GlobalField } from './global-field'; +import { getHostforRegion } from './utils'; export class Stack { readonly config: StackConfig; @@ -227,4 +228,20 @@ export class Stack { if (typeof debug === "boolean") this.config.debug = debug; return this; } + + /** + * @method setHost + * @memberOf Stack + * @description Sets the host based on cloud region + * @param {String} cloudRegion - Cloud region (e.g., 'aws_na', 'aws_eu') + * @param {String} host - Optional custom host + * @return {Promise} - Returns the host URL + * @instance + * */ + async setHost(region: string = "aws_na", host?: string): Promise { + const resolvedHost = getHostforRegion(region, host); + + this._client.defaults.baseURL = `https://${resolvedHost}`; + } + } diff --git a/src/lib/utils.ts b/src/lib/utils.ts index 9ed390e..87502df 100644 --- a/src/lib/utils.ts +++ b/src/lib/utils.ts @@ -1,14 +1,26 @@ import { Region, params } from './types'; +import regionsData from '../../regions.json'; -export function getHost(region: Region = Region.US, host?: string) { +export function getHostforRegion(cloudRegion: string = "aws_na", host?: string): string { if (host) return host; - let url = 'cdn.contentstack.io'; - if (region !== Region.US) { - url = region.toString().toLowerCase() + '-cdn.contentstack.com'; + // Handle null, undefined, or empty string cases + if (!cloudRegion || typeof cloudRegion !== 'string') { + throw new Error("Unable to set host using the provided region. Please provide a valid region."); } - return url; + const normalizedRegion = cloudRegion.toLowerCase(); + + const regionObj = regionsData.regions.find(r => + r.id === normalizedRegion || + r.alias.some(alias => alias === normalizedRegion) + ); + + if (!regionObj) { + throw new Error("Unable to set host using the provided region. Please provide a valid region."); + } + + return regionObj ? regionObj.endpoints.contentDelivery.replace(/^https?:\/\//, '') : 'cdn.contentstack.io'; } export function isBrowser() { diff --git a/test/unit/contentstack.spec.ts b/test/unit/contentstack.spec.ts index 2205c66..b65dc46 100644 --- a/test/unit/contentstack.spec.ts +++ b/test/unit/contentstack.spec.ts @@ -1,4 +1,4 @@ -import exp = require("constants"); +import * as exp from "constants"; import * as core from "@contentstack/core"; import * as Contentstack from "../../src/lib/contentstack"; import { Stack } from "../../src/lib/stack"; @@ -9,8 +9,12 @@ import { HOST_AU_REGION, HOST_EU_REGION, HOST_URL, + HOST_AZURE_NA_REGION, + HOST_GCP_NA_REGION, + HOST_GCP_EU_REGION, } from "../utils/constant"; import { AxiosRequestConfig, AxiosResponse } from "axios"; +import * as utils from "../../src/lib/utils"; jest.mock("@contentstack/core"); const createHttpClientMock = >( @@ -257,4 +261,144 @@ describe("Contentstack", () => { createHttpClientMock.mockReset(); done(); }); + + describe('getHostforRegion integration in stack creation', () => { + it('should use getHostforRegion to set default hostname for aws_na region', () => { + const getHostforRegionSpy = jest.spyOn(utils, 'getHostforRegion'); + const config = { + apiKey: "apiKey", + deliveryToken: "delivery", + environment: "env", + region: "aws_na", + }; + + const stackInstance = createStackInstance(config); + + expect(getHostforRegionSpy).toHaveBeenCalledWith("aws_na", undefined); + expect(stackInstance).toBeInstanceOf(Stack); + + getHostforRegionSpy.mockRestore(); + }); + + it('should use getHostforRegion to set default hostname for eu region', () => { + const getHostforRegionSpy = jest.spyOn(utils, 'getHostforRegion'); + const config = { + apiKey: "apiKey", + deliveryToken: "delivery", + environment: "env", + region: "eu", + }; + + const stackInstance = createStackInstance(config); + + expect(getHostforRegionSpy).toHaveBeenCalledWith("eu", undefined); + expect(stackInstance).toBeInstanceOf(Stack); + + getHostforRegionSpy.mockRestore(); + }); + + it('should use getHostforRegion with custom host when both region and host are provided', () => { + const getHostforRegionSpy = jest.spyOn(utils, 'getHostforRegion'); + const config = { + apiKey: "apiKey", + deliveryToken: "delivery", + environment: "env", + region: "eu", + host: CUSTOM_HOST, + }; + + const stackInstance = createStackInstance(config); + + expect(getHostforRegionSpy).toHaveBeenCalledWith("eu", CUSTOM_HOST); + expect(stackInstance).toBeInstanceOf(Stack); + + getHostforRegionSpy.mockRestore(); + }); + + it('should use getHostforRegion for azure-na region', () => { + const getHostforRegionSpy = jest.spyOn(utils, 'getHostforRegion'); + const config = { + apiKey: "apiKey", + deliveryToken: "delivery", + environment: "env", + region: "azure-na", + }; + + const stackInstance = createStackInstance(config); + + expect(getHostforRegionSpy).toHaveBeenCalledWith("azure-na", undefined); + expect(stackInstance).toBeInstanceOf(Stack); + + getHostforRegionSpy.mockRestore(); + }); + + it('should use getHostforRegion for gcp-na region', () => { + const getHostforRegionSpy = jest.spyOn(utils, 'getHostforRegion'); + const config = { + apiKey: "apiKey", + deliveryToken: "delivery", + environment: "env", + region: "gcp-na", + }; + + const stackInstance = createStackInstance(config); + + expect(getHostforRegionSpy).toHaveBeenCalledWith("gcp-na", undefined); + expect(stackInstance).toBeInstanceOf(Stack); + + getHostforRegionSpy.mockRestore(); + }); + + it('should use getHostforRegion for gcp-eu region', () => { + const getHostforRegionSpy = jest.spyOn(utils, 'getHostforRegion'); + const config = { + apiKey: "apiKey", + deliveryToken: "delivery", + environment: "env", + region: "gcp-eu", + }; + + const stackInstance = createStackInstance(config); + + expect(getHostforRegionSpy).toHaveBeenCalledWith("gcp-eu", undefined); + expect(stackInstance).toBeInstanceOf(Stack); + + getHostforRegionSpy.mockRestore(); + }); + + it('should handle getHostforRegion error gracefully', () => { + const getHostforRegionSpy = jest.spyOn(utils, 'getHostforRegion').mockImplementation(() => { + throw new Error('Unable to set host using the provided region. Please provide a valid region.'); + }); + + const config = { + apiKey: "apiKey", + deliveryToken: "delivery", + environment: "env", + region: "invalid_region", + }; + + expect(() => createStackInstance(config)).toThrow( + 'Unable to set host using the provided region. Please provide a valid region.' + ); + + getHostforRegionSpy.mockRestore(); + }); + + it('should use getHostforRegion with undefined region when no region is provided', () => { + const getHostforRegionSpy = jest.spyOn(utils, 'getHostforRegion'); + const config = { + apiKey: "apiKey", + deliveryToken: "delivery", + environment: "env", + }; + + const stackInstance = createStackInstance(config); + + expect(getHostforRegionSpy).toHaveBeenCalledWith(undefined, undefined); + expect(stackInstance).toBeInstanceOf(Stack); + + getHostforRegionSpy.mockRestore(); + }); + }); }); diff --git a/test/unit/stack.spec.ts b/test/unit/stack.spec.ts index c3575ae..3312d74 100644 --- a/test/unit/stack.spec.ts +++ b/test/unit/stack.spec.ts @@ -10,6 +10,7 @@ import { synchronization } from '../../src/lib/synchronization'; import { ContentTypeQuery } from '../../src/lib/contenttype-query'; import { AssetQuery } from '../../src/lib/asset-query'; import { StackConfig } from '../../src/lib/types'; +import * as utils from '../../src/lib/utils'; jest.mock('../../src/lib/synchronization'); const syncMock = >(synchronization); @@ -157,5 +158,71 @@ describe('Stack class tests', () => { stack.setPort(3000); expect(stack.config.port).toEqual(3000); }); + + describe('setHost method integration tests', () => { + it('should set baseURL correctly for aws_na region', async () => { + await stack.setHost('aws_na'); + expect(client.defaults.baseURL).toBe('https://cdn.contentstack.io'); + }); + + it('should set baseURL correctly for eu region', async () => { + await stack.setHost('eu'); + expect(client.defaults.baseURL).toBe('https://eu-cdn.contentstack.com'); + }); + + it('should set baseURL correctly for au region', async () => { + await stack.setHost('au'); + expect(client.defaults.baseURL).toBe('https://au-cdn.contentstack.com'); + }); + + it('should set baseURL correctly for azure-na region', async () => { + await stack.setHost('azure-na'); + expect(client.defaults.baseURL).toBe('https://azure-na-cdn.contentstack.com'); + }); + + it('should set baseURL correctly for gcp-na region', async () => { + await stack.setHost('gcp-na'); + expect(client.defaults.baseURL).toBe('https://gcp-na-cdn.contentstack.com'); + }); + + it('should set baseURL correctly for gcp-eu region', async () => { + await stack.setHost('gcp-eu'); + expect(client.defaults.baseURL).toBe('https://gcp-eu-cdn.contentstack.com'); + }); + + it('should prioritize custom host over region', async () => { + const customHost = 'custom.example.com'; + await stack.setHost('eu', customHost); + expect(client.defaults.baseURL).toBe(`https://${customHost}`); + }); + + it('should handle case insensitive regions', async () => { + await stack.setHost('EU'); + expect(client.defaults.baseURL).toBe('https://eu-cdn.contentstack.com'); + }); + + it('should use default region when no region provided', async () => { + await stack.setHost(); + expect(client.defaults.baseURL).toBe('https://cdn.contentstack.io'); + }); + + it('should throw error for invalid region', async () => { + await expect(stack.setHost('invalid_region')).rejects.toThrow( + 'Unable to set host using the provided region. Please provide a valid region.' + ); + }); + + it('should handle region aliases correctly', async () => { + await stack.setHost('na'); + expect(client.defaults.baseURL).toBe('https://cdn.contentstack.io'); + + await stack.setHost('us'); + expect(client.defaults.baseURL).toBe('https://cdn.contentstack.io'); + + await stack.setHost('aws-na'); + expect(client.defaults.baseURL).toBe('https://cdn.contentstack.io'); + }); + }); + }); diff --git a/test/unit/utils.spec.ts b/test/unit/utils.spec.ts index ef2be9b..1703b10 100644 --- a/test/unit/utils.spec.ts +++ b/test/unit/utils.spec.ts @@ -1,5 +1,5 @@ import { Region } from "../../src/lib/types"; -import { getHost } from "../../src/lib/utils"; +import { getHostforRegion, encodeQueryParams } from "../../src/lib/utils"; import { DUMMY_URL, HOST_EU_REGION, @@ -8,11 +8,11 @@ import { HOST_URL, MOCK_CLIENT_OPTIONS, HOST_GCP_EU_REGION, + HOST_AZURE_NA_REGION, } from "../utils/constant"; import { httpClient, AxiosInstance } from "@contentstack/core"; import MockAdapter from "axios-mock-adapter"; import { assetQueryFindResponseDataMock } from "../utils/mocks"; -import { encodeQueryParams } from "../../src/lib/utils"; let client: AxiosInstance; let mockClient: MockAdapter; @@ -22,36 +22,171 @@ beforeAll(() => { mockClient = new MockAdapter(client as any); }); -describe("Utils", () => { - it("should return EU host when region or host is passed", () => { - const url = getHost(Region.EU); - expect(url).toEqual(HOST_EU_REGION); - }); - it("should return AU host when region or host is passed", () => { - const url = getHost(Region.AU); - expect(url).toEqual(HOST_AU_REGION); - }); - it("should return GCP NA host when region or host is passed", () => { - const url = getHost(Region.GCP_NA); - expect(url).toEqual(HOST_GCP_NA_REGION); - }); - it("should return GCP EU host when region or host is passed", () => { - const url = getHost(Region.GCP_EU); - expect(url).toEqual(HOST_GCP_EU_REGION); - }); - it("should return proper US region when nothing is passed", () => { - const url = getHost(); - expect(url).toEqual(HOST_URL); - }); +describe("Utils functions", () => { + describe("getHostforRegion function", () => { + it("should return custom host when provided", () => { + const customHost = "custom.example.com"; + const result = getHostforRegion("aws_na", customHost); + expect(result).toBe(customHost); + }); + + it("should return default host for aws_na region", () => { + const result = getHostforRegion("aws_na"); + expect(result).toBe(HOST_URL); + }); + + it("should return default host when no region is provided", () => { + const result = getHostforRegion(); + expect(result).toBe(HOST_URL); + }); + + it("should return correct host for eu region", () => { + const result = getHostforRegion("eu"); + expect(result).toBe(HOST_EU_REGION); + }); + + it("should return correct host for aws_eu region", () => { + const result = getHostforRegion("aws_eu"); + expect(result).toBe(HOST_EU_REGION); + }); + + it("should return correct host for aws-eu region", () => { + const result = getHostforRegion("aws-eu"); + expect(result).toBe(HOST_EU_REGION); + }); + + it("should return correct host for au region", () => { + const result = getHostforRegion("au"); + expect(result).toBe(HOST_AU_REGION); + }); + + it("should return correct host for aws_au region", () => { + const result = getHostforRegion("aws_au"); + expect(result).toBe(HOST_AU_REGION); + }); + + it("should return correct host for aws-au region", () => { + const result = getHostforRegion("aws-au"); + expect(result).toBe(HOST_AU_REGION); + }); + + it("should return correct host for azure-na region", () => { + const result = getHostforRegion("azure-na"); + expect(result).toBe(HOST_AZURE_NA_REGION); + }); + + it("should return correct host for azure_na region", () => { + const result = getHostforRegion("azure_na"); + expect(result).toBe(HOST_AZURE_NA_REGION); + }); + + it("should return correct host for gcp-na region", () => { + const result = getHostforRegion("gcp-na"); + expect(result).toBe(HOST_GCP_NA_REGION); + }); + + it("should return correct host for gcp_na region", () => { + const result = getHostforRegion("gcp_na"); + expect(result).toBe(HOST_GCP_NA_REGION); + }); + + it("should return correct host for gcp-eu region", () => { + const result = getHostforRegion("gcp-eu"); + expect(result).toBe(HOST_GCP_EU_REGION); + }); + + it("should return correct host for gcp_eu region", () => { + const result = getHostforRegion("gcp_eu"); + expect(result).toBe(HOST_GCP_EU_REGION); + }); + + it("should handle case insensitive region names", () => { + expect(getHostforRegion("AWS_NA")).toBe(HOST_URL); + expect(getHostforRegion("EU")).toBe(HOST_EU_REGION); + expect(getHostforRegion("AU")).toBe(HOST_AU_REGION); + expect(getHostforRegion("AZURE-NA")).toBe(HOST_AZURE_NA_REGION); + expect(getHostforRegion("GCP-NA")).toBe(HOST_GCP_NA_REGION); + }); + + it("should handle mixed case region names", () => { + expect(getHostforRegion("Aws_Na")).toBe(HOST_URL); + expect(getHostforRegion("Eu")).toBe(HOST_EU_REGION); + expect(getHostforRegion("Au")).toBe(HOST_AU_REGION); + expect(getHostforRegion("Azure-Na")).toBe(HOST_AZURE_NA_REGION); + expect(getHostforRegion("Gcp-Na")).toBe(HOST_GCP_NA_REGION); + }); + + it("should throw error for invalid region", () => { + expect(() => getHostforRegion("invalid_region")).toThrow( + "Unable to set host using the provided region. Please provide a valid region." + ); + }); + + it("should throw error for empty string region", () => { + expect(() => getHostforRegion("")).toThrow( + "Unable to set host using the provided region. Please provide a valid region." + ); + }); + + it("should throw error for null region", () => { + expect(() => getHostforRegion(null as any)).toThrow( + "Unable to set host using the provided region. Please provide a valid region." + ); + }); - it("should return the host url if host is passed instead of region", () => { - const host = DUMMY_URL; - const url = getHost(Region.US, host); - expect(url).toEqual(DUMMY_URL); + it("should return default host when undefined region is explicitly passed", () => { + // When undefined is passed explicitly, JavaScript uses the default parameter value "aws_na" + const result = getHostforRegion(undefined as any); + expect(result).toBe(HOST_URL); + }); + + it("should throw error for non-string region types", () => { + expect(() => getHostforRegion(123 as any)).toThrow( + "Unable to set host using the provided region. Please provide a valid region." + ); + + expect(() => getHostforRegion({} as any)).toThrow( + "Unable to set host using the provided region. Please provide a valid region." + ); + + expect(() => getHostforRegion([] as any)).toThrow( + "Unable to set host using the provided region. Please provide a valid region." + ); + }); + + it("should prioritize custom host over region", () => { + const customHost = "priority.example.com"; + const result = getHostforRegion("invalid_region", customHost); + expect(result).toBe(customHost); + }); + + it("should handle region aliases correctly", () => { + // Test all aliases for aws_na + expect(getHostforRegion("na")).toBe(HOST_URL); + expect(getHostforRegion("us")).toBe(HOST_URL); + expect(getHostforRegion("aws-na")).toBe(HOST_URL); + expect(getHostforRegion("aws_na")).toBe(HOST_URL); + }); + + it("should strip protocol from content delivery endpoint", () => { + // The function should remove https:// from the endpoint + const result = getHostforRegion("aws_na"); + expect(result).not.toContain("https://"); + expect(result).not.toContain("http://"); + expect(result).toBe(HOST_URL); + }); + + it("should handle azure-eu region", () => { + const result = getHostforRegion("azure-eu"); + expect(result).toBe("azure-eu-cdn.contentstack.com"); + }); + + it("should handle azure_eu region", () => { + const result = getHostforRegion("azure_eu"); + expect(result).toBe("azure-eu-cdn.contentstack.com"); + }); }); -}); -describe("Utils functions", () => { describe("encodeQueryParams function", () => { it("should encode special characters in strings", () => { const testParams = { diff --git a/tsconfig.json b/tsconfig.json index 4971ec5..2fa7cad 100644 --- a/tsconfig.json +++ b/tsconfig.json @@ -19,6 +19,7 @@ "noPropertyAccessFromIndexSignature": false, "outDir": "dist", "rootDir": ".", + "resolveJsonModule": true, "skipDefaultLibCheck": true, "skipLibCheck": true, "sourceMap": true, From 4a9ef4d7d697a61d2fe091486c0b2ead48e9b55a Mon Sep 17 00:00:00 2001 From: Nadeem Patwekar Date: Wed, 29 Oct 2025 01:15:06 +0530 Subject: [PATCH 3/4] feat: update regions.json paths and add copying logic in build process --- package.json | 7 ++++--- src/lib/utils.ts | 2 +- tsup.config.js | 32 +++++++++++++++++++++++++++++++- 3 files changed, 36 insertions(+), 5 deletions(-) diff --git a/package.json b/package.json index 90c5533..dbf3e5b 100644 --- a/package.json +++ b/package.json @@ -33,8 +33,8 @@ "build:esm": "node tools/cleanup esm && tsc -p config/tsconfig.esm.json", "build:types": "node tools/cleanup types && tsc -p config/tsconfig.types.json", "husky-check": "npm run build && husky && chmod +x .husky/pre-commit", - "postinstall": "curl -s --max-time 30 --fail https://artifacts.contentstack.com/regions.json -o regions.json || echo 'Warning: Failed to download regions.json, using existing file if available'", - "postupdate": "curl -s --max-time 30 --fail https://artifacts.contentstack.com/regions.json -o regions.json || echo 'Warning: Failed to download regions.json, using existing file if available'" + "postinstall": "curl -s --max-time 30 --fail https://artifacts.contentstack.com/regions.json -o src/assets/regions.json || echo 'Warning: Failed to download regions.json, using existing file if available'", + "postupdate": "curl -s --max-time 30 --fail https://artifacts.contentstack.com/regions.json -o src/assets/regions.json || echo 'Warning: Failed to download regions.json, using existing file if available'" }, "dependencies": { "@contentstack/core": "^1.3.1", @@ -45,7 +45,8 @@ "files": [ "dist", "package.json", - "README.md" + "README.md", + "src/assets/regions.json" ], "devDependencies": { "@nrwl/jest": "^17.3.2", diff --git a/src/lib/utils.ts b/src/lib/utils.ts index 87502df..43d4892 100644 --- a/src/lib/utils.ts +++ b/src/lib/utils.ts @@ -1,5 +1,5 @@ import { Region, params } from './types'; -import regionsData from '../../regions.json'; +import regionsData from '../assets/regions.json'; export function getHostforRegion(cloudRegion: string = "aws_na", host?: string): string { if (host) return host; diff --git a/tsup.config.js b/tsup.config.js index c1f5834..b2a6de2 100644 --- a/tsup.config.js +++ b/tsup.config.js @@ -1,6 +1,8 @@ import { defineConfig } from 'tsup' import { esbuildPluginFilePathExtensions } from 'esbuild-plugin-file-path-extensions' import packageJson from './package.json' assert { type: "json" }; +import { copyFileSync, existsSync, mkdirSync } from 'fs'; +import { dirname, join } from 'path'; export default defineConfig([ modernConfig({ @@ -30,7 +32,21 @@ function modernConfig(opts) { replace: { '{{VERSION}}': `"${packageJson.version}"`, }, - esbuildPlugins: [esbuildPluginFilePathExtensions({ esmExtension: 'js' })] + esbuildPlugins: [esbuildPluginFilePathExtensions({ esmExtension: 'js' })], + onSuccess: async () => { + // Copy regions.json to dist/modern/assets/ (industry standard structure) + const sourceFile = 'src/assets/regions.json'; + const targetFile = join('dist/modern/assets', 'regions.json'); + + if (existsSync(sourceFile)) { + const targetDir = dirname(targetFile); + if (!existsSync(targetDir)) { + mkdirSync(targetDir, { recursive: true }); + } + copyFileSync(sourceFile, targetFile); + console.log('✓ Copied regions.json to dist/modern/assets'); + } + } } } @@ -54,5 +70,19 @@ function legacyConfig(opts) { options.jsxImportSource = 'preact'; options.jsx = 'automatic' }, + onSuccess: async () => { + // Copy regions.json to dist/legacy/assets/ (industry standard structure) + const sourceFile = 'src/assets/regions.json'; + const targetFile = join('dist/legacy/assets', 'regions.json'); + + if (existsSync(sourceFile)) { + const targetDir = dirname(targetFile); + if (!existsSync(targetDir)) { + mkdirSync(targetDir, { recursive: true }); + } + copyFileSync(sourceFile, targetFile); + console.log('✓ Copied regions.json to dist/legacy/assets'); + } + } } } \ No newline at end of file From f2594bd0d9b020a744a2bd6ee8a96e3a89e3d1b4 Mon Sep 17 00:00:00 2001 From: Nadeem Patwekar Date: Wed, 29 Oct 2025 01:26:41 +0530 Subject: [PATCH 4/4] chore: update axios version to 1.13.1 in package.json and package-lock.json --- .talismanrc | 2 +- package-lock.json | 12 ++++++------ package.json | 2 +- 3 files changed, 8 insertions(+), 8 deletions(-) diff --git a/.talismanrc b/.talismanrc index df41198..ea390f5 100644 --- a/.talismanrc +++ b/.talismanrc @@ -1,6 +1,6 @@ fileignoreconfig: - filename: package-lock.json - checksum: 2d01a92de8d55b56ba719b8c1a497ecda99b084d9a0f35687a363d99265a1d7c + checksum: 275bc45fd72f2a19f8634536e1e0ea3d6516ea554178d172f9e64d01521b06f7 - filename: test/unit/contentstack.spec.ts checksum: d5b99c01459ab8bc597baaa9e6cc4aa91ac6d9bf78af08e1d0220d0c5db3d0b3 - filename: test/unit/utils.spec.ts diff --git a/package-lock.json b/package-lock.json index ae1c7a7..54e7d2a 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,18 +1,18 @@ { "name": "@contentstack/delivery-sdk", - "version": "4.9.0", + "version": "4.10.1", "lockfileVersion": 3, "requires": true, "packages": { "": { "name": "@contentstack/delivery-sdk", - "version": "4.9.0", + "version": "4.10.1", "hasInstallScript": true, "license": "MIT", "dependencies": { "@contentstack/core": "^1.3.1", "@contentstack/utils": "^1.5.0", - "axios": "^1.11.0", + "axios": "^1.13.1", "humps": "^2.0.1" }, "devDependencies": { @@ -4973,9 +4973,9 @@ "license": "MIT" }, "node_modules/axios": { - "version": "1.11.0", - "resolved": "https://registry.npmjs.org/axios/-/axios-1.11.0.tgz", - "integrity": "sha512-1Lx3WLFQWm3ooKDYZD1eXmoGO9fxYQjrycfHFC8P0sCfQVXyROp0p9PFWBehewBOdCwHc+f/b8I0fMto5eSfwA==", + "version": "1.13.1", + "resolved": "https://registry.npmjs.org/axios/-/axios-1.13.1.tgz", + "integrity": "sha512-hU4EGxxt+j7TQijx1oYdAjw4xuIp1wRQSsbMFwSthCWeBQur1eF+qJ5iQ5sN3Tw8YRzQNKb8jszgBdMDVqwJcw==", "license": "MIT", "peer": true, "dependencies": { diff --git a/package.json b/package.json index 63c8268..346d6f6 100644 --- a/package.json +++ b/package.json @@ -39,7 +39,7 @@ "dependencies": { "@contentstack/core": "^1.3.1", "@contentstack/utils": "^1.5.0", - "axios": "^1.11.0", + "axios": "^1.13.1", "humps": "^2.0.1" }, "files": [