tigerbeetle-node 0.5.2 → 0.8.1

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.
Files changed (61) hide show
  1. package/README.md +97 -78
  2. package/dist/benchmark.js +96 -94
  3. package/dist/benchmark.js.map +1 -1
  4. package/dist/index.d.ts +82 -82
  5. package/dist/index.js +74 -93
  6. package/dist/index.js.map +1 -1
  7. package/dist/test.js +134 -111
  8. package/dist/test.js.map +1 -1
  9. package/package.json +3 -2
  10. package/scripts/download_node_headers.sh +3 -1
  11. package/src/benchmark.ts +114 -118
  12. package/src/index.ts +102 -111
  13. package/src/node.zig +55 -63
  14. package/src/test.ts +146 -125
  15. package/src/tigerbeetle/scripts/benchmark.bat +46 -0
  16. package/src/tigerbeetle/scripts/benchmark.sh +5 -0
  17. package/src/tigerbeetle/scripts/install_zig.bat +109 -109
  18. package/src/tigerbeetle/scripts/install_zig.sh +8 -4
  19. package/src/tigerbeetle/scripts/vopr.bat +47 -47
  20. package/src/tigerbeetle/scripts/vopr.sh +2 -2
  21. package/src/tigerbeetle/src/benchmark.zig +65 -102
  22. package/src/tigerbeetle/src/cli.zig +39 -18
  23. package/src/tigerbeetle/src/config.zig +44 -25
  24. package/src/tigerbeetle/src/demo.zig +2 -15
  25. package/src/tigerbeetle/src/demo_01_create_accounts.zig +10 -10
  26. package/src/tigerbeetle/src/demo_03_create_transfers.zig +5 -3
  27. package/src/tigerbeetle/src/{demo_04_create_transfers_two_phase_commit.zig → demo_04_create_pending_transfers.zig} +18 -12
  28. package/src/tigerbeetle/src/demo_05_post_pending_transfers.zig +37 -0
  29. package/src/tigerbeetle/src/demo_06_void_pending_transfers.zig +24 -0
  30. package/src/tigerbeetle/src/demo_07_lookup_transfers.zig +1 -1
  31. package/src/tigerbeetle/src/io/benchmark.zig +24 -49
  32. package/src/tigerbeetle/src/io/darwin.zig +175 -44
  33. package/src/tigerbeetle/src/io/linux.zig +177 -72
  34. package/src/tigerbeetle/src/io/test.zig +61 -39
  35. package/src/tigerbeetle/src/io/windows.zig +1161 -0
  36. package/src/tigerbeetle/src/io.zig +2 -0
  37. package/src/tigerbeetle/src/main.zig +31 -10
  38. package/src/tigerbeetle/src/message_bus.zig +49 -61
  39. package/src/tigerbeetle/src/message_pool.zig +66 -57
  40. package/src/tigerbeetle/src/ring_buffer.zig +55 -3
  41. package/src/tigerbeetle/src/simulator.zig +108 -12
  42. package/src/tigerbeetle/src/state_machine.zig +1813 -816
  43. package/src/tigerbeetle/src/storage.zig +0 -230
  44. package/src/tigerbeetle/src/test/cluster.zig +168 -38
  45. package/src/tigerbeetle/src/test/message_bus.zig +4 -3
  46. package/src/tigerbeetle/src/test/network.zig +13 -16
  47. package/src/tigerbeetle/src/test/packet_simulator.zig +14 -1
  48. package/src/tigerbeetle/src/test/state_checker.zig +6 -3
  49. package/src/tigerbeetle/src/test/state_machine.zig +8 -7
  50. package/src/tigerbeetle/src/test/storage.zig +99 -40
  51. package/src/tigerbeetle/src/tigerbeetle.zig +108 -101
  52. package/src/tigerbeetle/src/time.zig +58 -11
  53. package/src/tigerbeetle/src/vsr/client.zig +18 -32
  54. package/src/tigerbeetle/src/vsr/clock.zig +1 -1
  55. package/src/tigerbeetle/src/vsr/journal.zig +1388 -464
  56. package/src/tigerbeetle/src/vsr/replica.zig +1340 -576
  57. package/src/tigerbeetle/src/vsr.zig +452 -40
  58. package/src/translate.zig +10 -0
  59. package/src/tigerbeetle/src/demo_05_accept_transfers.zig +0 -23
  60. package/src/tigerbeetle/src/demo_06_reject_transfers.zig +0 -17
  61. package/src/tigerbeetle/src/format_test.zig +0 -69
package/dist/test.js CHANGED
@@ -13,28 +13,28 @@ const Zeroed32Bytes = Buffer.alloc(32, 0);
13
13
  const Zeroed48Bytes = Buffer.alloc(48, 0);
14
14
  const accountA = {
15
15
  id: 17n,
16
- reserved: Zeroed48Bytes,
17
16
  user_data: 0n,
17
+ reserved: Zeroed48Bytes,
18
+ ledger: 1,
18
19
  code: 718,
19
- unit: 1,
20
20
  flags: 0,
21
- credits_accepted: 0n,
22
- credits_reserved: 0n,
23
- debits_accepted: 0n,
24
- debits_reserved: 0n,
21
+ debits_pending: 0n,
22
+ debits_posted: 0n,
23
+ credits_pending: 0n,
24
+ credits_posted: 0n,
25
25
  timestamp: 0n
26
26
  };
27
27
  const accountB = {
28
28
  id: 19n,
29
- reserved: Zeroed48Bytes,
30
29
  user_data: 0n,
30
+ reserved: Zeroed48Bytes,
31
+ ledger: 1,
31
32
  code: 719,
32
- unit: 1,
33
33
  flags: 0,
34
- credits_accepted: 0n,
35
- credits_reserved: 0n,
36
- debits_accepted: 0n,
37
- debits_reserved: 0n,
34
+ debits_pending: 0n,
35
+ debits_posted: 0n,
36
+ credits_pending: 0n,
37
+ credits_posted: 0n,
38
38
  timestamp: 0n
39
39
  };
40
40
  const tests = [];
