@ninetailed/experience.js-utils 7.12.1 → 7.13.0-beta.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/index.cjs.js +71 -21
- package/index.esm.js +72 -22
- package/package.json +3 -3
- package/src/types/Config.d.ts +303 -19
- package/src/types/Experience.d.ts +971 -243
- package/src/types/Experiment.d.ts +971 -243
package/index.cjs.js
CHANGED
|
@@ -11,24 +11,63 @@ const Audience = zod.z.object({
|
|
|
11
11
|
description: zod.z.string().optional()
|
|
12
12
|
});
|
|
13
13
|
|
|
14
|
+
var ComponentTypeEnum;
|
|
15
|
+
(function (ComponentTypeEnum) {
|
|
16
|
+
ComponentTypeEnum["EntryReplacement"] = "EntryReplacement";
|
|
17
|
+
ComponentTypeEnum["InlineVariable"] = "InlineVariable";
|
|
18
|
+
})(ComponentTypeEnum || (ComponentTypeEnum = {}));
|
|
19
|
+
var InlineVariableComponentValueTypeEnum;
|
|
20
|
+
(function (InlineVariableComponentValueTypeEnum) {
|
|
21
|
+
InlineVariableComponentValueTypeEnum["String"] = "String";
|
|
22
|
+
InlineVariableComponentValueTypeEnum["Object"] = "Object";
|
|
23
|
+
})(InlineVariableComponentValueTypeEnum || (InlineVariableComponentValueTypeEnum = {}));
|
|
24
|
+
const entryReplacementVariantSchema = zod.z.object({
|
|
25
|
+
id: zod.z.string(),
|
|
26
|
+
hidden: zod.z.boolean().default(false)
|
|
27
|
+
});
|
|
28
|
+
const variableVariantSchema = zod.z.object({
|
|
29
|
+
value: zod.z.union([zod.z.string(), experience_jsShared.SerializableObject])
|
|
30
|
+
});
|
|
31
|
+
const EntryReplacementComponentSchema = zod.z.object({
|
|
32
|
+
type: zod.z.literal(ComponentTypeEnum.EntryReplacement),
|
|
33
|
+
baseline: entryReplacementVariantSchema,
|
|
34
|
+
variants: zod.z.array(entryReplacementVariantSchema)
|
|
35
|
+
});
|
|
36
|
+
function isEntryReplacementComponent(component) {
|
|
37
|
+
return component.type === ComponentTypeEnum.EntryReplacement || component.type === undefined;
|
|
38
|
+
}
|
|
39
|
+
const InlineVariableComponentSchema = zod.z.object({
|
|
40
|
+
type: zod.z.literal(ComponentTypeEnum.InlineVariable),
|
|
41
|
+
key: zod.z.string(),
|
|
42
|
+
valueType: zod.z.nativeEnum(InlineVariableComponentValueTypeEnum),
|
|
43
|
+
baseline: variableVariantSchema,
|
|
44
|
+
variants: zod.z.array(variableVariantSchema)
|
|
45
|
+
});
|
|
46
|
+
function isInlineVariableComponent(component) {
|
|
47
|
+
return component.type === ComponentTypeEnum.InlineVariable;
|
|
48
|
+
}
|
|
49
|
+
const ExperienceConfigComponentSchema = zod.z.preprocess(input => {
|
|
50
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
51
|
+
const component = input;
|
|
52
|
+
if (!(component === null || component === void 0 ? void 0 : component.type)) {
|
|
53
|
+
if ('baseline' in component && 'variants' in component) {
|
|
54
|
+
return Object.assign(Object.assign({}, component), {
|
|
55
|
+
type: ComponentTypeEnum.EntryReplacement
|
|
56
|
+
});
|
|
57
|
+
}
|
|
58
|
+
}
|
|
59
|
+
return component;
|
|
60
|
+
}, zod.z.discriminatedUnion('type', [EntryReplacementComponentSchema, InlineVariableComponentSchema]));
|
|
14
61
|
const Config = zod.z.object({
|
|
15
62
|
distribution: zod.z.array(zod.z.number()).optional().default([0.5, 0.5]),
|
|
16
63
|
traffic: zod.z.number().optional().default(0),
|
|
17
|
-
components: zod.z.array(
|
|
18
|
-
|
|
19
|
-
id: zod.z.string().default('')
|
|
20
|
-
}),
|
|
21
|
-
variants: zod.z.array(zod.z.object({
|
|
22
|
-
id: zod.z.string().default(''),
|
|
23
|
-
hidden: zod.z.boolean().default(false)
|
|
24
|
-
}))
|
|
25
|
-
})).optional().default([{
|
|
64
|
+
components: zod.z.array(ExperienceConfigComponentSchema).optional().default([{
|
|
65
|
+
type: ComponentTypeEnum.EntryReplacement,
|
|
26
66
|
baseline: {
|
|
27
67
|
id: ''
|
|
28
68
|
},
|
|
29
69
|
variants: [{
|
|
30
|
-
id: ''
|
|
31
|
-
hidden: false
|
|
70
|
+
id: ''
|
|
32
71
|
}]
|
|
33
72
|
}]),
|
|
34
73
|
sticky: zod.z.boolean().optional().default(false)
|
|
@@ -178,16 +217,27 @@ class ExperienceMapper {
|
|
|
178
217
|
end: config.distribution.slice(0, index + 1).reduce((a, b) => a + b, 0)
|
|
179
218
|
})),
|
|
180
219
|
sticky,
|
|
181
|
-
components: components.map(component =>
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
220
|
+
components: components.map(component => {
|
|
221
|
+
if (isEntryReplacementComponent(component)) {
|
|
222
|
+
// Process EntryReplacement component
|
|
223
|
+
const processedVariants = component.variants.map(variantRef => {
|
|
224
|
+
if (variantRef.hidden) {
|
|
225
|
+
return variantRef;
|
|
226
|
+
}
|
|
227
|
+
const matchingVariant = variants.find(variant => variant.id === variantRef.id);
|
|
228
|
+
return matchingVariant !== null && matchingVariant !== void 0 ? matchingVariant : null;
|
|
229
|
+
}).filter(variant => variant !== null);
|
|
230
|
+
return {
|
|
231
|
+
type: ComponentTypeEnum.EntryReplacement,
|
|
232
|
+
baseline: component.baseline,
|
|
233
|
+
variants: processedVariants
|
|
234
|
+
};
|
|
235
|
+
}
|
|
236
|
+
if (isInlineVariableComponent(component)) {
|
|
237
|
+
return component;
|
|
238
|
+
}
|
|
239
|
+
throw new Error(`Unsupported component type encountered`);
|
|
240
|
+
})
|
|
191
241
|
});
|
|
192
242
|
}
|
|
193
243
|
static isExperimentEntry(experiment) {
|
package/index.esm.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { logger } from '@ninetailed/experience.js-shared';
|
|
1
|
+
import { SerializableObject, logger } from '@ninetailed/experience.js-shared';
|
|
2
2
|
import { z } from 'zod';
|
|
3
3
|
|
|
4
4
|
const Audience = z.object({
|
|
@@ -7,24 +7,63 @@ const Audience = z.object({
|
|
|
7
7
|
description: z.string().optional()
|
|
8
8
|
});
|
|
9
9
|
|
|
10
|
+
let ComponentTypeEnum = /*#__PURE__*/function (ComponentTypeEnum) {
|
|
11
|
+
ComponentTypeEnum["EntryReplacement"] = "EntryReplacement";
|
|
12
|
+
ComponentTypeEnum["InlineVariable"] = "InlineVariable";
|
|
13
|
+
return ComponentTypeEnum;
|
|
14
|
+
}({});
|
|
15
|
+
let InlineVariableComponentValueTypeEnum = /*#__PURE__*/function (InlineVariableComponentValueTypeEnum) {
|
|
16
|
+
InlineVariableComponentValueTypeEnum["String"] = "String";
|
|
17
|
+
InlineVariableComponentValueTypeEnum["Object"] = "Object";
|
|
18
|
+
return InlineVariableComponentValueTypeEnum;
|
|
19
|
+
}({});
|
|
20
|
+
const entryReplacementVariantSchema = z.object({
|
|
21
|
+
id: z.string(),
|
|
22
|
+
hidden: z.boolean().default(false)
|
|
23
|
+
});
|
|
24
|
+
const variableVariantSchema = z.object({
|
|
25
|
+
value: z.union([z.string(), SerializableObject])
|
|
26
|
+
});
|
|
27
|
+
const EntryReplacementComponentSchema = z.object({
|
|
28
|
+
type: z.literal(ComponentTypeEnum.EntryReplacement),
|
|
29
|
+
baseline: entryReplacementVariantSchema,
|
|
30
|
+
variants: z.array(entryReplacementVariantSchema)
|
|
31
|
+
});
|
|
32
|
+
function isEntryReplacementComponent(component) {
|
|
33
|
+
return component.type === ComponentTypeEnum.EntryReplacement || component.type === undefined;
|
|
34
|
+
}
|
|
35
|
+
const InlineVariableComponentSchema = z.object({
|
|
36
|
+
type: z.literal(ComponentTypeEnum.InlineVariable),
|
|
37
|
+
key: z.string(),
|
|
38
|
+
valueType: z.nativeEnum(InlineVariableComponentValueTypeEnum),
|
|
39
|
+
baseline: variableVariantSchema,
|
|
40
|
+
variants: z.array(variableVariantSchema)
|
|
41
|
+
});
|
|
42
|
+
function isInlineVariableComponent(component) {
|
|
43
|
+
return component.type === ComponentTypeEnum.InlineVariable;
|
|
44
|
+
}
|
|
45
|
+
const ExperienceConfigComponentSchema = z.preprocess(input => {
|
|
46
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
47
|
+
const component = input;
|
|
48
|
+
if (!(component != null && component.type)) {
|
|
49
|
+
if ('baseline' in component && 'variants' in component) {
|
|
50
|
+
return Object.assign({}, component, {
|
|
51
|
+
type: ComponentTypeEnum.EntryReplacement
|
|
52
|
+
});
|
|
53
|
+
}
|
|
54
|
+
}
|
|
55
|
+
return component;
|
|
56
|
+
}, z.discriminatedUnion('type', [EntryReplacementComponentSchema, InlineVariableComponentSchema]));
|
|
10
57
|
const Config = z.object({
|
|
11
58
|
distribution: z.array(z.number()).optional().default([0.5, 0.5]),
|
|
12
59
|
traffic: z.number().optional().default(0),
|
|
13
|
-
components: z.array(
|
|
14
|
-
|
|
15
|
-
id: z.string().default('')
|
|
16
|
-
}),
|
|
17
|
-
variants: z.array(z.object({
|
|
18
|
-
id: z.string().default(''),
|
|
19
|
-
hidden: z.boolean().default(false)
|
|
20
|
-
}))
|
|
21
|
-
})).optional().default([{
|
|
60
|
+
components: z.array(ExperienceConfigComponentSchema).optional().default([{
|
|
61
|
+
type: ComponentTypeEnum.EntryReplacement,
|
|
22
62
|
baseline: {
|
|
23
63
|
id: ''
|
|
24
64
|
},
|
|
25
65
|
variants: [{
|
|
26
|
-
id: ''
|
|
27
|
-
hidden: false
|
|
66
|
+
id: ''
|
|
28
67
|
}]
|
|
29
68
|
}]),
|
|
30
69
|
sticky: z.boolean().optional().default(false)
|
|
@@ -174,16 +213,27 @@ class ExperienceMapper {
|
|
|
174
213
|
end: config.distribution.slice(0, index + 1).reduce((a, b) => a + b, 0)
|
|
175
214
|
})),
|
|
176
215
|
sticky,
|
|
177
|
-
components: components.map(component =>
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
216
|
+
components: components.map(component => {
|
|
217
|
+
if (isEntryReplacementComponent(component)) {
|
|
218
|
+
// Process EntryReplacement component
|
|
219
|
+
const processedVariants = component.variants.map(variantRef => {
|
|
220
|
+
if (variantRef.hidden) {
|
|
221
|
+
return variantRef;
|
|
222
|
+
}
|
|
223
|
+
const matchingVariant = variants.find(variant => variant.id === variantRef.id);
|
|
224
|
+
return matchingVariant != null ? matchingVariant : null;
|
|
225
|
+
}).filter(variant => variant !== null);
|
|
226
|
+
return {
|
|
227
|
+
type: ComponentTypeEnum.EntryReplacement,
|
|
228
|
+
baseline: component.baseline,
|
|
229
|
+
variants: processedVariants
|
|
230
|
+
};
|
|
231
|
+
}
|
|
232
|
+
if (isInlineVariableComponent(component)) {
|
|
233
|
+
return component;
|
|
234
|
+
}
|
|
235
|
+
throw new Error(`Unsupported component type encountered`);
|
|
236
|
+
})
|
|
187
237
|
});
|
|
188
238
|
}
|
|
189
239
|
static isExperimentEntry(experiment) {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@ninetailed/experience.js-utils",
|
|
3
|
-
"version": "7.
|
|
3
|
+
"version": "7.13.0-beta.1",
|
|
4
4
|
"description": "Ninetailed Experience.js Utils",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"repository": {
|
|
@@ -9,8 +9,8 @@
|
|
|
9
9
|
"directory": "packages/utils/javascript"
|
|
10
10
|
},
|
|
11
11
|
"dependencies": {
|
|
12
|
-
"@ninetailed/experience.js": "7.
|
|
13
|
-
"@ninetailed/experience.js-shared": "7.
|
|
12
|
+
"@ninetailed/experience.js": "7.13.0-beta.1",
|
|
13
|
+
"@ninetailed/experience.js-shared": "7.13.0-beta.1",
|
|
14
14
|
"zod": "3.23.0"
|
|
15
15
|
},
|
|
16
16
|
"module": "./index.esm.js",
|
package/src/types/Config.d.ts
CHANGED
|
@@ -1,69 +1,353 @@
|
|
|
1
1
|
import { Baseline, VariantRef } from '@ninetailed/experience.js';
|
|
2
|
+
import { SerializableObject } from '@ninetailed/experience.js-shared';
|
|
2
3
|
import { z } from 'zod';
|
|
4
|
+
export declare enum ComponentTypeEnum {
|
|
5
|
+
EntryReplacement = "EntryReplacement",
|
|
6
|
+
InlineVariable = "InlineVariable"
|
|
7
|
+
}
|
|
8
|
+
export declare enum InlineVariableComponentValueTypeEnum {
|
|
9
|
+
String = "String",
|
|
10
|
+
Object = "Object"
|
|
11
|
+
}
|
|
12
|
+
export declare const entryReplacementVariantSchema: z.ZodObject<{
|
|
13
|
+
id: z.ZodString;
|
|
14
|
+
hidden: z.ZodDefault<z.ZodBoolean>;
|
|
15
|
+
}, "strip", z.ZodTypeAny, {
|
|
16
|
+
id: string;
|
|
17
|
+
hidden: boolean;
|
|
18
|
+
}, {
|
|
19
|
+
id: string;
|
|
20
|
+
hidden?: boolean | undefined;
|
|
21
|
+
}>;
|
|
22
|
+
export declare const variableVariantSchema: z.ZodObject<{
|
|
23
|
+
value: z.ZodUnion<[z.ZodString, z.ZodType<SerializableObject, z.ZodTypeDef, unknown>]>;
|
|
24
|
+
}, "strip", z.ZodTypeAny, {
|
|
25
|
+
value: string | SerializableObject;
|
|
26
|
+
}, {
|
|
27
|
+
value?: unknown;
|
|
28
|
+
}>;
|
|
29
|
+
export declare const EntryReplacementComponentSchema: z.ZodObject<{
|
|
30
|
+
type: z.ZodLiteral<ComponentTypeEnum.EntryReplacement>;
|
|
31
|
+
baseline: z.ZodObject<{
|
|
32
|
+
id: z.ZodString;
|
|
33
|
+
hidden: z.ZodDefault<z.ZodBoolean>;
|
|
34
|
+
}, "strip", z.ZodTypeAny, {
|
|
35
|
+
id: string;
|
|
36
|
+
hidden: boolean;
|
|
37
|
+
}, {
|
|
38
|
+
id: string;
|
|
39
|
+
hidden?: boolean | undefined;
|
|
40
|
+
}>;
|
|
41
|
+
variants: z.ZodArray<z.ZodObject<{
|
|
42
|
+
id: z.ZodString;
|
|
43
|
+
hidden: z.ZodDefault<z.ZodBoolean>;
|
|
44
|
+
}, "strip", z.ZodTypeAny, {
|
|
45
|
+
id: string;
|
|
46
|
+
hidden: boolean;
|
|
47
|
+
}, {
|
|
48
|
+
id: string;
|
|
49
|
+
hidden?: boolean | undefined;
|
|
50
|
+
}>, "many">;
|
|
51
|
+
}, "strip", z.ZodTypeAny, {
|
|
52
|
+
type: ComponentTypeEnum.EntryReplacement;
|
|
53
|
+
baseline: {
|
|
54
|
+
id: string;
|
|
55
|
+
hidden: boolean;
|
|
56
|
+
};
|
|
57
|
+
variants: {
|
|
58
|
+
id: string;
|
|
59
|
+
hidden: boolean;
|
|
60
|
+
}[];
|
|
61
|
+
}, {
|
|
62
|
+
type: ComponentTypeEnum.EntryReplacement;
|
|
63
|
+
baseline: {
|
|
64
|
+
id: string;
|
|
65
|
+
hidden?: boolean | undefined;
|
|
66
|
+
};
|
|
67
|
+
variants: {
|
|
68
|
+
id: string;
|
|
69
|
+
hidden?: boolean | undefined;
|
|
70
|
+
}[];
|
|
71
|
+
}>;
|
|
72
|
+
export type EntryReplacementComponent = z.infer<typeof EntryReplacementComponentSchema>;
|
|
73
|
+
export type TExperienceConfigComponentSchema = z.infer<typeof ExperienceConfigComponentSchema>;
|
|
74
|
+
export declare function isEntryReplacementComponent(component: TExperienceConfigComponentSchema): component is EntryReplacementComponent;
|
|
75
|
+
export declare const InlineVariableComponentSchema: z.ZodObject<{
|
|
76
|
+
type: z.ZodLiteral<ComponentTypeEnum.InlineVariable>;
|
|
77
|
+
key: z.ZodString;
|
|
78
|
+
valueType: z.ZodNativeEnum<typeof InlineVariableComponentValueTypeEnum>;
|
|
79
|
+
baseline: z.ZodObject<{
|
|
80
|
+
value: z.ZodUnion<[z.ZodString, z.ZodType<SerializableObject, z.ZodTypeDef, unknown>]>;
|
|
81
|
+
}, "strip", z.ZodTypeAny, {
|
|
82
|
+
value: string | SerializableObject;
|
|
83
|
+
}, {
|
|
84
|
+
value?: unknown;
|
|
85
|
+
}>;
|
|
86
|
+
variants: z.ZodArray<z.ZodObject<{
|
|
87
|
+
value: z.ZodUnion<[z.ZodString, z.ZodType<SerializableObject, z.ZodTypeDef, unknown>]>;
|
|
88
|
+
}, "strip", z.ZodTypeAny, {
|
|
89
|
+
value: string | SerializableObject;
|
|
90
|
+
}, {
|
|
91
|
+
value?: unknown;
|
|
92
|
+
}>, "many">;
|
|
93
|
+
}, "strip", z.ZodTypeAny, {
|
|
94
|
+
type: ComponentTypeEnum.InlineVariable;
|
|
95
|
+
baseline: {
|
|
96
|
+
value: string | SerializableObject;
|
|
97
|
+
};
|
|
98
|
+
variants: {
|
|
99
|
+
value: string | SerializableObject;
|
|
100
|
+
}[];
|
|
101
|
+
key: string;
|
|
102
|
+
valueType: InlineVariableComponentValueTypeEnum;
|
|
103
|
+
}, {
|
|
104
|
+
type: ComponentTypeEnum.InlineVariable;
|
|
105
|
+
baseline: {
|
|
106
|
+
value?: unknown;
|
|
107
|
+
};
|
|
108
|
+
variants: {
|
|
109
|
+
value?: unknown;
|
|
110
|
+
}[];
|
|
111
|
+
key: string;
|
|
112
|
+
valueType: InlineVariableComponentValueTypeEnum;
|
|
113
|
+
}>;
|
|
114
|
+
export type InlineVariableComponent = z.infer<typeof InlineVariableComponentSchema>;
|
|
115
|
+
export declare function isInlineVariableComponent(component: TExperienceConfigComponentSchema): component is InlineVariableComponent;
|
|
116
|
+
export declare const ExperienceConfigComponentSchema: z.ZodEffects<z.ZodDiscriminatedUnion<"type", [z.ZodObject<{
|
|
117
|
+
type: z.ZodLiteral<ComponentTypeEnum.EntryReplacement>;
|
|
118
|
+
baseline: z.ZodObject<{
|
|
119
|
+
id: z.ZodString;
|
|
120
|
+
hidden: z.ZodDefault<z.ZodBoolean>;
|
|
121
|
+
}, "strip", z.ZodTypeAny, {
|
|
122
|
+
id: string;
|
|
123
|
+
hidden: boolean;
|
|
124
|
+
}, {
|
|
125
|
+
id: string;
|
|
126
|
+
hidden?: boolean | undefined;
|
|
127
|
+
}>;
|
|
128
|
+
variants: z.ZodArray<z.ZodObject<{
|
|
129
|
+
id: z.ZodString;
|
|
130
|
+
hidden: z.ZodDefault<z.ZodBoolean>;
|
|
131
|
+
}, "strip", z.ZodTypeAny, {
|
|
132
|
+
id: string;
|
|
133
|
+
hidden: boolean;
|
|
134
|
+
}, {
|
|
135
|
+
id: string;
|
|
136
|
+
hidden?: boolean | undefined;
|
|
137
|
+
}>, "many">;
|
|
138
|
+
}, "strip", z.ZodTypeAny, {
|
|
139
|
+
type: ComponentTypeEnum.EntryReplacement;
|
|
140
|
+
baseline: {
|
|
141
|
+
id: string;
|
|
142
|
+
hidden: boolean;
|
|
143
|
+
};
|
|
144
|
+
variants: {
|
|
145
|
+
id: string;
|
|
146
|
+
hidden: boolean;
|
|
147
|
+
}[];
|
|
148
|
+
}, {
|
|
149
|
+
type: ComponentTypeEnum.EntryReplacement;
|
|
150
|
+
baseline: {
|
|
151
|
+
id: string;
|
|
152
|
+
hidden?: boolean | undefined;
|
|
153
|
+
};
|
|
154
|
+
variants: {
|
|
155
|
+
id: string;
|
|
156
|
+
hidden?: boolean | undefined;
|
|
157
|
+
}[];
|
|
158
|
+
}>, z.ZodObject<{
|
|
159
|
+
type: z.ZodLiteral<ComponentTypeEnum.InlineVariable>;
|
|
160
|
+
key: z.ZodString;
|
|
161
|
+
valueType: z.ZodNativeEnum<typeof InlineVariableComponentValueTypeEnum>;
|
|
162
|
+
baseline: z.ZodObject<{
|
|
163
|
+
value: z.ZodUnion<[z.ZodString, z.ZodType<SerializableObject, z.ZodTypeDef, unknown>]>;
|
|
164
|
+
}, "strip", z.ZodTypeAny, {
|
|
165
|
+
value: string | SerializableObject;
|
|
166
|
+
}, {
|
|
167
|
+
value?: unknown;
|
|
168
|
+
}>;
|
|
169
|
+
variants: z.ZodArray<z.ZodObject<{
|
|
170
|
+
value: z.ZodUnion<[z.ZodString, z.ZodType<SerializableObject, z.ZodTypeDef, unknown>]>;
|
|
171
|
+
}, "strip", z.ZodTypeAny, {
|
|
172
|
+
value: string | SerializableObject;
|
|
173
|
+
}, {
|
|
174
|
+
value?: unknown;
|
|
175
|
+
}>, "many">;
|
|
176
|
+
}, "strip", z.ZodTypeAny, {
|
|
177
|
+
type: ComponentTypeEnum.InlineVariable;
|
|
178
|
+
baseline: {
|
|
179
|
+
value: string | SerializableObject;
|
|
180
|
+
};
|
|
181
|
+
variants: {
|
|
182
|
+
value: string | SerializableObject;
|
|
183
|
+
}[];
|
|
184
|
+
key: string;
|
|
185
|
+
valueType: InlineVariableComponentValueTypeEnum;
|
|
186
|
+
}, {
|
|
187
|
+
type: ComponentTypeEnum.InlineVariable;
|
|
188
|
+
baseline: {
|
|
189
|
+
value?: unknown;
|
|
190
|
+
};
|
|
191
|
+
variants: {
|
|
192
|
+
value?: unknown;
|
|
193
|
+
}[];
|
|
194
|
+
key: string;
|
|
195
|
+
valueType: InlineVariableComponentValueTypeEnum;
|
|
196
|
+
}>]>, {
|
|
197
|
+
type: ComponentTypeEnum.EntryReplacement;
|
|
198
|
+
baseline: {
|
|
199
|
+
id: string;
|
|
200
|
+
hidden: boolean;
|
|
201
|
+
};
|
|
202
|
+
variants: {
|
|
203
|
+
id: string;
|
|
204
|
+
hidden: boolean;
|
|
205
|
+
}[];
|
|
206
|
+
} | {
|
|
207
|
+
type: ComponentTypeEnum.InlineVariable;
|
|
208
|
+
baseline: {
|
|
209
|
+
value: string | SerializableObject;
|
|
210
|
+
};
|
|
211
|
+
variants: {
|
|
212
|
+
value: string | SerializableObject;
|
|
213
|
+
}[];
|
|
214
|
+
key: string;
|
|
215
|
+
valueType: InlineVariableComponentValueTypeEnum;
|
|
216
|
+
}, unknown>;
|
|
3
217
|
export declare const Config: z.ZodObject<{
|
|
4
218
|
distribution: z.ZodDefault<z.ZodOptional<z.ZodArray<z.ZodNumber, "many">>>;
|
|
5
219
|
traffic: z.ZodDefault<z.ZodOptional<z.ZodNumber>>;
|
|
6
|
-
components: z.ZodDefault<z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
220
|
+
components: z.ZodDefault<z.ZodOptional<z.ZodArray<z.ZodEffects<z.ZodDiscriminatedUnion<"type", [z.ZodObject<{
|
|
221
|
+
type: z.ZodLiteral<ComponentTypeEnum.EntryReplacement>;
|
|
7
222
|
baseline: z.ZodObject<{
|
|
8
|
-
id: z.
|
|
223
|
+
id: z.ZodString;
|
|
224
|
+
hidden: z.ZodDefault<z.ZodBoolean>;
|
|
9
225
|
}, "strip", z.ZodTypeAny, {
|
|
10
226
|
id: string;
|
|
227
|
+
hidden: boolean;
|
|
11
228
|
}, {
|
|
12
|
-
id
|
|
229
|
+
id: string;
|
|
230
|
+
hidden?: boolean | undefined;
|
|
13
231
|
}>;
|
|
14
232
|
variants: z.ZodArray<z.ZodObject<{
|
|
15
|
-
id: z.
|
|
233
|
+
id: z.ZodString;
|
|
16
234
|
hidden: z.ZodDefault<z.ZodBoolean>;
|
|
17
235
|
}, "strip", z.ZodTypeAny, {
|
|
18
236
|
id: string;
|
|
19
237
|
hidden: boolean;
|
|
20
238
|
}, {
|
|
21
|
-
id
|
|
239
|
+
id: string;
|
|
22
240
|
hidden?: boolean | undefined;
|
|
23
241
|
}>, "many">;
|
|
24
242
|
}, "strip", z.ZodTypeAny, {
|
|
243
|
+
type: ComponentTypeEnum.EntryReplacement;
|
|
25
244
|
baseline: {
|
|
26
245
|
id: string;
|
|
246
|
+
hidden: boolean;
|
|
27
247
|
};
|
|
28
248
|
variants: {
|
|
29
249
|
id: string;
|
|
30
250
|
hidden: boolean;
|
|
31
251
|
}[];
|
|
32
252
|
}, {
|
|
253
|
+
type: ComponentTypeEnum.EntryReplacement;
|
|
33
254
|
baseline: {
|
|
34
|
-
id
|
|
255
|
+
id: string;
|
|
256
|
+
hidden?: boolean | undefined;
|
|
35
257
|
};
|
|
36
258
|
variants: {
|
|
37
|
-
id
|
|
259
|
+
id: string;
|
|
38
260
|
hidden?: boolean | undefined;
|
|
39
261
|
}[];
|
|
40
|
-
}>,
|
|
262
|
+
}>, z.ZodObject<{
|
|
263
|
+
type: z.ZodLiteral<ComponentTypeEnum.InlineVariable>;
|
|
264
|
+
key: z.ZodString;
|
|
265
|
+
valueType: z.ZodNativeEnum<typeof InlineVariableComponentValueTypeEnum>;
|
|
266
|
+
baseline: z.ZodObject<{
|
|
267
|
+
value: z.ZodUnion<[z.ZodString, z.ZodType<SerializableObject, z.ZodTypeDef, unknown>]>;
|
|
268
|
+
}, "strip", z.ZodTypeAny, {
|
|
269
|
+
value: string | SerializableObject;
|
|
270
|
+
}, {
|
|
271
|
+
value?: unknown;
|
|
272
|
+
}>;
|
|
273
|
+
variants: z.ZodArray<z.ZodObject<{
|
|
274
|
+
value: z.ZodUnion<[z.ZodString, z.ZodType<SerializableObject, z.ZodTypeDef, unknown>]>;
|
|
275
|
+
}, "strip", z.ZodTypeAny, {
|
|
276
|
+
value: string | SerializableObject;
|
|
277
|
+
}, {
|
|
278
|
+
value?: unknown;
|
|
279
|
+
}>, "many">;
|
|
280
|
+
}, "strip", z.ZodTypeAny, {
|
|
281
|
+
type: ComponentTypeEnum.InlineVariable;
|
|
282
|
+
baseline: {
|
|
283
|
+
value: string | SerializableObject;
|
|
284
|
+
};
|
|
285
|
+
variants: {
|
|
286
|
+
value: string | SerializableObject;
|
|
287
|
+
}[];
|
|
288
|
+
key: string;
|
|
289
|
+
valueType: InlineVariableComponentValueTypeEnum;
|
|
290
|
+
}, {
|
|
291
|
+
type: ComponentTypeEnum.InlineVariable;
|
|
292
|
+
baseline: {
|
|
293
|
+
value?: unknown;
|
|
294
|
+
};
|
|
295
|
+
variants: {
|
|
296
|
+
value?: unknown;
|
|
297
|
+
}[];
|
|
298
|
+
key: string;
|
|
299
|
+
valueType: InlineVariableComponentValueTypeEnum;
|
|
300
|
+
}>]>, {
|
|
301
|
+
type: ComponentTypeEnum.EntryReplacement;
|
|
302
|
+
baseline: {
|
|
303
|
+
id: string;
|
|
304
|
+
hidden: boolean;
|
|
305
|
+
};
|
|
306
|
+
variants: {
|
|
307
|
+
id: string;
|
|
308
|
+
hidden: boolean;
|
|
309
|
+
}[];
|
|
310
|
+
} | {
|
|
311
|
+
type: ComponentTypeEnum.InlineVariable;
|
|
312
|
+
baseline: {
|
|
313
|
+
value: string | SerializableObject;
|
|
314
|
+
};
|
|
315
|
+
variants: {
|
|
316
|
+
value: string | SerializableObject;
|
|
317
|
+
}[];
|
|
318
|
+
key: string;
|
|
319
|
+
valueType: InlineVariableComponentValueTypeEnum;
|
|
320
|
+
}, unknown>, "many">>>;
|
|
41
321
|
sticky: z.ZodDefault<z.ZodOptional<z.ZodBoolean>>;
|
|
42
322
|
}, "strip", z.ZodTypeAny, {
|
|
43
323
|
distribution: number[];
|
|
44
324
|
traffic: number;
|
|
45
|
-
components: {
|
|
325
|
+
components: ({
|
|
326
|
+
type: ComponentTypeEnum.EntryReplacement;
|
|
46
327
|
baseline: {
|
|
47
328
|
id: string;
|
|
329
|
+
hidden: boolean;
|
|
48
330
|
};
|
|
49
331
|
variants: {
|
|
50
332
|
id: string;
|
|
51
333
|
hidden: boolean;
|
|
52
334
|
}[];
|
|
53
|
-
}
|
|
54
|
-
|
|
55
|
-
}, {
|
|
56
|
-
distribution?: number[] | undefined;
|
|
57
|
-
traffic?: number | undefined;
|
|
58
|
-
components?: {
|
|
335
|
+
} | {
|
|
336
|
+
type: ComponentTypeEnum.InlineVariable;
|
|
59
337
|
baseline: {
|
|
60
|
-
|
|
338
|
+
value: string | SerializableObject;
|
|
61
339
|
};
|
|
62
340
|
variants: {
|
|
63
|
-
|
|
64
|
-
hidden?: boolean | undefined;
|
|
341
|
+
value: string | SerializableObject;
|
|
65
342
|
}[];
|
|
66
|
-
|
|
343
|
+
key: string;
|
|
344
|
+
valueType: InlineVariableComponentValueTypeEnum;
|
|
345
|
+
})[];
|
|
346
|
+
sticky: boolean;
|
|
347
|
+
}, {
|
|
348
|
+
distribution?: number[] | undefined;
|
|
349
|
+
traffic?: number | undefined;
|
|
350
|
+
components?: unknown[] | undefined;
|
|
67
351
|
sticky?: boolean | undefined;
|
|
68
352
|
}>;
|
|
69
353
|
export type ConfigLike = z.input<typeof Config>;
|