contentful-management 11.64.0-new-beta.4 → 11.64.0-new-beta.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/README.md +46 -28
- package/dist/browser/index.js +29 -1990
- package/dist/browser/index.js.map +1 -1
- package/dist/browser/index.min.js +1 -1
- package/dist/browser/index.min.js.map +1 -1
- package/dist/cjs/index.cjs +1 -4
- package/dist/cjs/index.cjs.map +1 -1
- package/dist/esm/adapters/REST/endpoints/app-upload.mjs.map +1 -1
- package/dist/esm/adapters/REST/endpoints/upload.mjs.map +1 -1
- package/dist/esm/adapters/REST/rest-adapter.mjs +0 -2
- package/dist/esm/adapters/REST/rest-adapter.mjs.map +1 -1
- package/dist/esm/common-types.mjs.map +1 -1
- package/dist/esm/create-environment-api.mjs.map +1 -1
- package/dist/esm/create-organization-api.mjs.map +1 -1
- package/dist/esm/entities/asset.mjs.map +1 -1
- package/dist/esm/index.mjs +1 -1
- package/dist/esm/methods/action.mjs +0 -1
- package/dist/esm/methods/action.mjs.map +1 -1
- package/dist/types/adapters/REST/endpoints/app-upload.js.map +1 -1
- package/dist/types/adapters/REST/endpoints/upload.js.map +1 -1
- package/dist/types/adapters/REST/rest-adapter.js +0 -2
- package/dist/types/adapters/REST/rest-adapter.js.map +1 -1
- package/dist/types/common-types.d.ts +2 -3
- package/dist/types/common-types.js.map +1 -1
- package/dist/types/create-environment-api.d.ts +1 -2
- package/dist/types/create-environment-api.js.map +1 -1
- package/dist/types/create-organization-api.d.ts +1 -2
- package/dist/types/create-organization-api.js.map +1 -1
- package/dist/types/entities/asset.d.ts +1 -2
- package/dist/types/entities/asset.js.map +1 -1
- package/dist/types/index.js +1 -1
- package/dist/types/methods/action.js +0 -1
- package/dist/types/methods/action.js.map +1 -1
- package/dist/types/plain/entities/app-upload.d.ts +1 -2
- package/dist/types/plain/entities/upload.d.ts +1 -2
- package/package.json +5 -5
package/README.md
CHANGED
|
@@ -46,13 +46,13 @@
|
|
|
46
46
|
- [Supported Environments](#supported-environments)
|
|
47
47
|
- [Getting Started](#getting-started)
|
|
48
48
|
- [Installation](#installation)
|
|
49
|
-
- [Node](#node
|
|
50
|
-
- [Browser](#browser-)
|
|
49
|
+
- [Node](#node)
|
|
50
|
+
- [Browser](#browser-bundle-in-script-tag)
|
|
51
51
|
- [Typings](#typings)
|
|
52
52
|
- [Authentication](#authentication)
|
|
53
53
|
- [Using ES6 import](#using-es6-import)
|
|
54
54
|
- [Your first Request](#your-first-request)
|
|
55
|
-
- [
|
|
55
|
+
- [Legacy Client Interface](#legacy-client-interface)
|
|
56
56
|
- [App Framework](#app-framework)
|
|
57
57
|
- [Troubleshooting](#troubleshooting)
|
|
58
58
|
- [Documentation/References](#documentationreferences)
|
|
@@ -79,13 +79,13 @@
|
|
|
79
79
|
|
|
80
80
|
Browsers and Node.js:
|
|
81
81
|
|
|
82
|
-
- Chrome
|
|
83
|
-
- Firefox
|
|
84
|
-
- Edge
|
|
85
|
-
- Safari
|
|
86
|
-
-
|
|
82
|
+
- Chrome v110+
|
|
83
|
+
- Firefox v110+
|
|
84
|
+
- Edge v110+
|
|
85
|
+
- Safari v16.4+
|
|
86
|
+
- Node.js (LTS)
|
|
87
87
|
|
|
88
|
-
Other browsers
|
|
88
|
+
Other browsers might work (if they support ES2023), but at the moment we only support the browsers and Node.js versions specified above in 'contentful-management' v12+.
|
|
89
89
|
|
|
90
90
|
# Getting started
|
|
91
91
|
|
|
@@ -94,6 +94,7 @@ To get started with the Contentful Management JS library you'll need to install
|
|
|
94
94
|
- [Installation](#installation)
|
|
95
95
|
- [Authentication](#authentication)
|
|
96
96
|
- [Using ES6 import](#using-es6-import)
|
|
97
|
+
- [Using CommonJS require imports](#using-commonjs-require-imports)
|
|
97
98
|
- [Your first request](#your-first-request)
|
|
98
99
|
- [Troubleshooting](#troubleshooting)
|
|
99
100
|
- [Documentation/References](#documentationreferences)
|
|
@@ -114,32 +115,32 @@ Using [yarn](https://yarnpkg.com/lang/en/):
|
|
|
114
115
|
yarn add contentful-management
|
|
115
116
|
```
|
|
116
117
|
|
|
117
|
-
### Browser:
|
|
118
|
+
### Browser bundle in script tag:
|
|
118
119
|
|
|
119
|
-
For
|
|
120
|
+
For most modern web applications, we recommend to download and install the library via npm or yarn as described above.
|
|
120
121
|
|
|
121
|
-
|
|
122
|
+
However, if you need to include contentful-management via a script tag, we recommend using [jsDelivr](https://www.jsdelivr.com/package/npm/contentful-management) like so:
|
|
122
123
|
|
|
123
124
|
```html
|
|
124
|
-
<script src="https://cdn.jsdelivr.net/npm/contentful-management@
|
|
125
|
+
<script src="https://cdn.jsdelivr.net/npm/contentful-management@12"></script>
|
|
125
126
|
```
|
|
126
127
|
|
|
127
|
-
|
|
128
|
+
> It is recommended to specify the version in the URL.
|
|
129
|
+
> Using 'contentful@{major-version-number}'' will always get you the latest version in that release, but you can also specify a specific version number, ie: 'contentful@11.6.1'
|
|
128
130
|
|
|
129
|
-
|
|
131
|
+
The Contentful Management library will be accessible via the `contentfulManagement` global variable:
|
|
130
132
|
|
|
131
|
-
```
|
|
132
|
-
|
|
133
|
-
|
|
133
|
+
```js
|
|
134
|
+
const client = contentfulManagement.createClient({
|
|
135
|
+
accessToken: 'YOUR_ACCESS_TOKEN',
|
|
136
|
+
})
|
|
134
137
|
```
|
|
135
138
|
|
|
136
|
-
The Contentful Management library will be accessible via the `contentfulManagement` global variable.
|
|
137
|
-
|
|
138
139
|
Check the [releases](https://github.com/contentful/contentful-management.js/releases) page to know which versions are available.
|
|
139
140
|
|
|
140
141
|
## Typings
|
|
141
142
|
|
|
142
|
-
This library
|
|
143
|
+
This library is built in TypeScript and has fully typings available.
|
|
143
144
|
|
|
144
145
|
## Authentication
|
|
145
146
|
|
|
@@ -155,7 +156,24 @@ You can use the es6 import with the library as follows
|
|
|
155
156
|
|
|
156
157
|
```js
|
|
157
158
|
// import createClient directly
|
|
158
|
-
import
|
|
159
|
+
import { createClient } from 'contentful-management'
|
|
160
|
+
const client = createClient(
|
|
161
|
+
{
|
|
162
|
+
// This is the access token for this space. Normally you get the token in the Contentful web app
|
|
163
|
+
accessToken: 'YOUR_ACCESS_TOKEN',
|
|
164
|
+
},
|
|
165
|
+
{ type: 'plain' }
|
|
166
|
+
)
|
|
167
|
+
//....
|
|
168
|
+
```
|
|
169
|
+
|
|
170
|
+
## Using CommonJS require imports
|
|
171
|
+
|
|
172
|
+
You can use the commonjs require with the library as follows
|
|
173
|
+
|
|
174
|
+
```js
|
|
175
|
+
// import createClient directly
|
|
176
|
+
const contentful = require('contentful-management');
|
|
159
177
|
const client = contentful.createClient(
|
|
160
178
|
{
|
|
161
179
|
// This is the access token for this space. Normally you get the token in the Contentful web app
|
|
@@ -171,8 +189,8 @@ const client = contentful.createClient(
|
|
|
171
189
|
Beginning with `contentful-management@7` this library provides a client which exposes all CMA endpoints in a simple flat API surface, as opposed to the waterfall structure exposed by legacy versions of the SDK.
|
|
172
190
|
|
|
173
191
|
```javascript
|
|
174
|
-
|
|
175
|
-
const plainClient =
|
|
192
|
+
import { createClient } from 'contentful-management'
|
|
193
|
+
const plainClient = createClient(
|
|
176
194
|
{
|
|
177
195
|
accessToken: 'YOUR_ACCESS_TOKEN',
|
|
178
196
|
},
|
|
@@ -194,7 +212,7 @@ const entries = await plainClient.entry.getMany({
|
|
|
194
212
|
})
|
|
195
213
|
|
|
196
214
|
// With scoped space and environment
|
|
197
|
-
const scopedPlainClient =
|
|
215
|
+
const scopedPlainClient = createClient(
|
|
198
216
|
{
|
|
199
217
|
accessToken: 'YOUR_ACCESS_TOKEN',
|
|
200
218
|
},
|
|
@@ -231,8 +249,8 @@ The benefits of using the "plain" version of the client, over the legacy version
|
|
|
231
249
|
The following code snippet is an example of the legacy client interface, which reads and writes data as a sequence of nested requests:
|
|
232
250
|
|
|
233
251
|
```js
|
|
234
|
-
|
|
235
|
-
const client =
|
|
252
|
+
import { createClient } from 'contentful-management'
|
|
253
|
+
const client = createClient({
|
|
236
254
|
accessToken: 'YOUR_ACCESS_TOKEN',
|
|
237
255
|
})
|
|
238
256
|
|
|
@@ -308,7 +326,7 @@ To help you get the most out of this library, we've prepared reference documenta
|
|
|
308
326
|
The `createClient` method supports several options you may set to achieve the expected behavior:
|
|
309
327
|
|
|
310
328
|
```js
|
|
311
|
-
|
|
329
|
+
createClient({
|
|
312
330
|
... your config here ...
|
|
313
331
|
})
|
|
314
332
|
```
|