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.
Files changed (361) hide show
  1. package/README.md +873 -0
  2. package/dist/args.d.ts +57 -0
  3. package/dist/args.d.ts.map +1 -0
  4. package/dist/args.js +134 -0
  5. package/dist/args.js.map +1 -0
  6. package/dist/assets/expected-objects.json +9432 -0
  7. package/dist/assets/migrations/20260911120000_core_companies.sql +260 -0
  8. package/dist/assets/migrations/20260911120100_accounts_journals.sql +211 -0
  9. package/dist/assets/migrations/20260911120200_contacts.sql +90 -0
  10. package/dist/assets/migrations/20260911120300_taxes.sql +146 -0
  11. package/dist/assets/migrations/20260911120400_entries.sql +338 -0
  12. package/dist/assets/migrations/20260911120500_documents.sql +279 -0
  13. package/dist/assets/migrations/20260911120600_payments_reconciliation.sql +251 -0
  14. package/dist/assets/migrations/20260911120700_bank.sql +178 -0
  15. package/dist/assets/migrations/20260911120800_analytics_attachments.sql +128 -0
  16. package/dist/assets/migrations/20260911120900_post_document.sql +279 -0
  17. package/dist/assets/migrations/20260911121000_reporting.sql +235 -0
  18. package/dist/assets/migrations/20260911121100_country_templates.sql +226 -0
  19. package/dist/assets/migrations/20260911121200_fec.sql +71 -0
  20. package/dist/assets/migrations/20260911130000_instance.sql +77 -0
  21. package/dist/assets/migrations/20260911130100_instance_members.sql +224 -0
  22. package/dist/assets/migrations/20260911140000_instance_admins.sql +112 -0
  23. package/dist/assets/migrations/20260911160000_tax_posting_templates_unique.sql +17 -0
  24. package/dist/assets/migrations/20260911170000_document_amount_paid.sql +82 -0
  25. package/dist/assets/migrations/20260911173000_post_payment.sql +122 -0
  26. package/dist/assets/migrations/20260911173100_sequence_counters_under_rls.sql +84 -0
  27. package/dist/assets/migrations/20260911183000_country_journal_defaults.sql +143 -0
  28. package/dist/assets/migrations/20260911193853_line_account_defaults.sql +274 -0
  29. package/dist/assets/migrations/20260911195054_products.sql +221 -0
  30. package/dist/assets/migrations/20260911210131_anon_surface.sql +85 -0
  31. package/dist/assets/migrations/20260912074712_country_packs.sql +318 -0
  32. package/dist/assets/migrations/20260912080311_report_code_and_region.sql +198 -0
  33. package/dist/assets/migrations/20260912081014_pack_certification_maintained.sql +31 -0
  34. package/dist/assets/migrations/20260912081015_pack_certification_backfill.sql +16 -0
  35. package/dist/assets/migrations/20260912090407_tax_report_boxes.sql +329 -0
  36. package/dist/assets/migrations/20260912091917_tax_on_base_value.sql +25 -0
  37. package/dist/assets/migrations/20260912091918_tax_engine_columns.sql +776 -0
  38. package/dist/assets/migrations/20260912094412_opening_and_closing.sql +759 -0
  39. package/dist/assets/migrations/20260912095825_charts_of_accounts.sql +326 -0
  40. package/dist/assets/migrations/20260912100412_financial_statements.sql +632 -0
  41. package/dist/assets/migrations/20260912104719_one_formula_evaluator.sql +209 -0
  42. package/dist/assets/migrations/20260912105720_entry_kind_appropriation.sql +26 -0
  43. package/dist/assets/migrations/20260912105721_appropriation_entry_kind.sql +444 -0
  44. package/dist/assets/migrations/20260912111751_document_rules.sql +274 -0
  45. package/dist/assets/migrations/20260912112132_cash_basis_vat_and_fx.sql +1189 -0
  46. package/dist/assets/migrations/20260913074512_modules.sql +493 -0
  47. package/dist/assets/migrations/20260913075903_asset_disposal_roles.sql +47 -0
  48. package/dist/assets/migrations/20260913083216_capabilities.sql +637 -0
  49. package/dist/assets/migrations/20260913083901_company_invitations.sql +262 -0
  50. package/dist/assets/migrations/20260913084402_user_preferences.sql +376 -0
  51. package/dist/assets/migrations/20260913084847_company_profile.sql +261 -0
  52. package/dist/assets/migrations/20260913085436_numbering_reads_the_pack.sql +235 -0
  53. package/dist/assets/migrations/20260913085932_api_keys.sql +303 -0
  54. package/dist/assets/migrations/20260913090216_fiscal_year_bounds.sql +159 -0
  55. package/dist/assets/migrations/20260913092527_entries_import.sql +219 -0
  56. package/dist/assets/migrations/20260913101536_null_safe_guards.sql +188 -0
  57. package/dist/assets/migrations/20260913102115_installer_is_named.sql +462 -0
  58. package/dist/assets/migrations/20260913102758_no_currency_default.sql +138 -0
  59. package/dist/assets/migrations/20260913103355_cash_basis_needs_a_box.sql +453 -0
  60. package/dist/assets/migrations/20260913104014_aged_balance_named_group.sql +79 -0
  61. package/dist/assets/migrations/20260913104232_foreign_key_indexes.sql +144 -0
  62. package/dist/assets/migrations/20260913105120_declared_no_reader.sql +41 -0
  63. package/dist/assets/migrations/20260913111407_pack_languages.sql +223 -0
  64. package/dist/assets/migrations/20260913112233_schema_comments_for_a_reader.sql +27 -0
  65. package/dist/assets/migrations/20260913114535_fec_opening_balances.sql +307 -0
  66. package/dist/assets/migrations/20260914103412_audit_log.sql +509 -0
  67. package/dist/assets/migrations/20260914111907_pack_upgrade.sql +428 -0
  68. package/dist/assets/migrations/20260914120500_rounding_reads_the_currency.sql +206 -0
  69. package/dist/assets/migrations/20260914121200_amounts_round_at_the_currency.sql +2403 -0
  70. package/dist/assets/migrations/20260914134325_schema_version_0_2_0.sql +36 -0
  71. package/dist/assets/migrations/20260914143915_accounts_in_use.sql +428 -0
  72. package/dist/assets/migrations/20260914144731_account_code_frozen.sql +99 -0
  73. package/dist/assets/migrations/20260914151207_schema_grants_its_own_rights.sql +284 -0
  74. package/dist/assets/migrations/20260914152840_pack_upgrade_records_its_own_line.sql +237 -0
  75. package/dist/assets/migrations/20260914163943_declaration_periodicity.sql +349 -0
  76. package/dist/assets/migrations/20260915094000_foreign_services_received.sql +37 -0
  77. package/dist/assets/migrations/20260915094500_mentions_read_a_foreign_service.sql +72 -0
  78. package/dist/assets/migrations/20260915153000_document_shares.sql +568 -0
  79. package/dist/assets/migrations/20260915160000_ec_sales_list.sql +181 -0
  80. package/dist/assets/migrations/20260915161842_pack_sources.sql +56 -0
  81. package/dist/assets/migrations/20260915170500_schema_version_0_3_0.sql +45 -0
  82. package/dist/assets/migrations/20260915174500_a_vat_category_is_a_code.sql +177 -0
  83. package/dist/assets/migrations/20260915180000_document_rule_references.sql +85 -0
  84. package/dist/assets/migrations/20260915181000_territories.sql +342 -0
  85. package/dist/assets/migrations/20260915181500_ec_sales_list_reads_the_territories.sql +222 -0
  86. package/dist/assets/migrations/20260915182000_intracom_triangular.sql +53 -0
  87. package/dist/assets/migrations/20260915182500_a_triangular_supply_says_reverse_charge.sql +99 -0
  88. package/dist/assets/migrations/20260915191200_a_document_knows_its_language.sql +633 -0
  89. package/dist/assets/migrations/20260915195000_a_price_that_holds_its_tax.sql +649 -0
  90. package/dist/assets/migrations/20260915200000_a_posting_names_its_boxes.sql +1004 -0
  91. package/dist/assets/migrations/20260916094500_a_company_files_more_than_one_declaration.sql +795 -0
  92. package/dist/assets/migrations/20260916103000_a_ledger_line_names_its_posting.sql +902 -0
  93. package/dist/assets/migrations/20260916123000_a_vocabulary_for_a_tax_that_is_not_a_vat.sql +144 -0
  94. package/dist/assets/migrations/20260916124000_a_box_can_be_a_rate_of_a_box.sql +525 -0
  95. package/dist/assets/migrations/20260916125000_a_tax_follows_the_territory.sql +1318 -0
  96. package/dist/assets/migrations/20260916126000_a_tax_point_and_its_exception.sql +1211 -0
  97. package/dist/assets/migrations/20260917090000_a_counterparty_that_learns.sql +561 -0
  98. package/dist/assets/migrations/20260917120000_what_the_money_pays.sql +545 -0
  99. package/dist/assets/migrations/20260917150000_a_filing_is_a_row.sql +488 -0
  100. package/dist/assets/migrations/20260917170000_when_it_is_due.sql +194 -0
  101. package/dist/assets/migrations/20260917180000_a_box_is_a_number_and_a_kind.sql +213 -0
  102. package/dist/assets/migrations/20260917190000_what_a_declaration_owes.sql +486 -0
  103. package/dist/assets/migrations/20260917200000_what_moved_after_it_went.sql +227 -0
  104. package/dist/assets/migrations/20260918090000_a_form_names_its_file.sql +27 -0
  105. package/dist/assets/migrations/20260918110000_a_deposit_and_what_came_back.sql +286 -0
  106. package/dist/assets/migrations/20260918113741_a_fourth_preset_is_named.sql +9 -0
  107. package/dist/assets/migrations/20260918113807_a_client_reads_and_hands_over.sql +96 -0
  108. package/dist/assets/migrations/20260918114322_two_definer_functions_check_their_caller.sql +75 -0
  109. package/dist/assets/migrations/20260918130000_every_company_somebody_keeps.sql +177 -0
  110. package/dist/assets/migrations/20260918140000_a_session_nobody_prepared.sql +40 -0
  111. package/dist/assets/migrations/20260918141107_a_line_keeps_the_tax_it_was_posted_with.sql +256 -0
  112. package/dist/assets/migrations/20260918141342_a_company_has_an_electronic_address.sql +66 -0
  113. package/dist/assets/migrations/20260918141605_an_invoice_reads_whole_from_the_views.sql +313 -0
  114. package/dist/assets/migrations/20260918141627_a_policy_asks_once.sql +132 -0
  115. package/dist/assets/migrations/20260918143352_a_suggestion_reads_the_words_once.sql +204 -0
  116. package/dist/assets/migrations/20260918143417_a_reference_of_the_caller_and_a_rehearsal.sql +115 -0
  117. package/dist/assets/migrations/20260918150712_a_company_leaves_with_its_books.sql +1119 -0
  118. package/dist/assets/migrations/20260918150931_a_statement_is_imported_once.sql +654 -0
  119. package/dist/assets/migrations/20260918161204_a_posted_document_does_not_move.sql +437 -0
  120. package/dist/assets/migrations/20260918161538_a_posted_entry_does_not_move.sql +252 -0
  121. package/dist/assets/migrations/20260918171946_an_entry_is_posted_by_post_entry.sql +289 -0
  122. package/dist/assets/migrations/20260918174312_schema_version_0_4_0.sql +53 -0
  123. package/dist/assets/modules/assets/module.json +13 -0
  124. package/dist/assets/modules/assets/supabase/migrations/20260913081447_assets.sql +1190 -0
  125. package/dist/assets/modules/assets/supabase/migrations/20260913104234_foreign_key_indexes.sql +47 -0
  126. package/dist/assets/modules/assets/supabase/migrations/20260913104500_assets_capabilities.sql +145 -0
  127. package/dist/assets/modules/assets/supabase/migrations/20260914122100_assets_round_at_the_currency.sql +564 -0
  128. package/dist/assets/modules/assets/supabase/migrations/20260914145012_assets_accounts_in_use.sql +37 -0
  129. package/dist/assets/modules/assets/supabase/migrations/20260914151530_assets_grants_its_own_rights.sql +63 -0
  130. package/dist/assets/modules/assets/supabase/migrations/20260918113912_assets_client_reads.sql +20 -0
  131. package/dist/assets/modules/assets/supabase/migrations/20260918150801_assets_leave_with_the_company.sql +41 -0
  132. package/dist/assets/modules/budgets/module.json +12 -0
  133. package/dist/assets/modules/budgets/supabase/migrations/20260913083012_budgets.sql +210 -0
  134. package/dist/assets/modules/budgets/supabase/migrations/20260913104233_foreign_key_indexes.sql +37 -0
  135. package/dist/assets/modules/budgets/supabase/migrations/20260913104501_budgets_capabilities.sql +72 -0
  136. package/dist/assets/modules/budgets/supabase/migrations/20260914122400_budgets_round_at_the_currency.sql +68 -0
  137. package/dist/assets/modules/budgets/supabase/migrations/20260914145048_budgets_accounts_in_use.sql +30 -0
  138. package/dist/assets/modules/budgets/supabase/migrations/20260914151812_budgets_grants_its_own_rights.sql +31 -0
  139. package/dist/assets/modules/budgets/supabase/migrations/20260918113954_budgets_client_reads.sql +20 -0
  140. package/dist/assets/modules/budgets/supabase/migrations/20260918150823_budgets_leave_with_the_company.sql +37 -0
  141. package/dist/assets/modules/schema/module.1.json +69 -0
  142. package/dist/assets/seed/00_currencies.sql +15 -0
  143. package/dist/assets/seed/00_territories.sql +280 -0
  144. package/dist/assets/seed/05_framework_generic.sql +110 -0
  145. package/dist/assets/seed/10_pack_be.sql +1284 -0
  146. package/dist/assets/seed/11_pack_fr.sql +1112 -0
  147. package/dist/assets/seed/12_pack_lu.sql +2484 -0
  148. package/dist/assets/seed/13_pack_ee.sql +733 -0
  149. package/dist/assets/seed/14_pack_gb.sql +796 -0
  150. package/dist/assets/seed/15_pack_us.sql +751 -0
  151. package/dist/assets/seed/90_demo_company.sql +368 -0
  152. package/dist/assets/seed/modules/assets/10_pack_be.sql +58 -0
  153. package/dist/assets/seed/modules/assets/11_pack_fr.sql +57 -0
  154. package/dist/assets/seed/modules/assets/14_pack_gb.sql +58 -0
  155. package/dist/assets/seed/modules/assets/15_pack_us.sql +60 -0
  156. package/dist/auth.d.ts +59 -0
  157. package/dist/auth.d.ts.map +1 -0
  158. package/dist/auth.js +134 -0
  159. package/dist/auth.js.map +1 -0
  160. package/dist/bin.d.ts +6 -0
  161. package/dist/bin.d.ts.map +1 -0
  162. package/dist/bin.js +8 -0
  163. package/dist/bin.js.map +1 -0
  164. package/dist/books.d.ts +60 -0
  165. package/dist/books.d.ts.map +1 -0
  166. package/dist/books.js +168 -0
  167. package/dist/books.js.map +1 -0
  168. package/dist/bootstrap.d.ts +236 -0
  169. package/dist/bootstrap.d.ts.map +1 -0
  170. package/dist/bootstrap.js +459 -0
  171. package/dist/bootstrap.js.map +1 -0
  172. package/dist/bundle.d.ts +27 -0
  173. package/dist/bundle.d.ts.map +1 -0
  174. package/dist/bundle.js +47 -0
  175. package/dist/bundle.js.map +1 -0
  176. package/dist/checklist.d.ts +35 -0
  177. package/dist/checklist.d.ts.map +1 -0
  178. package/dist/checklist.js +64 -0
  179. package/dist/checklist.js.map +1 -0
  180. package/dist/cli.d.ts +14 -0
  181. package/dist/cli.d.ts.map +1 -0
  182. package/dist/cli.js +318 -0
  183. package/dist/cli.js.map +1 -0
  184. package/dist/commands/company.d.ts +59 -0
  185. package/dist/commands/company.d.ts.map +1 -0
  186. package/dist/commands/company.js +287 -0
  187. package/dist/commands/company.js.map +1 -0
  188. package/dist/commands/contact.d.ts +9 -0
  189. package/dist/commands/contact.d.ts.map +1 -0
  190. package/dist/commands/contact.js +82 -0
  191. package/dist/commands/contact.js.map +1 -0
  192. package/dist/commands/demo.d.ts +19 -0
  193. package/dist/commands/demo.d.ts.map +1 -0
  194. package/dist/commands/demo.js +72 -0
  195. package/dist/commands/demo.js.map +1 -0
  196. package/dist/commands/doctor.d.ts +12 -0
  197. package/dist/commands/doctor.d.ts.map +1 -0
  198. package/dist/commands/doctor.js +68 -0
  199. package/dist/commands/doctor.js.map +1 -0
  200. package/dist/commands/document.d.ts +17 -0
  201. package/dist/commands/document.d.ts.map +1 -0
  202. package/dist/commands/document.js +217 -0
  203. package/dist/commands/document.js.map +1 -0
  204. package/dist/commands/init.d.ts +31 -0
  205. package/dist/commands/init.d.ts.map +1 -0
  206. package/dist/commands/init.js +535 -0
  207. package/dist/commands/init.js.map +1 -0
  208. package/dist/commands/login.d.ts +24 -0
  209. package/dist/commands/login.d.ts.map +1 -0
  210. package/dist/commands/login.js +128 -0
  211. package/dist/commands/login.js.map +1 -0
  212. package/dist/commands/migrate.d.ts +30 -0
  213. package/dist/commands/migrate.d.ts.map +1 -0
  214. package/dist/commands/migrate.js +115 -0
  215. package/dist/commands/migrate.js.map +1 -0
  216. package/dist/commands/module.d.ts +32 -0
  217. package/dist/commands/module.d.ts.map +1 -0
  218. package/dist/commands/module.js +285 -0
  219. package/dist/commands/module.js.map +1 -0
  220. package/dist/commands/pack.d.ts +22 -0
  221. package/dist/commands/pack.d.ts.map +1 -0
  222. package/dist/commands/pack.js +481 -0
  223. package/dist/commands/pack.js.map +1 -0
  224. package/dist/commands/payment.d.ts +15 -0
  225. package/dist/commands/payment.d.ts.map +1 -0
  226. package/dist/commands/payment.js +97 -0
  227. package/dist/commands/payment.js.map +1 -0
  228. package/dist/commands/register.d.ts +20 -0
  229. package/dist/commands/register.d.ts.map +1 -0
  230. package/dist/commands/register.js +134 -0
  231. package/dist/commands/register.js.map +1 -0
  232. package/dist/commands/status.d.ts +8 -0
  233. package/dist/commands/status.d.ts.map +1 -0
  234. package/dist/commands/status.js +134 -0
  235. package/dist/commands/status.js.map +1 -0
  236. package/dist/commands/whoami.d.ts +21 -0
  237. package/dist/commands/whoami.d.ts.map +1 -0
  238. package/dist/commands/whoami.js +133 -0
  239. package/dist/commands/whoami.js.map +1 -0
  240. package/dist/company.d.ts +16 -0
  241. package/dist/company.d.ts.map +1 -0
  242. package/dist/company.js +26 -0
  243. package/dist/company.js.map +1 -0
  244. package/dist/config.d.ts +24 -0
  245. package/dist/config.d.ts.map +1 -0
  246. package/dist/config.js +50 -0
  247. package/dist/config.js.map +1 -0
  248. package/dist/connection.d.ts +79 -0
  249. package/dist/connection.d.ts.map +1 -0
  250. package/dist/connection.js +116 -0
  251. package/dist/connection.js.map +1 -0
  252. package/dist/context.d.ts +47 -0
  253. package/dist/context.d.ts.map +1 -0
  254. package/dist/context.js +93 -0
  255. package/dist/context.js.map +1 -0
  256. package/dist/doctor.d.ts +45 -0
  257. package/dist/doctor.d.ts.map +1 -0
  258. package/dist/doctor.js +448 -0
  259. package/dist/doctor.js.map +1 -0
  260. package/dist/grants.d.ts +88 -0
  261. package/dist/grants.d.ts.map +1 -0
  262. package/dist/grants.js +174 -0
  263. package/dist/grants.js.map +1 -0
  264. package/dist/identity.d.ts +54 -0
  265. package/dist/identity.d.ts.map +1 -0
  266. package/dist/identity.js +132 -0
  267. package/dist/identity.js.map +1 -0
  268. package/dist/index.d.ts +44 -0
  269. package/dist/index.d.ts.map +1 -0
  270. package/dist/index.js +43 -0
  271. package/dist/index.js.map +1 -0
  272. package/dist/inventory.d.ts +155 -0
  273. package/dist/inventory.d.ts.map +1 -0
  274. package/dist/inventory.js +303 -0
  275. package/dist/inventory.js.map +1 -0
  276. package/dist/migrations.d.ts +76 -0
  277. package/dist/migrations.d.ts.map +1 -0
  278. package/dist/migrations.js +226 -0
  279. package/dist/migrations.js.map +1 -0
  280. package/dist/module/read.d.ts +91 -0
  281. package/dist/module/read.d.ts.map +1 -0
  282. package/dist/module/read.js +172 -0
  283. package/dist/module/read.js.map +1 -0
  284. package/dist/output.d.ts +110 -0
  285. package/dist/output.d.ts.map +1 -0
  286. package/dist/output.js +173 -0
  287. package/dist/output.js.map +1 -0
  288. package/dist/pack/certification.d.ts +27 -0
  289. package/dist/pack/certification.d.ts.map +1 -0
  290. package/dist/pack/certification.js +38 -0
  291. package/dist/pack/certification.js.map +1 -0
  292. package/dist/pack/compile.d.ts +75 -0
  293. package/dist/pack/compile.d.ts.map +1 -0
  294. package/dist/pack/compile.js +801 -0
  295. package/dist/pack/compile.js.map +1 -0
  296. package/dist/pack/filing.d.ts +48 -0
  297. package/dist/pack/filing.d.ts.map +1 -0
  298. package/dist/pack/filing.js +56 -0
  299. package/dist/pack/filing.js.map +1 -0
  300. package/dist/pack/read.d.ts +766 -0
  301. package/dist/pack/read.d.ts.map +1 -0
  302. package/dist/pack/read.js +2336 -0
  303. package/dist/pack/read.js.map +1 -0
  304. package/dist/pack/schema.d.ts +26 -0
  305. package/dist/pack/schema.d.ts.map +1 -0
  306. package/dist/pack/schema.js +181 -0
  307. package/dist/pack/schema.js.map +1 -0
  308. package/dist/pack/territories.d.ts +98 -0
  309. package/dist/pack/territories.d.ts.map +1 -0
  310. package/dist/pack/territories.js +0 -0
  311. package/dist/pack/territories.js.map +1 -0
  312. package/dist/pack/upgrade.d.ts +86 -0
  313. package/dist/pack/upgrade.d.ts.map +1 -0
  314. package/dist/pack/upgrade.js +76 -0
  315. package/dist/pack/upgrade.js.map +1 -0
  316. package/dist/pack/vat-codes.d.ts +273 -0
  317. package/dist/pack/vat-codes.d.ts.map +1 -0
  318. package/dist/pack/vat-codes.js +513 -0
  319. package/dist/pack/vat-codes.js.map +1 -0
  320. package/dist/profiles.d.ts +67 -0
  321. package/dist/profiles.d.ts.map +1 -0
  322. package/dist/profiles.js +187 -0
  323. package/dist/profiles.js.map +1 -0
  324. package/dist/prompt.d.ts +40 -0
  325. package/dist/prompt.d.ts.map +1 -0
  326. package/dist/prompt.js +120 -0
  327. package/dist/prompt.js.map +1 -0
  328. package/dist/registry.d.ts +84 -0
  329. package/dist/registry.d.ts.map +1 -0
  330. package/dist/registry.js +104 -0
  331. package/dist/registry.js.map +1 -0
  332. package/dist/rest.d.ts +81 -0
  333. package/dist/rest.d.ts.map +1 -0
  334. package/dist/rest.js +245 -0
  335. package/dist/rest.js.map +1 -0
  336. package/dist/schema.d.ts +15 -0
  337. package/dist/schema.d.ts.map +1 -0
  338. package/dist/schema.js +15 -0
  339. package/dist/schema.js.map +1 -0
  340. package/dist/seeds.d.ts +27 -0
  341. package/dist/seeds.d.ts.map +1 -0
  342. package/dist/seeds.js +47 -0
  343. package/dist/seeds.js.map +1 -0
  344. package/dist/session.d.ts +39 -0
  345. package/dist/session.d.ts.map +1 -0
  346. package/dist/session.js +92 -0
  347. package/dist/session.js.map +1 -0
  348. package/dist/sql.d.ts +48 -0
  349. package/dist/sql.d.ts.map +1 -0
  350. package/dist/sql.js +112 -0
  351. package/dist/sql.js.map +1 -0
  352. package/dist/status.d.ts +94 -0
  353. package/dist/status.d.ts.map +1 -0
  354. package/dist/status.js +120 -0
  355. package/dist/status.js.map +1 -0
  356. package/dist/ui.d.ts +55 -0
  357. package/dist/ui.d.ts.map +1 -0
  358. package/dist/ui.js +114 -0
  359. package/dist/ui.js.map +1 -0
  360. package/package.json +29 -0
  361. package/schema/output.1.json +613 -0
