ekwo-os 0.4.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +873 -0
- package/dist/args.d.ts +57 -0
- package/dist/args.d.ts.map +1 -0
- package/dist/args.js +134 -0
- package/dist/args.js.map +1 -0
- package/dist/assets/expected-objects.json +9432 -0
- package/dist/assets/migrations/20260911120000_core_companies.sql +260 -0
- package/dist/assets/migrations/20260911120100_accounts_journals.sql +211 -0
- package/dist/assets/migrations/20260911120200_contacts.sql +90 -0
- package/dist/assets/migrations/20260911120300_taxes.sql +146 -0
- package/dist/assets/migrations/20260911120400_entries.sql +338 -0
- package/dist/assets/migrations/20260911120500_documents.sql +279 -0
- package/dist/assets/migrations/20260911120600_payments_reconciliation.sql +251 -0
- package/dist/assets/migrations/20260911120700_bank.sql +178 -0
- package/dist/assets/migrations/20260911120800_analytics_attachments.sql +128 -0
- package/dist/assets/migrations/20260911120900_post_document.sql +279 -0
- package/dist/assets/migrations/20260911121000_reporting.sql +235 -0
- package/dist/assets/migrations/20260911121100_country_templates.sql +226 -0
- package/dist/assets/migrations/20260911121200_fec.sql +71 -0
- package/dist/assets/migrations/20260911130000_instance.sql +77 -0
- package/dist/assets/migrations/20260911130100_instance_members.sql +224 -0
- package/dist/assets/migrations/20260911140000_instance_admins.sql +112 -0
- package/dist/assets/migrations/20260911160000_tax_posting_templates_unique.sql +17 -0
- package/dist/assets/migrations/20260911170000_document_amount_paid.sql +82 -0
- package/dist/assets/migrations/20260911173000_post_payment.sql +122 -0
- package/dist/assets/migrations/20260911173100_sequence_counters_under_rls.sql +84 -0
- package/dist/assets/migrations/20260911183000_country_journal_defaults.sql +143 -0
- package/dist/assets/migrations/20260911193853_line_account_defaults.sql +274 -0
- package/dist/assets/migrations/20260911195054_products.sql +221 -0
- package/dist/assets/migrations/20260911210131_anon_surface.sql +85 -0
- package/dist/assets/migrations/20260912074712_country_packs.sql +318 -0
- package/dist/assets/migrations/20260912080311_report_code_and_region.sql +198 -0
- package/dist/assets/migrations/20260912081014_pack_certification_maintained.sql +31 -0
- package/dist/assets/migrations/20260912081015_pack_certification_backfill.sql +16 -0
- package/dist/assets/migrations/20260912090407_tax_report_boxes.sql +329 -0
- package/dist/assets/migrations/20260912091917_tax_on_base_value.sql +25 -0
- package/dist/assets/migrations/20260912091918_tax_engine_columns.sql +776 -0
- package/dist/assets/migrations/20260912094412_opening_and_closing.sql +759 -0
- package/dist/assets/migrations/20260912095825_charts_of_accounts.sql +326 -0
- package/dist/assets/migrations/20260912100412_financial_statements.sql +632 -0
- package/dist/assets/migrations/20260912104719_one_formula_evaluator.sql +209 -0
- package/dist/assets/migrations/20260912105720_entry_kind_appropriation.sql +26 -0
- package/dist/assets/migrations/20260912105721_appropriation_entry_kind.sql +444 -0
- package/dist/assets/migrations/20260912111751_document_rules.sql +274 -0
- package/dist/assets/migrations/20260912112132_cash_basis_vat_and_fx.sql +1189 -0
- package/dist/assets/migrations/20260913074512_modules.sql +493 -0
- package/dist/assets/migrations/20260913075903_asset_disposal_roles.sql +47 -0
- package/dist/assets/migrations/20260913083216_capabilities.sql +637 -0
- package/dist/assets/migrations/20260913083901_company_invitations.sql +262 -0
- package/dist/assets/migrations/20260913084402_user_preferences.sql +376 -0
- package/dist/assets/migrations/20260913084847_company_profile.sql +261 -0
- package/dist/assets/migrations/20260913085436_numbering_reads_the_pack.sql +235 -0
- package/dist/assets/migrations/20260913085932_api_keys.sql +303 -0
- package/dist/assets/migrations/20260913090216_fiscal_year_bounds.sql +159 -0
- package/dist/assets/migrations/20260913092527_entries_import.sql +219 -0
- package/dist/assets/migrations/20260913101536_null_safe_guards.sql +188 -0
- package/dist/assets/migrations/20260913102115_installer_is_named.sql +462 -0
- package/dist/assets/migrations/20260913102758_no_currency_default.sql +138 -0
- package/dist/assets/migrations/20260913103355_cash_basis_needs_a_box.sql +453 -0
- package/dist/assets/migrations/20260913104014_aged_balance_named_group.sql +79 -0
- package/dist/assets/migrations/20260913104232_foreign_key_indexes.sql +144 -0
- package/dist/assets/migrations/20260913105120_declared_no_reader.sql +41 -0
- package/dist/assets/migrations/20260913111407_pack_languages.sql +223 -0
- package/dist/assets/migrations/20260913112233_schema_comments_for_a_reader.sql +27 -0
- package/dist/assets/migrations/20260913114535_fec_opening_balances.sql +307 -0
- package/dist/assets/migrations/20260914103412_audit_log.sql +509 -0
- package/dist/assets/migrations/20260914111907_pack_upgrade.sql +428 -0
- package/dist/assets/migrations/20260914120500_rounding_reads_the_currency.sql +206 -0
- package/dist/assets/migrations/20260914121200_amounts_round_at_the_currency.sql +2403 -0
- package/dist/assets/migrations/20260914134325_schema_version_0_2_0.sql +36 -0
- package/dist/assets/migrations/20260914143915_accounts_in_use.sql +428 -0
- package/dist/assets/migrations/20260914144731_account_code_frozen.sql +99 -0
- package/dist/assets/migrations/20260914151207_schema_grants_its_own_rights.sql +284 -0
- package/dist/assets/migrations/20260914152840_pack_upgrade_records_its_own_line.sql +237 -0
- package/dist/assets/migrations/20260914163943_declaration_periodicity.sql +349 -0
- package/dist/assets/migrations/20260915094000_foreign_services_received.sql +37 -0
- package/dist/assets/migrations/20260915094500_mentions_read_a_foreign_service.sql +72 -0
- package/dist/assets/migrations/20260915153000_document_shares.sql +568 -0
- package/dist/assets/migrations/20260915160000_ec_sales_list.sql +181 -0
- package/dist/assets/migrations/20260915161842_pack_sources.sql +56 -0
- package/dist/assets/migrations/20260915170500_schema_version_0_3_0.sql +45 -0
- package/dist/assets/migrations/20260915174500_a_vat_category_is_a_code.sql +177 -0
- package/dist/assets/migrations/20260915180000_document_rule_references.sql +85 -0
- package/dist/assets/migrations/20260915181000_territories.sql +342 -0
- package/dist/assets/migrations/20260915181500_ec_sales_list_reads_the_territories.sql +222 -0
- package/dist/assets/migrations/20260915182000_intracom_triangular.sql +53 -0
- package/dist/assets/migrations/20260915182500_a_triangular_supply_says_reverse_charge.sql +99 -0
- package/dist/assets/migrations/20260915191200_a_document_knows_its_language.sql +633 -0
- package/dist/assets/migrations/20260915195000_a_price_that_holds_its_tax.sql +649 -0
- package/dist/assets/migrations/20260915200000_a_posting_names_its_boxes.sql +1004 -0
- package/dist/assets/migrations/20260916094500_a_company_files_more_than_one_declaration.sql +795 -0
- package/dist/assets/migrations/20260916103000_a_ledger_line_names_its_posting.sql +902 -0
- package/dist/assets/migrations/20260916123000_a_vocabulary_for_a_tax_that_is_not_a_vat.sql +144 -0
- package/dist/assets/migrations/20260916124000_a_box_can_be_a_rate_of_a_box.sql +525 -0
- package/dist/assets/migrations/20260916125000_a_tax_follows_the_territory.sql +1318 -0
- package/dist/assets/migrations/20260916126000_a_tax_point_and_its_exception.sql +1211 -0
- package/dist/assets/migrations/20260917090000_a_counterparty_that_learns.sql +561 -0
- package/dist/assets/migrations/20260917120000_what_the_money_pays.sql +545 -0
- package/dist/assets/migrations/20260917150000_a_filing_is_a_row.sql +488 -0
- package/dist/assets/migrations/20260917170000_when_it_is_due.sql +194 -0
- package/dist/assets/migrations/20260917180000_a_box_is_a_number_and_a_kind.sql +213 -0
- package/dist/assets/migrations/20260917190000_what_a_declaration_owes.sql +486 -0
- package/dist/assets/migrations/20260917200000_what_moved_after_it_went.sql +227 -0
- package/dist/assets/migrations/20260918090000_a_form_names_its_file.sql +27 -0
- package/dist/assets/migrations/20260918110000_a_deposit_and_what_came_back.sql +286 -0
- package/dist/assets/migrations/20260918113741_a_fourth_preset_is_named.sql +9 -0
- package/dist/assets/migrations/20260918113807_a_client_reads_and_hands_over.sql +96 -0
- package/dist/assets/migrations/20260918114322_two_definer_functions_check_their_caller.sql +75 -0
- package/dist/assets/migrations/20260918130000_every_company_somebody_keeps.sql +177 -0
- package/dist/assets/migrations/20260918140000_a_session_nobody_prepared.sql +40 -0
- package/dist/assets/migrations/20260918141107_a_line_keeps_the_tax_it_was_posted_with.sql +256 -0
- package/dist/assets/migrations/20260918141342_a_company_has_an_electronic_address.sql +66 -0
- package/dist/assets/migrations/20260918141605_an_invoice_reads_whole_from_the_views.sql +313 -0
- package/dist/assets/migrations/20260918141627_a_policy_asks_once.sql +132 -0
- package/dist/assets/migrations/20260918143352_a_suggestion_reads_the_words_once.sql +204 -0
- package/dist/assets/migrations/20260918143417_a_reference_of_the_caller_and_a_rehearsal.sql +115 -0
- package/dist/assets/migrations/20260918150712_a_company_leaves_with_its_books.sql +1119 -0
- package/dist/assets/migrations/20260918150931_a_statement_is_imported_once.sql +654 -0
- package/dist/assets/migrations/20260918161204_a_posted_document_does_not_move.sql +437 -0
- package/dist/assets/migrations/20260918161538_a_posted_entry_does_not_move.sql +252 -0
- package/dist/assets/migrations/20260918171946_an_entry_is_posted_by_post_entry.sql +289 -0
- package/dist/assets/migrations/20260918174312_schema_version_0_4_0.sql +53 -0
- package/dist/assets/modules/assets/module.json +13 -0
- package/dist/assets/modules/assets/supabase/migrations/20260913081447_assets.sql +1190 -0
- package/dist/assets/modules/assets/supabase/migrations/20260913104234_foreign_key_indexes.sql +47 -0
- package/dist/assets/modules/assets/supabase/migrations/20260913104500_assets_capabilities.sql +145 -0
- package/dist/assets/modules/assets/supabase/migrations/20260914122100_assets_round_at_the_currency.sql +564 -0
- package/dist/assets/modules/assets/supabase/migrations/20260914145012_assets_accounts_in_use.sql +37 -0
- package/dist/assets/modules/assets/supabase/migrations/20260914151530_assets_grants_its_own_rights.sql +63 -0
- package/dist/assets/modules/assets/supabase/migrations/20260918113912_assets_client_reads.sql +20 -0
- package/dist/assets/modules/assets/supabase/migrations/20260918150801_assets_leave_with_the_company.sql +41 -0
- package/dist/assets/modules/budgets/module.json +12 -0
- package/dist/assets/modules/budgets/supabase/migrations/20260913083012_budgets.sql +210 -0
- package/dist/assets/modules/budgets/supabase/migrations/20260913104233_foreign_key_indexes.sql +37 -0
- package/dist/assets/modules/budgets/supabase/migrations/20260913104501_budgets_capabilities.sql +72 -0
- package/dist/assets/modules/budgets/supabase/migrations/20260914122400_budgets_round_at_the_currency.sql +68 -0
- package/dist/assets/modules/budgets/supabase/migrations/20260914145048_budgets_accounts_in_use.sql +30 -0
- package/dist/assets/modules/budgets/supabase/migrations/20260914151812_budgets_grants_its_own_rights.sql +31 -0
- package/dist/assets/modules/budgets/supabase/migrations/20260918113954_budgets_client_reads.sql +20 -0
- package/dist/assets/modules/budgets/supabase/migrations/20260918150823_budgets_leave_with_the_company.sql +37 -0
- package/dist/assets/modules/schema/module.1.json +69 -0
- package/dist/assets/seed/00_currencies.sql +15 -0
- package/dist/assets/seed/00_territories.sql +280 -0
- package/dist/assets/seed/05_framework_generic.sql +110 -0
- package/dist/assets/seed/10_pack_be.sql +1284 -0
- package/dist/assets/seed/11_pack_fr.sql +1112 -0
- package/dist/assets/seed/12_pack_lu.sql +2484 -0
- package/dist/assets/seed/13_pack_ee.sql +733 -0
- package/dist/assets/seed/14_pack_gb.sql +796 -0
- package/dist/assets/seed/15_pack_us.sql +751 -0
- package/dist/assets/seed/90_demo_company.sql +368 -0
- package/dist/assets/seed/modules/assets/10_pack_be.sql +58 -0
- package/dist/assets/seed/modules/assets/11_pack_fr.sql +57 -0
- package/dist/assets/seed/modules/assets/14_pack_gb.sql +58 -0
- package/dist/assets/seed/modules/assets/15_pack_us.sql +60 -0
- package/dist/auth.d.ts +59 -0
- package/dist/auth.d.ts.map +1 -0
- package/dist/auth.js +134 -0
- package/dist/auth.js.map +1 -0
- package/dist/bin.d.ts +6 -0
- package/dist/bin.d.ts.map +1 -0
- package/dist/bin.js +8 -0
- package/dist/bin.js.map +1 -0
- package/dist/books.d.ts +60 -0
- package/dist/books.d.ts.map +1 -0
- package/dist/books.js +168 -0
- package/dist/books.js.map +1 -0
- package/dist/bootstrap.d.ts +236 -0
- package/dist/bootstrap.d.ts.map +1 -0
- package/dist/bootstrap.js +459 -0
- package/dist/bootstrap.js.map +1 -0
- package/dist/bundle.d.ts +27 -0
- package/dist/bundle.d.ts.map +1 -0
- package/dist/bundle.js +47 -0
- package/dist/bundle.js.map +1 -0
- package/dist/checklist.d.ts +35 -0
- package/dist/checklist.d.ts.map +1 -0
- package/dist/checklist.js +64 -0
- package/dist/checklist.js.map +1 -0
- package/dist/cli.d.ts +14 -0
- package/dist/cli.d.ts.map +1 -0
- package/dist/cli.js +318 -0
- package/dist/cli.js.map +1 -0
- package/dist/commands/company.d.ts +59 -0
- package/dist/commands/company.d.ts.map +1 -0
- package/dist/commands/company.js +287 -0
- package/dist/commands/company.js.map +1 -0
- package/dist/commands/contact.d.ts +9 -0
- package/dist/commands/contact.d.ts.map +1 -0
- package/dist/commands/contact.js +82 -0
- package/dist/commands/contact.js.map +1 -0
- package/dist/commands/demo.d.ts +19 -0
- package/dist/commands/demo.d.ts.map +1 -0
- package/dist/commands/demo.js +72 -0
- package/dist/commands/demo.js.map +1 -0
- package/dist/commands/doctor.d.ts +12 -0
- package/dist/commands/doctor.d.ts.map +1 -0
- package/dist/commands/doctor.js +68 -0
- package/dist/commands/doctor.js.map +1 -0
- package/dist/commands/document.d.ts +17 -0
- package/dist/commands/document.d.ts.map +1 -0
- package/dist/commands/document.js +217 -0
- package/dist/commands/document.js.map +1 -0
- package/dist/commands/init.d.ts +31 -0
- package/dist/commands/init.d.ts.map +1 -0
- package/dist/commands/init.js +535 -0
- package/dist/commands/init.js.map +1 -0
- package/dist/commands/login.d.ts +24 -0
- package/dist/commands/login.d.ts.map +1 -0
- package/dist/commands/login.js +128 -0
- package/dist/commands/login.js.map +1 -0
- package/dist/commands/migrate.d.ts +30 -0
- package/dist/commands/migrate.d.ts.map +1 -0
- package/dist/commands/migrate.js +115 -0
- package/dist/commands/migrate.js.map +1 -0
- package/dist/commands/module.d.ts +32 -0
- package/dist/commands/module.d.ts.map +1 -0
- package/dist/commands/module.js +285 -0
- package/dist/commands/module.js.map +1 -0
- package/dist/commands/pack.d.ts +22 -0
- package/dist/commands/pack.d.ts.map +1 -0
- package/dist/commands/pack.js +481 -0
- package/dist/commands/pack.js.map +1 -0
- package/dist/commands/payment.d.ts +15 -0
- package/dist/commands/payment.d.ts.map +1 -0
- package/dist/commands/payment.js +97 -0
- package/dist/commands/payment.js.map +1 -0
- package/dist/commands/register.d.ts +20 -0
- package/dist/commands/register.d.ts.map +1 -0
- package/dist/commands/register.js +134 -0
- package/dist/commands/register.js.map +1 -0
- package/dist/commands/status.d.ts +8 -0
- package/dist/commands/status.d.ts.map +1 -0
- package/dist/commands/status.js +134 -0
- package/dist/commands/status.js.map +1 -0
- package/dist/commands/whoami.d.ts +21 -0
- package/dist/commands/whoami.d.ts.map +1 -0
- package/dist/commands/whoami.js +133 -0
- package/dist/commands/whoami.js.map +1 -0
- package/dist/company.d.ts +16 -0
- package/dist/company.d.ts.map +1 -0
- package/dist/company.js +26 -0
- package/dist/company.js.map +1 -0
- package/dist/config.d.ts +24 -0
- package/dist/config.d.ts.map +1 -0
- package/dist/config.js +50 -0
- package/dist/config.js.map +1 -0
- package/dist/connection.d.ts +79 -0
- package/dist/connection.d.ts.map +1 -0
- package/dist/connection.js +116 -0
- package/dist/connection.js.map +1 -0
- package/dist/context.d.ts +47 -0
- package/dist/context.d.ts.map +1 -0
- package/dist/context.js +93 -0
- package/dist/context.js.map +1 -0
- package/dist/doctor.d.ts +45 -0
- package/dist/doctor.d.ts.map +1 -0
- package/dist/doctor.js +448 -0
- package/dist/doctor.js.map +1 -0
- package/dist/grants.d.ts +88 -0
- package/dist/grants.d.ts.map +1 -0
- package/dist/grants.js +174 -0
- package/dist/grants.js.map +1 -0
- package/dist/identity.d.ts +54 -0
- package/dist/identity.d.ts.map +1 -0
- package/dist/identity.js +132 -0
- package/dist/identity.js.map +1 -0
- package/dist/index.d.ts +44 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +43 -0
- package/dist/index.js.map +1 -0
- package/dist/inventory.d.ts +155 -0
- package/dist/inventory.d.ts.map +1 -0
- package/dist/inventory.js +303 -0
- package/dist/inventory.js.map +1 -0
- package/dist/migrations.d.ts +76 -0
- package/dist/migrations.d.ts.map +1 -0
- package/dist/migrations.js +226 -0
- package/dist/migrations.js.map +1 -0
- package/dist/module/read.d.ts +91 -0
- package/dist/module/read.d.ts.map +1 -0
- package/dist/module/read.js +172 -0
- package/dist/module/read.js.map +1 -0
- package/dist/output.d.ts +110 -0
- package/dist/output.d.ts.map +1 -0
- package/dist/output.js +173 -0
- package/dist/output.js.map +1 -0
- package/dist/pack/certification.d.ts +27 -0
- package/dist/pack/certification.d.ts.map +1 -0
- package/dist/pack/certification.js +38 -0
- package/dist/pack/certification.js.map +1 -0
- package/dist/pack/compile.d.ts +75 -0
- package/dist/pack/compile.d.ts.map +1 -0
- package/dist/pack/compile.js +801 -0
- package/dist/pack/compile.js.map +1 -0
- package/dist/pack/filing.d.ts +48 -0
- package/dist/pack/filing.d.ts.map +1 -0
- package/dist/pack/filing.js +56 -0
- package/dist/pack/filing.js.map +1 -0
- package/dist/pack/read.d.ts +766 -0
- package/dist/pack/read.d.ts.map +1 -0
- package/dist/pack/read.js +2336 -0
- package/dist/pack/read.js.map +1 -0
- package/dist/pack/schema.d.ts +26 -0
- package/dist/pack/schema.d.ts.map +1 -0
- package/dist/pack/schema.js +181 -0
- package/dist/pack/schema.js.map +1 -0
- package/dist/pack/territories.d.ts +98 -0
- package/dist/pack/territories.d.ts.map +1 -0
- package/dist/pack/territories.js +0 -0
- package/dist/pack/territories.js.map +1 -0
- package/dist/pack/upgrade.d.ts +86 -0
- package/dist/pack/upgrade.d.ts.map +1 -0
- package/dist/pack/upgrade.js +76 -0
- package/dist/pack/upgrade.js.map +1 -0
- package/dist/pack/vat-codes.d.ts +273 -0
- package/dist/pack/vat-codes.d.ts.map +1 -0
- package/dist/pack/vat-codes.js +513 -0
- package/dist/pack/vat-codes.js.map +1 -0
- package/dist/profiles.d.ts +67 -0
- package/dist/profiles.d.ts.map +1 -0
- package/dist/profiles.js +187 -0
- package/dist/profiles.js.map +1 -0
- package/dist/prompt.d.ts +40 -0
- package/dist/prompt.d.ts.map +1 -0
- package/dist/prompt.js +120 -0
- package/dist/prompt.js.map +1 -0
- package/dist/registry.d.ts +84 -0
- package/dist/registry.d.ts.map +1 -0
- package/dist/registry.js +104 -0
- package/dist/registry.js.map +1 -0
- package/dist/rest.d.ts +81 -0
- package/dist/rest.d.ts.map +1 -0
- package/dist/rest.js +245 -0
- package/dist/rest.js.map +1 -0
- package/dist/schema.d.ts +15 -0
- package/dist/schema.d.ts.map +1 -0
- package/dist/schema.js +15 -0
- package/dist/schema.js.map +1 -0
- package/dist/seeds.d.ts +27 -0
- package/dist/seeds.d.ts.map +1 -0
- package/dist/seeds.js +47 -0
- package/dist/seeds.js.map +1 -0
- package/dist/session.d.ts +39 -0
- package/dist/session.d.ts.map +1 -0
- package/dist/session.js +92 -0
- package/dist/session.js.map +1 -0
- package/dist/sql.d.ts +48 -0
- package/dist/sql.d.ts.map +1 -0
- package/dist/sql.js +112 -0
- package/dist/sql.js.map +1 -0
- package/dist/status.d.ts +94 -0
- package/dist/status.d.ts.map +1 -0
- package/dist/status.js +120 -0
- package/dist/status.js.map +1 -0
- package/dist/ui.d.ts +55 -0
- package/dist/ui.d.ts.map +1 -0
- package/dist/ui.js +114 -0
- package/dist/ui.js.map +1 -0
- package/package.json +29 -0
- package/schema/output.1.json +613 -0
|
@@ -0,0 +1,535 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* `ekwo init` — a Supabase project you own, turned into a set of books.
|
|
3
|
+
*
|
|
4
|
+
* Six things happen, in this order:
|
|
5
|
+
*
|
|
6
|
+
* 1. the migrations are applied, and recorded the way `supabase db push`
|
|
7
|
+
* records them;
|
|
8
|
+
* 2. the reference seeds are applied — currencies, the charts of accounts,
|
|
9
|
+
* the VAT codes;
|
|
10
|
+
* 3. the first administrator is created in *your* Supabase Auth, because a
|
|
11
|
+
* superuser connection cannot be a signed-in user (see `../auth.ts`);
|
|
12
|
+
* 4. the installation sequence runs: instance, administrator, company,
|
|
13
|
+
* ownership, country template, first financial year;
|
|
14
|
+
* 5. `ekwo.json` is written, with nothing secret in it;
|
|
15
|
+
* 6. registering with Ekwo is offered, and the default answer is no.
|
|
16
|
+
*
|
|
17
|
+
* Every step is safe to run twice. Running `ekwo init` again on a set-up
|
|
18
|
+
* project reports what was already there and creates nothing a second time.
|
|
19
|
+
*/
|
|
20
|
+
import { boolFlag, numberFlag, rejectUnknownFlags, stringFlag, stringFlags, UsageError, } from '../args.js';
|
|
21
|
+
import { createAuthUser } from '../auth.js';
|
|
22
|
+
import { bootstrap, countryCharts, countryCurrency, countryFiscalYearOpening, countryLanguage, countryLanguages, countryFilingForms, countryPack, installedPacks, } from '../bootstrap.js';
|
|
23
|
+
import { printOperatorChecklist } from '../checklist.js';
|
|
24
|
+
import { describeCertification, needsWarning } from '../pack/certification.js';
|
|
25
|
+
import { DEMO_SEED, migrationsDir, seedDir } from '../bundle.js';
|
|
26
|
+
import { writeConfig } from '../config.js';
|
|
27
|
+
import { CONNECTION_FLAGS, openDatabase } from '../context.js';
|
|
28
|
+
import { setResult } from '../output.js';
|
|
29
|
+
import { listMigrations } from '../migrations.js';
|
|
30
|
+
import { applyMigrations } from '../migrations.js';
|
|
31
|
+
import { ask as askText, askRequired, askSecret, choose, confirm, isInteractive, NotInteractiveError } from '../prompt.js';
|
|
32
|
+
import { register, registryUrl } from '../registry.js';
|
|
33
|
+
import { applyDemoSeed, applySeeds } from '../seeds.js';
|
|
34
|
+
import { asUser, scalar } from '../sql.js';
|
|
35
|
+
import { syncSchemaVersion } from '../status.js';
|
|
36
|
+
import { bold, cyan, dim, heading, line, note, pairs, skipped, step, warn } from '../ui.js';
|
|
37
|
+
export const INIT_FLAGS = [
|
|
38
|
+
...CONNECTION_FLAGS,
|
|
39
|
+
'country',
|
|
40
|
+
'chart',
|
|
41
|
+
'org',
|
|
42
|
+
'company',
|
|
43
|
+
'admin-email',
|
|
44
|
+
'admin-password',
|
|
45
|
+
'admin-user-id',
|
|
46
|
+
'fiscal-year',
|
|
47
|
+
'fiscal-year-start',
|
|
48
|
+
'currency',
|
|
49
|
+
'language',
|
|
50
|
+
'vat-period',
|
|
51
|
+
'filing-period',
|
|
52
|
+
'iban',
|
|
53
|
+
'bic',
|
|
54
|
+
'bank-name',
|
|
55
|
+
'demo',
|
|
56
|
+
'register',
|
|
57
|
+
'register-email',
|
|
58
|
+
'registry-url',
|
|
59
|
+
'yes',
|
|
60
|
+
];
|
|
61
|
+
export async function initCommand(args, deps = {}) {
|
|
62
|
+
rejectUnknownFlags(args, INIT_FLAGS);
|
|
63
|
+
const yes = boolFlag(args, 'yes');
|
|
64
|
+
const interactive = !yes && isInteractive();
|
|
65
|
+
const makeUser = deps.createAuthUser ?? createAuthUser;
|
|
66
|
+
const { db, connection } = await openDatabase(args, { interactive, connect: deps.connect });
|
|
67
|
+
try {
|
|
68
|
+
heading('Schema');
|
|
69
|
+
const migrations = await listMigrations(migrationsDir());
|
|
70
|
+
const result = await applyMigrations(db, migrations, (migration) => {
|
|
71
|
+
step(migration.file);
|
|
72
|
+
});
|
|
73
|
+
if (result.applied.length === 0) {
|
|
74
|
+
skipped(`${result.alreadyApplied} migration(s) already applied, nothing to do`);
|
|
75
|
+
}
|
|
76
|
+
else {
|
|
77
|
+
note(dim(`${result.applied.length} applied, ${result.alreadyApplied} were already there`));
|
|
78
|
+
}
|
|
79
|
+
heading('Reference data');
|
|
80
|
+
await applySeeds(db, seedDir(), (seed) => {
|
|
81
|
+
step(seed.file);
|
|
82
|
+
});
|
|
83
|
+
skipped(`${DEMO_SEED} is sample data and is not applied here`);
|
|
84
|
+
// ---- What this installation is -----------------------------------------
|
|
85
|
+
//
|
|
86
|
+
// There is no default country, and there is no list of countries in this
|
|
87
|
+
// file: both come from the packs this installation holds, named as the
|
|
88
|
+
// pack names itself. A preselected country would be a choice nobody made,
|
|
89
|
+
// and the one question whose wrong answer is a chart of accounts.
|
|
90
|
+
const packs = await installedPacks(db);
|
|
91
|
+
if (packs.length === 0) {
|
|
92
|
+
throw new Error('no_country_pack: this database holds no country pack, so there is no chart of ' +
|
|
93
|
+
'accounts to install. Apply the reference seeds first.');
|
|
94
|
+
}
|
|
95
|
+
const country = (stringFlag(args, 'country') ??
|
|
96
|
+
(interactive
|
|
97
|
+
? await choose('Country whose accounting rules apply?', packs.map((p) => ({ value: p.country, label: p.name })))
|
|
98
|
+
: requiredCountry(packs))).toUpperCase();
|
|
99
|
+
const organization = stringFlag(args, 'org') ??
|
|
100
|
+
(interactive
|
|
101
|
+
? await askRequired('Name of your organisation?')
|
|
102
|
+
: required('--org', 'the organisation name'));
|
|
103
|
+
const company = stringFlag(args, 'company') ??
|
|
104
|
+
(interactive ? await askRequired('Name of the first company?', organization) : organization);
|
|
105
|
+
const fiscalYear = numberFlag(args, 'fiscal-year') ?? new Date().getUTCFullYear();
|
|
106
|
+
// When the first financial year opens. The country model names a month —
|
|
107
|
+
// `calendar`, `april`, `july`, `october` — and the flag names a day. A
|
|
108
|
+
// pack that declares neither is asked about when there is a terminal, and
|
|
109
|
+
// refused when there is not: opening somebody's books on a date nobody
|
|
110
|
+
// chose is found out a year later, in a closing.
|
|
111
|
+
const packOpening = await countryFiscalYearOpening(db, country);
|
|
112
|
+
const askedStart = stringFlag(args, 'fiscal-year-start');
|
|
113
|
+
if (askedStart !== undefined && !/^\d{4}-\d{2}-\d{2}$/.test(askedStart)) {
|
|
114
|
+
throw new UsageError(`bad_date: --fiscal-year-start takes a day as YYYY-MM-DD, not "${askedStart}".`);
|
|
115
|
+
}
|
|
116
|
+
const fiscalYearStart = askedStart ??
|
|
117
|
+
(packOpening !== undefined
|
|
118
|
+
? undefined
|
|
119
|
+
: interactive
|
|
120
|
+
? await askRequired(`First day of the financial year ${fiscalYear}? (YYYY-MM-DD)`)
|
|
121
|
+
: requiredFiscalYearStart(country));
|
|
122
|
+
// The currency has to be settled before the company row exists:
|
|
123
|
+
// `companies.currency_code` is `not null`, so there is no later moment at
|
|
124
|
+
// which it is empty and the country model could fill it. The pack answers
|
|
125
|
+
// it; a pack that does not is asked about, never guessed at.
|
|
126
|
+
const packCurrency = await countryCurrency(db, country);
|
|
127
|
+
const currencyCode = (stringFlag(args, 'currency') ??
|
|
128
|
+
(interactive
|
|
129
|
+
? await askRequired('Currency of the company?', packCurrency)
|
|
130
|
+
: (packCurrency ?? required('--currency', 'the currency')))).toUpperCase();
|
|
131
|
+
// Which chart of accounts. A country with one chart is not a question:
|
|
132
|
+
// there is nothing to choose. A country with two is asked about, with
|
|
133
|
+
// nothing preselected beyond the default the pack itself declares — the
|
|
134
|
+
// wrong answer here is a whole plan of accounts.
|
|
135
|
+
const charts = await countryCharts(db, country);
|
|
136
|
+
const askedChart = stringFlag(args, 'chart');
|
|
137
|
+
if (askedChart !== undefined && !charts.some((c) => c.code === askedChart)) {
|
|
138
|
+
throw new UsageError(`unknown_chart: ${country} has no chart ${askedChart}. ` +
|
|
139
|
+
`It has: ${charts.map((c) => c.code).join(', ') || 'none'}.`);
|
|
140
|
+
}
|
|
141
|
+
const chartCode = askedChart ??
|
|
142
|
+
(charts.length > 1 && interactive
|
|
143
|
+
? await choose('Which chart of accounts?', charts.map((c) => ({
|
|
144
|
+
value: c.code,
|
|
145
|
+
label: `${c.name}${c.audience === null ? '' : ` — ${c.audience}`}` +
|
|
146
|
+
` (${c.accounts} accounts${c.certificationStatus === null ? '' : `, ${c.certificationStatus}`})`,
|
|
147
|
+
})))
|
|
148
|
+
: charts.length > 1
|
|
149
|
+
? requiredChart(country, charts)
|
|
150
|
+
: undefined);
|
|
151
|
+
// The language of the books, for the same reason as the currency: it is
|
|
152
|
+
// written on the company row, which does not exist yet, and it decides
|
|
153
|
+
// which label of the pack lands in `accounts.name`.
|
|
154
|
+
//
|
|
155
|
+
// The pack says which languages it publishes, and the question lists them
|
|
156
|
+
// with nothing pre-selected. A Belgian company keeps its books in French,
|
|
157
|
+
// Dutch or German, and offering the first of the three as the answer to
|
|
158
|
+
// press Enter on is how two of the three end up installed in the wrong
|
|
159
|
+
// one. Outside an interactive session `--language` is required whenever
|
|
160
|
+
// there is a choice to make.
|
|
161
|
+
const packLanguage = await countryLanguage(db, country);
|
|
162
|
+
const languages = await countryLanguages(db, country);
|
|
163
|
+
const askedLanguage = stringFlag(args, 'language');
|
|
164
|
+
if (askedLanguage !== undefined &&
|
|
165
|
+
languages.length > 0 &&
|
|
166
|
+
!languages.some((l) => l.code === askedLanguage.toLowerCase())) {
|
|
167
|
+
warn(`${country} publishes its labels in ${languages.map((l) => l.code).join(', ')}; ` +
|
|
168
|
+
`the books will be kept in ${askedLanguage.toLowerCase()} and the chart of accounts ` +
|
|
169
|
+
`will carry the pack's own wording.`);
|
|
170
|
+
}
|
|
171
|
+
const language = (askedLanguage ??
|
|
172
|
+
(interactive && languages.length > 1
|
|
173
|
+
? await choose('Language of the books?', languages.map((l) => ({
|
|
174
|
+
value: l.code,
|
|
175
|
+
label: l.isPackLanguage ? `${l.label}, the language the pack is written in` : l.label,
|
|
176
|
+
})))
|
|
177
|
+
: interactive
|
|
178
|
+
? await askRequired('Language of the books?', packLanguage)
|
|
179
|
+
: languages.length > 1
|
|
180
|
+
? required('--language', `the language of the books (${languages.map((l) => l.code).join(', ')})`)
|
|
181
|
+
: (packLanguage ?? required('--language', 'the language of the books')))).toLowerCase();
|
|
182
|
+
// How often the company files each declaration it is subject to. The third
|
|
183
|
+
// question of the same family as the currency and the language, and the one
|
|
184
|
+
// with the sharpest consequence when it is wrong: a quarterly filer handed
|
|
185
|
+
// a monthly return misses a deadline.
|
|
186
|
+
//
|
|
187
|
+
// It is asked **once per form**, because a company is subject to several
|
|
188
|
+
// declarations and the cadence of one says nothing about the cadence of
|
|
189
|
+
// another. Where a form offers one cadence there is nothing to ask. Where
|
|
190
|
+
// it offers several, the pack proposes one only if the law of that country
|
|
191
|
+
// gives one answer to everybody — `period_default` on the form — and where
|
|
192
|
+
// it does not, the question is asked with nothing preselected and "later"
|
|
193
|
+
// among the answers: a company that has not decided is recorded as not
|
|
194
|
+
// having decided rather than as filing monthly.
|
|
195
|
+
const forms = await countryFilingForms(db, country);
|
|
196
|
+
const periodicReturn = forms.find((form) => form.isPeriodicReturn);
|
|
197
|
+
const askedPeriods = new Map();
|
|
198
|
+
for (const pair of stringFlags(args, 'filing-period')) {
|
|
199
|
+
const equals = pair.indexOf('=');
|
|
200
|
+
if (equals <= 0 || equals === pair.length - 1) {
|
|
201
|
+
throw new UsageError(`--filing-period takes <report_code>=<cadence>, one per declaration (got "${pair}")`);
|
|
202
|
+
}
|
|
203
|
+
askedPeriods.set(pair.slice(0, equals), pair.slice(equals + 1).toLowerCase());
|
|
204
|
+
}
|
|
205
|
+
const askedVatPeriod = stringFlag(args, 'vat-period')?.toLowerCase();
|
|
206
|
+
if (askedVatPeriod !== undefined) {
|
|
207
|
+
if (periodicReturn === undefined) {
|
|
208
|
+
throw new UsageError(`no_periodic_return: this installation carries no periodic return for ${country}, ` +
|
|
209
|
+
'so there is no declaration --vat-period could be about.');
|
|
210
|
+
}
|
|
211
|
+
askedPeriods.set(periodicReturn.code, askedVatPeriod);
|
|
212
|
+
}
|
|
213
|
+
for (const code of askedPeriods.keys()) {
|
|
214
|
+
if (forms.some((form) => form.code === code))
|
|
215
|
+
continue;
|
|
216
|
+
throw new UsageError(`unknown_tax_report: ${code} is not a declaration form of ${country} in this ` +
|
|
217
|
+
`installation (${forms.map((form) => form.code).join(', ') || 'it carries none'}).`);
|
|
218
|
+
}
|
|
219
|
+
const filingPeriods = {};
|
|
220
|
+
for (const form of forms) {
|
|
221
|
+
const flagged = askedPeriods.get(form.code);
|
|
222
|
+
if (flagged !== undefined && form.periods.length > 0 && !form.periods.includes(flagged)) {
|
|
223
|
+
throw new UsageError(`unknown_vat_period: ${form.code} is filed ${form.periods.join(' or ')}, not ${flagged}.`);
|
|
224
|
+
}
|
|
225
|
+
const chosen = flagged ??
|
|
226
|
+
(form.periods.length === 1
|
|
227
|
+
? form.periods[0]
|
|
228
|
+
: form.periods.length > 1 && interactive
|
|
229
|
+
? await choose(`How often does this company file ${form.name}?`, [
|
|
230
|
+
...form.periods.map((code) => ({
|
|
231
|
+
value: code,
|
|
232
|
+
label: code === form.periodDefault
|
|
233
|
+
? `every ${code} — what the law of this country gives everybody`
|
|
234
|
+
: `every ${code}`,
|
|
235
|
+
})),
|
|
236
|
+
{ value: 'later', label: 'not decided yet; ekwo status will say so' },
|
|
237
|
+
])
|
|
238
|
+
: form.periodDefault);
|
|
239
|
+
if (chosen === undefined && form.periods.length > 1) {
|
|
240
|
+
// Outside an interactive session there is nobody to ask and nothing
|
|
241
|
+
// lawful to assume: the cadence of this form is a fact about the
|
|
242
|
+
// company, and the pack said so by proposing none.
|
|
243
|
+
throw new UsageError(`no_filing_period: ${form.code} is filed ${form.periods.join(' or ')} and the ` +
|
|
244
|
+
`${country} pack proposes none, because the law makes it depend on the company. ` +
|
|
245
|
+
`Pass --filing-period ${form.code}=<cadence>` +
|
|
246
|
+
(form.isPeriodicReturn ? ', or --vat-period <cadence>' : '') +
|
|
247
|
+
'.');
|
|
248
|
+
}
|
|
249
|
+
if (chosen !== undefined && chosen !== 'later')
|
|
250
|
+
filingPeriods[form.code] = chosen;
|
|
251
|
+
}
|
|
252
|
+
// What the operator is about to install, and how much anyone has read it.
|
|
253
|
+
const pack = await countryPack(db, country);
|
|
254
|
+
if (pack === undefined) {
|
|
255
|
+
warn(`no country pack is recorded for ${country}; the seeds of this release declare one.`);
|
|
256
|
+
}
|
|
257
|
+
else {
|
|
258
|
+
const said = `${pack.name} pack ${pack.version}: ${describeCertification({
|
|
259
|
+
status: pack.certificationStatus,
|
|
260
|
+
by: pack.certifiedBy,
|
|
261
|
+
on: pack.certifiedAt,
|
|
262
|
+
})}.`;
|
|
263
|
+
if (needsWarning(pack.certificationStatus)) {
|
|
264
|
+
warn(`${said} Check the boxes against your own situation before you file anything.`);
|
|
265
|
+
}
|
|
266
|
+
else {
|
|
267
|
+
note(dim(said));
|
|
268
|
+
}
|
|
269
|
+
}
|
|
270
|
+
// The main bank account. Optional everywhere: a company can be installed
|
|
271
|
+
// and book sales without one, and `ekwo doctor` is what notices later.
|
|
272
|
+
const iban = stringFlag(args, 'iban') ??
|
|
273
|
+
(interactive
|
|
274
|
+
? emptyToUndefined(await askText('IBAN of the main bank account? (optional, Enter to skip)'))
|
|
275
|
+
: undefined);
|
|
276
|
+
const bankAccount = iban === undefined || iban.length === 0
|
|
277
|
+
? undefined
|
|
278
|
+
: {
|
|
279
|
+
iban,
|
|
280
|
+
bic: stringFlag(args, 'bic') ??
|
|
281
|
+
(interactive ? emptyToUndefined(await askText('BIC? (optional)')) : undefined),
|
|
282
|
+
bankName: stringFlag(args, 'bank-name') ??
|
|
283
|
+
(interactive ? emptyToUndefined(await askText('Name of the bank? (optional)')) : undefined),
|
|
284
|
+
};
|
|
285
|
+
// ---- The first administrator -------------------------------------------
|
|
286
|
+
heading('First administrator');
|
|
287
|
+
const adminUserId = await resolveAdminUser(db, args, {
|
|
288
|
+
interactive,
|
|
289
|
+
connection,
|
|
290
|
+
makeUser,
|
|
291
|
+
});
|
|
292
|
+
// ---- The installation sequence -----------------------------------------
|
|
293
|
+
heading('Installation');
|
|
294
|
+
const outcome = await bootstrap(db, {
|
|
295
|
+
organization,
|
|
296
|
+
country,
|
|
297
|
+
company,
|
|
298
|
+
fiscalYear,
|
|
299
|
+
...(fiscalYearStart === undefined ? {} : { fiscalYearStart }),
|
|
300
|
+
adminUserId,
|
|
301
|
+
currencyCode,
|
|
302
|
+
language,
|
|
303
|
+
...(chartCode === undefined ? {} : { chartCode }),
|
|
304
|
+
filingPeriods,
|
|
305
|
+
bankAccount,
|
|
306
|
+
});
|
|
307
|
+
for (const s of outcome.steps) {
|
|
308
|
+
const text = s.detail === undefined ? s.name : `${s.name} — ${s.detail}`;
|
|
309
|
+
if (s.outcome === 'created')
|
|
310
|
+
step(text);
|
|
311
|
+
else
|
|
312
|
+
skipped(`${text} (already there)`);
|
|
313
|
+
}
|
|
314
|
+
const schemaVersion = await syncSchemaVersion(db);
|
|
315
|
+
// ---- The demo company, only when asked ---------------------------------
|
|
316
|
+
if (boolFlag(args, 'demo')) {
|
|
317
|
+
heading('Demo company');
|
|
318
|
+
await asUser(db, adminUserId, () => applyDemoSeed(db, seedDir()));
|
|
319
|
+
step('Exemple Conseil SRL, its contacts, invoices, a payment and a statement');
|
|
320
|
+
warn('Fictional data, including a fictional administrator. Do not leave it on real books.');
|
|
321
|
+
}
|
|
322
|
+
// ---- ekwo.json ----------------------------------------------------------
|
|
323
|
+
const configFile = await writeConfig({
|
|
324
|
+
...(connection.supabaseUrl !== undefined ? { project_url: connection.supabaseUrl } : {}),
|
|
325
|
+
country,
|
|
326
|
+
...(schemaVersion !== undefined ? { schema_version: schemaVersion } : {}),
|
|
327
|
+
}, deps.cwd);
|
|
328
|
+
setResult({
|
|
329
|
+
organization,
|
|
330
|
+
instanceId: outcome.instanceId,
|
|
331
|
+
adminUserId,
|
|
332
|
+
company: {
|
|
333
|
+
id: outcome.companyId,
|
|
334
|
+
name: company,
|
|
335
|
+
country,
|
|
336
|
+
currency: outcome.currencyCode,
|
|
337
|
+
language: outcome.language,
|
|
338
|
+
chart: outcome.chartCode ?? null,
|
|
339
|
+
packVersion: outcome.packVersion ?? null,
|
|
340
|
+
},
|
|
341
|
+
fiscalYear: {
|
|
342
|
+
name: outcome.fiscalYearName,
|
|
343
|
+
start: outcome.fiscalYearStart,
|
|
344
|
+
end: outcome.fiscalYearEnd,
|
|
345
|
+
},
|
|
346
|
+
filingPeriods: outcome.filingPeriods,
|
|
347
|
+
bankAccountId: outcome.bankAccountId ?? null,
|
|
348
|
+
migrations: { applied: result.applied.map((m) => m.file), alreadyApplied: result.alreadyApplied },
|
|
349
|
+
steps: outcome.steps,
|
|
350
|
+
schemaVersion: schemaVersion ?? null,
|
|
351
|
+
demo: boolFlag(args, 'demo'),
|
|
352
|
+
configFile,
|
|
353
|
+
});
|
|
354
|
+
// ---- Registration, offered, never required ------------------------------
|
|
355
|
+
await offerRegistration(db, args, { interactive, adminUserId, deps });
|
|
356
|
+
heading('Done');
|
|
357
|
+
pairs([
|
|
358
|
+
['organisation', organization],
|
|
359
|
+
['company', `${company} (${country}, ${outcome.currencyCode}, ${outcome.language})`],
|
|
360
|
+
[
|
|
361
|
+
'chart of accounts',
|
|
362
|
+
`${outcome.chartCode ?? 'unknown'}${charts.find((c) => c.code === outcome.chartCode)?.name === undefined
|
|
363
|
+
? ''
|
|
364
|
+
: ` — ${charts.find((c) => c.code === outcome.chartCode)?.name}`}`,
|
|
365
|
+
],
|
|
366
|
+
...forms.map((form) => [
|
|
367
|
+
`files ${form.name}`,
|
|
368
|
+
outcome.filingPeriods[form.code] === undefined
|
|
369
|
+
? 'not recorded'
|
|
370
|
+
: `every ${outcome.filingPeriods[form.code]}`,
|
|
371
|
+
]),
|
|
372
|
+
[
|
|
373
|
+
'country pack',
|
|
374
|
+
pack === undefined
|
|
375
|
+
? 'none recorded'
|
|
376
|
+
: `${pack.version} — ${describeCertification({ status: pack.certificationStatus, by: pack.certifiedBy, on: pack.certifiedAt })}`,
|
|
377
|
+
],
|
|
378
|
+
['financial year', `${outcome.fiscalYearName} — ${outcome.fiscalYearStart} to ${outcome.fiscalYearEnd}`],
|
|
379
|
+
['bank account', bankAccount === undefined ? 'none — ekwo doctor will say so' : bankAccount.iban],
|
|
380
|
+
['schema version', schemaVersion ?? 'unknown'],
|
|
381
|
+
['config', configFile],
|
|
382
|
+
]);
|
|
383
|
+
line();
|
|
384
|
+
line(` ${bold('Next:')} sign in to your Supabase project as the administrator you just created,`);
|
|
385
|
+
line(` then ${cyan('ekwo status')} to see what is there and ${cyan('ekwo doctor')} to check it.`);
|
|
386
|
+
// The last thing on the screen, because it is the part nobody can do for
|
|
387
|
+
// the operator: three settings of their own project and one piece of
|
|
388
|
+
// reading. `packages/cli/README.md` carries the same four, and a test
|
|
389
|
+
// reads both so the two cannot drift.
|
|
390
|
+
printOperatorChecklist();
|
|
391
|
+
line();
|
|
392
|
+
return 0;
|
|
393
|
+
}
|
|
394
|
+
finally {
|
|
395
|
+
await db.close();
|
|
396
|
+
}
|
|
397
|
+
}
|
|
398
|
+
function required(flag, what) {
|
|
399
|
+
throw new NotInteractiveError(what, flag);
|
|
400
|
+
}
|
|
401
|
+
/**
|
|
402
|
+
* The refusal when `--country` is missing and nobody can be asked. It names
|
|
403
|
+
* the packs this installation holds rather than a country it prefers, because
|
|
404
|
+
* it has no reason to prefer one.
|
|
405
|
+
*/
|
|
406
|
+
function requiredCountry(packs) {
|
|
407
|
+
throw new UsageError('missing_input: the country was not given and this is not a terminal. Pass --country, ' +
|
|
408
|
+
`one of: ${packs.map((p) => `${p.country} (${p.name})`).join(', ')}.`);
|
|
409
|
+
}
|
|
410
|
+
/**
|
|
411
|
+
* The refusal when the pack names no opening month, `--fiscal-year-start` is
|
|
412
|
+
* missing and nobody can be asked. It names the field the pack should carry
|
|
413
|
+
* as well as the flag, because one of the two is the real fix.
|
|
414
|
+
*/
|
|
415
|
+
function requiredFiscalYearStart(country) {
|
|
416
|
+
throw new UsageError(`missing_input: the ${country} pack declares no defaults.fiscal_year_default and this is not a ` +
|
|
417
|
+
'terminal. Pass --fiscal-year-start YYYY-MM-DD, or add the field to the pack.');
|
|
418
|
+
}
|
|
419
|
+
/**
|
|
420
|
+
* The refusal when a country offers several charts, `--chart` is missing and
|
|
421
|
+
* nobody can be asked. It lists them rather than picking the default: a
|
|
422
|
+
* non-interactive install that meant the other one would find out a year later.
|
|
423
|
+
*/
|
|
424
|
+
function requiredChart(country, charts) {
|
|
425
|
+
throw new UsageError(`missing_input: ${country} offers several charts of accounts and this is not a terminal. ` +
|
|
426
|
+
`Pass --chart, one of: ${charts
|
|
427
|
+
.map((c) => `${c.code} (${c.name}${c.isDefault ? ', the default' : ''})`)
|
|
428
|
+
.join(', ')}.`);
|
|
429
|
+
}
|
|
430
|
+
/** An unanswered optional question is not an empty string. */
|
|
431
|
+
function emptyToUndefined(value) {
|
|
432
|
+
return value.length === 0 ? undefined : value;
|
|
433
|
+
}
|
|
434
|
+
/**
|
|
435
|
+
* The id that will be written into `instance_admins` and `company_members`.
|
|
436
|
+
*
|
|
437
|
+
* Either an account already exists and its id was given, or one is created
|
|
438
|
+
* through the Supabase Auth admin API. There is no third way: the id has to
|
|
439
|
+
* be one that `auth.uid()` will return for a real signed-in user, and only
|
|
440
|
+
* GoTrue can mint that.
|
|
441
|
+
*/
|
|
442
|
+
async function resolveAdminUser(db, args, options) {
|
|
443
|
+
const given = stringFlag(args, 'admin-user-id');
|
|
444
|
+
if (given !== undefined) {
|
|
445
|
+
const exists = await scalar(db, 'select exists (select 1 from auth.users where id = $1)', [given]);
|
|
446
|
+
if (exists !== true) {
|
|
447
|
+
throw new UsageError(`unknown_user: ${given} is not a user of this Supabase project. ` +
|
|
448
|
+
'Create the account first, or drop --admin-user-id and let the CLI create one.');
|
|
449
|
+
}
|
|
450
|
+
skipped(`using the existing account ${given}`);
|
|
451
|
+
return given;
|
|
452
|
+
}
|
|
453
|
+
const email = stringFlag(args, 'admin-email') ??
|
|
454
|
+
(options.interactive
|
|
455
|
+
? await askRequired('E-mail address of the first administrator?')
|
|
456
|
+
: required('--admin-email', "the administrator's address"));
|
|
457
|
+
const { supabaseUrl, serviceRoleKey } = options.connection;
|
|
458
|
+
if (supabaseUrl === undefined) {
|
|
459
|
+
throw new UsageError('missing_supabase_url: creating the first user needs the project URL. ' +
|
|
460
|
+
'Pass --supabase-url, or set SUPABASE_URL.');
|
|
461
|
+
}
|
|
462
|
+
const key = serviceRoleKey ??
|
|
463
|
+
(options.interactive
|
|
464
|
+
? await askSecret('service_role key (Project Settings → API). It is never written to disk:')
|
|
465
|
+
: required('--service-role-key', 'the service_role key'));
|
|
466
|
+
const password = stringFlag(args, 'admin-password') ??
|
|
467
|
+
(options.interactive
|
|
468
|
+
? await askSecret('Password for that administrator (blank to send an invite link instead):')
|
|
469
|
+
: undefined);
|
|
470
|
+
const user = await options.makeUser({
|
|
471
|
+
supabaseUrl,
|
|
472
|
+
serviceRoleKey: key,
|
|
473
|
+
email,
|
|
474
|
+
password: password !== undefined && password.length > 0 ? password : undefined,
|
|
475
|
+
});
|
|
476
|
+
if (user.created)
|
|
477
|
+
step(`created ${email} in your Supabase Auth`);
|
|
478
|
+
else
|
|
479
|
+
skipped(`${email} already had an account here`);
|
|
480
|
+
if (user.actionLink !== undefined) {
|
|
481
|
+
note(dim('No password was set. Send them this link to choose one:'));
|
|
482
|
+
note(user.actionLink);
|
|
483
|
+
}
|
|
484
|
+
// The foreign key on instance_admins will refuse an id GoTrue has not
|
|
485
|
+
// written yet; say so here rather than three steps later.
|
|
486
|
+
const visible = await scalar(db, 'select exists (select 1 from auth.users where id = $1)', [user.id]);
|
|
487
|
+
if (visible !== true) {
|
|
488
|
+
throw new Error(`auth_user_not_visible: Supabase Auth reported user ${user.id}, but the database does not ` +
|
|
489
|
+
'see it. Check that --db-url and --supabase-url point at the same project.');
|
|
490
|
+
}
|
|
491
|
+
return user.id;
|
|
492
|
+
}
|
|
493
|
+
async function offerRegistration(db, args, options) {
|
|
494
|
+
const asked = boolFlag(args, 'register');
|
|
495
|
+
const wanted = asked
|
|
496
|
+
? true
|
|
497
|
+
: options.interactive
|
|
498
|
+
? await ask('Register this installation with Ekwo to receive security advisories and release notes?')
|
|
499
|
+
: false;
|
|
500
|
+
if (!wanted) {
|
|
501
|
+
heading('Registration');
|
|
502
|
+
skipped('not registered — Community works unregistered, forever');
|
|
503
|
+
note(dim('Change your mind later with `ekwo register --email you@example.com`.'));
|
|
504
|
+
return;
|
|
505
|
+
}
|
|
506
|
+
const email = stringFlag(args, 'register-email') ??
|
|
507
|
+
stringFlag(args, 'admin-email') ??
|
|
508
|
+
(options.interactive ? await askRequired('Contact address?') : undefined);
|
|
509
|
+
if (email === undefined) {
|
|
510
|
+
warn('--register needs an address: pass --register-email or --admin-email. Skipped.');
|
|
511
|
+
return;
|
|
512
|
+
}
|
|
513
|
+
heading('Registration');
|
|
514
|
+
const url = stringFlag(args, 'registry-url') ?? registryUrl();
|
|
515
|
+
const result = await register(db, {
|
|
516
|
+
adminUserId: options.adminUserId,
|
|
517
|
+
email,
|
|
518
|
+
url,
|
|
519
|
+
...(options.deps.fetchImpl !== undefined ? { fetchImpl: options.deps.fetchImpl } : {}),
|
|
520
|
+
});
|
|
521
|
+
step(`recorded on the instance row: ${email}`);
|
|
522
|
+
if (result.announced) {
|
|
523
|
+
step(`announced to ${url}`);
|
|
524
|
+
}
|
|
525
|
+
else {
|
|
526
|
+
warn(`could not reach ${url} (${result.reason ?? 'unknown'}).`);
|
|
527
|
+
note(dim('The local registration stands. `ekwo register` will try again.'));
|
|
528
|
+
}
|
|
529
|
+
note(dim(`Sent: ${JSON.stringify(result.payload)}`));
|
|
530
|
+
}
|
|
531
|
+
/** Yes/no with no as the default, kept separate so the wording stays fixed. */
|
|
532
|
+
async function ask(question) {
|
|
533
|
+
return confirm(question, false);
|
|
534
|
+
}
|
|
535
|
+
//# sourceMappingURL=init.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"init.js","sourceRoot":"","sources":["../../src/commands/init.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;GAkBG;AAEH,OAAO,EACL,QAAQ,EACR,UAAU,EACV,kBAAkB,EAClB,UAAU,EACV,WAAW,EACX,UAAU,GAEX,MAAM,YAAY,CAAC;AACpB,OAAO,EAAE,cAAc,EAAuB,MAAM,YAAY,CAAC;AACjE,OAAO,EACL,SAAS,EACT,aAAa,EACb,eAAe,EACf,wBAAwB,EACxB,eAAe,EACf,gBAAgB,EAChB,kBAAkB,EAClB,WAAW,EACX,cAAc,GACf,MAAM,iBAAiB,CAAC;AACzB,OAAO,EAAE,sBAAsB,EAAE,MAAM,iBAAiB,CAAC;AACzD,OAAO,EAAE,qBAAqB,EAAE,YAAY,EAAE,MAAM,0BAA0B,CAAC;AAC/E,OAAO,EAAE,SAAS,EAAE,aAAa,EAAE,OAAO,EAAE,MAAM,cAAc,CAAC;AACjE,OAAO,EAAE,WAAW,EAAE,MAAM,cAAc,CAAC;AAC3C,OAAO,EAAE,gBAAgB,EAAE,YAAY,EAAoB,MAAM,eAAe,CAAC;AACjF,OAAO,EAAE,SAAS,EAAE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AK,SAAS,CAAC,CAAC,CAAC,EAAE,SAAS,EAAE,OAAO,CAAC,IAAI,CAAC,SAAS,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC;KACvF,CAAC,CAAC;IACH,IAAI,CAAC,iCAAiC,KAAK,EAAE,CAAC,CAAC;IAC/C,IAAI,MAAM,CAAC,SAAS,EAAE,CAAC;QACrB,IAAI,CAAC,gBAAgB,GAAG,EAAE,CAAC,CAAC;IAC9B,CAAC;SAAM,CAAC;QACN,IAAI,CAAC,mBAAmB,GAAG,KAAK,MAAM,CAAC,MAAM,IAAI,SAAS,IAAI,CAAC,CAAC;QAChE,IAAI,CAAC,GAAG,CAAC,gEAAgE,CAAC,CAAC,CAAC;IAC9E,CAAC;IACD,IAAI,CAAC,GAAG,CAAC,SAAS,IAAI,CAAC,SAAS,CAAC,MAAM,CAAC,OAAO,CAAC,EAAE,CAAC,CAAC,CAAC;AACvD,CAAC;AAED,+EAA+E;AAC/E,KAAK,UAAU,GAAG,CAAC,QAAgB;IACjC,OAAO,OAAO,CAAC,QAAQ,EAAE,KAAK,CAAC,CAAC;AAClC,CAAC"}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* `ekwo login` and `ekwo logout`.
|
|
3
|
+
*
|
|
4
|
+
* Signing in is what turns "every command takes a connection string" into
|
|
5
|
+
* something a person can use twenty times a day. It asks the instance for a
|
|
6
|
+
* session with an address and a password, keeps the session in the person's
|
|
7
|
+
* own configuration directory, and keeps the password nowhere.
|
|
8
|
+
*
|
|
9
|
+
* What it needs comes from a flag, then the environment, then a profile that
|
|
10
|
+
* already exists — so signing in again after a session ended is `ekwo login`
|
|
11
|
+
* and a password — then `ekwo.json` for the instance URL, and a question last,
|
|
12
|
+
* when there is somebody to ask.
|
|
13
|
+
*/
|
|
14
|
+
import { type ParsedArgs } from '../args.js';
|
|
15
|
+
import { type UserDeps } from '../identity.js';
|
|
16
|
+
export declare const LOGIN_FLAGS: readonly ["profile", "supabase-url", "anon-key", "email", "password", "yes"];
|
|
17
|
+
export declare const LOGOUT_FLAGS: readonly ["profile"];
|
|
18
|
+
export interface LoginDeps extends UserDeps {
|
|
19
|
+
/** Where `ekwo.json` is looked for. The working directory, unless a test says otherwise. */
|
|
20
|
+
cwd?: string | undefined;
|
|
21
|
+
}
|
|
22
|
+
export declare function loginCommand(args: ParsedArgs, deps?: LoginDeps): Promise<number>;
|
|
23
|
+
export declare function logoutCommand(args: ParsedArgs, deps?: UserDeps): Promise<number>;
|
|
24
|
+
//# sourceMappingURL=login.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"login.d.ts","sourceRoot":"","sources":["../../src/commands/login.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;GAYG;AAGH,OAAO,EAA4C,KAAK,UAAU,EAAE,MAAM,YAAY,CAAC;AAEvF,OAAO,EAA+D,KAAK,QAAQ,EAAE,MAAM,gBAAgB,CAAC;AAgB5G,eAAO,MAAM,WAAW,8EAA+E,CAAC;AACxG,eAAO,MAAM,YAAY,sBAAuB,CAAC;AAEjD,MAAM,WAAW,SAAU,SAAQ,QAAQ;IACzC,4FAA4F;IAC5F,GAAG,CAAC,EAAE,MAAM,GAAG,SAAS,CAAC;CAC1B;AAED,wBAAsB,YAAY,CAAC,IAAI,EAAE,UAAU,EAAE,IAAI,GAAE,SAAc,GAAG,OAAO,CAAC,MAAM,CAAC,CAoF1F;AAED,wBAAsB,aAAa,CAAC,IAAI,EAAE,UAAU,EAAE,IAAI,GAAE,QAAa,GAAG,OAAO,CAAC,MAAM,CAAC,CA6B1F"}
|