@zapier/policy-schema 0.11.1 → 0.12.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 +2 -13
- package/dist/index.d.cts +6 -7
- package/dist/index.d.ts +6 -7
- package/dist/index.mjs +3 -13
- package/package.json +1 -1
package/dist/index.cjs
CHANGED
|
@@ -20,20 +20,10 @@ var VALID_OPERATOR_LIST = [
|
|
|
20
20
|
];
|
|
21
21
|
var ScalarSchema = zod.z.union([zod.z.string(), zod.z.number(), zod.z.boolean()]);
|
|
22
22
|
var PathSchema = zod.z.array(zod.z.union([zod.z.string(), zod.z.number()])).min(1);
|
|
23
|
-
var JsonValueSchema = zod.z.lazy(
|
|
24
|
-
() => zod.z.union([
|
|
25
|
-
zod.z.string(),
|
|
26
|
-
zod.z.number(),
|
|
27
|
-
zod.z.boolean(),
|
|
28
|
-
zod.z.null(),
|
|
29
|
-
zod.z.array(JsonValueSchema),
|
|
30
|
-
zod.z.record(zod.z.string(), JsonValueSchema)
|
|
31
|
-
])
|
|
32
|
-
);
|
|
33
23
|
var EqualsConditionSchema = zod.z.object({
|
|
34
24
|
path: PathSchema,
|
|
35
25
|
operator: zod.z.literal("equals"),
|
|
36
|
-
value:
|
|
26
|
+
value: zod.z.json()
|
|
37
27
|
}).strict();
|
|
38
28
|
var InConditionSchema = zod.z.object({
|
|
39
29
|
path: PathSchema,
|
|
@@ -139,7 +129,7 @@ var OperatorSchema = zod.z.enum([
|
|
|
139
129
|
"keys_in",
|
|
140
130
|
"size"
|
|
141
131
|
]);
|
|
142
|
-
var ConditionValueSchema =
|
|
132
|
+
var ConditionValueSchema = zod.z.json();
|
|
143
133
|
var V1StatementSchema = zod.z.object({
|
|
144
134
|
id: zod.z.string().optional(),
|
|
145
135
|
effect: zod.z.enum(["allow", "deny"]),
|
|
@@ -238,7 +228,6 @@ function getOpenApiSchema() {
|
|
|
238
228
|
exports.ArrayOperatorSchema = ArrayOperatorSchema;
|
|
239
229
|
exports.ConditionSchema = ConditionSchema;
|
|
240
230
|
exports.ConditionValueSchema = ConditionValueSchema;
|
|
241
|
-
exports.JsonValueSchema = JsonValueSchema;
|
|
242
231
|
exports.OperatorSchema = OperatorSchema;
|
|
243
232
|
exports.OtherOperatorSchema = OtherOperatorSchema;
|
|
244
233
|
exports.PolicySchema = PolicySchema;
|
package/dist/index.d.cts
CHANGED
|
@@ -124,7 +124,6 @@ declare const VALID_VERSIONS: readonly [1, 2];
|
|
|
124
124
|
declare const VALID_EFFECTS: readonly ["allow", "ask", "deny"];
|
|
125
125
|
/** Valid condition operators. */
|
|
126
126
|
declare const VALID_OPERATOR_LIST: readonly ["equals", "exists", "in", "keys_in", "matches", "matches_host", "matches_path", "matches_url", "range", "size", "values_in"];
|
|
127
|
-
declare const JsonValueSchema: z.ZodType<JsonValue>;
|
|
128
127
|
declare const RangeValueSchema: z.ZodObject<{
|
|
129
128
|
min: z.ZodOptional<z.ZodNumber>;
|
|
130
129
|
max: z.ZodOptional<z.ZodNumber>;
|
|
@@ -136,7 +135,7 @@ declare const SizeValueSchema: z.ZodUnion<readonly [z.ZodNumber, z.ZodObject<{
|
|
|
136
135
|
declare const ConditionSchema: z.ZodUnion<readonly [z.ZodObject<{
|
|
137
136
|
path: z.ZodArray<z.ZodUnion<readonly [z.ZodString, z.ZodNumber]>>;
|
|
138
137
|
operator: z.ZodLiteral<"equals">;
|
|
139
|
-
value: z.
|
|
138
|
+
value: z.ZodJSONSchema;
|
|
140
139
|
}, z.core.$strict>, z.ZodObject<{
|
|
141
140
|
path: z.ZodArray<z.ZodUnion<readonly [z.ZodString, z.ZodNumber]>>;
|
|
142
141
|
operator: z.ZodLiteral<"in">;
|
|
@@ -215,7 +214,7 @@ declare const OperatorSchema: z.ZodEnum<{
|
|
|
215
214
|
values_in: "values_in";
|
|
216
215
|
matches_url: "matches_url";
|
|
217
216
|
}>;
|
|
218
|
-
declare const ConditionValueSchema: z.
|
|
217
|
+
declare const ConditionValueSchema: z.ZodJSONSchema;
|
|
219
218
|
/** Statement schema accepting the union of all effects (use PolicySchema for version-aware validation). */
|
|
220
219
|
declare const StatementSchema: z.ZodObject<{
|
|
221
220
|
id: z.ZodOptional<z.ZodString>;
|
|
@@ -229,7 +228,7 @@ declare const StatementSchema: z.ZodObject<{
|
|
|
229
228
|
conditions: z.ZodOptional<z.ZodArray<z.ZodUnion<readonly [z.ZodObject<{
|
|
230
229
|
path: z.ZodArray<z.ZodUnion<readonly [z.ZodString, z.ZodNumber]>>;
|
|
231
230
|
operator: z.ZodLiteral<"equals">;
|
|
232
|
-
value: z.
|
|
231
|
+
value: z.ZodJSONSchema;
|
|
233
232
|
}, z.core.$strict>, z.ZodObject<{
|
|
234
233
|
path: z.ZodArray<z.ZodUnion<readonly [z.ZodString, z.ZodNumber]>>;
|
|
235
234
|
operator: z.ZodLiteral<"in">;
|
|
@@ -290,7 +289,7 @@ declare const PolicySchema: z.ZodUnion<readonly [z.ZodObject<{
|
|
|
290
289
|
conditions: z.ZodOptional<z.ZodArray<z.ZodUnion<readonly [z.ZodObject<{
|
|
291
290
|
path: z.ZodArray<z.ZodUnion<readonly [z.ZodString, z.ZodNumber]>>;
|
|
292
291
|
operator: z.ZodLiteral<"equals">;
|
|
293
|
-
value: z.
|
|
292
|
+
value: z.ZodJSONSchema;
|
|
294
293
|
}, z.core.$strict>, z.ZodObject<{
|
|
295
294
|
path: z.ZodArray<z.ZodUnion<readonly [z.ZodString, z.ZodNumber]>>;
|
|
296
295
|
operator: z.ZodLiteral<"in">;
|
|
@@ -352,7 +351,7 @@ declare const PolicySchema: z.ZodUnion<readonly [z.ZodObject<{
|
|
|
352
351
|
conditions: z.ZodOptional<z.ZodArray<z.ZodUnion<readonly [z.ZodObject<{
|
|
353
352
|
path: z.ZodArray<z.ZodUnion<readonly [z.ZodString, z.ZodNumber]>>;
|
|
354
353
|
operator: z.ZodLiteral<"equals">;
|
|
355
|
-
value: z.
|
|
354
|
+
value: z.ZodJSONSchema;
|
|
356
355
|
}, z.core.$strict>, z.ZodObject<{
|
|
357
356
|
path: z.ZodArray<z.ZodUnion<readonly [z.ZodString, z.ZodNumber]>>;
|
|
358
357
|
operator: z.ZodLiteral<"in">;
|
|
@@ -409,4 +408,4 @@ declare const PolicySchema: z.ZodUnion<readonly [z.ZodObject<{
|
|
|
409
408
|
*/
|
|
410
409
|
declare function getOpenApiSchema(): OpenApiSchema;
|
|
411
410
|
|
|
412
|
-
export { type ArrayOperator, ArrayOperatorSchema, type CanonicalHash, type Condition, ConditionSchema, type ConditionTrace, type ConditionValue, ConditionValueSchema, type Effect, type EvaluatePolicyOptions, type JsonValue,
|
|
411
|
+
export { type ArrayOperator, ArrayOperatorSchema, type CanonicalHash, type Condition, ConditionSchema, type ConditionTrace, type ConditionValue, ConditionValueSchema, type Effect, type EvaluatePolicyOptions, type JsonValue, type OpenApiSchema, type Operator, OperatorSchema, type OtherOperator, OtherOperatorSchema, type Override, type OverrideTrace, type ParsedUrl, type Policy, type PolicyActionRequest, type PolicyHttpRequest, type PolicyReason, type PolicyRequest, type PolicyResult, PolicySchema, type RangeValue, RangeValueSchema, type ScalarOperator, ScalarOperatorSchema, type SizeValue, SizeValueSchema, type Statement, StatementSchema, type StatementTrace, type UrlOperator, UrlOperatorSchema, VALID_EFFECTS, VALID_OPERATOR_LIST, VALID_VERSIONS, getOpenApiSchema };
|
package/dist/index.d.ts
CHANGED
|
@@ -124,7 +124,6 @@ declare const VALID_VERSIONS: readonly [1, 2];
|
|
|
124
124
|
declare const VALID_EFFECTS: readonly ["allow", "ask", "deny"];
|
|
125
125
|
/** Valid condition operators. */
|
|
126
126
|
declare const VALID_OPERATOR_LIST: readonly ["equals", "exists", "in", "keys_in", "matches", "matches_host", "matches_path", "matches_url", "range", "size", "values_in"];
|
|
127
|
-
declare const JsonValueSchema: z.ZodType<JsonValue>;
|
|
128
127
|
declare const RangeValueSchema: z.ZodObject<{
|
|
129
128
|
min: z.ZodOptional<z.ZodNumber>;
|
|
130
129
|
max: z.ZodOptional<z.ZodNumber>;
|
|
@@ -136,7 +135,7 @@ declare const SizeValueSchema: z.ZodUnion<readonly [z.ZodNumber, z.ZodObject<{
|
|
|
136
135
|
declare const ConditionSchema: z.ZodUnion<readonly [z.ZodObject<{
|
|
137
136
|
path: z.ZodArray<z.ZodUnion<readonly [z.ZodString, z.ZodNumber]>>;
|
|
138
137
|
operator: z.ZodLiteral<"equals">;
|
|
139
|
-
value: z.
|
|
138
|
+
value: z.ZodJSONSchema;
|
|
140
139
|
}, z.core.$strict>, z.ZodObject<{
|
|
141
140
|
path: z.ZodArray<z.ZodUnion<readonly [z.ZodString, z.ZodNumber]>>;
|
|
142
141
|
operator: z.ZodLiteral<"in">;
|
|
@@ -215,7 +214,7 @@ declare const OperatorSchema: z.ZodEnum<{
|
|
|
215
214
|
values_in: "values_in";
|
|
216
215
|
matches_url: "matches_url";
|
|
217
216
|
}>;
|
|
218
|
-
declare const ConditionValueSchema: z.
|
|
217
|
+
declare const ConditionValueSchema: z.ZodJSONSchema;
|
|
219
218
|
/** Statement schema accepting the union of all effects (use PolicySchema for version-aware validation). */
|
|
220
219
|
declare const StatementSchema: z.ZodObject<{
|
|
221
220
|
id: z.ZodOptional<z.ZodString>;
|
|
@@ -229,7 +228,7 @@ declare const StatementSchema: z.ZodObject<{
|
|
|
229
228
|
conditions: z.ZodOptional<z.ZodArray<z.ZodUnion<readonly [z.ZodObject<{
|
|
230
229
|
path: z.ZodArray<z.ZodUnion<readonly [z.ZodString, z.ZodNumber]>>;
|
|
231
230
|
operator: z.ZodLiteral<"equals">;
|
|
232
|
-
value: z.
|
|
231
|
+
value: z.ZodJSONSchema;
|
|
233
232
|
}, z.core.$strict>, z.ZodObject<{
|
|
234
233
|
path: z.ZodArray<z.ZodUnion<readonly [z.ZodString, z.ZodNumber]>>;
|
|
235
234
|
operator: z.ZodLiteral<"in">;
|
|
@@ -290,7 +289,7 @@ declare const PolicySchema: z.ZodUnion<readonly [z.ZodObject<{
|
|
|
290
289
|
conditions: z.ZodOptional<z.ZodArray<z.ZodUnion<readonly [z.ZodObject<{
|
|
291
290
|
path: z.ZodArray<z.ZodUnion<readonly [z.ZodString, z.ZodNumber]>>;
|
|
292
291
|
operator: z.ZodLiteral<"equals">;
|
|
293
|
-
value: z.
|
|
292
|
+
value: z.ZodJSONSchema;
|
|
294
293
|
}, z.core.$strict>, z.ZodObject<{
|
|
295
294
|
path: z.ZodArray<z.ZodUnion<readonly [z.ZodString, z.ZodNumber]>>;
|
|
296
295
|
operator: z.ZodLiteral<"in">;
|
|
@@ -352,7 +351,7 @@ declare const PolicySchema: z.ZodUnion<readonly [z.ZodObject<{
|
|
|
352
351
|
conditions: z.ZodOptional<z.ZodArray<z.ZodUnion<readonly [z.ZodObject<{
|
|
353
352
|
path: z.ZodArray<z.ZodUnion<readonly [z.ZodString, z.ZodNumber]>>;
|
|
354
353
|
operator: z.ZodLiteral<"equals">;
|
|
355
|
-
value: z.
|
|
354
|
+
value: z.ZodJSONSchema;
|
|
356
355
|
}, z.core.$strict>, z.ZodObject<{
|
|
357
356
|
path: z.ZodArray<z.ZodUnion<readonly [z.ZodString, z.ZodNumber]>>;
|
|
358
357
|
operator: z.ZodLiteral<"in">;
|
|
@@ -409,4 +408,4 @@ declare const PolicySchema: z.ZodUnion<readonly [z.ZodObject<{
|
|
|
409
408
|
*/
|
|
410
409
|
declare function getOpenApiSchema(): OpenApiSchema;
|
|
411
410
|
|
|
412
|
-
export { type ArrayOperator, ArrayOperatorSchema, type CanonicalHash, type Condition, ConditionSchema, type ConditionTrace, type ConditionValue, ConditionValueSchema, type Effect, type EvaluatePolicyOptions, type JsonValue,
|
|
411
|
+
export { type ArrayOperator, ArrayOperatorSchema, type CanonicalHash, type Condition, ConditionSchema, type ConditionTrace, type ConditionValue, ConditionValueSchema, type Effect, type EvaluatePolicyOptions, type JsonValue, type OpenApiSchema, type Operator, OperatorSchema, type OtherOperator, OtherOperatorSchema, type Override, type OverrideTrace, type ParsedUrl, type Policy, type PolicyActionRequest, type PolicyHttpRequest, type PolicyReason, type PolicyRequest, type PolicyResult, PolicySchema, type RangeValue, RangeValueSchema, type ScalarOperator, ScalarOperatorSchema, type SizeValue, SizeValueSchema, type Statement, StatementSchema, type StatementTrace, type UrlOperator, UrlOperatorSchema, VALID_EFFECTS, VALID_OPERATOR_LIST, VALID_VERSIONS, getOpenApiSchema };
|
package/dist/index.mjs
CHANGED
|
@@ -18,20 +18,10 @@ var VALID_OPERATOR_LIST = [
|
|
|
18
18
|
];
|
|
19
19
|
var ScalarSchema = z.union([z.string(), z.number(), z.boolean()]);
|
|
20
20
|
var PathSchema = z.array(z.union([z.string(), z.number()])).min(1);
|
|
21
|
-
var JsonValueSchema = z.lazy(
|
|
22
|
-
() => z.union([
|
|
23
|
-
z.string(),
|
|
24
|
-
z.number(),
|
|
25
|
-
z.boolean(),
|
|
26
|
-
z.null(),
|
|
27
|
-
z.array(JsonValueSchema),
|
|
28
|
-
z.record(z.string(), JsonValueSchema)
|
|
29
|
-
])
|
|
30
|
-
);
|
|
31
21
|
var EqualsConditionSchema = z.object({
|
|
32
22
|
path: PathSchema,
|
|
33
23
|
operator: z.literal("equals"),
|
|
34
|
-
value:
|
|
24
|
+
value: z.json()
|
|
35
25
|
}).strict();
|
|
36
26
|
var InConditionSchema = z.object({
|
|
37
27
|
path: PathSchema,
|
|
@@ -137,7 +127,7 @@ var OperatorSchema = z.enum([
|
|
|
137
127
|
"keys_in",
|
|
138
128
|
"size"
|
|
139
129
|
]);
|
|
140
|
-
var ConditionValueSchema =
|
|
130
|
+
var ConditionValueSchema = z.json();
|
|
141
131
|
var V1StatementSchema = z.object({
|
|
142
132
|
id: z.string().optional(),
|
|
143
133
|
effect: z.enum(["allow", "deny"]),
|
|
@@ -233,4 +223,4 @@ function getOpenApiSchema() {
|
|
|
233
223
|
};
|
|
234
224
|
}
|
|
235
225
|
|
|
236
|
-
export { ArrayOperatorSchema, ConditionSchema, ConditionValueSchema,
|
|
226
|
+
export { ArrayOperatorSchema, ConditionSchema, ConditionValueSchema, OperatorSchema, OtherOperatorSchema, PolicySchema, RangeValueSchema, ScalarOperatorSchema, SizeValueSchema, StatementSchema, UrlOperatorSchema, VALID_EFFECTS, VALID_OPERATOR_LIST, VALID_VERSIONS, getOpenApiSchema };
|