@flagwire/schema 0.1.0 → 0.1.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/README.md +19 -2
- package/dist/index.d.ts +14 -14
- package/package.json +12 -2
package/README.md
CHANGED
|
@@ -1,10 +1,27 @@
|
|
|
1
1
|
# `@flagwire/schema`
|
|
2
2
|
|
|
3
|
-
|
|
4
|
-
reject malformed
|
|
3
|
+
Runtime schemas and TypeScript types for FlagWire wire contracts. SDKs use these Zod schemas to
|
|
4
|
+
reject malformed payloads before they can become active evaluation state.
|
|
5
|
+
|
|
6
|
+
## Install
|
|
7
|
+
|
|
8
|
+
```sh
|
|
9
|
+
pnpm add @flagwire/schema
|
|
10
|
+
```
|
|
11
|
+
|
|
12
|
+
## Usage
|
|
5
13
|
|
|
6
14
|
```ts
|
|
7
15
|
import { bundleSchema, type Bundle } from "@flagwire/schema";
|
|
8
16
|
|
|
9
17
|
const result = bundleSchema.safeParse(input);
|
|
18
|
+
if (!result.success) {
|
|
19
|
+
// Keep the last valid bundle or use application defaults.
|
|
20
|
+
return;
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
const bundle: Bundle = result.data;
|
|
10
24
|
```
|
|
25
|
+
|
|
26
|
+
The exported schemas define the protocol boundary shared by the SDKs and edge API. Parse untrusted
|
|
27
|
+
input with `safeParse` and avoid activating partially validated data.
|
package/dist/index.d.ts
CHANGED
|
@@ -31,11 +31,11 @@ export declare const sdkKeyLookupSchema: z.ZodObject<{
|
|
|
31
31
|
revoked: z.ZodBoolean;
|
|
32
32
|
}, z.core.$strict>;
|
|
33
33
|
export declare const clauseOperatorSchema: z.ZodEnum<{
|
|
34
|
+
in: "in";
|
|
34
35
|
endsWith: "endsWith";
|
|
35
36
|
startsWith: "startsWith";
|
|
36
37
|
eq: "eq";
|
|
37
38
|
neq: "neq";
|
|
38
|
-
in: "in";
|
|
39
39
|
contains: "contains";
|
|
40
40
|
gt: "gt";
|
|
41
41
|
gte: "gte";
|
|
@@ -51,11 +51,11 @@ export declare const clauseValueSchema: z.ZodUnion<readonly [z.ZodString, z.ZodN
|
|
|
51
51
|
export declare const clauseSchema: z.ZodObject<{
|
|
52
52
|
attr: z.ZodString;
|
|
53
53
|
op: z.ZodEnum<{
|
|
54
|
+
in: "in";
|
|
54
55
|
endsWith: "endsWith";
|
|
55
56
|
startsWith: "startsWith";
|
|
56
57
|
eq: "eq";
|
|
57
58
|
neq: "neq";
|
|
58
|
-
in: "in";
|
|
59
59
|
contains: "contains";
|
|
60
60
|
gt: "gt";
|
|
61
61
|
gte: "gte";
|
|
@@ -95,11 +95,11 @@ export declare const ruleSchema: z.ZodObject<{
|
|
|
95
95
|
clauses: z.ZodArray<z.ZodObject<{
|
|
96
96
|
attr: z.ZodString;
|
|
97
97
|
op: z.ZodEnum<{
|
|
98
|
+
in: "in";
|
|
98
99
|
endsWith: "endsWith";
|
|
99
100
|
startsWith: "startsWith";
|
|
100
101
|
eq: "eq";
|
|
101
102
|
neq: "neq";
|
|
102
|
-
in: "in";
|
|
103
103
|
contains: "contains";
|
|
104
104
|
gt: "gt";
|
|
105
105
|
gte: "gte";
|
|
@@ -129,11 +129,11 @@ export declare const segmentRuleGroupSchema: z.ZodObject<{
|
|
|
129
129
|
clauses: z.ZodArray<z.ZodObject<{
|
|
130
130
|
attr: z.ZodString;
|
|
131
131
|
op: z.ZodEnum<{
|
|
132
|
+
in: "in";
|
|
132
133
|
endsWith: "endsWith";
|
|
133
134
|
startsWith: "startsWith";
|
|
134
135
|
eq: "eq";
|
|
135
136
|
neq: "neq";
|
|
136
|
-
in: "in";
|
|
137
137
|
contains: "contains";
|
|
138
138
|
gt: "gt";
|
|
139
139
|
gte: "gte";
|
|
@@ -153,11 +153,11 @@ export declare const segmentRulesSchema: z.ZodArray<z.ZodObject<{
|
|
|
153
153
|
clauses: z.ZodArray<z.ZodObject<{
|
|
154
154
|
attr: z.ZodString;
|
|
155
155
|
op: z.ZodEnum<{
|
|
156
|
+
in: "in";
|
|
156
157
|
endsWith: "endsWith";
|
|
157
158
|
startsWith: "startsWith";
|
|
158
159
|
eq: "eq";
|
|
159
160
|
neq: "neq";
|
|
160
|
-
in: "in";
|
|
161
161
|
contains: "contains";
|
|
162
162
|
gt: "gt";
|
|
163
163
|
gte: "gte";
|
|
@@ -191,11 +191,11 @@ export declare const flagConfigSchema: z.ZodObject<{
|
|
|
191
191
|
clauses: z.ZodArray<z.ZodObject<{
|
|
192
192
|
attr: z.ZodString;
|
|
193
193
|
op: z.ZodEnum<{
|
|
194
|
+
in: "in";
|
|
194
195
|
endsWith: "endsWith";
|
|
195
196
|
startsWith: "startsWith";
|
|
196
197
|
eq: "eq";
|
|
197
198
|
neq: "neq";
|
|
198
|
-
in: "in";
|
|
199
199
|
contains: "contains";
|
|
200
200
|
gt: "gt";
|
|
201
201
|
gte: "gte";
|
|
@@ -273,11 +273,11 @@ export declare const compiledFlagSchema: z.ZodObject<{
|
|
|
273
273
|
clauses: z.ZodArray<z.ZodObject<{
|
|
274
274
|
attr: z.ZodString;
|
|
275
275
|
op: z.ZodEnum<{
|
|
276
|
+
in: "in";
|
|
276
277
|
endsWith: "endsWith";
|
|
277
278
|
startsWith: "startsWith";
|
|
278
279
|
eq: "eq";
|
|
279
280
|
neq: "neq";
|
|
280
|
-
in: "in";
|
|
281
281
|
contains: "contains";
|
|
282
282
|
gt: "gt";
|
|
283
283
|
gte: "gte";
|
|
@@ -314,11 +314,11 @@ export declare const bundleSchema: z.ZodObject<{
|
|
|
314
314
|
clauses: z.ZodArray<z.ZodObject<{
|
|
315
315
|
attr: z.ZodString;
|
|
316
316
|
op: z.ZodEnum<{
|
|
317
|
+
in: "in";
|
|
317
318
|
endsWith: "endsWith";
|
|
318
319
|
startsWith: "startsWith";
|
|
319
320
|
eq: "eq";
|
|
320
321
|
neq: "neq";
|
|
321
|
-
in: "in";
|
|
322
322
|
contains: "contains";
|
|
323
323
|
gt: "gt";
|
|
324
324
|
gte: "gte";
|
|
@@ -363,11 +363,11 @@ export declare const bundleSchema: z.ZodObject<{
|
|
|
363
363
|
clauses: z.ZodArray<z.ZodObject<{
|
|
364
364
|
attr: z.ZodString;
|
|
365
365
|
op: z.ZodEnum<{
|
|
366
|
+
in: "in";
|
|
366
367
|
endsWith: "endsWith";
|
|
367
368
|
startsWith: "startsWith";
|
|
368
369
|
eq: "eq";
|
|
369
370
|
neq: "neq";
|
|
370
|
-
in: "in";
|
|
371
371
|
contains: "contains";
|
|
372
372
|
gt: "gt";
|
|
373
373
|
gte: "gte";
|
|
@@ -405,11 +405,11 @@ export declare const revokedBundleSchema: z.ZodObject<{
|
|
|
405
405
|
clauses: z.ZodArray<z.ZodObject<{
|
|
406
406
|
attr: z.ZodString;
|
|
407
407
|
op: z.ZodEnum<{
|
|
408
|
+
in: "in";
|
|
408
409
|
endsWith: "endsWith";
|
|
409
410
|
startsWith: "startsWith";
|
|
410
411
|
eq: "eq";
|
|
411
412
|
neq: "neq";
|
|
412
|
-
in: "in";
|
|
413
413
|
contains: "contains";
|
|
414
414
|
gt: "gt";
|
|
415
415
|
gte: "gte";
|
|
@@ -454,11 +454,11 @@ export declare const revokedBundleSchema: z.ZodObject<{
|
|
|
454
454
|
clauses: z.ZodArray<z.ZodObject<{
|
|
455
455
|
attr: z.ZodString;
|
|
456
456
|
op: z.ZodEnum<{
|
|
457
|
+
in: "in";
|
|
457
458
|
endsWith: "endsWith";
|
|
458
459
|
startsWith: "startsWith";
|
|
459
460
|
eq: "eq";
|
|
460
461
|
neq: "neq";
|
|
461
|
-
in: "in";
|
|
462
462
|
contains: "contains";
|
|
463
463
|
gt: "gt";
|
|
464
464
|
gte: "gte";
|
|
@@ -562,11 +562,11 @@ export declare const updateFlagEnvironmentSchema: z.ZodObject<{
|
|
|
562
562
|
clauses: z.ZodArray<z.ZodObject<{
|
|
563
563
|
attr: z.ZodString;
|
|
564
564
|
op: z.ZodEnum<{
|
|
565
|
+
in: "in";
|
|
565
566
|
endsWith: "endsWith";
|
|
566
567
|
startsWith: "startsWith";
|
|
567
568
|
eq: "eq";
|
|
568
569
|
neq: "neq";
|
|
569
|
-
in: "in";
|
|
570
570
|
contains: "contains";
|
|
571
571
|
gt: "gt";
|
|
572
572
|
gte: "gte";
|
|
@@ -606,11 +606,11 @@ export declare const createSegmentSchema: z.ZodObject<{
|
|
|
606
606
|
clauses: z.ZodArray<z.ZodObject<{
|
|
607
607
|
attr: z.ZodString;
|
|
608
608
|
op: z.ZodEnum<{
|
|
609
|
+
in: "in";
|
|
609
610
|
endsWith: "endsWith";
|
|
610
611
|
startsWith: "startsWith";
|
|
611
612
|
eq: "eq";
|
|
612
613
|
neq: "neq";
|
|
613
|
-
in: "in";
|
|
614
614
|
contains: "contains";
|
|
615
615
|
gt: "gt";
|
|
616
616
|
gte: "gte";
|
|
@@ -635,11 +635,11 @@ export declare const updateSegmentSchema: z.ZodObject<{
|
|
|
635
635
|
clauses: z.ZodArray<z.ZodObject<{
|
|
636
636
|
attr: z.ZodString;
|
|
637
637
|
op: z.ZodEnum<{
|
|
638
|
+
in: "in";
|
|
638
639
|
endsWith: "endsWith";
|
|
639
640
|
startsWith: "startsWith";
|
|
640
641
|
eq: "eq";
|
|
641
642
|
neq: "neq";
|
|
642
|
-
in: "in";
|
|
643
643
|
contains: "contains";
|
|
644
644
|
gt: "gt";
|
|
645
645
|
gte: "gte";
|
package/package.json
CHANGED
|
@@ -1,8 +1,18 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@flagwire/schema",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.1",
|
|
4
4
|
"description": "Normative schemas and wire contracts for FlagWire",
|
|
5
|
+
"keywords": [
|
|
6
|
+
"feature-flags",
|
|
7
|
+
"schema",
|
|
8
|
+
"typescript",
|
|
9
|
+
"zod"
|
|
10
|
+
],
|
|
5
11
|
"license": "MIT",
|
|
12
|
+
"homepage": "https://github.com/flagwire/flagwire-js/tree/main/packages/schema#readme",
|
|
13
|
+
"bugs": {
|
|
14
|
+
"url": "https://github.com/flagwire/flagwire-js/issues"
|
|
15
|
+
},
|
|
6
16
|
"type": "module",
|
|
7
17
|
"files": [
|
|
8
18
|
"dist"
|
|
@@ -26,7 +36,7 @@
|
|
|
26
36
|
"provenance": true
|
|
27
37
|
},
|
|
28
38
|
"dependencies": {
|
|
29
|
-
"zod": "4.
|
|
39
|
+
"zod": "4.4.3"
|
|
30
40
|
},
|
|
31
41
|
"devDependencies": {
|
|
32
42
|
"esbuild": "0.28.2"
|