@uruhalushia/rule-converter-wasm 0.1.3 → 0.3.0
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/README.md +76 -10
- package/package.json +1 -1
- package/rule_converter_wasm.d.ts +26 -2
- package/rule_converter_wasm.js +1 -1
- package/rule_converter_wasm_bg.js +389 -4
- package/rule_converter_wasm_bg.wasm +0 -0
package/README.md
CHANGED
|
@@ -33,12 +33,12 @@ Create an HTML file outside `pkg`, then import the generated module by relative
|
|
|
33
33
|
<meta charset="utf-8" />
|
|
34
34
|
<button id="convert">convert</button>
|
|
35
35
|
<script type="module">
|
|
36
|
-
import init, {
|
|
36
|
+
import init, { strToBuf } from './wasm/pkg/rule_converter_wasm.js'
|
|
37
37
|
|
|
38
38
|
await init()
|
|
39
39
|
|
|
40
40
|
document.querySelector('#convert').addEventListener('click', () => {
|
|
41
|
-
const result =
|
|
41
|
+
const result = strToBuf(
|
|
42
42
|
`payload:\n - DOMAIN,example.com\n - DOMAIN-SUFFIX,example.net\n`,
|
|
43
43
|
{
|
|
44
44
|
inputTarget: 'mihomo',
|
|
@@ -50,8 +50,8 @@ Create an HTML file outside `pkg`, then import the generated module by relative
|
|
|
50
50
|
},
|
|
51
51
|
)
|
|
52
52
|
|
|
53
|
-
const
|
|
54
|
-
console.log(
|
|
53
|
+
const bytes = result.outputs.domain
|
|
54
|
+
console.log(result.info.domain.behavior, result.info.domain.format, result.info.domain.count, bytes)
|
|
55
55
|
})
|
|
56
56
|
</script>
|
|
57
57
|
```
|
|
@@ -80,11 +80,11 @@ pnpm add file:/home/atri/git/xishang/rule-converter/wasm/pkg
|
|
|
80
80
|
Use it from app code:
|
|
81
81
|
|
|
82
82
|
```js
|
|
83
|
-
import init, {
|
|
83
|
+
import init, { strToBuf } from '@uruhalushia/rule-converter-wasm'
|
|
84
84
|
|
|
85
85
|
await init()
|
|
86
86
|
|
|
87
|
-
const result =
|
|
87
|
+
const result = strToBuf(
|
|
88
88
|
`payload:\n - DOMAIN,example.com\n - DOMAIN-SUFFIX,example.net\n`,
|
|
89
89
|
{
|
|
90
90
|
inputTarget: 'mihomo',
|
|
@@ -96,19 +96,85 @@ const result = convertPayloadString(
|
|
|
96
96
|
},
|
|
97
97
|
)
|
|
98
98
|
|
|
99
|
-
for (const
|
|
100
|
-
console.log(
|
|
99
|
+
for (const [name, bytes] of Object.entries(result.outputs)) {
|
|
100
|
+
console.log(name, result.info[name].behavior, result.info[name].format, result.info[name].count, bytes)
|
|
101
101
|
}
|
|
102
102
|
```
|
|
103
103
|
|
|
104
104
|
The returned `bytes` value is a `Uint8Array`, so it can be downloaded, uploaded, or stored in IndexedDB directly.
|
|
105
105
|
|
|
106
|
+
MMDB list APIs also accept uploaded file bytes:
|
|
107
|
+
|
|
108
|
+
```js
|
|
109
|
+
import init, { listAsnNumbers, listGeoipCountries, listGeoipDatCountries, listGeositeCodes } from '@uruhalushia/rule-converter-wasm'
|
|
110
|
+
|
|
111
|
+
await init()
|
|
112
|
+
|
|
113
|
+
const bytes = new Uint8Array(await file.arrayBuffer())
|
|
114
|
+
console.log(listGeoipCountries(bytes))
|
|
115
|
+
console.log(listAsnNumbers(bytes))
|
|
116
|
+
console.log(listGeoipDatCountries(geoipDatBytes))
|
|
117
|
+
console.log(listGeositeCodes(geositeDatBytes))
|
|
118
|
+
```
|
|
119
|
+
|
|
120
|
+
DB conversions use the same `bufToBuf` / `bufToStr` functions. For example:
|
|
121
|
+
|
|
122
|
+
```js
|
|
123
|
+
const db = new Uint8Array(await mmdbFile.arrayBuffer())
|
|
124
|
+
const cn = bufToStr(db, {
|
|
125
|
+
inputTarget: 'geoip',
|
|
126
|
+
inputFormat: 'mmdb',
|
|
127
|
+
outputTarget: 'general',
|
|
128
|
+
outputFormat: 'ipset',
|
|
129
|
+
countries: ['cn'],
|
|
130
|
+
split: false,
|
|
131
|
+
})
|
|
132
|
+
const dat = bufToBuf(db, {
|
|
133
|
+
inputTarget: 'geoip',
|
|
134
|
+
inputFormat: 'mmdb',
|
|
135
|
+
outputTarget: 'geoip',
|
|
136
|
+
outputFormat: 'dat',
|
|
137
|
+
})
|
|
138
|
+
const geositeRules = bufToStr(geositeDatBytes, {
|
|
139
|
+
inputTarget: 'geosite',
|
|
140
|
+
inputFormat: 'dat',
|
|
141
|
+
outputTarget: 'general',
|
|
142
|
+
outputFormat: 'ruleset',
|
|
143
|
+
codes: ['cn'],
|
|
144
|
+
split: false,
|
|
145
|
+
})
|
|
146
|
+
```
|
|
147
|
+
|
|
148
|
+
Use `detectBuf` / `detectStr` to inspect uploaded input without converting it:
|
|
149
|
+
|
|
150
|
+
```js
|
|
151
|
+
import init, { detectBuf } from '@uruhalushia/rule-converter-wasm'
|
|
152
|
+
|
|
153
|
+
await init()
|
|
154
|
+
console.log(detectBuf(new Uint8Array(await file.arrayBuffer())))
|
|
155
|
+
```
|
|
156
|
+
|
|
157
|
+
|
|
158
|
+
Rule matching uses the same input options as conversion. Mihomo config input is supported when providers use local `path`/`file://` references supplied by the host application; browser HTTP provider downloads should be handled by the caller before matching:
|
|
159
|
+
|
|
160
|
+
```js
|
|
161
|
+
import init, { matchStr } from '@uruhalushia/rule-converter-wasm'
|
|
162
|
+
|
|
163
|
+
await init()
|
|
164
|
+
const result = matchStr('DOMAIN-SUFFIX,example.com\n', 'ads.example.com', {
|
|
165
|
+
inputTarget: 'general',
|
|
166
|
+
inputFormat: 'text',
|
|
167
|
+
inputBehavior: 'classical',
|
|
168
|
+
})
|
|
169
|
+
console.log(result.matched, result.rules)
|
|
170
|
+
```
|
|
171
|
+
|
|
106
172
|
Options use the same names as the N-API package:
|
|
107
173
|
|
|
108
174
|
```ts
|
|
109
175
|
type RuleTarget = 'mihomo' | 'general' | 'egern' | 'sing-box'
|
|
110
|
-
type InputFormat = 'yaml' | 'mrs' | 'text' | 'json' | 'srs'
|
|
111
|
-
type OutputFormat = 'mrs' | 'text' | 'yaml' | 'json' | 'srs' | 'domainset' | 'ruleset' | 'ipset'
|
|
176
|
+
type InputFormat = 'yaml' | 'mrs' | 'text' | 'json' | 'srs' | 'domainset' | 'ruleset' | 'ipset' | 'mmdb' | 'sing-db' | 'metadb' | 'dat' | 'sing-geosite'
|
|
177
|
+
type OutputFormat = 'mrs' | 'text' | 'yaml' | 'json' | 'srs' | 'domainset' | 'ruleset' | 'ipset' | 'mmdb' | 'sing-db' | 'metadb' | 'dat' | 'sing-geosite'
|
|
112
178
|
type InputBehavior = 'auto' | 'domain' | 'ip' | 'classical'
|
|
113
179
|
type OutputBehavior = 'domain' | 'ip' | 'classical'
|
|
114
180
|
```
|
package/package.json
CHANGED
package/rule_converter_wasm.d.ts
CHANGED
|
@@ -1,6 +1,30 @@
|
|
|
1
1
|
/* tslint:disable */
|
|
2
2
|
/* eslint-disable */
|
|
3
3
|
|
|
4
|
-
export function
|
|
4
|
+
export function bufToBuf(payload: Uint8Array, options: any): any;
|
|
5
5
|
|
|
6
|
-
export function
|
|
6
|
+
export function bufToStr(payload: Uint8Array, options: any): any;
|
|
7
|
+
|
|
8
|
+
export function buildDb(options: any): any;
|
|
9
|
+
|
|
10
|
+
export function detectBuf(input: Uint8Array): any;
|
|
11
|
+
|
|
12
|
+
export function detectStr(input: string): any;
|
|
13
|
+
|
|
14
|
+
export function listAsnNumbers(payload: Uint8Array): any;
|
|
15
|
+
|
|
16
|
+
export function listGeoipCountries(payload: Uint8Array): any;
|
|
17
|
+
|
|
18
|
+
export function listGeoipDatCountries(payload: Uint8Array): any;
|
|
19
|
+
|
|
20
|
+
export function listGeositeCodes(payload: Uint8Array): any;
|
|
21
|
+
|
|
22
|
+
export function listIndexes(payload: Uint8Array): any;
|
|
23
|
+
|
|
24
|
+
export function matchBuf(payload: Uint8Array, query: string, options: any): any;
|
|
25
|
+
|
|
26
|
+
export function matchStr(payload: string, query: string, options: any): any;
|
|
27
|
+
|
|
28
|
+
export function strToBuf(payload: string, options: any): any;
|
|
29
|
+
|
|
30
|
+
export function strToStr(payload: string, options: any): any;
|
package/rule_converter_wasm.js
CHANGED
|
@@ -5,5 +5,5 @@ import { __wbg_set_wasm } from "./rule_converter_wasm_bg.js";
|
|
|
5
5
|
__wbg_set_wasm(wasm);
|
|
6
6
|
|
|
7
7
|
export {
|
|
8
|
-
|
|
8
|
+
bufToBuf, bufToStr, buildDb, detectBuf, detectStr, listAsnNumbers, listGeoipCountries, listGeoipDatCountries, listGeositeCodes, listIndexes, matchBuf, matchStr, strToBuf, strToStr
|
|
9
9
|
} from "./rule_converter_wasm_bg.js";
|
|
@@ -3,12 +3,261 @@
|
|
|
3
3
|
* @param {any} options
|
|
4
4
|
* @returns {any}
|
|
5
5
|
*/
|
|
6
|
-
export function
|
|
6
|
+
export function bufToBuf(payload, options) {
|
|
7
7
|
try {
|
|
8
8
|
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
|
9
9
|
const ptr0 = passArray8ToWasm0(payload, wasm.__wbindgen_export);
|
|
10
10
|
const len0 = WASM_VECTOR_LEN;
|
|
11
|
-
wasm.
|
|
11
|
+
wasm.bufToBuf(retptr, ptr0, len0, addHeapObject(options));
|
|
12
|
+
var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
|
|
13
|
+
var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
|
|
14
|
+
var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
|
|
15
|
+
if (r2) {
|
|
16
|
+
throw takeObject(r1);
|
|
17
|
+
}
|
|
18
|
+
return takeObject(r0);
|
|
19
|
+
} finally {
|
|
20
|
+
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
21
|
+
}
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
/**
|
|
25
|
+
* @param {Uint8Array} payload
|
|
26
|
+
* @param {any} options
|
|
27
|
+
* @returns {any}
|
|
28
|
+
*/
|
|
29
|
+
export function bufToStr(payload, options) {
|
|
30
|
+
try {
|
|
31
|
+
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
|
32
|
+
const ptr0 = passArray8ToWasm0(payload, wasm.__wbindgen_export);
|
|
33
|
+
const len0 = WASM_VECTOR_LEN;
|
|
34
|
+
wasm.bufToStr(retptr, ptr0, len0, addHeapObject(options));
|
|
35
|
+
var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
|
|
36
|
+
var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
|
|
37
|
+
var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
|
|
38
|
+
if (r2) {
|
|
39
|
+
throw takeObject(r1);
|
|
40
|
+
}
|
|
41
|
+
return takeObject(r0);
|
|
42
|
+
} finally {
|
|
43
|
+
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
44
|
+
}
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
/**
|
|
48
|
+
* @param {any} options
|
|
49
|
+
* @returns {any}
|
|
50
|
+
*/
|
|
51
|
+
export function buildDb(options) {
|
|
52
|
+
try {
|
|
53
|
+
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
|
54
|
+
wasm.buildDb(retptr, addHeapObject(options));
|
|
55
|
+
var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
|
|
56
|
+
var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
|
|
57
|
+
var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
|
|
58
|
+
if (r2) {
|
|
59
|
+
throw takeObject(r1);
|
|
60
|
+
}
|
|
61
|
+
return takeObject(r0);
|
|
62
|
+
} finally {
|
|
63
|
+
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
64
|
+
}
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
/**
|
|
68
|
+
* @param {Uint8Array} input
|
|
69
|
+
* @returns {any}
|
|
70
|
+
*/
|
|
71
|
+
export function detectBuf(input) {
|
|
72
|
+
try {
|
|
73
|
+
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
|
74
|
+
const ptr0 = passArray8ToWasm0(input, wasm.__wbindgen_export);
|
|
75
|
+
const len0 = WASM_VECTOR_LEN;
|
|
76
|
+
wasm.detectBuf(retptr, ptr0, len0);
|
|
77
|
+
var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
|
|
78
|
+
var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
|
|
79
|
+
var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
|
|
80
|
+
if (r2) {
|
|
81
|
+
throw takeObject(r1);
|
|
82
|
+
}
|
|
83
|
+
return takeObject(r0);
|
|
84
|
+
} finally {
|
|
85
|
+
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
86
|
+
}
|
|
87
|
+
}
|
|
88
|
+
|
|
89
|
+
/**
|
|
90
|
+
* @param {string} input
|
|
91
|
+
* @returns {any}
|
|
92
|
+
*/
|
|
93
|
+
export function detectStr(input) {
|
|
94
|
+
try {
|
|
95
|
+
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
|
96
|
+
const ptr0 = passStringToWasm0(input, wasm.__wbindgen_export, wasm.__wbindgen_export2);
|
|
97
|
+
const len0 = WASM_VECTOR_LEN;
|
|
98
|
+
wasm.detectStr(retptr, ptr0, len0);
|
|
99
|
+
var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
|
|
100
|
+
var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
|
|
101
|
+
var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
|
|
102
|
+
if (r2) {
|
|
103
|
+
throw takeObject(r1);
|
|
104
|
+
}
|
|
105
|
+
return takeObject(r0);
|
|
106
|
+
} finally {
|
|
107
|
+
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
108
|
+
}
|
|
109
|
+
}
|
|
110
|
+
|
|
111
|
+
/**
|
|
112
|
+
* @param {Uint8Array} payload
|
|
113
|
+
* @returns {any}
|
|
114
|
+
*/
|
|
115
|
+
export function listAsnNumbers(payload) {
|
|
116
|
+
try {
|
|
117
|
+
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
|
118
|
+
const ptr0 = passArray8ToWasm0(payload, wasm.__wbindgen_export);
|
|
119
|
+
const len0 = WASM_VECTOR_LEN;
|
|
120
|
+
wasm.listAsnNumbers(retptr, ptr0, len0);
|
|
121
|
+
var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
|
|
122
|
+
var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
|
|
123
|
+
var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
|
|
124
|
+
if (r2) {
|
|
125
|
+
throw takeObject(r1);
|
|
126
|
+
}
|
|
127
|
+
return takeObject(r0);
|
|
128
|
+
} finally {
|
|
129
|
+
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
130
|
+
}
|
|
131
|
+
}
|
|
132
|
+
|
|
133
|
+
/**
|
|
134
|
+
* @param {Uint8Array} payload
|
|
135
|
+
* @returns {any}
|
|
136
|
+
*/
|
|
137
|
+
export function listGeoipCountries(payload) {
|
|
138
|
+
try {
|
|
139
|
+
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
|
140
|
+
const ptr0 = passArray8ToWasm0(payload, wasm.__wbindgen_export);
|
|
141
|
+
const len0 = WASM_VECTOR_LEN;
|
|
142
|
+
wasm.listGeoipCountries(retptr, ptr0, len0);
|
|
143
|
+
var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
|
|
144
|
+
var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
|
|
145
|
+
var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
|
|
146
|
+
if (r2) {
|
|
147
|
+
throw takeObject(r1);
|
|
148
|
+
}
|
|
149
|
+
return takeObject(r0);
|
|
150
|
+
} finally {
|
|
151
|
+
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
152
|
+
}
|
|
153
|
+
}
|
|
154
|
+
|
|
155
|
+
/**
|
|
156
|
+
* @param {Uint8Array} payload
|
|
157
|
+
* @returns {any}
|
|
158
|
+
*/
|
|
159
|
+
export function listGeoipDatCountries(payload) {
|
|
160
|
+
try {
|
|
161
|
+
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
|
162
|
+
const ptr0 = passArray8ToWasm0(payload, wasm.__wbindgen_export);
|
|
163
|
+
const len0 = WASM_VECTOR_LEN;
|
|
164
|
+
wasm.listGeoipDatCountries(retptr, ptr0, len0);
|
|
165
|
+
var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
|
|
166
|
+
var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
|
|
167
|
+
var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
|
|
168
|
+
if (r2) {
|
|
169
|
+
throw takeObject(r1);
|
|
170
|
+
}
|
|
171
|
+
return takeObject(r0);
|
|
172
|
+
} finally {
|
|
173
|
+
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
174
|
+
}
|
|
175
|
+
}
|
|
176
|
+
|
|
177
|
+
/**
|
|
178
|
+
* @param {Uint8Array} payload
|
|
179
|
+
* @returns {any}
|
|
180
|
+
*/
|
|
181
|
+
export function listGeositeCodes(payload) {
|
|
182
|
+
try {
|
|
183
|
+
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
|
184
|
+
const ptr0 = passArray8ToWasm0(payload, wasm.__wbindgen_export);
|
|
185
|
+
const len0 = WASM_VECTOR_LEN;
|
|
186
|
+
wasm.listGeositeCodes(retptr, ptr0, len0);
|
|
187
|
+
var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
|
|
188
|
+
var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
|
|
189
|
+
var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
|
|
190
|
+
if (r2) {
|
|
191
|
+
throw takeObject(r1);
|
|
192
|
+
}
|
|
193
|
+
return takeObject(r0);
|
|
194
|
+
} finally {
|
|
195
|
+
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
196
|
+
}
|
|
197
|
+
}
|
|
198
|
+
|
|
199
|
+
/**
|
|
200
|
+
* @param {Uint8Array} payload
|
|
201
|
+
* @returns {any}
|
|
202
|
+
*/
|
|
203
|
+
export function listIndexes(payload) {
|
|
204
|
+
try {
|
|
205
|
+
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
|
206
|
+
const ptr0 = passArray8ToWasm0(payload, wasm.__wbindgen_export);
|
|
207
|
+
const len0 = WASM_VECTOR_LEN;
|
|
208
|
+
wasm.listIndexes(retptr, ptr0, len0);
|
|
209
|
+
var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
|
|
210
|
+
var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
|
|
211
|
+
var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
|
|
212
|
+
if (r2) {
|
|
213
|
+
throw takeObject(r1);
|
|
214
|
+
}
|
|
215
|
+
return takeObject(r0);
|
|
216
|
+
} finally {
|
|
217
|
+
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
218
|
+
}
|
|
219
|
+
}
|
|
220
|
+
|
|
221
|
+
/**
|
|
222
|
+
* @param {Uint8Array} payload
|
|
223
|
+
* @param {string} query
|
|
224
|
+
* @param {any} options
|
|
225
|
+
* @returns {any}
|
|
226
|
+
*/
|
|
227
|
+
export function matchBuf(payload, query, options) {
|
|
228
|
+
try {
|
|
229
|
+
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
|
230
|
+
const ptr0 = passArray8ToWasm0(payload, wasm.__wbindgen_export);
|
|
231
|
+
const len0 = WASM_VECTOR_LEN;
|
|
232
|
+
const ptr1 = passStringToWasm0(query, wasm.__wbindgen_export, wasm.__wbindgen_export2);
|
|
233
|
+
const len1 = WASM_VECTOR_LEN;
|
|
234
|
+
wasm.matchBuf(retptr, ptr0, len0, ptr1, len1, addHeapObject(options));
|
|
235
|
+
var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
|
|
236
|
+
var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
|
|
237
|
+
var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
|
|
238
|
+
if (r2) {
|
|
239
|
+
throw takeObject(r1);
|
|
240
|
+
}
|
|
241
|
+
return takeObject(r0);
|
|
242
|
+
} finally {
|
|
243
|
+
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
244
|
+
}
|
|
245
|
+
}
|
|
246
|
+
|
|
247
|
+
/**
|
|
248
|
+
* @param {string} payload
|
|
249
|
+
* @param {string} query
|
|
250
|
+
* @param {any} options
|
|
251
|
+
* @returns {any}
|
|
252
|
+
*/
|
|
253
|
+
export function matchStr(payload, query, options) {
|
|
254
|
+
try {
|
|
255
|
+
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
|
256
|
+
const ptr0 = passStringToWasm0(payload, wasm.__wbindgen_export, wasm.__wbindgen_export2);
|
|
257
|
+
const len0 = WASM_VECTOR_LEN;
|
|
258
|
+
const ptr1 = passStringToWasm0(query, wasm.__wbindgen_export, wasm.__wbindgen_export2);
|
|
259
|
+
const len1 = WASM_VECTOR_LEN;
|
|
260
|
+
wasm.matchStr(retptr, ptr0, len0, ptr1, len1, addHeapObject(options));
|
|
12
261
|
var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
|
|
13
262
|
var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
|
|
14
263
|
var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
|
|
@@ -26,12 +275,35 @@ export function convertPayload(payload, options) {
|
|
|
26
275
|
* @param {any} options
|
|
27
276
|
* @returns {any}
|
|
28
277
|
*/
|
|
29
|
-
export function
|
|
278
|
+
export function strToBuf(payload, options) {
|
|
30
279
|
try {
|
|
31
280
|
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
|
32
281
|
const ptr0 = passStringToWasm0(payload, wasm.__wbindgen_export, wasm.__wbindgen_export2);
|
|
33
282
|
const len0 = WASM_VECTOR_LEN;
|
|
34
|
-
wasm.
|
|
283
|
+
wasm.strToBuf(retptr, ptr0, len0, addHeapObject(options));
|
|
284
|
+
var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
|
|
285
|
+
var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
|
|
286
|
+
var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
|
|
287
|
+
if (r2) {
|
|
288
|
+
throw takeObject(r1);
|
|
289
|
+
}
|
|
290
|
+
return takeObject(r0);
|
|
291
|
+
} finally {
|
|
292
|
+
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
293
|
+
}
|
|
294
|
+
}
|
|
295
|
+
|
|
296
|
+
/**
|
|
297
|
+
* @param {string} payload
|
|
298
|
+
* @param {any} options
|
|
299
|
+
* @returns {any}
|
|
300
|
+
*/
|
|
301
|
+
export function strToStr(payload, options) {
|
|
302
|
+
try {
|
|
303
|
+
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
|
304
|
+
const ptr0 = passStringToWasm0(payload, wasm.__wbindgen_export, wasm.__wbindgen_export2);
|
|
305
|
+
const len0 = WASM_VECTOR_LEN;
|
|
306
|
+
wasm.strToStr(retptr, ptr0, len0, addHeapObject(options));
|
|
35
307
|
var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
|
|
36
308
|
var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
|
|
37
309
|
var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
|
|
@@ -47,6 +319,10 @@ export function __wbg_Error_bce6d499ff0a4aff(arg0, arg1) {
|
|
|
47
319
|
const ret = Error(getStringFromWasm0(arg0, arg1));
|
|
48
320
|
return addHeapObject(ret);
|
|
49
321
|
}
|
|
322
|
+
export function __wbg_Number_b7972a139bfbfdf0(arg0) {
|
|
323
|
+
const ret = Number(getObject(arg0));
|
|
324
|
+
return ret;
|
|
325
|
+
}
|
|
50
326
|
export function __wbg_String_8564e559799eccda(arg0, arg1) {
|
|
51
327
|
const ret = String(getObject(arg1));
|
|
52
328
|
const ptr1 = passStringToWasm0(ret, wasm.__wbindgen_export, wasm.__wbindgen_export2);
|
|
@@ -54,6 +330,12 @@ export function __wbg_String_8564e559799eccda(arg0, arg1) {
|
|
|
54
330
|
getDataViewMemory0().setInt32(arg0 + 4 * 1, len1, true);
|
|
55
331
|
getDataViewMemory0().setInt32(arg0 + 4 * 0, ptr1, true);
|
|
56
332
|
}
|
|
333
|
+
export function __wbg___wbindgen_bigint_get_as_i64_410e28c7b761ad83(arg0, arg1) {
|
|
334
|
+
const v = getObject(arg1);
|
|
335
|
+
const ret = typeof(v) === 'bigint' ? v : undefined;
|
|
336
|
+
getDataViewMemory0().setBigInt64(arg0 + 8 * 1, isLikeNone(ret) ? BigInt(0) : ret, true);
|
|
337
|
+
getDataViewMemory0().setInt32(arg0 + 4 * 0, !isLikeNone(ret), true);
|
|
338
|
+
}
|
|
57
339
|
export function __wbg___wbindgen_boolean_get_2304fb8c853028c8(arg0) {
|
|
58
340
|
const v = getObject(arg0);
|
|
59
341
|
const ret = typeof(v) === 'boolean' ? v : undefined;
|
|
@@ -70,6 +352,14 @@ export function __wbg___wbindgen_in_07056af4f902c445(arg0, arg1) {
|
|
|
70
352
|
const ret = getObject(arg0) in getObject(arg1);
|
|
71
353
|
return ret;
|
|
72
354
|
}
|
|
355
|
+
export function __wbg___wbindgen_is_bigint_aeae3893f30ed54e(arg0) {
|
|
356
|
+
const ret = typeof(getObject(arg0)) === 'bigint';
|
|
357
|
+
return ret;
|
|
358
|
+
}
|
|
359
|
+
export function __wbg___wbindgen_is_function_5cd60d5cf78b4eef(arg0) {
|
|
360
|
+
const ret = typeof(getObject(arg0)) === 'function';
|
|
361
|
+
return ret;
|
|
362
|
+
}
|
|
73
363
|
export function __wbg___wbindgen_is_null_2042690d351e14f0(arg0) {
|
|
74
364
|
const ret = getObject(arg0) === null;
|
|
75
365
|
return ret;
|
|
@@ -79,10 +369,18 @@ export function __wbg___wbindgen_is_object_b4593df85baada48(arg0) {
|
|
|
79
369
|
const ret = typeof(val) === 'object' && val !== null;
|
|
80
370
|
return ret;
|
|
81
371
|
}
|
|
372
|
+
export function __wbg___wbindgen_is_string_dde0fd9020db4434(arg0) {
|
|
373
|
+
const ret = typeof(getObject(arg0)) === 'string';
|
|
374
|
+
return ret;
|
|
375
|
+
}
|
|
82
376
|
export function __wbg___wbindgen_is_undefined_35bb9f4c7fd651d5(arg0) {
|
|
83
377
|
const ret = getObject(arg0) === undefined;
|
|
84
378
|
return ret;
|
|
85
379
|
}
|
|
380
|
+
export function __wbg___wbindgen_jsval_eq_c0ed08b3e0f393b9(arg0, arg1) {
|
|
381
|
+
const ret = getObject(arg0) === getObject(arg1);
|
|
382
|
+
return ret;
|
|
383
|
+
}
|
|
86
384
|
export function __wbg___wbindgen_jsval_loose_eq_0ad77b7717db155c(arg0, arg1) {
|
|
87
385
|
const ret = getObject(arg0) == getObject(arg1);
|
|
88
386
|
return ret;
|
|
@@ -104,6 +402,34 @@ export function __wbg___wbindgen_string_get_d109740c0d18f4d7(arg0, arg1) {
|
|
|
104
402
|
export function __wbg___wbindgen_throw_9c31b086c2b26051(arg0, arg1) {
|
|
105
403
|
throw new Error(getStringFromWasm0(arg0, arg1));
|
|
106
404
|
}
|
|
405
|
+
export function __wbg_call_13665d9f14390edc() { return handleError(function (arg0, arg1) {
|
|
406
|
+
const ret = getObject(arg0).call(getObject(arg1));
|
|
407
|
+
return addHeapObject(ret);
|
|
408
|
+
}, arguments); }
|
|
409
|
+
export function __wbg_done_54b8da57023b7ed2(arg0) {
|
|
410
|
+
const ret = getObject(arg0).done;
|
|
411
|
+
return ret;
|
|
412
|
+
}
|
|
413
|
+
export function __wbg_entries_564a7e8b1e54ede5(arg0) {
|
|
414
|
+
const ret = Object.entries(getObject(arg0));
|
|
415
|
+
return addHeapObject(ret);
|
|
416
|
+
}
|
|
417
|
+
export function __wbg_get_3e9a707ab7d352eb() { return handleError(function (arg0, arg1) {
|
|
418
|
+
const ret = Reflect.get(getObject(arg0), getObject(arg1));
|
|
419
|
+
return addHeapObject(ret);
|
|
420
|
+
}, arguments); }
|
|
421
|
+
export function __wbg_get_98fdf51d029a75eb(arg0, arg1) {
|
|
422
|
+
const ret = getObject(arg0)[arg1 >>> 0];
|
|
423
|
+
return addHeapObject(ret);
|
|
424
|
+
}
|
|
425
|
+
export function __wbg_get_dcf82ab8aad1a593() { return handleError(function (arg0, arg1) {
|
|
426
|
+
const ret = Reflect.get(getObject(arg0), getObject(arg1));
|
|
427
|
+
return addHeapObject(ret);
|
|
428
|
+
}, arguments); }
|
|
429
|
+
export function __wbg_get_unchecked_1dfe6d05ad91d9b7(arg0, arg1) {
|
|
430
|
+
const ret = getObject(arg0)[arg1 >>> 0];
|
|
431
|
+
return addHeapObject(ret);
|
|
432
|
+
}
|
|
107
433
|
export function __wbg_get_with_ref_key_6412cf3094599694(arg0, arg1) {
|
|
108
434
|
const ret = getObject(arg0)[getObject(arg1)];
|
|
109
435
|
return addHeapObject(ret);
|
|
@@ -128,6 +454,26 @@ export function __wbg_instanceof_Uint8Array_abd07d4bd221d50b(arg0) {
|
|
|
128
454
|
const ret = result;
|
|
129
455
|
return ret;
|
|
130
456
|
}
|
|
457
|
+
export function __wbg_isArray_94898ed3aad6947b(arg0) {
|
|
458
|
+
const ret = Array.isArray(getObject(arg0));
|
|
459
|
+
return ret;
|
|
460
|
+
}
|
|
461
|
+
export function __wbg_isSafeInteger_01e964d144ad3a55(arg0) {
|
|
462
|
+
const ret = Number.isSafeInteger(getObject(arg0));
|
|
463
|
+
return ret;
|
|
464
|
+
}
|
|
465
|
+
export function __wbg_iterator_1441b47f341dc34f() {
|
|
466
|
+
const ret = Symbol.iterator;
|
|
467
|
+
return addHeapObject(ret);
|
|
468
|
+
}
|
|
469
|
+
export function __wbg_keys_682010b680c9b1f8(arg0) {
|
|
470
|
+
const ret = Object.keys(getObject(arg0));
|
|
471
|
+
return addHeapObject(ret);
|
|
472
|
+
}
|
|
473
|
+
export function __wbg_length_2591a0f4f659a55c(arg0) {
|
|
474
|
+
const ret = getObject(arg0).length;
|
|
475
|
+
return ret;
|
|
476
|
+
}
|
|
131
477
|
export function __wbg_length_56fcd3e2b7e0299d(arg0) {
|
|
132
478
|
const ret = getObject(arg0).length;
|
|
133
479
|
return ret;
|
|
@@ -136,6 +482,10 @@ export function __wbg_new_02d162bc6cf02f60() {
|
|
|
136
482
|
const ret = new Object();
|
|
137
483
|
return addHeapObject(ret);
|
|
138
484
|
}
|
|
485
|
+
export function __wbg_new_070df68d66325372() {
|
|
486
|
+
const ret = new Map();
|
|
487
|
+
return addHeapObject(ret);
|
|
488
|
+
}
|
|
139
489
|
export function __wbg_new_1f236d63ba0c4784(arg0, arg1) {
|
|
140
490
|
const ret = new Error(getStringFromWasm0(arg0, arg1));
|
|
141
491
|
return addHeapObject(ret);
|
|
@@ -148,15 +498,42 @@ export function __wbg_new_7ddec6de44ff8f5d(arg0) {
|
|
|
148
498
|
const ret = new Uint8Array(getObject(arg0));
|
|
149
499
|
return addHeapObject(ret);
|
|
150
500
|
}
|
|
501
|
+
export function __wbg_new_with_length_99887c91eae4abab(arg0) {
|
|
502
|
+
const ret = new Uint8Array(arg0 >>> 0);
|
|
503
|
+
return addHeapObject(ret);
|
|
504
|
+
}
|
|
505
|
+
export function __wbg_next_2a4e19f4f5083b0f(arg0) {
|
|
506
|
+
const ret = getObject(arg0).next;
|
|
507
|
+
return addHeapObject(ret);
|
|
508
|
+
}
|
|
509
|
+
export function __wbg_next_6429a146bf756f93() { return handleError(function (arg0) {
|
|
510
|
+
const ret = getObject(arg0).next();
|
|
511
|
+
return addHeapObject(ret);
|
|
512
|
+
}, arguments); }
|
|
151
513
|
export function __wbg_prototypesetcall_5f9bdc8d75e07276(arg0, arg1, arg2) {
|
|
152
514
|
Uint8Array.prototype.set.call(getArrayU8FromWasm0(arg0, arg1), getObject(arg2));
|
|
153
515
|
}
|
|
516
|
+
export function __wbg_set_24d0fa9e104112f9(arg0, arg1, arg2) {
|
|
517
|
+
getObject(arg0).set(getArrayU8FromWasm0(arg1, arg2));
|
|
518
|
+
}
|
|
154
519
|
export function __wbg_set_6be42768c690e380(arg0, arg1, arg2) {
|
|
155
520
|
getObject(arg0)[takeObject(arg1)] = takeObject(arg2);
|
|
156
521
|
}
|
|
157
522
|
export function __wbg_set_78ea6a19f4818587(arg0, arg1, arg2) {
|
|
158
523
|
getObject(arg0)[arg1 >>> 0] = takeObject(arg2);
|
|
159
524
|
}
|
|
525
|
+
export function __wbg_set_a0e911be3da02782() { return handleError(function (arg0, arg1, arg2) {
|
|
526
|
+
const ret = Reflect.set(getObject(arg0), getObject(arg1), getObject(arg2));
|
|
527
|
+
return ret;
|
|
528
|
+
}, arguments); }
|
|
529
|
+
export function __wbg_set_facb7a5914e0fa39(arg0, arg1, arg2) {
|
|
530
|
+
const ret = getObject(arg0).set(getObject(arg1), getObject(arg2));
|
|
531
|
+
return addHeapObject(ret);
|
|
532
|
+
}
|
|
533
|
+
export function __wbg_value_9cc0518af87a489c(arg0) {
|
|
534
|
+
const ret = getObject(arg0).value;
|
|
535
|
+
return addHeapObject(ret);
|
|
536
|
+
}
|
|
160
537
|
export function __wbindgen_cast_0000000000000001(arg0) {
|
|
161
538
|
// Cast intrinsic for `F64 -> Externref`.
|
|
162
539
|
const ret = arg0;
|
|
@@ -286,6 +663,14 @@ function getUint8ArrayMemory0() {
|
|
|
286
663
|
|
|
287
664
|
function getObject(idx) { return heap[idx]; }
|
|
288
665
|
|
|
666
|
+
function handleError(f, args) {
|
|
667
|
+
try {
|
|
668
|
+
return f.apply(this, args);
|
|
669
|
+
} catch (e) {
|
|
670
|
+
wasm.__wbindgen_export3(addHeapObject(e));
|
|
671
|
+
}
|
|
672
|
+
}
|
|
673
|
+
|
|
289
674
|
let heap = new Array(1024).fill(undefined);
|
|
290
675
|
heap.push(undefined, null, true, false);
|
|
291
676
|
|
|
Binary file
|