@cedar-policy/cedar-wasm 4.3.0 → 4.4.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.
@@ -10,6 +10,26 @@ export function getValidRequestEnvsTemplate(t: Template, s: Schema): GetValidReq
10
10
  export function getValidRequestEnvsPolicy(t: Policy, s: Schema): GetValidRequestEnvsResult;
11
11
  export function getCedarVersion(): string;
12
12
  export function getCedarSDKVersion(): string;
13
+ /**
14
+ * Basic interface, using [`AuthorizationCall`] and [`AuthorizationAnswer`] types
15
+ */
16
+ export function isAuthorized(call: AuthorizationCall): AuthorizationAnswer;
17
+ /**
18
+ * Check whether a policy set successfully parses.
19
+ */
20
+ export function checkParsePolicySet(policies: PolicySet): CheckParseAnswer;
21
+ /**
22
+ * Check whether a schema successfully parses.
23
+ */
24
+ export function checkParseSchema(schema: Schema): CheckParseAnswer;
25
+ /**
26
+ * Check whether a set of entities successfully parses.
27
+ */
28
+ export function checkParseEntities(call: EntitiesParsingCall): CheckParseAnswer;
29
+ /**
30
+ * Check whether a context successfully parses.
31
+ */
32
+ export function checkParseContext(call: ContextParsingCall): CheckParseAnswer;
13
33
  /**
14
34
  * Parse a policy set and optionally validate it against a provided schema
15
35
  *
@@ -18,9 +38,9 @@ export function getCedarSDKVersion(): string;
18
38
  */
19
39
  export function validate(call: ValidationCall): ValidationAnswer;
20
40
  /**
21
- * Get language version of Cedar
41
+ * Apply the Cedar policy formatter to a policy set in the Cedar policy format
22
42
  */
23
- export function getCedarLangVersion(): string;
43
+ export function formatPolicies(call: FormattingCall): FormattingAnswer;
24
44
  /**
25
45
  * Return the Cedar (textual) representation of a policy.
26
46
  */
@@ -46,73 +66,11 @@ export function schemaToText(schema: Schema): SchemaToTextAnswer;
46
66
  */
47
67
  export function schemaToJson(schema: Schema): SchemaToJsonAnswer;
48
68
  /**
49
- * Check whether a policy set successfully parses.
50
- */
51
- export function checkParsePolicySet(policies: PolicySet): CheckParseAnswer;
52
- /**
53
- * Check whether a schema successfully parses.
54
- */
55
- export function checkParseSchema(schema: Schema): CheckParseAnswer;
56
- /**
57
- * Check whether a set of entities successfully parses.
58
- */
59
- export function checkParseEntities(call: EntitiesParsingCall): CheckParseAnswer;
60
- /**
61
- * Check whether a context successfully parses.
62
- */
63
- export function checkParseContext(call: ContextParsingCall): CheckParseAnswer;
64
- /**
65
- * Basic interface, using [`AuthorizationCall`] and [`AuthorizationAnswer`] types
66
- */
67
- export function isAuthorized(call: AuthorizationCall): AuthorizationAnswer;
68
- /**
69
- * Apply the Cedar policy formatter to a policy set in the Cedar policy format
69
+ * Get language version of Cedar
70
70
  */
71
- export function formatPolicies(call: FormattingCall): FormattingAnswer;
71
+ export function getCedarLangVersion(): string;
72
72
  export type GetValidRequestEnvsResult = { type: "success"; principals: string[]; actions: string[]; resources: string[] } | { type: "failure"; error: string };
73
73
 
