@cedar-policy/cedar-wasm 4.2.0 → 4.2.2

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.
@@ -1,106 +1,128 @@
1
1
  /* tslint:disable */
2
2
  /* eslint-disable */
3
3
  /**
4
- * Get valid request environment
5
- * @param {Template} t
6
- * @param {Schema} s
7
- * @returns {GetValidRequestEnvsResult}
8
- */
4
+ * Get valid request environment
5
+ * @param {Template} t
6
+ * @param {Schema} s
7
+ * @returns {GetValidRequestEnvsResult}
8
+ */
9
9
  export function getValidRequestEnvsTemplate(t: Template, s: Schema): GetValidRequestEnvsResult;
10
10
  /**
11
- * Get valid request environment
12
- * @param {Policy} t
13
- * @param {Schema} s
14
- * @returns {GetValidRequestEnvsResult}
15
- */
11
+ * Get valid request environment
12
+ * @param {Policy} t
13
+ * @param {Schema} s
14
+ * @returns {GetValidRequestEnvsResult}
15
+ */
16
16
  export function getValidRequestEnvsPolicy(t: Policy, s: Schema): GetValidRequestEnvsResult;
17
17
  /**
18
- * @returns {string}
19
- */
18
+ * @returns {string}
19
+ */
20
20
  export function getCedarVersion(): string;
21
21
  /**
22
- * Basic interface, using [`AuthorizationCall`] and [`AuthorizationAnswer`] types
23
- * @param {AuthorizationCall} call
24
- * @returns {AuthorizationAnswer}
25
- */
26
- export function isAuthorized(call: AuthorizationCall): AuthorizationAnswer;
27
- /**
28
- * Parse a policy set and optionally validate it against a provided schema
29
- *
30
- * This is the basic validator interface, using [`ValidationCall`] and
31
- * [`ValidationAnswer`] types
32
- * @param {ValidationCall} call
33
- * @returns {ValidationAnswer}
34
- */
35
- export function validate(call: ValidationCall): ValidationAnswer;
36
- /**
37
- * Apply the Cedar policy formatter to a policy set in the Cedar policy format
38
- * @param {FormattingCall} call
39
- * @returns {FormattingAnswer}
40
- */
22
+ * Apply the Cedar policy formatter to a policy set in the Cedar policy format
23
+ * @param {FormattingCall} call
24
+ * @returns {FormattingAnswer}
25
+ */
41
26
  export function formatPolicies(call: FormattingCall): FormattingAnswer;
42
27
  /**
43
- * Return the Cedar (textual) representation of a policy.
44
- * @param {Policy} policy
45
- * @returns {PolicyToTextAnswer}
46
- */
28
+ * Return the Cedar (textual) representation of a policy.
29
+ * @param {Policy} policy
30
+ * @returns {PolicyToTextAnswer}
31
+ */
47
32
  export function policyToText(policy: Policy): PolicyToTextAnswer;
48
33
  /**
49
- * Return the Cedar (textual) representation of a template.
50
- * @param {Template} template
51
- * @returns {PolicyToTextAnswer}
52
- */
34
+ * Return the Cedar (textual) representation of a template.
35
+ * @param {Template} template
36
+ * @returns {PolicyToTextAnswer}
37
+ */
53
38
  export function templateToText(template: Template): PolicyToTextAnswer;
54
39
  /**
55
- * Return the JSON representation of a policy.
56
- * @param {Policy} policy
57
- * @returns {PolicyToJsonAnswer}
58
- */
40
+ * Return the JSON representation of a policy.
41
+ * @param {Policy} policy
42
+ * @returns {PolicyToJsonAnswer}
43
+ */
59
44
  export function policyToJson(policy: Policy): PolicyToJsonAnswer;
