@janssenproject/cedarling_wasm 0.0.0 → 0.0.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.
@@ -136,6 +136,11 @@ export class Diagnostics {
136
136
  */
137
137
  readonly errors: PolicyEvaluationError[];
138
138
  }
139
+ export class JsJsonLogic {
140
+ free(): void;
141
+ constructor();
142
+ apply(logic: any, data: any): any;
143
+ }
139
144
  /**
140
145
  * PolicyEvaluationError
141
146
  * =====================
@@ -189,15 +194,19 @@ export interface InitOutput {
189
194
  readonly __wbg_policyevaluationerror_free: (a: number, b: number) => void;
190
195
  readonly policyevaluationerror_id: (a: number, b: number) => void;
191
196
  readonly policyevaluationerror_error: (a: number, b: number) => void;
192
- readonly ring_core_0_17_8_bn_mul_mont: (a: number, b: number, c: number, d: number, e: number, f: number) => void;
193
- readonly __wbindgen_export_0: (a: number) => void;
194
- readonly __wbindgen_export_1: (a: number, b: number) => number;
195
- readonly __wbindgen_export_2: (a: number, b: number, c: number, d: number) => number;
197
+ readonly __wbg_jsjsonlogic_free: (a: number, b: number) => void;
198
+ readonly jsjsonlogic_new: () => number;
199
+ readonly jsjsonlogic_apply: (a: number, b: number, c: number, d: number) => void;
200
+ readonly ring_core_0_17_14__bn_mul_mont: (a: number, b: number, c: number, d: number, e: number, f: number) => void;
201
+ readonly __wbindgen_export_0: (a: number, b: number) => number;
202
+ readonly __wbindgen_export_1: (a: number, b: number, c: number, d: number) => number;
203
+ readonly __wbindgen_export_2: (a: number) => void;
196
204
  readonly __wbindgen_export_3: WebAssembly.Table;
197
205
  readonly __wbindgen_add_to_stack_pointer: (a: number) => number;
198
206
  readonly __wbindgen_export_4: (a: number, b: number, c: number) => void;
199
- readonly __wbindgen_export_5: (a: number, b: number, c: number) => void;
200
- readonly __wbindgen_export_6: (a: number, b: number, c: number, d: number) => void;
207
+ readonly __wbindgen_export_5: (a: number, b: number) => void;
208
+ readonly __wbindgen_export_6: (a: number, b: number, c: number) => void;
209
+ readonly __wbindgen_export_7: (a: number, b: number, c: number, d: number) => void;
201
210
  }
202
211
 
203
212
  export type SyncInitInput = BufferSource | WebAssembly.Module;
package/cedarling_wasm.js CHANGED
@@ -6,9 +6,7 @@ heap.push(undefined, null, true, false);
6
6
 
7
7
  function getObject(idx) { return heap[idx]; }
8
8
 
9
- const cachedTextDecoder = (typeof TextDecoder !== 'undefined' ? new TextDecoder('utf-8', { ignoreBOM: true, fatal: true }) : { decode: () => { throw Error('TextDecoder not available') } } );
10
-
11
- if (typeof TextDecoder !== 'undefined') { cachedTextDecoder.decode(); };
9
+ let WASM_VECTOR_LEN = 0;
12
10
 
13
11
  let cachedUint8ArrayMemory0 = null;
14
12
 
@@ -19,48 +17,6 @@ function getUint8ArrayMemory0() {
19
17
  return cachedUint8ArrayMemory0;
20
18
  }
21
19
 
22
- function getStringFromWasm0(ptr, len) {
23
- ptr = ptr >>> 0;
24
- return cachedTextDecoder.decode(getUint8ArrayMemory0().subarray(ptr, ptr + len));
25
- }
26
-
27
- let heap_next = heap.length;
28
-
29
- function addHeapObject(obj) {
30
- if (heap_next === heap.length) heap.push(heap.length + 1);
31
- const idx = heap_next;
32
- heap_next = heap[idx];
33
-
34
- heap[idx] = obj;
35
- return idx;
36
- }
37
-
38
- function handleError(f, args) {
39
- try {
40
- return f.apply(this, args);
41
- } catch (e) {
42
- wasm.__wbindgen_export_0(addHeapObject(e));
43
- }
44
- }
45
-
46
- function dropObject(idx) {
47
- if (idx < 132) return;
48
- heap[idx] = heap_next;
49
- heap_next = idx;
50
- }
51
-
52
- function takeObject(idx) {
53
- const ret = getObject(idx);
54
- dropObject(idx);
55
- return ret;
56
- }
57
-
58
- function isLikeNone(x) {
59
- return x === undefined || x === null;
60
- }
61
-
62
- let WASM_VECTOR_LEN = 0;
63
-
64
20
  const cachedTextEncoder = (typeof TextEncoder !== 'undefined' ? new TextEncoder('utf-8') : { encode: () => { throw Error('TextEncoder not available') } } );
65
21
 
66
22
  const encodeString = (typeof cachedTextEncoder.encodeInto === 'function'
@@ -124,6 +80,50 @@ function getDataViewMemory0() {
124
80
  return cachedDataViewMemory0;
125
81
  }
126
82
 
83
+ const cachedTextDecoder = (typeof TextDecoder !== 'undefined' ? new TextDecoder('utf-8', { ignoreBOM: true, fatal: true }) : { decode: () => { throw Error('TextDecoder not available') } } );
84
+
85
+ if (typeof TextDecoder !== 'undefined') { cachedTextDecoder.decode(); };
86
+
87
+ function getStringFromWasm0(ptr, len) {
88
+ ptr = ptr >>> 0;
89
+ return cachedTextDecoder.decode(getUint8ArrayMemory0().subarray(ptr, ptr + len));
90
+ }
91
+
92
+ let heap_next = heap.length;
93
+
94
+ function addHeapObject(obj) {
95
+ if (heap_next === heap.length) heap.push(heap.length + 1);
96
+ const idx = heap_next;
97
+ heap_next = heap[idx];
98
+
99
+ heap[idx] = obj;
100
+ return idx;
101
+ }
102
+
103
+ function handleError(f, args) {
104
+ try {
105
+ return f.apply(this, args);
106
+ } catch (e) {
107
+ wasm.__wbindgen_export_2(addHeapObject(e));
108
+ }
109
+ }
110
+
111
+ function dropObject(idx) {
112
+ if (idx < 132) return;
113
+ heap[idx] = heap_next;
114
+ heap_next = idx;
115
+ }
116
+
117
+ function takeObject(idx) {
118
+ const ret = getObject(idx);
119
+ dropObject(idx);
120
+ return ret;
121
+ }
122
+
123
+ function isLikeNone(x) {
124
+ return x === undefined || x === null;
125
+ }
126
+
127
127
  const CLOSURE_DTORS = (typeof FinalizationRegistry === 'undefined')
128
128
  ? { register: () => {}, unregister: () => {} }
129
129
  : new FinalizationRegistry(state => {
@@ -245,12 +245,16 @@ function _assertClass(instance, klass) {
245
245
  throw new Error(`expected instance of ${klass.name}`);
246
246
  }
247
247
  }
248
- function __wbg_adapter_48(arg0, arg1, arg2) {
249
- wasm.__wbindgen_export_5(arg0, arg1, addHeapObject(arg2));
248
+ function __wbg_adapter_48(arg0, arg1) {
249
+ wasm.__wbindgen_export_5(arg0, arg1);
250
250
  }
251
251
 
252
- function __wbg_adapter_164(arg0, arg1, arg2, arg3) {
253
- wasm.__wbindgen_export_6(arg0, arg1, addHeapObject(arg2), addHeapObject(arg3));
252
+ function __wbg_adapter_51(arg0, arg1, arg2) {
253
+ wasm.__wbindgen_export_6(arg0, arg1, addHeapObject(arg2));
254
+ }
255
+
256
+ function __wbg_adapter_171(arg0, arg1, arg2, arg3) {
257
+ wasm.__wbindgen_export_7(arg0, arg1, addHeapObject(arg2), addHeapObject(arg3));
254
258
  }
255
259
 
256
260
  const __wbindgen_enum_RequestCredentials = ["omit", "same-origin", "include"];
@@ -373,7 +377,7 @@ export class AuthorizeResult {
373
377
  * @param {string} arg0
374
378
  */
