casualos 3.9.0 → 3.10.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cli.js +590 -545
- package/minify.js +3 -1
- package/minify.js.map +1 -1
- package/package.json +2 -2
package/dist/cli.js
CHANGED
|
@@ -16267,7 +16267,7 @@ var require_base64_js = __commonJS({
|
|
|
16267
16267
|
"../../node_modules/.pnpm/base64-js@1.5.1/node_modules/base64-js/index.js"(exports2) {
|
|
16268
16268
|
"use strict";
|
|
16269
16269
|
exports2.byteLength = byteLength;
|
|
16270
|
-
exports2.toByteArray =
|
|
16270
|
+
exports2.toByteArray = toByteArray12;
|
|
16271
16271
|
exports2.fromByteArray = fromByteArray16;
|
|
16272
16272
|
var lookup2 = [];
|
|
16273
16273
|
var revLookup = [];
|
|
@@ -16300,7 +16300,7 @@ var require_base64_js = __commonJS({
|
|
|
16300
16300
|
function _byteLength(b64, validLen, placeHoldersLen) {
|
|
16301
16301
|
return (validLen + placeHoldersLen) * 3 / 4 - placeHoldersLen;
|
|
16302
16302
|
}
|
|
16303
|
-
function
|
|
16303
|
+
function toByteArray12(b64) {
|
|
16304
16304
|
var tmp;
|
|
16305
16305
|
var lens = getLens(b64);
|
|
16306
16306
|
var validLen = lens[0];
|
|
@@ -56619,307 +56619,6 @@ var require_Errors = __commonJS({
|
|
|
56619
56619
|
}
|
|
56620
56620
|
});
|
|
56621
56621
|
|
|
56622
|
-
// ../../node_modules/.pnpm/tigerbeetle-node@0.16.44/node_modules/tigerbeetle-node/dist/bindings.js
|
|
56623
|
-
var require_bindings = __commonJS({
|
|
56624
|
-
"../../node_modules/.pnpm/tigerbeetle-node@0.16.44/node_modules/tigerbeetle-node/dist/bindings.js"(exports2) {
|
|
56625
|
-
"use strict";
|
|
56626
|
-
Object.defineProperty(exports2, "__esModule", { value: true });
|
|
56627
|
-
exports2.Operation = exports2.CreateTransferError = exports2.CreateAccountError = exports2.QueryFilterFlags = exports2.AccountFilterFlags = exports2.TransferFlags = exports2.AccountFlags = void 0;
|
|
56628
|
-
var AccountFlags4;
|
|
56629
|
-
(function(AccountFlags5) {
|
|
56630
|
-
AccountFlags5[AccountFlags5["none"] = 0] = "none";
|
|
56631
|
-
AccountFlags5[AccountFlags5["linked"] = 1] = "linked";
|
|
56632
|
-
AccountFlags5[AccountFlags5["debits_must_not_exceed_credits"] = 2] = "debits_must_not_exceed_credits";
|
|
56633
|
-
AccountFlags5[AccountFlags5["credits_must_not_exceed_debits"] = 4] = "credits_must_not_exceed_debits";
|
|
56634
|
-
AccountFlags5[AccountFlags5["history"] = 8] = "history";
|
|
56635
|
-
AccountFlags5[AccountFlags5["imported"] = 16] = "imported";
|
|
56636
|
-
AccountFlags5[AccountFlags5["closed"] = 32] = "closed";
|
|
56637
|
-
})(AccountFlags4 = exports2.AccountFlags || (exports2.AccountFlags = {}));
|
|
56638
|
-
var TransferFlags5;
|
|
56639
|
-
(function(TransferFlags6) {
|
|
56640
|
-
TransferFlags6[TransferFlags6["none"] = 0] = "none";
|
|
56641
|
-
TransferFlags6[TransferFlags6["linked"] = 1] = "linked";
|
|
56642
|
-
TransferFlags6[TransferFlags6["pending"] = 2] = "pending";
|
|
56643
|
-
TransferFlags6[TransferFlags6["post_pending_transfer"] = 4] = "post_pending_transfer";
|
|
56644
|
-
TransferFlags6[TransferFlags6["void_pending_transfer"] = 8] = "void_pending_transfer";
|
|
56645
|
-
TransferFlags6[TransferFlags6["balancing_debit"] = 16] = "balancing_debit";
|
|
56646
|
-
TransferFlags6[TransferFlags6["balancing_credit"] = 32] = "balancing_credit";
|
|
56647
|
-
TransferFlags6[TransferFlags6["closing_debit"] = 64] = "closing_debit";
|
|
56648
|
-
TransferFlags6[TransferFlags6["closing_credit"] = 128] = "closing_credit";
|
|
56649
|
-
TransferFlags6[TransferFlags6["imported"] = 256] = "imported";
|
|
56650
|
-
})(TransferFlags5 = exports2.TransferFlags || (exports2.TransferFlags = {}));
|
|
56651
|
-
var AccountFilterFlags3;
|
|
56652
|
-
(function(AccountFilterFlags4) {
|
|
56653
|
-
AccountFilterFlags4[AccountFilterFlags4["none"] = 0] = "none";
|
|
56654
|
-
AccountFilterFlags4[AccountFilterFlags4["debits"] = 1] = "debits";
|
|
56655
|
-
AccountFilterFlags4[AccountFilterFlags4["credits"] = 2] = "credits";
|
|
56656
|
-
AccountFilterFlags4[AccountFilterFlags4["reversed"] = 4] = "reversed";
|
|
56657
|
-
})(AccountFilterFlags3 = exports2.AccountFilterFlags || (exports2.AccountFilterFlags = {}));
|
|
56658
|
-
var QueryFilterFlags;
|
|
56659
|
-
(function(QueryFilterFlags2) {
|
|
56660
|
-
QueryFilterFlags2[QueryFilterFlags2["none"] = 0] = "none";
|
|
56661
|
-
QueryFilterFlags2[QueryFilterFlags2["reversed"] = 1] = "reversed";
|
|
56662
|
-
})(QueryFilterFlags = exports2.QueryFilterFlags || (exports2.QueryFilterFlags = {}));
|
|
56663
|
-
var CreateAccountError4;
|
|
56664
|
-
(function(CreateAccountError5) {
|
|
56665
|
-
CreateAccountError5[CreateAccountError5["ok"] = 0] = "ok";
|
|
56666
|
-
CreateAccountError5[CreateAccountError5["linked_event_failed"] = 1] = "linked_event_failed";
|
|
56667
|
-
CreateAccountError5[CreateAccountError5["linked_event_chain_open"] = 2] = "linked_event_chain_open";
|
|
56668
|
-
CreateAccountError5[CreateAccountError5["imported_event_expected"] = 22] = "imported_event_expected";
|
|
56669
|
-
CreateAccountError5[CreateAccountError5["imported_event_not_expected"] = 23] = "imported_event_not_expected";
|
|
56670
|
-
CreateAccountError5[CreateAccountError5["timestamp_must_be_zero"] = 3] = "timestamp_must_be_zero";
|
|
56671
|
-
CreateAccountError5[CreateAccountError5["imported_event_timestamp_out_of_range"] = 24] = "imported_event_timestamp_out_of_range";
|
|
56672
|
-
CreateAccountError5[CreateAccountError5["imported_event_timestamp_must_not_advance"] = 25] = "imported_event_timestamp_must_not_advance";
|
|
56673
|
-
CreateAccountError5[CreateAccountError5["reserved_field"] = 4] = "reserved_field";
|
|
56674
|
-
CreateAccountError5[CreateAccountError5["reserved_flag"] = 5] = "reserved_flag";
|
|
56675
|
-
CreateAccountError5[CreateAccountError5["id_must_not_be_zero"] = 6] = "id_must_not_be_zero";
|
|
56676
|
-
CreateAccountError5[CreateAccountError5["id_must_not_be_int_max"] = 7] = "id_must_not_be_int_max";
|
|
56677
|
-
CreateAccountError5[CreateAccountError5["exists_with_different_flags"] = 15] = "exists_with_different_flags";
|
|
56678
|
-
CreateAccountError5[CreateAccountError5["exists_with_different_user_data_128"] = 16] = "exists_with_different_user_data_128";
|
|
56679
|
-
CreateAccountError5[CreateAccountError5["exists_with_different_user_data_64"] = 17] = "exists_with_different_user_data_64";
|
|
56680
|
-
CreateAccountError5[CreateAccountError5["exists_with_different_user_data_32"] = 18] = "exists_with_different_user_data_32";
|
|
56681
|
-
CreateAccountError5[CreateAccountError5["exists_with_different_ledger"] = 19] = "exists_with_different_ledger";
|
|
56682
|
-
CreateAccountError5[CreateAccountError5["exists_with_different_code"] = 20] = "exists_with_different_code";
|
|
56683
|
-
CreateAccountError5[CreateAccountError5["exists"] = 21] = "exists";
|
|
56684
|
-
CreateAccountError5[CreateAccountError5["flags_are_mutually_exclusive"] = 8] = "flags_are_mutually_exclusive";
|
|
56685
|
-
CreateAccountError5[CreateAccountError5["debits_pending_must_be_zero"] = 9] = "debits_pending_must_be_zero";
|
|
56686
|
-
CreateAccountError5[CreateAccountError5["debits_posted_must_be_zero"] = 10] = "debits_posted_must_be_zero";
|
|
56687
|
-
CreateAccountError5[CreateAccountError5["credits_pending_must_be_zero"] = 11] = "credits_pending_must_be_zero";
|
|
56688
|
-
CreateAccountError5[CreateAccountError5["credits_posted_must_be_zero"] = 12] = "credits_posted_must_be_zero";
|
|
56689
|
-
CreateAccountError5[CreateAccountError5["ledger_must_not_be_zero"] = 13] = "ledger_must_not_be_zero";
|
|
56690
|
-
CreateAccountError5[CreateAccountError5["code_must_not_be_zero"] = 14] = "code_must_not_be_zero";
|
|
56691
|
-
CreateAccountError5[CreateAccountError5["imported_event_timestamp_must_not_regress"] = 26] = "imported_event_timestamp_must_not_regress";
|
|
56692
|
-
})(CreateAccountError4 = exports2.CreateAccountError || (exports2.CreateAccountError = {}));
|
|
56693
|
-
var CreateTransferError3;
|
|
56694
|
-
(function(CreateTransferError4) {
|
|
56695
|
-
CreateTransferError4[CreateTransferError4["ok"] = 0] = "ok";
|
|
56696
|
-
CreateTransferError4[CreateTransferError4["linked_event_failed"] = 1] = "linked_event_failed";
|
|
56697
|
-
CreateTransferError4[CreateTransferError4["linked_event_chain_open"] = 2] = "linked_event_chain_open";
|
|
56698
|
-
CreateTransferError4[CreateTransferError4["imported_event_expected"] = 56] = "imported_event_expected";
|
|
56699
|
-
CreateTransferError4[CreateTransferError4["imported_event_not_expected"] = 57] = "imported_event_not_expected";
|
|
56700
|
-
CreateTransferError4[CreateTransferError4["timestamp_must_be_zero"] = 3] = "timestamp_must_be_zero";
|
|
56701
|
-
CreateTransferError4[CreateTransferError4["imported_event_timestamp_out_of_range"] = 58] = "imported_event_timestamp_out_of_range";
|
|
56702
|
-
CreateTransferError4[CreateTransferError4["imported_event_timestamp_must_not_advance"] = 59] = "imported_event_timestamp_must_not_advance";
|
|
56703
|
-
CreateTransferError4[CreateTransferError4["reserved_flag"] = 4] = "reserved_flag";
|
|
56704
|
-
CreateTransferError4[CreateTransferError4["id_must_not_be_zero"] = 5] = "id_must_not_be_zero";
|
|
56705
|
-
CreateTransferError4[CreateTransferError4["id_must_not_be_int_max"] = 6] = "id_must_not_be_int_max";
|
|
56706
|
-
CreateTransferError4[CreateTransferError4["exists_with_different_flags"] = 36] = "exists_with_different_flags";
|
|
56707
|
-
CreateTransferError4[CreateTransferError4["exists_with_different_pending_id"] = 40] = "exists_with_different_pending_id";
|
|
56708
|
-
CreateTransferError4[CreateTransferError4["exists_with_different_timeout"] = 44] = "exists_with_different_timeout";
|
|
56709
|
-
CreateTransferError4[CreateTransferError4["exists_with_different_debit_account_id"] = 37] = "exists_with_different_debit_account_id";
|
|
56710
|
-
CreateTransferError4[CreateTransferError4["exists_with_different_credit_account_id"] = 38] = "exists_with_different_credit_account_id";
|
|
56711
|
-
CreateTransferError4[CreateTransferError4["exists_with_different_amount"] = 39] = "exists_with_different_amount";
|
|
56712
|
-
CreateTransferError4[CreateTransferError4["exists_with_different_user_data_128"] = 41] = "exists_with_different_user_data_128";
|
|
56713
|
-
CreateTransferError4[CreateTransferError4["exists_with_different_user_data_64"] = 42] = "exists_with_different_user_data_64";
|
|
56714
|
-
CreateTransferError4[CreateTransferError4["exists_with_different_user_data_32"] = 43] = "exists_with_different_user_data_32";
|
|
56715
|
-
CreateTransferError4[CreateTransferError4["exists_with_different_ledger"] = 67] = "exists_with_different_ledger";
|
|
56716
|
-
CreateTransferError4[CreateTransferError4["exists_with_different_code"] = 45] = "exists_with_different_code";
|
|
56717
|
-
CreateTransferError4[CreateTransferError4["exists"] = 46] = "exists";
|
|
56718
|
-
CreateTransferError4[CreateTransferError4["id_already_failed"] = 68] = "id_already_failed";
|
|
56719
|
-
CreateTransferError4[CreateTransferError4["flags_are_mutually_exclusive"] = 7] = "flags_are_mutually_exclusive";
|
|
56720
|
-
CreateTransferError4[CreateTransferError4["debit_account_id_must_not_be_zero"] = 8] = "debit_account_id_must_not_be_zero";
|
|
56721
|
-
CreateTransferError4[CreateTransferError4["debit_account_id_must_not_be_int_max"] = 9] = "debit_account_id_must_not_be_int_max";
|
|
56722
|
-
CreateTransferError4[CreateTransferError4["credit_account_id_must_not_be_zero"] = 10] = "credit_account_id_must_not_be_zero";
|
|
56723
|
-
CreateTransferError4[CreateTransferError4["credit_account_id_must_not_be_int_max"] = 11] = "credit_account_id_must_not_be_int_max";
|
|
56724
|
-
CreateTransferError4[CreateTransferError4["accounts_must_be_different"] = 12] = "accounts_must_be_different";
|
|
56725
|
-
CreateTransferError4[CreateTransferError4["pending_id_must_be_zero"] = 13] = "pending_id_must_be_zero";
|
|
56726
|
-
CreateTransferError4[CreateTransferError4["pending_id_must_not_be_zero"] = 14] = "pending_id_must_not_be_zero";
|
|
56727
|
-
CreateTransferError4[CreateTransferError4["pending_id_must_not_be_int_max"] = 15] = "pending_id_must_not_be_int_max";
|
|
56728
|
-
CreateTransferError4[CreateTransferError4["pending_id_must_be_different"] = 16] = "pending_id_must_be_different";
|
|
56729
|
-
CreateTransferError4[CreateTransferError4["timeout_reserved_for_pending_transfer"] = 17] = "timeout_reserved_for_pending_transfer";
|
|
56730
|
-
CreateTransferError4[CreateTransferError4["closing_transfer_must_be_pending"] = 64] = "closing_transfer_must_be_pending";
|
|
56731
|
-
CreateTransferError4[CreateTransferError4["ledger_must_not_be_zero"] = 19] = "ledger_must_not_be_zero";
|
|
56732
|
-
CreateTransferError4[CreateTransferError4["code_must_not_be_zero"] = 20] = "code_must_not_be_zero";
|
|
56733
|
-
CreateTransferError4[CreateTransferError4["debit_account_not_found"] = 21] = "debit_account_not_found";
|
|
56734
|
-
CreateTransferError4[CreateTransferError4["credit_account_not_found"] = 22] = "credit_account_not_found";
|
|
56735
|
-
CreateTransferError4[CreateTransferError4["accounts_must_have_the_same_ledger"] = 23] = "accounts_must_have_the_same_ledger";
|
|
56736
|
-
CreateTransferError4[CreateTransferError4["transfer_must_have_the_same_ledger_as_accounts"] = 24] = "transfer_must_have_the_same_ledger_as_accounts";
|
|
56737
|
-
CreateTransferError4[CreateTransferError4["pending_transfer_not_found"] = 25] = "pending_transfer_not_found";
|
|
56738
|
-
CreateTransferError4[CreateTransferError4["pending_transfer_not_pending"] = 26] = "pending_transfer_not_pending";
|
|
56739
|
-
CreateTransferError4[CreateTransferError4["pending_transfer_has_different_debit_account_id"] = 27] = "pending_transfer_has_different_debit_account_id";
|
|
56740
|
-
CreateTransferError4[CreateTransferError4["pending_transfer_has_different_credit_account_id"] = 28] = "pending_transfer_has_different_credit_account_id";
|
|
56741
|
-
CreateTransferError4[CreateTransferError4["pending_transfer_has_different_ledger"] = 29] = "pending_transfer_has_different_ledger";
|
|
56742
|
-
CreateTransferError4[CreateTransferError4["pending_transfer_has_different_code"] = 30] = "pending_transfer_has_different_code";
|
|
56743
|
-
CreateTransferError4[CreateTransferError4["exceeds_pending_transfer_amount"] = 31] = "exceeds_pending_transfer_amount";
|
|
56744
|
-
CreateTransferError4[CreateTransferError4["pending_transfer_has_different_amount"] = 32] = "pending_transfer_has_different_amount";
|
|
56745
|
-
CreateTransferError4[CreateTransferError4["pending_transfer_already_posted"] = 33] = "pending_transfer_already_posted";
|
|
56746
|
-
CreateTransferError4[CreateTransferError4["pending_transfer_already_voided"] = 34] = "pending_transfer_already_voided";
|
|
56747
|
-
CreateTransferError4[CreateTransferError4["pending_transfer_expired"] = 35] = "pending_transfer_expired";
|
|
56748
|
-
CreateTransferError4[CreateTransferError4["imported_event_timestamp_must_not_regress"] = 60] = "imported_event_timestamp_must_not_regress";
|
|
56749
|
-
CreateTransferError4[CreateTransferError4["imported_event_timestamp_must_postdate_debit_account"] = 61] = "imported_event_timestamp_must_postdate_debit_account";
|
|
56750
|
-
CreateTransferError4[CreateTransferError4["imported_event_timestamp_must_postdate_credit_account"] = 62] = "imported_event_timestamp_must_postdate_credit_account";
|
|
56751
|
-
CreateTransferError4[CreateTransferError4["imported_event_timeout_must_be_zero"] = 63] = "imported_event_timeout_must_be_zero";
|
|
56752
|
-
CreateTransferError4[CreateTransferError4["debit_account_already_closed"] = 65] = "debit_account_already_closed";
|
|
56753
|
-
CreateTransferError4[CreateTransferError4["credit_account_already_closed"] = 66] = "credit_account_already_closed";
|
|
56754
|
-
CreateTransferError4[CreateTransferError4["overflows_debits_pending"] = 47] = "overflows_debits_pending";
|
|
56755
|
-
CreateTransferError4[CreateTransferError4["overflows_credits_pending"] = 48] = "overflows_credits_pending";
|
|
56756
|
-
CreateTransferError4[CreateTransferError4["overflows_debits_posted"] = 49] = "overflows_debits_posted";
|
|
56757
|
-
CreateTransferError4[CreateTransferError4["overflows_credits_posted"] = 50] = "overflows_credits_posted";
|
|
56758
|
-
CreateTransferError4[CreateTransferError4["overflows_debits"] = 51] = "overflows_debits";
|
|
56759
|
-
CreateTransferError4[CreateTransferError4["overflows_credits"] = 52] = "overflows_credits";
|
|
56760
|
-
CreateTransferError4[CreateTransferError4["overflows_timeout"] = 53] = "overflows_timeout";
|
|
56761
|
-
CreateTransferError4[CreateTransferError4["exceeds_credits"] = 54] = "exceeds_credits";
|
|
56762
|
-
CreateTransferError4[CreateTransferError4["exceeds_debits"] = 55] = "exceeds_debits";
|
|
56763
|
-
})(CreateTransferError3 = exports2.CreateTransferError || (exports2.CreateTransferError = {}));
|
|
56764
|
-
var Operation;
|
|
56765
|
-
(function(Operation2) {
|
|
56766
|
-
Operation2[Operation2["pulse"] = 128] = "pulse";
|
|
56767
|
-
Operation2[Operation2["get_change_events"] = 137] = "get_change_events";
|
|
56768
|
-
Operation2[Operation2["create_accounts"] = 138] = "create_accounts";
|
|
56769
|
-
Operation2[Operation2["create_transfers"] = 139] = "create_transfers";
|
|
56770
|
-
Operation2[Operation2["lookup_accounts"] = 140] = "lookup_accounts";
|
|
56771
|
-
Operation2[Operation2["lookup_transfers"] = 141] = "lookup_transfers";
|
|
56772
|
-
Operation2[Operation2["get_account_transfers"] = 142] = "get_account_transfers";
|
|
56773
|
-
Operation2[Operation2["get_account_balances"] = 143] = "get_account_balances";
|
|
56774
|
-
Operation2[Operation2["query_accounts"] = 144] = "query_accounts";
|
|
56775
|
-
Operation2[Operation2["query_transfers"] = 145] = "query_transfers";
|
|
56776
|
-
})(Operation = exports2.Operation || (exports2.Operation = {}));
|
|
56777
|
-
}
|
|
56778
|
-
});
|
|
56779
|
-
|
|
56780
|
-
// ../../node_modules/.pnpm/tigerbeetle-node@0.16.44/node_modules/tigerbeetle-node/dist/index.js
|
|
56781
|
-
var require_dist3 = __commonJS({
|
|
56782
|
-
"../../node_modules/.pnpm/tigerbeetle-node@0.16.44/node_modules/tigerbeetle-node/dist/index.js"(exports2) {
|
|
56783
|
-
"use strict";
|
|
56784
|
-
var __createBinding2 = exports2 && exports2.__createBinding || (Object.create ? (function(o2, m2, k2, k22) {
|
|
56785
|
-
if (k22 === void 0) k22 = k2;
|
|
56786
|
-
Object.defineProperty(o2, k22, { enumerable: true, get: function() {
|
|
56787
|
-
return m2[k2];
|
|
56788
|
-
} });
|
|
56789
|
-
}) : (function(o2, m2, k2, k22) {
|
|
56790
|
-
if (k22 === void 0) k22 = k2;
|
|
56791
|
-
o2[k22] = m2[k2];
|
|
56792
|
-
}));
|
|
56793
|
-
var __exportStar2 = exports2 && exports2.__exportStar || function(m2, exports3) {
|
|
56794
|
-
for (var p2 in m2) if (p2 !== "default" && !Object.prototype.hasOwnProperty.call(exports3, p2)) __createBinding2(exports3, m2, p2);
|
|
56795
|
-
};
|
|
56796
|
-
Object.defineProperty(exports2, "__esModule", { value: true });
|
|
56797
|
-
exports2.id = exports2.createClient = exports2.amount_max = void 0;
|
|
56798
|
-
__exportStar2(require_bindings(), exports2);
|
|
56799
|
-
var bindings_1 = require_bindings();
|
|
56800
|
-
var node_crypto_1 = require("node:crypto");
|
|
56801
|
-
var binding = (() => {
|
|
56802
|
-
const { arch, platform } = process;
|
|
56803
|
-
const archMap = {
|
|
56804
|
-
"arm64": "aarch64",
|
|
56805
|
-
"x64": "x86_64"
|
|
56806
|
-
};
|
|
56807
|
-
const platformMap = {
|
|
56808
|
-
"linux": "linux",
|
|
56809
|
-
"darwin": "macos",
|
|
56810
|
-
"win32": "windows"
|
|
56811
|
-
};
|
|
56812
|
-
if (!(arch in archMap)) {
|
|
56813
|
-
throw new Error(`Unsupported arch: ${arch}`);
|
|
56814
|
-
}
|
|
56815
|
-
if (!(platform in platformMap)) {
|
|
56816
|
-
throw new Error(`Unsupported platform: ${platform}`);
|
|
56817
|
-
}
|
|
56818
|
-
let extra = "";
|
|
56819
|
-
const fs4 = require("fs");
|
|
56820
|
-
const path6 = require("path");
|
|
56821
|
-
if (platform === "linux") {
|
|
56822
|
-
extra = "-gnu";
|
|
56823
|
-
for (const file2 of fs4.readdirSync("/proc/self/map_files/")) {
|
|
56824
|
-
const realPath = fs4.readlinkSync(path6.join("/proc/self/map_files/", file2));
|
|
56825
|
-
if (realPath.includes("musl")) {
|
|
56826
|
-
extra = "-musl";
|
|
56827
|
-
break;
|
|
56828
|
-
}
|
|
56829
|
-
}
|
|
56830
|
-
}
|
|
56831
|
-
const filename = `./bin/${archMap[arch]}-${platformMap[platform]}${extra}/client.node`;
|
|
56832
|
-
return require(filename);
|
|
56833
|
-
})();
|
|
56834
|
-
exports2.amount_max = 2n ** 128n - 1n;
|
|
56835
|
-
function createClient(args2) {
|
|
56836
|
-
let context = binding.init({
|
|
56837
|
-
cluster_id: args2.cluster_id,
|
|
56838
|
-
replica_addresses: Buffer.from(args2.replica_addresses.join(","))
|
|
56839
|
-
});
|
|
56840
|
-
const destroy = () => {
|
|
56841
|
-
if (context)
|
|
56842
|
-
binding.deinit(context);
|
|
56843
|
-
context = null;
|
|
56844
|
-
};
|
|
56845
|
-
const request2 = (operation, batch) => {
|
|
56846
|
-
return new Promise((resolve2, reject) => {
|
|
56847
|
-
try {
|
|
56848
|
-
if (!context)
|
|
56849
|
-
throw new Error("Client was shutdown.");
|
|
56850
|
-
binding.submit(context, operation, batch, (error46, result) => {
|
|
56851
|
-
if (error46) {
|
|
56852
|
-
reject(error46);
|
|
56853
|
-
} else if (result) {
|
|
56854
|
-
resolve2(result);
|
|
56855
|
-
} else {
|
|
56856
|
-
throw new Error("UB: Binding invoked callback without error or result");
|
|
56857
|
-
}
|
|
56858
|
-
});
|
|
56859
|
-
} catch (err) {
|
|
56860
|
-
reject(err);
|
|
56861
|
-
}
|
|
56862
|
-
});
|
|
56863
|
-
};
|
|
56864
|
-
return {
|
|
56865
|
-
createAccounts(batch) {
|
|
56866
|
-
return request2(bindings_1.Operation.create_accounts, batch);
|
|
56867
|
-
},
|
|
56868
|
-
createTransfers(batch) {
|
|
56869
|
-
return request2(bindings_1.Operation.create_transfers, batch);
|
|
56870
|
-
},
|
|
56871
|
-
lookupAccounts(batch) {
|
|
56872
|
-
return request2(bindings_1.Operation.lookup_accounts, batch);
|
|
56873
|
-
},
|
|
56874
|
-
lookupTransfers(batch) {
|
|
56875
|
-
return request2(bindings_1.Operation.lookup_transfers, batch);
|
|
56876
|
-
},
|
|
56877
|
-
getAccountTransfers(filter3) {
|
|
56878
|
-
return request2(bindings_1.Operation.get_account_transfers, [filter3]);
|
|
56879
|
-
},
|
|
56880
|
-
getAccountBalances(filter3) {
|
|
56881
|
-
return request2(bindings_1.Operation.get_account_balances, [filter3]);
|
|
56882
|
-
},
|
|
56883
|
-
queryAccounts(filter3) {
|
|
56884
|
-
return request2(bindings_1.Operation.query_accounts, [filter3]);
|
|
56885
|
-
},
|
|
56886
|
-
queryTransfers(filter3) {
|
|
56887
|
-
return request2(bindings_1.Operation.query_transfers, [filter3]);
|
|
56888
|
-
},
|
|
56889
|
-
destroy
|
|
56890
|
-
};
|
|
56891
|
-
}
|
|
56892
|
-
exports2.createClient = createClient;
|
|
56893
|
-
var idLastTimestamp = 0;
|
|
56894
|
-
var idLastBuffer = new DataView(new ArrayBuffer(16));
|
|
56895
|
-
function id2() {
|
|
56896
|
-
let timestamp = Date.now();
|
|
56897
|
-
if (timestamp <= idLastTimestamp) {
|
|
56898
|
-
timestamp = idLastTimestamp;
|
|
56899
|
-
} else {
|
|
56900
|
-
idLastTimestamp = timestamp;
|
|
56901
|
-
(0, node_crypto_1.randomFillSync)(idLastBuffer);
|
|
56902
|
-
}
|
|
56903
|
-
const littleEndian = true;
|
|
56904
|
-
const randomLo32 = idLastBuffer.getUint32(0, littleEndian) + 1;
|
|
56905
|
-
const randomHi32 = idLastBuffer.getUint32(4, littleEndian) + (randomLo32 > 4294967295 ? 1 : 0);
|
|
56906
|
-
const randomHi16 = idLastBuffer.getUint16(8, littleEndian) + (randomHi32 > 4294967295 ? 1 : 0);
|
|
56907
|
-
if (randomHi16 > 65535) {
|
|
56908
|
-
throw new Error("random bits overflow on monotonic increment");
|
|
56909
|
-
}
|
|
56910
|
-
idLastBuffer.setUint32(0, randomLo32 & 4294967295, littleEndian);
|
|
56911
|
-
idLastBuffer.setUint32(4, randomHi32 & 4294967295, littleEndian);
|
|
56912
|
-
idLastBuffer.setUint16(8, randomHi16, littleEndian);
|
|
56913
|
-
idLastBuffer.setUint16(10, timestamp & 65535, littleEndian);
|
|
56914
|
-
idLastBuffer.setUint32(12, timestamp >>> 16 & 4294967295, littleEndian);
|
|
56915
|
-
const lo = idLastBuffer.getBigUint64(0, littleEndian);
|
|
56916
|
-
const hi = idLastBuffer.getBigUint64(8, littleEndian);
|
|
56917
|
-
return hi << 64n | lo;
|
|
56918
|
-
}
|
|
56919
|
-
exports2.id = id2;
|
|
56920
|
-
}
|
|
56921
|
-
});
|
|
56922
|
-
|
|
56923
56622
|
// ../../node_modules/.pnpm/web-streams-polyfill@4.0.0-beta.3/node_modules/web-streams-polyfill/dist/ponyfill.mjs
|
|
56924
56623
|
function t() {
|
|
56925
56624
|
}
|
|
@@ -65931,7 +65630,7 @@ var require_src4 = __commonJS({
|
|
|
65931
65630
|
});
|
|
65932
65631
|
|
|
65933
65632
|
// ../../node_modules/.pnpm/@kwsites+file-exists@1.1.1/node_modules/@kwsites/file-exists/dist/index.js
|
|
65934
|
-
var
|
|
65633
|
+
var require_dist3 = __commonJS({
|
|
65935
65634
|
"../../node_modules/.pnpm/@kwsites+file-exists@1.1.1/node_modules/@kwsites/file-exists/dist/index.js"(exports2) {
|
|
65936
65635
|
"use strict";
|
|
65937
65636
|
function __export3(m2) {
|
|
@@ -65943,7 +65642,7 @@ var require_dist4 = __commonJS({
|
|
|
65943
65642
|
});
|
|
65944
65643
|
|
|
65945
65644
|
// ../../node_modules/.pnpm/@kwsites+promise-deferred@1.1.1/node_modules/@kwsites/promise-deferred/dist/index.js
|
|
65946
|
-
var
|
|
65645
|
+
var require_dist4 = __commonJS({
|
|
65947
65646
|
"../../node_modules/.pnpm/@kwsites+promise-deferred@1.1.1/node_modules/@kwsites/promise-deferred/dist/index.js"(exports2) {
|
|
65948
65647
|
"use strict";
|
|
65949
65648
|
Object.defineProperty(exports2, "__esModule", { value: true });
|
|
@@ -90245,6 +89944,9 @@ var WEB_CONFIG_SCHEMA = external_exports.object({
|
|
|
90245
89944
|
allowedBiosOptions: external_exports.array(BIOS_OPTION_SCHEMA).nullable().optional(),
|
|
90246
89945
|
defaultBiosOption: BIOS_OPTION_SCHEMA.nullable().optional(),
|
|
90247
89946
|
automaticBiosOption: BIOS_OPTION_SCHEMA.nullable().optional(),
|
|
89947
|
+
automaticBiosOptionInst: external_exports.string().nonempty().nullable().optional().describe(
|
|
89948
|
+
"The instance ID to use when executing the automatic BIOS option. Should be formatted as `{recordName/{instName}`. For local/public insts, recordName can be omitted (e.g. `/{instName}`)."
|
|
89949
|
+
),
|
|
90248
89950
|
enableDom: external_exports.boolean().prefault(false),
|
|
90249
89951
|
debug: external_exports.boolean().prefault(false),
|
|
90250
89952
|
enableSmsAuthentication: external_exports.boolean().nullable().optional(),
|
|
@@ -90308,6 +90010,40 @@ function parseVersionNumber(version2) {
|
|
|
90308
90010
|
tag: prerelease?.substring(1) ?? null
|
|
90309
90011
|
};
|
|
90310
90012
|
}
|
|
90013
|
+
function formatVersion(version2) {
|
|
90014
|
+
return formatVersionNumber(
|
|
90015
|
+
version2.major,
|
|
90016
|
+
version2.minor,
|
|
90017
|
+
version2.patch,
|
|
90018
|
+
version2.tag ?? ""
|
|
90019
|
+
);
|
|
90020
|
+
}
|
|
90021
|
+
function formatVersionNumber(major2, minor, patch, tag) {
|
|
90022
|
+
return `v${major2}.${minor}.${patch}${tag ? `-${tag}` : ""}`;
|
|
90023
|
+
}
|
|
90024
|
+
function compareVersions(first2, second) {
|
|
90025
|
+
if (first2.major < second.major) {
|
|
90026
|
+
return -1;
|
|
90027
|
+
} else if (first2.major > second.major) {
|
|
90028
|
+
return 1;
|
|
90029
|
+
} else if (first2.minor < second.minor) {
|
|
90030
|
+
return -1;
|
|
90031
|
+
} else if (first2.minor > second.minor) {
|
|
90032
|
+
return 1;
|
|
90033
|
+
} else if (first2.patch < second.patch) {
|
|
90034
|
+
return -1;
|
|
90035
|
+
} else if (first2.patch > second.patch) {
|
|
90036
|
+
return 1;
|
|
90037
|
+
} else if (first2.tag === null && second.tag !== null) {
|
|
90038
|
+
return 1;
|
|
90039
|
+
} else if (first2.tag !== null && second.tag === null) {
|
|
90040
|
+
return -1;
|
|
90041
|
+
} else if (first2.tag !== null && second.tag !== null) {
|
|
90042
|
+
return first2.tag.localeCompare(second.tag);
|
|
90043
|
+
} else {
|
|
90044
|
+
return 0;
|
|
90045
|
+
}
|
|
90046
|
+
}
|
|
90311
90047
|
|
|
90312
90048
|
// ../aux-common/bots/BotEvents.ts
|
|
90313
90049
|
var UNMAPPABLE = Symbol("UNMAPPABLE");
|
|
@@ -99246,10 +98982,11 @@ function valueOrSharedType(val) {
|
|
|
99246
98982
|
|
|
99247
98983
|
// ../aux-common/partitions/YjsPartition.ts
|
|
99248
98984
|
var APPLY_UPDATES_TO_INST_TRANSACTION_ORIGIN2 = "__apply_updates_to_inst";
|
|
99249
|
-
var YjsPartitionImpl = class
|
|
98985
|
+
var YjsPartitionImpl = class extends YjsSharedDocument {
|
|
99250
98986
|
constructor(config3) {
|
|
99251
98987
|
super(config3);
|
|
99252
98988
|
this._hasRegisteredSubs = false;
|
|
98989
|
+
this._installedAuxes = new globalThis.Map();
|
|
99253
98990
|
this.type = "yjs";
|
|
99254
98991
|
this.private = config3.private || false;
|
|
99255
98992
|
this._remoteEvents = config3.remoteEvents;
|
|
@@ -99361,15 +99098,9 @@ var YjsPartitionImpl = class _YjsPartitionImpl extends YjsSharedDocument {
|
|
|
99361
99098
|
} else if (event.event.type === "get_inst_state_from_updates") {
|
|
99362
99099
|
const action2 = event.event;
|
|
99363
99100
|
try {
|
|
99364
|
-
|
|
99365
|
-
type: "yjs"
|
|
99366
|
-
});
|
|
99367
|
-
for (let { update } of action2.updates) {
|
|
99368
|
-
const updateBytes = (0, import_base64_js3.toByteArray)(update);
|
|
99369
|
-
applyUpdate(partition3.doc, updateBytes);
|
|
99370
|
-
}
|
|
99101
|
+
const state = getStateFromUpdates(action2);
|
|
99371
99102
|
this._onEvents.next([
|
|
99372
|
-
asyncResult(event.taskId,
|
|
99103
|
+
asyncResult(event.taskId, state, false)
|
|
99373
99104
|
]);
|
|
99374
99105
|
} catch (err) {
|
|
99375
99106
|
this._onEvents.next([asyncError(event.taskId, err)]);
|
|
@@ -99377,24 +99108,10 @@ var YjsPartitionImpl = class _YjsPartitionImpl extends YjsSharedDocument {
|
|
|
99377
99108
|
} else if (event.event.type === "create_initialization_update") {
|
|
99378
99109
|
const action2 = event.event;
|
|
99379
99110
|
try {
|
|
99380
|
-
|
|
99381
|
-
|
|
99382
|
-
|
|
99383
|
-
|
|
99384
|
-
let instUpdate = {
|
|
99385
|
-
id: 0,
|
|
99386
|
-
timestamp: Date.now(),
|
|
99387
|
-
update: (0, import_base64_js3.fromByteArray)(update)
|
|
99388
|
-
};
|
|
99389
|
-
this._onEvents.next([
|
|
99390
|
-
asyncResult(event.taskId, instUpdate, false)
|
|
99391
|
-
]);
|
|
99392
|
-
});
|
|
99393
|
-
await partition3.applyEvents(
|
|
99394
|
-
action2.bots.map(
|
|
99395
|
-
(b2) => botAdded(createBot(b2.id, b2.tags))
|
|
99396
|
-
)
|
|
99397
|
-
);
|
|
99111
|
+
const update = constructInitializationUpdate(action2);
|
|
99112
|
+
this._onEvents.next([
|
|
99113
|
+
asyncResult(event.taskId, update, false)
|
|
99114
|
+
]);
|
|
99398
99115
|
} catch (err) {
|
|
99399
99116
|
this._onEvents.next([asyncError(event.taskId, err)]);
|
|
99400
99117
|
}
|
|
@@ -99451,7 +99168,63 @@ var YjsPartitionImpl = class _YjsPartitionImpl extends YjsSharedDocument {
|
|
|
99451
99168
|
}
|
|
99452
99169
|
} else {
|
|
99453
99170
|
if (action2.aux.version === 2) {
|
|
99454
|
-
|
|
99171
|
+
let installed = false;
|
|
99172
|
+
if (hasValue(action2.source)) {
|
|
99173
|
+
const previouslyInstalled = this._installedAuxes.get(action2.source);
|
|
99174
|
+
if (hasValue(previouslyInstalled)) {
|
|
99175
|
+
if (action2.version && previouslyInstalled.version) {
|
|
99176
|
+
if (compareVersions(
|
|
99177
|
+
action2.version,
|
|
99178
|
+
previouslyInstalled.version
|
|
99179
|
+
) < 0) {
|
|
99180
|
+
if (!action2.downgrade) {
|
|
99181
|
+
console.warn(
|
|
99182
|
+
`Attempted to downgrade ${action2.source} aux file from version ${formatVersion(
|
|
99183
|
+
previouslyInstalled.version
|
|
99184
|
+
)} to ${formatVersion(
|
|
99185
|
+
action2.version
|
|
99186
|
+
)} without downgrade flag. Skipping installation.`
|
|
99187
|
+
);
|
|
99188
|
+
this._onEvents.next([
|
|
99189
|
+
asyncError(
|
|
99190
|
+
event.taskId,
|
|
99191
|
+
new Error(
|
|
99192
|
+
`Cannot downgrade aux file ${action2.source} from version ${formatVersion(
|
|
99193
|
+
previouslyInstalled.version
|
|
99194
|
+
)} to ${formatVersion(
|
|
99195
|
+
action2.version
|
|
99196
|
+
)} without downgrade flag.`
|
|
99197
|
+
)
|
|
99198
|
+
)
|
|
99199
|
+
]);
|
|
99200
|
+
continue;
|
|
99201
|
+
}
|
|
99202
|
+
}
|
|
99203
|
+
}
|
|
99204
|
+
const combined = [
|
|
99205
|
+
updateToNewStateUpdate(
|
|
99206
|
+
previouslyInstalled.updates,
|
|
99207
|
+
action2.aux.updates
|
|
99208
|
+
)
|
|
99209
|
+
];
|
|
99210
|
+
this._installedAuxes.set(
|
|
99211
|
+
action2.source,
|
|
99212
|
+
{
|
|
99213
|
+
version: action2.version,
|
|
99214
|
+
updates: combined
|
|
99215
|
+
}
|
|
99216
|
+
);
|
|
99217
|
+
this.applyStateUpdates(combined);
|
|
99218
|
+
installed = true;
|
|
99219
|
+
}
|
|
99220
|
+
}
|
|
99221
|
+
if (!installed) {
|
|
99222
|
+
this._installedAuxes.set(action2.source, {
|
|
99223
|
+
version: action2.version,
|
|
99224
|
+
updates: action2.aux.updates
|
|
99225
|
+
});
|
|
99226
|
+
this.applyStateUpdates(action2.aux.updates);
|
|
99227
|
+
}
|
|
99455
99228
|
} else if (action2.aux.version === 1) {
|
|
99456
99229
|
this._applyEvents(
|
|
99457
99230
|
Object.values(action2.aux.state).map(
|
|
@@ -99839,6 +99612,59 @@ function constructInitializationUpdate(action2) {
|
|
|
99839
99612
|
);
|
|
99840
99613
|
return instUpdate;
|
|
99841
99614
|
}
|
|
99615
|
+
function constructInitializationUpdateFromPreviousUpdates(previousUpdates, bots) {
|
|
99616
|
+
const partition3 = new YjsPartitionImpl({
|
|
99617
|
+
type: "yjs"
|
|
99618
|
+
});
|
|
99619
|
+
for (let { update } of previousUpdates) {
|
|
99620
|
+
const updateBytes = (0, import_base64_js4.toByteArray)(update);
|
|
99621
|
+
applyUpdate(partition3.doc, updateBytes);
|
|
99622
|
+
}
|
|
99623
|
+
const allBotIds = new Set(Object.keys(partition3.state));
|
|
99624
|
+
const actions = [];
|
|
99625
|
+
for (let b2 of bots) {
|
|
99626
|
+
const oldBot = partition3.state[b2.id];
|
|
99627
|
+
if (oldBot) {
|
|
99628
|
+
let tags = { ...b2.tags };
|
|
99629
|
+
for (let oldTag in oldBot.tags) {
|
|
99630
|
+
if (!hasValue(tags[oldTag])) {
|
|
99631
|
+
tags[oldTag] = null;
|
|
99632
|
+
}
|
|
99633
|
+
}
|
|
99634
|
+
actions.push(
|
|
99635
|
+
botUpdated(b2.id, {
|
|
99636
|
+
tags
|
|
99637
|
+
})
|
|
99638
|
+
);
|
|
99639
|
+
} else {
|
|
99640
|
+
actions.push(botAdded(createBot(b2.id, b2.tags)));
|
|
99641
|
+
}
|
|
99642
|
+
allBotIds.delete(b2.id);
|
|
99643
|
+
}
|
|
99644
|
+
for (let id2 of allBotIds) {
|
|
99645
|
+
actions.push(botRemoved(id2));
|
|
99646
|
+
}
|
|
99647
|
+
let instUpdate;
|
|
99648
|
+
partition3.doc.on("update", (update) => {
|
|
99649
|
+
instUpdate = {
|
|
99650
|
+
id: 0,
|
|
99651
|
+
timestamp: Date.now(),
|
|
99652
|
+
update: (0, import_base64_js4.fromByteArray)(encodeStateAsUpdate(partition3.doc))
|
|
99653
|
+
};
|
|
99654
|
+
});
|
|
99655
|
+
partition3.applyEvents(actions);
|
|
99656
|
+
return instUpdate;
|
|
99657
|
+
}
|
|
99658
|
+
function updateToNewStateUpdate(previousUpdates, newState) {
|
|
99659
|
+
const state = getStateFromUpdates({
|
|
99660
|
+
type: "get_inst_state_from_updates",
|
|
99661
|
+
updates: Array.isArray(newState) ? newState : [newState]
|
|
99662
|
+
});
|
|
99663
|
+
return constructInitializationUpdateFromPreviousUpdates(
|
|
99664
|
+
previousUpdates,
|
|
99665
|
+
Object.values(state)
|
|
99666
|
+
);
|
|
99667
|
+
}
|
|
99842
99668
|
function getStateFromUpdates(action2) {
|
|
99843
99669
|
let partition3 = new YjsPartitionImpl({
|
|
99844
99670
|
type: "yjs"
|
|
@@ -102074,7 +101900,7 @@ var trace = TraceAPI.getInstance();
|
|
|
102074
101900
|
function hashLowEntropyPasswordWithSalt2(password, salt) {
|
|
102075
101901
|
const tracer = trace.getTracer(
|
|
102076
101902
|
"InstrumentedHashHelpers",
|
|
102077
|
-
false ? void 0 : "v3.
|
|
101903
|
+
false ? void 0 : "v3.10.0"
|
|
102078
101904
|
);
|
|
102079
101905
|
return tracer.startActiveSpan(
|
|
102080
101906
|
"hashLowEntropyPasswordWithSalt",
|
|
@@ -102092,7 +101918,7 @@ function hashLowEntropyPasswordWithSalt2(password, salt) {
|
|
|
102092
101918
|
function hashHighEntropyPasswordWithSalt2(password, salt) {
|
|
102093
101919
|
const tracer = trace.getTracer(
|
|
102094
101920
|
"InstrumentedHashHelpers",
|
|
102095
|
-
false ? void 0 : "v3.
|
|
101921
|
+
false ? void 0 : "v3.10.0"
|
|
102096
101922
|
);
|
|
102097
101923
|
return tracer.startActiveSpan(
|
|
102098
101924
|
"hashHighEntropyPasswordWithSalt",
|
|
@@ -102110,7 +101936,7 @@ function hashHighEntropyPasswordWithSalt2(password, salt) {
|
|
|
102110
101936
|
function verifyPasswordAgainstHashes2(password, salt, hashes) {
|
|
102111
101937
|
const tracer = trace.getTracer(
|
|
102112
101938
|
"InstrumentedHashHelpers",
|
|
102113
|
-
false ? void 0 : "v3.
|
|
101939
|
+
false ? void 0 : "v3.10.0"
|
|
102114
101940
|
);
|
|
102115
101941
|
return tracer.startActiveSpan(
|
|
102116
101942
|
"verifyPasswordAgainstHashes",
|
|
@@ -109640,7 +109466,7 @@ var import_semantic_conventions = __toESM(require_src3());
|
|
|
109640
109466
|
function traced(tracerName, options = {}, metricOptions = {}) {
|
|
109641
109467
|
const tracer = trace.getTracer(
|
|
109642
109468
|
tracerName,
|
|
109643
|
-
false ? void 0 : "v3.
|
|
109469
|
+
false ? void 0 : "v3.10.0"
|
|
109644
109470
|
);
|
|
109645
109471
|
return function(target, propertyKey, descriptor) {
|
|
109646
109472
|
const originalMethod = descriptor.value;
|
|
@@ -109722,7 +109548,7 @@ function getHistogram(meter) {
|
|
|
109722
109548
|
}
|
|
109723
109549
|
return metrics.getMeter(
|
|
109724
109550
|
meter.meter,
|
|
109725
|
-
false ? void 0 : "v3.
|
|
109551
|
+
false ? void 0 : "v3.10.0"
|
|
109726
109552
|
).createHistogram(meter.name, meter.options);
|
|
109727
109553
|
}
|
|
109728
109554
|
function getCounter(meter) {
|
|
@@ -109731,7 +109557,7 @@ function getCounter(meter) {
|
|
|
109731
109557
|
}
|
|
109732
109558
|
return metrics.getMeter(
|
|
109733
109559
|
meter.meter,
|
|
109734
|
-
false ? void 0 : "v3.
|
|
109560
|
+
false ? void 0 : "v3.10.0"
|
|
109735
109561
|
).createCounter(meter.name, meter.options);
|
|
109736
109562
|
}
|
|
109737
109563
|
function traceHttpResponse(options = {}) {
|
|
@@ -109773,11 +109599,12 @@ var MAX_EMAIL_ADDRESS_LENGTH = 200;
|
|
|
109773
109599
|
var MAX_SMS_ADDRESS_LENGTH = 30;
|
|
109774
109600
|
var PRIVO_OPEN_ID_PROVIDER = "privo";
|
|
109775
109601
|
var AuthController = class {
|
|
109776
|
-
constructor(authStore, messenger, configStore, privoClient = null, relyingParties = []) {
|
|
109602
|
+
constructor(authStore, messenger, configStore, recordsStore, privoClient = null, relyingParties = []) {
|
|
109777
109603
|
this._privoClient = null;
|
|
109778
109604
|
this._store = authStore;
|
|
109779
109605
|
this._messenger = messenger;
|
|
109780
109606
|
this._config = configStore;
|
|
109607
|
+
this._records = recordsStore;
|
|
109781
109608
|
this._privoClient = privoClient;
|
|
109782
109609
|
this._webAuthNRelyingParties = relyingParties;
|
|
109783
109610
|
this._privoEnabled = this._privoClient !== null;
|
|
@@ -109948,6 +109775,13 @@ var AuthController = class {
|
|
|
109948
109775
|
};
|
|
109949
109776
|
}
|
|
109950
109777
|
}
|
|
109778
|
+
if (request2.loginStudioId && request2.comId) {
|
|
109779
|
+
return {
|
|
109780
|
+
success: false,
|
|
109781
|
+
errorCode: "unacceptable_request",
|
|
109782
|
+
errorMessage: "Cannot specify both loginStudioId and comId."
|
|
109783
|
+
};
|
|
109784
|
+
}
|
|
109951
109785
|
try {
|
|
109952
109786
|
let newUser = false;
|
|
109953
109787
|
const supported = await this._messenger.supportsAddressType(
|
|
@@ -109960,9 +109794,37 @@ var AuthController = class {
|
|
|
109960
109794
|
errorMessage: request2.addressType === "email" ? "Email addresses are not supported." : "Phone numbers are not supported"
|
|
109961
109795
|
};
|
|
109962
109796
|
}
|
|
109797
|
+
let loginStudioId = request2.loginStudioId;
|
|
109798
|
+
if (request2.comId) {
|
|
109799
|
+
const studio = await this._records.getStudioByComId(
|
|
109800
|
+
request2.comId
|
|
109801
|
+
);
|
|
109802
|
+
if (!studio) {
|
|
109803
|
+
return {
|
|
109804
|
+
success: false,
|
|
109805
|
+
errorCode: "not_found",
|
|
109806
|
+
errorMessage: "The specified comID was not found."
|
|
109807
|
+
};
|
|
109808
|
+
}
|
|
109809
|
+
console.log(
|
|
109810
|
+
`[AuthController] [requestLogin] Logging into studio (${studio.id}) for comID: ${request2.comId}.`
|
|
109811
|
+
);
|
|
109812
|
+
loginStudioId = studio.id;
|
|
109813
|
+
} else if (request2.customDomain) {
|
|
109814
|
+
const customDomain = await this._records.getVerifiedCustomDomainByName(
|
|
109815
|
+
request2.customDomain
|
|
109816
|
+
);
|
|
109817
|
+
if (customDomain) {
|
|
109818
|
+
console.log(
|
|
109819
|
+
`[AuthController] [requestLogin] Logging into studio (${customDomain.studioId}) for custom domain: ${request2.customDomain}.`
|
|
109820
|
+
);
|
|
109821
|
+
loginStudioId = customDomain.studioId;
|
|
109822
|
+
}
|
|
109823
|
+
}
|
|
109963
109824
|
let user = await this._store.findUserByAddress(
|
|
109964
109825
|
request2.address,
|
|
109965
|
-
request2.addressType
|
|
109826
|
+
request2.addressType,
|
|
109827
|
+
loginStudioId
|
|
109966
109828
|
);
|
|
109967
109829
|
if (!user) {
|
|
109968
109830
|
newUser = true;
|
|
@@ -109971,8 +109833,12 @@ var AuthController = class {
|
|
|
109971
109833
|
email: request2.addressType === "email" ? request2.address : null,
|
|
109972
109834
|
phoneNumber: request2.addressType === "phone" ? request2.address : null,
|
|
109973
109835
|
allSessionRevokeTimeMs: null,
|
|
109974
|
-
currentLoginRequestId: null
|
|
109836
|
+
currentLoginRequestId: null,
|
|
109837
|
+
loginStudioId
|
|
109975
109838
|
};
|
|
109839
|
+
console.log(
|
|
109840
|
+
`[AuthController] [requestLogin] Creating new user (${user.id}).`
|
|
109841
|
+
);
|
|
109976
109842
|
if (!await this._validateAddress(
|
|
109977
109843
|
request2.address,
|
|
109978
109844
|
request2.addressType
|
|
@@ -110024,7 +109890,8 @@ var AuthController = class {
|
|
|
110024
109890
|
if (result2.success === false) {
|
|
110025
109891
|
user = await this._store.findUserByAddress(
|
|
110026
109892
|
request2.address,
|
|
110027
|
-
request2.addressType
|
|
109893
|
+
request2.addressType,
|
|
109894
|
+
loginStudioId
|
|
110028
109895
|
);
|
|
110029
109896
|
if (!user) {
|
|
110030
109897
|
console.log(
|
|
@@ -119510,6 +119377,7 @@ var COM_ID_PLAYER_CONFIG = WEB_CONFIG_SCHEMA.pick({
|
|
|
119510
119377
|
allowedBiosOptions: true,
|
|
119511
119378
|
arcGisApiKey: true,
|
|
119512
119379
|
automaticBiosOption: true,
|
|
119380
|
+
automaticBiosOptionInst: true,
|
|
119513
119381
|
defaultBiosOption: true,
|
|
119514
119382
|
jitsiAppName: true,
|
|
119515
119383
|
what3WordsApiKey: true,
|
|
@@ -121449,7 +121317,7 @@ var RecordsServer = class {
|
|
|
121449
121317
|
this._viewTemplateRenderer = viewTemplateRenderer;
|
|
121450
121318
|
this._tracer = trace.getTracer(
|
|
121451
121319
|
"RecordsServer",
|
|
121452
|
-
false ? void 0 : "v3.
|
|
121320
|
+
false ? void 0 : "v3.10.0"
|
|
121453
121321
|
);
|
|
121454
121322
|
this._purchasableItems = purchasableItemsController;
|
|
121455
121323
|
this._procedures = this._createProcedures();
|
|
@@ -121780,16 +121648,30 @@ var RecordsServer = class {
|
|
|
121780
121648
|
requestLogin: procedure().origins("account").http("POST", "/api/v2/login").inputs(
|
|
121781
121649
|
external_exports.object({
|
|
121782
121650
|
address: external_exports.string(),
|
|
121783
|
-
addressType: external_exports.enum(["email", "phone"])
|
|
121651
|
+
addressType: external_exports.enum(["email", "phone"]),
|
|
121652
|
+
loginStudioId: external_exports.string().nullable().optional(),
|
|
121653
|
+
comId: external_exports.string().nullable().optional(),
|
|
121654
|
+
customDomain: external_exports.string().nullable().optional()
|
|
121784
121655
|
})
|
|
121785
|
-
).handler(
|
|
121786
|
-
|
|
121656
|
+
).handler(
|
|
121657
|
+
async ({
|
|
121787
121658
|
address,
|
|
121788
121659
|
addressType,
|
|
121789
|
-
|
|
121790
|
-
|
|
121791
|
-
|
|
121792
|
-
|
|
121660
|
+
loginStudioId,
|
|
121661
|
+
comId,
|
|
121662
|
+
customDomain
|
|
121663
|
+
}, context) => {
|
|
121664
|
+
const result = await this._auth.requestLogin({
|
|
121665
|
+
address,
|
|
121666
|
+
addressType,
|
|
121667
|
+
ipAddress: context.ipAddress,
|
|
121668
|
+
loginStudioId,
|
|
121669
|
+
comId,
|
|
121670
|
+
customDomain
|
|
121671
|
+
});
|
|
121672
|
+
return result;
|
|
121673
|
+
}
|
|
121674
|
+
),
|
|
121793
121675
|
requestPrivoLogin: procedure().origins("account").http("POST", "/api/v2/login/privo").inputs(external_exports.object({})).handler(async (_2, context) => {
|
|
121794
121676
|
const result = await this._auth.requestOpenIDLogin({
|
|
121795
121677
|
provider: PRIVO_OPEN_ID_PROVIDER,
|
|
@@ -122982,6 +122864,7 @@ var RecordsServer = class {
|
|
|
122982
122864
|
inst: external_exports.string().min(1),
|
|
122983
122865
|
branch: external_exports.string().optional().nullable(),
|
|
122984
122866
|
instances: INSTANCES_ARRAY_VALIDATION.optional(),
|
|
122867
|
+
downgrade: external_exports.boolean().optional().nullable(),
|
|
122985
122868
|
package: external_exports.object({
|
|
122986
122869
|
recordName: RECORD_NAME_VALIDATION,
|
|
122987
122870
|
address: ADDRESS_VALIDATION,
|
|
@@ -123002,7 +122885,14 @@ var RecordsServer = class {
|
|
|
123002
122885
|
})
|
|
123003
122886
|
})
|
|
123004
122887
|
).handler(
|
|
123005
|
-
async ({
|
|
122888
|
+
async ({
|
|
122889
|
+
recordName,
|
|
122890
|
+
inst,
|
|
122891
|
+
branch,
|
|
122892
|
+
package: pkg,
|
|
122893
|
+
instances,
|
|
122894
|
+
downgrade
|
|
122895
|
+
}, context) => {
|
|
123006
122896
|
if (!this._websocketController) {
|
|
123007
122897
|
return INSTS_NOT_SUPPORTED_RESULT;
|
|
123008
122898
|
}
|
|
@@ -123019,7 +122909,8 @@ var RecordsServer = class {
|
|
|
123019
122909
|
inst,
|
|
123020
122910
|
branch,
|
|
123021
122911
|
package: pkg,
|
|
123022
|
-
instances
|
|
122912
|
+
instances,
|
|
122913
|
+
downgrade
|
|
123023
122914
|
});
|
|
123024
122915
|
return result;
|
|
123025
122916
|
}
|
|
@@ -125306,8 +125197,8 @@ var RecordsServer = class {
|
|
|
125306
125197
|
return {
|
|
125307
125198
|
success: true,
|
|
125308
125199
|
...metadata,
|
|
125309
|
-
version: true ? "v3.
|
|
125310
|
-
versionHash: true ? "
|
|
125200
|
+
version: true ? "v3.10.0" : void 0,
|
|
125201
|
+
versionHash: true ? "abfc1b8d83bcdc8ff4dc7f2b4a946fd27b66e692" : void 0
|
|
125311
125202
|
};
|
|
125312
125203
|
}),
|
|
125313
125204
|
getPurchasableItem: procedure().origins(true).http("GET", "/api/v2/records/purchasableItems").inputs(
|
|
@@ -127227,8 +127118,6 @@ var import_tweetnacl8 = __toESM(require_nacl_fast());
|
|
|
127227
127118
|
var import_base64_js15 = __toESM(require_base64_js());
|
|
127228
127119
|
|
|
127229
127120
|
// ../aux-records/financial/FinancialInterface.ts
|
|
127230
|
-
var import_tigerbeetle_node = __toESM(require_dist3());
|
|
127231
|
-
var import_tigerbeetle_node2 = __toESM(require_dist3());
|
|
127232
127121
|
var AMOUNT_MAX = 340282366920938463463374607431768211455n;
|
|
127233
127122
|
var LEDGERS = {
|
|
127234
127123
|
/**
|
|
@@ -127402,45 +127291,45 @@ function getFlagsForAccountCode(code) {
|
|
|
127402
127291
|
switch (code) {
|
|
127403
127292
|
case 1002 /* assets_stripe */:
|
|
127404
127293
|
case 1001 /* assets_cash */:
|
|
127405
|
-
return
|
|
127294
|
+
return (void 0).credits_must_not_exceed_debits | (void 0).history;
|
|
127406
127295
|
case 2101 /* liabilities_user */:
|
|
127407
127296
|
case 2102 /* liabilities_studio */:
|
|
127408
127297
|
case 2103 /* liabilities_contract */:
|
|
127409
127298
|
case 4101 /* revenue_platform_fees */:
|
|
127410
|
-
return
|
|
127299
|
+
return (void 0).debits_must_not_exceed_credits | (void 0).history;
|
|
127411
127300
|
case 6001 /* liquidity_pool */:
|
|
127412
|
-
return
|
|
127301
|
+
return (void 0).none;
|
|
127413
127302
|
default:
|
|
127414
127303
|
throw new Error(`Unknown account code: ${code}`);
|
|
127415
127304
|
}
|
|
127416
127305
|
}
|
|
127417
127306
|
function getMessageForAccountError(error46) {
|
|
127418
127307
|
switch (error46) {
|
|
127419
|
-
case
|
|
127308
|
+
case (void 0).code_must_not_be_zero:
|
|
127420
127309
|
return "The account code must not be zero.";
|
|
127421
|
-
case
|
|
127310
|
+
case (void 0).credits_pending_must_be_zero:
|
|
127422
127311
|
return "The account credits pending must be zero.";
|
|
127423
|
-
case
|
|
127312
|
+
case (void 0).debits_pending_must_be_zero:
|
|
127424
127313
|
return "The account debits pending must be zero.";
|
|
127425
|
-
case
|
|
127314
|
+
case (void 0).credits_posted_must_be_zero:
|
|
127426
127315
|
return "The account credits posted must be zero.";
|
|
127427
|
-
case
|
|
127316
|
+
case (void 0).debits_posted_must_be_zero:
|
|
127428
127317
|
return "The account debits posted must be zero.";
|
|
127429
|
-
case
|
|
127318
|
+
case (void 0).exists:
|
|
127430
127319
|
return "The account already exists.";
|
|
127431
|
-
case
|
|
127320
|
+
case (void 0).exists_with_different_code:
|
|
127432
127321
|
return "The account already exists with a different code.";
|
|
127433
|
-
case
|
|
127322
|
+
case (void 0).exists_with_different_flags:
|
|
127434
127323
|
return "The account already exists with different flags.";
|
|
127435
|
-
case
|
|
127324
|
+
case (void 0).exists_with_different_ledger:
|
|
127436
127325
|
return "The account already exists with a different ledger.";
|
|
127437
|
-
case
|
|
127438
|
-
case
|
|
127439
|
-
case
|
|
127326
|
+
case (void 0).exists_with_different_user_data_128:
|
|
127327
|
+
case (void 0).exists_with_different_user_data_64:
|
|
127328
|
+
case (void 0).exists_with_different_user_data_32:
|
|
127440
127329
|
return "The account already exists with different user data.";
|
|
127441
|
-
case
|
|
127330
|
+
case (void 0).flags_are_mutually_exclusive:
|
|
127442
127331
|
return "The account flags are mutually exclusive.";
|
|
127443
|
-
case
|
|
127332
|
+
case (void 0).timestamp_must_be_zero:
|
|
127444
127333
|
return "The account timestamp must be zero.";
|
|
127445
127334
|
default:
|
|
127446
127335
|
return "An unknown error occurred.";
|
|
@@ -127448,31 +127337,31 @@ function getMessageForAccountError(error46) {
|
|
|
127448
127337
|
}
|
|
127449
127338
|
function getCodeForAccountError(error46) {
|
|
127450
127339
|
switch (error46) {
|
|
127451
|
-
case
|
|
127340
|
+
case (void 0).code_must_not_be_zero:
|
|
127452
127341
|
return "code_must_not_be_zero";
|
|
127453
|
-
case
|
|
127342
|
+
case (void 0).credits_pending_must_be_zero:
|
|
127454
127343
|
return "credits_pending_must_be_zero";
|
|
127455
|
-
case
|
|
127344
|
+
case (void 0).debits_pending_must_be_zero:
|
|
127456
127345
|
return "debits_pending_must_be_zero";
|
|
127457
|
-
case
|
|
127346
|
+
case (void 0).credits_posted_must_be_zero:
|
|
127458
127347
|
return "credits_posted_must_be_zero";
|
|
127459
|
-
case
|
|
127348
|
+
case (void 0).debits_posted_must_be_zero:
|
|
127460
127349
|
return "debits_posted_must_be_zero";
|
|
127461
|
-
case
|
|
127350
|
+
case (void 0).exists:
|
|
127462
127351
|
return "exists";
|
|
127463
|
-
case
|
|
127352
|
+
case (void 0).exists_with_different_code:
|
|
127464
127353
|
return "exists_with_different_code";
|
|
127465
|
-
case
|
|
127354
|
+
case (void 0).exists_with_different_flags:
|
|
127466
127355
|
return "exists_with_different_flags";
|
|
127467
|
-
case
|
|
127356
|
+
case (void 0).exists_with_different_ledger:
|
|
127468
127357
|
return "exists_with_different_ledger";
|
|
127469
|
-
case
|
|
127470
|
-
case
|
|
127471
|
-
case
|
|
127358
|
+
case (void 0).exists_with_different_user_data_128:
|
|
127359
|
+
case (void 0).exists_with_different_user_data_64:
|
|
127360
|
+
case (void 0).exists_with_different_user_data_32:
|
|
127472
127361
|
return "exists_with_different_user_data";
|
|
127473
|
-
case
|
|
127362
|
+
case (void 0).flags_are_mutually_exclusive:
|
|
127474
127363
|
return "flags_are_mutually_exclusive";
|
|
127475
|
-
case
|
|
127364
|
+
case (void 0).timestamp_must_be_zero:
|
|
127476
127365
|
return "timestamp_must_be_zero";
|
|
127477
127366
|
default:
|
|
127478
127367
|
return "server_error";
|
|
@@ -127480,67 +127369,67 @@ function getCodeForAccountError(error46) {
|
|
|
127480
127369
|
}
|
|
127481
127370
|
function getMessageForTransferError(error46) {
|
|
127482
127371
|
switch (error46) {
|
|
127483
|
-
case
|
|
127372
|
+
case (void 0).code_must_not_be_zero:
|
|
127484
127373
|
return "The transfer code must not be zero.";
|
|
127485
|
-
case
|
|
127374
|
+
case (void 0).accounts_must_be_different:
|
|
127486
127375
|
return "The transfer accounts must be different.";
|
|
127487
|
-
case
|
|
127376
|
+
case (void 0).accounts_must_have_the_same_ledger:
|
|
127488
127377
|
return "The transfer accounts must have the same ledger.";
|
|
127489
|
-
case
|
|
127378
|
+
case (void 0).closing_transfer_must_be_pending:
|
|
127490
127379
|
return "The closing transfer must be pending.";
|
|
127491
|
-
case
|
|
127380
|
+
case (void 0).credit_account_already_closed:
|
|
127492
127381
|
return "The credit account is already closed.";
|
|
127493
|
-
case
|
|
127382
|
+
case (void 0).debit_account_already_closed:
|
|
127494
127383
|
return "The debit account is already closed.";
|
|
127495
|
-
case
|
|
127384
|
+
case (void 0).credit_account_not_found:
|
|
127496
127385
|
return "The credit account was not found.";
|
|
127497
|
-
case
|
|
127386
|
+
case (void 0).debit_account_not_found:
|
|
127498
127387
|
return "The debit account was not found.";
|
|
127499
|
-
case
|
|
127388
|
+
case (void 0).exceeds_credits:
|
|
127500
127389
|
return "The transfer would cause the debits on the account to exceed its credits.";
|
|
127501
|
-
case
|
|
127390
|
+
case (void 0).exceeds_debits:
|
|
127502
127391
|
return "The transfer would cause the credits on the account to exceed its debits.";
|
|
127503
|
-
case
|
|
127392
|
+
case (void 0).exists:
|
|
127504
127393
|
return "The transfer already exists.";
|
|
127505
|
-
case
|
|
127394
|
+
case (void 0).exceeds_pending_transfer_amount:
|
|
127506
127395
|
return "The transfer would cause the pending transfer amount to exceed its limit.";
|
|
127507
|
-
case
|
|
127396
|
+
case (void 0).exists_with_different_amount:
|
|
127508
127397
|
return "The transfer already exists with a different amount.";
|
|
127509
|
-
case
|
|
127398
|
+
case (void 0).exists_with_different_code:
|
|
127510
127399
|
return "The transfer already exists with a different code.";
|
|
127511
|
-
case
|
|
127400
|
+
case (void 0).exists_with_different_flags:
|
|
127512
127401
|
return "The transfer already exists with different flags.";
|
|
127513
|
-
case
|
|
127402
|
+
case (void 0).exists_with_different_ledger:
|
|
127514
127403
|
return "The transfer already exists with a different ledger.";
|
|
127515
|
-
case
|
|
127516
|
-
case
|
|
127517
|
-
case
|
|
127404
|
+
case (void 0).exists_with_different_user_data_128:
|
|
127405
|
+
case (void 0).exists_with_different_user_data_64:
|
|
127406
|
+
case (void 0).exists_with_different_user_data_32:
|
|
127518
127407
|
return "The transfer already exists with different user data.";
|
|
127519
|
-
case
|
|
127408
|
+
case (void 0).flags_are_mutually_exclusive:
|
|
127520
127409
|
return "The transfer flags are mutually exclusive.";
|
|
127521
|
-
case
|
|
127410
|
+
case (void 0).timestamp_must_be_zero:
|
|
127522
127411
|
return "The transfer timestamp must be zero.";
|
|
127523
|
-
case
|
|
127412
|
+
case (void 0).id_already_failed:
|
|
127524
127413
|
return "A transfer with the same ID has already failed.";
|
|
127525
|
-
case
|
|
127414
|
+
case (void 0).overflows_credits:
|
|
127526
127415
|
return "The transfer would cause the credits on the account to overflow a 128-bit unsigned int.";
|
|
127527
|
-
case
|
|
127416
|
+
case (void 0).overflows_debits:
|
|
127528
127417
|
return "The transfer would cause the debits on the account to overflow a 128-bit unsigned int.";
|
|
127529
|
-
case
|
|
127418
|
+
case (void 0).overflows_credits_pending:
|
|
127530
127419
|
return "The transfer would cause the credits pending on the account to overflow a 128-bit unsigned int.";
|
|
127531
|
-
case
|
|
127420
|
+
case (void 0).overflows_debits_pending:
|
|
127532
127421
|
return "The transfer would cause the debits pending on the account to overflow a 128-bit unsigned int.";
|
|
127533
|
-
case
|
|
127422
|
+
case (void 0).overflows_credits_posted:
|
|
127534
127423
|
return "The transfer would cause the credits posted on the account to overflow a 128-bit unsigned int.";
|
|
127535
|
-
case
|
|
127424
|
+
case (void 0).overflows_debits_posted:
|
|
127536
127425
|
return "The transfer would cause the debits posted on the account to overflow a 128-bit unsigned int.";
|
|
127537
|
-
case
|
|
127426
|
+
case (void 0).overflows_timeout:
|
|
127538
127427
|
return "The transfer would cause the timeout on the account to overflow a 64-bit unsigned int.";
|
|
127539
|
-
case
|
|
127428
|
+
case (void 0).transfer_must_have_the_same_ledger_as_accounts:
|
|
127540
127429
|
return "The transfer must have the same ledger as the accounts.";
|
|
127541
|
-
case
|
|
127430
|
+
case (void 0).linked_event_failed:
|
|
127542
127431
|
return "The linked event for the transfer failed.";
|
|
127543
|
-
case
|
|
127432
|
+
case (void 0).pending_transfer_not_pending:
|
|
127544
127433
|
return "The pending transfer was not pending.";
|
|
127545
127434
|
default:
|
|
127546
127435
|
return `An unknown error occurred (${error46}).`;
|
|
@@ -127548,71 +127437,71 @@ function getMessageForTransferError(error46) {
|
|
|
127548
127437
|
}
|
|
127549
127438
|
function getCodeForTransferError(error46) {
|
|
127550
127439
|
switch (error46) {
|
|
127551
|
-
case
|
|
127440
|
+
case (void 0).code_must_not_be_zero:
|
|
127552
127441
|
return "code_must_not_be_zero";
|
|
127553
|
-
case
|
|
127442
|
+
case (void 0).accounts_must_be_different:
|
|
127554
127443
|
return "accounts_must_be_different";
|
|
127555
|
-
case
|
|
127444
|
+
case (void 0).accounts_must_have_the_same_ledger:
|
|
127556
127445
|
return "accounts_must_have_the_same_ledger";
|
|
127557
|
-
case
|
|
127446
|
+
case (void 0).closing_transfer_must_be_pending:
|
|
127558
127447
|
return "closing_transfer_must_be_pending";
|
|
127559
|
-
case
|
|
127448
|
+
case (void 0).credit_account_already_closed:
|
|
127560
127449
|
return "credit_account_already_closed";
|
|
127561
|
-
case
|
|
127450
|
+
case (void 0).debit_account_already_closed:
|
|
127562
127451
|
return "debit_account_already_closed";
|
|
127563
|
-
case
|
|
127452
|
+
case (void 0).credit_account_not_found:
|
|
127564
127453
|
return "credit_account_not_found";
|
|
127565
|
-
case
|
|
127454
|
+
case (void 0).debit_account_not_found:
|
|
127566
127455
|
return "debit_account_not_found";
|
|
127567
|
-
case
|
|
127456
|
+
case (void 0).exceeds_credits:
|
|
127568
127457
|
return "exceeds_credits";
|
|
127569
|
-
case
|
|
127458
|
+
case (void 0).exceeds_debits:
|
|
127570
127459
|
return "exceeds_debits";
|
|
127571
|
-
case
|
|
127572
|
-
case
|
|
127573
|
-
case
|
|
127574
|
-
case
|
|
127575
|
-
case
|
|
127576
|
-
case
|
|
127577
|
-
case
|
|
127578
|
-
case
|
|
127579
|
-
case
|
|
127460
|
+
case (void 0).exists:
|
|
127461
|
+
case (void 0).exceeds_pending_transfer_amount:
|
|
127462
|
+
case (void 0).exists_with_different_amount:
|
|
127463
|
+
case (void 0).exists_with_different_code:
|
|
127464
|
+
case (void 0).exists_with_different_flags:
|
|
127465
|
+
case (void 0).exists_with_different_ledger:
|
|
127466
|
+
case (void 0).exists_with_different_user_data_128:
|
|
127467
|
+
case (void 0).exists_with_different_user_data_64:
|
|
127468
|
+
case (void 0).exists_with_different_user_data_32:
|
|
127580
127469
|
return "exists";
|
|
127581
|
-
case
|
|
127470
|
+
case (void 0).flags_are_mutually_exclusive:
|
|
127582
127471
|
return "flags_are_mutually_exclusive";
|
|
127583
|
-
case
|
|
127472
|
+
case (void 0).timestamp_must_be_zero:
|
|
127584
127473
|
return "timestamp_must_be_zero";
|
|
127585
|
-
case
|
|
127474
|
+
case (void 0).id_already_failed:
|
|
127586
127475
|
return "id_already_failed";
|
|
127587
|
-
case
|
|
127476
|
+
case (void 0).overflows_credits:
|
|
127588
127477
|
return "overflows_credits";
|
|
127589
|
-
case
|
|
127478
|
+
case (void 0).overflows_debits:
|
|
127590
127479
|
return "overflows_debits";
|
|
127591
|
-
case
|
|
127480
|
+
case (void 0).overflows_credits_pending:
|
|
127592
127481
|
return "overflows_credits_pending";
|
|
127593
|
-
case
|
|
127482
|
+
case (void 0).overflows_debits_pending:
|
|
127594
127483
|
return "overflows_debits_pending";
|
|
127595
|
-
case
|
|
127484
|
+
case (void 0).overflows_credits_posted:
|
|
127596
127485
|
return "overflows_credits_posted";
|
|
127597
|
-
case
|
|
127486
|
+
case (void 0).overflows_debits_posted:
|
|
127598
127487
|
return "overflows_debits_posted";
|
|
127599
|
-
case
|
|
127488
|
+
case (void 0).overflows_timeout:
|
|
127600
127489
|
return "overflows_timeout";
|
|
127601
|
-
case
|
|
127490
|
+
case (void 0).pending_transfer_already_posted:
|
|
127602
127491
|
return "already_posted";
|
|
127603
|
-
case
|
|
127492
|
+
case (void 0).pending_transfer_already_voided:
|
|
127604
127493
|
return "already_voided";
|
|
127605
127494
|
default:
|
|
127606
127495
|
return "server_error";
|
|
127607
127496
|
}
|
|
127608
127497
|
}
|
|
127609
127498
|
function getFlagsForTransferCode(code) {
|
|
127610
|
-
return
|
|
127499
|
+
return (void 0).none;
|
|
127611
127500
|
}
|
|
127612
127501
|
function processAccountErrors(results) {
|
|
127613
127502
|
let errors = [];
|
|
127614
127503
|
for (let result of results) {
|
|
127615
|
-
if (result.result !==
|
|
127504
|
+
if (result.result !== (void 0).ok) {
|
|
127616
127505
|
errors.push({
|
|
127617
127506
|
errorCode: getCodeForAccountError(result.result),
|
|
127618
127507
|
errorMessage: getMessageForAccountError(result.result),
|
|
@@ -127632,7 +127521,7 @@ function processAccountErrors(results) {
|
|
|
127632
127521
|
function processTransferErrors(results, transfers) {
|
|
127633
127522
|
let errors = [];
|
|
127634
127523
|
for (let result of results) {
|
|
127635
|
-
if (result.result !==
|
|
127524
|
+
if (result.result !== (void 0).ok) {
|
|
127636
127525
|
const transfer = transfers[result.index];
|
|
127637
127526
|
errors.push({
|
|
127638
127527
|
errorCode: getCodeForTransferError(result.result),
|
|
@@ -127653,7 +127542,6 @@ function processTransferErrors(results, transfers) {
|
|
|
127653
127542
|
}
|
|
127654
127543
|
|
|
127655
127544
|
// ../aux-records/financial/FinancialController.ts
|
|
127656
|
-
var import_tigerbeetle_node3 = __toESM(require_dist3());
|
|
127657
127545
|
var TRACE_NAME12 = "FinancialController";
|
|
127658
127546
|
var FinancialController = class {
|
|
127659
127547
|
constructor(financialInterface, financialStore) {
|
|
@@ -127730,7 +127618,7 @@ var FinancialController = class {
|
|
|
127730
127618
|
{
|
|
127731
127619
|
id: ACCOUNT_IDS.liquidity_usd,
|
|
127732
127620
|
code: 6001 /* liquidity_pool */,
|
|
127733
|
-
flags: getFlagsForAccountCode(6001 /* liquidity_pool */) |
|
|
127621
|
+
flags: getFlagsForAccountCode(6001 /* liquidity_pool */) | (void 0).debits_must_not_exceed_credits,
|
|
127734
127622
|
credits_pending: 0n,
|
|
127735
127623
|
credits_posted: 0n,
|
|
127736
127624
|
debits_pending: 0n,
|
|
@@ -127745,7 +127633,7 @@ var FinancialController = class {
|
|
|
127745
127633
|
{
|
|
127746
127634
|
id: ACCOUNT_IDS.liquidity_credits,
|
|
127747
127635
|
code: 6001 /* liquidity_pool */,
|
|
127748
|
-
flags: getFlagsForAccountCode(6001 /* liquidity_pool */) |
|
|
127636
|
+
flags: getFlagsForAccountCode(6001 /* liquidity_pool */) | (void 0).credits_must_not_exceed_debits,
|
|
127749
127637
|
credits_pending: 0n,
|
|
127750
127638
|
credits_posted: 0n,
|
|
127751
127639
|
debits_pending: 0n,
|
|
@@ -127760,7 +127648,7 @@ var FinancialController = class {
|
|
|
127760
127648
|
{
|
|
127761
127649
|
id: ACCOUNT_IDS.USD_SETUP,
|
|
127762
127650
|
code: 1 /* control */,
|
|
127763
|
-
flags:
|
|
127651
|
+
flags: (void 0).none,
|
|
127764
127652
|
credits_pending: 0n,
|
|
127765
127653
|
credits_posted: 0n,
|
|
127766
127654
|
debits_pending: 0n,
|
|
@@ -127775,7 +127663,7 @@ var FinancialController = class {
|
|
|
127775
127663
|
{
|
|
127776
127664
|
id: ACCOUNT_IDS.USD_LIMIT_CREDITS,
|
|
127777
127665
|
code: 1 /* control */,
|
|
127778
|
-
flags:
|
|
127666
|
+
flags: (void 0).credits_must_not_exceed_debits,
|
|
127779
127667
|
credits_pending: 0n,
|
|
127780
127668
|
credits_posted: 0n,
|
|
127781
127669
|
debits_pending: 0n,
|
|
@@ -127790,7 +127678,7 @@ var FinancialController = class {
|
|
|
127790
127678
|
{
|
|
127791
127679
|
id: ACCOUNT_IDS.USD_LIMIT_DEBITS,
|
|
127792
127680
|
code: 1 /* control */,
|
|
127793
|
-
flags:
|
|
127681
|
+
flags: (void 0).debits_must_not_exceed_credits,
|
|
127794
127682
|
credits_pending: 0n,
|
|
127795
127683
|
credits_posted: 0n,
|
|
127796
127684
|
debits_pending: 0n,
|
|
@@ -127805,7 +127693,7 @@ var FinancialController = class {
|
|
|
127805
127693
|
{
|
|
127806
127694
|
id: ACCOUNT_IDS.CREDITS_SETUP,
|
|
127807
127695
|
code: 1 /* control */,
|
|
127808
|
-
flags:
|
|
127696
|
+
flags: (void 0).none,
|
|
127809
127697
|
credits_pending: 0n,
|
|
127810
127698
|
credits_posted: 0n,
|
|
127811
127699
|
debits_pending: 0n,
|
|
@@ -127820,7 +127708,7 @@ var FinancialController = class {
|
|
|
127820
127708
|
{
|
|
127821
127709
|
id: ACCOUNT_IDS.CREDITS_LIMIT_CREDITS,
|
|
127822
127710
|
code: 1 /* control */,
|
|
127823
|
-
flags:
|
|
127711
|
+
flags: (void 0).credits_must_not_exceed_debits,
|
|
127824
127712
|
credits_pending: 0n,
|
|
127825
127713
|
credits_posted: 0n,
|
|
127826
127714
|
debits_pending: 0n,
|
|
@@ -127835,7 +127723,7 @@ var FinancialController = class {
|
|
|
127835
127723
|
{
|
|
127836
127724
|
id: ACCOUNT_IDS.CREDITS_LIMIT_DEBITS,
|
|
127837
127725
|
code: 1 /* control */,
|
|
127838
|
-
flags:
|
|
127726
|
+
flags: (void 0).debits_must_not_exceed_credits,
|
|
127839
127727
|
credits_pending: 0n,
|
|
127840
127728
|
credits_posted: 0n,
|
|
127841
127729
|
debits_pending: 0n,
|
|
@@ -127850,7 +127738,7 @@ var FinancialController = class {
|
|
|
127850
127738
|
]);
|
|
127851
127739
|
let failed = false;
|
|
127852
127740
|
for (let result of results) {
|
|
127853
|
-
if (result.result !==
|
|
127741
|
+
if (result.result !== (void 0).ok) {
|
|
127854
127742
|
console.error(
|
|
127855
127743
|
`[FinancialController] Failed to create default accounts (${result.index},${result.result})`,
|
|
127856
127744
|
getMessageForAccountError(result.result)
|
|
@@ -128103,10 +127991,10 @@ var FinancialController = class {
|
|
|
128103
127991
|
let flags = getFlagsForTransferCode(transfer.code);
|
|
128104
127992
|
let timeout = 0;
|
|
128105
127993
|
if (i2 < request2.transfers.length - 1) {
|
|
128106
|
-
flags |=
|
|
127994
|
+
flags |= (void 0).linked;
|
|
128107
127995
|
}
|
|
128108
127996
|
if ("pending" in transfer && transfer.pending) {
|
|
128109
|
-
flags |=
|
|
127997
|
+
flags |= (void 0).pending;
|
|
128110
127998
|
if (transfer.timeoutSeconds <= 0) {
|
|
128111
127999
|
return failure({
|
|
128112
128000
|
errorCode: "invalid_transfer",
|
|
@@ -128117,16 +128005,16 @@ var FinancialController = class {
|
|
|
128117
128005
|
timeout = transfer.timeoutSeconds;
|
|
128118
128006
|
}
|
|
128119
128007
|
if (transfer.balancingCredit) {
|
|
128120
|
-
flags |=
|
|
128008
|
+
flags |= (void 0).balancing_credit;
|
|
128121
128009
|
}
|
|
128122
128010
|
if (transfer.balancingDebit) {
|
|
128123
|
-
flags |=
|
|
128011
|
+
flags |= (void 0).balancing_debit;
|
|
128124
128012
|
}
|
|
128125
128013
|
if (transfer.closingCredit) {
|
|
128126
|
-
flags |=
|
|
128014
|
+
flags |= (void 0).closing_credit | (void 0).pending;
|
|
128127
128015
|
}
|
|
128128
128016
|
if (transfer.closingDebit) {
|
|
128129
|
-
flags |=
|
|
128017
|
+
flags |= (void 0).closing_debit | (void 0).pending;
|
|
128130
128018
|
}
|
|
128131
128019
|
transfers.push({
|
|
128132
128020
|
id: transferId,
|
|
@@ -128160,13 +128048,13 @@ var FinancialController = class {
|
|
|
128160
128048
|
for (let i2 = 0; i2 < request2.transfers.length; i2++) {
|
|
128161
128049
|
const id2 = request2.transfers[i2];
|
|
128162
128050
|
const transferId = typeof id2 === "string" ? BigInt(id2) : id2;
|
|
128163
|
-
let flags = request2.flags ??
|
|
128051
|
+
let flags = request2.flags ?? (void 0).post_pending_transfer;
|
|
128164
128052
|
if (i2 < request2.transfers.length - 1) {
|
|
128165
|
-
flags |=
|
|
128053
|
+
flags |= (void 0).linked;
|
|
128166
128054
|
}
|
|
128167
128055
|
transfers.push({
|
|
128168
128056
|
id: this._financialInterface.generateId(),
|
|
128169
|
-
amount: (flags &
|
|
128057
|
+
amount: (flags & (void 0).void_pending_transfer) === (void 0).void_pending_transfer ? 0n : AMOUNT_MAX,
|
|
128170
128058
|
code: 0,
|
|
128171
128059
|
credit_account_id: 0n,
|
|
128172
128060
|
debit_account_id: 0n,
|
|
@@ -128198,7 +128086,7 @@ var FinancialController = class {
|
|
|
128198
128086
|
account_id: accountId,
|
|
128199
128087
|
code: 0,
|
|
128200
128088
|
// 0 means all codes
|
|
128201
|
-
flags:
|
|
128089
|
+
flags: (void 0).credits | (void 0).debits,
|
|
128202
128090
|
limit: 1e3,
|
|
128203
128091
|
// Limit to 1000 transfers
|
|
128204
128092
|
timestamp_max: 0n,
|
|
@@ -128533,12 +128421,9 @@ function getLiquidityPoolBalance(account) {
|
|
|
128533
128421
|
}
|
|
128534
128422
|
|
|
128535
128423
|
// ../aux-records/financial/MemoryFinancialInterface.ts
|
|
128536
|
-
var import_tigerbeetle_node4 = __toESM(require_dist3());
|
|
128537
|
-
var import_tigerbeetle_node5 = __toESM(require_dist3());
|
|
128538
128424
|
var MAX_BIGINT_128 = BigInt("340282366920938463463374607431768211454");
|
|
128539
128425
|
|
|
128540
128426
|
// ../aux-records/SubscriptionController.ts
|
|
128541
|
-
var import_tigerbeetle_node6 = __toESM(require_dist3());
|
|
128542
128427
|
var TRACE_NAME13 = "SubscriptionController";
|
|
128543
128428
|
var ACCESS_KEY_SECRET_BYTE_LENGTH = 16;
|
|
128544
128429
|
var STRIPE_PAYOUT_TIMEOUT_SECONDS = 60 * 5;
|
|
@@ -128855,7 +128740,7 @@ var SubscriptionController = class {
|
|
|
128855
128740
|
amount: transfer.amount,
|
|
128856
128741
|
debitAccountId: transfer.debit_account_id.toString(),
|
|
128857
128742
|
creditAccountId: transfer.credit_account_id.toString(),
|
|
128858
|
-
pending: (transfer.flags &
|
|
128743
|
+
pending: (transfer.flags & (void 0).pending) !== 0,
|
|
128859
128744
|
code: transfer.code,
|
|
128860
128745
|
timeMs: Number(transfer.timestamp / 1000000n),
|
|
128861
128746
|
// Convert nanoseconds to milliseconds
|
|
@@ -130304,7 +130189,7 @@ var SubscriptionController = class {
|
|
|
130304
130189
|
{
|
|
130305
130190
|
transfers: transferResult.value.transferIds,
|
|
130306
130191
|
transactionId: transferResult.value.transactionId,
|
|
130307
|
-
flags:
|
|
130192
|
+
flags: (void 0).void_pending_transfer
|
|
130308
130193
|
}
|
|
130309
130194
|
);
|
|
130310
130195
|
if (isFailure(voidResult)) {
|
|
@@ -130862,7 +130747,7 @@ var SubscriptionController = class {
|
|
|
130862
130747
|
const voidResult = await this._financialController.completePendingTransfers({
|
|
130863
130748
|
transfers: transactionResult.value.transferIds,
|
|
130864
130749
|
transactionId: transactionResult.value.transactionId,
|
|
130865
|
-
flags:
|
|
130750
|
+
flags: (void 0).void_pending_transfer
|
|
130866
130751
|
});
|
|
130867
130752
|
if (isFailure(voidResult)) {
|
|
130868
130753
|
logError(
|
|
@@ -131683,7 +131568,7 @@ var SubscriptionController = class {
|
|
|
131683
131568
|
const result = await this._financialController.completePendingTransfers({
|
|
131684
131569
|
transfers: session.transferIds,
|
|
131685
131570
|
transactionId: session.transactionId,
|
|
131686
|
-
flags:
|
|
131571
|
+
flags: (void 0).void_pending_transfer
|
|
131687
131572
|
});
|
|
131688
131573
|
if (isFailure(result)) {
|
|
131689
131574
|
logError(
|
|
@@ -144507,6 +144392,99 @@ var PackageVersionRecordsController = class {
|
|
|
144507
144392
|
};
|
|
144508
144393
|
}
|
|
144509
144394
|
}
|
|
144395
|
+
async getItemById(request2) {
|
|
144396
|
+
try {
|
|
144397
|
+
const result = await this._store.getItemById(
|
|
144398
|
+
request2.packageVersionId
|
|
144399
|
+
);
|
|
144400
|
+
if (!result.item) {
|
|
144401
|
+
return {
|
|
144402
|
+
success: false,
|
|
144403
|
+
errorCode: "data_not_found",
|
|
144404
|
+
errorMessage: "The item was not found."
|
|
144405
|
+
};
|
|
144406
|
+
}
|
|
144407
|
+
const baseRequest = {
|
|
144408
|
+
recordKeyOrRecordName: result.recordName,
|
|
144409
|
+
userId: request2.userId,
|
|
144410
|
+
instances: request2.instances
|
|
144411
|
+
};
|
|
144412
|
+
const context = await this._policies.constructAuthorizationContext(
|
|
144413
|
+
baseRequest
|
|
144414
|
+
);
|
|
144415
|
+
if (context.success === false) {
|
|
144416
|
+
return context;
|
|
144417
|
+
}
|
|
144418
|
+
const markers = result.parentMarkers;
|
|
144419
|
+
const authorization = await this._policies.authorizeUserAndInstances(
|
|
144420
|
+
context.context,
|
|
144421
|
+
{
|
|
144422
|
+
userId: request2.userId,
|
|
144423
|
+
instances: request2.instances,
|
|
144424
|
+
resourceKind: this._resourceKind,
|
|
144425
|
+
resourceId: result.item.address,
|
|
144426
|
+
action: "read",
|
|
144427
|
+
markers
|
|
144428
|
+
}
|
|
144429
|
+
);
|
|
144430
|
+
if (authorization.success === false) {
|
|
144431
|
+
return authorization;
|
|
144432
|
+
}
|
|
144433
|
+
const item = {
|
|
144434
|
+
id: result.item.id,
|
|
144435
|
+
address: result.item.address,
|
|
144436
|
+
key: result.item.key,
|
|
144437
|
+
auxFileName: result.item.auxFileName,
|
|
144438
|
+
createdAtMs: result.item.createdAtMs,
|
|
144439
|
+
auxSha256: result.item.auxSha256,
|
|
144440
|
+
createdFile: result.item.createdFile,
|
|
144441
|
+
entitlements: result.item.entitlements,
|
|
144442
|
+
markers: result.item.markers,
|
|
144443
|
+
description: result.item.description,
|
|
144444
|
+
requiresReview: result.item.requiresReview,
|
|
144445
|
+
sha256: result.item.sha256,
|
|
144446
|
+
sizeInBytes: result.item.sizeInBytes,
|
|
144447
|
+
packageId: result.packageId,
|
|
144448
|
+
approved: true,
|
|
144449
|
+
approvalType: "normal"
|
|
144450
|
+
};
|
|
144451
|
+
if (item.requiresReview) {
|
|
144452
|
+
let review = await this.store.getMostRecentPackageVersionReview(
|
|
144453
|
+
item.id
|
|
144454
|
+
);
|
|
144455
|
+
item.approved = review?.approved ?? false;
|
|
144456
|
+
item.approvalType = review?.approvalType ?? null;
|
|
144457
|
+
}
|
|
144458
|
+
const auxFile = item.createdFile ? await this.files.readFile(
|
|
144459
|
+
context.context.recordName,
|
|
144460
|
+
item.auxFileName,
|
|
144461
|
+
null,
|
|
144462
|
+
void 0,
|
|
144463
|
+
"system"
|
|
144464
|
+
) : await this.files.readFile(
|
|
144465
|
+
context.context.recordName,
|
|
144466
|
+
item.auxFileName,
|
|
144467
|
+
context.context.userId
|
|
144468
|
+
);
|
|
144469
|
+
return {
|
|
144470
|
+
success: true,
|
|
144471
|
+
item,
|
|
144472
|
+
auxFile
|
|
144473
|
+
};
|
|
144474
|
+
} catch (err) {
|
|
144475
|
+
const span = trace.getActiveSpan();
|
|
144476
|
+
if (err instanceof Error) {
|
|
144477
|
+
span?.recordException(err);
|
|
144478
|
+
}
|
|
144479
|
+
span?.setStatus({ code: SpanStatusCode.ERROR });
|
|
144480
|
+
console.error(`[${this._name}] Error getting item:`, err);
|
|
144481
|
+
return {
|
|
144482
|
+
success: false,
|
|
144483
|
+
errorCode: "server_error",
|
|
144484
|
+
errorMessage: "A server error occurred."
|
|
144485
|
+
};
|
|
144486
|
+
}
|
|
144487
|
+
}
|
|
144510
144488
|
async eraseItem(request2) {
|
|
144511
144489
|
try {
|
|
144512
144490
|
const context = await this._policies.constructAuthorizationContext({
|
|
@@ -144763,6 +144741,9 @@ __decorateClass([
|
|
|
144763
144741
|
__decorateClass([
|
|
144764
144742
|
traced(TRACE_NAME25)
|
|
144765
144743
|
], PackageVersionRecordsController.prototype, "getItem", 1);
|
|
144744
|
+
__decorateClass([
|
|
144745
|
+
traced(TRACE_NAME25)
|
|
144746
|
+
], PackageVersionRecordsController.prototype, "getItemById", 1);
|
|
144766
144747
|
__decorateClass([
|
|
144767
144748
|
traced(TRACE_NAME25)
|
|
144768
144749
|
], PackageVersionRecordsController.prototype, "eraseItem", 1);
|
|
@@ -145546,7 +145527,7 @@ var WebsocketController = class {
|
|
|
145546
145527
|
}
|
|
145547
145528
|
async addUserUpdates(request2) {
|
|
145548
145529
|
console.log(
|
|
145549
|
-
`[
|
|
145530
|
+
`[WebsocketController] [namespace: ${request2.recordName}/${request2.inst}/${request2.branch}, userId: ${request2.userId}] Add Updates`
|
|
145550
145531
|
);
|
|
145551
145532
|
if (request2.updates) {
|
|
145552
145533
|
let branch = await this._instStore.getBranchByName(
|
|
@@ -145575,7 +145556,7 @@ var WebsocketController = class {
|
|
|
145575
145556
|
}
|
|
145576
145557
|
if (!branch) {
|
|
145577
145558
|
console.log(
|
|
145578
|
-
`[
|
|
145559
|
+
`[WebsocketController] [namespace: ${request2.recordName}/${request2.inst}/${request2.branch}, userId: ${request2.userId}] Branch not found!`
|
|
145579
145560
|
);
|
|
145580
145561
|
const instResult = await this._getOrCreateInst(
|
|
145581
145562
|
request2.recordName,
|
|
@@ -145700,7 +145681,7 @@ var WebsocketController = class {
|
|
|
145700
145681
|
);
|
|
145701
145682
|
if (result.success === false) {
|
|
145702
145683
|
console.log(
|
|
145703
|
-
`[
|
|
145684
|
+
`[WebsocketController] [namespace: ${request2.recordName}/${request2.inst}/${request2.branch}, userId: ${request2.userId}] Failed to add updates`,
|
|
145704
145685
|
result
|
|
145705
145686
|
);
|
|
145706
145687
|
if (result.errorCode === "max_size_reached") {
|
|
@@ -146516,7 +146497,7 @@ var WebsocketController = class {
|
|
|
146516
146497
|
const userId = request2.userId;
|
|
146517
146498
|
const key = request2.package.key ?? {};
|
|
146518
146499
|
console.log(
|
|
146519
|
-
`[
|
|
146500
|
+
`[WebsocketController] [namespace: ${request2.recordName}/${request2.inst}, ${userId}, package: ${request2.package.recordName}/${request2.package.address}@${formatVersionSpecifier(key)}] Install Package`
|
|
146520
146501
|
);
|
|
146521
146502
|
const p2 = await this._packageVersions.getItem({
|
|
146522
146503
|
recordName: request2.package.recordName,
|
|
@@ -146527,14 +146508,14 @@ var WebsocketController = class {
|
|
|
146527
146508
|
});
|
|
146528
146509
|
if (p2.success === false) {
|
|
146529
146510
|
console.error(
|
|
146530
|
-
`[
|
|
146511
|
+
`[WebsocketController] [userId: ${userId}] Unable to load package.`,
|
|
146531
146512
|
p2
|
|
146532
146513
|
);
|
|
146533
146514
|
return p2;
|
|
146534
146515
|
}
|
|
146535
146516
|
if (p2.auxFile.success === false) {
|
|
146536
146517
|
console.error(
|
|
146537
|
-
`[
|
|
146518
|
+
`[WebsocketController] [userId: ${userId}] Unable to load package file.`,
|
|
146538
146519
|
p2.auxFile
|
|
146539
146520
|
);
|
|
146540
146521
|
return p2.auxFile;
|
|
@@ -146546,14 +146527,16 @@ var WebsocketController = class {
|
|
|
146546
146527
|
p2.item.packageId
|
|
146547
146528
|
);
|
|
146548
146529
|
if (loadedPackage) {
|
|
146549
|
-
|
|
146550
|
-
|
|
146551
|
-
|
|
146552
|
-
|
|
146553
|
-
|
|
146554
|
-
|
|
146555
|
-
|
|
146556
|
-
|
|
146530
|
+
if (loadedPackage.packageVersionId === p2.item.id) {
|
|
146531
|
+
console.log(
|
|
146532
|
+
`[WebsocketController] [userId: ${userId}] Package already loaded.`
|
|
146533
|
+
);
|
|
146534
|
+
return {
|
|
146535
|
+
success: true,
|
|
146536
|
+
packageLoadId: loadedPackage.id,
|
|
146537
|
+
package: p2.item
|
|
146538
|
+
};
|
|
146539
|
+
}
|
|
146557
146540
|
}
|
|
146558
146541
|
const context = await this._policies.constructAuthorizationContext({
|
|
146559
146542
|
recordKeyOrRecordName: request2.package.recordName,
|
|
@@ -146576,68 +146559,85 @@ var WebsocketController = class {
|
|
|
146576
146559
|
if (authorization.success === false) {
|
|
146577
146560
|
return authorization;
|
|
146578
146561
|
}
|
|
146579
|
-
const
|
|
146580
|
-
|
|
146581
|
-
|
|
146582
|
-
});
|
|
146583
|
-
if (fileResponse.status >= 300) {
|
|
146584
|
-
console.error(
|
|
146585
|
-
`[CausalRepoServer] [userId: ${userId}] Unable to load package file.`
|
|
146586
|
-
);
|
|
146587
|
-
return {
|
|
146588
|
-
success: false,
|
|
146589
|
-
errorCode: "invalid_file_data",
|
|
146590
|
-
errorMessage: "The package file could not be loaded."
|
|
146591
|
-
};
|
|
146592
|
-
}
|
|
146593
|
-
const json2 = await fileResponse.text();
|
|
146594
|
-
const packageData = tryParseJson(json2);
|
|
146595
|
-
if (packageData.success === false) {
|
|
146596
|
-
console.error(
|
|
146597
|
-
`[CausalRepoServer] [userId: ${userId}] Unable to parse package file.`,
|
|
146598
|
-
packageData
|
|
146599
|
-
);
|
|
146600
|
-
return {
|
|
146601
|
-
success: false,
|
|
146602
|
-
errorCode: "invalid_file_data",
|
|
146603
|
-
errorMessage: "The package file could not be parsed. It must be valid JSON."
|
|
146604
|
-
};
|
|
146562
|
+
const packageData = await this._loadPackageVersion(userId, p2);
|
|
146563
|
+
if (isFailure(packageData)) {
|
|
146564
|
+
return genericResult(packageData);
|
|
146605
146565
|
}
|
|
146606
|
-
|
|
146607
|
-
if (parsed.success === false) {
|
|
146608
|
-
console.error(
|
|
146609
|
-
`[CausalRepoServer] [userId: ${userId}] Unable to parse package file.`,
|
|
146610
|
-
packageData
|
|
146611
|
-
);
|
|
146612
|
-
return {
|
|
146613
|
-
success: false,
|
|
146614
|
-
errorCode: "invalid_file_data",
|
|
146615
|
-
errorMessage: "The package file could not be parsed.",
|
|
146616
|
-
issues: parsed.error.issues
|
|
146617
|
-
};
|
|
146618
|
-
}
|
|
146619
|
-
const updates = parsed.data.version === 2 ? parsed.data.updates.map((u2) => u2.update) : [
|
|
146566
|
+
let updates = packageData.value.version === 2 ? packageData.value.updates : [
|
|
146620
146567
|
constructInitializationUpdate(
|
|
146621
146568
|
createInitializationUpdate(
|
|
146622
|
-
Object.values(
|
|
146569
|
+
Object.values(
|
|
146570
|
+
packageData.value.state
|
|
146571
|
+
)
|
|
146623
146572
|
)
|
|
146624
|
-
)
|
|
146573
|
+
)
|
|
146625
146574
|
];
|
|
146626
|
-
const timestamps = parsed.data.version === 2 ? parsed.data.updates.map((u2) => u2.timestamp) : [0];
|
|
146627
146575
|
const branch = request2.branch ?? DEFAULT_BRANCH_NAME;
|
|
146576
|
+
if (loadedPackage) {
|
|
146577
|
+
const existingPackageVersion = await this._packageVersions.getItemById({
|
|
146578
|
+
packageVersionId: loadedPackage.packageVersionId,
|
|
146579
|
+
userId,
|
|
146580
|
+
instances: request2.instances
|
|
146581
|
+
});
|
|
146582
|
+
if (existingPackageVersion.success === false) {
|
|
146583
|
+
console.error(
|
|
146584
|
+
`[WebsocketController] [userId: ${userId}] Unable to get existing package version.`,
|
|
146585
|
+
existingPackageVersion
|
|
146586
|
+
);
|
|
146587
|
+
return existingPackageVersion;
|
|
146588
|
+
} else {
|
|
146589
|
+
if (compareVersions(
|
|
146590
|
+
p2.item.key,
|
|
146591
|
+
existingPackageVersion.item.key
|
|
146592
|
+
) <= 0) {
|
|
146593
|
+
if (!request2.downgrade) {
|
|
146594
|
+
return {
|
|
146595
|
+
success: false,
|
|
146596
|
+
errorCode: "invalid_request",
|
|
146597
|
+
errorMessage: `Cannot install version ${formatVersionSpecifier(
|
|
146598
|
+
p2.item.key
|
|
146599
|
+
)} because a newer version (${formatVersionSpecifier(
|
|
146600
|
+
existingPackageVersion.item.key
|
|
146601
|
+
)}) of this package is already installed. If you want to downgrade the package, you must set the downgrade option to true.`
|
|
146602
|
+
};
|
|
146603
|
+
} else {
|
|
146604
|
+
console.log(
|
|
146605
|
+
`[WebsocketController] [userId: ${userId}] Downgrading package from version ${loadedPackage.packageVersionId} to ${p2.item.id}.`
|
|
146606
|
+
);
|
|
146607
|
+
}
|
|
146608
|
+
}
|
|
146609
|
+
const existingUpdates = await this._instStore.getCurrentUpdates(
|
|
146610
|
+
request2.recordName,
|
|
146611
|
+
request2.inst,
|
|
146612
|
+
branch
|
|
146613
|
+
);
|
|
146614
|
+
updates = [
|
|
146615
|
+
updateToNewStateUpdate(
|
|
146616
|
+
existingUpdates.updates.map((u2, i2) => ({
|
|
146617
|
+
id: i2,
|
|
146618
|
+
update: u2,
|
|
146619
|
+
timestamp: 0
|
|
146620
|
+
})),
|
|
146621
|
+
updates
|
|
146622
|
+
)
|
|
146623
|
+
];
|
|
146624
|
+
}
|
|
146625
|
+
}
|
|
146626
|
+
const updateBase64 = updates.map((u2) => u2.update);
|
|
146627
|
+
const timestamps = updates.map((u2) => u2.timestamp);
|
|
146628
146628
|
const result = await this.addUserUpdates({
|
|
146629
146629
|
userId: request2.userId,
|
|
146630
146630
|
userRole: request2.userRole,
|
|
146631
146631
|
recordName: request2.recordName,
|
|
146632
146632
|
inst: request2.inst,
|
|
146633
146633
|
branch,
|
|
146634
|
-
updates,
|
|
146634
|
+
updates: updateBase64,
|
|
146635
146635
|
timestamps
|
|
146636
146636
|
});
|
|
146637
146637
|
if (result.success === false) {
|
|
146638
146638
|
return result;
|
|
146639
146639
|
}
|
|
146640
|
-
const loadedPackageId = v7_default();
|
|
146640
|
+
const loadedPackageId = loadedPackage?.id ?? v7_default();
|
|
146641
146641
|
await loadedPackageStore.saveLoadedPackage({
|
|
146642
146642
|
id: loadedPackageId,
|
|
146643
146643
|
recordName: request2.recordName,
|
|
@@ -146653,6 +146653,49 @@ var WebsocketController = class {
|
|
|
146653
146653
|
package: p2.item
|
|
146654
146654
|
};
|
|
146655
146655
|
}
|
|
146656
|
+
async _loadPackageVersion(userId, p2) {
|
|
146657
|
+
if (p2.auxFile.success === false) {
|
|
146658
|
+
return failure(p2.auxFile);
|
|
146659
|
+
}
|
|
146660
|
+
const fileResponse = await fetch(p2.auxFile.requestUrl, {
|
|
146661
|
+
method: p2.auxFile.requestMethod,
|
|
146662
|
+
headers: new Headers(p2.auxFile.requestHeaders)
|
|
146663
|
+
});
|
|
146664
|
+
if (fileResponse.status >= 300) {
|
|
146665
|
+
console.error(
|
|
146666
|
+
`[WebsocketController] [userId: ${userId}] Unable to load package file.`
|
|
146667
|
+
);
|
|
146668
|
+
return failure({
|
|
146669
|
+
errorCode: "invalid_file_data",
|
|
146670
|
+
errorMessage: "The package file could not be loaded."
|
|
146671
|
+
});
|
|
146672
|
+
}
|
|
146673
|
+
const json2 = await fileResponse.text();
|
|
146674
|
+
const packageData = tryParseJson(json2);
|
|
146675
|
+
if (packageData.success === false) {
|
|
146676
|
+
console.error(
|
|
146677
|
+
`[WebsocketController] [userId: ${userId}] Unable to parse package file.`,
|
|
146678
|
+
packageData
|
|
146679
|
+
);
|
|
146680
|
+
return failure({
|
|
146681
|
+
errorCode: "invalid_file_data",
|
|
146682
|
+
errorMessage: "The package file could not be parsed. It must be valid JSON."
|
|
146683
|
+
});
|
|
146684
|
+
}
|
|
146685
|
+
const parsed = STORED_AUX_SCHEMA.safeParse(packageData.value);
|
|
146686
|
+
if (parsed.success === false) {
|
|
146687
|
+
console.error(
|
|
146688
|
+
`[WebsocketController] [userId: ${userId}] Unable to parse package file.`,
|
|
146689
|
+
packageData
|
|
146690
|
+
);
|
|
146691
|
+
return failure({
|
|
146692
|
+
errorCode: "invalid_file_data",
|
|
146693
|
+
errorMessage: "The package file could not be parsed.",
|
|
146694
|
+
issues: parsed.error.issues
|
|
146695
|
+
});
|
|
146696
|
+
}
|
|
146697
|
+
return success2(parsed.data);
|
|
146698
|
+
}
|
|
146656
146699
|
async listInstalledPackages(request2) {
|
|
146657
146700
|
if (!this._packageVersions) {
|
|
146658
146701
|
return {
|
|
@@ -154475,11 +154518,11 @@ var App2 = App.defaults({ Octokit: Octokit2 });
|
|
|
154475
154518
|
var OAuthApp2 = OAuthApp.defaults({ Octokit: Octokit2 });
|
|
154476
154519
|
|
|
154477
154520
|
// ../../node_modules/.pnpm/simple-git@3.27.0/node_modules/simple-git/dist/esm/index.js
|
|
154478
|
-
var import_file_exists = __toESM(
|
|
154521
|
+
var import_file_exists = __toESM(require_dist3(), 1);
|
|
154479
154522
|
var import_debug = __toESM(require_src2(), 1);
|
|
154480
154523
|
var import_child_process = require("child_process");
|
|
154481
|
-
var import_promise_deferred = __toESM(
|
|
154482
|
-
var import_promise_deferred2 = __toESM(
|
|
154524
|
+
var import_promise_deferred = __toESM(require_dist4(), 1);
|
|
154525
|
+
var import_promise_deferred2 = __toESM(require_dist4(), 1);
|
|
154483
154526
|
var import_node_events = require("node:events");
|
|
154484
154527
|
var __defProp2 = Object.defineProperty;
|
|
154485
154528
|
var __defProps = Object.defineProperties;
|
|
@@ -159266,7 +159309,9 @@ async function minifyAux(aux, target = [
|
|
|
159266
159309
|
return transformAux(aux, {
|
|
159267
159310
|
minify: true,
|
|
159268
159311
|
target,
|
|
159269
|
-
jsx: "
|
|
159312
|
+
jsx: "transform",
|
|
159313
|
+
jsxFactory: "html.h",
|
|
159314
|
+
jsxFragment: "html.f",
|
|
159270
159315
|
platform: "browser"
|
|
159271
159316
|
});
|
|
159272
159317
|
}
|
|
@@ -159352,7 +159397,7 @@ var config2 = new Conf({
|
|
|
159352
159397
|
projectName: "casualos-cli"
|
|
159353
159398
|
});
|
|
159354
159399
|
var program2 = new Command();
|
|
159355
|
-
program2.name("casualos").description("A CLI for CasualOS").version("v3.
|
|
159400
|
+
program2.name("casualos").description("A CLI for CasualOS").version("v3.10.0").option(
|
|
159356
159401
|
"-e, --endpoint <url>",
|
|
159357
159402
|
"The endpoint to use for queries. Can be used to override the current endpoint."
|
|
159358
159403
|
);
|