60
45
  /**
61
- * Return the JSON representation of a template.
62
- * @param {Template} template
63
- * @returns {PolicyToJsonAnswer}
64
- */
46
+ * Return the JSON representation of a template.
47
+ * @param {Template} template
48
+ * @returns {PolicyToJsonAnswer}
49
+ */
65
50
  export function templateToJson(template: Template): PolicyToJsonAnswer;
66
51
  /**
67
- * Return the Cedar (textual) representation of a schema.
68
- * @param {Schema} schema
69
- * @returns {SchemaToTextAnswer}
70
- */
52
+ * Return the Cedar (textual) representation of a schema.
53
+ * @param {Schema} schema
54
+ * @returns {SchemaToTextAnswer}
55
+ */
71
56
  export function schemaToText(schema: Schema): SchemaToTextAnswer;
72
57
  /**
73
- * Return the JSON representation of a schema.
74
- * @param {Schema} schema
75
- * @returns {SchemaToJsonAnswer}
76
- */
58
+ * Return the JSON representation of a schema.
59
+ * @param {Schema} schema
60
+ * @returns {SchemaToJsonAnswer}
61
+ */
77
62
  export function schemaToJson(schema: Schema): SchemaToJsonAnswer;
78
63
  /**
79
- * Check whether a policy set successfully parses.
80
- * @param {PolicySet} policies
81
- * @returns {CheckParseAnswer}
82
- */
64
+ * Basic interface, using [`AuthorizationCall`] and [`AuthorizationAnswer`] types
65
+ * @param {AuthorizationCall} call
66
+ * @returns {AuthorizationAnswer}
67
+ */
68
+ export function isAuthorized(call: AuthorizationCall): AuthorizationAnswer;
69
+ /**
70
+ * Parse a policy set and optionally validate it against a provided schema
71
+ *
72
+ * This is the basic validator interface, using [`ValidationCall`] and
73
+ * [`ValidationAnswer`] types
74
+ * @param {ValidationCall} call
75
+ * @returns {ValidationAnswer}
76
+ */
77
+ export function validate(call: ValidationCall): ValidationAnswer;
78
+ /**
79
+ * Check whether a policy set successfully parses.
80
+ * @param {PolicySet} policies
81
+ * @returns {CheckParseAnswer}
82
+ */
83
83
  export function checkParsePolicySet(policies: PolicySet): CheckParseAnswer;
84
84
  /**
85
- * Check whether a schema successfully parses.
86
- * @param {Schema} schema
87
- * @returns {CheckParseAnswer}
88
- */
85
+ * Check whether a schema successfully parses.
86
+ * @param {Schema} schema
87
+ * @returns {CheckParseAnswer}
88
+ */
89
89
  export function checkParseSchema(schema: Schema): CheckParseAnswer;
90
90
  /**
91
- * Check whether a set of entities successfully parses.
92
- * @param {EntitiesParsingCall} call
93
- * @returns {CheckParseAnswer}
94
- */
91
+ * Check whether a set of entities successfully parses.
92
+ * @param {EntitiesParsingCall} call
93
+ * @returns {CheckParseAnswer}
94
+ */
95
95
  export function checkParseEntities(call: EntitiesParsingCall): CheckParseAnswer;
