@rustledger/wasm 0.2.0 → 0.5.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 +267 -121
- package/rustledger_wasm.js +404 -283
- 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,78 @@ 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
|
+
|
|
223
|
+
/** The kind of reference. */
|
|
224
|
+
export type ReferenceKind = 'account' | 'currency' | 'payee';
|
|
225
|
+
|
|
226
|
+
/** A reference to a symbol in the document. */
|
|
227
|
+
export interface EditorReference {
|
|
228
|
+
range: EditorRange;
|
|
229
|
+
kind: ReferenceKind;
|
|
230
|
+
is_definition: boolean;
|
|
231
|
+
context?: string;
|
|
232
|
+
}
|
|
233
|
+
|
|
234
|
+
/** Result of a find-references request. */
|
|
235
|
+
export interface EditorReferencesResult {
|
|
236
|
+
symbol: string;
|
|
237
|
+
kind: ReferenceKind;
|
|
238
|
+
references: EditorReference[];
|
|
239
|
+
}
|
|
240
|
+
|
|
169
241
|
/**
|
|
170
242
|
* A parsed and validated ledger that caches the parse result.
|
|
171
243
|
* Use this class when you need to perform multiple operations on the same
|
|
@@ -210,67 +282,136 @@ export class ParsedLedger {
|
|
|
210
282
|
|
|
211
283
|
/** Run a native plugin on this ledger. */
|
|
212
284
|
runPlugin(pluginName: string): PluginResult;
|
|
285
|
+
|
|
286
|
+
// =========================================================================
|
|
287
|
+
// Editor Integration (LSP-like features)
|
|
288
|
+
// =========================================================================
|
|
289
|
+
|
|
290
|
+
/** Get completions at the given position. */
|
|
291
|
+
getCompletions(line: number, character: number): EditorCompletionResult;
|
|
292
|
+
|
|
293
|
+
/** Get hover information at the given position. */
|
|
294
|
+
getHoverInfo(line: number, character: number): EditorHoverInfo | null;
|
|
295
|
+
|
|
296
|
+
/** Get the definition location for the symbol at the given position. */
|
|
297
|
+
getDefinition(line: number, character: number): EditorLocation | null;
|
|
298
|
+
|
|
299
|
+
/** Get all document symbols for the outline view. */
|
|
300
|
+
getDocumentSymbols(): EditorDocumentSymbol[];
|
|
301
|
+
|
|
302
|
+
/** Find all references to the symbol at the given position. */
|
|
303
|
+
getReferences(line: number, character: number): EditorReferencesResult | null;
|
|
213
304
|
}
|
|
214
305
|
|
|
215
306
|
|
|
216
307
|
|
|
308
|
+
/**
|
|
309
|
+
* A parsed and validated ledger that caches the parse result.
|
|
310
|
+
*
|
|
311
|
+
* Use this class when you need to perform multiple operations on the same
|
|
312
|
+
* source without re-parsing each time.
|
|
313
|
+
*
|
|
314
|
+
* # Example (JavaScript)
|
|
315
|
+
*
|
|
316
|
+
* ```javascript
|
|
317
|
+
* const ledger = new ParsedLedger(source);
|
|
318
|
+
* if (ledger.isValid()) {
|
|
319
|
+
* const balances = ledger.query("BALANCES");
|
|
320
|
+
* const formatted = ledger.format();
|
|
321
|
+
* }
|
|
322
|
+
* ```
|
|
323
|
+
*/
|
|
217
324
|
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
|
-
|
|
325
|
+
free(): void;
|
|
326
|
+
[Symbol.dispose](): void;
|
|
327
|
+
/**
|
|
328
|
+
* Get account balances (shorthand for query("BALANCES")).
|
|
329
|
+
*/
|
|
330
|
+
balances(): any;
|
|
331
|
+
/**
|
|
332
|
+
* Get the number of directives.
|
|
333
|
+
*/
|
|
334
|
+
directiveCount(): number;
|
|
335
|
+
/**
|
|
336
|
+
* Expand pad directives.
|
|
337
|
+
*/
|
|
338
|
+
expandPads(): any;
|
|
339
|
+
/**
|
|
340
|
+
* Format the ledger source.
|
|
341
|
+
*/
|
|
342
|
+
format(): any;
|
|
343
|
+
/**
|
|
344
|
+
* Get completions at the given position.
|
|
345
|
+
*
|
|
346
|
+
* Returns context-aware completions for accounts, currencies, directives, etc.
|
|
347
|
+
* Uses cached account/currency/payee data for efficiency.
|
|
348
|
+
*/
|
|
349
|
+
getCompletions(line: number, character: number): any;
|
|
350
|
+
/**
|
|
351
|
+
* Get the definition location for the symbol at the given position.
|
|
352
|
+
*
|
|
353
|
+
* Returns the location of the `open` or `commodity` directive for accounts/currencies.
|
|
354
|
+
* Uses cached `LineIndex` for O(log n) position lookups.
|
|
355
|
+
*/
|
|
356
|
+
getDefinition(line: number, character: number): any;
|
|
357
|
+
/**
|
|
358
|
+
* Get the parsed directives.
|
|
359
|
+
*/
|
|
360
|
+
getDirectives(): any;
|
|
361
|
+
/**
|
|
362
|
+
* Get all document symbols for the outline view.
|
|
363
|
+
*
|
|
364
|
+
* Returns a hierarchical list of all directives with their positions.
|
|
365
|
+
* Uses cached `LineIndex` for O(log n) position lookups.
|
|
366
|
+
*/
|
|
367
|
+
getDocumentSymbols(): any;
|
|
368
|
+
/**
|
|
369
|
+
* Get all errors (parse + validation).
|
|
370
|
+
*/
|
|
371
|
+
getErrors(): any;
|
|
372
|
+
/**
|
|
373
|
+
* Get hover information at the given position.
|
|
374
|
+
*
|
|
375
|
+
* Returns documentation for accounts, currencies, and directive keywords.
|
|
376
|
+
*/
|
|
377
|
+
getHoverInfo(line: number, character: number): any;
|
|
378
|
+
/**
|
|
379
|
+
* Get the ledger options.
|
|
380
|
+
*/
|
|
381
|
+
getOptions(): any;
|
|
382
|
+
/**
|
|
383
|
+
* Get parse errors only.
|
|
384
|
+
*/
|
|
385
|
+
getParseErrors(): any;
|
|
386
|
+
/**
|
|
387
|
+
* Find all references to the symbol at the given position.
|
|
388
|
+
*
|
|
389
|
+
* Returns all occurrences of accounts, currencies, or payees in the document.
|
|
390
|
+
* Uses cached data for efficient lookup.
|
|
391
|
+
*/
|
|
392
|
+
getReferences(line: number, character: number): any;
|
|
393
|
+
/**
|
|
394
|
+
* Get validation errors only.
|
|
395
|
+
*/
|
|
396
|
+
getValidationErrors(): any;
|
|
397
|
+
/**
|
|
398
|
+
* Check if the ledger is valid (no parse or validation errors).
|
|
399
|
+
*/
|
|
400
|
+
isValid(): boolean;
|
|
401
|
+
/**
|
|
402
|
+
* Create a new `ParsedLedger` from source text.
|
|
403
|
+
*
|
|
404
|
+
* Parses, interpolates, and validates the source. Call `isValid()` to check for errors.
|
|
405
|
+
*/
|
|
406
|
+
constructor(source: string);
|
|
407
|
+
/**
|
|
408
|
+
* Run a BQL query on this ledger.
|
|
409
|
+
*/
|
|
410
|
+
query(query_str: string): any;
|
|
411
|
+
/**
|
|
412
|
+
* Run a native plugin on this ledger.
|
|
413
|
+
*/
|
|
414
|
+
runPlugin(plugin_name: string): any;
|
|
274
415
|
}
|
|
275
416
|
|
|
276
417
|
/**
|
|
@@ -357,57 +498,62 @@ export function version(): string;
|
|
|
357
498
|
export type InitInput = RequestInfo | URL | Response | BufferSource | WebAssembly.Module;
|
|
358
499
|
|
|
359
500
|
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
|
-
|
|
501
|
+
readonly memory: WebAssembly.Memory;
|
|
502
|
+
readonly __wbg_parsedledger_free: (a: number, b: number) => void;
|
|
503
|
+
readonly balances: (a: number, b: number, c: number) => void;
|
|
504
|
+
readonly bqlCompletions: (a: number, b: number, c: number, d: number) => void;
|
|
505
|
+
readonly expandPads: (a: number, b: number, c: number) => void;
|
|
506
|
+
readonly format: (a: number, b: number, c: number) => void;
|
|
507
|
+
readonly listPlugins: (a: number) => void;
|
|
508
|
+
readonly parse: (a: number, b: number, c: number) => void;
|
|
509
|
+
readonly parsedledger_balances: (a: number, b: number) => void;
|
|
510
|
+
readonly parsedledger_directiveCount: (a: number) => number;
|
|
511
|
+
readonly parsedledger_expandPads: (a: number, b: number) => void;
|
|
512
|
+
readonly parsedledger_format: (a: number, b: number) => void;
|
|
513
|
+
readonly parsedledger_getCompletions: (a: number, b: number, c: number, d: number) => void;
|
|
514
|
+
readonly parsedledger_getDefinition: (a: number, b: number, c: number, d: number) => void;
|
|
515
|
+
readonly parsedledger_getDirectives: (a: number, b: number) => void;
|
|
516
|
+
readonly parsedledger_getDocumentSymbols: (a: number, b: number) => void;
|
|
517
|
+
readonly parsedledger_getErrors: (a: number, b: number) => void;
|
|
518
|
+
readonly parsedledger_getHoverInfo: (a: number, b: number, c: number, d: number) => void;
|
|
519
|
+
readonly parsedledger_getOptions: (a: number, b: number) => void;
|
|
520
|
+
readonly parsedledger_getParseErrors: (a: number, b: number) => void;
|
|
521
|
+
readonly parsedledger_getReferences: (a: number, b: number, c: number, d: number) => void;
|
|
522
|
+
readonly parsedledger_getValidationErrors: (a: number, b: number) => void;
|
|
523
|
+
readonly parsedledger_isValid: (a: number) => number;
|
|
524
|
+
readonly parsedledger_new: (a: number, b: number) => number;
|
|
525
|
+
readonly parsedledger_query: (a: number, b: number, c: number, d: number) => void;
|
|
526
|
+
readonly parsedledger_runPlugin: (a: number, b: number, c: number, d: number) => void;
|
|
527
|
+
readonly query: (a: number, b: number, c: number, d: number, e: number) => void;
|
|
528
|
+
readonly runPlugin: (a: number, b: number, c: number, d: number, e: number) => void;
|
|
529
|
+
readonly validateSource: (a: number, b: number, c: number) => void;
|
|
530
|
+
readonly version: (a: number) => void;
|
|
531
|
+
readonly init: () => void;
|
|
532
|
+
readonly __wbindgen_export: (a: number, b: number) => number;
|
|
533
|
+
readonly __wbindgen_export2: (a: number, b: number, c: number, d: number) => number;
|
|
534
|
+
readonly __wbindgen_export3: (a: number, b: number, c: number) => void;
|
|
535
|
+
readonly __wbindgen_add_to_stack_pointer: (a: number) => number;
|
|
536
|
+
readonly __wbindgen_start: () => void;
|
|
391
537
|
}
|
|
392
538
|
|
|
393
539
|
export type SyncInitInput = BufferSource | WebAssembly.Module;
|
|
394
540
|
|
|
395
541
|
/**
|
|
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
|
-
*/
|
|
542
|
+
* Instantiates the given `module`, which can either be bytes or
|
|
543
|
+
* a precompiled `WebAssembly.Module`.
|
|
544
|
+
*
|
|
545
|
+
* @param {{ module: SyncInitInput }} module - Passing `SyncInitInput` directly is deprecated.
|
|
546
|
+
*
|
|
547
|
+
* @returns {InitOutput}
|
|
548
|
+
*/
|
|
403
549
|
export function initSync(module: { module: SyncInitInput } | SyncInitInput): InitOutput;
|
|
404
550
|
|
|
405
551
|
/**
|
|
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
|
-
*/
|
|
552
|
+
* If `module_or_path` is {RequestInfo} or {URL}, makes a request and
|
|
553
|
+
* for everything else, calls `WebAssembly.instantiate` directly.
|
|
554
|
+
*
|
|
555
|
+
* @param {{ module_or_path: InitInput | Promise<InitInput> }} module_or_path - Passing `InitInput` directly is deprecated.
|
|
556
|
+
*
|
|
557
|
+
* @returns {Promise<InitOutput>}
|
|
558
|
+
*/
|
|
413
559
|
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,21 +160,35 @@ 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
|
+
}
|
|
254
183
|
}
|
|
255
184
|
/**
|
|
256
|
-
* Get
|
|
185
|
+
* Get all errors (parse + validation).
|
|
257
186
|
* @returns {any}
|
|
258
187
|
*/
|
|
259
|
-
|
|
188
|
+
getErrors() {
|
|
260
189
|
try {
|
|
261
190
|
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
|
262
|
-
wasm.
|
|
191
|
+
wasm.parsedledger_getErrors(retptr, this.__wbg_ptr);
|
|
263
192
|
var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
|
|
264
193
|
var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
|
|
265
194
|
var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
|
|
@@ -272,13 +201,17 @@ export class ParsedLedger {
|
|
|
272
201
|
}
|
|
273
202
|
}
|
|
274
203
|
/**
|
|
275
|
-
* Get
|
|
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
|
|
276
209
|
* @returns {any}
|
|
277
210
|
*/
|
|
278
|
-
|
|
211
|
+
getHoverInfo(line, character) {
|
|
279
212
|
try {
|
|
280
213
|
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
|
281
|
-
wasm.
|
|
214
|
+
wasm.parsedledger_getHoverInfo(retptr, this.__wbg_ptr, line, character);
|
|
282
215
|
var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
|
|
283
216
|
var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
|
|
284
217
|
var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
|
|
@@ -291,30 +224,32 @@ export class ParsedLedger {
|
|
|
291
224
|
}
|
|
292
225
|
}
|
|
293
226
|
/**
|
|
294
|
-
*
|
|
295
|
-
*
|
|
296
|
-
* Parses, interpolates, and validates the source. Call `isValid()` to check for errors.
|
|
297
|
-
* @param {string} source
|
|
227
|
+
* Get the ledger options.
|
|
228
|
+
* @returns {any}
|
|
298
229
|
*/
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
|
|
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
|
+
}
|
|
306
244
|
}
|
|
307
245
|
/**
|
|
308
|
-
*
|
|
309
|
-
* @param {string} query_str
|
|
246
|
+
* Get parse errors only.
|
|
310
247
|
* @returns {any}
|
|
311
248
|
*/
|
|
312
|
-
|
|
249
|
+
getParseErrors() {
|
|
313
250
|
try {
|
|
314
251
|
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
|
315
|
-
|
|
316
|
-
const len0 = WASM_VECTOR_LEN;
|
|
317
|
-
wasm.parsedledger_query(retptr, this.__wbg_ptr, ptr0, len0);
|
|
252
|
+
wasm.parsedledger_getParseErrors(retptr, this.__wbg_ptr);
|
|
318
253
|
var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
|
|
319
254
|
var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
|
|
320
255
|
var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
|
|
@@ -327,13 +262,18 @@ export class ParsedLedger {
|
|
|
327
262
|
}
|
|
328
263
|
}
|
|
329
264
|
/**
|
|
330
|
-
*
|
|
265
|
+
* Find all references to the symbol at the given position.
|
|
266
|
+
*
|
|
267
|
+
* Returns all occurrences of accounts, currencies, or payees in the document.
|
|
268
|
+
* Uses cached data for efficient lookup.
|
|
269
|
+
* @param {number} line
|
|
270
|
+
* @param {number} character
|
|
331
271
|
* @returns {any}
|
|
332
272
|
*/
|
|
333
|
-
|
|
273
|
+
getReferences(line, character) {
|
|
334
274
|
try {
|
|
335
275
|
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
|
336
|
-
wasm.
|
|
276
|
+
wasm.parsedledger_getReferences(retptr, this.__wbg_ptr, line, character);
|
|
337
277
|
var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
|
|
338
278
|
var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
|
|
339
279
|
var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
|
|
@@ -346,13 +286,13 @@ export class ParsedLedger {
|
|
|
346
286
|
}
|
|
347
287
|
}
|
|
348
288
|
/**
|
|
349
|
-
* Get
|
|
289
|
+
* Get validation errors only.
|
|
350
290
|
* @returns {any}
|
|
351
291
|
*/
|
|
352
|
-
|
|
292
|
+
getValidationErrors() {
|
|
353
293
|
try {
|
|
354
294
|
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
|
355
|
-
wasm.
|
|
295
|
+
wasm.parsedledger_getValidationErrors(retptr, this.__wbg_ptr);
|
|
356
296
|
var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
|
|
357
297
|
var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
|
|
358
298
|
var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
|
|
@@ -372,6 +312,64 @@ export class ParsedLedger {
|
|
|
372
312
|
const ret = wasm.parsedledger_isValid(this.__wbg_ptr);
|
|
373
313
|
return ret !== 0;
|
|
374
314
|
}
|
|
315
|
+
/**
|
|
316
|
+
* Create a new `ParsedLedger` from source text.
|
|
317
|
+
*
|
|
318
|
+
* Parses, interpolates, and validates the source. Call `isValid()` to check for errors.
|
|
319
|
+
* @param {string} source
|
|
320
|
+
*/
|
|
321
|
+
constructor(source) {
|
|
322
|
+
const ptr0 = passStringToWasm0(source, wasm.__wbindgen_export, wasm.__wbindgen_export2);
|
|
323
|
+
const len0 = WASM_VECTOR_LEN;
|
|
324
|
+
const ret = wasm.parsedledger_new(ptr0, len0);
|
|
325
|
+
this.__wbg_ptr = ret >>> 0;
|
|
326
|
+
ParsedLedgerFinalization.register(this, this.__wbg_ptr, this);
|
|
327
|
+
return this;
|
|
328
|
+
}
|
|
329
|
+
/**
|
|
330
|
+
* Run a BQL query on this ledger.
|
|
331
|
+
* @param {string} query_str
|
|
332
|
+
* @returns {any}
|
|
333
|
+
*/
|
|
334
|
+
query(query_str) {
|
|
335
|
+
try {
|
|
336
|
+
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
|
337
|
+
const ptr0 = passStringToWasm0(query_str, wasm.__wbindgen_export, wasm.__wbindgen_export2);
|
|
338
|
+
const len0 = WASM_VECTOR_LEN;
|
|
339
|
+
wasm.parsedledger_query(retptr, this.__wbg_ptr, ptr0, len0);
|
|
340
|
+
var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
|
|
341
|
+
var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
|
|
342
|
+
var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
|
|
343
|
+
if (r2) {
|
|
344
|
+
throw takeObject(r1);
|
|
345
|
+
}
|
|
346
|
+
return takeObject(r0);
|
|
347
|
+
} finally {
|
|
348
|
+
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
349
|
+
}
|
|
350
|
+
}
|
|
351
|
+
/**
|
|
352
|
+
* Run a native plugin on this ledger.
|
|
353
|
+
* @param {string} plugin_name
|
|
354
|
+
* @returns {any}
|
|
355
|
+
*/
|
|
356
|
+
runPlugin(plugin_name) {
|
|
357
|
+
try {
|
|
358
|
+
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
|
359
|
+
const ptr0 = passStringToWasm0(plugin_name, wasm.__wbindgen_export, wasm.__wbindgen_export2);
|
|
360
|
+
const len0 = WASM_VECTOR_LEN;
|
|
361
|
+
wasm.parsedledger_runPlugin(retptr, this.__wbg_ptr, ptr0, len0);
|
|
362
|
+
var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
|
|
363
|
+
var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
|
|
364
|
+
var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
|
|
365
|
+
if (r2) {
|
|
366
|
+
throw takeObject(r1);
|
|
367
|
+
}
|
|
368
|
+
return takeObject(r0);
|
|
369
|
+
} finally {
|
|
370
|
+
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
371
|
+
}
|
|
372
|
+
}
|
|
375
373
|
}
|
|
376
374
|
if (Symbol.dispose) ParsedLedger.prototype[Symbol.dispose] = ParsedLedger.prototype.free;
|
|
377
375
|
|
|
@@ -640,7 +638,232 @@ export function version() {
|
|
|
640
638
|
}
|
|
641
639
|
}
|
|
642
640
|
|
|
643
|
-
|
|
641
|
+
function __wbg_get_imports() {
|
|
642
|
+
const import0 = {
|
|
643
|
+
__proto__: null,
|
|
644
|
+
__wbg_Error_8c4e43fe74559d73: function(arg0, arg1) {
|
|
645
|
+
const ret = Error(getStringFromWasm0(arg0, arg1));
|
|
646
|
+
return addHeapObject(ret);
|
|
647
|
+
},
|
|
648
|
+
__wbg_String_8f0eb39a4a4c2f66: function(arg0, arg1) {
|
|
649
|
+
const ret = String(getObject(arg1));
|
|
650
|
+
const ptr1 = passStringToWasm0(ret, wasm.__wbindgen_export, wasm.__wbindgen_export2);
|
|
651
|
+
const len1 = WASM_VECTOR_LEN;
|
|
652
|
+
getDataViewMemory0().setInt32(arg0 + 4 * 1, len1, true);
|
|
653
|
+
getDataViewMemory0().setInt32(arg0 + 4 * 0, ptr1, true);
|
|
654
|
+
},
|
|
655
|
+
__wbg___wbindgen_throw_be289d5034ed271b: function(arg0, arg1) {
|
|
656
|
+
throw new Error(getStringFromWasm0(arg0, arg1));
|
|
657
|
+
},
|
|
658
|
+
__wbg_error_7534b8e9a36f1ab4: function(arg0, arg1) {
|
|
659
|
+
let deferred0_0;
|
|
660
|
+
let deferred0_1;
|
|
661
|
+
try {
|
|
662
|
+
deferred0_0 = arg0;
|
|
663
|
+
deferred0_1 = arg1;
|
|
664
|
+
console.error(getStringFromWasm0(arg0, arg1));
|
|
665
|
+
} finally {
|
|
666
|
+
wasm.__wbindgen_export3(deferred0_0, deferred0_1, 1);
|
|
667
|
+
}
|
|
668
|
+
},
|
|
669
|
+
__wbg_getTime_1e3cd1391c5c3995: function(arg0) {
|
|
670
|
+
const ret = getObject(arg0).getTime();
|
|
671
|
+
return ret;
|
|
672
|
+
},
|
|
673
|
+
__wbg_getTimezoneOffset_81776d10a4ec18a8: function(arg0) {
|
|
674
|
+
const ret = getObject(arg0).getTimezoneOffset();
|
|
675
|
+
return ret;
|
|
676
|
+
},
|
|
677
|
+
__wbg_new_0_73afc35eb544e539: function() {
|
|
678
|
+
const ret = new Date();
|
|
679
|
+
return addHeapObject(ret);
|
|
680
|
+
},
|
|
681
|
+
__wbg_new_245cd5c49157e602: function(arg0) {
|
|
682
|
+
const ret = new Date(getObject(arg0));
|
|
683
|
+
return addHeapObject(ret);
|
|
684
|
+
},
|
|
685
|
+
__wbg_new_361308b2356cecd0: function() {
|
|
686
|
+
const ret = new Object();
|
|
687
|
+
return addHeapObject(ret);
|
|
688
|
+
},
|
|
689
|
+
__wbg_new_3eb36ae241fe6f44: function() {
|
|
690
|
+
const ret = new Array();
|
|
691
|
+
return addHeapObject(ret);
|
|
692
|
+
},
|
|
693
|
+
__wbg_new_8a6f238a6ece86ea: function() {
|
|
694
|
+
const ret = new Error();
|
|
695
|
+
return addHeapObject(ret);
|
|
696
|
+
},
|
|
697
|
+
__wbg_set_3f1d0b984ed272ed: function(arg0, arg1, arg2) {
|
|
698
|
+
getObject(arg0)[takeObject(arg1)] = takeObject(arg2);
|
|
699
|
+
},
|
|
700
|
+
__wbg_set_f43e577aea94465b: function(arg0, arg1, arg2) {
|
|
701
|
+
getObject(arg0)[arg1 >>> 0] = takeObject(arg2);
|
|
702
|
+
},
|
|
703
|
+
__wbg_stack_0ed75d68575b0f3c: function(arg0, arg1) {
|
|
704
|
+
const ret = getObject(arg1).stack;
|
|
705
|
+
const ptr1 = passStringToWasm0(ret, wasm.__wbindgen_export, wasm.__wbindgen_export2);
|
|
706
|
+
const len1 = WASM_VECTOR_LEN;
|
|
707
|
+
getDataViewMemory0().setInt32(arg0 + 4 * 1, len1, true);
|
|
708
|
+
getDataViewMemory0().setInt32(arg0 + 4 * 0, ptr1, true);
|
|
709
|
+
},
|
|
710
|
+
__wbindgen_cast_0000000000000001: function(arg0) {
|
|
711
|
+
// Cast intrinsic for `F64 -> Externref`.
|
|
712
|
+
const ret = arg0;
|
|
713
|
+
return addHeapObject(ret);
|
|
714
|
+
},
|
|
715
|
+
__wbindgen_cast_0000000000000002: function(arg0) {
|
|
716
|
+
// Cast intrinsic for `I64 -> Externref`.
|
|
717
|
+
const ret = arg0;
|
|
718
|
+
return addHeapObject(ret);
|
|
719
|
+
},
|
|
720
|
+
__wbindgen_cast_0000000000000003: function(arg0, arg1) {
|
|
721
|
+
// Cast intrinsic for `Ref(String) -> Externref`.
|
|
722
|
+
const ret = getStringFromWasm0(arg0, arg1);
|
|
723
|
+
return addHeapObject(ret);
|
|
724
|
+
},
|
|
725
|
+
__wbindgen_object_clone_ref: function(arg0) {
|
|
726
|
+
const ret = getObject(arg0);
|
|
727
|
+
return addHeapObject(ret);
|
|
728
|
+
},
|
|
729
|
+
__wbindgen_object_drop_ref: function(arg0) {
|
|
730
|
+
takeObject(arg0);
|
|
731
|
+
},
|
|
732
|
+
};
|
|
733
|
+
return {
|
|
734
|
+
__proto__: null,
|
|
735
|
+
"./rustledger_wasm_bg.js": import0,
|
|
736
|
+
};
|
|
737
|
+
}
|
|
738
|
+
|
|
739
|
+
const ParsedLedgerFinalization = (typeof FinalizationRegistry === 'undefined')
|
|
740
|
+
? { register: () => {}, unregister: () => {} }
|
|
741
|
+
: new FinalizationRegistry(ptr => wasm.__wbg_parsedledger_free(ptr >>> 0, 1));
|
|
742
|
+
|
|
743
|
+
function addHeapObject(obj) {
|
|
744
|
+
if (heap_next === heap.length) heap.push(heap.length + 1);
|
|
745
|
+
const idx = heap_next;
|
|
746
|
+
heap_next = heap[idx];
|
|
747
|
+
|
|
748
|
+
heap[idx] = obj;
|
|
749
|
+
return idx;
|
|
750
|
+
}
|
|
751
|
+
|
|
752
|
+
function dropObject(idx) {
|
|
753
|
+
if (idx < 132) return;
|
|
754
|
+
heap[idx] = heap_next;
|
|
755
|
+
heap_next = idx;
|
|
756
|
+
}
|
|
757
|
+
|
|
758
|
+
let cachedDataViewMemory0 = null;
|
|
759
|
+
function getDataViewMemory0() {
|
|
760
|
+
if (cachedDataViewMemory0 === null || cachedDataViewMemory0.buffer.detached === true || (cachedDataViewMemory0.buffer.detached === undefined && cachedDataViewMemory0.buffer !== wasm.memory.buffer)) {
|
|
761
|
+
cachedDataViewMemory0 = new DataView(wasm.memory.buffer);
|
|
762
|
+
}
|
|
763
|
+
return cachedDataViewMemory0;
|
|
764
|
+
}
|
|
765
|
+
|
|
766
|
+
function getStringFromWasm0(ptr, len) {
|
|
767
|
+
ptr = ptr >>> 0;
|
|
768
|
+
return decodeText(ptr, len);
|
|
769
|
+
}
|
|
770
|
+
|
|
771
|
+
let cachedUint8ArrayMemory0 = null;
|
|
772
|
+
function getUint8ArrayMemory0() {
|
|
773
|
+
if (cachedUint8ArrayMemory0 === null || cachedUint8ArrayMemory0.byteLength === 0) {
|
|
774
|
+
cachedUint8ArrayMemory0 = new Uint8Array(wasm.memory.buffer);
|
|
775
|
+
}
|
|
776
|
+
return cachedUint8ArrayMemory0;
|
|
777
|
+
}
|
|
778
|
+
|
|
779
|
+
function getObject(idx) { return heap[idx]; }
|
|
780
|
+
|
|
781
|
+
let heap = new Array(128).fill(undefined);
|
|
782
|
+
heap.push(undefined, null, true, false);
|
|
783
|
+
|
|
784
|
+
let heap_next = heap.length;
|
|
785
|
+
|
|
786
|
+
function passStringToWasm0(arg, malloc, realloc) {
|
|
787
|
+
if (realloc === undefined) {
|
|
788
|
+
const buf = cachedTextEncoder.encode(arg);
|
|
789
|
+
const ptr = malloc(buf.length, 1) >>> 0;
|
|
790
|
+
getUint8ArrayMemory0().subarray(ptr, ptr + buf.length).set(buf);
|
|
791
|
+
WASM_VECTOR_LEN = buf.length;
|
|
792
|
+
return ptr;
|
|
793
|
+
}
|
|
794
|
+
|
|
795
|
+
let len = arg.length;
|
|
796
|
+
let ptr = malloc(len, 1) >>> 0;
|
|
797
|
+
|
|
798
|
+
const mem = getUint8ArrayMemory0();
|
|
799
|
+
|
|
800
|
+
let offset = 0;
|
|
801
|
+
|
|
802
|
+
for (; offset < len; offset++) {
|
|
803
|
+
const code = arg.charCodeAt(offset);
|
|
804
|
+
if (code > 0x7F) break;
|
|
805
|
+
mem[ptr + offset] = code;
|
|
806
|
+
}
|
|
807
|
+
if (offset !== len) {
|
|
808
|
+
if (offset !== 0) {
|
|
809
|
+
arg = arg.slice(offset);
|
|
810
|
+
}
|
|
811
|
+
ptr = realloc(ptr, len, len = offset + arg.length * 3, 1) >>> 0;
|
|
812
|
+
const view = getUint8ArrayMemory0().subarray(ptr + offset, ptr + len);
|
|
813
|
+
const ret = cachedTextEncoder.encodeInto(arg, view);
|
|
814
|
+
|
|
815
|
+
offset += ret.written;
|
|
816
|
+
ptr = realloc(ptr, len, offset, 1) >>> 0;
|
|
817
|
+
}
|
|
818
|
+
|
|
819
|
+
WASM_VECTOR_LEN = offset;
|
|
820
|
+
return ptr;
|
|
821
|
+
}
|
|
822
|
+
|
|
823
|
+
function takeObject(idx) {
|
|
824
|
+
const ret = getObject(idx);
|
|
825
|
+
dropObject(idx);
|
|
826
|
+
return ret;
|
|
827
|
+
}
|
|
828
|
+
|
|
829
|
+
let cachedTextDecoder = new TextDecoder('utf-8', { ignoreBOM: true, fatal: true });
|
|
830
|
+
cachedTextDecoder.decode();
|
|
831
|
+
const MAX_SAFARI_DECODE_BYTES = 2146435072;
|
|
832
|
+
let numBytesDecoded = 0;
|
|
833
|
+
function decodeText(ptr, len) {
|
|
834
|
+
numBytesDecoded += len;
|
|
835
|
+
if (numBytesDecoded >= MAX_SAFARI_DECODE_BYTES) {
|
|
836
|
+
cachedTextDecoder = new TextDecoder('utf-8', { ignoreBOM: true, fatal: true });
|
|
837
|
+
cachedTextDecoder.decode();
|
|
838
|
+
numBytesDecoded = len;
|
|
839
|
+
}
|
|
840
|
+
return cachedTextDecoder.decode(getUint8ArrayMemory0().subarray(ptr, ptr + len));
|
|
841
|
+
}
|
|
842
|
+
|
|
843
|
+
const cachedTextEncoder = new TextEncoder();
|
|
844
|
+
|
|
845
|
+
if (!('encodeInto' in cachedTextEncoder)) {
|
|
846
|
+
cachedTextEncoder.encodeInto = function (arg, view) {
|
|
847
|
+
const buf = cachedTextEncoder.encode(arg);
|
|
848
|
+
view.set(buf);
|
|
849
|
+
return {
|
|
850
|
+
read: arg.length,
|
|
851
|
+
written: buf.length
|
|
852
|
+
};
|
|
853
|
+
};
|
|
854
|
+
}
|
|
855
|
+
|
|
856
|
+
let WASM_VECTOR_LEN = 0;
|
|
857
|
+
|
|
858
|
+
let wasmModule, wasm;
|
|
859
|
+
function __wbg_finalize_init(instance, module) {
|
|
860
|
+
wasm = instance.exports;
|
|
861
|
+
wasmModule = module;
|
|
862
|
+
cachedDataViewMemory0 = null;
|
|
863
|
+
cachedUint8ArrayMemory0 = null;
|
|
864
|
+
wasm.__wbindgen_start();
|
|
865
|
+
return wasm;
|
|
866
|
+
}
|
|
644
867
|
|
|
645
868
|
async function __wbg_load(module, imports) {
|
|
646
869
|
if (typeof Response === 'function' && module instanceof Response) {
|
|
@@ -648,14 +871,12 @@ async function __wbg_load(module, imports) {
|
|
|
648
871
|
try {
|
|
649
872
|
return await WebAssembly.instantiateStreaming(module, imports);
|
|
650
873
|
} catch (e) {
|
|
651
|
-
const validResponse = module.ok &&
|
|
874
|
+
const validResponse = module.ok && expectedResponseType(module.type);
|
|
652
875
|
|
|
653
876
|
if (validResponse && module.headers.get('Content-Type') !== 'application/wasm') {
|
|
654
877
|
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
878
|
|
|
656
|
-
} else {
|
|
657
|
-
throw e;
|
|
658
|
-
}
|
|
879
|
+
} else { throw e; }
|
|
659
880
|
}
|
|
660
881
|
}
|
|
661
882
|
|
|
@@ -670,119 +891,20 @@ async function __wbg_load(module, imports) {
|
|
|
670
891
|
return instance;
|
|
671
892
|
}
|
|
672
893
|
}
|
|
673
|
-
}
|
|
674
894
|
|
|
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);
|
|
895
|
+
function expectedResponseType(type) {
|
|
896
|
+
switch (type) {
|
|
897
|
+
case 'basic': case 'cors': case 'default': return true;
|
|
701
898
|
}
|
|
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;
|
|
899
|
+
return false;
|
|
900
|
+
}
|
|
779
901
|
}
|
|
780
902
|
|
|
781
903
|
function initSync(module) {
|
|
782
904
|
if (wasm !== undefined) return wasm;
|
|
783
905
|
|
|
784
906
|
|
|
785
|
-
if (
|
|
907
|
+
if (module !== undefined) {
|
|
786
908
|
if (Object.getPrototypeOf(module) === Object.prototype) {
|
|
787
909
|
({module} = module)
|
|
788
910
|
} else {
|
|
@@ -802,7 +924,7 @@ async function __wbg_init(module_or_path) {
|
|
|
802
924
|
if (wasm !== undefined) return wasm;
|
|
803
925
|
|
|
804
926
|
|
|
805
|
-
if (
|
|
927
|
+
if (module_or_path !== undefined) {
|
|
806
928
|
if (Object.getPrototypeOf(module_or_path) === Object.prototype) {
|
|
807
929
|
({module_or_path} = module_or_path)
|
|
808
930
|
} else {
|
|
@@ -810,7 +932,7 @@ async function __wbg_init(module_or_path) {
|
|
|
810
932
|
}
|
|
811
933
|
}
|
|
812
934
|
|
|
813
|
-
if (
|
|
935
|
+
if (module_or_path === undefined) {
|
|
814
936
|
module_or_path = new URL('rustledger_wasm_bg.wasm', import.meta.url);
|
|
815
937
|
}
|
|
816
938
|
const imports = __wbg_get_imports();
|
|
@@ -824,5 +946,4 @@ async function __wbg_init(module_or_path) {
|
|
|
824
946
|
return __wbg_finalize_init(instance, module);
|
|
825
947
|
}
|
|
826
948
|
|
|
827
|
-
export { initSync };
|
|
828
|
-
export default __wbg_init;
|
|
949
|
+
export { initSync, __wbg_init as default };
|
package/rustledger_wasm_bg.wasm
CHANGED
|
Binary file
|