@cedar-policy/cedar-wasm 3.2.1 → 3.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.
@@ -0,0 +1,270 @@
1
+ /* tslint:disable */
2
+ /* eslint-disable */
3
+ /**
4
+ * @param {string} json_str
5
+ * @returns {JsonToPolicyResult}
6
+ */
7
+ export function policyTextFromJson(json_str: string): JsonToPolicyResult;
8
+ /**
9
+ * @param {string} cedar_str
10
+ * @returns {PolicyToJsonResult}
11
+ */
12
+ export function policyTextToJson(cedar_str: string): PolicyToJsonResult;
13
+ /**
14
+ * @param {string} input_policies_str
15
+ * @returns {CheckParsePolicySetResult}
16
+ */
17
+ export function checkParsePolicySet(input_policies_str: string): CheckParsePolicySetResult;
18
+ /**
19
+ * @param {string} template_str
20
+ * @returns {CheckParseTemplateResult}
21
+ */
22
+ export function checkParseTemplate(template_str: string): CheckParseTemplateResult;
23
+ /**
24
+ * @param {string} input_schema
25
+ * @returns {CheckParseResult}
26
+ */
27
+ export function checkParseSchema(input_schema: string): CheckParseResult;
28
+ /**
29
+ * @param {string} entities_str
30
+ * @param {string} schema_str
31
+ * @returns {CheckParseResult}
32
+ */
33
+ export function checkParseEntities(entities_str: string, schema_str: string): CheckParseResult;
34
+ /**
35
+ * @param {string} context_str
36
+ * @param {string} action_str
37
+ * @param {string} schema_str
38
+ * @returns {CheckParseResult}
39
+ */
40
+ export function checkParseContext(context_str: string, action_str: string, schema_str: string): CheckParseResult;
41
+ /**
42
+ * @param {string} policies_str
43
+ * @param {number} line_width
44
+ * @param {number} indent_width
45
+ * @returns {FormattingResult}
46
+ */
47
+ export function formatPolicies(policies_str: string, line_width: number, indent_width: number): FormattingResult;
48
+ /**
49
+ * @returns {string}
50
+ */
51
+ export function getCedarVersion(): string;
52
+ /**
53
+ * @param {AuthorizationCall} call
54
+ * @returns {AuthorizationAnswer}
55
+ */
56
+ export function isAuthorized(call: AuthorizationCall): AuthorizationAnswer;
57
+ /**
58
+ * @param {ValidationCall} call
59
+ * @returns {ValidationAnswer}
60
+ */
61
+ export function validate(call: ValidationCall): ValidationAnswer;
62
+ export type JsonToPolicyResult = { type: "success"; policyText: string } | { type: "error"; errors: string[] };
63
+
64
+ export type PolicyToJsonResult = { type: "success"; policy: Policy } | { type: "error"; errors: string[] };
65
+
66
+ export type CheckParsePolicySetResult = { type: "success"; policies: number; templates: number } | { type: "error"; errors: string[] };
67
+
68
+ export type CheckParseTemplateResult = { type: "success"; slots: string[] } | { type: "error"; errors: string[] };
69
+
70
+ export type CheckParseResult = { type: "success" } | { type: "error"; errors: string[] };
71
+
72
+ export type FormattingResult = { type: "success"; formatted_policy: string } | { type: "error"; errors: string[] };
73
+
74
+ export type Schema = { human: string } | { json: SchemaJson };
75
+
76
+ export type PolicySet = string | Record<string, string>;
77
+
78
+ export interface SourceLocation {
79
+ start: number;
80
+ end: number;
81
+ }
82
+
83
+ export interface SourceLabel extends SourceLocation {
84
+ label: string | null;
85
+ }
86
+
87
+ export type Severity = "advice" | "warning" | "error";
88
+
89
+ export interface DetailedError {
90
+ message: string;
91
+ help: string | null;
92
+ code: string | null;
93
+ url: string | null;
94
+ severity: Severity | null;
95
+ sourceLocations?: SourceLabel[];
96
+ related?: DetailedError[];
97
+ }
98
+
99
+ export type ValidationAnswer = { type: "failure"; errors: DetailedError[]; warnings: DetailedError[] } | { type: "success"; validationErrors: ValidationError[]; validationWarnings: ValidationError[]; otherWarnings: DetailedError[] };
100
+
101
+ export interface ValidationError {
102
+ policyId: SmolStr;
103
+ error: DetailedError;
104
+ }
105
+
106
+ export type ValidationEnabled = "on" | "off";
107
+
108
+ export interface ValidationSettings {
109
+ enabled: ValidationEnabled;
110
+ }
111
+
112
+ export interface ValidationCall {
113
+ validationSettings?: ValidationSettings;
114
+ schema: Schema;
115
+ policySet: PolicySet;
116
+ }
117
+
118
+ export interface RecvdSlice {
119
+ policies: PolicySet;
120
+ entities: Array<EntityJson>;
121
+ templates?: Record<string, string> | null;
122
+ templateInstantiations: TemplateLink[] | null;
123
+ }
124
+
125
+ export type Links = Link[];
126
+
127
+ export interface TemplateLink {
128
+ templateId: string;
129
+ resultPolicyId: string;
130
+ instantiations: Links;
131
+ }
132
+
133
+ export interface Link {
134
+ slot: string;
135
+ value: EntityUIDStrings;
136
+ }
137
+
138
+ export interface EntityUIDStrings {
139
+ ty: string;
140
+ eid: string;
141
+ }
142
+
143
+ export interface AuthorizationCall {
144
+ principal: {type: string, id: string};
145
+ action: {type: string, id: string};
146
+ resource: {type: string, id: string};
147
+ context: Record<string, CedarValueJson>;
148
+ schema?: Schema;
149
+ enableRequestValidation?: boolean;
150
+ slice: RecvdSlice;
151
+ }
152
+
153
+ export type AuthorizationAnswer = { type: "failure"; errors: DetailedError[]; warnings: DetailedError[] } | { type: "success"; response: Response; warnings: DetailedError[] };
154
+
155
+ export interface AuthorizationError {
156
+ policyId: SmolStr;
157
+ error: DetailedError;
158
+ }
159
+
160
+ export interface Diagnostics {
161
+ reason: Set<String>;
162
+ errors: AuthorizationError[];
163
+ }
164
+
165
+ export interface Response {
166
+ decision: Decision;
167
+ diagnostics: Diagnostics;
168
+ }
169
+
170
+ export type SchemaTypeVariant = { type: "String" } | { type: "Long" } | { type: "Boolean" } | { type: "Set"; element: SchemaType } | { type: "Record"; attributes: Record<SmolStr, TypeOfAttribute>; additionalAttributes: boolean } | { type: "Entity"; name: Name } | { type: "Extension"; name: Id };
171
+
172
+ export type SchemaType = SchemaTypeVariant | { type: Name };
173
+
174
+ export interface ActionEntityUID {
175
+ id: SmolStr;
176
+ type?: Name;
177
+ }
178
+
179
+ export interface ApplySpec {
180
+ resourceTypes?: Name[];
181
+ principalTypes?: Name[];
182
+ context?: AttributesOrContext;
183
+ }
184
+
185
+ export interface ActionType {
186
+ attributes?: Record<SmolStr, CedarValueJson>;
187
+ appliesTo?: ApplySpec;
188
+ memberOf?: ActionEntityUID[];
189
+ }
190
+
191
+ export type AttributesOrContext = SchemaType;
192
+
193
+ export interface EntityType {
194
+ memberOfTypes?: Name[];
195
+ shape?: AttributesOrContext;
196
+ }
197
+
198
+ export interface NamespaceDefinition {
199
+ commonTypes?: Record<Id, SchemaType>;
200
+ entityTypes: Record<Id, EntityType>;
201
+ actions: Record<SmolStr, ActionType>;
202
+ }
203
+
204
+ export type SchemaJson = Record<string, NamespaceDefinition>;
205
+
206
+ export type EntityUidJson = { __expr: string } | { __entity: TypeAndId } | TypeAndId;
207
+
208
+ export interface FnAndArg {
209
+ fn: string;
210
+ arg: CedarValueJson;
211
+ }
212
+
213
+ export interface TypeAndId {
214
+ type: string;
215
+ id: string;
216
+ }
217
+
218
+ export type CedarValueJson = { __expr: string } | { __entity: TypeAndId } | { __extn: FnAndArg } | boolean | number | string | CedarValueJson[] | { [key: string]: CedarValueJson } | null;
219
+
220
+ export type Var = "principal" | "action" | "resource" | "context";
221
+
222
+ export type Effect = "permit" | "forbid";
223
+
224
+ export type Clause = { kind: "when"; body: Expr } | { kind: "unless"; body: Expr };
225
+
226
+ export interface Policy {
227
+ effect: Effect;
228
+ principal: PrincipalConstraint;
229
+ action: ActionConstraint;
230
+ resource: ResourceConstraint;
231
+ conditions: Clause[];
232
+ annotations?: Record<string, string>;
233
+ }
234
+
235
+ export interface EntityJson {
236
+ uid: EntityUidJson;
237
+ attrs: Record<string, CedarValueJson>;
238
+ parents: EntityUidJson[];
239
+ }
240
+
241
+ export type Decision = "Allow" | "Deny";
242
+
243
+ export type ActionInConstraint = { entity: EntityUidJson } | { entities: EntityUidJson[] };
244
+
245
+ export interface PrincipalOrResourceIsConstraint {
246
+ entity_type: string;
247
+ in?: PrincipalOrResourceInConstraint;
248
+ }
249
+
250
+ export type PrincipalOrResourceInConstraint = { entity: EntityUidJson } | { slot: string };
251
+
252
+ export type EqConstraint = { entity: EntityUidJson } | { slot: string };
253
+
254
+ export type ResourceConstraint = { op: "All" } | ({ op: "==" } & EqConstraint) | ({ op: "in" } & PrincipalOrResourceInConstraint) | ({ op: "is" } & PrincipalOrResourceIsConstraint);
255
+
256
+ export type ActionConstraint = { op: "All" } | ({ op: "==" } & EqConstraint) | ({ op: "in" } & ActionInConstraint);
257
+
258
+ export type PrincipalConstraint = { op: "All" } | ({ op: "==" } & EqConstraint) | ({ op: "in" } & PrincipalOrResourceInConstraint) | ({ op: "is" } & PrincipalOrResourceIsConstraint);
259
+
260
+ export type ExtFuncCall = {} & Record<string, Array<Expr>>;
261
+
262
+ export type ExprNoExt = { Value: CedarValueJson } | { Var: Var } | { Slot: string } | { Unknown: { name: string } } | { "!": { arg: Expr } } | { neg: { arg: Expr } } | { "==": { left: Expr; right: Expr } } | { "!=": { left: Expr; right: Expr } } | { in: { left: Expr; right: Expr } } | { "<": { left: Expr; right: Expr } } | { "<=": { left: Expr; right: Expr } } | { ">": { left: Expr; right: Expr } } | { ">=": { left: Expr; right: Expr } } | { "&&": { left: Expr; right: Expr } } | { "||": { left: Expr; right: Expr } } | { "+": { left: Expr; right: Expr } } | { "-": { left: Expr; right: Expr } } | { "*": { left: Expr; right: Expr } } | { contains: { left: Expr; right: Expr } } | { containsAll: { left: Expr; right: Expr } } | { containsAny: { left: Expr; right: Expr } } | { ".": { left: Expr; attr: SmolStr } } | { has: { left: Expr; attr: SmolStr } } | { like: { left: Expr; pattern: SmolStr } } | { is: { left: Expr; entity_type: SmolStr; in?: Expr } } | { "if-then-else": { if: Expr; then: Expr; else: Expr } } | { Set: Expr[] } | { Record: Record<string, Expr> };
263
+
264
+ export type Expr = ExprNoExt | ExtFuncCall;
265
+
266
+ type SmolStr = string;
267
+ type Name = string;
268
+ type Id = string;
269
+ export type TypeOfAttribute = SchemaType & { required?: boolean };
270
+ export type Context = Record<string, CedarValueJson>;
@@ -0,0 +1,310 @@
1
+ let imports = {};
2
+ imports['__wbindgen_placeholder__'] = module.exports;
3
+ let wasm;
4
+ const { TextEncoder, TextDecoder } = require(`util`);
5
+
6
+ const heap = new Array(128).fill(undefined);
7
+
8
+ heap.push(undefined, null, true, false);
9
+
10
+ function getObject(idx) { return heap[idx]; }
11
+
12
+ let heap_next = heap.length;
13
+
14
+ function addHeapObject(obj) {
15
+ if (heap_next === heap.length) heap.push(heap.length + 1);
16
+ const idx = heap_next;
17
+ heap_next = heap[idx];
18
+
19
+ heap[idx] = obj;
20
+ return idx;
21
+ }
22
+
23
+ function dropObject(idx) {
24
+ if (idx < 132) return;
25
+ heap[idx] = heap_next;
26
+ heap_next = idx;
27
+ }
28
+
29
+ function takeObject(idx) {
30
+ const ret = getObject(idx);
31
+ dropObject(idx);
32
+ return ret;
33
+ }
34
+
35
+ let WASM_VECTOR_LEN = 0;
36
+
37
+ let cachedUint8Memory0 = null;
38
+
39
+ function getUint8Memory0() {
40
+ if (cachedUint8Memory0 === null || cachedUint8Memory0.byteLength === 0) {
41
+ cachedUint8Memory0 = new Uint8Array(wasm.memory.buffer);
42
+ }
43
+ return cachedUint8Memory0;
44
+ }
45
+
46
+ let cachedTextEncoder = new TextEncoder('utf-8');
47
+
48
+ const encodeString = (typeof cachedTextEncoder.encodeInto === 'function'
49
+ ? function (arg, view) {
50
+ return cachedTextEncoder.encodeInto(arg, view);
51
+ }
52
+ : function (arg, view) {
53
+ const buf = cachedTextEncoder.encode(arg);
54
+ view.set(buf);
55
+ return {
56
+ read: arg.length,
57
+ written: buf.length
58
+ };
59
+ });
60
+
61
+ function passStringToWasm0(arg, malloc, realloc) {
62
+
63
+ if (realloc === undefined) {
64
+ const buf = cachedTextEncoder.encode(arg);
65
+ const ptr = malloc(buf.length, 1) >>> 0;
66
+ getUint8Memory0().subarray(ptr, ptr + buf.length).set(buf);
67
+ WASM_VECTOR_LEN = buf.length;
68
+ return ptr;
69
+ }
70
+
71
+ let len = arg.length;
72
+ let ptr = malloc(len, 1) >>> 0;
73
+
74
+ const mem = getUint8Memory0();
75
+
76
+ let offset = 0;
77
+
78
+ for (; offset < len; offset++) {
79
+ const code = arg.charCodeAt(offset);
80
+ if (code > 0x7F) break;
81
+ mem[ptr + offset] = code;
82
+ }
83
+
84
+ if (offset !== len) {
85
+ if (offset !== 0) {
86
+ arg = arg.slice(offset);
87
+ }
88
+ ptr = realloc(ptr, len, len = offset + arg.length * 3, 1) >>> 0;
89
+ const view = getUint8Memory0().subarray(ptr + offset, ptr + len);
90
+ const ret = encodeString(arg, view);
91
+
92
+ offset += ret.written;
93
+ ptr = realloc(ptr, len, offset, 1) >>> 0;
94
+ }
95
+
96
+ WASM_VECTOR_LEN = offset;
97
+ return ptr;
98
+ }
99
+
100
+ function isLikeNone(x) {
101
+ return x === undefined || x === null;
102
+ }
103
+
104
+ let cachedInt32Memory0 = null;
105
+
106
+ function getInt32Memory0() {
107
+ if (cachedInt32Memory0 === null || cachedInt32Memory0.byteLength === 0) {
108
+ cachedInt32Memory0 = new Int32Array(wasm.memory.buffer);
109
+ }
110
+ return cachedInt32Memory0;
111
+ }
112
+
113
+ let cachedTextDecoder = new TextDecoder('utf-8', { ignoreBOM: true, fatal: true });
114
+
115
+ cachedTextDecoder.decode();
116
+
117
+ function getStringFromWasm0(ptr, len) {
118
+ ptr = ptr >>> 0;
119
+ return cachedTextDecoder.decode(getUint8Memory0().subarray(ptr, ptr + len));
120
+ }
121
+ /**
122
+ * @param {string} json_str
123
+ * @returns {JsonToPolicyResult}
124
+ */
125
+ module.exports.policyTextFromJson = function(json_str) {
126
+ const ptr0 = passStringToWasm0(json_str, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
127
+ const len0 = WASM_VECTOR_LEN;
128
+ const ret = wasm.policyTextFromJson(ptr0, len0);
129
+ return takeObject(ret);
130
+ };
131
+
132
+ /**
133
+ * @param {string} cedar_str
134
+ * @returns {PolicyToJsonResult}
135
+ */
136
+ module.exports.policyTextToJson = function(cedar_str) {
137
+ const ptr0 = passStringToWasm0(cedar_str, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
138
+ const len0 = WASM_VECTOR_LEN;
139
+ const ret = wasm.policyTextToJson(ptr0, len0);
140
+ return takeObject(ret);
141
+ };
142
+
143
+ /**
144
+ * @param {string} input_policies_str
145
+ * @returns {CheckParsePolicySetResult}
146
+ */
147
+ module.exports.checkParsePolicySet = function(input_policies_str) {
148
+ const ptr0 = passStringToWasm0(input_policies_str, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
149
+ const len0 = WASM_VECTOR_LEN;
150
+ const ret = wasm.checkParsePolicySet(ptr0, len0);
151
+ return takeObject(ret);
152
+ };
153
+
154
+ /**
155
+ * @param {string} template_str
156
+ * @returns {CheckParseTemplateResult}
157
+ */
158
+ module.exports.checkParseTemplate = function(template_str) {
159
+ const ptr0 = passStringToWasm0(template_str, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
160
+ const len0 = WASM_VECTOR_LEN;
161
+ const ret = wasm.checkParseTemplate(ptr0, len0);
162
+ return takeObject(ret);
163
+ };
164
+
165
+ /**
166
+ * @param {string} input_schema
167
+ * @returns {CheckParseResult}
168
+ */
169
+ module.exports.checkParseSchema = function(input_schema) {
170
+ const ptr0 = passStringToWasm0(input_schema, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
171
+ const len0 = WASM_VECTOR_LEN;
172
+ const ret = wasm.checkParseSchema(ptr0, len0);
173
+ return takeObject(ret);
174
+ };
175
+
176
+ /**
177
+ * @param {string} entities_str
178
+ * @param {string} schema_str
179
+ * @returns {CheckParseResult}
180
+ */
181
+ module.exports.checkParseEntities = function(entities_str, schema_str) {
182
+ const ptr0 = passStringToWasm0(entities_str, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
183
+ const len0 = WASM_VECTOR_LEN;
184
+ const ptr1 = passStringToWasm0(schema_str, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
185
+ const len1 = WASM_VECTOR_LEN;
186
+ const ret = wasm.checkParseEntities(ptr0, len0, ptr1, len1);
187
+ return takeObject(ret);
188
+ };
189
+
190
+ /**
191
+ * @param {string} context_str
192
+ * @param {string} action_str
193
+ * @param {string} schema_str
194
+ * @returns {CheckParseResult}
195
+ */
196
+ module.exports.checkParseContext = function(context_str, action_str, schema_str) {
197
+ const ptr0 = passStringToWasm0(context_str, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
198
+ const len0 = WASM_VECTOR_LEN;
199
+ const ptr1 = passStringToWasm0(action_str, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
200
+ const len1 = WASM_VECTOR_LEN;
201
+ const ptr2 = passStringToWasm0(schema_str, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
202
+ const len2 = WASM_VECTOR_LEN;
203
+ const ret = wasm.checkParseContext(ptr0, len0, ptr1, len1, ptr2, len2);
204
+ return takeObject(ret);
205
+ };
206
+
207
+ /**
208
+ * @param {string} policies_str
209
+ * @param {number} line_width
210
+ * @param {number} indent_width
211
+ * @returns {FormattingResult}
212
+ */
213
+ module.exports.formatPolicies = function(policies_str, line_width, indent_width) {
214
+ const ptr0 = passStringToWasm0(policies_str, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
215
+ const len0 = WASM_VECTOR_LEN;
216
+ const ret = wasm.formatPolicies(ptr0, len0, line_width, indent_width);
217
+ return takeObject(ret);
218
+ };
219
+
220
+ /**
221
+ * @returns {string}
222
+ */
223
+ module.exports.getCedarVersion = function() {
224
+ let deferred1_0;
225
+ let deferred1_1;
226
+ try {
227
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
228
+ wasm.getCedarVersion(retptr);
229
+ var r0 = getInt32Memory0()[retptr / 4 + 0];
230
+ var r1 = getInt32Memory0()[retptr / 4 + 1];
231
+ deferred1_0 = r0;
232
+ deferred1_1 = r1;
233
+ return getStringFromWasm0(r0, r1);
234
+ } finally {
235
+ wasm.__wbindgen_add_to_stack_pointer(16);
236
+ wasm.__wbindgen_free(deferred1_0, deferred1_1, 1);
237
+ }
238
+ };
239
+
240
+ /**
241
+ * @param {AuthorizationCall} call
242
+ * @returns {AuthorizationAnswer}
243
+ */
244
+ module.exports.isAuthorized = function(call) {
245
+ const ret = wasm.isAuthorized(addHeapObject(call));
246
+ return takeObject(ret);
247
+ };
248
+
249
+ /**
250
+ * @param {ValidationCall} call
251
+ * @returns {ValidationAnswer}
252
+ */
253
+ module.exports.validate = function(call) {
254
+ const ret = wasm.validate(addHeapObject(call));
255
+ return takeObject(ret);
256
+ };
257
+
258
+ function handleError(f, args) {
259
+ try {
260
+ return f.apply(this, args);
261
+ } catch (e) {
262
+ wasm.__wbindgen_exn_store(addHeapObject(e));
263
+ }
264
+ }
265
+
266
+ module.exports.__wbindgen_is_undefined = function(arg0) {
267
+ const ret = getObject(arg0) === undefined;
268
+ return ret;
269
+ };
270
+
271
+ module.exports.__wbindgen_object_clone_ref = function(arg0) {
272
+ const ret = getObject(arg0);
273
+ return addHeapObject(ret);
274
+ };
275
+
276
+ module.exports.__wbindgen_object_drop_ref = function(arg0) {
277
+ takeObject(arg0);
278
+ };
279
+
280
+ module.exports.__wbindgen_string_get = function(arg0, arg1) {
281
+ const obj = getObject(arg1);
282
+ const ret = typeof(obj) === 'string' ? obj : undefined;
283
+ var ptr1 = isLikeNone(ret) ? 0 : passStringToWasm0(ret, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
284
+ var len1 = WASM_VECTOR_LEN;
285
+ getInt32Memory0()[arg0 / 4 + 1] = len1;
286
+ getInt32Memory0()[arg0 / 4 + 0] = ptr1;
287
+ };
288
+
289
+ module.exports.__wbg_parse_66d1801634e099ac = function() { return handleError(function (arg0, arg1) {
290
+ const ret = JSON.parse(getStringFromWasm0(arg0, arg1));
291
+ return addHeapObject(ret);
292
+ }, arguments) };
293
+
294
+ module.exports.__wbg_stringify_8887fe74e1c50d81 = function() { return handleError(function (arg0) {
295
+ const ret = JSON.stringify(getObject(arg0));
296
+ return addHeapObject(ret);
297
+ }, arguments) };
298
+
299
+ module.exports.__wbindgen_throw = function(arg0, arg1) {
300
+ throw new Error(getStringFromWasm0(arg0, arg1));
301
+ };
302
+
303
+ const path = require('path').join(__dirname, 'cedar_wasm_bg.wasm');
304
+ const bytes = require('fs').readFileSync(path);
305
+
306
+ const wasmModule = new WebAssembly.Module(bytes);
307
+ const wasmInstance = new WebAssembly.Instance(wasmModule, imports);
308
+ wasm = wasmInstance.exports;
309
+ module.exports.__wasm = wasm;
310
+
Binary file
@@ -0,0 +1,19 @@
1
+ /* tslint:disable */
2
+ /* eslint-disable */
3
+ export const memory: WebAssembly.Memory;
4
+ export function policyTextFromJson(a: number, b: number): number;
5
+ export function policyTextToJson(a: number, b: number): number;
6
+ export function checkParsePolicySet(a: number, b: number): number;
7
+ export function checkParseTemplate(a: number, b: number): number;
8
+ export function checkParseSchema(a: number, b: number): number;
9
+ export function checkParseEntities(a: number, b: number, c: number, d: number): number;
10
+ export function checkParseContext(a: number, b: number, c: number, d: number, e: number, f: number): number;
11
+ export function formatPolicies(a: number, b: number, c: number, d: number): number;
12
+ export function getCedarVersion(a: number): void;
13
+ export function isAuthorized(a: number): number;
14
+ export function validate(a: number): number;
15
+ export function __wbindgen_malloc(a: number, b: number): number;
16
+ export function __wbindgen_realloc(a: number, b: number, c: number, d: number): number;
17
+ export function __wbindgen_add_to_stack_pointer(a: number): number;
18
+ export function __wbindgen_free(a: number, b: number, c: number): void;
19
+ export function __wbindgen_exn_store(a: number): void;
@@ -0,0 +1,15 @@
1
+ {
2
+ "name": "@cedar-policy/cedar-wasm",
3
+ "description": "Wasm bindings and typescript types for Cedar lib",
4
+ "version": "3.2.2",
5
+ "license": "Apache-2.0",
6
+ "files": [
7
+ "cedar_wasm_bg.wasm",
8
+ "cedar_wasm_bg.wasm.d.ts",
9
+ "cedar_wasm.js",
10
+ "cedar_wasm.d.ts"
11
+ ],
12
+ "main": "cedar_wasm.js",
13
+ "types": "cedar_wasm.d.ts",
14
+ "type": "commonjs"
15
+ }
package/package.json CHANGED
@@ -1,12 +1,28 @@
1
1
  {
2
2
  "name": "@cedar-policy/cedar-wasm",
3
- "description": "WASM bindings and typescript types for Cedar lib",
4
- "version": "3.2.1",
3
+ "description": "Wasm bindings and typescript types for Cedar lib",
4
+ "version": "3.2.2",
5
5
  "license": "Apache-2.0",
6
6
  "files": [
7
- "esm/*",
8
- "nodejs/*",
9
- "web/*"
7
+ "esm/package.json",
8
+ "esm/README.md",
9
+ "esm/cedar_wasm_bg.wasm",
10
+ "esm/cedar_wasm_bg.wasm.d.ts",
11
+ "esm/cedar_wasm.js",
12
+ "esm/cedar_wasm_bg.js",
13
+ "esm/cedar_wasm.d.ts",
14
+ "nodejs/package.json",
15
+ "nodejs/README.md",
16
+ "nodejs/cedar_wasm_bg.wasm",
17
+ "nodejs/cedar_wasm_bg.wasm.d.ts",
18
+ "nodejs/cedar_wasm.js",
19
+ "nodejs/cedar_wasm.d.ts",
20
+ "web/package.json",
21
+ "web/README.md",
22
+ "web/cedar_wasm_bg.wasm",
23
+ "web/cedar_wasm_bg.wasm.d.ts",
24
+ "web/cedar_wasm.js",
25
+ "web/cedar_wasm.d.ts"
10
26
  ],
11
27
  "module": "esm/cedar_wasm.js",
12
28
  "types": "esm/cedar_wasm.d.ts",