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

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.
Files changed (58) hide show
  1. package/dist/{UniformComposition-fq7Qfhvp.d.mts → UniformResolvedComposition-Ckhza3b7.d.mts} +25 -27
  2. package/dist/{UniformComposition-T7CRvU1H.d.ts → UniformResolvedComposition-Dr73WwIO.d.ts} +25 -27
  3. package/dist/akamai.d.mts +106 -0
  4. package/dist/akamai.d.ts +106 -0
  5. package/dist/akamai.js +1672 -0
  6. package/dist/akamai.mjs +1634 -0
  7. package/dist/cache.d.mts +26 -4
  8. package/dist/cache.d.ts +26 -4
  9. package/dist/cache.js +439 -89
  10. package/dist/cache.mjs +435 -88
  11. package/dist/cf-vinext.d.mts +69 -0
  12. package/dist/cf-vinext.d.ts +69 -0
  13. package/dist/cf-vinext.js +2083 -0
  14. package/dist/cf-vinext.mjs +2050 -0
  15. package/dist/compat.d.mts +2 -2
  16. package/dist/compat.d.ts +2 -2
  17. package/dist/component.d.mts +1 -10
  18. package/dist/component.d.ts +1 -10
  19. package/dist/component.js +39 -53
  20. package/dist/component.mjs +39 -52
  21. package/dist/composition-C7voY4YR.d.mts +37 -0
  22. package/dist/composition-C7voY4YR.d.ts +37 -0
  23. package/dist/createCachedManifestProvider-Bsx_in7t.d.mts +45 -0
  24. package/dist/createCachedManifestProvider-ChIWejZA.d.ts +45 -0
  25. package/dist/createEdgeRouteStore-B2ugix2E.d.ts +225 -0
  26. package/dist/createEdgeRouteStore-DaU9QjP2.d.mts +225 -0
  27. package/dist/createPreviewGETRouteHandler-ii7w-gAc.d.mts +25 -0
  28. package/dist/createPreviewGETRouteHandler-ii7w-gAc.d.ts +25 -0
  29. package/dist/edge.d.mts +45 -35
  30. package/dist/edge.d.ts +45 -35
  31. package/dist/edge.js +1462 -143
  32. package/dist/edge.mjs +1462 -149
  33. package/dist/handler.d.mts +16 -24
  34. package/dist/handler.d.ts +16 -24
  35. package/dist/handler.js +357 -130
  36. package/dist/handler.mjs +344 -117
  37. package/dist/index.d.mts +171 -19
  38. package/dist/index.d.ts +171 -19
  39. package/dist/index.esm.js +571 -278
  40. package/dist/index.js +587 -296
  41. package/dist/index.mjs +571 -278
  42. package/dist/learnedEdgeRouteFilter-DWg-puGg.d.mts +30 -0
  43. package/dist/learnedEdgeRouteFilter-i9hELx_t.d.ts +30 -0
  44. package/dist/middleware.d.mts +21 -2
  45. package/dist/middleware.d.ts +21 -2
  46. package/dist/middleware.js +118 -86
  47. package/dist/middleware.mjs +123 -92
  48. package/dist/models-kIvBB7Tv.d.mts +141 -0
  49. package/dist/models-kIvBB7Tv.d.ts +141 -0
  50. package/dist/resolveRouteFromPath-BpuMu5ZS.d.ts +81 -0
  51. package/dist/resolveRouteFromPath-DWNRjFHQ.d.mts +81 -0
  52. package/dist/vercel.d.mts +77 -0
  53. package/dist/vercel.d.ts +77 -0
  54. package/dist/vercel.js +2089 -0
  55. package/dist/vercel.mjs +2056 -0
  56. package/package.json +45 -13
  57. package/dist/resolveRouteFromCode-CId7aItt.d.mts +0 -48
  58. package/dist/resolveRouteFromCode-CId7aItt.d.ts +0 -48
