@sitecore-content-sdk/core 0.1.0-beta.10 → 0.1.0-beta.12
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.
|
@@ -40,7 +40,7 @@ const getFallbackConfig = () => ({
|
|
|
40
40
|
enabled: process.env.NODE_ENV !== 'development',
|
|
41
41
|
edgeTimeout: 400,
|
|
42
42
|
cdpTimeout: 400,
|
|
43
|
-
scope:
|
|
43
|
+
scope: '',
|
|
44
44
|
channel: 'WEB',
|
|
45
45
|
currency: 'USD',
|
|
46
46
|
},
|
|
@@ -69,10 +69,10 @@ const deepMerge = (base, override) => {
|
|
|
69
69
|
edge: Object.assign(Object.assign({}, (_a = base.api) === null || _a === void 0 ? void 0 : _a.edge), (_b = override.api) === null || _b === void 0 ? void 0 : _b.edge),
|
|
70
70
|
local: Object.assign(Object.assign({}, (_c = base.api) === null || _c === void 0 ? void 0 : _c.local), (_d = override.api) === null || _d === void 0 ? void 0 : _d.local),
|
|
71
71
|
}, retries: Object.assign(Object.assign({}, base.retries), override.retries), layout: Object.assign(Object.assign({}, base.layout), override.layout), multisite: Object.assign(Object.assign({}, base.multisite), override.multisite), personalize: Object.assign(Object.assign({}, base.personalize), override.personalize), redirects: Object.assign(Object.assign({}, base.redirects), override.redirects), dictionary: Object.assign(Object.assign({}, base.dictionary), override.dictionary) });
|
|
72
|
-
if (Number.isNaN(result.personalize.cdpTimeout)) {
|
|
72
|
+
if (Number.isNaN(result.personalize.cdpTimeout) || !result.personalize.cdpTimeout) {
|
|
73
73
|
result.personalize.cdpTimeout = base.personalize.cdpTimeout;
|
|
74
74
|
}
|
|
75
|
-
if (Number.isNaN(result.personalize.edgeTimeout)) {
|
|
75
|
+
if (Number.isNaN(result.personalize.edgeTimeout) || !result.personalize.edgeTimeout) {
|
|
76
76
|
result.personalize.edgeTimeout = base.personalize.edgeTimeout;
|
|
77
77
|
}
|
|
78
78
|
// fallback in case only one context provided
|
|
@@ -68,6 +68,7 @@ class GraphQLRequestClient {
|
|
|
68
68
|
headers: Object.assign(Object.assign({}, this.headers), options === null || options === void 0 ? void 0 : options.headers),
|
|
69
69
|
query,
|
|
70
70
|
variables,
|
|
71
|
+
timeout: this.timeout,
|
|
71
72
|
});
|
|
72
73
|
const startTimestamp = Date.now();
|
|
73
74
|
const fetchWithOptionalTimeout = [this.client.request(query, variables, options === null || options === void 0 ? void 0 : options.headers)];
|
|
@@ -37,7 +37,7 @@ export const getFallbackConfig = () => ({
|
|
|
37
37
|
enabled: process.env.NODE_ENV !== 'development',
|
|
38
38
|
edgeTimeout: 400,
|
|
39
39
|
cdpTimeout: 400,
|
|
40
|
-
scope:
|
|
40
|
+
scope: '',
|
|
41
41
|
channel: 'WEB',
|
|
42
42
|
currency: 'USD',
|
|
43
43
|
},
|
|
@@ -65,10 +65,10 @@ const deepMerge = (base, override) => {
|
|
|
65
65
|
edge: Object.assign(Object.assign({}, (_a = base.api) === null || _a === void 0 ? void 0 : _a.edge), (_b = override.api) === null || _b === void 0 ? void 0 : _b.edge),
|
|
66
66
|
local: Object.assign(Object.assign({}, (_c = base.api) === null || _c === void 0 ? void 0 : _c.local), (_d = override.api) === null || _d === void 0 ? void 0 : _d.local),
|
|
67
67
|
}, retries: Object.assign(Object.assign({}, base.retries), override.retries), layout: Object.assign(Object.assign({}, base.layout), override.layout), multisite: Object.assign(Object.assign({}, base.multisite), override.multisite), personalize: Object.assign(Object.assign({}, base.personalize), override.personalize), redirects: Object.assign(Object.assign({}, base.redirects), override.redirects), dictionary: Object.assign(Object.assign({}, base.dictionary), override.dictionary) });
|
|
68
|
-
if (Number.isNaN(result.personalize.cdpTimeout)) {
|
|
68
|
+
if (Number.isNaN(result.personalize.cdpTimeout) || !result.personalize.cdpTimeout) {
|
|
69
69
|
result.personalize.cdpTimeout = base.personalize.cdpTimeout;
|
|
70
70
|
}
|
|
71
|
-
if (Number.isNaN(result.personalize.edgeTimeout)) {
|
|
71
|
+
if (Number.isNaN(result.personalize.edgeTimeout) || !result.personalize.edgeTimeout) {
|
|
72
72
|
result.personalize.edgeTimeout = base.personalize.edgeTimeout;
|
|
73
73
|
}
|
|
74
74
|
// fallback in case only one context provided
|
|
@@ -62,6 +62,7 @@ export class GraphQLRequestClient {
|
|
|
62
62
|
headers: Object.assign(Object.assign({}, this.headers), options === null || options === void 0 ? void 0 : options.headers),
|
|
63
63
|
query,
|
|
64
64
|
variables,
|
|
65
|
+
timeout: this.timeout,
|
|
65
66
|
});
|
|
66
67
|
const startTimestamp = Date.now();
|
|
67
68
|
const fetchWithOptionalTimeout = [this.client.request(query, variables, options === null || options === void 0 ? void 0 : options.headers)];
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@sitecore-content-sdk/core",
|
|
3
|
-
"version": "0.1.0-beta.
|
|
3
|
+
"version": "0.1.0-beta.12",
|
|
4
4
|
"main": "dist/cjs/index.js",
|
|
5
5
|
"module": "dist/esm/index.js",
|
|
6
6
|
"sideEffects": false,
|
|
@@ -66,7 +66,7 @@
|
|
|
66
66
|
},
|
|
67
67
|
"description": "",
|
|
68
68
|
"types": "types/index.d.ts",
|
|
69
|
-
"gitHead": "
|
|
69
|
+
"gitHead": "8f504530a297cbf241a930173b104a0203c5d7bf",
|
|
70
70
|
"files": [
|
|
71
71
|
"dist",
|
|
72
72
|
"types",
|
package/types/config/models.d.ts
CHANGED
|
@@ -18,48 +18,85 @@ export type SitecoreConfigInput = {
|
|
|
18
18
|
* Edge endpoint credentials for Sitecore connection. Will be used to connect to SaaS XMCloud instance
|
|
19
19
|
*/
|
|
20
20
|
edge?: {
|
|
21
|
-
|
|
21
|
+
/**
|
|
22
|
+
* A unified identifier used to connect and retrieve data from XM Cloud instance
|
|
23
|
+
*/
|
|
24
|
+
contextId: string;
|
|
25
|
+
/**
|
|
26
|
+
* Optional identifier used to connect and retrieve data from XM Cloud instance in client-side functionality
|
|
27
|
+
*/
|
|
22
28
|
clientContextId?: string;
|
|
29
|
+
/**
|
|
30
|
+
* XM Cloud endpoint that the app will communicate and retrieve data from
|
|
31
|
+
* @default https://edge-platform.sitecorecloud.io
|
|
32
|
+
*/
|
|
23
33
|
edgeUrl?: string;
|
|
24
34
|
};
|
|
25
35
|
/**
|
|
26
36
|
* API endpoint credentials for connection to local Sitecore instance
|
|
27
37
|
*/
|
|
28
38
|
local?: {
|
|
29
|
-
|
|
30
|
-
|
|
39
|
+
/**
|
|
40
|
+
* Sitecore API key identifier used to connect to the GraphQL endpoint
|
|
41
|
+
*/
|
|
42
|
+
apiKey: string;
|
|
43
|
+
/**
|
|
44
|
+
* Sitecore API hostname that the app will connect and retrieve data from
|
|
45
|
+
*/
|
|
46
|
+
apiHost: string;
|
|
47
|
+
/**
|
|
48
|
+
* GraphQL endpoint path, will be appended to apiHost to form full enpoint URL ($apiHost/$path)
|
|
49
|
+
* @default /sitecore/api/graph/edge
|
|
50
|
+
*/
|
|
31
51
|
path?: string;
|
|
32
52
|
};
|
|
33
53
|
};
|
|
34
|
-
|
|
54
|
+
/**
|
|
55
|
+
* The default and fallback locale for your site.
|
|
56
|
+
* Ensure it aligns with the framework-specific settings used in your application.
|
|
57
|
+
*/
|
|
35
58
|
defaultLanguage: string;
|
|
59
|
+
/**
|
|
60
|
+
* Your default site name. When using the multisite feature this variable defines the fallback site.
|
|
61
|
+
*/
|
|
62
|
+
defaultSite?: string;
|
|
36
63
|
/**
|
|
37
64
|
* Editing secret required to support Sitecore editing and preview functionality.
|
|
38
65
|
*/
|
|
39
66
|
editingSecret?: string;
|
|
67
|
+
/**
|
|
68
|
+
* Retry configuration applied to Layout, Dictionary and ErrorPages services out of the box
|
|
69
|
+
*/
|
|
40
70
|
retries?: {
|
|
41
71
|
/**
|
|
42
72
|
* Number of retries for graphql client. Will use the specified `retryStrategy`.
|
|
73
|
+
* @default 3
|
|
43
74
|
*/
|
|
44
75
|
count?: number;
|
|
45
76
|
/**
|
|
46
|
-
* Retry strategy for the client.
|
|
77
|
+
* Retry strategy for the client. By default, uses exponential
|
|
47
78
|
* back-off factor of 2 for codes 429, 502, 503, 504, 520, 521, 522, 523, 524.
|
|
79
|
+
* @default DefaultRetryStrategy
|
|
48
80
|
*/
|
|
49
81
|
retryStrategy?: RetryStrategy;
|
|
50
82
|
};
|
|
83
|
+
/**
|
|
84
|
+
* Settings for Layout Service
|
|
85
|
+
*/
|
|
51
86
|
layout?: {
|
|
52
87
|
/**
|
|
53
|
-
* Override
|
|
54
|
-
* @param {string} siteName
|
|
55
|
-
* @param {string} itemPath
|
|
56
|
-
* @param {string} [locale]
|
|
88
|
+
* Override the first part of graphQL query for Layout Service (excluding the fields part)
|
|
89
|
+
* @param {string} siteName your site name
|
|
90
|
+
* @param {string} itemPath full path to Sitecore item/route
|
|
91
|
+
* @param {string} [locale] item/route language
|
|
57
92
|
* @returns {string} custom layout query
|
|
58
|
-
*
|
|
59
|
-
* layout(site:"${siteName}", routePath:"${itemPath}", language:"${language}")
|
|
93
|
+
* @default 'layout(site:"${siteName}", routePath:"${itemPath}", language:"${language}")'
|
|
60
94
|
*/
|
|
61
95
|
formatLayoutQuery?: ((siteName: string, itemPath: string, locale?: string) => string) | null;
|
|
62
96
|
};
|
|
97
|
+
/**
|
|
98
|
+
* Settings for Dictionary Service
|
|
99
|
+
*/
|
|
63
100
|
dictionary?: {
|
|
64
101
|
/**
|
|
65
102
|
* configure local memory caching for Dictionary Service requests
|
|
@@ -69,7 +106,14 @@ export type SitecoreConfigInput = {
|
|
|
69
106
|
timeout?: number;
|
|
70
107
|
};
|
|
71
108
|
};
|
|
72
|
-
|
|
109
|
+
/**
|
|
110
|
+
* Settings for multisite functionaliry
|
|
111
|
+
*/
|
|
112
|
+
multisite?: {
|
|
113
|
+
/**
|
|
114
|
+
* Enable multisite
|
|
115
|
+
* @default true
|
|
116
|
+
*/
|
|
73
117
|
enabled?: boolean;
|
|
74
118
|
/**
|
|
75
119
|
* Fallback hostname in case `host` header is not present
|
|
@@ -81,7 +125,14 @@ export type SitecoreConfigInput = {
|
|
|
81
125
|
*/
|
|
82
126
|
useCookieResolution?: (req?: RequestInit, res?: ResponseInit) => boolean;
|
|
83
127
|
};
|
|
84
|
-
|
|
128
|
+
/**
|
|
129
|
+
* Setting for personalize functionality
|
|
130
|
+
*/
|
|
131
|
+
personalize?: {
|
|
132
|
+
/**
|
|
133
|
+
* Enable personalize middleware
|
|
134
|
+
* @default process.env.NODE_ENV !== 'development'
|
|
135
|
+
*/
|
|
85
136
|
enabled?: boolean;
|
|
86
137
|
/**
|
|
87
138
|
* Configuration for your Sitecore Experience Edge endpoint
|
|
@@ -94,21 +145,28 @@ export type SitecoreConfigInput = {
|
|
|
94
145
|
/**
|
|
95
146
|
* Optional Sitecore Personalize scope identifier allowing you to isolate your personalization data between XM Cloud environments
|
|
96
147
|
*/
|
|
97
|
-
scope
|
|
148
|
+
scope?: string;
|
|
98
149
|
/**
|
|
99
150
|
* The Sitecore CDP channel to use for events. Uses 'WEB' by default.
|
|
100
151
|
*/
|
|
101
|
-
channel?: string
|
|
152
|
+
channel?: string;
|
|
102
153
|
/**
|
|
103
154
|
* Currency for CDP request. Uses 'USA' as default.
|
|
104
155
|
*/
|
|
105
|
-
currency?: string
|
|
156
|
+
currency?: string;
|
|
106
157
|
};
|
|
107
|
-
|
|
158
|
+
/**
|
|
159
|
+
* Settings for redirects functionality
|
|
160
|
+
*/
|
|
161
|
+
redirects?: {
|
|
162
|
+
/**
|
|
163
|
+
* Enable redirects middleware
|
|
164
|
+
* @default process.env.NODE_ENV !== 'development'
|
|
165
|
+
*/
|
|
108
166
|
enabled?: boolean;
|
|
109
167
|
/**
|
|
110
168
|
* These are all the locales you support in your application.
|
|
111
|
-
* These should match those in your
|
|
169
|
+
* These should match those in framework-specific configuration of your app.
|
|
112
170
|
*/
|
|
113
171
|
locales?: string[];
|
|
114
172
|
};
|