fatoority 0.4.4 → 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.
@@ -0,0 +1,616 @@
1
+ // generated by diplomat-tool
2
+ import { Adjustment } from "./Adjustment.mjs"
3
+ import { BindingError } from "./BindingError.mjs"
4
+ import { InvoiceLineItem } from "./InvoiceLineItem.mjs"
5
+ import { OriginalInvoiceRef } from "./OriginalInvoiceRef.mjs"
6
+ import { TaxExemption } from "./TaxExemption.mjs"
7
+ import { VatBreakdown } from "./VatBreakdown.mjs"
8
+ import wasm from "./diplomat-wasm.mjs";
9
+ import * as diplomatRuntime from "./diplomat-runtime.mjs";
10
+
11
+ const LineItemBuilder_box_destroy_registry = new FinalizationRegistry((ptr) => {
12
+ wasm.fatoora_LineItemBuilder_destroy(ptr);
13
+ });
14
+
15
+ export class LineItemBuilder {
16
+ // Internal ptr reference:
17
+ #ptr = null;
18
+
19
+ // Lifetimes are only to keep dependencies alive.
20
+ // Since JS won't garbage collect until there are no incoming edges.
21
+ #selfEdge = [];
22
+
23
+ #internalConstructor(symbol, ptr, selfEdge) {
24
+ if (symbol !== diplomatRuntime.internalConstructor) {
25
+ console.error("LineItemBuilder is an Opaque type. You cannot call its constructor.");
26
+ return;
27
+ }
28
+ this.#ptr = ptr;
29
+ this.#selfEdge = selfEdge;
30
+
31
+ // Are we being borrowed? If not, we can register.
32
+ if (this.#selfEdge.length === 0) {
33
+ LineItemBuilder_box_destroy_registry.register(this, this.#ptr);
34
+ }
35
+
36
+ return this;
37
+ }
38
+ /** @internal */
39
+ get ffiValue() {
40
+ return this.#ptr;
41
+ }
42
+
43
+
44
+ setTaxTotalPresent(present) {
45
+ const diplomatReceive = new diplomatRuntime.DiplomatReceiveBuf(wasm, 5, 4, true);
46
+
47
+
48
+ const result = wasm.fatoora_LineItemBuilder_set_tax_total_present(diplomatReceive.buffer, this.ffiValue, present);
49
+
50
+ try {
51
+ if (!diplomatReceive.resultFlag) {
52
+ const cause = new BindingError(diplomatRuntime.internalConstructor, diplomatRuntime.ptrRead(wasm, diplomatReceive.buffer), []);
53
+ throw new globalThis.Error('BindingError: ' + cause.toString(), { cause });
54
+ }
55
+ }
56
+
57
+ finally {
58
+ diplomatRuntime.FUNCTION_PARAM_ALLOC.clean();
59
+ diplomatReceive.free();
60
+ }
61
+ }
62
+
63
+ setGrossAmountPresent(present) {
64
+ const diplomatReceive = new diplomatRuntime.DiplomatReceiveBuf(wasm, 5, 4, true);
65
+
66
+
67
+ const result = wasm.fatoora_LineItemBuilder_set_gross_amount_present(diplomatReceive.buffer, this.ffiValue, present);
68
+
69
+ try {
70
+ if (!diplomatReceive.resultFlag) {
71
+ const cause = new BindingError(diplomatRuntime.internalConstructor, diplomatRuntime.ptrRead(wasm, diplomatReceive.buffer), []);
72
+ throw new globalThis.Error('BindingError: ' + cause.toString(), { cause });
73
+ }
74
+ }
75
+
76
+ finally {
77
+ diplomatRuntime.FUNCTION_PARAM_ALLOC.clean();
78
+ diplomatReceive.free();
79
+ }
80
+ }
81
+
82
+ static new_() {
83
+
84
+ const result = wasm.fatoora_LineItemBuilder_new();
85
+
86
+ try {
87
+ return new LineItemBuilder(diplomatRuntime.internalConstructor, result, []);
88
+ }
89
+
90
+ finally {
91
+ diplomatRuntime.FUNCTION_PARAM_ALLOC.clean();
92
+ }
93
+ }
94
+
95
+ build() {
96
+ const diplomatReceive = new diplomatRuntime.DiplomatReceiveBuf(wasm, 5, 4, true);
97
+
98
+
99
+ const result = wasm.fatoora_LineItemBuilder_build(diplomatReceive.buffer, this.ffiValue);
100
+
101
+ try {
102
+ if (!diplomatReceive.resultFlag) {
103
+ const cause = new BindingError(diplomatRuntime.internalConstructor, diplomatRuntime.ptrRead(wasm, diplomatReceive.buffer), []);
104
+ throw new globalThis.Error('BindingError: ' + cause.toString(), { cause });
105
+ }
106
+ return new InvoiceLineItem(diplomatRuntime.internalConstructor, diplomatRuntime.ptrRead(wasm, diplomatReceive.buffer), []);
107
+ }
108
+
109
+ finally {
110
+ diplomatRuntime.FUNCTION_PARAM_ALLOC.clean();
111
+ diplomatReceive.free();
112
+ }
113
+ }
114
+
115
+ setItemName(value) {
116
+ let functionCleanupArena = new diplomatRuntime.CleanupArena();
117
+
118
+ const valueSlice = functionCleanupArena.alloc(diplomatRuntime.DiplomatBuf.sliceWrapper(wasm, diplomatRuntime.DiplomatBuf.str8(wasm, value)));
119
+ const diplomatReceive = new diplomatRuntime.DiplomatReceiveBuf(wasm, 5, 4, true);
120
+
121
+
122
+ const result = wasm.fatoora_LineItemBuilder_set_item_name(diplomatReceive.buffer, this.ffiValue, valueSlice.ptr);
123
+
124
+ try {
125
+ if (!diplomatReceive.resultFlag) {
126
+ const cause = new BindingError(diplomatRuntime.internalConstructor, diplomatRuntime.ptrRead(wasm, diplomatReceive.buffer), []);
127
+ throw new globalThis.Error('BindingError: ' + cause.toString(), { cause });
128
+ }
129
+ }
130
+
131
+ finally {
132
+ diplomatRuntime.FUNCTION_PARAM_ALLOC.clean();
133
+ functionCleanupArena.free();
134
+
135
+ diplomatReceive.free();
136
+ }
137
+ }
138
+
139
+ setInvoicedQuantityUnitCode(value) {
140
+ let functionCleanupArena = new diplomatRuntime.CleanupArena();
141
+
142
+ const valueSlice = functionCleanupArena.alloc(diplomatRuntime.DiplomatBuf.sliceWrapper(wasm, diplomatRuntime.DiplomatBuf.str8(wasm, value)));
143
+ const diplomatReceive = new diplomatRuntime.DiplomatReceiveBuf(wasm, 5, 4, true);
144
+
145
+
146
+ const result = wasm.fatoora_LineItemBuilder_set_invoiced_quantity_unit_code(diplomatReceive.buffer, this.ffiValue, valueSlice.ptr);
147
+
148
+ try {
149
+ if (!diplomatReceive.resultFlag) {
150
+ const cause = new BindingError(diplomatRuntime.internalConstructor, diplomatRuntime.ptrRead(wasm, diplomatReceive.buffer), []);
151
+ throw new globalThis.Error('BindingError: ' + cause.toString(), { cause });
152
+ }
153
+ }
154
+
155
+ finally {
156
+ diplomatRuntime.FUNCTION_PARAM_ALLOC.clean();
157
+ functionCleanupArena.free();
158
+
159
+ diplomatReceive.free();
160
+ }
161
+ }
162
+
163
+ setItemPriceBaseQuantityUnitCode(value) {
164
+ let functionCleanupArena = new diplomatRuntime.CleanupArena();
165
+
166
+ const valueSlice = functionCleanupArena.alloc(diplomatRuntime.DiplomatBuf.sliceWrapper(wasm, diplomatRuntime.DiplomatBuf.str8(wasm, value)));
167
+ const diplomatReceive = new diplomatRuntime.DiplomatReceiveBuf(wasm, 5, 4, true);
168
+
169
+
170
+ const result = wasm.fatoora_LineItemBuilder_set_item_price_base_quantity_unit_code(diplomatReceive.buffer, this.ffiValue, valueSlice.ptr);
171
+
172
+ try {
173
+ if (!diplomatReceive.resultFlag) {
174
+ const cause = new BindingError(diplomatRuntime.internalConstructor, diplomatRuntime.ptrRead(wasm, diplomatReceive.buffer), []);
175
+ throw new globalThis.Error('BindingError: ' + cause.toString(), { cause });
176
+ }
177
+ }
178
+
179
+ finally {
180
+ diplomatRuntime.FUNCTION_PARAM_ALLOC.clean();
181
+ functionCleanupArena.free();
182
+
183
+ diplomatReceive.free();
184
+ }
185
+ }
186
+
187
+ setId(value) {
188
+ let functionCleanupArena = new diplomatRuntime.CleanupArena();
189
+
190
+ const valueSlice = functionCleanupArena.alloc(diplomatRuntime.DiplomatBuf.sliceWrapper(wasm, diplomatRuntime.DiplomatBuf.str8(wasm, value)));
191
+ const diplomatReceive = new diplomatRuntime.DiplomatReceiveBuf(wasm, 5, 4, true);
192
+
193
+
194
+ const result = wasm.fatoora_LineItemBuilder_set_id(diplomatReceive.buffer, this.ffiValue, valueSlice.ptr);
195
+
196
+ try {
197
+ if (!diplomatReceive.resultFlag) {
198
+ const cause = new BindingError(diplomatRuntime.internalConstructor, diplomatRuntime.ptrRead(wasm, diplomatReceive.buffer), []);
199
+ throw new globalThis.Error('BindingError: ' + cause.toString(), { cause });
200
+ }
201
+ }
202
+
203
+ finally {
204
+ diplomatRuntime.FUNCTION_PARAM_ALLOC.clean();
205
+ functionCleanupArena.free();
206
+
207
+ diplomatReceive.free();
208
+ }
209
+ }
210
+
211
+ setInvoicedQuantity(value) {
212
+ let functionCleanupArena = new diplomatRuntime.CleanupArena();
213
+
214
+ const valueSlice = functionCleanupArena.alloc(diplomatRuntime.DiplomatBuf.sliceWrapper(wasm, diplomatRuntime.DiplomatBuf.str8(wasm, value)));
215
+ const diplomatReceive = new diplomatRuntime.DiplomatReceiveBuf(wasm, 5, 4, true);
216
+
217
+
218
+ const result = wasm.fatoora_LineItemBuilder_set_invoiced_quantity(diplomatReceive.buffer, this.ffiValue, valueSlice.ptr);
219
+
220
+ try {
221
+ if (!diplomatReceive.resultFlag) {
222
+ const cause = new BindingError(diplomatRuntime.internalConstructor, diplomatRuntime.ptrRead(wasm, diplomatReceive.buffer), []);
223
+ throw new globalThis.Error('BindingError: ' + cause.toString(), { cause });
224
+ }
225
+ }
226
+
227
+ finally {
228
+ diplomatRuntime.FUNCTION_PARAM_ALLOC.clean();
229
+ functionCleanupArena.free();
230
+
231
+ diplomatReceive.free();
232
+ }
233
+ }
234
+
235
+ setItemNetPrice(value) {
236
+ let functionCleanupArena = new diplomatRuntime.CleanupArena();
237
+
238
+ const valueSlice = functionCleanupArena.alloc(diplomatRuntime.DiplomatBuf.sliceWrapper(wasm, diplomatRuntime.DiplomatBuf.str8(wasm, value)));
239
+ const diplomatReceive = new diplomatRuntime.DiplomatReceiveBuf(wasm, 5, 4, true);
240
+
241
+
242
+ const result = wasm.fatoora_LineItemBuilder_set_item_net_price(diplomatReceive.buffer, this.ffiValue, valueSlice.ptr);
243
+
244
+ try {
245
+ if (!diplomatReceive.resultFlag) {
246
+ const cause = new BindingError(diplomatRuntime.internalConstructor, diplomatRuntime.ptrRead(wasm, diplomatReceive.buffer), []);
247
+ throw new globalThis.Error('BindingError: ' + cause.toString(), { cause });
248
+ }
249
+ }
250
+
251
+ finally {
252
+ diplomatRuntime.FUNCTION_PARAM_ALLOC.clean();
253
+ functionCleanupArena.free();
254
+
255
+ diplomatReceive.free();
256
+ }
257
+ }
258
+
259
+ setItemGrossPrice(value) {
260
+ let functionCleanupArena = new diplomatRuntime.CleanupArena();
261
+
262
+ const valueSlice = functionCleanupArena.alloc(diplomatRuntime.DiplomatBuf.sliceWrapper(wasm, diplomatRuntime.DiplomatBuf.str8(wasm, value)));
263
+ const diplomatReceive = new diplomatRuntime.DiplomatReceiveBuf(wasm, 5, 4, true);
264
+
265
+
266
+ const result = wasm.fatoora_LineItemBuilder_set_item_gross_price(diplomatReceive.buffer, this.ffiValue, valueSlice.ptr);
267
+
268
+ try {
269
+ if (!diplomatReceive.resultFlag) {
270
+ const cause = new BindingError(diplomatRuntime.internalConstructor, diplomatRuntime.ptrRead(wasm, diplomatReceive.buffer), []);
271
+ throw new globalThis.Error('BindingError: ' + cause.toString(), { cause });
272
+ }
273
+ }
274
+
275
+ finally {
276
+ diplomatRuntime.FUNCTION_PARAM_ALLOC.clean();
277
+ functionCleanupArena.free();
278
+
279
+ diplomatReceive.free();
280
+ }
281
+ }
282
+
283
+ setItemPriceDiscount(value) {
284
+ let functionCleanupArena = new diplomatRuntime.CleanupArena();
285
+
286
+ const valueSlice = functionCleanupArena.alloc(diplomatRuntime.DiplomatBuf.sliceWrapper(wasm, diplomatRuntime.DiplomatBuf.str8(wasm, value)));
287
+ const diplomatReceive = new diplomatRuntime.DiplomatReceiveBuf(wasm, 5, 4, true);
288
+
289
+
290
+ const result = wasm.fatoora_LineItemBuilder_set_item_price_discount(diplomatReceive.buffer, this.ffiValue, valueSlice.ptr);
291
+
292
+ try {
293
+ if (!diplomatReceive.resultFlag) {
294
+ const cause = new BindingError(diplomatRuntime.internalConstructor, diplomatRuntime.ptrRead(wasm, diplomatReceive.buffer), []);
295
+ throw new globalThis.Error('BindingError: ' + cause.toString(), { cause });
296
+ }
297
+ }
298
+
299
+ finally {
300
+ diplomatRuntime.FUNCTION_PARAM_ALLOC.clean();
301
+ functionCleanupArena.free();
302
+
303
+ diplomatReceive.free();
304
+ }
305
+ }
306
+
307
+ setItemPriceBaseQuantity(value) {
308
+ let functionCleanupArena = new diplomatRuntime.CleanupArena();
309
+
310
+ const valueSlice = functionCleanupArena.alloc(diplomatRuntime.DiplomatBuf.sliceWrapper(wasm, diplomatRuntime.DiplomatBuf.str8(wasm, value)));
311
+ const diplomatReceive = new diplomatRuntime.DiplomatReceiveBuf(wasm, 5, 4, true);
312
+
313
+
314
+ const result = wasm.fatoora_LineItemBuilder_set_item_price_base_quantity(diplomatReceive.buffer, this.ffiValue, valueSlice.ptr);
315
+
316
+ try {
317
+ if (!diplomatReceive.resultFlag) {
318
+ const cause = new BindingError(diplomatRuntime.internalConstructor, diplomatRuntime.ptrRead(wasm, diplomatReceive.buffer), []);
319
+ throw new globalThis.Error('BindingError: ' + cause.toString(), { cause });
320
+ }
321
+ }
322
+
323
+ finally {
324
+ diplomatRuntime.FUNCTION_PARAM_ALLOC.clean();
325
+ functionCleanupArena.free();
326
+
327
+ diplomatReceive.free();
328
+ }
329
+ }
330
+
331
+ setLineNetAmount(value) {
332
+ let functionCleanupArena = new diplomatRuntime.CleanupArena();
333
+
334
+ const valueSlice = functionCleanupArena.alloc(diplomatRuntime.DiplomatBuf.sliceWrapper(wasm, diplomatRuntime.DiplomatBuf.str8(wasm, value)));
335
+ const diplomatReceive = new diplomatRuntime.DiplomatReceiveBuf(wasm, 5, 4, true);
336
+
337
+
338
+ const result = wasm.fatoora_LineItemBuilder_set_line_net_amount(diplomatReceive.buffer, this.ffiValue, valueSlice.ptr);
339
+
340
+ try {
341
+ if (!diplomatReceive.resultFlag) {
342
+ const cause = new BindingError(diplomatRuntime.internalConstructor, diplomatRuntime.ptrRead(wasm, diplomatReceive.buffer), []);
343
+ throw new globalThis.Error('BindingError: ' + cause.toString(), { cause });
344
+ }
345
+ }
346
+
347
+ finally {
348
+ diplomatRuntime.FUNCTION_PARAM_ALLOC.clean();
349
+ functionCleanupArena.free();
350
+
351
+ diplomatReceive.free();
352
+ }
353
+ }
354
+
355
+ setLineVatAmount(value) {
356
+ let functionCleanupArena = new diplomatRuntime.CleanupArena();
357
+
358
+ const valueSlice = functionCleanupArena.alloc(diplomatRuntime.DiplomatBuf.sliceWrapper(wasm, diplomatRuntime.DiplomatBuf.str8(wasm, value)));
359
+ const diplomatReceive = new diplomatRuntime.DiplomatReceiveBuf(wasm, 5, 4, true);
360
+
361
+
362
+ const result = wasm.fatoora_LineItemBuilder_set_line_vat_amount(diplomatReceive.buffer, this.ffiValue, valueSlice.ptr);
363
+
364
+ try {
365
+ if (!diplomatReceive.resultFlag) {
366
+ const cause = new BindingError(diplomatRuntime.internalConstructor, diplomatRuntime.ptrRead(wasm, diplomatReceive.buffer), []);
367
+ throw new globalThis.Error('BindingError: ' + cause.toString(), { cause });
368
+ }
369
+ }
370
+
371
+ finally {
372
+ diplomatRuntime.FUNCTION_PARAM_ALLOC.clean();
373
+ functionCleanupArena.free();
374
+
375
+ diplomatReceive.free();
376
+ }
377
+ }
378
+
379
+ setLineAmountWithVat(value) {
380
+ let functionCleanupArena = new diplomatRuntime.CleanupArena();
381
+
382
+ const valueSlice = functionCleanupArena.alloc(diplomatRuntime.DiplomatBuf.sliceWrapper(wasm, diplomatRuntime.DiplomatBuf.str8(wasm, value)));
383
+ const diplomatReceive = new diplomatRuntime.DiplomatReceiveBuf(wasm, 5, 4, true);
384
+
385
+
386
+ const result = wasm.fatoora_LineItemBuilder_set_line_amount_with_vat(diplomatReceive.buffer, this.ffiValue, valueSlice.ptr);
387
+
388
+ try {
389
+ if (!diplomatReceive.resultFlag) {
390
+ const cause = new BindingError(diplomatRuntime.internalConstructor, diplomatRuntime.ptrRead(wasm, diplomatReceive.buffer), []);
391
+ throw new globalThis.Error('BindingError: ' + cause.toString(), { cause });
392
+ }
393
+ }
394
+
395
+ finally {
396
+ diplomatRuntime.FUNCTION_PARAM_ALLOC.clean();
397
+ functionCleanupArena.free();
398
+
399
+ diplomatReceive.free();
400
+ }
401
+ }
402
+
403
+ setVatRate(value) {
404
+ let functionCleanupArena = new diplomatRuntime.CleanupArena();
405
+
406
+ const valueSlice = functionCleanupArena.alloc(diplomatRuntime.DiplomatBuf.sliceWrapper(wasm, diplomatRuntime.DiplomatBuf.str8(wasm, value)));
407
+ const diplomatReceive = new diplomatRuntime.DiplomatReceiveBuf(wasm, 5, 4, true);
408
+
409
+
410
+ const result = wasm.fatoora_LineItemBuilder_set_vat_rate(diplomatReceive.buffer, this.ffiValue, valueSlice.ptr);
411
+
412
+ try {
413
+ if (!diplomatReceive.resultFlag) {
414
+ const cause = new BindingError(diplomatRuntime.internalConstructor, diplomatRuntime.ptrRead(wasm, diplomatReceive.buffer), []);
415
+ throw new globalThis.Error('BindingError: ' + cause.toString(), { cause });
416
+ }
417
+ }
418
+
419
+ finally {
420
+ diplomatRuntime.FUNCTION_PARAM_ALLOC.clean();
421
+ functionCleanupArena.free();
422
+
423
+ diplomatReceive.free();
424
+ }
425
+ }
426
+
427
+ setVatCategory(value) {
428
+ const diplomatReceive = new diplomatRuntime.DiplomatReceiveBuf(wasm, 5, 4, true);
429
+
430
+
431
+ const result = wasm.fatoora_LineItemBuilder_set_vat_category(diplomatReceive.buffer, this.ffiValue, value);
432
+
433
+ try {
434
+ if (!diplomatReceive.resultFlag) {
435
+ const cause = new BindingError(diplomatRuntime.internalConstructor, diplomatRuntime.ptrRead(wasm, diplomatReceive.buffer), []);
436
+ throw new globalThis.Error('BindingError: ' + cause.toString(), { cause });
437
+ }
438
+ }
439
+
440
+ finally {
441
+ diplomatRuntime.FUNCTION_PARAM_ALLOC.clean();
442
+ diplomatReceive.free();
443
+ }
444
+ }
445
+
446
+ setExemption(value) {
447
+ const diplomatReceive = new diplomatRuntime.DiplomatReceiveBuf(wasm, 5, 4, true);
448
+
449
+
450
+ const result = wasm.fatoora_LineItemBuilder_set_exemption(diplomatReceive.buffer, this.ffiValue, value instanceof TaxExemption ? value.ffiValue : typeError('value', 'TaxExemption'));
451
+
452
+ try {
453
+ if (!diplomatReceive.resultFlag) {
454
+ const cause = new BindingError(diplomatRuntime.internalConstructor, diplomatRuntime.ptrRead(wasm, diplomatReceive.buffer), []);
455
+ throw new globalThis.Error('BindingError: ' + cause.toString(), { cause });
456
+ }
457
+ }
458
+
459
+ finally {
460
+ diplomatRuntime.FUNCTION_PARAM_ALLOC.clean();
461
+ diplomatReceive.free();
462
+ }
463
+ }
464
+
465
+ addAllowance(value) {
466
+ const diplomatReceive = new diplomatRuntime.DiplomatReceiveBuf(wasm, 5, 4, true);
467
+
468
+
469
+ const result = wasm.fatoora_LineItemBuilder_add_allowance(diplomatReceive.buffer, this.ffiValue, value instanceof Adjustment ? value.ffiValue : typeError('value', 'Adjustment'));
470
+
471
+ try {
472
+ if (!diplomatReceive.resultFlag) {
473
+ const cause = new BindingError(diplomatRuntime.internalConstructor, diplomatRuntime.ptrRead(wasm, diplomatReceive.buffer), []);
474
+ throw new globalThis.Error('BindingError: ' + cause.toString(), { cause });
475
+ }
476
+ }
477
+
478
+ finally {
479
+ diplomatRuntime.FUNCTION_PARAM_ALLOC.clean();
480
+ diplomatReceive.free();
481
+ }
482
+ }
483
+
484
+ addCharge(value) {
485
+ const diplomatReceive = new diplomatRuntime.DiplomatReceiveBuf(wasm, 5, 4, true);
486
+
487
+
488
+ const result = wasm.fatoora_LineItemBuilder_add_charge(diplomatReceive.buffer, this.ffiValue, value instanceof Adjustment ? value.ffiValue : typeError('value', 'Adjustment'));
489
+
490
+ try {
491
+ if (!diplomatReceive.resultFlag) {
492
+ const cause = new BindingError(diplomatRuntime.internalConstructor, diplomatRuntime.ptrRead(wasm, diplomatReceive.buffer), []);
493
+ throw new globalThis.Error('BindingError: ' + cause.toString(), { cause });
494
+ }
495
+ }
496
+
497
+ finally {
498
+ diplomatRuntime.FUNCTION_PARAM_ALLOC.clean();
499
+ diplomatReceive.free();
500
+ }
501
+ }
502
+
503
+ addDocumentReference(value) {
504
+ const diplomatReceive = new diplomatRuntime.DiplomatReceiveBuf(wasm, 5, 4, true);
505
+
506
+
507
+ const result = wasm.fatoora_LineItemBuilder_add_document_reference(diplomatReceive.buffer, this.ffiValue, value instanceof OriginalInvoiceRef ? value.ffiValue : typeError('value', 'OriginalInvoiceRef'));
508
+
509
+ try {
510
+ if (!diplomatReceive.resultFlag) {
511
+ const cause = new BindingError(diplomatRuntime.internalConstructor, diplomatRuntime.ptrRead(wasm, diplomatReceive.buffer), []);
512
+ throw new globalThis.Error('BindingError: ' + cause.toString(), { cause });
513
+ }
514
+ }
515
+
516
+ finally {
517
+ diplomatRuntime.FUNCTION_PARAM_ALLOC.clean();
518
+ diplomatReceive.free();
519
+ }
520
+ }
521
+
522
+ addTaxSubtotal(value) {
523
+ const diplomatReceive = new diplomatRuntime.DiplomatReceiveBuf(wasm, 5, 4, true);
524
+
525
+
526
+ const result = wasm.fatoora_LineItemBuilder_add_tax_subtotal(diplomatReceive.buffer, this.ffiValue, value instanceof VatBreakdown ? value.ffiValue : typeError('value', 'VatBreakdown'));
527
+
528
+ try {
529
+ if (!diplomatReceive.resultFlag) {
530
+ const cause = new BindingError(diplomatRuntime.internalConstructor, diplomatRuntime.ptrRead(wasm, diplomatReceive.buffer), []);
531
+ throw new globalThis.Error('BindingError: ' + cause.toString(), { cause });
532
+ }
533
+ }
534
+
535
+ finally {
536
+ diplomatRuntime.FUNCTION_PARAM_ALLOC.clean();
537
+ diplomatReceive.free();
538
+ }
539
+ }
540
+
541
+ setItemSellerIdentifier(value, scheme) {
542
+ let functionCleanupArena = new diplomatRuntime.CleanupArena();
543
+
544
+ const valueSlice = functionCleanupArena.alloc(diplomatRuntime.DiplomatBuf.sliceWrapper(wasm, diplomatRuntime.DiplomatBuf.str8(wasm, value)));
545
+ const diplomatReceive = new diplomatRuntime.DiplomatReceiveBuf(wasm, 5, 4, true);
546
+
547
+
548
+ const result = wasm.fatoora_LineItemBuilder_set_item_seller_identifier(diplomatReceive.buffer, this.ffiValue, valueSlice.ptr, diplomatRuntime.optionToBufferForCalling(wasm, scheme, 8, 4, functionCleanupArena, (arrayBuffer, offset, jsValue) => [functionCleanupArena.alloc(diplomatRuntime.DiplomatBuf.str8(wasm, jsValue)).writePtrLenToArrayBuffer(arrayBuffer, offset + 0)]));
549
+
550
+ try {
551
+ if (!diplomatReceive.resultFlag) {
552
+ const cause = new BindingError(diplomatRuntime.internalConstructor, diplomatRuntime.ptrRead(wasm, diplomatReceive.buffer), []);
553
+ throw new globalThis.Error('BindingError: ' + cause.toString(), { cause });
554
+ }
555
+ }
556
+
557
+ finally {
558
+ diplomatRuntime.FUNCTION_PARAM_ALLOC.clean();
559
+ functionCleanupArena.free();
560
+
561
+ diplomatReceive.free();
562
+ }
563
+ }
564
+
565
+ setItemBuyerIdentifier(value, scheme) {
566
+ let functionCleanupArena = new diplomatRuntime.CleanupArena();
567
+
568
+ const valueSlice = functionCleanupArena.alloc(diplomatRuntime.DiplomatBuf.sliceWrapper(wasm, diplomatRuntime.DiplomatBuf.str8(wasm, value)));
569
+ const diplomatReceive = new diplomatRuntime.DiplomatReceiveBuf(wasm, 5, 4, true);
570
+
571
+
572
+ const result = wasm.fatoora_LineItemBuilder_set_item_buyer_identifier(diplomatReceive.buffer, this.ffiValue, valueSlice.ptr, diplomatRuntime.optionToBufferForCalling(wasm, scheme, 8, 4, functionCleanupArena, (arrayBuffer, offset, jsValue) => [functionCleanupArena.alloc(diplomatRuntime.DiplomatBuf.str8(wasm, jsValue)).writePtrLenToArrayBuffer(arrayBuffer, offset + 0)]));
573
+
574
+ try {
575
+ if (!diplomatReceive.resultFlag) {
576
+ const cause = new BindingError(diplomatRuntime.internalConstructor, diplomatRuntime.ptrRead(wasm, diplomatReceive.buffer), []);
577
+ throw new globalThis.Error('BindingError: ' + cause.toString(), { cause });
578
+ }
579
+ }
580
+
581
+ finally {
582
+ diplomatRuntime.FUNCTION_PARAM_ALLOC.clean();
583
+ functionCleanupArena.free();
584
+
585
+ diplomatReceive.free();
586
+ }
587
+ }
588
+
589
+ setItemStandardIdentifier(value, scheme) {
590
+ let functionCleanupArena = new diplomatRuntime.CleanupArena();
591
+
592
+ const valueSlice = functionCleanupArena.alloc(diplomatRuntime.DiplomatBuf.sliceWrapper(wasm, diplomatRuntime.DiplomatBuf.str8(wasm, value)));
593
+ const diplomatReceive = new diplomatRuntime.DiplomatReceiveBuf(wasm, 5, 4, true);
594
+
595
+
596
+ const result = wasm.fatoora_LineItemBuilder_set_item_standard_identifier(diplomatReceive.buffer, this.ffiValue, valueSlice.ptr, diplomatRuntime.optionToBufferForCalling(wasm, scheme, 8, 4, functionCleanupArena, (arrayBuffer, offset, jsValue) => [functionCleanupArena.alloc(diplomatRuntime.DiplomatBuf.str8(wasm, jsValue)).writePtrLenToArrayBuffer(arrayBuffer, offset + 0)]));
597
+
598
+ try {
599
+ if (!diplomatReceive.resultFlag) {
600
+ const cause = new BindingError(diplomatRuntime.internalConstructor, diplomatRuntime.ptrRead(wasm, diplomatReceive.buffer), []);
601
+ throw new globalThis.Error('BindingError: ' + cause.toString(), { cause });
602
+ }
603
+ }
604
+
605
+ finally {
606
+ diplomatRuntime.FUNCTION_PARAM_ALLOC.clean();
607
+ functionCleanupArena.free();
608
+
609
+ diplomatReceive.free();
610
+ }
611
+ }
612
+
613
+ constructor(symbol, ptr, selfEdge) {
614
+ return this.#internalConstructor(...arguments)
615
+ }
616
+ }
@@ -12,6 +12,12 @@ export class OriginalInvoiceRef {
12
12
  constructor();
13
13
 
14
14
 
15
+ static new_(id: string, uuid: string | null, date: string | null, time: string | null, typeCode: string | null): OriginalInvoiceRef;
16
+
17
+ issueTime(): Text | null;
18
+
19
+ documentTypeCode(): Text | null;
20
+
15
21
  id(): string;
16
22
 
17
23
  uuid(): Text | null;