@zapier/policy-schema 0.10.0 → 0.11.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/dist/index.cjs +2 -7
- package/dist/index.d.cts +2 -5
- package/dist/index.d.ts +2 -5
- package/dist/index.mjs +2 -8
- package/package.json +5 -4
package/dist/index.cjs
CHANGED
|
@@ -142,7 +142,6 @@ var OperatorSchema = zod.z.enum([
|
|
|
142
142
|
var ConditionValueSchema = JsonValueSchema;
|
|
143
143
|
var V1StatementSchema = zod.z.object({
|
|
144
144
|
id: zod.z.string().optional(),
|
|
145
|
-
label: zod.z.string().optional(),
|
|
146
145
|
effect: zod.z.enum(["allow", "deny"]),
|
|
147
146
|
permissions: zod.z.array(zod.z.string()).min(1),
|
|
148
147
|
resources: zod.z.array(zod.z.string()).min(1),
|
|
@@ -150,7 +149,6 @@ var V1StatementSchema = zod.z.object({
|
|
|
150
149
|
}).strict();
|
|
151
150
|
var V2StatementSchema = zod.z.object({
|
|
152
151
|
id: zod.z.string().optional(),
|
|
153
|
-
label: zod.z.string().optional(),
|
|
154
152
|
effect: zod.z.enum(["allow", "ask", "deny"]),
|
|
155
153
|
permissions: zod.z.array(zod.z.string()).min(1),
|
|
156
154
|
resources: zod.z.array(zod.z.string()).min(1),
|
|
@@ -185,11 +183,7 @@ function getOpenApiSchema() {
|
|
|
185
183
|
properties: {
|
|
186
184
|
id: {
|
|
187
185
|
type: "string",
|
|
188
|
-
description: "Optional identifier for debugging and provenance. Included in
|
|
189
|
-
},
|
|
190
|
-
label: {
|
|
191
|
-
type: "string",
|
|
192
|
-
description: "Optional human-readable description of the statement. Excluded from statementHash for override targeting."
|
|
186
|
+
description: "Optional identifier for debugging and provenance. Included in canonical hash."
|
|
193
187
|
},
|
|
194
188
|
effect: {
|
|
195
189
|
type: "string",
|
|
@@ -244,6 +238,7 @@ function getOpenApiSchema() {
|
|
|
244
238
|
exports.ArrayOperatorSchema = ArrayOperatorSchema;
|
|
245
239
|
exports.ConditionSchema = ConditionSchema;
|
|
246
240
|
exports.ConditionValueSchema = ConditionValueSchema;
|
|
241
|
+
exports.JsonValueSchema = JsonValueSchema;
|
|
247
242
|
exports.OperatorSchema = OperatorSchema;
|
|
248
243
|
exports.OtherOperatorSchema = OtherOperatorSchema;
|
|
249
244
|
exports.PolicySchema = PolicySchema;
|
package/dist/index.d.cts
CHANGED
|
@@ -22,7 +22,6 @@ interface Condition {
|
|
|
22
22
|
type Effect = "allow" | "ask" | "deny";
|
|
23
23
|
interface Statement {
|
|
24
24
|
id?: string;
|
|
25
|
-
label?: string;
|
|
26
25
|
effect: Effect;
|
|
27
26
|
permissions: string[];
|
|
28
27
|
resources: string[];
|
|
@@ -125,6 +124,7 @@ declare const VALID_VERSIONS: readonly [1, 2];
|
|
|
125
124
|
declare const VALID_EFFECTS: readonly ["allow", "ask", "deny"];
|
|
126
125
|
/** Valid condition operators. */
|
|
127
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
128
|
declare const RangeValueSchema: z.ZodObject<{
|
|
129
129
|
min: z.ZodOptional<z.ZodNumber>;
|
|
130
130
|
max: z.ZodOptional<z.ZodNumber>;
|
|
@@ -219,7 +219,6 @@ declare const ConditionValueSchema: z.ZodType<JsonValue, unknown, z.core.$ZodTyp
|
|
|
219
219
|
/** Statement schema accepting the union of all effects (use PolicySchema for version-aware validation). */
|
|
220
220
|
declare const StatementSchema: z.ZodObject<{
|
|
221
221
|
id: z.ZodOptional<z.ZodString>;
|
|
222
|
-
label: z.ZodOptional<z.ZodString>;
|
|
223
222
|
effect: z.ZodEnum<{
|
|
224
223
|
allow: "allow";
|
|
225
224
|
ask: "ask";
|
|
@@ -282,7 +281,6 @@ declare const PolicySchema: z.ZodUnion<readonly [z.ZodObject<{
|
|
|
282
281
|
version: z.ZodLiteral<1>;
|
|
283
282
|
statements: z.ZodArray<z.ZodObject<{
|
|
284
283
|
id: z.ZodOptional<z.ZodString>;
|
|
285
|
-
label: z.ZodOptional<z.ZodString>;
|
|
286
284
|
effect: z.ZodEnum<{
|
|
287
285
|
allow: "allow";
|
|
288
286
|
deny: "deny";
|
|
@@ -344,7 +342,6 @@ declare const PolicySchema: z.ZodUnion<readonly [z.ZodObject<{
|
|
|
344
342
|
version: z.ZodLiteral<2>;
|
|
345
343
|
statements: z.ZodArray<z.ZodObject<{
|
|
346
344
|
id: z.ZodOptional<z.ZodString>;
|
|
347
|
-
label: z.ZodOptional<z.ZodString>;
|
|
348
345
|
effect: z.ZodEnum<{
|
|
349
346
|
allow: "allow";
|
|
350
347
|
ask: "ask";
|
|
@@ -412,4 +409,4 @@ declare const PolicySchema: z.ZodUnion<readonly [z.ZodObject<{
|
|
|
412
409
|
*/
|
|
413
410
|
declare function getOpenApiSchema(): OpenApiSchema;
|
|
414
411
|
|
|
415
|
-
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 };
|
|
412
|
+
export { type ArrayOperator, ArrayOperatorSchema, type CanonicalHash, type Condition, ConditionSchema, type ConditionTrace, type ConditionValue, ConditionValueSchema, type Effect, type EvaluatePolicyOptions, type JsonValue, JsonValueSchema, 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
|
@@ -22,7 +22,6 @@ interface Condition {
|
|
|
22
22
|
type Effect = "allow" | "ask" | "deny";
|
|
23
23
|
interface Statement {
|
|
24
24
|
id?: string;
|
|
25
|
-
label?: string;
|
|
26
25
|
effect: Effect;
|
|
27
26
|
permissions: string[];
|
|
28
27
|
resources: string[];
|
|
@@ -125,6 +124,7 @@ declare const VALID_VERSIONS: readonly [1, 2];
|
|
|
125
124
|
declare const VALID_EFFECTS: readonly ["allow", "ask", "deny"];
|
|
126
125
|
/** Valid condition operators. */
|
|
127
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
128
|
declare const RangeValueSchema: z.ZodObject<{
|
|
129
129
|
min: z.ZodOptional<z.ZodNumber>;
|
|
130
130
|
max: z.ZodOptional<z.ZodNumber>;
|
|
@@ -219,7 +219,6 @@ declare const ConditionValueSchema: z.ZodType<JsonValue, unknown, z.core.$ZodTyp
|
|
|
219
219
|
/** Statement schema accepting the union of all effects (use PolicySchema for version-aware validation). */
|
|
220
220
|
declare const StatementSchema: z.ZodObject<{
|
|
221
221
|
id: z.ZodOptional<z.ZodString>;
|
|
222
|
-
label: z.ZodOptional<z.ZodString>;
|
|
223
222
|
effect: z.ZodEnum<{
|
|
224
223
|
allow: "allow";
|
|
225
224
|
ask: "ask";
|
|
@@ -282,7 +281,6 @@ declare const PolicySchema: z.ZodUnion<readonly [z.ZodObject<{
|
|
|
282
281
|
version: z.ZodLiteral<1>;
|
|
283
282
|
statements: z.ZodArray<z.ZodObject<{
|
|
284
283
|
id: z.ZodOptional<z.ZodString>;
|
|
285
|
-
label: z.ZodOptional<z.ZodString>;
|
|
286
284
|
effect: z.ZodEnum<{
|
|
287
285
|
allow: "allow";
|
|
288
286
|
deny: "deny";
|
|
@@ -344,7 +342,6 @@ declare const PolicySchema: z.ZodUnion<readonly [z.ZodObject<{
|
|
|
344
342
|
version: z.ZodLiteral<2>;
|
|
345
343
|
statements: z.ZodArray<z.ZodObject<{
|
|
346
344
|
id: z.ZodOptional<z.ZodString>;
|
|
347
|
-
label: z.ZodOptional<z.ZodString>;
|
|
348
345
|
effect: z.ZodEnum<{
|
|
349
346
|
allow: "allow";
|
|
350
347
|
ask: "ask";
|
|
@@ -412,4 +409,4 @@ declare const PolicySchema: z.ZodUnion<readonly [z.ZodObject<{
|
|
|
412
409
|
*/
|
|
413
410
|
declare function getOpenApiSchema(): OpenApiSchema;
|
|
414
411
|
|
|
415
|
-
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 };
|
|
412
|
+
export { type ArrayOperator, ArrayOperatorSchema, type CanonicalHash, type Condition, ConditionSchema, type ConditionTrace, type ConditionValue, ConditionValueSchema, type Effect, type EvaluatePolicyOptions, type JsonValue, JsonValueSchema, 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
|
@@ -140,7 +140,6 @@ var OperatorSchema = z.enum([
|
|
|
140
140
|
var ConditionValueSchema = JsonValueSchema;
|
|
141
141
|
var V1StatementSchema = z.object({
|
|
142
142
|
id: z.string().optional(),
|
|
143
|
-
label: z.string().optional(),
|
|
144
143
|
effect: z.enum(["allow", "deny"]),
|
|
145
144
|
permissions: z.array(z.string()).min(1),
|
|
146
145
|
resources: z.array(z.string()).min(1),
|
|
@@ -148,7 +147,6 @@ var V1StatementSchema = z.object({
|
|
|
148
147
|
}).strict();
|
|
149
148
|
var V2StatementSchema = z.object({
|
|
150
149
|
id: z.string().optional(),
|
|
151
|
-
label: z.string().optional(),
|
|
152
150
|
effect: z.enum(["allow", "ask", "deny"]),
|
|
153
151
|
permissions: z.array(z.string()).min(1),
|
|
154
152
|
resources: z.array(z.string()).min(1),
|
|
@@ -183,11 +181,7 @@ function getOpenApiSchema() {
|
|
|
183
181
|
properties: {
|
|
184
182
|
id: {
|
|
185
183
|
type: "string",
|
|
186
|
-
description: "Optional identifier for debugging and provenance. Included in
|
|
187
|
-
},
|
|
188
|
-
label: {
|
|
189
|
-
type: "string",
|
|
190
|
-
description: "Optional human-readable description of the statement. Excluded from statementHash for override targeting."
|
|
184
|
+
description: "Optional identifier for debugging and provenance. Included in canonical hash."
|
|
191
185
|
},
|
|
192
186
|
effect: {
|
|
193
187
|
type: "string",
|
|
@@ -239,4 +233,4 @@ function getOpenApiSchema() {
|
|
|
239
233
|
};
|
|
240
234
|
}
|
|
241
235
|
|
|
242
|
-
export { ArrayOperatorSchema, ConditionSchema, ConditionValueSchema, OperatorSchema, OtherOperatorSchema, PolicySchema, RangeValueSchema, ScalarOperatorSchema, SizeValueSchema, StatementSchema, UrlOperatorSchema, VALID_EFFECTS, VALID_OPERATOR_LIST, VALID_VERSIONS, getOpenApiSchema };
|
|
236
|
+
export { ArrayOperatorSchema, ConditionSchema, ConditionValueSchema, JsonValueSchema, OperatorSchema, OtherOperatorSchema, PolicySchema, RangeValueSchema, ScalarOperatorSchema, SizeValueSchema, StatementSchema, UrlOperatorSchema, VALID_EFFECTS, VALID_OPERATOR_LIST, VALID_VERSIONS, getOpenApiSchema };
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@zapier/policy-schema",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.11.1",
|
|
4
4
|
"description": "Zod schemas and TypeScript types for the Zapier policy engine",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "dist/index.cjs",
|
|
@@ -30,8 +30,8 @@
|
|
|
30
30
|
"publishConfig": {
|
|
31
31
|
"access": "public"
|
|
32
32
|
},
|
|
33
|
-
"
|
|
34
|
-
"zod": "4.
|
|
33
|
+
"peerDependencies": {
|
|
34
|
+
"zod": "^4.0.0"
|
|
35
35
|
},
|
|
36
36
|
"devDependencies": {
|
|
37
37
|
"@types/node": "^22.0.0",
|
|
@@ -39,7 +39,8 @@
|
|
|
39
39
|
"tsx": "^4.0.0",
|
|
40
40
|
"tsup": "^8.0.0",
|
|
41
41
|
"typescript": "^5.7.0",
|
|
42
|
-
"vitest": "^3.0.0"
|
|
42
|
+
"vitest": "^3.0.0",
|
|
43
|
+
"zod": "^4.0.0"
|
|
43
44
|
},
|
|
44
45
|
"scripts": {
|
|
45
46
|
"build": "tsup",
|