@flagwire/schema 0.1.0
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/LICENSE +21 -0
- package/README.md +10 -0
- package/dist/index.d.ts +677 -0
- package/dist/index.js +1 -0
- package/package.json +40 -0
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 FlagWire contributors
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/README.md
ADDED
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
# `@flagwire/schema`
|
|
2
|
+
|
|
3
|
+
Public Zod schemas and TypeScript types for FlagWire wire contracts. SDKs use these schemas to
|
|
4
|
+
reject malformed bundles and fail safely to application defaults.
|
|
5
|
+
|
|
6
|
+
```ts
|
|
7
|
+
import { bundleSchema, type Bundle } from "@flagwire/schema";
|
|
8
|
+
|
|
9
|
+
const result = bundleSchema.safeParse(input);
|
|
10
|
+
```
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,677 @@
|
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
export declare const bundleFormatVersion: 1;
|
|
3
|
+
export type JsonValue = null | boolean | number | string | JsonValue[] | {
|
|
4
|
+
[key: string]: JsonValue;
|
|
5
|
+
};
|
|
6
|
+
export declare const jsonValueSchema: z.ZodType<JsonValue>;
|
|
7
|
+
export declare const resourceIdSchema: z.ZodString;
|
|
8
|
+
export declare const resourceKeySchema: z.ZodString;
|
|
9
|
+
export declare const displayNameSchema: z.ZodString;
|
|
10
|
+
export declare const descriptionSchema: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
11
|
+
export declare const flagTypeSchema: z.ZodEnum<{
|
|
12
|
+
string: "string";
|
|
13
|
+
boolean: "boolean";
|
|
14
|
+
json: "json";
|
|
15
|
+
}>;
|
|
16
|
+
export declare const environmentSlugSchema: z.ZodEnum<{
|
|
17
|
+
dev: "dev";
|
|
18
|
+
staging: "staging";
|
|
19
|
+
prod: "prod";
|
|
20
|
+
}>;
|
|
21
|
+
export declare const sdkKeyKindSchema: z.ZodEnum<{
|
|
22
|
+
client: "client";
|
|
23
|
+
server: "server";
|
|
24
|
+
}>;
|
|
25
|
+
export declare const sdkKeyLookupSchema: z.ZodObject<{
|
|
26
|
+
envId: z.ZodString;
|
|
27
|
+
kind: z.ZodEnum<{
|
|
28
|
+
client: "client";
|
|
29
|
+
server: "server";
|
|
30
|
+
}>;
|
|
31
|
+
revoked: z.ZodBoolean;
|
|
32
|
+
}, z.core.$strict>;
|
|
33
|
+
export declare const clauseOperatorSchema: z.ZodEnum<{
|
|
34
|
+
endsWith: "endsWith";
|
|
35
|
+
startsWith: "startsWith";
|
|
36
|
+
eq: "eq";
|
|
37
|
+
neq: "neq";
|
|
38
|
+
in: "in";
|
|
39
|
+
contains: "contains";
|
|
40
|
+
gt: "gt";
|
|
41
|
+
gte: "gte";
|
|
42
|
+
lt: "lt";
|
|
43
|
+
lte: "lte";
|
|
44
|
+
semverEq: "semverEq";
|
|
45
|
+
semverGt: "semverGt";
|
|
46
|
+
semverLt: "semverLt";
|
|
47
|
+
regex: "regex";
|
|
48
|
+
segment: "segment";
|
|
49
|
+
}>;
|
|
50
|
+
export declare const clauseValueSchema: z.ZodUnion<readonly [z.ZodString, z.ZodNumber, z.ZodBoolean]>;
|
|
51
|
+
export declare const clauseSchema: z.ZodObject<{
|
|
52
|
+
attr: z.ZodString;
|
|
53
|
+
op: z.ZodEnum<{
|
|
54
|
+
endsWith: "endsWith";
|
|
55
|
+
startsWith: "startsWith";
|
|
56
|
+
eq: "eq";
|
|
57
|
+
neq: "neq";
|
|
58
|
+
in: "in";
|
|
59
|
+
contains: "contains";
|
|
60
|
+
gt: "gt";
|
|
61
|
+
gte: "gte";
|
|
62
|
+
lt: "lt";
|
|
63
|
+
lte: "lte";
|
|
64
|
+
semverEq: "semverEq";
|
|
65
|
+
semverGt: "semverGt";
|
|
66
|
+
semverLt: "semverLt";
|
|
67
|
+
regex: "regex";
|
|
68
|
+
segment: "segment";
|
|
69
|
+
}>;
|
|
70
|
+
values: z.ZodArray<z.ZodUnion<readonly [z.ZodString, z.ZodNumber, z.ZodBoolean]>>;
|
|
71
|
+
negate: z.ZodBoolean;
|
|
72
|
+
}, z.core.$strict>;
|
|
73
|
+
export declare const rolloutVariationSchema: z.ZodObject<{
|
|
74
|
+
variant: z.ZodNumber;
|
|
75
|
+
weight: z.ZodNumber;
|
|
76
|
+
}, z.core.$strict>;
|
|
77
|
+
export declare const rolloutSchema: z.ZodObject<{
|
|
78
|
+
variations: z.ZodArray<z.ZodObject<{
|
|
79
|
+
variant: z.ZodNumber;
|
|
80
|
+
weight: z.ZodNumber;
|
|
81
|
+
}, z.core.$strict>>;
|
|
82
|
+
}, z.core.$strict>;
|
|
83
|
+
export declare const serveSchema: z.ZodUnion<readonly [z.ZodObject<{
|
|
84
|
+
variant: z.ZodNumber;
|
|
85
|
+
}, z.core.$strict>, z.ZodObject<{
|
|
86
|
+
rollout: z.ZodObject<{
|
|
87
|
+
variations: z.ZodArray<z.ZodObject<{
|
|
88
|
+
variant: z.ZodNumber;
|
|
89
|
+
weight: z.ZodNumber;
|
|
90
|
+
}, z.core.$strict>>;
|
|
91
|
+
}, z.core.$strict>;
|
|
92
|
+
}, z.core.$strict>]>;
|
|
93
|
+
export declare const ruleSchema: z.ZodObject<{
|
|
94
|
+
id: z.ZodString;
|
|
95
|
+
clauses: z.ZodArray<z.ZodObject<{
|
|
96
|
+
attr: z.ZodString;
|
|
97
|
+
op: z.ZodEnum<{
|
|
98
|
+
endsWith: "endsWith";
|
|
99
|
+
startsWith: "startsWith";
|
|
100
|
+
eq: "eq";
|
|
101
|
+
neq: "neq";
|
|
102
|
+
in: "in";
|
|
103
|
+
contains: "contains";
|
|
104
|
+
gt: "gt";
|
|
105
|
+
gte: "gte";
|
|
106
|
+
lt: "lt";
|
|
107
|
+
lte: "lte";
|
|
108
|
+
semverEq: "semverEq";
|
|
109
|
+
semverGt: "semverGt";
|
|
110
|
+
semverLt: "semverLt";
|
|
111
|
+
regex: "regex";
|
|
112
|
+
segment: "segment";
|
|
113
|
+
}>;
|
|
114
|
+
values: z.ZodArray<z.ZodUnion<readonly [z.ZodString, z.ZodNumber, z.ZodBoolean]>>;
|
|
115
|
+
negate: z.ZodBoolean;
|
|
116
|
+
}, z.core.$strict>>;
|
|
117
|
+
serve: z.ZodUnion<readonly [z.ZodObject<{
|
|
118
|
+
variant: z.ZodNumber;
|
|
119
|
+
}, z.core.$strict>, z.ZodObject<{
|
|
120
|
+
rollout: z.ZodObject<{
|
|
121
|
+
variations: z.ZodArray<z.ZodObject<{
|
|
122
|
+
variant: z.ZodNumber;
|
|
123
|
+
weight: z.ZodNumber;
|
|
124
|
+
}, z.core.$strict>>;
|
|
125
|
+
}, z.core.$strict>;
|
|
126
|
+
}, z.core.$strict>]>;
|
|
127
|
+
}, z.core.$strict>;
|
|
128
|
+
export declare const segmentRuleGroupSchema: z.ZodObject<{
|
|
129
|
+
clauses: z.ZodArray<z.ZodObject<{
|
|
130
|
+
attr: z.ZodString;
|
|
131
|
+
op: z.ZodEnum<{
|
|
132
|
+
endsWith: "endsWith";
|
|
133
|
+
startsWith: "startsWith";
|
|
134
|
+
eq: "eq";
|
|
135
|
+
neq: "neq";
|
|
136
|
+
in: "in";
|
|
137
|
+
contains: "contains";
|
|
138
|
+
gt: "gt";
|
|
139
|
+
gte: "gte";
|
|
140
|
+
lt: "lt";
|
|
141
|
+
lte: "lte";
|
|
142
|
+
semverEq: "semverEq";
|
|
143
|
+
semverGt: "semverGt";
|
|
144
|
+
semverLt: "semverLt";
|
|
145
|
+
regex: "regex";
|
|
146
|
+
segment: "segment";
|
|
147
|
+
}>;
|
|
148
|
+
values: z.ZodArray<z.ZodUnion<readonly [z.ZodString, z.ZodNumber, z.ZodBoolean]>>;
|
|
149
|
+
negate: z.ZodBoolean;
|
|
150
|
+
}, z.core.$strict>>;
|
|
151
|
+
}, z.core.$strict>;
|
|
152
|
+
export declare const segmentRulesSchema: z.ZodArray<z.ZodObject<{
|
|
153
|
+
clauses: z.ZodArray<z.ZodObject<{
|
|
154
|
+
attr: z.ZodString;
|
|
155
|
+
op: z.ZodEnum<{
|
|
156
|
+
endsWith: "endsWith";
|
|
157
|
+
startsWith: "startsWith";
|
|
158
|
+
eq: "eq";
|
|
159
|
+
neq: "neq";
|
|
160
|
+
in: "in";
|
|
161
|
+
contains: "contains";
|
|
162
|
+
gt: "gt";
|
|
163
|
+
gte: "gte";
|
|
164
|
+
lt: "lt";
|
|
165
|
+
lte: "lte";
|
|
166
|
+
semverEq: "semverEq";
|
|
167
|
+
semverGt: "semverGt";
|
|
168
|
+
semverLt: "semverLt";
|
|
169
|
+
regex: "regex";
|
|
170
|
+
segment: "segment";
|
|
171
|
+
}>;
|
|
172
|
+
values: z.ZodArray<z.ZodUnion<readonly [z.ZodString, z.ZodNumber, z.ZodBoolean]>>;
|
|
173
|
+
negate: z.ZodBoolean;
|
|
174
|
+
}, z.core.$strict>>;
|
|
175
|
+
}, z.core.$strict>>;
|
|
176
|
+
export declare const flagConfigSchema: z.ZodObject<{
|
|
177
|
+
on: z.ZodBoolean;
|
|
178
|
+
offVariant: z.ZodNumber;
|
|
179
|
+
fallthrough: z.ZodUnion<readonly [z.ZodObject<{
|
|
180
|
+
variant: z.ZodNumber;
|
|
181
|
+
}, z.core.$strict>, z.ZodObject<{
|
|
182
|
+
rollout: z.ZodObject<{
|
|
183
|
+
variations: z.ZodArray<z.ZodObject<{
|
|
184
|
+
variant: z.ZodNumber;
|
|
185
|
+
weight: z.ZodNumber;
|
|
186
|
+
}, z.core.$strict>>;
|
|
187
|
+
}, z.core.$strict>;
|
|
188
|
+
}, z.core.$strict>]>;
|
|
189
|
+
rules: z.ZodArray<z.ZodObject<{
|
|
190
|
+
id: z.ZodString;
|
|
191
|
+
clauses: z.ZodArray<z.ZodObject<{
|
|
192
|
+
attr: z.ZodString;
|
|
193
|
+
op: z.ZodEnum<{
|
|
194
|
+
endsWith: "endsWith";
|
|
195
|
+
startsWith: "startsWith";
|
|
196
|
+
eq: "eq";
|
|
197
|
+
neq: "neq";
|
|
198
|
+
in: "in";
|
|
199
|
+
contains: "contains";
|
|
200
|
+
gt: "gt";
|
|
201
|
+
gte: "gte";
|
|
202
|
+
lt: "lt";
|
|
203
|
+
lte: "lte";
|
|
204
|
+
semverEq: "semverEq";
|
|
205
|
+
semverGt: "semverGt";
|
|
206
|
+
semverLt: "semverLt";
|
|
207
|
+
regex: "regex";
|
|
208
|
+
segment: "segment";
|
|
209
|
+
}>;
|
|
210
|
+
values: z.ZodArray<z.ZodUnion<readonly [z.ZodString, z.ZodNumber, z.ZodBoolean]>>;
|
|
211
|
+
negate: z.ZodBoolean;
|
|
212
|
+
}, z.core.$strict>>;
|
|
213
|
+
serve: z.ZodUnion<readonly [z.ZodObject<{
|
|
214
|
+
variant: z.ZodNumber;
|
|
215
|
+
}, z.core.$strict>, z.ZodObject<{
|
|
216
|
+
rollout: z.ZodObject<{
|
|
217
|
+
variations: z.ZodArray<z.ZodObject<{
|
|
218
|
+
variant: z.ZodNumber;
|
|
219
|
+
weight: z.ZodNumber;
|
|
220
|
+
}, z.core.$strict>>;
|
|
221
|
+
}, z.core.$strict>;
|
|
222
|
+
}, z.core.$strict>]>;
|
|
223
|
+
}, z.core.$strict>>;
|
|
224
|
+
}, z.core.$strict>;
|
|
225
|
+
export declare const variantSchema: z.ZodObject<{
|
|
226
|
+
key: z.ZodString;
|
|
227
|
+
value: z.ZodType<JsonValue, unknown, z.core.$ZodTypeInternals<JsonValue, unknown>>;
|
|
228
|
+
}, z.core.$strict>;
|
|
229
|
+
export declare const variantsSchema: z.ZodArray<z.ZodObject<{
|
|
230
|
+
key: z.ZodString;
|
|
231
|
+
value: z.ZodType<JsonValue, unknown, z.core.$ZodTypeInternals<JsonValue, unknown>>;
|
|
232
|
+
}, z.core.$strict>>;
|
|
233
|
+
export declare const flagDefinitionSchema: z.ZodObject<{
|
|
234
|
+
key: z.ZodString;
|
|
235
|
+
name: z.ZodString;
|
|
236
|
+
type: z.ZodEnum<{
|
|
237
|
+
string: "string";
|
|
238
|
+
boolean: "boolean";
|
|
239
|
+
json: "json";
|
|
240
|
+
}>;
|
|
241
|
+
description: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
242
|
+
variants: z.ZodArray<z.ZodObject<{
|
|
243
|
+
key: z.ZodString;
|
|
244
|
+
value: z.ZodType<JsonValue, unknown, z.core.$ZodTypeInternals<JsonValue, unknown>>;
|
|
245
|
+
}, z.core.$strict>>;
|
|
246
|
+
}, z.core.$strict>;
|
|
247
|
+
export declare const compiledFlagSchema: z.ZodObject<{
|
|
248
|
+
type: z.ZodEnum<{
|
|
249
|
+
string: "string";
|
|
250
|
+
boolean: "boolean";
|
|
251
|
+
json: "json";
|
|
252
|
+
}>;
|
|
253
|
+
version: z.ZodNumber;
|
|
254
|
+
salt: z.ZodString;
|
|
255
|
+
on: z.ZodBoolean;
|
|
256
|
+
variants: z.ZodArray<z.ZodObject<{
|
|
257
|
+
key: z.ZodString;
|
|
258
|
+
value: z.ZodType<JsonValue, unknown, z.core.$ZodTypeInternals<JsonValue, unknown>>;
|
|
259
|
+
}, z.core.$strict>>;
|
|
260
|
+
offVariant: z.ZodNumber;
|
|
261
|
+
fallthrough: z.ZodUnion<readonly [z.ZodObject<{
|
|
262
|
+
variant: z.ZodNumber;
|
|
263
|
+
}, z.core.$strict>, z.ZodObject<{
|
|
264
|
+
rollout: z.ZodObject<{
|
|
265
|
+
variations: z.ZodArray<z.ZodObject<{
|
|
266
|
+
variant: z.ZodNumber;
|
|
267
|
+
weight: z.ZodNumber;
|
|
268
|
+
}, z.core.$strict>>;
|
|
269
|
+
}, z.core.$strict>;
|
|
270
|
+
}, z.core.$strict>]>;
|
|
271
|
+
rules: z.ZodArray<z.ZodObject<{
|
|
272
|
+
id: z.ZodString;
|
|
273
|
+
clauses: z.ZodArray<z.ZodObject<{
|
|
274
|
+
attr: z.ZodString;
|
|
275
|
+
op: z.ZodEnum<{
|
|
276
|
+
endsWith: "endsWith";
|
|
277
|
+
startsWith: "startsWith";
|
|
278
|
+
eq: "eq";
|
|
279
|
+
neq: "neq";
|
|
280
|
+
in: "in";
|
|
281
|
+
contains: "contains";
|
|
282
|
+
gt: "gt";
|
|
283
|
+
gte: "gte";
|
|
284
|
+
lt: "lt";
|
|
285
|
+
lte: "lte";
|
|
286
|
+
semverEq: "semverEq";
|
|
287
|
+
semverGt: "semverGt";
|
|
288
|
+
semverLt: "semverLt";
|
|
289
|
+
regex: "regex";
|
|
290
|
+
segment: "segment";
|
|
291
|
+
}>;
|
|
292
|
+
values: z.ZodArray<z.ZodUnion<readonly [z.ZodString, z.ZodNumber, z.ZodBoolean]>>;
|
|
293
|
+
negate: z.ZodBoolean;
|
|
294
|
+
}, z.core.$strict>>;
|
|
295
|
+
serve: z.ZodUnion<readonly [z.ZodObject<{
|
|
296
|
+
variant: z.ZodNumber;
|
|
297
|
+
}, z.core.$strict>, z.ZodObject<{
|
|
298
|
+
rollout: z.ZodObject<{
|
|
299
|
+
variations: z.ZodArray<z.ZodObject<{
|
|
300
|
+
variant: z.ZodNumber;
|
|
301
|
+
weight: z.ZodNumber;
|
|
302
|
+
}, z.core.$strict>>;
|
|
303
|
+
}, z.core.$strict>;
|
|
304
|
+
}, z.core.$strict>]>;
|
|
305
|
+
}, z.core.$strict>>;
|
|
306
|
+
}, z.core.$strict>;
|
|
307
|
+
export declare const bundleSchema: z.ZodObject<{
|
|
308
|
+
fmt: z.ZodLiteral<1>;
|
|
309
|
+
envId: z.ZodString;
|
|
310
|
+
version: z.ZodNumber;
|
|
311
|
+
publishedAt: z.ZodNumber;
|
|
312
|
+
revoked: z.ZodBoolean;
|
|
313
|
+
segments: z.ZodRecord<z.ZodString, z.ZodArray<z.ZodObject<{
|
|
314
|
+
clauses: z.ZodArray<z.ZodObject<{
|
|
315
|
+
attr: z.ZodString;
|
|
316
|
+
op: z.ZodEnum<{
|
|
317
|
+
endsWith: "endsWith";
|
|
318
|
+
startsWith: "startsWith";
|
|
319
|
+
eq: "eq";
|
|
320
|
+
neq: "neq";
|
|
321
|
+
in: "in";
|
|
322
|
+
contains: "contains";
|
|
323
|
+
gt: "gt";
|
|
324
|
+
gte: "gte";
|
|
325
|
+
lt: "lt";
|
|
326
|
+
lte: "lte";
|
|
327
|
+
semverEq: "semverEq";
|
|
328
|
+
semverGt: "semverGt";
|
|
329
|
+
semverLt: "semverLt";
|
|
330
|
+
regex: "regex";
|
|
331
|
+
segment: "segment";
|
|
332
|
+
}>;
|
|
333
|
+
values: z.ZodArray<z.ZodUnion<readonly [z.ZodString, z.ZodNumber, z.ZodBoolean]>>;
|
|
334
|
+
negate: z.ZodBoolean;
|
|
335
|
+
}, z.core.$strict>>;
|
|
336
|
+
}, z.core.$strict>>>;
|
|
337
|
+
flags: z.ZodRecord<z.ZodString, z.ZodObject<{
|
|
338
|
+
type: z.ZodEnum<{
|
|
339
|
+
string: "string";
|
|
340
|
+
boolean: "boolean";
|
|
341
|
+
json: "json";
|
|
342
|
+
}>;
|
|
343
|
+
version: z.ZodNumber;
|
|
344
|
+
salt: z.ZodString;
|
|
345
|
+
on: z.ZodBoolean;
|
|
346
|
+
variants: z.ZodArray<z.ZodObject<{
|
|
347
|
+
key: z.ZodString;
|
|
348
|
+
value: z.ZodType<JsonValue, unknown, z.core.$ZodTypeInternals<JsonValue, unknown>>;
|
|
349
|
+
}, z.core.$strict>>;
|
|
350
|
+
offVariant: z.ZodNumber;
|
|
351
|
+
fallthrough: z.ZodUnion<readonly [z.ZodObject<{
|
|
352
|
+
variant: z.ZodNumber;
|
|
353
|
+
}, z.core.$strict>, z.ZodObject<{
|
|
354
|
+
rollout: z.ZodObject<{
|
|
355
|
+
variations: z.ZodArray<z.ZodObject<{
|
|
356
|
+
variant: z.ZodNumber;
|
|
357
|
+
weight: z.ZodNumber;
|
|
358
|
+
}, z.core.$strict>>;
|
|
359
|
+
}, z.core.$strict>;
|
|
360
|
+
}, z.core.$strict>]>;
|
|
361
|
+
rules: z.ZodArray<z.ZodObject<{
|
|
362
|
+
id: z.ZodString;
|
|
363
|
+
clauses: z.ZodArray<z.ZodObject<{
|
|
364
|
+
attr: z.ZodString;
|
|
365
|
+
op: z.ZodEnum<{
|
|
366
|
+
endsWith: "endsWith";
|
|
367
|
+
startsWith: "startsWith";
|
|
368
|
+
eq: "eq";
|
|
369
|
+
neq: "neq";
|
|
370
|
+
in: "in";
|
|
371
|
+
contains: "contains";
|
|
372
|
+
gt: "gt";
|
|
373
|
+
gte: "gte";
|
|
374
|
+
lt: "lt";
|
|
375
|
+
lte: "lte";
|
|
376
|
+
semverEq: "semverEq";
|
|
377
|
+
semverGt: "semverGt";
|
|
378
|
+
semverLt: "semverLt";
|
|
379
|
+
regex: "regex";
|
|
380
|
+
segment: "segment";
|
|
381
|
+
}>;
|
|
382
|
+
values: z.ZodArray<z.ZodUnion<readonly [z.ZodString, z.ZodNumber, z.ZodBoolean]>>;
|
|
383
|
+
negate: z.ZodBoolean;
|
|
384
|
+
}, z.core.$strict>>;
|
|
385
|
+
serve: z.ZodUnion<readonly [z.ZodObject<{
|
|
386
|
+
variant: z.ZodNumber;
|
|
387
|
+
}, z.core.$strict>, z.ZodObject<{
|
|
388
|
+
rollout: z.ZodObject<{
|
|
389
|
+
variations: z.ZodArray<z.ZodObject<{
|
|
390
|
+
variant: z.ZodNumber;
|
|
391
|
+
weight: z.ZodNumber;
|
|
392
|
+
}, z.core.$strict>>;
|
|
393
|
+
}, z.core.$strict>;
|
|
394
|
+
}, z.core.$strict>]>;
|
|
395
|
+
}, z.core.$strict>>;
|
|
396
|
+
}, z.core.$strict>>;
|
|
397
|
+
}, z.core.$strict>;
|
|
398
|
+
export declare const revokedBundleSchema: z.ZodObject<{
|
|
399
|
+
fmt: z.ZodLiteral<1>;
|
|
400
|
+
envId: z.ZodString;
|
|
401
|
+
version: z.ZodNumber;
|
|
402
|
+
publishedAt: z.ZodNumber;
|
|
403
|
+
revoked: z.ZodBoolean;
|
|
404
|
+
segments: z.ZodRecord<z.ZodString, z.ZodArray<z.ZodObject<{
|
|
405
|
+
clauses: z.ZodArray<z.ZodObject<{
|
|
406
|
+
attr: z.ZodString;
|
|
407
|
+
op: z.ZodEnum<{
|
|
408
|
+
endsWith: "endsWith";
|
|
409
|
+
startsWith: "startsWith";
|
|
410
|
+
eq: "eq";
|
|
411
|
+
neq: "neq";
|
|
412
|
+
in: "in";
|
|
413
|
+
contains: "contains";
|
|
414
|
+
gt: "gt";
|
|
415
|
+
gte: "gte";
|
|
416
|
+
lt: "lt";
|
|
417
|
+
lte: "lte";
|
|
418
|
+
semverEq: "semverEq";
|
|
419
|
+
semverGt: "semverGt";
|
|
420
|
+
semverLt: "semverLt";
|
|
421
|
+
regex: "regex";
|
|
422
|
+
segment: "segment";
|
|
423
|
+
}>;
|
|
424
|
+
values: z.ZodArray<z.ZodUnion<readonly [z.ZodString, z.ZodNumber, z.ZodBoolean]>>;
|
|
425
|
+
negate: z.ZodBoolean;
|
|
426
|
+
}, z.core.$strict>>;
|
|
427
|
+
}, z.core.$strict>>>;
|
|
428
|
+
flags: z.ZodRecord<z.ZodString, z.ZodObject<{
|
|
429
|
+
type: z.ZodEnum<{
|
|
430
|
+
string: "string";
|
|
431
|
+
boolean: "boolean";
|
|
432
|
+
json: "json";
|
|
433
|
+
}>;
|
|
434
|
+
version: z.ZodNumber;
|
|
435
|
+
salt: z.ZodString;
|
|
436
|
+
on: z.ZodBoolean;
|
|
437
|
+
variants: z.ZodArray<z.ZodObject<{
|
|
438
|
+
key: z.ZodString;
|
|
439
|
+
value: z.ZodType<JsonValue, unknown, z.core.$ZodTypeInternals<JsonValue, unknown>>;
|
|
440
|
+
}, z.core.$strict>>;
|
|
441
|
+
offVariant: z.ZodNumber;
|
|
442
|
+
fallthrough: z.ZodUnion<readonly [z.ZodObject<{
|
|
443
|
+
variant: z.ZodNumber;
|
|
444
|
+
}, z.core.$strict>, z.ZodObject<{
|
|
445
|
+
rollout: z.ZodObject<{
|
|
446
|
+
variations: z.ZodArray<z.ZodObject<{
|
|
447
|
+
variant: z.ZodNumber;
|
|
448
|
+
weight: z.ZodNumber;
|
|
449
|
+
}, z.core.$strict>>;
|
|
450
|
+
}, z.core.$strict>;
|
|
451
|
+
}, z.core.$strict>]>;
|
|
452
|
+
rules: z.ZodArray<z.ZodObject<{
|
|
453
|
+
id: z.ZodString;
|
|
454
|
+
clauses: z.ZodArray<z.ZodObject<{
|
|
455
|
+
attr: z.ZodString;
|
|
456
|
+
op: z.ZodEnum<{
|
|
457
|
+
endsWith: "endsWith";
|
|
458
|
+
startsWith: "startsWith";
|
|
459
|
+
eq: "eq";
|
|
460
|
+
neq: "neq";
|
|
461
|
+
in: "in";
|
|
462
|
+
contains: "contains";
|
|
463
|
+
gt: "gt";
|
|
464
|
+
gte: "gte";
|
|
465
|
+
lt: "lt";
|
|
466
|
+
lte: "lte";
|
|
467
|
+
semverEq: "semverEq";
|
|
468
|
+
semverGt: "semverGt";
|
|
469
|
+
semverLt: "semverLt";
|
|
470
|
+
regex: "regex";
|
|
471
|
+
segment: "segment";
|
|
472
|
+
}>;
|
|
473
|
+
values: z.ZodArray<z.ZodUnion<readonly [z.ZodString, z.ZodNumber, z.ZodBoolean]>>;
|
|
474
|
+
negate: z.ZodBoolean;
|
|
475
|
+
}, z.core.$strict>>;
|
|
476
|
+
serve: z.ZodUnion<readonly [z.ZodObject<{
|
|
477
|
+
variant: z.ZodNumber;
|
|
478
|
+
}, z.core.$strict>, z.ZodObject<{
|
|
479
|
+
rollout: z.ZodObject<{
|
|
480
|
+
variations: z.ZodArray<z.ZodObject<{
|
|
481
|
+
variant: z.ZodNumber;
|
|
482
|
+
weight: z.ZodNumber;
|
|
483
|
+
}, z.core.$strict>>;
|
|
484
|
+
}, z.core.$strict>;
|
|
485
|
+
}, z.core.$strict>]>;
|
|
486
|
+
}, z.core.$strict>>;
|
|
487
|
+
}, z.core.$strict>>;
|
|
488
|
+
}, z.core.$strict>;
|
|
489
|
+
export declare const contextAttributeSchema: z.ZodUnion<readonly [z.ZodString, z.ZodNumber, z.ZodBoolean, z.ZodArray<z.ZodString>]>;
|
|
490
|
+
export declare const evaluationContextSchema: z.ZodObject<{
|
|
491
|
+
key: z.ZodString;
|
|
492
|
+
attributes: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnion<readonly [z.ZodString, z.ZodNumber, z.ZodBoolean, z.ZodArray<z.ZodString>]>>>;
|
|
493
|
+
}, z.core.$strict>;
|
|
494
|
+
export declare const evaluationRequestSchema: z.ZodObject<{
|
|
495
|
+
context: z.ZodObject<{
|
|
496
|
+
key: z.ZodString;
|
|
497
|
+
attributes: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnion<readonly [z.ZodString, z.ZodNumber, z.ZodBoolean, z.ZodArray<z.ZodString>]>>>;
|
|
498
|
+
}, z.core.$strict>;
|
|
499
|
+
}, z.core.$strict>;
|
|
500
|
+
export declare const exposureEventSchema: z.ZodObject<{
|
|
501
|
+
flagKey: z.ZodString;
|
|
502
|
+
flagVersion: z.ZodNumber;
|
|
503
|
+
variant: z.ZodString;
|
|
504
|
+
count: z.ZodNumber;
|
|
505
|
+
}, z.core.$strict>;
|
|
506
|
+
export declare const exposureEventsSchema: z.ZodArray<z.ZodObject<{
|
|
507
|
+
flagKey: z.ZodString;
|
|
508
|
+
flagVersion: z.ZodNumber;
|
|
509
|
+
variant: z.ZodString;
|
|
510
|
+
count: z.ZodNumber;
|
|
511
|
+
}, z.core.$strict>>;
|
|
512
|
+
export type EvaluationContext = z.infer<typeof evaluationContextSchema>;
|
|
513
|
+
export type ExposureEvent = z.infer<typeof exposureEventSchema>;
|
|
514
|
+
export declare const createProjectSchema: z.ZodObject<{
|
|
515
|
+
orgId: z.ZodString;
|
|
516
|
+
name: z.ZodString;
|
|
517
|
+
slug: z.ZodOptional<z.ZodString>;
|
|
518
|
+
}, z.core.$strict>;
|
|
519
|
+
export declare const updateProjectSchema: z.ZodObject<{
|
|
520
|
+
name: z.ZodOptional<z.ZodString>;
|
|
521
|
+
slug: z.ZodOptional<z.ZodString>;
|
|
522
|
+
}, z.core.$strict>;
|
|
523
|
+
export declare const createFlagSchema: z.ZodObject<{
|
|
524
|
+
key: z.ZodString;
|
|
525
|
+
name: z.ZodString;
|
|
526
|
+
type: z.ZodEnum<{
|
|
527
|
+
string: "string";
|
|
528
|
+
boolean: "boolean";
|
|
529
|
+
json: "json";
|
|
530
|
+
}>;
|
|
531
|
+
description: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
532
|
+
variants: z.ZodArray<z.ZodObject<{
|
|
533
|
+
key: z.ZodString;
|
|
534
|
+
value: z.ZodType<JsonValue, unknown, z.core.$ZodTypeInternals<JsonValue, unknown>>;
|
|
535
|
+
}, z.core.$strict>>;
|
|
536
|
+
}, z.core.$strict>;
|
|
537
|
+
export declare const updateFlagSchema: z.ZodObject<{
|
|
538
|
+
name: z.ZodOptional<z.ZodString>;
|
|
539
|
+
description: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
540
|
+
variants: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
541
|
+
key: z.ZodString;
|
|
542
|
+
value: z.ZodType<JsonValue, unknown, z.core.$ZodTypeInternals<JsonValue, unknown>>;
|
|
543
|
+
}, z.core.$strict>>>;
|
|
544
|
+
archived: z.ZodOptional<z.ZodBoolean>;
|
|
545
|
+
}, z.core.$strict>;
|
|
546
|
+
export declare const updateFlagEnvironmentSchema: z.ZodObject<{
|
|
547
|
+
config: z.ZodObject<{
|
|
548
|
+
on: z.ZodBoolean;
|
|
549
|
+
offVariant: z.ZodNumber;
|
|
550
|
+
fallthrough: z.ZodUnion<readonly [z.ZodObject<{
|
|
551
|
+
variant: z.ZodNumber;
|
|
552
|
+
}, z.core.$strict>, z.ZodObject<{
|
|
553
|
+
rollout: z.ZodObject<{
|
|
554
|
+
variations: z.ZodArray<z.ZodObject<{
|
|
555
|
+
variant: z.ZodNumber;
|
|
556
|
+
weight: z.ZodNumber;
|
|
557
|
+
}, z.core.$strict>>;
|
|
558
|
+
}, z.core.$strict>;
|
|
559
|
+
}, z.core.$strict>]>;
|
|
560
|
+
rules: z.ZodArray<z.ZodObject<{
|
|
561
|
+
id: z.ZodString;
|
|
562
|
+
clauses: z.ZodArray<z.ZodObject<{
|
|
563
|
+
attr: z.ZodString;
|
|
564
|
+
op: z.ZodEnum<{
|
|
565
|
+
endsWith: "endsWith";
|
|
566
|
+
startsWith: "startsWith";
|
|
567
|
+
eq: "eq";
|
|
568
|
+
neq: "neq";
|
|
569
|
+
in: "in";
|
|
570
|
+
contains: "contains";
|
|
571
|
+
gt: "gt";
|
|
572
|
+
gte: "gte";
|
|
573
|
+
lt: "lt";
|
|
574
|
+
lte: "lte";
|
|
575
|
+
semverEq: "semverEq";
|
|
576
|
+
semverGt: "semverGt";
|
|
577
|
+
semverLt: "semverLt";
|
|
578
|
+
regex: "regex";
|
|
579
|
+
segment: "segment";
|
|
580
|
+
}>;
|
|
581
|
+
values: z.ZodArray<z.ZodUnion<readonly [z.ZodString, z.ZodNumber, z.ZodBoolean]>>;
|
|
582
|
+
negate: z.ZodBoolean;
|
|
583
|
+
}, z.core.$strict>>;
|
|
584
|
+
serve: z.ZodUnion<readonly [z.ZodObject<{
|
|
585
|
+
variant: z.ZodNumber;
|
|
586
|
+
}, z.core.$strict>, z.ZodObject<{
|
|
587
|
+
rollout: z.ZodObject<{
|
|
588
|
+
variations: z.ZodArray<z.ZodObject<{
|
|
589
|
+
variant: z.ZodNumber;
|
|
590
|
+
weight: z.ZodNumber;
|
|
591
|
+
}, z.core.$strict>>;
|
|
592
|
+
}, z.core.$strict>;
|
|
593
|
+
}, z.core.$strict>]>;
|
|
594
|
+
}, z.core.$strict>>;
|
|
595
|
+
}, z.core.$strict>;
|
|
596
|
+
comment: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
597
|
+
}, z.core.$strict>;
|
|
598
|
+
export declare const rollbackFlagSchema: z.ZodObject<{
|
|
599
|
+
toVersion: z.ZodNumber;
|
|
600
|
+
}, z.core.$strict>;
|
|
601
|
+
export declare const createSegmentSchema: z.ZodObject<{
|
|
602
|
+
key: z.ZodString;
|
|
603
|
+
name: z.ZodString;
|
|
604
|
+
description: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
605
|
+
rules: z.ZodArray<z.ZodObject<{
|
|
606
|
+
clauses: z.ZodArray<z.ZodObject<{
|
|
607
|
+
attr: z.ZodString;
|
|
608
|
+
op: z.ZodEnum<{
|
|
609
|
+
endsWith: "endsWith";
|
|
610
|
+
startsWith: "startsWith";
|
|
611
|
+
eq: "eq";
|
|
612
|
+
neq: "neq";
|
|
613
|
+
in: "in";
|
|
614
|
+
contains: "contains";
|
|
615
|
+
gt: "gt";
|
|
616
|
+
gte: "gte";
|
|
617
|
+
lt: "lt";
|
|
618
|
+
lte: "lte";
|
|
619
|
+
semverEq: "semverEq";
|
|
620
|
+
semverGt: "semverGt";
|
|
621
|
+
semverLt: "semverLt";
|
|
622
|
+
regex: "regex";
|
|
623
|
+
segment: "segment";
|
|
624
|
+
}>;
|
|
625
|
+
values: z.ZodArray<z.ZodUnion<readonly [z.ZodString, z.ZodNumber, z.ZodBoolean]>>;
|
|
626
|
+
negate: z.ZodBoolean;
|
|
627
|
+
}, z.core.$strict>>;
|
|
628
|
+
}, z.core.$strict>>;
|
|
629
|
+
}, z.core.$strict>;
|
|
630
|
+
export declare const updateSegmentSchema: z.ZodObject<{
|
|
631
|
+
key: z.ZodOptional<z.ZodString>;
|
|
632
|
+
name: z.ZodOptional<z.ZodString>;
|
|
633
|
+
description: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
634
|
+
rules: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
635
|
+
clauses: z.ZodArray<z.ZodObject<{
|
|
636
|
+
attr: z.ZodString;
|
|
637
|
+
op: z.ZodEnum<{
|
|
638
|
+
endsWith: "endsWith";
|
|
639
|
+
startsWith: "startsWith";
|
|
640
|
+
eq: "eq";
|
|
641
|
+
neq: "neq";
|
|
642
|
+
in: "in";
|
|
643
|
+
contains: "contains";
|
|
644
|
+
gt: "gt";
|
|
645
|
+
gte: "gte";
|
|
646
|
+
lt: "lt";
|
|
647
|
+
lte: "lte";
|
|
648
|
+
semverEq: "semverEq";
|
|
649
|
+
semverGt: "semverGt";
|
|
650
|
+
semverLt: "semverLt";
|
|
651
|
+
regex: "regex";
|
|
652
|
+
segment: "segment";
|
|
653
|
+
}>;
|
|
654
|
+
values: z.ZodArray<z.ZodUnion<readonly [z.ZodString, z.ZodNumber, z.ZodBoolean]>>;
|
|
655
|
+
negate: z.ZodBoolean;
|
|
656
|
+
}, z.core.$strict>>;
|
|
657
|
+
}, z.core.$strict>>>;
|
|
658
|
+
}, z.core.$strict>;
|
|
659
|
+
export declare const createSdkKeySchema: z.ZodObject<{
|
|
660
|
+
kind: z.ZodEnum<{
|
|
661
|
+
client: "client";
|
|
662
|
+
server: "server";
|
|
663
|
+
}>;
|
|
664
|
+
}, z.core.$strict>;
|
|
665
|
+
export declare const auditCursorSchema: z.ZodObject<{
|
|
666
|
+
createdAt: z.ZodNumber;
|
|
667
|
+
id: z.ZodString;
|
|
668
|
+
}, z.core.$strict>;
|
|
669
|
+
export type Bundle = z.infer<typeof bundleSchema>;
|
|
670
|
+
export type Clause = z.infer<typeof clauseSchema>;
|
|
671
|
+
export type CompiledFlag = z.infer<typeof compiledFlagSchema>;
|
|
672
|
+
export type FlagConfig = z.infer<typeof flagConfigSchema>;
|
|
673
|
+
export type FlagDefinition = z.infer<typeof flagDefinitionSchema>;
|
|
674
|
+
export type Rule = z.infer<typeof ruleSchema>;
|
|
675
|
+
export type SegmentRules = z.infer<typeof segmentRulesSchema>;
|
|
676
|
+
export type Serve = z.infer<typeof serveSchema>;
|
|
677
|
+
export type Variant = z.infer<typeof variantSchema>;
|
package/dist/index.js
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{z as e}from"zod";var b=1,u=e.lazy(()=>e.union([e.null(),e.boolean(),e.number().finite(),e.string(),e.array(u),e.record(e.string(),u)])),m=e.string().trim().min(1).max(128),s=e.string().trim().min(1).max(128).regex(/^[a-z0-9]+(?:[._-][a-z0-9]+)*$/,"Use lowercase letters, numbers, dots, underscores, or hyphens"),c=e.string().trim().min(1).max(120),p=e.string().trim().max(1e3).nullable().optional(),g=e.enum(["boolean","string","json"]),O=e.enum(["dev","staging","prod"]),y=e.enum(["client","server"]),_=e.object({envId:m,kind:y,revoked:e.boolean()}).strict(),S=e.enum(["eq","neq","in","contains","startsWith","endsWith","gt","gte","lt","lte","semverEq","semverGt","semverLt","regex","segment"]),j=e.union([e.string(),e.number().finite(),e.boolean()]),v=e.object({attr:e.string().trim().max(128),op:S,values:e.array(j).min(1),negate:e.boolean()}).strict().superRefine((t,o)=>{if(t.op!=="segment"&&t.attr.length===0&&o.addIssue({code:"custom",message:"Attribute is required for non-segment clauses",path:["attr"]}),t.op==="segment"&&t.values.forEach((n,a)=>{(typeof n!="string"||!s.safeParse(n).success)&&o.addIssue({code:"custom",message:"Segment clause values must be segment keys",path:["values",a]})}),t.op==="regex")for(let[n,a]of t.values.entries())typeof a!="string"?o.addIssue({code:"custom",message:"Regex clause values must be strings",path:["values",n]}):a.length>256&&o.addIssue({code:"too_big",origin:"string",maximum:256,inclusive:!0,message:"Regex patterns cannot exceed 256 characters",path:["values",n]})}),k=e.object({variant:e.number().int().nonnegative(),weight:e.number().int().min(0).max(1e5)}).strict(),z=e.object({variations:e.array(k).min(1)}).strict().superRefine((t,o)=>{t.variations.reduce((r,i)=>r+i.weight,0)!==1e5&&o.addIssue({code:"custom",message:"Rollout weights must sum to 100000 basis points",path:["variations"]});let a=new Set;t.variations.forEach((r,i)=>{a.has(r.variant)&&o.addIssue({code:"custom",message:"A rollout can reference each variant only once",path:["variations",i,"variant"]}),a.add(r.variant)})}),l=e.union([e.object({variant:e.number().int().nonnegative()}).strict(),e.object({rollout:z}).strict()]),x=e.object({id:m,clauses:e.array(v).min(1),serve:l}).strict(),V=e.object({clauses:e.array(v).min(1)}).strict(),d=e.array(V),R=e.object({on:e.boolean(),offVariant:e.number().int().nonnegative(),fallthrough:l,rules:e.array(x)}).strict().superRefine((t,o)=>{let n=new Set;t.rules.forEach((a,r)=>{n.has(a.id)&&o.addIssue({code:"custom",message:"Rule IDs must be unique within a flag configuration",path:["rules",r,"id"]}),n.add(a.id)})}),I=e.object({key:s,value:u}).strict(),f=e.array(I).min(1).superRefine((t,o)=>{let n=new Set;t.forEach((a,r)=>{n.has(a.key)&&o.addIssue({code:"custom",message:"Variant keys must be unique",path:[r,"key"]}),n.add(a.key)})});function h(t){return"variant"in t?[t.variant]:t.rollout.variations.map(o=>o.variant)}function E(t,o){let n=t.variants.length-1,a=[{path:["offVariant"],indexes:[t.offVariant]},{path:["fallthrough"],indexes:h(t.fallthrough)},...t.rules.map((r,i)=>({path:["rules",i,"serve"],indexes:h(r.serve)}))];for(let r of a)r.indexes.some(i=>i>n)&&o.addIssue({code:"custom",message:`Variant index must be between 0 and ${n}`,path:r.path})}var q=e.object({key:s,name:c,type:g,description:p,variants:f}).strict().superRefine((t,o)=>{t.variants.forEach((n,a)=>{t.type==="json"||t.type==="boolean"&&typeof n.value=="boolean"||t.type==="string"&&typeof n.value=="string"||o.addIssue({code:"custom",message:`Variant value must match flag type ${t.type}`,path:["variants",a,"value"]})})}),C=e.object({type:g,version:e.number().int().positive(),salt:e.string().regex(/^[a-f0-9]{16}$/),on:e.boolean(),variants:f,offVariant:e.number().int().nonnegative(),fallthrough:l,rules:e.array(x)}).strict().superRefine((t,o)=>{E(t,o),t.variants.forEach((n,a)=>{t.type==="json"||t.type==="boolean"&&typeof n.value=="boolean"||t.type==="string"&&typeof n.value=="string"||o.addIssue({code:"custom",message:`Variant value must match flag type ${t.type}`,path:["variants",a,"value"]})})}),F=e.object({fmt:e.literal(b),envId:m,version:e.number().int().positive(),publishedAt:e.number().int().nonnegative(),revoked:e.boolean(),segments:e.record(s,d),flags:e.record(s,C)}).strict(),$=F.refine(t=>!t.revoked||Object.keys(t.flags).length===0,{message:"Revoked bundles cannot contain flags",path:["flags"]}),w=e.union([e.string(),e.number().finite(),e.boolean(),e.array(e.string())]),K=e.object({key:e.string(),attributes:e.record(e.string(),w).optional()}).strict(),D=e.object({context:K}).strict(),A=e.object({flagKey:s,flagVersion:e.number().int().positive(),variant:s,count:e.number().int().positive()}).strict(),J=e.array(A).max(100),B=e.object({orgId:m,name:c,slug:s.optional()}).strict(),G=e.object({name:c.optional(),slug:s.optional()}).strict().refine(t=>Object.keys(t).length>0,"At least one field is required"),L=q,T=e.object({name:c.optional(),description:p,variants:f.optional(),archived:e.boolean().optional()}).strict().refine(t=>Object.keys(t).length>0,"At least one field is required"),W=e.object({config:R,comment:e.string().trim().max(500).nullable().optional()}).strict(),N=e.object({toVersion:e.number().int().positive()}).strict(),U=e.object({key:s,name:c,description:p,rules:d}).strict(),Z=e.object({key:s.optional(),name:c.optional(),description:p,rules:d.optional()}).strict().refine(t=>Object.keys(t).length>0,"At least one field is required"),H=e.object({kind:y}).strict(),M=e.object({createdAt:e.number().int().nonnegative(),id:m}).strict();export{M as auditCursorSchema,b as bundleFormatVersion,F as bundleSchema,S as clauseOperatorSchema,v as clauseSchema,j as clauseValueSchema,C as compiledFlagSchema,w as contextAttributeSchema,L as createFlagSchema,B as createProjectSchema,H as createSdkKeySchema,U as createSegmentSchema,p as descriptionSchema,c as displayNameSchema,O as environmentSlugSchema,K as evaluationContextSchema,D as evaluationRequestSchema,A as exposureEventSchema,J as exposureEventsSchema,R as flagConfigSchema,q as flagDefinitionSchema,g as flagTypeSchema,u as jsonValueSchema,m as resourceIdSchema,s as resourceKeySchema,$ as revokedBundleSchema,N as rollbackFlagSchema,z as rolloutSchema,k as rolloutVariationSchema,x as ruleSchema,y as sdkKeyKindSchema,_ as sdkKeyLookupSchema,V as segmentRuleGroupSchema,d as segmentRulesSchema,l as serveSchema,W as updateFlagEnvironmentSchema,T as updateFlagSchema,G as updateProjectSchema,Z as updateSegmentSchema,I as variantSchema,f as variantsSchema};
|
package/package.json
ADDED
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@flagwire/schema",
|
|
3
|
+
"version": "0.1.0",
|
|
4
|
+
"description": "Normative schemas and wire contracts for FlagWire",
|
|
5
|
+
"license": "MIT",
|
|
6
|
+
"type": "module",
|
|
7
|
+
"files": [
|
|
8
|
+
"dist"
|
|
9
|
+
],
|
|
10
|
+
"exports": {
|
|
11
|
+
".": {
|
|
12
|
+
"types": "./dist/index.d.ts",
|
|
13
|
+
"import": "./dist/index.js"
|
|
14
|
+
}
|
|
15
|
+
},
|
|
16
|
+
"types": "./dist/index.d.ts",
|
|
17
|
+
"module": "./dist/index.js",
|
|
18
|
+
"sideEffects": false,
|
|
19
|
+
"repository": {
|
|
20
|
+
"type": "git",
|
|
21
|
+
"url": "git+https://github.com/flagwire/flagwire-js.git",
|
|
22
|
+
"directory": "packages/schema"
|
|
23
|
+
},
|
|
24
|
+
"publishConfig": {
|
|
25
|
+
"access": "public",
|
|
26
|
+
"provenance": true
|
|
27
|
+
},
|
|
28
|
+
"dependencies": {
|
|
29
|
+
"zod": "4.1.5"
|
|
30
|
+
},
|
|
31
|
+
"devDependencies": {
|
|
32
|
+
"esbuild": "0.28.2"
|
|
33
|
+
},
|
|
34
|
+
"scripts": {
|
|
35
|
+
"build": "node ../../scripts/clean-package-dist.mjs && tsc -p tsconfig.build.json && esbuild src/index.ts --bundle --minify --format=esm --platform=neutral --target=es2022 --external:zod --outfile=dist/index.js",
|
|
36
|
+
"lint": "eslint src",
|
|
37
|
+
"test": "vitest run",
|
|
38
|
+
"typecheck": "tsc -p tsconfig.json --noEmit"
|
|
39
|
+
}
|
|
40
|
+
}
|