@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 };
@@ -120,30 +120,30 @@ function getStringFromWasm0(ptr, len) {
120
120
  return cachedTextDecoder.decode(getUint8ArrayMemory0().subarray(ptr, ptr + len));
121
121
  }
122
122
  /**
123
- * Get valid request environment
124
- * @param {Template} t
125
- * @param {Schema} s
126
- * @returns {GetValidRequestEnvsResult}
127
- */
123
+ * Get valid request environment
124
+ * @param {Template} t
125
+ * @param {Schema} s
126
+ * @returns {GetValidRequestEnvsResult}
127
+ */
128
128
  module.exports.getValidRequestEnvsTemplate = function(t, s) {
129
129
  const ret = wasm.getValidRequestEnvsTemplate(addHeapObject(t), addHeapObject(s));
130
130
  return takeObject(ret);
131
131
  };
132
132
 
133
133
  /**
134
- * Get valid request environment
135
- * @param {Policy} t
136
- * @param {Schema} s
137
- * @returns {GetValidRequestEnvsResult}
138
- */
134
+ * Get valid request environment
135
+ * @param {Policy} t
136
+ * @param {Schema} s
137
+ * @returns {GetValidRequestEnvsResult}
138
+ */
139
139
  module.exports.getValidRequestEnvsPolicy = function(t, s) {
140
140
  const ret = wasm.getValidRequestEnvsPolicy(addHeapObject(t), addHeapObject(s));
141
141
  return takeObject(ret);
142
142
  };
143
143
 
