@contentful/experience-delivery 1.0.0-dev.4 → 1.0.0-dev.5
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/LICENSE +21 -0
- package/README.md +25 -18
- package/dist/cjs/BaseClient.js +2 -2
- package/dist/cjs/version.d.ts +1 -1
- package/dist/cjs/version.js +1 -1
- package/dist/esm/BaseClient.mjs +2 -2
- package/dist/esm/version.d.mts +1 -1
- package/dist/esm/version.mjs +1 -1
- package/package.json +7 -4
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 Contentful
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/README.md
CHANGED
|
@@ -10,8 +10,8 @@ A TypeScript client for delivering and previewing Contentful Experiences. Fetch
|
|
|
10
10
|
|
|
11
11
|
- [Installation](#installation)
|
|
12
12
|
- [Reference](#reference)
|
|
13
|
-
- [Authentication](#authentication)
|
|
14
13
|
- [Usage](#usage)
|
|
14
|
+
- [Authentication](#authentication)
|
|
15
15
|
- [Environments](#environments)
|
|
16
16
|
- [Request and Response Types](#request-and-response-types)
|
|
17
17
|
- [Exception Handling](#exception-handling)
|
|
@@ -37,6 +37,30 @@ npm i -s @contentful/experience-delivery
|
|
|
37
37
|
|
|
38
38
|
A full reference for this library is available [here](https://github.com/contentful/contentful-experience-delivery.js/blob/HEAD/./reference.md).
|
|
39
39
|
|
|
40
|
+
## Usage
|
|
41
|
+
|
|
42
|
+
Instantiate the client with a Content Delivery API token and fetch a published
|
|
43
|
+
Experience:
|
|
44
|
+
|
|
45
|
+
```typescript
|
|
46
|
+
import { ContentfulViewDeliveryClient } from "@contentful/experience-delivery";
|
|
47
|
+
|
|
48
|
+
const client = new ContentfulViewDeliveryClient({
|
|
49
|
+
token: process.env.CONTENTFUL_CDA_TOKEN!,
|
|
50
|
+
});
|
|
51
|
+
|
|
52
|
+
const experience = await client.view.getExperience(
|
|
53
|
+
"spaceId",
|
|
54
|
+
"environmentId",
|
|
55
|
+
"experienceId",
|
|
56
|
+
{ locale: "en-US" },
|
|
57
|
+
);
|
|
58
|
+
```
|
|
59
|
+
|
|
60
|
+
See [Authentication](#authentication) for preview tokens and the
|
|
61
|
+
`access_token` query-parameter alternative.
|
|
62
|
+
|
|
63
|
+
|
|
40
64
|
## Authentication
|
|
41
65
|
|
|
42
66
|
The API supports two authentication modes — both backed by a Contentful access token.
|
|
@@ -86,23 +110,6 @@ await client.view.getExperience(spaceId, envId, experienceId, {
|
|
|
86
110
|
```
|
|
87
111
|
|
|
88
112
|
|
|
89
|
-
## Usage
|
|
90
|
-
|
|
91
|
-
Instantiate and use the client with the following:
|
|
92
|
-
|
|
93
|
-
```typescript
|
|
94
|
-
import { ContentfulViewDeliveryClient } from "@contentful/experience-delivery";
|
|
95
|
-
|
|
96
|
-
const client = new ContentfulViewDeliveryClient({ token: "YOUR_TOKEN" });
|
|
97
|
-
await client.view.getExperienceWithOverrides("spaceId", "environmentId", "id", {
|
|
98
|
-
preview: "true",
|
|
99
|
-
accessToken: "access_token",
|
|
100
|
-
optimizationProfileId: "optimization-profile-id",
|
|
101
|
-
locale: "locale",
|
|
102
|
-
variant: "variant"
|
|
103
|
-
});
|
|
104
|
-
```
|
|
105
|
-
|
|
106
113
|
## Environments
|
|
107
114
|
|
|
108
115
|
This SDK allows you to configure different environments for API requests.
|
package/dist/cjs/BaseClient.js
CHANGED
|
@@ -43,8 +43,8 @@ function normalizeClientOptions(options) {
|
|
|
43
43
|
const headers = (0, headers_js_1.mergeHeaders)({
|
|
44
44
|
"X-Fern-Language": "JavaScript",
|
|
45
45
|
"X-Fern-SDK-Name": "@contentful/experience-delivery",
|
|
46
|
-
"X-Fern-SDK-Version": "0.0.0-fern-placeholder.
|
|
47
|
-
"User-Agent": "@contentful/experience-delivery/0.0.0-fern-placeholder.
|
|
46
|
+
"X-Fern-SDK-Version": "0.0.0-fern-placeholder.4",
|
|
47
|
+
"User-Agent": "@contentful/experience-delivery/0.0.0-fern-placeholder.4",
|
|
48
48
|
"X-Fern-Runtime": core.RUNTIME.type,
|
|
49
49
|
"X-Fern-Runtime-Version": core.RUNTIME.version,
|
|
50
50
|
}, options === null || options === void 0 ? void 0 : options.headers);
|
package/dist/cjs/version.d.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export declare const SDK_VERSION = "0.0.0-fern-placeholder.
|
|
1
|
+
export declare const SDK_VERSION = "0.0.0-fern-placeholder.4";
|
package/dist/cjs/version.js
CHANGED
package/dist/esm/BaseClient.mjs
CHANGED
|
@@ -6,8 +6,8 @@ export function normalizeClientOptions(options) {
|
|
|
6
6
|
const headers = mergeHeaders({
|
|
7
7
|
"X-Fern-Language": "JavaScript",
|
|
8
8
|
"X-Fern-SDK-Name": "@contentful/experience-delivery",
|
|
9
|
-
"X-Fern-SDK-Version": "0.0.0-fern-placeholder.
|
|
10
|
-
"User-Agent": "@contentful/experience-delivery/0.0.0-fern-placeholder.
|
|
9
|
+
"X-Fern-SDK-Version": "0.0.0-fern-placeholder.4",
|
|
10
|
+
"User-Agent": "@contentful/experience-delivery/0.0.0-fern-placeholder.4",
|
|
11
11
|
"X-Fern-Runtime": core.RUNTIME.type,
|
|
12
12
|
"X-Fern-Runtime-Version": core.RUNTIME.version,
|
|
13
13
|
}, options === null || options === void 0 ? void 0 : options.headers);
|
package/dist/esm/version.d.mts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export declare const SDK_VERSION = "0.0.0-fern-placeholder.
|
|
1
|
+
export declare const SDK_VERSION = "0.0.0-fern-placeholder.4";
|
package/dist/esm/version.mjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export const SDK_VERSION = "0.0.0-fern-placeholder.
|
|
1
|
+
export const SDK_VERSION = "0.0.0-fern-placeholder.4";
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@contentful/experience-delivery",
|
|
3
|
-
"version": "1.0.0-dev.
|
|
3
|
+
"version": "1.0.0-dev.5",
|
|
4
4
|
"private": false,
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|
|
@@ -74,7 +74,8 @@
|
|
|
74
74
|
"build:cjs": "tsc --project ./tsconfig.cjs.json",
|
|
75
75
|
"build:esm": "tsc --project ./tsconfig.esm.json && node scripts/rename-to-esm-files.js dist/esm",
|
|
76
76
|
"test": "vitest",
|
|
77
|
-
"test:unit": "vitest --project unit"
|
|
77
|
+
"test:unit": "vitest --project unit",
|
|
78
|
+
"update-licenses": "node ./scripts/update-licenses.js"
|
|
78
79
|
},
|
|
79
80
|
"dependencies": {},
|
|
80
81
|
"devDependencies": {
|
|
@@ -83,7 +84,8 @@
|
|
|
83
84
|
"vitest": "^4.1.1",
|
|
84
85
|
"@types/node": "^20.0.0",
|
|
85
86
|
"typescript": "~5.9.3",
|
|
86
|
-
"@biomejs/biome": "2.4.10"
|
|
87
|
+
"@biomejs/biome": "2.4.10",
|
|
88
|
+
"license-checker-rseidelsohn": "^4.4.2"
|
|
87
89
|
},
|
|
88
90
|
"browser": {
|
|
89
91
|
"fs": false,
|
|
@@ -97,5 +99,6 @@
|
|
|
97
99
|
"node": ">=18.0.0"
|
|
98
100
|
},
|
|
99
101
|
"sideEffects": false,
|
|
100
|
-
"description": "TypeScript client for Contentful's Experience Delivery and Preview API"
|
|
102
|
+
"description": "TypeScript client for Contentful's Experience Delivery and Preview API",
|
|
103
|
+
"license": "MIT"
|
|
101
104
|
}
|