@kya-os/agentshield-nextjs 0.2.7 → 0.2.8
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/dist/.tsbuildinfo +1 -1
- package/dist/index.d.mts +2 -1
- package/dist/index.d.ts +2 -1
- package/dist/index.js +175 -0
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +155 -2
- package/dist/index.mjs.map +1 -1
- package/dist/policy.d.mts +150 -0
- package/dist/policy.d.ts +150 -0
- package/dist/policy.js +185 -0
- package/dist/policy.js.map +1 -0
- package/dist/policy.mjs +161 -0
- package/dist/policy.mjs.map +1 -0
- package/package.json +9 -4
- package/wasm/agentshield_wasm.d.ts +6 -33
- package/wasm/agentshield_wasm.js +516 -626
- package/wasm/agentshield_wasm_bg.wasm +0 -0
package/wasm/agentshield_wasm.js
CHANGED
|
@@ -1,149 +1,136 @@
|
|
|
1
1
|
let wasm;
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
const cachedTextDecoder = (typeof TextDecoder !== 'undefined' ? new TextDecoder('utf-8', { ignoreBOM: true, fatal: true }) : { decode: () => { throw Error('TextDecoder not available') } } );
|
|
4
4
|
|
|
5
|
-
|
|
6
|
-
if (cachedUint8ArrayMemory0 === null || cachedUint8ArrayMemory0.byteLength === 0) {
|
|
7
|
-
cachedUint8ArrayMemory0 = new Uint8Array(wasm.memory.buffer);
|
|
8
|
-
}
|
|
9
|
-
return cachedUint8ArrayMemory0;
|
|
10
|
-
}
|
|
5
|
+
if (typeof TextDecoder !== 'undefined') { cachedTextDecoder.decode(); };
|
|
11
6
|
|
|
12
|
-
let
|
|
13
|
-
|
|
14
|
-
cachedTextDecoder.decode();
|
|
7
|
+
let cachedUint8ArrayMemory0 = null;
|
|
15
8
|
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
cachedTextDecoder = new TextDecoder('utf-8', { ignoreBOM: true, fatal: true });
|
|
22
|
-
cachedTextDecoder.decode();
|
|
23
|
-
numBytesDecoded = len;
|
|
24
|
-
}
|
|
25
|
-
return cachedTextDecoder.decode(getUint8ArrayMemory0().subarray(ptr, ptr + len));
|
|
9
|
+
function getUint8ArrayMemory0() {
|
|
10
|
+
if (cachedUint8ArrayMemory0 === null || cachedUint8ArrayMemory0.byteLength === 0) {
|
|
11
|
+
cachedUint8ArrayMemory0 = new Uint8Array(wasm.memory.buffer);
|
|
12
|
+
}
|
|
13
|
+
return cachedUint8ArrayMemory0;
|
|
26
14
|
}
|
|
27
15
|
|
|
28
16
|
function getStringFromWasm0(ptr, len) {
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
}
|
|
32
|
-
|
|
33
|
-
let heap = new Array(128).fill(undefined);
|
|
34
|
-
|
|
35
|
-
heap.push(undefined, null, true, false);
|
|
36
|
-
|
|
37
|
-
function getObject(idx) {
|
|
38
|
-
return heap[idx];
|
|
17
|
+
ptr = ptr >>> 0;
|
|
18
|
+
return cachedTextDecoder.decode(getUint8ArrayMemory0().subarray(ptr, ptr + len));
|
|
39
19
|
}
|
|
40
20
|
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
21
|
+
function logError(f, args) {
|
|
22
|
+
try {
|
|
23
|
+
return f.apply(this, args);
|
|
24
|
+
} catch (e) {
|
|
25
|
+
let error = (function () {
|
|
26
|
+
try {
|
|
27
|
+
return e instanceof Error ? `${e.message}\n\nStack:\n${e.stack}` : e.toString();
|
|
28
|
+
} catch(_) {
|
|
29
|
+
return "<failed to stringify thrown value>";
|
|
30
|
+
}
|
|
31
|
+
}());
|
|
32
|
+
console.error("wasm-bindgen: imported JS function that was not marked as `catch` threw an error:", error);
|
|
33
|
+
throw e;
|
|
34
|
+
}
|
|
50
35
|
}
|
|
51
36
|
|
|
52
37
|
let WASM_VECTOR_LEN = 0;
|
|
53
38
|
|
|
54
|
-
const cachedTextEncoder = new TextEncoder();
|
|
39
|
+
const cachedTextEncoder = (typeof TextEncoder !== 'undefined' ? new TextEncoder('utf-8') : { encode: () => { throw Error('TextEncoder not available') } } );
|
|
55
40
|
|
|
56
|
-
|
|
57
|
-
|
|
41
|
+
const encodeString = (typeof cachedTextEncoder.encodeInto === 'function'
|
|
42
|
+
? function (arg, view) {
|
|
43
|
+
return cachedTextEncoder.encodeInto(arg, view);
|
|
44
|
+
}
|
|
45
|
+
: function (arg, view) {
|
|
58
46
|
const buf = cachedTextEncoder.encode(arg);
|
|
59
47
|
view.set(buf);
|
|
60
48
|
return {
|
|
61
|
-
|
|
62
|
-
|
|
49
|
+
read: arg.length,
|
|
50
|
+
written: buf.length
|
|
63
51
|
};
|
|
64
|
-
|
|
65
|
-
}
|
|
52
|
+
});
|
|
66
53
|
|
|
67
54
|
function passStringToWasm0(arg, malloc, realloc) {
|
|
68
|
-
if (realloc === undefined) {
|
|
69
|
-
const buf = cachedTextEncoder.encode(arg);
|
|
70
|
-
const ptr = malloc(buf.length, 1) >>> 0;
|
|
71
|
-
getUint8ArrayMemory0()
|
|
72
|
-
.subarray(ptr, ptr + buf.length)
|
|
73
|
-
.set(buf);
|
|
74
|
-
WASM_VECTOR_LEN = buf.length;
|
|
75
|
-
return ptr;
|
|
76
|
-
}
|
|
77
55
|
|
|
78
|
-
|
|
79
|
-
|
|
56
|
+
if (typeof(arg) !== 'string') throw new Error(`expected a string argument, found ${typeof(arg)}`);
|
|
57
|
+
|
|
58
|
+
if (realloc === undefined) {
|
|
59
|
+
const buf = cachedTextEncoder.encode(arg);
|
|
60
|
+
const ptr = malloc(buf.length, 1) >>> 0;
|
|
61
|
+
getUint8ArrayMemory0().subarray(ptr, ptr + buf.length).set(buf);
|
|
62
|
+
WASM_VECTOR_LEN = buf.length;
|
|
63
|
+
return ptr;
|
|
64
|
+
}
|
|
80
65
|
|
|
81
|
-
|
|
66
|
+
let len = arg.length;
|
|
67
|
+
let ptr = malloc(len, 1) >>> 0;
|
|
82
68
|
|
|
83
|
-
|
|
69
|
+
const mem = getUint8ArrayMemory0();
|
|
84
70
|
|
|
85
|
-
|
|
86
|
-
const code = arg.charCodeAt(offset);
|
|
87
|
-
if (code > 0x7f) break;
|
|
88
|
-
mem[ptr + offset] = code;
|
|
89
|
-
}
|
|
71
|
+
let offset = 0;
|
|
90
72
|
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
73
|
+
for (; offset < len; offset++) {
|
|
74
|
+
const code = arg.charCodeAt(offset);
|
|
75
|
+
if (code > 0x7F) break;
|
|
76
|
+
mem[ptr + offset] = code;
|
|
94
77
|
}
|
|
95
|
-
ptr = realloc(ptr, len, (len = offset + arg.length * 3), 1) >>> 0;
|
|
96
|
-
const view = getUint8ArrayMemory0().subarray(ptr + offset, ptr + len);
|
|
97
|
-
const ret = cachedTextEncoder.encodeInto(arg, view);
|
|
98
78
|
|
|
99
|
-
offset
|
|
100
|
-
|
|
101
|
-
|
|
79
|
+
if (offset !== len) {
|
|
80
|
+
if (offset !== 0) {
|
|
81
|
+
arg = arg.slice(offset);
|
|
82
|
+
}
|
|
83
|
+
ptr = realloc(ptr, len, len = offset + arg.length * 3, 1) >>> 0;
|
|
84
|
+
const view = getUint8ArrayMemory0().subarray(ptr + offset, ptr + len);
|
|
85
|
+
const ret = encodeString(arg, view);
|
|
86
|
+
if (ret.read !== arg.length) throw new Error('failed to pass whole string');
|
|
87
|
+
offset += ret.written;
|
|
88
|
+
ptr = realloc(ptr, len, offset, 1) >>> 0;
|
|
89
|
+
}
|
|
102
90
|
|
|
103
|
-
|
|
104
|
-
|
|
91
|
+
WASM_VECTOR_LEN = offset;
|
|
92
|
+
return ptr;
|
|
105
93
|
}
|
|
106
94
|
|
|
107
95
|
let cachedDataViewMemory0 = null;
|
|
108
96
|
|
|
109
97
|
function getDataViewMemory0() {
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
cachedDataViewMemory0.buffer !== wasm.memory.buffer)
|
|
115
|
-
) {
|
|
116
|
-
cachedDataViewMemory0 = new DataView(wasm.memory.buffer);
|
|
117
|
-
}
|
|
118
|
-
return cachedDataViewMemory0;
|
|
98
|
+
if (cachedDataViewMemory0 === null || cachedDataViewMemory0.buffer.detached === true || (cachedDataViewMemory0.buffer.detached === undefined && cachedDataViewMemory0.buffer !== wasm.memory.buffer)) {
|
|
99
|
+
cachedDataViewMemory0 = new DataView(wasm.memory.buffer);
|
|
100
|
+
}
|
|
101
|
+
return cachedDataViewMemory0;
|
|
119
102
|
}
|
|
120
103
|
|
|
121
|
-
function
|
|
122
|
-
|
|
123
|
-
heap[idx] = heap_next;
|
|
124
|
-
heap_next = idx;
|
|
104
|
+
function _assertNum(n) {
|
|
105
|
+
if (typeof(n) !== 'number') throw new Error(`expected a number argument, found ${typeof(n)}`);
|
|
125
106
|
}
|
|
126
107
|
|
|
127
|
-
function
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
108
|
+
function _assertBoolean(n) {
|
|
109
|
+
if (typeof(n) !== 'boolean') {
|
|
110
|
+
throw new Error(`expected a boolean argument, found ${typeof(n)}`);
|
|
111
|
+
}
|
|
131
112
|
}
|
|
132
113
|
|
|
133
114
|
function isLikeNone(x) {
|
|
134
|
-
|
|
115
|
+
return x === undefined || x === null;
|
|
135
116
|
}
|
|
136
117
|
/**
|
|
137
118
|
* Initialize the AgentShield WASM module
|
|
138
119
|
*/
|
|
139
120
|
export function init() {
|
|
140
|
-
|
|
121
|
+
wasm.init();
|
|
141
122
|
}
|
|
142
123
|
|
|
143
124
|
function _assertClass(instance, klass) {
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
125
|
+
if (!(instance instanceof klass)) {
|
|
126
|
+
throw new Error(`expected instance of ${klass.name}`);
|
|
127
|
+
}
|
|
128
|
+
}
|
|
129
|
+
|
|
130
|
+
function takeFromExternrefTable0(idx) {
|
|
131
|
+
const value = wasm.__wbindgen_export_3.get(idx);
|
|
132
|
+
wasm.__externref_table_dealloc(idx);
|
|
133
|
+
return value;
|
|
147
134
|
}
|
|
148
135
|
/**
|
|
149
136
|
* Analyze a request and detect if it's from an agent
|
|
@@ -151,20 +138,15 @@ function _assertClass(instance, klass) {
|
|
|
151
138
|
* @returns {JsDetectionResult}
|
|
152
139
|
*/
|
|
153
140
|
export function detect_agent(metadata) {
|
|
154
|
-
try {
|
|
155
|
-
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
|
156
141
|
_assertClass(metadata, JsRequestMetadata);
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
if (
|
|
162
|
-
|
|
163
|
-
}
|
|
164
|
-
return JsDetectionResult.__wrap(
|
|
165
|
-
} finally {
|
|
166
|
-
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
167
|
-
}
|
|
142
|
+
if (metadata.__wbg_ptr === 0) {
|
|
143
|
+
throw new Error('Attempt to use a moved value');
|
|
144
|
+
}
|
|
145
|
+
const ret = wasm.detect_agent(metadata.__wbg_ptr);
|
|
146
|
+
if (ret[2]) {
|
|
147
|
+
throw takeFromExternrefTable0(ret[1]);
|
|
148
|
+
}
|
|
149
|
+
return JsDetectionResult.__wrap(ret[0]);
|
|
168
150
|
}
|
|
169
151
|
|
|
170
152
|
/**
|
|
@@ -172,571 +154,479 @@ export function detect_agent(metadata) {
|
|
|
172
154
|
* @returns {string}
|
|
173
155
|
*/
|
|
174
156
|
export function version() {
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
} finally {
|
|
186
|
-
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
187
|
-
wasm.__wbindgen_export(deferred1_0, deferred1_1, 1);
|
|
188
|
-
}
|
|
189
|
-
}
|
|
190
|
-
|
|
191
|
-
/**
|
|
192
|
-
* Get the version of the AgentShield library
|
|
193
|
-
* @returns {string}
|
|
194
|
-
*/
|
|
195
|
-
export function get_version() {
|
|
196
|
-
let deferred1_0;
|
|
197
|
-
let deferred1_1;
|
|
198
|
-
try {
|
|
199
|
-
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
|
200
|
-
wasm.get_version(retptr);
|
|
201
|
-
var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
|
|
202
|
-
var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
|
|
203
|
-
deferred1_0 = r0;
|
|
204
|
-
deferred1_1 = r1;
|
|
205
|
-
return getStringFromWasm0(r0, r1);
|
|
206
|
-
} finally {
|
|
207
|
-
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
208
|
-
wasm.__wbindgen_export(deferred1_0, deferred1_1, 1);
|
|
209
|
-
}
|
|
210
|
-
}
|
|
211
|
-
|
|
212
|
-
/**
|
|
213
|
-
* Get build information
|
|
214
|
-
* @returns {string}
|
|
215
|
-
*/
|
|
216
|
-
export function get_build_info() {
|
|
217
|
-
let deferred1_0;
|
|
218
|
-
let deferred1_1;
|
|
219
|
-
try {
|
|
220
|
-
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
|
221
|
-
wasm.get_build_info(retptr);
|
|
222
|
-
var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
|
|
223
|
-
var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
|
|
224
|
-
deferred1_0 = r0;
|
|
225
|
-
deferred1_1 = r1;
|
|
226
|
-
return getStringFromWasm0(r0, r1);
|
|
227
|
-
} finally {
|
|
228
|
-
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
229
|
-
wasm.__wbindgen_export(deferred1_0, deferred1_1, 1);
|
|
230
|
-
}
|
|
157
|
+
let deferred1_0;
|
|
158
|
+
let deferred1_1;
|
|
159
|
+
try {
|
|
160
|
+
const ret = wasm.version();
|
|
161
|
+
deferred1_0 = ret[0];
|
|
162
|
+
deferred1_1 = ret[1];
|
|
163
|
+
return getStringFromWasm0(ret[0], ret[1]);
|
|
164
|
+
} finally {
|
|
165
|
+
wasm.__wbindgen_free(deferred1_0, deferred1_1, 1);
|
|
166
|
+
}
|
|
231
167
|
}
|
|
232
168
|
|
|
233
|
-
const JsDetectionResultFinalization =
|
|
234
|
-
typeof FinalizationRegistry === 'undefined'
|
|
169
|
+
const JsDetectionResultFinalization = (typeof FinalizationRegistry === 'undefined')
|
|
235
170
|
? { register: () => {}, unregister: () => {} }
|
|
236
|
-
: new FinalizationRegistry(
|
|
171
|
+
: new FinalizationRegistry(ptr => wasm.__wbg_jsdetectionresult_free(ptr >>> 0, 1));
|
|
237
172
|
/**
|
|
238
173
|
* JavaScript-compatible detection result
|
|
239
174
|
*/
|
|
240
175
|
export class JsDetectionResult {
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
|
|
328
|
-
|
|
329
|
-
|
|
330
|
-
|
|
331
|
-
|
|
332
|
-
|
|
333
|
-
|
|
334
|
-
|
|
335
|
-
|
|
336
|
-
|
|
337
|
-
|
|
338
|
-
|
|
339
|
-
|
|
340
|
-
|
|
341
|
-
|
|
342
|
-
|
|
343
|
-
|
|
344
|
-
|
|
345
|
-
|
|
346
|
-
|
|
347
|
-
|
|
348
|
-
|
|
349
|
-
|
|
350
|
-
|
|
351
|
-
|
|
352
|
-
|
|
353
|
-
|
|
354
|
-
|
|
355
|
-
|
|
356
|
-
|
|
357
|
-
|
|
358
|
-
|
|
359
|
-
|
|
360
|
-
|
|
361
|
-
|
|
362
|
-
|
|
363
|
-
|
|
364
|
-
|
|
365
|
-
|
|
366
|
-
|
|
367
|
-
|
|
176
|
+
|
|
177
|
+
constructor() {
|
|
178
|
+
throw new Error('cannot invoke `new` directly');
|
|
179
|
+
}
|
|
180
|
+
|
|
181
|
+
static __wrap(ptr) {
|
|
182
|
+
ptr = ptr >>> 0;
|
|
183
|
+
const obj = Object.create(JsDetectionResult.prototype);
|
|
184
|
+
obj.__wbg_ptr = ptr;
|
|
185
|
+
JsDetectionResultFinalization.register(obj, obj.__wbg_ptr, obj);
|
|
186
|
+
return obj;
|
|
187
|
+
}
|
|
188
|
+
|
|
189
|
+
__destroy_into_raw() {
|
|
190
|
+
const ptr = this.__wbg_ptr;
|
|
191
|
+
this.__wbg_ptr = 0;
|
|
192
|
+
JsDetectionResultFinalization.unregister(this);
|
|
193
|
+
return ptr;
|
|
194
|
+
}
|
|
195
|
+
|
|
196
|
+
free() {
|
|
197
|
+
const ptr = this.__destroy_into_raw();
|
|
198
|
+
wasm.__wbg_jsdetectionresult_free(ptr, 0);
|
|
199
|
+
}
|
|
200
|
+
/**
|
|
201
|
+
* Whether the request was identified as coming from an agent
|
|
202
|
+
* @returns {boolean}
|
|
203
|
+
*/
|
|
204
|
+
get is_agent() {
|
|
205
|
+
if (this.__wbg_ptr == 0) throw new Error('Attempt to use a moved value');
|
|
206
|
+
_assertNum(this.__wbg_ptr);
|
|
207
|
+
const ret = wasm.__wbg_get_jsdetectionresult_is_agent(this.__wbg_ptr);
|
|
208
|
+
return ret !== 0;
|
|
209
|
+
}
|
|
210
|
+
/**
|
|
211
|
+
* Whether the request was identified as coming from an agent
|
|
212
|
+
* @param {boolean} arg0
|
|
213
|
+
*/
|
|
214
|
+
set is_agent(arg0) {
|
|
215
|
+
if (this.__wbg_ptr == 0) throw new Error('Attempt to use a moved value');
|
|
216
|
+
_assertNum(this.__wbg_ptr);
|
|
217
|
+
_assertBoolean(arg0);
|
|
218
|
+
wasm.__wbg_set_jsdetectionresult_is_agent(this.__wbg_ptr, arg0);
|
|
219
|
+
}
|
|
220
|
+
/**
|
|
221
|
+
* Confidence score (0.0 to 1.0)
|
|
222
|
+
* @returns {number}
|
|
223
|
+
*/
|
|
224
|
+
get confidence() {
|
|
225
|
+
if (this.__wbg_ptr == 0) throw new Error('Attempt to use a moved value');
|
|
226
|
+
_assertNum(this.__wbg_ptr);
|
|
227
|
+
const ret = wasm.__wbg_get_jsdetectionresult_confidence(this.__wbg_ptr);
|
|
228
|
+
return ret;
|
|
229
|
+
}
|
|
230
|
+
/**
|
|
231
|
+
* Confidence score (0.0 to 1.0)
|
|
232
|
+
* @param {number} arg0
|
|
233
|
+
*/
|
|
234
|
+
set confidence(arg0) {
|
|
235
|
+
if (this.__wbg_ptr == 0) throw new Error('Attempt to use a moved value');
|
|
236
|
+
_assertNum(this.__wbg_ptr);
|
|
237
|
+
wasm.__wbg_set_jsdetectionresult_confidence(this.__wbg_ptr, arg0);
|
|
238
|
+
}
|
|
239
|
+
/**
|
|
240
|
+
* Get the detected agent name
|
|
241
|
+
* @returns {string | undefined}
|
|
242
|
+
*/
|
|
243
|
+
get agent() {
|
|
244
|
+
if (this.__wbg_ptr == 0) throw new Error('Attempt to use a moved value');
|
|
245
|
+
_assertNum(this.__wbg_ptr);
|
|
246
|
+
const ret = wasm.jsdetectionresult_agent(this.__wbg_ptr);
|
|
247
|
+
let v1;
|
|
248
|
+
if (ret[0] !== 0) {
|
|
249
|
+
v1 = getStringFromWasm0(ret[0], ret[1]).slice();
|
|
250
|
+
wasm.__wbindgen_free(ret[0], ret[1] * 1, 1);
|
|
251
|
+
}
|
|
252
|
+
return v1;
|
|
253
|
+
}
|
|
254
|
+
/**
|
|
255
|
+
* Get the verification method as a string
|
|
256
|
+
* @returns {string}
|
|
257
|
+
*/
|
|
258
|
+
get verification_method() {
|
|
259
|
+
let deferred1_0;
|
|
260
|
+
let deferred1_1;
|
|
261
|
+
try {
|
|
262
|
+
if (this.__wbg_ptr == 0) throw new Error('Attempt to use a moved value');
|
|
263
|
+
_assertNum(this.__wbg_ptr);
|
|
264
|
+
const ret = wasm.jsdetectionresult_verification_method(this.__wbg_ptr);
|
|
265
|
+
deferred1_0 = ret[0];
|
|
266
|
+
deferred1_1 = ret[1];
|
|
267
|
+
return getStringFromWasm0(ret[0], ret[1]);
|
|
268
|
+
} finally {
|
|
269
|
+
wasm.__wbindgen_free(deferred1_0, deferred1_1, 1);
|
|
270
|
+
}
|
|
271
|
+
}
|
|
272
|
+
/**
|
|
273
|
+
* Get the risk level as a string
|
|
274
|
+
* @returns {string}
|
|
275
|
+
*/
|
|
276
|
+
get risk_level() {
|
|
277
|
+
let deferred1_0;
|
|
278
|
+
let deferred1_1;
|
|
279
|
+
try {
|
|
280
|
+
if (this.__wbg_ptr == 0) throw new Error('Attempt to use a moved value');
|
|
281
|
+
_assertNum(this.__wbg_ptr);
|
|
282
|
+
const ret = wasm.jsdetectionresult_risk_level(this.__wbg_ptr);
|
|
283
|
+
deferred1_0 = ret[0];
|
|
284
|
+
deferred1_1 = ret[1];
|
|
285
|
+
return getStringFromWasm0(ret[0], ret[1]);
|
|
286
|
+
} finally {
|
|
287
|
+
wasm.__wbindgen_free(deferred1_0, deferred1_1, 1);
|
|
288
|
+
}
|
|
289
|
+
}
|
|
290
|
+
/**
|
|
291
|
+
* Get the timestamp as a string
|
|
292
|
+
* @returns {string}
|
|
293
|
+
*/
|
|
294
|
+
get timestamp() {
|
|
295
|
+
let deferred1_0;
|
|
296
|
+
let deferred1_1;
|
|
297
|
+
try {
|
|
298
|
+
if (this.__wbg_ptr == 0) throw new Error('Attempt to use a moved value');
|
|
299
|
+
_assertNum(this.__wbg_ptr);
|
|
300
|
+
const ret = wasm.jsdetectionresult_timestamp(this.__wbg_ptr);
|
|
301
|
+
deferred1_0 = ret[0];
|
|
302
|
+
deferred1_1 = ret[1];
|
|
303
|
+
return getStringFromWasm0(ret[0], ret[1]);
|
|
304
|
+
} finally {
|
|
305
|
+
wasm.__wbindgen_free(deferred1_0, deferred1_1, 1);
|
|
306
|
+
}
|
|
368
307
|
}
|
|
369
|
-
}
|
|
370
308
|
}
|
|
371
|
-
if (Symbol.dispose) JsDetectionResult.prototype[Symbol.dispose] = JsDetectionResult.prototype.free;
|
|
372
309
|
|
|
373
|
-
const JsRequestMetadataFinalization =
|
|
374
|
-
typeof FinalizationRegistry === 'undefined'
|
|
310
|
+
const JsRequestMetadataFinalization = (typeof FinalizationRegistry === 'undefined')
|
|
375
311
|
? { register: () => {}, unregister: () => {} }
|
|
376
|
-
: new FinalizationRegistry(
|
|
312
|
+
: new FinalizationRegistry(ptr => wasm.__wbg_jsrequestmetadata_free(ptr >>> 0, 1));
|
|
377
313
|
/**
|
|
378
314
|
* JavaScript-compatible request metadata
|
|
379
315
|
*/
|
|
380
316
|
export class JsRequestMetadata {
|
|
381
|
-
|
|
382
|
-
|
|
383
|
-
|
|
384
|
-
|
|
385
|
-
|
|
386
|
-
|
|
387
|
-
|
|
388
|
-
free() {
|
|
389
|
-
const ptr = this.__destroy_into_raw();
|
|
390
|
-
wasm.__wbg_jsrequestmetadata_free(ptr, 0);
|
|
391
|
-
}
|
|
392
|
-
/**
|
|
393
|
-
* Constructor for JsRequestMetadata
|
|
394
|
-
* @param {string | null | undefined} user_agent
|
|
395
|
-
* @param {string | null | undefined} ip_address
|
|
396
|
-
* @param {string} headers
|
|
397
|
-
* @param {string} timestamp
|
|
398
|
-
* @param {string | null} [url]
|
|
399
|
-
* @param {string | null} [method]
|
|
400
|
-
* @param {string | null} [client_fingerprint]
|
|
401
|
-
*/
|
|
402
|
-
constructor(user_agent, ip_address, headers, timestamp, url, method, client_fingerprint) {
|
|
403
|
-
var ptr0 = isLikeNone(user_agent)
|
|
404
|
-
? 0
|
|
405
|
-
: passStringToWasm0(user_agent, wasm.__wbindgen_export2, wasm.__wbindgen_export3);
|
|
406
|
-
var len0 = WASM_VECTOR_LEN;
|
|
407
|
-
var ptr1 = isLikeNone(ip_address)
|
|
408
|
-
? 0
|
|
409
|
-
: passStringToWasm0(ip_address, wasm.__wbindgen_export2, wasm.__wbindgen_export3);
|
|
410
|
-
var len1 = WASM_VECTOR_LEN;
|
|
411
|
-
const ptr2 = passStringToWasm0(headers, wasm.__wbindgen_export2, wasm.__wbindgen_export3);
|
|
412
|
-
const len2 = WASM_VECTOR_LEN;
|
|
413
|
-
const ptr3 = passStringToWasm0(timestamp, wasm.__wbindgen_export2, wasm.__wbindgen_export3);
|
|
414
|
-
const len3 = WASM_VECTOR_LEN;
|
|
415
|
-
var ptr4 = isLikeNone(url)
|
|
416
|
-
? 0
|
|
417
|
-
: passStringToWasm0(url, wasm.__wbindgen_export2, wasm.__wbindgen_export3);
|
|
418
|
-
var len4 = WASM_VECTOR_LEN;
|
|
419
|
-
var ptr5 = isLikeNone(method)
|
|
420
|
-
? 0
|
|
421
|
-
: passStringToWasm0(method, wasm.__wbindgen_export2, wasm.__wbindgen_export3);
|
|
422
|
-
var len5 = WASM_VECTOR_LEN;
|
|
423
|
-
var ptr6 = isLikeNone(client_fingerprint)
|
|
424
|
-
? 0
|
|
425
|
-
: passStringToWasm0(client_fingerprint, wasm.__wbindgen_export2, wasm.__wbindgen_export3);
|
|
426
|
-
var len6 = WASM_VECTOR_LEN;
|
|
427
|
-
const ret = wasm.jsrequestmetadata_new(
|
|
428
|
-
ptr0,
|
|
429
|
-
len0,
|
|
430
|
-
ptr1,
|
|
431
|
-
len1,
|
|
432
|
-
ptr2,
|
|
433
|
-
len2,
|
|
434
|
-
ptr3,
|
|
435
|
-
len3,
|
|
436
|
-
ptr4,
|
|
437
|
-
len4,
|
|
438
|
-
ptr5,
|
|
439
|
-
len5,
|
|
440
|
-
ptr6,
|
|
441
|
-
len6
|
|
442
|
-
);
|
|
443
|
-
this.__wbg_ptr = ret >>> 0;
|
|
444
|
-
JsRequestMetadataFinalization.register(this, this.__wbg_ptr, this);
|
|
445
|
-
return this;
|
|
446
|
-
}
|
|
447
|
-
/**
|
|
448
|
-
* Get the user agent
|
|
449
|
-
* @returns {string | undefined}
|
|
450
|
-
*/
|
|
451
|
-
get user_agent() {
|
|
452
|
-
try {
|
|
453
|
-
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
|
454
|
-
wasm.jsrequestmetadata_user_agent(retptr, this.__wbg_ptr);
|
|
455
|
-
var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
|
|
456
|
-
var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
|
|
457
|
-
let v1;
|
|
458
|
-
if (r0 !== 0) {
|
|
459
|
-
v1 = getStringFromWasm0(r0, r1).slice();
|
|
460
|
-
wasm.__wbindgen_export(r0, r1 * 1, 1);
|
|
461
|
-
}
|
|
462
|
-
return v1;
|
|
463
|
-
} finally {
|
|
464
|
-
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
465
|
-
}
|
|
466
|
-
}
|
|
467
|
-
/**
|
|
468
|
-
* Get the IP address
|
|
469
|
-
* @returns {string | undefined}
|
|
470
|
-
*/
|
|
471
|
-
get ip_address() {
|
|
472
|
-
try {
|
|
473
|
-
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
|
474
|
-
wasm.jsrequestmetadata_ip_address(retptr, this.__wbg_ptr);
|
|
475
|
-
var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
|
|
476
|
-
var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
|
|
477
|
-
let v1;
|
|
478
|
-
if (r0 !== 0) {
|
|
479
|
-
v1 = getStringFromWasm0(r0, r1).slice();
|
|
480
|
-
wasm.__wbindgen_export(r0, r1 * 1, 1);
|
|
481
|
-
}
|
|
482
|
-
return v1;
|
|
483
|
-
} finally {
|
|
484
|
-
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
485
|
-
}
|
|
486
|
-
}
|
|
487
|
-
/**
|
|
488
|
-
* Get the headers as JSON string
|
|
489
|
-
* @returns {string}
|
|
490
|
-
*/
|
|
491
|
-
get headers() {
|
|
492
|
-
let deferred1_0;
|
|
493
|
-
let deferred1_1;
|
|
494
|
-
try {
|
|
495
|
-
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
|
496
|
-
wasm.jsrequestmetadata_headers(retptr, this.__wbg_ptr);
|
|
497
|
-
var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
|
|
498
|
-
var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
|
|
499
|
-
deferred1_0 = r0;
|
|
500
|
-
deferred1_1 = r1;
|
|
501
|
-
return getStringFromWasm0(r0, r1);
|
|
502
|
-
} finally {
|
|
503
|
-
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
504
|
-
wasm.__wbindgen_export(deferred1_0, deferred1_1, 1);
|
|
505
|
-
}
|
|
506
|
-
}
|
|
507
|
-
/**
|
|
508
|
-
* Get the timestamp
|
|
509
|
-
* @returns {string}
|
|
510
|
-
*/
|
|
511
|
-
get timestamp() {
|
|
512
|
-
let deferred1_0;
|
|
513
|
-
let deferred1_1;
|
|
514
|
-
try {
|
|
515
|
-
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
|
516
|
-
wasm.jsrequestmetadata_timestamp(retptr, this.__wbg_ptr);
|
|
517
|
-
var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
|
|
518
|
-
var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
|
|
519
|
-
deferred1_0 = r0;
|
|
520
|
-
deferred1_1 = r1;
|
|
521
|
-
return getStringFromWasm0(r0, r1);
|
|
522
|
-
} finally {
|
|
523
|
-
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
524
|
-
wasm.__wbindgen_export(deferred1_0, deferred1_1, 1);
|
|
525
|
-
}
|
|
526
|
-
}
|
|
527
|
-
/**
|
|
528
|
-
* Get the URL
|
|
529
|
-
* @returns {string | undefined}
|
|
530
|
-
*/
|
|
531
|
-
get url() {
|
|
532
|
-
try {
|
|
533
|
-
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
|
534
|
-
wasm.jsrequestmetadata_url(retptr, this.__wbg_ptr);
|
|
535
|
-
var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
|
|
536
|
-
var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
|
|
537
|
-
let v1;
|
|
538
|
-
if (r0 !== 0) {
|
|
539
|
-
v1 = getStringFromWasm0(r0, r1).slice();
|
|
540
|
-
wasm.__wbindgen_export(r0, r1 * 1, 1);
|
|
541
|
-
}
|
|
542
|
-
return v1;
|
|
543
|
-
} finally {
|
|
544
|
-
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
545
|
-
}
|
|
546
|
-
}
|
|
547
|
-
/**
|
|
548
|
-
* Get the method
|
|
549
|
-
* @returns {string | undefined}
|
|
550
|
-
*/
|
|
551
|
-
get method() {
|
|
552
|
-
try {
|
|
553
|
-
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
|
554
|
-
wasm.jsrequestmetadata_method(retptr, this.__wbg_ptr);
|
|
555
|
-
var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
|
|
556
|
-
var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
|
|
557
|
-
let v1;
|
|
558
|
-
if (r0 !== 0) {
|
|
559
|
-
v1 = getStringFromWasm0(r0, r1).slice();
|
|
560
|
-
wasm.__wbindgen_export(r0, r1 * 1, 1);
|
|
561
|
-
}
|
|
562
|
-
return v1;
|
|
563
|
-
} finally {
|
|
564
|
-
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
565
|
-
}
|
|
566
|
-
}
|
|
567
|
-
/**
|
|
568
|
-
* Get the client fingerprint
|
|
569
|
-
* @returns {string | undefined}
|
|
570
|
-
*/
|
|
571
|
-
get client_fingerprint() {
|
|
572
|
-
try {
|
|
573
|
-
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
|
574
|
-
wasm.jsrequestmetadata_client_fingerprint(retptr, this.__wbg_ptr);
|
|
575
|
-
var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
|
|
576
|
-
var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
|
|
577
|
-
let v1;
|
|
578
|
-
if (r0 !== 0) {
|
|
579
|
-
v1 = getStringFromWasm0(r0, r1).slice();
|
|
580
|
-
wasm.__wbindgen_export(r0, r1 * 1, 1);
|
|
581
|
-
}
|
|
582
|
-
return v1;
|
|
583
|
-
} finally {
|
|
584
|
-
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
317
|
+
|
|
318
|
+
__destroy_into_raw() {
|
|
319
|
+
const ptr = this.__wbg_ptr;
|
|
320
|
+
this.__wbg_ptr = 0;
|
|
321
|
+
JsRequestMetadataFinalization.unregister(this);
|
|
322
|
+
return ptr;
|
|
585
323
|
}
|
|
586
|
-
}
|
|
587
|
-
}
|
|
588
|
-
if (Symbol.dispose) JsRequestMetadata.prototype[Symbol.dispose] = JsRequestMetadata.prototype.free;
|
|
589
324
|
|
|
590
|
-
|
|
325
|
+
free() {
|
|
326
|
+
const ptr = this.__destroy_into_raw();
|
|
327
|
+
wasm.__wbg_jsrequestmetadata_free(ptr, 0);
|
|
328
|
+
}
|
|
329
|
+
/**
|
|
330
|
+
* Constructor for JsRequestMetadata
|
|
331
|
+
* @param {string | null | undefined} user_agent
|
|
332
|
+
* @param {string | null | undefined} ip_address
|
|
333
|
+
* @param {string} headers
|
|
334
|
+
* @param {string} timestamp
|
|
335
|
+
* @param {string | null} [url]
|
|
336
|
+
* @param {string | null} [method]
|
|
337
|
+
* @param {string | null} [client_fingerprint]
|
|
338
|
+
*/
|
|
339
|
+
constructor(user_agent, ip_address, headers, timestamp, url, method, client_fingerprint) {
|
|
340
|
+
var ptr0 = isLikeNone(user_agent) ? 0 : passStringToWasm0(user_agent, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
341
|
+
var len0 = WASM_VECTOR_LEN;
|
|
342
|
+
var ptr1 = isLikeNone(ip_address) ? 0 : passStringToWasm0(ip_address, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
343
|
+
var len1 = WASM_VECTOR_LEN;
|
|
344
|
+
const ptr2 = passStringToWasm0(headers, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
345
|
+
const len2 = WASM_VECTOR_LEN;
|
|
346
|
+
const ptr3 = passStringToWasm0(timestamp, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
347
|
+
const len3 = WASM_VECTOR_LEN;
|
|
348
|
+
var ptr4 = isLikeNone(url) ? 0 : passStringToWasm0(url, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
349
|
+
var len4 = WASM_VECTOR_LEN;
|
|
350
|
+
var ptr5 = isLikeNone(method) ? 0 : passStringToWasm0(method, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
351
|
+
var len5 = WASM_VECTOR_LEN;
|
|
352
|
+
var ptr6 = isLikeNone(client_fingerprint) ? 0 : passStringToWasm0(client_fingerprint, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
353
|
+
var len6 = WASM_VECTOR_LEN;
|
|
354
|
+
const ret = wasm.jsrequestmetadata_new(ptr0, len0, ptr1, len1, ptr2, len2, ptr3, len3, ptr4, len4, ptr5, len5, ptr6, len6);
|
|
355
|
+
this.__wbg_ptr = ret >>> 0;
|
|
356
|
+
JsRequestMetadataFinalization.register(this, this.__wbg_ptr, this);
|
|
357
|
+
return this;
|
|
358
|
+
}
|
|
359
|
+
/**
|
|
360
|
+
* Get the user agent
|
|
361
|
+
* @returns {string | undefined}
|
|
362
|
+
*/
|
|
363
|
+
get user_agent() {
|
|
364
|
+
if (this.__wbg_ptr == 0) throw new Error('Attempt to use a moved value');
|
|
365
|
+
_assertNum(this.__wbg_ptr);
|
|
366
|
+
const ret = wasm.jsrequestmetadata_user_agent(this.__wbg_ptr);
|
|
367
|
+
let v1;
|
|
368
|
+
if (ret[0] !== 0) {
|
|
369
|
+
v1 = getStringFromWasm0(ret[0], ret[1]).slice();
|
|
370
|
+
wasm.__wbindgen_free(ret[0], ret[1] * 1, 1);
|
|
371
|
+
}
|
|
372
|
+
return v1;
|
|
373
|
+
}
|
|
374
|
+
/**
|
|
375
|
+
* Get the IP address
|
|
376
|
+
* @returns {string | undefined}
|
|
377
|
+
*/
|
|
378
|
+
get ip_address() {
|
|
379
|
+
if (this.__wbg_ptr == 0) throw new Error('Attempt to use a moved value');
|
|
380
|
+
_assertNum(this.__wbg_ptr);
|
|
381
|
+
const ret = wasm.jsrequestmetadata_ip_address(this.__wbg_ptr);
|
|
382
|
+
let v1;
|
|
383
|
+
if (ret[0] !== 0) {
|
|
384
|
+
v1 = getStringFromWasm0(ret[0], ret[1]).slice();
|
|
385
|
+
wasm.__wbindgen_free(ret[0], ret[1] * 1, 1);
|
|
386
|
+
}
|
|
387
|
+
return v1;
|
|
388
|
+
}
|
|
389
|
+
/**
|
|
390
|
+
* Get the headers as JSON string
|
|
391
|
+
* @returns {string}
|
|
392
|
+
*/
|
|
393
|
+
get headers() {
|
|
394
|
+
let deferred1_0;
|
|
395
|
+
let deferred1_1;
|
|
396
|
+
try {
|
|
397
|
+
if (this.__wbg_ptr == 0) throw new Error('Attempt to use a moved value');
|
|
398
|
+
_assertNum(this.__wbg_ptr);
|
|
399
|
+
const ret = wasm.jsrequestmetadata_headers(this.__wbg_ptr);
|
|
400
|
+
deferred1_0 = ret[0];
|
|
401
|
+
deferred1_1 = ret[1];
|
|
402
|
+
return getStringFromWasm0(ret[0], ret[1]);
|
|
403
|
+
} finally {
|
|
404
|
+
wasm.__wbindgen_free(deferred1_0, deferred1_1, 1);
|
|
405
|
+
}
|
|
406
|
+
}
|
|
407
|
+
/**
|
|
408
|
+
* Get the timestamp
|
|
409
|
+
* @returns {string}
|
|
410
|
+
*/
|
|
411
|
+
get timestamp() {
|
|
412
|
+
let deferred1_0;
|
|
413
|
+
let deferred1_1;
|
|
414
|
+
try {
|
|
415
|
+
if (this.__wbg_ptr == 0) throw new Error('Attempt to use a moved value');
|
|
416
|
+
_assertNum(this.__wbg_ptr);
|
|
417
|
+
const ret = wasm.jsrequestmetadata_timestamp(this.__wbg_ptr);
|
|
418
|
+
deferred1_0 = ret[0];
|
|
419
|
+
deferred1_1 = ret[1];
|
|
420
|
+
return getStringFromWasm0(ret[0], ret[1]);
|
|
421
|
+
} finally {
|
|
422
|
+
wasm.__wbindgen_free(deferred1_0, deferred1_1, 1);
|
|
423
|
+
}
|
|
424
|
+
}
|
|
425
|
+
/**
|
|
426
|
+
* Get the URL
|
|
427
|
+
* @returns {string | undefined}
|
|
428
|
+
*/
|
|
429
|
+
get url() {
|
|
430
|
+
if (this.__wbg_ptr == 0) throw new Error('Attempt to use a moved value');
|
|
431
|
+
_assertNum(this.__wbg_ptr);
|
|
432
|
+
const ret = wasm.jsrequestmetadata_url(this.__wbg_ptr);
|
|
433
|
+
let v1;
|
|
434
|
+
if (ret[0] !== 0) {
|
|
435
|
+
v1 = getStringFromWasm0(ret[0], ret[1]).slice();
|
|
436
|
+
wasm.__wbindgen_free(ret[0], ret[1] * 1, 1);
|
|
437
|
+
}
|
|
438
|
+
return v1;
|
|
439
|
+
}
|
|
440
|
+
/**
|
|
441
|
+
* Get the method
|
|
442
|
+
* @returns {string | undefined}
|
|
443
|
+
*/
|
|
444
|
+
get method() {
|
|
445
|
+
if (this.__wbg_ptr == 0) throw new Error('Attempt to use a moved value');
|
|
446
|
+
_assertNum(this.__wbg_ptr);
|
|
447
|
+
const ret = wasm.jsrequestmetadata_method(this.__wbg_ptr);
|
|
448
|
+
let v1;
|
|
449
|
+
if (ret[0] !== 0) {
|
|
450
|
+
v1 = getStringFromWasm0(ret[0], ret[1]).slice();
|
|
451
|
+
wasm.__wbindgen_free(ret[0], ret[1] * 1, 1);
|
|
452
|
+
}
|
|
453
|
+
return v1;
|
|
454
|
+
}
|
|
455
|
+
/**
|
|
456
|
+
* Get the client fingerprint
|
|
457
|
+
* @returns {string | undefined}
|
|
458
|
+
*/
|
|
459
|
+
get client_fingerprint() {
|
|
460
|
+
if (this.__wbg_ptr == 0) throw new Error('Attempt to use a moved value');
|
|
461
|
+
_assertNum(this.__wbg_ptr);
|
|
462
|
+
const ret = wasm.jsrequestmetadata_client_fingerprint(this.__wbg_ptr);
|
|
463
|
+
let v1;
|
|
464
|
+
if (ret[0] !== 0) {
|
|
465
|
+
v1 = getStringFromWasm0(ret[0], ret[1]).slice();
|
|
466
|
+
wasm.__wbindgen_free(ret[0], ret[1] * 1, 1);
|
|
467
|
+
}
|
|
468
|
+
return v1;
|
|
469
|
+
}
|
|
470
|
+
}
|
|
591
471
|
|
|
592
472
|
async function __wbg_load(module, imports) {
|
|
593
|
-
|
|
594
|
-
|
|
595
|
-
|
|
596
|
-
|
|
597
|
-
|
|
598
|
-
|
|
599
|
-
|
|
600
|
-
|
|
601
|
-
|
|
602
|
-
|
|
603
|
-
|
|
604
|
-
|
|
605
|
-
|
|
606
|
-
throw e;
|
|
473
|
+
if (typeof Response === 'function' && module instanceof Response) {
|
|
474
|
+
if (typeof WebAssembly.instantiateStreaming === 'function') {
|
|
475
|
+
try {
|
|
476
|
+
return await WebAssembly.instantiateStreaming(module, imports);
|
|
477
|
+
|
|
478
|
+
} catch (e) {
|
|
479
|
+
if (module.headers.get('Content-Type') != 'application/wasm') {
|
|
480
|
+
console.warn("`WebAssembly.instantiateStreaming` failed because your server does not serve Wasm with `application/wasm` MIME type. Falling back to `WebAssembly.instantiate` which is slower. Original error:\n", e);
|
|
481
|
+
|
|
482
|
+
} else {
|
|
483
|
+
throw e;
|
|
484
|
+
}
|
|
485
|
+
}
|
|
607
486
|
}
|
|
608
|
-
}
|
|
609
|
-
}
|
|
610
487
|
|
|
611
|
-
|
|
612
|
-
|
|
613
|
-
} else {
|
|
614
|
-
const instance = await WebAssembly.instantiate(module, imports);
|
|
488
|
+
const bytes = await module.arrayBuffer();
|
|
489
|
+
return await WebAssembly.instantiate(bytes, imports);
|
|
615
490
|
|
|
616
|
-
if (instance instanceof WebAssembly.Instance) {
|
|
617
|
-
return { instance, module };
|
|
618
491
|
} else {
|
|
619
|
-
|
|
492
|
+
const instance = await WebAssembly.instantiate(module, imports);
|
|
493
|
+
|
|
494
|
+
if (instance instanceof WebAssembly.Instance) {
|
|
495
|
+
return { instance, module };
|
|
496
|
+
|
|
497
|
+
} else {
|
|
498
|
+
return instance;
|
|
499
|
+
}
|
|
620
500
|
}
|
|
621
|
-
}
|
|
622
501
|
}
|
|
623
502
|
|
|
624
503
|
function __wbg_get_imports() {
|
|
625
|
-
|
|
626
|
-
|
|
627
|
-
|
|
628
|
-
|
|
629
|
-
|
|
630
|
-
|
|
631
|
-
|
|
632
|
-
|
|
633
|
-
|
|
634
|
-
|
|
635
|
-
|
|
636
|
-
|
|
637
|
-
}
|
|
638
|
-
|
|
639
|
-
|
|
640
|
-
|
|
641
|
-
|
|
642
|
-
|
|
643
|
-
|
|
644
|
-
|
|
645
|
-
|
|
646
|
-
|
|
647
|
-
|
|
648
|
-
|
|
649
|
-
|
|
650
|
-
|
|
651
|
-
|
|
652
|
-
|
|
653
|
-
|
|
654
|
-
|
|
655
|
-
|
|
656
|
-
|
|
657
|
-
|
|
658
|
-
|
|
659
|
-
|
|
660
|
-
|
|
661
|
-
|
|
662
|
-
|
|
663
|
-
|
|
664
|
-
|
|
665
|
-
|
|
666
|
-
|
|
667
|
-
|
|
668
|
-
|
|
669
|
-
|
|
670
|
-
|
|
671
|
-
|
|
672
|
-
|
|
673
|
-
|
|
674
|
-
|
|
675
|
-
|
|
676
|
-
|
|
504
|
+
const imports = {};
|
|
505
|
+
imports.wbg = {};
|
|
506
|
+
imports.wbg.__wbg_error_7534b8e9a36f1ab4 = function() { return logError(function (arg0, arg1) {
|
|
507
|
+
let deferred0_0;
|
|
508
|
+
let deferred0_1;
|
|
509
|
+
try {
|
|
510
|
+
deferred0_0 = arg0;
|
|
511
|
+
deferred0_1 = arg1;
|
|
512
|
+
console.error(getStringFromWasm0(arg0, arg1));
|
|
513
|
+
} finally {
|
|
514
|
+
wasm.__wbindgen_free(deferred0_0, deferred0_1, 1);
|
|
515
|
+
}
|
|
516
|
+
}, arguments) };
|
|
517
|
+
imports.wbg.__wbg_getTime_46267b1c24877e30 = function() { return logError(function (arg0) {
|
|
518
|
+
const ret = arg0.getTime();
|
|
519
|
+
return ret;
|
|
520
|
+
}, arguments) };
|
|
521
|
+
imports.wbg.__wbg_log_c222819a41e063d3 = function() { return logError(function (arg0) {
|
|
522
|
+
console.log(arg0);
|
|
523
|
+
}, arguments) };
|
|
524
|
+
imports.wbg.__wbg_new_31a97dac4f10fab7 = function() { return logError(function (arg0) {
|
|
525
|
+
const ret = new Date(arg0);
|
|
526
|
+
return ret;
|
|
527
|
+
}, arguments) };
|
|
528
|
+
imports.wbg.__wbg_new_8a6f238a6ece86ea = function() { return logError(function () {
|
|
529
|
+
const ret = new Error();
|
|
530
|
+
return ret;
|
|
531
|
+
}, arguments) };
|
|
532
|
+
imports.wbg.__wbg_now_807e54c39636c349 = function() { return logError(function () {
|
|
533
|
+
const ret = Date.now();
|
|
534
|
+
return ret;
|
|
535
|
+
}, arguments) };
|
|
536
|
+
imports.wbg.__wbg_stack_0ed75d68575b0f3c = function() { return logError(function (arg0, arg1) {
|
|
537
|
+
const ret = arg1.stack;
|
|
538
|
+
const ptr1 = passStringToWasm0(ret, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
539
|
+
const len1 = WASM_VECTOR_LEN;
|
|
540
|
+
getDataViewMemory0().setInt32(arg0 + 4 * 1, len1, true);
|
|
541
|
+
getDataViewMemory0().setInt32(arg0 + 4 * 0, ptr1, true);
|
|
542
|
+
}, arguments) };
|
|
543
|
+
imports.wbg.__wbindgen_init_externref_table = function() {
|
|
544
|
+
const table = wasm.__wbindgen_export_3;
|
|
545
|
+
const offset = table.grow(4);
|
|
546
|
+
table.set(0, undefined);
|
|
547
|
+
table.set(offset + 0, undefined);
|
|
548
|
+
table.set(offset + 1, null);
|
|
549
|
+
table.set(offset + 2, true);
|
|
550
|
+
table.set(offset + 3, false);
|
|
551
|
+
;
|
|
552
|
+
};
|
|
553
|
+
imports.wbg.__wbindgen_string_new = function(arg0, arg1) {
|
|
554
|
+
const ret = getStringFromWasm0(arg0, arg1);
|
|
555
|
+
return ret;
|
|
556
|
+
};
|
|
557
|
+
imports.wbg.__wbindgen_throw = function(arg0, arg1) {
|
|
558
|
+
throw new Error(getStringFromWasm0(arg0, arg1));
|
|
559
|
+
};
|
|
560
|
+
|
|
561
|
+
return imports;
|
|
562
|
+
}
|
|
563
|
+
|
|
564
|
+
function __wbg_init_memory(imports, memory) {
|
|
565
|
+
|
|
677
566
|
}
|
|
678
567
|
|
|
679
568
|
function __wbg_finalize_init(instance, module) {
|
|
680
|
-
|
|
681
|
-
|
|
682
|
-
|
|
683
|
-
|
|
569
|
+
wasm = instance.exports;
|
|
570
|
+
__wbg_init.__wbindgen_wasm_module = module;
|
|
571
|
+
cachedDataViewMemory0 = null;
|
|
572
|
+
cachedUint8ArrayMemory0 = null;
|
|
573
|
+
|
|
684
574
|
|
|
685
|
-
|
|
686
|
-
|
|
575
|
+
wasm.__wbindgen_start();
|
|
576
|
+
return wasm;
|
|
687
577
|
}
|
|
688
578
|
|
|
689
579
|
function initSync(module) {
|
|
690
|
-
|
|
580
|
+
if (wasm !== undefined) return wasm;
|
|
691
581
|
|
|
692
|
-
|
|
693
|
-
if (
|
|
694
|
-
|
|
695
|
-
|
|
696
|
-
|
|
582
|
+
|
|
583
|
+
if (typeof module !== 'undefined') {
|
|
584
|
+
if (Object.getPrototypeOf(module) === Object.prototype) {
|
|
585
|
+
({module} = module)
|
|
586
|
+
} else {
|
|
587
|
+
console.warn('using deprecated parameters for `initSync()`; pass a single object instead')
|
|
588
|
+
}
|
|
697
589
|
}
|
|
698
|
-
}
|
|
699
590
|
|
|
700
|
-
|
|
591
|
+
const imports = __wbg_get_imports();
|
|
701
592
|
|
|
702
|
-
|
|
703
|
-
module = new WebAssembly.Module(module);
|
|
704
|
-
}
|
|
593
|
+
__wbg_init_memory(imports);
|
|
705
594
|
|
|
706
|
-
|
|
595
|
+
if (!(module instanceof WebAssembly.Module)) {
|
|
596
|
+
module = new WebAssembly.Module(module);
|
|
597
|
+
}
|
|
598
|
+
|
|
599
|
+
const instance = new WebAssembly.Instance(module, imports);
|
|
707
600
|
|
|
708
|
-
|
|
601
|
+
return __wbg_finalize_init(instance, module);
|
|
709
602
|
}
|
|
710
603
|
|
|
711
604
|
async function __wbg_init(module_or_path) {
|
|
712
|
-
|
|
605
|
+
if (wasm !== undefined) return wasm;
|
|
713
606
|
|
|
714
|
-
|
|
715
|
-
if (
|
|
716
|
-
|
|
717
|
-
|
|
718
|
-
|
|
719
|
-
|
|
720
|
-
|
|
607
|
+
|
|
608
|
+
if (typeof module_or_path !== 'undefined') {
|
|
609
|
+
if (Object.getPrototypeOf(module_or_path) === Object.prototype) {
|
|
610
|
+
({module_or_path} = module_or_path)
|
|
611
|
+
} else {
|
|
612
|
+
console.warn('using deprecated parameters for the initialization function; pass a single object instead')
|
|
613
|
+
}
|
|
614
|
+
}
|
|
615
|
+
|
|
616
|
+
if (typeof module_or_path === 'undefined') {
|
|
617
|
+
module_or_path = new URL('agentshield_wasm_bg.wasm', import.meta.url);
|
|
721
618
|
}
|
|
722
|
-
|
|
619
|
+
const imports = __wbg_get_imports();
|
|
723
620
|
|
|
724
|
-
|
|
725
|
-
|
|
726
|
-
|
|
727
|
-
const imports = __wbg_get_imports();
|
|
621
|
+
if (typeof module_or_path === 'string' || (typeof Request === 'function' && module_or_path instanceof Request) || (typeof URL === 'function' && module_or_path instanceof URL)) {
|
|
622
|
+
module_or_path = fetch(module_or_path);
|
|
623
|
+
}
|
|
728
624
|
|
|
729
|
-
|
|
730
|
-
typeof module_or_path === 'string' ||
|
|
731
|
-
(typeof Request === 'function' && module_or_path instanceof Request) ||
|
|
732
|
-
(typeof URL === 'function' && module_or_path instanceof URL)
|
|
733
|
-
) {
|
|
734
|
-
module_or_path = fetch(module_or_path);
|
|
735
|
-
}
|
|
625
|
+
__wbg_init_memory(imports);
|
|
736
626
|
|
|
737
|
-
|
|
627
|
+
const { instance, module } = await __wbg_load(await module_or_path, imports);
|
|
738
628
|
|
|
739
|
-
|
|
629
|
+
return __wbg_finalize_init(instance, module);
|
|
740
630
|
}
|
|
741
631
|
|
|
742
632
|
export { initSync };
|