@contentful/optimization-node 1.1.0 → 1.2.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 CHANGED
@@ -1,6 +1,6 @@
1
1
  <p align="center">
2
2
  <a href="https://www.contentful.com/developers/docs/personalization/">
3
- <img alt="Contentful Logo" title="Contentful" src="https://raw.githubusercontent.com/contentful/optimization/optimization-node-v1.1.0/contentful-icon.png" width="150">
3
+ <img alt="Contentful Logo" title="Contentful" src="https://raw.githubusercontent.com/contentful/optimization/optimization-node-v1.2.0/contentful-icon.png" width="150">
4
4
  </a>
5
5
  </p>
6
6
 
@@ -11,12 +11,12 @@
11
11
  <div align="center">
12
12
 
13
13
  [Guides](https://contentful.github.io/optimization/documents/Documentation.Guides.html) ·
14
- [Reference](https://contentful.github.io/optimization) · [Contributing](https://github.com/contentful/optimization/blob/optimization-node-v1.1.0/CONTRIBUTING.md)
14
+ [Reference](https://contentful.github.io/optimization) · [Contributing](https://github.com/contentful/optimization/blob/optimization-node-v1.2.0/CONTRIBUTING.md)
15
15
 
16
16
  </div>
17
17
 
18
18
  The Optimization Node SDK implements stateless server-side optimization behavior on top of the
19
- [Optimization Core SDK](https://github.com/contentful/optimization/blob/optimization-node-v1.1.0/packages/universal/core-sdk/README.md). Use it for server rendering, server
19
+ [Optimization Core SDK](https://github.com/contentful/optimization/blob/optimization-node-v1.2.0/packages/universal/core-sdk/README.md). Use it for server rendering, server
20
20
  functions, and Node services that need request-scoped profile evaluation or event emission.
21
21
 
22
22
  If you are integrating a Node application, start with [Getting Started](#getting-started), then use
@@ -104,7 +104,7 @@ are part of the same application.
104
104
 
105
105
  The Node SDK is stateless. It does not maintain consent, profile, or browser persistence state
106
106
  between requests. For cross-SDK consent guidance, see
107
- [Consent management in the Optimization SDK Suite](https://github.com/contentful/optimization/blob/optimization-node-v1.1.0/documentation/concepts/consent-management-in-the-optimization-sdk-suite.md).
107
+ [Consent management in the Optimization SDK Suite](https://github.com/contentful/optimization/blob/optimization-node-v1.2.0/documentation/concepts/consent-management-in-the-optimization-sdk-suite.md).
108
108
 
109
109
  | Option | Required? | Default | Description |
110
110
  | ------------------- | --------- | ---------------------- | ----------------------------------------------------------- |
@@ -222,10 +222,10 @@ to `forRequest()`.
222
222
 
223
223
  ### Content resolution
224
224
 
225
- When a `contentful.js` client is available, prefer SDK-managed fetching by entry ID. Configure the
226
- client once, then call `fetchOptimizedEntry()` on a request-bound client after an accepted
227
- Experience API call. `forRequest()` clients use the latest selected optimizations when omitted;
228
- singleton calls require explicit `selectedOptimizations`.
225
+ When a `contentful.js` client is available, prefer SDK-managed fetching by entry ID or content type
226
+ and slug. Configure the client once, then call `fetchOptimizedEntry()` on a request-bound client
227
+ after an accepted Experience API call. `forRequest()` clients use the latest selected optimizations
228
+ when omitted; singleton calls require explicit `selectedOptimizations`.
229
229
 
230
230
  ```ts
231
231
  const optimization = new ContentfulOptimization({
@@ -237,12 +237,19 @@ const optimization = new ContentfulOptimization({
237
237
 
238
238
  const requestOptimization = optimization.forRequest({ consent: true, profile })
239
239
  await requestOptimization.page()
240
- const { baselineEntry, entry } = await requestOptimization.fetchOptimizedEntry('hero-entry')
240
+ const { baselineEntry, entry } = await requestOptimization.fetchOptimizedEntry({
241
+ contentType: 'productPage',
242
+ slug: req.params.slug,
243
+ entryQuery: { locale: appLocale },
244
+ })
241
245
  ```
242
246
 
243
247
  Use `fetchContentfulEntries()` or `prefetchManagedEntries()` when a route knows several managed
244
- entry IDs. Entries with the same normalized query share one `getEntries()` call; same-tick
245
- single-entry calls can join that batch. Large `getEntries()` fetches are split into 100-ID chunks.
248
+ entry sources. A slug source accepts `slugField` when the content model does not use the default
249
+ `slug` field. Slug lookup enforces its content-type, field selector, and two-result uniqueness limit
250
+ after merging `entryQuery`; successful resolution uses the fetched entry's `sys.id`. Slug handoffs
251
+ nest the normalized descriptor under `managedEntry` and retain that ID in `entryId`. Equivalent ID
252
+ sources retain same-query batching and 100-ID chunking.
246
253
 
247
254
  If your application already fetched the baseline entry, keep using the manual resolver:
248
255
 
@@ -308,9 +315,9 @@ package directory.
308
315
  step-by-step server-side integration guide
309
316
  - [Node SDK generated reference](https://contentful.github.io/optimization/modules/_contentful_optimization-node.html) -
310
317
  exported API reference
311
- - [Node reference implementation](https://github.com/contentful/optimization/blob/optimization-node-v1.1.0/implementations/node-sdk/README.md) - server-rendered
318
+ - [Node reference implementation](https://github.com/contentful/optimization/blob/optimization-node-v1.2.0/implementations/node-sdk/README.md) - server-rendered
312
319
  implementation using request-scoped SDK calls
313
- - [Node + Web reference implementation](https://github.com/contentful/optimization/blob/optimization-node-v1.1.0/implementations/node-sdk+web-sdk/README.md) -
320
+ - [Node + Web reference implementation](https://github.com/contentful/optimization/blob/optimization-node-v1.2.0/implementations/node-sdk+web-sdk/README.md) -
314
321
  hybrid SSR and browser implementation
315
- - [Optimization Web SDK](https://github.com/contentful/optimization/blob/optimization-node-v1.1.0/packages/web/web-sdk/README.md) - browser SDK used when the same application
322
+ - [Optimization Web SDK](https://github.com/contentful/optimization/blob/optimization-node-v1.2.0/packages/web/web-sdk/README.md) - browser SDK used when the same application
316
323
  also needs client-side consent, persistence, tracking, or live updates
package/dist/260.mjs CHANGED
@@ -1,4 +1,4 @@
1
- const OPTIMIZATION_NODE_SDK_VERSION = "1.1.0";
1
+ const OPTIMIZATION_NODE_SDK_VERSION = "1.2.0";
2
2
  const OPTIMIZATION_NODE_SDK_NAME = "@contentful/optimization-node";
3
3
  export { ANONYMOUS_ID_COOKIE, ANONYMOUS_ID_KEY } from "@contentful/optimization-core/constants";
4
4
  export { OPTIMIZATION_NODE_SDK_NAME, OPTIMIZATION_NODE_SDK_VERSION };
@@ -30,7 +30,7 @@ __webpack_require__.d(__webpack_exports__, {
30
30
  OPTIMIZATION_NODE_SDK_VERSION: ()=>OPTIMIZATION_NODE_SDK_VERSION
31
31
  });
32
32
  const constants_namespaceObject = require("@contentful/optimization-core/constants");
33
- const OPTIMIZATION_NODE_SDK_VERSION = "1.1.0";
33
+ const OPTIMIZATION_NODE_SDK_VERSION = "1.2.0";
34
34
  const OPTIMIZATION_NODE_SDK_NAME = "@contentful/optimization-node";
35
35
  exports.ANONYMOUS_ID_COOKIE = __webpack_exports__.ANONYMOUS_ID_COOKIE;
36
36
  exports.ANONYMOUS_ID_KEY = __webpack_exports__.ANONYMOUS_ID_KEY;
package/dist/index.cjs CHANGED
@@ -6,7 +6,7 @@ var __webpack_modules__ = {
6
6
  OPTIMIZATION_NODE_SDK_VERSION: ()=>OPTIMIZATION_NODE_SDK_VERSION
7
7
  });
8
8
  require("@contentful/optimization-core/constants");
9
- const OPTIMIZATION_NODE_SDK_VERSION = "1.1.0";
9
+ const OPTIMIZATION_NODE_SDK_VERSION = "1.2.0";
10
10
  const OPTIMIZATION_NODE_SDK_NAME = "@contentful/optimization-node";
11
11
  }
12
12
  };
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@contentful/optimization-node",
3
3
  "description": "Node.js SDK for Contentful Optimization",
4
- "version": "1.1.0",
4
+ "version": "1.2.0",
5
5
  "license": "MIT",
6
6
  "repository": {
7
7
  "type": "git",
@@ -88,6 +88,6 @@
88
88
  }
89
89
  },
90
90
  "dependencies": {
91
- "@contentful/optimization-core": "1.1.0"
91
+ "@contentful/optimization-core": "1.2.0"
92
92
  }
93
93
  }