tigerbeetle-node 0.14.176 → 0.14.178
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 +3 -2
- package/dist/bin/aarch64-linux-gnu/client.node +0 -0
- package/dist/bin/aarch64-linux-musl/client.node +0 -0
- package/dist/bin/aarch64-macos/client.node +0 -0
- package/dist/bin/x86_64-linux-gnu/client.node +0 -0
- package/dist/bin/x86_64-linux-musl/client.node +0 -0
- package/dist/bin/x86_64-macos/client.node +0 -0
- package/dist/bin/x86_64-windows/client.node +0 -0
- package/dist/bindings.d.ts +2 -1
- package/dist/bindings.js.map +1 -1
- package/dist/test.js +116 -14
- package/dist/test.js.map +1 -1
- package/package.json +1 -1
- package/src/bindings.ts +7 -2
- package/src/node.zig +23 -13
- package/src/test.ts +144 -24
- package/src/translate.zig +1 -1
package/README.md
CHANGED
|
@@ -11,7 +11,7 @@ The TigerBeetle client for Node.js.
|
|
|
11
11
|
|
|
12
12
|
Linux >= 5.6 is the only production environment we
|
|
13
13
|
support. But for ease of development we also support macOS and Windows.
|
|
14
|
-
* NodeJS >= `
|
|
14
|
+
* NodeJS >= `18`
|
|
15
15
|
|
|
16
16
|
## Setup
|
|
17
17
|
|
|
@@ -574,7 +574,8 @@ reverse-chronological order.
|
|
|
574
574
|
```javascript
|
|
575
575
|
let filter = {
|
|
576
576
|
account_id: 2n,
|
|
577
|
-
|
|
577
|
+
timestamp_min: 0n, // No filter by Timestamp.
|
|
578
|
+
timestamp_max: 0n, // No filter by Timestamp.
|
|
578
579
|
limit: 10, // Limit to ten transfers at most.
|
|
579
580
|
flags: GetAccountTransfersFlags.debits | // Include transfer from the debit side.
|
|
580
581
|
GetAccountTransfersFlags.credits | // Include transfer from the credit side.
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
package/dist/bindings.d.ts
CHANGED
package/dist/bindings.js.map
CHANGED
|
@@ -1 +1 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FAAsB,CAAA;IAKtB,wFAAsB,CAAA;IAKtB,oFAAoB,CAAA;IAKpB,kFAAmB,CAAA;AACrB,CAAC,EAzRW,mBAAmB,GAAnB,2BAAmB,KAAnB,2BAAmB,QAyR9B;AAuCD,IAAY,SAMX;AAND,WAAY,SAAS;IACnB,iEAAqB,CAAA;IACrB,mEAAsB,CAAA;IACtB,iEAAqB,CAAA;IACrB,mEAAsB,CAAA;IACtB,6EAA2B,CAAA;AAC7B,CAAC,EANW,SAAS,GAAT,iBAAS,KAAT,iBAAS,QAMpB","sourcesContent":["///////////////////////////////////////////////////////\n// This file was auto-generated by node_bindings.zig //\n// Do not manually modify. //\n///////////////////////////////////////////////////////\n\n\n/**\n* See [AccountFlags](https://docs.tigerbeetle.com/reference/accounts#flags)\n*/\nexport enum AccountFlags {\n none = 0,\n\n /**\n * See [linked](https://docs.tigerbeetle.com/reference/accounts#flagslinked)\n */\n linked = (1 << 0),\n\n /**\n * See [debits_must_not_exceed_credits](https://docs.tigerbeetle.com/reference/accounts#flagsdebits_must_not_exceed_credits)\n */\n debits_must_not_exceed_credits = (1 << 1),\n\n /**\n * See [credits_must_not_exceed_debits](https://docs.tigerbeetle.com/reference/accounts#flagscredits_must_not_exceed_debits)\n */\n credits_must_not_exceed_debits = (1 << 2),\n}\n\n\n/**\n* See [TransferFlags](https://docs.tigerbeetle.com/reference/transfers#flags)\n*/\nexport enum TransferFlags {\n none = 0,\n\n /**\n * See [linked](https://docs.tigerbeetle.com/reference/transfers#flagslinked)\n */\n linked = (1 << 0),\n\n /**\n * See [pending](https://docs.tigerbeetle.com/reference/transfers#flagspending)\n */\n pending = (1 << 1),\n\n /**\n * See [post_pending_transfer](https://docs.tigerbeetle.com/reference/transfers#flagspost_pending_transfer)\n */\n post_pending_transfer = (1 << 2),\n\n /**\n * See [void_pending_transfer](https://docs.tigerbeetle.com/reference/transfers#flagsvoid_pending_transfer)\n */\n void_pending_transfer = (1 << 3),\n\n /**\n * See [balancing_debit](https://docs.tigerbeetle.com/reference/transfers#flagsbalancing_debit)\n */\n balancing_debit = (1 << 4),\n\n /**\n * See [balancing_credit](https://docs.tigerbeetle.com/reference/transfers#flagsbalancing_credit)\n */\n balancing_credit = (1 << 5),\n}\n\n\n/**\n* See [GetAccountTransfersFlags](https://docs.tigerbeetle.com/reference/operations/get_account_transfers#flags)\n*/\nexport enum GetAccountTransfersFlags {\n none = 0,\n\n /**\n * See [debits](https://docs.tigerbeetle.com/reference/operations/get_account_transfers#flagsdebits)\n */\n debits = (1 << 0),\n\n /**\n * See [credits](https://docs.tigerbeetle.com/reference/operations/get_account_transfers#flagscredits)\n */\n credits = (1 << 1),\n\n /**\n * See [reversed](https://docs.tigerbeetle.com/reference/operations/get_account_transfers#flagsreversed)\n */\n reversed = (1 << 2),\n}\n\n\n/**\n* See [Account](https://docs.tigerbeetle.com/reference/accounts/#)\n*/\nexport type Account = {\n\n /**\n * See [id](https://docs.tigerbeetle.com/reference/accounts/#id)\n */\n id: bigint\n\n /**\n * See [debits_pending](https://docs.tigerbeetle.com/reference/accounts/#debits_pending)\n */\n debits_pending: bigint\n\n /**\n * See [debits_posted](https://docs.tigerbeetle.com/reference/accounts/#debits_posted)\n */\n debits_posted: bigint\n\n /**\n * See [credits_pending](https://docs.tigerbeetle.com/reference/accounts/#credits_pending)\n */\n credits_pending: bigint\n\n /**\n * See [credits_posted](https://docs.tigerbeetle.com/reference/accounts/#credits_posted)\n */\n credits_posted: bigint\n\n /**\n * See [user_data_128](https://docs.tigerbeetle.com/reference/accounts/#user_data_128)\n */\n user_data_128: bigint\n\n /**\n * See [user_data_64](https://docs.tigerbeetle.com/reference/accounts/#user_data_64)\n */\n user_data_64: bigint\n\n /**\n * See [user_data_32](https://docs.tigerbeetle.com/reference/accounts/#user_data_32)\n */\n user_data_32: number\n\n /**\n * See [reserved](https://docs.tigerbeetle.com/reference/accounts/#reserved)\n */\n reserved: number\n\n /**\n * See [ledger](https://docs.tigerbeetle.com/reference/accounts/#ledger)\n */\n ledger: number\n\n /**\n * See [code](https://docs.tigerbeetle.com/reference/accounts/#code)\n */\n code: number\n\n /**\n * See [flags](https://docs.tigerbeetle.com/reference/accounts/#flags)\n */\n flags: number\n\n /**\n * See [timestamp](https://docs.tigerbeetle.com/reference/accounts/#timestamp)\n */\n timestamp: bigint\n}\n\n\n/**\n* See [Transfer](https://docs.tigerbeetle.com/reference/transfers/#)\n*/\nexport type Transfer = {\n\n /**\n * See [id](https://docs.tigerbeetle.com/reference/transfers/#id)\n */\n id: bigint\n\n /**\n * See [debit_account_id](https://docs.tigerbeetle.com/reference/transfers/#debit_account_id)\n */\n debit_account_id: bigint\n\n /**\n * See [credit_account_id](https://docs.tigerbeetle.com/reference/transfers/#credit_account_id)\n */\n credit_account_id: bigint\n\n /**\n * See [amount](https://docs.tigerbeetle.com/reference/transfers/#amount)\n */\n amount: bigint\n\n /**\n * See [pending_id](https://docs.tigerbeetle.com/reference/transfers/#pending_id)\n */\n pending_id: bigint\n\n /**\n * See [user_data_128](https://docs.tigerbeetle.com/reference/transfers/#user_data_128)\n */\n user_data_128: bigint\n\n /**\n * See [user_data_64](https://docs.tigerbeetle.com/reference/transfers/#user_data_64)\n */\n user_data_64: bigint\n\n /**\n * See [user_data_32](https://docs.tigerbeetle.com/reference/transfers/#user_data_32)\n */\n user_data_32: number\n\n /**\n * See [timeout](https://docs.tigerbeetle.com/reference/transfers/#timeout)\n */\n timeout: number\n\n /**\n * See [ledger](https://docs.tigerbeetle.com/reference/transfers/#ledger)\n */\n ledger: number\n\n /**\n * See [code](https://docs.tigerbeetle.com/reference/transfers/#code)\n */\n code: number\n\n /**\n * See [flags](https://docs.tigerbeetle.com/reference/transfers/#flags)\n */\n flags: number\n\n /**\n * See [timestamp](https://docs.tigerbeetle.com/reference/transfers/#timestamp)\n */\n timestamp: bigint\n}\n\n\n/**\n* See [CreateAccountError](https://docs.tigerbeetle.com/reference/operations/create_accounts#)\n*/\nexport enum CreateAccountError {\n\n /**\n * See [ok](https://docs.tigerbeetle.com/reference/operations/create_accounts#ok)\n */\n ok = 0,\n\n /**\n * See [linked_event_failed](https://docs.tigerbeetle.com/reference/operations/create_accounts#linked_event_failed)\n */\n linked_event_failed = 1,\n\n /**\n * See [linked_event_chain_open](https://docs.tigerbeetle.com/reference/operations/create_accounts#linked_event_chain_open)\n */\n linked_event_chain_open = 2,\n\n /**\n * See [timestamp_must_be_zero](https://docs.tigerbeetle.com/reference/operations/create_accounts#timestamp_must_be_zero)\n */\n timestamp_must_be_zero = 3,\n\n /**\n * See [reserved_field](https://docs.tigerbeetle.com/reference/operations/create_accounts#reserved_field)\n */\n reserved_field = 4,\n\n /**\n * See [reserved_flag](https://docs.tigerbeetle.com/reference/operations/create_accounts#reserved_flag)\n */\n reserved_flag = 5,\n\n /**\n * See [id_must_not_be_zero](https://docs.tigerbeetle.com/reference/operations/create_accounts#id_must_not_be_zero)\n */\n id_must_not_be_zero = 6,\n\n /**\n * See [id_must_not_be_int_max](https://docs.tigerbeetle.com/reference/operations/create_accounts#id_must_not_be_int_max)\n */\n id_must_not_be_int_max = 7,\n\n /**\n * See [flags_are_mutually_exclusive](https://docs.tigerbeetle.com/reference/operations/create_accounts#flags_are_mutually_exclusive)\n */\n flags_are_mutually_exclusive = 8,\n\n /**\n * See [debits_pending_must_be_zero](https://docs.tigerbeetle.com/reference/operations/create_accounts#debits_pending_must_be_zero)\n */\n debits_pending_must_be_zero = 9,\n\n /**\n * See [debits_posted_must_be_zero](https://docs.tigerbeetle.com/reference/operations/create_accounts#debits_posted_must_be_zero)\n */\n debits_posted_must_be_zero = 10,\n\n /**\n * See [credits_pending_must_be_zero](https://docs.tigerbeetle.com/reference/operations/create_accounts#credits_pending_must_be_zero)\n */\n credits_pending_must_be_zero = 11,\n\n /**\n * See [credits_posted_must_be_zero](https://docs.tigerbeetle.com/reference/operations/create_accounts#credits_posted_must_be_zero)\n */\n credits_posted_must_be_zero = 12,\n\n /**\n * See [ledger_must_not_be_zero](https://docs.tigerbeetle.com/reference/operations/create_accounts#ledger_must_not_be_zero)\n */\n ledger_must_not_be_zero = 13,\n\n /**\n * See [code_must_not_be_zero](https://docs.tigerbeetle.com/reference/operations/create_accounts#code_must_not_be_zero)\n */\n code_must_not_be_zero = 14,\n\n /**\n * See [exists_with_different_flags](https://docs.tigerbeetle.com/reference/operations/create_accounts#exists_with_different_flags)\n */\n exists_with_different_flags = 15,\n\n /**\n * See [exists_with_different_user_data_128](https://docs.tigerbeetle.com/reference/operations/create_accounts#exists_with_different_user_data_128)\n */\n exists_with_different_user_data_128 = 16,\n\n /**\n * See [exists_with_different_user_data_64](https://docs.tigerbeetle.com/reference/operations/create_accounts#exists_with_different_user_data_64)\n */\n exists_with_different_user_data_64 = 17,\n\n /**\n * See [exists_with_different_user_data_32](https://docs.tigerbeetle.com/reference/operations/create_accounts#exists_with_different_user_data_32)\n */\n exists_with_different_user_data_32 = 18,\n\n /**\n * See [exists_with_different_ledger](https://docs.tigerbeetle.com/reference/operations/create_accounts#exists_with_different_ledger)\n */\n exists_with_different_ledger = 19,\n\n /**\n * See [exists_with_different_code](https://docs.tigerbeetle.com/reference/operations/create_accounts#exists_with_different_code)\n */\n exists_with_different_code = 20,\n\n /**\n * See [exists](https://docs.tigerbeetle.com/reference/operations/create_accounts#exists)\n */\n exists = 21,\n}\n\n\n/**\n* See [CreateTransferError](https://docs.tigerbeetle.com/reference/operations/create_transfers#)\n*/\nexport enum CreateTransferError {\n\n /**\n * See [ok](https://docs.tigerbeetle.com/reference/operations/create_transfers#ok)\n */\n ok = 0,\n\n /**\n * See [linked_event_failed](https://docs.tigerbeetle.com/reference/operations/create_transfers#linked_event_failed)\n */\n linked_event_failed = 1,\n\n /**\n * See [linked_event_chain_open](https://docs.tigerbeetle.com/reference/operations/create_transfers#linked_event_chain_open)\n */\n linked_event_chain_open = 2,\n\n /**\n * See [timestamp_must_be_zero](https://docs.tigerbeetle.com/reference/operations/create_transfers#timestamp_must_be_zero)\n */\n timestamp_must_be_zero = 3,\n\n /**\n * See [reserved_flag](https://docs.tigerbeetle.com/reference/operations/create_transfers#reserved_flag)\n */\n reserved_flag = 4,\n\n /**\n * See [id_must_not_be_zero](https://docs.tigerbeetle.com/reference/operations/create_transfers#id_must_not_be_zero)\n */\n id_must_not_be_zero = 5,\n\n /**\n * See [id_must_not_be_int_max](https://docs.tigerbeetle.com/reference/operations/create_transfers#id_must_not_be_int_max)\n */\n id_must_not_be_int_max = 6,\n\n /**\n * See [flags_are_mutually_exclusive](https://docs.tigerbeetle.com/reference/operations/create_transfers#flags_are_mutually_exclusive)\n */\n flags_are_mutually_exclusive = 7,\n\n /**\n * See [debit_account_id_must_not_be_zero](https://docs.tigerbeetle.com/reference/operations/create_transfers#debit_account_id_must_not_be_zero)\n */\n debit_account_id_must_not_be_zero = 8,\n\n /**\n * See [debit_account_id_must_not_be_int_max](https://docs.tigerbeetle.com/reference/operations/create_transfers#debit_account_id_must_not_be_int_max)\n */\n debit_account_id_must_not_be_int_max = 9,\n\n /**\n * See [credit_account_id_must_not_be_zero](https://docs.tigerbeetle.com/reference/operations/create_transfers#credit_account_id_must_not_be_zero)\n */\n credit_account_id_must_not_be_zero = 10,\n\n /**\n * See [credit_account_id_must_not_be_int_max](https://docs.tigerbeetle.com/reference/operations/create_transfers#credit_account_id_must_not_be_int_max)\n */\n credit_account_id_must_not_be_int_max = 11,\n\n /**\n * See [accounts_must_be_different](https://docs.tigerbeetle.com/reference/operations/create_transfers#accounts_must_be_different)\n */\n accounts_must_be_different = 12,\n\n /**\n * See [pending_id_must_be_zero](https://docs.tigerbeetle.com/reference/operations/create_transfers#pending_id_must_be_zero)\n */\n pending_id_must_be_zero = 13,\n\n /**\n * See [pending_id_must_not_be_zero](https://docs.tigerbeetle.com/reference/operations/create_transfers#pending_id_must_not_be_zero)\n */\n pending_id_must_not_be_zero = 14,\n\n /**\n * See [pending_id_must_not_be_int_max](https://docs.tigerbeetle.com/reference/operations/create_transfers#pending_id_must_not_be_int_max)\n */\n pending_id_must_not_be_int_max = 15,\n\n /**\n * See [pending_id_must_be_different](https://docs.tigerbeetle.com/reference/operations/create_transfers#pending_id_must_be_different)\n */\n pending_id_must_be_different = 16,\n\n /**\n * See [timeout_reserved_for_pending_transfer](https://docs.tigerbeetle.com/reference/operations/create_transfers#timeout_reserved_for_pending_transfer)\n */\n timeout_reserved_for_pending_transfer = 17,\n\n /**\n * See [amount_must_not_be_zero](https://docs.tigerbeetle.com/reference/operations/create_transfers#amount_must_not_be_zero)\n */\n amount_must_not_be_zero = 18,\n\n /**\n * See [ledger_must_not_be_zero](https://docs.tigerbeetle.com/reference/operations/create_transfers#ledger_must_not_be_zero)\n */\n ledger_must_not_be_zero = 19,\n\n /**\n * See [code_must_not_be_zero](https://docs.tigerbeetle.com/reference/operations/create_transfers#code_must_not_be_zero)\n */\n code_must_not_be_zero = 20,\n\n /**\n * See [debit_account_not_found](https://docs.tigerbeetle.com/reference/operations/create_transfers#debit_account_not_found)\n */\n debit_account_not_found = 21,\n\n /**\n * See [credit_account_not_found](https://docs.tigerbeetle.com/reference/operations/create_transfers#credit_account_not_found)\n */\n credit_account_not_found = 22,\n\n /**\n * See [accounts_must_have_the_same_ledger](https://docs.tigerbeetle.com/reference/operations/create_transfers#accounts_must_have_the_same_ledger)\n */\n accounts_must_have_the_same_ledger = 23,\n\n /**\n * See [transfer_must_have_the_same_ledger_as_accounts](https://docs.tigerbeetle.com/reference/operations/create_transfers#transfer_must_have_the_same_ledger_as_accounts)\n */\n transfer_must_have_the_same_ledger_as_accounts = 24,\n\n /**\n * See [pending_transfer_not_found](https://docs.tigerbeetle.com/reference/operations/create_transfers#pending_transfer_not_found)\n */\n pending_transfer_not_found = 25,\n\n /**\n * See [pending_transfer_not_pending](https://docs.tigerbeetle.com/reference/operations/create_transfers#pending_transfer_not_pending)\n */\n pending_transfer_not_pending = 26,\n\n /**\n * See [pending_transfer_has_different_debit_account_id](https://docs.tigerbeetle.com/reference/operations/create_transfers#pending_transfer_has_different_debit_account_id)\n */\n pending_transfer_has_different_debit_account_id = 27,\n\n /**\n * See [pending_transfer_has_different_credit_account_id](https://docs.tigerbeetle.com/reference/operations/create_transfers#pending_transfer_has_different_credit_account_id)\n */\n pending_transfer_has_different_credit_account_id = 28,\n\n /**\n * See [pending_transfer_has_different_ledger](https://docs.tigerbeetle.com/reference/operations/create_transfers#pending_transfer_has_different_ledger)\n */\n pending_transfer_has_different_ledger = 29,\n\n /**\n * See [pending_transfer_has_different_code](https://docs.tigerbeetle.com/reference/operations/create_transfers#pending_transfer_has_different_code)\n */\n pending_transfer_has_different_code = 30,\n\n /**\n * See [exceeds_pending_transfer_amount](https://docs.tigerbeetle.com/reference/operations/create_transfers#exceeds_pending_transfer_amount)\n */\n exceeds_pending_transfer_amount = 31,\n\n /**\n * See [pending_transfer_has_different_amount](https://docs.tigerbeetle.com/reference/operations/create_transfers#pending_transfer_has_different_amount)\n */\n pending_transfer_has_different_amount = 32,\n\n /**\n * See [pending_transfer_already_posted](https://docs.tigerbeetle.com/reference/operations/create_transfers#pending_transfer_already_posted)\n */\n pending_transfer_already_posted = 33,\n\n /**\n * See [pending_transfer_already_voided](https://docs.tigerbeetle.com/reference/operations/create_transfers#pending_transfer_already_voided)\n */\n pending_transfer_already_voided = 34,\n\n /**\n * See [pending_transfer_expired](https://docs.tigerbeetle.com/reference/operations/create_transfers#pending_transfer_expired)\n */\n pending_transfer_expired = 35,\n\n /**\n * See [exists_with_different_flags](https://docs.tigerbeetle.com/reference/operations/create_transfers#exists_with_different_flags)\n */\n exists_with_different_flags = 36,\n\n /**\n * See [exists_with_different_debit_account_id](https://docs.tigerbeetle.com/reference/operations/create_transfers#exists_with_different_debit_account_id)\n */\n exists_with_different_debit_account_id = 37,\n\n /**\n * See [exists_with_different_credit_account_id](https://docs.tigerbeetle.com/reference/operations/create_transfers#exists_with_different_credit_account_id)\n */\n exists_with_different_credit_account_id = 38,\n\n /**\n * See [exists_with_different_amount](https://docs.tigerbeetle.com/reference/operations/create_transfers#exists_with_different_amount)\n */\n exists_with_different_amount = 39,\n\n /**\n * See [exists_with_different_pending_id](https://docs.tigerbeetle.com/reference/operations/create_transfers#exists_with_different_pending_id)\n */\n exists_with_different_pending_id = 40,\n\n /**\n * See [exists_with_different_user_data_128](https://docs.tigerbeetle.com/reference/operations/create_transfers#exists_with_different_user_data_128)\n */\n exists_with_different_user_data_128 = 41,\n\n /**\n * See [exists_with_different_user_data_64](https://docs.tigerbeetle.com/reference/operations/create_transfers#exists_with_different_user_data_64)\n */\n exists_with_different_user_data_64 = 42,\n\n /**\n * See [exists_with_different_user_data_32](https://docs.tigerbeetle.com/reference/operations/create_transfers#exists_with_different_user_data_32)\n */\n exists_with_different_user_data_32 = 43,\n\n /**\n * See [exists_with_different_timeout](https://docs.tigerbeetle.com/reference/operations/create_transfers#exists_with_different_timeout)\n */\n exists_with_different_timeout = 44,\n\n /**\n * See [exists_with_different_code](https://docs.tigerbeetle.com/reference/operations/create_transfers#exists_with_different_code)\n */\n exists_with_different_code = 45,\n\n /**\n * See [exists](https://docs.tigerbeetle.com/reference/operations/create_transfers#exists)\n */\n exists = 46,\n\n /**\n * See [overflows_debits_pending](https://docs.tigerbeetle.com/reference/operations/create_transfers#overflows_debits_pending)\n */\n overflows_debits_pending = 47,\n\n /**\n * See [overflows_credits_pending](https://docs.tigerbeetle.com/reference/operations/create_transfers#overflows_credits_pending)\n */\n overflows_credits_pending = 48,\n\n /**\n * See [overflows_debits_posted](https://docs.tigerbeetle.com/reference/operations/create_transfers#overflows_debits_posted)\n */\n overflows_debits_posted = 49,\n\n /**\n * See [overflows_credits_posted](https://docs.tigerbeetle.com/reference/operations/create_transfers#overflows_credits_posted)\n */\n overflows_credits_posted = 50,\n\n /**\n * See [overflows_debits](https://docs.tigerbeetle.com/reference/operations/create_transfers#overflows_debits)\n */\n overflows_debits = 51,\n\n /**\n * See [overflows_credits](https://docs.tigerbeetle.com/reference/operations/create_transfers#overflows_credits)\n */\n overflows_credits = 52,\n\n /**\n * See [overflows_timeout](https://docs.tigerbeetle.com/reference/operations/create_transfers#overflows_timeout)\n */\n overflows_timeout = 53,\n\n /**\n * See [exceeds_credits](https://docs.tigerbeetle.com/reference/operations/create_transfers#exceeds_credits)\n */\n exceeds_credits = 54,\n\n /**\n * See [exceeds_debits](https://docs.tigerbeetle.com/reference/operations/create_transfers#exceeds_debits)\n */\n exceeds_debits = 55,\n}\n\nexport type CreateAccountsError = {\n index: number\n result: CreateAccountError\n}\n\nexport type CreateTransfersError = {\n index: number\n result: CreateTransferError\n}\n\n\n/**\n* See [GetAccountTransfers](https://docs.tigerbeetle.com/reference/operations/get_account_transfers#)\n*/\nexport type GetAccountTransfers = {\n\n /**\n * See [account_id](https://docs.tigerbeetle.com/reference/operations/get_account_transfers#account_id)\n */\n account_id: bigint\n\n /**\n * See [timestamp](https://docs.tigerbeetle.com/reference/operations/get_account_transfers#timestamp)\n */\n timestamp: bigint\n\n /**\n * See [limit](https://docs.tigerbeetle.com/reference/operations/get_account_transfers#limit)\n */\n limit: number\n\n /**\n * See [flags](https://docs.tigerbeetle.com/reference/operations/get_account_transfers#flags)\n */\n flags: number\n}\n\nexport enum Operation {\n create_accounts = 128,\n create_transfers = 129,\n lookup_accounts = 130,\n lookup_transfers = 131,\n get_account_transfers = 132,\n}\n\n"]}
|
|
1
|
+
{"version":3,"file":"bindings.js","sourceRoot":"","sources":["../src/bindings.ts"],"names":[],"mappings":";;;AASA,IAAY,YAiBX;AAjBD,WAAY,YAAY;IACtB,+CAAQ,CAAA;IAKR,mDAAiB,CAAA;IAKjB,mGAAyC,CAAA;IAKzC,mGAAyC,CAAA;AAC3C,CAAC,EAjBW,YAAY,GAAZ,oBAAY,KAAZ,oBAAY,QAiBvB;AAMD,IAAY,aAgCX;AAhCD,WAAY,aAAa;IACvB,iDAAQ,CAAA;IAKR,qDAAiB,CAAA;IAKjB,uDAAkB,CAAA;IAKlB,mFAAgC,CAAA;IAKhC,mFAAgC,CAAA;IAKhC,wEAA0B,CAAA;IAK1B,0EAA2B,CAAA;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GAAiC,CAAA;IAKjC,gIAA0C,CAAA;IAK1C,oGAA4B,CAAA;IAK5B,oGAA4B,CAAA;IAK5B,gGAA0B,CAAA;IAK1B,oGAA4B,CAAA;IAK5B,sGAA6B,CAAA;IAK7B,0HAAuC,CAAA;IAKvC,kJAAmD,CAAA;IAKnD,0GAA+B,CAAA;IAK/B,8GAAiC,CAAA;IAKjC,oJAAoD,CAAA;IAKpD,sJAAqD,CAAA;IAKrD,gIAA0C,CAAA;IAK1C,4HAAwC,CAAA;IAKxC,oHAAoC,CAAA;IAKpC,gIAA0C,CAAA;IAK1C,oHAAoC,CAAA;IAKpC,oHAAoC,CAAA;IAKpC,sGAA6B,CAAA;IAK7B,4GAAgC,CAAA;IAKhC,kIAA2C,CAAA;IAK3C,oIAA4C,CAAA;IAK5C,8GAAiC,CAAA;IAKjC,sHAAqC,CAAA;IAKrC,4HAAwC,CAAA;IAKxC,0HAAuC,CAAA;IAKvC,0HAAuC,CAAA;IAKvC,gHAAkC,CAAA;IAKlC,0GAA+B,CAAA;IAK/B,kEAAW,CAAA;IAKX,sGAA6B,CAAA;IAK7B,wGAA8B,CAAA;IAK9B,oGAA4B,CAAA;IAK5B,sGAA6B,CAAA;IAK7B,sFAAqB,CAAA;IAKrB,wFAAsB,CAAA;IAKtB,wFAAsB,CAAA;IAKtB,oFAAoB,CAAA;IAKpB,kFAAmB,CAAA;AACrB,CAAC,EAzRW,mBAAmB,GAAnB,2BAAmB,KAAnB,2BAAmB,QAyR9B;AA4CD,IAAY,SAMX;AAND,WAAY,SAAS;IACnB,iEAAqB,CAAA;IACrB,mEAAsB,CAAA;IACtB,iEAAqB,CAAA;IACrB,mEAAsB,CAAA;IACtB,6EAA2B,CAAA;AAC7B,CAAC,EANW,SAAS,GAAT,iBAAS,KAAT,iBAAS,QAMpB","sourcesContent":["///////////////////////////////////////////////////////\n// This file was auto-generated by node_bindings.zig //\n// Do not manually modify. //\n///////////////////////////////////////////////////////\n\n\n/**\n* See [AccountFlags](https://docs.tigerbeetle.com/reference/accounts#flags)\n*/\nexport enum AccountFlags {\n none = 0,\n\n /**\n * See [linked](https://docs.tigerbeetle.com/reference/accounts#flagslinked)\n */\n linked = (1 << 0),\n\n /**\n * See [debits_must_not_exceed_credits](https://docs.tigerbeetle.com/reference/accounts#flagsdebits_must_not_exceed_credits)\n */\n debits_must_not_exceed_credits = (1 << 1),\n\n /**\n * See [credits_must_not_exceed_debits](https://docs.tigerbeetle.com/reference/accounts#flagscredits_must_not_exceed_debits)\n */\n credits_must_not_exceed_debits = (1 << 2),\n}\n\n\n/**\n* See [TransferFlags](https://docs.tigerbeetle.com/reference/transfers#flags)\n*/\nexport enum TransferFlags {\n none = 0,\n\n /**\n * See [linked](https://docs.tigerbeetle.com/reference/transfers#flagslinked)\n */\n linked = (1 << 0),\n\n /**\n * See [pending](https://docs.tigerbeetle.com/reference/transfers#flagspending)\n */\n pending = (1 << 1),\n\n /**\n * See [post_pending_transfer](https://docs.tigerbeetle.com/reference/transfers#flagspost_pending_transfer)\n */\n post_pending_transfer = (1 << 2),\n\n /**\n * See [void_pending_transfer](https://docs.tigerbeetle.com/reference/transfers#flagsvoid_pending_transfer)\n */\n void_pending_transfer = (1 << 3),\n\n /**\n * See [balancing_debit](https://docs.tigerbeetle.com/reference/transfers#flagsbalancing_debit)\n */\n balancing_debit = (1 << 4),\n\n /**\n * See [balancing_credit](https://docs.tigerbeetle.com/reference/transfers#flagsbalancing_credit)\n */\n balancing_credit = (1 << 5),\n}\n\n\n/**\n* See [GetAccountTransfersFlags](https://docs.tigerbeetle.com/reference/operations/get_account_transfers#flags)\n*/\nexport enum GetAccountTransfersFlags {\n none = 0,\n\n /**\n * See [debits](https://docs.tigerbeetle.com/reference/operations/get_account_transfers#flagsdebits)\n */\n debits = (1 << 0),\n\n /**\n * See [credits](https://docs.tigerbeetle.com/reference/operations/get_account_transfers#flagscredits)\n */\n credits = (1 << 1),\n\n /**\n * See [reversed](https://docs.tigerbeetle.com/reference/operations/get_account_transfers#flagsreversed)\n */\n reversed = (1 << 2),\n}\n\n\n/**\n* See [Account](https://docs.tigerbeetle.com/reference/accounts/#)\n*/\nexport type Account = {\n\n /**\n * See [id](https://docs.tigerbeetle.com/reference/accounts/#id)\n */\n id: bigint\n\n /**\n * See [debits_pending](https://docs.tigerbeetle.com/reference/accounts/#debits_pending)\n */\n debits_pending: bigint\n\n /**\n * See [debits_posted](https://docs.tigerbeetle.com/reference/accounts/#debits_posted)\n */\n debits_posted: bigint\n\n /**\n * See [credits_pending](https://docs.tigerbeetle.com/reference/accounts/#credits_pending)\n */\n credits_pending: bigint\n\n /**\n * See [credits_posted](https://docs.tigerbeetle.com/reference/accounts/#credits_posted)\n */\n credits_posted: bigint\n\n /**\n * See [user_data_128](https://docs.tigerbeetle.com/reference/accounts/#user_data_128)\n */\n user_data_128: bigint\n\n /**\n * See [user_data_64](https://docs.tigerbeetle.com/reference/accounts/#user_data_64)\n */\n user_data_64: bigint\n\n /**\n * See [user_data_32](https://docs.tigerbeetle.com/reference/accounts/#user_data_32)\n */\n user_data_32: number\n\n /**\n * See [reserved](https://docs.tigerbeetle.com/reference/accounts/#reserved)\n */\n reserved: number\n\n /**\n * See [ledger](https://docs.tigerbeetle.com/reference/accounts/#ledger)\n */\n ledger: number\n\n /**\n * See [code](https://docs.tigerbeetle.com/reference/accounts/#code)\n */\n code: number\n\n /**\n * See [flags](https://docs.tigerbeetle.com/reference/accounts/#flags)\n */\n flags: number\n\n /**\n * See [timestamp](https://docs.tigerbeetle.com/reference/accounts/#timestamp)\n */\n timestamp: bigint\n}\n\n\n/**\n* See [Transfer](https://docs.tigerbeetle.com/reference/transfers/#)\n*/\nexport type Transfer = {\n\n /**\n * See [id](https://docs.tigerbeetle.com/reference/transfers/#id)\n */\n id: bigint\n\n /**\n * See [debit_account_id](https://docs.tigerbeetle.com/reference/transfers/#debit_account_id)\n */\n debit_account_id: bigint\n\n /**\n * See [credit_account_id](https://docs.tigerbeetle.com/reference/transfers/#credit_account_id)\n */\n credit_account_id: bigint\n\n /**\n * See [amount](https://docs.tigerbeetle.com/reference/transfers/#amount)\n */\n amount: bigint\n\n /**\n * See [pending_id](https://docs.tigerbeetle.com/reference/transfers/#pending_id)\n */\n pending_id: bigint\n\n /**\n * See [user_data_128](https://docs.tigerbeetle.com/reference/transfers/#user_data_128)\n */\n user_data_128: bigint\n\n /**\n * See [user_data_64](https://docs.tigerbeetle.com/reference/transfers/#user_data_64)\n */\n user_data_64: bigint\n\n /**\n * See [user_data_32](https://docs.tigerbeetle.com/reference/transfers/#user_data_32)\n */\n user_data_32: number\n\n /**\n * See [timeout](https://docs.tigerbeetle.com/reference/transfers/#timeout)\n */\n timeout: number\n\n /**\n * See [ledger](https://docs.tigerbeetle.com/reference/transfers/#ledger)\n */\n ledger: number\n\n /**\n * See [code](https://docs.tigerbeetle.com/reference/transfers/#code)\n */\n code: number\n\n /**\n * See [flags](https://docs.tigerbeetle.com/reference/transfers/#flags)\n */\n flags: number\n\n /**\n * See [timestamp](https://docs.tigerbeetle.com/reference/transfers/#timestamp)\n */\n timestamp: bigint\n}\n\n\n/**\n* See [CreateAccountError](https://docs.tigerbeetle.com/reference/operations/create_accounts#)\n*/\nexport enum CreateAccountError {\n\n /**\n * See [ok](https://docs.tigerbeetle.com/reference/operations/create_accounts#ok)\n */\n ok = 0,\n\n /**\n * See [linked_event_failed](https://docs.tigerbeetle.com/reference/operations/create_accounts#linked_event_failed)\n */\n linked_event_failed = 1,\n\n /**\n * See [linked_event_chain_open](https://docs.tigerbeetle.com/reference/operations/create_accounts#linked_event_chain_open)\n */\n linked_event_chain_open = 2,\n\n /**\n * See [timestamp_must_be_zero](https://docs.tigerbeetle.com/reference/operations/create_accounts#timestamp_must_be_zero)\n */\n timestamp_must_be_zero = 3,\n\n /**\n * See [reserved_field](https://docs.tigerbeetle.com/reference/operations/create_accounts#reserved_field)\n */\n reserved_field = 4,\n\n /**\n * See [reserved_flag](https://docs.tigerbeetle.com/reference/operations/create_accounts#reserved_flag)\n */\n reserved_flag = 5,\n\n /**\n * See [id_must_not_be_zero](https://docs.tigerbeetle.com/reference/operations/create_accounts#id_must_not_be_zero)\n */\n id_must_not_be_zero = 6,\n\n /**\n * See [id_must_not_be_int_max](https://docs.tigerbeetle.com/reference/operations/create_accounts#id_must_not_be_int_max)\n */\n id_must_not_be_int_max = 7,\n\n /**\n * See [flags_are_mutually_exclusive](https://docs.tigerbeetle.com/reference/operations/create_accounts#flags_are_mutually_exclusive)\n */\n flags_are_mutually_exclusive = 8,\n\n /**\n * See [debits_pending_must_be_zero](https://docs.tigerbeetle.com/reference/operations/create_accounts#debits_pending_must_be_zero)\n */\n debits_pending_must_be_zero = 9,\n\n /**\n * See [debits_posted_must_be_zero](https://docs.tigerbeetle.com/reference/operations/create_accounts#debits_posted_must_be_zero)\n */\n debits_posted_must_be_zero = 10,\n\n /**\n * See [credits_pending_must_be_zero](https://docs.tigerbeetle.com/reference/operations/create_accounts#credits_pending_must_be_zero)\n */\n credits_pending_must_be_zero = 11,\n\n /**\n * See [credits_posted_must_be_zero](https://docs.tigerbeetle.com/reference/operations/create_accounts#credits_posted_must_be_zero)\n */\n credits_posted_must_be_zero = 12,\n\n /**\n * See [ledger_must_not_be_zero](https://docs.tigerbeetle.com/reference/operations/create_accounts#ledger_must_not_be_zero)\n */\n ledger_must_not_be_zero = 13,\n\n /**\n * See [code_must_not_be_zero](https://docs.tigerbeetle.com/reference/operations/create_accounts#code_must_not_be_zero)\n */\n code_must_not_be_zero = 14,\n\n /**\n * See [exists_with_different_flags](https://docs.tigerbeetle.com/reference/operations/create_accounts#exists_with_different_flags)\n */\n exists_with_different_flags = 15,\n\n /**\n * See [exists_with_different_user_data_128](https://docs.tigerbeetle.com/reference/operations/create_accounts#exists_with_different_user_data_128)\n */\n exists_with_different_user_data_128 = 16,\n\n /**\n * See [exists_with_different_user_data_64](https://docs.tigerbeetle.com/reference/operations/create_accounts#exists_with_different_user_data_64)\n */\n exists_with_different_user_data_64 = 17,\n\n /**\n * See [exists_with_different_user_data_32](https://docs.tigerbeetle.com/reference/operations/create_accounts#exists_with_different_user_data_32)\n */\n exists_with_different_user_data_32 = 18,\n\n /**\n * See [exists_with_different_ledger](https://docs.tigerbeetle.com/reference/operations/create_accounts#exists_with_different_ledger)\n */\n exists_with_different_ledger = 19,\n\n /**\n * See [exists_with_different_code](https://docs.tigerbeetle.com/reference/operations/create_accounts#exists_with_different_code)\n */\n exists_with_different_code = 20,\n\n /**\n * See [exists](https://docs.tigerbeetle.com/reference/operations/create_accounts#exists)\n */\n exists = 21,\n}\n\n\n/**\n* See [CreateTransferError](https://docs.tigerbeetle.com/reference/operations/create_transfers#)\n*/\nexport enum CreateTransferError {\n\n /**\n * See [ok](https://docs.tigerbeetle.com/reference/operations/create_transfers#ok)\n */\n ok = 0,\n\n /**\n * See [linked_event_failed](https://docs.tigerbeetle.com/reference/operations/create_transfers#linked_event_failed)\n */\n linked_event_failed = 1,\n\n /**\n * See [linked_event_chain_open](https://docs.tigerbeetle.com/reference/operations/create_transfers#linked_event_chain_open)\n */\n linked_event_chain_open = 2,\n\n /**\n * See [timestamp_must_be_zero](https://docs.tigerbeetle.com/reference/operations/create_transfers#timestamp_must_be_zero)\n */\n timestamp_must_be_zero = 3,\n\n /**\n * See [reserved_flag](https://docs.tigerbeetle.com/reference/operations/create_transfers#reserved_flag)\n */\n reserved_flag = 4,\n\n /**\n * See [id_must_not_be_zero](https://docs.tigerbeetle.com/reference/operations/create_transfers#id_must_not_be_zero)\n */\n id_must_not_be_zero = 5,\n\n /**\n * See [id_must_not_be_int_max](https://docs.tigerbeetle.com/reference/operations/create_transfers#id_must_not_be_int_max)\n */\n id_must_not_be_int_max = 6,\n\n /**\n * See [flags_are_mutually_exclusive](https://docs.tigerbeetle.com/reference/operations/create_transfers#flags_are_mutually_exclusive)\n */\n flags_are_mutually_exclusive = 7,\n\n /**\n * See [debit_account_id_must_not_be_zero](https://docs.tigerbeetle.com/reference/operations/create_transfers#debit_account_id_must_not_be_zero)\n */\n debit_account_id_must_not_be_zero = 8,\n\n /**\n * See [debit_account_id_must_not_be_int_max](https://docs.tigerbeetle.com/reference/operations/create_transfers#debit_account_id_must_not_be_int_max)\n */\n debit_account_id_must_not_be_int_max = 9,\n\n /**\n * See [credit_account_id_must_not_be_zero](https://docs.tigerbeetle.com/reference/operations/create_transfers#credit_account_id_must_not_be_zero)\n */\n credit_account_id_must_not_be_zero = 10,\n\n /**\n * See [credit_account_id_must_not_be_int_max](https://docs.tigerbeetle.com/reference/operations/create_transfers#credit_account_id_must_not_be_int_max)\n */\n credit_account_id_must_not_be_int_max = 11,\n\n /**\n * See [accounts_must_be_different](https://docs.tigerbeetle.com/reference/operations/create_transfers#accounts_must_be_different)\n */\n accounts_must_be_different = 12,\n\n /**\n * See [pending_id_must_be_zero](https://docs.tigerbeetle.com/reference/operations/create_transfers#pending_id_must_be_zero)\n */\n pending_id_must_be_zero = 13,\n\n /**\n * See [pending_id_must_not_be_zero](https://docs.tigerbeetle.com/reference/operations/create_transfers#pending_id_must_not_be_zero)\n */\n pending_id_must_not_be_zero = 14,\n\n /**\n * See [pending_id_must_not_be_int_max](https://docs.tigerbeetle.com/reference/operations/create_transfers#pending_id_must_not_be_int_max)\n */\n pending_id_must_not_be_int_max = 15,\n\n /**\n * See [pending_id_must_be_different](https://docs.tigerbeetle.com/reference/operations/create_transfers#pending_id_must_be_different)\n */\n pending_id_must_be_different = 16,\n\n /**\n * See [timeout_reserved_for_pending_transfer](https://docs.tigerbeetle.com/reference/operations/create_transfers#timeout_reserved_for_pending_transfer)\n */\n timeout_reserved_for_pending_transfer = 17,\n\n /**\n * See [amount_must_not_be_zero](https://docs.tigerbeetle.com/reference/operations/create_transfers#amount_must_not_be_zero)\n */\n amount_must_not_be_zero = 18,\n\n /**\n * See [ledger_must_not_be_zero](https://docs.tigerbeetle.com/reference/operations/create_transfers#ledger_must_not_be_zero)\n */\n ledger_must_not_be_zero = 19,\n\n /**\n * See [code_must_not_be_zero](https://docs.tigerbeetle.com/reference/operations/create_transfers#code_must_not_be_zero)\n */\n code_must_not_be_zero = 20,\n\n /**\n * See [debit_account_not_found](https://docs.tigerbeetle.com/reference/operations/create_transfers#debit_account_not_found)\n */\n debit_account_not_found = 21,\n\n /**\n * See [credit_account_not_found](https://docs.tigerbeetle.com/reference/operations/create_transfers#credit_account_not_found)\n */\n credit_account_not_found = 22,\n\n /**\n * See [accounts_must_have_the_same_ledger](https://docs.tigerbeetle.com/reference/operations/create_transfers#accounts_must_have_the_same_ledger)\n */\n accounts_must_have_the_same_ledger = 23,\n\n /**\n * See [transfer_must_have_the_same_ledger_as_accounts](https://docs.tigerbeetle.com/reference/operations/create_transfers#transfer_must_have_the_same_ledger_as_accounts)\n */\n transfer_must_have_the_same_ledger_as_accounts = 24,\n\n /**\n * See [pending_transfer_not_found](https://docs.tigerbeetle.com/reference/operations/create_transfers#pending_transfer_not_found)\n */\n pending_transfer_not_found = 25,\n\n /**\n * See [pending_transfer_not_pending](https://docs.tigerbeetle.com/reference/operations/create_transfers#pending_transfer_not_pending)\n */\n pending_transfer_not_pending = 26,\n\n /**\n * See [pending_transfer_has_different_debit_account_id](https://docs.tigerbeetle.com/reference/operations/create_transfers#pending_transfer_has_different_debit_account_id)\n */\n pending_transfer_has_different_debit_account_id = 27,\n\n /**\n * See [pending_transfer_has_different_credit_account_id](https://docs.tigerbeetle.com/reference/operations/create_transfers#pending_transfer_has_different_credit_account_id)\n */\n pending_transfer_has_different_credit_account_id = 28,\n\n /**\n * See [pending_transfer_has_different_ledger](https://docs.tigerbeetle.com/reference/operations/create_transfers#pending_transfer_has_different_ledger)\n */\n pending_transfer_has_different_ledger = 29,\n\n /**\n * See [pending_transfer_has_different_code](https://docs.tigerbeetle.com/reference/operations/create_transfers#pending_transfer_has_different_code)\n */\n pending_transfer_has_different_code = 30,\n\n /**\n * See [exceeds_pending_transfer_amount](https://docs.tigerbeetle.com/reference/operations/create_transfers#exceeds_pending_transfer_amount)\n */\n exceeds_pending_transfer_amount = 31,\n\n /**\n * See [pending_transfer_has_different_amount](https://docs.tigerbeetle.com/reference/operations/create_transfers#pending_transfer_has_different_amount)\n */\n pending_transfer_has_different_amount = 32,\n\n /**\n * See [pending_transfer_already_posted](https://docs.tigerbeetle.com/reference/operations/create_transfers#pending_transfer_already_posted)\n */\n pending_transfer_already_posted = 33,\n\n /**\n * See [pending_transfer_already_voided](https://docs.tigerbeetle.com/reference/operations/create_transfers#pending_transfer_already_voided)\n */\n pending_transfer_already_voided = 34,\n\n /**\n * See [pending_transfer_expired](https://docs.tigerbeetle.com/reference/operations/create_transfers#pending_transfer_expired)\n */\n pending_transfer_expired = 35,\n\n /**\n * See [exists_with_different_flags](https://docs.tigerbeetle.com/reference/operations/create_transfers#exists_with_different_flags)\n */\n exists_with_different_flags = 36,\n\n /**\n * See [exists_with_different_debit_account_id](https://docs.tigerbeetle.com/reference/operations/create_transfers#exists_with_different_debit_account_id)\n */\n exists_with_different_debit_account_id = 37,\n\n /**\n * See [exists_with_different_credit_account_id](https://docs.tigerbeetle.com/reference/operations/create_transfers#exists_with_different_credit_account_id)\n */\n exists_with_different_credit_account_id = 38,\n\n /**\n * See [exists_with_different_amount](https://docs.tigerbeetle.com/reference/operations/create_transfers#exists_with_different_amount)\n */\n exists_with_different_amount = 39,\n\n /**\n * See [exists_with_different_pending_id](https://docs.tigerbeetle.com/reference/operations/create_transfers#exists_with_different_pending_id)\n */\n exists_with_different_pending_id = 40,\n\n /**\n * See [exists_with_different_user_data_128](https://docs.tigerbeetle.com/reference/operations/create_transfers#exists_with_different_user_data_128)\n */\n exists_with_different_user_data_128 = 41,\n\n /**\n * See [exists_with_different_user_data_64](https://docs.tigerbeetle.com/reference/operations/create_transfers#exists_with_different_user_data_64)\n */\n exists_with_different_user_data_64 = 42,\n\n /**\n * See [exists_with_different_user_data_32](https://docs.tigerbeetle.com/reference/operations/create_transfers#exists_with_different_user_data_32)\n */\n exists_with_different_user_data_32 = 43,\n\n /**\n * See [exists_with_different_timeout](https://docs.tigerbeetle.com/reference/operations/create_transfers#exists_with_different_timeout)\n */\n exists_with_different_timeout = 44,\n\n /**\n * See [exists_with_different_code](https://docs.tigerbeetle.com/reference/operations/create_transfers#exists_with_different_code)\n */\n exists_with_different_code = 45,\n\n /**\n * See [exists](https://docs.tigerbeetle.com/reference/operations/create_transfers#exists)\n */\n exists = 46,\n\n /**\n * See [overflows_debits_pending](https://docs.tigerbeetle.com/reference/operations/create_transfers#overflows_debits_pending)\n */\n overflows_debits_pending = 47,\n\n /**\n * See [overflows_credits_pending](https://docs.tigerbeetle.com/reference/operations/create_transfers#overflows_credits_pending)\n */\n overflows_credits_pending = 48,\n\n /**\n * See [overflows_debits_posted](https://docs.tigerbeetle.com/reference/operations/create_transfers#overflows_debits_posted)\n */\n overflows_debits_posted = 49,\n\n /**\n * See [overflows_credits_posted](https://docs.tigerbeetle.com/reference/operations/create_transfers#overflows_credits_posted)\n */\n overflows_credits_posted = 50,\n\n /**\n * See [overflows_debits](https://docs.tigerbeetle.com/reference/operations/create_transfers#overflows_debits)\n */\n overflows_debits = 51,\n\n /**\n * See [overflows_credits](https://docs.tigerbeetle.com/reference/operations/create_transfers#overflows_credits)\n */\n overflows_credits = 52,\n\n /**\n * See [overflows_timeout](https://docs.tigerbeetle.com/reference/operations/create_transfers#overflows_timeout)\n */\n overflows_timeout = 53,\n\n /**\n * See [exceeds_credits](https://docs.tigerbeetle.com/reference/operations/create_transfers#exceeds_credits)\n */\n exceeds_credits = 54,\n\n /**\n * See [exceeds_debits](https://docs.tigerbeetle.com/reference/operations/create_transfers#exceeds_debits)\n */\n exceeds_debits = 55,\n}\n\nexport type CreateAccountsError = {\n index: number\n result: CreateAccountError\n}\n\nexport type CreateTransfersError = {\n index: number\n result: CreateTransferError\n}\n\n\n/**\n* See [GetAccountTransfers](https://docs.tigerbeetle.com/reference/operations/get_account_transfers#)\n*/\nexport type GetAccountTransfers = {\n\n /**\n * See [account_id](https://docs.tigerbeetle.com/reference/operations/get_account_transfers#account_id)\n */\n account_id: bigint\n\n /**\n * See [timestamp_min](https://docs.tigerbeetle.com/reference/operations/get_account_transfers#timestamp_min)\n */\n timestamp_min: bigint\n\n /**\n * See [timestamp_max](https://docs.tigerbeetle.com/reference/operations/get_account_transfers#timestamp_max)\n */\n timestamp_max: bigint\n\n /**\n * See [limit](https://docs.tigerbeetle.com/reference/operations/get_account_transfers#limit)\n */\n limit: number\n\n /**\n * See [flags](https://docs.tigerbeetle.com/reference/operations/get_account_transfers#flags)\n */\n flags: number\n}\n\nexport enum Operation {\n create_accounts = 128,\n create_transfers = 129,\n lookup_accounts = 130,\n lookup_transfers = 131,\n get_account_transfers = 132,\n}\n\n"]}
|
package/dist/test.js
CHANGED
|
@@ -65,9 +65,11 @@ test('can return error on account', async () => {
|
|
|
65
65
|
assert_1.default.strictEqual(errors.length, 1);
|
|
66
66
|
assert_1.default.deepStrictEqual(errors[0], { index: 0, result: _1.CreateAccountError.exists });
|
|
67
67
|
});
|
|
68
|
-
test('
|
|
68
|
+
test('error if timestamp is not set to 0n on account', async () => {
|
|
69
69
|
const account = { ...accountA, timestamp: 2n, id: 3n };
|
|
70
|
-
await
|
|
70
|
+
const errors = await client.createAccounts([account]);
|
|
71
|
+
assert_1.default.strictEqual(errors.length, 1);
|
|
72
|
+
assert_1.default.deepStrictEqual(errors[0], { index: 0, result: _1.CreateAccountError.timestamp_must_be_zero });
|
|
71
73
|
});
|
|
72
74
|
test('can lookup accounts', async () => {
|
|
73
75
|
const accounts = await client.lookupAccounts([accountA.id, accountB.id]);
|
|
@@ -295,6 +297,44 @@ test('can link transfers', async () => {
|
|
|
295
297
|
assert_1.default.strictEqual(accounts[1].debits_posted, 150n);
|
|
296
298
|
assert_1.default.strictEqual(accounts[1].debits_pending, 0n);
|
|
297
299
|
});
|
|
300
|
+
test('cannot void an expired transfer', async () => {
|
|
301
|
+
const transfer = {
|
|
302
|
+
id: 6n,
|
|
303
|
+
debit_account_id: accountB.id,
|
|
304
|
+
credit_account_id: accountA.id,
|
|
305
|
+
amount: 50n,
|
|
306
|
+
user_data_128: 0n,
|
|
307
|
+
user_data_64: 0n,
|
|
308
|
+
user_data_32: 0,
|
|
309
|
+
pending_id: 0n,
|
|
310
|
+
timeout: 1,
|
|
311
|
+
ledger: 1,
|
|
312
|
+
code: 1,
|
|
313
|
+
flags: _1.TransferFlags.pending,
|
|
314
|
+
timestamp: 0n,
|
|
315
|
+
};
|
|
316
|
+
const transferErrors = await client.createTransfers([transfer]);
|
|
317
|
+
assert_1.default.strictEqual(transferErrors.length, 0);
|
|
318
|
+
await new Promise(_ => setTimeout(_, 1000));
|
|
319
|
+
const reject = {
|
|
320
|
+
id: 7n,
|
|
321
|
+
debit_account_id: BigInt(0),
|
|
322
|
+
credit_account_id: BigInt(0),
|
|
323
|
+
amount: 0n,
|
|
324
|
+
user_data_128: 0n,
|
|
325
|
+
user_data_64: 0n,
|
|
326
|
+
user_data_32: 0,
|
|
327
|
+
pending_id: 6n,
|
|
328
|
+
timeout: 0,
|
|
329
|
+
ledger: 1,
|
|
330
|
+
code: 1,
|
|
331
|
+
flags: _1.TransferFlags.void_pending_transfer,
|
|
332
|
+
timestamp: 0n,
|
|
333
|
+
};
|
|
334
|
+
const errors = await client.createTransfers([reject]);
|
|
335
|
+
assert_1.default.strictEqual(errors.length, 1);
|
|
336
|
+
assert_1.default.deepStrictEqual(errors[0], { index: 0, result: _1.CreateTransferError.pending_transfer_expired });
|
|
337
|
+
});
|
|
298
338
|
test('can get account transfers', async () => {
|
|
299
339
|
const accountC = {
|
|
300
340
|
id: 21n,
|
|
@@ -335,8 +375,9 @@ test('can get account transfers', async () => {
|
|
|
335
375
|
assert_1.default.strictEqual(transfers_created_result.length, 0);
|
|
336
376
|
var filter = {
|
|
337
377
|
account_id: accountC.id,
|
|
338
|
-
|
|
339
|
-
|
|
378
|
+
timestamp_min: 0n,
|
|
379
|
+
timestamp_max: 0n,
|
|
380
|
+
limit: 8190,
|
|
340
381
|
flags: _1.GetAccountTransfersFlags.credits | _1.GetAccountTransfersFlags.debits,
|
|
341
382
|
};
|
|
342
383
|
var transfers = await client.getAccountTransfers(filter);
|
|
@@ -348,7 +389,8 @@ test('can get account transfers', async () => {
|
|
|
348
389
|
}
|
|
349
390
|
filter = {
|
|
350
391
|
account_id: accountC.id,
|
|
351
|
-
|
|
392
|
+
timestamp_min: 0n,
|
|
393
|
+
timestamp_max: 0n,
|
|
352
394
|
limit: 8190,
|
|
353
395
|
flags: _1.GetAccountTransfersFlags.debits | _1.GetAccountTransfersFlags.reversed,
|
|
354
396
|
};
|
|
@@ -361,7 +403,8 @@ test('can get account transfers', async () => {
|
|
|
361
403
|
}
|
|
362
404
|
filter = {
|
|
363
405
|
account_id: accountC.id,
|
|
364
|
-
|
|
406
|
+
timestamp_min: 0n,
|
|
407
|
+
timestamp_max: 0n,
|
|
365
408
|
limit: 8190,
|
|
366
409
|
flags: _1.GetAccountTransfersFlags.credits | _1.GetAccountTransfersFlags.reversed,
|
|
367
410
|
};
|
|
@@ -374,7 +417,8 @@ test('can get account transfers', async () => {
|
|
|
374
417
|
}
|
|
375
418
|
filter = {
|
|
376
419
|
account_id: accountC.id,
|
|
377
|
-
|
|
420
|
+
timestamp_min: 0n,
|
|
421
|
+
timestamp_max: 0n,
|
|
378
422
|
limit: transfers_created.length / 2,
|
|
379
423
|
flags: _1.GetAccountTransfersFlags.credits | _1.GetAccountTransfersFlags.debits,
|
|
380
424
|
};
|
|
@@ -387,7 +431,8 @@ test('can get account transfers', async () => {
|
|
|
387
431
|
}
|
|
388
432
|
filter = {
|
|
389
433
|
account_id: accountC.id,
|
|
390
|
-
|
|
434
|
+
timestamp_min: timestamp + 1n,
|
|
435
|
+
timestamp_max: 0n,
|
|
391
436
|
limit: transfers_created.length / 2,
|
|
392
437
|
flags: _1.GetAccountTransfersFlags.credits | _1.GetAccountTransfersFlags.debits,
|
|
393
438
|
};
|
|
@@ -399,39 +444,95 @@ test('can get account transfers', async () => {
|
|
|
399
444
|
}
|
|
400
445
|
filter = {
|
|
401
446
|
account_id: accountC.id,
|
|
402
|
-
|
|
447
|
+
timestamp_min: timestamp + 1n,
|
|
448
|
+
timestamp_max: 0n,
|
|
403
449
|
limit: transfers_created.length / 2,
|
|
404
450
|
flags: _1.GetAccountTransfersFlags.credits | _1.GetAccountTransfersFlags.debits,
|
|
405
451
|
};
|
|
406
452
|
transfers = await client.getAccountTransfers(filter);
|
|
407
453
|
assert_1.default.strictEqual(transfers.length, 0);
|
|
454
|
+
filter = {
|
|
455
|
+
account_id: accountC.id,
|
|
456
|
+
timestamp_min: 0n,
|
|
457
|
+
timestamp_max: 0n,
|
|
458
|
+
limit: transfers_created.length / 2,
|
|
459
|
+
flags: _1.GetAccountTransfersFlags.credits | _1.GetAccountTransfersFlags.debits | _1.GetAccountTransfersFlags.reversed,
|
|
460
|
+
};
|
|
461
|
+
transfers = await client.getAccountTransfers(filter);
|
|
462
|
+
assert_1.default.strictEqual(transfers.length, transfers_created.length / 2);
|
|
463
|
+
timestamp = 1n << 64n;
|
|
464
|
+
for (var transfer of transfers) {
|
|
465
|
+
assert_1.default.ok(timestamp > transfer.timestamp);
|
|
466
|
+
timestamp = transfer.timestamp;
|
|
467
|
+
}
|
|
468
|
+
filter = {
|
|
469
|
+
account_id: accountC.id,
|
|
470
|
+
timestamp_min: 0n,
|
|
471
|
+
timestamp_max: timestamp - 1n,
|
|
472
|
+
limit: transfers_created.length / 2,
|
|
473
|
+
flags: _1.GetAccountTransfersFlags.credits | _1.GetAccountTransfersFlags.debits | _1.GetAccountTransfersFlags.reversed,
|
|
474
|
+
};
|
|
475
|
+
transfers = await client.getAccountTransfers(filter);
|
|
476
|
+
assert_1.default.strictEqual(transfers.length, transfers_created.length / 2);
|
|
477
|
+
for (var transfer of transfers) {
|
|
478
|
+
assert_1.default.ok(timestamp > transfer.timestamp);
|
|
479
|
+
timestamp = transfer.timestamp;
|
|
480
|
+
}
|
|
481
|
+
filter = {
|
|
482
|
+
account_id: accountC.id,
|
|
483
|
+
timestamp_min: 0n,
|
|
484
|
+
timestamp_max: timestamp - 1n,
|
|
485
|
+
limit: transfers_created.length / 2,
|
|
486
|
+
flags: _1.GetAccountTransfersFlags.credits | _1.GetAccountTransfersFlags.debits | _1.GetAccountTransfersFlags.reversed,
|
|
487
|
+
};
|
|
488
|
+
transfers = await client.getAccountTransfers(filter);
|
|
489
|
+
assert_1.default.strictEqual(transfers.length, 0);
|
|
408
490
|
assert_1.default.strictEqual((await client.getAccountTransfers({
|
|
409
491
|
account_id: 0n,
|
|
410
|
-
|
|
492
|
+
timestamp_min: 0n,
|
|
493
|
+
timestamp_max: 0n,
|
|
411
494
|
limit: 8190,
|
|
412
495
|
flags: _1.GetAccountTransfersFlags.credits | _1.GetAccountTransfersFlags.debits,
|
|
413
496
|
})).length, 0);
|
|
414
497
|
assert_1.default.strictEqual((await client.getAccountTransfers({
|
|
415
498
|
account_id: accountC.id,
|
|
416
|
-
|
|
499
|
+
timestamp_min: (1n << 64n) - 1n,
|
|
500
|
+
timestamp_max: 0n,
|
|
417
501
|
limit: 8190,
|
|
418
502
|
flags: _1.GetAccountTransfersFlags.credits | _1.GetAccountTransfersFlags.debits,
|
|
419
503
|
})).length, 0);
|
|
420
504
|
assert_1.default.strictEqual((await client.getAccountTransfers({
|
|
421
505
|
account_id: accountC.id,
|
|
422
|
-
|
|
506
|
+
timestamp_min: 0n,
|
|
507
|
+
timestamp_max: (1n << 64n) - 1n,
|
|
508
|
+
limit: 8190,
|
|
509
|
+
flags: _1.GetAccountTransfersFlags.credits | _1.GetAccountTransfersFlags.debits,
|
|
510
|
+
})).length, 0);
|
|
511
|
+
assert_1.default.strictEqual((await client.getAccountTransfers({
|
|
512
|
+
account_id: accountC.id,
|
|
513
|
+
timestamp_min: (1n << 64n) - 2n,
|
|
514
|
+
timestamp_max: 1n,
|
|
515
|
+
limit: 8190,
|
|
516
|
+
flags: _1.GetAccountTransfersFlags.credits | _1.GetAccountTransfersFlags.debits,
|
|
517
|
+
})).length, 0);
|
|
518
|
+
assert_1.default.strictEqual((await client.getAccountTransfers({
|
|
519
|
+
account_id: accountC.id,
|
|
520
|
+
timestamp_min: 0n,
|
|
521
|
+
timestamp_max: 0n,
|
|
423
522
|
limit: 0,
|
|
424
523
|
flags: _1.GetAccountTransfersFlags.credits | _1.GetAccountTransfersFlags.debits,
|
|
425
524
|
})).length, 0);
|
|
426
525
|
assert_1.default.strictEqual((await client.getAccountTransfers({
|
|
427
526
|
account_id: accountC.id,
|
|
428
|
-
|
|
527
|
+
timestamp_min: 0n,
|
|
528
|
+
timestamp_max: 0n,
|
|
429
529
|
limit: 8190,
|
|
430
530
|
flags: _1.GetAccountTransfersFlags.none,
|
|
431
531
|
})).length, 0);
|
|
432
532
|
assert_1.default.strictEqual((await client.getAccountTransfers({
|
|
433
533
|
account_id: accountC.id,
|
|
434
|
-
|
|
534
|
+
timestamp_min: 0n,
|
|
535
|
+
timestamp_max: 0n,
|
|
435
536
|
limit: 8190,
|
|
436
537
|
flags: 0xFFFF,
|
|
437
538
|
})).length, 0);
|
|
@@ -457,5 +558,6 @@ async function main() {
|
|
|
457
558
|
main().catch((error) => {
|
|
458
559
|
console.log('operator:', error.operator);
|
|
459
560
|
console.log('stack:', error.stack);
|
|
561
|
+
process.exit(-1);
|
|
460
562
|
});
|
|
461
563
|
//# sourceMappingURL=test.js.map
|
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,wBASU;AAEV,MAAM,MAAM,GAAG,IAAA,eAAY,EAAC;IAC1B,UAAU,EAAE,EAAE;IACd,iBAAiB,EAAE,CAAC,OAAO,CAAC,GAAG,CAAC,UAAU,IAAI,MAAM,CAAC;CACtD,CAAC,CAAA;AAGF,MAAM,aAAa,GAAG,MAAM,CAAC,KAAK,CAAC,EAAE,EAAE,CAAC,CAAC,CAAA;AACzC,MAAM,aAAa,GAAG,M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IAAI;QACX,KAAK,EAAE,MAAM;KACd,CAAC,CAAC,CAAC,MAAM,EAAE,CAAC,CAAC,CAAA;AAEhB,CAAC,CAAC,CAAA;AAEF,KAAK,UAAU,IAAI;IACjB,MAAM,KAAK,GAAG,IAAI,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 GetAccountTransfers,\n GetAccountTransfersFlags,\n} from '.'\n\nconst client = createClient({\n cluster_id: 0n,\n replica_addresses: [process.env.TB_ADDRESS || '3000']\n})\n\n// Test data\nconst Zeroed32Bytes = Buffer.alloc(32, 0)\nconst Zeroed48Bytes = Buffer.alloc(48, 0)\nconst accountA: Account = {\n id: 17n,\n debits_pending: 0n,\n debits_posted: 0n,\n credits_pending: 0n,\n credits_posted: 0n,\n user_data_128: 0n,\n user_data_64: 0n,\n user_data_32: 0,\n reserved: 0,\n ledger: 1,\n code: 718,\n flags: 0,\n timestamp: 0n // this will be set correctly by the TigerBeetle server\n}\nconst accountB: Account = {\n id: 19n,\n debits_pending: 0n,\n debits_posted: 0n,\n credits_pending: 0n,\n credits_posted: 0n,\n user_data_128: 0n,\n user_data_64: 0n,\n user_data_32: 0,\n reserved: 0,\n ledger: 1,\n code: 719,\n flags: 0,\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, result: 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.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.strictEqual(account1.user_data_128, 0n)\n assert.strictEqual(account1.user_data_64, 0n)\n assert.strictEqual(account1.user_data_32, 0)\n assert.strictEqual(account1.code, 718)\n assert.strictEqual(account1.ledger, 1)\n assert.strictEqual(account1.flags, 0)\n assert.ok(account1.timestamp > 0n)\n\n const account2 = accounts[1]\n assert.strictEqual(account2.id, 19n)\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.strictEqual(account2.user_data_128, 0n)\n assert.strictEqual(account2.user_data_64, 0n)\n assert.strictEqual(account2.user_data_32, 0)\n assert.strictEqual(account2.code, 719)\n assert.strictEqual(account2.ledger, 1)\n assert.strictEqual(account2.flags, 0)\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 amount: 100n,\n user_data_128: 0n,\n user_data_64: 0n,\n user_data_32: 0,\n pending_id: 0n,\n timeout: 0,\n ledger: 1,\n code: 1,\n flags: 0,\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 amount: 50n,\n user_data_128: 0n,\n user_data_64: 0n,\n user_data_32: 0,\n pending_id: 0n,\n timeout: 2e9,\n ledger: 1,\n code: 1,\n flags,\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].amount, 50n)\n assert.strictEqual(transfers[0].user_data_128, 0n)\n assert.strictEqual(transfers[0].user_data_64, 0n)\n assert.strictEqual(transfers[0].user_data_32, 0)\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].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 amount: 0n,\n user_data_128: 0n,\n user_data_64: 0n,\n user_data_32: 0,\n pending_id: 2n,// must match the id of the pending transfer\n timeout: 0,\n ledger: 1,\n code: 1,\n flags: flags,\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 amount: 50n,\n user_data_128: 0n,\n user_data_64: 0n,\n user_data_32: 0,\n pending_id: 0n,\n timeout: 1e9,\n ledger: 1,\n code: 1,\n flags: TransferFlags.pending,\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 amount: 0n,\n user_data_128: 0n,\n user_data_64: 0n,\n user_data_32: 0,\n pending_id: 4n, // must match the id of the pending transfer\n timeout: 0,\n ledger: 1,\n code: 1,\n flags: TransferFlags.void_pending_transfer,\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 amount: 100n,\n user_data_128: 0n,\n user_data_64: 0n,\n user_data_32: 0,\n pending_id: 0n,\n timeout: 0,\n ledger: 1,\n code: 1,\n flags: TransferFlags.linked, // points to transfer2\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 amount: 100n,\n user_data_128: 0n,\n user_data_64: 0n,\n user_data_32: 0,\n pending_id: 0n,\n timeout: 0,\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 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, result: CreateTransferError.linked_event_failed })\n assert.deepStrictEqual(errors[1], { index: 1, result: 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\ntest('can get account transfers', async (): Promise<void> => {\n const accountC: Account = {\n id: 21n,\n debits_pending: 0n,\n debits_posted: 0n,\n credits_pending: 0n,\n credits_posted: 0n, \n user_data_128: 0n,\n user_data_64: 0n,\n user_data_32: 0,\n reserved: 0,\n ledger: 1,\n code: 718,\n flags: 0,\n timestamp: 0n\n }\n const account_errors = await client.createAccounts([accountC])\n assert.strictEqual(account_errors.length, 0)\n\n var transfers_created : Transfer[] = [];\n // Create transfers where the new account is either the debit or credit account:\n for (var i=0; i<10;i++) {\n transfers_created.push({\n id: BigInt(i + 10000),\n debit_account_id: i % 2 == 0 ? accountC.id : accountA.id,\n credit_account_id: i % 2 == 0 ? accountB.id : accountC.id,\n amount: 100n,\n user_data_128: 0n,\n user_data_64: 0n,\n user_data_32: 0,\n pending_id: 0n,\n timeout: 0,\n ledger: 1,\n code: 1,\n flags: 0,\n timestamp: 0n,\n });\n }\n \n const transfers_created_result = await client.createTransfers(transfers_created)\n assert.strictEqual(transfers_created_result.length, 0)\n\n // Query all transfers for accountC:\n var filter: GetAccountTransfers = {\n account_id: accountC.id,\n timestamp: 0n,\n limit: 0,\n flags: GetAccountTransfersFlags.credits | GetAccountTransfersFlags.debits,\n }\n var transfers = await client.getAccountTransfers(filter)\n assert.strictEqual(transfers.length, transfers_created.length)\n var timestamp = 0n;\n for (var transfer of transfers) {\n assert.ok(timestamp < transfer.timestamp);\n timestamp = transfer.timestamp;\n }\n\n // Query only the debit transfers for accountC, descending:\n filter = {\n account_id: accountC.id,\n timestamp: 0n,\n limit: 8190,\n flags: GetAccountTransfersFlags.debits | GetAccountTransfersFlags.reversed,\n }\n transfers = await client.getAccountTransfers(filter)\n assert.strictEqual(transfers.length, transfers_created.length / 2)\n timestamp = 1n << 64n;\n for (var transfer of transfers) {\n assert.ok(transfer.timestamp < timestamp);\n timestamp = transfer.timestamp;\n } \n\n // Query only the credit transfers for accountC, descending:\n filter = {\n account_id: accountC.id,\n timestamp: 0n,\n limit: 8190,\n flags: GetAccountTransfersFlags.credits | GetAccountTransfersFlags.reversed,\n }\n transfers = await client.getAccountTransfers(filter)\n assert.strictEqual(transfers.length, transfers_created.length / 2)\n timestamp = 1n << 64n;\n for (var transfer of transfers) {\n assert.ok(transfer.timestamp < timestamp);\n timestamp = transfer.timestamp;\n } \n\n // Query the first 5 transfers for accountC:\n filter = {\n account_id: accountC.id,\n timestamp: 0n,\n limit: transfers_created.length / 2,\n flags: GetAccountTransfersFlags.credits | GetAccountTransfersFlags.debits,\n }\n transfers = await client.getAccountTransfers(filter)\n assert.strictEqual(transfers.length, transfers_created.length / 2)\n timestamp = 0n;\n for (var transfer of transfers) {\n assert.ok(timestamp < transfer.timestamp);\n timestamp = transfer.timestamp;\n } \n\n // Query the next 5 transfers for accountC, with pagination:\n filter = {\n account_id: accountC.id,\n timestamp: timestamp,\n limit: transfers_created.length / 2,\n flags: GetAccountTransfersFlags.credits | GetAccountTransfersFlags.debits,\n }\n transfers = await client.getAccountTransfers(filter)\n assert.strictEqual(transfers.length, transfers_created.length / 2)\n for (var transfer of transfers) {\n assert.ok(timestamp < transfer.timestamp);\n timestamp = transfer.timestamp;\n } \n\n // Query again, no more transfers should be found:\n filter = {\n account_id: accountC.id,\n timestamp: timestamp,\n limit: transfers_created.length / 2,\n flags: GetAccountTransfersFlags.credits | GetAccountTransfersFlags.debits,\n }\n transfers = await client.getAccountTransfers(filter)\n assert.strictEqual(transfers.length, 0)\n\n\n // Invalid account:\n assert.strictEqual((await client.getAccountTransfers({\n account_id: 0n,\n timestamp: timestamp,\n limit: 8190,\n flags: GetAccountTransfersFlags.credits | GetAccountTransfersFlags.debits,\n })).length, 0)\n\n // Invalid timestamp:\n assert.strictEqual((await client.getAccountTransfers({\n account_id: accountC.id,\n timestamp: (1n << 64n) - 1n,\n limit: 8190,\n flags: GetAccountTransfersFlags.credits | GetAccountTransfersFlags.debits,\n })).length, 0)\n\n // Zero limit:\n assert.strictEqual((await client.getAccountTransfers({\n account_id: accountC.id,\n timestamp: 0n,\n limit: 0,\n flags: GetAccountTransfersFlags.credits | GetAccountTransfersFlags.debits,\n })).length, 0) \n \n // Empty flags:\n assert.strictEqual((await client.getAccountTransfers({\n account_id: accountC.id,\n timestamp: 0n,\n limit: 8190,\n flags: GetAccountTransfersFlags.none,\n })).length, 0)\n\n // Invalid flags:\n assert.strictEqual((await client.getAccountTransfers({\n account_id: accountC.id,\n timestamp: 0n,\n limit: 8190,\n flags: 0xFFFF,\n })).length, 0) \n\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,wBASU;AAEV,MAAM,MAAM,GAAG,IAAA,eAAY,EAAC;IAC1B,UAAU,EAAE,EAAE;IACd,iBAAiB,EAAE,CAAC,OAAO,CAAC,GAAG,CAAC,UAAU,IAAI,MAAM,CAAC;CACtD,CAAC,CAAA;AAGF,MAAM,aAAa,GAAG,MAAM,CAAC,KAAK,CAAC,EAAE,EAAE,CAAC,CAAC,CAAA;AACzC,MAAM,aAAa,GAAG,MAAM,CAAC,KAAK,CAAC,EAAE,EAAE,CAAC,CAAC,CAAA;AACzC,MAAM,QAAQ,GAAY;IACxB,EAAE,EAAE,GAAG;IACP,cAAc,EAAE,EAAE;IAClB,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,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;IAClC,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,CAAC;AACnB,CAAC,CAAC,CAAA","sourcesContent":["import assert, { AssertionError } from 'assert'\nimport {\n createClient,\n Account,\n Transfer,\n TransferFlags,\n CreateAccountError,\n CreateTransferError,\n GetAccountTransfers,\n GetAccountTransfersFlags,\n} from '.'\n\nconst client = createClient({\n cluster_id: 0n,\n replica_addresses: [process.env.TB_ADDRESS || '3000']\n})\n\n// Test data\nconst Zeroed32Bytes = Buffer.alloc(32, 0)\nconst Zeroed48Bytes = Buffer.alloc(48, 0)\nconst accountA: Account = {\n id: 17n,\n debits_pending: 0n,\n debits_posted: 0n,\n credits_pending: 0n,\n credits_posted: 0n,\n user_data_128: 0n,\n user_data_64: 0n,\n user_data_32: 0,\n reserved: 0,\n ledger: 1,\n code: 718,\n flags: 0,\n timestamp: 0n // this will be set correctly by the TigerBeetle server\n}\nconst accountB: Account = {\n id: 19n,\n debits_pending: 0n,\n debits_posted: 0n,\n credits_pending: 0n,\n credits_posted: 0n,\n user_data_128: 0n,\n user_data_64: 0n,\n user_data_32: 0,\n reserved: 0,\n ledger: 1,\n code: 719,\n flags: 0,\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, result: CreateAccountError.exists })\n})\n\ntest('error if timestamp is not set to 0n on account', async (): Promise<void> => {\n const account = { ...accountA, timestamp: 2n, id: 3n }\n const errors = await client.createAccounts([account])\n\n assert.strictEqual(errors.length, 1)\n assert.deepStrictEqual(errors[0], { index: 0, result: CreateAccountError.timestamp_must_be_zero }) \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.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.strictEqual(account1.user_data_128, 0n)\n assert.strictEqual(account1.user_data_64, 0n)\n assert.strictEqual(account1.user_data_32, 0)\n assert.strictEqual(account1.code, 718)\n assert.strictEqual(account1.ledger, 1)\n assert.strictEqual(account1.flags, 0)\n assert.ok(account1.timestamp > 0n)\n\n const account2 = accounts[1]\n assert.strictEqual(account2.id, 19n)\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.strictEqual(account2.user_data_128, 0n)\n assert.strictEqual(account2.user_data_64, 0n)\n assert.strictEqual(account2.user_data_32, 0)\n assert.strictEqual(account2.code, 719)\n assert.strictEqual(account2.ledger, 1)\n assert.strictEqual(account2.flags, 0)\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 amount: 100n,\n user_data_128: 0n,\n user_data_64: 0n,\n user_data_32: 0,\n pending_id: 0n,\n timeout: 0,\n ledger: 1,\n code: 1,\n flags: 0,\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 amount: 50n,\n user_data_128: 0n,\n user_data_64: 0n,\n user_data_32: 0,\n pending_id: 0n,\n timeout: 2e9,\n ledger: 1,\n code: 1,\n flags,\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].amount, 50n)\n assert.strictEqual(transfers[0].user_data_128, 0n)\n assert.strictEqual(transfers[0].user_data_64, 0n)\n assert.strictEqual(transfers[0].user_data_32, 0)\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].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 amount: 0n,\n user_data_128: 0n,\n user_data_64: 0n,\n user_data_32: 0,\n pending_id: 2n,// must match the id of the pending transfer\n timeout: 0,\n ledger: 1,\n code: 1,\n flags: flags,\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 amount: 50n,\n user_data_128: 0n,\n user_data_64: 0n,\n user_data_32: 0,\n pending_id: 0n,\n timeout: 1e9,\n ledger: 1,\n code: 1,\n flags: TransferFlags.pending,\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 amount: 0n,\n user_data_128: 0n,\n user_data_64: 0n,\n user_data_32: 0,\n pending_id: 4n, // must match the id of the pending transfer\n timeout: 0,\n ledger: 1,\n code: 1,\n flags: TransferFlags.void_pending_transfer,\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 amount: 100n,\n user_data_128: 0n,\n user_data_64: 0n,\n user_data_32: 0,\n pending_id: 0n,\n timeout: 0,\n ledger: 1,\n code: 1,\n flags: TransferFlags.linked, // points to transfer2\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 amount: 100n,\n user_data_128: 0n,\n user_data_64: 0n,\n user_data_32: 0,\n pending_id: 0n,\n timeout: 0,\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 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, result: CreateTransferError.linked_event_failed })\n assert.deepStrictEqual(errors[1], { index: 1, result: 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\ntest('cannot void an expired transfer', async (): Promise<void> => {\n // Create a two-phase transfer:\n const transfer: Transfer = {\n id: 6n,\n debit_account_id: accountB.id,\n credit_account_id: accountA.id,\n amount: 50n,\n user_data_128: 0n,\n user_data_64: 0n,\n user_data_32: 0,\n pending_id: 0n,\n timeout: 1,\n ledger: 1,\n code: 1,\n flags: TransferFlags.pending,\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 // Wait for the transfer to expire.\n // TODO: Use `await setTimeout(1000)` when upgrade to Node > 15.\n await new Promise(_ => setTimeout(_, 1000));\n \n // send in the reject\n const reject: Transfer = {\n id: 7n,\n debit_account_id: BigInt(0),\n credit_account_id: BigInt(0),\n amount: 0n,\n user_data_128: 0n,\n user_data_64: 0n,\n user_data_32: 0,\n pending_id: 6n, // must match the id of the pending transfer\n timeout: 0,\n ledger: 1,\n code: 1,\n flags: TransferFlags.void_pending_transfer,\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, 1)\n assert.deepStrictEqual(errors[0], { index: 0, result: CreateTransferError.pending_transfer_expired }) \n})\n\ntest('can get account transfers', async (): Promise<void> => {\n const accountC: Account = {\n id: 21n,\n debits_pending: 0n,\n debits_posted: 0n,\n credits_pending: 0n,\n credits_posted: 0n,\n user_data_128: 0n,\n user_data_64: 0n,\n user_data_32: 0,\n reserved: 0,\n ledger: 1,\n code: 718,\n flags: 0,\n timestamp: 0n\n }\n const account_errors = await client.createAccounts([accountC])\n assert.strictEqual(account_errors.length, 0)\n\n var transfers_created : Transfer[] = [];\n // Create transfers where the new account is either the debit or credit account:\n for (var i=0; i<10;i++) {\n transfers_created.push({\n id: BigInt(i + 10000),\n debit_account_id: i % 2 == 0 ? accountC.id : accountA.id,\n credit_account_id: i % 2 == 0 ? accountB.id : accountC.id,\n amount: 100n,\n user_data_128: 0n,\n user_data_64: 0n,\n user_data_32: 0,\n pending_id: 0n,\n timeout: 0,\n ledger: 1,\n code: 1,\n flags: 0,\n timestamp: 0n,\n });\n }\n\n const transfers_created_result = await client.createTransfers(transfers_created)\n assert.strictEqual(transfers_created_result.length, 0)\n\n // Query all transfers for accountC:\n var filter: GetAccountTransfers = {\n account_id: accountC.id,\n timestamp_min: 0n,\n timestamp_max: 0n,\n limit: 8190,\n flags: GetAccountTransfersFlags.credits | GetAccountTransfersFlags.debits,\n }\n var transfers = await client.getAccountTransfers(filter)\n assert.strictEqual(transfers.length, transfers_created.length)\n var timestamp = 0n;\n for (var transfer of transfers) {\n assert.ok(timestamp < transfer.timestamp);\n timestamp = transfer.timestamp;\n }\n\n // Query only the debit transfers for accountC, descending:\n filter = {\n account_id: accountC.id,\n timestamp_min: 0n,\n timestamp_max: 0n,\n limit: 8190,\n flags: GetAccountTransfersFlags.debits | GetAccountTransfersFlags.reversed,\n }\n transfers = await client.getAccountTransfers(filter)\n assert.strictEqual(transfers.length, transfers_created.length / 2)\n timestamp = 1n << 64n;\n for (var transfer of transfers) {\n assert.ok(transfer.timestamp < timestamp);\n timestamp = transfer.timestamp;\n }\n\n // Query only the credit transfers for accountC, descending:\n filter = {\n account_id: accountC.id,\n timestamp_min: 0n,\n timestamp_max: 0n,\n limit: 8190,\n flags: GetAccountTransfersFlags.credits | GetAccountTransfersFlags.reversed,\n }\n transfers = await client.getAccountTransfers(filter)\n assert.strictEqual(transfers.length, transfers_created.length / 2)\n timestamp = 1n << 64n;\n for (var transfer of transfers) {\n assert.ok(transfer.timestamp < timestamp);\n timestamp = transfer.timestamp;\n }\n\n // Query the first 5 transfers for accountC:\n filter = {\n account_id: accountC.id,\n timestamp_min: 0n,\n timestamp_max: 0n,\n limit: transfers_created.length / 2,\n flags: GetAccountTransfersFlags.credits | GetAccountTransfersFlags.debits,\n }\n transfers = await client.getAccountTransfers(filter)\n assert.strictEqual(transfers.length, transfers_created.length / 2)\n timestamp = 0n;\n for (var transfer of transfers) {\n assert.ok(timestamp < transfer.timestamp);\n timestamp = transfer.timestamp;\n }\n\n // Query the next 5 transfers for accountC, with pagination:\n filter = {\n account_id: accountC.id,\n timestamp_min: timestamp + 1n,\n timestamp_max: 0n,\n limit: transfers_created.length / 2,\n flags: GetAccountTransfersFlags.credits | GetAccountTransfersFlags.debits,\n }\n transfers = await client.getAccountTransfers(filter)\n assert.strictEqual(transfers.length, transfers_created.length / 2)\n for (var transfer of transfers) {\n assert.ok(timestamp < transfer.timestamp);\n timestamp = transfer.timestamp;\n }\n\n // Query again, no more transfers should be found:\n filter = {\n account_id: accountC.id,\n timestamp_min: timestamp + 1n,\n timestamp_max: 0n,\n limit: transfers_created.length / 2,\n flags: GetAccountTransfersFlags.credits | GetAccountTransfersFlags.debits,\n }\n transfers = await client.getAccountTransfers(filter)\n assert.strictEqual(transfers.length, 0)\n\n // Query the first 5 transfers for accountC ORDER BY DESC:\n filter = {\n account_id: accountC.id,\n timestamp_min: 0n,\n timestamp_max: 0n,\n limit: transfers_created.length / 2,\n flags: GetAccountTransfersFlags.credits | GetAccountTransfersFlags.debits | GetAccountTransfersFlags.reversed,\n }\n transfers = await client.getAccountTransfers(filter)\n assert.strictEqual(transfers.length, transfers_created.length / 2)\n timestamp = 1n << 64n;\n for (var transfer of transfers) {\n assert.ok(timestamp > transfer.timestamp);\n timestamp = transfer.timestamp;\n }\n\n // Query the next 5 transfers for accountC, with pagination:\n filter = {\n account_id: accountC.id,\n timestamp_min: 0n,\n timestamp_max: timestamp - 1n,\n limit: transfers_created.length / 2,\n flags: GetAccountTransfersFlags.credits | GetAccountTransfersFlags.debits | GetAccountTransfersFlags.reversed,\n }\n transfers = await client.getAccountTransfers(filter)\n assert.strictEqual(transfers.length, transfers_created.length / 2)\n for (var transfer of transfers) {\n assert.ok(timestamp > transfer.timestamp);\n timestamp = transfer.timestamp;\n }\n\n // Query again, no more transfers should be found:\n filter = {\n account_id: accountC.id,\n timestamp_min: 0n,\n timestamp_max: timestamp - 1n,\n limit: transfers_created.length / 2,\n flags: GetAccountTransfersFlags.credits | GetAccountTransfersFlags.debits | GetAccountTransfersFlags.reversed,\n }\n transfers = await client.getAccountTransfers(filter)\n assert.strictEqual(transfers.length, 0) \n\n // Invalid account:\n assert.strictEqual((await client.getAccountTransfers({\n account_id: 0n,\n timestamp_min: 0n,\n timestamp_max: 0n,\n limit: 8190,\n flags: GetAccountTransfersFlags.credits | GetAccountTransfersFlags.debits,\n })).length, 0)\n\n // Invalid timestamp min:\n assert.strictEqual((await client.getAccountTransfers({\n account_id: accountC.id,\n timestamp_min: (1n << 64n) - 1n, // ulong max value\n timestamp_max: 0n,\n limit: 8190,\n flags: GetAccountTransfersFlags.credits | GetAccountTransfersFlags.debits,\n })).length, 0)\n\n // Invalid timestamp max:\n assert.strictEqual((await client.getAccountTransfers({\n account_id: accountC.id,\n timestamp_min: 0n,\n timestamp_max: (1n << 64n) - 1n, // ulong max value\n limit: 8190,\n flags: GetAccountTransfersFlags.credits | GetAccountTransfersFlags.debits,\n })).length, 0)\n\n // Invalid timestamp range:\n assert.strictEqual((await client.getAccountTransfers({\n account_id: accountC.id,\n timestamp_min: (1n << 64n) - 2n, // ulong max - 1\n timestamp_max: 1n,\n limit: 8190,\n flags: GetAccountTransfersFlags.credits | GetAccountTransfersFlags.debits,\n })).length, 0)\n\n // Zero limit:\n assert.strictEqual((await client.getAccountTransfers({\n account_id: accountC.id,\n timestamp_min: 0n,\n timestamp_max: 0n,\n limit: 0,\n flags: GetAccountTransfersFlags.credits | GetAccountTransfersFlags.debits,\n })).length, 0)\n\n // Empty flags:\n assert.strictEqual((await client.getAccountTransfers({\n account_id: accountC.id,\n timestamp_min: 0n,\n timestamp_max: 0n,\n limit: 8190,\n flags: GetAccountTransfersFlags.none,\n })).length, 0)\n\n // Invalid flags:\n assert.strictEqual((await client.getAccountTransfers({\n account_id: accountC.id,\n timestamp_min: 0n,\n timestamp_max: 0n,\n limit: 8190,\n flags: 0xFFFF,\n })).length, 0)\n\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 process.exit(-1);\n})\n"]}
|
package/package.json
CHANGED
package/src/bindings.ts
CHANGED
|
@@ -657,9 +657,14 @@ export type GetAccountTransfers = {
|
|
|
657
657
|
account_id: bigint
|
|
658
658
|
|
|
659
659
|
/**
|
|
660
|
-
* See [
|
|
660
|
+
* See [timestamp_min](https://docs.tigerbeetle.com/reference/operations/get_account_transfers#timestamp_min)
|
|
661
661
|
*/
|
|
662
|
-
|
|
662
|
+
timestamp_min: bigint
|
|
663
|
+
|
|
664
|
+
/**
|
|
665
|
+
* See [timestamp_max](https://docs.tigerbeetle.com/reference/operations/get_account_transfers#timestamp_max)
|
|
666
|
+
*/
|
|
667
|
+
timestamp_max: bigint
|
|
663
668
|
|
|
664
669
|
/**
|
|
665
670
|
* See [limit](https://docs.tigerbeetle.com/reference/operations/get_account_transfers#limit)
|
package/src/node.zig
CHANGED
|
@@ -369,21 +369,31 @@ fn decode_array(comptime Event: type, env: c.napi_env, array: c.napi_value, even
|
|
|
369
369
|
switch (Event) {
|
|
370
370
|
Account, Transfer, GetAccountTransfers => {
|
|
371
371
|
inline for (std.meta.fields(Event)) |field| {
|
|
372
|
-
const
|
|
373
|
-
.Struct => |info|
|
|
374
|
-
|
|
372
|
+
const value: field.type = switch (@typeInfo(field.type)) {
|
|
373
|
+
.Struct => |info| @bitCast(try @field(
|
|
374
|
+
translate,
|
|
375
|
+
@typeName(info.backing_integer.?) ++ "_from_object",
|
|
376
|
+
)(
|
|
377
|
+
env,
|
|
378
|
+
object,
|
|
379
|
+
add_trailing_null(field.name),
|
|
380
|
+
)),
|
|
381
|
+
.Int => try @field(translate, @typeName(field.type) ++ "_from_object")(
|
|
382
|
+
env,
|
|
383
|
+
object,
|
|
384
|
+
add_trailing_null(field.name),
|
|
385
|
+
),
|
|
386
|
+
// Arrays are only used for padding/reserved fields,
|
|
387
|
+
// instead of requiring the user to explicitly set an empty buffer,
|
|
388
|
+
// we just hide those fields and preserve their default value.
|
|
389
|
+
.Array => @as(
|
|
390
|
+
*const field.type,
|
|
391
|
+
@ptrCast(@alignCast(field.default_value.?)),
|
|
392
|
+
).*,
|
|
393
|
+
else => unreachable,
|
|
375
394
|
};
|
|
376
395
|
|
|
377
|
-
|
|
378
|
-
env,
|
|
379
|
-
object,
|
|
380
|
-
add_trailing_null(field.name),
|
|
381
|
-
);
|
|
382
|
-
|
|
383
|
-
@field(event, field.name) = switch (@typeInfo(field.type)) {
|
|
384
|
-
.Struct => @as(field.type, @bitCast(value)),
|
|
385
|
-
else => value,
|
|
386
|
-
};
|
|
396
|
+
@field(event, field.name) = value;
|
|
387
397
|
}
|
|
388
398
|
},
|
|
389
399
|
u128 => event.* = try translate.u128_from_value(env, object, "lookup"),
|
package/src/test.ts
CHANGED
|
@@ -80,9 +80,12 @@ test('can return error on account', async (): Promise<void> => {
|
|
|
80
80
|
assert.deepStrictEqual(errors[0], { index: 0, result: CreateAccountError.exists })
|
|
81
81
|
})
|
|
82
82
|
|
|
83
|
-
test('
|
|
83
|
+
test('error if timestamp is not set to 0n on account', async (): Promise<void> => {
|
|
84
84
|
const account = { ...accountA, timestamp: 2n, id: 3n }
|
|
85
|
-
await
|
|
85
|
+
const errors = await client.createAccounts([account])
|
|
86
|
+
|
|
87
|
+
assert.strictEqual(errors.length, 1)
|
|
88
|
+
assert.deepStrictEqual(errors[0], { index: 0, result: CreateAccountError.timestamp_must_be_zero })
|
|
86
89
|
})
|
|
87
90
|
|
|
88
91
|
test('can lookup accounts', async (): Promise<void> => {
|
|
@@ -342,13 +345,59 @@ test('can link transfers', async (): Promise<void> => {
|
|
|
342
345
|
assert.strictEqual(accounts[1].debits_pending, 0n)
|
|
343
346
|
})
|
|
344
347
|
|
|
348
|
+
test('cannot void an expired transfer', async (): Promise<void> => {
|
|
349
|
+
// Create a two-phase transfer:
|
|
350
|
+
const transfer: Transfer = {
|
|
351
|
+
id: 6n,
|
|
352
|
+
debit_account_id: accountB.id,
|
|
353
|
+
credit_account_id: accountA.id,
|
|
354
|
+
amount: 50n,
|
|
355
|
+
user_data_128: 0n,
|
|
356
|
+
user_data_64: 0n,
|
|
357
|
+
user_data_32: 0,
|
|
358
|
+
pending_id: 0n,
|
|
359
|
+
timeout: 1,
|
|
360
|
+
ledger: 1,
|
|
361
|
+
code: 1,
|
|
362
|
+
flags: TransferFlags.pending,
|
|
363
|
+
timestamp: 0n, // this will be set correctly by the TigerBeetle server
|
|
364
|
+
}
|
|
365
|
+
const transferErrors = await client.createTransfers([transfer])
|
|
366
|
+
assert.strictEqual(transferErrors.length, 0)
|
|
367
|
+
|
|
368
|
+
// Wait for the transfer to expire.
|
|
369
|
+
// TODO: Use `await setTimeout(1000)` when upgrade to Node > 15.
|
|
370
|
+
await new Promise(_ => setTimeout(_, 1000));
|
|
371
|
+
|
|
372
|
+
// send in the reject
|
|
373
|
+
const reject: Transfer = {
|
|
374
|
+
id: 7n,
|
|
375
|
+
debit_account_id: BigInt(0),
|
|
376
|
+
credit_account_id: BigInt(0),
|
|
377
|
+
amount: 0n,
|
|
378
|
+
user_data_128: 0n,
|
|
379
|
+
user_data_64: 0n,
|
|
380
|
+
user_data_32: 0,
|
|
381
|
+
pending_id: 6n, // must match the id of the pending transfer
|
|
382
|
+
timeout: 0,
|
|
383
|
+
ledger: 1,
|
|
384
|
+
code: 1,
|
|
385
|
+
flags: TransferFlags.void_pending_transfer,
|
|
386
|
+
timestamp: 0n, // this will be set correctly by the TigerBeetle server
|
|
387
|
+
}
|
|
388
|
+
|
|
389
|
+
const errors = await client.createTransfers([reject])
|
|
390
|
+
assert.strictEqual(errors.length, 1)
|
|
391
|
+
assert.deepStrictEqual(errors[0], { index: 0, result: CreateTransferError.pending_transfer_expired })
|
|
392
|
+
})
|
|
393
|
+
|
|
345
394
|
test('can get account transfers', async (): Promise<void> => {
|
|
346
395
|
const accountC: Account = {
|
|
347
396
|
id: 21n,
|
|
348
397
|
debits_pending: 0n,
|
|
349
398
|
debits_posted: 0n,
|
|
350
399
|
credits_pending: 0n,
|
|
351
|
-
credits_posted: 0n,
|
|
400
|
+
credits_posted: 0n,
|
|
352
401
|
user_data_128: 0n,
|
|
353
402
|
user_data_64: 0n,
|
|
354
403
|
user_data_32: 0,
|
|
@@ -380,15 +429,16 @@ test('can get account transfers', async (): Promise<void> => {
|
|
|
380
429
|
timestamp: 0n,
|
|
381
430
|
});
|
|
382
431
|
}
|
|
383
|
-
|
|
432
|
+
|
|
384
433
|
const transfers_created_result = await client.createTransfers(transfers_created)
|
|
385
434
|
assert.strictEqual(transfers_created_result.length, 0)
|
|
386
435
|
|
|
387
436
|
// Query all transfers for accountC:
|
|
388
437
|
var filter: GetAccountTransfers = {
|
|
389
438
|
account_id: accountC.id,
|
|
390
|
-
|
|
391
|
-
|
|
439
|
+
timestamp_min: 0n,
|
|
440
|
+
timestamp_max: 0n,
|
|
441
|
+
limit: 8190,
|
|
392
442
|
flags: GetAccountTransfersFlags.credits | GetAccountTransfersFlags.debits,
|
|
393
443
|
}
|
|
394
444
|
var transfers = await client.getAccountTransfers(filter)
|
|
@@ -402,7 +452,8 @@ test('can get account transfers', async (): Promise<void> => {
|
|
|
402
452
|
// Query only the debit transfers for accountC, descending:
|
|
403
453
|
filter = {
|
|
404
454
|
account_id: accountC.id,
|
|
405
|
-
|
|
455
|
+
timestamp_min: 0n,
|
|
456
|
+
timestamp_max: 0n,
|
|
406
457
|
limit: 8190,
|
|
407
458
|
flags: GetAccountTransfersFlags.debits | GetAccountTransfersFlags.reversed,
|
|
408
459
|
}
|
|
@@ -412,12 +463,13 @@ test('can get account transfers', async (): Promise<void> => {
|
|
|
412
463
|
for (var transfer of transfers) {
|
|
413
464
|
assert.ok(transfer.timestamp < timestamp);
|
|
414
465
|
timestamp = transfer.timestamp;
|
|
415
|
-
}
|
|
466
|
+
}
|
|
416
467
|
|
|
417
468
|
// Query only the credit transfers for accountC, descending:
|
|
418
469
|
filter = {
|
|
419
470
|
account_id: accountC.id,
|
|
420
|
-
|
|
471
|
+
timestamp_min: 0n,
|
|
472
|
+
timestamp_max: 0n,
|
|
421
473
|
limit: 8190,
|
|
422
474
|
flags: GetAccountTransfersFlags.credits | GetAccountTransfersFlags.reversed,
|
|
423
475
|
}
|
|
@@ -427,12 +479,13 @@ test('can get account transfers', async (): Promise<void> => {
|
|
|
427
479
|
for (var transfer of transfers) {
|
|
428
480
|
assert.ok(transfer.timestamp < timestamp);
|
|
429
481
|
timestamp = transfer.timestamp;
|
|
430
|
-
}
|
|
482
|
+
}
|
|
431
483
|
|
|
432
484
|
// Query the first 5 transfers for accountC:
|
|
433
485
|
filter = {
|
|
434
486
|
account_id: accountC.id,
|
|
435
|
-
|
|
487
|
+
timestamp_min: 0n,
|
|
488
|
+
timestamp_max: 0n,
|
|
436
489
|
limit: transfers_created.length / 2,
|
|
437
490
|
flags: GetAccountTransfersFlags.credits | GetAccountTransfersFlags.debits,
|
|
438
491
|
}
|
|
@@ -442,12 +495,13 @@ test('can get account transfers', async (): Promise<void> => {
|
|
|
442
495
|
for (var transfer of transfers) {
|
|
443
496
|
assert.ok(timestamp < transfer.timestamp);
|
|
444
497
|
timestamp = transfer.timestamp;
|
|
445
|
-
}
|
|
498
|
+
}
|
|
446
499
|
|
|
447
500
|
// Query the next 5 transfers for accountC, with pagination:
|
|
448
501
|
filter = {
|
|
449
502
|
account_id: accountC.id,
|
|
450
|
-
|
|
503
|
+
timestamp_min: timestamp + 1n,
|
|
504
|
+
timestamp_max: 0n,
|
|
451
505
|
limit: transfers_created.length / 2,
|
|
452
506
|
flags: GetAccountTransfersFlags.credits | GetAccountTransfersFlags.debits,
|
|
453
507
|
}
|
|
@@ -456,31 +510,93 @@ test('can get account transfers', async (): Promise<void> => {
|
|
|
456
510
|
for (var transfer of transfers) {
|
|
457
511
|
assert.ok(timestamp < transfer.timestamp);
|
|
458
512
|
timestamp = transfer.timestamp;
|
|
459
|
-
}
|
|
513
|
+
}
|
|
460
514
|
|
|
461
515
|
// Query again, no more transfers should be found:
|
|
462
516
|
filter = {
|
|
463
517
|
account_id: accountC.id,
|
|
464
|
-
|
|
518
|
+
timestamp_min: timestamp + 1n,
|
|
519
|
+
timestamp_max: 0n,
|
|
465
520
|
limit: transfers_created.length / 2,
|
|
466
521
|
flags: GetAccountTransfersFlags.credits | GetAccountTransfersFlags.debits,
|
|
467
522
|
}
|
|
468
523
|
transfers = await client.getAccountTransfers(filter)
|
|
469
524
|
assert.strictEqual(transfers.length, 0)
|
|
470
525
|
|
|
526
|
+
// Query the first 5 transfers for accountC ORDER BY DESC:
|
|
527
|
+
filter = {
|
|
528
|
+
account_id: accountC.id,
|
|
529
|
+
timestamp_min: 0n,
|
|
530
|
+
timestamp_max: 0n,
|
|
531
|
+
limit: transfers_created.length / 2,
|
|
532
|
+
flags: GetAccountTransfersFlags.credits | GetAccountTransfersFlags.debits | GetAccountTransfersFlags.reversed,
|
|
533
|
+
}
|
|
534
|
+
transfers = await client.getAccountTransfers(filter)
|
|
535
|
+
assert.strictEqual(transfers.length, transfers_created.length / 2)
|
|
536
|
+
timestamp = 1n << 64n;
|
|
537
|
+
for (var transfer of transfers) {
|
|
538
|
+
assert.ok(timestamp > transfer.timestamp);
|
|
539
|
+
timestamp = transfer.timestamp;
|
|
540
|
+
}
|
|
541
|
+
|
|
542
|
+
// Query the next 5 transfers for accountC, with pagination:
|
|
543
|
+
filter = {
|
|
544
|
+
account_id: accountC.id,
|
|
545
|
+
timestamp_min: 0n,
|
|
546
|
+
timestamp_max: timestamp - 1n,
|
|
547
|
+
limit: transfers_created.length / 2,
|
|
548
|
+
flags: GetAccountTransfersFlags.credits | GetAccountTransfersFlags.debits | GetAccountTransfersFlags.reversed,
|
|
549
|
+
}
|
|
550
|
+
transfers = await client.getAccountTransfers(filter)
|
|
551
|
+
assert.strictEqual(transfers.length, transfers_created.length / 2)
|
|
552
|
+
for (var transfer of transfers) {
|
|
553
|
+
assert.ok(timestamp > transfer.timestamp);
|
|
554
|
+
timestamp = transfer.timestamp;
|
|
555
|
+
}
|
|
556
|
+
|
|
557
|
+
// Query again, no more transfers should be found:
|
|
558
|
+
filter = {
|
|
559
|
+
account_id: accountC.id,
|
|
560
|
+
timestamp_min: 0n,
|
|
561
|
+
timestamp_max: timestamp - 1n,
|
|
562
|
+
limit: transfers_created.length / 2,
|
|
563
|
+
flags: GetAccountTransfersFlags.credits | GetAccountTransfersFlags.debits | GetAccountTransfersFlags.reversed,
|
|
564
|
+
}
|
|
565
|
+
transfers = await client.getAccountTransfers(filter)
|
|
566
|
+
assert.strictEqual(transfers.length, 0)
|
|
471
567
|
|
|
472
568
|
// Invalid account:
|
|
473
569
|
assert.strictEqual((await client.getAccountTransfers({
|
|
474
570
|
account_id: 0n,
|
|
475
|
-
|
|
571
|
+
timestamp_min: 0n,
|
|
572
|
+
timestamp_max: 0n,
|
|
476
573
|
limit: 8190,
|
|
477
574
|
flags: GetAccountTransfersFlags.credits | GetAccountTransfersFlags.debits,
|
|
478
575
|
})).length, 0)
|
|
479
576
|
|
|
480
|
-
// Invalid timestamp:
|
|
577
|
+
// Invalid timestamp min:
|
|
481
578
|
assert.strictEqual((await client.getAccountTransfers({
|
|
482
579
|
account_id: accountC.id,
|
|
483
|
-
|
|
580
|
+
timestamp_min: (1n << 64n) - 1n, // ulong max value
|
|
581
|
+
timestamp_max: 0n,
|
|
582
|
+
limit: 8190,
|
|
583
|
+
flags: GetAccountTransfersFlags.credits | GetAccountTransfersFlags.debits,
|
|
584
|
+
})).length, 0)
|
|
585
|
+
|
|
586
|
+
// Invalid timestamp max:
|
|
587
|
+
assert.strictEqual((await client.getAccountTransfers({
|
|
588
|
+
account_id: accountC.id,
|
|
589
|
+
timestamp_min: 0n,
|
|
590
|
+
timestamp_max: (1n << 64n) - 1n, // ulong max value
|
|
591
|
+
limit: 8190,
|
|
592
|
+
flags: GetAccountTransfersFlags.credits | GetAccountTransfersFlags.debits,
|
|
593
|
+
})).length, 0)
|
|
594
|
+
|
|
595
|
+
// Invalid timestamp range:
|
|
596
|
+
assert.strictEqual((await client.getAccountTransfers({
|
|
597
|
+
account_id: accountC.id,
|
|
598
|
+
timestamp_min: (1n << 64n) - 2n, // ulong max - 1
|
|
599
|
+
timestamp_max: 1n,
|
|
484
600
|
limit: 8190,
|
|
485
601
|
flags: GetAccountTransfersFlags.credits | GetAccountTransfersFlags.debits,
|
|
486
602
|
})).length, 0)
|
|
@@ -488,15 +604,17 @@ test('can get account transfers', async (): Promise<void> => {
|
|
|
488
604
|
// Zero limit:
|
|
489
605
|
assert.strictEqual((await client.getAccountTransfers({
|
|
490
606
|
account_id: accountC.id,
|
|
491
|
-
|
|
607
|
+
timestamp_min: 0n,
|
|
608
|
+
timestamp_max: 0n,
|
|
492
609
|
limit: 0,
|
|
493
610
|
flags: GetAccountTransfersFlags.credits | GetAccountTransfersFlags.debits,
|
|
494
|
-
})).length, 0)
|
|
495
|
-
|
|
611
|
+
})).length, 0)
|
|
612
|
+
|
|
496
613
|
// Empty flags:
|
|
497
614
|
assert.strictEqual((await client.getAccountTransfers({
|
|
498
615
|
account_id: accountC.id,
|
|
499
|
-
|
|
616
|
+
timestamp_min: 0n,
|
|
617
|
+
timestamp_max: 0n,
|
|
500
618
|
limit: 8190,
|
|
501
619
|
flags: GetAccountTransfersFlags.none,
|
|
502
620
|
})).length, 0)
|
|
@@ -504,10 +622,11 @@ test('can get account transfers', async (): Promise<void> => {
|
|
|
504
622
|
// Invalid flags:
|
|
505
623
|
assert.strictEqual((await client.getAccountTransfers({
|
|
506
624
|
account_id: accountC.id,
|
|
507
|
-
|
|
625
|
+
timestamp_min: 0n,
|
|
626
|
+
timestamp_max: 0n,
|
|
508
627
|
limit: 8190,
|
|
509
628
|
flags: 0xFFFF,
|
|
510
|
-
})).length, 0)
|
|
629
|
+
})).length, 0)
|
|
511
630
|
|
|
512
631
|
})
|
|
513
632
|
|
|
@@ -532,4 +651,5 @@ async function main () {
|
|
|
532
651
|
main().catch((error: AssertionError) => {
|
|
533
652
|
console.log('operator:', error.operator)
|
|
534
653
|
console.log('stack:', error.stack)
|
|
654
|
+
process.exit(-1);
|
|
535
655
|
})
|
package/src/translate.zig
CHANGED
|
@@ -161,7 +161,7 @@ pub fn u128_from_value(env: c.napi_env, value: c.napi_value, comptime name: [:0]
|
|
|
161
161
|
// we would need to convert, but big endian is not supported by tigerbeetle.
|
|
162
162
|
var result: u128 = 0;
|
|
163
163
|
var sign_bit: c_int = undefined;
|
|
164
|
-
const words
|
|
164
|
+
const words: *[2]u64 = @ptrCast(&result);
|
|
165
165
|
var word_count: usize = 2;
|
|
166
166
|
switch (c.napi_get_value_bigint_words(env, value, &sign_bit, &word_count, words)) {
|
|
167
167
|
c.napi_ok => {},
|