@uniformdev/next-app-router 20.81.1-alpha.4.sha-de16ebeee7 → 20.81.1

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/index.d.mts CHANGED
@@ -1,13 +1,15 @@
1
- import { CanvasClient, CompositionDeliveryClient, RouteClient } from '@uniformdev/canvas';
1
+ import { CanvasClient, CompositionDeliveryClient, RouteClient, ComponentInstance } from '@uniformdev/canvas';
2
2
  import { CacheMode, CanvasCacheMode, ManifestCacheMode, ProjectMapCacheMode, RewriteRequestPathResult } from '@uniformdev/next-app-router-shared';
3
3
  import { ManifestClient } from '@uniformdev/context/api';
4
4
  import { ProjectMapClient } from '@uniformdev/project-map';
5
- import { U as UniformCompositionProps } from './UniformComposition-fq7Qfhvp.mjs';
6
- export { C as CompositionCache, a as ResolveComponentFunction, R as ResolveComponentResult, b as UniformComposition, c as createCompositionCache } from './UniformComposition-fq7Qfhvp.mjs';
5
+ import { U as UniformCompositionProps } from './UniformComposition-le6UEB_r.mjs';
6
+ export { C as CompositionCache, a as ResolveComponentFunction, R as ResolveComponentResult, b as UniformComposition, c as createCompositionCache } from './UniformComposition-le6UEB_r.mjs';
7
7
  import React from 'react';
8
- import { a as ResolvedRouteResult } from './resolveRouteFromCode-CId7aItt.mjs';
9
- export { D as DataClient, b as DefaultDataClient, E as EnhanceRouteOptions, G as GetRouteOptions, c as GetRouteResult, R as ResolveRouteFunction, r as resolveRouteFromCode } from './resolveRouteFromCode-CId7aItt.mjs';
8
+ export { D as DataClient, a as DefaultDataClient, E as EnhanceRouteOptions, G as GetRouteFromMiddlewareOptions, b as GetRouteFromPageStateOptions, c as GetRouteOptions, R as RewriteRouteOptions, d as RewriteRouteResult, e as expireMiddlewareCacheTag } from './client-BElN_CWD.mjs';
9
+ import { a as ResolvedRouteResult } from './resolveRouteFromCode-CuJ4JHeb.mjs';
10
+ export { R as ResolveRouteFunction, r as resolveRouteFromCode } from './resolveRouteFromCode-CuJ4JHeb.mjs';
10
11
  import '@uniformdev/next-app-router-client';
12
+ import '@uniformdev/context';
11
13
 
