Skip to content

feat/gcp eu support #144

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 3 commits into from
Mar 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
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
### Version: 4.6.0
#### Date: March-10-2025
Enh: Added GCP-EU support

### Version: 4.4.4
#### Date: January-06-2025
Enh: Include References on Entry UID
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/delivery-sdk",
"version": "4.5.1",
"version": "4.6.0",
"type": "module",
"license": "MIT",
"main": "./dist/legacy/index.cjs",
Expand Down
1 change: 1 addition & 0 deletions src/lib/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ export enum Region {
AZURE_NA = 'azure-na',
AZURE_EU = 'azure-eu',
GCP_NA = 'gcp-na',
GCP_EU = 'gcp-eu',
}
export interface StackConfig extends HttpClientParams {
host?: string;
Expand Down
6 changes: 5 additions & 1 deletion test/unit/utils.spec.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { Region } from '../../src/lib/types';
import { getHost } from '../../src/lib/utils';
import { DUMMY_URL, HOST_EU_REGION, HOST_GCP_NA_REGION, HOST_URL, MOCK_CLIENT_OPTIONS } from '../utils/constant';
import { DUMMY_URL, HOST_EU_REGION, HOST_GCP_NA_REGION, HOST_URL, MOCK_CLIENT_OPTIONS, HOST_GCP_EU_REGION } from '../utils/constant';
import { httpClient, AxiosInstance } from '@contentstack/core';
import MockAdapter from 'axios-mock-adapter';
import { assetQueryFindResponseDataMock } from '../utils/mocks';
Expand All @@ -22,6 +22,10 @@ describe('Utils', () => {
const url = getHost(Region.GCP_NA);
expect(url).toEqual(HOST_GCP_NA_REGION);
});
it('should return 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);
Expand Down
1 change: 1 addition & 0 deletions test/utils/constant.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,5 +4,6 @@ export const CUSTOM_HOST = 'example-cdn.csnonprod.com';
export const HOST_EU_REGION = 'eu-cdn.contentstack.com';
export const HOST_AZURE_NA_REGION = 'azure-na-cdn.contentstack.com';
export const HOST_GCP_NA_REGION = 'gcp-na-cdn.contentstack.com';
export const HOST_GCP_EU_REGION = 'gcp-eu-cdn.contentstack.com';
export const DUMMY_URL = 'www.example.com';
export const MOCK_CLIENT_OPTIONS = { defaultHostname: HOST_URL, params: { environment: 'env' } };