contentful 11.9.0-testing-oidc-trusted-publishing.1 → 11.10.0
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 +35 -10
- package/dist/contentful.browser.js +323 -215
- package/dist/contentful.browser.min.js +1 -1
- package/dist/contentful.cjs +87 -6
- package/dist/esm/contentful.js +1 -1
- package/dist/esm/create-contentful-api.js +13 -1
- package/dist/esm/utils/normalize-cursor-pagination-parameters.js +9 -0
- package/dist/esm/utils/normalize-cursor-pagination-response.js +23 -0
- package/dist/esm/utils/timeline-preview-helpers.js +2 -2
- package/dist/stats-browser-min.html +1 -1
- package/dist/types/contentful.d.ts +11 -1
- package/dist/types/types/asset.d.ts +9 -1
- package/dist/types/types/client.d.ts +48 -3
- package/dist/types/types/collection.d.ts +36 -9
- package/dist/types/types/concept-scheme.d.ts +2 -11
- package/dist/types/types/concept.d.ts +2 -11
- package/dist/types/types/entry.d.ts +16 -1
- package/dist/types/types/query/query.d.ts +28 -4
- package/dist/types/utils/normalize-cursor-pagination-parameters.d.ts +5 -0
- package/dist/types/utils/normalize-cursor-pagination-response.d.ts +2 -0
- package/package.json +7 -15
package/README.md
CHANGED
|
@@ -31,8 +31,8 @@
|
|
|
31
31
|
<a href="LICENSE">
|
|
32
32
|
<img src="https://img.shields.io/badge/license-MIT-brightgreen.svg" alt="MIT License" />
|
|
33
33
|
</a>
|
|
34
|
-
<a href="https://
|
|
35
|
-
<img src="https://
|
|
34
|
+
<a href="https://github.com/contentful/contentful.js/actions?query=branch%3Amaster">
|
|
35
|
+
<img src="https://github.com/contentful/contentful.js/actions/workflows/main.yaml/badge.svg">
|
|
36
36
|
</a>
|
|
37
37
|
<a href="https://www.npmjs.com/package/contentful">
|
|
38
38
|
<img src="https://img.shields.io/npm/v/contentful.svg" alt="NPM">
|
|
@@ -68,17 +68,20 @@ JavaScript library for the Contentful [Content Delivery API](https://www.content
|
|
|
68
68
|
- [Your first request](#your-first-request)
|
|
69
69
|
- [Using this library with the Preview API](#using-this-library-with-the-preview-api)
|
|
70
70
|
- [Authentication](#authentication)
|
|
71
|
+
- [Cursor-based Pagination](#cursor-based-pagination)
|
|
71
72
|
- [Documentation \& References](#documentation--references)
|
|
72
73
|
- [Configuration](#configuration)
|
|
73
74
|
- [Request configuration options](#request-configuration-options)
|
|
74
75
|
- [Response configuration options](#response-configuration-options)
|
|
76
|
+
- [Timeline Preview](#timeline-preview)
|
|
77
|
+
- [Example](#example)
|
|
75
78
|
- [Client chain modifiers](#client-chain-modifiers)
|
|
76
79
|
- [Entries](#entries)
|
|
77
|
-
- [Example](#example)
|
|
78
|
-
- [Assets](#assets)
|
|
79
80
|
- [Example](#example-1)
|
|
80
|
-
- [
|
|
81
|
+
- [Assets](#assets)
|
|
81
82
|
- [Example](#example-2)
|
|
83
|
+
- [Sync](#sync)
|
|
84
|
+
- [Example](#example-3)
|
|
82
85
|
- [Reference documentation](#reference-documentation)
|
|
83
86
|
- [Tutorials \& other resources](#tutorials--other-resources)
|
|
84
87
|
- [Troubleshooting](#troubleshooting)
|
|
@@ -133,6 +136,7 @@ In order to get started with the Contentful JS library you'll need not only to i
|
|
|
133
136
|
- [Your first request](#your-first-request)
|
|
134
137
|
- [Using this library with the Preview API](#using-this-library-with-the-preview-api)
|
|
135
138
|
- [Authentication](#authentication)
|
|
139
|
+
- [Cursor-based pagination](#cursor-based-pagination)
|
|
136
140
|
- [Documentation & References](#documentation--references)
|
|
137
141
|
|
|
138
142
|
### Installation
|
|
@@ -227,6 +231,29 @@ Don't forget to also get your Space ID.
|
|
|
227
231
|
|
|
228
232
|
For more information, check the [Contentful REST API reference on Authentication](https://www.contentful.com/developers/docs/references/authentication/).
|
|
229
233
|
|
|
234
|
+
### Cursor-based Pagination
|
|
235
|
+
|
|
236
|
+
Cursor-based pagination is supported on collection endpoints for entries and assets:
|
|
237
|
+
|
|
238
|
+
```js
|
|
239
|
+
const response = await client.getEntriesWithCursor({ limit: 10 })
|
|
240
|
+
console.log(response.items) // Array of items
|
|
241
|
+
console.log(response.pages?.next) // Cursor for next page
|
|
242
|
+
```
|
|
243
|
+
|
|
244
|
+
Use the value from `response.pages.next` to fetch the next page or `response.pages.prev` to fetch the previous page.
|
|
245
|
+
|
|
246
|
+
```js
|
|
247
|
+
const nextPageResponse = await client.getEntriesWithCursor({
|
|
248
|
+
limit: 10,
|
|
249
|
+
pageNext: response.pages?.next,
|
|
250
|
+
})
|
|
251
|
+
|
|
252
|
+
console.log(nextPageResponse.items) // Array of items
|
|
253
|
+
console.log(nextPageResponse.pages?.next) // Cursor for next page
|
|
254
|
+
console.log(nextPageResponse.pages?.prev) // Cursor for prev page
|
|
255
|
+
```
|
|
256
|
+
|
|
230
257
|
## Documentation & References
|
|
231
258
|
|
|
232
259
|
- [Configuration](#configuration)
|
|
@@ -292,11 +319,9 @@ const client = contentful.createClient({
|
|
|
292
319
|
accessToken: 'preview_0b7f6x59a0',
|
|
293
320
|
host: 'preview.contentful.com',
|
|
294
321
|
// either release or timestamp or both can be passed as a valid config
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
timestamp: { lte: '2025-11-29T08:46:15Z' },
|
|
299
|
-
},
|
|
322
|
+
timelinePreview: {
|
|
323
|
+
release: { lte: 'black-friday' },
|
|
324
|
+
timestamp: { lte: '2025-11-29T08:46:15Z' },
|
|
300
325
|
},
|
|
301
326
|
})
|
|
302
327
|
```
|