12
14
  type SpecificCacheMode<TCacheMode extends CacheMode> = {
13
15
  cache: TCacheMode;
@@ -220,25 +222,44 @@ type CreateStaticParamsOptions = {
220
222
  locale?: string;
221
223
  };
222
224
  /**
223
- * Generates the playground code for the first of the given paths. Playground requests are drafts,
224
- * which evaluate while the page renders, so there is one code per composition.
225
+ * Function to generate all possible page states for the given paths in playground mode.
226
+ * @param options
227
+ * @returns
225
228
  */
226
229
  declare const createUniformPlaygroundStaticParams: (options: CreateStaticParamsOptions) => Promise<{
227
230
  code: string;
228
231
  }[]>;
229
232
  /**
230
- * Generates one code per published composition among the given paths, for `generateStaticParams`
231
- * of the `[code]` route. Codes carry the route, not an evaluation, so each path has one static page
232
- * whose variants are chosen in the browser or at the edge.
233
+ * Function to generate all possible page states for the given paths.
234
+ * @param options
235
+ * @returns
233
236
  */
234
237
  declare const createUniformStaticParams: (options: CreateStaticParamsOptions) => Promise<{
235
238
  code: string;
236
239
  }[]>;
237
240
 
238
- /**
239
- * Resolves the composition of a playground code. The code carries the composition id, and the
240
- * composition resolves in the editor state, falling back to the draft state.
241
- */
241
+ type EvaluateTestsFunction = (test: {
242
+ name: string;
243
+ component: ComponentInstance;
244
+ }) => boolean;
245
+ type EvaluatePersonalizationsFunction = (personalization: {
246
+ name: string;
247
+ component: ComponentInstance;
248
+ }) => boolean;
249
+ type PrecomputeCompositionOptions = Pick<ResolvedRouteResult, 'pageState' | 'route'> & {
250
+ /**
251
+ * Whether to evaluate tests
252
+ * @defaultValue true
253
+ */
254
+ evaluateTests?: boolean | EvaluateTestsFunction;
255
+ /**
256
+ * Whether to evaluate personalizations
257
+ * @defaultValue true
258
+ */
259
+ evaluatePersonalizations?: boolean | EvaluatePersonalizationsFunction;
260
+ };
261
+ declare const precomputeComposition: ({ pageState, route, evaluatePersonalizations, evaluateTests, }: PrecomputeCompositionOptions) => Promise<void>;
262
+
242
263
  declare const resolvePlaygroundRoute: ({ code }: {
243
264
  code: string;
244
265
  }) => Promise<ResolvedRouteResult>;
@@ -255,4 +276,4 @@ declare const findRouteMatch: (routes: CustomRoute[], path: string) => RouteMatc
255
276
 
256
277
  declare const serverContext: <T>(defaultValue?: T) => [() => T | undefined, (v: T) => void];
257
278
 
258
- export { type AwaitedUniformPageParameters, type CreateStaticParamsOptions, type CustomRoute, type GetCanvasClientOptions, type GetCompositionDeliveryClientOptions, type GetManifestClientOptions, type GetProjectMapClientOptions, type GetRouteClientOptions, type PlaygroundParameters, type RouteMatch, UniformCompositionProps, type UniformPageParameters, UniformPlayground, createUniformPlaygroundStaticParams, createUniformStaticParams, findRouteMatch, getCanvasClient, getCompositionDeliveryClient, getManifest, getManifestClient, getProjectMapClient, getRouteClient, resolvePlaygroundRoute, serverContext };
279
+ export { type AwaitedUniformPageParameters, type CreateStaticParamsOptions, type CustomRoute, type GetCanvasClientOptions, type GetCompositionDeliveryClientOptions, type GetManifestClientOptions, type GetProjectMapClientOptions, type GetRouteClientOptions, type PlaygroundParameters, type RouteMatch, UniformCompositionProps, type UniformPageParameters, UniformPlayground, createUniformPlaygroundStaticParams, createUniformStaticParams, findRouteMatch, getCanvasClient, getCompositionDeliveryClient, getManifest, getManifestClient, getProjectMapClient, getRouteClient, precomputeComposition, resolvePlaygroundRoute, serverContext };
package/dist/index.d.ts CHANGED
@@ -1,13 +1,15 @@
1
- import { CanvasClient, CompositionDeliveryClient, RouteClient } from '@uniformdev/canvas';
1
+ import { CanvasClient, CompositionDeliveryClient, RouteClient, ComponentInstance } from '@uniformdev/canvas';
2
2
  import { CacheMode, CanvasCacheMode, ManifestCacheMode, ProjectMapCacheMode, RewriteRequestPathResult } from '@uniformdev/next-app-router-shared';
3
3
  import { ManifestClient } from '@uniformdev/context/api';
4
4
  import { ProjectMapClient } from '@uniformdev/project-map';
5
- import { U as UniformCompositionProps } from './UniformComposition-T7CRvU1H.js';
6
- export { C as CompositionCache, a as ResolveComponentFunction, R as ResolveComponentResult, b as UniformComposition, c as createCompositionCache } from './UniformComposition-T7CRvU1H.js';
5
+ import { U as UniformCompositionProps } from './UniformComposition-DBO-oo7J.js';
6
+ export { C as CompositionCache, a as ResolveComponentFunction, R as ResolveComponentResult, b as UniformComposition, c as createCompositionCache } from './UniformComposition-DBO-oo7J.js';
7
7
  import React from 'react';
8
- import { a as ResolvedRouteResult } from './resolveRouteFromCode-CId7aItt.js';
9
- export { D as DataClient, b as DefaultDataClient, E as EnhanceRouteOptions, G as GetRouteOptions, c as GetRouteResult, R as ResolveRouteFunction, r as resolveRouteFromCode } from './resolveRouteFromCode-CId7aItt.js';
8
+ export { D as DataClient, a as DefaultDataClient, E as EnhanceRouteOptions, G as GetRouteFromMiddlewareOptions, b as GetRouteFromPageStateOptions, c as GetRouteOptions, R as RewriteRouteOptions, d as RewriteRouteResult, e as expireMiddlewareCacheTag } from './client-BElN_CWD.js';
9
+ import { a as ResolvedRouteResult } from './resolveRouteFromCode-BOvjIvM2.js';
10
+ export { R as ResolveRouteFunction, r as resolveRouteFromCode } from './resolveRouteFromCode-BOvjIvM2.js';
10
11
  import '@uniformdev/next-app-router-client';
12
+ import '@uniformdev/context';
11
13
 
12
14
  type SpecificCacheMode<TCacheMode extends CacheMode> = {
13
15
  cache: TCacheMode;
@@ -220,25 +222,44 @@ type CreateStaticParamsOptions = {
220
222
  locale?: string;
221
223
  };
222
224
  /**
223
- * Generates the playground code for the first of the given paths. Playground requests are drafts,
224
- * which evaluate while the page renders, so there is one code per composition.
225
+ * Function to generate all possible page states for the given paths in playground mode.
226
+ * @param options
227
+ * @returns
225
228
  */
226
229
  declare const createUniformPlaygroundStaticParams: (options: CreateStaticParamsOptions) => Promise<{
227
230
  code: string;
228
231
  }[]>;
229
232
  /**
230
- * Generates one code per published composition among the given paths, for `generateStaticParams`
231
- * of the `[code]` route. Codes carry the route, not an evaluation, so each path has one static page
232
- * whose variants are chosen in the browser or at the edge.
233
+ * Function to generate all possible page states for the given paths.
234
+ * @param options
235
+ * @returns
233
236
  */
234
237
  declare const createUniformStaticParams: (options: CreateStaticParamsOptions) => Promise<{
235
238
  code: string;
236
239
  }[]>;
237
240
 
238
- /**
239
- * Resolves the composition of a playground code. The code carries the composition id, and the
240
- * composition resolves in the editor state, falling back to the draft state.
241
- */
241
+ type EvaluateTestsFunction = (test: {
242
+ name: string;
243
+ component: ComponentInstance;
244
+ }) => boolean;
245
+ type EvaluatePersonalizationsFunction = (personalization: {
246
+ name: string;
247
+ component: ComponentInstance;
248
+ }) => boolean;
249
+ type PrecomputeCompositionOptions = Pick<ResolvedRouteResult, 'pageState' | 'route'> & {
250
+ /**
251
+ * Whether to evaluate tests
252
+ * @defaultValue true
253
+ */
254
+ evaluateTests?: boolean | EvaluateTestsFunction;
255
+ /**
256
+ * Whether to evaluate personalizations
257
+ * @defaultValue true
258
+ */
259
+ evaluatePersonalizations?: boolean | EvaluatePersonalizationsFunction;
260
+ };
261
+ declare const precomputeComposition: ({ pageState, route, evaluatePersonalizations, evaluateTests, }: PrecomputeCompositionOptions) => Promise<void>;
262
+
242
263
  declare const resolvePlaygroundRoute: ({ code }: {
243
264
  code: string;
244
265
  }) => Promise<ResolvedRouteResult>;
@@ -255,4 +276,4 @@ declare const findRouteMatch: (routes: CustomRoute[], path: string) => RouteMatc
255
276
 
256
277
  declare const serverContext: <T>(defaultValue?: T) => [() => T | undefined, (v: T) => void];
257
278
 
258
- export { type AwaitedUniformPageParameters, type CreateStaticParamsOptions, type CustomRoute, type GetCanvasClientOptions, type GetCompositionDeliveryClientOptions, type GetManifestClientOptions, type GetProjectMapClientOptions, type GetRouteClientOptions, type PlaygroundParameters, type RouteMatch, UniformCompositionProps, type UniformPageParameters, UniformPlayground, createUniformPlaygroundStaticParams, createUniformStaticParams, findRouteMatch, getCanvasClient, getCompositionDeliveryClient, getManifest, getManifestClient, getProjectMapClient, getRouteClient, resolvePlaygroundRoute, serverContext };
279
+ export { type AwaitedUniformPageParameters, type CreateStaticParamsOptions, type CustomRoute, type GetCanvasClientOptions, type GetCompositionDeliveryClientOptions, type GetManifestClientOptions, type GetProjectMapClientOptions, type GetRouteClientOptions, type PlaygroundParameters, type RouteMatch, UniformCompositionProps, type UniformPageParameters, UniformPlayground, createUniformPlaygroundStaticParams, createUniformStaticParams, findRouteMatch, getCanvasClient, getCompositionDeliveryClient, getManifest, getManifestClient, getProjectMapClient, getRouteClient, precomputeComposition, resolvePlaygroundRoute, serverContext };