@@ -44,27 +44,24 @@ function test(name, fn) {
44
44
  test.skip = (name, fn) => {
45
45
  console.log(name + ': SKIPPED');
46
46
  };
47
- test('range checks `unit` and `code` on Account to be u16', async () => {
48
- const account = { ...accountA, id: 0n, unit: 65535 + 1 };
49
- const unitError = await client.createAccounts([account]).catch(error => error);
50
- assert_1.default.strictEqual(unitError.message, 'unit must be a u16.');
51
- account.unit = 0;
47
+ test('range check `code` on Account to be u16', async () => {
48
+ const account = { ...accountA, id: 0n };
52
49
  account.code = 65535 + 1;
53
50
  const codeError = await client.createAccounts([account]).catch(error => error);
54
51
  assert_1.default.strictEqual(codeError.message, 'code must be a u16.');
55
- const accounts = await client.lookupAccounts([0n]);
52
+ const accounts = await client.lookupAccounts([account.id]);
56
53
  assert_1.default.strictEqual(accounts.length, 0);
57
54
  });
58
55
  test('can create accounts', async () => {
59
56
  const errors = await client.createAccounts([accountA]);
60
57
  assert_1.default.strictEqual(errors.length, 0);
61
58
  });
62
- test('can return error', async () => {
59
+ test('can return error on account', async () => {
63
60
  const errors = await client.createAccounts([accountA, accountB]);
64
61
  assert_1.default.strictEqual(errors.length, 1);
65
62
  assert_1.default.deepStrictEqual(errors[0], { index: 0, code: _1.CreateAccountError.exists });
66
63
  });
67
- test('throws error if timestamp is not set to 0n', async () => {
64
+ test('throws error if timestamp is not set to 0n on account', async () => {
68
65
  const account = { ...accountA, timestamp: 2n, id: 3n };
69
66
  await assert_1.default.rejects(client.createAccounts([account]));
70
67
  });
@@ -76,82 +73,86 @@ test('can lookup accounts', async () => {
76
73
  assert_1.default.ok(account1.reserved.equals(Zeroed48Bytes));
77
74
  assert_1.default.strictEqual(account1.user_data, 0n);
78
75
  assert_1.default.strictEqual(account1.code, 718);
79
- assert_1.default.strictEqual(account1.unit, 1);
76
+ assert_1.default.strictEqual(account1.ledger, 1);
80
77
  assert_1.default.strictEqual(account1.flags, 0);
81
- assert_1.default.strictEqual(account1.credits_accepted, 0n);
82
- assert_1.default.strictEqual(account1.credits_reserved, 0n);
83
- assert_1.default.strictEqual(account1.debits_accepted, 0n);
84
- assert_1.default.strictEqual(account1.debits_reserved, 0n);
78
+ assert_1.default.strictEqual(account1.credits_posted, 0n);
79
+ assert_1.default.strictEqual(account1.credits_pending, 0n);
80
+ assert_1.default.strictEqual(account1.debits_posted, 0n);
81
+ assert_1.default.strictEqual(account1.debits_pending, 0n);
85
82
  assert_1.default.ok(account1.timestamp > 0n);
86
83
  const account2 = accounts[1];
87
84
  assert_1.default.strictEqual(account2.id, 19n);
88
85
  assert_1.default.ok(account2.reserved.equals(Zeroed48Bytes));
89
86
  assert_1.default.strictEqual(account2.user_data, 0n);
90
87
  assert_1.default.strictEqual(account2.code, 719);
91
- assert_1.default.strictEqual(account2.unit, 1);
88
+ assert_1.default.strictEqual(account2.ledger, 1);
92
89
  assert_1.default.strictEqual(account2.flags, 0);
93
- assert_1.default.strictEqual(account2.credits_accepted, 0n);
94
- assert_1.default.strictEqual(account2.credits_reserved, 0n);
95
- assert_1.default.strictEqual(account2.debits_accepted, 0n);
96
- assert_1.default.strictEqual(account2.debits_reserved, 0n);
90
+ assert_1.default.strictEqual(account2.credits_posted, 0n);
91
+ assert_1.default.strictEqual(account2.credits_pending, 0n);
92
+ assert_1.default.strictEqual(account2.debits_posted, 0n);
93
+ assert_1.default.strictEqual(account2.debits_pending, 0n);
97
94
  assert_1.default.ok(account2.timestamp > 0n);
98
95
  });
99
96
  test('can create a transfer', async () => {
100
97
  const transfer = {
101
- id: 0n,
102
- amount: 100n,
103
- code: 1,
104
- credit_account_id: accountA.id,
98
+ id: 1n,
105
99
  debit_account_id: accountB.id,
106
- flags: 0,
100
+ credit_account_id: accountA.id,
107
101
  user_data: 0n,
108
- reserved: Zeroed32Bytes,
102
+ reserved: 0n,
103
+ pending_id: 0n,
109
104
  timeout: 0n,
105
+ ledger: 1,
106
+ code: 1,
107
+ flags: 0,
108
+ amount: 100n,
110
109
  timestamp: 0n,
111
110
  };
112
111
  const errors = await client.createTransfers([transfer]);
113
112
  assert_1.default.strictEqual(errors.length, 0);
114
113
  const accounts = await client.lookupAccounts([accountA.id, accountB.id]);
115
114
  assert_1.default.strictEqual(accounts.length, 2);
116
- assert_1.default.strictEqual(accounts[0].credits_accepted, 100n);
117
- assert_1.default.strictEqual(accounts[0].credits_reserved, 0n);
118
- assert_1.default.strictEqual(accounts[0].debits_accepted, 0n);
119
- assert_1.default.strictEqual(accounts[0].debits_reserved, 0n);
120
- assert_1.default.strictEqual(accounts[1].credits_accepted, 0n);
121
- assert_1.default.strictEqual(accounts[1].credits_reserved, 0n);
122
- assert_1.default.strictEqual(accounts[1].debits_accepted, 100n);
123
- assert_1.default.strictEqual(accounts[1].debits_reserved, 0n);
115
+ assert_1.default.strictEqual(accounts[0].credits_posted, 100n);
116
+ assert_1.default.strictEqual(accounts[0].credits_pending, 0n);
117
+ assert_1.default.strictEqual(accounts[0].debits_posted, 0n);
118
+ assert_1.default.strictEqual(accounts[0].debits_pending, 0n);
119
+ assert_1.default.strictEqual(accounts[1].credits_posted, 0n);
120
+ assert_1.default.strictEqual(accounts[1].credits_pending, 0n);
121
+ assert_1.default.strictEqual(accounts[1].debits_posted, 100n);
122
+ assert_1.default.strictEqual(accounts[1].debits_pending, 0n);
124
123
  });
125
124
  test('can create a two-phase transfer', async () => {
126
125
  let flags = 0;
127
- flags |= _1.TransferFlags.two_phase_commit;
126
+ flags |= _1.TransferFlags.pending;
128
127
  const transfer = {
129
- id: 1n,
130
- amount: 50n,
131
- code: 1,
132
- credit_account_id: accountA.id,
128
+ id: 2n,
133
129
  debit_account_id: accountB.id,
134
- flags,
130
+ credit_account_id: accountA.id,
135
131
  user_data: 0n,
136
- reserved: Zeroed32Bytes,
132
+ reserved: 0n,
133
+ pending_id: 0n,
137
134
  timeout: BigInt(2e9),
135
+ ledger: 1,
136
+ code: 1,
137
+ flags,
138
+ amount: 50n,
138
139
  timestamp: 0n,
139
140
  };
140
141
  const errors = await client.createTransfers([transfer]);
141
142
  assert_1.default.strictEqual(errors.length, 0);
142
143
  const accounts = await client.lookupAccounts([accountA.id, accountB.id]);
143
144
  assert_1.default.strictEqual(accounts.length, 2);
144
- assert_1.default.strictEqual(accounts[0].credits_accepted, 100n);
145
- assert_1.default.strictEqual(accounts[0].credits_reserved, 50n);
146
- assert_1.default.strictEqual(accounts[0].debits_accepted, 0n);
147
- assert_1.default.strictEqual(accounts[0].debits_reserved, 0n);
148
- assert_1.default.strictEqual(accounts[1].credits_accepted, 0n);
149
- assert_1.default.strictEqual(accounts[1].credits_reserved, 0n);
150
- assert_1.default.strictEqual(accounts[1].debits_accepted, 100n);
151
- assert_1.default.strictEqual(accounts[1].debits_reserved, 50n);
145
+ assert_1.default.strictEqual(accounts[0].credits_posted, 100n);
146
+ assert_1.default.strictEqual(accounts[0].credits_pending, 50n);
147
+ assert_1.default.strictEqual(accounts[0].debits_posted, 0n);
148
+ assert_1.default.strictEqual(accounts[0].debits_pending, 0n);
149
+ assert_1.default.strictEqual(accounts[1].credits_posted, 0n);
150
+ assert_1.default.strictEqual(accounts[1].credits_pending, 0n);
151
+ assert_1.default.strictEqual(accounts[1].debits_posted, 100n);
152
+ assert_1.default.strictEqual(accounts[1].debits_pending, 50n);
152
153
  const transfers = await client.lookupTransfers([transfer.id]);
153
154
  assert_1.default.strictEqual(transfers.length, 1);
154
- assert_1.default.strictEqual(transfers[0].id, 1n);
155
+ assert_1.default.strictEqual(transfers[0].id, 2n);
155
156
  assert_1.default.strictEqual(transfers[0].debit_account_id, accountB.id);
156
157
  assert_1.default.strictEqual(transfers[0].credit_account_id, accountA.id);
157
158
  assert_1.default.strictEqual(transfers[0].user_data, 0n);
@@ -162,85 +163,107 @@ test('can create a two-phase transfer', async () => {
162
163
  assert_1.default.strictEqual(transfers[0].amount, 50n);
163
164
  assert_1.default.strictEqual(transfers[0].timestamp > 0, true);
164
165
  });
165
- test('can commit a two-phase transfer', async () => {
166
+ test('can post a two-phase transfer', async () => {
167
+ let flags = 0;
168
+ flags |= _1.TransferFlags.post_pending_transfer;
166
169
  const commit = {
167
- id: 1n,
170
+ id: 3n,
171
+ debit_account_id: BigInt(0),
172
+ credit_account_id: BigInt(0),
173
+ user_data: 0n,
174
+ reserved: 0n,
175
+ pending_id: 2n,
176
+ timeout: 0n,
177
+ ledger: 1,
168
178
  code: 1,
169
- flags: 0,
170
- reserved: Zeroed32Bytes,
179
+ flags: flags,
180
+ amount: 0n,
171
181
  timestamp: 0n,
172
182
  };
173
- const errors = await client.commitTransfers([commit]);
183
+ const errors = await client.createTransfers([commit]);
174
184
  assert_1.default.strictEqual(errors.length, 0);
175
185
  const accounts = await client.lookupAccounts([accountA.id, accountB.id]);
176
186
  assert_1.default.strictEqual(accounts.length, 2);
177
- assert_1.default.strictEqual(accounts[0].credits_accepted, 150n);
178
- assert_1.default.strictEqual(accounts[0].credits_reserved, 0n);
179
- assert_1.default.strictEqual(accounts[0].debits_accepted, 0n);
180
- assert_1.default.strictEqual(accounts[0].debits_reserved, 0n);
181
- assert_1.default.strictEqual(accounts[1].credits_accepted, 0n);
182
- assert_1.default.strictEqual(accounts[1].credits_reserved, 0n);
183
- assert_1.default.strictEqual(accounts[1].debits_accepted, 150n);
184
- assert_1.default.strictEqual(accounts[1].debits_reserved, 0n);
187
+ assert_1.default.strictEqual(accounts[0].credits_posted, 150n);
188
+ assert_1.default.strictEqual(accounts[0].credits_pending, 0n);
189
+ assert_1.default.strictEqual(accounts[0].debits_posted, 0n);
190
+ assert_1.default.strictEqual(accounts[0].debits_pending, 0n);
191
+ assert_1.default.strictEqual(accounts[1].credits_posted, 0n);
192
+ assert_1.default.strictEqual(accounts[1].credits_pending, 0n);
193
+ assert_1.default.strictEqual(accounts[1].debits_posted, 150n);
194
+ assert_1.default.strictEqual(accounts[1].debits_pending, 0n);
185
195
  });
186
196
  test('can reject a two-phase transfer', async () => {
187
197
  const transfer = {
188
- id: 3n,
189
- amount: 50n,
190
- code: 1,
191
- credit_account_id: accountA.id,
198
+ id: 4n,
192
199
  debit_account_id: accountB.id,
193
- flags: _1.TransferFlags.two_phase_commit,
200
+ credit_account_id: accountA.id,
194
201
  user_data: 0n,
195
- reserved: Zeroed32Bytes,
202
+ reserved: 0n,
203
+ pending_id: 0n,
196
204
  timeout: BigInt(1e9),
205
+ ledger: 1,
206
+ code: 1,
207
+ flags: _1.TransferFlags.pending,
208
+ amount: 50n,
197
209
  timestamp: 0n,
198
210
  };
199
211
  const transferErrors = await client.createTransfers([transfer]);
200
212
  assert_1.default.strictEqual(transferErrors.length, 0);
201
213
  const reject = {
202
- id: 3n,
214
+ id: 5n,
215
+ debit_account_id: BigInt(0),
216
+ credit_account_id: BigInt(0),
217
+ user_data: 0n,
218
+ reserved: 0n,
219
+ pending_id: 4n,
220
+ timeout: 0n,
221
+ ledger: 1,
203
222
  code: 1,
204
- flags: _1.CommitFlags.reject,
205
- reserved: Zeroed32Bytes,
223
+ flags: _1.TransferFlags.void_pending_transfer,
224
+ amount: 0n,
206
225
  timestamp: 0n,
207
226
  };
208
- const errors = await client.commitTransfers([reject]);
227
+ const errors = await client.createTransfers([reject]);
209
228
  assert_1.default.strictEqual(errors.length, 0);
210
229
  const accounts = await client.lookupAccounts([accountA.id, accountB.id]);
211
230
  assert_1.default.strictEqual(accounts.length, 2);
212
- assert_1.default.strictEqual(accounts[0].credits_accepted, 150n);
213
- assert_1.default.strictEqual(accounts[0].credits_reserved, 0n);
214
- assert_1.default.strictEqual(accounts[0].debits_accepted, 0n);
215
- assert_1.default.strictEqual(accounts[0].debits_reserved, 0n);
216
- assert_1.default.strictEqual(accounts[1].credits_accepted, 0n);
217
- assert_1.default.strictEqual(accounts[1].credits_reserved, 0n);
218
- assert_1.default.strictEqual(accounts[1].debits_accepted, 150n);
219
- assert_1.default.strictEqual(accounts[1].debits_reserved, 0n);
231
+ assert_1.default.strictEqual(accounts[0].credits_posted, 150n);
232
+ assert_1.default.strictEqual(accounts[0].credits_pending, 0n);
233
+ assert_1.default.strictEqual(accounts[0].debits_posted, 0n);
234
+ assert_1.default.strictEqual(accounts[0].debits_pending, 0n);
235
+ assert_1.default.strictEqual(accounts[1].credits_posted, 0n);
236
+ assert_1.default.strictEqual(accounts[1].credits_pending, 0n);
237
+ assert_1.default.strictEqual(accounts[1].debits_posted, 150n);
238
+ assert_1.default.strictEqual(accounts[1].debits_pending, 0n);
220
239
  });
221
240
  test('can link transfers', async () => {
222
241
  const transfer1 = {
223
- id: 4n,
224
- amount: 100n,
225
- code: 1,
226
- credit_account_id: accountA.id,
242
+ id: 6n,
227
243
  debit_account_id: accountB.id,
228
- flags: _1.TransferFlags.linked,
244
+ credit_account_id: accountA.id,
229
245
  user_data: 0n,
230
- reserved: Zeroed32Bytes,
246
+ reserved: 0n,
247
+ pending_id: 0n,
231
248
  timeout: 0n,
249
+ ledger: 1,
250
+ code: 1,
251
+ flags: _1.TransferFlags.linked,
252
+ amount: 100n,
232
253
  timestamp: 0n,
233
254
  };
234
255
  const transfer2 = {
235
- id: 4n,
236
- amount: 100n,
237
- code: 1,
238
- credit_account_id: accountA.id,
256
+ id: 6n,
239
257
  debit_account_id: accountB.id,
240
- flags: 0,
258
+ credit_account_id: accountA.id,
241
259
  user_data: 0n,
242
- reserved: Zeroed32Bytes,
260
+ reserved: 0n,
261
+ pending_id: 0n,
243
262
  timeout: 0n,
263
+ ledger: 1,
264
+ code: 1,
265
+ flags: 0,
266
+ amount: 100n,
244
267
  timestamp: 0n,
245
268
  };
246
269
  const errors = await client.createTransfers([transfer1, transfer2]);
@@ -249,14 +272,14 @@ test('can link transfers', async () => {
249
272
  assert_1.default.deepStrictEqual(errors[1], { index: 1, code: _1.CreateTransferError.exists_with_different_flags });
250
273
  const accounts = await client.lookupAccounts([accountA.id, accountB.id]);
251
274
  assert_1.default.strictEqual(accounts.length, 2);
252
- assert_1.default.strictEqual(accounts[0].credits_accepted, 150n);
253
- assert_1.default.strictEqual(accounts[0].credits_reserved, 0n);
254
- assert_1.default.strictEqual(accounts[0].debits_accepted, 0n);
255
- assert_1.default.strictEqual(accounts[0].debits_reserved, 0n);
256
- assert_1.default.strictEqual(accounts[1].credits_accepted, 0n);
257
- assert_1.default.strictEqual(accounts[1].credits_reserved, 0n);
258
- assert_1.default.strictEqual(accounts[1].debits_accepted, 150n);
259
- assert_1.default.strictEqual(accounts[1].debits_reserved, 0n);
275
+ assert_1.default.strictEqual(accounts[0].credits_posted, 150n);
276
+ assert_1.default.strictEqual(accounts[0].credits_pending, 0n);
277
+ assert_1.default.strictEqual(accounts[0].debits_posted, 0n);
278
+ assert_1.default.strictEqual(accounts[0].debits_pending, 0n);
279
+ assert_1.default.strictEqual(accounts[1].credits_posted, 0n);
280
+ assert_1.default.strictEqual(accounts[1].credits_pending, 0n);
281
+ assert_1.default.strictEqual(accounts[1].debits_posted, 150n);
282
+ assert_1.default.strictEqual(accounts[1].debits_pending, 0n);
260
283
  });
261
284
  async function main() {
262
285
  const start = new Date().getTime();
package/dist/test.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"test.js","sourceRoot":"","sources":["../src/test.ts"],"names":[],"mappings":";;;;;AAAA,oDAA+C;AAC/C,wBAQU;AAEV,MAAM,MAAM,GAAG,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AAE,EAAE,CAAC,IAAI,CAAC,GAAG,EAAE;gBAC9B,OAAO,CAAC,GAAG,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,IAAI,GAAG,UAAU,CAAC,CAAA;YACzC,CAAC,CAAC,CAAC,KAAK,CAAC,KAAK,CAAC,EAAE;gBACf,OAAO,CAAC,GAAG,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,IAAI,GAAG,UAAU,CAAC,CAAA;gBACvC,MAAM,KAAK,CAAA;YACb,CAAC,CAAC,CAAA;SACH;QACD,MAAM,GAAG,GAAG,IAAI,IAAI,EAAE,CAAC,OAAO,EAAE,CAAA;QAChC,OAAO,CAAC,GAAG,CAAC,iBAAiB,EAAE,CAAC,GAAG,GAAG,KAAK,CAAC,GAAC,IAAI,CAAC,CAAA;KACnD;YAAS;QACR,MAAM,MAAM,CAAC,OAAO,EAAE,CAAA;KACvB;AACH,CAAC;AAED,IAAI,EAAE,CAAC,KAAK,CAAC,CAAC,KAAqB,EAAE,EAAE;IACrC,OAAO,CAAC,GAAG,CAAC,WAAW,EAAE,KAAK,CAAC,QAAQ,CAAC,CAAA;IACxC,OAAO,CAAC,GAAG,CAAC,QAAQ,EAAE,KAAK,CAAC,KAAK,CAAC,CAAA;AACpC,CAAC,CAAC,CAAA","sourcesContent":["import assert, { AssertionError } from 'assert'\nimport { CommitFlags,\n createClient,\n Commit,\n Account,\n Transfer,\n TransferFlags,\n CreateAccountError,\n CreateTransferError\n} from '.'\n\nconst client = createClient({\n cluster_id: 0,\n replica_addresses: ['3001']\n})\n\n// Test data\nconst Zeroed32Bytes = Buffer.alloc(32, 0)\nconst Zeroed48Bytes = Buffer.alloc(48, 0)\nconst accountA: Account = {\n id: 17n,\n reserved: Zeroed48Bytes,\n user_data: 0n,\n code: 718,\n unit: 1,\n flags: 0,\n credits_accepted: 0n,\n credits_reserved: 0n,\n debits_accepted: 0n,\n debits_reserved: 0n,\n timestamp: 0n // this will be set correctly by the TigerBeetle server\n}\nconst accountB: Account = {\n id: 19n,\n reserved: Zeroed48Bytes,\n user_data: 0n,\n code: 719,\n unit: 1,\n flags: 0,\n credits_accepted: 0n,\n credits_reserved: 0n,\n debits_accepted: 0n,\n debits_reserved: 0n,\n timestamp: 0n // this will be set correctly by the TigerBeetle server\n}\n\nconst tests: Array<{ name: string, fn: () => Promise<void> }> = []\nfunction test(name: string, fn: () => Promise<void>) {\n tests.push({ name, fn })\n}\ntest.skip = (name: string, fn: () => Promise<void>) => {\n console.log(name + ': SKIPPED')\n}\n\ntest('range checks `unit` and `code` on Account to be u16', async (): Promise<void> => {\n const account = { ...accountA, id: 0n, unit: 65535 + 1 }\n\n const unitError = await client.createAccounts([account]).catch(error => error)\n assert.strictEqual(unitError.message, 'unit must be a u16.')\n\n account.unit = 0\n account.code = 65535 + 1\n const codeError = await client.createAccounts([account]).catch(error => error)\n assert.strictEqual(codeError.message, 'code must be a u16.')\n\n const accounts = await client.lookupAccounts([0n])\n assert.strictEqual(accounts.length, 0)\n})\n\ntest('can create accounts', async (): Promise<void> => {\n const errors = await client.createAccounts([accountA])\n\n assert.strictEqual(errors.length, 0)\n})\n\ntest('can return error', async (): Promise<void> => {\n const errors = await client.createAccounts([accountA, accountB])\n\n assert.strictEqual(errors.length, 1)\n assert.deepStrictEqual(errors[0], { index: 0, code: CreateAccountError.exists })\n})\n\ntest('throws error if timestamp is not set to 0n', async (): Promise<void> => {\n const account = { ...accountA, timestamp: 2n, id: 3n }\n await assert.rejects(client.createAccounts([account]))\n})\n\ntest('can lookup accounts', async (): Promise<void> => {\n const accounts = await client.lookupAccounts([accountA.id, accountB.id])\n\n assert.strictEqual(accounts.length, 2)\n const account1 = accounts[0]\n assert.strictEqual(account1.id, 17n)\n assert.ok(account1.reserved.equals(Zeroed48Bytes))\n assert.strictEqual(account1.user_data, 0n)\n assert.strictEqual(account1.code, 718)\n assert.strictEqual(account1.unit, 1)\n assert.strictEqual(account1.flags, 0)\n assert.strictEqual(account1.credits_accepted, 0n)\n assert.strictEqual(account1.credits_reserved, 0n)\n assert.strictEqual(account1.debits_accepted, 0n)\n assert.strictEqual(account1.debits_reserved, 0n)\n assert.ok(account1.timestamp > 0n)\n\n const account2 = accounts[1]\n assert.strictEqual(account2.id, 19n)\n assert.ok(account2.reserved.equals(Zeroed48Bytes))\n assert.strictEqual(account2.user_data, 0n)\n assert.strictEqual(account2.code, 719)\n assert.strictEqual(account2.unit, 1)\n assert.strictEqual(account2.flags, 0)\n assert.strictEqual(account2.credits_accepted, 0n)\n assert.strictEqual(account2.credits_reserved, 0n)\n assert.strictEqual(account2.debits_accepted, 0n)\n assert.strictEqual(account2.debits_reserved, 0n)\n assert.ok(account2.timestamp > 0n)\n})\n\ntest('can create a transfer', async (): Promise<void> => {\n const transfer: Transfer = {\n id: 0n,\n amount: 100n,\n code: 1,\n credit_account_id: accountA.id,\n debit_account_id: accountB.id,\n flags: 0,\n user_data: 0n,\n reserved: Zeroed32Bytes,\n timeout: 0n,\n timestamp: 0n, // this will be set correctly by the TigerBeetle server\n }\n\n const errors = await client.createTransfers([transfer])\n assert.strictEqual(errors.length, 0)\n\n const accounts = await client.lookupAccounts([accountA.id, accountB.id])\n assert.strictEqual(accounts.length, 2)\n assert.strictEqual(accounts[0].credits_accepted, 100n)\n assert.strictEqual(accounts[0].credits_reserved, 0n)\n assert.strictEqual(accounts[0].debits_accepted, 0n)\n assert.strictEqual(accounts[0].debits_reserved, 0n)\n\n assert.strictEqual(accounts[1].credits_accepted, 0n)\n assert.strictEqual(accounts[1].credits_reserved, 0n)\n assert.strictEqual(accounts[1].debits_accepted, 100n)\n assert.strictEqual(accounts[1].debits_reserved, 0n)\n})\n\ntest('can create a two-phase transfer', async (): Promise<void> => {\n let flags = 0\n flags |= TransferFlags.two_phase_commit\n const transfer: Transfer = {\n id: 1n,\n amount: 50n,\n code: 1,\n credit_account_id: accountA.id,\n debit_account_id: accountB.id,\n flags,\n user_data: 0n,\n reserved: Zeroed32Bytes,\n timeout: BigInt(2e9),\n timestamp: 0n, // this will be set correctly by the TigerBeetle server\n }\n\n const errors = await client.createTransfers([transfer])\n assert.strictEqual(errors.length, 0)\n\n const accounts = await client.lookupAccounts([accountA.id, accountB.id])\n assert.strictEqual(accounts.length, 2)\n assert.strictEqual(accounts[0].credits_accepted, 100n)\n assert.strictEqual(accounts[0].credits_reserved, 50n)\n assert.strictEqual(accounts[0].debits_accepted, 0n)\n assert.strictEqual(accounts[0].debits_reserved, 0n)\n\n assert.strictEqual(accounts[1].credits_accepted, 0n)\n assert.strictEqual(accounts[1].credits_reserved, 0n)\n assert.strictEqual(accounts[1].debits_accepted, 100n)\n assert.strictEqual(accounts[1].debits_reserved, 50n)\n\n // Lookup the transfer\n const transfers = await client.lookupTransfers([transfer.id])\n assert.strictEqual(transfers.length, 1)\n assert.strictEqual(transfers[0].id, 1n)\n assert.strictEqual(transfers[0].debit_account_id, accountB.id)\n assert.strictEqual(transfers[0].credit_account_id, accountA.id)\n assert.strictEqual(transfers[0].user_data, 0n)\n assert.notStrictEqual(transfers[0].reserved, Zeroed32Bytes)\n assert.strictEqual(transfers[0].timeout > 0, true)\n assert.strictEqual(transfers[0].code, 1)\n assert.strictEqual(transfers[0].flags, 2)\n assert.strictEqual(transfers[0].amount, 50n)\n assert.strictEqual(transfers[0].timestamp > 0, true)\n})\n\ntest('can commit a two-phase transfer', async (): Promise<void> => {\n const commit: Commit = {\n id: 1n, // must match the id of the create transfer\n code: 1,\n flags: 0, // defaults to accept\n reserved: Zeroed32Bytes,\n timestamp: 0n, // this will be set correctly by the TigerBeetle server\n }\n\n const errors = await client.commitTransfers([commit])\n assert.strictEqual(errors.length, 0)\n\n const accounts = await client.lookupAccounts([accountA.id, accountB.id])\n assert.strictEqual(accounts.length, 2)\n assert.strictEqual(accounts[0].credits_accepted, 150n)\n assert.strictEqual(accounts[0].credits_reserved, 0n)\n assert.strictEqual(accounts[0].debits_accepted, 0n)\n assert.strictEqual(accounts[0].debits_reserved, 0n)\n\n assert.strictEqual(accounts[1].credits_accepted, 0n)\n assert.strictEqual(accounts[1].credits_reserved, 0n)\n assert.strictEqual(accounts[1].debits_accepted, 150n)\n assert.strictEqual(accounts[1].debits_reserved, 0n)\n})\n\ntest('can reject a two-phase transfer', async (): Promise<void> => {\n // create a two-phase transfer\n const transfer: Transfer = {\n id: 3n,\n amount: 50n,\n code: 1,\n credit_account_id: accountA.id,\n debit_account_id: accountB.id,\n flags: TransferFlags.two_phase_commit,\n user_data: 0n,\n reserved: Zeroed32Bytes,\n timeout: BigInt(1e9),\n timestamp: 0n, // this will be set correctly by the TigerBeetle server\n }\n const transferErrors = await client.createTransfers([transfer])\n assert.strictEqual(transferErrors.length, 0)\n\n // send in the reject\n const reject: Commit = {\n id: 3n,\n code: 1,\n flags: CommitFlags.reject,\n reserved: Zeroed32Bytes,\n timestamp: 0n,// this will be set correctly by the TigerBeetle server\n }\n\n const errors = await client.commitTransfers([reject])\n assert.strictEqual(errors.length, 0)\n\n const accounts = await client.lookupAccounts([accountA.id, accountB.id])\n assert.strictEqual(accounts.length, 2)\n assert.strictEqual(accounts[0].credits_accepted, 150n)\n assert.strictEqual(accounts[0].credits_reserved, 0n)\n assert.strictEqual(accounts[0].debits_accepted, 0n)\n assert.strictEqual(accounts[0].debits_reserved, 0n)\n\n assert.strictEqual(accounts[1].credits_accepted, 0n)\n assert.strictEqual(accounts[1].credits_reserved, 0n)\n assert.strictEqual(accounts[1].debits_accepted, 150n)\n assert.strictEqual(accounts[1].debits_reserved, 0n)\n})\n\ntest('can link transfers', async (): Promise<void> => {\n const transfer1: Transfer = {\n id: 4n,\n amount: 100n,\n code: 1,\n credit_account_id: accountA.id,\n debit_account_id: accountB.id,\n flags: TransferFlags.linked, // points to transfer2\n user_data: 0n,\n reserved: Zeroed32Bytes,\n timeout: 0n,\n timestamp: 0n, // will be set correctly by the TigerBeetle server\n }\n const transfer2: Transfer = {\n id: 4n,\n amount: 100n,\n code: 1,\n credit_account_id: accountA.id,\n debit_account_id: accountB.id,\n // Does not have linked flag as it is the end of the chain.\n // This will also cause it to fail as this is now a duplicate with different flags\n flags: 0,\n user_data: 0n,\n reserved: Zeroed32Bytes,\n timeout: 0n,\n timestamp: 0n, // will be set correctly by the TigerBeetle server\n }\n\n const errors = await client.createTransfers([transfer1, transfer2])\n assert.strictEqual(errors.length, 2)\n assert.deepStrictEqual(errors[0], { index: 0, code: CreateTransferError.linked_event_failed })\n assert.deepStrictEqual(errors[1], { index: 1, code: CreateTransferError.exists_with_different_flags })\n\n const accounts = await client.lookupAccounts([accountA.id, accountB.id])\n assert.strictEqual(accounts.length, 2)\n assert.strictEqual(accounts[0].credits_accepted, 150n)\n assert.strictEqual(accounts[0].credits_reserved, 0n)\n assert.strictEqual(accounts[0].debits_accepted, 0n)\n assert.strictEqual(accounts[0].debits_reserved, 0n)\n\n assert.strictEqual(accounts[1].credits_accepted, 0n)\n assert.strictEqual(accounts[1].credits_reserved, 0n)\n assert.strictEqual(accounts[1].debits_accepted, 150n)\n assert.strictEqual(accounts[1].debits_reserved, 0n)\n})\n\nasync function main () {\n const start = new Date().getTime()\n try {\n for (let i = 0; i < tests.length; i++) {\n await tests[i].fn().then(() => {\n console.log(tests[i].name + \": PASSED\")\n }).catch(error => {\n console.log(tests[i].name + \": FAILED\")\n throw error\n })\n }\n const end = new Date().getTime()\n console.log('Time taken (s):', (end - start)/1000)\n } finally {\n await client.destroy()\n } \n}\n\nmain().catch((error: AssertionError) => {\n console.log('operator:', error.operator)\n console.log('stack:', error.stack)\n})\n"]}
1
+ {"version":3,"file":"test.js","sourceRoot":"","sources":["../src/test.ts"],"names":[],"mappings":";;;;;AAAA,oDAA+C;AAC/C,wBAOU;AAEV,MAAM,MAAM,GAAG,eAAY,CAAC;IAC1B,UAAU,EAAE,CAAC;IACb,iBAAiB,EAAE,CAAC,MAAM,CAAC;CAC5B,CAAC,CAAA;AAGF,MAAM,aAAa,GAAG,MAAM,CAAC,KAAK,CAAC,EAAE,EAAE,CAAC,CAAC,CAAA;AACzC,MAAM,aAAa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AAI,IAAI,EAAE,CAAC,OAAO,EAAE,CAAA;IAClC,IAAI;QACF,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,KAAK,CAAC,MAAM,EAAE,CAAC,EAAE,EAAE;YACnC,MAAM,KAAK,CAAC,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,IAAI,CAAC,GAAG,EAAE;gBAC9B,OAAO,CAAC,GAAG,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,IAAI,GAAG,UAAU,CAAC,CAAA;YACzC,CAAC,CAAC,CAAC,KAAK,CAAC,KAAK,CAAC,EAAE;gBACf,OAAO,CAAC,GAAG,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,IAAI,GAAG,UAAU,CAAC,CAAA;gBACvC,MAAM,KAAK,CAAA;YACb,CAAC,CAAC,CAAA;SACH;QACD,MAAM,GAAG,GAAG,IAAI,IAAI,EAAE,CAAC,OAAO,EAAE,CAAA;QAChC,OAAO,CAAC,GAAG,CAAC,iBAAiB,EAAE,CAAC,GAAG,GAAG,KAAK,CAAC,GAAC,IAAI,CAAC,CAAA;KACnD;YAAS;QACR,MAAM,MAAM,CAAC,OAAO,EAAE,CAAA;KACvB;AACH,CAAC;AAED,IAAI,EAAE,CAAC,KAAK,CAAC,CAAC,KAAqB,EAAE,EAAE;IACrC,OAAO,CAAC,GAAG,CAAC,WAAW,EAAE,KAAK,CAAC,QAAQ,CAAC,CAAA;IACxC,OAAO,CAAC,GAAG,CAAC,QAAQ,EAAE,KAAK,CAAC,KAAK,CAAC,CAAA;AACpC,CAAC,CAAC,CAAA","sourcesContent":["import assert, { AssertionError } from 'assert'\nimport {\n createClient,\n Account,\n Transfer,\n TransferFlags,\n CreateAccountError,\n CreateTransferError\n} from '.'\n\nconst client = createClient({\n cluster_id: 0,\n replica_addresses: ['3001']\n})\n\n// Test data\nconst Zeroed32Bytes = Buffer.alloc(32, 0)\nconst Zeroed48Bytes = Buffer.alloc(48, 0)\nconst accountA: Account = {\n id: 17n,\n user_data: 0n,\n reserved: Zeroed48Bytes,\n ledger: 1,\n code: 718,\n flags: 0,\n debits_pending: 0n,\n debits_posted: 0n,\n credits_pending: 0n,\n credits_posted: 0n,\n timestamp: 0n // this will be set correctly by the TigerBeetle server\n}\nconst accountB: Account = {\n id: 19n,\n user_data: 0n,\n reserved: Zeroed48Bytes,\n ledger: 1,\n code: 719,\n flags: 0,\n debits_pending: 0n,\n debits_posted: 0n,\n credits_pending: 0n,\n credits_posted: 0n,\n timestamp: 0n // this will be set correctly by the TigerBeetle server\n}\n\nconst tests: Array<{ name: string, fn: () => Promise<void> }> = []\nfunction test(name: string, fn: () => Promise<void>) {\n tests.push({ name, fn })\n}\ntest.skip = (name: string, fn: () => Promise<void>) => {\n console.log(name + ': SKIPPED')\n}\n\ntest('range check `code` on Account to be u16', async (): Promise<void> => {\n const account = { ...accountA, id: 0n }\n\n account.code = 65535 + 1\n const codeError = await client.createAccounts([account]).catch(error => error)\n assert.strictEqual(codeError.message, 'code must be a u16.')\n\n const accounts = await client.lookupAccounts([account.id])\n assert.strictEqual(accounts.length, 0)\n})\n\ntest('can create accounts', async (): Promise<void> => {\n const errors = await client.createAccounts([accountA])\n assert.strictEqual(errors.length, 0)\n})\n\ntest('can return error on account', async (): Promise<void> => {\n const errors = await client.createAccounts([accountA, accountB])\n\n assert.strictEqual(errors.length, 1)\n assert.deepStrictEqual(errors[0], { index: 0, code: CreateAccountError.exists })\n})\n\ntest('throws error if timestamp is not set to 0n on account', async (): Promise<void> => {\n const account = { ...accountA, timestamp: 2n, id: 3n }\n await assert.rejects(client.createAccounts([account]))\n})\n\ntest('can lookup accounts', async (): Promise<void> => {\n const accounts = await client.lookupAccounts([accountA.id, accountB.id])\n\n assert.strictEqual(accounts.length, 2)\n const account1 = accounts[0]\n assert.strictEqual(account1.id, 17n)\n assert.ok(account1.reserved.equals(Zeroed48Bytes))\n assert.strictEqual(account1.user_data, 0n)\n assert.strictEqual(account1.code, 718)\n assert.strictEqual(account1.ledger, 1)\n assert.strictEqual(account1.flags, 0)\n assert.strictEqual(account1.credits_posted, 0n)\n assert.strictEqual(account1.credits_pending, 0n)\n assert.strictEqual(account1.debits_posted, 0n)\n assert.strictEqual(account1.debits_pending, 0n)\n assert.ok(account1.timestamp > 0n)\n\n const account2 = accounts[1]\n assert.strictEqual(account2.id, 19n)\n assert.ok(account2.reserved.equals(Zeroed48Bytes))\n assert.strictEqual(account2.user_data, 0n)\n assert.strictEqual(account2.code, 719)\n assert.strictEqual(account2.ledger, 1)\n assert.strictEqual(account2.flags, 0)\n assert.strictEqual(account2.credits_posted, 0n)\n assert.strictEqual(account2.credits_pending, 0n)\n assert.strictEqual(account2.debits_posted, 0n)\n assert.strictEqual(account2.debits_pending, 0n)\n assert.ok(account2.timestamp > 0n)\n})\n\ntest('can create a transfer', async (): Promise<void> => {\n const transfer: Transfer = {\n id: 1n,\n debit_account_id: accountB.id,\n credit_account_id: accountA.id,\n user_data: 0n,\n reserved: 0n,\n pending_id: 0n,\n timeout: 0n,\n ledger: 1,\n code: 1,\n flags: 0,\n amount: 100n,\n timestamp: 0n, // this will be set correctly by the TigerBeetle server\n }\n\n const errors = await client.createTransfers([transfer])\n assert.strictEqual(errors.length, 0)\n\n const accounts = await client.lookupAccounts([accountA.id, accountB.id])\n assert.strictEqual(accounts.length, 2)\n assert.strictEqual(accounts[0].credits_posted, 100n)\n assert.strictEqual(accounts[0].credits_pending, 0n)\n assert.strictEqual(accounts[0].debits_posted, 0n)\n assert.strictEqual(accounts[0].debits_pending, 0n)\n\n assert.strictEqual(accounts[1].credits_posted, 0n)\n assert.strictEqual(accounts[1].credits_pending, 0n)\n assert.strictEqual(accounts[1].debits_posted, 100n)\n assert.strictEqual(accounts[1].debits_pending, 0n)\n})\n\ntest('can create a two-phase transfer', async (): Promise<void> => {\n let flags = 0\n flags |= TransferFlags.pending\n const transfer: Transfer = {\n id: 2n,\n debit_account_id: accountB.id,\n credit_account_id: accountA.id,\n user_data: 0n,\n reserved: 0n,\n pending_id: 0n,\n timeout: BigInt(2e9),\n ledger: 1,\n code: 1,\n flags,\n amount: 50n,\n timestamp: 0n, // this will be set correctly by the TigerBeetle server\n }\n\n const errors = await client.createTransfers([transfer])\n assert.strictEqual(errors.length, 0)\n\n const accounts = await client.lookupAccounts([accountA.id, accountB.id])\n assert.strictEqual(accounts.length, 2)\n assert.strictEqual(accounts[0].credits_posted, 100n)\n assert.strictEqual(accounts[0].credits_pending, 50n)\n assert.strictEqual(accounts[0].debits_posted, 0n)\n assert.strictEqual(accounts[0].debits_pending, 0n)\n\n assert.strictEqual(accounts[1].credits_posted, 0n)\n assert.strictEqual(accounts[1].credits_pending, 0n)\n assert.strictEqual(accounts[1].debits_posted, 100n)\n assert.strictEqual(accounts[1].debits_pending, 50n)\n\n // Lookup the transfer:\n const transfers = await client.lookupTransfers([transfer.id])\n assert.strictEqual(transfers.length, 1)\n assert.strictEqual(transfers[0].id, 2n)\n assert.strictEqual(transfers[0].debit_account_id, accountB.id)\n assert.strictEqual(transfers[0].credit_account_id, accountA.id)\n assert.strictEqual(transfers[0].user_data, 0n)\n assert.notStrictEqual(transfers[0].reserved, Zeroed32Bytes)\n assert.strictEqual(transfers[0].timeout > 0, true)\n assert.strictEqual(transfers[0].code, 1)\n assert.strictEqual(transfers[0].flags, 2)\n assert.strictEqual(transfers[0].amount, 50n)\n assert.strictEqual(transfers[0].timestamp > 0, true)\n})\n\ntest('can post a two-phase transfer', async (): Promise<void> => {\n let flags = 0\n flags |= TransferFlags.post_pending_transfer\n\n const commit: Transfer = {\n id: 3n,\n debit_account_id: BigInt(0),\n credit_account_id: BigInt(0),\n user_data: 0n,\n reserved: 0n,\n pending_id: 2n,// must match the id of the pending transfer\n timeout: 0n,\n ledger: 1,\n code: 1,\n flags: flags,\n amount: 0n,\n timestamp: 0n, // this will be set correctly by the TigerBeetle server\n }\n\n const errors = await client.createTransfers([commit])\n assert.strictEqual(errors.length, 0)\n\n const accounts = await client.lookupAccounts([accountA.id, accountB.id])\n assert.strictEqual(accounts.length, 2)\n assert.strictEqual(accounts[0].credits_posted, 150n)\n assert.strictEqual(accounts[0].credits_pending, 0n)\n assert.strictEqual(accounts[0].debits_posted, 0n)\n assert.strictEqual(accounts[0].debits_pending, 0n)\n\n assert.strictEqual(accounts[1].credits_posted, 0n)\n assert.strictEqual(accounts[1].credits_pending, 0n)\n assert.strictEqual(accounts[1].debits_posted, 150n)\n assert.strictEqual(accounts[1].debits_pending, 0n)\n})\n\ntest('can reject a two-phase transfer', async (): Promise<void> => {\n // Create a two-phase transfer:\n const transfer: Transfer = {\n id: 4n,\n debit_account_id: accountB.id,\n credit_account_id: accountA.id,\n user_data: 0n,\n reserved: 0n,\n pending_id: 0n,\n timeout: BigInt(1e9),\n ledger: 1,\n code: 1,\n flags: TransferFlags.pending,\n amount: 50n,\n timestamp: 0n, // this will be set correctly by the TigerBeetle server\n }\n const transferErrors = await client.createTransfers([transfer])\n assert.strictEqual(transferErrors.length, 0)\n\n // send in the reject\n const reject: Transfer = {\n id: 5n,\n debit_account_id: BigInt(0),\n credit_account_id: BigInt(0),\n user_data: 0n,\n reserved: 0n,\n pending_id: 4n, // must match the id of the pending transfer\n timeout: 0n,\n ledger: 1,\n code: 1,\n flags: TransferFlags.void_pending_transfer,\n amount: 0n,\n timestamp: 0n, // this will be set correctly by the TigerBeetle server\n }\n\n const errors = await client.createTransfers([reject])\n assert.strictEqual(errors.length, 0)\n\n const accounts = await client.lookupAccounts([accountA.id, accountB.id])\n assert.strictEqual(accounts.length, 2)\n assert.strictEqual(accounts[0].credits_posted, 150n)\n assert.strictEqual(accounts[0].credits_pending, 0n)\n assert.strictEqual(accounts[0].debits_posted, 0n)\n assert.strictEqual(accounts[0].debits_pending, 0n)\n\n assert.strictEqual(accounts[1].credits_posted, 0n)\n assert.strictEqual(accounts[1].credits_pending, 0n)\n assert.strictEqual(accounts[1].debits_posted, 150n)\n assert.strictEqual(accounts[1].debits_pending, 0n)\n})\n\ntest('can link transfers', async (): Promise<void> => {\n const transfer1: Transfer = {\n id: 6n,\n debit_account_id: accountB.id,\n credit_account_id: accountA.id,\n user_data: 0n,\n reserved: 0n,\n pending_id: 0n,\n timeout: 0n,\n ledger: 1,\n code: 1,\n flags: TransferFlags.linked, // points to transfer2\n amount: 100n,\n timestamp: 0n, // will be set correctly by the TigerBeetle server\n }\n const transfer2: Transfer = {\n id: 6n,\n debit_account_id: accountB.id,\n credit_account_id: accountA.id,\n user_data: 0n,\n reserved: 0n,\n pending_id: 0n,\n timeout: 0n,\n ledger: 1,\n code: 1,\n // Does not have linked flag as it is the end of the chain.\n // This will also cause it to fail as this is now a duplicate with different flags\n flags: 0,\n amount: 100n,\n timestamp: 0n, // will be set correctly by the TigerBeetle server\n }\n\n const errors = await client.createTransfers([transfer1, transfer2])\n assert.strictEqual(errors.length, 2)\n assert.deepStrictEqual(errors[0], { index: 0, code: CreateTransferError.linked_event_failed })\n assert.deepStrictEqual(errors[1], { index: 1, code: CreateTransferError.exists_with_different_flags })\n\n const accounts = await client.lookupAccounts([accountA.id, accountB.id])\n assert.strictEqual(accounts.length, 2)\n assert.strictEqual(accounts[0].credits_posted, 150n)\n assert.strictEqual(accounts[0].credits_pending, 0n)\n assert.strictEqual(accounts[0].debits_posted, 0n)\n assert.strictEqual(accounts[0].debits_pending, 0n)\n\n assert.strictEqual(accounts[1].credits_posted, 0n)\n assert.strictEqual(accounts[1].credits_pending, 0n)\n assert.strictEqual(accounts[1].debits_posted, 150n)\n assert.strictEqual(accounts[1].debits_pending, 0n)\n})\n\nasync function main () {\n const start = new Date().getTime()\n try {\n for (let i = 0; i < tests.length; i++) {\n await tests[i].fn().then(() => {\n console.log(tests[i].name + \": PASSED\")\n }).catch(error => {\n console.log(tests[i].name + \": FAILED\")\n throw error\n })\n }\n const end = new Date().getTime()\n console.log('Time taken (s):', (end - start)/1000)\n } finally {\n await client.destroy()\n } \n}\n\nmain().catch((error: AssertionError) => {\n console.log('operator:', error.operator)\n console.log('stack:', error.stack)\n})\n"]}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "tigerbeetle-node",
3
- "version": "0.5.2",
3
+ "version": "0.8.1",
4
4
  "description": "TigerBeetle Node.js client",
5
5
  "main": "dist/index.js",
6
6
  "typings": "dist/index.d.ts",
@@ -49,7 +49,8 @@
49
49
  "contributors": [
50
50
  "Donovan Changfoot <don@coil.com>",
51
51
  "Isaac Freund <isaac.freund@coil.com>",
52
- "Joran Dirk Greef <joran@coil.com>"
52
+ "Joran Dirk Greef <joran@coil.com>",
53
+ "Jason Bruwer <jason.bruwer@coil.com>"
53
54
  ],
54
55
  "devDependencies": {
55
56
  "@types/node": "^14.14.41",
@@ -12,7 +12,9 @@ HEADERS_TARBALL=./build/`basename "$HEADERS_URL"`
12
12
  # Download, making sure we download to the same output document, without wget adding "-1" etc. if the file was previously partially downloaded:
13
13
  echo "Downloading $HEADERS_URL..."
14
14
  if command -v wget &> /dev/null; then
15
- wget --quiet --show-progress --output-document=$HEADERS_TARBALL $HEADERS_URL
15
+ # -4 forces `wget` to connect to ipv4 addresses, as ipv6 fails to resolve on certain distros.
16
+ # Only A records (for ipv4) are used in DNS:
17
+ wget -4 --quiet --show-progress --output-document=$HEADERS_TARBALL $HEADERS_URL
16
18
  else
17
19
  curl --silent --progress-bar --output $HEADERS_TARBALL $HEADERS_URL
18
20
  fi