@rustledger/wasm 0.2.0 → 0.4.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 +14 -6
- package/package.json +1 -1
- package/rustledger_wasm.d.ts +238 -121
- package/rustledger_wasm.js +381 -284
- package/rustledger_wasm_bg.wasm +0 -0
package/README.md
CHANGED
|
@@ -92,7 +92,7 @@ rledger-format --in-place ledger.beancount
|
|
|
92
92
|
| `rustledger-parser` | Lexer and parser with error recovery |
|
|
93
93
|
| `rustledger-loader` | File loading and includes |
|
|
94
94
|
| `rustledger-booking` | Interpolation and 7 booking methods |
|
|
95
|
-
| `rustledger-validate` |
|
|
95
|
+
| `rustledger-validate` | 27 validation error codes |
|
|
96
96
|
| `rustledger-query` | BQL query engine |
|
|
97
97
|
| `rustledger-plugin` | 20 built-in plugins + Python plugin support |
|
|
98
98
|
| `rustledger-importer` | CSV/OFX import framework |
|
|
@@ -145,20 +145,28 @@ rledger-format --in-place ledger.beancount
|
|
|
145
145
|
|
|
146
146
|
## Performance
|
|
147
147
|
|
|
148
|
-
|
|
148
|
+
<picture>
|
|
149
|
+
<source media="(prefers-color-scheme: dark)" srcset="https://raw.githubusercontent.com/rustledger/rustledger/benchmarks/.github/badges/validation-chart.svg">
|
|
150
|
+
<source media="(prefers-color-scheme: light)" srcset="https://raw.githubusercontent.com/rustledger/rustledger/benchmarks/.github/badges/validation-chart.svg">
|
|
151
|
+
<img alt="Validation Benchmark" src="https://raw.githubusercontent.com/rustledger/rustledger/benchmarks/.github/badges/validation-chart.png" width="100%">
|
|
152
|
+
</picture>
|
|
149
153
|
|
|
150
154
|
<picture>
|
|
151
|
-
<source media="(prefers-color-scheme: dark)" srcset="https://raw.githubusercontent.com/rustledger/rustledger/benchmarks/.github/badges/
|
|
152
|
-
<source media="(prefers-color-scheme: light)" srcset="https://raw.githubusercontent.com/rustledger/rustledger/benchmarks/.github/badges/
|
|
153
|
-
<img alt="Benchmark
|
|
155
|
+
<source media="(prefers-color-scheme: dark)" srcset="https://raw.githubusercontent.com/rustledger/rustledger/benchmarks/.github/badges/balance-chart.svg">
|
|
156
|
+
<source media="(prefers-color-scheme: light)" srcset="https://raw.githubusercontent.com/rustledger/rustledger/benchmarks/.github/badges/balance-chart.svg">
|
|
157
|
+
<img alt="Balance Report Benchmark" src="https://raw.githubusercontent.com/rustledger/rustledger/benchmarks/.github/badges/balance-chart.png" width="100%">
|
|
154
158
|
</picture>
|
|
155
159
|
|
|
156
|
-
<sub>Benchmarks run nightly on
|
|
160
|
+
<sub>Benchmarks run nightly on 10K transaction ledgers. [View workflow →](https://github.com/rustledger/rustledger/actions/workflows/bench.yml)</sub>
|
|
157
161
|
|
|
158
162
|
## Contributing
|
|
159
163
|
|
|
160
164
|
See [CLAUDE.md](CLAUDE.md) for architecture and development setup.
|
|
161
165
|
|
|
166
|
+
By submitting a pull request, you agree to the [Contributor License Agreement](CLA.md).
|
|
167
|
+
|
|
162
168
|
## License
|
|
163
169
|
|
|
164
170
|
[GPL-3.0](LICENSE)
|
|
171
|
+
|
|
172
|
+
**Commercial licensing available** - [contact us](https://rustledger.github.io/#contact) for proprietary license options.
|
package/package.json
CHANGED
package/rustledger_wasm.d.ts
CHANGED
|
@@ -73,18 +73,18 @@ export interface CloseDirective extends BaseDirective {
|
|
|
73
73
|
|
|
74
74
|
/** All directive types. */
|
|
75
75
|
export type Directive =
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
76
|
+
| TransactionDirective
|
|
77
|
+
| BalanceDirective
|
|
78
|
+
| OpenDirective
|
|
79
|
+
| CloseDirective
|
|
80
|
+
| { type: 'commodity'; date: string; currency: string }
|
|
81
|
+
| { type: 'pad'; date: string; account: string; source_account: string }
|
|
82
|
+
| { type: 'event'; date: string; event_type: string; value: string }
|
|
83
|
+
| { type: 'note'; date: string; account: string; comment: string }
|
|
84
|
+
| { type: 'document'; date: string; account: string; path: string }
|
|
85
|
+
| { type: 'price'; date: string; currency: string; amount: Amount }
|
|
86
|
+
| { type: 'query'; date: string; name: string; query_string: string }
|
|
87
|
+
| { type: 'custom'; date: string; custom_type: string };
|
|
88
88
|
|
|
89
89
|
/** Ledger options. */
|
|
90
90
|
export interface LedgerOptions {
|
|
@@ -112,14 +112,14 @@ export interface ValidationResult {
|
|
|
112
112
|
|
|
113
113
|
/** Cell value in query results. */
|
|
114
114
|
export type CellValue =
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
115
|
+
| null
|
|
116
|
+
| string
|
|
117
|
+
| number
|
|
118
|
+
| boolean
|
|
119
|
+
| Amount
|
|
120
|
+
| { units: Amount; cost?: { number: string; currency: string; date?: string; label?: string } }
|
|
121
|
+
| { positions: Array<{ units: Amount }> }
|
|
122
|
+
| string[];
|
|
123
123
|
|
|
124
124
|
/** Result of a BQL query. */
|
|
125
125
|
export interface QueryResult {
|
|
@@ -166,6 +166,60 @@ export interface CompletionResult {
|
|
|
166
166
|
context: string;
|
|
167
167
|
}
|
|
168
168
|
|
|
169
|
+
// =============================================================================
|
|
170
|
+
// Editor Integration Types (LSP-like features)
|
|
171
|
+
// =============================================================================
|
|
172
|
+
|
|
173
|
+
/** The kind of a completion item. */
|
|
174
|
+
export type EditorCompletionKind = 'keyword' | 'account' | 'accountsegment' | 'currency' | 'payee' | 'date' | 'text';
|
|
175
|
+
|
|
176
|
+
/** A completion item for Beancount source editing. */
|
|
177
|
+
export interface EditorCompletion {
|
|
178
|
+
label: string;
|
|
179
|
+
kind: EditorCompletionKind;
|
|
180
|
+
detail?: string;
|
|
181
|
+
insertText?: string;
|
|
182
|
+
}
|
|
183
|
+
|
|
184
|
+
/** Result of an editor completion request. */
|
|
185
|
+
export interface EditorCompletionResult {
|
|
186
|
+
completions: EditorCompletion[];
|
|
187
|
+
context: string;
|
|
188
|
+
}
|
|
189
|
+
|
|
190
|
+
/** A range in the document. */
|
|
191
|
+
export interface EditorRange {
|
|
192
|
+
start_line: number;
|
|
193
|
+
start_character: number;
|
|
194
|
+
end_line: number;
|
|
195
|
+
end_character: number;
|
|
196
|
+
}
|
|
197
|
+
|
|
198
|
+
/** Hover information for a symbol. */
|
|
199
|
+
export interface EditorHoverInfo {
|
|
200
|
+
contents: string;
|
|
201
|
+
range?: EditorRange;
|
|
202
|
+
}
|
|
203
|
+
|
|
204
|
+
/** A location in the document. */
|
|
205
|
+
export interface EditorLocation {
|
|
206
|
+
line: number;
|
|
207
|
+
character: number;
|
|
208
|
+
}
|
|
209
|
+
|
|
210
|
+
/** The kind of a symbol. */
|
|
211
|
+
export type SymbolKind = 'transaction' | 'account' | 'balance' | 'commodity' | 'posting' | 'pad' | 'event' | 'note' | 'document' | 'price' | 'query' | 'custom';
|
|
212
|
+
|
|
213
|
+
/** A document symbol for the outline view. */
|
|
214
|
+
export interface EditorDocumentSymbol {
|
|
215
|
+
name: string;
|
|
216
|
+
detail?: string;
|
|
217
|
+
kind: SymbolKind;
|
|
218
|
+
range: EditorRange;
|
|
219
|
+
children?: EditorDocumentSymbol[];
|
|
220
|
+
deprecated?: boolean;
|
|
221
|
+
}
|
|
222
|
+
|
|
169
223
|
/**
|
|
170
224
|
* A parsed and validated ledger that caches the parse result.
|
|
171
225
|
* Use this class when you need to perform multiple operations on the same
|
|
@@ -210,67 +264,126 @@ export class ParsedLedger {
|
|
|
210
264
|
|
|
211
265
|
/** Run a native plugin on this ledger. */
|
|
212
266
|
runPlugin(pluginName: string): PluginResult;
|
|
267
|
+
|
|
268
|
+
// =========================================================================
|
|
269
|
+
// Editor Integration (LSP-like features)
|
|
270
|
+
// =========================================================================
|
|
271
|
+
|
|
272
|
+
/** Get completions at the given position. */
|
|
273
|
+
getCompletions(line: number, character: number): EditorCompletionResult;
|
|
274
|
+
|
|
275
|
+
/** Get hover information at the given position. */
|
|
276
|
+
getHoverInfo(line: number, character: number): EditorHoverInfo | null;
|
|
277
|
+
|
|
278
|
+
/** Get the definition location for the symbol at the given position. */
|
|
279
|
+
getDefinition(line: number, character: number): EditorLocation | null;
|
|
280
|
+
|
|
281
|
+
/** Get all document symbols for the outline view. */
|
|
282
|
+
getDocumentSymbols(): EditorDocumentSymbol[];
|
|
213
283
|
}
|
|
214
284
|
|
|
215
285
|
|
|
216
286
|
|
|
287
|
+
/**
|
|
288
|
+
* A parsed and validated ledger that caches the parse result.
|
|
289
|
+
*
|
|
290
|
+
* Use this class when you need to perform multiple operations on the same
|
|
291
|
+
* source without re-parsing each time.
|
|
292
|
+
*
|
|
293
|
+
* # Example (JavaScript)
|
|
294
|
+
*
|
|
295
|
+
* ```javascript
|
|
296
|
+
* const ledger = new ParsedLedger(source);
|
|
297
|
+
* if (ledger.isValid()) {
|
|
298
|
+
* const balances = ledger.query("BALANCES");
|
|
299
|
+
* const formatted = ledger.format();
|
|
300
|
+
* }
|
|
301
|
+
* ```
|
|
302
|
+
*/
|
|
217
303
|
export class ParsedLedger {
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
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
|
-
|
|
304
|
+
free(): void;
|
|
305
|
+
[Symbol.dispose](): void;
|
|
306
|
+
/**
|
|
307
|
+
* Get account balances (shorthand for query("BALANCES")).
|
|
308
|
+
*/
|
|
309
|
+
balances(): any;
|
|
310
|
+
/**
|
|
311
|
+
* Get the number of directives.
|
|
312
|
+
*/
|
|
313
|
+
directiveCount(): number;
|
|
314
|
+
/**
|
|
315
|
+
* Expand pad directives.
|
|
316
|
+
*/
|
|
317
|
+
expandPads(): any;
|
|
318
|
+
/**
|
|
319
|
+
* Format the ledger source.
|
|
320
|
+
*/
|
|
321
|
+
format(): any;
|
|
322
|
+
/**
|
|
323
|
+
* Get completions at the given position.
|
|
324
|
+
*
|
|
325
|
+
* Returns context-aware completions for accounts, currencies, directives, etc.
|
|
326
|
+
* Uses cached account/currency/payee data for efficiency.
|
|
327
|
+
*/
|
|
328
|
+
getCompletions(line: number, character: number): any;
|
|
329
|
+
/**
|
|
330
|
+
* Get the definition location for the symbol at the given position.
|
|
331
|
+
*
|
|
332
|
+
* Returns the location of the `open` or `commodity` directive for accounts/currencies.
|
|
333
|
+
* Uses cached `LineIndex` for O(log n) position lookups.
|
|
334
|
+
*/
|
|
335
|
+
getDefinition(line: number, character: number): any;
|
|
336
|
+
/**
|
|
337
|
+
* Get the parsed directives.
|
|
338
|
+
*/
|
|
339
|
+
getDirectives(): any;
|
|
340
|
+
/**
|
|
341
|
+
* Get all document symbols for the outline view.
|
|
342
|
+
*
|
|
343
|
+
* Returns a hierarchical list of all directives with their positions.
|
|
344
|
+
* Uses cached `LineIndex` for O(log n) position lookups.
|
|
345
|
+
*/
|
|
346
|
+
getDocumentSymbols(): any;
|
|
347
|
+
/**
|
|
348
|
+
* Get all errors (parse + validation).
|
|
349
|
+
*/
|
|
350
|
+
getErrors(): any;
|
|
351
|
+
/**
|
|
352
|
+
* Get hover information at the given position.
|
|
353
|
+
*
|
|
354
|
+
* Returns documentation for accounts, currencies, and directive keywords.
|
|
355
|
+
*/
|
|
356
|
+
getHoverInfo(line: number, character: number): any;
|
|
357
|
+
/**
|
|
358
|
+
* Get the ledger options.
|
|
359
|
+
*/
|
|
360
|
+
getOptions(): any;
|
|
361
|
+
/**
|
|
362
|
+
* Get parse errors only.
|
|
363
|
+
*/
|
|
364
|
+
getParseErrors(): any;
|
|
365
|
+
/**
|
|
366
|
+
* Get validation errors only.
|
|
367
|
+
*/
|
|
368
|
+
getValidationErrors(): any;
|
|
369
|
+
/**
|
|
370
|
+
* Check if the ledger is valid (no parse or validation errors).
|
|
371
|
+
*/
|
|
372
|
+
isValid(): boolean;
|
|
373
|
+
/**
|
|
374
|
+
* Create a new `ParsedLedger` from source text.
|
|
375
|
+
*
|
|
376
|
+
* Parses, interpolates, and validates the source. Call `isValid()` to check for errors.
|
|
377
|
+
*/
|
|
378
|
+
constructor(source: string);
|
|
379
|
+
/**
|
|
380
|
+
* Run a BQL query on this ledger.
|
|
381
|
+
*/
|
|
382
|
+
query(query_str: string): any;
|
|
383
|
+
/**
|
|
384
|
+
* Run a native plugin on this ledger.
|
|
385
|
+
*/
|
|
386
|
+
runPlugin(plugin_name: string): any;
|
|
274
387
|
}
|
|
275
388
|
|
|
276
389
|
/**
|
|
@@ -357,57 +470,61 @@ export function version(): string;
|
|
|
357
470
|
export type InitInput = RequestInfo | URL | Response | BufferSource | WebAssembly.Module;
|
|
358
471
|
|
|
359
472
|
export interface InitOutput {
|
|
360
|
-
|
|
361
|
-
|
|
362
|
-
|
|
363
|
-
|
|
364
|
-
|
|
365
|
-
|
|
366
|
-
|
|
367
|
-
|
|
368
|
-
|
|
369
|
-
|
|
370
|
-
|
|
371
|
-
|
|
372
|
-
|
|
373
|
-
|
|
374
|
-
|
|
375
|
-
|
|
376
|
-
|
|
377
|
-
|
|
378
|
-
|
|
379
|
-
|
|
380
|
-
|
|
381
|
-
|
|
382
|
-
|
|
383
|
-
|
|
384
|
-
|
|
385
|
-
|
|
386
|
-
|
|
387
|
-
|
|
388
|
-
|
|
389
|
-
|
|
390
|
-
|
|
473
|
+
readonly memory: WebAssembly.Memory;
|
|
474
|
+
readonly __wbg_parsedledger_free: (a: number, b: number) => void;
|
|
475
|
+
readonly balances: (a: number, b: number, c: number) => void;
|
|
476
|
+
readonly bqlCompletions: (a: number, b: number, c: number, d: number) => void;
|
|
477
|
+
readonly expandPads: (a: number, b: number, c: number) => void;
|
|
478
|
+
readonly format: (a: number, b: number, c: number) => void;
|
|
479
|
+
readonly listPlugins: (a: number) => void;
|
|
480
|
+
readonly parse: (a: number, b: number, c: number) => void;
|
|
481
|
+
readonly parsedledger_balances: (a: number, b: number) => void;
|
|
482
|
+
readonly parsedledger_directiveCount: (a: number) => number;
|
|
483
|
+
readonly parsedledger_expandPads: (a: number, b: number) => void;
|
|
484
|
+
readonly parsedledger_format: (a: number, b: number) => void;
|
|
485
|
+
readonly parsedledger_getCompletions: (a: number, b: number, c: number, d: number) => void;
|
|
486
|
+
readonly parsedledger_getDefinition: (a: number, b: number, c: number, d: number) => void;
|
|
487
|
+
readonly parsedledger_getDirectives: (a: number, b: number) => void;
|
|
488
|
+
readonly parsedledger_getDocumentSymbols: (a: number, b: number) => void;
|
|
489
|
+
readonly parsedledger_getErrors: (a: number, b: number) => void;
|
|
490
|
+
readonly parsedledger_getHoverInfo: (a: number, b: number, c: number, d: number) => void;
|
|
491
|
+
readonly parsedledger_getOptions: (a: number, b: number) => void;
|
|
492
|
+
readonly parsedledger_getParseErrors: (a: number, b: number) => void;
|
|
493
|
+
readonly parsedledger_getValidationErrors: (a: number, b: number) => void;
|
|
494
|
+
readonly parsedledger_isValid: (a: number) => number;
|
|
495
|
+
readonly parsedledger_new: (a: number, b: number) => number;
|
|
496
|
+
readonly parsedledger_query: (a: number, b: number, c: number, d: number) => void;
|
|
497
|
+
readonly parsedledger_runPlugin: (a: number, b: number, c: number, d: number) => void;
|
|
498
|
+
readonly query: (a: number, b: number, c: number, d: number, e: number) => void;
|
|
499
|
+
readonly runPlugin: (a: number, b: number, c: number, d: number, e: number) => void;
|
|
500
|
+
readonly validateSource: (a: number, b: number, c: number) => void;
|
|
501
|
+
readonly version: (a: number) => void;
|
|
502
|
+
readonly init: () => void;
|
|
503
|
+
readonly __wbindgen_export: (a: number, b: number) => number;
|
|
504
|
+
readonly __wbindgen_export2: (a: number, b: number, c: number, d: number) => number;
|
|
505
|
+
readonly __wbindgen_export3: (a: number, b: number, c: number) => void;
|
|
506
|
+
readonly __wbindgen_add_to_stack_pointer: (a: number) => number;
|
|
507
|
+
readonly __wbindgen_start: () => void;
|
|
391
508
|
}
|
|
392
509
|
|
|
393
510
|
export type SyncInitInput = BufferSource | WebAssembly.Module;
|
|
394
511
|
|
|
395
512
|
/**
|
|
396
|
-
* Instantiates the given `module`, which can either be bytes or
|
|
397
|
-
* a precompiled `WebAssembly.Module`.
|
|
398
|
-
*
|
|
399
|
-
* @param {{ module: SyncInitInput }} module - Passing `SyncInitInput` directly is deprecated.
|
|
400
|
-
*
|
|
401
|
-
* @returns {InitOutput}
|
|
402
|
-
*/
|
|
513
|
+
* Instantiates the given `module`, which can either be bytes or
|
|
514
|
+
* a precompiled `WebAssembly.Module`.
|
|
515
|
+
*
|
|
516
|
+
* @param {{ module: SyncInitInput }} module - Passing `SyncInitInput` directly is deprecated.
|
|
517
|
+
*
|
|
518
|
+
* @returns {InitOutput}
|
|
519
|
+
*/
|
|
403
520
|
export function initSync(module: { module: SyncInitInput } | SyncInitInput): InitOutput;
|
|
404
521
|
|
|
405
522
|
/**
|
|
406
|
-
* If `module_or_path` is {RequestInfo} or {URL}, makes a request and
|
|
407
|
-
* for everything else, calls `WebAssembly.instantiate` directly.
|
|
408
|
-
*
|
|
409
|
-
* @param {{ module_or_path: InitInput | Promise<InitInput> }} module_or_path - Passing `InitInput` directly is deprecated.
|
|
410
|
-
*
|
|
411
|
-
* @returns {Promise<InitOutput>}
|
|
412
|
-
*/
|
|
523
|
+
* If `module_or_path` is {RequestInfo} or {URL}, makes a request and
|
|
524
|
+
* for everything else, calls `WebAssembly.instantiate` directly.
|
|
525
|
+
*
|
|
526
|
+
* @param {{ module_or_path: InitInput | Promise<InitInput> }} module_or_path - Passing `InitInput` directly is deprecated.
|
|
527
|
+
*
|
|
528
|
+
* @returns {Promise<InitOutput>}
|
|
529
|
+
*/
|
|
413
530
|
export default function __wbg_init (module_or_path?: { module_or_path: InitInput | Promise<InitInput> } | InitInput | Promise<InitInput>): Promise<InitOutput>;
|
package/rustledger_wasm.js
CHANGED
|
@@ -1,123 +1,4 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
function addHeapObject(obj) {
|
|
4
|
-
if (heap_next === heap.length) heap.push(heap.length + 1);
|
|
5
|
-
const idx = heap_next;
|
|
6
|
-
heap_next = heap[idx];
|
|
7
|
-
|
|
8
|
-
heap[idx] = obj;
|
|
9
|
-
return idx;
|
|
10
|
-
}
|
|
11
|
-
|
|
12
|
-
function dropObject(idx) {
|
|
13
|
-
if (idx < 132) return;
|
|
14
|
-
heap[idx] = heap_next;
|
|
15
|
-
heap_next = idx;
|
|
16
|
-
}
|
|
17
|
-
|
|
18
|
-
let cachedDataViewMemory0 = null;
|
|
19
|
-
function getDataViewMemory0() {
|
|
20
|
-
if (cachedDataViewMemory0 === null || cachedDataViewMemory0.buffer.detached === true || (cachedDataViewMemory0.buffer.detached === undefined && cachedDataViewMemory0.buffer !== wasm.memory.buffer)) {
|
|
21
|
-
cachedDataViewMemory0 = new DataView(wasm.memory.buffer);
|
|
22
|
-
}
|
|
23
|
-
return cachedDataViewMemory0;
|
|
24
|
-
}
|
|
25
|
-
|
|
26
|
-
function getStringFromWasm0(ptr, len) {
|
|
27
|
-
ptr = ptr >>> 0;
|
|
28
|
-
return decodeText(ptr, len);
|
|
29
|
-
}
|
|
30
|
-
|
|
31
|
-
let cachedUint8ArrayMemory0 = null;
|
|
32
|
-
function getUint8ArrayMemory0() {
|
|
33
|
-
if (cachedUint8ArrayMemory0 === null || cachedUint8ArrayMemory0.byteLength === 0) {
|
|
34
|
-
cachedUint8ArrayMemory0 = new Uint8Array(wasm.memory.buffer);
|
|
35
|
-
}
|
|
36
|
-
return cachedUint8ArrayMemory0;
|
|
37
|
-
}
|
|
38
|
-
|
|
39
|
-
function getObject(idx) { return heap[idx]; }
|
|
40
|
-
|
|
41
|
-
let heap = new Array(128).fill(undefined);
|
|
42
|
-
heap.push(undefined, null, true, false);
|
|
43
|
-
|
|
44
|
-
let heap_next = heap.length;
|
|
45
|
-
|
|
46
|
-
function passStringToWasm0(arg, malloc, realloc) {
|
|
47
|
-
if (realloc === undefined) {
|
|
48
|
-
const buf = cachedTextEncoder.encode(arg);
|
|
49
|
-
const ptr = malloc(buf.length, 1) >>> 0;
|
|
50
|
-
getUint8ArrayMemory0().subarray(ptr, ptr + buf.length).set(buf);
|
|
51
|
-
WASM_VECTOR_LEN = buf.length;
|
|
52
|
-
return ptr;
|
|
53
|
-
}
|
|
54
|
-
|
|
55
|
-
let len = arg.length;
|
|
56
|
-
let ptr = malloc(len, 1) >>> 0;
|
|
57
|
-
|
|
58
|
-
const mem = getUint8ArrayMemory0();
|
|
59
|
-
|
|
60
|
-
let offset = 0;
|
|
61
|
-
|
|
62
|
-
for (; offset < len; offset++) {
|
|
63
|
-
const code = arg.charCodeAt(offset);
|
|
64
|
-
if (code > 0x7F) break;
|
|
65
|
-
mem[ptr + offset] = code;
|
|
66
|
-
}
|
|
67
|
-
if (offset !== len) {
|
|
68
|
-
if (offset !== 0) {
|
|
69
|
-
arg = arg.slice(offset);
|
|
70
|
-
}
|
|
71
|
-
ptr = realloc(ptr, len, len = offset + arg.length * 3, 1) >>> 0;
|
|
72
|
-
const view = getUint8ArrayMemory0().subarray(ptr + offset, ptr + len);
|
|
73
|
-
const ret = cachedTextEncoder.encodeInto(arg, view);
|
|
74
|
-
|
|
75
|
-
offset += ret.written;
|
|
76
|
-
ptr = realloc(ptr, len, offset, 1) >>> 0;
|
|
77
|
-
}
|
|
78
|
-
|
|
79
|
-
WASM_VECTOR_LEN = offset;
|
|
80
|
-
return ptr;
|
|
81
|
-
}
|
|
82
|
-
|
|
83
|
-
function takeObject(idx) {
|
|
84
|
-
const ret = getObject(idx);
|
|
85
|
-
dropObject(idx);
|
|
86
|
-
return ret;
|
|
87
|
-
}
|
|
88
|
-
|
|
89
|
-
let cachedTextDecoder = new TextDecoder('utf-8', { ignoreBOM: true, fatal: true });
|
|
90
|
-
cachedTextDecoder.decode();
|
|
91
|
-
const MAX_SAFARI_DECODE_BYTES = 2146435072;
|
|
92
|
-
let numBytesDecoded = 0;
|
|
93
|
-
function decodeText(ptr, len) {
|
|
94
|
-
numBytesDecoded += len;
|
|
95
|
-
if (numBytesDecoded >= MAX_SAFARI_DECODE_BYTES) {
|
|
96
|
-
cachedTextDecoder = new TextDecoder('utf-8', { ignoreBOM: true, fatal: true });
|
|
97
|
-
cachedTextDecoder.decode();
|
|
98
|
-
numBytesDecoded = len;
|
|
99
|
-
}
|
|
100
|
-
return cachedTextDecoder.decode(getUint8ArrayMemory0().subarray(ptr, ptr + len));
|
|
101
|
-
}
|
|
102
|
-
|
|
103
|
-
const cachedTextEncoder = new TextEncoder();
|
|
104
|
-
|
|
105
|
-
if (!('encodeInto' in cachedTextEncoder)) {
|
|
106
|
-
cachedTextEncoder.encodeInto = function (arg, view) {
|
|
107
|
-
const buf = cachedTextEncoder.encode(arg);
|
|
108
|
-
view.set(buf);
|
|
109
|
-
return {
|
|
110
|
-
read: arg.length,
|
|
111
|
-
written: buf.length
|
|
112
|
-
};
|
|
113
|
-
}
|
|
114
|
-
}
|
|
115
|
-
|
|
116
|
-
let WASM_VECTOR_LEN = 0;
|
|
117
|
-
|
|
118
|
-
const ParsedLedgerFinalization = (typeof FinalizationRegistry === 'undefined')
|
|
119
|
-
? { register: () => {}, unregister: () => {} }
|
|
120
|
-
: new FinalizationRegistry(ptr => wasm.__wbg_parsedledger_free(ptr >>> 0, 1));
|
|
1
|
+
/* @ts-self-types="./rustledger_wasm.d.ts" */
|
|
121
2
|
|
|
122
3
|
/**
|
|
123
4
|
* A parsed and validated ledger that caches the parse result.
|
|
@@ -147,13 +28,13 @@ export class ParsedLedger {
|
|
|
147
28
|
wasm.__wbg_parsedledger_free(ptr, 0);
|
|
148
29
|
}
|
|
149
30
|
/**
|
|
150
|
-
* Get
|
|
31
|
+
* Get account balances (shorthand for query("BALANCES")).
|
|
151
32
|
* @returns {any}
|
|
152
33
|
*/
|
|
153
|
-
|
|
34
|
+
balances() {
|
|
154
35
|
try {
|
|
155
36
|
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
|
156
|
-
wasm.
|
|
37
|
+
wasm.parsedledger_balances(retptr, this.__wbg_ptr);
|
|
157
38
|
var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
|
|
158
39
|
var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
|
|
159
40
|
var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
|
|
@@ -166,16 +47,21 @@ export class ParsedLedger {
|
|
|
166
47
|
}
|
|
167
48
|
}
|
|
168
49
|
/**
|
|
169
|
-
*
|
|
170
|
-
* @
|
|
50
|
+
* Get the number of directives.
|
|
51
|
+
* @returns {number}
|
|
52
|
+
*/
|
|
53
|
+
directiveCount() {
|
|
54
|
+
const ret = wasm.parsedledger_directiveCount(this.__wbg_ptr);
|
|
55
|
+
return ret >>> 0;
|
|
56
|
+
}
|
|
57
|
+
/**
|
|
58
|
+
* Expand pad directives.
|
|
171
59
|
* @returns {any}
|
|
172
60
|
*/
|
|
173
|
-
|
|
61
|
+
expandPads() {
|
|
174
62
|
try {
|
|
175
63
|
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
|
176
|
-
|
|
177
|
-
const len0 = WASM_VECTOR_LEN;
|
|
178
|
-
wasm.parsedledger_runPlugin(retptr, this.__wbg_ptr, ptr0, len0);
|
|
64
|
+
wasm.parsedledger_expandPads(retptr, this.__wbg_ptr);
|
|
179
65
|
var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
|
|
180
66
|
var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
|
|
181
67
|
var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
|
|
@@ -188,13 +74,13 @@ export class ParsedLedger {
|
|
|
188
74
|
}
|
|
189
75
|
}
|
|
190
76
|
/**
|
|
191
|
-
*
|
|
77
|
+
* Format the ledger source.
|
|
192
78
|
* @returns {any}
|
|
193
79
|
*/
|
|
194
|
-
|
|
80
|
+
format() {
|
|
195
81
|
try {
|
|
196
82
|
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
|
197
|
-
wasm.
|
|
83
|
+
wasm.parsedledger_format(retptr, this.__wbg_ptr);
|
|
198
84
|
var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
|
|
199
85
|
var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
|
|
200
86
|
var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
|
|
@@ -207,13 +93,42 @@ export class ParsedLedger {
|
|
|
207
93
|
}
|
|
208
94
|
}
|
|
209
95
|
/**
|
|
210
|
-
* Get the
|
|
96
|
+
* Get completions at the given position.
|
|
97
|
+
*
|
|
98
|
+
* Returns context-aware completions for accounts, currencies, directives, etc.
|
|
99
|
+
* Uses cached account/currency/payee data for efficiency.
|
|
100
|
+
* @param {number} line
|
|
101
|
+
* @param {number} character
|
|
211
102
|
* @returns {any}
|
|
212
103
|
*/
|
|
213
|
-
|
|
104
|
+
getCompletions(line, character) {
|
|
214
105
|
try {
|
|
215
106
|
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
|
216
|
-
wasm.
|
|
107
|
+
wasm.parsedledger_getCompletions(retptr, this.__wbg_ptr, line, character);
|
|
108
|
+
var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
|
|
109
|
+
var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
|
|
110
|
+
var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
|
|
111
|
+
if (r2) {
|
|
112
|
+
throw takeObject(r1);
|
|
113
|
+
}
|
|
114
|
+
return takeObject(r0);
|
|
115
|
+
} finally {
|
|
116
|
+
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
117
|
+
}
|
|
118
|
+
}
|
|
119
|
+
/**
|
|
120
|
+
* Get the definition location for the symbol at the given position.
|
|
121
|
+
*
|
|
122
|
+
* Returns the location of the `open` or `commodity` directive for accounts/currencies.
|
|
123
|
+
* Uses cached `LineIndex` for O(log n) position lookups.
|
|
124
|
+
* @param {number} line
|
|
125
|
+
* @param {number} character
|
|
126
|
+
* @returns {any}
|
|
127
|
+
*/
|
|
128
|
+
getDefinition(line, character) {
|
|
129
|
+
try {
|
|
130
|
+
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
|
131
|
+
wasm.parsedledger_getDefinition(retptr, this.__wbg_ptr, line, character);
|
|
217
132
|
var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
|
|
218
133
|
var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
|
|
219
134
|
var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
|
|
@@ -245,12 +160,87 @@ export class ParsedLedger {
|
|
|
245
160
|
}
|
|
246
161
|
}
|
|
247
162
|
/**
|
|
248
|
-
* Get the
|
|
249
|
-
*
|
|
163
|
+
* Get all document symbols for the outline view.
|
|
164
|
+
*
|
|
165
|
+
* Returns a hierarchical list of all directives with their positions.
|
|
166
|
+
* Uses cached `LineIndex` for O(log n) position lookups.
|
|
167
|
+
* @returns {any}
|
|
250
168
|
*/
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
169
|
+
getDocumentSymbols() {
|
|
170
|
+
try {
|
|
171
|
+
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
|
172
|
+
wasm.parsedledger_getDocumentSymbols(retptr, this.__wbg_ptr);
|
|
173
|
+
var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
|
|
174
|
+
var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
|
|
175
|
+
var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
|
|
176
|
+
if (r2) {
|
|
177
|
+
throw takeObject(r1);
|
|
178
|
+
}
|
|
179
|
+
return takeObject(r0);
|
|
180
|
+
} finally {
|
|
181
|
+
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
182
|
+
}
|
|
183
|
+
}
|
|
184
|
+
/**
|
|
185
|
+
* Get all errors (parse + validation).
|
|
186
|
+
* @returns {any}
|
|
187
|
+
*/
|
|
188
|
+
getErrors() {
|
|
189
|
+
try {
|
|
190
|
+
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
|
191
|
+
wasm.parsedledger_getErrors(retptr, this.__wbg_ptr);
|
|
192
|
+
var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
|
|
193
|
+
var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
|
|
194
|
+
var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
|
|
195
|
+
if (r2) {
|
|
196
|
+
throw takeObject(r1);
|
|
197
|
+
}
|
|
198
|
+
return takeObject(r0);
|
|
199
|
+
} finally {
|
|
200
|
+
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
201
|
+
}
|
|
202
|
+
}
|
|
203
|
+
/**
|
|
204
|
+
* Get hover information at the given position.
|
|
205
|
+
*
|
|
206
|
+
* Returns documentation for accounts, currencies, and directive keywords.
|
|
207
|
+
* @param {number} line
|
|
208
|
+
* @param {number} character
|
|
209
|
+
* @returns {any}
|
|
210
|
+
*/
|
|
211
|
+
getHoverInfo(line, character) {
|
|
212
|
+
try {
|
|
213
|
+
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
|
214
|
+
wasm.parsedledger_getHoverInfo(retptr, this.__wbg_ptr, line, character);
|
|
215
|
+
var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
|
|
216
|
+
var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
|
|
217
|
+
var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
|
|
218
|
+
if (r2) {
|
|
219
|
+
throw takeObject(r1);
|
|
220
|
+
}
|
|
221
|
+
return takeObject(r0);
|
|
222
|
+
} finally {
|
|
223
|
+
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
224
|
+
}
|
|
225
|
+
}
|
|
226
|
+
/**
|
|
227
|
+
* Get the ledger options.
|
|
228
|
+
* @returns {any}
|
|
229
|
+
*/
|
|
230
|
+
getOptions() {
|
|
231
|
+
try {
|
|
232
|
+
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
|
233
|
+
wasm.parsedledger_getOptions(retptr, this.__wbg_ptr);
|
|
234
|
+
var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
|
|
235
|
+
var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
|
|
236
|
+
var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
|
|
237
|
+
if (r2) {
|
|
238
|
+
throw takeObject(r1);
|
|
239
|
+
}
|
|
240
|
+
return takeObject(r0);
|
|
241
|
+
} finally {
|
|
242
|
+
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
243
|
+
}
|
|
254
244
|
}
|
|
255
245
|
/**
|
|
256
246
|
* Get parse errors only.
|
|
@@ -290,6 +280,14 @@ export class ParsedLedger {
|
|
|
290
280
|
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
291
281
|
}
|
|
292
282
|
}
|
|
283
|
+
/**
|
|
284
|
+
* Check if the ledger is valid (no parse or validation errors).
|
|
285
|
+
* @returns {boolean}
|
|
286
|
+
*/
|
|
287
|
+
isValid() {
|
|
288
|
+
const ret = wasm.parsedledger_isValid(this.__wbg_ptr);
|
|
289
|
+
return ret !== 0;
|
|
290
|
+
}
|
|
293
291
|
/**
|
|
294
292
|
* Create a new `ParsedLedger` from source text.
|
|
295
293
|
*
|
|
@@ -327,32 +325,16 @@ export class ParsedLedger {
|
|
|
327
325
|
}
|
|
328
326
|
}
|
|
329
327
|
/**
|
|
330
|
-
*
|
|
331
|
-
* @
|
|
332
|
-
*/
|
|
333
|
-
format() {
|
|
334
|
-
try {
|
|
335
|
-
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
|
336
|
-
wasm.parsedledger_format(retptr, this.__wbg_ptr);
|
|
337
|
-
var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
|
|
338
|
-
var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
|
|
339
|
-
var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
|
|
340
|
-
if (r2) {
|
|
341
|
-
throw takeObject(r1);
|
|
342
|
-
}
|
|
343
|
-
return takeObject(r0);
|
|
344
|
-
} finally {
|
|
345
|
-
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
346
|
-
}
|
|
347
|
-
}
|
|
348
|
-
/**
|
|
349
|
-
* Get account balances (shorthand for query("BALANCES")).
|
|
328
|
+
* Run a native plugin on this ledger.
|
|
329
|
+
* @param {string} plugin_name
|
|
350
330
|
* @returns {any}
|
|
351
331
|
*/
|
|
352
|
-
|
|
332
|
+
runPlugin(plugin_name) {
|
|
353
333
|
try {
|
|
354
334
|
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
|
355
|
-
wasm.
|
|
335
|
+
const ptr0 = passStringToWasm0(plugin_name, wasm.__wbindgen_export, wasm.__wbindgen_export2);
|
|
336
|
+
const len0 = WASM_VECTOR_LEN;
|
|
337
|
+
wasm.parsedledger_runPlugin(retptr, this.__wbg_ptr, ptr0, len0);
|
|
356
338
|
var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
|
|
357
339
|
var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
|
|
358
340
|
var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
|
|
@@ -364,14 +346,6 @@ export class ParsedLedger {
|
|
|
364
346
|
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
365
347
|
}
|
|
366
348
|
}
|
|
367
|
-
/**
|
|
368
|
-
* Check if the ledger is valid (no parse or validation errors).
|
|
369
|
-
* @returns {boolean}
|
|
370
|
-
*/
|
|
371
|
-
isValid() {
|
|
372
|
-
const ret = wasm.parsedledger_isValid(this.__wbg_ptr);
|
|
373
|
-
return ret !== 0;
|
|
374
|
-
}
|
|
375
349
|
}
|
|
376
350
|
if (Symbol.dispose) ParsedLedger.prototype[Symbol.dispose] = ParsedLedger.prototype.free;
|
|
377
351
|
|
|
@@ -640,7 +614,232 @@ export function version() {
|
|
|
640
614
|
}
|
|
641
615
|
}
|
|
642
616
|
|
|
643
|
-
|
|
617
|
+
function __wbg_get_imports() {
|
|
618
|
+
const import0 = {
|
|
619
|
+
__proto__: null,
|
|
620
|
+
__wbg_Error_8c4e43fe74559d73: function(arg0, arg1) {
|
|
621
|
+
const ret = Error(getStringFromWasm0(arg0, arg1));
|
|
622
|
+
return addHeapObject(ret);
|
|
623
|
+
},
|
|
624
|
+
__wbg_String_8f0eb39a4a4c2f66: function(arg0, arg1) {
|
|
625
|
+
const ret = String(getObject(arg1));
|
|
626
|
+
const ptr1 = passStringToWasm0(ret, wasm.__wbindgen_export, wasm.__wbindgen_export2);
|
|
627
|
+
const len1 = WASM_VECTOR_LEN;
|
|
628
|
+
getDataViewMemory0().setInt32(arg0 + 4 * 1, len1, true);
|
|
629
|
+
getDataViewMemory0().setInt32(arg0 + 4 * 0, ptr1, true);
|
|
630
|
+
},
|
|
631
|
+
__wbg___wbindgen_throw_be289d5034ed271b: function(arg0, arg1) {
|
|
632
|
+
throw new Error(getStringFromWasm0(arg0, arg1));
|
|
633
|
+
},
|
|
634
|
+
__wbg_error_7534b8e9a36f1ab4: function(arg0, arg1) {
|
|
635
|
+
let deferred0_0;
|
|
636
|
+
let deferred0_1;
|
|
637
|
+
try {
|
|
638
|
+
deferred0_0 = arg0;
|
|
639
|
+
deferred0_1 = arg1;
|
|
640
|
+
console.error(getStringFromWasm0(arg0, arg1));
|
|
641
|
+
} finally {
|
|
642
|
+
wasm.__wbindgen_export3(deferred0_0, deferred0_1, 1);
|
|
643
|
+
}
|
|
644
|
+
},
|
|
645
|
+
__wbg_getTime_1e3cd1391c5c3995: function(arg0) {
|
|
646
|
+
const ret = getObject(arg0).getTime();
|
|
647
|
+
return ret;
|
|
648
|
+
},
|
|
649
|
+
__wbg_getTimezoneOffset_81776d10a4ec18a8: function(arg0) {
|
|
650
|
+
const ret = getObject(arg0).getTimezoneOffset();
|
|
651
|
+
return ret;
|
|
652
|
+
},
|
|
653
|
+
__wbg_new_0_73afc35eb544e539: function() {
|
|
654
|
+
const ret = new Date();
|
|
655
|
+
return addHeapObject(ret);
|
|
656
|
+
},
|
|
657
|
+
__wbg_new_245cd5c49157e602: function(arg0) {
|
|
658
|
+
const ret = new Date(getObject(arg0));
|
|
659
|
+
return addHeapObject(ret);
|
|
660
|
+
},
|
|
661
|
+
__wbg_new_361308b2356cecd0: function() {
|
|
662
|
+
const ret = new Object();
|
|
663
|
+
return addHeapObject(ret);
|
|
664
|
+
},
|
|
665
|
+
__wbg_new_3eb36ae241fe6f44: function() {
|
|
666
|
+
const ret = new Array();
|
|
667
|
+
return addHeapObject(ret);
|
|
668
|
+
},
|
|
669
|
+
__wbg_new_8a6f238a6ece86ea: function() {
|
|
670
|
+
const ret = new Error();
|
|
671
|
+
return addHeapObject(ret);
|
|
672
|
+
},
|
|
673
|
+
__wbg_set_3f1d0b984ed272ed: function(arg0, arg1, arg2) {
|
|
674
|
+
getObject(arg0)[takeObject(arg1)] = takeObject(arg2);
|
|
675
|
+
},
|
|
676
|
+
__wbg_set_f43e577aea94465b: function(arg0, arg1, arg2) {
|
|
677
|
+
getObject(arg0)[arg1 >>> 0] = takeObject(arg2);
|
|
678
|
+
},
|
|
679
|
+
__wbg_stack_0ed75d68575b0f3c: function(arg0, arg1) {
|
|
680
|
+
const ret = getObject(arg1).stack;
|
|
681
|
+
const ptr1 = passStringToWasm0(ret, wasm.__wbindgen_export, wasm.__wbindgen_export2);
|
|
682
|
+
const len1 = WASM_VECTOR_LEN;
|
|
683
|
+
getDataViewMemory0().setInt32(arg0 + 4 * 1, len1, true);
|
|
684
|
+
getDataViewMemory0().setInt32(arg0 + 4 * 0, ptr1, true);
|
|
685
|
+
},
|
|
686
|
+
__wbindgen_cast_0000000000000001: function(arg0) {
|
|
687
|
+
// Cast intrinsic for `F64 -> Externref`.
|
|
688
|
+
const ret = arg0;
|
|
689
|
+
return addHeapObject(ret);
|
|
690
|
+
},
|
|
691
|
+
__wbindgen_cast_0000000000000002: function(arg0) {
|
|
692
|
+
// Cast intrinsic for `I64 -> Externref`.
|
|
693
|
+
const ret = arg0;
|
|
694
|
+
return addHeapObject(ret);
|
|
695
|
+
},
|
|
696
|
+
__wbindgen_cast_0000000000000003: function(arg0, arg1) {
|
|
697
|
+
// Cast intrinsic for `Ref(String) -> Externref`.
|
|
698
|
+
const ret = getStringFromWasm0(arg0, arg1);
|
|
699
|
+
return addHeapObject(ret);
|
|
700
|
+
},
|
|
701
|
+
__wbindgen_object_clone_ref: function(arg0) {
|
|
702
|
+
const ret = getObject(arg0);
|
|
703
|
+
return addHeapObject(ret);
|
|
704
|
+
},
|
|
705
|
+
__wbindgen_object_drop_ref: function(arg0) {
|
|
706
|
+
takeObject(arg0);
|
|
707
|
+
},
|
|
708
|
+
};
|
|
709
|
+
return {
|
|
710
|
+
__proto__: null,
|
|
711
|
+
"./rustledger_wasm_bg.js": import0,
|
|
712
|
+
};
|
|
713
|
+
}
|
|
714
|
+
|
|
715
|
+
const ParsedLedgerFinalization = (typeof FinalizationRegistry === 'undefined')
|
|
716
|
+
? { register: () => {}, unregister: () => {} }
|
|
717
|
+
: new FinalizationRegistry(ptr => wasm.__wbg_parsedledger_free(ptr >>> 0, 1));
|
|
718
|
+
|
|
719
|
+
function addHeapObject(obj) {
|
|
720
|
+
if (heap_next === heap.length) heap.push(heap.length + 1);
|
|
721
|
+
const idx = heap_next;
|
|
722
|
+
heap_next = heap[idx];
|
|
723
|
+
|
|
724
|
+
heap[idx] = obj;
|
|
725
|
+
return idx;
|
|
726
|
+
}
|
|
727
|
+
|
|
728
|
+
function dropObject(idx) {
|
|
729
|
+
if (idx < 132) return;
|
|
730
|
+
heap[idx] = heap_next;
|
|
731
|
+
heap_next = idx;
|
|
732
|
+
}
|
|
733
|
+
|
|
734
|
+
let cachedDataViewMemory0 = null;
|
|
735
|
+
function getDataViewMemory0() {
|
|
736
|
+
if (cachedDataViewMemory0 === null || cachedDataViewMemory0.buffer.detached === true || (cachedDataViewMemory0.buffer.detached === undefined && cachedDataViewMemory0.buffer !== wasm.memory.buffer)) {
|
|
737
|
+
cachedDataViewMemory0 = new DataView(wasm.memory.buffer);
|
|
738
|
+
}
|
|
739
|
+
return cachedDataViewMemory0;
|
|
740
|
+
}
|
|
741
|
+
|
|
742
|
+
function getStringFromWasm0(ptr, len) {
|
|
743
|
+
ptr = ptr >>> 0;
|
|
744
|
+
return decodeText(ptr, len);
|
|
745
|
+
}
|
|
746
|
+
|
|
747
|
+
let cachedUint8ArrayMemory0 = null;
|
|
748
|
+
function getUint8ArrayMemory0() {
|
|
749
|
+
if (cachedUint8ArrayMemory0 === null || cachedUint8ArrayMemory0.byteLength === 0) {
|
|
750
|
+
cachedUint8ArrayMemory0 = new Uint8Array(wasm.memory.buffer);
|
|
751
|
+
}
|
|
752
|
+
return cachedUint8ArrayMemory0;
|
|
753
|
+
}
|
|
754
|
+
|
|
755
|
+
function getObject(idx) { return heap[idx]; }
|
|
756
|
+
|
|
757
|
+
let heap = new Array(128).fill(undefined);
|
|
758
|
+
heap.push(undefined, null, true, false);
|
|
759
|
+
|
|
760
|
+
let heap_next = heap.length;
|
|
761
|
+
|
|
762
|
+
function passStringToWasm0(arg, malloc, realloc) {
|
|
763
|
+
if (realloc === undefined) {
|
|
764
|
+
const buf = cachedTextEncoder.encode(arg);
|
|
765
|
+
const ptr = malloc(buf.length, 1) >>> 0;
|
|
766
|
+
getUint8ArrayMemory0().subarray(ptr, ptr + buf.length).set(buf);
|
|
767
|
+
WASM_VECTOR_LEN = buf.length;
|
|
768
|
+
return ptr;
|
|
769
|
+
}
|
|
770
|
+
|
|
771
|
+
let len = arg.length;
|
|
772
|
+
let ptr = malloc(len, 1) >>> 0;
|
|
773
|
+
|
|
774
|
+
const mem = getUint8ArrayMemory0();
|
|
775
|
+
|
|
776
|
+
let offset = 0;
|
|
777
|
+
|
|
778
|
+
for (; offset < len; offset++) {
|
|
779
|
+
const code = arg.charCodeAt(offset);
|
|
780
|
+
if (code > 0x7F) break;
|
|
781
|
+
mem[ptr + offset] = code;
|
|
782
|
+
}
|
|
783
|
+
if (offset !== len) {
|
|
784
|
+
if (offset !== 0) {
|
|
785
|
+
arg = arg.slice(offset);
|
|
786
|
+
}
|
|
787
|
+
ptr = realloc(ptr, len, len = offset + arg.length * 3, 1) >>> 0;
|
|
788
|
+
const view = getUint8ArrayMemory0().subarray(ptr + offset, ptr + len);
|
|
789
|
+
const ret = cachedTextEncoder.encodeInto(arg, view);
|
|
790
|
+
|
|
791
|
+
offset += ret.written;
|
|
792
|
+
ptr = realloc(ptr, len, offset, 1) >>> 0;
|
|
793
|
+
}
|
|
794
|
+
|
|
795
|
+
WASM_VECTOR_LEN = offset;
|
|
796
|
+
return ptr;
|
|
797
|
+
}
|
|
798
|
+
|
|
799
|
+
function takeObject(idx) {
|
|
800
|
+
const ret = getObject(idx);
|
|
801
|
+
dropObject(idx);
|
|
802
|
+
return ret;
|
|
803
|
+
}
|
|
804
|
+
|
|
805
|
+
let cachedTextDecoder = new TextDecoder('utf-8', { ignoreBOM: true, fatal: true });
|
|
806
|
+
cachedTextDecoder.decode();
|
|
807
|
+
const MAX_SAFARI_DECODE_BYTES = 2146435072;
|
|
808
|
+
let numBytesDecoded = 0;
|
|
809
|
+
function decodeText(ptr, len) {
|
|
810
|
+
numBytesDecoded += len;
|
|
811
|
+
if (numBytesDecoded >= MAX_SAFARI_DECODE_BYTES) {
|
|
812
|
+
cachedTextDecoder = new TextDecoder('utf-8', { ignoreBOM: true, fatal: true });
|
|
813
|
+
cachedTextDecoder.decode();
|
|
814
|
+
numBytesDecoded = len;
|
|
815
|
+
}
|
|
816
|
+
return cachedTextDecoder.decode(getUint8ArrayMemory0().subarray(ptr, ptr + len));
|
|
817
|
+
}
|
|
818
|
+
|
|
819
|
+
const cachedTextEncoder = new TextEncoder();
|
|
820
|
+
|
|
821
|
+
if (!('encodeInto' in cachedTextEncoder)) {
|
|
822
|
+
cachedTextEncoder.encodeInto = function (arg, view) {
|
|
823
|
+
const buf = cachedTextEncoder.encode(arg);
|
|
824
|
+
view.set(buf);
|
|
825
|
+
return {
|
|
826
|
+
read: arg.length,
|
|
827
|
+
written: buf.length
|
|
828
|
+
};
|
|
829
|
+
};
|
|
830
|
+
}
|
|
831
|
+
|
|
832
|
+
let WASM_VECTOR_LEN = 0;
|
|
833
|
+
|
|
834
|
+
let wasmModule, wasm;
|
|
835
|
+
function __wbg_finalize_init(instance, module) {
|
|
836
|
+
wasm = instance.exports;
|
|
837
|
+
wasmModule = module;
|
|
838
|
+
cachedDataViewMemory0 = null;
|
|
839
|
+
cachedUint8ArrayMemory0 = null;
|
|
840
|
+
wasm.__wbindgen_start();
|
|
841
|
+
return wasm;
|
|
842
|
+
}
|
|
644
843
|
|
|
645
844
|
async function __wbg_load(module, imports) {
|
|
646
845
|
if (typeof Response === 'function' && module instanceof Response) {
|
|
@@ -648,14 +847,12 @@ async function __wbg_load(module, imports) {
|
|
|
648
847
|
try {
|
|
649
848
|
return await WebAssembly.instantiateStreaming(module, imports);
|
|
650
849
|
} catch (e) {
|
|
651
|
-
const validResponse = module.ok &&
|
|
850
|
+
const validResponse = module.ok && expectedResponseType(module.type);
|
|
652
851
|
|
|
653
852
|
if (validResponse && module.headers.get('Content-Type') !== 'application/wasm') {
|
|
654
853
|
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);
|
|
655
854
|
|
|
656
|
-
} else {
|
|
657
|
-
throw e;
|
|
658
|
-
}
|
|
855
|
+
} else { throw e; }
|
|
659
856
|
}
|
|
660
857
|
}
|
|
661
858
|
|
|
@@ -670,119 +867,20 @@ async function __wbg_load(module, imports) {
|
|
|
670
867
|
return instance;
|
|
671
868
|
}
|
|
672
869
|
}
|
|
673
|
-
}
|
|
674
870
|
|
|
675
|
-
function
|
|
676
|
-
|
|
677
|
-
|
|
678
|
-
imports.wbg.__wbg_Error_52673b7de5a0ca89 = function(arg0, arg1) {
|
|
679
|
-
const ret = Error(getStringFromWasm0(arg0, arg1));
|
|
680
|
-
return addHeapObject(ret);
|
|
681
|
-
};
|
|
682
|
-
imports.wbg.__wbg_String_8f0eb39a4a4c2f66 = function(arg0, arg1) {
|
|
683
|
-
const ret = String(getObject(arg1));
|
|
684
|
-
const ptr1 = passStringToWasm0(ret, wasm.__wbindgen_export, wasm.__wbindgen_export2);
|
|
685
|
-
const len1 = WASM_VECTOR_LEN;
|
|
686
|
-
getDataViewMemory0().setInt32(arg0 + 4 * 1, len1, true);
|
|
687
|
-
getDataViewMemory0().setInt32(arg0 + 4 * 0, ptr1, true);
|
|
688
|
-
};
|
|
689
|
-
imports.wbg.__wbg___wbindgen_throw_dd24417ed36fc46e = function(arg0, arg1) {
|
|
690
|
-
throw new Error(getStringFromWasm0(arg0, arg1));
|
|
691
|
-
};
|
|
692
|
-
imports.wbg.__wbg_error_7534b8e9a36f1ab4 = function(arg0, arg1) {
|
|
693
|
-
let deferred0_0;
|
|
694
|
-
let deferred0_1;
|
|
695
|
-
try {
|
|
696
|
-
deferred0_0 = arg0;
|
|
697
|
-
deferred0_1 = arg1;
|
|
698
|
-
console.error(getStringFromWasm0(arg0, arg1));
|
|
699
|
-
} finally {
|
|
700
|
-
wasm.__wbindgen_export3(deferred0_0, deferred0_1, 1);
|
|
871
|
+
function expectedResponseType(type) {
|
|
872
|
+
switch (type) {
|
|
873
|
+
case 'basic': case 'cors': case 'default': return true;
|
|
701
874
|
}
|
|
702
|
-
|
|
703
|
-
|
|
704
|
-
const ret = getObject(arg0).getTime();
|
|
705
|
-
return ret;
|
|
706
|
-
};
|
|
707
|
-
imports.wbg.__wbg_getTimezoneOffset_45389e26d6f46823 = function(arg0) {
|
|
708
|
-
const ret = getObject(arg0).getTimezoneOffset();
|
|
709
|
-
return ret;
|
|
710
|
-
};
|
|
711
|
-
imports.wbg.__wbg_new_0_23cedd11d9b40c9d = function() {
|
|
712
|
-
const ret = new Date();
|
|
713
|
-
return addHeapObject(ret);
|
|
714
|
-
};
|
|
715
|
-
imports.wbg.__wbg_new_1ba21ce319a06297 = function() {
|
|
716
|
-
const ret = new Object();
|
|
717
|
-
return addHeapObject(ret);
|
|
718
|
-
};
|
|
719
|
-
imports.wbg.__wbg_new_25f239778d6112b9 = function() {
|
|
720
|
-
const ret = new Array();
|
|
721
|
-
return addHeapObject(ret);
|
|
722
|
-
};
|
|
723
|
-
imports.wbg.__wbg_new_8a6f238a6ece86ea = function() {
|
|
724
|
-
const ret = new Error();
|
|
725
|
-
return addHeapObject(ret);
|
|
726
|
-
};
|
|
727
|
-
imports.wbg.__wbg_new_b2db8aa2650f793a = function(arg0) {
|
|
728
|
-
const ret = new Date(getObject(arg0));
|
|
729
|
-
return addHeapObject(ret);
|
|
730
|
-
};
|
|
731
|
-
imports.wbg.__wbg_set_3f1d0b984ed272ed = function(arg0, arg1, arg2) {
|
|
732
|
-
getObject(arg0)[takeObject(arg1)] = takeObject(arg2);
|
|
733
|
-
};
|
|
734
|
-
imports.wbg.__wbg_set_7df433eea03a5c14 = function(arg0, arg1, arg2) {
|
|
735
|
-
getObject(arg0)[arg1 >>> 0] = takeObject(arg2);
|
|
736
|
-
};
|
|
737
|
-
imports.wbg.__wbg_stack_0ed75d68575b0f3c = function(arg0, arg1) {
|
|
738
|
-
const ret = getObject(arg1).stack;
|
|
739
|
-
const ptr1 = passStringToWasm0(ret, wasm.__wbindgen_export, wasm.__wbindgen_export2);
|
|
740
|
-
const len1 = WASM_VECTOR_LEN;
|
|
741
|
-
getDataViewMemory0().setInt32(arg0 + 4 * 1, len1, true);
|
|
742
|
-
getDataViewMemory0().setInt32(arg0 + 4 * 0, ptr1, true);
|
|
743
|
-
};
|
|
744
|
-
imports.wbg.__wbindgen_cast_2241b6af4c4b2941 = function(arg0, arg1) {
|
|
745
|
-
// Cast intrinsic for `Ref(String) -> Externref`.
|
|
746
|
-
const ret = getStringFromWasm0(arg0, arg1);
|
|
747
|
-
return addHeapObject(ret);
|
|
748
|
-
};
|
|
749
|
-
imports.wbg.__wbindgen_cast_9ae0607507abb057 = function(arg0) {
|
|
750
|
-
// Cast intrinsic for `I64 -> Externref`.
|
|
751
|
-
const ret = arg0;
|
|
752
|
-
return addHeapObject(ret);
|
|
753
|
-
};
|
|
754
|
-
imports.wbg.__wbindgen_cast_d6cd19b81560fd6e = function(arg0) {
|
|
755
|
-
// Cast intrinsic for `F64 -> Externref`.
|
|
756
|
-
const ret = arg0;
|
|
757
|
-
return addHeapObject(ret);
|
|
758
|
-
};
|
|
759
|
-
imports.wbg.__wbindgen_object_clone_ref = function(arg0) {
|
|
760
|
-
const ret = getObject(arg0);
|
|
761
|
-
return addHeapObject(ret);
|
|
762
|
-
};
|
|
763
|
-
imports.wbg.__wbindgen_object_drop_ref = function(arg0) {
|
|
764
|
-
takeObject(arg0);
|
|
765
|
-
};
|
|
766
|
-
|
|
767
|
-
return imports;
|
|
768
|
-
}
|
|
769
|
-
|
|
770
|
-
function __wbg_finalize_init(instance, module) {
|
|
771
|
-
wasm = instance.exports;
|
|
772
|
-
__wbg_init.__wbindgen_wasm_module = module;
|
|
773
|
-
cachedDataViewMemory0 = null;
|
|
774
|
-
cachedUint8ArrayMemory0 = null;
|
|
775
|
-
|
|
776
|
-
|
|
777
|
-
wasm.__wbindgen_start();
|
|
778
|
-
return wasm;
|
|
875
|
+
return false;
|
|
876
|
+
}
|
|
779
877
|
}
|
|
780
878
|
|
|
781
879
|
function initSync(module) {
|
|
782
880
|
if (wasm !== undefined) return wasm;
|
|
783
881
|
|
|
784
882
|
|
|
785
|
-
if (
|
|
883
|
+
if (module !== undefined) {
|
|
786
884
|
if (Object.getPrototypeOf(module) === Object.prototype) {
|
|
787
885
|
({module} = module)
|
|
788
886
|
} else {
|
|
@@ -802,7 +900,7 @@ async function __wbg_init(module_or_path) {
|
|
|
802
900
|
if (wasm !== undefined) return wasm;
|
|
803
901
|
|
|
804
902
|
|
|
805
|
-
if (
|
|
903
|
+
if (module_or_path !== undefined) {
|
|
806
904
|
if (Object.getPrototypeOf(module_or_path) === Object.prototype) {
|
|
807
905
|
({module_or_path} = module_or_path)
|
|
808
906
|
} else {
|
|
@@ -810,7 +908,7 @@ async function __wbg_init(module_or_path) {
|
|
|
810
908
|
}
|
|
811
909
|
}
|
|
812
910
|
|
|
813
|
-
if (
|
|
911
|
+
if (module_or_path === undefined) {
|
|
814
912
|
module_or_path = new URL('rustledger_wasm_bg.wasm', import.meta.url);
|
|
815
913
|
}
|
|
816
914
|
const imports = __wbg_get_imports();
|
|
@@ -824,5 +922,4 @@ async function __wbg_init(module_or_path) {
|
|
|
824
922
|
return __wbg_finalize_init(instance, module);
|
|
825
923
|
}
|
|
826
924
|
|
|
827
|
-
export { initSync };
|
|
828
|
-
export default __wbg_init;
|
|
925
|
+
export { initSync, __wbg_init as default };
|
package/rustledger_wasm_bg.wasm
CHANGED
|
Binary file
|