@zapier/policy-schema 0.17.0 → 0.18.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/dist/index.cjs CHANGED
@@ -27,33 +27,40 @@ var VALID_OPERATOR_LIST = [
27
27
  "values_in"
28
28
  ];
29
29
  var ScalarSchema = zod.z.union([zod.z.string(), zod.z.number(), zod.z.boolean()]);
30
- var PathSchema = zod.z.array(zod.z.union([zod.z.string(), zod.z.number()])).min(1);
31
- var RelativePathSchema = zod.z.array(zod.z.union([zod.z.string(), zod.z.number()]));
30
+ var PathSegmentSchema = zod.z.union([zod.z.string(), zod.z.number().int()]);
31
+ var PathSchema = zod.z.array(PathSegmentSchema).min(1);
32
+ var RelativePathSchema = zod.z.array(PathSegmentSchema);
33
+ var NegateField = { negate: zod.z.boolean().optional() };
32
34
  var ConditionValueSchema = zod.z.json();
33
35
  var EqualsConditionSchema = zod.z.object({
34
36
  path: PathSchema,
35
37
  operator: zod.z.literal("equals"),
36
- value: ConditionValueSchema
38
+ value: ConditionValueSchema,
39
+ ...NegateField
37
40
  }).strict();
38
41
  var InConditionSchema = zod.z.object({
39
42
  path: PathSchema,
40
43
  operator: zod.z.literal("in"),
41
- value: zod.z.array(ScalarSchema).min(1)
44
+ value: zod.z.array(ScalarSchema).min(1),
45
+ ...NegateField
42
46
  }).strict();
43
47
  var MatchesConditionSchema = zod.z.object({
44
48
  path: PathSchema,
45
49
  operator: zod.z.literal("matches"),
46
- value: zod.z.string()
50
+ value: zod.z.string(),
51
+ ...NegateField
47
52
  }).strict();
48
53
  var MatchesHostConditionSchema = zod.z.object({
49
54
  path: PathSchema,
50
55
  operator: zod.z.literal("matches_host"),
51
- value: zod.z.string()
56
+ value: zod.z.string(),
57
+ ...NegateField
52
58
  }).strict();
53
59
  var MatchesPathConditionSchema = zod.z.object({
54
60
  path: PathSchema,
55
61
  operator: zod.z.literal("matches_path"),
56
- value: zod.z.string()
62
+ value: zod.z.string(),
63
+ ...NegateField
57
64
  }).strict();
58
65
  var RangeValueSchema = zod.z.object({
59
66
  min: zod.z.number().finite().optional(),
@@ -64,26 +71,31 @@ var RangeValueSchema = zod.z.object({
64
71
  var RangeConditionSchema = zod.z.object({
65
72
  path: PathSchema,
66
73
  operator: zod.z.literal("range"),
67
- value: RangeValueSchema
74
+ value: RangeValueSchema,
75
+ ...NegateField
68
76
  }).strict();
69
77
  var MatchesUrlConditionSchema = zod.z.object({
70
78
  path: PathSchema,
71
79
  operator: zod.z.literal("matches_url"),
72
- value: zod.z.string()
80
+ value: zod.z.string(),
81
+ ...NegateField
73
82
  }).strict();
74
83
  var ValuesInConditionSchema = zod.z.object({
75
84
  path: PathSchema,
76
85
  operator: zod.z.literal("values_in"),
77
- value: zod.z.array(ScalarSchema).min(1)
86
+ value: zod.z.array(ScalarSchema).min(1),
87
+ ...NegateField
78
88
  }).strict();
79
89
  var ExistsConditionSchema = zod.z.object({
80
90
  path: PathSchema,
81
- operator: zod.z.literal("exists")
91
+ operator: zod.z.literal("exists"),
92
+ ...NegateField
82
93
  }).strict();
83
94
  var KeysInConditionSchema = zod.z.object({
84
95
  path: PathSchema,
85
96
  operator: zod.z.literal("keys_in"),
86
- value: zod.z.array(zod.z.string())
97
+ value: zod.z.array(zod.z.string()),
98
+ ...NegateField
87
99
  }).strict();
88
100
  var SizeValueSchema = zod.z.union([
89
101
  zod.z.number().int().nonnegative(),
@@ -92,7 +104,8 @@ var SizeValueSchema = zod.z.union([
92
104
  var SizeConditionSchema = zod.z.object({
93
105
  path: PathSchema,
94
106
  operator: zod.z.literal("size"),
95
- value: SizeValueSchema
107
+ value: SizeValueSchema,
108
+ ...NegateField
96
109
  }).strict();
97
110
  var RelativeConditionSchema = zod.z.union([
98
111
  EqualsConditionSchema.extend({ path: RelativePathSchema }),
@@ -330,6 +343,10 @@ function getOpenApiSchema() {
330
343
  value: {
331
344
  description: "Value to compare against using the operator."
332
345
  },
346
+ negate: {
347
+ type: "boolean",
348
+ description: "When true, the condition passes only if the operator would have failed. Not permitted on the some, all, and none quantifiers."
349
+ },
333
350
  where: {
334
351
  type: "array",
335
352
  minItems: 1,
@@ -355,6 +372,10 @@ function getOpenApiSchema() {
355
372
  },
356
373
  value: {
357
374
  description: "Value to compare against using the operator."
375
+ },
376
+ negate: {
377
+ type: "boolean",
378
+ description: "When true, the relative condition passes only if the operator would have failed."
358
379
  }
359
380
  }
360
381
  }