@kya-os/agentshield-nextjs 0.2.3 → 0.2.4
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/package.json +1 -1
- package/wasm/agentshield_wasm.d.ts +33 -6
- package/wasm/agentshield_wasm.js +284 -209
- package/wasm/agentshield_wasm_bg.wasm +0 -0
package/package.json
CHANGED
|
@@ -12,18 +12,27 @@ export function detect_agent(metadata: JsRequestMetadata): JsDetectionResult;
|
|
|
12
12
|
* Get the version of the AgentShield library
|
|
13
13
|
*/
|
|
14
14
|
export function version(): string;
|
|
15
|
+
/**
|
|
16
|
+
* Get the version of the AgentShield library
|
|
17
|
+
*/
|
|
18
|
+
export function get_version(): string;
|
|
19
|
+
/**
|
|
20
|
+
* Get build information
|
|
21
|
+
*/
|
|
22
|
+
export function get_build_info(): string;
|
|
15
23
|
/**
|
|
16
24
|
* JavaScript-compatible detection result
|
|
17
25
|
*/
|
|
18
26
|
export class JsDetectionResult {
|
|
19
27
|
private constructor();
|
|
20
28
|
free(): void;
|
|
29
|
+
[Symbol.dispose](): void;
|
|
21
30
|
/**
|
|
22
31
|
* Whether the request was identified as coming from an agent
|
|
23
32
|
*/
|
|
24
33
|
is_agent: boolean;
|
|
25
34
|
/**
|
|
26
|
-
* Confidence score (0
|
|
35
|
+
* Confidence score (0-100 scale)
|
|
27
36
|
*/
|
|
28
37
|
confidence: number;
|
|
29
38
|
/**
|
|
@@ -48,10 +57,11 @@ export class JsDetectionResult {
|
|
|
48
57
|
*/
|
|
49
58
|
export class JsRequestMetadata {
|
|
50
59
|
free(): void;
|
|
60
|
+
[Symbol.dispose](): void;
|
|
51
61
|
/**
|
|
52
62
|
* Constructor for JsRequestMetadata
|
|
53
63
|
*/
|
|
54
|
-
constructor(user_agent: string | null | undefined, ip_address: string | null | undefined, headers: string, timestamp: string);
|
|
64
|
+
constructor(user_agent: string | null | undefined, ip_address: string | null | undefined, headers: string, timestamp: string, url?: string | null, method?: string | null, client_fingerprint?: string | null);
|
|
55
65
|
/**
|
|
56
66
|
* Get the user agent
|
|
57
67
|
*/
|
|
@@ -68,6 +78,18 @@ export class JsRequestMetadata {
|
|
|
68
78
|
* Get the timestamp
|
|
69
79
|
*/
|
|
70
80
|
readonly timestamp: string;
|
|
81
|
+
/**
|
|
82
|
+
* Get the URL
|
|
83
|
+
*/
|
|
84
|
+
readonly url: string | undefined;
|
|
85
|
+
/**
|
|
86
|
+
* Get the method
|
|
87
|
+
*/
|
|
88
|
+
readonly method: string | undefined;
|
|
89
|
+
/**
|
|
90
|
+
* Get the client fingerprint
|
|
91
|
+
*/
|
|
92
|
+
readonly client_fingerprint: string | undefined;
|
|
71
93
|
}
|
|
72
94
|
|
|
73
95
|
export type InitInput = RequestInfo | URL | Response | BufferSource | WebAssembly.Module;
|
|
@@ -84,17 +106,22 @@ export interface InitOutput {
|
|
|
84
106
|
readonly jsdetectionresult_risk_level: (a: number, b: number) => void;
|
|
85
107
|
readonly jsdetectionresult_timestamp: (a: number, b: number) => void;
|
|
86
108
|
readonly __wbg_jsrequestmetadata_free: (a: number, b: number) => void;
|
|
87
|
-
readonly jsrequestmetadata_new: (a: number, b: number, c: number, d: number, e: number, f: number, g: number, h: number) => number;
|
|
109
|
+
readonly jsrequestmetadata_new: (a: number, b: number, c: number, d: number, e: number, f: number, g: number, h: number, i: number, j: number, k: number, l: number, m: number, n: number) => number;
|
|
88
110
|
readonly jsrequestmetadata_user_agent: (a: number, b: number) => void;
|
|
89
111
|
readonly jsrequestmetadata_ip_address: (a: number, b: number) => void;
|
|
90
112
|
readonly jsrequestmetadata_headers: (a: number, b: number) => void;
|
|
91
113
|
readonly jsrequestmetadata_timestamp: (a: number, b: number) => void;
|
|
114
|
+
readonly jsrequestmetadata_url: (a: number, b: number) => void;
|
|
115
|
+
readonly jsrequestmetadata_method: (a: number, b: number) => void;
|
|
116
|
+
readonly jsrequestmetadata_client_fingerprint: (a: number, b: number) => void;
|
|
92
117
|
readonly init: () => void;
|
|
93
118
|
readonly detect_agent: (a: number, b: number) => void;
|
|
119
|
+
readonly get_version: (a: number) => void;
|
|
120
|
+
readonly get_build_info: (a: number) => void;
|
|
94
121
|
readonly version: (a: number) => void;
|
|
95
|
-
readonly
|
|
96
|
-
readonly
|
|
97
|
-
readonly
|
|
122
|
+
readonly __wbindgen_export: (a: number, b: number, c: number) => void;
|
|
123
|
+
readonly __wbindgen_export2: (a: number, b: number) => number;
|
|
124
|
+
readonly __wbindgen_export3: (a: number, b: number, c: number, d: number) => number;
|
|
98
125
|
readonly __wbindgen_add_to_stack_pointer: (a: number) => number;
|
|
99
126
|
readonly __wbindgen_start: () => void;
|
|
100
127
|
}
|
package/wasm/agentshield_wasm.js
CHANGED
|
@@ -1,9 +1,5 @@
|
|
|
1
1
|
let wasm;
|
|
2
2
|
|
|
3
|
-
const cachedTextDecoder = (typeof TextDecoder !== 'undefined' ? new TextDecoder('utf-8', { ignoreBOM: true, fatal: true }) : { decode: () => { throw Error('TextDecoder not available') } } );
|
|
4
|
-
|
|
5
|
-
if (typeof TextDecoder !== 'undefined') { cachedTextDecoder.decode(); };
|
|
6
|
-
|
|
7
3
|
let cachedUint8ArrayMemory0 = null;
|
|
8
4
|
|
|
9
5
|
function getUint8ArrayMemory0() {
|
|
@@ -13,48 +9,61 @@ function getUint8ArrayMemory0() {
|
|
|
13
9
|
return cachedUint8ArrayMemory0;
|
|
14
10
|
}
|
|
15
11
|
|
|
12
|
+
let cachedTextDecoder = new TextDecoder('utf-8', { ignoreBOM: true, fatal: true });
|
|
13
|
+
|
|
14
|
+
cachedTextDecoder.decode();
|
|
15
|
+
|
|
16
|
+
const MAX_SAFARI_DECODE_BYTES = 2146435072;
|
|
17
|
+
let numBytesDecoded = 0;
|
|
18
|
+
function decodeText(ptr, len) {
|
|
19
|
+
numBytesDecoded += len;
|
|
20
|
+
if (numBytesDecoded >= MAX_SAFARI_DECODE_BYTES) {
|
|
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));
|
|
26
|
+
}
|
|
27
|
+
|
|
16
28
|
function getStringFromWasm0(ptr, len) {
|
|
17
29
|
ptr = ptr >>> 0;
|
|
18
|
-
return
|
|
30
|
+
return decodeText(ptr, len);
|
|
19
31
|
}
|
|
20
32
|
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
33
|
+
let heap = new Array(128).fill(undefined);
|
|
34
|
+
|
|
35
|
+
heap.push(undefined, null, true, false);
|
|
36
|
+
|
|
37
|
+
function getObject(idx) { return heap[idx]; }
|
|
38
|
+
|
|
39
|
+
let heap_next = heap.length;
|
|
40
|
+
|
|
41
|
+
function addHeapObject(obj) {
|
|
42
|
+
if (heap_next === heap.length) heap.push(heap.length + 1);
|
|
43
|
+
const idx = heap_next;
|
|
44
|
+
heap_next = heap[idx];
|
|
45
|
+
|
|
46
|
+
heap[idx] = obj;
|
|
47
|
+
return idx;
|
|
35
48
|
}
|
|
36
49
|
|
|
37
50
|
let WASM_VECTOR_LEN = 0;
|
|
38
51
|
|
|
39
|
-
const cachedTextEncoder =
|
|
52
|
+
const cachedTextEncoder = new TextEncoder();
|
|
40
53
|
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
54
|
+
if (!('encodeInto' in cachedTextEncoder)) {
|
|
55
|
+
cachedTextEncoder.encodeInto = function (arg, view) {
|
|
56
|
+
const buf = cachedTextEncoder.encode(arg);
|
|
57
|
+
view.set(buf);
|
|
58
|
+
return {
|
|
59
|
+
read: arg.length,
|
|
60
|
+
written: buf.length
|
|
61
|
+
};
|
|
62
|
+
}
|
|
44
63
|
}
|
|
45
|
-
: function (arg, view) {
|
|
46
|
-
const buf = cachedTextEncoder.encode(arg);
|
|
47
|
-
view.set(buf);
|
|
48
|
-
return {
|
|
49
|
-
read: arg.length,
|
|
50
|
-
written: buf.length
|
|
51
|
-
};
|
|
52
|
-
});
|
|
53
64
|
|
|
54
65
|
function passStringToWasm0(arg, malloc, realloc) {
|
|
55
66
|
|
|
56
|
-
if (typeof(arg) !== 'string') throw new Error(`expected a string argument, found ${typeof(arg)}`);
|
|
57
|
-
|
|
58
67
|
if (realloc === undefined) {
|
|
59
68
|
const buf = cachedTextEncoder.encode(arg);
|
|
60
69
|
const ptr = malloc(buf.length, 1) >>> 0;
|
|
@@ -82,8 +91,8 @@ function passStringToWasm0(arg, malloc, realloc) {
|
|
|
82
91
|
}
|
|
83
92
|
ptr = realloc(ptr, len, len = offset + arg.length * 3, 1) >>> 0;
|
|
84
93
|
const view = getUint8ArrayMemory0().subarray(ptr + offset, ptr + len);
|
|
85
|
-
const ret =
|
|
86
|
-
|
|
94
|
+
const ret = cachedTextEncoder.encodeInto(arg, view);
|
|
95
|
+
|
|
87
96
|
offset += ret.written;
|
|
88
97
|
ptr = realloc(ptr, len, offset, 1) >>> 0;
|
|
89
98
|
}
|
|
@@ -101,14 +110,16 @@ function getDataViewMemory0() {
|
|
|
101
110
|
return cachedDataViewMemory0;
|
|
102
111
|
}
|
|
103
112
|
|
|
104
|
-
function
|
|
105
|
-
if (
|
|
113
|
+
function dropObject(idx) {
|
|
114
|
+
if (idx < 132) return;
|
|
115
|
+
heap[idx] = heap_next;
|
|
116
|
+
heap_next = idx;
|
|
106
117
|
}
|
|
107
118
|
|
|
108
|
-
function
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
119
|
+
function takeObject(idx) {
|
|
120
|
+
const ret = getObject(idx);
|
|
121
|
+
dropObject(idx);
|
|
122
|
+
return ret;
|
|
112
123
|
}
|
|
113
124
|
|
|
114
125
|
function isLikeNone(x) {
|
|
@@ -126,27 +137,26 @@ function _assertClass(instance, klass) {
|
|
|
126
137
|
throw new Error(`expected instance of ${klass.name}`);
|
|
127
138
|
}
|
|
128
139
|
}
|
|
129
|
-
|
|
130
|
-
function takeFromExternrefTable0(idx) {
|
|
131
|
-
const value = wasm.__wbindgen_export_3.get(idx);
|
|
132
|
-
wasm.__externref_table_dealloc(idx);
|
|
133
|
-
return value;
|
|
134
|
-
}
|
|
135
140
|
/**
|
|
136
141
|
* Analyze a request and detect if it's from an agent
|
|
137
142
|
* @param {JsRequestMetadata} metadata
|
|
138
143
|
* @returns {JsDetectionResult}
|
|
139
144
|
*/
|
|
140
145
|
export function detect_agent(metadata) {
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
146
|
+
try {
|
|
147
|
+
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
|
148
|
+
_assertClass(metadata, JsRequestMetadata);
|
|
149
|
+
wasm.detect_agent(retptr, metadata.__wbg_ptr);
|
|
150
|
+
var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
|
|
151
|
+
var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
|
|
152
|
+
var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
|
|
153
|
+
if (r2) {
|
|
154
|
+
throw takeObject(r1);
|
|
155
|
+
}
|
|
156
|
+
return JsDetectionResult.__wrap(r0);
|
|
157
|
+
} finally {
|
|
158
|
+
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
148
159
|
}
|
|
149
|
-
return JsDetectionResult.__wrap(ret[0]);
|
|
150
160
|
}
|
|
151
161
|
|
|
152
162
|
/**
|
|
@@ -157,12 +167,58 @@ export function version() {
|
|
|
157
167
|
let deferred1_0;
|
|
158
168
|
let deferred1_1;
|
|
159
169
|
try {
|
|
160
|
-
const
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
170
|
+
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
|
171
|
+
wasm.get_version(retptr);
|
|
172
|
+
var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
|
|
173
|
+
var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
|
|
174
|
+
deferred1_0 = r0;
|
|
175
|
+
deferred1_1 = r1;
|
|
176
|
+
return getStringFromWasm0(r0, r1);
|
|
177
|
+
} finally {
|
|
178
|
+
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
179
|
+
wasm.__wbindgen_export(deferred1_0, deferred1_1, 1);
|
|
180
|
+
}
|
|
181
|
+
}
|
|
182
|
+
|
|
183
|
+
/**
|
|
184
|
+
* Get the version of the AgentShield library
|
|
185
|
+
* @returns {string}
|
|
186
|
+
*/
|
|
187
|
+
export function get_version() {
|
|
188
|
+
let deferred1_0;
|
|
189
|
+
let deferred1_1;
|
|
190
|
+
try {
|
|
191
|
+
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
|
192
|
+
wasm.get_version(retptr);
|
|
193
|
+
var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
|
|
194
|
+
var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
|
|
195
|
+
deferred1_0 = r0;
|
|
196
|
+
deferred1_1 = r1;
|
|
197
|
+
return getStringFromWasm0(r0, r1);
|
|
198
|
+
} finally {
|
|
199
|
+
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
200
|
+
wasm.__wbindgen_export(deferred1_0, deferred1_1, 1);
|
|
201
|
+
}
|
|
202
|
+
}
|
|
203
|
+
|
|
204
|
+
/**
|
|
205
|
+
* Get build information
|
|
206
|
+
* @returns {string}
|
|
207
|
+
*/
|
|
208
|
+
export function get_build_info() {
|
|
209
|
+
let deferred1_0;
|
|
210
|
+
let deferred1_1;
|
|
211
|
+
try {
|
|
212
|
+
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
|
213
|
+
wasm.get_build_info(retptr);
|
|
214
|
+
var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
|
|
215
|
+
var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
|
|
216
|
+
deferred1_0 = r0;
|
|
217
|
+
deferred1_1 = r1;
|
|
218
|
+
return getStringFromWasm0(r0, r1);
|
|
164
219
|
} finally {
|
|
165
|
-
wasm.
|
|
220
|
+
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
221
|
+
wasm.__wbindgen_export(deferred1_0, deferred1_1, 1);
|
|
166
222
|
}
|
|
167
223
|
}
|
|
168
224
|
|
|
@@ -174,10 +230,6 @@ const JsDetectionResultFinalization = (typeof FinalizationRegistry === 'undefine
|
|
|
174
230
|
*/
|
|
175
231
|
export class JsDetectionResult {
|
|
176
232
|
|
|
177
|
-
constructor() {
|
|
178
|
-
throw new Error('cannot invoke `new` directly');
|
|
179
|
-
}
|
|
180
|
-
|
|
181
233
|
static __wrap(ptr) {
|
|
182
234
|
ptr = ptr >>> 0;
|
|
183
235
|
const obj = Object.create(JsDetectionResult.prototype);
|
|
@@ -202,8 +254,6 @@ export class JsDetectionResult {
|
|
|
202
254
|
* @returns {boolean}
|
|
203
255
|
*/
|
|
204
256
|
get is_agent() {
|
|
205
|
-
if (this.__wbg_ptr == 0) throw new Error('Attempt to use a moved value');
|
|
206
|
-
_assertNum(this.__wbg_ptr);
|
|
207
257
|
const ret = wasm.__wbg_get_jsdetectionresult_is_agent(this.__wbg_ptr);
|
|
208
258
|
return ret !== 0;
|
|
209
259
|
}
|
|
@@ -212,28 +262,21 @@ export class JsDetectionResult {
|
|
|
212
262
|
* @param {boolean} arg0
|
|
213
263
|
*/
|
|
214
264
|
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
265
|
wasm.__wbg_set_jsdetectionresult_is_agent(this.__wbg_ptr, arg0);
|
|
219
266
|
}
|
|
220
267
|
/**
|
|
221
|
-
* Confidence score (0
|
|
268
|
+
* Confidence score (0-100 scale)
|
|
222
269
|
* @returns {number}
|
|
223
270
|
*/
|
|
224
271
|
get confidence() {
|
|
225
|
-
if (this.__wbg_ptr == 0) throw new Error('Attempt to use a moved value');
|
|
226
|
-
_assertNum(this.__wbg_ptr);
|
|
227
272
|
const ret = wasm.__wbg_get_jsdetectionresult_confidence(this.__wbg_ptr);
|
|
228
273
|
return ret;
|
|
229
274
|
}
|
|
230
275
|
/**
|
|
231
|
-
* Confidence score (0
|
|
276
|
+
* Confidence score (0-100 scale)
|
|
232
277
|
* @param {number} arg0
|
|
233
278
|
*/
|
|
234
279
|
set confidence(arg0) {
|
|
235
|
-
if (this.__wbg_ptr == 0) throw new Error('Attempt to use a moved value');
|
|
236
|
-
_assertNum(this.__wbg_ptr);
|
|
237
280
|
wasm.__wbg_set_jsdetectionresult_confidence(this.__wbg_ptr, arg0);
|
|
238
281
|
}
|
|
239
282
|
/**
|
|
@@ -241,15 +284,20 @@ export class JsDetectionResult {
|
|
|
241
284
|
* @returns {string | undefined}
|
|
242
285
|
*/
|
|
243
286
|
get agent() {
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
v1
|
|
250
|
-
|
|
287
|
+
try {
|
|
288
|
+
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
|
289
|
+
wasm.jsdetectionresult_agent(retptr, this.__wbg_ptr);
|
|
290
|
+
var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
|
|
291
|
+
var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
|
|
292
|
+
let v1;
|
|
293
|
+
if (r0 !== 0) {
|
|
294
|
+
v1 = getStringFromWasm0(r0, r1).slice();
|
|
295
|
+
wasm.__wbindgen_export(r0, r1 * 1, 1);
|
|
296
|
+
}
|
|
297
|
+
return v1;
|
|
298
|
+
} finally {
|
|
299
|
+
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
251
300
|
}
|
|
252
|
-
return v1;
|
|
253
301
|
}
|
|
254
302
|
/**
|
|
255
303
|
* Get the verification method as a string
|
|
@@ -259,14 +307,16 @@ export class JsDetectionResult {
|
|
|
259
307
|
let deferred1_0;
|
|
260
308
|
let deferred1_1;
|
|
261
309
|
try {
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
310
|
+
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
|
311
|
+
wasm.jsdetectionresult_verification_method(retptr, this.__wbg_ptr);
|
|
312
|
+
var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
|
|
313
|
+
var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
|
|
314
|
+
deferred1_0 = r0;
|
|
315
|
+
deferred1_1 = r1;
|
|
316
|
+
return getStringFromWasm0(r0, r1);
|
|
268
317
|
} finally {
|
|
269
|
-
wasm.
|
|
318
|
+
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
319
|
+
wasm.__wbindgen_export(deferred1_0, deferred1_1, 1);
|
|
270
320
|
}
|
|
271
321
|
}
|
|
272
322
|
/**
|
|
@@ -277,14 +327,16 @@ export class JsDetectionResult {
|
|
|
277
327
|
let deferred1_0;
|
|
278
328
|
let deferred1_1;
|
|
279
329
|
try {
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
330
|
+
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
|
331
|
+
wasm.jsdetectionresult_risk_level(retptr, this.__wbg_ptr);
|
|
332
|
+
var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
|
|
333
|
+
var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
|
|
334
|
+
deferred1_0 = r0;
|
|
335
|
+
deferred1_1 = r1;
|
|
336
|
+
return getStringFromWasm0(r0, r1);
|
|
286
337
|
} finally {
|
|
287
|
-
wasm.
|
|
338
|
+
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
339
|
+
wasm.__wbindgen_export(deferred1_0, deferred1_1, 1);
|
|
288
340
|
}
|
|
289
341
|
}
|
|
290
342
|
/**
|
|
@@ -295,17 +347,20 @@ export class JsDetectionResult {
|
|
|
295
347
|
let deferred1_0;
|
|
296
348
|
let deferred1_1;
|
|
297
349
|
try {
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
|
|
350
|
+
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
|
351
|
+
wasm.jsdetectionresult_timestamp(retptr, this.__wbg_ptr);
|
|
352
|
+
var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
|
|
353
|
+
var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
|
|
354
|
+
deferred1_0 = r0;
|
|
355
|
+
deferred1_1 = r1;
|
|
356
|
+
return getStringFromWasm0(r0, r1);
|
|
304
357
|
} finally {
|
|
305
|
-
wasm.
|
|
358
|
+
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
359
|
+
wasm.__wbindgen_export(deferred1_0, deferred1_1, 1);
|
|
306
360
|
}
|
|
307
361
|
}
|
|
308
362
|
}
|
|
363
|
+
if (Symbol.dispose) JsDetectionResult.prototype[Symbol.dispose] = JsDetectionResult.prototype.free;
|
|
309
364
|
|
|
310
365
|
const JsRequestMetadataFinalization = (typeof FinalizationRegistry === 'undefined')
|
|
311
366
|
? { register: () => {}, unregister: () => {} }
|
|
@@ -337,19 +392,19 @@ export class JsRequestMetadata {
|
|
|
337
392
|
* @param {string | null} [client_fingerprint]
|
|
338
393
|
*/
|
|
339
394
|
constructor(user_agent, ip_address, headers, timestamp, url, method, client_fingerprint) {
|
|
340
|
-
var ptr0 = isLikeNone(user_agent) ? 0 : passStringToWasm0(user_agent, wasm.
|
|
395
|
+
var ptr0 = isLikeNone(user_agent) ? 0 : passStringToWasm0(user_agent, wasm.__wbindgen_export2, wasm.__wbindgen_export3);
|
|
341
396
|
var len0 = WASM_VECTOR_LEN;
|
|
342
|
-
var ptr1 = isLikeNone(ip_address) ? 0 : passStringToWasm0(ip_address, wasm.
|
|
397
|
+
var ptr1 = isLikeNone(ip_address) ? 0 : passStringToWasm0(ip_address, wasm.__wbindgen_export2, wasm.__wbindgen_export3);
|
|
343
398
|
var len1 = WASM_VECTOR_LEN;
|
|
344
|
-
const ptr2 = passStringToWasm0(headers, wasm.
|
|
399
|
+
const ptr2 = passStringToWasm0(headers, wasm.__wbindgen_export2, wasm.__wbindgen_export3);
|
|
345
400
|
const len2 = WASM_VECTOR_LEN;
|
|
346
|
-
const ptr3 = passStringToWasm0(timestamp, wasm.
|
|
401
|
+
const ptr3 = passStringToWasm0(timestamp, wasm.__wbindgen_export2, wasm.__wbindgen_export3);
|
|
347
402
|
const len3 = WASM_VECTOR_LEN;
|
|
348
|
-
var ptr4 = isLikeNone(url) ? 0 : passStringToWasm0(url, wasm.
|
|
403
|
+
var ptr4 = isLikeNone(url) ? 0 : passStringToWasm0(url, wasm.__wbindgen_export2, wasm.__wbindgen_export3);
|
|
349
404
|
var len4 = WASM_VECTOR_LEN;
|
|
350
|
-
var ptr5 = isLikeNone(method) ? 0 : passStringToWasm0(method, wasm.
|
|
405
|
+
var ptr5 = isLikeNone(method) ? 0 : passStringToWasm0(method, wasm.__wbindgen_export2, wasm.__wbindgen_export3);
|
|
351
406
|
var len5 = WASM_VECTOR_LEN;
|
|
352
|
-
var ptr6 = isLikeNone(client_fingerprint) ? 0 : passStringToWasm0(client_fingerprint, wasm.
|
|
407
|
+
var ptr6 = isLikeNone(client_fingerprint) ? 0 : passStringToWasm0(client_fingerprint, wasm.__wbindgen_export2, wasm.__wbindgen_export3);
|
|
353
408
|
var len6 = WASM_VECTOR_LEN;
|
|
354
409
|
const ret = wasm.jsrequestmetadata_new(ptr0, len0, ptr1, len1, ptr2, len2, ptr3, len3, ptr4, len4, ptr5, len5, ptr6, len6);
|
|
355
410
|
this.__wbg_ptr = ret >>> 0;
|
|
@@ -361,30 +416,40 @@ export class JsRequestMetadata {
|
|
|
361
416
|
* @returns {string | undefined}
|
|
362
417
|
*/
|
|
363
418
|
get user_agent() {
|
|
364
|
-
|
|
365
|
-
|
|
366
|
-
|
|
367
|
-
|
|
368
|
-
|
|
369
|
-
v1
|
|
370
|
-
|
|
419
|
+
try {
|
|
420
|
+
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
|
421
|
+
wasm.jsrequestmetadata_user_agent(retptr, this.__wbg_ptr);
|
|
422
|
+
var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
|
|
423
|
+
var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
|
|
424
|
+
let v1;
|
|
425
|
+
if (r0 !== 0) {
|
|
426
|
+
v1 = getStringFromWasm0(r0, r1).slice();
|
|
427
|
+
wasm.__wbindgen_export(r0, r1 * 1, 1);
|
|
428
|
+
}
|
|
429
|
+
return v1;
|
|
430
|
+
} finally {
|
|
431
|
+
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
371
432
|
}
|
|
372
|
-
return v1;
|
|
373
433
|
}
|
|
374
434
|
/**
|
|
375
435
|
* Get the IP address
|
|
376
436
|
* @returns {string | undefined}
|
|
377
437
|
*/
|
|
378
438
|
get ip_address() {
|
|
379
|
-
|
|
380
|
-
|
|
381
|
-
|
|
382
|
-
|
|
383
|
-
|
|
384
|
-
v1
|
|
385
|
-
|
|
439
|
+
try {
|
|
440
|
+
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
|
441
|
+
wasm.jsrequestmetadata_ip_address(retptr, this.__wbg_ptr);
|
|
442
|
+
var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
|
|
443
|
+
var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
|
|
444
|
+
let v1;
|
|
445
|
+
if (r0 !== 0) {
|
|
446
|
+
v1 = getStringFromWasm0(r0, r1).slice();
|
|
447
|
+
wasm.__wbindgen_export(r0, r1 * 1, 1);
|
|
448
|
+
}
|
|
449
|
+
return v1;
|
|
450
|
+
} finally {
|
|
451
|
+
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
386
452
|
}
|
|
387
|
-
return v1;
|
|
388
453
|
}
|
|
389
454
|
/**
|
|
390
455
|
* Get the headers as JSON string
|
|
@@ -394,14 +459,16 @@ export class JsRequestMetadata {
|
|
|
394
459
|
let deferred1_0;
|
|
395
460
|
let deferred1_1;
|
|
396
461
|
try {
|
|
397
|
-
|
|
398
|
-
|
|
399
|
-
|
|
400
|
-
|
|
401
|
-
|
|
402
|
-
|
|
462
|
+
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
|
463
|
+
wasm.jsrequestmetadata_headers(retptr, this.__wbg_ptr);
|
|
464
|
+
var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
|
|
465
|
+
var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
|
|
466
|
+
deferred1_0 = r0;
|
|
467
|
+
deferred1_1 = r1;
|
|
468
|
+
return getStringFromWasm0(r0, r1);
|
|
403
469
|
} finally {
|
|
404
|
-
wasm.
|
|
470
|
+
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
471
|
+
wasm.__wbindgen_export(deferred1_0, deferred1_1, 1);
|
|
405
472
|
}
|
|
406
473
|
}
|
|
407
474
|
/**
|
|
@@ -412,14 +479,16 @@ export class JsRequestMetadata {
|
|
|
412
479
|
let deferred1_0;
|
|
413
480
|
let deferred1_1;
|
|
414
481
|
try {
|
|
415
|
-
|
|
416
|
-
|
|
417
|
-
|
|
418
|
-
|
|
419
|
-
|
|
420
|
-
|
|
482
|
+
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
|
483
|
+
wasm.jsrequestmetadata_timestamp(retptr, this.__wbg_ptr);
|
|
484
|
+
var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
|
|
485
|
+
var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
|
|
486
|
+
deferred1_0 = r0;
|
|
487
|
+
deferred1_1 = r1;
|
|
488
|
+
return getStringFromWasm0(r0, r1);
|
|
421
489
|
} finally {
|
|
422
|
-
wasm.
|
|
490
|
+
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
491
|
+
wasm.__wbindgen_export(deferred1_0, deferred1_1, 1);
|
|
423
492
|
}
|
|
424
493
|
}
|
|
425
494
|
/**
|
|
@@ -427,47 +496,65 @@ export class JsRequestMetadata {
|
|
|
427
496
|
* @returns {string | undefined}
|
|
428
497
|
*/
|
|
429
498
|
get url() {
|
|
430
|
-
|
|
431
|
-
|
|
432
|
-
|
|
433
|
-
|
|
434
|
-
|
|
435
|
-
v1
|
|
436
|
-
|
|
499
|
+
try {
|
|
500
|
+
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
|
501
|
+
wasm.jsrequestmetadata_url(retptr, this.__wbg_ptr);
|
|
502
|
+
var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
|
|
503
|
+
var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
|
|
504
|
+
let v1;
|
|
505
|
+
if (r0 !== 0) {
|
|
506
|
+
v1 = getStringFromWasm0(r0, r1).slice();
|
|
507
|
+
wasm.__wbindgen_export(r0, r1 * 1, 1);
|
|
508
|
+
}
|
|
509
|
+
return v1;
|
|
510
|
+
} finally {
|
|
511
|
+
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
437
512
|
}
|
|
438
|
-
return v1;
|
|
439
513
|
}
|
|
440
514
|
/**
|
|
441
515
|
* Get the method
|
|
442
516
|
* @returns {string | undefined}
|
|
443
517
|
*/
|
|
444
518
|
get method() {
|
|
445
|
-
|
|
446
|
-
|
|
447
|
-
|
|
448
|
-
|
|
449
|
-
|
|
450
|
-
v1
|
|
451
|
-
|
|
519
|
+
try {
|
|
520
|
+
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
|
521
|
+
wasm.jsrequestmetadata_method(retptr, this.__wbg_ptr);
|
|
522
|
+
var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
|
|
523
|
+
var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
|
|
524
|
+
let v1;
|
|
525
|
+
if (r0 !== 0) {
|
|
526
|
+
v1 = getStringFromWasm0(r0, r1).slice();
|
|
527
|
+
wasm.__wbindgen_export(r0, r1 * 1, 1);
|
|
528
|
+
}
|
|
529
|
+
return v1;
|
|
530
|
+
} finally {
|
|
531
|
+
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
452
532
|
}
|
|
453
|
-
return v1;
|
|
454
533
|
}
|
|
455
534
|
/**
|
|
456
535
|
* Get the client fingerprint
|
|
457
536
|
* @returns {string | undefined}
|
|
458
537
|
*/
|
|
459
538
|
get client_fingerprint() {
|
|
460
|
-
|
|
461
|
-
|
|
462
|
-
|
|
463
|
-
|
|
464
|
-
|
|
465
|
-
v1
|
|
466
|
-
|
|
539
|
+
try {
|
|
540
|
+
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
|
541
|
+
wasm.jsrequestmetadata_client_fingerprint(retptr, this.__wbg_ptr);
|
|
542
|
+
var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
|
|
543
|
+
var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
|
|
544
|
+
let v1;
|
|
545
|
+
if (r0 !== 0) {
|
|
546
|
+
v1 = getStringFromWasm0(r0, r1).slice();
|
|
547
|
+
wasm.__wbindgen_export(r0, r1 * 1, 1);
|
|
548
|
+
}
|
|
549
|
+
return v1;
|
|
550
|
+
} finally {
|
|
551
|
+
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
467
552
|
}
|
|
468
|
-
return v1;
|
|
469
553
|
}
|
|
470
554
|
}
|
|
555
|
+
if (Symbol.dispose) JsRequestMetadata.prototype[Symbol.dispose] = JsRequestMetadata.prototype.free;
|
|
556
|
+
|
|
557
|
+
const EXPECTED_RESPONSE_TYPES = new Set(['basic', 'cors', 'default']);
|
|
471
558
|
|
|
472
559
|
async function __wbg_load(module, imports) {
|
|
473
560
|
if (typeof Response === 'function' && module instanceof Response) {
|
|
@@ -476,7 +563,9 @@ async function __wbg_load(module, imports) {
|
|
|
476
563
|
return await WebAssembly.instantiateStreaming(module, imports);
|
|
477
564
|
|
|
478
565
|
} catch (e) {
|
|
479
|
-
|
|
566
|
+
const validResponse = module.ok && EXPECTED_RESPONSE_TYPES.has(module.type);
|
|
567
|
+
|
|
568
|
+
if (validResponse && module.headers.get('Content-Type') !== 'application/wasm') {
|
|
480
569
|
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
570
|
|
|
482
571
|
} else {
|
|
@@ -503,7 +592,10 @@ async function __wbg_load(module, imports) {
|
|
|
503
592
|
function __wbg_get_imports() {
|
|
504
593
|
const imports = {};
|
|
505
594
|
imports.wbg = {};
|
|
506
|
-
imports.wbg.
|
|
595
|
+
imports.wbg.__wbg___wbindgen_throw_b855445ff6a94295 = function(arg0, arg1) {
|
|
596
|
+
throw new Error(getStringFromWasm0(arg0, arg1));
|
|
597
|
+
};
|
|
598
|
+
imports.wbg.__wbg_error_7534b8e9a36f1ab4 = function(arg0, arg1) {
|
|
507
599
|
let deferred0_0;
|
|
508
600
|
let deferred0_1;
|
|
509
601
|
try {
|
|
@@ -511,60 +603,47 @@ function __wbg_get_imports() {
|
|
|
511
603
|
deferred0_1 = arg1;
|
|
512
604
|
console.error(getStringFromWasm0(arg0, arg1));
|
|
513
605
|
} finally {
|
|
514
|
-
wasm.
|
|
606
|
+
wasm.__wbindgen_export(deferred0_0, deferred0_1, 1);
|
|
515
607
|
}
|
|
516
|
-
}
|
|
517
|
-
imports.wbg.
|
|
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);
|
|
608
|
+
};
|
|
609
|
+
imports.wbg.__wbg_getTime_14776bfb48a1bff9 = function(arg0) {
|
|
610
|
+
const ret = getObject(arg0).getTime();
|
|
526
611
|
return ret;
|
|
527
|
-
}
|
|
528
|
-
imports.wbg.
|
|
612
|
+
};
|
|
613
|
+
imports.wbg.__wbg_log_8cec76766b8c0e33 = function(arg0) {
|
|
614
|
+
console.log(getObject(arg0));
|
|
615
|
+
};
|
|
616
|
+
imports.wbg.__wbg_new_8a6f238a6ece86ea = function() {
|
|
529
617
|
const ret = new Error();
|
|
530
|
-
return ret;
|
|
531
|
-
}
|
|
532
|
-
imports.wbg.
|
|
618
|
+
return addHeapObject(ret);
|
|
619
|
+
};
|
|
620
|
+
imports.wbg.__wbg_new_93d9417ed3fb115d = function(arg0) {
|
|
621
|
+
const ret = new Date(getObject(arg0));
|
|
622
|
+
return addHeapObject(ret);
|
|
623
|
+
};
|
|
624
|
+
imports.wbg.__wbg_now_793306c526e2e3b6 = function() {
|
|
533
625
|
const ret = Date.now();
|
|
534
626
|
return ret;
|
|
535
|
-
}
|
|
536
|
-
imports.wbg.__wbg_stack_0ed75d68575b0f3c = function(
|
|
537
|
-
const ret = arg1.stack;
|
|
538
|
-
const ptr1 = passStringToWasm0(ret, wasm.
|
|
627
|
+
};
|
|
628
|
+
imports.wbg.__wbg_stack_0ed75d68575b0f3c = function(arg0, arg1) {
|
|
629
|
+
const ret = getObject(arg1).stack;
|
|
630
|
+
const ptr1 = passStringToWasm0(ret, wasm.__wbindgen_export2, wasm.__wbindgen_export3);
|
|
539
631
|
const len1 = WASM_VECTOR_LEN;
|
|
540
632
|
getDataViewMemory0().setInt32(arg0 + 4 * 1, len1, true);
|
|
541
633
|
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
634
|
};
|
|
553
|
-
imports.wbg.
|
|
635
|
+
imports.wbg.__wbindgen_cast_2241b6af4c4b2941 = function(arg0, arg1) {
|
|
636
|
+
// Cast intrinsic for `Ref(String) -> Externref`.
|
|
554
637
|
const ret = getStringFromWasm0(arg0, arg1);
|
|
555
|
-
return ret;
|
|
638
|
+
return addHeapObject(ret);
|
|
556
639
|
};
|
|
557
|
-
imports.wbg.
|
|
558
|
-
|
|
640
|
+
imports.wbg.__wbindgen_object_drop_ref = function(arg0) {
|
|
641
|
+
takeObject(arg0);
|
|
559
642
|
};
|
|
560
643
|
|
|
561
644
|
return imports;
|
|
562
645
|
}
|
|
563
646
|
|
|
564
|
-
function __wbg_init_memory(imports, memory) {
|
|
565
|
-
|
|
566
|
-
}
|
|
567
|
-
|
|
568
647
|
function __wbg_finalize_init(instance, module) {
|
|
569
648
|
wasm = instance.exports;
|
|
570
649
|
__wbg_init.__wbindgen_wasm_module = module;
|
|
@@ -590,8 +669,6 @@ function initSync(module) {
|
|
|
590
669
|
|
|
591
670
|
const imports = __wbg_get_imports();
|
|
592
671
|
|
|
593
|
-
__wbg_init_memory(imports);
|
|
594
|
-
|
|
595
672
|
if (!(module instanceof WebAssembly.Module)) {
|
|
596
673
|
module = new WebAssembly.Module(module);
|
|
597
674
|
}
|
|
@@ -622,8 +699,6 @@ async function __wbg_init(module_or_path) {
|
|
|
622
699
|
module_or_path = fetch(module_or_path);
|
|
623
700
|
}
|
|
624
701
|
|
|
625
|
-
__wbg_init_memory(imports);
|
|
626
|
-
|
|
627
702
|
const { instance, module } = await __wbg_load(await module_or_path, imports);
|
|
628
703
|
|
|
629
704
|
return __wbg_finalize_init(instance, module);
|
|
Binary file
|