144
144
  /**
145
- * @returns {string}
146
- */
145
+ * @returns {string}
146
+ */
147
147
  module.exports.getCedarVersion = function() {
148
148
  let deferred1_0;
149
149
  let deferred1_1;
@@ -162,133 +162,133 @@ module.exports.getCedarVersion = function() {
162
162
  };
163
163
 
164
164
  /**
165
- * Basic interface, using [`AuthorizationCall`] and [`AuthorizationAnswer`] types
166
- * @param {AuthorizationCall} call
167
- * @returns {AuthorizationAnswer}
168
- */
169
- module.exports.isAuthorized = function(call) {
170
- const ret = wasm.isAuthorized(addHeapObject(call));
171
- return takeObject(ret);
172
- };
173
-
174
- /**
175
- * Parse a policy set and optionally validate it against a provided schema
176
- *
177
- * This is the basic validator interface, using [`ValidationCall`] and
178
- * [`ValidationAnswer`] types
179
- * @param {ValidationCall} call
180
- * @returns {ValidationAnswer}
181
- */
182
- module.exports.validate = function(call) {
183
- const ret = wasm.validate(addHeapObject(call));
184
- return takeObject(ret);
185
- };
186
-
187
- /**
188
- * Apply the Cedar policy formatter to a policy set in the Cedar policy format
189
- * @param {FormattingCall} call
190
- * @returns {FormattingAnswer}
191
- */
165
+ * Apply the Cedar policy formatter to a policy set in the Cedar policy format
166
+ * @param {FormattingCall} call
167
+ * @returns {FormattingAnswer}
168
+ */
192
169
  module.exports.formatPolicies = function(call) {
193
170
  const ret = wasm.formatPolicies(addHeapObject(call));
194
171
  return takeObject(ret);
195
172
  };
196
173
 
197
174
  /**
198
- * Return the Cedar (textual) representation of a policy.
199
- * @param {Policy} policy
200
- * @returns {PolicyToTextAnswer}
201
- */
175
+ * Return the Cedar (textual) representation of a policy.
176
+ * @param {Policy} policy
177
+ * @returns {PolicyToTextAnswer}
178
+ */
202
179
  module.exports.policyToText = function(policy) {
203
180
  const ret = wasm.policyToText(addHeapObject(policy));
204
181
  return takeObject(ret);
205
182
  };
206
183
 
207
184
  /**
208
- * Return the Cedar (textual) representation of a template.
209
- * @param {Template} template
210
- * @returns {PolicyToTextAnswer}
211
- */
185
+ * Return the Cedar (textual) representation of a template.
186
+ * @param {Template} template
187
+ * @returns {PolicyToTextAnswer}
188
+ */
212
189
  module.exports.templateToText = function(template) {
213
190
  const ret = wasm.templateToText(addHeapObject(template));
214
191
  return takeObject(ret);
215
192
  };
216
193
 
217
194
  /**
218
- * Return the JSON representation of a policy.
219
- * @param {Policy} policy
220
- * @returns {PolicyToJsonAnswer}
221
- */
195
+ * Return the JSON representation of a policy.
196
+ * @param {Policy} policy
197
+ * @returns {PolicyToJsonAnswer}
198
+ */
222
199
  module.exports.policyToJson = function(policy) {
223
200
  const ret = wasm.policyToJson(addHeapObject(policy));
224
201
  return takeObject(ret);
225
202
  };
226
203
 
227
204
  /**
228
- * Return the JSON representation of a template.
229
- * @param {Template} template
230
- * @returns {PolicyToJsonAnswer}
231
- */
205
+ * Return the JSON representation of a template.
206
+ * @param {Template} template
207
+ * @returns {PolicyToJsonAnswer}
208
+ */
232
209
  module.exports.templateToJson = function(template) {
233
210
  const ret = wasm.templateToJson(addHeapObject(template));
234
211
  return takeObject(ret);
235
212
  };
236
213
 
237
214
  /**
238
- * Return the Cedar (textual) representation of a schema.
239
- * @param {Schema} schema
240
- * @returns {SchemaToTextAnswer}
241
- */
215
+ * Return the Cedar (textual) representation of a schema.
216
+ * @param {Schema} schema
217
+ * @returns {SchemaToTextAnswer}
218
+ */
242
219
  module.exports.schemaToText = function(schema) {
243
220
  const ret = wasm.schemaToText(addHeapObject(schema));
244
221
  return takeObject(ret);
245
222
  };
246
223
 
247
224
  /**
248
- * Return the JSON representation of a schema.
249
- * @param {Schema} schema
250
- * @returns {SchemaToJsonAnswer}
251
- */
225
+ * Return the JSON representation of a schema.
226
+ * @param {Schema} schema
227
+ * @returns {SchemaToJsonAnswer}
228
+ */
252
229
  module.exports.schemaToJson = function(schema) {
253
230
  const ret = wasm.schemaToJson(addHeapObject(schema));
254
231
  return takeObject(ret);
255
232
  };
256
233
 
257
234
  /**
258
- * Check whether a policy set successfully parses.
259
- * @param {PolicySet} policies
260
- * @returns {CheckParseAnswer}
261
- */
235
+ * Basic interface, using [`AuthorizationCall`] and [`AuthorizationAnswer`] types
236
+ * @param {AuthorizationCall} call
237
+ * @returns {AuthorizationAnswer}
238
+ */
239
+ module.exports.isAuthorized = function(call) {
240
+ const ret = wasm.isAuthorized(addHeapObject(call));
241
+ return takeObject(ret);
242
+ };
243
+
244
+ /**
245
+ * Parse a policy set and optionally validate it against a provided schema
246
+ *
247
+ * This is the basic validator interface, using [`ValidationCall`] and
248
+ * [`ValidationAnswer`] types
249
+ * @param {ValidationCall} call
250
+ * @returns {ValidationAnswer}
251
+ */
252
+ module.exports.validate = function(call) {
253
+ const ret = wasm.validate(addHeapObject(call));
254
+ return takeObject(ret);
255
+ };
256
+
257
+ /**
258
+ * Check whether a policy set successfully parses.
259
+ * @param {PolicySet} policies
260
+ * @returns {CheckParseAnswer}
261
+ */
262
262
  module.exports.checkParsePolicySet = function(policies) {
263
263
  const ret = wasm.checkParsePolicySet(addHeapObject(policies));
264
264
  return takeObject(ret);
265
265
  };
266
266
 
267
267
  /**
268
- * Check whether a schema successfully parses.
269
- * @param {Schema} schema
270
- * @returns {CheckParseAnswer}
271
- */
268
+ * Check whether a schema successfully parses.
269
+ * @param {Schema} schema
270
+ * @returns {CheckParseAnswer}
271
+ */
272
272
  module.exports.checkParseSchema = function(schema) {
273
273
  const ret = wasm.checkParseSchema(addHeapObject(schema));
274
274
  return takeObject(ret);
275
275
  };
276
276
 
277
277
  /**
278
- * Check whether a set of entities successfully parses.
279
- * @param {EntitiesParsingCall} call
280
- * @returns {CheckParseAnswer}
281
- */
278
+ * Check whether a set of entities successfully parses.
279
+ * @param {EntitiesParsingCall} call
280
+ * @returns {CheckParseAnswer}
281
+ */
282
282
  module.exports.checkParseEntities = function(call) {
283
283
  const ret = wasm.checkParseEntities(addHeapObject(call));
284
284
  return takeObject(ret);
285
285
  };
286
286
 
287
287
  /**
288
- * Check whether a context successfully parses.
289
- * @param {ContextParsingCall} call
290
- * @returns {CheckParseAnswer}
291
- */
288
+ * Check whether a context successfully parses.
289
+ * @param {ContextParsingCall} call
290
+ * @returns {CheckParseAnswer}
291
+ */
292
292
  module.exports.checkParseContext = function(call) {
293
293
  const ret = wasm.checkParseContext(addHeapObject(call));
294
294
  return takeObject(ret);
@@ -325,12 +325,12 @@ module.exports.__wbindgen_string_get = function(arg0, arg1) {
325
325
  getDataViewMemory0().setInt32(arg0 + 4 * 0, ptr1, true);
326
326
  };
327
327
 
328
- module.exports.__wbg_parse_52202f117ec9ecfa = function() { return handleError(function (arg0, arg1) {
328
+ module.exports.__wbg_parse_51ee5409072379d3 = function() { return handleError(function (arg0, arg1) {
329
329
  const ret = JSON.parse(getStringFromWasm0(arg0, arg1));
330
330
  return addHeapObject(ret);
331
331
  }, arguments) };
332
332
 
333
- module.exports.__wbg_stringify_bbf45426c92a6bf5 = function() { return handleError(function (arg0) {
333
+ module.exports.__wbg_stringify_eead5648c09faaf8 = function() { return handleError(function (arg0) {
334
334
  const ret = JSON.stringify(getObject(arg0));
335
335
  return addHeapObject(ret);
336
336
  }, 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;
@@ -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.2.0",
4
+ "version": "4.2.2",
5
5
  "license": "Apache-2.0",
6
6
  "files": [
7
7
  "cedar_wasm_bg.wasm",
package/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
  "esm/package.json",