@@ -1,8 +1,7 @@
1
1
  import { RootComponentInstance, ComponentInstance } from '@uniformdev/canvas';
2
2
  import { ComponentProps } from '@uniformdev/next-app-router-shared';
3
3
  import React, { ComponentType } from 'react';
4
- import { a as ResolvedRouteResult, R as ResolveRouteFunction, D as DataClient } from './resolveRouteFromCode-CId7aItt.mjs';
5
- import { ClientContextComponent } from '@uniformdev/next-app-router-client';
4
+ import { a as ResolvedRouteResult } from './composition-C7voY4YR.mjs';
6
5
 
7
6
  type CompositionCache = {
8
7
  getUniformComposition: ({ id }: {
@@ -14,19 +13,12 @@ type CompositionCache = {
14
13
  componentId: string;
15
14
  }) => ComponentInstance | null;
16
15
  };
16
+ /**
17
+ * Creates a cache of the compositions rendered during a request, which components read with
18
+ * `getUniformComposition` and `getUniformComponent`. Each request starts empty.
19
+ */
17
20
  declare const createCompositionCache: () => CompositionCache;
18
21
 
19
- type UniformContextProps = {
20
- /**
21
- * Component to initialize Uniform context on the client.
22
- */
23
- clientContextComponent?: ClientContextComponent;
24
- /**
25
- * The result of the route resolution.
26
- */
27
- result: ResolvedRouteResult | undefined;
28
- };
29
-
30
22
  type ResolveComponentResult = {
31
23
  component: ComponentType<ComponentProps<any, any>> | null;
32
24
  includeContext?: boolean;
@@ -47,32 +39,38 @@ type ResolveComponentFunction = (options: {
47
39
  component: ComponentInstance;
48
40
  }) => ResolveComponentResult;
49
41
  type ResolveEmptyPlaceholderFunction = (options: ResolveEmptyPlaceholderOptions) => ResolveEmptyPlaceholderResult;
50
- type UniformCompositionProps = {
42
+ type UniformResolvedCompositionProps = {
51
43
  /**
52
- * The code to resolve the route from.
44
+ * The result of any resolver, passed as is. A composition renders; a redirect or not found
45
+ * renders nothing. To redirect or return a 404 instead, pass the result through
46
+ * `requireComposition` first.
53
47
  */
54
- code: string;
55
- /**
56
- * Function to resolve the route from the code.
57
- */
58
- resolveRoute: ResolveRouteFunction;
48
+ result: ResolvedRouteResult;
59
49
  /**
60
50
  * Function to map composition components to React components.
61
51
  */
62
52
  resolveComponent: ResolveComponentFunction;
63
- /**
64
- * Resolves the route for the code. Defaults to `DefaultDataClient`.
65
- */
66
- dataClient?: DataClient;
67
53
  /**
68
54
  * Function to map empty placeholders to React components.
69
55
  */
70
56
  resolveEmptyPlaceholder?: ResolveEmptyPlaceholderFunction;
57
+ /**
58
+ * Marks the page's primary composition. It sets the composition metadata of the visitor's
59
+ * context, which Uniform Insights attributes page hits and goals to, and the default consent
60
+ * from its page state. In the editor and draft states it also loads the contextual editing
61
+ * script. Set it on one composition per page.
62
+ */
63
+ pageComposition?: boolean;
71
64
  /**
72
65
  * Composition cache, will be used to cache the composition.
73
66
  */
74
67
  compositionCache?: CompositionCache;
75
- } & Pick<UniformContextProps, 'clientContextComponent'>;
76
- declare function UniformComposition({ code, ...props }: UniformCompositionProps): React.JSX.Element;
68
+ };
69
+ /**
70
+ * Renders a resolved composition, or nothing when the result is a redirect or not found. Render it
71
+ * before the root layout's `UniformContext`, and set `pageComposition` on the page's primary
72
+ * composition.
73
+ */
74
+ declare function UniformResolvedComposition(props: UniformResolvedCompositionProps): React.JSX.Element;
77
75
 
78
- export { type CompositionCache as C, type ResolveComponentResult as R, type UniformCompositionProps as U, type ResolveComponentFunction as a, UniformComposition as b, createCompositionCache as c };
76
+ export { type CompositionCache as C, type ResolveComponentResult as R, type UniformResolvedCompositionProps as U, type ResolveComponentFunction as a, UniformResolvedComposition as b, createCompositionCache as c };
@@ -1,8 +1,7 @@
1
1
  import { RootComponentInstance, ComponentInstance } from '@uniformdev/canvas';
2
2
  import { ComponentProps } from '@uniformdev/next-app-router-shared';
3
3
  import React, { ComponentType } from 'react';
4
- import { a as ResolvedRouteResult, R as ResolveRouteFunction, D as DataClient } from './resolveRouteFromCode-CId7aItt.js';
5
- import { ClientContextComponent } from '@uniformdev/next-app-router-client';
4
+ import { a as ResolvedRouteResult } from './composition-C7voY4YR.js';
6
5
 
7
6
  type CompositionCache = {
8
7
  getUniformComposition: ({ id }: {
@@ -14,19 +13,12 @@ type CompositionCache = {
14
13
  componentId: string;
15
14
  }) => ComponentInstance | null;
16
15
  };
16
+ /**
17
+ * Creates a cache of the compositions rendered during a request, which components read with
18
+ * `getUniformComposition` and `getUniformComponent`. Each request starts empty.
19
+ */
17
20
  declare const createCompositionCache: () => CompositionCache;
18
21
 
19
- type UniformContextProps = {
20
- /**
21
- * Component to initialize Uniform context on the client.
22
- */
23
- clientContextComponent?: ClientContextComponent;
24
- /**
25
- * The result of the route resolution.
26
- */
27
- result: ResolvedRouteResult | undefined;
28
- };
29
-
30
22
  type ResolveComponentResult = {
31
23
  component: ComponentType<ComponentProps<any, any>> | null;
32
24
  includeContext?: boolean;
@@ -47,32 +39,38 @@ type ResolveComponentFunction = (options: {
47
39
  component: ComponentInstance;
48
40
  }) => ResolveComponentResult;
49
41
  type ResolveEmptyPlaceholderFunction = (options: ResolveEmptyPlaceholderOptions) => ResolveEmptyPlaceholderResult;
50
- type UniformCompositionProps = {
42
+ type UniformResolvedCompositionProps = {
51
43
  /**
52
- * The code to resolve the route from.
44
+ * The result of any resolver, passed as is. A composition renders; a redirect or not found
45
+ * renders nothing. To redirect or return a 404 instead, pass the result through
46
+ * `requireComposition` first.
53
47
  */
54
- code: string;
55
- /**
56
- * Function to resolve the route from the code.
57
- */
58
- resolveRoute: ResolveRouteFunction;
48
+ result: ResolvedRouteResult;
59
49
  /**
60
50
  * Function to map composition components to React components.
61
51
  */
62
52
  resolveComponent: ResolveComponentFunction;
63
- /**
64
- * Resolves the route for the code. Defaults to `DefaultDataClient`.
65
- */
66
- dataClient?: DataClient;
67
53
  /**
68
54
  * Function to map empty placeholders to React components.
69
55
  */
70
56
  resolveEmptyPlaceholder?: ResolveEmptyPlaceholderFunction;
57
+ /**
58
+ * Marks the page's primary composition. It sets the composition metadata of the visitor's
59
+ * context, which Uniform Insights attributes page hits and goals to, and the default consent
60
+ * from its page state. In the editor and draft states it also loads the contextual editing
61
+ * script. Set it on one composition per page.
62
+ */
63
+ pageComposition?: boolean;
71
64
  /**
72
65
  * Composition cache, will be used to cache the composition.
73
66
  */
74
67
  compositionCache?: CompositionCache;
75
- } & Pick<UniformContextProps, 'clientContextComponent'>;
76
- declare function UniformComposition({ code, ...props }: UniformCompositionProps): React.JSX.Element;
68
+ };
69
+ /**
70
+ * Renders a resolved composition, or nothing when the result is a redirect or not found. Render it
71
+ * before the root layout's `UniformContext`, and set `pageComposition` on the page's primary
72
+ * composition.
73
+ */
74
+ declare function UniformResolvedComposition(props: UniformResolvedCompositionProps): React.JSX.Element;
77
75
 
78
- export { type CompositionCache as C, type ResolveComponentResult as R, type UniformCompositionProps as U, type ResolveComponentFunction as a, UniformComposition as b, createCompositionCache as c };
76
+ export { type CompositionCache as C, type ResolveComponentResult as R, type UniformResolvedCompositionProps as U, type ResolveComponentFunction as a, UniformResolvedComposition as b, createCompositionCache as c };
@@ -0,0 +1,106 @@
1
+ import { Quirks } from '@uniformdev/context';
2
+ import { UniformServerConfig, RewriteRequestPathResult } from '@uniformdev/next-app-router-shared';
3
+ import { U as UniformEdgeMiddlewareOptions } from './createEdgeRouteStore-DaU9QjP2.mjs';
4
+ export { c as createEdgeRouteStore } from './createEdgeRouteStore-DaU9QjP2.mjs';
5
+ import { HandleOptions } from './middleware.mjs';
6
+ export { U as UNIFORM_EDGE_ORIGIN_HEADER, c as createStaticEdgeRouteFilter, l as learnedEdgeRouteFilter } from './learnedEdgeRouteFilter-DWg-puGg.mjs';
7
+ import 'next/server';
8
+ import './models-kIvBB7Tv.mjs';
9
+ import './createPreviewGETRouteHandler-ii7w-gAc.mjs';
10
+
11
+ /** The request an EdgeWorker event handler of `akamaiUniformEdgeWorker` receives. */
12
+ type AkamaiRequest = EW.IngressClientRequest | EW.ResponseProviderRequest | EW.EgressClientRequest;
13
+
14
+ /** Skips `responseProvider` for the request when `onClientRequest` sets it to `true`. */
15
+ declare const AKAMAI_BYPASS_RESPONSE_PROVIDER_VARIABLE = "PMUSER_BYPASS_EW_RP_EVENT";
16
+ type AkamaiUniformEdgeWorkerOptions = Pick<UniformEdgeMiddlewareOptions, 'manifest' | 'filter' | 'store' | 'etags'> & Pick<HandleOptions, 'rewriteDestinationPath' | 'queryStrings' | 'release' | 'quirks' | 'defaultConsent' | 'locale'> & {
17
+ /**
18
+ * The app's server config, the default export of `uniform.server.config.ts`. Pass the origin's
19
+ * config, so the worker builds the codes and the visitor's Context the way the app does.
20
+ *
21
+ * @defaultValue the default config
22
+ */
23
+ config?: UniformServerConfig;
24
+ /**
25
+ * Returns the route path, and the keys, to resolve for the request. The path includes the
26
+ * query string.
27
+ *
28
+ * @defaultValue the request path and query string
29
+ */
30
+ rewriteRequestPath?: (options: {
31
+ request: AkamaiRequest;
32
+ path: string;
33
+ query: string;
34
+ }) => Promise<RewriteRequestPathResult | undefined>;
35
+ /**
36
+ * Builds the quirks the visitor's Context and the browser get from the request. `quirks` are
37
+ * added on top.
38
+ *
39
+ * @defaultValue `buildAkamaiQuirks`, the visitor's Akamai location
40
+ */
41
+ buildQuirks?: (request: AkamaiRequest) => Quirks;
42
+ /**
43
+ * Whether the worker rewrites the request path. Other requests reach the origin untouched.
44
+ *
45
+ * @defaultValue every path except `/api`, `/_next/static`, `/_next/image`, `/favicon.ico`,
46
+ * `/sitemap.xml` and `/robots.txt`, like the Next.js middleware matcher of the Uniform examples
47
+ */
48
+ matcher?: (path: string) => boolean;
49
+ /**
50
+ * Called when the manifest provider throws, when processing fails before the response starts,
51
+ * and when the NESI transform fails. Without it, the last two are logged with the EdgeWorkers
52
+ * `logger`.
53
+ *
54
+ * A provider failure receives the error, and the worker chooses with an empty manifest:
55
+ * personalizations show their defaults, and the browser chooses tests after hydration.
56
+ *
57
+ * A failure before the response starts, such as the `filter` throwing or the fetch of the page
58
+ * failing, receives the error, and the visitor gets the page without edge mode, so the browser
59
+ * chooses the variants.
60
+ *
61
+ * A transform failure also receives the decoded HTML chunk that triggered it, when available,
62
+ * and the response ends at the point of failure.
63
+ */
64
+ onError?: UniformEdgeMiddlewareOptions['onError'];
65
+ };
66
+ /**
67
+ * Returns the event handlers of an Akamai EdgeWorker in front of a Next.js app that uses Uniform.
68
+ * The worker does what `uniformEdgeMiddleware` does in the app: it rewrites each published route
69
+ * to its `/uniform/{code}` page, and keeps only the visitor's variants of pages in edge mode. Akamai
70
+ * caches each page once for every visitor.
71
+ *
72
+ * - `onClientRequest` rewrites client navigations, prefetches, other methods and pages the
73
+ * `filter` skips with `route()`, and leaves HTML document requests for pages in edge mode to
74
+ * `responseProvider`. Requests in draft mode, paths `matcher` excludes and the worker's own
75
+ * fetches reach the origin untouched, where the app's middleware handles them.
76
+ * - `responseProvider` fetches the page in edge mode through Akamai and streams it through the NESI
77
+ * transform, with the ETags `serveEdgePage` describes.
78
+ * - `onClientResponse` hands the quirks to the browser in the `ufqc` cookie.
79
+ *
80
+ * Export all three from the bundle's `main.js`. The property needs the user-defined variable
81
+ * `PMUSER_BYPASS_EW_RP_EVENT`, with `false` as its initial value, so `onClientRequest` can skip
82
+ * `responseProvider`. The app's middleware lets the rewritten requests through, since they carry
83
+ * `UNIFORM_EDGE_ORIGIN_HEADER`.
84
+ *
85
+ * Mark the EdgeWorkers modules `cookies`, `create-response`, `crypto`, `encoding`, `http-request`,
86
+ * `log`, `streams` and `url-search-params` external in the bundler. `encoding` and `crypto` also
87
+ * name an npm package and a Node module, which do not run on EdgeWorkers.
88
+ *
89
+ * EdgeWorkers has no `waitUntil`, so a `store` write that is still pending when the response ends
90
+ * may be lost. A manifest provider may only fetch from hosts Akamai serves; pass a manifest baked
91
+ * into the bundle to avoid fetching it.
92
+ */
93
+ declare const akamaiUniformEdgeWorker: ({ config, manifest, filter, store, etags, onError, rewriteRequestPath, rewriteDestinationPath, queryStrings, release, quirks: customQuirks, defaultConsent: defaultConsentOption, locale, buildQuirks, matcher, }: AkamaiUniformEdgeWorkerOptions) => {
94
+ onClientRequest: (request: EW.IngressClientRequest) => Promise<void>;
95
+ responseProvider: (request: EW.ResponseProviderRequest) => Promise<object>;
96
+ onClientResponse: (request: EW.EgressClientRequest, response: EW.EgressClientResponse) => void;
97
+ };
98
+
99
+ /**
100
+ * Builds quirks from the visitor's Akamai location, named like those of
101
+ * `@uniformdev/context-edge-akamai`: `aka-loc-continent`, `aka-loc-country`, `aka-loc-region` and
102
+ * `aka-loc-city`. Locations Akamai cannot supply are left out.
103
+ */
104
+ declare const buildAkamaiQuirks: (request: AkamaiRequest) => Quirks;
105
+
106
+ export { AKAMAI_BYPASS_RESPONSE_PROVIDER_VARIABLE, type AkamaiRequest, type AkamaiUniformEdgeWorkerOptions, akamaiUniformEdgeWorker, buildAkamaiQuirks };
@@ -0,0 +1,106 @@
1
+ import { Quirks } from '@uniformdev/context';
2
+ import { UniformServerConfig, RewriteRequestPathResult } from '@uniformdev/next-app-router-shared';
3
+ import { U as UniformEdgeMiddlewareOptions } from './createEdgeRouteStore-B2ugix2E.js';
4
+ export { c as createEdgeRouteStore } from './createEdgeRouteStore-B2ugix2E.js';
5
+ import { HandleOptions } from './middleware.js';
6
+ export { U as UNIFORM_EDGE_ORIGIN_HEADER, c as createStaticEdgeRouteFilter, l as learnedEdgeRouteFilter } from './learnedEdgeRouteFilter-i9hELx_t.js';
7
+ import 'next/server';
8
+ import './models-kIvBB7Tv.js';
9
+ import './createPreviewGETRouteHandler-ii7w-gAc.js';
10
+
11
+ /** The request an EdgeWorker event handler of `akamaiUniformEdgeWorker` receives. */
12
+ type AkamaiRequest = EW.IngressClientRequest | EW.ResponseProviderRequest | EW.EgressClientRequest;
13
+
14
+ /** Skips `responseProvider` for the request when `onClientRequest` sets it to `true`. */
15
+ declare const AKAMAI_BYPASS_RESPONSE_PROVIDER_VARIABLE = "PMUSER_BYPASS_EW_RP_EVENT";
16
+ type AkamaiUniformEdgeWorkerOptions = Pick<UniformEdgeMiddlewareOptions, 'manifest' | 'filter' | 'store' | 'etags'> & Pick<HandleOptions, 'rewriteDestinationPath' | 'queryStrings' | 'release' | 'quirks' | 'defaultConsent' | 'locale'> & {
17
+ /**
18
+ * The app's server config, the default export of `uniform.server.config.ts`. Pass the origin's
19
+ * config, so the worker builds the codes and the visitor's Context the way the app does.
20
+ *
21
+ * @defaultValue the default config
22
+ */
23
+ config?: UniformServerConfig;
24
+ /**
25
+ * Returns the route path, and the keys, to resolve for the request. The path includes the
26
+ * query string.
27
+ *
28
+ * @defaultValue the request path and query string
29
+ */
30
+ rewriteRequestPath?: (options: {
31
+ request: AkamaiRequest;
32
+ path: string;
33
+ query: string;
34
+ }) => Promise<RewriteRequestPathResult | undefined>;
35
+ /**
36
+ * Builds the quirks the visitor's Context and the browser get from the request. `quirks` are
37
+ * added on top.
38
+ *
39
+ * @defaultValue `buildAkamaiQuirks`, the visitor's Akamai location
40
+ */
41
+ buildQuirks?: (request: AkamaiRequest) => Quirks;
42
+ /**
43
+ * Whether the worker rewrites the request path. Other requests reach the origin untouched.
44
+ *
45
+ * @defaultValue every path except `/api`, `/_next/static`, `/_next/image`, `/favicon.ico`,
46
+ * `/sitemap.xml` and `/robots.txt`, like the Next.js middleware matcher of the Uniform examples
47
+ */
48
+ matcher?: (path: string) => boolean;
49
+ /**
50
+ * Called when the manifest provider throws, when processing fails before the response starts,
51
+ * and when the NESI transform fails. Without it, the last two are logged with the EdgeWorkers
52
+ * `logger`.
53
+ *
54
+ * A provider failure receives the error, and the worker chooses with an empty manifest:
55
+ * personalizations show their defaults, and the browser chooses tests after hydration.
56
+ *
57
+ * A failure before the response starts, such as the `filter` throwing or the fetch of the page
58
+ * failing, receives the error, and the visitor gets the page without edge mode, so the browser
59
+ * chooses the variants.
60
+ *
61
+ * A transform failure also receives the decoded HTML chunk that triggered it, when available,
62
+ * and the response ends at the point of failure.
63
+ */
64
+ onError?: UniformEdgeMiddlewareOptions['onError'];
65
+ };
66
+ /**
67
+ * Returns the event handlers of an Akamai EdgeWorker in front of a Next.js app that uses Uniform.
68
+ * The worker does what `uniformEdgeMiddleware` does in the app: it rewrites each published route
69
+ * to its `/uniform/{code}` page, and keeps only the visitor's variants of pages in edge mode. Akamai
70
+ * caches each page once for every visitor.
71
+ *
72
+ * - `onClientRequest` rewrites client navigations, prefetches, other methods and pages the
73
+ * `filter` skips with `route()`, and leaves HTML document requests for pages in edge mode to
74
+ * `responseProvider`. Requests in draft mode, paths `matcher` excludes and the worker's own
75
+ * fetches reach the origin untouched, where the app's middleware handles them.
76
+ * - `responseProvider` fetches the page in edge mode through Akamai and streams it through the NESI
77
+ * transform, with the ETags `serveEdgePage` describes.
78
+ * - `onClientResponse` hands the quirks to the browser in the `ufqc` cookie.
79
+ *
80
+ * Export all three from the bundle's `main.js`. The property needs the user-defined variable
81
+ * `PMUSER_BYPASS_EW_RP_EVENT`, with `false` as its initial value, so `onClientRequest` can skip
82
+ * `responseProvider`. The app's middleware lets the rewritten requests through, since they carry
83
+ * `UNIFORM_EDGE_ORIGIN_HEADER`.
84
+ *
85
+ * Mark the EdgeWorkers modules `cookies`, `create-response`, `crypto`, `encoding`, `http-request`,
86
+ * `log`, `streams` and `url-search-params` external in the bundler. `encoding` and `crypto` also
87
+ * name an npm package and a Node module, which do not run on EdgeWorkers.
88
+ *
89
+ * EdgeWorkers has no `waitUntil`, so a `store` write that is still pending when the response ends
90
+ * may be lost. A manifest provider may only fetch from hosts Akamai serves; pass a manifest baked
91
+ * into the bundle to avoid fetching it.
92
+ */
93
+ declare const akamaiUniformEdgeWorker: ({ config, manifest, filter, store, etags, onError, rewriteRequestPath, rewriteDestinationPath, queryStrings, release, quirks: customQuirks, defaultConsent: defaultConsentOption, locale, buildQuirks, matcher, }: AkamaiUniformEdgeWorkerOptions) => {
94
+ onClientRequest: (request: EW.IngressClientRequest) => Promise<void>;
95
+ responseProvider: (request: EW.ResponseProviderRequest) => Promise<object>;
96
+ onClientResponse: (request: EW.EgressClientRequest, response: EW.EgressClientResponse) => void;
97
+ };
98
+
99
+ /**
100
+ * Builds quirks from the visitor's Akamai location, named like those of
101
+ * `@uniformdev/context-edge-akamai`: `aka-loc-continent`, `aka-loc-country`, `aka-loc-region` and
102
+ * `aka-loc-city`. Locations Akamai cannot supply are left out.
103
+ */
104
+ declare const buildAkamaiQuirks: (request: AkamaiRequest) => Quirks;
105
+
106
+ export { AKAMAI_BYPASS_RESPONSE_PROVIDER_VARIABLE, type AkamaiRequest, type AkamaiUniformEdgeWorkerOptions, akamaiUniformEdgeWorker, buildAkamaiQuirks };