@@ -0,0 +1,459 @@
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 { first, scalar } from './sql.js';
16
+ /**
17
+ * The currency the country model proposes.
18
+ *
19
+ * `companies.currency_code` is not null and has a default, so the value has to
20
+ * be chosen *before* the insert — after it there is nothing empty left to
21
+ * fill, which is why `install_country_template` could never be the place for
22
+ * this. It is the reader `country_defaults.currency_code` never had.
23
+ */
24
+ export async function countryCurrency(db, country) {
25
+ return scalar(db, 'select currency_code from country_defaults where country = $1', [
26
+ country.toUpperCase(),
27
+ ]);
28
+ }
29
+ /**
30
+ * The language the country model proposes, for the same reason as the
31
+ * currency: the column has a default, so the choice has to be made before the
32
+ * insert. It is what `country_defaults.language_default` is for.
33
+ */
34
+ export async function countryLanguage(db, country) {
35
+ return scalar(db, 'select language_default from country_defaults where country = $1', [
36
+ country.toUpperCase(),
37
+ ]);
38
+ }
39
+ /**
40
+ * The languages this country's pack publishes, the pack's own first.
41
+ *
42
+ * `ekwo init` asks rather than assumes: a Belgian company may keep its books
43
+ * in French, Dutch or German, and which one it is is not something a country
44
+ * code answers. The list comes from the database — `country_defaults` — and
45
+ * not from the pack folder, because an installation has the compiled seeds
46
+ * and no pack to read.
47
+ */
48
+ export async function countryLanguages(db, country) {
49
+ const row = await first(db, 'select name, name_i18n, languages from country_defaults where country = $1', [country.toUpperCase()]);
50
+ if (row === undefined)
51
+ return [];
52
+ const own = await countryLanguage(db, country);
53
+ return (row.languages ?? []).map((code) => ({
54
+ code,
55
+ label: row.name_i18n?.[code] ?? row.name,
56
+ isPackLanguage: code === own,
57
+ }));
58
+ }
59
+ /**
60
+ * The cadences the periodic return of this country is filed on.
61
+ *
62
+ * Read from the form rather than from a list in this file, because how often a
63
+ * return is filed is part of the return. An empty list means the installation
64
+ * carries no form for that country, and `ekwo init` then asks nothing: there
65
+ * is no cadence to choose between.
66
+ */
67
+ export async function countryVatPeriods(db, country) {
68
+ const row = await first(db, `select t.periods::text[] as periods
69
+ from tax_report_templates t
70
+ where t.country = $1 and t.is_periodic_return
71
+ order by t.valid_from desc
72
+ limit 1`, [country.toUpperCase()]);
73
+ return row?.periods ?? [];
74
+ }
75
+ /**
76
+ * Every declaration form this country files, with what each one accepts and
77
+ * what it proposes.
78
+ *
79
+ * `ekwo init` asks once per form, because a company is subject to several
80
+ * declarations and each has a cadence of its own: the recapitulative statement
81
+ * of intra-Community supplies is not filed on the cadence of the return in any
82
+ * country read so far. An empty list means the installation carries no form for
83
+ * that country, and then there is nothing to ask.
84
+ */
85
+ export async function countryFilingForms(db, country) {
86
+ const found = await db.query(`select t.code, t.name, t.periods::text[] as periods,
87
+ t.period_default::text as period_default, t.is_periodic_return
88
+ from tax_report_templates t
89
+ where t.country = $1
90
+ order by t.is_periodic_return desc, t.code`, [country.toUpperCase()]);
91
+ return found.map((row) => ({
92
+ code: row.code,
93
+ name: row.name,
94
+ periods: row.periods ?? [],
95
+ ...(row.period_default === null ? {} : { periodDefault: row.period_default }),
96
+ isPeriodicReturn: row.is_periodic_return,
97
+ }));
98
+ }
99
+ /**
100
+ * The cadence the pack proposes, or nothing.
101
+ *
102
+ * Nothing is the answer for three of the four packs here: Belgium, France and
103
+ * Luxembourg each make the cadence follow turnover, so the pack has no way to
104
+ * know and says so by staying silent. Estonia's taxable period is the calendar
105
+ * month for everybody, so it proposes one. It is
106
+ * `country_defaults.vat_period_default`.
107
+ */
108
+ export async function countryVatPeriod(db, country) {
109
+ // Read from the form and no longer from `country_defaults.vat_period_default`,
110
+ // which asked what a country proposes when the answer belongs to a
111
+ // declaration. `scalar` hands back the null the column holds, and a null here
112
+ // is a pack that has said nothing — the same thing as no row to every caller.
113
+ const proposed = await scalar(db, `select t.period_default::text from tax_report_templates t
114
+ where t.country = $1 and t.is_periodic_return
115
+ order by t.valid_from desc
116
+ limit 1`, [country.toUpperCase()]);
117
+ return proposed ?? undefined;
118
+ }
119
+ /**
120
+ * The month the country model opens a financial year on, or nothing.
121
+ *
122
+ * `ekwo init` reads it to know whether it has to ask. The dates themselves
123
+ * are never computed here: `fiscal_year_bounds()` in the schema is the one
124
+ * place that turns a month into two days.
125
+ */
126
+ export async function countryFiscalYearOpening(db, country) {
127
+ return scalar(db, 'select fiscal_year_default from country_defaults where country = $1', [
128
+ country.toUpperCase(),
129
+ ]);
130
+ }
131
+ /**
132
+ * The charts a country offers, the default one first.
133
+ *
134
+ * `ekwo init` asks only when there are two or more, and preselects nothing:
135
+ * the question whose wrong answer is a chart of accounts has no right default
136
+ * beyond the one the pack itself declares.
137
+ */
138
+ export async function countryCharts(db, country) {
139
+ const rows = await db.query(`select c.code, c.name, c.is_default, c.audience,
140
+ c.certification_status::text,
141
+ (select count(*) from account_templates a
142
+ where a.country = c.country and a.chart_code = c.code)::text as accounts
143
+ from chart_templates c
144
+ where c.country = $1
145
+ order by c.is_default desc, c.code`, [country.toUpperCase()]);
146
+ return rows.map((r) => ({
147
+ code: r.code,
148
+ name: r.name,
149
+ isDefault: r.is_default,
150
+ audience: r.audience,
151
+ certificationStatus: r.certification_status,
152
+ accounts: Number(r.accounts),
153
+ }));
154
+ }
155
+ export async function countryPack(db, country) {
156
+ const row = await first(db, `select country, name, version, certification_status::text, certified_by,
157
+ certified_at::text
158
+ from country_packs where country = $1`, [country.toUpperCase()]);
159
+ if (row === undefined)
160
+ return undefined;
161
+ return {
162
+ country: row.country,
163
+ name: row.name,
164
+ version: row.version,
165
+ certificationStatus: row.certification_status,
166
+ certifiedBy: row.certified_by,
167
+ certifiedAt: row.certified_at,
168
+ };
169
+ }
170
+ /** Countries with a chart of accounts seeded in this database. */
171
+ export async function availableCountries(db) {
172
+ const rows = await db.query('select distinct country from account_templates order by country');
173
+ return rows.map((r) => r.country);
174
+ }
175
+ /**
176
+ * What this installation can install a company on, in the order it is
177
+ * offered: the packs it holds, by name.
178
+ *
179
+ * The name comes from the pack — `country_packs.name` — so no list of
180
+ * countries and no label for one is ever written in this code. A database
181
+ * seeded before `country_packs` existed still has charts, so the codes of
182
+ * `account_templates` are the fallback, each standing as its own label.
183
+ */
184
+ export async function installedPacks(db) {
185
+ const rows = await db.query('select country, name from country_packs order by name, country');
186
+ if (rows.length > 0)
187
+ return rows.map((r) => ({ country: r.country, name: r.name }));
188
+ return (await availableCountries(db)).map((country) => ({ country, name: country }));
189
+ }
190
+ /** Whether the schema has been installed at all. */
191
+ export async function schemaIsInstalled(db) {
192
+ const present = await scalar(db, `select exists (
193
+ select 1 from information_schema.tables
194
+ where table_schema = 'public' and table_name = 'instance'
195
+ )`);
196
+ return present === true;
197
+ }
198
+ export async function bootstrap(db, options) {
199
+ const country = options.country.toUpperCase();
200
+ const steps = [];
201
+ const countries = await availableCountries(db);
202
+ if (!countries.includes(country)) {
203
+ throw new Error(`unknown_country: no chart of accounts seeded for ${country}. ` +
204
+ `This release ships ${countries.join(', ')}.`);
205
+ }
206
+ // 1. The installation itself.
207
+ const existingInstance = await first(db, 'select instance_id, organization_name from instance where id = 1');
208
+ let instanceId;
209
+ if (existingInstance === undefined) {
210
+ const created = await first(db, `select instance_id from init_instance($1, $2, 'community')`, [options.organization, country]);
211
+ if (created === undefined)
212
+ throw new Error('init_instance_failed: no row returned');
213
+ instanceId = created.instance_id;
214
+ steps.push({ name: 'instance', outcome: 'created', detail: options.organization });
215
+ }
216
+ else {
217
+ instanceId = existingInstance.instance_id;
218
+ steps.push({
219
+ name: 'instance',
220
+ outcome: 'already',
221
+ detail: existingInstance.organization_name,
222
+ });
223
+ }
224
+ // 2. The first administrator.
225
+ const isAdmin = await scalar(db, 'select exists (select 1 from instance_admins where user_id = $1)', [options.adminUserId]);
226
+ if (isAdmin === true) {
227
+ steps.push({ name: 'administrator', outcome: 'already', detail: options.adminUserId });
228
+ }
229
+ else {
230
+ const someoneElse = await scalar(db, 'select exists (select 1 from instance_admins)');
231
+ if (someoneElse === true) {
232
+ // The database's own rule: the first claim is open, afterwards only an
233
+ // administrator appoints another. The CLI does not get to break it just
234
+ // because it holds the connection.
235
+ throw new Error('instance_already_claimed: this installation already has an administrator. ' +
236
+ 'An existing administrator appoints another; the CLI will not overrule that.');
237
+ }
238
+ await db.query('select claim_instance_admin($1)', [options.adminUserId]);
239
+ steps.push({ name: 'administrator', outcome: 'created', detail: options.adminUserId });
240
+ }
241
+ // 3. The company. Its currency is chosen here or nowhere: the column has a
242
+ // default, so nothing downstream could tell a deliberate choice from a
243
+ // fallback. The caller answers, or the pack does. There is no third
244
+ // answer written in this file: a company keeping its books in Canadian
245
+ // dollars would get a wrong one, and a wrong answer is worse than a
246
+ // refusal.
247
+ const packCurrency = options.currencyCode ?? (await countryCurrency(db, country));
248
+ if (packCurrency === undefined) {
249
+ throw new Error(`no_currency: the ${country} pack names no currency. Pass --currency.`);
250
+ }
251
+ const currencyCode = packCurrency.toUpperCase();
252
+ const packLanguage = options.language ?? (await countryLanguage(db, country));
253
+ if (packLanguage === undefined) {
254
+ throw new Error(`no_language: the ${country} pack names no language for its labels. Pass --language.`);
255
+ }
256
+ const language = packLanguage.toLowerCase();
257
+ // How often this company files each declaration it is subject to. Unlike the
258
+ // currency and the language, nothing downstream breaks when one is missing,
259
+ // so the absence of an answer is itself an answer and is recorded as one —
260
+ // no row. What is refused is an answer the form does not accept, and a form
261
+ // this installation does not carry.
262
+ const forms = await countryFilingForms(db, country);
263
+ const asked = { ...(options.filingPeriods ?? {}) };
264
+ const periodicReturn = forms.find((form) => form.isPeriodicReturn);
265
+ if (options.vatPeriod !== undefined) {
266
+ if (periodicReturn === undefined) {
267
+ throw new Error(`no_periodic_return: this installation carries no periodic return for ${country}, ` +
268
+ 'so there is no declaration a VAT filing cadence could be about.');
269
+ }
270
+ asked[periodicReturn.code] = options.vatPeriod;
271
+ }
272
+ for (const code of Object.keys(asked)) {
273
+ if (forms.some((form) => form.code === code))
274
+ continue;
275
+ throw new Error(`unknown_tax_report: ${code} is not a declaration form of ${country} in this installation.`);
276
+ }
277
+ const filingPeriods = {};
278
+ for (const form of forms) {
279
+ const chosen = asked[form.code] ?? form.periodDefault;
280
+ if (chosen === undefined)
281
+ continue;
282
+ if (form.periods.length > 0 && !form.periods.includes(chosen)) {
283
+ throw new Error(`unknown_vat_period: ${form.code} is filed ${form.periods.join(' or ')}, not ${chosen}.`);
284
+ }
285
+ filingPeriods[form.code] = chosen;
286
+ }
287
+ const vatPeriod = periodicReturn === undefined ? undefined : filingPeriods[periodicReturn.code];
288
+ const existingCompany = await first(db, 'select id, currency_code from companies where name = $1 order by created_at limit 1', [options.company]);
289
+ let companyId;
290
+ if (existingCompany === undefined) {
291
+ const created = await first(db,
292
+ // `vat_period` is not written here. It is a mirror of the row
293
+ // `company_filing_periods` carries for the periodic return, and writing
294
+ // both would be the one fact decided in two places.
295
+ `insert into companies (name, country, fiscal_country, currency_code, language)
296
+ values ($1, $2, $2, $3, $4)
297
+ returning id`, [options.company, country, currencyCode, language]);
298
+ if (created === undefined)
299
+ throw new Error('company_insert_failed: no row returned');
300
+ companyId = created.id;
301
+ steps.push({
302
+ name: 'company',
303
+ outcome: 'created',
304
+ detail: `${options.company} (${currencyCode})`,
305
+ });
306
+ }
307
+ else {
308
+ companyId = existingCompany.id;
309
+ steps.push({
310
+ name: 'company',
311
+ outcome: 'already',
312
+ detail: `${options.company} (${existingCompany.currency_code})`,
313
+ });
314
+ }
315
+ // Every cadence that was settled, one row per declaration. `do nothing` on a
316
+ // conflict: running `init` again over a company that already records a
317
+ // cadence says what it already said, and does not overrule an answer
318
+ // somebody has since changed.
319
+ for (const [code, period] of Object.entries(filingPeriods)) {
320
+ await db.query(`insert into company_filing_periods (company_id, report_code, period)
321
+ values ($1, $2, $3::declaration_period)
322
+ on conflict (company_id, report_code) do nothing`, [companyId, code, period]);
323
+ }
324
+ // 4. The administrator on the books of that company. Administering an
325
+ // installation is not the same as being a member of a company.
326
+ const membership = await db.query(`insert into company_members (company_id, user_id, role)
327
+ values ($1, $2, 'owner')
328
+ on conflict (company_id, user_id) do nothing
329
+ returning user_id`, [companyId, options.adminUserId]);
330
+ steps.push({
331
+ name: 'owner',
332
+ outcome: membership.length > 0 ? 'created' : 'already',
333
+ });
334
+ // 5. Chart of accounts, journals, taxes, and the company's default accounts.
335
+ // Idempotent on its own: every insert inside it is `on conflict do nothing`.
336
+ const accountsBefore = await scalar(db, 'select count(*)::text from accounts where company_id = $1', [companyId]);
337
+ await db.query('select install_country_template($1, $2, $3, $4)', [
338
+ companyId,
339
+ country,
340
+ language,
341
+ options.chartCode ?? null,
342
+ ]);
343
+ const accountsAfter = await scalar(db, 'select count(*)::text from accounts where company_id = $1', [companyId]);
344
+ const copied = await first(db, 'select version, chart_code from company_packs where company_id = $1 and country = $2', [companyId, country]);
345
+ steps.push({
346
+ name: 'country template',
347
+ outcome: accountsBefore === accountsAfter ? 'already' : 'created',
348
+ detail: `${accountsAfter ?? '0'} accounts, ${country} pack ${copied?.version ?? '?'} ` +
349
+ `chart ${copied?.chart_code ?? '?'} in ${language}`,
350
+ });
351
+ // 6. The first financial year, on the month the country model names. The
352
+ // dates are computed by the schema — `fiscal_year_bounds()` — because
353
+ // `ekwo init`, the MCP server and whoever opens next year all have to
354
+ // get the same answer, and two answers is how a company ends up with two
355
+ // overlapping first years.
356
+ const bounds = await first(db, 'select start_date::text, end_date::text from fiscal_year_bounds($1, $2, $3::date)', [country, options.fiscalYear, options.fiscalYearStart ?? null]);
357
+ if (bounds === undefined)
358
+ throw new Error('fiscal_year_bounds_failed: no row returned');
359
+ const start = bounds.start_date;
360
+ const end = bounds.end_date;
361
+ const fiscalYearName = `FY${options.fiscalYear}`;
362
+ const existingYear = await first(db, 'select name from fiscal_years where company_id = $1 and start_date = $2', [companyId, start]);
363
+ if (existingYear === undefined) {
364
+ await db.query(`insert into fiscal_years (company_id, name, start_date, end_date)
365
+ values ($1, $2, $3, $4)`, [companyId, fiscalYearName, start, end]);
366
+ steps.push({
367
+ name: 'financial year',
368
+ outcome: 'created',
369
+ detail: `${fiscalYearName} — ${start} to ${end}`,
370
+ });
371
+ }
372
+ else {
373
+ steps.push({ name: 'financial year', outcome: 'already', detail: existingYear.name });
374
+ }
375
+ // 7. The main bank account, when an IBAN was given. Without one there is
376
+ // nothing to create: a bank account with no IBAN identifies nothing, and
377
+ // `ekwo doctor` says so rather than this step inventing a placeholder.
378
+ let bankAccountId;
379
+ if (options.bankAccount !== undefined) {
380
+ const outcome = await ensureBankAccount(db, companyId, currencyCode, options.bankAccount);
381
+ bankAccountId = outcome.id;
382
+ steps.push({
383
+ name: 'bank account',
384
+ outcome: outcome.outcome,
385
+ detail: `${outcome.label} — ${options.bankAccount.iban}${outcome.accountCode === undefined ? '' : ` on ${outcome.accountCode}`}`,
386
+ });
387
+ }
388
+ return {
389
+ instanceId,
390
+ companyId,
391
+ fiscalYearName,
392
+ fiscalYearStart: start,
393
+ fiscalYearEnd: end,
394
+ currencyCode,
395
+ language,
396
+ vatPeriod,
397
+ filingPeriods,
398
+ packVersion: copied?.version,
399
+ chartCode: copied?.chart_code,
400
+ bankAccountId,
401
+ steps,
402
+ };
403
+ }
404
+ /**
405
+ * The company's first bank account, wired to the bank journal and its ledger
406
+ * account.
407
+ *
408
+ * `install_country_template` already points the bank journal at 550000 or
409
+ * 512000, so the ledger side is known and this step does not ask for it. The
410
+ * IBAN is the natural key — `bank_accounts_company_iban_idx` — so running
411
+ * `init` again with the same one finds it rather than creating a second.
412
+ */
413
+ export async function ensureBankAccount(db, companyId, currencyCode, options) {
414
+ const iban = options.iban.replace(/\s+/g, '').toUpperCase();
415
+ const label = options.label ?? options.bankName ?? 'Compte courant';
416
+ const journal = await first(db, `select id, default_account_id, code from journals
417
+ where company_id = $1 and journal_type = 'bank' and active
418
+ order by code limit 1`, [companyId]);
419
+ if (journal === undefined) {
420
+ throw new Error('no_bank_journal: this company has no journal of type bank, so a bank account has nothing to book through. ' +
421
+ 'Run install_country_template first.');
422
+ }
423
+ const accountCode = await scalar(db, 'select code from accounts where id = $1', [journal.default_account_id]);
424
+ const existing = await first(db, 'select id, name from bank_accounts where company_id = $1 and iban = $2', [companyId, iban]);
425
+ let id;
426
+ let outcome;
427
+ if (existing === undefined) {
428
+ const created = await first(db, `insert into bank_accounts (company_id, name, iban, bic, bank_name, currency_code,
429
+ account_id, journal_id)
430
+ values ($1, $2, $3, $4, $5, $6, $7, $8)
431
+ returning id`, [
432
+ companyId,
433
+ label,
434
+ iban,
435
+ options.bic ?? null,
436
+ options.bankName ?? null,
437
+ currencyCode,
438
+ journal.default_account_id,
439
+ journal.id,
440
+ ]);
441
+ if (created === undefined)
442
+ throw new Error('bank_account_insert_failed: no row returned');
443
+ id = created.id;
444
+ outcome = 'created';
445
+ }
446
+ else {
447
+ id = existing.id;
448
+ outcome = 'already';
449
+ }
450
+ // The journal points back, so `post_payment` finds the money side from
451
+ // either direction.
452
+ await db.query('update journals set bank_account_id = $1 where id = $2 and bank_account_id is null', [id, journal.id]);
453
+ // And the company points at it, so the first invoice carries an IBAN a
454
+ // customer can pay into. Only when nothing was chosen: the operator picking
455
+ // a different account later is a choice this step must not take back.
456
+ await db.query('update companies set default_bank_account_id = $1 where id = $2 and default_bank_account_id is null', [id, companyId]);
457
+ return { id, outcome, label, accountCode };
458
+ }
459
+ //# sourceMappingURL=bootstrap.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"bootstrap.js","sourceRoot":"","sources":["../src/bootstrap.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;GAaG;AAGH,OAAO,EAAE,KAAK,EAAE,MAAM,EAAE,MAAM,UAAU,CAAC;AAgFzC;;;;;;;GAOG;AACH,MAAM,CAAC,KAAK,UAAU,eAAe,CAAC,EAAa,EAAE,OAAe;IAClE,OAAO,MAAM,CAAS,EAAE,EAAE,+DAA+D,EAAE;QACzF,OAAO,CAAC,WAAW,EAAE;KACtB,CAAC,CAAC;AACL,CAAC;AAED;;;;GAIG;AACH,MAAM,CAAC,KAAK,UAAU,eAAe,CAAC,EAAa,EAAE,OAAe;IAClE,OAAO,MAAM,CAAS,EAAE,EAAE,kEAAkE,EAAE;QAC5F,OAAO,CAAC,WAAW,EAAE;KACtB,CAAC,CAAC;AACL,CAAC;AAYD;;;;;;;;GAQG;AACH,MAAM,CAAC,KAAK,UAAU,gBAAgB,CAAC,EAAa,EAAE,OAAe;IACnE,MAAM,GAAG,GAAG,MAAM,KAAK,CACrB,EAAE,EACF,4EAA4E,EAC5E,CAAC,OAAO,CAAC,WAAW,EAAE,CAAC,CACxB,CAAC;IACF,IAAI,GAAG,KAAK,SAAS;QAAE,OAAO,EAAE,CAAC;IACjC,MAAM,GAAG,GAAG,MAAM,eAAe,CAAC,EAAE,EAAE,OAAO,CAAC,CAAC;IAC/C,OAAO,CAAC,GAAG,CAAC,SAAS,IAAI,EAAE,CAAC,CAAC,GAAG,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,CAAC;QAC1C,IAAI;QACJ,KAAK,EAAE,GAAG,CAAC,SAAS,EAAE,CAAC,IAAI,CAAC,IAAI,GAAG,CAAC,IAAI;QACxC,cAAc,EAAE,IAAI,KAA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1,27 @@
1
+ /**
2
+ * Where the SQL lives.
3
+ *
4
+ * The published npm package carries its own copy of `supabase/migrations`
5
+ * and `supabase/seed` under `dist/assets`, copied at build time by
6
+ * `scripts/copy-assets.mjs`. A user running `npx ekwo-os init` has no clone of
7
+ * the repository, so the schema has to travel with the CLI.
8
+ *
9
+ * When the CLI runs from a checkout instead (`node packages/cli/src/...` or
10
+ * the tests), `dist/assets` does not exist and the repository's own
11
+ * `supabase/` folder is used. Both layouts sit at the same depth relative to
12
+ * this file, which is why the fallback is a fixed path and not a search.
13
+ *
14
+ * `ee/supabase/migrations` is never one of the candidates. The commercial
15
+ * layer has its own migrations and its own installer; a Community
16
+ * installation gets the core and nothing else.
17
+ */
18
+ /** Directory holding `migrations/` and `seed/`, whichever layout we are in. */
19
+ export declare function resolveBundleDir(): string;
20
+ export declare function migrationsDir(bundle?: string): string;
21
+ export declare function seedDir(bundle?: string): string;
22
+ /**
23
+ * The demo company. Never applied by `init` unless `--demo` is passed, and
24
+ * never by `ekwo migrate`: it is sample data, not reference data.
25
+ */
26
+ export declare const DEMO_SEED = "90_demo_company.sql";
27
+ //# sourceMappingURL=bundle.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"bundle.d.ts","sourceRoot":"","sources":["../src/bundle.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;GAgBG;AAKH,+EAA+E;AAC/E,wBAAgB,gBAAgB,IAAI,MAAM,CAiBzC;AAED,wBAAgB,aAAa,CAAC,MAAM,SAAqB,GAAG,MAAM,CAEjE;AAED,wBAAgB,OAAO,CAAC,MAAM,SAAqB,GAAG,MAAM,CAE3D;AAED;;;GAGG;AACH,eAAO,MAAM,SAAS,wBAAwB,CAAC"}
package/dist/bundle.js ADDED
@@ -0,0 +1,47 @@
1
+ /**
2
+ * Where the SQL lives.
3
+ *
4
+ * The published npm package carries its own copy of `supabase/migrations`
5
+ * and `supabase/seed` under `dist/assets`, copied at build time by
6
+ * `scripts/copy-assets.mjs`. A user running `npx ekwo-os init` has no clone of
7
+ * the repository, so the schema has to travel with the CLI.
8
+ *
9
+ * When the CLI runs from a checkout instead (`node packages/cli/src/...` or
10
+ * the tests), `dist/assets` does not exist and the repository's own
11
+ * `supabase/` folder is used. Both layouts sit at the same depth relative to
12
+ * this file, which is why the fallback is a fixed path and not a search.
13
+ *
14
+ * `ee/supabase/migrations` is never one of the candidates. The commercial
15
+ * layer has its own migrations and its own installer; a Community
16
+ * installation gets the core and nothing else.
17
+ */
18
+ import { existsSync } from 'node:fs';
19
+ import { fileURLToPath } from 'node:url';
20
+ /** Directory holding `migrations/` and `seed/`, whichever layout we are in. */
21
+ export function resolveBundleDir() {
22
+ const candidates = [
23
+ // Published package: packages/cli/dist/bundle.js → dist/assets/
24
+ new URL('./assets/', import.meta.url),
25
+ // Checkout: packages/cli/{src,dist}/bundle.* → <repo>/supabase/
26
+ new URL('../../../supabase/', import.meta.url),
27
+ ];
28
+ for (const candidate of candidates) {
29
+ const dir = fileURLToPath(candidate);
30
+ if (existsSync(`${dir}migrations`))
31
+ return dir.replace(/\/$/, '');
32
+ }
33
+ throw new Error('bundle_missing: neither dist/assets nor supabase/ was found next to the CLI. ' +
34
+ 'Reinstall the package, or run `npm run build` in a checkout.');
35
+ }
36
+ export function migrationsDir(bundle = resolveBundleDir()) {
37
+ return `${bundle}/migrations`;
38
+ }
39
+ export function seedDir(bundle = resolveBundleDir()) {
40
+ return `${bundle}/seed`;
41
+ }
42
+ /**
43
+ * The demo company. Never applied by `init` unless `--demo` is passed, and
44
+ * never by `ekwo migrate`: it is sample data, not reference data.
45
+ */
46
+ export const DEMO_SEED = '90_demo_company.sql';
47
+ //# sourceMappingURL=bundle.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"bundle.js","sourceRoot":"","sources":["../src/bundle.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;GAgBG;AAEH,OAAO,EAAE,UAAU,EAAE,MAAM,SAAS,CAAC;AACrC,OAAO,EAAE,aAAa,EAAE,MAAM,UAAU,CAAC;AAEzC,+EAA+E;AAC/E,MAAM,UAAU,gBAAgB;IAC9B,MAAM,UAAU,GAAG;QACjB,gEAAgE;QAChE,IAAI,GAAG,CAAC,WAAW,EAAE,MAAM,CAAC,IAAI,CAAC,GAAG,CAAC;QACrC,gEAAgE;QAChE,IAAI,GAAG,CAAC,oBAAoB,EAAE,MAAM,CAAC,IAAI,CAAC,GAAG,CAAC;KAC/C,CAAC;IAEF,KAAK,MAAM,SAAS,IAAI,UAAU,EAAE,CAAC;QACnC,MAAM,GAAG,GAAG,aAAa,CAAC,SAAS,CAAC,CAAC;QACrC,IAAI,UAAU,CAAC,GAAG,GAAG,YAAY,CAAC;YAAE,OAAO,GAAG,CAAC,OAAO,CAAC,KAAK,EAAE,EAAE,CAAC,CAAC;IACpE,CAAC;IAED,MAAM,IAAI,KAAK,CACb,+EAA+E;QAC7E,8DAA8D,CACjE,CAAC;AACJ,CAAC;AAED,MAAM,UAAU,aAAa,CAAC,MAAM,GAAG,gBAAgB,EAAE;IACvD,OAAO,GAAG,MAAM,aAAa,CAAC;AAChC,CAAC;AAED,MAAM,UAAU,OAAO,CAAC,MAAM,GAAG,gBAAgB,EAAE;IACjD,OAAO,GAAG,MAAM,OAAO,CAAC;AAC1B,CAAC;AAED;;;GAGG;AACH,MAAM,CAAC,MAAM,SAAS,GAAG,qBAAqB,CAAC"}
@@ -0,0 +1,35 @@
1
+ /**
2
+ * The four things an operator has to do on their own Supabase project, which
3
+ * no installer can do for them.
4
+ *
5
+ * Three of the four are settings of the project rather than of the database —
6
+ * whether strangers may sign themselves up, who holds the `service_role` key —
7
+ * and a connection string reaches none of them. The fourth is a piece of
8
+ * reading. So they are printed at the end of a successful `ekwo init`, where
9
+ * the person running it still has the dashboard open, and they are written in
10
+ * the installation documentation in the same words.
11
+ *
12
+ * `ekwo doctor` does not check them, and says nothing about them: it holds a
13
+ * database connection, and the answers are not in the database. The day the
14
+ * CLI accepts a Supabase management token it could ask the API instead, and
15
+ * that is a phase 1 question with an obvious cost — a token that can read a
16
+ * project's settings can change them.
17
+ */
18
+ export interface OperatorInstruction {
19
+ /** What to do, in one sentence. */
20
+ instruction: string;
21
+ /** Why it matters, or where the setting is. */
22
+ because: string;
23
+ }
24
+ /**
25
+ * Kept as data rather than as four calls to `line()` so that a test can read
26
+ * them, and so the documentation and the terminal cannot drift into saying
27
+ * different things.
28
+ */
29
+ export declare const OPERATOR_CHECKLIST: readonly OperatorInstruction[];
30
+ /**
31
+ * Prints the checklist. Called at the end of a successful installation, and
32
+ * exported so a test can read what it writes.
33
+ */
34
+ export declare function printOperatorChecklist(): void;
35
+ //# sourceMappingURL=checklist.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"checklist.d.ts","sourceRoot":"","sources":["../src/checklist.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;GAgBG;AAIH,MAAM,WAAW,mBAAmB;IAClC,mCAAmC;IACnC,WAAW,EAAE,MAAM,CAAC;IACpB,+CAA+C;IAC/C,OAAO,EAAE,MAAM,CAAC;CACjB;AAED;;;;GAIG;AACH,eAAO,MAAM,kBAAkB,EAAE,SAAS,mBAAmB,EA4B5D,CAAC;AAEF;;;GAGG;AACH,wBAAgB,sBAAsB,IAAI,IAAI,CAc7C"}