@uniformdev/canvas-next-rsc-shared 20.80.0 → 20.80.1-alpha.10.sha-e0cfb4ce44

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,5 +1,5 @@
1
1
  import * as _uniformdev_context from '@uniformdev/context';
2
- import { ContextInstance, ContextState, Context, LogMessage, TestVariant, TestOptions, PersonalizedVariant, PersonalizeOptions, TestEvent, PersonalizationEvent, CompositionMetadata, ContextOptions, CookieTransitionDataStoreOptions } from '@uniformdev/context';
2
+ import { CookieTransitionDataStoreOptions, VisitorDataStoreOptions, ContextInstance, ContextState, Context, LogMessage, TestVariant, TestOptions, PersonalizedVariant, PersonalizeOptions, TestEvent, PersonalizationEvent, CompositionMetadata, ContextOptions } from '@uniformdev/context';
3
3
  import { ComponentInstance, RouteGetResponseComposition, RootComponentInstance } from '@uniformdev/canvas';
4
4
  import { PropsWithChildren } from 'react';
5
5
 
@@ -48,6 +48,42 @@ type UniformServerConfig = {
48
48
  * @defaultValue false
49
49
  */
50
50
  disableDevTools?: boolean;
51
+ /**
52
+ * Ceiling on the size in bytes of the visitor data cookie, measured on the percent-encoded
53
+ * `name=value` pair. When the visitor's data does not fit, the least valuable parts are
54
+ * dropped until it does. Local storage remains the complete copy.
55
+ *
56
+ * @defaultValue undefined - the cookie is unbounded
57
+ */
58
+ cookieMaxBytes?: CookieTransitionDataStoreOptions['maxBytes'];
59
+ /**
60
+ * Removes stored A/B test assignments for tests that are no longer in the manifest.
61
+ * Does nothing unless a manifest with contents is loaded - an empty manifest is read as a
62
+ * manifest that did not load, not as a project that deleted everything - so a partial or
63
+ * failed load cannot destroy anything. Pruning is irreversible.
64
+ *
65
+ * @defaultValue false
66
+ */
67
+ pruneUnknownTests?: VisitorDataStoreOptions['pruneUnknownTests'];
68
+ /**
69
+ * Removes stored dimensions that are no longer in the manifest.
70
+ * Does nothing unless a manifest with contents is loaded - an empty manifest is read as a
71
+ * manifest that did not load, not as a project that deleted everything - so a partial or
72
+ * failed load cannot destroy anything. Dimensions Uniform writes itself, whose keys begin
73
+ * with `$` such as the page view counter, are kept: they are never in the manifest.
74
+ * Pruning is irreversible.
75
+ *
76
+ * @defaultValue false
77
+ */
78
+ pruneUnknownDimensions?: VisitorDataStoreOptions['pruneUnknownDimensions'];
79
+ /**
80
+ * Removes stored dimensions whose score is zero. Pruning is irreversible.
81
+ * `true` removes a score of exactly zero; `'round'` also removes any score whose magnitude
82
+ * is below 1, negatives included, so the cookie and local storage hold the same keys.
83
+ *
84
+ * @defaultValue false
85
+ */
86
+ pruneZeroScores?: VisitorDataStoreOptions['pruneZeroScores'];
51
87
  };
52
88
  /**
53
89
  * Configure where system components should be evaluated.
@@ -183,10 +219,11 @@ type AppDirectoryServerContext = Omit<AppDirectoryContext, 'update'>;
183
219
  type CreateUniformContextOptions = Omit<ContextOptions, 'transitionStore'> & {
184
220
  serverCookieValue: string | undefined;
185
221
  cookieAttributes?: CookieTransitionDataStoreOptions['cookieAttributes'];
222
+ cookieMaxBytes?: CookieTransitionDataStoreOptions['maxBytes'];
186
223
  quirkCookieValue?: string;
187
224
  experimental_quirksEnabled?: CookieTransitionDataStoreOptions['experimental_quirksEnabled'];
188
225
  };
189
- declare const createUniformContext: ({ serverCookieValue, quirkCookieValue, experimental_quirksEnabled, cookieAttributes, ...rest }: CreateUniformContextOptions) => AppDirectoryContextInstance;
226
+ declare const createUniformContext: ({ serverCookieValue, quirkCookieValue, experimental_quirksEnabled, cookieAttributes, cookieMaxBytes, ...rest }: CreateUniformContextOptions) => AppDirectoryContextInstance;
190
227
  declare class AppDirectoryContextInstance implements AppDirectoryContext {
191
228
  #private;
192
229
  readonly manifest: ContextInstance['manifest'];
package/dist/index.d.ts CHANGED
@@ -1,5 +1,5 @@
1
1
  import * as _uniformdev_context from '@uniformdev/context';
2
- import { ContextInstance, ContextState, Context, LogMessage, TestVariant, TestOptions, PersonalizedVariant, PersonalizeOptions, TestEvent, PersonalizationEvent, CompositionMetadata, ContextOptions, CookieTransitionDataStoreOptions } from '@uniformdev/context';
2
+ import { CookieTransitionDataStoreOptions, VisitorDataStoreOptions, ContextInstance, ContextState, Context, LogMessage, TestVariant, TestOptions, PersonalizedVariant, PersonalizeOptions, TestEvent, PersonalizationEvent, CompositionMetadata, ContextOptions } from '@uniformdev/context';
3
3
  import { ComponentInstance, RouteGetResponseComposition, RootComponentInstance } from '@uniformdev/canvas';
4
4
  import { PropsWithChildren } from 'react';
5
5
 
@@ -48,6 +48,42 @@ type UniformServerConfig = {
48
48
  * @defaultValue false
49
49
  */
