@uniformdev/canvas-next-rsc 20.72.3-alpha.3 → 20.72.3-alpha.45
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/handler.js +9 -6
- package/dist/handler.mjs +10 -7
- package/dist/index.d.mts +12 -3
- package/dist/index.d.ts +12 -3
- package/dist/index.esm.js +22 -13
- package/dist/index.js +23 -12
- package/dist/index.mjs +22 -13
- package/package.json +11 -11
package/dist/handler.js
CHANGED
|
@@ -247,8 +247,8 @@ var determineFetchCacheOptions = (mode) => {
|
|
|
247
247
|
};
|
|
248
248
|
|
|
249
249
|
// src/clients/canvasClient.ts
|
|
250
|
-
var
|
|
251
|
-
return
|
|
250
|
+
var buildCanvasClientOptions = (options) => {
|
|
251
|
+
return {
|
|
252
252
|
projectId: env.getProjectId(),
|
|
253
253
|
apiHost: env.getApiHost(),
|
|
254
254
|
apiKey: env.getApiKey(),
|
|
@@ -293,7 +293,10 @@ var getCanvasClient = (options) => {
|
|
|
293
293
|
}
|
|
294
294
|
});
|
|
295
295
|
}
|
|
296
|
-
}
|
|
296
|
+
};
|
|
297
|
+
};
|
|
298
|
+
var getCompositionDeliveryClient = (options) => {
|
|
299
|
+
return new import_canvas2.CompositionDeliveryClient(buildCanvasClientOptions(options));
|
|
297
300
|
};
|
|
298
301
|
|
|
299
302
|
// src/clients/projectMapClient.ts
|
|
@@ -438,13 +441,13 @@ var processCompositionChange = async (compositionId) => {
|
|
|
438
441
|
};
|
|
439
442
|
};
|
|
440
443
|
var getComposition = async ({ compositionId }) => {
|
|
441
|
-
const canvasClient =
|
|
444
|
+
const canvasClient = getCompositionDeliveryClient({
|
|
442
445
|
cache: {
|
|
443
446
|
type: "no-cache"
|
|
444
447
|
}
|
|
445
448
|
});
|
|
446
449
|
try {
|
|
447
|
-
const composition = await canvasClient.
|
|
450
|
+
const composition = await canvasClient.get({
|
|
448
451
|
compositionId
|
|
449
452
|
});
|
|
450
453
|
return composition;
|
|
@@ -510,7 +513,7 @@ var processEdgeConfigChange = async ({ source_url }) => {
|
|
|
510
513
|
type: "no-cache"
|
|
511
514
|
}
|
|
512
515
|
});
|
|
513
|
-
const route = await routeClient.
|
|
516
|
+
const route = await routeClient.get({
|
|
514
517
|
path: source_url
|
|
515
518
|
});
|
|
516
519
|
let valueToStore = void 0;
|
package/dist/handler.mjs
CHANGED
|
@@ -155,7 +155,7 @@ import { parseConnectionString } from "@vercel/edge-config";
|
|
|
155
155
|
import { Webhook } from "svix";
|
|
156
156
|
|
|
157
157
|
// src/clients/canvasClient.ts
|
|
158
|
-
import { CanvasClient } from "@uniformdev/canvas";
|
|
158
|
+
import { CanvasClient, CompositionDeliveryClient } from "@uniformdev/canvas";
|
|
159
159
|
|
|
160
160
|
// src/config/helpers.ts
|
|
161
161
|
import serverConfig from "uniform.server.config";
|
|
@@ -214,8 +214,8 @@ var determineFetchCacheOptions = (mode) => {
|
|
|
214
214
|
};
|
|
215
215
|
|
|
216
216
|
// src/clients/canvasClient.ts
|
|
217
|
-
var
|
|
218
|
-
return
|
|
217
|
+
var buildCanvasClientOptions = (options) => {
|
|
218
|
+
return {
|
|
219
219
|
projectId: env.getProjectId(),
|
|
220
220
|
apiHost: env.getApiHost(),
|
|
221
221
|
apiKey: env.getApiKey(),
|
|
@@ -260,7 +260,10 @@ var getCanvasClient = (options) => {
|
|
|
260
260
|
}
|
|
261
261
|
});
|
|
262
262
|
}
|
|
263
|
-
}
|
|
263
|
+
};
|
|
264
|
+
};
|
|
265
|
+
var getCompositionDeliveryClient = (options) => {
|
|
266
|
+
return new CompositionDeliveryClient(buildCanvasClientOptions(options));
|
|
264
267
|
};
|
|
265
268
|
|
|
266
269
|
// src/clients/projectMapClient.ts
|
|
@@ -405,13 +408,13 @@ var processCompositionChange = async (compositionId) => {
|
|
|
405
408
|
};
|
|
406
409
|
};
|
|
407
410
|
var getComposition = async ({ compositionId }) => {
|
|
408
|
-
const canvasClient =
|
|
411
|
+
const canvasClient = getCompositionDeliveryClient({
|
|
409
412
|
cache: {
|
|
410
413
|
type: "no-cache"
|
|
411
414
|
}
|
|
412
415
|
});
|
|
413
416
|
try {
|
|
414
|
-
const composition = await canvasClient.
|
|
417
|
+
const composition = await canvasClient.get({
|
|
415
418
|
compositionId
|
|
416
419
|
});
|
|
417
420
|
return composition;
|
|
@@ -477,7 +480,7 @@ var processEdgeConfigChange = async ({ source_url }) => {
|
|
|
477
480
|
type: "no-cache"
|
|
478
481
|
}
|
|
479
482
|
});
|
|
480
|
-
const route = await routeClient.
|
|
483
|
+
const route = await routeClient.get({
|
|
481
484
|
path: source_url
|
|
482
485
|
});
|
|
483
486
|
let valueToStore = void 0;
|
package/dist/index.d.mts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { CanvasClient, RouteClient, CompositionGetBySlugParameters, ResolvedRouteGetResponse, RouteGetParameters } from '@uniformdev/canvas';
|
|
1
|
+
import { CanvasClient, CompositionDeliveryClient, RouteClient, CompositionGetBySlugParameters, ResolvedRouteGetResponse, RouteGetParameters } from '@uniformdev/canvas';
|
|
2
2
|
import { UniformServerConfig, CompositionContext, AppDirectoryContextState, AppDirectoryServerContext, PlaygroundParameters, AwaitedPageParameters, PageParameters } from '@uniformdev/canvas-next-rsc-shared';
|
|
3
3
|
export { PageParameters, PlaygroundParameters } from '@uniformdev/canvas-next-rsc-shared';
|
|
4
4
|
import { ManifestClient } from '@uniformdev/context/api';
|
|
@@ -12,8 +12,17 @@ import { ClientContextComponent } from '@uniformdev/canvas-next-rsc-client';
|
|
|
12
12
|
type GetCanvasClientOptions = {
|
|
13
13
|
cache: NonNullable<UniformServerConfig['canvasCache']>;
|
|
14
14
|
};
|
|
15
|
+
type GetCompositionDeliveryClientOptions = GetCanvasClientOptions;
|
|
16
|
+
/**
|
|
17
|
+
* @deprecated Use {@link getCompositionDeliveryClient} instead
|
|
18
|
+
*/
|
|
15
19
|
declare const getCanvasClient: (options: GetCanvasClientOptions) => CanvasClient;
|
|
20
|
+
declare const getCompositionDeliveryClient: (options: GetCompositionDeliveryClientOptions) => CompositionDeliveryClient;
|
|
21
|
+
/**
|
|
22
|
+
* @deprecated Use {@link getDefaultCompositionDeliveryClient} instead.
|
|
23
|
+
*/
|
|
16
24
|
declare const getDefaultCanvasClient: (options: Pick<CompositionContext, "searchParams">) => Promise<CanvasClient>;
|
|
25
|
+
declare const getDefaultCompositionDeliveryClient: (options: Pick<CompositionContext, "searchParams">) => Promise<CompositionDeliveryClient>;
|
|
17
26
|
|
|
18
27
|
type GetManifestClientOptions = {
|
|
19
28
|
cache: NonNullable<UniformServerConfig['manifestCache']>;
|
|
@@ -248,8 +257,8 @@ type RetrieveSlugOptions = Pick<CompositionGetBySlugParameters, 'slug' | 'locale
|
|
|
248
257
|
[key: string]: string | undefined;
|
|
249
258
|
};
|
|
250
259
|
} & RetrieveCommonOptions;
|
|
251
|
-
type RetrieveRouteFetchOptions = Omit<RouteGetParameters, 'projectId' | 'path' | 'withComponentIDs' | '
|
|
260
|
+
type RetrieveRouteFetchOptions = Omit<RouteGetParameters, 'projectId' | 'path' | 'withComponentIDs' | 'state'>;
|
|
252
261
|
declare const retrieveCompositionBySlug: ({ slug, searchParams, skipPrefetch, locale, releaseId, versionId, }: RetrieveSlugOptions) => Promise<ResolvedRouteGetResponse>;
|
|
253
262
|
declare const retrieveRoute: ({ params, searchParams: providedSearchParams, skipPrefetch }: RetrieveRouteOptions, fetchOptions?: RetrieveRouteFetchOptions) => Promise<ResolvedRouteGetResponse>;
|
|
254
263
|
|
|
255
|
-
export { ContextUpdateTransfer, type ContextUpdateTransferProps, type CreateServerUniformContextProps, type CreateStaticParamsOptions, type GetCanvasClientOptions, type GetManifestClientOptions, type GetProjectMapClientOptions, type GetRouteClientOptions, UniformCompositionProps, UniformContext, type UniformContextProps, UniformPlayground, type UniformPlaygroundProps, createServerUniformContext, createStaticParams, generateStaticParams, getCanvasClient, getDefaultCanvasClient, getDefaultManifestClient, getDefaultProjectMapClient, getDefaultRouteClient, getManifest, getManifestClient, getProjectMapClient, getRouteClient, isDevelopmentEnvironment, isDraftModeEnabled, isIncontextEditingEnabled, isOnVercelPreviewEnvironment, retrieveCompositionBySlug, retrieveRoute };
|
|
264
|
+
export { ContextUpdateTransfer, type ContextUpdateTransferProps, type CreateServerUniformContextProps, type CreateStaticParamsOptions, type GetCanvasClientOptions, type GetCompositionDeliveryClientOptions, type GetManifestClientOptions, type GetProjectMapClientOptions, type GetRouteClientOptions, UniformCompositionProps, UniformContext, type UniformContextProps, UniformPlayground, type UniformPlaygroundProps, createServerUniformContext, createStaticParams, generateStaticParams, getCanvasClient, getCompositionDeliveryClient, getDefaultCanvasClient, getDefaultCompositionDeliveryClient, getDefaultManifestClient, getDefaultProjectMapClient, getDefaultRouteClient, getManifest, getManifestClient, getProjectMapClient, getRouteClient, isDevelopmentEnvironment, isDraftModeEnabled, isIncontextEditingEnabled, isOnVercelPreviewEnvironment, retrieveCompositionBySlug, retrieveRoute };
|
package/dist/index.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { CanvasClient, RouteClient, CompositionGetBySlugParameters, ResolvedRouteGetResponse, RouteGetParameters } from '@uniformdev/canvas';
|
|
1
|
+
import { CanvasClient, CompositionDeliveryClient, RouteClient, CompositionGetBySlugParameters, ResolvedRouteGetResponse, RouteGetParameters } from '@uniformdev/canvas';
|
|
2
2
|
import { UniformServerConfig, CompositionContext, AppDirectoryContextState, AppDirectoryServerContext, PlaygroundParameters, AwaitedPageParameters, PageParameters } from '@uniformdev/canvas-next-rsc-shared';
|
|
3
3
|
export { PageParameters, PlaygroundParameters } from '@uniformdev/canvas-next-rsc-shared';
|
|
4
4
|
import { ManifestClient } from '@uniformdev/context/api';
|
|
@@ -12,8 +12,17 @@ import { ClientContextComponent } from '@uniformdev/canvas-next-rsc-client';
|
|
|
12
12
|
type GetCanvasClientOptions = {
|
|
13
13
|
cache: NonNullable<UniformServerConfig['canvasCache']>;
|
|
14
14
|
};
|
|
15
|
+
type GetCompositionDeliveryClientOptions = GetCanvasClientOptions;
|
|
16
|
+
/**
|
|
17
|
+
* @deprecated Use {@link getCompositionDeliveryClient} instead
|
|
18
|
+
*/
|
|
15
19
|
declare const getCanvasClient: (options: GetCanvasClientOptions) => CanvasClient;
|
|
20
|
+
declare const getCompositionDeliveryClient: (options: GetCompositionDeliveryClientOptions) => CompositionDeliveryClient;
|
|
21
|
+
/**
|
|
22
|
+
* @deprecated Use {@link getDefaultCompositionDeliveryClient} instead.
|
|
23
|
+
*/
|
|
16
24
|
declare const getDefaultCanvasClient: (options: Pick<CompositionContext, "searchParams">) => Promise<CanvasClient>;
|
|
25
|
+
declare const getDefaultCompositionDeliveryClient: (options: Pick<CompositionContext, "searchParams">) => Promise<CompositionDeliveryClient>;
|
|
17
26
|
|
|
18
27
|
type GetManifestClientOptions = {
|
|
19
28
|
cache: NonNullable<UniformServerConfig['manifestCache']>;
|
|
@@ -248,8 +257,8 @@ type RetrieveSlugOptions = Pick<CompositionGetBySlugParameters, 'slug' | 'locale
|
|
|
248
257
|
[key: string]: string | undefined;
|
|
249
258
|
};
|
|
250
259
|
} & RetrieveCommonOptions;
|
|
251
|
-
type RetrieveRouteFetchOptions = Omit<RouteGetParameters, 'projectId' | 'path' | 'withComponentIDs' | '
|
|
260
|
+
type RetrieveRouteFetchOptions = Omit<RouteGetParameters, 'projectId' | 'path' | 'withComponentIDs' | 'state'>;
|
|
252
261
|
declare const retrieveCompositionBySlug: ({ slug, searchParams, skipPrefetch, locale, releaseId, versionId, }: RetrieveSlugOptions) => Promise<ResolvedRouteGetResponse>;
|
|
253
262
|
declare const retrieveRoute: ({ params, searchParams: providedSearchParams, skipPrefetch }: RetrieveRouteOptions, fetchOptions?: RetrieveRouteFetchOptions) => Promise<ResolvedRouteGetResponse>;
|
|
254
263
|
|
|
255
|
-
export { ContextUpdateTransfer, type ContextUpdateTransferProps, type CreateServerUniformContextProps, type CreateStaticParamsOptions, type GetCanvasClientOptions, type GetManifestClientOptions, type GetProjectMapClientOptions, type GetRouteClientOptions, UniformCompositionProps, UniformContext, type UniformContextProps, UniformPlayground, type UniformPlaygroundProps, createServerUniformContext, createStaticParams, generateStaticParams, getCanvasClient, getDefaultCanvasClient, getDefaultManifestClient, getDefaultProjectMapClient, getDefaultRouteClient, getManifest, getManifestClient, getProjectMapClient, getRouteClient, isDevelopmentEnvironment, isDraftModeEnabled, isIncontextEditingEnabled, isOnVercelPreviewEnvironment, retrieveCompositionBySlug, retrieveRoute };
|
|
264
|
+
export { ContextUpdateTransfer, type ContextUpdateTransferProps, type CreateServerUniformContextProps, type CreateStaticParamsOptions, type GetCanvasClientOptions, type GetCompositionDeliveryClientOptions, type GetManifestClientOptions, type GetProjectMapClientOptions, type GetRouteClientOptions, UniformCompositionProps, UniformContext, type UniformContextProps, UniformPlayground, type UniformPlaygroundProps, createServerUniformContext, createStaticParams, generateStaticParams, getCanvasClient, getCompositionDeliveryClient, getDefaultCanvasClient, getDefaultCompositionDeliveryClient, getDefaultManifestClient, getDefaultProjectMapClient, getDefaultRouteClient, getManifest, getManifestClient, getProjectMapClient, getRouteClient, isDevelopmentEnvironment, isDraftModeEnabled, isIncontextEditingEnabled, isOnVercelPreviewEnvironment, retrieveCompositionBySlug, retrieveRoute };
|
package/dist/index.esm.js
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
import "server-only";
|
|
3
3
|
|
|
4
4
|
// src/clients/canvasClient.ts
|
|
5
|
-
import { CanvasClient } from "@uniformdev/canvas";
|
|
5
|
+
import { CanvasClient, CompositionDeliveryClient } from "@uniformdev/canvas";
|
|
6
6
|
|
|
7
7
|
// src/config/helpers.ts
|
|
8
8
|
import serverConfig from "uniform.server.config";
|
|
@@ -184,8 +184,8 @@ var determineFetchCacheOptions = (mode) => {
|
|
|
184
184
|
};
|
|
185
185
|
|
|
186
186
|
// src/clients/canvasClient.ts
|
|
187
|
-
var
|
|
188
|
-
return
|
|
187
|
+
var buildCanvasClientOptions = (options) => {
|
|
188
|
+
return {
|
|
189
189
|
projectId: env.getProjectId(),
|
|
190
190
|
apiHost: env.getApiHost(),
|
|
191
191
|
apiKey: env.getApiKey(),
|
|
@@ -230,13 +230,24 @@ var getCanvasClient = (options) => {
|
|
|
230
230
|
}
|
|
231
231
|
});
|
|
232
232
|
}
|
|
233
|
-
}
|
|
233
|
+
};
|
|
234
|
+
};
|
|
235
|
+
var getCanvasClient = (options) => {
|
|
236
|
+
return new CanvasClient(buildCanvasClientOptions(options));
|
|
237
|
+
};
|
|
238
|
+
var getCompositionDeliveryClient = (options) => {
|
|
239
|
+
return new CompositionDeliveryClient(buildCanvasClientOptions(options));
|
|
234
240
|
};
|
|
235
241
|
var getDefaultCanvasClient = async (options) => {
|
|
236
242
|
return getCanvasClient({
|
|
237
243
|
cache: await getCanvasCacheStrategy(options)
|
|
238
244
|
});
|
|
239
245
|
};
|
|
246
|
+
var getDefaultCompositionDeliveryClient = async (options) => {
|
|
247
|
+
return getCompositionDeliveryClient({
|
|
248
|
+
cache: await getCanvasCacheStrategy(options)
|
|
249
|
+
});
|
|
250
|
+
};
|
|
240
251
|
|
|
241
252
|
// src/clients/manifestClient.ts
|
|
242
253
|
import { ManifestClient } from "@uniformdev/context/api";
|
|
@@ -477,7 +488,6 @@ var retrieveCompositionBySlug = async ({
|
|
|
477
488
|
releaseId,
|
|
478
489
|
versionId
|
|
479
490
|
}) => {
|
|
480
|
-
var _a;
|
|
481
491
|
if (!skipPrefetch) {
|
|
482
492
|
void getManifest({
|
|
483
493
|
searchParams
|
|
@@ -489,15 +499,14 @@ var retrieveCompositionBySlug = async ({
|
|
|
489
499
|
});
|
|
490
500
|
for (let i = 0; i < states.length; i++) {
|
|
491
501
|
const state = states[i];
|
|
492
|
-
const canvasClient = await
|
|
502
|
+
const canvasClient = await getDefaultCompositionDeliveryClient({
|
|
493
503
|
searchParams
|
|
494
504
|
});
|
|
495
505
|
try {
|
|
496
|
-
const composition = await canvasClient.
|
|
506
|
+
const composition = await canvasClient.get({
|
|
497
507
|
slug,
|
|
498
508
|
state,
|
|
499
509
|
withComponentIDs: true,
|
|
500
|
-
withContentSourceMap: isOnVercelPreviewEnvironment() && ((_a = getServerConfig().experimental) == null ? void 0 : _a.vercelVisualEditing),
|
|
501
510
|
locale,
|
|
502
511
|
releaseId,
|
|
503
512
|
versionId
|
|
@@ -571,7 +580,6 @@ var retrieveRouteByPath = async ({
|
|
|
571
580
|
fetchOptions,
|
|
572
581
|
releaseId
|
|
573
582
|
}) => {
|
|
574
|
-
var _a;
|
|
575
583
|
const client = await getDefaultRouteClient({
|
|
576
584
|
searchParams
|
|
577
585
|
});
|
|
@@ -588,13 +596,12 @@ var retrieveRouteByPath = async ({
|
|
|
588
596
|
queryPath = `${helper.pathname}${helper.search}`;
|
|
589
597
|
}
|
|
590
598
|
}
|
|
591
|
-
return await client.
|
|
599
|
+
return await client.get({
|
|
592
600
|
...fetchOptions,
|
|
593
601
|
path: queryPath,
|
|
594
602
|
state,
|
|
595
603
|
dataSourceVariant: getDataSourceVariantFromRouteGetParams(fetchOptions != null ? fetchOptions : {}, state),
|
|
596
604
|
withComponentIDs: true,
|
|
597
|
-
withContentSourceMap: isOnVercelPreviewEnvironment() && ((_a = getServerConfig().experimental) == null ? void 0 : _a.vercelVisualEditing),
|
|
598
605
|
releaseId
|
|
599
606
|
});
|
|
600
607
|
};
|
|
@@ -1158,7 +1165,7 @@ var UniformPlayground = async ({ searchParams, ...rest }) => {
|
|
|
1158
1165
|
if (!id) {
|
|
1159
1166
|
notFound2();
|
|
1160
1167
|
}
|
|
1161
|
-
const canvasClient =
|
|
1168
|
+
const canvasClient = getCompositionDeliveryClient({
|
|
1162
1169
|
cache: {
|
|
1163
1170
|
type: "no-cache"
|
|
1164
1171
|
}
|
|
@@ -1168,7 +1175,7 @@ var UniformPlayground = async ({ searchParams, ...rest }) => {
|
|
|
1168
1175
|
for (let i = 0; i < possibleStates.length; i++) {
|
|
1169
1176
|
const state = possibleStates[i];
|
|
1170
1177
|
try {
|
|
1171
|
-
composition = await canvasClient.
|
|
1178
|
+
composition = await canvasClient.get({
|
|
1172
1179
|
compositionId: id,
|
|
1173
1180
|
state,
|
|
1174
1181
|
withComponentIDs: true
|
|
@@ -1207,7 +1214,9 @@ export {
|
|
|
1207
1214
|
createStaticParams,
|
|
1208
1215
|
generateStaticParams,
|
|
1209
1216
|
getCanvasClient,
|
|
1217
|
+
getCompositionDeliveryClient,
|
|
1210
1218
|
getDefaultCanvasClient,
|
|
1219
|
+
getDefaultCompositionDeliveryClient,
|
|
1211
1220
|
getDefaultManifestClient,
|
|
1212
1221
|
getDefaultProjectMapClient,
|
|
1213
1222
|
getDefaultRouteClient,
|
package/dist/index.js
CHANGED
|
@@ -38,7 +38,9 @@ __export(index_exports, {
|
|
|
38
38
|
createStaticParams: () => createStaticParams,
|
|
39
39
|
generateStaticParams: () => generateStaticParams,
|
|
40
40
|
getCanvasClient: () => getCanvasClient,
|
|
41
|
+
getCompositionDeliveryClient: () => getCompositionDeliveryClient,
|
|
41
42
|
getDefaultCanvasClient: () => getDefaultCanvasClient,
|
|
43
|
+
getDefaultCompositionDeliveryClient: () => getDefaultCompositionDeliveryClient,
|
|
42
44
|
getDefaultManifestClient: () => getDefaultManifestClient,
|
|
43
45
|
getDefaultProjectMapClient: () => getDefaultProjectMapClient,
|
|
44
46
|
getDefaultRouteClient: () => getDefaultRouteClient,
|
|
@@ -237,8 +239,8 @@ var determineFetchCacheOptions = (mode) => {
|
|
|
237
239
|
};
|
|
238
240
|
|
|
239
241
|
// src/clients/canvasClient.ts
|
|
240
|
-
var
|
|
241
|
-
return
|
|
242
|
+
var buildCanvasClientOptions = (options) => {
|
|
243
|
+
return {
|
|
242
244
|
projectId: env.getProjectId(),
|
|
243
245
|
apiHost: env.getApiHost(),
|
|
244
246
|
apiKey: env.getApiKey(),
|
|
@@ -283,13 +285,24 @@ var getCanvasClient = (options) => {
|
|
|
283
285
|
}
|
|
284
286
|
});
|
|
285
287
|
}
|
|
286
|
-
}
|
|
288
|
+
};
|
|
289
|
+
};
|
|
290
|
+
var getCanvasClient = (options) => {
|
|
291
|
+
return new import_canvas2.CanvasClient(buildCanvasClientOptions(options));
|
|
292
|
+
};
|
|
293
|
+
var getCompositionDeliveryClient = (options) => {
|
|
294
|
+
return new import_canvas2.CompositionDeliveryClient(buildCanvasClientOptions(options));
|
|
287
295
|
};
|
|
288
296
|
var getDefaultCanvasClient = async (options) => {
|
|
289
297
|
return getCanvasClient({
|
|
290
298
|
cache: await getCanvasCacheStrategy(options)
|
|
291
299
|
});
|
|
292
300
|
};
|
|
301
|
+
var getDefaultCompositionDeliveryClient = async (options) => {
|
|
302
|
+
return getCompositionDeliveryClient({
|
|
303
|
+
cache: await getCanvasCacheStrategy(options)
|
|
304
|
+
});
|
|
305
|
+
};
|
|
293
306
|
|
|
294
307
|
// src/clients/manifestClient.ts
|
|
295
308
|
var import_api = require("@uniformdev/context/api");
|
|
@@ -505,7 +518,6 @@ var retrieveCompositionBySlug = async ({
|
|
|
505
518
|
releaseId,
|
|
506
519
|
versionId
|
|
507
520
|
}) => {
|
|
508
|
-
var _a;
|
|
509
521
|
if (!skipPrefetch) {
|
|
510
522
|
void getManifest({
|
|
511
523
|
searchParams
|
|
@@ -517,15 +529,14 @@ var retrieveCompositionBySlug = async ({
|
|
|
517
529
|
});
|
|
518
530
|
for (let i = 0; i < states.length; i++) {
|
|
519
531
|
const state = states[i];
|
|
520
|
-
const canvasClient = await
|
|
532
|
+
const canvasClient = await getDefaultCompositionDeliveryClient({
|
|
521
533
|
searchParams
|
|
522
534
|
});
|
|
523
535
|
try {
|
|
524
|
-
const composition = await canvasClient.
|
|
536
|
+
const composition = await canvasClient.get({
|
|
525
537
|
slug,
|
|
526
538
|
state,
|
|
527
539
|
withComponentIDs: true,
|
|
528
|
-
withContentSourceMap: isOnVercelPreviewEnvironment() && ((_a = getServerConfig().experimental) == null ? void 0 : _a.vercelVisualEditing),
|
|
529
540
|
locale,
|
|
530
541
|
releaseId,
|
|
531
542
|
versionId
|
|
@@ -599,7 +610,6 @@ var retrieveRouteByPath = async ({
|
|
|
599
610
|
fetchOptions,
|
|
600
611
|
releaseId
|
|
601
612
|
}) => {
|
|
602
|
-
var _a;
|
|
603
613
|
const client = await getDefaultRouteClient({
|
|
604
614
|
searchParams
|
|
605
615
|
});
|
|
@@ -616,13 +626,12 @@ var retrieveRouteByPath = async ({
|
|
|
616
626
|
queryPath = `${helper.pathname}${helper.search}`;
|
|
617
627
|
}
|
|
618
628
|
}
|
|
619
|
-
return await client.
|
|
629
|
+
return await client.get({
|
|
620
630
|
...fetchOptions,
|
|
621
631
|
path: queryPath,
|
|
622
632
|
state,
|
|
623
633
|
dataSourceVariant: (0, import_canvas4.getDataSourceVariantFromRouteGetParams)(fetchOptions != null ? fetchOptions : {}, state),
|
|
624
634
|
withComponentIDs: true,
|
|
625
|
-
withContentSourceMap: isOnVercelPreviewEnvironment() && ((_a = getServerConfig().experimental) == null ? void 0 : _a.vercelVisualEditing),
|
|
626
635
|
releaseId
|
|
627
636
|
});
|
|
628
637
|
};
|
|
@@ -1178,7 +1187,7 @@ var UniformPlayground = async ({ searchParams, ...rest }) => {
|
|
|
1178
1187
|
if (!id) {
|
|
1179
1188
|
(0, import_navigation2.notFound)();
|
|
1180
1189
|
}
|
|
1181
|
-
const canvasClient =
|
|
1190
|
+
const canvasClient = getCompositionDeliveryClient({
|
|
1182
1191
|
cache: {
|
|
1183
1192
|
type: "no-cache"
|
|
1184
1193
|
}
|
|
@@ -1188,7 +1197,7 @@ var UniformPlayground = async ({ searchParams, ...rest }) => {
|
|
|
1188
1197
|
for (let i = 0; i < possibleStates.length; i++) {
|
|
1189
1198
|
const state = possibleStates[i];
|
|
1190
1199
|
try {
|
|
1191
|
-
composition = await canvasClient.
|
|
1200
|
+
composition = await canvasClient.get({
|
|
1192
1201
|
compositionId: id,
|
|
1193
1202
|
state,
|
|
1194
1203
|
withComponentIDs: true
|
|
@@ -1228,7 +1237,9 @@ var UniformPlayground = async ({ searchParams, ...rest }) => {
|
|
|
1228
1237
|
createStaticParams,
|
|
1229
1238
|
generateStaticParams,
|
|
1230
1239
|
getCanvasClient,
|
|
1240
|
+
getCompositionDeliveryClient,
|
|
1231
1241
|
getDefaultCanvasClient,
|
|
1242
|
+
getDefaultCompositionDeliveryClient,
|
|
1232
1243
|
getDefaultManifestClient,
|
|
1233
1244
|
getDefaultProjectMapClient,
|
|
1234
1245
|
getDefaultRouteClient,
|
package/dist/index.mjs
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
import "server-only";
|
|
3
3
|
|
|
4
4
|
// src/clients/canvasClient.ts
|
|
5
|
-
import { CanvasClient } from "@uniformdev/canvas";
|
|
5
|
+
import { CanvasClient, CompositionDeliveryClient } from "@uniformdev/canvas";
|
|
6
6
|
|
|
7
7
|
// src/config/helpers.ts
|
|
8
8
|
import serverConfig from "uniform.server.config";
|
|
@@ -184,8 +184,8 @@ var determineFetchCacheOptions = (mode) => {
|
|
|
184
184
|
};
|
|
185
185
|
|
|
186
186
|
// src/clients/canvasClient.ts
|
|
187
|
-
var
|
|
188
|
-
return
|
|
187
|
+
var buildCanvasClientOptions = (options) => {
|
|
188
|
+
return {
|
|
189
189
|
projectId: env.getProjectId(),
|
|
190
190
|
apiHost: env.getApiHost(),
|
|
191
191
|
apiKey: env.getApiKey(),
|
|
@@ -230,13 +230,24 @@ var getCanvasClient = (options) => {
|
|
|
230
230
|
}
|
|
231
231
|
});
|
|
232
232
|
}
|
|
233
|
-
}
|
|
233
|
+
};
|
|
234
|
+
};
|
|
235
|
+
var getCanvasClient = (options) => {
|
|
236
|
+
return new CanvasClient(buildCanvasClientOptions(options));
|
|
237
|
+
};
|
|
238
|
+
var getCompositionDeliveryClient = (options) => {
|
|
239
|
+
return new CompositionDeliveryClient(buildCanvasClientOptions(options));
|
|
234
240
|
};
|
|
235
241
|
var getDefaultCanvasClient = async (options) => {
|
|
236
242
|
return getCanvasClient({
|
|
237
243
|
cache: await getCanvasCacheStrategy(options)
|
|
238
244
|
});
|
|
239
245
|
};
|
|
246
|
+
var getDefaultCompositionDeliveryClient = async (options) => {
|
|
247
|
+
return getCompositionDeliveryClient({
|
|
248
|
+
cache: await getCanvasCacheStrategy(options)
|
|
249
|
+
});
|
|
250
|
+
};
|
|
240
251
|
|
|
241
252
|
// src/clients/manifestClient.ts
|
|
242
253
|
import { ManifestClient } from "@uniformdev/context/api";
|
|
@@ -477,7 +488,6 @@ var retrieveCompositionBySlug = async ({
|
|
|
477
488
|
releaseId,
|
|
478
489
|
versionId
|
|
479
490
|
}) => {
|
|
480
|
-
var _a;
|
|
481
491
|
if (!skipPrefetch) {
|
|
482
492
|
void getManifest({
|
|
483
493
|
searchParams
|
|
@@ -489,15 +499,14 @@ var retrieveCompositionBySlug = async ({
|
|
|
489
499
|
});
|
|
490
500
|
for (let i = 0; i < states.length; i++) {
|
|
491
501
|
const state = states[i];
|
|
492
|
-
const canvasClient = await
|
|
502
|
+
const canvasClient = await getDefaultCompositionDeliveryClient({
|
|
493
503
|
searchParams
|
|
494
504
|
});
|
|
495
505
|
try {
|
|
496
|
-
const composition = await canvasClient.
|
|
506
|
+
const composition = await canvasClient.get({
|
|
497
507
|
slug,
|
|
498
508
|
state,
|
|
499
509
|
withComponentIDs: true,
|
|
500
|
-
withContentSourceMap: isOnVercelPreviewEnvironment() && ((_a = getServerConfig().experimental) == null ? void 0 : _a.vercelVisualEditing),
|
|
501
510
|
locale,
|
|
502
511
|
releaseId,
|
|
503
512
|
versionId
|
|
@@ -571,7 +580,6 @@ var retrieveRouteByPath = async ({
|
|
|
571
580
|
fetchOptions,
|
|
572
581
|
releaseId
|
|
573
582
|
}) => {
|
|
574
|
-
var _a;
|
|
575
583
|
const client = await getDefaultRouteClient({
|
|
576
584
|
searchParams
|
|
577
585
|
});
|
|
@@ -588,13 +596,12 @@ var retrieveRouteByPath = async ({
|
|
|
588
596
|
queryPath = `${helper.pathname}${helper.search}`;
|
|
589
597
|
}
|
|
590
598
|
}
|
|
591
|
-
return await client.
|
|
599
|
+
return await client.get({
|
|
592
600
|
...fetchOptions,
|
|
593
601
|
path: queryPath,
|
|
594
602
|
state,
|
|
595
603
|
dataSourceVariant: getDataSourceVariantFromRouteGetParams(fetchOptions != null ? fetchOptions : {}, state),
|
|
596
604
|
withComponentIDs: true,
|
|
597
|
-
withContentSourceMap: isOnVercelPreviewEnvironment() && ((_a = getServerConfig().experimental) == null ? void 0 : _a.vercelVisualEditing),
|
|
598
605
|
releaseId
|
|
599
606
|
});
|
|
600
607
|
};
|
|
@@ -1158,7 +1165,7 @@ var UniformPlayground = async ({ searchParams, ...rest }) => {
|
|
|
1158
1165
|
if (!id) {
|
|
1159
1166
|
notFound2();
|
|
1160
1167
|
}
|
|
1161
|
-
const canvasClient =
|
|
1168
|
+
const canvasClient = getCompositionDeliveryClient({
|
|
1162
1169
|
cache: {
|
|
1163
1170
|
type: "no-cache"
|
|
1164
1171
|
}
|
|
@@ -1168,7 +1175,7 @@ var UniformPlayground = async ({ searchParams, ...rest }) => {
|
|
|
1168
1175
|
for (let i = 0; i < possibleStates.length; i++) {
|
|
1169
1176
|
const state = possibleStates[i];
|
|
1170
1177
|
try {
|
|
1171
|
-
composition = await canvasClient.
|
|
1178
|
+
composition = await canvasClient.get({
|
|
1172
1179
|
compositionId: id,
|
|
1173
1180
|
state,
|
|
1174
1181
|
withComponentIDs: true
|
|
@@ -1207,7 +1214,9 @@ export {
|
|
|
1207
1214
|
createStaticParams,
|
|
1208
1215
|
generateStaticParams,
|
|
1209
1216
|
getCanvasClient,
|
|
1217
|
+
getCompositionDeliveryClient,
|
|
1210
1218
|
getDefaultCanvasClient,
|
|
1219
|
+
getDefaultCompositionDeliveryClient,
|
|
1211
1220
|
getDefaultManifestClient,
|
|
1212
1221
|
getDefaultProjectMapClient,
|
|
1213
1222
|
getDefaultRouteClient,
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@uniformdev/canvas-next-rsc",
|
|
3
|
-
"version": "20.72.3-alpha.
|
|
3
|
+
"version": "20.72.3-alpha.45+2b8b05d58a",
|
|
4
4
|
"license": "SEE LICENSE IN LICENSE.txt",
|
|
5
5
|
"scripts": {
|
|
6
6
|
"build": "tsup",
|
|
@@ -60,15 +60,15 @@
|
|
|
60
60
|
"react-dom": "19.2.1"
|
|
61
61
|
},
|
|
62
62
|
"dependencies": {
|
|
63
|
-
"@uniformdev/canvas": "20.72.3-alpha.
|
|
64
|
-
"@uniformdev/canvas-next-rsc-client": "^20.72.3-alpha.
|
|
65
|
-
"@uniformdev/canvas-next-rsc-shared": "^20.72.3-alpha.
|
|
66
|
-
"@uniformdev/canvas-react": "20.72.3-alpha.
|
|
67
|
-
"@uniformdev/context": "20.72.3-alpha.
|
|
68
|
-
"@uniformdev/project-map": "20.72.3-alpha.
|
|
69
|
-
"@uniformdev/redirect": "20.72.3-alpha.
|
|
70
|
-
"@uniformdev/richtext": "20.72.3-alpha.
|
|
71
|
-
"@uniformdev/webhooks": "20.72.3-alpha.
|
|
63
|
+
"@uniformdev/canvas": "20.72.3-alpha.45+2b8b05d58a",
|
|
64
|
+
"@uniformdev/canvas-next-rsc-client": "^20.72.3-alpha.45+2b8b05d58a",
|
|
65
|
+
"@uniformdev/canvas-next-rsc-shared": "^20.72.3-alpha.45+2b8b05d58a",
|
|
66
|
+
"@uniformdev/canvas-react": "20.72.3-alpha.45+2b8b05d58a",
|
|
67
|
+
"@uniformdev/context": "20.72.3-alpha.45+2b8b05d58a",
|
|
68
|
+
"@uniformdev/project-map": "20.72.3-alpha.45+2b8b05d58a",
|
|
69
|
+
"@uniformdev/redirect": "20.72.3-alpha.45+2b8b05d58a",
|
|
70
|
+
"@uniformdev/richtext": "20.72.3-alpha.45+2b8b05d58a",
|
|
71
|
+
"@uniformdev/webhooks": "20.72.3-alpha.45+2b8b05d58a",
|
|
72
72
|
"@vercel/edge-config": "^1.4.3",
|
|
73
73
|
"encoding": "^0.1.13",
|
|
74
74
|
"server-only": "^0.0.1",
|
|
@@ -85,5 +85,5 @@
|
|
|
85
85
|
"publishConfig": {
|
|
86
86
|
"access": "public"
|
|
87
87
|
},
|
|
88
|
-
"gitHead": "
|
|
88
|
+
"gitHead": "2b8b05d58ab275b4d29a9647feeaad47b0ab5cce"
|
|
89
89
|
}
|