Skip to content

Commit 19c872b

Browse files
authored
Merge pull request #103 from contentstack/develop
feat: add support for GCP regions
2 parents 5b24db5 + 745ec4f commit 19c872b

File tree

8 files changed

+5289
-5292
lines changed

8 files changed

+5289
-5292
lines changed

LICENSE

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
MIT License
22

3-
Copyright (c) 2022-2023 Contentstack
3+
Copyright (c) 2022-2024 Contentstack
44

55
Permission is hereby granted, free of charge, to any person obtaining a copy
66
of this software and associated documentation files (the "Software"), to deal

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ For more information, please refer to our [App SDK API Reference](https://github
3232

3333
You can extend or customize the functionality of Contentstack CMS with Marketplace apps. To simplify and speed up the building process, boilerplates describe repetitive elements in a project. This boilerplate will help you build custom applications for your organization or stack.
3434

35-
Download the [boilerplate](https://assets.contentstack.io/v3/assets/blt23180bf2502c7444/blt2bccdd28a2d44d1b/62fcb522da3c526fe6314886/app-boilerplate.zip?disposition=download).
35+
Download the [boilerplate](https://github.com/contentstack/marketplace-app-boilerplate/archive/refs/heads/master.zip).
3636

3737
## UI Locations and Examples
3838

__test__/utils.test.ts

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,10 @@ describe("formatAppRegion", () => {
1818
expect(formatAppRegion("AZURE_EU")).toBe(Region.AZURE_EU);
1919
});
2020

21+
it('should return GCP_NA for "GCP_NA"', () => {
22+
expect(formatAppRegion("GCP_NA")).toBe(Region.GCP_NA);
23+
});
24+
2125
it("should return unknown for any invalid region", () => {
2226
expect(formatAppRegion("invalid")).toBe(Region.UNKNOWN);
2327
});

package-lock.json

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@contentstack/app-sdk",
3-
"version": "2.0.0",
3+
"version": "2.0.1",
44
"types": "dist/src/index.d.ts",
55
"description": "The Contentstack App SDK allows you to customize your Contentstack applications.",
66
"main": "dist/index.js",

src/types.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -229,4 +229,5 @@ export enum Region {
229229
EU = "EU",
230230
AZURE_NA = "AZURE_NA",
231231
AZURE_EU = "AZURE_EU",
232+
GCP_NA = "GCP_NA",
232233
}

src/utils/utils.ts

Lines changed: 3 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -12,18 +12,10 @@ export function onError(error: Error) {
1212
}
1313

1414
export function formatAppRegion(region: string): Region {
15-
switch (region) {
16-
case "NA":
17-
return Region.NA;
18-
case "EU":
19-
return Region.EU;
20-
case "AZURE_NA":
21-
return Region.AZURE_NA;
22-
case "AZURE_EU":
23-
return Region.AZURE_EU;
24-
default:
25-
return Region.UNKNOWN;
15+
if (region && Object.values(Region).includes(region as Region)) {
16+
return region as Region;
2617
}
18+
return Region.UNKNOWN;
2719
}
2820

2921
export function getPreferredBodyElement(nodeCollection: HTMLCollection) {

yarn.lock

Lines changed: 5276 additions & 5276 deletions
Large diffs are not rendered by default.

0 commit comments

Comments
 (0)