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,236 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The six steps of the installation sequence, in SQL.
|
|
3
|
+
*
|
|
4
|
+
* They are the same six the README spells out, in the same order, and they
|
|
5
|
+
* run over the Postgres connection as the database owner. Row level security
|
|
6
|
+
* is bypassed rather than satisfied there, which is exactly why the first
|
|
7
|
+
* administrator has to be created through Supabase Auth first (see `auth.ts`)
|
|
8
|
+
* — the id written into `instance_admins` and `company_members` must be one a
|
|
9
|
+
* signed-in user will later present as `auth.uid()`.
|
|
10
|
+
*
|
|
11
|
+
* Every step is check-then-act, so `ekwo init` can be run twice on the same
|
|
12
|
+
* project without creating a second company or a second financial year. Each
|
|
13
|
+
* one reports whether it did the work or found it already done.
|
|
14
|
+
*/
|
|
15
|
+
import type { SqlClient } from './sql.js';
|
|
16
|
+
export type StepOutcome = 'created' | 'already';
|
|
17
|
+
export interface Step {
|
|
18
|
+
name: string;
|
|
19
|
+
outcome: StepOutcome;
|
|
20
|
+
detail?: string;
|
|
21
|
+
}
|
|
22
|
+
export interface BankAccountOptions {
|
|
23
|
+
/** The only field that is required to create one; without it, none is. */
|
|
24
|
+
iban: string;
|
|
25
|
+
bic?: string | undefined;
|
|
26
|
+
bankName?: string | undefined;
|
|
27
|
+
/** What it is called in the books. Defaults to the bank name, then to `Compte courant`. */
|
|
28
|
+
label?: string | undefined;
|
|
29
|
+
}
|
|
30
|
+
export interface BootstrapOptions {
|
|
31
|
+
organization: string;
|
|
32
|
+
country: string;
|
|
33
|
+
company: string;
|
|
34
|
+
/** Calendar year the first financial year opens in. */
|
|
35
|
+
fiscalYear: number;
|
|
36
|
+
/**
|
|
37
|
+
* First day of that year, as YYYY-MM-DD. Left out, the month comes from
|
|
38
|
+
* `country_defaults.fiscal_year_default` — and a pack that declares none
|
|
39
|
+
* produces a refusal naming the flag, never a January nobody chose.
|
|
40
|
+
*/
|
|
41
|
+
fiscalYearStart?: string | undefined;
|
|
42
|
+
/** `auth.users.id` of the first administrator. */
|
|
43
|
+
adminUserId: string;
|
|
44
|
+
/** ISO 4217 code. Left out, the country model decides; it is `EUR` for both countries shipped. */
|
|
45
|
+
currencyCode?: string | undefined;
|
|
46
|
+
/** Two letters. Left out, the country model decides. Chooses which label of the pack lands in `accounts.name`. */
|
|
47
|
+
language?: string | undefined;
|
|
48
|
+
/** Chart of accounts to install. Left out, the pack's default chart. */
|
|
49
|
+
chartCode?: string | undefined;
|
|
50
|
+
/**
|
|
51
|
+
* How often the company files its periodic return. Left out, the cadence
|
|
52
|
+
* the pack proposes; left out by the pack too, the column stays null and
|
|
53
|
+
* nothing here invents one.
|
|
54
|
+
*/
|
|
55
|
+
vatPeriod?: string | undefined;
|
|
56
|
+
/**
|
|
57
|
+
* How often the company files each declaration it is subject to, keyed on
|
|
58
|
+
* the code of the form. `vatPeriod` above is the same fact for the country's
|
|
59
|
+
* periodic return and is folded into this; a form named here and nowhere
|
|
60
|
+
* recorded simply gets no row, because a cadence nobody chose is not one.
|
|
61
|
+
*/
|
|
62
|
+
filingPeriods?: Record<string, string> | undefined;
|
|
63
|
+
/** The main bank account, when the operator has one to give. */
|
|
64
|
+
bankAccount?: BankAccountOptions | undefined;
|
|
65
|
+
}
|
|
66
|
+
export interface BootstrapResult {
|
|
67
|
+
instanceId: string;
|
|
68
|
+
companyId: string;
|
|
69
|
+
fiscalYearName: string;
|
|
70
|
+
/** The first and last day the financial year was opened on. */
|
|
71
|
+
fiscalYearStart: string;
|
|
72
|
+
fiscalYearEnd: string;
|
|
73
|
+
/** The currency the company was created with. */
|
|
74
|
+
currencyCode: string;
|
|
75
|
+
/** The language the chart of accounts was copied in. */
|
|
76
|
+
language: string;
|
|
77
|
+
/** Version of the country pack the company copied, from `company_packs`. */
|
|
78
|
+
packVersion?: string | undefined;
|
|
79
|
+
/** Chart of accounts the company was installed on. */
|
|
80
|
+
chartCode?: string | undefined;
|
|
81
|
+
/** The cadence recorded on the company, when one was settled. */
|
|
82
|
+
vatPeriod?: string | undefined;
|
|
83
|
+
/** Every cadence recorded, by the code of the form it was recorded for. */
|
|
84
|
+
filingPeriods: Record<string, string>;
|
|
85
|
+
/** The bank account, when one was asked for. */
|
|
86
|
+
bankAccountId?: string | undefined;
|
|
87
|
+
steps: Step[];
|
|
88
|
+
}
|
|
89
|
+
/**
|
|
90
|
+
* The currency the country model proposes.
|
|
91
|
+
*
|
|
92
|
+
* `companies.currency_code` is not null and has a default, so the value has to
|
|
93
|
+
* be chosen *before* the insert — after it there is nothing empty left to
|
|
94
|
+
* fill, which is why `install_country_template` could never be the place for
|
|
95
|
+
* this. It is the reader `country_defaults.currency_code` never had.
|
|
96
|
+
*/
|
|
97
|
+
export declare function countryCurrency(db: SqlClient, country: string): Promise<string | undefined>;
|
|
98
|
+
/**
|
|
99
|
+
* The language the country model proposes, for the same reason as the
|
|
100
|
+
* currency: the column has a default, so the choice has to be made before the
|
|
101
|
+
* insert. It is what `country_defaults.language_default` is for.
|
|
102
|
+
*/
|
|
103
|
+
export declare function countryLanguage(db: SqlClient, country: string): Promise<string | undefined>;
|
|
104
|
+
/** One language a country pack publishes every label in. */
|
|
105
|
+
export interface LanguageChoice {
|
|
106
|
+
/** ISO 639-1, two letters. */
|
|
107
|
+
code: string;
|
|
108
|
+
/** The country's own name in that language, which is a hint anyone can read. */
|
|
109
|
+
label: string;
|
|
110
|
+
/** True of the language the pack itself is written in. */
|
|
111
|
+
isPackLanguage: boolean;
|
|
112
|
+
}
|
|
113
|
+
/**
|
|
114
|
+
* The languages this country's pack publishes, the pack's own first.
|
|
115
|
+
*
|
|
116
|
+
* `ekwo init` asks rather than assumes: a Belgian company may keep its books
|
|
117
|
+
* in French, Dutch or German, and which one it is is not something a country
|
|
118
|
+
* code answers. The list comes from the database — `country_defaults` — and
|
|
119
|
+
* not from the pack folder, because an installation has the compiled seeds
|
|
120
|
+
* and no pack to read.
|
|
121
|
+
*/
|
|
122
|
+
export declare function countryLanguages(db: SqlClient, country: string): Promise<LanguageChoice[]>;
|
|
123
|
+
/**
|
|
124
|
+
* The cadences the periodic return of this country is filed on.
|
|
125
|
+
*
|
|
126
|
+
* Read from the form rather than from a list in this file, because how often a
|
|
127
|
+
* return is filed is part of the return. An empty list means the installation
|
|
128
|
+
* carries no form for that country, and `ekwo init` then asks nothing: there
|
|
129
|
+
* is no cadence to choose between.
|
|
130
|
+
*/
|
|
131
|
+
export declare function countryVatPeriods(db: SqlClient, country: string): Promise<string[]>;
|
|
132
|
+
/** A declaration form of a country, as an installation carries it. */
|
|
133
|
+
export interface FilingForm {
|
|
134
|
+
code: string;
|
|
135
|
+
name: string;
|
|
136
|
+
/** The cadences the form is filed on. */
|
|
137
|
+
periods: string[];
|
|
138
|
+
/** The cadence the law of that country gives everybody, when it gives one. */
|
|
139
|
+
periodDefault?: string | undefined;
|
|
140
|
+
/** Whether this is the periodic return, which is what `--vat-period` names. */
|
|
141
|
+
isPeriodicReturn: boolean;
|
|
142
|
+
}
|
|
143
|
+
/**
|
|
144
|
+
* Every declaration form this country files, with what each one accepts and
|
|
145
|
+
* what it proposes.
|
|
146
|
+
*
|
|
147
|
+
* `ekwo init` asks once per form, because a company is subject to several
|
|
148
|
+
* declarations and each has a cadence of its own: the recapitulative statement
|
|
149
|
+
* of intra-Community supplies is not filed on the cadence of the return in any
|
|
150
|
+
* country read so far. An empty list means the installation carries no form for
|
|
151
|
+
* that country, and then there is nothing to ask.
|
|
152
|
+
*/
|
|
153
|
+
export declare function countryFilingForms(db: SqlClient, country: string): Promise<FilingForm[]>;
|
|
154
|
+
/**
|
|
155
|
+
* The cadence the pack proposes, or nothing.
|
|
156
|
+
*
|
|
157
|
+
* Nothing is the answer for three of the four packs here: Belgium, France and
|
|
158
|
+
* Luxembourg each make the cadence follow turnover, so the pack has no way to
|
|
159
|
+
* know and says so by staying silent. Estonia's taxable period is the calendar
|
|
160
|
+
* month for everybody, so it proposes one. It is
|
|
161
|
+
* `country_defaults.vat_period_default`.
|
|
162
|
+
*/
|
|
163
|
+
export declare function countryVatPeriod(db: SqlClient, country: string): Promise<string | undefined>;
|
|
164
|
+
/**
|
|
165
|
+
* The month the country model opens a financial year on, or nothing.
|
|
166
|
+
*
|
|
167
|
+
* `ekwo init` reads it to know whether it has to ask. The dates themselves
|
|
168
|
+
* are never computed here: `fiscal_year_bounds()` in the schema is the one
|
|
169
|
+
* place that turns a month into two days.
|
|
170
|
+
*/
|
|
171
|
+
export declare function countryFiscalYearOpening(db: SqlClient, country: string): Promise<string | undefined>;
|
|
172
|
+
/** One chart a country pack offers. */
|
|
173
|
+
export interface ChartChoice {
|
|
174
|
+
code: string;
|
|
175
|
+
name: string;
|
|
176
|
+
isDefault: boolean;
|
|
177
|
+
audience: string | null;
|
|
178
|
+
certificationStatus: string | null;
|
|
179
|
+
accounts: number;
|
|
180
|
+
}
|
|
181
|
+
/**
|
|
182
|
+
* The charts a country offers, the default one first.
|
|
183
|
+
*
|
|
184
|
+
* `ekwo init` asks only when there are two or more, and preselects nothing:
|
|
185
|
+
* the question whose wrong answer is a chart of accounts has no right default
|
|
186
|
+
* beyond the one the pack itself declares.
|
|
187
|
+
*/
|
|
188
|
+
export declare function countryCharts(db: SqlClient, country: string): Promise<ChartChoice[]>;
|
|
189
|
+
/** What a pack says about itself: version and how much anyone has read it. */
|
|
190
|
+
export interface PackSummary {
|
|
191
|
+
country: string;
|
|
192
|
+
name: string;
|
|
193
|
+
version: string;
|
|
194
|
+
certificationStatus: string;
|
|
195
|
+
certifiedBy: string | null;
|
|
196
|
+
certifiedAt: string | null;
|
|
197
|
+
}
|
|
198
|
+
export declare function countryPack(db: SqlClient, country: string): Promise<PackSummary | undefined>;
|
|
199
|
+
/** Countries with a chart of accounts seeded in this database. */
|
|
200
|
+
export declare function availableCountries(db: SqlClient): Promise<string[]>;
|
|
201
|
+
/** A country offered at install time: its code, and what the pack calls it. */
|
|
202
|
+
export interface InstalledPack {
|
|
203
|
+
country: string;
|
|
204
|
+
name: string;
|
|
205
|
+
}
|
|
206
|
+
/**
|
|
207
|
+
* What this installation can install a company on, in the order it is
|
|
208
|
+
* offered: the packs it holds, by name.
|
|
209
|
+
*
|
|
210
|
+
* The name comes from the pack — `country_packs.name` — so no list of
|
|
211
|
+
* countries and no label for one is ever written in this code. A database
|
|
212
|
+
* seeded before `country_packs` existed still has charts, so the codes of
|
|
213
|
+
* `account_templates` are the fallback, each standing as its own label.
|
|
214
|
+
*/
|
|
215
|
+
export declare function installedPacks(db: SqlClient): Promise<InstalledPack[]>;
|
|
216
|
+
/** Whether the schema has been installed at all. */
|
|
217
|
+
export declare function schemaIsInstalled(db: SqlClient): Promise<boolean>;
|
|
218
|
+
export declare function bootstrap(db: SqlClient, options: BootstrapOptions): Promise<BootstrapResult>;
|
|
219
|
+
interface BankAccountOutcome {
|
|
220
|
+
id: string;
|
|
221
|
+
outcome: StepOutcome;
|
|
222
|
+
label: string;
|
|
223
|
+
accountCode?: string | undefined;
|
|
224
|
+
}
|
|
225
|
+
/**
|
|
226
|
+
* The company's first bank account, wired to the bank journal and its ledger
|
|
227
|
+
* account.
|
|
228
|
+
*
|
|
229
|
+
* `install_country_template` already points the bank journal at 550000 or
|
|
230
|
+
* 512000, so the ledger side is known and this step does not ask for it. The
|
|
231
|
+
* IBAN is the natural key — `bank_accounts_company_iban_idx` — so running
|
|
232
|
+
* `init` again with the same one finds it rather than creating a second.
|
|
233
|
+
*/
|
|
234
|
+
export declare function ensureBankAccount(db: SqlClient, companyId: string, currencyCode: string, options: BankAccountOptions): Promise<BankAccountOutcome>;
|
|
235
|
+
export {};
|
|
236
|
+
//# sourceMappingURL=bootstrap.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"bootstrap.d.ts","sourceRoot":"","sources":["../src/bootstrap.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;GAaG;AAEH,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,UAAU,CAAC;AAG1C,MAAM,MAAM,WAAW,GAAG,SAAS,GAAG,SAAS,CAAC;AAEhD,MAAM,WAAW,IAAI;IACnB,IAAI,EAAE,MAAM,CAAC;IACb,OAAO,EAAE,WAAW,CAAC;IACrB,MAAM,CAAC,EAAE,MAAM,CAAC;CACjB;AAED,MAAM,WAAW,kBAAkB;IACjC,0EAA0E;IAC1E,IAAI,EAAE,MAAM,CAAC;IACb,GAAG,CAAC,EAAE,MAAM,GAAG,SAAS,CAAC;IACzB,QAAQ,CAAC,EAAE,MAAM,GAAG,SAAS,CAAC;IAC9B,2FAA2F;IAC3F,KAAK,CAAC,EAAE,MAAM,GAAG,SAAS,CAAC;CAC5B;AAED,MAAM,WAAW,gBAAgB;IAC/B,YAAY,EAAE,MAAM,CAAC;IACrB,OAAO,EAAE,MAAM,CAAC;IAChB,OAAO,EAAE,MAAM,CAAC;IAChB,uDAAuD;IACvD,UAAU,EAAE,MAAM,CAAC;IACnB;;;;OAIG;IACH,eAA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