Skip to content

Added AWS-AU support #384

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 4 commits into from
Jul 3, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
31 changes: 22 additions & 9 deletions .husky/pre-commit
Original file line number Diff line number Diff line change
@@ -1,11 +1,30 @@
#!/usr/bin/env sh
# Pre-commit hook to run Snyk and Talisman scans, completing both before deciding to commit
# Pre-commit hook to run lint, Snyk and Talisman scans, completing all before deciding to commit

# Function to check if a command exists
command_exists() {
command -v "$1" >/dev/null 2>&1
}

# Allow bypassing the hook with an environment variable
if [ "$SKIP_HOOK" = "1" ]; then
echo "Skipping lint, Snyk and Talisman scans (SKIP_HOOK=1)."
exit 0
fi

# Run ESLint check first
echo "Running ESLint check..."
npm run lint
lint_exit_code=$?

if [ $lint_exit_code -ne 0 ]; then
echo "ESLint check failed. Please fix the linting issues and try again."
echo "You can run 'npm run format' to auto-fix most issues."
exit 1
fi

echo "ESLint check passed."

# Check if Snyk is installed
if ! command_exists snyk; then
echo "Error: Snyk is not installed. Please install it and try again."
Expand All @@ -18,12 +37,6 @@ if ! command_exists talisman; then
exit 1
fi

# Allow bypassing the hook with an environment variable
if [ "$SKIP_HOOK" = "1" ]; then
echo "Skipping Snyk and Talisman scans (SKIP_HOOK=1)."
exit 0
fi

# Initialize variables to track scan results
snyk_failed=false
talisman_failed=false
Expand Down Expand Up @@ -63,7 +76,7 @@ if [ "$snyk_failed" = true ] || [ "$talisman_failed" = true ]; then
exit 1
fi

# If both scans pass, allow the commit
echo "All scans passed. Proceeding with commit.cd ."
# If all checks pass, allow the commit
echo "All checks passed (ESLint, Snyk, Talisman). Proceeding with commit."
rm -f snyk_output.log talisman_output.log
exit 0
29 changes: 4 additions & 25 deletions .talismanrc
Original file line number Diff line number Diff line change
@@ -1,27 +1,6 @@
fileignoreconfig:
- filename: .github/workflows/secrets-scan.yml
ignore_detectors:
- filecontent
- filename: package-lock.json
checksum: 9d0340f9359927d477fe8ab4650642c068c592be63fb817651d866849e0dbbc2
- filename: .husky/pre-commit
checksum: 5baabd7d2c391648163f9371f0e5e9484f8fb90fa2284cfc378732ec3192c193
- filename: .husky/pre-commit
checksum: 52a664f536cf5d1be0bea19cb6031ca6e8107b45b6314fe7d47b7fad7d800632
- filename: test/sanity-check/api/user-test.js
checksum: 6bb8251aad584e09f4d963a913bd0007e5f6e089357a44c3fb1529e3fda5509d
version: ""
fileignoreconfig:
- filename: test/unit/globalField-test.js
checksum: 25185e3400a12e10a043dc47502d8f30b7e1c4f2b6b4d3b8b55cdc19850c48bf
version: "1.0"
fileignoreconfig:
- filename: lib/stack/index.js
checksum: 6aab5edf85efb17951418b4dc4402889cd24c8d786c671185074aeb4d50f0242
- filename: test/sanity-check/api/stack-test.js
checksum: 198d5cf7ead33b079249dc3ecdee61a9c57453e93f1073ed0341400983e5aa53
version: "1.0"
fileignoreconfig:
- filename: test/sanity-check/api/previewToken-test.js
checksum: 9a42e079b7c71f76932896a0d2390d86ac626678ab20d36821dcf962820a886c
- filename: lib/stack/deliveryToken/index.js
checksum: 51ae00f07f4cc75c1cd832b311c2e2482f04a8467a0139da6013ceb88fbdda2f
- filename: lib/stack/deliveryToken/previewToken/index.js
checksum: b506f33bffdd20dfc701f964370707f5d7b28a2c05c70665f0edb7b3c53c165b
version: "1.0"
4 changes: 3 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
# Changelog
## [v1.21.8](https://github.com/contentstack/contentstack-management-javascript/tree/v1.21.8) (2025-07-07)
## [v1.22.0](https://github.com/contentstack/contentstack-management-javascript/tree/v1.22.0) (2025-07-07)
- Enhancement
- AWS-AU Region support added
- Fix
- Fixed branch header conflits
## [v1.21.7](https://github.com/contentstack/contentstack-management-javascript/tree/v1.21.7) (2025-06-30)
Expand Down
1 change: 1 addition & 0 deletions lib/contentstack.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ import httpClient from './core/contentstackHTTPClient.js'
const regionHostMap = {
NA: 'api.contentstack.io',
EU: 'eu-api.contentstack.com',
AU: 'au-api.contentstack.com',
AZURE_NA: 'azure-na-api.contentstack.com',
AZURE_EU: 'azure-eu-api.contentstack.com',
GCP_NA: 'gcp-na-api.contentstack.com',
Expand Down
4 changes: 2 additions & 2 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@contentstack/management",
"version": "1.21.8",
"version": "1.22.0",
"description": "The Content Management API is used to manage the content of your Contentstack account",
"main": "./dist/node/contentstack-management.js",
"browser": "./dist/web/contentstack-management.js",
Expand Down
7 changes: 7 additions & 0 deletions test/sanity-check/api/user-test.js
Original file line number Diff line number Diff line change
Expand Up @@ -111,6 +111,13 @@ describe('Contentstack User Session api Test', () => {
done()
})

it('should get host for AU region', done => {
const client = contentstack.client({ region: 'AU' })
const baseUrl = client.axiosInstance.defaults.baseURL
expect(baseUrl).to.include('au-api.contentstack.com', 'region AU set correctly')
done()
})

it('should get host for AZURE_NA region', done => {
const client = contentstack.client({ region: 'AZURE_NA' })
const baseUrl = client.axiosInstance.defaults.baseURL
Expand Down
1 change: 1 addition & 0 deletions test/unit/Util-test.js
Original file line number Diff line number Diff line change
Expand Up @@ -123,6 +123,7 @@ describe('Get User Agent', () => {
expect(isHost('contentstack.io:2Sdrd')).to.be.equal(true, 'contentstack.io:2Sdrd should be host')
expect(isHost('contentstack.io:wedsfa2')).to.be.equal(true, 'contentstack.io:wedsfa2 should be host')
expect(isHost('eu-api.contentstack.com')).to.be.equal(true, 'eu-api.contentstack.com should be host')
expect(isHost('au-api.contentstack.com')).to.be.equal(true, 'au-api.contentstack.com should be host')
expect(isHost('contentstack.io/path')).to.be.equal(false, 'contentstack.io/path should not host')
done()
})
Expand Down
Loading