50
50
  disableDevTools?: boolean;
51
+ /**
52
+ * Ceiling on the size in bytes of the visitor data cookie, measured on the percent-encoded
53
+ * `name=value` pair. When the visitor's data does not fit, the least valuable parts are
54
+ * dropped until it does. Local storage remains the complete copy.
55
+ *
56
+ * @defaultValue undefined - the cookie is unbounded
57
+ */
58
+ cookieMaxBytes?: CookieTransitionDataStoreOptions['maxBytes'];
59
+ /**
60
+ * Removes stored A/B test assignments for tests that are no longer in the manifest.
61
+ * Does nothing unless a manifest with contents is loaded - an empty manifest is read as a
62
+ * manifest that did not load, not as a project that deleted everything - so a partial or
63
+ * failed load cannot destroy anything. Pruning is irreversible.
64
+ *
65
+ * @defaultValue false
66
+ */
67
+ pruneUnknownTests?: VisitorDataStoreOptions['pruneUnknownTests'];
68
+ /**
69
+ * Removes stored dimensions that are no longer in the manifest.
70
+ * Does nothing unless a manifest with contents is loaded - an empty manifest is read as a
71
+ * manifest that did not load, not as a project that deleted everything - so a partial or
72
+ * failed load cannot destroy anything. Dimensions Uniform writes itself, whose keys begin
73
+ * with `$` such as the page view counter, are kept: they are never in the manifest.
74
+ * Pruning is irreversible.
75
+ *
76
+ * @defaultValue false
77
+ */
78
+ pruneUnknownDimensions?: VisitorDataStoreOptions['pruneUnknownDimensions'];
79
+ /**
80
+ * Removes stored dimensions whose score is zero. Pruning is irreversible.
81
+ * `true` removes a score of exactly zero; `'round'` also removes any score whose magnitude
82
+ * is below 1, negatives included, so the cookie and local storage hold the same keys.
83
+ *
84
+ * @defaultValue false
85
+ */
86
+ pruneZeroScores?: VisitorDataStoreOptions['pruneZeroScores'];
51
87
  };