74
- export interface ValidationCall {
75
- validationSettings?: ValidationSettings;
76
- schema: Schema;
77
- policies: PolicySet;
78
- }
79
-
80
- export interface ValidationSettings {
81
- mode: ValidationMode;
82
- }
83
-
84
- export interface ValidationError {
85
- policyId: string;
86
- error: DetailedError;
87
- }
88
-
89
- export type ValidationAnswer = { type: "failure"; errors: DetailedError[]; warnings: DetailedError[] } | { type: "success"; validationErrors: ValidationError[]; validationWarnings: ValidationError[]; otherWarnings: DetailedError[] };
90
-
91
- export type PolicyToTextAnswer = { type: "success"; text: string } | { type: "failure"; errors: DetailedError[] };
92
-
93
- export type PolicyToJsonAnswer = { type: "success"; json: PolicyJson } | { type: "failure"; errors: DetailedError[] };
94
-
95
- export type SchemaToTextAnswer = { type: "success"; text: string; warnings: DetailedError[] } | { type: "failure"; errors: DetailedError[] };
96
-
97
- export type SchemaToJsonAnswer = { type: "success"; json: SchemaJson<string>; warnings: DetailedError[] } | { type: "failure"; errors: DetailedError[] };
98
-
99
- export type SlotId = string;
100
-
101
- export type PolicyId = string;
102
-
103
- export type CheckParseAnswer = { type: "success" } | { type: "failure"; errors: DetailedError[] };
104
-
105
- export interface EntitiesParsingCall {
106
- entities: Entities;
107
- schema?: Schema | null;
108
- }
109
-
110
- export interface ContextParsingCall {
111
- context: Context;
112
- schema?: Schema | null;
113
- action?: EntityUid | null;
114
- }
115
-
116
74
  export interface Response {
117
75
  decision: Decision;
118
76
  diagnostics: Diagnostics;
@@ -141,13 +99,22 @@ export interface AuthorizationCall {
141
99
  entities: Entities;
142
100
  }
143
101
 
144
- export interface FormattingCall {
145
- policyText: string;
146
- lineWidth?: number;
147
- indentWidth?: number;
102
+ export type CheckParseAnswer = { type: "success" } | { type: "failure"; errors: DetailedError[] };
103
+
104
+ export interface EntitiesParsingCall {
105
+ entities: Entities;
106
+ schema?: Schema | null;
148
107
  }
149
108
 
150
- export type FormattingAnswer = { type: "failure"; errors: DetailedError[] } | { type: "success"; formatted_policy: string };
109
+ export interface ContextParsingCall {
110
+ context: Context;
111
+ schema?: Schema | null;
112
+ action?: EntityUid | null;
113
+ }
114
+
115
+ export type SlotId = string;
116
+
117
+ export type PolicyId = string;
151
118
 
152
119
  export type Schema = string | SchemaJson<string>;
153
120
 
@@ -196,6 +163,39 @@ export interface DetailedError {
196
163
  related?: DetailedError[];
197
164
  }
198
165
 
166
+ export interface ValidationCall {
167
+ validationSettings?: ValidationSettings;
168
+ schema: Schema;
169
+ policies: PolicySet;
170
+ }
171
+
172
+ export interface ValidationSettings {
173
+ mode: ValidationMode;
174
+ }
175
+
176
+ export interface ValidationError {
177
+ policyId: string;
178
+ error: DetailedError;
179
+ }
180
+
181
+ export type ValidationAnswer = { type: "failure"; errors: DetailedError[]; warnings: DetailedError[] } | { type: "success"; validationErrors: ValidationError[]; validationWarnings: ValidationError[]; otherWarnings: DetailedError[] };
182
+
183
+ export interface FormattingCall {
184
+ policyText: string;
185
+ lineWidth?: number;
186
+ indentWidth?: number;
187
+ }
188
+
189
+ export type FormattingAnswer = { type: "failure"; errors: DetailedError[] } | { type: "success"; formatted_policy: string };
190
+
191
+ export type PolicyToTextAnswer = { type: "success"; text: string } | { type: "failure"; errors: DetailedError[] };
192
+
193
+ export type PolicyToJsonAnswer = { type: "success"; json: PolicyJson } | { type: "failure"; errors: DetailedError[] };
194
+
195
+ export type SchemaToTextAnswer = { type: "success"; text: string; warnings: DetailedError[] } | { type: "failure"; errors: DetailedError[] };
196
+
197
+ export type SchemaToJsonAnswer = { type: "success"; json: SchemaJson<string>; warnings: DetailedError[] } | { type: "failure"; errors: DetailedError[] };
198
+
199
199
  export type ValidationMode = "strict";
200
200
 
201
201
  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 };
@@ -227,13 +227,14 @@ export interface ActionType<N> {
227
227
 
228
228
  export type AttributesOrContext<N> = Type<N>;
229
229
 
230
- export interface EntityType<N> {
230
+ export interface StandardEntityType<N> {
231
231
  memberOfTypes?: N[];
232
232
  shape?: AttributesOrContext<N>;
233
233
  tags?: Type<N>;
234
- annotations?: Annotations;
235
234
  }
236
235
 
236
+ export type EntityTypeKind<N> = StandardEntityType<N> | { enum: NonEmpty<SmolStr> };
237
+
237
238
  export interface NamespaceDefinition<N> {
238
239
  commonTypes?: Record<CommonTypeId, CommonType<N>>;
239
240
  entityTypes: Record<UnreservedId, EntityType<N>>;
@@ -245,41 +246,8 @@ export type CommonTypeId = string;
245
246
 
246
247
  export type SchemaJson<N> = Record<string, NamespaceDefinition<N>>;
247
248
 
248
- export type ActionInConstraint = { entity: EntityUidJson } | { entities: EntityUidJson[] };
249
-
250
- export interface PrincipalOrResourceIsConstraint {
251
- entity_type: string;
252
- in?: PrincipalOrResourceInConstraint;
253
- }
254
-
255
- export type PrincipalOrResourceInConstraint = { entity: EntityUidJson } | { slot: string };
256
-
257
- export type EqConstraint = { entity: EntityUidJson } | { slot: string };
258
-
259
- export type ResourceConstraint = { op: "All" } | ({ op: "==" } & EqConstraint) | ({ op: "in" } & PrincipalOrResourceInConstraint) | ({ op: "is" } & PrincipalOrResourceIsConstraint);
260
-
261
- export type ActionConstraint = { op: "All" } | ({ op: "==" } & EqConstraint) | ({ op: "in" } & ActionInConstraint);
262
-
263
- export type PrincipalConstraint = { op: "All" } | ({ op: "==" } & EqConstraint) | ({ op: "in" } & PrincipalOrResourceInConstraint) | ({ op: "is" } & PrincipalOrResourceIsConstraint);
264
-
265
249
  export type Var = "principal" | "action" | "resource" | "context";
266
250
 
267
- export type EntityUidJson = { __entity: TypeAndId } | TypeAndId;
268
-
269
- export interface FnAndArg {
270
- fn: string;
271
- arg: CedarValueJson;
272
- }
273
-
274
- export interface TypeAndId {
275
- type: string;
276
- id: string;
277
- }
278
-
279
- export type CedarValueJson = { __entity: TypeAndId } | { __extn: FnAndArg } | boolean | number | string | CedarValueJson[] | { [key: string]: CedarValueJson } | null;
280
-
281
- export type Annotations = Record<string, Annotation>;
282
-
283
251
  export interface EntityJson {
284
252
  uid: EntityUidJson;
285
253
  attrs: Record<string, CedarValueJson>;
@@ -289,8 +257,6 @@ export interface EntityJson {
289
257
 
290
258
  export type Decision = "allow" | "deny";
291
259
 
292
- export type Annotation = SmolStr;
293
-
294
260
  export type Clause = { kind: "when"; body: Expr } | { kind: "unless"; body: Expr };
295
261
 
296
262
  export interface PolicyJson {
@@ -314,8 +280,45 @@ export type AnyId = SmolStr;
314
280
 
315
281
  export type UnreservedId = string;
316
282
 
283
+ export type EntityUidJson = { __entity: TypeAndId } | TypeAndId;
284
+
285
+ export interface FnAndArg {
286
+ fn: string;
287
+ arg: CedarValueJson;
288
+ }
289
+
290
+ export interface TypeAndId {
291
+ type: string;
292
+ id: string;
293
+ }
294
+
295
+ export type CedarValueJson = { __entity: TypeAndId } | { __extn: FnAndArg } | boolean | number | string | CedarValueJson[] | { [key: string]: CedarValueJson } | null;
296
+
297
+ export type ActionInConstraint = { entity: EntityUidJson } | { entities: EntityUidJson[] };
298
+
299
+ export interface PrincipalOrResourceIsConstraint {
300
+ entity_type: string;
301
+ in?: PrincipalOrResourceInConstraint;
302
+ }
303
+
304
+ export type PrincipalOrResourceInConstraint = { entity: EntityUidJson } | { slot: string };
305
+
306
+ export type EqConstraint = { entity: EntityUidJson } | { slot: string };
307
+
308
+ export type ResourceConstraint = { op: "All" } | ({ op: "==" } & EqConstraint) | ({ op: "in" } & PrincipalOrResourceInConstraint) | ({ op: "is" } & PrincipalOrResourceIsConstraint);
309
+
310
+ export type ActionConstraint = { op: "All" } | ({ op: "==" } & EqConstraint) | ({ op: "in" } & ActionInConstraint);
311
+
312
+ export type PrincipalConstraint = { op: "All" } | ({ op: "==" } & EqConstraint) | ({ op: "in" } & PrincipalOrResourceInConstraint) | ({ op: "is" } & PrincipalOrResourceIsConstraint);
313
+
317
314
  export type Effect = "permit" | "forbid";
318
315
 
316
+ export type Annotations = Record<string, Annotation>;
317
+
318
+ export type Annotation = SmolStr;
319
+
319
320
  type SmolStr = string;
320
321
  export type TypeOfAttribute<N> = Type<N> & { required?: boolean };
321
322
  export type CommonType<N> = Type<N> & { annotations?: Annotations };
323
+ export type EntityType<N> = EntityTypeKind<N> & { annotations?: Annotations; };
324
+ export type NonEmpty<Type> = Array<Type>;
package/esm/cedar_wasm.js CHANGED
@@ -1,4 +1,5 @@
1
1
  import * as wasm from "./cedar_wasm_bg.wasm";
2
2
  export * from "./cedar_wasm_bg.js";
3
3
  import { __wbg_set_wasm } from "./cedar_wasm_bg.js";
4
- __wbg_set_wasm(wasm);
4
+ __wbg_set_wasm(wasm);
5
+ wasm.__wbindgen_start();
@@ -24,18 +24,9 @@ function getStringFromWasm0(ptr, len) {
24
24
  return cachedTextDecoder.decode(getUint8ArrayMemory0().subarray(ptr, ptr + len));
25
25
  }
26
26
 
27
- const heap = new Array(128).fill(undefined);
28
-
29
- heap.push(undefined, null, true, false);
30
-
31
- let heap_next = heap.length;
32
-
33
- function addHeapObject(obj) {
34
- if (heap_next === heap.length) heap.push(heap.length + 1);
35
- const idx = heap_next;
36
- heap_next = heap[idx];
37
-
38
- heap[idx] = obj;
27
+ function addToExternrefTable0(obj) {
28
+ const idx = wasm.__externref_table_alloc();
29
+ wasm.__wbindgen_export_2.set(idx, obj);
39
30
  return idx;
40
31
  }
41
32
 
@@ -43,24 +34,11 @@ function handleError(f, args) {
43
34
  try {
44
35
  return f.apply(this, args);
45
36
  } catch (e) {
46
- wasm.__wbindgen_exn_store(addHeapObject(e));
37
+ const idx = addToExternrefTable0(e);
38
+ wasm.__wbindgen_exn_store(idx);
47
39
  }
48
40
  }
49
41
 
50
- function getObject(idx) { return heap[idx]; }
51
-
52
- function dropObject(idx) {
53
- if (idx < 132) return;
54
- heap[idx] = heap_next;
55
- heap_next = idx;
56
- }
57
-
58
- function takeObject(idx) {
59
- const ret = getObject(idx);
60
- dropObject(idx);
61
- return ret;
62
- }
63
-
64
42
  let WASM_VECTOR_LEN = 0;
65
43
 
66
44
  const lTextEncoder = typeof TextEncoder === 'undefined' ? (0, module.require)('util').TextEncoder : TextEncoder;
@@ -138,8 +116,8 @@ function getDataViewMemory0() {
138
116
  * @returns {GetValidRequestEnvsResult}
139
117
  */
140
118
  export function getValidRequestEnvsTemplate(t, s) {
141
- const ret = wasm.getValidRequestEnvsTemplate(addHeapObject(t), addHeapObject(s));
142
- return takeObject(ret);
119
+ const ret = wasm.getValidRequestEnvsTemplate(t, s);
120
+ return ret;
143
121
  }
144
122
 
145
123
  /**
@@ -149,8 +127,8 @@ export function getValidRequestEnvsTemplate(t, s) {
149
127
  * @returns {GetValidRequestEnvsResult}
150
128
  */
151
129
  export function getValidRequestEnvsPolicy(t, s) {
152
- const ret = wasm.getValidRequestEnvsPolicy(addHeapObject(t), addHeapObject(s));
153
- return takeObject(ret);
130
+ const ret = wasm.getValidRequestEnvsPolicy(t, s);
131
+ return ret;
154
132
  }
155
133
 
156
134
  /**
@@ -160,15 +138,11 @@ export function getCedarVersion() {
160
138
  let deferred1_0;
161
139
  let deferred1_1;
162
140
  try {
163
- const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
164
- wasm.getCedarSDKVersion(retptr);
165
- var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
166
- var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
167
- deferred1_0 = r0;
168
- deferred1_1 = r1;
169
- return getStringFromWasm0(r0, r1);
141
+ const ret = wasm.getCedarVersion();
142
+ deferred1_0 = ret[0];
143
+ deferred1_1 = ret[1];
144
+ return getStringFromWasm0(ret[0], ret[1]);
170
145
  } finally {
171
- wasm.__wbindgen_add_to_stack_pointer(16);
172
146
  wasm.__wbindgen_free(deferred1_0, deferred1_1, 1);
173
147
  }
174
148
  }
@@ -180,19 +154,65 @@ export function getCedarSDKVersion() {
180
154
  let deferred1_0;
181
155
  let deferred1_1;
182
156
  try {
183
- const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
184
- wasm.getCedarSDKVersion(retptr);
185
- var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
186
- var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
187
- deferred1_0 = r0;
188
- deferred1_1 = r1;
189
- return getStringFromWasm0(r0, r1);
157
+ const ret = wasm.getCedarSDKVersion();
158
+ deferred1_0 = ret[0];
159
+ deferred1_1 = ret[1];
160
+ return getStringFromWasm0(ret[0], ret[1]);
190
161
  } finally {
191
- wasm.__wbindgen_add_to_stack_pointer(16);
192
162
  wasm.__wbindgen_free(deferred1_0, deferred1_1, 1);
193
163
  }
194
164
  }
195
165
 
166
+ /**
167
+ * Basic interface, using [`AuthorizationCall`] and [`AuthorizationAnswer`] types
168
+ * @param {AuthorizationCall} call
169
+ * @returns {AuthorizationAnswer}
170
+ */
171
+ export function isAuthorized(call) {
172
+ const ret = wasm.isAuthorized(call);
173
+ return ret;
174
+ }
175
+
176
+ /**
177
+ * Check whether a policy set successfully parses.
178
+ * @param {PolicySet} policies
179
+ * @returns {CheckParseAnswer}
180
+ */
181
+ export function checkParsePolicySet(policies) {
182
+ const ret = wasm.checkParsePolicySet(policies);
183
+ return ret;
184
+ }
185
+
186
+ /**
187
+ * Check whether a schema successfully parses.
188
+ * @param {Schema} schema
189
+ * @returns {CheckParseAnswer}
190
+ */
191
+ export function checkParseSchema(schema) {
192
+ const ret = wasm.checkParseSchema(schema);
193
+ return ret;
194
+ }
195
+
196
+ /**
197
+ * Check whether a set of entities successfully parses.
198
+ * @param {EntitiesParsingCall} call
199
+ * @returns {CheckParseAnswer}
200
+ */
201
+ export function checkParseEntities(call) {
202
+ const ret = wasm.checkParseEntities(call);
203
+ return ret;
204
+ }
205
+
206
+ /**
207
+ * Check whether a context successfully parses.
208
+ * @param {ContextParsingCall} call
209
+ * @returns {CheckParseAnswer}
210
+ */
211
+ export function checkParseContext(call) {
212
+ const ret = wasm.checkParseContext(call);
213
+ return ret;
214
+ }
215
+
196
216
  /**
197
217
  * Parse a policy set and optionally validate it against a provided schema
198
218
  *
@@ -202,29 +222,18 @@ export function getCedarSDKVersion() {
202
222
  * @returns {ValidationAnswer}
203
223
  */
204
224
  export function validate(call) {
205
- const ret = wasm.validate(addHeapObject(call));
206
- return takeObject(ret);
225
+ const ret = wasm.validate(call);
226
+ return ret;
207
227
  }
208
228
 
209
229
  /**
210
- * Get language version of Cedar
211
- * @returns {string}
230
+ * Apply the Cedar policy formatter to a policy set in the Cedar policy format
231
+ * @param {FormattingCall} call
232
+ * @returns {FormattingAnswer}
212
233
  */
213
- export function getCedarLangVersion() {
214
- let deferred1_0;
215
- let deferred1_1;
216
- try {
217
- const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
218
- wasm.getCedarLangVersion(retptr);
219
- var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
220
- var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
221
- deferred1_0 = r0;
222
- deferred1_1 = r1;
223
- return getStringFromWasm0(r0, r1);
224
- } finally {
225
- wasm.__wbindgen_add_to_stack_pointer(16);
226
- wasm.__wbindgen_free(deferred1_0, deferred1_1, 1);
227
- }
234
+ export function formatPolicies(call) {
235
+ const ret = wasm.formatPolicies(call);
236
+ return ret;
228
237
  }
229
238
 
230
239
  /**
@@ -233,8 +242,8 @@ export function getCedarLangVersion() {
233
242
  * @returns {PolicyToTextAnswer}
234
243
  */
235
244
  export function policyToText(policy) {
236
- const ret = wasm.policyToText(addHeapObject(policy));
237
- return takeObject(ret);
245
+ const ret = wasm.policyToText(policy);
246
+ return ret;
238
247
  }
239
248
 
240
249
  /**
@@ -243,8 +252,8 @@ export function policyToText(policy) {
243
252
  * @returns {PolicyToTextAnswer}
244
253
  */
245
254
  export function templateToText(template) {
246
- const ret = wasm.templateToText(addHeapObject(template));
247
- return takeObject(ret);
255
+ const ret = wasm.templateToText(template);
256
+ return ret;
248
257
  }
249
258
 
250
259
  /**
@@ -253,8 +262,8 @@ export function templateToText(template) {
253
262
  * @returns {PolicyToJsonAnswer}
254
263
  */
255
264
  export function policyToJson(policy) {
256
- const ret = wasm.policyToJson(addHeapObject(policy));
257
- return takeObject(ret);
265
+ const ret = wasm.policyToJson(policy);
266
+ return ret;
258
267
  }
259
268
 
260
269
  /**
@@ -263,8 +272,8 @@ export function policyToJson(policy) {
263
272
  * @returns {PolicyToJsonAnswer}
264
273
  */
265
274
  export function templateToJson(template) {
266
- const ret = wasm.templateToJson(addHeapObject(template));
267
- return takeObject(ret);
275
+ const ret = wasm.templateToJson(template);
276
+ return ret;
268
277
  }
269
278
 
270
279
  /**
@@ -273,8 +282,8 @@ export function templateToJson(template) {
273
282
  * @returns {SchemaToTextAnswer}
274
283
  */
275
284
  export function schemaToText(schema) {
276
- const ret = wasm.schemaToText(addHeapObject(schema));
277
- return takeObject(ret);
285
+ const ret = wasm.schemaToText(schema);
286
+ return ret;
278
287
  }
279
288
 
280
289
  /**
@@ -283,96 +292,55 @@ export function schemaToText(schema) {
283
292
  * @returns {SchemaToJsonAnswer}
284
293
  */
285
294
  export function schemaToJson(schema) {
286
- const ret = wasm.schemaToJson(addHeapObject(schema));
287
- return takeObject(ret);
288
- }
289
-
290
- /**
291
- * Check whether a policy set successfully parses.
292
- * @param {PolicySet} policies
293
- * @returns {CheckParseAnswer}
294
- */
295
- export function checkParsePolicySet(policies) {
296
- const ret = wasm.checkParsePolicySet(addHeapObject(policies));
297
- return takeObject(ret);
298
- }
299
-
300
- /**
301
- * Check whether a schema successfully parses.
302
- * @param {Schema} schema
303
- * @returns {CheckParseAnswer}
304
- */
305
- export function checkParseSchema(schema) {
306
- const ret = wasm.checkParseSchema(addHeapObject(schema));
307
- return takeObject(ret);
308
- }
309
-
310
- /**
311
- * Check whether a set of entities successfully parses.
312
- * @param {EntitiesParsingCall} call
313
- * @returns {CheckParseAnswer}
314
- */
315
- export function checkParseEntities(call) {
316
- const ret = wasm.checkParseEntities(addHeapObject(call));
317
- return takeObject(ret);
318
- }
319
-
320
- /**
321
- * Check whether a context successfully parses.
322
- * @param {ContextParsingCall} call
323
- * @returns {CheckParseAnswer}
324
- */
325
- export function checkParseContext(call) {
326
- const ret = wasm.checkParseContext(addHeapObject(call));
327
- return takeObject(ret);
328
- }
329
-
330
- /**
331
- * Basic interface, using [`AuthorizationCall`] and [`AuthorizationAnswer`] types
332
- * @param {AuthorizationCall} call
333
- * @returns {AuthorizationAnswer}
334
- */
335
- export function isAuthorized(call) {
336
- const ret = wasm.isAuthorized(addHeapObject(call));
337
- return takeObject(ret);
295
+ const ret = wasm.schemaToJson(schema);
296
+ return ret;
338
297
  }
339
298
 
340
299
  /**
341
- * Apply the Cedar policy formatter to a policy set in the Cedar policy format
342
- * @param {FormattingCall} call
343
- * @returns {FormattingAnswer}
300
+ * Get language version of Cedar
301
+ * @returns {string}
344
302
  */
345
- export function formatPolicies(call) {
346
- const ret = wasm.formatPolicies(addHeapObject(call));
347
- return takeObject(ret);
303
+ export function getCedarLangVersion() {
304
+ let deferred1_0;
305
+ let deferred1_1;
306
+ try {
307
+ const ret = wasm.getCedarLangVersion();
308
+ deferred1_0 = ret[0];
309
+ deferred1_1 = ret[1];
310
+ return getStringFromWasm0(ret[0], ret[1]);
311
+ } finally {
312
+ wasm.__wbindgen_free(deferred1_0, deferred1_1, 1);
313
+ }
348
314
  }
349
315
 
350
316
  export function __wbg_parse_def2e24ef1252aff() { return handleError(function (arg0, arg1) {
351
317
  const ret = JSON.parse(getStringFromWasm0(arg0, arg1));
352
- return addHeapObject(ret);
318
+ return ret;
353
319
  }, arguments) };
354
320
 
355
321
  export function __wbg_stringify_f7ed6987935b4a24() { return handleError(function (arg0) {
356
- const ret = JSON.stringify(getObject(arg0));
357
- return addHeapObject(ret);
358
- }, arguments) };
359
-
360
- export function __wbindgen_is_undefined(arg0) {
361
- const ret = getObject(arg0) === undefined;
322
+ const ret = JSON.stringify(arg0);
362
323
  return ret;
363
- };
324
+ }, arguments) };
364
325
 
365
- export function __wbindgen_object_clone_ref(arg0) {
366
- const ret = getObject(arg0);
367
- return addHeapObject(ret);
326
+ export function __wbindgen_init_externref_table() {
327
+ const table = wasm.__wbindgen_export_2;
328
+ const offset = table.grow(4);
329
+ table.set(0, undefined);
330
+ table.set(offset + 0, undefined);
331
+ table.set(offset + 1, null);
332
+ table.set(offset + 2, true);
333
+ table.set(offset + 3, false);
334
+ ;
368
335
  };
369
336
 
370
- export function __wbindgen_object_drop_ref(arg0) {
371
- takeObject(arg0);
337
+ export function __wbindgen_is_undefined(arg0) {
338
+ const ret = arg0 === undefined;
339
+ return ret;
372
340
  };
373
341
 
374
342
  export function __wbindgen_string_get(arg0, arg1) {
375
- const obj = getObject(arg1);
343
+ const obj = arg1;
376
344
  const ret = typeof(obj) === 'string' ? obj : undefined;
377
345
  var ptr1 = isLikeNone(ret) ? 0 : passStringToWasm0(ret, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
378
346
  var len1 = WASM_VECTOR_LEN;
Binary file