@contentstack/delivery-sdk 4.11.0 → 4.11.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md
CHANGED
|
@@ -66,6 +66,63 @@ You will need to specify the API key, Delivery Token, and Environment Name of yo
|
|
|
66
66
|
|
|
67
67
|
Once you have initialized the SDK, you can start getting content in your app.
|
|
68
68
|
|
|
69
|
+
#### Region and Host Configuration
|
|
70
|
+
|
|
71
|
+
The SDK supports region and custom host configuration to connect to different Contentstack data centers or custom endpoints.
|
|
72
|
+
|
|
73
|
+
**Region Support**
|
|
74
|
+
|
|
75
|
+
You can specify a region to connect to the appropriate Contentstack data center. Available regions are:
|
|
76
|
+
- `US` (default) - Uses `cdn.contentstack.io`
|
|
77
|
+
- `EU` - Uses `eu-cdn.contentstack.com`
|
|
78
|
+
- `AU` - Uses `au-cdn.contentstack.com`
|
|
79
|
+
- `AZURE_NA` - Uses `azure-na-cdn.contentstack.com`
|
|
80
|
+
- `AZURE_EU` - Uses `azure-eu-cdn.contentstack.com`
|
|
81
|
+
- `GCP_NA` - Uses `gcp-na-cdn.contentstack.com`
|
|
82
|
+
- `GCP_EU` - Uses `gcp-eu-cdn.contentstack.com`
|
|
83
|
+
|
|
84
|
+
```typescript
|
|
85
|
+
import contentstack, { Region } from '@contentstack/delivery-sdk'
|
|
86
|
+
|
|
87
|
+
// Using region enum
|
|
88
|
+
const stack = contentstack.stack({
|
|
89
|
+
apiKey: "apiKey",
|
|
90
|
+
deliveryToken: "deliveryToken",
|
|
91
|
+
environment: "environment",
|
|
92
|
+
region: Region.EU
|
|
93
|
+
});
|
|
94
|
+
|
|
95
|
+
// Using region string
|
|
96
|
+
const stack = contentstack.stack({
|
|
97
|
+
apiKey: "apiKey",
|
|
98
|
+
deliveryToken: "deliveryToken",
|
|
99
|
+
environment: "environment",
|
|
100
|
+
region: "eu"
|
|
101
|
+
});
|
|
102
|
+
```
|
|
103
|
+
|
|
104
|
+
**Custom Host Support**
|
|
105
|
+
|
|
106
|
+
You can specify a custom host to connect to a custom endpoint. If a custom host is provided, it takes priority over the region-based host.
|
|
107
|
+
|
|
108
|
+
```typescript
|
|
109
|
+
const stack = contentstack.stack({
|
|
110
|
+
apiKey: "apiKey",
|
|
111
|
+
deliveryToken: "deliveryToken",
|
|
112
|
+
environment: "environment",
|
|
113
|
+
host: "custom-cdn.example.com"
|
|
114
|
+
});
|
|
115
|
+
|
|
116
|
+
// Custom host with region (host takes priority)
|
|
117
|
+
const stack = contentstack.stack({
|
|
118
|
+
apiKey: "apiKey",
|
|
119
|
+
deliveryToken: "deliveryToken",
|
|
120
|
+
environment: "environment",
|
|
121
|
+
region: Region.EU,
|
|
122
|
+
host: "custom-cdn.example.com"
|
|
123
|
+
});
|
|
124
|
+
```
|
|
125
|
+
|
|
69
126
|
#### Querying content from your stack
|
|
70
127
|
|
|
71
128
|
To get a single entry, you need to specify the content type as well as the ID of the entry.
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@contentstack/delivery-sdk",
|
|
3
|
-
"version": "4.11.
|
|
3
|
+
"version": "4.11.2",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"main": "./dist/legacy/index.cjs",
|
|
@@ -24,7 +24,18 @@
|
|
|
24
24
|
"test": "jest ./test/unit",
|
|
25
25
|
"test:unit": "jest ./test/unit",
|
|
26
26
|
"test:api": "jest ./test/api",
|
|
27
|
+
"test:browser": "jest --config jest.config.browser.ts",
|
|
28
|
+
"test:e2e": "node test/e2e/build-browser-bundle.js && playwright test",
|
|
29
|
+
"test:e2e:ui": "node test/e2e/build-browser-bundle.js && playwright test --ui",
|
|
30
|
+
"test:api:report": "jest ./test/api --json --outputFile=test-results/jest-results.json",
|
|
31
|
+
"test:bundlers:report": "cd test/bundlers && ./run-with-report.sh",
|
|
32
|
+
"test:cicd": "mkdir -p test-results && npm run test:api:report && npm run test:bundlers:report && npm run test:e2e && node test/reporting/generate-unified-report.js",
|
|
33
|
+
"test:cicd:no-browser": "mkdir -p test-results && npm run test:api:report && npm run test:bundlers:report && node test/reporting/generate-unified-report.js",
|
|
34
|
+
"test:all": "npm run test:unit && npm run test:browser && npm run test:api",
|
|
27
35
|
"test:sanity-report": "node sanity-report.mjs",
|
|
36
|
+
"validate:browser": "node scripts/validate-browser-safe.js",
|
|
37
|
+
"validate:bundlers": "cd test/bundlers && ./validate-all.sh",
|
|
38
|
+
"validate:all": "npm run validate:browser && npm run validate:bundlers",
|
|
28
39
|
"lint": "eslint . -c .eslintrc.json",
|
|
29
40
|
"clean": "node tools/cleanup",
|
|
30
41
|
"package": "npm run build && npm pack",
|
|
@@ -32,21 +43,24 @@
|
|
|
32
43
|
"build:cjs": "node tools/cleanup cjs && tsc -p config/tsconfig.cjs.json && node tools/rename-cjs.cjs",
|
|
33
44
|
"build:esm": "node tools/cleanup esm && tsc -p config/tsconfig.esm.json",
|
|
34
45
|
"build:types": "node tools/cleanup types && tsc -p config/tsconfig.types.json",
|
|
35
|
-
"husky-check": "npm run build && husky && chmod +x .husky/pre-commit"
|
|
46
|
+
"husky-check": "npm run build && husky && chmod +x .husky/pre-commit",
|
|
47
|
+
"prerelease": "npm run test:all && npm run validate:all"
|
|
36
48
|
},
|
|
37
49
|
"dependencies": {
|
|
38
|
-
"@contentstack/core": "^1.3.
|
|
39
|
-
"@contentstack/utils": "^1.
|
|
40
|
-
"axios": "^1.13.
|
|
50
|
+
"@contentstack/core": "^1.3.10",
|
|
51
|
+
"@contentstack/utils": "^1.7.0",
|
|
52
|
+
"axios": "^1.13.5",
|
|
41
53
|
"humps": "^2.0.1"
|
|
42
54
|
},
|
|
43
55
|
"files": [
|
|
44
56
|
"dist",
|
|
45
57
|
"package.json",
|
|
46
|
-
"README.md"
|
|
58
|
+
"README.md",
|
|
59
|
+
"src/assets/regions.json"
|
|
47
60
|
],
|
|
48
61
|
"devDependencies": {
|
|
49
|
-
"@nrwl/jest": "^
|
|
62
|
+
"@nrwl/jest": "^19.8.14",
|
|
63
|
+
"@playwright/test": "^1.57.0",
|
|
50
64
|
"@slack/bolt": "^4.4.0",
|
|
51
65
|
"@types/humps": "^2.0.6",
|
|
52
66
|
"@types/jest": "^29.5.14",
|
|
@@ -55,6 +69,7 @@
|
|
|
55
69
|
"babel-jest": "^29.7.0",
|
|
56
70
|
"dotenv": "^16.6.1",
|
|
57
71
|
"esbuild-plugin-file-path-extensions": "^2.1.4",
|
|
72
|
+
"http-server": "^14.1.1",
|
|
58
73
|
"husky": "^9.1.7",
|
|
59
74
|
"ignore-loader": "^0.1.2",
|
|
60
75
|
"jest": "^29.7.0",
|