@contentful/optimization-node 0.1.0-alpha → 0.1.0-alpha11
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 +168 -78
- package/dist/260.mjs +6 -0
- package/dist/260.mjs.map +1 -0
- package/dist/987.mjs +2 -0
- package/dist/api-client.cjs +60 -0
- package/dist/api-client.cjs.map +1 -0
- package/dist/api-client.d.cts +4 -0
- package/dist/api-client.d.mts +4 -0
- package/dist/api-client.d.ts +4 -0
- package/dist/api-client.mjs +2 -0
- package/dist/api-schemas.cjs +60 -0
- package/dist/api-schemas.cjs.map +1 -0
- package/dist/api-schemas.d.cts +4 -0
- package/dist/api-schemas.d.mts +4 -0
- package/dist/api-schemas.d.ts +4 -0
- package/dist/api-schemas.mjs +2 -0
- package/dist/constants.cjs +49 -0
- package/dist/constants.cjs.map +1 -0
- package/dist/constants.d.cts +26 -0
- package/dist/constants.d.mts +26 -0
- package/dist/constants.d.ts +26 -0
- package/dist/constants.mjs +1 -0
- package/dist/core-sdk.cjs +60 -0
- package/dist/core-sdk.cjs.map +1 -0
- package/dist/core-sdk.d.cts +4 -0
- package/dist/core-sdk.d.mts +4 -0
- package/dist/core-sdk.d.ts +4 -0
- package/dist/core-sdk.mjs +2 -0
- package/dist/index.cjs +36 -58
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +113 -0
- package/dist/index.d.mts +113 -0
- package/dist/index.d.ts +62 -24
- package/dist/index.mjs +7 -9
- package/dist/index.mjs.map +1 -1
- package/dist/logger.cjs +67 -0
- package/dist/logger.cjs.map +1 -0
- package/dist/logger.d.cts +8 -0
- package/dist/logger.d.mts +8 -0
- package/dist/logger.d.ts +8 -0
- package/dist/logger.mjs +4 -0
- package/package.json +76 -8
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="
|
|
3
|
+
<img alt="Contentful Logo" title="Contentful" src="https://raw.githubusercontent.com/contentful/optimization/v0.1.0-alpha11/contentful-icon.png" width="150">
|
|
4
4
|
</a>
|
|
5
5
|
</p>
|
|
6
6
|
|
|
@@ -10,18 +10,18 @@
|
|
|
10
10
|
|
|
11
11
|
<div align="center">
|
|
12
12
|
|
|
13
|
-
[
|
|
14
|
-
[Contributing](/CONTRIBUTING.md)
|
|
13
|
+
[Guides](https://contentful.github.io/optimization/documents/Guides.html) ·
|
|
14
|
+
[Reference](https://contentful.github.io/optimization) · [Contributing](https://github.com/contentful/optimization/blob/v0.1.0-alpha11/CONTRIBUTING.md)
|
|
15
15
|
|
|
16
16
|
</div>
|
|
17
17
|
|
|
18
18
|
> [!WARNING]
|
|
19
19
|
>
|
|
20
|
-
> The Optimization SDK Suite is
|
|
20
|
+
> The Optimization SDK Suite is pre-release (alpha). Breaking changes may be published at any time.
|
|
21
21
|
|
|
22
22
|
The Optimization Node SDK implements functionality specific to Node environments, based on the
|
|
23
|
-
[Optimization Core Library](/universal/core/README.md). This SDK is part of the
|
|
24
|
-
[Contentful Optimization SDK Suite](/README.md).
|
|
23
|
+
[Optimization Core Library](https://github.com/contentful/optimization/blob/v0.1.0-alpha11/packages/universal/core-sdk/README.md). This SDK is part of the
|
|
24
|
+
[Contentful Optimization SDK Suite](https://github.com/contentful/optimization/blob/v0.1.0-alpha11/README.md).
|
|
25
25
|
|
|
26
26
|
<details>
|
|
27
27
|
<summary>Table of Contents</summary>
|
|
@@ -31,20 +31,22 @@ The Optimization Node SDK implements functionality specific to Node environments
|
|
|
31
31
|
- [Reference Implementations](#reference-implementations)
|
|
32
32
|
- [Configuration](#configuration)
|
|
33
33
|
- [Top-level Configuration Options](#top-level-configuration-options)
|
|
34
|
-
- [
|
|
34
|
+
- [API Options](#api-options)
|
|
35
35
|
- [Event Builder Options](#event-builder-options)
|
|
36
36
|
- [Fetch Options](#fetch-options)
|
|
37
|
-
- [Personalization Options](#personalization-options)
|
|
38
37
|
- [Optimization Methods](#optimization-methods)
|
|
39
|
-
- [
|
|
40
|
-
- [`
|
|
41
|
-
- [`
|
|
38
|
+
- [Optimization Data Resolution Methods](#optimization-data-resolution-methods)
|
|
39
|
+
- [`getFlag`](#getflag)
|
|
40
|
+
- [`resolveOptimizedEntry`](#resolveoptimizedentry)
|
|
42
41
|
- [`getMergeTagValue`](#getmergetagvalue)
|
|
43
|
-
- [
|
|
42
|
+
- [Experience API and Insights API Event Methods](#experience-api-and-insights-api-event-methods)
|
|
44
43
|
- [`identify`](#identify)
|
|
45
44
|
- [`page`](#page)
|
|
45
|
+
- [`screen`](#screen)
|
|
46
46
|
- [`track`](#track)
|
|
47
|
-
- [`
|
|
47
|
+
- [`trackView`](#trackview)
|
|
48
|
+
- [`trackClick`](#trackclick)
|
|
49
|
+
- [`trackHover`](#trackhover)
|
|
48
50
|
- [`trackFlagView`](#trackflagview)
|
|
49
51
|
- [Interceptors](#interceptors)
|
|
50
52
|
- [Life-cycle Interceptors](#life-cycle-interceptors)
|
|
@@ -63,61 +65,93 @@ pnpm install @contentful/optimization-node
|
|
|
63
65
|
Import the Optimization class; both CJS and ESM module systems are supported, ESM preferred:
|
|
64
66
|
|
|
65
67
|
```ts
|
|
66
|
-
import
|
|
68
|
+
import ContentfulOptimization from '@contentful/optimization-node'
|
|
67
69
|
```
|
|
68
70
|
|
|
69
71
|
Configure and initialize the Optimization Node SDK:
|
|
70
72
|
|
|
71
73
|
```ts
|
|
72
|
-
const optimization = new
|
|
74
|
+
const optimization = new ContentfulOptimization({ clientId: 'abc123' })
|
|
75
|
+
const requestOptimization = optimization.forRequest()
|
|
73
76
|
```
|
|
74
77
|
|
|
78
|
+
Create `optimization` once per module or process, then call `optimization.forRequest(...)` once per
|
|
79
|
+
incoming request.
|
|
80
|
+
|
|
81
|
+
For a step-by-step Express-style walkthrough that covers request context, profile persistence,
|
|
82
|
+
Contentful entry resolution, and hybrid Node + browser setups, see
|
|
83
|
+
[Integrating the Optimization Node SDK in a Node App](https://github.com/contentful/optimization/blob/v0.1.0-alpha11/documentation/integrating-the-node-sdk-in-a-node-app.md).
|
|
84
|
+
|
|
85
|
+
## Development Harness
|
|
86
|
+
|
|
87
|
+
The package-local dev harness runs from `packages/node/node-sdk/dev/` and reads `.env` from this
|
|
88
|
+
package directory.
|
|
89
|
+
|
|
90
|
+
1. Start from `.env.example` and create or update `packages/node/node-sdk/.env`.
|
|
91
|
+
2. Prefer the repo-standard `PUBLIC_...` variable names shown in `.env.example`.
|
|
92
|
+
3. Start the harness from the repo root:
|
|
93
|
+
|
|
94
|
+
```sh
|
|
95
|
+
pnpm --filter @contentful/optimization-node dev
|
|
96
|
+
```
|
|
97
|
+
|
|
75
98
|
## Reference Implementations
|
|
76
99
|
|
|
77
100
|
Reference implementations illustrate how the SDK may be used under common scenarios, as well as
|
|
78
101
|
select less-common scenarios, with the most basic example solution possible.
|
|
79
102
|
|
|
80
|
-
- [Node SSR Only](/implementations/node-
|
|
81
|
-
SDK to render
|
|
82
|
-
- [Node SSR + Web Vanilla](/implementations/node-
|
|
83
|
-
demonstrating simple profile synchronization between the Node and
|
|
84
|
-
cookie
|
|
103
|
+
- [Node SSR Only](https://github.com/contentful/optimization/blob/v0.1.0-alpha11/implementations/node-sdk/README.md): Example application that uses the
|
|
104
|
+
Node SDK to render an optimized Web page
|
|
105
|
+
- [Node SSR + Web Vanilla](https://github.com/contentful/optimization/blob/v0.1.0-alpha11/implementations/node-sdk+web-sdk/README.md): Example application
|
|
106
|
+
demonstrating simple profile synchronization between the Node and
|
|
107
|
+
[Web](https://github.com/contentful/optimization/blob/v0.1.0-alpha11/packages/web/web-sdk/README.md) SDKs via cookie
|
|
85
108
|
|
|
86
109
|
## Configuration
|
|
87
110
|
|
|
88
111
|
### Top-level Configuration Options
|
|
89
112
|
|
|
90
|
-
| Option
|
|
91
|
-
|
|
|
92
|
-
| `
|
|
93
|
-
| `app`
|
|
94
|
-
| `clientId`
|
|
95
|
-
| `environment`
|
|
96
|
-
| `eventBuilder`
|
|
97
|
-
| `fetchOptions`
|
|
98
|
-
| `logLevel`
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
|
104
|
-
|
|
|
105
|
-
| `
|
|
113
|
+
| Option | Required? | Default | Description |
|
|
114
|
+
| -------------- | --------- | --------------------------- | ------------------------------------------------------------------------------ |
|
|
115
|
+
| `api` | No | See "API Options" | Unified configuration for the Experience API and Insights API endpoints |
|
|
116
|
+
| `app` | No | `undefined` | The application definition used to attribute events to a specific consumer app |
|
|
117
|
+
| `clientId` | Yes | N/A | Shared API key for Experience API and Insights API requests |
|
|
118
|
+
| `environment` | No | `'main'` | The environment identifier |
|
|
119
|
+
| `eventBuilder` | No | See "Event Builder Options" | Event builder configuration (channel/library metadata, etc.) |
|
|
120
|
+
| `fetchOptions` | No | See "Fetch Options" | Configuration for Fetch timeout and retry functionality |
|
|
121
|
+
| `logLevel` | No | `'error'` | Minimum log level for the default console sink |
|
|
122
|
+
|
|
123
|
+
### API Options
|
|
124
|
+
|
|
125
|
+
| Option | Required? | Default | Description |
|
|
126
|
+
| ------------------- | --------- | ------------------------------------------ | ------------------------------------------------------------ |
|
|
127
|
+
| `experienceBaseUrl` | No | `'https://experience.ninetailed.co/'` | Base URL for the Experience API |
|
|
128
|
+
| `insightsBaseUrl` | No | `'https://ingest.insights.ninetailed.co/'` | Base URL for the Insights API |
|
|
129
|
+
| `enabledFeatures` | No | `['ip-enrichment', 'location']` | Enabled features the Experience API may use for each request |
|
|
130
|
+
|
|
131
|
+
Request-scoped Experience API options are bound with `optimization.forRequest(...)` instead of the
|
|
132
|
+
SDK constructor:
|
|
133
|
+
|
|
134
|
+
| Option | Required? | Default | Description |
|
|
135
|
+
| ----------- | --------- | ----------- | ------------------------------------------------------------------------------ |
|
|
136
|
+
| `ip` | No | `undefined` | IP address override used by the Experience API for location analysis |
|
|
137
|
+
| `locale` | No | `undefined` | Locale used to translate `location.city` and `location.country` |
|
|
138
|
+
| `plainText` | No | `undefined` | Sends performance-critical Experience API endpoints in plain text |
|
|
139
|
+
| `preflight` | No | `undefined` | Instructs the Experience API to aggregate a new profile state but not store it |
|
|
106
140
|
|
|
107
141
|
### Event Builder Options
|
|
108
142
|
|
|
109
143
|
Event builder options should only be supplied when building an SDK on top of the Optimization Node
|
|
110
144
|
SDK or any of its descendent SDKs.
|
|
111
145
|
|
|
112
|
-
| Option | Required? | Default
|
|
113
|
-
| --------- | --------- |
|
|
114
|
-
| `channel` | No | `'server'`
|
|
115
|
-
| `library` | No | `{ name: '
|
|
146
|
+
| Option | Required? | Default | Description |
|
|
147
|
+
| --------- | --------- | ------------------------------------------------------------- | ---------------------------------------------------------------------------------- |
|
|
148
|
+
| `channel` | No | `'server'` | The channel that identifies where events originate from (e.g. `'web'`, `'mobile'`) |
|
|
149
|
+
| `library` | No | `{ name: '@contentful/optimization-node', version: '0.0.0' }` | The client library metadata that is attached to all events |
|
|
116
150
|
|
|
117
151
|
### Fetch Options
|
|
118
152
|
|
|
119
153
|
Fetch options allow for configuration of a Fetch API-compatible fetch method and the retry/timeout
|
|
120
|
-
logic integrated into the
|
|
154
|
+
logic integrated into the SDK's bundled API clients. Specify the `fetchMethod` when the host
|
|
121
155
|
application environment does not offer a `fetch` method that is compatible with the standard Fetch
|
|
122
156
|
API in its global scope.
|
|
123
157
|
|
|
@@ -135,24 +169,13 @@ Configuration method signatures:
|
|
|
135
169
|
- `fetchMethod`: `(url: string | URL, init: RequestInit) => Promise<Response>`
|
|
136
170
|
- `onFailedAttempt` and `onRequestTimeout`: `(options: FetchMethodCallbackOptions) => void`
|
|
137
171
|
|
|
138
|
-
### Personalization Options
|
|
139
|
-
|
|
140
|
-
| Option | Required? | Default | Description |
|
|
141
|
-
| ----------------- | --------- | ------------------------------------- | ------------------------------------------------------------------- |
|
|
142
|
-
| `baseUrl` | No | `'https://experience.ninetailed.co/'` | Base URL for the Experience API |
|
|
143
|
-
| `enabledFeatures` | No | `['ip-enrichment', 'location']` | Enabled features which the API may use for each request |
|
|
144
|
-
| `ip` | No | `undefined` | IP address to override the API behavior for IP analysis |
|
|
145
|
-
| `locale` | No | `'en-US'` (in API) | Locale used to translate `location.city` and `location.country` |
|
|
146
|
-
| `plainText` | No | `false` | Sends performance-critical endpoints in plain text |
|
|
147
|
-
| `preflight` | No | `false` | Instructs the API to aggregate a new profile state but not store it |
|
|
148
|
-
|
|
149
172
|
## Optimization Methods
|
|
150
173
|
|
|
151
174
|
Arguments marked with an asterisk (\*) are always required.
|
|
152
175
|
|
|
153
|
-
###
|
|
176
|
+
### Optimization Data Resolution Methods
|
|
154
177
|
|
|
155
|
-
#### `
|
|
178
|
+
#### `getFlag`
|
|
156
179
|
|
|
157
180
|
Get the specified Custom Flag's value from the provided changes array.
|
|
158
181
|
|
|
@@ -165,14 +188,20 @@ Returns:
|
|
|
165
188
|
|
|
166
189
|
- The resolved value for the specified Custom Flag, or `undefined` if it cannot be found.
|
|
167
190
|
|
|
191
|
+
Behavior notes:
|
|
192
|
+
|
|
193
|
+
- Node SDK is stateless; `getFlag(...)` does not auto-emit `trackFlagView`.
|
|
194
|
+
- If full map resolution is needed for advanced use cases, use
|
|
195
|
+
`optimization.flagsResolver.resolve(changes)`.
|
|
196
|
+
|
|
168
197
|
> [!NOTE]
|
|
169
198
|
>
|
|
170
199
|
> If the `changes` argument is omitted, the method will return `undefined`.
|
|
171
200
|
|
|
172
|
-
#### `
|
|
201
|
+
#### `resolveOptimizedEntry`
|
|
173
202
|
|
|
174
|
-
Resolve a baseline Contentful entry to
|
|
175
|
-
|
|
203
|
+
Resolve a baseline Contentful entry to an optimized variant using the provided selected
|
|
204
|
+
optimizations.
|
|
176
205
|
|
|
177
206
|
Type arguments:
|
|
178
207
|
|
|
@@ -182,17 +211,17 @@ Type arguments:
|
|
|
182
211
|
|
|
183
212
|
Arguments:
|
|
184
213
|
|
|
185
|
-
- `entry`\*: The entry to
|
|
186
|
-
- `
|
|
214
|
+
- `entry`\*: The baseline entry to resolve
|
|
215
|
+
- `selectedOptimizations`: Selected optimizations
|
|
187
216
|
|
|
188
217
|
Returns:
|
|
189
218
|
|
|
190
|
-
- The resolved
|
|
191
|
-
|
|
219
|
+
- The resolved optimized entry variant, or the supplied baseline entry if baseline is the selected
|
|
220
|
+
variant or a variant cannot be found.
|
|
192
221
|
|
|
193
222
|
> [!NOTE]
|
|
194
223
|
>
|
|
195
|
-
> If the `
|
|
224
|
+
> If the `selectedOptimizations` argument is omitted, the method will return the baseline entry.
|
|
196
225
|
|
|
197
226
|
#### `getMergeTagValue`
|
|
198
227
|
|
|
@@ -209,14 +238,36 @@ Arguments:
|
|
|
209
238
|
>
|
|
210
239
|
> If the `profile` argument is omitted, the method will return the merge tag's fallback value.
|
|
211
240
|
|
|
212
|
-
###
|
|
241
|
+
### Experience API and Insights API Event Methods
|
|
213
242
|
|
|
214
|
-
|
|
243
|
+
Create a request scope once per incoming request, then call event methods on that scope:
|
|
244
|
+
|
|
245
|
+
```ts
|
|
246
|
+
const requestOptimization = optimization.forRequest({
|
|
247
|
+
locale: req.acceptsLanguages()[0] ?? 'en-US',
|
|
248
|
+
})
|
|
249
|
+
```
|
|
250
|
+
|
|
251
|
+
Only the following methods may return an `OptimizationData` object:
|
|
252
|
+
|
|
253
|
+
- `identify`
|
|
254
|
+
- `page`
|
|
255
|
+
- `screen`
|
|
256
|
+
- `track`
|
|
257
|
+
- `trackView` (when `payload.sticky` is `true`)
|
|
258
|
+
|
|
259
|
+
`trackClick`, `trackHover`, and `trackFlagView` return no data. When returned, `OptimizationData`
|
|
260
|
+
contains:
|
|
215
261
|
|
|
216
262
|
- `changes`: Currently used for Custom Flags
|
|
217
|
-
- `
|
|
263
|
+
- `selectedOptimizations`: Selected optimizations for the profile
|
|
218
264
|
- `profile`: Profile associated with the evaluated events
|
|
219
265
|
|
|
266
|
+
In stateless runtimes, Insights-backed methods require a profile for delivery. Non-sticky
|
|
267
|
+
`trackView`, `trackClick`, `trackHover`, and `trackFlagView` require `payload.profile.id`. Sticky
|
|
268
|
+
`trackView` may omit `profile`, because the returned Experience profile is reused for the paired
|
|
269
|
+
Insights event.
|
|
270
|
+
|
|
220
271
|
#### `identify`
|
|
221
272
|
|
|
222
273
|
Identify the current profile/visitor to associate traits with a profile.
|
|
@@ -228,42 +279,82 @@ Arguments:
|
|
|
228
279
|
|
|
229
280
|
#### `page`
|
|
230
281
|
|
|
231
|
-
Record
|
|
282
|
+
Record an Experience API page view.
|
|
232
283
|
|
|
233
284
|
Arguments:
|
|
234
285
|
|
|
235
286
|
- `payload`\*: Page view event builder arguments object, including an optional `profile` property
|
|
236
287
|
with a `PartialProfile` value that requires only an `id`
|
|
237
288
|
|
|
289
|
+
#### `screen`
|
|
290
|
+
|
|
291
|
+
Record an Experience API screen view.
|
|
292
|
+
|
|
293
|
+
Arguments:
|
|
294
|
+
|
|
295
|
+
- `payload`\*: Screen view event builder arguments object, including an optional `profile` property
|
|
296
|
+
with a `PartialProfile` value that requires only an `id`
|
|
297
|
+
|
|
238
298
|
#### `track`
|
|
239
299
|
|
|
240
|
-
Record
|
|
300
|
+
Record an Experience API custom track event.
|
|
241
301
|
|
|
242
302
|
Arguments:
|
|
243
303
|
|
|
244
304
|
- `payload`\*: Track event builder arguments object, including an optional `profile` property with a
|
|
245
305
|
`PartialProfile` value that requires only an `id`
|
|
246
306
|
|
|
247
|
-
#### `
|
|
307
|
+
#### `trackView`
|
|
308
|
+
|
|
309
|
+
Record an Insights API entry view event. When the payload marks the entry as "sticky", an additional
|
|
310
|
+
Experience API entry view is recorded. This method only returns `OptimizationData` when the entry is
|
|
311
|
+
marked as "sticky".
|
|
312
|
+
|
|
313
|
+
Arguments:
|
|
314
|
+
|
|
315
|
+
- `payload`\*: Entry view event builder arguments object. When `payload.sticky` is `true`, `profile`
|
|
316
|
+
is optional and the returned Experience profile is reused for Insights delivery. Otherwise,
|
|
317
|
+
`profile` is required and must contain at least an `id`
|
|
318
|
+
|
|
319
|
+
#### `trackClick`
|
|
320
|
+
|
|
321
|
+
Record an Insights API entry click event.
|
|
322
|
+
|
|
323
|
+
Returns:
|
|
324
|
+
|
|
325
|
+
- `void`
|
|
326
|
+
|
|
327
|
+
Arguments:
|
|
328
|
+
|
|
329
|
+
- `payload`\*: Entry click event builder arguments object, including a required `profile` property
|
|
330
|
+
with a `PartialProfile` value that requires only an `id`
|
|
331
|
+
|
|
332
|
+
#### `trackHover`
|
|
333
|
+
|
|
334
|
+
Record an Insights API entry hover event.
|
|
335
|
+
|
|
336
|
+
Returns:
|
|
248
337
|
|
|
249
|
-
|
|
250
|
-
additional personalization component view is recorded. This method only returns `OptimizationData`
|
|
251
|
-
when the component is marked as "sticky".
|
|
338
|
+
- `void`
|
|
252
339
|
|
|
253
340
|
Arguments:
|
|
254
341
|
|
|
255
|
-
- `payload`\*:
|
|
256
|
-
|
|
342
|
+
- `payload`\*: Entry hover event builder arguments object, including a required `profile` property
|
|
343
|
+
with a `PartialProfile` value that requires only an `id`
|
|
257
344
|
|
|
258
345
|
#### `trackFlagView`
|
|
259
346
|
|
|
260
|
-
Track a feature flag view via
|
|
347
|
+
Track a feature flag view via the Insights API. This is functionally the same as a non-sticky flag
|
|
261
348
|
view event.
|
|
262
349
|
|
|
350
|
+
Returns:
|
|
351
|
+
|
|
352
|
+
- `void`
|
|
353
|
+
|
|
263
354
|
Arguments:
|
|
264
355
|
|
|
265
|
-
- `payload`\*:
|
|
266
|
-
|
|
356
|
+
- `payload`\*: Flag view event builder arguments object, including a required `profile` property
|
|
357
|
+
with a `PartialProfile` value that requires only an `id`
|
|
267
358
|
|
|
268
359
|
## Interceptors
|
|
269
360
|
|
|
@@ -285,5 +376,4 @@ optimization.interceptors.event((event) => {
|
|
|
285
376
|
|
|
286
377
|
> [!WARNING]
|
|
287
378
|
>
|
|
288
|
-
> Interceptors are intended to enable low-level interoperability
|
|
289
|
-
> Optimization SDK events, use the `states` observables.
|
|
379
|
+
> Interceptors are intended to enable low-level interoperability and should be used with care.
|
package/dist/260.mjs
ADDED
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
const OPTIMIZATION_NODE_SDK_VERSION = "0.1.0-alpha11";
|
|
2
|
+
const OPTIMIZATION_NODE_SDK_NAME = "@contentful/optimization-node";
|
|
3
|
+
export { ANONYMOUS_ID_COOKIE, ANONYMOUS_ID_KEY } from "@contentful/optimization-core/constants";
|
|
4
|
+
export { OPTIMIZATION_NODE_SDK_NAME, OPTIMIZATION_NODE_SDK_VERSION };
|
|
5
|
+
|
|
6
|
+
//# sourceMappingURL=260.mjs.map
|
package/dist/260.mjs.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"260.mjs","sources":["../src/constants.ts"],"sourcesContent":["// eslint-disable-next-line @typescript-eslint/naming-convention -- Replaced at build-time\ndeclare const __OPTIMIZATION_VERSION__: string | undefined\n// eslint-disable-next-line @typescript-eslint/naming-convention -- Replaced at build-time\ndeclare const __OPTIMIZATION_PACKAGE_NAME__: string | undefined\n\n/**\n * The current version of the Optimization Node SDK, injected at build-time.\n *\n * @defaultValue `'0.0.0'` when the build-time replacement is unavailable.\n *\n * @public\n */\nexport const OPTIMIZATION_NODE_SDK_VERSION =\n typeof __OPTIMIZATION_VERSION__ === 'string' ? __OPTIMIZATION_VERSION__ : '0.0.0'\n\n/**\n * The package name of the Optimization Node SDK, injected at build-time.\n *\n * @defaultValue `'@contentful/optimization-node'` when the build-time replacement is unavailable.\n *\n * @public\n */\nexport const OPTIMIZATION_NODE_SDK_NAME =\n typeof __OPTIMIZATION_PACKAGE_NAME__ === 'string'\n ? __OPTIMIZATION_PACKAGE_NAME__\n : '@contentful/optimization-node'\n\n/**\n * Re-exports of anonymous identifier constants used by the Optimization Core.\n *\n * @remarks\n * This constant is surfaced here to provide a stable import path for Node SDK\n * consumers. It represents the cookie key used by the Optimization Framework\n * to persist an anonymous identifier for tracking optimization and insights\n * events when no explicit profile is known.\n *\n * @example\n * ```ts\n * import { ANONYMOUS_ID_COOKIE, ANONYMOUS_ID_KEY } from '@contentful/optimization-node/constants'\n * const cookieId = request.cookies[ANONYMOUS_ID_COOKIE]\n * const storageId = localStorage.getItem(ANONYMOUS_ID_KEY)\n * ```\n *\n * @see {@link ANONYMOUS_ID_COOKIE} and {@link ANONYMOUS_ID_KEY} in\n * `@contentful/optimization-core` for the\n * authoritative definition and documentation.\n *\n * @public\n */\nexport { ANONYMOUS_ID_COOKIE, ANONYMOUS_ID_KEY } from '@contentful/optimization-core/constants'\n"],"names":["OPTIMIZATION_NODE_SDK_VERSION","__OPTIMIZATION_VERSION__","OPTIMIZATION_NODE_SDK_NAME","__OPTIMIZATION_PACKAGE_NAME__"],"mappings":"AAYO,MAAMA,gCACoCC;AAS1C,MAAMC,6BAEPC"}
|
package/dist/987.mjs
ADDED
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __webpack_modules__ = {
|
|
3
|
+
"@contentful/optimization-core/api-client" (module) {
|
|
4
|
+
module.exports = require("@contentful/optimization-core/api-client");
|
|
5
|
+
}
|
|
6
|
+
};
|
|
7
|
+
var __webpack_module_cache__ = {};
|
|
8
|
+
function __webpack_require__(moduleId) {
|
|
9
|
+
var cachedModule = __webpack_module_cache__[moduleId];
|
|
10
|
+
if (void 0 !== cachedModule) return cachedModule.exports;
|
|
11
|
+
var module = __webpack_module_cache__[moduleId] = {
|
|
12
|
+
exports: {}
|
|
13
|
+
};
|
|
14
|
+
__webpack_modules__[moduleId](module, module.exports, __webpack_require__);
|
|
15
|
+
return module.exports;
|
|
16
|
+
}
|
|
17
|
+
(()=>{
|
|
18
|
+
__webpack_require__.n = (module)=>{
|
|
19
|
+
var getter = module && module.__esModule ? ()=>module['default'] : ()=>module;
|
|
20
|
+
__webpack_require__.d(getter, {
|
|
21
|
+
a: getter
|
|
22
|
+
});
|
|
23
|
+
return getter;
|
|
24
|
+
};
|
|
25
|
+
})();
|
|
26
|
+
(()=>{
|
|
27
|
+
__webpack_require__.d = (exports1, definition)=>{
|
|
28
|
+
for(var key in definition)if (__webpack_require__.o(definition, key) && !__webpack_require__.o(exports1, key)) Object.defineProperty(exports1, key, {
|
|
29
|
+
enumerable: true,
|
|
30
|
+
get: definition[key]
|
|
31
|
+
});
|
|
32
|
+
};
|
|
33
|
+
})();
|
|
34
|
+
(()=>{
|
|
35
|
+
__webpack_require__.o = (obj, prop)=>Object.prototype.hasOwnProperty.call(obj, prop);
|
|
36
|
+
})();
|
|
37
|
+
(()=>{
|
|
38
|
+
__webpack_require__.r = (exports1)=>{
|
|
39
|
+
if ("u" > typeof Symbol && Symbol.toStringTag) Object.defineProperty(exports1, Symbol.toStringTag, {
|
|
40
|
+
value: 'Module'
|
|
41
|
+
});
|
|
42
|
+
Object.defineProperty(exports1, '__esModule', {
|
|
43
|
+
value: true
|
|
44
|
+
});
|
|
45
|
+
};
|
|
46
|
+
})();
|
|
47
|
+
var __webpack_exports__ = {};
|
|
48
|
+
(()=>{
|
|
49
|
+
__webpack_require__.r(__webpack_exports__);
|
|
50
|
+
var _contentful_optimization_core_api_client__rspack_import_0 = __webpack_require__("@contentful/optimization-core/api-client");
|
|
51
|
+
var __rspack_reexport = {};
|
|
52
|
+
for(const __rspack_import_key in _contentful_optimization_core_api_client__rspack_import_0)if ("default" !== __rspack_import_key) __rspack_reexport[__rspack_import_key] = ()=>_contentful_optimization_core_api_client__rspack_import_0[__rspack_import_key];
|
|
53
|
+
__webpack_require__.d(__webpack_exports__, __rspack_reexport);
|
|
54
|
+
})();
|
|
55
|
+
for(var __rspack_i in __webpack_exports__)exports[__rspack_i] = __webpack_exports__[__rspack_i];
|
|
56
|
+
Object.defineProperty(exports, '__esModule', {
|
|
57
|
+
value: true
|
|
58
|
+
});
|
|
59
|
+
|
|
60
|
+
//# sourceMappingURL=api-client.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"api-client.cjs","sources":["webpack/runtime/compat_get_default_export","webpack/runtime/define_property_getters","webpack/runtime/has_own_property","webpack/runtime/make_namespace_object"],"sourcesContent":["// getDefaultExport function for compatibility with non-ESM modules\n__webpack_require__.n = (module) => {\n\tvar getter = module && module.__esModule ?\n\t\t() => (module['default']) :\n\t\t() => (module);\n\t__webpack_require__.d(getter, { a: getter });\n\treturn getter;\n};\n","__webpack_require__.d = (exports, definition) => {\n\tfor(var key in definition) {\n if(__webpack_require__.o(definition, key) && !__webpack_require__.o(exports, key)) {\n Object.defineProperty(exports, key, { enumerable: true, get: definition[key] });\n }\n }\n};","__webpack_require__.o = (obj, prop) => (Object.prototype.hasOwnProperty.call(obj, prop))","// define __esModule on exports\n__webpack_require__.r = (exports) => {\n\tif(typeof Symbol !== 'undefined' && Symbol.toStringTag) {\n\t\tObject.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });\n\t}\n\tObject.defineProperty(exports, '__esModule', { value: true });\n};"],"names":["__webpack_require__","module","getter","definition","key","Object","obj","prop","Symbol"],"mappings":";;;;;;;;;;;;;;;;;IACAA,oBAAoB,CAAC,GAAG,CAACC;QACxB,IAAIC,SAASD,UAAUA,OAAO,UAAU,GACvC,IAAOA,MAAM,CAAC,UAAU,GACxB,IAAOA;QACRD,oBAAoB,CAAC,CAACE,QAAQ;YAAE,GAAGA;QAAO;QAC1C,OAAOA;IACR;;;ICPAF,oBAAoB,CAAC,GAAG,CAAC,UAASG;QACjC,IAAI,IAAIC,OAAOD,WACR,IAAGH,oBAAoB,CAAC,CAACG,YAAYC,QAAQ,CAACJ,oBAAoB,CAAC,CAAC,UAASI,MACzEC,OAAO,cAAc,CAAC,UAASD,KAAK;YAAE,YAAY;YAAM,KAAKD,UAAU,CAACC,IAAI;QAAC;IAGzF;;;ICNAJ,oBAAoB,CAAC,GAAG,CAACM,KAAKC,OAAUF,OAAO,SAAS,CAAC,cAAc,CAAC,IAAI,CAACC,KAAKC;;;ICClFP,oBAAoB,CAAC,GAAG,CAAC;QACxB,IAAG,AAAkB,MAAlB,OAAOQ,UAA0BA,OAAO,WAAW,EACrDH,OAAO,cAAc,CAAC,UAASG,OAAO,WAAW,EAAE;YAAE,OAAO;QAAS;QAEtEH,OAAO,cAAc,CAAC,UAAS,cAAc;YAAE,OAAO;QAAK;IAC5D"}
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __webpack_modules__ = {
|
|
3
|
+
"@contentful/optimization-core/api-schemas" (module) {
|
|
4
|
+
module.exports = require("@contentful/optimization-core/api-schemas");
|
|
5
|
+
}
|
|
6
|
+
};
|
|
7
|
+
var __webpack_module_cache__ = {};
|
|
8
|
+
function __webpack_require__(moduleId) {
|
|
9
|
+
var cachedModule = __webpack_module_cache__[moduleId];
|
|
10
|
+
if (void 0 !== cachedModule) return cachedModule.exports;
|
|
11
|
+
var module = __webpack_module_cache__[moduleId] = {
|
|
12
|
+
exports: {}
|
|
13
|
+
};
|
|
14
|
+
__webpack_modules__[moduleId](module, module.exports, __webpack_require__);
|
|
15
|
+
return module.exports;
|
|
16
|
+
}
|
|
17
|
+
(()=>{
|
|
18
|
+
__webpack_require__.n = (module)=>{
|
|
19
|
+
var getter = module && module.__esModule ? ()=>module['default'] : ()=>module;
|
|
20
|
+
__webpack_require__.d(getter, {
|
|
21
|
+
a: getter
|
|
22
|
+
});
|
|
23
|
+
return getter;
|
|
24
|
+
};
|
|
25
|
+
})();
|
|
26
|
+
(()=>{
|
|
27
|
+
__webpack_require__.d = (exports1, definition)=>{
|
|
28
|
+
for(var key in definition)if (__webpack_require__.o(definition, key) && !__webpack_require__.o(exports1, key)) Object.defineProperty(exports1, key, {
|
|
29
|
+
enumerable: true,
|
|
30
|
+
get: definition[key]
|
|
31
|
+
});
|
|
32
|
+
};
|
|
33
|
+
})();
|
|
34
|
+
(()=>{
|
|
35
|
+
__webpack_require__.o = (obj, prop)=>Object.prototype.hasOwnProperty.call(obj, prop);
|
|
36
|
+
})();
|
|
37
|
+
(()=>{
|
|
38
|
+
__webpack_require__.r = (exports1)=>{
|
|
39
|
+
if ("u" > typeof Symbol && Symbol.toStringTag) Object.defineProperty(exports1, Symbol.toStringTag, {
|
|
40
|
+
value: 'Module'
|
|
41
|
+
});
|
|
42
|
+
Object.defineProperty(exports1, '__esModule', {
|
|
43
|
+
value: true
|
|
44
|
+
});
|
|
45
|
+
};
|
|
46
|
+
})();
|
|
47
|
+
var __webpack_exports__ = {};
|
|
48
|
+
(()=>{
|
|
49
|
+
__webpack_require__.r(__webpack_exports__);
|
|
50
|
+
var _contentful_optimization_core_api_schemas__rspack_import_0 = __webpack_require__("@contentful/optimization-core/api-schemas");
|
|
51
|
+
var __rspack_reexport = {};
|
|
52
|
+
for(const __rspack_import_key in _contentful_optimization_core_api_schemas__rspack_import_0)if ("default" !== __rspack_import_key) __rspack_reexport[__rspack_import_key] = ()=>_contentful_optimization_core_api_schemas__rspack_import_0[__rspack_import_key];
|
|
53
|
+
__webpack_require__.d(__webpack_exports__, __rspack_reexport);
|
|
54
|
+
})();
|
|
55
|
+
for(var __rspack_i in __webpack_exports__)exports[__rspack_i] = __webpack_exports__[__rspack_i];
|
|
56
|
+
Object.defineProperty(exports, '__esModule', {
|
|
57
|
+
value: true
|
|
58
|
+
});
|
|
59
|
+
|
|
60
|
+
//# sourceMappingURL=api-schemas.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"api-schemas.cjs","sources":["webpack/runtime/compat_get_default_export","webpack/runtime/define_property_getters","webpack/runtime/has_own_property","webpack/runtime/make_namespace_object"],"sourcesContent":["// getDefaultExport function for compatibility with non-ESM modules\n__webpack_require__.n = (module) => {\n\tvar getter = module && module.__esModule ?\n\t\t() => (module['default']) :\n\t\t() => (module);\n\t__webpack_require__.d(getter, { a: getter });\n\treturn getter;\n};\n","__webpack_require__.d = (exports, definition) => {\n\tfor(var key in definition) {\n if(__webpack_require__.o(definition, key) && !__webpack_require__.o(exports, key)) {\n Object.defineProperty(exports, key, { enumerable: true, get: definition[key] });\n }\n }\n};","__webpack_require__.o = (obj, prop) => (Object.prototype.hasOwnProperty.call(obj, prop))","// define __esModule on exports\n__webpack_require__.r = (exports) => {\n\tif(typeof Symbol !== 'undefined' && Symbol.toStringTag) {\n\t\tObject.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });\n\t}\n\tObject.defineProperty(exports, '__esModule', { value: true });\n};"],"names":["__webpack_require__","module","getter","definition","key","Object","obj","prop","Symbol"],"mappings":";;;;;;;;;;;;;;;;;IACAA,oBAAoB,CAAC,GAAG,CAACC;QACxB,IAAIC,SAASD,UAAUA,OAAO,UAAU,GACvC,IAAOA,MAAM,CAAC,UAAU,GACxB,IAAOA;QACRD,oBAAoB,CAAC,CAACE,QAAQ;YAAE,GAAGA;QAAO;QAC1C,OAAOA;IACR;;;ICPAF,oBAAoB,CAAC,GAAG,CAAC,UAASG;QACjC,IAAI,IAAIC,OAAOD,WACR,IAAGH,oBAAoB,CAAC,CAACG,YAAYC,QAAQ,CAACJ,oBAAoB,CAAC,CAAC,UAASI,MACzEC,OAAO,cAAc,CAAC,UAASD,KAAK;YAAE,YAAY;YAAM,KAAKD,UAAU,CAACC,IAAI;QAAC;IAGzF;;;ICNAJ,oBAAoB,CAAC,GAAG,CAACM,KAAKC,OAAUF,OAAO,SAAS,CAAC,cAAc,CAAC,IAAI,CAACC,KAAKC;;;ICClFP,oBAAoB,CAAC,GAAG,CAAC;QACxB,IAAG,AAAkB,MAAlB,OAAOQ,UAA0BA,OAAO,WAAW,EACrDH,OAAO,cAAc,CAAC,UAASG,OAAO,WAAW,EAAE;YAAE,OAAO;QAAS;QAEtEH,OAAO,cAAc,CAAC,UAAS,cAAc;YAAE,OAAO;QAAK;IAC5D"}
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __webpack_require__ = {};
|
|
3
|
+
(()=>{
|
|
4
|
+
__webpack_require__.d = (exports1, definition)=>{
|
|
5
|
+
for(var key in definition)if (__webpack_require__.o(definition, key) && !__webpack_require__.o(exports1, key)) Object.defineProperty(exports1, key, {
|
|
6
|
+
enumerable: true,
|
|
7
|
+
get: definition[key]
|
|
8
|
+
});
|
|
9
|
+
};
|
|
10
|
+
})();
|
|
11
|
+
(()=>{
|
|
12
|
+
__webpack_require__.o = (obj, prop)=>Object.prototype.hasOwnProperty.call(obj, prop);
|
|
13
|
+
})();
|
|
14
|
+
(()=>{
|
|
15
|
+
__webpack_require__.r = (exports1)=>{
|
|
16
|
+
if ("u" > typeof Symbol && Symbol.toStringTag) Object.defineProperty(exports1, Symbol.toStringTag, {
|
|
17
|
+
value: 'Module'
|
|
18
|
+
});
|
|
19
|
+
Object.defineProperty(exports1, '__esModule', {
|
|
20
|
+
value: true
|
|
21
|
+
});
|
|
22
|
+
};
|
|
23
|
+
})();
|
|
24
|
+
var __webpack_exports__ = {};
|
|
25
|
+
__webpack_require__.r(__webpack_exports__);
|
|
26
|
+
__webpack_require__.d(__webpack_exports__, {
|
|
27
|
+
ANONYMOUS_ID_COOKIE: ()=>constants_namespaceObject.ANONYMOUS_ID_COOKIE,
|
|
28
|
+
OPTIMIZATION_NODE_SDK_NAME: ()=>OPTIMIZATION_NODE_SDK_NAME,
|
|
29
|
+
ANONYMOUS_ID_KEY: ()=>constants_namespaceObject.ANONYMOUS_ID_KEY,
|
|
30
|
+
OPTIMIZATION_NODE_SDK_VERSION: ()=>OPTIMIZATION_NODE_SDK_VERSION
|
|
31
|
+
});
|
|
32
|
+
const constants_namespaceObject = require("@contentful/optimization-core/constants");
|
|
33
|
+
const OPTIMIZATION_NODE_SDK_VERSION = "0.1.0-alpha11";
|
|
34
|
+
const OPTIMIZATION_NODE_SDK_NAME = "@contentful/optimization-node";
|
|
35
|
+
exports.ANONYMOUS_ID_COOKIE = __webpack_exports__.ANONYMOUS_ID_COOKIE;
|
|
36
|
+
exports.ANONYMOUS_ID_KEY = __webpack_exports__.ANONYMOUS_ID_KEY;
|
|
37
|
+
exports.OPTIMIZATION_NODE_SDK_NAME = __webpack_exports__.OPTIMIZATION_NODE_SDK_NAME;
|
|
38
|
+
exports.OPTIMIZATION_NODE_SDK_VERSION = __webpack_exports__.OPTIMIZATION_NODE_SDK_VERSION;
|
|
39
|
+
for(var __rspack_i in __webpack_exports__)if (-1 === [
|
|
40
|
+
"ANONYMOUS_ID_COOKIE",
|
|
41
|
+
"ANONYMOUS_ID_KEY",
|
|
42
|
+
"OPTIMIZATION_NODE_SDK_NAME",
|
|
43
|
+
"OPTIMIZATION_NODE_SDK_VERSION"
|
|
44
|
+
].indexOf(__rspack_i)) exports[__rspack_i] = __webpack_exports__[__rspack_i];
|
|
45
|
+
Object.defineProperty(exports, '__esModule', {
|
|
46
|
+
value: true
|
|
47
|
+
});
|
|
48
|
+
|
|
49
|
+
//# sourceMappingURL=constants.cjs.map
|