contentful-management 11.64.0-new-beta.3 → 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.
Files changed (36) hide show
  1. package/README.md +47 -29
  2. package/dist/browser/index.js +23417 -0
  3. package/dist/browser/index.js.map +1 -0
  4. package/dist/browser/index.min.js +2 -0
  5. package/dist/browser/index.min.js.map +1 -0
  6. package/dist/cjs/index.cjs +1 -4
  7. package/dist/cjs/index.cjs.map +1 -1
  8. package/dist/esm/adapters/REST/endpoints/app-upload.mjs.map +1 -1
  9. package/dist/esm/adapters/REST/endpoints/upload.mjs.map +1 -1
  10. package/dist/esm/adapters/REST/rest-adapter.mjs +0 -2
  11. package/dist/esm/adapters/REST/rest-adapter.mjs.map +1 -1
  12. package/dist/esm/common-types.mjs.map +1 -1
  13. package/dist/esm/create-environment-api.mjs.map +1 -1
  14. package/dist/esm/create-organization-api.mjs.map +1 -1
  15. package/dist/esm/entities/asset.mjs.map +1 -1
  16. package/dist/esm/index.mjs +1 -1
  17. package/dist/esm/methods/action.mjs +0 -1
  18. package/dist/esm/methods/action.mjs.map +1 -1
  19. package/dist/types/adapters/REST/endpoints/app-upload.js.map +1 -1
  20. package/dist/types/adapters/REST/endpoints/upload.js.map +1 -1
  21. package/dist/types/adapters/REST/rest-adapter.js +0 -2
  22. package/dist/types/adapters/REST/rest-adapter.js.map +1 -1
  23. package/dist/types/common-types.d.ts +2 -3
  24. package/dist/types/common-types.js.map +1 -1
  25. package/dist/types/create-environment-api.d.ts +1 -2
  26. package/dist/types/create-environment-api.js.map +1 -1
  27. package/dist/types/create-organization-api.d.ts +1 -2
  28. package/dist/types/create-organization-api.js.map +1 -1
  29. package/dist/types/entities/asset.d.ts +1 -2
  30. package/dist/types/entities/asset.js.map +1 -1
  31. package/dist/types/index.js +1 -1
  32. package/dist/types/methods/action.js +0 -1
  33. package/dist/types/methods/action.js.map +1 -1
  34. package/dist/types/plain/entities/app-upload.d.ts +1 -2
  35. package/dist/types/plain/entities/upload.d.ts +1 -2
  36. package/package.json +15 -8
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
- - [Alternative plain API](#alternative-plain-api)
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
- - node.js (LTS)
82
+ - Chrome v110+
83
+ - Firefox v110+
84
+ - Edge v110+
85
+ - Safari v16.4+
86
+ - Node.js (LTS)
87
87
 
88
- Other browsers should also work, but at the moment we're only running automated tests on the browsers and Node.js versions specified above.
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 browsers, we recommend to download the library via npm or yarn to ensure 100% availability.
120
+ For most modern web applications, we recommend to download and install the library via npm or yarn as described above.
120
121
 
121
- If you'd like to use a standalone built file you can use the following script tag or download it from [jsDelivr](https://www.jsdelivr.com/package/npm/contentful-management), under the `dist` directory:
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@latest/dist/contentful-management.browser.min.js"></script>
125
+ <script src="https://cdn.jsdelivr.net/npm/contentful-management@12"></script>
125
126
  ```
126
127
 
127
- **It's not recommended to use the above URL for production.**
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
- Using `contentful@latest` will always get you the latest version, but you can also specify a specific version number:
131
+ The Contentful Management library will be accessible via the `contentfulManagement` global variable:
130
132
 
131
- ```html
132
- <!-- Avoid using the following url for production. You can not rely on its availability. -->
133
- <script src="https://cdn.jsdelivr.net/npm/contentful-management@7.3.0/dist/contentful-management.browser.min.js"></script>
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 also comes with typings to use with typescript.
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 contentful from 'contentful-management'
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
- const contentful = require('contentful-management')
175
- const plainClient = contentful.createClient(
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 = contentful.createClient(
215
+ const scopedPlainClient = createClient(
198
216
  {
199
217
  accessToken: 'YOUR_ACCESS_TOKEN',
200
218
  },
@@ -215,7 +233,7 @@ const entries = await scopedPlainClient.entry.getMany({
215
233
  },
216
234
  })
217
235
  ```
218
-
236
+
219
237
  You can try and change the above example on [Runkit](https://npm.runkit.com/contentful-management).
220
238
 
221
239
  The benefits of using the "plain" version of the client, over the legacy version, are:
@@ -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
- const contentful = require('contentful-management')
235
- const client = contentful.createClient({
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
- contentful.createClient({
329
+ createClient({
312
330
  ... your config here ...
313
331
  })
314
332
  ```