@cedar-policy/cedar-wasm 4.1.0 → 4.2.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/README.md CHANGED
@@ -28,7 +28,7 @@ console.log(cedar.getCedarVersion());
28
28
  Importing the esm version using esm async import:
29
29
 
30
30
  ```
31
- import('@cedar-policy/cedar-wasm')
31
+ import('@cedar-policy/cedar-wasm/nodejs')
32
32
  .then(cedar => console.log(cedar.getCedarVersion()));
33
33
  ```
34
34
 
package/esm/README.md CHANGED
@@ -28,7 +28,7 @@ console.log(cedar.getCedarVersion());
28
28
  Importing the esm version using esm async import:
29
29
 
30
30
  ```
31
- import('@cedar-policy/cedar-wasm')
31
+ import('@cedar-policy/cedar-wasm/nodejs')
32
32
  .then(cedar => console.log(cedar.getCedarVersion()));
33
33
  ```
34
34
 
@@ -34,30 +34,6 @@ export function isAuthorized(call: AuthorizationCall): AuthorizationAnswer;
34
34
  */
35
35
  export function validate(call: ValidationCall): ValidationAnswer;
36
36
  /**
37
- * Check whether a policy set successfully parses.
38
- * @param {PolicySet} policies
39
- * @returns {CheckParseAnswer}
40
- */
41
- export function checkParsePolicySet(policies: PolicySet): CheckParseAnswer;
42
- /**
43
- * Check whether a schema successfully parses.
44
- * @param {Schema} schema
45
- * @returns {CheckParseAnswer}
46
- */
47
- export function checkParseSchema(schema: Schema): CheckParseAnswer;
48
- /**
49
- * Check whether a set of entities successfully parses.
50
- * @param {EntitiesParsingCall} call
51
- * @returns {CheckParseAnswer}
52
- */
53
- export function checkParseEntities(call: EntitiesParsingCall): CheckParseAnswer;
54
- /**
55
- * Check whether a context successfully parses.
56
- * @param {ContextParsingCall} call
57
- * @returns {CheckParseAnswer}
58
- */
59
- export function checkParseContext(call: ContextParsingCall): CheckParseAnswer;
60
- /**
61
37
  * Apply the Cedar policy formatter to a policy set in the Cedar policy format
62
38
  * @param {FormattingCall} call
63
39
  * @returns {FormattingAnswer}
@@ -99,6 +75,30 @@ export function schemaToText(schema: Schema): SchemaToTextAnswer;
99
75
  * @returns {SchemaToJsonAnswer}
100
76
  */
101
77
  export function schemaToJson(schema: Schema): SchemaToJsonAnswer;
78
+ /**
79
+ * Check whether a policy set successfully parses.
80
+ * @param {PolicySet} policies
81
+ * @returns {CheckParseAnswer}
82
+ */
83
+ export function checkParsePolicySet(policies: PolicySet): CheckParseAnswer;
84
+ /**
85
+ * Check whether a schema successfully parses.
86
+ * @param {Schema} schema
87
+ * @returns {CheckParseAnswer}
88
+ */
89
+ export function checkParseSchema(schema: Schema): CheckParseAnswer;
90
+ /**
91
+ * Check whether a set of entities successfully parses.
92
+ * @param {EntitiesParsingCall} call
93
+ * @returns {CheckParseAnswer}
94
+ */
95
+ export function checkParseEntities(call: EntitiesParsingCall): CheckParseAnswer;
96
+ /**
97
+ * Check whether a context successfully parses.
98
+ * @param {ContextParsingCall} call
99
+ * @returns {CheckParseAnswer}
100
+ */
101
+ export function checkParseContext(call: ContextParsingCall): CheckParseAnswer;
102
102
  export type GetValidRequestEnvsResult = { type: "success"; principals: string[]; actions: string[]; resources: string[] } | { type: "failure"; error: string };
103
103
 