96
96
  /**
97
- * Check whether a context successfully parses.
98
- * @param {ContextParsingCall} call
99
- * @returns {CheckParseAnswer}
100
- */
97
+ * Check whether a context successfully parses.
98
+ * @param {ContextParsingCall} call
99
+ * @returns {CheckParseAnswer}
100
+ */
101
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
+ export type SlotId = string;
105
+
106
+ export type PolicyId = string;
107
+
108
+ export type ValidationMode = "strict";
109
+
110
+ export interface FormattingCall {
111
+ policyText: string;
112
+ lineWidth?: number;
113
+ indentWidth?: number;
114
+ }
115
+
116
+ export type FormattingAnswer = { type: "failure"; errors: DetailedError[] } | { type: "success"; formatted_policy: string };
117
+
118
+ export type PolicyToTextAnswer = { type: "success"; text: string } | { type: "failure"; errors: DetailedError[] };
119
+
120
+ export type PolicyToJsonAnswer = { type: "success"; json: PolicyJson } | { type: "failure"; errors: DetailedError[] };
121
+
122
+ export type SchemaToTextAnswer = { type: "success"; text: string; warnings: DetailedError[] } | { type: "failure"; errors: DetailedError[] };
123
+
124
+ export type SchemaToJsonAnswer = { type: "success"; json: SchemaJson<string>; warnings: DetailedError[] } | { type: "failure"; errors: DetailedError[] };
125
+
104
126
  export interface Response {
105
127
  decision: Decision;
106
128
  diagnostics: Diagnostics;
@@ -146,24 +168,6 @@ export interface ValidationError {
146
168
 
147
169
  export type ValidationAnswer = { type: "failure"; errors: DetailedError[]; warnings: DetailedError[] } | { type: "success"; validationErrors: ValidationError[]; validationWarnings: ValidationError[]; otherWarnings: DetailedError[] };
148
170
 
149
- export interface FormattingCall {
150
- policyText: string;
151
- lineWidth?: number;
152
- indentWidth?: number;
153
- }
154
-
155
- export type FormattingAnswer = { type: "failure"; errors: DetailedError[] } | { type: "success"; formatted_policy: string };
156
-
157
- export type PolicyToTextAnswer = { type: "success"; text: string } | { type: "failure"; errors: DetailedError[] };
158
-
159
- export type PolicyToJsonAnswer = { type: "success"; json: PolicyJson } | { type: "failure"; errors: DetailedError[] };
160
-
161
- export type SchemaToTextAnswer = { type: "success"; text: string; warnings: DetailedError[] } | { type: "failure"; errors: DetailedError[] };
162
-
163
- export type SchemaToJsonAnswer = { type: "success"; json: SchemaJson<string>; warnings: DetailedError[] } | { type: "failure"; errors: DetailedError[] };
164
-
165
- export type ValidationMode = "strict";
166
-
167
171
  export type CheckParseAnswer = { type: "success" } | { type: "failure"; errors: DetailedError[] };
168
172
 
169
173
  export interface EntitiesParsingCall {
@@ -177,10 +181,6 @@ export interface ContextParsingCall {
177
181
  action?: EntityUid | null;
178
182
  }
179
183
 
180
- export type SlotId = string;
181
-
182
- export type PolicyId = string;
183
-
184
184
  export type Schema = string | SchemaJson<string>;
185
185
 
186
186
  export interface PolicySet {
@@ -272,8 +272,6 @@ 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
-
277
275
  export type Clause = { kind: "when"; body: Expr } | { kind: "unless"; body: Expr };
278
276
 
279
277
  export interface PolicyJson {
@@ -285,39 +283,28 @@ export interface PolicyJson {
285
283
  annotations?: Record<string, string>;
286
284
  }
287
285
 
288
- export type ExtFuncCall = {} & Record<string, Array<Expr>>;
289
-
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> };
291
-
292
- export type PatternElem = "Wildcard" | { Literal: SmolStr };
293
-
294
- export type Expr = ExprNoExt | ExtFuncCall;
295
-
296
286
  export type Effect = "permit" | "forbid";
297
287
 
298
- export type ActionInConstraint = { entity: EntityUidJson } | { entities: EntityUidJson[] };
288
+ export type UnreservedId = string;
299
289
 
300
- export interface PrincipalOrResourceIsConstraint {
301
- entity_type: string;
302
- in?: PrincipalOrResourceInConstraint;
290
+ export interface EntityJson {
291
+ uid: EntityUidJson;
292
+ attrs: Record<string, CedarValueJson>;
293
+ parents: EntityUidJson[];
294
+ tags?: Record<string, CedarValueJson>;
303
295
  }
304
296
 
305
- export type PrincipalOrResourceInConstraint = { entity: EntityUidJson } | { slot: string };
297
+ export type Decision = "allow" | "deny";
306
298
 
307
- export type EqConstraint = { entity: EntityUidJson } | { slot: string };
299
+ export type Var = "principal" | "action" | "resource" | "context";
308
300
 
309
- export type ResourceConstraint = { op: "All" } | ({ op: "==" } & EqConstraint) | ({ op: "in" } & PrincipalOrResourceInConstraint) | ({ op: "is" } & PrincipalOrResourceIsConstraint);
301
+ export type ExtFuncCall = {} & Record<string, Array<Expr>>;
310
302
 
311
- export type ActionConstraint = { op: "All" } | ({ op: "==" } & EqConstraint) | ({ op: "in" } & ActionInConstraint);
303
+ 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> };
312
304
 
313
- export type PrincipalConstraint = { op: "All" } | ({ op: "==" } & EqConstraint) | ({ op: "in" } & PrincipalOrResourceInConstraint) | ({ op: "is" } & PrincipalOrResourceIsConstraint);
305
+ export type PatternElem = "Wildcard" | { Literal: SmolStr };
314
306
 
315
- export interface EntityJson {
316
- uid: EntityUidJson;
317
- attrs: Record<string, CedarValueJson>;
318
- parents: EntityUidJson[];
319
- tags?: Record<string, CedarValueJson>;
320
- }
307
+ export type Expr = ExprNoExt | ExtFuncCall;
321
308
 
322
309
  export type EntityUidJson = { __entity: TypeAndId } | TypeAndId;
323
310
 
@@ -333,9 +320,22 @@ export interface TypeAndId {
333
320
 
334
321
  export type CedarValueJson = { __entity: TypeAndId } | { __extn: FnAndArg } | boolean | number | string | CedarValueJson[] | { [key: string]: CedarValueJson } | null;
335
322
 
336
- export type UnreservedId = string;
323
+ export type ActionInConstraint = { entity: EntityUidJson } | { entities: EntityUidJson[] };
337
324
 
338
- export type Var = "principal" | "action" | "resource" | "context";
325
+ export interface PrincipalOrResourceIsConstraint {
326
+ entity_type: string;
327
+ in?: PrincipalOrResourceInConstraint;
328
+ }
329
+
330
+ export type PrincipalOrResourceInConstraint = { entity: EntityUidJson } | { slot: string };
331
+
332
+ export type EqConstraint = { entity: EntityUidJson } | { slot: string };
333
+
334
+ export type ResourceConstraint = { op: "All" } | ({ op: "==" } & EqConstraint) | ({ op: "in" } & PrincipalOrResourceInConstraint) | ({ op: "is" } & PrincipalOrResourceIsConstraint);
335
+
336
+ export type ActionConstraint = { op: "All" } | ({ op: "==" } & EqConstraint) | ({ op: "in" } & ActionInConstraint);
337
+
338
+ export type PrincipalConstraint = { op: "All" } | ({ op: "==" } & EqConstraint) | ({ op: "in" } & PrincipalOrResourceInConstraint) | ({ op: "is" } & PrincipalOrResourceIsConstraint);
339
339
 
340
340
  type SmolStr = string;
341
341
  export type TypeOfAttribute<N> = Type<N> & { required?: boolean };
package/esm/cedar_wasm.js CHANGED
@@ -1,5 +1,4 @@
1
-
2
1
  import * as wasm from "./cedar_wasm_bg.wasm";
3
- import { __wbg_set_wasm } from "./cedar_wasm_bg.js";
4
- __wbg_set_wasm(wasm);
5
2
  export * from "./cedar_wasm_bg.js";
3
+ import { __wbg_set_wasm } from "./cedar_wasm_bg.js";
4
+ __wbg_set_wasm(wasm);
@@ -124,30 +124,30 @@ function getStringFromWasm0(ptr, len) {
124
124
  return cachedTextDecoder.decode(getUint8ArrayMemory0().subarray(ptr, ptr + len));
125
125
  }
126
126
  /**
127
- * Get valid request environment
128
- * @param {Template} t
129
- * @param {Schema} s
130
- * @returns {GetValidRequestEnvsResult}
131
- */
127
+ * Get valid request environment
128
+ * @param {Template} t
129
+ * @param {Schema} s
130
+ * @returns {GetValidRequestEnvsResult}
131
+ */
132
132
  export function getValidRequestEnvsTemplate(t, s) {
133
133
  const ret = wasm.getValidRequestEnvsTemplate(addHeapObject(t), addHeapObject(s));
134
134
  return takeObject(ret);
135
135
  }
136
136
 
137
137
  /**
138
- * Get valid request environment
139
- * @param {Policy} t
140
- * @param {Schema} s
141
- * @returns {GetValidRequestEnvsResult}
142
- */
138
+ * Get valid request environment
139
+ * @param {Policy} t
140
+ * @param {Schema} s
141
+ * @returns {GetValidRequestEnvsResult}
142
+ */
143
143
  export function getValidRequestEnvsPolicy(t, s) {
144
144
  const ret = wasm.getValidRequestEnvsPolicy(addHeapObject(t), addHeapObject(s));
145
145
  return takeObject(ret);
146
146
  }
147
147
 
148
148
  /**
149
- * @returns {string}
150
- */
149
+ * @returns {string}
150
+ */
151
151
  export function getCedarVersion() {
152
152
  let deferred1_0;
153
153
  let deferred1_1;
@@ -166,133 +166,133 @@ export function getCedarVersion() {
166
166
  }
167
167
 
168
168
  /**
169
- * Basic interface, using [`AuthorizationCall`] and [`AuthorizationAnswer`] types
170
- * @param {AuthorizationCall} call
171
- * @returns {AuthorizationAnswer}
172
- */
173
- export function isAuthorized(call) {
174
- const ret = wasm.isAuthorized(addHeapObject(call));
175
- return takeObject(ret);
176
- }
177
-
178
- /**
179
- * Parse a policy set and optionally validate it against a provided schema
180
- *
181
- * This is the basic validator interface, using [`ValidationCall`] and
182
- * [`ValidationAnswer`] types
183
- * @param {ValidationCall} call
184
- * @returns {ValidationAnswer}
185
- */
186
- export function validate(call) {
187
- const ret = wasm.validate(addHeapObject(call));
188
- return takeObject(ret);
189
- }
190
-
191
- /**
192
- * Apply the Cedar policy formatter to a policy set in the Cedar policy format
193
- * @param {FormattingCall} call
194
- * @returns {FormattingAnswer}
195
- */
169
+ * Apply the Cedar policy formatter to a policy set in the Cedar policy format
170
+ * @param {FormattingCall} call
171
+ * @returns {FormattingAnswer}
172
+ */
196
173
  export function formatPolicies(call) {
197
174
  const ret = wasm.formatPolicies(addHeapObject(call));
198
175
  return takeObject(ret);
199
176
  }
200
177
 
201
178
  /**
202
- * Return the Cedar (textual) representation of a policy.
203
- * @param {Policy} policy
204
- * @returns {PolicyToTextAnswer}
205
- */
179
+ * Return the Cedar (textual) representation of a policy.
180
+ * @param {Policy} policy
181
+ * @returns {PolicyToTextAnswer}
182
+ */
206
183
  export function policyToText(policy) {
207
184
  const ret = wasm.policyToText(addHeapObject(policy));
208
185
  return takeObject(ret);
209
186
  }
210
187
 
211
188
  /**
212
- * Return the Cedar (textual) representation of a template.
213
- * @param {Template} template
214
- * @returns {PolicyToTextAnswer}
215
- */
189
+ * Return the Cedar (textual) representation of a template.
190
+ * @param {Template} template
191
+ * @returns {PolicyToTextAnswer}
192
+ */
216
193
  export function templateToText(template) {
217
194
  const ret = wasm.templateToText(addHeapObject(template));
218
195
  return takeObject(ret);
219
196
  }
220
197
 
221
198
  /**
222
- * Return the JSON representation of a policy.
223
- * @param {Policy} policy
224
- * @returns {PolicyToJsonAnswer}
225
- */
199
+ * Return the JSON representation of a policy.
200
+ * @param {Policy} policy
201
+ * @returns {PolicyToJsonAnswer}
202
+ */
226
203
  export function policyToJson(policy) {
227
204
  const ret = wasm.policyToJson(addHeapObject(policy));
228
205
  return takeObject(ret);
229
206
  }
230
207
 
231
208
  /**
232
- * Return the JSON representation of a template.
233
- * @param {Template} template
234
- * @returns {PolicyToJsonAnswer}
235
- */
209
+ * Return the JSON representation of a template.
210
+ * @param {Template} template
211
+ * @returns {PolicyToJsonAnswer}
212
+ */
236
213
  export function templateToJson(template) {
237
214
  const ret = wasm.templateToJson(addHeapObject(template));
238
215
  return takeObject(ret);
239
216
  }
240
217
 
241
218
  /**
242
- * Return the Cedar (textual) representation of a schema.
243
- * @param {Schema} schema
244
- * @returns {SchemaToTextAnswer}
245
- */
219
+ * Return the Cedar (textual) representation of a schema.
220
+ * @param {Schema} schema
221
+ * @returns {SchemaToTextAnswer}
222
+ */
246
223
  export function schemaToText(schema) {
247
224
  const ret = wasm.schemaToText(addHeapObject(schema));
248
225
  return takeObject(ret);
249
226
  }
250
227
 
251
228
  /**
252
- * Return the JSON representation of a schema.
253
- * @param {Schema} schema
254
- * @returns {SchemaToJsonAnswer}
255
- */
229
+ * Return the JSON representation of a schema.
230
+ * @param {Schema} schema
231
+ * @returns {SchemaToJsonAnswer}
232
+ */
256
233
  export function schemaToJson(schema) {
257
234
  const ret = wasm.schemaToJson(addHeapObject(schema));
258
235
  return takeObject(ret);
259
236
  }
260
237
 
261
238
  /**
262
- * Check whether a policy set successfully parses.
263
- * @param {PolicySet} policies
264
- * @returns {CheckParseAnswer}
265
- */
239
+ * Basic interface, using [`AuthorizationCall`] and [`AuthorizationAnswer`] types
240
+ * @param {AuthorizationCall} call
241
+ * @returns {AuthorizationAnswer}
242
+ */
243
+ export function isAuthorized(call) {
244
+ const ret = wasm.isAuthorized(addHeapObject(call));
245
+ return takeObject(ret);
246
+ }
247
+
248
+ /**
249
+ * Parse a policy set and optionally validate it against a provided schema
250
+ *
251
+ * This is the basic validator interface, using [`ValidationCall`] and
252
+ * [`ValidationAnswer`] types
253
+ * @param {ValidationCall} call
254
+ * @returns {ValidationAnswer}
255
+ */
256
+ export function validate(call) {
257
+ const ret = wasm.validate(addHeapObject(call));
258
+ return takeObject(ret);
259
+ }
260
+
261
+ /**
262
+ * Check whether a policy set successfully parses.
263
+ * @param {PolicySet} policies
264
+ * @returns {CheckParseAnswer}
265
+ */
266
266
  export function checkParsePolicySet(policies) {
267
267
  const ret = wasm.checkParsePolicySet(addHeapObject(policies));
268
268
  return takeObject(ret);
269
269
  }
270
270
 
271
271
  /**
272
- * Check whether a schema successfully parses.
273
- * @param {Schema} schema
274
- * @returns {CheckParseAnswer}
275
- */
272
+ * Check whether a schema successfully parses.
273
+ * @param {Schema} schema
274
+ * @returns {CheckParseAnswer}
275
+ */
276
276
  export function checkParseSchema(schema) {
277
277
  const ret = wasm.checkParseSchema(addHeapObject(schema));
278
278
  return takeObject(ret);
279
279
  }
280
280
 
281
281
  /**
282
- * Check whether a set of entities successfully parses.
283
- * @param {EntitiesParsingCall} call
284
- * @returns {CheckParseAnswer}
285
- */
282
+ * Check whether a set of entities successfully parses.
283
+ * @param {EntitiesParsingCall} call
284
+ * @returns {CheckParseAnswer}
285
+ */
286
286
  export function checkParseEntities(call) {
287
287
  const ret = wasm.checkParseEntities(addHeapObject(call));
288
288
  return takeObject(ret);
289
289
  }
290
290
 
291
291
  /**
292
- * Check whether a context successfully parses.
293
- * @param {ContextParsingCall} call
294
- * @returns {CheckParseAnswer}
295
- */
292
+ * Check whether a context successfully parses.
293
+ * @param {ContextParsingCall} call
294
+ * @returns {CheckParseAnswer}
295
+ */
296
296
  export function checkParseContext(call) {
297
297
  const ret = wasm.checkParseContext(addHeapObject(call));
298
298
  return takeObject(ret);
@@ -329,12 +329,12 @@ export function __wbindgen_string_get(arg0, arg1) {
329
329
  getDataViewMemory0().setInt32(arg0 + 4 * 0, ptr1, true);
330
330
  };
331
331
 
332
- export function __wbg_parse_52202f117ec9ecfa() { return handleError(function (arg0, arg1) {
332
+ export function __wbg_parse_51ee5409072379d3() { return handleError(function (arg0, arg1) {
333
333
  const ret = JSON.parse(getStringFromWasm0(arg0, arg1));
334
334
  return addHeapObject(ret);
335
335
  }, arguments) };
336
336
 
337
- export function __wbg_stringify_bbf45426c92a6bf5() { return handleError(function (arg0) {
337
+ export function __wbg_stringify_eead5648c09faaf8() { return handleError(function (arg0) {
338
338
  const ret = JSON.stringify(getObject(arg0));
339
339
  return addHeapObject(ret);
340
340
  }, arguments) };
Binary file
@@ -4,8 +4,6 @@ export const memory: WebAssembly.Memory;
4
4
  export function getValidRequestEnvsTemplate(a: number, b: number): number;
5
5
  export function getValidRequestEnvsPolicy(a: number, b: number): number;
6
6
  export function getCedarVersion(a: number): void;
7
- export function isAuthorized(a: number): number;
8
- export function validate(a: number): number;
9
7
  export function formatPolicies(a: number): number;
10
8
  export function policyToText(a: number): number;
11
9
  export function templateToText(a: number): number;
@@ -13,6 +11,8 @@ export function policyToJson(a: number): number;
13
11
  export function templateToJson(a: number): number;
14
12
  export function schemaToText(a: number): number;
15
13
  export function schemaToJson(a: number): number;
14
+ export function isAuthorized(a: number): number;
15
+ export function validate(a: number): number;
16
16
  export function checkParsePolicySet(a: number): number;
17
17
  export function checkParseSchema(a: number): number;
18
18
  export function checkParseEntities(a: number): number;
package/esm/package.json CHANGED
@@ -2,7 +2,7 @@
2
2
  "name": "@cedar-policy/cedar-wasm",
3
3
  "type": "module",
4
4
  "description": "Wasm bindings and typescript types for Cedar lib",
5
- "version": "4.2.0",
5
+ "version": "4.2.2",
6
6
  "license": "Apache-2.0",
7
7
  "files": [
8
8
  "cedar_wasm_bg.wasm",