@uniformdev/canvas-next-rsc 19.55.2-alpha.21 → 19.55.2-alpha.22
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/dist/config.d.mts +2 -66
- package/dist/config.d.ts +2 -66
- package/dist/handler.js +34 -17
- package/dist/handler.mjs +34 -17
- package/dist/index.d.mts +9 -8
- package/dist/index.d.ts +9 -8
- package/dist/index.esm.js +65 -44
- package/dist/index.js +65 -44
- package/dist/index.mjs +65 -44
- package/dist/models-a7648139.d.ts +69 -0
- package/package.json +11 -11
package/dist/config.d.mts
CHANGED
|
@@ -1,70 +1,6 @@
|
|
|
1
1
|
import { NextConfig } from 'next';
|
|
2
|
-
|
|
3
|
-
type UniformServerConfig = {
|
|
4
|
-
/**
|
|
5
|
-
* Sets the default value of storage consent for new unknown visitors.
|
|
6
|
-
*
|
|
7
|
-
* @default false
|
|
8
|
-
*/
|
|
9
|
-
defaultConsent?: boolean;
|
|
10
|
-
/**
|
|
11
|
-
* Interval to revalidate the manifest at.
|
|
12
|
-
*
|
|
13
|
-
* @default 60
|
|
14
|
-
*/
|
|
15
|
-
manifestRevalidateInterval?: number;
|
|
16
|
-
/**
|
|
17
|
-
* Interval to revalidate canvas data at.
|
|
18
|
-
*
|
|
19
|
-
* @default 10
|
|
20
|
-
*/
|
|
21
|
-
canvasRevalidateInterval?: number;
|
|
22
|
-
/**
|
|
23
|
-
* Interval to revalidate project map data at.
|
|
24
|
-
*
|
|
25
|
-
* @default 10
|
|
26
|
-
*/
|
|
27
|
-
projectMapRevalidateInterval?: number;
|
|
28
|
-
/**
|
|
29
|
-
* Configure where system components should be evaluated.
|
|
30
|
-
*/
|
|
31
|
-
evaluation?: {
|
|
32
|
-
/**
|
|
33
|
-
* Configure where personalization components should be evaluated.
|
|
34
|
-
*/
|
|
35
|
-
personalization: 'client' | 'server';
|
|
36
|
-
/**
|
|
37
|
-
* Configure where testing components should be evaluated.
|
|
38
|
-
*/
|
|
39
|
-
testing: 'client' | 'server';
|
|
40
|
-
};
|
|
41
|
-
/**
|
|
42
|
-
* 😅
|
|
43
|
-
*/
|
|
44
|
-
experimental?: {
|
|
45
|
-
/**
|
|
46
|
-
* Enables edge cache of redirects.
|
|
47
|
-
*
|
|
48
|
-
* @default false
|
|
49
|
-
*/
|
|
50
|
-
edgeRedirects?: boolean;
|
|
51
|
-
/**
|
|
52
|
-
* Enables edge cache of compositions.
|
|
53
|
-
*
|
|
54
|
-
* @default false
|
|
55
|
-
*/
|
|
56
|
-
edgeCompositions?: boolean;
|
|
57
|
-
/**
|
|
58
|
-
* Dynamic tokens names that should be used for localization.
|
|
59
|
-
*/
|
|
60
|
-
localeDynamicInputs?: string[];
|
|
61
|
-
/**
|
|
62
|
-
* Enables visual editing mode.
|
|
63
|
-
*/
|
|
64
|
-
vercelVisualEditing?: boolean;
|
|
65
|
-
};
|
|
66
|
-
};
|
|
2
|
+
export { U as UniformServerConfig } from './models-a7648139.js';
|
|
67
3
|
|
|
68
4
|
declare const withUniformConfig: (nextConfig: NextConfig) => NextConfig;
|
|
69
5
|
|
|
70
|
-
export {
|
|
6
|
+
export { withUniformConfig };
|
package/dist/config.d.ts
CHANGED
|
@@ -1,70 +1,6 @@
|
|
|
1
1
|
import { NextConfig } from 'next';
|
|
2
|
-
|
|
3
|
-
type UniformServerConfig = {
|
|
4
|
-
/**
|
|
5
|
-
* Sets the default value of storage consent for new unknown visitors.
|
|
6
|
-
*
|
|
7
|
-
* @default false
|
|
8
|
-
*/
|
|
9
|
-
defaultConsent?: boolean;
|
|
10
|
-
/**
|
|
11
|
-
* Interval to revalidate the manifest at.
|
|
12
|
-
*
|
|
13
|
-
* @default 60
|
|
14
|
-
*/
|
|
15
|
-
manifestRevalidateInterval?: number;
|
|
16
|
-
/**
|
|
17
|
-
* Interval to revalidate canvas data at.
|
|
18
|
-
*
|
|
19
|
-
* @default 10
|
|
20
|
-
*/
|
|
21
|
-
canvasRevalidateInterval?: number;
|
|
22
|
-
/**
|
|
23
|
-
* Interval to revalidate project map data at.
|
|
24
|
-
*
|
|
25
|
-
* @default 10
|
|
26
|
-
*/
|
|
27
|
-
projectMapRevalidateInterval?: number;
|
|
28
|
-
/**
|
|
29
|
-
* Configure where system components should be evaluated.
|
|
30
|
-
*/
|
|
31
|
-
evaluation?: {
|
|
32
|
-
/**
|
|
33
|
-
* Configure where personalization components should be evaluated.
|
|
34
|
-
*/
|
|
35
|
-
personalization: 'client' | 'server';
|
|
36
|
-
/**
|
|
37
|
-
* Configure where testing components should be evaluated.
|
|
38
|
-
*/
|
|
39
|
-
testing: 'client' | 'server';
|
|
40
|
-
};
|
|
41
|
-
/**
|
|
42
|
-
* 😅
|
|
43
|
-
*/
|
|
44
|
-
experimental?: {
|
|
45
|
-
/**
|
|
46
|
-
* Enables edge cache of redirects.
|
|
47
|
-
*
|
|
48
|
-
* @default false
|
|
49
|
-
*/
|
|
50
|
-
edgeRedirects?: boolean;
|
|
51
|
-
/**
|
|
52
|
-
* Enables edge cache of compositions.
|
|
53
|
-
*
|
|
54
|
-
* @default false
|
|
55
|
-
*/
|
|
56
|
-
edgeCompositions?: boolean;
|
|
57
|
-
/**
|
|
58
|
-
* Dynamic tokens names that should be used for localization.
|
|
59
|
-
*/
|
|
60
|
-
localeDynamicInputs?: string[];
|
|
61
|
-
/**
|
|
62
|
-
* Enables visual editing mode.
|
|
63
|
-
*/
|
|
64
|
-
vercelVisualEditing?: boolean;
|
|
65
|
-
};
|
|
66
|
-
};
|
|
2
|
+
export { U as UniformServerConfig } from './models-a7648139.js';
|
|
67
3
|
|
|
68
4
|
declare const withUniformConfig: (nextConfig: NextConfig) => NextConfig;
|
|
69
5
|
|
|
70
|
-
export {
|
|
6
|
+
export { withUniformConfig };
|
package/dist/handler.js
CHANGED
|
@@ -64,12 +64,19 @@ var isDevelopmentEnvironment = () => {
|
|
|
64
64
|
};
|
|
65
65
|
|
|
66
66
|
// src/config/helpers.ts
|
|
67
|
-
var
|
|
68
|
-
if (isDraftModeEnabled(options) || isOnVercelPreviewEnvironment()) {
|
|
69
|
-
return -1;
|
|
70
|
-
}
|
|
67
|
+
var getCanvasCacheStrategy = (options) => {
|
|
71
68
|
const config = getServerConfig();
|
|
72
|
-
|
|
69
|
+
if (config.canvasCache) {
|
|
70
|
+
return config.canvasCache;
|
|
71
|
+
}
|
|
72
|
+
if (isDevelopmentEnvironment() || isDraftModeEnabled(options) || isOnVercelPreviewEnvironment()) {
|
|
73
|
+
return {
|
|
74
|
+
type: "no-cache"
|
|
75
|
+
};
|
|
76
|
+
}
|
|
77
|
+
return {
|
|
78
|
+
type: "force-cache"
|
|
79
|
+
};
|
|
73
80
|
};
|
|
74
81
|
var getServerConfig = () => {
|
|
75
82
|
let serverConfig;
|
|
@@ -92,6 +99,22 @@ var buildCompositionTag = (compositionId) => {
|
|
|
92
99
|
return `composition:${compositionId}`.toLowerCase();
|
|
93
100
|
};
|
|
94
101
|
|
|
102
|
+
// src/clients/shared.ts
|
|
103
|
+
var determineFetchCacheOptions = (mode) => {
|
|
104
|
+
let cache = void 0;
|
|
105
|
+
let revalidate = void 0;
|
|
106
|
+
if (mode.type === "revalidate") {
|
|
107
|
+
cache = void 0;
|
|
108
|
+
revalidate = mode.interval;
|
|
109
|
+
} else {
|
|
110
|
+
cache = mode.type;
|
|
111
|
+
}
|
|
112
|
+
return {
|
|
113
|
+
cache,
|
|
114
|
+
revalidate
|
|
115
|
+
};
|
|
116
|
+
};
|
|
117
|
+
|
|
95
118
|
// src/clients/routeClient.ts
|
|
96
119
|
var import_canvas2 = require("@uniformdev/canvas");
|
|
97
120
|
var getRouteClient = (options) => {
|
|
@@ -125,22 +148,14 @@ var getRouteClient = (options) => {
|
|
|
125
148
|
}
|
|
126
149
|
}
|
|
127
150
|
}
|
|
128
|
-
|
|
129
|
-
let noCache = false;
|
|
130
|
-
if (options == null ? void 0 : options.revalidate) {
|
|
131
|
-
revalidate = options.revalidate;
|
|
132
|
-
}
|
|
133
|
-
if (revalidate === -1 || isDevelopmentEnvironment()) {
|
|
134
|
-
noCache = true;
|
|
135
|
-
revalidate = void 0;
|
|
136
|
-
}
|
|
151
|
+
const { cache, revalidate } = determineFetchCacheOptions(options.cache);
|
|
137
152
|
return fetch(req, {
|
|
138
153
|
...init,
|
|
139
154
|
headers: {
|
|
140
155
|
...init == null ? void 0 : init.headers,
|
|
141
156
|
"x-bypass-cache": bypassCache.toString()
|
|
142
157
|
},
|
|
143
|
-
cache
|
|
158
|
+
cache,
|
|
144
159
|
next: {
|
|
145
160
|
revalidate,
|
|
146
161
|
tags: tags.length ? tags : void 0
|
|
@@ -152,7 +167,7 @@ var getRouteClient = (options) => {
|
|
|
152
167
|
};
|
|
153
168
|
var getDefaultRouteClient = ({ searchParams }) => {
|
|
154
169
|
return getRouteClient({
|
|
155
|
-
|
|
170
|
+
cache: getCanvasCacheStrategy({
|
|
156
171
|
searchParams
|
|
157
172
|
})
|
|
158
173
|
});
|
|
@@ -254,10 +269,12 @@ var getProjectMapClient = (options) => {
|
|
|
254
269
|
apiKey: process.env.UNIFORM_API_KEY,
|
|
255
270
|
projectId: process.env.UNIFORM_PROJECT_ID,
|
|
256
271
|
fetch: (req, init) => {
|
|
272
|
+
const { cache, revalidate } = determineFetchCacheOptions(options.cache);
|
|
257
273
|
return fetch(req, {
|
|
258
274
|
...init,
|
|
275
|
+
cache,
|
|
259
276
|
next: {
|
|
260
|
-
revalidate
|
|
277
|
+
revalidate
|
|
261
278
|
}
|
|
262
279
|
});
|
|
263
280
|
}
|
package/dist/handler.mjs
CHANGED
|
@@ -49,12 +49,19 @@ var isDevelopmentEnvironment = () => {
|
|
|
49
49
|
};
|
|
50
50
|
|
|
51
51
|
// src/config/helpers.ts
|
|
52
|
-
var
|
|
53
|
-
if (isDraftModeEnabled(options) || isOnVercelPreviewEnvironment()) {
|
|
54
|
-
return -1;
|
|
55
|
-
}
|
|
52
|
+
var getCanvasCacheStrategy = (options) => {
|
|
56
53
|
const config = getServerConfig();
|
|
57
|
-
|
|
54
|
+
if (config.canvasCache) {
|
|
55
|
+
return config.canvasCache;
|
|
56
|
+
}
|
|
57
|
+
if (isDevelopmentEnvironment() || isDraftModeEnabled(options) || isOnVercelPreviewEnvironment()) {
|
|
58
|
+
return {
|
|
59
|
+
type: "no-cache"
|
|
60
|
+
};
|
|
61
|
+
}
|
|
62
|
+
return {
|
|
63
|
+
type: "force-cache"
|
|
64
|
+
};
|
|
58
65
|
};
|
|
59
66
|
var getServerConfig = () => {
|
|
60
67
|
let serverConfig;
|
|
@@ -77,6 +84,22 @@ var buildCompositionTag = (compositionId) => {
|
|
|
77
84
|
return `composition:${compositionId}`.toLowerCase();
|
|
78
85
|
};
|
|
79
86
|
|
|
87
|
+
// src/clients/shared.ts
|
|
88
|
+
var determineFetchCacheOptions = (mode) => {
|
|
89
|
+
let cache = void 0;
|
|
90
|
+
let revalidate = void 0;
|
|
91
|
+
if (mode.type === "revalidate") {
|
|
92
|
+
cache = void 0;
|
|
93
|
+
revalidate = mode.interval;
|
|
94
|
+
} else {
|
|
95
|
+
cache = mode.type;
|
|
96
|
+
}
|
|
97
|
+
return {
|
|
98
|
+
cache,
|
|
99
|
+
revalidate
|
|
100
|
+
};
|
|
101
|
+
};
|
|
102
|
+
|
|
80
103
|
// src/clients/routeClient.ts
|
|
81
104
|
import {
|
|
82
105
|
CANVAS_DRAFT_STATE,
|
|
@@ -115,22 +138,14 @@ var getRouteClient = (options) => {
|
|
|
115
138
|
}
|
|
116
139
|
}
|
|
117
140
|
}
|
|
118
|
-
|
|
119
|
-
let noCache = false;
|
|
120
|
-
if (options == null ? void 0 : options.revalidate) {
|
|
121
|
-
revalidate = options.revalidate;
|
|
122
|
-
}
|
|
123
|
-
if (revalidate === -1 || isDevelopmentEnvironment()) {
|
|
124
|
-
noCache = true;
|
|
125
|
-
revalidate = void 0;
|
|
126
|
-
}
|
|
141
|
+
const { cache, revalidate } = determineFetchCacheOptions(options.cache);
|
|
127
142
|
return fetch(req, {
|
|
128
143
|
...init,
|
|
129
144
|
headers: {
|
|
130
145
|
...init == null ? void 0 : init.headers,
|
|
131
146
|
"x-bypass-cache": bypassCache.toString()
|
|
132
147
|
},
|
|
133
|
-
cache
|
|
148
|
+
cache,
|
|
134
149
|
next: {
|
|
135
150
|
revalidate,
|
|
136
151
|
tags: tags.length ? tags : void 0
|
|
@@ -142,7 +157,7 @@ var getRouteClient = (options) => {
|
|
|
142
157
|
};
|
|
143
158
|
var getDefaultRouteClient = ({ searchParams }) => {
|
|
144
159
|
return getRouteClient({
|
|
145
|
-
|
|
160
|
+
cache: getCanvasCacheStrategy({
|
|
146
161
|
searchParams
|
|
147
162
|
})
|
|
148
163
|
});
|
|
@@ -244,10 +259,12 @@ var getProjectMapClient = (options) => {
|
|
|
244
259
|
apiKey: process.env.UNIFORM_API_KEY,
|
|
245
260
|
projectId: process.env.UNIFORM_PROJECT_ID,
|
|
246
261
|
fetch: (req, init) => {
|
|
262
|
+
const { cache, revalidate } = determineFetchCacheOptions(options.cache);
|
|
247
263
|
return fetch(req, {
|
|
248
264
|
...init,
|
|
265
|
+
cache,
|
|
249
266
|
next: {
|
|
250
|
-
revalidate
|
|
267
|
+
revalidate
|
|
251
268
|
}
|
|
252
269
|
});
|
|
253
270
|
}
|
package/dist/index.d.mts
CHANGED
|
@@ -2,6 +2,7 @@ import { CanvasClient, RouteClient, CompositionResolvedGetResponse, ComponentIns
|
|
|
2
2
|
import * as _uniformdev_canvas_next_rsc_shared from '@uniformdev/canvas-next-rsc-shared';
|
|
3
3
|
import { PageParameters, AppDirectoryContextState, AppDirectoryServerContext, ComponentProps, CompositionContext, SlotDefinition, AppDirectoryContext } from '@uniformdev/canvas-next-rsc-shared';
|
|
4
4
|
export { ComponentProps, CompositionContext, PageParameters } from '@uniformdev/canvas-next-rsc-shared';
|
|
5
|
+
import { C as CacheMode } from './models-a7648139.js';
|
|
5
6
|
import { ManifestClient } from '@uniformdev/context/api';
|
|
6
7
|
import { ProjectMapClient } from '@uniformdev/project-map';
|
|
7
8
|
import { ContextState, ManifestV2, ContextOptions } from '@uniformdev/context';
|
|
@@ -13,17 +14,17 @@ import { PureUniformTextProps } from '@uniformdev/canvas-react/core';
|
|
|
13
14
|
export { useInitUniformContext, useUniformContext } from '@uniformdev/canvas-next-rsc-client';
|
|
14
15
|
|
|
15
16
|
type GetCanvasClientOptions = {
|
|
16
|
-
|
|
17
|
+
cache: CacheMode;
|
|
17
18
|
};
|
|
18
|
-
declare const getCanvasClient: (options
|
|
19
|
+
declare const getCanvasClient: (options: GetCanvasClientOptions) => CanvasClient;
|
|
19
20
|
declare const getDefaultCanvasClient: ({ searchParams, }: {
|
|
20
21
|
searchParams: PageParameters['searchParams'];
|
|
21
22
|
}) => CanvasClient;
|
|
22
23
|
|
|
23
24
|
type GetManifestClientOptions = {
|
|
24
|
-
|
|
25
|
+
cache: CacheMode;
|
|
25
26
|
};
|
|
26
|
-
declare const getManifestClient: (options
|
|
27
|
+
declare const getManifestClient: (options: GetManifestClientOptions) => ManifestClient;
|
|
27
28
|
declare const getDefaultManifestClient: ({ searchParams, }: {
|
|
28
29
|
searchParams?: PageParameters['searchParams'];
|
|
29
30
|
}) => ManifestClient;
|
|
@@ -183,17 +184,17 @@ declare const getManifest: ({ searchParams }: {
|
|
|
183
184
|
}>;
|
|
184
185
|
|
|
185
186
|
type GetProjectMapClientOptions = {
|
|
186
|
-
|
|
187
|
+
cache: CacheMode;
|
|
187
188
|
};
|
|
188
|
-
declare const getProjectMapClient: (options
|
|
189
|
+
declare const getProjectMapClient: (options: GetProjectMapClientOptions) => ProjectMapClient;
|
|
189
190
|
declare const getDefaultProjectMapClient: ({ searchParams, }: {
|
|
190
191
|
searchParams: PageParameters['searchParams'];
|
|
191
192
|
}) => ProjectMapClient;
|
|
192
193
|
|
|
193
194
|
type GetRouteClientOptions = {
|
|
194
|
-
|
|
195
|
+
cache: CacheMode;
|
|
195
196
|
};
|
|
196
|
-
declare const getRouteClient: (options
|
|
197
|
+
declare const getRouteClient: (options: GetRouteClientOptions) => RouteClient;
|
|
197
198
|
declare const getDefaultRouteClient: ({ searchParams }: {
|
|
198
199
|
searchParams: PageParameters['searchParams'];
|
|
199
200
|
}) => RouteClient;
|
package/dist/index.d.ts
CHANGED
|
@@ -2,6 +2,7 @@ import { CanvasClient, RouteClient, CompositionResolvedGetResponse, ComponentIns
|
|
|
2
2
|
import * as _uniformdev_canvas_next_rsc_shared from '@uniformdev/canvas-next-rsc-shared';
|
|
3
3
|
import { PageParameters, AppDirectoryContextState, AppDirectoryServerContext, ComponentProps, CompositionContext, SlotDefinition, AppDirectoryContext } from '@uniformdev/canvas-next-rsc-shared';
|
|
4
4
|
export { ComponentProps, CompositionContext, PageParameters } from '@uniformdev/canvas-next-rsc-shared';
|
|
5
|
+
import { C as CacheMode } from './models-a7648139.js';
|
|
5
6
|
import { ManifestClient } from '@uniformdev/context/api';
|
|
6
7
|
import { ProjectMapClient } from '@uniformdev/project-map';
|
|
7
8
|
import { ContextState, ManifestV2, ContextOptions } from '@uniformdev/context';
|
|
@@ -13,17 +14,17 @@ import { PureUniformTextProps } from '@uniformdev/canvas-react/core';
|
|
|
13
14
|
export { useInitUniformContext, useUniformContext } from '@uniformdev/canvas-next-rsc-client';
|
|
14
15
|
|
|
15
16
|
type GetCanvasClientOptions = {
|
|
16
|
-
|
|
17
|
+
cache: CacheMode;
|
|
17
18
|
};
|
|
18
|
-
declare const getCanvasClient: (options
|
|
19
|
+
declare const getCanvasClient: (options: GetCanvasClientOptions) => CanvasClient;
|
|
19
20
|
declare const getDefaultCanvasClient: ({ searchParams, }: {
|
|
20
21
|
searchParams: PageParameters['searchParams'];
|
|
21
22
|
}) => CanvasClient;
|
|
22
23
|
|
|
23
24
|
type GetManifestClientOptions = {
|
|
24
|
-
|
|
25
|
+
cache: CacheMode;
|
|
25
26
|
};
|
|
26
|
-
declare const getManifestClient: (options
|
|
27
|
+
declare const getManifestClient: (options: GetManifestClientOptions) => ManifestClient;
|
|
27
28
|
declare const getDefaultManifestClient: ({ searchParams, }: {
|
|
28
29
|
searchParams?: PageParameters['searchParams'];
|
|
29
30
|
}) => ManifestClient;
|
|
@@ -183,17 +184,17 @@ declare const getManifest: ({ searchParams }: {
|
|
|
183
184
|
}>;
|
|
184
185
|
|
|
185
186
|
type GetProjectMapClientOptions = {
|
|
186
|
-
|
|
187
|
+
cache: CacheMode;
|
|
187
188
|
};
|
|
188
|
-
declare const getProjectMapClient: (options
|
|
189
|
+
declare const getProjectMapClient: (options: GetProjectMapClientOptions) => ProjectMapClient;
|
|
189
190
|
declare const getDefaultProjectMapClient: ({ searchParams, }: {
|
|
190
191
|
searchParams: PageParameters['searchParams'];
|
|
191
192
|
}) => ProjectMapClient;
|
|
192
193
|
|
|
193
194
|
type GetRouteClientOptions = {
|
|
194
|
-
|
|
195
|
+
cache: CacheMode;
|
|
195
196
|
};
|
|
196
|
-
declare const getRouteClient: (options
|
|
197
|
+
declare const getRouteClient: (options: GetRouteClientOptions) => RouteClient;
|
|
197
198
|
declare const getDefaultRouteClient: ({ searchParams }: {
|
|
198
199
|
searchParams: PageParameters['searchParams'];
|
|
199
200
|
}) => RouteClient;
|
package/dist/index.esm.js
CHANGED
|
@@ -39,26 +39,47 @@ var isDevelopmentEnvironment = () => {
|
|
|
39
39
|
};
|
|
40
40
|
|
|
41
41
|
// src/config/helpers.ts
|
|
42
|
-
var
|
|
43
|
-
if (isDraftModeEnabled(options) || isOnVercelPreviewEnvironment()) {
|
|
44
|
-
return -1;
|
|
45
|
-
}
|
|
42
|
+
var getCanvasCacheStrategy = (options) => {
|
|
46
43
|
const config = getServerConfig();
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
var getManifestRevalidateInterval = (options) => {
|
|
50
|
-
if (isDraftModeEnabled(options) || isOnVercelPreviewEnvironment()) {
|
|
51
|
-
return -1;
|
|
44
|
+
if (config.canvasCache) {
|
|
45
|
+
return config.canvasCache;
|
|
52
46
|
}
|
|
53
|
-
|
|
54
|
-
|
|
47
|
+
if (isDevelopmentEnvironment() || isDraftModeEnabled(options) || isOnVercelPreviewEnvironment()) {
|
|
48
|
+
return {
|
|
49
|
+
type: "no-cache"
|
|
50
|
+
};
|
|
51
|
+
}
|
|
52
|
+
return {
|
|
53
|
+
type: "force-cache"
|
|
54
|
+
};
|
|
55
55
|
};
|
|
56
|
-
var
|
|
57
|
-
|
|
58
|
-
|
|
56
|
+
var getManifestCacheStrategy = (options) => {
|
|
57
|
+
const config = getServerConfig();
|
|
58
|
+
if (config.manifestCache) {
|
|
59
|
+
return config.manifestCache;
|
|
60
|
+
}
|
|
61
|
+
if (isDevelopmentEnvironment() || isDraftModeEnabled(options) || isOnVercelPreviewEnvironment()) {
|
|
62
|
+
return {
|
|
63
|
+
type: "no-cache"
|
|
64
|
+
};
|
|
59
65
|
}
|
|
66
|
+
return {
|
|
67
|
+
type: "force-cache"
|
|
68
|
+
};
|
|
69
|
+
};
|
|
70
|
+
var getProjectMapCacheStrategy = (options) => {
|
|
60
71
|
const config = getServerConfig();
|
|
61
|
-
|
|
72
|
+
if (config.projectMapCache) {
|
|
73
|
+
return config.projectMapCache;
|
|
74
|
+
}
|
|
75
|
+
if (isDevelopmentEnvironment() || isDraftModeEnabled(options) || isOnVercelPreviewEnvironment()) {
|
|
76
|
+
return {
|
|
77
|
+
type: "no-cache"
|
|
78
|
+
};
|
|
79
|
+
}
|
|
80
|
+
return {
|
|
81
|
+
type: "force-cache"
|
|
82
|
+
};
|
|
62
83
|
};
|
|
63
84
|
var getServerConfig = () => {
|
|
64
85
|
let serverConfig;
|
|
@@ -81,6 +102,22 @@ var buildCompositionTag = (compositionId) => {
|
|
|
81
102
|
return `composition:${compositionId}`.toLowerCase();
|
|
82
103
|
};
|
|
83
104
|
|
|
105
|
+
// src/clients/shared.ts
|
|
106
|
+
var determineFetchCacheOptions = (mode) => {
|
|
107
|
+
let cache = void 0;
|
|
108
|
+
let revalidate = void 0;
|
|
109
|
+
if (mode.type === "revalidate") {
|
|
110
|
+
cache = void 0;
|
|
111
|
+
revalidate = mode.interval;
|
|
112
|
+
} else {
|
|
113
|
+
cache = mode.type;
|
|
114
|
+
}
|
|
115
|
+
return {
|
|
116
|
+
cache,
|
|
117
|
+
revalidate
|
|
118
|
+
};
|
|
119
|
+
};
|
|
120
|
+
|
|
84
121
|
// src/clients/canvasClient.ts
|
|
85
122
|
var getCanvasClient = (options) => {
|
|
86
123
|
return new CanvasClient({
|
|
@@ -113,15 +150,10 @@ var getCanvasClient = (options) => {
|
|
|
113
150
|
}
|
|
114
151
|
}
|
|
115
152
|
}
|
|
116
|
-
|
|
117
|
-
let noCache = false;
|
|
118
|
-
if (revalidate === -1 || isDevelopmentEnvironment()) {
|
|
119
|
-
noCache = true;
|
|
120
|
-
revalidate = void 0;
|
|
121
|
-
}
|
|
153
|
+
const { cache, revalidate } = determineFetchCacheOptions(options.cache);
|
|
122
154
|
return fetch(req, {
|
|
123
155
|
...init,
|
|
124
|
-
cache
|
|
156
|
+
cache,
|
|
125
157
|
next: {
|
|
126
158
|
revalidate
|
|
127
159
|
}
|
|
@@ -133,7 +165,7 @@ var getDefaultCanvasClient = ({
|
|
|
133
165
|
searchParams
|
|
134
166
|
}) => {
|
|
135
167
|
return getCanvasClient({
|
|
136
|
-
|
|
168
|
+
cache: getCanvasCacheStrategy({
|
|
137
169
|
searchParams
|
|
138
170
|
})
|
|
139
171
|
});
|
|
@@ -147,15 +179,10 @@ var getManifestClient = (options) => {
|
|
|
147
179
|
apiKey: process.env.UNIFORM_API_KEY,
|
|
148
180
|
projectId: process.env.UNIFORM_PROJECT_ID,
|
|
149
181
|
fetch: (req, init) => {
|
|
150
|
-
|
|
151
|
-
let noCache = false;
|
|
152
|
-
if (revalidate === -1 || isDevelopmentEnvironment()) {
|
|
153
|
-
noCache = true;
|
|
154
|
-
revalidate = void 0;
|
|
155
|
-
}
|
|
182
|
+
const { cache, revalidate } = determineFetchCacheOptions(options.cache);
|
|
156
183
|
return fetch(req, {
|
|
157
184
|
...init,
|
|
158
|
-
cache
|
|
185
|
+
cache,
|
|
159
186
|
next: {
|
|
160
187
|
revalidate,
|
|
161
188
|
tags: ["manifest"]
|
|
@@ -169,7 +196,7 @@ var getDefaultManifestClient = ({
|
|
|
169
196
|
searchParams
|
|
170
197
|
}) => {
|
|
171
198
|
return getManifestClient({
|
|
172
|
-
|
|
199
|
+
cache: getManifestCacheStrategy({
|
|
173
200
|
searchParams
|
|
174
201
|
})
|
|
175
202
|
});
|
|
@@ -189,10 +216,12 @@ var getProjectMapClient = (options) => {
|
|
|
189
216
|
apiKey: process.env.UNIFORM_API_KEY,
|
|
190
217
|
projectId: process.env.UNIFORM_PROJECT_ID,
|
|
191
218
|
fetch: (req, init) => {
|
|
219
|
+
const { cache, revalidate } = determineFetchCacheOptions(options.cache);
|
|
192
220
|
return fetch(req, {
|
|
193
221
|
...init,
|
|
222
|
+
cache,
|
|
194
223
|
next: {
|
|
195
|
-
revalidate
|
|
224
|
+
revalidate
|
|
196
225
|
}
|
|
197
226
|
});
|
|
198
227
|
}
|
|
@@ -203,7 +232,7 @@ var getDefaultProjectMapClient = ({
|
|
|
203
232
|
searchParams
|
|
204
233
|
}) => {
|
|
205
234
|
return getProjectMapClient({
|
|
206
|
-
|
|
235
|
+
cache: getProjectMapCacheStrategy({
|
|
207
236
|
searchParams
|
|
208
237
|
})
|
|
209
238
|
});
|
|
@@ -247,22 +276,14 @@ var getRouteClient = (options) => {
|
|
|
247
276
|
}
|
|
248
277
|
}
|
|
249
278
|
}
|
|
250
|
-
|
|
251
|
-
let noCache = false;
|
|
252
|
-
if (options == null ? void 0 : options.revalidate) {
|
|
253
|
-
revalidate = options.revalidate;
|
|
254
|
-
}
|
|
255
|
-
if (revalidate === -1 || isDevelopmentEnvironment()) {
|
|
256
|
-
noCache = true;
|
|
257
|
-
revalidate = void 0;
|
|
258
|
-
}
|
|
279
|
+
const { cache, revalidate } = determineFetchCacheOptions(options.cache);
|
|
259
280
|
return fetch(req, {
|
|
260
281
|
...init,
|
|
261
282
|
headers: {
|
|
262
283
|
...init == null ? void 0 : init.headers,
|
|
263
284
|
"x-bypass-cache": bypassCache.toString()
|
|
264
285
|
},
|
|
265
|
-
cache
|
|
286
|
+
cache,
|
|
266
287
|
next: {
|
|
267
288
|
revalidate,
|
|
268
289
|
tags: tags.length ? tags : void 0
|
|
@@ -274,7 +295,7 @@ var getRouteClient = (options) => {
|
|
|
274
295
|
};
|
|
275
296
|
var getDefaultRouteClient = ({ searchParams }) => {
|
|
276
297
|
return getRouteClient({
|
|
277
|
-
|
|
298
|
+
cache: getCanvasCacheStrategy({
|
|
278
299
|
searchParams
|
|
279
300
|
})
|
|
280
301
|
});
|
package/dist/index.js
CHANGED
|
@@ -93,26 +93,47 @@ var isDevelopmentEnvironment = () => {
|
|
|
93
93
|
};
|
|
94
94
|
|
|
95
95
|
// src/config/helpers.ts
|
|
96
|
-
var
|
|
97
|
-
if (isDraftModeEnabled(options) || isOnVercelPreviewEnvironment()) {
|
|
98
|
-
return -1;
|
|
99
|
-
}
|
|
96
|
+
var getCanvasCacheStrategy = (options) => {
|
|
100
97
|
const config = getServerConfig();
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
var getManifestRevalidateInterval = (options) => {
|
|
104
|
-
if (isDraftModeEnabled(options) || isOnVercelPreviewEnvironment()) {
|
|
105
|
-
return -1;
|
|
98
|
+
if (config.canvasCache) {
|
|
99
|
+
return config.canvasCache;
|
|
106
100
|
}
|
|
107
|
-
|
|
108
|
-
|
|
101
|
+
if (isDevelopmentEnvironment() || isDraftModeEnabled(options) || isOnVercelPreviewEnvironment()) {
|
|
102
|
+
return {
|
|
103
|
+
type: "no-cache"
|
|
104
|
+
};
|
|
105
|
+
}
|
|
106
|
+
return {
|
|
107
|
+
type: "force-cache"
|
|
108
|
+
};
|
|
109
109
|
};
|
|
110
|
-
var
|
|
111
|
-
|
|
112
|
-
|
|
110
|
+
var getManifestCacheStrategy = (options) => {
|
|
111
|
+
const config = getServerConfig();
|
|
112
|
+
if (config.manifestCache) {
|
|
113
|
+
return config.manifestCache;
|
|
114
|
+
}
|
|
115
|
+
if (isDevelopmentEnvironment() || isDraftModeEnabled(options) || isOnVercelPreviewEnvironment()) {
|
|
116
|
+
return {
|
|
117
|
+
type: "no-cache"
|
|
118
|
+
};
|
|
113
119
|
}
|
|
120
|
+
return {
|
|
121
|
+
type: "force-cache"
|
|
122
|
+
};
|
|
123
|
+
};
|
|
124
|
+
var getProjectMapCacheStrategy = (options) => {
|
|
114
125
|
const config = getServerConfig();
|
|
115
|
-
|
|
126
|
+
if (config.projectMapCache) {
|
|
127
|
+
return config.projectMapCache;
|
|
128
|
+
}
|
|
129
|
+
if (isDevelopmentEnvironment() || isDraftModeEnabled(options) || isOnVercelPreviewEnvironment()) {
|
|
130
|
+
return {
|
|
131
|
+
type: "no-cache"
|
|
132
|
+
};
|
|
133
|
+
}
|
|
134
|
+
return {
|
|
135
|
+
type: "force-cache"
|
|
136
|
+
};
|
|
116
137
|
};
|
|
117
138
|
var getServerConfig = () => {
|
|
118
139
|
let serverConfig;
|
|
@@ -135,6 +156,22 @@ var buildCompositionTag = (compositionId) => {
|
|
|
135
156
|
return `composition:${compositionId}`.toLowerCase();
|
|
136
157
|
};
|
|
137
158
|
|
|
159
|
+
// src/clients/shared.ts
|
|
160
|
+
var determineFetchCacheOptions = (mode) => {
|
|
161
|
+
let cache = void 0;
|
|
162
|
+
let revalidate = void 0;
|
|
163
|
+
if (mode.type === "revalidate") {
|
|
164
|
+
cache = void 0;
|
|
165
|
+
revalidate = mode.interval;
|
|
166
|
+
} else {
|
|
167
|
+
cache = mode.type;
|
|
168
|
+
}
|
|
169
|
+
return {
|
|
170
|
+
cache,
|
|
171
|
+
revalidate
|
|
172
|
+
};
|
|
173
|
+
};
|
|
174
|
+
|
|
138
175
|
// src/clients/canvasClient.ts
|
|
139
176
|
var getCanvasClient = (options) => {
|
|
140
177
|
return new import_canvas2.CanvasClient({
|
|
@@ -167,15 +204,10 @@ var getCanvasClient = (options) => {
|
|
|
167
204
|
}
|
|
168
205
|
}
|
|
169
206
|
}
|
|
170
|
-
|
|
171
|
-
let noCache = false;
|
|
172
|
-
if (revalidate === -1 || isDevelopmentEnvironment()) {
|
|
173
|
-
noCache = true;
|
|
174
|
-
revalidate = void 0;
|
|
175
|
-
}
|
|
207
|
+
const { cache, revalidate } = determineFetchCacheOptions(options.cache);
|
|
176
208
|
return fetch(req, {
|
|
177
209
|
...init,
|
|
178
|
-
cache
|
|
210
|
+
cache,
|
|
179
211
|
next: {
|
|
180
212
|
revalidate
|
|
181
213
|
}
|
|
@@ -187,7 +219,7 @@ var getDefaultCanvasClient = ({
|
|
|
187
219
|
searchParams
|
|
188
220
|
}) => {
|
|
189
221
|
return getCanvasClient({
|
|
190
|
-
|
|
222
|
+
cache: getCanvasCacheStrategy({
|
|
191
223
|
searchParams
|
|
192
224
|
})
|
|
193
225
|
});
|
|
@@ -201,15 +233,10 @@ var getManifestClient = (options) => {
|
|
|
201
233
|
apiKey: process.env.UNIFORM_API_KEY,
|
|
202
234
|
projectId: process.env.UNIFORM_PROJECT_ID,
|
|
203
235
|
fetch: (req, init) => {
|
|
204
|
-
|
|
205
|
-
let noCache = false;
|
|
206
|
-
if (revalidate === -1 || isDevelopmentEnvironment()) {
|
|
207
|
-
noCache = true;
|
|
208
|
-
revalidate = void 0;
|
|
209
|
-
}
|
|
236
|
+
const { cache, revalidate } = determineFetchCacheOptions(options.cache);
|
|
210
237
|
return fetch(req, {
|
|
211
238
|
...init,
|
|
212
|
-
cache
|
|
239
|
+
cache,
|
|
213
240
|
next: {
|
|
214
241
|
revalidate,
|
|
215
242
|
tags: ["manifest"]
|
|
@@ -223,7 +250,7 @@ var getDefaultManifestClient = ({
|
|
|
223
250
|
searchParams
|
|
224
251
|
}) => {
|
|
225
252
|
return getManifestClient({
|
|
226
|
-
|
|
253
|
+
cache: getManifestCacheStrategy({
|
|
227
254
|
searchParams
|
|
228
255
|
})
|
|
229
256
|
});
|
|
@@ -243,10 +270,12 @@ var getProjectMapClient = (options) => {
|
|
|
243
270
|
apiKey: process.env.UNIFORM_API_KEY,
|
|
244
271
|
projectId: process.env.UNIFORM_PROJECT_ID,
|
|
245
272
|
fetch: (req, init) => {
|
|
273
|
+
const { cache, revalidate } = determineFetchCacheOptions(options.cache);
|
|
246
274
|
return fetch(req, {
|
|
247
275
|
...init,
|
|
276
|
+
cache,
|
|
248
277
|
next: {
|
|
249
|
-
revalidate
|
|
278
|
+
revalidate
|
|
250
279
|
}
|
|
251
280
|
});
|
|
252
281
|
}
|
|
@@ -257,7 +286,7 @@ var getDefaultProjectMapClient = ({
|
|
|
257
286
|
searchParams
|
|
258
287
|
}) => {
|
|
259
288
|
return getProjectMapClient({
|
|
260
|
-
|
|
289
|
+
cache: getProjectMapCacheStrategy({
|
|
261
290
|
searchParams
|
|
262
291
|
})
|
|
263
292
|
});
|
|
@@ -296,22 +325,14 @@ var getRouteClient = (options) => {
|
|
|
296
325
|
}
|
|
297
326
|
}
|
|
298
327
|
}
|
|
299
|
-
|
|
300
|
-
let noCache = false;
|
|
301
|
-
if (options == null ? void 0 : options.revalidate) {
|
|
302
|
-
revalidate = options.revalidate;
|
|
303
|
-
}
|
|
304
|
-
if (revalidate === -1 || isDevelopmentEnvironment()) {
|
|
305
|
-
noCache = true;
|
|
306
|
-
revalidate = void 0;
|
|
307
|
-
}
|
|
328
|
+
const { cache, revalidate } = determineFetchCacheOptions(options.cache);
|
|
308
329
|
return fetch(req, {
|
|
309
330
|
...init,
|
|
310
331
|
headers: {
|
|
311
332
|
...init == null ? void 0 : init.headers,
|
|
312
333
|
"x-bypass-cache": bypassCache.toString()
|
|
313
334
|
},
|
|
314
|
-
cache
|
|
335
|
+
cache,
|
|
315
336
|
next: {
|
|
316
337
|
revalidate,
|
|
317
338
|
tags: tags.length ? tags : void 0
|
|
@@ -323,7 +344,7 @@ var getRouteClient = (options) => {
|
|
|
323
344
|
};
|
|
324
345
|
var getDefaultRouteClient = ({ searchParams }) => {
|
|
325
346
|
return getRouteClient({
|
|
326
|
-
|
|
347
|
+
cache: getCanvasCacheStrategy({
|
|
327
348
|
searchParams
|
|
328
349
|
})
|
|
329
350
|
});
|
package/dist/index.mjs
CHANGED
|
@@ -39,26 +39,47 @@ var isDevelopmentEnvironment = () => {
|
|
|
39
39
|
};
|
|
40
40
|
|
|
41
41
|
// src/config/helpers.ts
|
|
42
|
-
var
|
|
43
|
-
if (isDraftModeEnabled(options) || isOnVercelPreviewEnvironment()) {
|
|
44
|
-
return -1;
|
|
45
|
-
}
|
|
42
|
+
var getCanvasCacheStrategy = (options) => {
|
|
46
43
|
const config = getServerConfig();
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
var getManifestRevalidateInterval = (options) => {
|
|
50
|
-
if (isDraftModeEnabled(options) || isOnVercelPreviewEnvironment()) {
|
|
51
|
-
return -1;
|
|
44
|
+
if (config.canvasCache) {
|
|
45
|
+
return config.canvasCache;
|
|
52
46
|
}
|
|
53
|
-
|
|
54
|
-
|
|
47
|
+
if (isDevelopmentEnvironment() || isDraftModeEnabled(options) || isOnVercelPreviewEnvironment()) {
|
|
48
|
+
return {
|
|
49
|
+
type: "no-cache"
|
|
50
|
+
};
|
|
51
|
+
}
|
|
52
|
+
return {
|
|
53
|
+
type: "force-cache"
|
|
54
|
+
};
|
|
55
55
|
};
|
|
56
|
-
var
|
|
57
|
-
|
|
58
|
-
|
|
56
|
+
var getManifestCacheStrategy = (options) => {
|
|
57
|
+
const config = getServerConfig();
|
|
58
|
+
if (config.manifestCache) {
|
|
59
|
+
return config.manifestCache;
|
|
60
|
+
}
|
|
61
|
+
if (isDevelopmentEnvironment() || isDraftModeEnabled(options) || isOnVercelPreviewEnvironment()) {
|
|
62
|
+
return {
|
|
63
|
+
type: "no-cache"
|
|
64
|
+
};
|
|
59
65
|
}
|
|
66
|
+
return {
|
|
67
|
+
type: "force-cache"
|
|
68
|
+
};
|
|
69
|
+
};
|
|
70
|
+
var getProjectMapCacheStrategy = (options) => {
|
|
60
71
|
const config = getServerConfig();
|
|
61
|
-
|
|
72
|
+
if (config.projectMapCache) {
|
|
73
|
+
return config.projectMapCache;
|
|
74
|
+
}
|
|
75
|
+
if (isDevelopmentEnvironment() || isDraftModeEnabled(options) || isOnVercelPreviewEnvironment()) {
|
|
76
|
+
return {
|
|
77
|
+
type: "no-cache"
|
|
78
|
+
};
|
|
79
|
+
}
|
|
80
|
+
return {
|
|
81
|
+
type: "force-cache"
|
|
82
|
+
};
|
|
62
83
|
};
|
|
63
84
|
var getServerConfig = () => {
|
|
64
85
|
let serverConfig;
|
|
@@ -81,6 +102,22 @@ var buildCompositionTag = (compositionId) => {
|
|
|
81
102
|
return `composition:${compositionId}`.toLowerCase();
|
|
82
103
|
};
|
|
83
104
|
|
|
105
|
+
// src/clients/shared.ts
|
|
106
|
+
var determineFetchCacheOptions = (mode) => {
|
|
107
|
+
let cache = void 0;
|
|
108
|
+
let revalidate = void 0;
|
|
109
|
+
if (mode.type === "revalidate") {
|
|
110
|
+
cache = void 0;
|
|
111
|
+
revalidate = mode.interval;
|
|
112
|
+
} else {
|
|
113
|
+
cache = mode.type;
|
|
114
|
+
}
|
|
115
|
+
return {
|
|
116
|
+
cache,
|
|
117
|
+
revalidate
|
|
118
|
+
};
|
|
119
|
+
};
|
|
120
|
+
|
|
84
121
|
// src/clients/canvasClient.ts
|
|
85
122
|
var getCanvasClient = (options) => {
|
|
86
123
|
return new CanvasClient({
|
|
@@ -113,15 +150,10 @@ var getCanvasClient = (options) => {
|
|
|
113
150
|
}
|
|
114
151
|
}
|
|
115
152
|
}
|
|
116
|
-
|
|
117
|
-
let noCache = false;
|
|
118
|
-
if (revalidate === -1 || isDevelopmentEnvironment()) {
|
|
119
|
-
noCache = true;
|
|
120
|
-
revalidate = void 0;
|
|
121
|
-
}
|
|
153
|
+
const { cache, revalidate } = determineFetchCacheOptions(options.cache);
|
|
122
154
|
return fetch(req, {
|
|
123
155
|
...init,
|
|
124
|
-
cache
|
|
156
|
+
cache,
|
|
125
157
|
next: {
|
|
126
158
|
revalidate
|
|
127
159
|
}
|
|
@@ -133,7 +165,7 @@ var getDefaultCanvasClient = ({
|
|
|
133
165
|
searchParams
|
|
134
166
|
}) => {
|
|
135
167
|
return getCanvasClient({
|
|
136
|
-
|
|
168
|
+
cache: getCanvasCacheStrategy({
|
|
137
169
|
searchParams
|
|
138
170
|
})
|
|
139
171
|
});
|
|
@@ -147,15 +179,10 @@ var getManifestClient = (options) => {
|
|
|
147
179
|
apiKey: process.env.UNIFORM_API_KEY,
|
|
148
180
|
projectId: process.env.UNIFORM_PROJECT_ID,
|
|
149
181
|
fetch: (req, init) => {
|
|
150
|
-
|
|
151
|
-
let noCache = false;
|
|
152
|
-
if (revalidate === -1 || isDevelopmentEnvironment()) {
|
|
153
|
-
noCache = true;
|
|
154
|
-
revalidate = void 0;
|
|
155
|
-
}
|
|
182
|
+
const { cache, revalidate } = determineFetchCacheOptions(options.cache);
|
|
156
183
|
return fetch(req, {
|
|
157
184
|
...init,
|
|
158
|
-
cache
|
|
185
|
+
cache,
|
|
159
186
|
next: {
|
|
160
187
|
revalidate,
|
|
161
188
|
tags: ["manifest"]
|
|
@@ -169,7 +196,7 @@ var getDefaultManifestClient = ({
|
|
|
169
196
|
searchParams
|
|
170
197
|
}) => {
|
|
171
198
|
return getManifestClient({
|
|
172
|
-
|
|
199
|
+
cache: getManifestCacheStrategy({
|
|
173
200
|
searchParams
|
|
174
201
|
})
|
|
175
202
|
});
|
|
@@ -189,10 +216,12 @@ var getProjectMapClient = (options) => {
|
|
|
189
216
|
apiKey: process.env.UNIFORM_API_KEY,
|
|
190
217
|
projectId: process.env.UNIFORM_PROJECT_ID,
|
|
191
218
|
fetch: (req, init) => {
|
|
219
|
+
const { cache, revalidate } = determineFetchCacheOptions(options.cache);
|
|
192
220
|
return fetch(req, {
|
|
193
221
|
...init,
|
|
222
|
+
cache,
|
|
194
223
|
next: {
|
|
195
|
-
revalidate
|
|
224
|
+
revalidate
|
|
196
225
|
}
|
|
197
226
|
});
|
|
198
227
|
}
|
|
@@ -203,7 +232,7 @@ var getDefaultProjectMapClient = ({
|
|
|
203
232
|
searchParams
|
|
204
233
|
}) => {
|
|
205
234
|
return getProjectMapClient({
|
|
206
|
-
|
|
235
|
+
cache: getProjectMapCacheStrategy({
|
|
207
236
|
searchParams
|
|
208
237
|
})
|
|
209
238
|
});
|
|
@@ -247,22 +276,14 @@ var getRouteClient = (options) => {
|
|
|
247
276
|
}
|
|
248
277
|
}
|
|
249
278
|
}
|
|
250
|
-
|
|
251
|
-
let noCache = false;
|
|
252
|
-
if (options == null ? void 0 : options.revalidate) {
|
|
253
|
-
revalidate = options.revalidate;
|
|
254
|
-
}
|
|
255
|
-
if (revalidate === -1 || isDevelopmentEnvironment()) {
|
|
256
|
-
noCache = true;
|
|
257
|
-
revalidate = void 0;
|
|
258
|
-
}
|
|
279
|
+
const { cache, revalidate } = determineFetchCacheOptions(options.cache);
|
|
259
280
|
return fetch(req, {
|
|
260
281
|
...init,
|
|
261
282
|
headers: {
|
|
262
283
|
...init == null ? void 0 : init.headers,
|
|
263
284
|
"x-bypass-cache": bypassCache.toString()
|
|
264
285
|
},
|
|
265
|
-
cache
|
|
286
|
+
cache,
|
|
266
287
|
next: {
|
|
267
288
|
revalidate,
|
|
268
289
|
tags: tags.length ? tags : void 0
|
|
@@ -274,7 +295,7 @@ var getRouteClient = (options) => {
|
|
|
274
295
|
};
|
|
275
296
|
var getDefaultRouteClient = ({ searchParams }) => {
|
|
276
297
|
return getRouteClient({
|
|
277
|
-
|
|
298
|
+
cache: getCanvasCacheStrategy({
|
|
278
299
|
searchParams
|
|
279
300
|
})
|
|
280
301
|
});
|
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
type CacheMode = {
|
|
2
|
+
type: RequestInit['cache'];
|
|
3
|
+
} | {
|
|
4
|
+
type: 'revalidate';
|
|
5
|
+
interval: number;
|
|
6
|
+
};
|
|
7
|
+
type UniformServerConfig = {
|
|
8
|
+
/**
|
|
9
|
+
* Sets the default value of storage consent for new unknown visitors.
|
|
10
|
+
*
|
|
11
|
+
* @default false
|
|
12
|
+
*/
|
|
13
|
+
defaultConsent?: boolean;
|
|
14
|
+
/**
|
|
15
|
+
* Cache mode for manifest data.
|
|
16
|
+
*
|
|
17
|
+
*/
|
|
18
|
+
manifestCache?: CacheMode;
|
|
19
|
+
/**
|
|
20
|
+
* Cache mode for canvas data.
|
|
21
|
+
*
|
|
22
|
+
*/
|
|
23
|
+
canvasCache?: CacheMode;
|
|
24
|
+
/**
|
|
25
|
+
* Cache mode for project map data.
|
|
26
|
+
*
|
|
27
|
+
*/
|
|
28
|
+
projectMapCache?: CacheMode;
|
|
29
|
+
/**
|
|
30
|
+
* Configure where system components should be evaluated.
|
|
31
|
+
*/
|
|
32
|
+
evaluation?: {
|
|
33
|
+
/**
|
|
34
|
+
* Configure where personalization components should be evaluated.
|
|
35
|
+
*/
|
|
36
|
+
personalization: 'client' | 'server';
|
|
37
|
+
/**
|
|
38
|
+
* Configure where testing components should be evaluated.
|
|
39
|
+
*/
|
|
40
|
+
testing: 'client' | 'server';
|
|
41
|
+
};
|
|
42
|
+
/**
|
|
43
|
+
* 😅
|
|
44
|
+
*/
|
|
45
|
+
experimental?: {
|
|
46
|
+
/**
|
|
47
|
+
* Enables edge cache of redirects.
|
|
48
|
+
*
|
|
49
|
+
* @default false
|
|
50
|
+
*/
|
|
51
|
+
edgeRedirects?: boolean;
|
|
52
|
+
/**
|
|
53
|
+
* Enables edge cache of compositions.
|
|
54
|
+
*
|
|
55
|
+
* @default false
|
|
56
|
+
*/
|
|
57
|
+
edgeCompositions?: boolean;
|
|
58
|
+
/**
|
|
59
|
+
* Dynamic tokens names that should be used for localization.
|
|
60
|
+
*/
|
|
61
|
+
localeDynamicInputs?: string[];
|
|
62
|
+
/**
|
|
63
|
+
* Enables visual editing mode.
|
|
64
|
+
*/
|
|
65
|
+
vercelVisualEditing?: boolean;
|
|
66
|
+
};
|
|
67
|
+
};
|
|
68
|
+
|
|
69
|
+
export { CacheMode as C, UniformServerConfig as U };
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@uniformdev/canvas-next-rsc",
|
|
3
|
-
"version": "19.55.2-alpha.
|
|
3
|
+
"version": "19.55.2-alpha.22+6bad328e5",
|
|
4
4
|
"license": "SEE LICENSE IN LICENSE.txt",
|
|
5
5
|
"scripts": {
|
|
6
6
|
"build": "tsup",
|
|
@@ -53,15 +53,15 @@
|
|
|
53
53
|
"react-dom": "18.2.0"
|
|
54
54
|
},
|
|
55
55
|
"dependencies": {
|
|
56
|
-
"@uniformdev/canvas": "19.55.2-alpha.
|
|
57
|
-
"@uniformdev/canvas-next-rsc-client": "^19.55.2-alpha.
|
|
58
|
-
"@uniformdev/canvas-next-rsc-shared": "^19.55.2-alpha.
|
|
59
|
-
"@uniformdev/canvas-react": "19.55.2-alpha.
|
|
60
|
-
"@uniformdev/context": "19.55.2-alpha.
|
|
61
|
-
"@uniformdev/project-map": "19.55.2-alpha.
|
|
62
|
-
"@uniformdev/redirect": "19.55.2-alpha.
|
|
63
|
-
"@uniformdev/richtext": "19.55.2-alpha.
|
|
64
|
-
"@uniformdev/webhooks": "19.55.2-alpha.
|
|
56
|
+
"@uniformdev/canvas": "19.55.2-alpha.22+6bad328e5",
|
|
57
|
+
"@uniformdev/canvas-next-rsc-client": "^19.55.2-alpha.22+6bad328e5",
|
|
58
|
+
"@uniformdev/canvas-next-rsc-shared": "^19.55.2-alpha.22+6bad328e5",
|
|
59
|
+
"@uniformdev/canvas-react": "19.55.2-alpha.22+6bad328e5",
|
|
60
|
+
"@uniformdev/context": "19.55.2-alpha.22+6bad328e5",
|
|
61
|
+
"@uniformdev/project-map": "19.55.2-alpha.22+6bad328e5",
|
|
62
|
+
"@uniformdev/redirect": "19.55.2-alpha.22+6bad328e5",
|
|
63
|
+
"@uniformdev/richtext": "19.55.2-alpha.22+6bad328e5",
|
|
64
|
+
"@uniformdev/webhooks": "19.55.2-alpha.22+6bad328e5",
|
|
65
65
|
"@vercel/edge-config": "^0.4.0",
|
|
66
66
|
"svix": "^1.5.0"
|
|
67
67
|
},
|
|
@@ -76,5 +76,5 @@
|
|
|
76
76
|
"publishConfig": {
|
|
77
77
|
"access": "public"
|
|
78
78
|
},
|
|
79
|
-
"gitHead": "
|
|
79
|
+
"gitHead": "6bad328e509c2176457d9225a7b172c6ac515bd3"
|
|
80
80
|
}
|