104
104
  export interface Response {
@@ -146,19 +146,6 @@ export interface ValidationError {
146
146
 
147
147
  export type ValidationAnswer = { type: "failure"; errors: DetailedError[]; warnings: DetailedError[] } | { type: "success"; validationErrors: ValidationError[]; validationWarnings: ValidationError[]; otherWarnings: DetailedError[] };
148
148
 
149
- export type CheckParseAnswer = { type: "success" } | { type: "failure"; errors: DetailedError[] };
150
-
151
- export interface EntitiesParsingCall {
152
- entities: Entities;
153
- schema?: Schema | null;
154
- }
155
-
156
- export interface ContextParsingCall {
157
- context: Context;
158
- schema?: Schema | null;
159
- action?: EntityUid | null;
160
- }
161
-
162
149
  export interface FormattingCall {
163
150
  policyText: string;
164
151
  lineWidth?: number;
@@ -175,6 +162,25 @@ export type SchemaToTextAnswer = { type: "success"; text: string; warnings: Deta
175
162
 
176
163
  export type SchemaToJsonAnswer = { type: "success"; json: SchemaJson<string>; warnings: DetailedError[] } | { type: "failure"; errors: DetailedError[] };
177
164
 
165
+ export type ValidationMode = "strict";
166
+
167
+ export type CheckParseAnswer = { type: "success" } | { type: "failure"; errors: DetailedError[] };
168
+
169
+ export interface EntitiesParsingCall {
170
+ entities: Entities;
171
+ schema?: Schema | null;
172
+ }
173
+
174
+ export interface ContextParsingCall {
175
+ context: Context;
176
+ schema?: Schema | null;
177
+ action?: EntityUid | null;
178
+ }
179
+
180
+ export type SlotId = string;
181
+
182
+ export type PolicyId = string;
183
+
178
184
  export type Schema = string | SchemaJson<string>;
179
185
 
180
186
  export interface PolicySet {
@@ -222,12 +228,6 @@ export interface DetailedError {
222
228
  related?: DetailedError[];
223
229
  }
224
230
 
225
- export type ValidationMode = "strict";
226
-
227
- export type SlotId = string;
228
-
229
- export type PolicyId = string;
230
-
231
231
  export type TypeVariant<N> = { type: "String" } | { type: "Long" } | { type: "Boolean" } | { type: "Set"; element: Type<N> } | ({ type: "Record" } & RecordType<N>) | { type: "Entity"; name: N } | { type: "EntityOrCommon"; name: N } | { type: "Extension"; name: UnreservedId };
232
232
 
233
233
  export interface RecordType<N> {
@@ -272,6 +272,8 @@ export type CommonTypeId = string;
272
272
 
273
273
  export type SchemaJson<N> = Record<string, NamespaceDefinition<N>>;
274
274
 
275
+ export type Decision = "allow" | "deny";
276
+
275
277
  export type Clause = { kind: "when"; body: Expr } | { kind: "unless"; body: Expr };
276
278
 
277
279
  export interface PolicyJson {
@@ -283,16 +285,15 @@ export interface PolicyJson {
283
285
  annotations?: Record<string, string>;
284
286
  }
285
287
 
286
- export interface EntityJson {
287
- uid: EntityUidJson;
288
- attrs: Record<string, CedarValueJson>;
289
- parents: EntityUidJson[];
290
- tags?: Record<string, CedarValueJson>;
291
- }
288
+ export type ExtFuncCall = {} & Record<string, Array<Expr>>;
292
289
 
293
- export type UnreservedId = string;
290
+ export type ExprNoExt = { Value: CedarValueJson } | { Var: Var } | { Slot: 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 } } | { getTag: { left: Expr; right: Expr } } | { hasTag: { left: Expr; right: Expr } } | { ".": { left: Expr; attr: SmolStr } } | { has: { left: Expr; attr: SmolStr } } | { like: { left: Expr; pattern: PatternElem[] } } | { is: { left: Expr; entity_type: SmolStr; in?: Expr } } | { "if-then-else": { if: Expr; then: Expr; else: Expr } } | { Set: Expr[] } | { Record: Record<string, Expr> };
294
291
 
295
- export type Var = "principal" | "action" | "resource" | "context";
292
+ export type PatternElem = "Wildcard" | { Literal: SmolStr };
293
+
294
+ export type Expr = ExprNoExt | ExtFuncCall;
295
+
296
+ export type Effect = "permit" | "forbid";
296
297
 
297
298
  export type ActionInConstraint = { entity: EntityUidJson } | { entities: EntityUidJson[] };
298
299
 
@@ -311,7 +312,12 @@ export type ActionConstraint = { op: "All" } | ({ op: "==" } & EqConstraint) | (
311
312
 
312
313
  export type PrincipalConstraint = { op: "All" } | ({ op: "==" } & EqConstraint) | ({ op: "in" } & PrincipalOrResourceInConstraint) | ({ op: "is" } & PrincipalOrResourceIsConstraint);
313
314
 
314
- export type Decision = "allow" | "deny";
315
+ export interface EntityJson {
316
+ uid: EntityUidJson;
317
+ attrs: Record<string, CedarValueJson>;
318
+ parents: EntityUidJson[];
319
+ tags?: Record<string, CedarValueJson>;
320
+ }
315
321
 
316
322
  export type EntityUidJson = { __entity: TypeAndId } | TypeAndId;
317
323
 
@@ -327,15 +333,9 @@ export interface TypeAndId {
327
333
 
328
334
  export type CedarValueJson = { __entity: TypeAndId } | { __extn: FnAndArg } | boolean | number | string | CedarValueJson[] | { [key: string]: CedarValueJson } | null;
329
335
 
330
- export type ExtFuncCall = {} & Record<string, Array<Expr>>;
331
-
332
- export type ExprNoExt = { Value: CedarValueJson } | { Var: Var } | { Slot: 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 } } | { getTag: { left: Expr; right: Expr } } | { hasTag: { left: Expr; right: Expr } } | { ".": { left: Expr; attr: SmolStr } } | { has: { left: Expr; attr: SmolStr } } | { like: { left: Expr; pattern: PatternElem[] } } | { is: { left: Expr; entity_type: SmolStr; in?: Expr } } | { "if-then-else": { if: Expr; then: Expr; else: Expr } } | { Set: Expr[] } | { Record: Record<string, Expr> };
333
-
334
- export type PatternElem = "Wildcard" | { Literal: SmolStr };
335
-
336
- export type Expr = ExprNoExt | ExtFuncCall;
336
+ export type UnreservedId = string;
337
337
 
338
- export type Effect = "permit" | "forbid";
338
+ export type Var = "principal" | "action" | "resource" | "context";
339
339
 
340
340
  type SmolStr = string;
341
341
  export type TypeOfAttribute<N> = Type<N> & { required?: boolean };
@@ -188,46 +188,6 @@ export function validate(call) {
188
188
  return takeObject(ret);
189
189
  }
190
190
 
191
- /**
192
- * Check whether a policy set successfully parses.
193
- * @param {PolicySet} policies
194
- * @returns {CheckParseAnswer}
195
- */
196
- export function checkParsePolicySet(policies) {
197
- const ret = wasm.checkParsePolicySet(addHeapObject(policies));
198
- return takeObject(ret);
199
- }
200
-
201
- /**
202
- * Check whether a schema successfully parses.
203
- * @param {Schema} schema
204
- * @returns {CheckParseAnswer}
205
- */
206
- export function checkParseSchema(schema) {
207
- const ret = wasm.checkParseSchema(addHeapObject(schema));
208
- return takeObject(ret);
209
- }
210
-
211
- /**
212
- * Check whether a set of entities successfully parses.
213
- * @param {EntitiesParsingCall} call
214
- * @returns {CheckParseAnswer}
215
- */
216
- export function checkParseEntities(call) {
217
- const ret = wasm.checkParseEntities(addHeapObject(call));
218
- return takeObject(ret);
219
- }
220
-
221
- /**
222
- * Check whether a context successfully parses.
223
- * @param {ContextParsingCall} call
224
- * @returns {CheckParseAnswer}
225
- */
226
- export function checkParseContext(call) {
227
- const ret = wasm.checkParseContext(addHeapObject(call));
228
- return takeObject(ret);
229
- }
230
-
231
191
  /**
232
192
  * Apply the Cedar policy formatter to a policy set in the Cedar policy format
233
193
  * @param {FormattingCall} call
@@ -298,6 +258,46 @@ export function schemaToJson(schema) {
298
258
  return takeObject(ret);
299
259
  }
300
260
 
261
+ /**
262
+ * Check whether a policy set successfully parses.
263
+ * @param {PolicySet} policies
264
+ * @returns {CheckParseAnswer}
265
+ */
266
+ export function checkParsePolicySet(policies) {
267
+ const ret = wasm.checkParsePolicySet(addHeapObject(policies));
268
+ return takeObject(ret);
269
+ }
270
+
271
+ /**
272
+ * Check whether a schema successfully parses.
273
+ * @param {Schema} schema
274
+ * @returns {CheckParseAnswer}
275
+ */
276
+ export function checkParseSchema(schema) {
277
+ const ret = wasm.checkParseSchema(addHeapObject(schema));
278
+ return takeObject(ret);
279
+ }
280
+
281
+ /**
282
+ * Check whether a set of entities successfully parses.
283
+ * @param {EntitiesParsingCall} call
284
+ * @returns {CheckParseAnswer}
285
+ */
286
+ export function checkParseEntities(call) {
287
+ const ret = wasm.checkParseEntities(addHeapObject(call));
288
+ return takeObject(ret);
289
+ }
290
+
291
+ /**
292
+ * Check whether a context successfully parses.
293
+ * @param {ContextParsingCall} call
294
+ * @returns {CheckParseAnswer}
295
+ */
296
+ export function checkParseContext(call) {
297
+ const ret = wasm.checkParseContext(addHeapObject(call));
298
+ return takeObject(ret);
299
+ }
300
+
301
301
  function handleError(f, args) {
302
302
  try {
303
303
  return f.apply(this, args);
Binary file
@@ -6,10 +6,6 @@ export function getValidRequestEnvsPolicy(a: number, b: number): number;
6
6
  export function getCedarVersion(a: number): void;
7
7
  export function isAuthorized(a: number): number;
8
8
  export function validate(a: number): number;
9
- export function checkParsePolicySet(a: number): number;
10
- export function checkParseSchema(a: number): number;
11
- export function checkParseEntities(a: number): number;
12
- export function checkParseContext(a: number): number;
13
9
  export function formatPolicies(a: number): number;
14
10
  export function policyToText(a: number): number;
15
11
  export function templateToText(a: number): number;
@@ -17,6 +13,10 @@ export function policyToJson(a: number): number;
17
13
  export function templateToJson(a: number): number;
18
14
  export function schemaToText(a: number): number;
19
15
  export function schemaToJson(a: number): number;
16
+ export function checkParsePolicySet(a: number): number;
17
+ export function checkParseSchema(a: number): number;
18
+ export function checkParseEntities(a: number): number;
19
+ export function checkParseContext(a: number): number;
20
20
  export function __wbindgen_malloc(a: number, b: number): number;
21
21
  export function __wbindgen_realloc(a: number, b: number, c: number, d: number): number;
22
22
  export function __wbindgen_add_to_stack_pointer(a: number): number;
package/esm/package.json CHANGED
@@ -1,7 +1,8 @@
1
1
  {
2
2
  "name": "@cedar-policy/cedar-wasm",
3
+ "type": "module",
3
4
  "description": "Wasm bindings and typescript types for Cedar lib",
4
- "version": "4.1.0",
5
+ "version": "4.2.0",
5
6
  "license": "Apache-2.0",
6
7
  "files": [
7
8
  "cedar_wasm_bg.wasm",
@@ -9,11 +10,10 @@
9
10
  "cedar_wasm_bg.js",
10
11
  "cedar_wasm.d.ts"
11
12
  ],
12
- "module": "cedar_wasm.js",
13
+ "main": "cedar_wasm.js",
13
14
  "types": "cedar_wasm.d.ts",
14
15
  "sideEffects": [
15
16
  "./cedar_wasm.js",
16
17
  "./snippets/*"
17
- ],
18
- "type": "module"
18
+ ]
19
19
  }
package/nodejs/README.md CHANGED
@@ -28,7 +28,7 @@ console.log(cedar.getCedarVersion());
28
28
  Importing the esm version using esm async import:
29
29
 
30
30
  ```
31
- import('@cedar-policy/cedar-wasm')
31
+ import('@cedar-policy/cedar-wasm/nodejs')
32
32
  .then(cedar => console.log(cedar.getCedarVersion()));
33
33
  ```
34
34
 
@@ -34,30 +34,6 @@ export function isAuthorized(call: AuthorizationCall): AuthorizationAnswer;
34
34
  */
35
35
  export function validate(call: ValidationCall): ValidationAnswer;
36
36
  /**
37
- * Check whether a policy set successfully parses.
38
- * @param {PolicySet} policies
39
- * @returns {CheckParseAnswer}
40
- */
41
- export function checkParsePolicySet(policies: PolicySet): CheckParseAnswer;
42
- /**
43
- * Check whether a schema successfully parses.
44
- * @param {Schema} schema
45
- * @returns {CheckParseAnswer}
46
- */
47
- export function checkParseSchema(schema: Schema): CheckParseAnswer;
48
- /**
49
- * Check whether a set of entities successfully parses.
50
- * @param {EntitiesParsingCall} call
51
- * @returns {CheckParseAnswer}
52
- */
53
- export function checkParseEntities(call: EntitiesParsingCall): CheckParseAnswer;
54
- /**
55
- * Check whether a context successfully parses.
56
- * @param {ContextParsingCall} call
57
- * @returns {CheckParseAnswer}
58
- */
59
- export function checkParseContext(call: ContextParsingCall): CheckParseAnswer;
60
- /**
61
37
  * Apply the Cedar policy formatter to a policy set in the Cedar policy format
62
38
  * @param {FormattingCall} call
63
39
  * @returns {FormattingAnswer}
@@ -99,6 +75,30 @@ export function schemaToText(schema: Schema): SchemaToTextAnswer;
99
75
  * @returns {SchemaToJsonAnswer}
100
76
  */
101
77
  export function schemaToJson(schema: Schema): SchemaToJsonAnswer;
78
+ /**
79
+ * Check whether a policy set successfully parses.
80
+ * @param {PolicySet} policies
81
+ * @returns {CheckParseAnswer}
82
+ */
83
+ export function checkParsePolicySet(policies: PolicySet): CheckParseAnswer;
84
+ /**
85
+ * Check whether a schema successfully parses.
86
+ * @param {Schema} schema
87
+ * @returns {CheckParseAnswer}
88
+ */
89
+ export function checkParseSchema(schema: Schema): CheckParseAnswer;
90
+ /**
91
+ * Check whether a set of entities successfully parses.
92
+ * @param {EntitiesParsingCall} call
93
+ * @returns {CheckParseAnswer}
94
+ */
95
+ export function checkParseEntities(call: EntitiesParsingCall): CheckParseAnswer;
96
+ /**
97
+ * Check whether a context successfully parses.
98
+ * @param {ContextParsingCall} call
99
+ * @returns {CheckParseAnswer}
100
+ */
101
+ export function checkParseContext(call: ContextParsingCall): CheckParseAnswer;
102
102
  export type GetValidRequestEnvsResult = { type: "success"; principals: string[]; actions: string[]; resources: string[] } | { type: "failure"; error: string };
103
103
 
104
104
  export interface Response {
@@ -146,19 +146,6 @@ export interface ValidationError {
146
146
 
147
147
  export type ValidationAnswer = { type: "failure"; errors: DetailedError[]; warnings: DetailedError[] } | { type: "success"; validationErrors: ValidationError[]; validationWarnings: ValidationError[]; otherWarnings: DetailedError[] };
148
148
 
149
- export type CheckParseAnswer = { type: "success" } | { type: "failure"; errors: DetailedError[] };
150
-
151
- export interface EntitiesParsingCall {
152
- entities: Entities;
153
- schema?: Schema | null;
154
- }
155
-
156
- export interface ContextParsingCall {
157
- context: Context;
158
- schema?: Schema | null;
159
- action?: EntityUid | null;
160
- }
161
-
162
149
  export interface FormattingCall {
163
150
  policyText: string;
164
151
  lineWidth?: number;
@@ -175,6 +162,25 @@ export type SchemaToTextAnswer = { type: "success"; text: string; warnings: Deta
175
162
 
176
163
  export type SchemaToJsonAnswer = { type: "success"; json: SchemaJson<string>; warnings: DetailedError[] } | { type: "failure"; errors: DetailedError[] };
177
164
 
165
+ export type ValidationMode = "strict";
166
+
167
+ export type CheckParseAnswer = { type: "success" } | { type: "failure"; errors: DetailedError[] };
168
+
169
+ export interface EntitiesParsingCall {
170
+ entities: Entities;
171
+ schema?: Schema | null;
172
+ }
173
+
174
+ export interface ContextParsingCall {
175
+ context: Context;
176
+ schema?: Schema | null;
177
+ action?: EntityUid | null;
178
+ }
179
+
180
+ export type SlotId = string;
181
+
182
+ export type PolicyId = string;
183
+
178
184
  export type Schema = string | SchemaJson<string>;
179
185
 
180
186
  export interface PolicySet {
@@ -222,12 +228,6 @@ export interface DetailedError {
222
228
  related?: DetailedError[];
223
229
  }
224
230
 
225
- export type ValidationMode = "strict";
226
-
227
- export type SlotId = string;
228
-
229
- export type PolicyId = string;
230
-
231
231
  export type TypeVariant<N> = { type: "String" } | { type: "Long" } | { type: "Boolean" } | { type: "Set"; element: Type<N> } | ({ type: "Record" } & RecordType<N>) | { type: "Entity"; name: N } | { type: "EntityOrCommon"; name: N } | { type: "Extension"; name: UnreservedId };
232
232
 
233
233
  export interface RecordType<N> {
@@ -272,6 +272,8 @@ export type CommonTypeId = string;
272
272
 
273
273
  export type SchemaJson<N> = Record<string, NamespaceDefinition<N>>;
274
274
 
275
+ export type Decision = "allow" | "deny";
276
+
275
277
  export type Clause = { kind: "when"; body: Expr } | { kind: "unless"; body: Expr };
276
278
 
277
279
  export interface PolicyJson {
@@ -283,16 +285,15 @@ export interface PolicyJson {
283
285
  annotations?: Record<string, string>;
284
286
  }
285
287
 
286
- export interface EntityJson {
287
- uid: EntityUidJson;
288
- attrs: Record<string, CedarValueJson>;
289
- parents: EntityUidJson[];
290
- tags?: Record<string, CedarValueJson>;
291
- }
288
+ export type ExtFuncCall = {} & Record<string, Array<Expr>>;
292
289
 
293
- export type UnreservedId = string;
290
+ export type ExprNoExt = { Value: CedarValueJson } | { Var: Var } | { Slot: 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 } } | { getTag: { left: Expr; right: Expr } } | { hasTag: { left: Expr; right: Expr } } | { ".": { left: Expr; attr: SmolStr } } | { has: { left: Expr; attr: SmolStr } } | { like: { left: Expr; pattern: PatternElem[] } } | { is: { left: Expr; entity_type: SmolStr; in?: Expr } } | { "if-then-else": { if: Expr; then: Expr; else: Expr } } | { Set: Expr[] } | { Record: Record<string, Expr> };
294
291
 
295
- export type Var = "principal" | "action" | "resource" | "context";
292
+ export type PatternElem = "Wildcard" | { Literal: SmolStr };
293
+
294
+ export type Expr = ExprNoExt | ExtFuncCall;
295
+
296
+ export type Effect = "permit" | "forbid";
296
297
 
297
298
  export type ActionInConstraint = { entity: EntityUidJson } | { entities: EntityUidJson[] };
298
299
 
@@ -311,7 +312,12 @@ export type ActionConstraint = { op: "All" } | ({ op: "==" } & EqConstraint) | (
311
312
 
312
313
  export type PrincipalConstraint = { op: "All" } | ({ op: "==" } & EqConstraint) | ({ op: "in" } & PrincipalOrResourceInConstraint) | ({ op: "is" } & PrincipalOrResourceIsConstraint);
313
314
 
314
- export type Decision = "allow" | "deny";
315
+ export interface EntityJson {
316
+ uid: EntityUidJson;
317
+ attrs: Record<string, CedarValueJson>;
318
+ parents: EntityUidJson[];
319
+ tags?: Record<string, CedarValueJson>;
320
+ }
315
321
 
316
322
  export type EntityUidJson = { __entity: TypeAndId } | TypeAndId;
317
323
 
@@ -327,15 +333,9 @@ export interface TypeAndId {
327
333
 
328
334
  export type CedarValueJson = { __entity: TypeAndId } | { __extn: FnAndArg } | boolean | number | string | CedarValueJson[] | { [key: string]: CedarValueJson } | null;
329
335
 
330
- export type ExtFuncCall = {} & Record<string, Array<Expr>>;
331
-
332
- export type ExprNoExt = { Value: CedarValueJson } | { Var: Var } | { Slot: 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 } } | { getTag: { left: Expr; right: Expr } } | { hasTag: { left: Expr; right: Expr } } | { ".": { left: Expr; attr: SmolStr } } | { has: { left: Expr; attr: SmolStr } } | { like: { left: Expr; pattern: PatternElem[] } } | { is: { left: Expr; entity_type: SmolStr; in?: Expr } } | { "if-then-else": { if: Expr; then: Expr; else: Expr } } | { Set: Expr[] } | { Record: Record<string, Expr> };
333
-
334
- export type PatternElem = "Wildcard" | { Literal: SmolStr };
335
-
336
- export type Expr = ExprNoExt | ExtFuncCall;
336
+ export type UnreservedId = string;
337
337
 
338
- export type Effect = "permit" | "forbid";
338
+ export type Var = "principal" | "action" | "resource" | "context";
339
339
 
340
340
  type SmolStr = string;
341
341
  export type TypeOfAttribute<N> = Type<N> & { required?: boolean };
@@ -184,46 +184,6 @@ module.exports.validate = function(call) {
184
184
  return takeObject(ret);
185
185
  };
186
186
 
187
- /**
188
- * Check whether a policy set successfully parses.
189
- * @param {PolicySet} policies
190
- * @returns {CheckParseAnswer}
191
- */
192
- module.exports.checkParsePolicySet = function(policies) {
193
- const ret = wasm.checkParsePolicySet(addHeapObject(policies));
194
- return takeObject(ret);
195
- };
196
-
197
- /**
198
- * Check whether a schema successfully parses.
199
- * @param {Schema} schema
200
- * @returns {CheckParseAnswer}
201
- */
202
- module.exports.checkParseSchema = function(schema) {
203
- const ret = wasm.checkParseSchema(addHeapObject(schema));
204
- return takeObject(ret);
205
- };
206
-
207
- /**
208
- * Check whether a set of entities successfully parses.
209
- * @param {EntitiesParsingCall} call
210
- * @returns {CheckParseAnswer}
211
- */
212
- module.exports.checkParseEntities = function(call) {
213
- const ret = wasm.checkParseEntities(addHeapObject(call));
214
- return takeObject(ret);
215
- };
216
-
217
- /**
218
- * Check whether a context successfully parses.
219
- * @param {ContextParsingCall} call
220
- * @returns {CheckParseAnswer}
221
- */
222
- module.exports.checkParseContext = function(call) {
223
- const ret = wasm.checkParseContext(addHeapObject(call));
224
- return takeObject(ret);
225
- };
226
-
227
187
  /**
228
188
  * Apply the Cedar policy formatter to a policy set in the Cedar policy format
229
189
  * @param {FormattingCall} call
@@ -294,6 +254,46 @@ module.exports.schemaToJson = function(schema) {
294
254
  return takeObject(ret);
295
255
  };
296
256
 
257
+ /**
258
+ * Check whether a policy set successfully parses.
259
+ * @param {PolicySet} policies
260
+ * @returns {CheckParseAnswer}
261
+ */
262
+ module.exports.checkParsePolicySet = function(policies) {
263
+ const ret = wasm.checkParsePolicySet(addHeapObject(policies));
264
+ return takeObject(ret);
265
+ };
266
+
267
+ /**
268
+ * Check whether a schema successfully parses.
269
+ * @param {Schema} schema
270
+ * @returns {CheckParseAnswer}
271
+ */
272
+ module.exports.checkParseSchema = function(schema) {
273
+ const ret = wasm.checkParseSchema(addHeapObject(schema));
274
+ return takeObject(ret);
275
+ };
276
+
277
+ /**
278
+ * Check whether a set of entities successfully parses.
279
+ * @param {EntitiesParsingCall} call
280
+ * @returns {CheckParseAnswer}
281
+ */
282
+ module.exports.checkParseEntities = function(call) {
283
+ const ret = wasm.checkParseEntities(addHeapObject(call));
284
+ return takeObject(ret);
285
+ };
286
+
287
+ /**
288
+ * Check whether a context successfully parses.
289
+ * @param {ContextParsingCall} call
290
+ * @returns {CheckParseAnswer}
291
+ */
292
+ module.exports.checkParseContext = function(call) {
293
+ const ret = wasm.checkParseContext(addHeapObject(call));
294
+ return takeObject(ret);
295
+ };
296
+
297
297
  function handleError(f, args) {
298
298
  try {
299
299
  return f.apply(this, args);
Binary file
@@ -6,10 +6,6 @@ export function getValidRequestEnvsPolicy(a: number, b: number): number;
6
6
  export function getCedarVersion(a: number): void;
7
7
  export function isAuthorized(a: number): number;
8
8
  export function validate(a: number): number;
9
- export function checkParsePolicySet(a: number): number;
10
- export function checkParseSchema(a: number): number;
11
- export function checkParseEntities(a: number): number;
12
- export function checkParseContext(a: number): number;
13
9
  export function formatPolicies(a: number): number;
14
10
  export function policyToText(a: number): number;
15
11
  export function templateToText(a: number): number;
@@ -17,6 +13,10 @@ export function policyToJson(a: number): number;
17
13
  export function templateToJson(a: number): number;
18
14
  export function schemaToText(a: number): number;
19
15
  export function schemaToJson(a: number): number;
16
+ export function checkParsePolicySet(a: number): number;
17
+ export function checkParseSchema(a: number): number;
18
+ export function checkParseEntities(a: number): number;
19
+ export function checkParseContext(a: number): number;
20
20
  export function __wbindgen_malloc(a: number, b: number): number;
21
21
  export function __wbindgen_realloc(a: number, b: number, c: number, d: number): number;
22
22
  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": "4.1.0",
4
+ "version": "4.2.0",
5
5
  "license": "Apache-2.0",
6
6
  "files": [
7
7
  "cedar_wasm_bg.wasm",
package/package.json CHANGED
@@ -1,7 +1,8 @@
1
1
  {
2
2
  "name": "@cedar-policy/cedar-wasm",
3
+ "type": "module",
3
4
  "description": "Wasm bindings and typescript types for Cedar lib",
4
- "version": "4.1.0",
5
+ "version": "4.2.0",
5
6
  "license": "Apache-2.0",
6
7
  "files": [
7
8
  "esm/package.json",
@@ -24,11 +25,12 @@
24
25
  "web/cedar_wasm.js",
25
26
  "web/cedar_wasm.d.ts"
26
27
  ],
27
- "module": "esm/cedar_wasm.js",
28
+ "main": "cedar_wasm.js",
28
29
  "types": "esm/cedar_wasm.d.ts",
29
30
  "sideEffects": [
30
31
  "./snippets/*"
31
32
  ],
33
+ "module": "esm/cedar_wasm.js",
32
34
  "exports": {
33
35
  ".": {
34
36
  "import": "./esm/cedar_wasm.js",
@@ -36,6 +38,7 @@
36
38
  },
37
39
  "./nodejs": {
38
40
  "require": "./nodejs/cedar_wasm.js",
41
+ "import": "./nodejs/cedar_wasm.js",
39
42
  "types": "./nodejs/cedar_wasm.d.ts"
40
43
  },
41
44
  "./web": {
package/web/README.md CHANGED
@@ -28,7 +28,7 @@ console.log(cedar.getCedarVersion());
28
28
  Importing the esm version using esm async import:
29
29
 
30
30
  ```
31
- import('@cedar-policy/cedar-wasm')
31
+ import('@cedar-policy/cedar-wasm/nodejs')
32
32
  .then(cedar => console.log(cedar.getCedarVersion()));
33
33
  ```
34
34
 
@@ -34,30 +34,6 @@ export function isAuthorized(call: AuthorizationCall): AuthorizationAnswer;
34
34
  */
35
35
  export function validate(call: ValidationCall): ValidationAnswer;
36
36
  /**
37
- * Check whether a policy set successfully parses.
38
- * @param {PolicySet} policies
39
- * @returns {CheckParseAnswer}
40
- */
41
- export function checkParsePolicySet(policies: PolicySet): CheckParseAnswer;
42
- /**
43
- * Check whether a schema successfully parses.
44
- * @param {Schema} schema
45
- * @returns {CheckParseAnswer}
46
- */
47
- export function checkParseSchema(schema: Schema): CheckParseAnswer;
48
- /**
49
- * Check whether a set of entities successfully parses.
50
- * @param {EntitiesParsingCall} call
51
- * @returns {CheckParseAnswer}
52
- */
53
- export function checkParseEntities(call: EntitiesParsingCall): CheckParseAnswer;
54
- /**
55
- * Check whether a context successfully parses.
56
- * @param {ContextParsingCall} call
57
- * @returns {CheckParseAnswer}
58
- */
59
- export function checkParseContext(call: ContextParsingCall): CheckParseAnswer;
60
- /**
61
37
  * Apply the Cedar policy formatter to a policy set in the Cedar policy format
62
38
  * @param {FormattingCall} call
63
39
  * @returns {FormattingAnswer}
@@ -99,6 +75,30 @@ export function schemaToText(schema: Schema): SchemaToTextAnswer;
99
75
  * @returns {SchemaToJsonAnswer}
100
76
  */
101
77
  export function schemaToJson(schema: Schema): SchemaToJsonAnswer;
78
+ /**
79
+ * Check whether a policy set successfully parses.
80
+ * @param {PolicySet} policies
81
+ * @returns {CheckParseAnswer}
82
+ */
83
+ export function checkParsePolicySet(policies: PolicySet): CheckParseAnswer;
84
+ /**
85
+ * Check whether a schema successfully parses.
86
+ * @param {Schema} schema
87
+ * @returns {CheckParseAnswer}
88
+ */
89
+ export function checkParseSchema(schema: Schema): CheckParseAnswer;
90
+ /**
91
+ * Check whether a set of entities successfully parses.
92
+ * @param {EntitiesParsingCall} call
93
+ * @returns {CheckParseAnswer}
94
+ */
95
+ export function checkParseEntities(call: EntitiesParsingCall): CheckParseAnswer;
96
+ /**
97
+ * Check whether a context successfully parses.
98
+ * @param {ContextParsingCall} call
99
+ * @returns {CheckParseAnswer}
100
+ */
101
+ export function checkParseContext(call: ContextParsingCall): CheckParseAnswer;
102
102
  export type GetValidRequestEnvsResult = { type: "success"; principals: string[]; actions: string[]; resources: string[] } | { type: "failure"; error: string };
103
103
 
104
104
  export interface Response {
@@ -146,19 +146,6 @@ export interface ValidationError {
146
146
 
147
147
  export type ValidationAnswer = { type: "failure"; errors: DetailedError[]; warnings: DetailedError[] } | { type: "success"; validationErrors: ValidationError[]; validationWarnings: ValidationError[]; otherWarnings: DetailedError[] };
148
148
 
149
- export type CheckParseAnswer = { type: "success" } | { type: "failure"; errors: DetailedError[] };
150
-
151
- export interface EntitiesParsingCall {
152
- entities: Entities;
153
- schema?: Schema | null;
154
- }
155
-
156
- export interface ContextParsingCall {
157
- context: Context;
158
- schema?: Schema | null;
159
- action?: EntityUid | null;
160
- }
161
-
162
149
  export interface FormattingCall {
163
150
  policyText: string;
164
151
  lineWidth?: number;
@@ -175,6 +162,25 @@ export type SchemaToTextAnswer = { type: "success"; text: string; warnings: Deta
175
162
 
176
163
  export type SchemaToJsonAnswer = { type: "success"; json: SchemaJson<string>; warnings: DetailedError[] } | { type: "failure"; errors: DetailedError[] };
177
164
 
165
+ export type ValidationMode = "strict";
166
+
167
+ export type CheckParseAnswer = { type: "success" } | { type: "failure"; errors: DetailedError[] };
168
+
169
+ export interface EntitiesParsingCall {
170
+ entities: Entities;
171
+ schema?: Schema | null;
172
+ }
173
+
174
+ export interface ContextParsingCall {
175
+ context: Context;
176
+ schema?: Schema | null;
177
+ action?: EntityUid | null;
178
+ }
179
+
180
+ export type SlotId = string;
181
+
182
+ export type PolicyId = string;
183
+
178
184
  export type Schema = string | SchemaJson<string>;
179
185
 
180
186
  export interface PolicySet {
@@ -222,12 +228,6 @@ export interface DetailedError {
222
228
  related?: DetailedError[];
223
229
  }
224
230
 
225
- export type ValidationMode = "strict";
226
-
227
- export type SlotId = string;
228
-
229
- export type PolicyId = string;
230
-
231
231
  export type TypeVariant<N> = { type: "String" } | { type: "Long" } | { type: "Boolean" } | { type: "Set"; element: Type<N> } | ({ type: "Record" } & RecordType<N>) | { type: "Entity"; name: N } | { type: "EntityOrCommon"; name: N } | { type: "Extension"; name: UnreservedId };
232
232
 
233
233
  export interface RecordType<N> {
@@ -272,6 +272,8 @@ export type CommonTypeId = string;
272
272
 
273
273
  export type SchemaJson<N> = Record<string, NamespaceDefinition<N>>;
274
274
 
275
+ export type Decision = "allow" | "deny";
276
+
275
277
  export type Clause = { kind: "when"; body: Expr } | { kind: "unless"; body: Expr };
276
278
 
277
279
  export interface PolicyJson {
@@ -283,16 +285,15 @@ export interface PolicyJson {
283
285
  annotations?: Record<string, string>;
284
286
  }
285
287
 
286
- export interface EntityJson {
287
- uid: EntityUidJson;
288
- attrs: Record<string, CedarValueJson>;
289
- parents: EntityUidJson[];
290
- tags?: Record<string, CedarValueJson>;
291
- }
288
+ export type ExtFuncCall = {} & Record<string, Array<Expr>>;
292
289
 
293
- export type UnreservedId = string;
290
+ export type ExprNoExt = { Value: CedarValueJson } | { Var: Var } | { Slot: 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 } } | { getTag: { left: Expr; right: Expr } } | { hasTag: { left: Expr; right: Expr } } | { ".": { left: Expr; attr: SmolStr } } | { has: { left: Expr; attr: SmolStr } } | { like: { left: Expr; pattern: PatternElem[] } } | { is: { left: Expr; entity_type: SmolStr; in?: Expr } } | { "if-then-else": { if: Expr; then: Expr; else: Expr } } | { Set: Expr[] } | { Record: Record<string, Expr> };
294
291
 
295
- export type Var = "principal" | "action" | "resource" | "context";
292
+ export type PatternElem = "Wildcard" | { Literal: SmolStr };
293
+
294
+ export type Expr = ExprNoExt | ExtFuncCall;
295
+
296
+ export type Effect = "permit" | "forbid";
296
297
 
297
298
  export type ActionInConstraint = { entity: EntityUidJson } | { entities: EntityUidJson[] };
298
299
 
@@ -311,7 +312,12 @@ export type ActionConstraint = { op: "All" } | ({ op: "==" } & EqConstraint) | (
311
312
 
312
313
  export type PrincipalConstraint = { op: "All" } | ({ op: "==" } & EqConstraint) | ({ op: "in" } & PrincipalOrResourceInConstraint) | ({ op: "is" } & PrincipalOrResourceIsConstraint);
313
314
 
314
- export type Decision = "allow" | "deny";
315
+ export interface EntityJson {
316
+ uid: EntityUidJson;
317
+ attrs: Record<string, CedarValueJson>;
318
+ parents: EntityUidJson[];
319
+ tags?: Record<string, CedarValueJson>;
320
+ }
315
321
 
316
322
  export type EntityUidJson = { __entity: TypeAndId } | TypeAndId;
317
323
 
@@ -327,15 +333,9 @@ export interface TypeAndId {
327
333
 
328
334
  export type CedarValueJson = { __entity: TypeAndId } | { __extn: FnAndArg } | boolean | number | string | CedarValueJson[] | { [key: string]: CedarValueJson } | null;
329
335
 
330
- export type ExtFuncCall = {} & Record<string, Array<Expr>>;
331
-
332
- export type ExprNoExt = { Value: CedarValueJson } | { Var: Var } | { Slot: 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 } } | { getTag: { left: Expr; right: Expr } } | { hasTag: { left: Expr; right: Expr } } | { ".": { left: Expr; attr: SmolStr } } | { has: { left: Expr; attr: SmolStr } } | { like: { left: Expr; pattern: PatternElem[] } } | { is: { left: Expr; entity_type: SmolStr; in?: Expr } } | { "if-then-else": { if: Expr; then: Expr; else: Expr } } | { Set: Expr[] } | { Record: Record<string, Expr> };
333
-
334
- export type PatternElem = "Wildcard" | { Literal: SmolStr };
335
-
336
- export type Expr = ExprNoExt | ExtFuncCall;
336
+ export type UnreservedId = string;
337
337
 
338
- export type Effect = "permit" | "forbid";
338
+ export type Var = "principal" | "action" | "resource" | "context";
339
339
 
340
340
 
341
341
  export type InitInput = RequestInfo | URL | Response | BufferSource | WebAssembly.Module;
@@ -347,10 +347,6 @@ export interface InitOutput {
347
347
  readonly getCedarVersion: (a: number) => void;
348
348
  readonly isAuthorized: (a: number) => number;
349
349
  readonly validate: (a: number) => number;
350
- readonly checkParsePolicySet: (a: number) => number;
351
- readonly checkParseSchema: (a: number) => number;
352
- readonly checkParseEntities: (a: number) => number;
353
- readonly checkParseContext: (a: number) => number;
354
350
  readonly formatPolicies: (a: number) => number;
355
351
  readonly policyToText: (a: number) => number;
356
352
  readonly templateToText: (a: number) => number;
@@ -358,6 +354,10 @@ export interface InitOutput {
358
354
  readonly templateToJson: (a: number) => number;
359
355
  readonly schemaToText: (a: number) => number;
360
356
  readonly schemaToJson: (a: number) => number;
357
+ readonly checkParsePolicySet: (a: number) => number;
358
+ readonly checkParseSchema: (a: number) => number;
359
+ readonly checkParseEntities: (a: number) => number;
360
+ readonly checkParseContext: (a: number) => number;
361
361
  readonly __wbindgen_malloc: (a: number, b: number) => number;
362
362
  readonly __wbindgen_realloc: (a: number, b: number, c: number, d: number) => number;
363
363
  readonly __wbindgen_add_to_stack_pointer: (a: number) => number;
package/web/cedar_wasm.js CHANGED
@@ -180,46 +180,6 @@ export function validate(call) {
180
180
  return takeObject(ret);
181
181
  }
182
182
 
183
- /**
184
- * Check whether a policy set successfully parses.
185
- * @param {PolicySet} policies
186
- * @returns {CheckParseAnswer}
187
- */
188
- export function checkParsePolicySet(policies) {
189
- const ret = wasm.checkParsePolicySet(addHeapObject(policies));
190
- return takeObject(ret);
191
- }
192
-
193
- /**
194
- * Check whether a schema successfully parses.
195
- * @param {Schema} schema
196
- * @returns {CheckParseAnswer}
197
- */
198
- export function checkParseSchema(schema) {
199
- const ret = wasm.checkParseSchema(addHeapObject(schema));
200
- return takeObject(ret);
201
- }
202
-
203
- /**
204
- * Check whether a set of entities successfully parses.
205
- * @param {EntitiesParsingCall} call
206
- * @returns {CheckParseAnswer}
207
- */
208
- export function checkParseEntities(call) {
209
- const ret = wasm.checkParseEntities(addHeapObject(call));
210
- return takeObject(ret);
211
- }
212
-
213
- /**
214
- * Check whether a context successfully parses.
215
- * @param {ContextParsingCall} call
216
- * @returns {CheckParseAnswer}
217
- */
218
- export function checkParseContext(call) {
219
- const ret = wasm.checkParseContext(addHeapObject(call));
220
- return takeObject(ret);
221
- }
222
-
223
183
  /**
224
184
  * Apply the Cedar policy formatter to a policy set in the Cedar policy format
225
185
  * @param {FormattingCall} call
@@ -290,6 +250,46 @@ export function schemaToJson(schema) {
290
250
  return takeObject(ret);
291
251
  }
292
252
 
253
+ /**
254
+ * Check whether a policy set successfully parses.
255
+ * @param {PolicySet} policies
256
+ * @returns {CheckParseAnswer}
257
+ */
258
+ export function checkParsePolicySet(policies) {
259
+ const ret = wasm.checkParsePolicySet(addHeapObject(policies));
260
+ return takeObject(ret);
261
+ }
262
+
263
+ /**
264
+ * Check whether a schema successfully parses.
265
+ * @param {Schema} schema
266
+ * @returns {CheckParseAnswer}
267
+ */
268
+ export function checkParseSchema(schema) {
269
+ const ret = wasm.checkParseSchema(addHeapObject(schema));
270
+ return takeObject(ret);
271
+ }
272
+
273
+ /**
274
+ * Check whether a set of entities successfully parses.
275
+ * @param {EntitiesParsingCall} call
276
+ * @returns {CheckParseAnswer}
277
+ */
278
+ export function checkParseEntities(call) {
279
+ const ret = wasm.checkParseEntities(addHeapObject(call));
280
+ return takeObject(ret);
281
+ }
282
+
283
+ /**
284
+ * Check whether a context successfully parses.
285
+ * @param {ContextParsingCall} call
286
+ * @returns {CheckParseAnswer}
287
+ */
288
+ export function checkParseContext(call) {
289
+ const ret = wasm.checkParseContext(addHeapObject(call));
290
+ return takeObject(ret);
291
+ }
292
+
293
293
  function handleError(f, args) {
294
294
  try {
295
295
  return f.apply(this, args);
Binary file
@@ -6,10 +6,6 @@ export function getValidRequestEnvsPolicy(a: number, b: number): number;
6
6
  export function getCedarVersion(a: number): void;
7
7
  export function isAuthorized(a: number): number;
8
8
  export function validate(a: number): number;
9
- export function checkParsePolicySet(a: number): number;
10
- export function checkParseSchema(a: number): number;
11
- export function checkParseEntities(a: number): number;
12
- export function checkParseContext(a: number): number;
13
9
  export function formatPolicies(a: number): number;
14
10
  export function policyToText(a: number): number;
15
11
  export function templateToText(a: number): number;
@@ -17,6 +13,10 @@ export function policyToJson(a: number): number;
17
13
  export function templateToJson(a: number): number;
18
14
  export function schemaToText(a: number): number;
19
15
  export function schemaToJson(a: number): number;
16
+ export function checkParsePolicySet(a: number): number;
17
+ export function checkParseSchema(a: number): number;
18
+ export function checkParseEntities(a: number): number;
19
+ export function checkParseContext(a: number): number;
20
20
  export function __wbindgen_malloc(a: number, b: number): number;
21
21
  export function __wbindgen_realloc(a: number, b: number, c: number, d: number): number;
22
22
  export function __wbindgen_add_to_stack_pointer(a: number): number;
package/web/package.json CHANGED
@@ -1,17 +1,17 @@
1
1
  {
2
2
  "name": "@cedar-policy/cedar-wasm",
3
+ "type": "module",
3
4
  "description": "Wasm bindings and typescript types for Cedar lib",
4
- "version": "4.1.0",
5
+ "version": "4.2.0",
5
6
  "license": "Apache-2.0",
6
7
  "files": [
7
8
  "cedar_wasm_bg.wasm",
8
9
  "cedar_wasm.js",
9
10
  "cedar_wasm.d.ts"
10
11
  ],
11
- "module": "cedar_wasm.js",
12
+ "main": "cedar_wasm.js",
12
13
  "types": "cedar_wasm.d.ts",
13
14
  "sideEffects": [
14
15
  "./snippets/*"
15
- ],
16
- "type": "module"
16
+ ]
17
17
  }