@zapier/policy-schema 0.3.0 → 0.4.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
@@ -41,6 +41,11 @@ var RangeConditionSchema = zod.z.object({
41
41
  operator: zod.z.literal("range"),
42
42
  value: RangeValueSchema
43
43
  }).strict();
44
+ var MatchesUrlConditionSchema = zod.z.object({
45
+ path: PathSchema,
46
+ operator: zod.z.literal("matches_url"),
47
+ value: zod.z.string()
48
+ }).strict();
44
49
  var ValuesInConditionSchema = zod.z.object({
45
50
  path: PathSchema,
46
51
  operator: zod.z.literal("values_in"),
@@ -72,6 +77,8 @@ var ConditionSchema = zod.z.union([
72
77
  MatchesHostConditionSchema,
73
78
  MatchesPathConditionSchema,
74
79
  RangeConditionSchema,
80
+ // URL operators
81
+ MatchesUrlConditionSchema,
75
82
  // Array operators
76
83
  ValuesInConditionSchema,
77
84
  // Other operators
@@ -88,6 +95,7 @@ var ScalarOperatorSchema = zod.z.enum([
88
95
  "range"
89
96
  ]);
90
97
  var ArrayOperatorSchema = zod.z.enum(["values_in"]);
98
+ var UrlOperatorSchema = zod.z.enum(["matches_url"]);
91
99
  var OtherOperatorSchema = zod.z.enum(["exists", "keys_in", "size"]);
92
100
  var OperatorSchema = zod.z.enum([
93
101
  // Scalar
@@ -97,6 +105,8 @@ var OperatorSchema = zod.z.enum([
97
105
  "matches_host",
98
106
  "matches_path",
99
107
  "range",
108
+ // URL
109
+ "matches_url",
100
110
  // Array
101
111
  "values_in",
102
112
  // Other
@@ -132,3 +142,4 @@ exports.RangeValueSchema = RangeValueSchema;
132
142
  exports.ScalarOperatorSchema = ScalarOperatorSchema;
133
143
  exports.SizeValueSchema = SizeValueSchema;
134
144
  exports.StatementSchema = StatementSchema;
145
+ exports.UrlOperatorSchema = UrlOperatorSchema;
package/dist/index.d.cts CHANGED
@@ -2,8 +2,9 @@ import { z } from 'zod';
2
2
 
3
3
  type ScalarOperator = "equals" | "in" | "matches" | "matches_host" | "matches_path" | "range";
4
4
  type ArrayOperator = "values_in";
5
+ type UrlOperator = "matches_url";
5
6
  type OtherOperator = "exists" | "keys_in" | "size";
6
- type Operator = ScalarOperator | ArrayOperator | OtherOperator;
7
+ type Operator = ScalarOperator | ArrayOperator | UrlOperator | OtherOperator;
7
8
  type RangeValue = {
8
9
  min?: number;
9
10
  max?: number;
@@ -85,6 +86,10 @@ declare const ConditionSchema: z.ZodUnion<readonly [z.ZodObject<{
85
86
  min: z.ZodOptional<z.ZodNumber>;
86
87
  max: z.ZodOptional<z.ZodNumber>;
87
88
  }, z.core.$strict>;
89
+ }, z.core.$strict>, z.ZodObject<{
90
+ path: z.ZodArray<z.ZodUnion<readonly [z.ZodString, z.ZodNumber]>>;
91
+ operator: z.ZodLiteral<"matches_url">;
92
+ value: z.ZodString;
88
93
  }, z.core.$strict>, z.ZodObject<{
89
94
  path: z.ZodArray<z.ZodUnion<readonly [z.ZodString, z.ZodNumber]>>;
90
95
  operator: z.ZodLiteral<"values_in">;
@@ -115,6 +120,9 @@ declare const ScalarOperatorSchema: z.ZodEnum<{
115
120
  declare const ArrayOperatorSchema: z.ZodEnum<{
116
121
  values_in: "values_in";
117
122
  }>;
123
+ declare const UrlOperatorSchema: z.ZodEnum<{
124
+ matches_url: "matches_url";
125
+ }>;
118
126
  declare const OtherOperatorSchema: z.ZodEnum<{
119
127
  exists: "exists";
120
128
  keys_in: "keys_in";
@@ -131,6 +139,7 @@ declare const OperatorSchema: z.ZodEnum<{
131
139
  keys_in: "keys_in";
132
140
  size: "size";
133
141
  values_in: "values_in";
142
+ matches_url: "matches_url";
134
143
  }>;
135
144
  declare const ConditionValueSchema: z.ZodUnion<readonly [z.ZodUnion<readonly [z.ZodString, z.ZodNumber, z.ZodBoolean]>, z.ZodArray<z.ZodUnion<readonly [z.ZodString, z.ZodNumber, z.ZodBoolean]>>, z.ZodObject<{
136
145
  min: z.ZodOptional<z.ZodNumber>;
@@ -173,6 +182,10 @@ declare const StatementSchema: z.ZodObject<{
173
182
  min: z.ZodOptional<z.ZodNumber>;
174
183
  max: z.ZodOptional<z.ZodNumber>;
175
184
  }, z.core.$strict>;
185
+ }, z.core.$strict>, z.ZodObject<{
186
+ path: z.ZodArray<z.ZodUnion<readonly [z.ZodString, z.ZodNumber]>>;
187
+ operator: z.ZodLiteral<"matches_url">;
188
+ value: z.ZodString;
176
189
  }, z.core.$strict>, z.ZodObject<{
177
190
  path: z.ZodArray<z.ZodUnion<readonly [z.ZodString, z.ZodNumber]>>;
178
191
  operator: z.ZodLiteral<"values_in">;
@@ -229,6 +242,10 @@ declare const PolicySchema: z.ZodObject<{
229
242
  min: z.ZodOptional<z.ZodNumber>;
230
243
  max: z.ZodOptional<z.ZodNumber>;
231
244
  }, z.core.$strict>;
245
+ }, z.core.$strict>, z.ZodObject<{
246
+ path: z.ZodArray<z.ZodUnion<readonly [z.ZodString, z.ZodNumber]>>;
247
+ operator: z.ZodLiteral<"matches_url">;
248
+ value: z.ZodString;
232
249
  }, z.core.$strict>, z.ZodObject<{
233
250
  path: z.ZodArray<z.ZodUnion<readonly [z.ZodString, z.ZodNumber]>>;
234
251
  operator: z.ZodLiteral<"values_in">;
@@ -251,4 +268,4 @@ declare const PolicySchema: z.ZodObject<{
251
268
  }, z.core.$strict>>;
252
269
  }, z.core.$strict>;
253
270
 
254
- export { type ArrayOperator, ArrayOperatorSchema, type Condition, ConditionSchema, type ConditionValue, ConditionValueSchema, type Effect, type Operator, OperatorSchema, type OtherOperator, OtherOperatorSchema, type ParsedUrl, type Policy, type PolicyHttpRequest, type PolicyRequest, type PolicyResult, PolicySchema, type RangeValue, RangeValueSchema, type ScalarOperator, ScalarOperatorSchema, type SizeValue, SizeValueSchema, type Statement, StatementSchema };
271
+ export { type ArrayOperator, ArrayOperatorSchema, type Condition, ConditionSchema, type ConditionValue, ConditionValueSchema, type Effect, type Operator, OperatorSchema, type OtherOperator, OtherOperatorSchema, type ParsedUrl, type Policy, type PolicyHttpRequest, type PolicyRequest, type PolicyResult, PolicySchema, type RangeValue, RangeValueSchema, type ScalarOperator, ScalarOperatorSchema, type SizeValue, SizeValueSchema, type Statement, StatementSchema, type UrlOperator, UrlOperatorSchema };
package/dist/index.d.ts CHANGED
@@ -2,8 +2,9 @@ import { z } from 'zod';
2
2
 
3
3
  type ScalarOperator = "equals" | "in" | "matches" | "matches_host" | "matches_path" | "range";
4
4
  type ArrayOperator = "values_in";
5
+ type UrlOperator = "matches_url";
5
6
  type OtherOperator = "exists" | "keys_in" | "size";
6
- type Operator = ScalarOperator | ArrayOperator | OtherOperator;
7
+ type Operator = ScalarOperator | ArrayOperator | UrlOperator | OtherOperator;
7
8
  type RangeValue = {
8
9
  min?: number;
9
10
  max?: number;
@@ -85,6 +86,10 @@ declare const ConditionSchema: z.ZodUnion<readonly [z.ZodObject<{
85
86
  min: z.ZodOptional<z.ZodNumber>;
86
87
  max: z.ZodOptional<z.ZodNumber>;
87
88
  }, z.core.$strict>;
89
+ }, z.core.$strict>, z.ZodObject<{
90
+ path: z.ZodArray<z.ZodUnion<readonly [z.ZodString, z.ZodNumber]>>;
91
+ operator: z.ZodLiteral<"matches_url">;
92
+ value: z.ZodString;
88
93
  }, z.core.$strict>, z.ZodObject<{
89
94
  path: z.ZodArray<z.ZodUnion<readonly [z.ZodString, z.ZodNumber]>>;
90
95
  operator: z.ZodLiteral<"values_in">;
@@ -115,6 +120,9 @@ declare const ScalarOperatorSchema: z.ZodEnum<{
115
120
  declare const ArrayOperatorSchema: z.ZodEnum<{
116
121
  values_in: "values_in";
117
122
  }>;
123
+ declare const UrlOperatorSchema: z.ZodEnum<{
124
+ matches_url: "matches_url";
125
+ }>;
118
126
  declare const OtherOperatorSchema: z.ZodEnum<{
119
127
  exists: "exists";
120
128
  keys_in: "keys_in";
@@ -131,6 +139,7 @@ declare const OperatorSchema: z.ZodEnum<{
131
139
  keys_in: "keys_in";
132
140
  size: "size";
133
141
  values_in: "values_in";
142
+ matches_url: "matches_url";
134
143
  }>;
135
144
  declare const ConditionValueSchema: z.ZodUnion<readonly [z.ZodUnion<readonly [z.ZodString, z.ZodNumber, z.ZodBoolean]>, z.ZodArray<z.ZodUnion<readonly [z.ZodString, z.ZodNumber, z.ZodBoolean]>>, z.ZodObject<{
136
145
  min: z.ZodOptional<z.ZodNumber>;
@@ -173,6 +182,10 @@ declare const StatementSchema: z.ZodObject<{
173
182
  min: z.ZodOptional<z.ZodNumber>;
174
183
  max: z.ZodOptional<z.ZodNumber>;
175
184
  }, z.core.$strict>;
185
+ }, z.core.$strict>, z.ZodObject<{
186
+ path: z.ZodArray<z.ZodUnion<readonly [z.ZodString, z.ZodNumber]>>;
187
+ operator: z.ZodLiteral<"matches_url">;
188
+ value: z.ZodString;
176
189
  }, z.core.$strict>, z.ZodObject<{
177
190
  path: z.ZodArray<z.ZodUnion<readonly [z.ZodString, z.ZodNumber]>>;
178
191
  operator: z.ZodLiteral<"values_in">;
@@ -229,6 +242,10 @@ declare const PolicySchema: z.ZodObject<{
229
242
  min: z.ZodOptional<z.ZodNumber>;
230
243
  max: z.ZodOptional<z.ZodNumber>;
231
244
  }, z.core.$strict>;
245
+ }, z.core.$strict>, z.ZodObject<{
246
+ path: z.ZodArray<z.ZodUnion<readonly [z.ZodString, z.ZodNumber]>>;
247
+ operator: z.ZodLiteral<"matches_url">;
248
+ value: z.ZodString;
232
249
  }, z.core.$strict>, z.ZodObject<{
233
250
  path: z.ZodArray<z.ZodUnion<readonly [z.ZodString, z.ZodNumber]>>;
234
251
  operator: z.ZodLiteral<"values_in">;
@@ -251,4 +268,4 @@ declare const PolicySchema: z.ZodObject<{
251
268
  }, z.core.$strict>>;
252
269
  }, z.core.$strict>;
253
270
 
254
- export { type ArrayOperator, ArrayOperatorSchema, type Condition, ConditionSchema, type ConditionValue, ConditionValueSchema, type Effect, type Operator, OperatorSchema, type OtherOperator, OtherOperatorSchema, type ParsedUrl, type Policy, type PolicyHttpRequest, type PolicyRequest, type PolicyResult, PolicySchema, type RangeValue, RangeValueSchema, type ScalarOperator, ScalarOperatorSchema, type SizeValue, SizeValueSchema, type Statement, StatementSchema };
271
+ export { type ArrayOperator, ArrayOperatorSchema, type Condition, ConditionSchema, type ConditionValue, ConditionValueSchema, type Effect, type Operator, OperatorSchema, type OtherOperator, OtherOperatorSchema, type ParsedUrl, type Policy, type PolicyHttpRequest, type PolicyRequest, type PolicyResult, PolicySchema, type RangeValue, RangeValueSchema, type ScalarOperator, ScalarOperatorSchema, type SizeValue, SizeValueSchema, type Statement, StatementSchema, type UrlOperator, UrlOperatorSchema };
package/dist/index.mjs CHANGED
@@ -39,6 +39,11 @@ var RangeConditionSchema = z.object({
39
39
  operator: z.literal("range"),
40
40
  value: RangeValueSchema
41
41
  }).strict();
42
+ var MatchesUrlConditionSchema = z.object({
43
+ path: PathSchema,
44
+ operator: z.literal("matches_url"),
45
+ value: z.string()
46
+ }).strict();
42
47
  var ValuesInConditionSchema = z.object({
43
48
  path: PathSchema,
44
49
  operator: z.literal("values_in"),
@@ -70,6 +75,8 @@ var ConditionSchema = z.union([
70
75
  MatchesHostConditionSchema,
71
76
  MatchesPathConditionSchema,
72
77
  RangeConditionSchema,
78
+ // URL operators
79
+ MatchesUrlConditionSchema,
73
80
  // Array operators
74
81
  ValuesInConditionSchema,
75
82
  // Other operators
@@ -86,6 +93,7 @@ var ScalarOperatorSchema = z.enum([
86
93
  "range"
87
94
  ]);
88
95
  var ArrayOperatorSchema = z.enum(["values_in"]);
96
+ var UrlOperatorSchema = z.enum(["matches_url"]);
89
97
  var OtherOperatorSchema = z.enum(["exists", "keys_in", "size"]);
90
98
  var OperatorSchema = z.enum([
91
99
  // Scalar
@@ -95,6 +103,8 @@ var OperatorSchema = z.enum([
95
103
  "matches_host",
96
104
  "matches_path",
97
105
  "range",
106
+ // URL
107
+ "matches_url",
98
108
  // Array
99
109
  "values_in",
100
110
  // Other
@@ -120,4 +130,4 @@ var PolicySchema = z.object({
120
130
  statements: z.array(StatementSchema)
121
131
  }).strict();
122
132
 
123
- export { ArrayOperatorSchema, ConditionSchema, ConditionValueSchema, OperatorSchema, OtherOperatorSchema, PolicySchema, RangeValueSchema, ScalarOperatorSchema, SizeValueSchema, StatementSchema };
133
+ export { ArrayOperatorSchema, ConditionSchema, ConditionValueSchema, OperatorSchema, OtherOperatorSchema, PolicySchema, RangeValueSchema, ScalarOperatorSchema, SizeValueSchema, StatementSchema, UrlOperatorSchema };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@zapier/policy-schema",
3
- "version": "0.3.0",
3
+ "version": "0.4.0",
4
4
  "description": "Zod schemas and TypeScript types for the Zapier policy engine",
5
5
  "type": "module",
6
6
  "main": "dist/index.cjs",