@cedar-policy/cedar-wasm 3.2.3 → 3.3.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.
@@ -46,6 +46,10 @@ export function checkParseEntities(entities_str: string, schema_str: string): Ch
46
46
  */
47
47
  export function checkParseContext(context_str: string, action_str: string, schema_str: string): CheckParseResult;
48
48
  /**
49
+ * @returns {string}
50
+ */
51
+ export function getCedarVersion(): string;
52
+ /**
49
53
  * @param {AuthorizationCall} call
50
54
  * @returns {AuthorizationAnswer}
51
55
  */
@@ -55,10 +59,6 @@ export function isAuthorized(call: AuthorizationCall): AuthorizationAnswer;
55
59
  * @returns {ValidationAnswer}
56
60
  */
57
61
  export function validate(call: ValidationCall): ValidationAnswer;
58
- /**
59
- * @returns {string}
60
- */
61
- export function getCedarVersion(): string;
62
62
  export type JsonToPolicyResult = { type: "success"; policyText: string } | { type: "error"; errors: string[] };
63
63
 
64
64
  export type PolicyToJsonResult = { type: "success"; policy: Policy } | { type: "error"; errors: string[] };
@@ -71,6 +71,31 @@ export type FormattingResult = { type: "success"; formatted_policy: string } | {
71
71
 
72
72
  export type CheckParseResult = { type: "success" } | { type: "error"; errors: string[] };
73
73
 
74
+ export type Schema = { human: string } | { json: SchemaJson };
75
+
76
+ export type PolicySet = string | Record<string, string>;
77
+
78
+ export interface SourceLocation {
79
+ start: number;
80
+ end: number;
81
+ }
82
+
83
+ export interface SourceLabel extends SourceLocation {
84
+ label: string | null;
85
+ }
86
+
87
+ export type Severity = "advice" | "warning" | "error";
88
+
89
+ export interface DetailedError {
90
+ message: string;
91
+ help: string | null;
92
+ code: string | null;
93
+ url: string | null;
94
+ severity: Severity | null;
95
+ sourceLocations?: SourceLabel[];
96
+ related?: DetailedError[];
97
+ }
98
+
74
99
  export type ValidationAnswer = { type: "failure"; errors: DetailedError[]; warnings: DetailedError[] } | { type: "success"; validationErrors: ValidationError[]; validationWarnings: ValidationError[]; otherWarnings: DetailedError[] };
75
100
 
76
101
  export interface ValidationError {
@@ -142,31 +167,6 @@ export interface Response {
142
167
  diagnostics: Diagnostics;
143
168
  }
144
169
 
145
- export type Schema = { human: string } | { json: SchemaJson };
146
-
147
- export type PolicySet = string | Record<string, string>;
148
-
149
- export interface SourceLocation {
150
- start: number;
151
- end: number;
152
- }
153
-
154
- export interface SourceLabel extends SourceLocation {
155
- label: string | null;
156
- }
157
-
158
- export type Severity = "advice" | "warning" | "error";
159
-
160
- export interface DetailedError {
161
- message: string;
162
- help: string | null;
163
- code: string | null;
164
- url: string | null;
165
- severity: Severity | null;
166
- sourceLocations?: SourceLabel[];
167
- related?: DetailedError[];
168
- }
169
-
170
170
  export type SchemaTypeVariant = { type: "String" } | { type: "Long" } | { type: "Boolean" } | { type: "Set"; element: SchemaType } | { type: "Record"; attributes: Record<SmolStr, TypeOfAttribute>; additionalAttributes: boolean } | { type: "Entity"; name: Name } | { type: "Extension"; name: Id };
171
171
 
172
172
  export type SchemaType = SchemaTypeVariant | { type: Name };
@@ -220,25 +220,6 @@ export type ActionConstraint = { op: "All" } | ({ op: "==" } & EqConstraint) | (
220
220
 
221
221
  export type PrincipalConstraint = { op: "All" } | ({ op: "==" } & EqConstraint) | ({ op: "in" } & PrincipalOrResourceInConstraint) | ({ op: "is" } & PrincipalOrResourceIsConstraint);
222
222
 
223
- export interface EntityJson {
224
- uid: EntityUidJson;
225
- attrs: Record<string, CedarValueJson>;
226
- parents: EntityUidJson[];
227
- }
228
-
229
- export type Clause = { kind: "when"; body: Expr } | { kind: "unless"; body: Expr };
230
-
231
- export interface Policy {
232
- effect: Effect;
233
- principal: PrincipalConstraint;
234
- action: ActionConstraint;
235
- resource: ResourceConstraint;
236
- conditions: Clause[];
237
- annotations?: Record<string, string>;
238
- }
239
-
240
- export type Effect = "permit" | "forbid";
241
-
242
223
  export type EntityUidJson = { __expr: string } | { __entity: TypeAndId } | TypeAndId;
243
224
 
244
225
  export interface FnAndArg {
@@ -253,14 +234,33 @@ export interface TypeAndId {
253
234
 
254
235
  export type CedarValueJson = { __expr: string } | { __entity: TypeAndId } | { __extn: FnAndArg } | boolean | number | string | CedarValueJson[] | { [key: string]: CedarValueJson } | null;
255
236
 
256
- export type Decision = "Allow" | "Deny";
257
-
258
237
  export type ExtFuncCall = {} & Record<string, Array<Expr>>;
259
238
 
260
239
  export type ExprNoExt = { Value: CedarValueJson } | { Var: Var } | { Slot: string } | { Unknown: { name: string } } | { "!": { arg: Expr } } | { neg: { arg: Expr } } | { "==": { left: Expr; right: Expr } } | { "!=": { left: Expr; right: Expr } } | { in: { left: Expr; right: Expr } } | { "<": { left: Expr; right: Expr } } | { "<=": { left: Expr; right: Expr } } | { ">": { left: Expr; right: Expr } } | { ">=": { left: Expr; right: Expr } } | { "&&": { left: Expr; right: Expr } } | { "||": { left: Expr; right: Expr } } | { "+": { left: Expr; right: Expr } } | { "-": { left: Expr; right: Expr } } | { "*": { left: Expr; right: Expr } } | { contains: { left: Expr; right: Expr } } | { containsAll: { left: Expr; right: Expr } } | { containsAny: { left: Expr; right: Expr } } | { ".": { left: Expr; attr: SmolStr } } | { has: { left: Expr; attr: SmolStr } } | { like: { left: Expr; pattern: SmolStr } } | { is: { left: Expr; entity_type: SmolStr; in?: Expr } } | { "if-then-else": { if: Expr; then: Expr; else: Expr } } | { Set: Expr[] } | { Record: Record<string, Expr> };
261
240
 
262
241
  export type Expr = ExprNoExt | ExtFuncCall;
263
242
 
243
+ export type Decision = "Allow" | "Deny";
244
+
245
+ export type Effect = "permit" | "forbid";
246
+
247
+ export interface EntityJson {
248
+ uid: EntityUidJson;
249
+ attrs: Record<string, CedarValueJson>;
250
+ parents: EntityUidJson[];
251
+ }
252
+
253
+ export type Clause = { kind: "when"; body: Expr } | { kind: "unless"; body: Expr };
254
+
255
+ export interface Policy {
256
+ effect: Effect;
257
+ principal: PrincipalConstraint;
258
+ action: ActionConstraint;
259
+ resource: ResourceConstraint;
260
+ conditions: Clause[];
261
+ annotations?: Record<string, string>;
262
+ }
263
+
264
264
  export type Var = "principal" | "action" | "resource" | "context";
265
265
 
266
266
  type SmolStr = string;
@@ -222,24 +222,6 @@ export function checkParseContext(context_str, action_str, schema_str) {
222
222
  return takeObject(ret);
223
223
  }
224
224
 
225
- /**
226
- * @param {AuthorizationCall} call
227
- * @returns {AuthorizationAnswer}
228
- */
229
- export function isAuthorized(call) {
230
- const ret = wasm.isAuthorized(addHeapObject(call));
231
- return takeObject(ret);
232
- }
233
-
234
- /**
235
- * @param {ValidationCall} call
236
- * @returns {ValidationAnswer}
237
- */
238
- export function validate(call) {
239
- const ret = wasm.validate(addHeapObject(call));
240
- return takeObject(ret);
241
- }
242
-
243
225
  /**
244
226
  * @returns {string}
245
227
  */
@@ -260,6 +242,24 @@ export function getCedarVersion() {
260
242
  }
261
243
  }
262
244
 
245
+ /**
246
+ * @param {AuthorizationCall} call
247
+ * @returns {AuthorizationAnswer}
248
+ */
249
+ export function isAuthorized(call) {
250
+ const ret = wasm.isAuthorized(addHeapObject(call));
251
+ return takeObject(ret);
252
+ }
253
+
254
+ /**
255
+ * @param {ValidationCall} call
256
+ * @returns {ValidationAnswer}
257
+ */
258
+ export function validate(call) {
259
+ const ret = wasm.validate(addHeapObject(call));
260
+ return takeObject(ret);
261
+ }
262
+
263
263
  function handleError(f, args) {
264
264
  try {
265
265
  return f.apply(this, args);
Binary file
@@ -9,9 +9,9 @@ export function formatPolicies(a: number, b: number, c: number, d: number): numb
9
9
  export function checkParseSchema(a: number, b: number): number;
10
10
  export function checkParseEntities(a: number, b: number, c: number, d: number): number;
11
11
  export function checkParseContext(a: number, b: number, c: number, d: number, e: number, f: number): number;
12
+ export function getCedarVersion(a: number): void;
12
13
  export function isAuthorized(a: number): number;
13
14
  export function validate(a: number): number;
14
- export function getCedarVersion(a: number): void;
15
15
  export function __wbindgen_malloc(a: number, b: number): number;
16
16
  export function __wbindgen_realloc(a: number, b: number, c: number, d: number): number;
17
17
  export function __wbindgen_add_to_stack_pointer(a: number): number;
package/esm/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@cedar-policy/cedar-wasm",
3
3
  "description": "Wasm bindings and typescript types for Cedar lib",
4
- "version": "3.2.3",
4
+ "version": "3.3.0",
5
5
  "license": "Apache-2.0",
6
6
  "files": [
7
7
  "cedar_wasm_bg.wasm",
@@ -46,6 +46,10 @@ export function checkParseEntities(entities_str: string, schema_str: string): Ch
46
46
  */
47
47
  export function checkParseContext(context_str: string, action_str: string, schema_str: string): CheckParseResult;
48
48
  /**
49
+ * @returns {string}
50
+ */
51
+ export function getCedarVersion(): string;
52
+ /**
49
53
  * @param {AuthorizationCall} call
50
54
  * @returns {AuthorizationAnswer}
51
55
  */
@@ -55,10 +59,6 @@ export function isAuthorized(call: AuthorizationCall): AuthorizationAnswer;
55
59
  * @returns {ValidationAnswer}
56
60
  */
57
61
  export function validate(call: ValidationCall): ValidationAnswer;
58
- /**
59
- * @returns {string}
60
- */
61
- export function getCedarVersion(): string;
62
62
  export type JsonToPolicyResult = { type: "success"; policyText: string } | { type: "error"; errors: string[] };
63
63
 
64
64
  export type PolicyToJsonResult = { type: "success"; policy: Policy } | { type: "error"; errors: string[] };
@@ -71,6 +71,31 @@ export type FormattingResult = { type: "success"; formatted_policy: string } | {
71
71
 
72
72
  export type CheckParseResult = { type: "success" } | { type: "error"; errors: string[] };
73
73
 
74
+ export type Schema = { human: string } | { json: SchemaJson };
75
+
76
+ export type PolicySet = string | Record<string, string>;
77
+
78
+ export interface SourceLocation {
79
+ start: number;
80
+ end: number;
81
+ }
82
+
83
+ export interface SourceLabel extends SourceLocation {
84
+ label: string | null;
85
+ }
86
+
87
+ export type Severity = "advice" | "warning" | "error";
88
+
89
+ export interface DetailedError {
90
+ message: string;
91
+ help: string | null;
92
+ code: string | null;
93
+ url: string | null;
94
+ severity: Severity | null;
95
+ sourceLocations?: SourceLabel[];
96
+ related?: DetailedError[];
97
+ }
98
+
74
99
  export type ValidationAnswer = { type: "failure"; errors: DetailedError[]; warnings: DetailedError[] } | { type: "success"; validationErrors: ValidationError[]; validationWarnings: ValidationError[]; otherWarnings: DetailedError[] };
75
100
 
76
101
  export interface ValidationError {
@@ -142,31 +167,6 @@ export interface Response {
142
167
  diagnostics: Diagnostics;
143
168
  }
144
169
 
145
- export type Schema = { human: string } | { json: SchemaJson };
146
-
147
- export type PolicySet = string | Record<string, string>;
148
-
149
- export interface SourceLocation {
150
- start: number;
151
- end: number;
152
- }
153
-
154
- export interface SourceLabel extends SourceLocation {
155
- label: string | null;
156
- }
157
-
158
- export type Severity = "advice" | "warning" | "error";
159
-
160
- export interface DetailedError {
161
- message: string;
162
- help: string | null;
163
- code: string | null;
164
- url: string | null;
165
- severity: Severity | null;
166
- sourceLocations?: SourceLabel[];
167
- related?: DetailedError[];
168
- }
169
-
170
170
  export type SchemaTypeVariant = { type: "String" } | { type: "Long" } | { type: "Boolean" } | { type: "Set"; element: SchemaType } | { type: "Record"; attributes: Record<SmolStr, TypeOfAttribute>; additionalAttributes: boolean } | { type: "Entity"; name: Name } | { type: "Extension"; name: Id };
171
171
 
172
172
  export type SchemaType = SchemaTypeVariant | { type: Name };
@@ -220,25 +220,6 @@ export type ActionConstraint = { op: "All" } | ({ op: "==" } & EqConstraint) | (
220
220
 
221
221
  export type PrincipalConstraint = { op: "All" } | ({ op: "==" } & EqConstraint) | ({ op: "in" } & PrincipalOrResourceInConstraint) | ({ op: "is" } & PrincipalOrResourceIsConstraint);
222
222
 
223
- export interface EntityJson {
224
- uid: EntityUidJson;
225
- attrs: Record<string, CedarValueJson>;
226
- parents: EntityUidJson[];
227
- }
228
-
229
- export type Clause = { kind: "when"; body: Expr } | { kind: "unless"; body: Expr };
230
-
231
- export interface Policy {
232
- effect: Effect;
233
- principal: PrincipalConstraint;
234
- action: ActionConstraint;
235
- resource: ResourceConstraint;
236
- conditions: Clause[];
237
- annotations?: Record<string, string>;
238
- }
239
-
240
- export type Effect = "permit" | "forbid";
241
-
242
223
  export type EntityUidJson = { __expr: string } | { __entity: TypeAndId } | TypeAndId;
243
224
 
244
225
  export interface FnAndArg {
@@ -253,14 +234,33 @@ export interface TypeAndId {
253
234
 
254
235
  export type CedarValueJson = { __expr: string } | { __entity: TypeAndId } | { __extn: FnAndArg } | boolean | number | string | CedarValueJson[] | { [key: string]: CedarValueJson } | null;
255
236
 
256
- export type Decision = "Allow" | "Deny";
257
-
258
237
  export type ExtFuncCall = {} & Record<string, Array<Expr>>;
259
238
 
260
239
  export type ExprNoExt = { Value: CedarValueJson } | { Var: Var } | { Slot: string } | { Unknown: { name: string } } | { "!": { arg: Expr } } | { neg: { arg: Expr } } | { "==": { left: Expr; right: Expr } } | { "!=": { left: Expr; right: Expr } } | { in: { left: Expr; right: Expr } } | { "<": { left: Expr; right: Expr } } | { "<=": { left: Expr; right: Expr } } | { ">": { left: Expr; right: Expr } } | { ">=": { left: Expr; right: Expr } } | { "&&": { left: Expr; right: Expr } } | { "||": { left: Expr; right: Expr } } | { "+": { left: Expr; right: Expr } } | { "-": { left: Expr; right: Expr } } | { "*": { left: Expr; right: Expr } } | { contains: { left: Expr; right: Expr } } | { containsAll: { left: Expr; right: Expr } } | { containsAny: { left: Expr; right: Expr } } | { ".": { left: Expr; attr: SmolStr } } | { has: { left: Expr; attr: SmolStr } } | { like: { left: Expr; pattern: SmolStr } } | { is: { left: Expr; entity_type: SmolStr; in?: Expr } } | { "if-then-else": { if: Expr; then: Expr; else: Expr } } | { Set: Expr[] } | { Record: Record<string, Expr> };
261
240
 
262
241
  export type Expr = ExprNoExt | ExtFuncCall;
263
242
 
243
+ export type Decision = "Allow" | "Deny";
244
+
245
+ export type Effect = "permit" | "forbid";
246
+
247
+ export interface EntityJson {
248
+ uid: EntityUidJson;
249
+ attrs: Record<string, CedarValueJson>;
250
+ parents: EntityUidJson[];
251
+ }
252
+
253
+ export type Clause = { kind: "when"; body: Expr } | { kind: "unless"; body: Expr };
254
+
255
+ export interface Policy {
256
+ effect: Effect;
257
+ principal: PrincipalConstraint;
258
+ action: ActionConstraint;
259
+ resource: ResourceConstraint;
260
+ conditions: Clause[];
261
+ annotations?: Record<string, string>;
262
+ }
263
+
264
264
  export type Var = "principal" | "action" | "resource" | "context";
265
265
 
266
266
  type SmolStr = string;
@@ -217,24 +217,6 @@ module.exports.checkParseContext = function(context_str, action_str, schema_str)
217
217
  return takeObject(ret);
218
218
  };
219
219
 
220
- /**
221
- * @param {AuthorizationCall} call
222
- * @returns {AuthorizationAnswer}
223
- */
224
- module.exports.isAuthorized = function(call) {
225
- const ret = wasm.isAuthorized(addHeapObject(call));
226
- return takeObject(ret);
227
- };
228
-
229
- /**
230
- * @param {ValidationCall} call
231
- * @returns {ValidationAnswer}
232
- */
233
- module.exports.validate = function(call) {
234
- const ret = wasm.validate(addHeapObject(call));
235
- return takeObject(ret);
236
- };
237
-
238
220
  /**
239
221
  * @returns {string}
240
222
  */
@@ -255,6 +237,24 @@ module.exports.getCedarVersion = function() {
255
237
  }
256
238
  };
257
239
 
240
+ /**
241
+ * @param {AuthorizationCall} call
242
+ * @returns {AuthorizationAnswer}
243
+ */
244
+ module.exports.isAuthorized = function(call) {
245
+ const ret = wasm.isAuthorized(addHeapObject(call));
246
+ return takeObject(ret);
247
+ };
248
+
249
+ /**
250
+ * @param {ValidationCall} call
251
+ * @returns {ValidationAnswer}
252
+ */
253
+ module.exports.validate = function(call) {
254
+ const ret = wasm.validate(addHeapObject(call));
255
+ return takeObject(ret);
256
+ };
257
+
258
258
  function handleError(f, args) {
259
259
  try {
260
260
  return f.apply(this, args);
Binary file
@@ -9,9 +9,9 @@ export function formatPolicies(a: number, b: number, c: number, d: number): numb
9
9
  export function checkParseSchema(a: number, b: number): number;
10
10
  export function checkParseEntities(a: number, b: number, c: number, d: number): number;
11
11
  export function checkParseContext(a: number, b: number, c: number, d: number, e: number, f: number): number;
12
+ export function getCedarVersion(a: number): void;
12
13
  export function isAuthorized(a: number): number;
13
14
  export function validate(a: number): number;
14
- export function getCedarVersion(a: number): void;
15
15
  export function __wbindgen_malloc(a: number, b: number): number;
16
16
  export function __wbindgen_realloc(a: number, b: number, c: number, d: number): number;
17
17
  export function __wbindgen_add_to_stack_pointer(a: number): number;
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@cedar-policy/cedar-wasm",
3
3
  "description": "Wasm bindings and typescript types for Cedar lib",
4
- "version": "3.2.3",
4
+ "version": "3.3.0",
5
5
  "license": "Apache-2.0",
6
6
  "files": [
7
7
  "cedar_wasm_bg.wasm",
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@cedar-policy/cedar-wasm",
3
3
  "description": "Wasm bindings and typescript types for Cedar lib",
4
- "version": "3.2.3",
4
+ "version": "3.3.0",
5
5
  "license": "Apache-2.0",
6
6
  "files": [
7
7
  "esm/package.json",
@@ -46,6 +46,10 @@ export function checkParseEntities(entities_str: string, schema_str: string): Ch
46
46
  */
47
47
  export function checkParseContext(context_str: string, action_str: string, schema_str: string): CheckParseResult;
48
48
  /**
49
+ * @returns {string}
50
+ */
51
+ export function getCedarVersion(): string;
52
+ /**
49
53
  * @param {AuthorizationCall} call
50
54
  * @returns {AuthorizationAnswer}
51
55
  */
@@ -55,10 +59,6 @@ export function isAuthorized(call: AuthorizationCall): AuthorizationAnswer;
55
59
  * @returns {ValidationAnswer}
56
60
  */
57
61
  export function validate(call: ValidationCall): ValidationAnswer;
58
- /**
59
- * @returns {string}
60
- */
61
- export function getCedarVersion(): string;
62
62
  export type JsonToPolicyResult = { type: "success"; policyText: string } | { type: "error"; errors: string[] };
63
63
 
64
64
  export type PolicyToJsonResult = { type: "success"; policy: Policy } | { type: "error"; errors: string[] };
@@ -71,6 +71,31 @@ export type FormattingResult = { type: "success"; formatted_policy: string } | {
71
71
 
72
72
  export type CheckParseResult = { type: "success" } | { type: "error"; errors: string[] };
73
73
 
74
+ export type Schema = { human: string } | { json: SchemaJson };
75
+
76
+ export type PolicySet = string | Record<string, string>;
77
+
78
+ export interface SourceLocation {
79
+ start: number;
80
+ end: number;
81
+ }
82
+
83
+ export interface SourceLabel extends SourceLocation {
84
+ label: string | null;
85
+ }
86
+
87
+ export type Severity = "advice" | "warning" | "error";
88
+
89
+ export interface DetailedError {
90
+ message: string;
91
+ help: string | null;
92
+ code: string | null;
93
+ url: string | null;
94
+ severity: Severity | null;
95
+ sourceLocations?: SourceLabel[];
96
+ related?: DetailedError[];
97
+ }
98
+
74
99
  export type ValidationAnswer = { type: "failure"; errors: DetailedError[]; warnings: DetailedError[] } | { type: "success"; validationErrors: ValidationError[]; validationWarnings: ValidationError[]; otherWarnings: DetailedError[] };
75
100
 
76
101
  export interface ValidationError {
@@ -142,31 +167,6 @@ export interface Response {
142
167
  diagnostics: Diagnostics;
143
168
  }
144
169
 
145
- export type Schema = { human: string } | { json: SchemaJson };
146
-
147
- export type PolicySet = string | Record<string, string>;
148
-
149
- export interface SourceLocation {
150
- start: number;
151
- end: number;
152
- }
153
-
154
- export interface SourceLabel extends SourceLocation {
155
- label: string | null;
156
- }
157
-
158
- export type Severity = "advice" | "warning" | "error";
159
-
160
- export interface DetailedError {
161
- message: string;
162
- help: string | null;
163
- code: string | null;
164
- url: string | null;
165
- severity: Severity | null;
166
- sourceLocations?: SourceLabel[];
167
- related?: DetailedError[];
168
- }
169
-
170
170
  export type SchemaTypeVariant = { type: "String" } | { type: "Long" } | { type: "Boolean" } | { type: "Set"; element: SchemaType } | { type: "Record"; attributes: Record<SmolStr, TypeOfAttribute>; additionalAttributes: boolean } | { type: "Entity"; name: Name } | { type: "Extension"; name: Id };
171
171
 
172
172
  export type SchemaType = SchemaTypeVariant | { type: Name };
@@ -220,25 +220,6 @@ export type ActionConstraint = { op: "All" } | ({ op: "==" } & EqConstraint) | (
220
220
 
221
221
  export type PrincipalConstraint = { op: "All" } | ({ op: "==" } & EqConstraint) | ({ op: "in" } & PrincipalOrResourceInConstraint) | ({ op: "is" } & PrincipalOrResourceIsConstraint);
222
222
 
223
- export interface EntityJson {
224
- uid: EntityUidJson;
225
- attrs: Record<string, CedarValueJson>;
226
- parents: EntityUidJson[];
227
- }
228
-
229
- export type Clause = { kind: "when"; body: Expr } | { kind: "unless"; body: Expr };
230
-
231
- export interface Policy {
232
- effect: Effect;
233
- principal: PrincipalConstraint;
234
- action: ActionConstraint;
235
- resource: ResourceConstraint;
236
- conditions: Clause[];
237
- annotations?: Record<string, string>;
238
- }
239
-
240
- export type Effect = "permit" | "forbid";
241
-
242
223
  export type EntityUidJson = { __expr: string } | { __entity: TypeAndId } | TypeAndId;
243
224
 
244
225
  export interface FnAndArg {
@@ -253,14 +234,33 @@ export interface TypeAndId {
253
234
 
254
235
  export type CedarValueJson = { __expr: string } | { __entity: TypeAndId } | { __extn: FnAndArg } | boolean | number | string | CedarValueJson[] | { [key: string]: CedarValueJson } | null;
255
236
 
256
- export type Decision = "Allow" | "Deny";
257
-
258
237
  export type ExtFuncCall = {} & Record<string, Array<Expr>>;
259
238
 
260
239
  export type ExprNoExt = { Value: CedarValueJson } | { Var: Var } | { Slot: string } | { Unknown: { name: string } } | { "!": { arg: Expr } } | { neg: { arg: Expr } } | { "==": { left: Expr; right: Expr } } | { "!=": { left: Expr; right: Expr } } | { in: { left: Expr; right: Expr } } | { "<": { left: Expr; right: Expr } } | { "<=": { left: Expr; right: Expr } } | { ">": { left: Expr; right: Expr } } | { ">=": { left: Expr; right: Expr } } | { "&&": { left: Expr; right: Expr } } | { "||": { left: Expr; right: Expr } } | { "+": { left: Expr; right: Expr } } | { "-": { left: Expr; right: Expr } } | { "*": { left: Expr; right: Expr } } | { contains: { left: Expr; right: Expr } } | { containsAll: { left: Expr; right: Expr } } | { containsAny: { left: Expr; right: Expr } } | { ".": { left: Expr; attr: SmolStr } } | { has: { left: Expr; attr: SmolStr } } | { like: { left: Expr; pattern: SmolStr } } | { is: { left: Expr; entity_type: SmolStr; in?: Expr } } | { "if-then-else": { if: Expr; then: Expr; else: Expr } } | { Set: Expr[] } | { Record: Record<string, Expr> };
261
240
 
262
241
  export type Expr = ExprNoExt | ExtFuncCall;
263
242
 
243
+ export type Decision = "Allow" | "Deny";
244
+
245
+ export type Effect = "permit" | "forbid";
246
+
247
+ export interface EntityJson {
248
+ uid: EntityUidJson;
249
+ attrs: Record<string, CedarValueJson>;
250
+ parents: EntityUidJson[];
251
+ }
252
+
253
+ export type Clause = { kind: "when"; body: Expr } | { kind: "unless"; body: Expr };
254
+
255
+ export interface Policy {
256
+ effect: Effect;
257
+ principal: PrincipalConstraint;
258
+ action: ActionConstraint;
259
+ resource: ResourceConstraint;
260
+ conditions: Clause[];
261
+ annotations?: Record<string, string>;
262
+ }
263
+
264
264
  export type Var = "principal" | "action" | "resource" | "context";
265
265
 
266
266
 
@@ -276,9 +276,9 @@ export interface InitOutput {
276
276
  readonly checkParseSchema: (a: number, b: number) => number;
277
277
  readonly checkParseEntities: (a: number, b: number, c: number, d: number) => number;
278
278
  readonly checkParseContext: (a: number, b: number, c: number, d: number, e: number, f: number) => number;
279
+ readonly getCedarVersion: (a: number) => void;
279
280
  readonly isAuthorized: (a: number) => number;
280
281
  readonly validate: (a: number) => number;
281
- readonly getCedarVersion: (a: number) => void;
282
282
  readonly __wbindgen_malloc: (a: number, b: number) => number;
283
283
  readonly __wbindgen_realloc: (a: number, b: number, c: number, d: number) => number;
284
284
  readonly __wbindgen_add_to_stack_pointer: (a: number) => number;
package/web/cedar_wasm.js CHANGED
@@ -214,24 +214,6 @@ export function checkParseContext(context_str, action_str, schema_str) {
214
214
  return takeObject(ret);
215
215
  }
216
216
 
217
- /**
218
- * @param {AuthorizationCall} call
219
- * @returns {AuthorizationAnswer}
220
- */
221
- export function isAuthorized(call) {
222
- const ret = wasm.isAuthorized(addHeapObject(call));
223
- return takeObject(ret);
224
- }
225
-
226
- /**
227
- * @param {ValidationCall} call
228
- * @returns {ValidationAnswer}
229
- */
230
- export function validate(call) {
231
- const ret = wasm.validate(addHeapObject(call));
232
- return takeObject(ret);
233
- }
234
-
235
217
  /**
236
218
  * @returns {string}
237
219
  */
@@ -252,6 +234,24 @@ export function getCedarVersion() {
252
234
  }
253
235
  }
254
236
 
237
+ /**
238
+ * @param {AuthorizationCall} call
239
+ * @returns {AuthorizationAnswer}
240
+ */
241
+ export function isAuthorized(call) {
242
+ const ret = wasm.isAuthorized(addHeapObject(call));
243
+ return takeObject(ret);
244
+ }
245
+
246
+ /**
247
+ * @param {ValidationCall} call
248
+ * @returns {ValidationAnswer}
249
+ */
250
+ export function validate(call) {
251
+ const ret = wasm.validate(addHeapObject(call));
252
+ return takeObject(ret);
253
+ }
254
+
255
255
  function handleError(f, args) {
256
256
  try {
257
257
  return f.apply(this, args);
Binary file
@@ -9,9 +9,9 @@ export function formatPolicies(a: number, b: number, c: number, d: number): numb
9
9
  export function checkParseSchema(a: number, b: number): number;
10
10
  export function checkParseEntities(a: number, b: number, c: number, d: number): number;
11
11
  export function checkParseContext(a: number, b: number, c: number, d: number, e: number, f: number): number;
12
+ export function getCedarVersion(a: number): void;
12
13
  export function isAuthorized(a: number): number;
13
14
  export function validate(a: number): number;
14
- export function getCedarVersion(a: number): void;
15
15
  export function __wbindgen_malloc(a: number, b: number): number;
16
16
  export function __wbindgen_realloc(a: number, b: number, c: number, d: number): number;
17
17
  export function __wbindgen_add_to_stack_pointer(a: number): number;
package/web/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@cedar-policy/cedar-wasm",
3
3
  "description": "Wasm bindings and typescript types for Cedar lib",
4
- "version": "3.2.3",
4
+ "version": "3.3.0",
5
5
  "license": "Apache-2.0",
6
6
  "files": [
7
7
  "cedar_wasm_bg.wasm",