375
379
  set request_id(arg0) {
376
- const ptr0 = passStringToWasm0(arg0, wasm.__wbindgen_export_1, wasm.__wbindgen_export_2);
380
+ const ptr0 = passStringToWasm0(arg0, wasm.__wbindgen_export_0, wasm.__wbindgen_export_1);
377
381
  const len0 = WASM_VECTOR_LEN;
378
382
  wasm.__wbg_set_authorizeresult_request_id(this.__wbg_ptr, ptr0, len0);
379
383
  }
@@ -531,7 +535,7 @@ export class Cedarling {
531
535
  get_log_by_id(id) {
532
536
  try {
533
537
  const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
534
- const ptr0 = passStringToWasm0(id, wasm.__wbindgen_export_1, wasm.__wbindgen_export_2);
538
+ const ptr0 = passStringToWasm0(id, wasm.__wbindgen_export_0, wasm.__wbindgen_export_1);
535
539
  const len0 = WASM_VECTOR_LEN;
536
540
  wasm.cedarling_get_log_by_id(retptr, this.__wbg_ptr, ptr0, len0);
537
541
  var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
@@ -563,7 +567,7 @@ export class Cedarling {
563
567
  get_logs_by_tag(tag) {
564
568
  try {
565
569
  const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
566
- const ptr0 = passStringToWasm0(tag, wasm.__wbindgen_export_1, wasm.__wbindgen_export_2);
570
+ const ptr0 = passStringToWasm0(tag, wasm.__wbindgen_export_0, wasm.__wbindgen_export_1);
567
571
  const len0 = WASM_VECTOR_LEN;
568
572
  wasm.cedarling_get_logs_by_tag(retptr, this.__wbg_ptr, ptr0, len0);
569
573
  var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
@@ -589,7 +593,7 @@ export class Cedarling {
589
593
  get_logs_by_request_id(request_id) {
590
594
  try {
591
595
  const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
592
- const ptr0 = passStringToWasm0(request_id, wasm.__wbindgen_export_1, wasm.__wbindgen_export_2);
596
+ const ptr0 = passStringToWasm0(request_id, wasm.__wbindgen_export_0, wasm.__wbindgen_export_1);
593
597
  const len0 = WASM_VECTOR_LEN;
594
598
  wasm.cedarling_get_logs_by_request_id(retptr, this.__wbg_ptr, ptr0, len0);
595
599
  var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
@@ -617,9 +621,9 @@ export class Cedarling {
617
621
  get_logs_by_request_id_and_tag(request_id, tag) {
618
622
  try {
619
623
  const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
620
- const ptr0 = passStringToWasm0(request_id, wasm.__wbindgen_export_1, wasm.__wbindgen_export_2);
624
+ const ptr0 = passStringToWasm0(request_id, wasm.__wbindgen_export_0, wasm.__wbindgen_export_1);
621
625
  const len0 = WASM_VECTOR_LEN;
622
- const ptr1 = passStringToWasm0(tag, wasm.__wbindgen_export_1, wasm.__wbindgen_export_2);
626
+ const ptr1 = passStringToWasm0(tag, wasm.__wbindgen_export_0, wasm.__wbindgen_export_1);
623
627
  const len1 = WASM_VECTOR_LEN;
624
628
  wasm.cedarling_get_logs_by_request_id_and_tag(retptr, this.__wbg_ptr, ptr0, len0, ptr1, len1);
625
629
  var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
@@ -708,6 +712,51 @@ export class Diagnostics {
708
712
  }
709
713
  }
710
714
 
715
+ const JsJsonLogicFinalization = (typeof FinalizationRegistry === 'undefined')
716
+ ? { register: () => {}, unregister: () => {} }
717
+ : new FinalizationRegistry(ptr => wasm.__wbg_jsjsonlogic_free(ptr >>> 0, 1));
718
+
719
+ export class JsJsonLogic {
720
+
721
+ __destroy_into_raw() {
722
+ const ptr = this.__wbg_ptr;
723
+ this.__wbg_ptr = 0;
724
+ JsJsonLogicFinalization.unregister(this);
725
+ return ptr;
726
+ }
727
+
728
+ free() {
729
+ const ptr = this.__destroy_into_raw();
730
+ wasm.__wbg_jsjsonlogic_free(ptr, 0);
731
+ }
732
+ constructor() {
733
+ const ret = wasm.jsjsonlogic_new();
734
+ this.__wbg_ptr = ret >>> 0;
735
+ JsJsonLogicFinalization.register(this, this.__wbg_ptr, this);
736
+ return this;
737
+ }
738
+ /**
739
+ * @param {any} logic
740
+ * @param {any} data
741
+ * @returns {any}
742
+ */
743
+ apply(logic, data) {
744
+ try {
745
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
746
+ wasm.jsjsonlogic_apply(retptr, this.__wbg_ptr, addHeapObject(logic), addHeapObject(data));
747
+ var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
748
+ var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
749
+ var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
750
+ if (r2) {
751
+ throw takeObject(r1);
752
+ }
753
+ return takeObject(r0);
754
+ } finally {
755
+ wasm.__wbindgen_add_to_stack_pointer(16);
756
+ }
757
+ }
758
+ }
759
+
711
760
  const PolicyEvaluationErrorFinalization = (typeof FinalizationRegistry === 'undefined')
712
761
  ? { register: () => {}, unregister: () => {} }
713
762
  : new FinalizationRegistry(ptr => wasm.__wbg_policyevaluationerror_free(ptr >>> 0, 1));
@@ -814,6 +863,16 @@ async function __wbg_load(module, imports) {
814
863
  function __wbg_get_imports() {
815
864
  const imports = {};
816
865
  imports.wbg = {};
866
+ imports.wbg.__wbg_String_8f0eb39a4a4c2f66 = function(arg0, arg1) {
867
+ const ret = String(getObject(arg1));
868
+ const ptr1 = passStringToWasm0(ret, wasm.__wbindgen_export_0, wasm.__wbindgen_export_1);
869
+ const len1 = WASM_VECTOR_LEN;
870
+ getDataViewMemory0().setInt32(arg0 + 4 * 1, len1, true);
871
+ getDataViewMemory0().setInt32(arg0 + 4 * 0, ptr1, true);
872
+ };
873
+ imports.wbg.__wbg_abort_410ec47a64ac6117 = function(arg0, arg1) {
874
+ getObject(arg0).abort(getObject(arg1));
875
+ };
817
876
  imports.wbg.__wbg_abort_775ef1d17fc65868 = function(arg0) {
818
877
  getObject(arg0).abort();
819
878
  };
@@ -840,6 +899,10 @@ function __wbg_get_imports() {
840
899
  const ret = Cedarling.__wrap(arg0);
841
900
  return addHeapObject(ret);
842
901
  };
902
+ imports.wbg.__wbg_clearTimeout_86721db0036bea98 = function(arg0) {
903
+ const ret = clearTimeout(takeObject(arg0));
904
+ return addHeapObject(ret);
905
+ };
843
906
  imports.wbg.__wbg_crypto_ed58b8e10a292839 = function(arg0) {
844
907
  const ret = getObject(arg0).crypto;
845
908
  return addHeapObject(ret);
@@ -862,14 +925,14 @@ function __wbg_get_imports() {
862
925
  imports.wbg.__wbg_error_dc53417fcef5463a = function(arg0) {
863
926
  console.error(...getObject(arg0));
864
927
  };
865
- imports.wbg.__wbg_fetch_4465c2b10f21a927 = function(arg0) {
866
- const ret = fetch(getObject(arg0));
867
- return addHeapObject(ret);
868
- };
869
928
  imports.wbg.__wbg_fetch_509096533071c657 = function(arg0, arg1) {
870
929
  const ret = getObject(arg0).fetch(getObject(arg1));
871
930
  return addHeapObject(ret);
872
931
  };
932
+ imports.wbg.__wbg_fetch_d36a73832f0a45e8 = function(arg0) {
933
+ const ret = fetch(getObject(arg0));
934
+ return addHeapObject(ret);
935
+ };
873
936
  imports.wbg.__wbg_fromEntries_524679eecb0bdc2e = function() { return handleError(function (arg0) {
874
937
  const ret = Object.fromEntries(getObject(arg0));
875
938
  return addHeapObject(ret);
@@ -1004,7 +1067,7 @@ function __wbg_get_imports() {
1004
1067
  const a = state0.a;
1005
1068
  state0.a = 0;
1006
1069
  try {
1007
- return __wbg_adapter_164(a, state0.b, arg0, arg1);
1070
+ return __wbg_adapter_171(a, state0.b, arg0, arg1);
1008
1071
  } finally {
1009
1072
  state0.a = a;
1010
1073
  }
@@ -1043,6 +1106,10 @@ function __wbg_get_imports() {
1043
1106
  const ret = new Function(getStringFromWasm0(arg0, arg1));
1044
1107
  return addHeapObject(ret);
1045
1108
  };
1109
+ imports.wbg.__wbg_newwithargs_ab6ffe8cd6c19c04 = function(arg0, arg1, arg2, arg3) {
1110
+ const ret = new Function(getStringFromWasm0(arg0, arg1), getStringFromWasm0(arg2, arg3));
1111
+ return addHeapObject(ret);
1112
+ };
1046
1113
  imports.wbg.__wbg_newwithbyteoffsetandlength_d97e637ebe145a9a = function(arg0, arg1, arg2) {
1047
1114
  const ret = new Uint8Array(getObject(arg0), arg1 >>> 0, arg2 >>> 0);
1048
1115
  return addHeapObject(ret);
@@ -1097,6 +1164,10 @@ function __wbg_get_imports() {
1097
1164
  const ret = Promise.resolve(getObject(arg0));
1098
1165
  return addHeapObject(ret);
1099
1166
  };
1167
+ imports.wbg.__wbg_setTimeout_2e707715f8cc9497 = function(arg0, arg1) {
1168
+ const ret = setTimeout(getObject(arg0), arg1);
1169
+ return addHeapObject(ret);
1170
+ };
1100
1171
  imports.wbg.__wbg_set_37837023f3d740e8 = function(arg0, arg1, arg2) {
1101
1172
  getObject(arg0)[arg1 >>> 0] = takeObject(arg2);
1102
1173
  };
@@ -1181,7 +1252,7 @@ function __wbg_get_imports() {
1181
1252
  };
1182
1253
  imports.wbg.__wbg_url_ae10c34ca209681d = function(arg0, arg1) {
1183
1254
  const ret = getObject(arg1).url;
1184
- const ptr1 = passStringToWasm0(ret, wasm.__wbindgen_export_1, wasm.__wbindgen_export_2);
1255
+ const ptr1 = passStringToWasm0(ret, wasm.__wbindgen_export_0, wasm.__wbindgen_export_1);
1185
1256
  const len1 = WASM_VECTOR_LEN;
1186
1257
  getDataViewMemory0().setInt32(arg0 + 4 * 1, len1, true);
1187
1258
  getDataViewMemory0().setInt32(arg0 + 4 * 0, ptr1, true);
@@ -1225,13 +1296,17 @@ function __wbg_get_imports() {
1225
1296
  const ret = false;
1226
1297
  return ret;
1227
1298
  };
1228
- imports.wbg.__wbindgen_closure_wrapper11185 = function(arg0, arg1, arg2) {
1229
- const ret = makeMutClosure(arg0, arg1, 2049, __wbg_adapter_48);
1299
+ imports.wbg.__wbindgen_closure_wrapper10756 = function(arg0, arg1, arg2) {
1300
+ const ret = makeMutClosure(arg0, arg1, 1927, __wbg_adapter_48);
1301
+ return addHeapObject(ret);
1302
+ };
1303
+ imports.wbg.__wbindgen_closure_wrapper11641 = function(arg0, arg1, arg2) {
1304
+ const ret = makeMutClosure(arg0, arg1, 2126, __wbg_adapter_51);
1230
1305
  return addHeapObject(ret);
1231
1306
  };
1232
1307
  imports.wbg.__wbindgen_debug_string = function(arg0, arg1) {
1233
1308
  const ret = debugString(getObject(arg1));
1234
- const ptr1 = passStringToWasm0(ret, wasm.__wbindgen_export_1, wasm.__wbindgen_export_2);
1309
+ const ptr1 = passStringToWasm0(ret, wasm.__wbindgen_export_0, wasm.__wbindgen_export_1);
1235
1310
  const len1 = WASM_VECTOR_LEN;
1236
1311
  getDataViewMemory0().setInt32(arg0 + 4 * 1, len1, true);
1237
1312
  getDataViewMemory0().setInt32(arg0 + 4 * 0, ptr1, true);
@@ -1297,7 +1372,7 @@ function __wbg_get_imports() {
1297
1372
  imports.wbg.__wbindgen_string_get = function(arg0, arg1) {
1298
1373
  const obj = getObject(arg1);
1299
1374
  const ret = typeof(obj) === 'string' ? obj : undefined;
1300
- var ptr1 = isLikeNone(ret) ? 0 : passStringToWasm0(ret, wasm.__wbindgen_export_1, wasm.__wbindgen_export_2);
1375
+ var ptr1 = isLikeNone(ret) ? 0 : passStringToWasm0(ret, wasm.__wbindgen_export_0, wasm.__wbindgen_export_1);
1301
1376
  var len1 = WASM_VECTOR_LEN;
1302
1377
  getDataViewMemory0().setInt32(arg0 + 4 * 1, len1, true);
1303
1378
  getDataViewMemory0().setInt32(arg0 + 4 * 0, ptr1, true);
Binary file
package/package.json CHANGED
@@ -2,8 +2,12 @@
2
2
  "name": "@janssenproject/cedarling_wasm",
3
3
  "type": "module",
4
4
  "description": "The Cedarling is a performant local authorization service that runs the Rust Cedar Engine",
5
- "version": "0.0.0",
5
+ "version": "0.0.2",
6
6
  "license": "Apache-2.0",
7
+ "repository": {
8
+ "type": "git",
9
+ "url": "git+https://github.com/JanssenProject/jans.git"
10
+ },
7
11
  "files": [
8
12
  "cedarling_wasm_bg.wasm",
9
13
  "cedarling_wasm.js",