@contentful/optimization-api-client 1.1.1 → 2.0.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 +36 -14
- package/THIRD_PARTY_NOTICES.txt +0 -2017
- package/dist/api-schemas.cjs +504 -28
- package/dist/api-schemas.cjs.map +1 -1
- package/dist/api-schemas.d.cts +6558 -1
- package/dist/api-schemas.d.mts +6558 -1
- package/dist/api-schemas.d.ts +6558 -1
- package/dist/api-schemas.mjs +309 -2
- package/dist/api-schemas.mjs.map +1 -0
- package/dist/guards.cjs +44 -0
- package/dist/guards.cjs.map +1 -0
- package/dist/guards.d.cts +103 -0
- package/dist/guards.d.mts +103 -0
- package/dist/guards.d.ts +103 -0
- package/dist/guards.mjs +1 -0
- package/dist/index.cjs +48 -38
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +1512 -24
- package/dist/index.d.mts +1512 -24
- package/dist/index.d.ts +1512 -24
- package/dist/index.mjs +23 -22
- package/dist/index.mjs.map +1 -1
- package/dist/logger.cjs +17 -13
- package/dist/logger.cjs.map +1 -1
- package/dist/logger.mjs +131 -1
- package/dist/logger.mjs.map +1 -0
- package/dist/u~0.mjs +6 -0
- package/dist/u~0.mjs.map +1 -0
- package/package.json +39 -2
- package/dist/199.mjs +0 -2
- package/dist/649.mjs +0 -131
- package/dist/649.mjs.map +0 -1
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-api-client-
|
|
3
|
+
<img alt="Contentful Logo" title="Contentful" src="https://raw.githubusercontent.com/contentful/optimization/optimization-api-client-v2.0.0/contentful-icon.png" width="150">
|
|
4
4
|
</a>
|
|
5
5
|
</p>
|
|
6
6
|
|
|
@@ -11,7 +11,7 @@
|
|
|
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-api-client-
|
|
14
|
+
[Reference](https://contentful.github.io/optimization) · [Contributing](https://github.com/contentful/optimization/blob/optimization-api-client-v2.0.0/CONTRIBUTING.md)
|
|
15
15
|
|
|
16
16
|
</div>
|
|
17
17
|
|
|
@@ -23,6 +23,12 @@ We recommend starting applications with Web, React Web, Node, or React Native SD
|
|
|
23
23
|
directly when building or maintaining SDK layers, tests, tooling, or first-party integrations that
|
|
24
24
|
need raw API access.
|
|
25
25
|
|
|
26
|
+
> [!IMPORTANT]
|
|
27
|
+
>
|
|
28
|
+
> Upgrading from v1? Follow the
|
|
29
|
+
> [v1-to-v2 migration guide](https://contentful.github.io/optimization/documents/Documentation.Guides.migrating-optimization-sdk-packages-from-v1-to-v2.html)
|
|
30
|
+
> before changing package versions or route-dependent infrastructure.
|
|
31
|
+
|
|
26
32
|
<details>
|
|
27
33
|
<summary>Table of Contents</summary>
|
|
28
34
|
<!-- mtoc-start -->
|
|
@@ -33,6 +39,7 @@ need raw API access.
|
|
|
33
39
|
- [API surface](#api-surface)
|
|
34
40
|
- [Experience API](#experience-api)
|
|
35
41
|
- [Insights API](#insights-api)
|
|
42
|
+
- [Schema entry point](#schema-entry-point)
|
|
36
43
|
- [Fetch helpers](#fetch-helpers)
|
|
37
44
|
- [Related](#related)
|
|
38
45
|
|
|
@@ -54,8 +61,8 @@ preferred:
|
|
|
54
61
|
import { ApiClient } from '@contentful/optimization-api-client'
|
|
55
62
|
|
|
56
63
|
const client = new ApiClient({
|
|
57
|
-
|
|
58
|
-
environment: '
|
|
64
|
+
spaceId: 'your-space-id',
|
|
65
|
+
environment: 'master',
|
|
59
66
|
})
|
|
60
67
|
```
|
|
61
68
|
|
|
@@ -67,13 +74,13 @@ state, consent handling, event builders, entry resolution, tracking, or platform
|
|
|
67
74
|
|
|
68
75
|
## Common configuration
|
|
69
76
|
|
|
70
|
-
| Option | Required? | Default | Description
|
|
71
|
-
| -------------- | --------- | ---------------------------- |
|
|
72
|
-
| `
|
|
73
|
-
| `environment` | No | `'
|
|
74
|
-
| `experience` | No | See Experience options below | Experience API endpoint and default request options
|
|
75
|
-
| `insights` | No | See Insights options below | Insights API endpoint options
|
|
76
|
-
| `fetchOptions` | No | SDK defaults | Fetch timeout and retry behavior
|
|
77
|
+
| Option | Required? | Default | Description |
|
|
78
|
+
| -------------- | --------- | ---------------------------- | ------------------------------------------------------------------------ |
|
|
79
|
+
| `spaceId` | Yes | N/A | Contentful Space identifier for Experience and Insights API requests |
|
|
80
|
+
| `environment` | No | `'master'` | Contentful space environment identifier for Experience and Insights APIs |
|
|
81
|
+
| `experience` | No | See Experience options below | Experience API endpoint and default request options |
|
|
82
|
+
| `insights` | No | See Insights options below | Insights API endpoint options |
|
|
83
|
+
| `fetchOptions` | No | SDK defaults | Fetch timeout and retry behavior |
|
|
77
84
|
|
|
78
85
|
Common Experience API options:
|
|
79
86
|
|
|
@@ -147,6 +154,20 @@ await client.insights.sendBatchEvents([
|
|
|
147
154
|
Insights endpoints do not return response data. For last-chance browser lifecycle delivery, pass a
|
|
148
155
|
per-call `beacon` sender that receives the request URL and already serialized body.
|
|
149
156
|
|
|
157
|
+
### Schema entry point
|
|
158
|
+
|
|
159
|
+
`@contentful/optimization-api-client/api-schemas` owns the Experience API and Insights API runtime
|
|
160
|
+
validation schemas, inferred types, and validation helpers used by this client. Import those
|
|
161
|
+
contracts from that entry point when building SDK layers, tooling, or tests:
|
|
162
|
+
|
|
163
|
+
```ts
|
|
164
|
+
import { ExperienceResponse } from '@contentful/optimization-api-client/api-schemas'
|
|
165
|
+
```
|
|
166
|
+
|
|
167
|
+
This entry point does not include Contentful CDA schemas. Import CDA schemas from
|
|
168
|
+
`@contentful/optimization-core/api-schemas` instead. That Core entry point also provides an
|
|
169
|
+
aggregate schema surface for SDK layers that need both CDA and API contracts.
|
|
170
|
+
|
|
150
171
|
### Fetch helpers
|
|
151
172
|
|
|
152
173
|
This package also exports fetch helper functions used by SDK layers:
|
|
@@ -163,8 +184,9 @@ Use generated reference docs for helper signatures and callback payloads.
|
|
|
163
184
|
|
|
164
185
|
- [API Client generated reference](https://contentful.github.io/optimization/modules/_contentful_optimization-api-client.html) -
|
|
165
186
|
exported API reference
|
|
166
|
-
- [
|
|
167
|
-
|
|
168
|
-
|
|
187
|
+
- [Optimization Core SDK](https://github.com/contentful/optimization/blob/optimization-api-client-v2.0.0/packages/universal/core-sdk/README.md) - platform-agnostic SDK layer that composes this
|
|
188
|
+
client and owns CDA schemas through its `/api-schemas` entry point
|
|
189
|
+
- [API Schemas](https://github.com/contentful/optimization/blob/optimization-api-client-v2.0.0/packages/universal/api-schemas/README.md) - deprecated compatibility facade and import migration
|
|
190
|
+
guidance
|
|
169
191
|
- [Choosing the right SDK](https://contentful.github.io/optimization/documents/Documentation.Guides.choosing-the-right-sdk.html) -
|
|
170
192
|
package selection guidance for application integrations
|