@cedar-policy/cedar-wasm 4.7.0 → 4.8.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.
- package/esm/cedar_wasm.d.ts +230 -208
- package/esm/cedar_wasm_bg.js +171 -179
- package/esm/cedar_wasm_bg.wasm +0 -0
- package/esm/cedar_wasm_bg.wasm.d.ts +6 -6
- package/esm/package.json +1 -1
- package/nodejs/cedar_wasm.d.ts +230 -208
- package/nodejs/cedar_wasm.js +209 -194
- package/nodejs/cedar_wasm_bg.wasm +0 -0
- package/nodejs/cedar_wasm_bg.wasm.d.ts +6 -6
- package/nodejs/package.json +1 -1
- package/package.json +1 -1
- package/web/cedar_wasm.d.ts +237 -214
- package/web/cedar_wasm.js +169 -189
- package/web/cedar_wasm_bg.wasm +0 -0
- package/web/cedar_wasm_bg.wasm.d.ts +6 -6
- package/web/package.json +1 -1
package/nodejs/cedar_wasm.js
CHANGED
|
@@ -2,21 +2,18 @@
|
|
|
2
2
|
let imports = {};
|
|
3
3
|
imports['__wbindgen_placeholder__'] = module.exports;
|
|
4
4
|
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
cachedUint8ArrayMemory0 = new Uint8Array(wasm.memory.buffer);
|
|
10
|
-
}
|
|
11
|
-
return cachedUint8ArrayMemory0;
|
|
5
|
+
function addToExternrefTable0(obj) {
|
|
6
|
+
const idx = wasm.__externref_table_alloc();
|
|
7
|
+
wasm.__wbindgen_externrefs.set(idx, obj);
|
|
8
|
+
return idx;
|
|
12
9
|
}
|
|
13
10
|
|
|
14
|
-
let
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
return
|
|
11
|
+
let cachedDataViewMemory0 = null;
|
|
12
|
+
function getDataViewMemory0() {
|
|
13
|
+
if (cachedDataViewMemory0 === null || cachedDataViewMemory0.buffer.detached === true || (cachedDataViewMemory0.buffer.detached === undefined && cachedDataViewMemory0.buffer !== wasm.memory.buffer)) {
|
|
14
|
+
cachedDataViewMemory0 = new DataView(wasm.memory.buffer);
|
|
15
|
+
}
|
|
16
|
+
return cachedDataViewMemory0;
|
|
20
17
|
}
|
|
21
18
|
|
|
22
19
|
function getStringFromWasm0(ptr, len) {
|
|
@@ -24,10 +21,12 @@ function getStringFromWasm0(ptr, len) {
|
|
|
24
21
|
return decodeText(ptr, len);
|
|
25
22
|
}
|
|
26
23
|
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
24
|
+
let cachedUint8ArrayMemory0 = null;
|
|
25
|
+
function getUint8ArrayMemory0() {
|
|
26
|
+
if (cachedUint8ArrayMemory0 === null || cachedUint8ArrayMemory0.byteLength === 0) {
|
|
27
|
+
cachedUint8ArrayMemory0 = new Uint8Array(wasm.memory.buffer);
|
|
28
|
+
}
|
|
29
|
+
return cachedUint8ArrayMemory0;
|
|
31
30
|
}
|
|
32
31
|
|
|
33
32
|
function handleError(f, args) {
|
|
@@ -39,23 +38,11 @@ function handleError(f, args) {
|
|
|
39
38
|
}
|
|
40
39
|
}
|
|
41
40
|
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
const cachedTextEncoder = new TextEncoder();
|
|
45
|
-
|
|
46
|
-
if (!('encodeInto' in cachedTextEncoder)) {
|
|
47
|
-
cachedTextEncoder.encodeInto = function (arg, view) {
|
|
48
|
-
const buf = cachedTextEncoder.encode(arg);
|
|
49
|
-
view.set(buf);
|
|
50
|
-
return {
|
|
51
|
-
read: arg.length,
|
|
52
|
-
written: buf.length
|
|
53
|
-
};
|
|
54
|
-
}
|
|
41
|
+
function isLikeNone(x) {
|
|
42
|
+
return x === undefined || x === null;
|
|
55
43
|
}
|
|
56
44
|
|
|
57
45
|
function passStringToWasm0(arg, malloc, realloc) {
|
|
58
|
-
|
|
59
46
|
if (realloc === undefined) {
|
|
60
47
|
const buf = cachedTextEncoder.encode(arg);
|
|
61
48
|
const ptr = malloc(buf.length, 1) >>> 0;
|
|
@@ -76,7 +63,6 @@ function passStringToWasm0(arg, malloc, realloc) {
|
|
|
76
63
|
if (code > 0x7F) break;
|
|
77
64
|
mem[ptr + offset] = code;
|
|
78
65
|
}
|
|
79
|
-
|
|
80
66
|
if (offset !== len) {
|
|
81
67
|
if (offset !== 0) {
|
|
82
68
|
arg = arg.slice(offset);
|
|
@@ -93,22 +79,104 @@ function passStringToWasm0(arg, malloc, realloc) {
|
|
|
93
79
|
return ptr;
|
|
94
80
|
}
|
|
95
81
|
|
|
96
|
-
|
|
97
|
-
|
|
82
|
+
let cachedTextDecoder = new TextDecoder('utf-8', { ignoreBOM: true, fatal: true });
|
|
83
|
+
cachedTextDecoder.decode();
|
|
84
|
+
function decodeText(ptr, len) {
|
|
85
|
+
return cachedTextDecoder.decode(getUint8ArrayMemory0().subarray(ptr, ptr + len));
|
|
98
86
|
}
|
|
99
87
|
|
|
100
|
-
|
|
88
|
+
const cachedTextEncoder = new TextEncoder();
|
|
101
89
|
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
90
|
+
if (!('encodeInto' in cachedTextEncoder)) {
|
|
91
|
+
cachedTextEncoder.encodeInto = function (arg, view) {
|
|
92
|
+
const buf = cachedTextEncoder.encode(arg);
|
|
93
|
+
view.set(buf);
|
|
94
|
+
return {
|
|
95
|
+
read: arg.length,
|
|
96
|
+
written: buf.length
|
|
97
|
+
};
|
|
105
98
|
}
|
|
106
|
-
return cachedDataViewMemory0;
|
|
107
99
|
}
|
|
100
|
+
|
|
101
|
+
let WASM_VECTOR_LEN = 0;
|
|
102
|
+
|
|
103
|
+
/**
|
|
104
|
+
* Check whether a context successfully parses.
|
|
105
|
+
* @param {ContextParsingCall} call
|
|
106
|
+
* @returns {CheckParseAnswer}
|
|
107
|
+
*/
|
|
108
|
+
function checkParseContext(call) {
|
|
109
|
+
const ret = wasm.checkParseContext(call);
|
|
110
|
+
return ret;
|
|
111
|
+
}
|
|
112
|
+
exports.checkParseContext = checkParseContext;
|
|
113
|
+
|
|
114
|
+
/**
|
|
115
|
+
* Check whether a set of entities successfully parses.
|
|
116
|
+
* @param {EntitiesParsingCall} call
|
|
117
|
+
* @returns {CheckParseAnswer}
|
|
118
|
+
*/
|
|
119
|
+
function checkParseEntities(call) {
|
|
120
|
+
const ret = wasm.checkParseEntities(call);
|
|
121
|
+
return ret;
|
|
122
|
+
}
|
|
123
|
+
exports.checkParseEntities = checkParseEntities;
|
|
124
|
+
|
|
125
|
+
/**
|
|
126
|
+
* Check whether a policy set successfully parses.
|
|
127
|
+
* @param {PolicySet} policies
|
|
128
|
+
* @returns {CheckParseAnswer}
|
|
129
|
+
*/
|
|
130
|
+
function checkParsePolicySet(policies) {
|
|
131
|
+
const ret = wasm.checkParsePolicySet(policies);
|
|
132
|
+
return ret;
|
|
133
|
+
}
|
|
134
|
+
exports.checkParsePolicySet = checkParsePolicySet;
|
|
135
|
+
|
|
136
|
+
/**
|
|
137
|
+
* Check whether a schema successfully parses.
|
|
138
|
+
* @param {Schema} schema
|
|
139
|
+
* @returns {CheckParseAnswer}
|
|
140
|
+
*/
|
|
141
|
+
function checkParseSchema(schema) {
|
|
142
|
+
const ret = wasm.checkParseSchema(schema);
|
|
143
|
+
return ret;
|
|
144
|
+
}
|
|
145
|
+
exports.checkParseSchema = checkParseSchema;
|
|
146
|
+
|
|
147
|
+
/**
|
|
148
|
+
* Apply the Cedar policy formatter to a policy set in the Cedar policy format
|
|
149
|
+
* @param {FormattingCall} call
|
|
150
|
+
* @returns {FormattingAnswer}
|
|
151
|
+
*/
|
|
152
|
+
function formatPolicies(call) {
|
|
153
|
+
const ret = wasm.formatPolicies(call);
|
|
154
|
+
return ret;
|
|
155
|
+
}
|
|
156
|
+
exports.formatPolicies = formatPolicies;
|
|
157
|
+
|
|
158
|
+
/**
|
|
159
|
+
* Get language version of Cedar
|
|
160
|
+
* @returns {string}
|
|
161
|
+
*/
|
|
162
|
+
function getCedarLangVersion() {
|
|
163
|
+
let deferred1_0;
|
|
164
|
+
let deferred1_1;
|
|
165
|
+
try {
|
|
166
|
+
const ret = wasm.getCedarLangVersion();
|
|
167
|
+
deferred1_0 = ret[0];
|
|
168
|
+
deferred1_1 = ret[1];
|
|
169
|
+
return getStringFromWasm0(ret[0], ret[1]);
|
|
170
|
+
} finally {
|
|
171
|
+
wasm.__wbindgen_free(deferred1_0, deferred1_1, 1);
|
|
172
|
+
}
|
|
173
|
+
}
|
|
174
|
+
exports.getCedarLangVersion = getCedarLangVersion;
|
|
175
|
+
|
|
108
176
|
/**
|
|
109
177
|
* @returns {string}
|
|
110
178
|
*/
|
|
111
|
-
|
|
179
|
+
function getCedarSDKVersion() {
|
|
112
180
|
let deferred1_0;
|
|
113
181
|
let deferred1_1;
|
|
114
182
|
try {
|
|
@@ -119,12 +187,13 @@ exports.getCedarSDKVersion = function() {
|
|
|
119
187
|
} finally {
|
|
120
188
|
wasm.__wbindgen_free(deferred1_0, deferred1_1, 1);
|
|
121
189
|
}
|
|
122
|
-
}
|
|
190
|
+
}
|
|
191
|
+
exports.getCedarSDKVersion = getCedarSDKVersion;
|
|
123
192
|
|
|
124
193
|
/**
|
|
125
194
|
* @returns {string}
|
|
126
195
|
*/
|
|
127
|
-
|
|
196
|
+
function getCedarVersion() {
|
|
128
197
|
let deferred1_0;
|
|
129
198
|
let deferred1_1;
|
|
130
199
|
try {
|
|
@@ -135,7 +204,8 @@ exports.getCedarVersion = function() {
|
|
|
135
204
|
} finally {
|
|
136
205
|
wasm.__wbindgen_free(deferred1_0, deferred1_1, 1);
|
|
137
206
|
}
|
|
138
|
-
}
|
|
207
|
+
}
|
|
208
|
+
exports.getCedarVersion = getCedarVersion;
|
|
139
209
|
|
|
140
210
|
/**
|
|
141
211
|
* Get valid request environment
|
|
@@ -143,10 +213,11 @@ exports.getCedarVersion = function() {
|
|
|
143
213
|
* @param {Schema} s
|
|
144
214
|
* @returns {GetValidRequestEnvsResult}
|
|
145
215
|
*/
|
|
146
|
-
|
|
216
|
+
function getValidRequestEnvsPolicy(t, s) {
|
|
147
217
|
const ret = wasm.getValidRequestEnvsPolicy(t, s);
|
|
148
218
|
return ret;
|
|
149
|
-
}
|
|
219
|
+
}
|
|
220
|
+
exports.getValidRequestEnvsPolicy = getValidRequestEnvsPolicy;
|
|
150
221
|
|
|
151
222
|
/**
|
|
152
223
|
* Get valid request environment
|
|
@@ -154,33 +225,58 @@ exports.getValidRequestEnvsPolicy = function(t, s) {
|
|
|
154
225
|
* @param {Schema} s
|
|
155
226
|
* @returns {GetValidRequestEnvsResult}
|
|
156
227
|
*/
|
|
157
|
-
|
|
228
|
+
function getValidRequestEnvsTemplate(t, s) {
|
|
158
229
|
const ret = wasm.getValidRequestEnvsTemplate(t, s);
|
|
159
230
|
return ret;
|
|
160
|
-
}
|
|
231
|
+
}
|
|
232
|
+
exports.getValidRequestEnvsTemplate = getValidRequestEnvsTemplate;
|
|
161
233
|
|
|
162
234
|
/**
|
|
163
|
-
*
|
|
164
|
-
*
|
|
165
|
-
* This function works like [`is_authorized`] but retrieves schemas and policy sets
|
|
166
|
-
* from thread-local cache instead of parsing them on each call.
|
|
167
|
-
* @param {StatefulAuthorizationCall} call
|
|
235
|
+
* Basic interface, using [`AuthorizationCall`] and [`AuthorizationAnswer`] types
|
|
236
|
+
* @param {AuthorizationCall} call
|
|
168
237
|
* @returns {AuthorizationAnswer}
|
|
169
238
|
*/
|
|
170
|
-
|
|
171
|
-
const ret = wasm.
|
|
239
|
+
function isAuthorized(call) {
|
|
240
|
+
const ret = wasm.isAuthorized(call);
|
|
172
241
|
return ret;
|
|
173
|
-
}
|
|
242
|
+
}
|
|
243
|
+
exports.isAuthorized = isAuthorized;
|
|
174
244
|
|
|
175
245
|
/**
|
|
176
|
-
*
|
|
177
|
-
*
|
|
178
|
-
* @
|
|
246
|
+
* Takes a `PolicySet` represented as string and return the policies
|
|
247
|
+
* and templates split into vecs and sorted by id.
|
|
248
|
+
* @param {string} policyset_str
|
|
249
|
+
* @returns {PolicySetTextToPartsAnswer}
|
|
179
250
|
*/
|
|
180
|
-
|
|
181
|
-
const
|
|
251
|
+
function policySetTextToParts(policyset_str) {
|
|
252
|
+
const ptr0 = passStringToWasm0(policyset_str, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
253
|
+
const len0 = WASM_VECTOR_LEN;
|
|
254
|
+
const ret = wasm.policySetTextToParts(ptr0, len0);
|
|
182
255
|
return ret;
|
|
183
|
-
}
|
|
256
|
+
}
|
|
257
|
+
exports.policySetTextToParts = policySetTextToParts;
|
|
258
|
+
|
|
259
|
+
/**
|
|
260
|
+
* Return the JSON representation of a policy.
|
|
261
|
+
* @param {Policy} policy
|
|
262
|
+
* @returns {PolicyToJsonAnswer}
|
|
263
|
+
*/
|
|
264
|
+
function policyToJson(policy) {
|
|
265
|
+
const ret = wasm.policyToJson(policy);
|
|
266
|
+
return ret;
|
|
267
|
+
}
|
|
268
|
+
exports.policyToJson = policyToJson;
|
|
269
|
+
|
|
270
|
+
/**
|
|
271
|
+
* Return the Cedar (textual) representation of a policy.
|
|
272
|
+
* @param {Policy} policy
|
|
273
|
+
* @returns {PolicyToTextAnswer}
|
|
274
|
+
*/
|
|
275
|
+
function policyToText(policy) {
|
|
276
|
+
const ret = wasm.policyToText(policy);
|
|
277
|
+
return ret;
|
|
278
|
+
}
|
|
279
|
+
exports.policyToText = policyToText;
|
|
184
280
|
|
|
185
281
|
/**
|
|
186
282
|
* Preparse and cache a policy set in thread-local storage
|
|
@@ -192,12 +288,13 @@ exports.isAuthorized = function(call) {
|
|
|
192
288
|
* @param {PolicySet} policies
|
|
193
289
|
* @returns {CheckParseAnswer}
|
|
194
290
|
*/
|
|
195
|
-
|
|
291
|
+
function preparsePolicySet(pset_id, policies) {
|
|
196
292
|
const ptr0 = passStringToWasm0(pset_id, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
197
293
|
const len0 = WASM_VECTOR_LEN;
|
|
198
294
|
const ret = wasm.preparsePolicySet(ptr0, len0, policies);
|
|
199
295
|
return ret;
|
|
200
|
-
}
|
|
296
|
+
}
|
|
297
|
+
exports.preparsePolicySet = preparsePolicySet;
|
|
201
298
|
|
|
202
299
|
/**
|
|
203
300
|
* Preparse and cache a schema in thread-local storage
|
|
@@ -209,152 +306,71 @@ exports.preparsePolicySet = function(pset_id, policies) {
|
|
|
209
306
|
* @param {Schema} schema
|
|
210
307
|
* @returns {CheckParseAnswer}
|
|
211
308
|
*/
|
|
212
|
-
|
|
309
|
+
function preparseSchema(schema_name, schema) {
|
|
213
310
|
const ptr0 = passStringToWasm0(schema_name, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
214
311
|
const len0 = WASM_VECTOR_LEN;
|
|
215
312
|
const ret = wasm.preparseSchema(ptr0, len0, schema);
|
|
216
313
|
return ret;
|
|
217
|
-
}
|
|
218
|
-
|
|
219
|
-
/**
|
|
220
|
-
* Check whether a policy set successfully parses.
|
|
221
|
-
* @param {PolicySet} policies
|
|
222
|
-
* @returns {CheckParseAnswer}
|
|
223
|
-
*/
|
|
224
|
-
exports.checkParsePolicySet = function(policies) {
|
|
225
|
-
const ret = wasm.checkParsePolicySet(policies);
|
|
226
|
-
return ret;
|
|
227
|
-
};
|
|
228
|
-
|
|
229
|
-
/**
|
|
230
|
-
* Check whether a context successfully parses.
|
|
231
|
-
* @param {ContextParsingCall} call
|
|
232
|
-
* @returns {CheckParseAnswer}
|
|
233
|
-
*/
|
|
234
|
-
exports.checkParseContext = function(call) {
|
|
235
|
-
const ret = wasm.checkParseContext(call);
|
|
236
|
-
return ret;
|
|
237
|
-
};
|
|
314
|
+
}
|
|
315
|
+
exports.preparseSchema = preparseSchema;
|
|
238
316
|
|
|
239
317
|
/**
|
|
240
|
-
*
|
|
318
|
+
* Return the JSON representation of a schema.
|
|
241
319
|
* @param {Schema} schema
|
|
242
|
-
* @returns {
|
|
320
|
+
* @returns {SchemaToJsonAnswer}
|
|
243
321
|
*/
|
|
244
|
-
|
|
245
|
-
const ret = wasm.
|
|
322
|
+
function schemaToJson(schema) {
|
|
323
|
+
const ret = wasm.schemaToJson(schema);
|
|
246
324
|
return ret;
|
|
247
|
-
}
|
|
325
|
+
}
|
|
326
|
+
exports.schemaToJson = schemaToJson;
|
|
248
327
|
|
|
249
328
|
/**
|
|
250
|
-
*
|
|
251
|
-
* @param {
|
|
252
|
-
* @returns {
|
|
329
|
+
* Return the Cedar (textual) representation of a schema.
|
|
330
|
+
* @param {Schema} schema
|
|
331
|
+
* @returns {SchemaToTextAnswer}
|
|
253
332
|
*/
|
|
254
|
-
|
|
255
|
-
const ret = wasm.
|
|
333
|
+
function schemaToText(schema) {
|
|
334
|
+
const ret = wasm.schemaToText(schema);
|
|
256
335
|
return ret;
|
|
257
|
-
}
|
|
336
|
+
}
|
|
337
|
+
exports.schemaToText = schemaToText;
|
|
258
338
|
|
|
259
339
|
/**
|
|
260
|
-
*
|
|
261
|
-
*
|
|
262
|
-
*
|
|
263
|
-
*
|
|
340
|
+
* Stateful authorization using preparsed schemas and policy sets.
|
|
341
|
+
*
|
|
342
|
+
* This function works like [`is_authorized`] but retrieves schemas and policy sets
|
|
343
|
+
* from thread-local cache instead of parsing them on each call.
|
|
344
|
+
* @param {StatefulAuthorizationCall} call
|
|
345
|
+
* @returns {AuthorizationAnswer}
|
|
264
346
|
*/
|
|
265
|
-
|
|
266
|
-
const
|
|
267
|
-
const len0 = WASM_VECTOR_LEN;
|
|
268
|
-
const ret = wasm.policySetTextToParts(ptr0, len0);
|
|
347
|
+
function statefulIsAuthorized(call) {
|
|
348
|
+
const ret = wasm.statefulIsAuthorized(call);
|
|
269
349
|
return ret;
|
|
270
|
-
}
|
|
350
|
+
}
|
|
351
|
+
exports.statefulIsAuthorized = statefulIsAuthorized;
|
|
271
352
|
|
|
272
353
|
/**
|
|
273
354
|
* Return the JSON representation of a template.
|
|
274
355
|
* @param {Template} template
|
|
275
356
|
* @returns {PolicyToJsonAnswer}
|
|
276
357
|
*/
|
|
277
|
-
|
|
358
|
+
function templateToJson(template) {
|
|
278
359
|
const ret = wasm.templateToJson(template);
|
|
279
360
|
return ret;
|
|
280
|
-
}
|
|
281
|
-
|
|
282
|
-
/**
|
|
283
|
-
* Return the Cedar (textual) representation of a policy.
|
|
284
|
-
* @param {Policy} policy
|
|
285
|
-
* @returns {PolicyToTextAnswer}
|
|
286
|
-
*/
|
|
287
|
-
exports.policyToText = function(policy) {
|
|
288
|
-
const ret = wasm.policyToText(policy);
|
|
289
|
-
return ret;
|
|
290
|
-
};
|
|
291
|
-
|
|
292
|
-
/**
|
|
293
|
-
* Return the JSON representation of a schema.
|
|
294
|
-
* @param {Schema} schema
|
|
295
|
-
* @returns {SchemaToJsonAnswer}
|
|
296
|
-
*/
|
|
297
|
-
exports.schemaToJson = function(schema) {
|
|
298
|
-
const ret = wasm.schemaToJson(schema);
|
|
299
|
-
return ret;
|
|
300
|
-
};
|
|
361
|
+
}
|
|
362
|
+
exports.templateToJson = templateToJson;
|
|
301
363
|
|
|
302
364
|
/**
|
|
303
365
|
* Return the Cedar (textual) representation of a template.
|
|
304
366
|
* @param {Template} template
|
|
305
367
|
* @returns {PolicyToTextAnswer}
|
|
306
368
|
*/
|
|
307
|
-
|
|
369
|
+
function templateToText(template) {
|
|
308
370
|
const ret = wasm.templateToText(template);
|
|
309
371
|
return ret;
|
|
310
|
-
}
|
|
311
|
-
|
|
312
|
-
/**
|
|
313
|
-
* Return the JSON representation of a policy.
|
|
314
|
-
* @param {Policy} policy
|
|
315
|
-
* @returns {PolicyToJsonAnswer}
|
|
316
|
-
*/
|
|
317
|
-
exports.policyToJson = function(policy) {
|
|
318
|
-
const ret = wasm.policyToJson(policy);
|
|
319
|
-
return ret;
|
|
320
|
-
};
|
|
321
|
-
|
|
322
|
-
/**
|
|
323
|
-
* Return the Cedar (textual) representation of a schema.
|
|
324
|
-
* @param {Schema} schema
|
|
325
|
-
* @returns {SchemaToTextAnswer}
|
|
326
|
-
*/
|
|
327
|
-
exports.schemaToText = function(schema) {
|
|
328
|
-
const ret = wasm.schemaToText(schema);
|
|
329
|
-
return ret;
|
|
330
|
-
};
|
|
331
|
-
|
|
332
|
-
/**
|
|
333
|
-
* Get language version of Cedar
|
|
334
|
-
* @returns {string}
|
|
335
|
-
*/
|
|
336
|
-
exports.getCedarLangVersion = function() {
|
|
337
|
-
let deferred1_0;
|
|
338
|
-
let deferred1_1;
|
|
339
|
-
try {
|
|
340
|
-
const ret = wasm.getCedarLangVersion();
|
|
341
|
-
deferred1_0 = ret[0];
|
|
342
|
-
deferred1_1 = ret[1];
|
|
343
|
-
return getStringFromWasm0(ret[0], ret[1]);
|
|
344
|
-
} finally {
|
|
345
|
-
wasm.__wbindgen_free(deferred1_0, deferred1_1, 1);
|
|
346
|
-
}
|
|
347
|
-
};
|
|
348
|
-
|
|
349
|
-
/**
|
|
350
|
-
* Apply the Cedar policy formatter to a policy set in the Cedar policy format
|
|
351
|
-
* @param {FormattingCall} call
|
|
352
|
-
* @returns {FormattingAnswer}
|
|
353
|
-
*/
|
|
354
|
-
exports.formatPolicies = function(call) {
|
|
355
|
-
const ret = wasm.formatPolicies(call);
|
|
356
|
-
return ret;
|
|
357
|
-
};
|
|
372
|
+
}
|
|
373
|
+
exports.templateToText = templateToText;
|
|
358
374
|
|
|
359
375
|
/**
|
|
360
376
|
* Parse a policy set and optionally validate it against a provided schema
|
|
@@ -364,27 +380,18 @@ exports.formatPolicies = function(call) {
|
|
|
364
380
|
* @param {ValidationCall} call
|
|
365
381
|
* @returns {ValidationAnswer}
|
|
366
382
|
*/
|
|
367
|
-
|
|
383
|
+
function validate(call) {
|
|
368
384
|
const ret = wasm.validate(call);
|
|
369
385
|
return ret;
|
|
370
|
-
}
|
|
371
|
-
|
|
372
|
-
exports.__wbg_parse_442f5ba02e5eaf8b = function() { return handleError(function (arg0, arg1) {
|
|
373
|
-
const ret = JSON.parse(getStringFromWasm0(arg0, arg1));
|
|
374
|
-
return ret;
|
|
375
|
-
}, arguments) };
|
|
376
|
-
|
|
377
|
-
exports.__wbg_stringify_b98c93d0a190446a = function() { return handleError(function (arg0) {
|
|
378
|
-
const ret = JSON.stringify(arg0);
|
|
379
|
-
return ret;
|
|
380
|
-
}, arguments) };
|
|
386
|
+
}
|
|
387
|
+
exports.validate = validate;
|
|
381
388
|
|
|
382
|
-
exports.
|
|
389
|
+
exports.__wbg___wbindgen_is_undefined_f6b95eab589e0269 = function(arg0) {
|
|
383
390
|
const ret = arg0 === undefined;
|
|
384
391
|
return ret;
|
|
385
392
|
};
|
|
386
393
|
|
|
387
|
-
exports.
|
|
394
|
+
exports.__wbg___wbindgen_string_get_a2a31e16edf96e42 = function(arg0, arg1) {
|
|
388
395
|
const obj = arg1;
|
|
389
396
|
const ret = typeof(obj) === 'string' ? obj : undefined;
|
|
390
397
|
var ptr1 = isLikeNone(ret) ? 0 : passStringToWasm0(ret, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
@@ -393,19 +400,28 @@ exports.__wbg_wbindgenstringget_0f16a6ddddef376f = function(arg0, arg1) {
|
|
|
393
400
|
getDataViewMemory0().setInt32(arg0 + 4 * 0, ptr1, true);
|
|
394
401
|
};
|
|
395
402
|
|
|
396
|
-
exports.
|
|
403
|
+
exports.__wbg___wbindgen_throw_dd24417ed36fc46e = function(arg0, arg1) {
|
|
397
404
|
throw new Error(getStringFromWasm0(arg0, arg1));
|
|
398
405
|
};
|
|
399
406
|
|
|
407
|
+
exports.__wbg_parse_a09a54cf72639456 = function() { return handleError(function (arg0, arg1) {
|
|
408
|
+
const ret = JSON.parse(getStringFromWasm0(arg0, arg1));
|
|
409
|
+
return ret;
|
|
410
|
+
}, arguments) };
|
|
411
|
+
|
|
412
|
+
exports.__wbg_stringify_655a6390e1f5eb6b = function() { return handleError(function (arg0) {
|
|
413
|
+
const ret = JSON.stringify(arg0);
|
|
414
|
+
return ret;
|
|
415
|
+
}, arguments) };
|
|
416
|
+
|
|
400
417
|
exports.__wbindgen_init_externref_table = function() {
|
|
401
|
-
const table = wasm.
|
|
418
|
+
const table = wasm.__wbindgen_externrefs;
|
|
402
419
|
const offset = table.grow(4);
|
|
403
420
|
table.set(0, undefined);
|
|
404
421
|
table.set(offset + 0, undefined);
|
|
405
422
|
table.set(offset + 1, null);
|
|
406
423
|
table.set(offset + 2, true);
|
|
407
424
|
table.set(offset + 3, false);
|
|
408
|
-
;
|
|
409
425
|
};
|
|
410
426
|
|
|
411
427
|
const wasmPath = `${__dirname}/cedar_wasm_bg.wasm`;
|
|
@@ -414,4 +430,3 @@ const wasmModule = new WebAssembly.Module(wasmBytes);
|
|
|
414
430
|
const wasm = exports.__wasm = new WebAssembly.Instance(wasmModule, imports).exports;
|
|
415
431
|
|
|
416
432
|
wasm.__wbindgen_start();
|
|
417
|
-
|
|
Binary file
|
|
@@ -5,15 +5,16 @@ export const getCedarSDKVersion: () => [number, number];
|
|
|
5
5
|
export const getValidRequestEnvsPolicy: (a: any, b: any) => any;
|
|
6
6
|
export const getValidRequestEnvsTemplate: (a: any, b: any) => any;
|
|
7
7
|
export const getCedarVersion: () => [number, number];
|
|
8
|
+
export const formatPolicies: (a: any) => any;
|
|
8
9
|
export const isAuthorized: (a: any) => any;
|
|
9
10
|
export const preparsePolicySet: (a: number, b: number, c: any) => any;
|
|
10
11
|
export const preparseSchema: (a: number, b: number, c: any) => any;
|
|
11
12
|
export const statefulIsAuthorized: (a: any) => any;
|
|
13
|
+
export const validate: (a: any) => any;
|
|
12
14
|
export const checkParseContext: (a: any) => any;
|
|
13
15
|
export const checkParseEntities: (a: any) => any;
|
|
14
16
|
export const checkParsePolicySet: (a: any) => any;
|
|
15
17
|
export const checkParseSchema: (a: any) => any;
|
|
16
|
-
export const getCedarLangVersion: () => [number, number];
|
|
17
18
|
export const policySetTextToParts: (a: number, b: number) => any;
|
|
18
19
|
export const policyToJson: (a: any) => any;
|
|
19
20
|
export const policyToText: (a: any) => any;
|
|
@@ -21,12 +22,11 @@ export const schemaToJson: (a: any) => any;
|
|
|
21
22
|
export const schemaToText: (a: any) => any;
|
|
22
23
|
export const templateToJson: (a: any) => any;
|
|
23
24
|
export const templateToText: (a: any) => any;
|
|
24
|
-
export const
|
|
25
|
-
export const validate: (a: any) => any;
|
|
26
|
-
export const __wbindgen_exn_store: (a: number) => void;
|
|
27
|
-
export const __externref_table_alloc: () => number;
|
|
28
|
-
export const __wbindgen_export_2: WebAssembly.Table;
|
|
25
|
+
export const getCedarLangVersion: () => [number, number];
|
|
29
26
|
export const __wbindgen_malloc: (a: number, b: number) => number;
|
|
30
27
|
export const __wbindgen_realloc: (a: number, b: number, c: number, d: number) => number;
|
|
28
|
+
export const __wbindgen_exn_store: (a: number) => void;
|
|
29
|
+
export const __externref_table_alloc: () => number;
|
|
30
|
+
export const __wbindgen_externrefs: WebAssembly.Table;
|
|
31
31
|
export const __wbindgen_free: (a: number, b: number, c: number) => void;
|
|
32
32
|
export const __wbindgen_start: () => void;
|
package/nodejs/package.json
CHANGED