52
88
  /**
53
89
  * Configure where system components should be evaluated.
@@ -183,10 +219,11 @@ type AppDirectoryServerContext = Omit<AppDirectoryContext, 'update'>;
183
219
  type CreateUniformContextOptions = Omit<ContextOptions, 'transitionStore'> & {
184
220
  serverCookieValue: string | undefined;
185
221
  cookieAttributes?: CookieTransitionDataStoreOptions['cookieAttributes'];
222
+ cookieMaxBytes?: CookieTransitionDataStoreOptions['maxBytes'];
186
223
  quirkCookieValue?: string;
187
224
  experimental_quirksEnabled?: CookieTransitionDataStoreOptions['experimental_quirksEnabled'];
188
225
  };
189
- declare const createUniformContext: ({ serverCookieValue, quirkCookieValue, experimental_quirksEnabled, cookieAttributes, ...rest }: CreateUniformContextOptions) => AppDirectoryContextInstance;
226
+ declare const createUniformContext: ({ serverCookieValue, quirkCookieValue, experimental_quirksEnabled, cookieAttributes, cookieMaxBytes, ...rest }: CreateUniformContextOptions) => AppDirectoryContextInstance;
190
227
  declare class AppDirectoryContextInstance implements AppDirectoryContext {
191
228
  #private;
192
229
  readonly manifest: ContextInstance['manifest'];
package/dist/index.esm.js CHANGED
@@ -69,17 +69,20 @@ var createUniformContext = ({
69
69
  quirkCookieValue,
70
70
  experimental_quirksEnabled,
71
71
  cookieAttributes,
72
+ cookieMaxBytes,
73
+ // the pruning options are not named here on purpose: they belong to the visitor data store,
74
+ // so `rest` already carries them to the Context
72
75
  ...rest
73
76
  }) => {
74
- const context = new Context({
75
- ...rest,
76
- transitionStore: new CookieTransitionDataStore({
77
- serverCookieValue,
78
- quirkCookieValue,
79
- cookieAttributes,
80
- experimental_quirksEnabled
81
- })
77
+ const transitionStore = new CookieTransitionDataStore({
78
+ serverCookieValue,
79
+ quirkCookieValue,
80
+ cookieAttributes,
81
+ experimental_quirksEnabled,
82
+ maxBytes: cookieMaxBytes
82
83
  });
84
+ const context = new Context({ ...rest, transitionStore });
85
+ transitionStore.onLogMessage = (message) => context.log(...message);
83
86
  const wrapped = new AppDirectoryContextInstance(context);
84
87
  return wrapped;
85
88
  };
package/dist/index.js CHANGED
@@ -96,17 +96,20 @@ var createUniformContext = ({
96
96
  quirkCookieValue,
97
97
  experimental_quirksEnabled,
98
98
  cookieAttributes,
99
+ cookieMaxBytes,
100
+ // the pruning options are not named here on purpose: they belong to the visitor data store,
101
+ // so `rest` already carries them to the Context
99
102
  ...rest
100
103
  }) => {
101
- const context = new import_context.Context({
102
- ...rest,
103
- transitionStore: new import_context.CookieTransitionDataStore({
104
- serverCookieValue,
105
- quirkCookieValue,
106
- cookieAttributes,
107
- experimental_quirksEnabled
108
- })
104
+ const transitionStore = new import_context.CookieTransitionDataStore({
105
+ serverCookieValue,
106
+ quirkCookieValue,
107
+ cookieAttributes,
108
+ experimental_quirksEnabled,
109
+ maxBytes: cookieMaxBytes
109
110
  });
111
+ const context = new import_context.Context({ ...rest, transitionStore });
112
+ transitionStore.onLogMessage = (message) => context.log(...message);
110
113
  const wrapped = new AppDirectoryContextInstance(context);
111
114
  return wrapped;
112
115
  };
package/dist/index.mjs CHANGED
@@ -69,17 +69,20 @@ var createUniformContext = ({
69
69
  quirkCookieValue,
70
70
  experimental_quirksEnabled,
71
71
  cookieAttributes,
72
+ cookieMaxBytes,
73
+ // the pruning options are not named here on purpose: they belong to the visitor data store,
74
+ // so `rest` already carries them to the Context
72
75
  ...rest
73
76
  }) => {
74
- const context = new Context({
75
- ...rest,
76
- transitionStore: new CookieTransitionDataStore({
77
- serverCookieValue,
78
- quirkCookieValue,
79
- cookieAttributes,
80
- experimental_quirksEnabled
81
- })
77
+ const transitionStore = new CookieTransitionDataStore({
78
+ serverCookieValue,
79
+ quirkCookieValue,
80
+ cookieAttributes,
81
+ experimental_quirksEnabled,
82
+ maxBytes: cookieMaxBytes
82
83
  });
84
+ const context = new Context({ ...rest, transitionStore });
85
+ transitionStore.onLogMessage = (message) => context.log(...message);
83
86
  const wrapped = new AppDirectoryContextInstance(context);
84
87
  return wrapped;
85
88
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@uniformdev/canvas-next-rsc-shared",
3
- "version": "20.80.0",
3
+ "version": "20.80.1-alpha.10.sha-e0cfb4ce44",
4
4
  "license": "SEE LICENSE IN LICENSE.txt",
5
5
  "scripts": {
6
6
  "build": "tsup",
@@ -33,8 +33,8 @@
33
33
  "react-dom": "19.2.1"
34
34
  },
35
35
  "dependencies": {
36
- "@uniformdev/canvas": "20.80.0",
37
- "@uniformdev/context": "20.80.0"
36
+ "@uniformdev/canvas": "20.80.1-alpha.10.sha-e0cfb4ce44",
37
+ "@uniformdev/context": "20.80.1-alpha.10.sha-e0cfb4ce44"
38
38
  },
39
39
  "engines": {
40
40
  "node": "^18.18.0 || ^19.8.0 || >= 20.0.0"
@@ -47,5 +47,5 @@
47
47
  "publishConfig": {
48
48
  "access": "public"
49
49
  },
50
- "gitHead": "6eec8f028463f30667b59af913a74d56960dde11"
50
+ "gitHead": "e0cfb4ce4435ea507f36d3246fc886c24f8ebe16"
51
51
  }