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
package/dist/output.js ADDED
@@ -0,0 +1,173 @@
1
+ /**
2
+ * The output contract: what a command answers, and with which exit code.
3
+ *
4
+ * Every command of this CLI is run through `execute()`, so the contract is
5
+ * written once and a command cannot opt out of it by forgetting.
6
+ *
7
+ * 0 done.
8
+ * 1 it did not end well and the books were not asked: the network, a
9
+ * database that does not answer, a bug — and a check that found
10
+ * something (`doctor`, `pack check`, a pending migration), which is how
11
+ * a CI job goes red.
12
+ * 2 the command was called wrong: an unknown option, a missing argument,
13
+ * a question that needed an answer and no terminal to ask it on.
14
+ * 3 the database refused. A locked period, a capability the caller does
15
+ * not hold, a tax that does not apply here. The command was well formed
16
+ * and everything worked; the accounting said no.
17
+ *
18
+ * A caller — an agent with a shell, a Makefile — has to tell 2 from 3 without
19
+ * reading a sentence, and that is the reason 3 exists.
20
+ *
21
+ * The refusal itself is printed as the database wrote it. Its name
22
+ * (`period_locked`) is the part a program matches on and its sentence is the
23
+ * part a person reads; neither is rephrased here, and nothing in this file
24
+ * knows what any of the names mean. Which SQLSTATEs count as a refusal and
25
+ * how a name is read out of a message are in `@ekwo-ai/core`, where the MCP
26
+ * server reads them too.
27
+ */
28
+ import { BooksError, isRefusalState, socleCode } from '@ekwo-ai/core';
29
+ import { UsageError } from './args.js';
30
+ import { NotInteractiveError } from './prompt.js';
31
+ import { collectedWarnings, dim, emit, fail, isJsonMode, line, setJsonMode } from './ui.js';
32
+ export const EXIT_OK = 0;
33
+ export const EXIT_ERROR = 1;
34
+ export const EXIT_USAGE = 2;
35
+ export const EXIT_REFUSED = 3;
36
+ let result;
37
+ let context;
38
+ /** Called by a command that acts as a person, as soon as it knows for which company. */
39
+ export function setContext(value) {
40
+ context = value;
41
+ }
42
+ /**
43
+ * What the command answers under `--json`.
44
+ *
45
+ * Called by the command with the same values it prints, never with values of
46
+ * its own: a figure that exists in one of the two forms only is a bug.
47
+ */
48
+ export function setResult(data) {
49
+ result = data;
50
+ }
51
+ const TWO_WORDS = new Set(['module', 'pack', 'company', 'contact', 'invoice', 'payment', 'doc']);
52
+ /** `module list`, `pack upgrade`, `status`: the words that named the command. */
53
+ export function commandLabel(args) {
54
+ if (args.command === undefined && args.flags.get('version') === true)
55
+ return 'version';
56
+ const command = args.command ?? 'help';
57
+ const takesAction = TWO_WORDS.has(command);
58
+ const action = takesAction ? args.positional[0] : undefined;
59
+ if (action === undefined)
60
+ return command;
61
+ // `invoice line add`: the one verb of three words.
62
+ if (command === 'invoice' && action === 'line' && args.positional[1] !== undefined) {
63
+ return `invoice line ${args.positional[1]}`;
64
+ }
65
+ return `${command} ${action}`;
66
+ }
67
+ function field(error, name) {
68
+ if (typeof error !== 'object' || error === null)
69
+ return undefined;
70
+ const value = error[name];
71
+ return typeof value === 'string' && value.length > 0 ? value : undefined;
72
+ }
73
+ /** Which of the three an error is, and with it the exit code. */
74
+ export function classify(error) {
75
+ const message = error instanceof Error ? error.message : String(error);
76
+ const name = socleCode(message);
77
+ const named = name === undefined ? {} : { name };
78
+ // An error of the core's bookkeeping layer was raised before the database
79
+ // was asked, or about something it did not return: an unknown account code,
80
+ // a document that is not a draft. The call has to change; the books did not
81
+ // refuse, so it is not 3.
82
+ if (error instanceof UsageError || error instanceof NotInteractiveError || error instanceof BooksError) {
83
+ return { exitCode: EXIT_USAGE, error: { kind: 'usage', ...named, message } };
84
+ }
85
+ // Both drivers this CLI meets — `postgres` on a real project, PGlite in the
86
+ // tests — put the SQLSTATE in `code`. A Node network error has a `code` too
87
+ // (`ECONNREFUSED`), which is not five characters of the SQL alphabet.
88
+ const code = field(error, 'code');
89
+ const sqlstate = code !== undefined && /^[0-9A-Z]{5}$/.test(code) ? code : undefined;
90
+ const detail = field(error, 'detail');
91
+ const hint = field(error, 'hint');
92
+ const fromDatabase = {
93
+ ...(sqlstate === undefined ? {} : { sqlstate }),
94
+ ...(detail === undefined ? {} : { detail }),
95
+ ...(hint === undefined ? {} : { hint }),
96
+ };
97
+ if (isRefusalState(sqlstate)) {
98
+ return { exitCode: EXIT_REFUSED, error: { kind: 'refusal', ...named, message, ...fromDatabase } };
99
+ }
100
+ return { exitCode: EXIT_ERROR, error: { kind: 'technical', ...named, message, ...fromDatabase } };
101
+ }
102
+ /** `--json` as it was typed, for the errors that happen before flags are read. */
103
+ export function askedForJson(argv) {
104
+ for (const token of argv) {
105
+ if (token === '--')
106
+ return false;
107
+ if (token === '--json' || token === '--json=true' || token === '--json=yes')
108
+ return true;
109
+ }
110
+ return false;
111
+ }
112
+ function printError(error) {
113
+ fail(error.message);
114
+ if (error.detail !== undefined)
115
+ line(` ${dim(error.detail)}`);
116
+ if (error.hint !== undefined)
117
+ line(` ${dim(error.hint)}`);
118
+ }
119
+ /** An error met before any command ran: a bad option, an unknown command. */
120
+ export function reportFailure(command, json, error) {
121
+ setJsonMode(json);
122
+ const outcome = classify(error);
123
+ printError(outcome.error);
124
+ if (json) {
125
+ emit({
126
+ ok: false,
127
+ command,
128
+ exitCode: outcome.exitCode,
129
+ warnings: collectedWarnings(),
130
+ error: outcome.error,
131
+ });
132
+ }
133
+ return outcome.exitCode;
134
+ }
135
+ /**
136
+ * Runs one command under the contract.
137
+ *
138
+ * The handler prints for a person as it goes and hands `setResult()` what a
139
+ * program should read. Here the two are kept apart: under `--json` the prose
140
+ * has already gone to the standard error, and the standard output receives
141
+ * exactly one document — on success, on a finding, and on a refusal alike, so
142
+ * a caller parses the same shape whatever happened.
143
+ */
144
+ export async function execute(args, json, handler) {
145
+ const command = commandLabel(args);
146
+ setJsonMode(json);
147
+ result = undefined;
148
+ context = undefined;
149
+ let exitCode;
150
+ let error;
151
+ try {
152
+ exitCode = await handler();
153
+ }
154
+ catch (thrown) {
155
+ const outcome = classify(thrown);
156
+ exitCode = outcome.exitCode;
157
+ error = outcome.error;
158
+ printError(error);
159
+ }
160
+ if (isJsonMode()) {
161
+ emit({
162
+ ok: exitCode === EXIT_OK,
163
+ command,
164
+ exitCode,
165
+ ...(result === undefined ? {} : { data: result }),
166
+ ...(context === undefined ? {} : { context }),
167
+ warnings: collectedWarnings(),
168
+ ...(error === undefined ? {} : { error }),
169
+ });
170
+ }
171
+ return exitCode;
172
+ }
173
+ //# sourceMappingURL=output.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"output.js","sourceRoot":"","sources":["../src/output.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;GA0BG;AAEH,OAAO,EAAE,UAAU,EAAE,cAAc,EAAE,SAAS,EAAE,MAAM,eAAe,CAAC;AACtE,OAAO,EAAE,UAAU,EAAmB,MAAM,WAAW,CAAC;AACxD,OAAO,EAAE,mBAAmB,EAAE,MAAM,aAAa,CAAC;AAClD,OAAO,EAAE,iBAAiB,EAAE,GAAG,EAAE,IAAI,EAAE,IAAI,EAAE,UAAU,EAAE,IAAI,EAAE,WAAW,EAAE,MAAM,SAAS,CAAC;AAE5F,MAAM,CAAC,MAAM,OAAO,GAAG,CAAC,CAAC;AACzB,MAAM,CAAC,MAAM,UAAU,GAAG,CAAC,CAAC;AAC5B,MAAM,CAAC,MAAM,UAAU,GAAG,CAAC,CAAC;AAC5B,MAAM,CAAC,MAAM,YAAY,GAAG,CAAC,CAAC;AAkD9B,IAAI,MAAe,CAAC;AACpB,IAAI,OAAkC,CAAC;AAEvC,wFAAwF;AACxF,MAAM,UAAU,UAAU,CAAC,KAAoB;IAC7C,OAAO,GAAG,KAAK,CAAC;AAClB,CAAC;AAED;;;;;GAKG;AACH,M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AAC,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;YACjD,GAAG,CAAC,OAAO,KAAK,SAAS,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,EAAE,OAAO,EAAE,CAAC;YAC7C,QAAQ,EAAE,iBAAiB,EAAE;YAC7B,GAAG,CAAC,KAAK,KAAK,SAAS,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,EAAE,KAAK,EAAE,CAAC;SACjB,CAAC,CAAC;IAC9B,CAAC;IACD,OAAO,QAAQ,CAAC;AAClB,CAAC"}
@@ -0,0 +1,27 @@
1
+ /**
2
+ * How a pack describes what anyone has read.
3
+ *
4
+ * One sentence, written once, printed by `ekwo init`, by `ekwo status` and in
5
+ * the header of every generated seed — so the three cannot say three
6
+ * different things about the same pack.
7
+ *
8
+ * The scale is `community`, `maintained`, `reviewed`, and the distinction it
9
+ * carries is the whole point: Ekwo writes a pack and tests that it is
10
+ * internally coherent, which is not an accountant reading it against the law.
11
+ * *Certified* describes a review by a named professional, and nothing else.
12
+ * The value `ekwo` is deprecated; it is still translated here because a
13
+ * database installed before September 2026 may hold it until its seeds are
14
+ * re-applied.
15
+ */
16
+ export type Certification = 'community' | 'maintained' | 'reviewed' | 'ekwo';
17
+ export interface CertificationFacts {
18
+ status: string;
19
+ /** The professional who read it. Only ever set on a reviewed pack. */
20
+ by?: string | null | undefined;
21
+ on?: string | null | undefined;
22
+ }
23
+ /** One line, in plain words, about how much anyone has read this pack. */
24
+ export declare function describeCertification(facts: CertificationFacts): string;
25
+ /** Whether the operator should be warned rather than merely informed. */
26
+ export declare function needsWarning(status: string): boolean;
27
+ //# sourceMappingURL=certification.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"certification.d.ts","sourceRoot":"","sources":["../../src/pack/certification.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AAEH,MAAM,MAAM,aAAa,GAAG,WAAW,GAAG,YAAY,GAAG,UAAU,GAAG,MAAM,CAAC;AAE7E,MAAM,WAAW,kBAAkB;IACjC,MAAM,EAAE,MAAM,CAAC;IACf,sEAAsE;IACtE,EAAE,CAAC,EAAE,MAAM,GAAG,IAAI,GAAG,SAAS,CAAC;IAC/B,EAAE,CAAC,EAAE,MAAM,GAAG,IAAI,GAAG,SAAS,CAAC;CAChC;AAED,0EAA0E;AAC1E,wBAAgB,qBAAqB,CAAC,KAAK,EAAE,kBAAkB,GAAG,MAAM,CAiBvE;AAED,yEAAyE;AACzE,wBAAgB,YAAY,CAAC,MAAM,EAAE,MAAM,GAAG,OAAO,CAEpD"}
@@ -0,0 +1,38 @@
1
+ /**
2
+ * How a pack describes what anyone has read.
3
+ *
4
+ * One sentence, written once, printed by `ekwo init`, by `ekwo status` and in
5
+ * the header of every generated seed — so the three cannot say three
6
+ * different things about the same pack.
7
+ *
8
+ * The scale is `community`, `maintained`, `reviewed`, and the distinction it
9
+ * carries is the whole point: Ekwo writes a pack and tests that it is
10
+ * internally coherent, which is not an accountant reading it against the law.
11
+ * *Certified* describes a review by a named professional, and nothing else.
12
+ * The value `ekwo` is deprecated; it is still translated here because a
13
+ * database installed before September 2026 may hold it until its seeds are
14
+ * re-applied.
15
+ */
16
+ /** One line, in plain words, about how much anyone has read this pack. */
17
+ export function describeCertification(facts) {
18
+ const by = facts.by === null || facts.by === undefined || facts.by === '' ? undefined : facts.by;
19
+ const on = facts.on === null || facts.on === undefined || facts.on === '' ? undefined : facts.on;
20
+ switch (facts.status) {
21
+ case 'reviewed':
22
+ return by === undefined
23
+ ? 'reviewed by an accountant'
24
+ : `reviewed by ${by}${on === undefined ? '' : ` on ${on}`}`;
25
+ case 'maintained':
26
+ case 'ekwo':
27
+ return 'maintained by Ekwo — not yet reviewed by an accountant';
28
+ case 'community':
29
+ return 'community pack — not reviewed';
30
+ default:
31
+ return `certification ${facts.status}`;
32
+ }
33
+ }
34
+ /** Whether the operator should be warned rather than merely informed. */
35
+ export function needsWarning(status) {
36
+ return status !== 'reviewed';
37
+ }
38
+ //# sourceMappingURL=certification.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"certification.js","sourceRoot":"","sources":["../../src/pack/certification.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AAWH,0EAA0E;AAC1E,MAAM,UAAU,qBAAqB,CAAC,KAAyB;IAC7D,MAAM,EAAE,GAAG,KAAK,CAAC,EAAE,KAAK,IAAI,IAAI,KAAK,CAAC,EAAE,KAAK,SAAS,IAAI,KAAK,CAAC,EAAE,KAAK,EAAE,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC,CAAC,KAAK,CAAC,EAAE,CAAC;IACjG,MAAM,EAAE,GAAG,KAAK,CAAC,EAAE,KAAK,IAAI,IAAI,KAAK,CAAC,EAAE,KAAK,SAAS,IAAI,KAAK,CAAC,EAAE,KAAK,EAAE,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC,CAAC,KAAK,CAAC,EAAE,CAAC;IAEjG,QAAQ,KAAK,CAAC,MAAM,EAAE,CAAC;QACrB,KAAK,UAAU;YACb,OAAO,EAAE,KAAK,SAAS;gBACrB,CAAC,CAAC,2BAA2B;gBAC7B,CAAC,CAAC,eAAe,EAAE,GAAG,EAAE,KAAK,SAAS,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,OAAO,EAAE,EAAE,EAAE,CAAC;QAChE,KAAK,YAAY,CAAC;QAClB,KAAK,MAAM;YACT,OAAO,wDAAwD,CAAC;QAClE,KAAK,WAAW;YACd,OAAO,+BAA+B,CAAC;QACzC;YACE,OAAO,iBAAiB,KAAK,CAAC,MAAM,EAAE,CAAC;IAC3C,CAAC;AACH,CAAC;AAED,yEAAyE;AACzE,MAAM,UAAU,YAAY,CAAC,MAAc;IACzC,OAAO,MAAM,KAAK,UAAU,CAAC;AAC/B,CAAC"}
@@ -0,0 +1,75 @@
1
+ /**
2
+ * The compiler: a pack in, one seed file out.
3
+ *
4
+ * The SQL is a build artefact, like `docs/schema.md`. The source is the pack,
5
+ * the output is committed so that `supabase db push` and `psql -f` install a
6
+ * country without this CLI ever running, and `ekwo pack check` refuses an
7
+ * output that is no longer what its pack says. The order of every row is
8
+ * fixed here, so the same pack always compiles to the same bytes.
9
+ *
10
+ * Every insert **upserts on the template tables and on nothing else**. The
11
+ * seeds used to say `on conflict do nothing`, which meant an instance
12
+ * installed last month never received a single pack change — not even for a
13
+ * company created afterwards, since a company copies the templates at
14
+ * install. A template is reference data and a seed is allowed to re-state it;
15
+ * a row that belongs to a company is never touched here, and moving a company
16
+ * from one pack version to the next is `ekwo pack upgrade`, still to come, which
17
+ * shows the diff first.
18
+ *
19
+ * What an upsert cannot do is remove: a template dropped from a pack stays in
20
+ * the database. That is the rule anyway — nothing is ever deleted from a
21
+ * pack, an account is deprecated and a tax gets a `valid_to`.
22
+ */
23
+ import { type FrameworkPack, type Pack } from './read.js';
24
+ /**
25
+ * Which number each pack's compiled seed carries, by slug.
26
+ *
27
+ * **The number is the pack's own, and a number that has shipped never moves.**
28
+ * The seeds are applied in file-name order and are listed by name in
29
+ * `supabase/config.toml`, so a release that renamed one would rename a file an
30
+ * installation already holds — harmless, because the seeds upsert, and
31
+ * inexplicable to whoever reads the list a year later.
32
+ *
33
+ * It used to be the pack's rank in the alphabetical list of slugs, which is
34
+ * stable exactly until a country is added in the middle of it: inserting `ee`
35
+ * between `be` and `fr` moved France and Luxembourg one place each. So a pack
36
+ * **declares** its number, in `seed_sequence`, and nothing here sorts anything.
37
+ */
38
+ export declare function seedFileNames(allSlugs: readonly string[], sequences: ReadonlyMap<string, number>): Map<string, string>;
39
+ /** `packs/be` → `10_pack_be.sql`, `packs/ee` → `13_pack_ee.sql`. */
40
+ export declare function seedFileName(slug: string, allSlugs: readonly string[], sequences: ReadonlyMap<string, number>): string;
41
+ export declare function compilePack(pack: Pack): string;
42
+ /**
43
+ * The country data of one module, for one pack:
44
+ * `supabase/seed/modules/assets/10_pack_be.sql`.
45
+ *
46
+ * It is a seed of its own, under the module's own folder, and deliberately not
47
+ * part of the pack seed. The pack seed is applied by every installation;
48
+ * `assets.category_templates` does not exist on one that does not carry the
49
+ * module, and a seed that half fails is a seed nobody can re-run. So the
50
+ * module migration runner applies these, and only for the modules it installed.
51
+ *
52
+ * The numbering is the pack's own — `10_pack_be`, `13_pack_ee` — so the file
53
+ * of a country is recognisable wherever it sits.
54
+ */
55
+ export declare function moduleSeedFileName(slug: string, allSlugs: readonly string[], sequences: ReadonlyMap<string, number>): string;
56
+ /**
57
+ * `packs/<cc>/assets.json` → the two reference tables of the `assets` module.
58
+ *
59
+ * Returns `undefined` when the pack says nothing about fixed assets, which is
60
+ * not a gap to fill: `assets.generate_schedule` refuses by name where it needs
61
+ * a prorata convention nobody has declared, rather than taking another
62
+ * country's.
63
+ */
64
+ export declare function compileAssetsSeed(pack: Pack): string | undefined;
65
+ /** Every module seed a pack compiles to, by module code. */
66
+ export declare function compileModuleSeeds(pack: Pack): Map<string, string>;
67
+ /** `packs/generic` → `05_framework_generic.sql`. It sorts before every pack. */
68
+ export declare function frameworkSeedFileName(slug: string): string;
69
+ /**
70
+ * The framework pack: statements with no country, and nothing else. They are
71
+ * seeded before the country packs because a chart may name one, and because a
72
+ * company whose country has no pack at all still gets a balance sheet.
73
+ */
74
+ export declare function compileFrameworkPack(pack: FrameworkPack): string;
75
+ //# sourceMappingURL=compile.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"compile.d.ts","sourceRoot":"","sources":["../../src/pack/compile.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;GAqBG;AAGH,OAAO,EAAa,KAAK,aAAa,EAAE,KAAK,IAAI,EAAuC,MAAM,WAAW,CAAC;AAE1G;;;;;;;;;;;;;GAaG;AACH,wBAAgB,aAAa,CAC3B,QAAQ,EAAE,SAAS,MAAM,EAAE,EAC3B,SAAS,EAAE,WAAW,CAAC,MAAM,EAAE,MAAM,CAAC,GACrC,GAAG,CAAC,MAAM,EAAE,MAAM,CAAC,CAoBrB;AAED,oEAAoE;AACpE,wBAAgB,YAAY,CAC1B,IAAI,EAAE,MAAM,EACZ,QAAQ,EAAE,SAAS,MAAM,EAAE,EAC3B,SAAS,EAAE,WAAW,CAAC,MAAM,EAAE,MAAM,CAAC,GACrC,MAAM,CAIR;AAED,wBAAgB,WAAW,CAAC,IAAI,EAAE,IAAI,GAAG,MAAM,CAkB9C;AAED;;;;;;;;;;;;GAYG;AACH,wBAAgB,kBAAkB,CAChC,IAAI,EAAE,MAAM,EACZ,QAAQ,EAAE,SAAS,MAAM,EAAE,EAC3B,SAAS,EAAE,WAAW,CAAC,MAAM,EAAE,MAAM,CAAC,GACrC,MAAM,CAER;AAED;;;;;;;GAOG;AACH,wBAAgB,iBAAiB,CAAC,IAAI,EAAE,IAAI,GAAG,MAAM,GAAG,SAAS,CA2EhE;AAED,4DAA4D;AAC5D,wBAAgB,kBAAkB,CAAC,IAAI,EAAE,IAAI,GAAG,GAAG,CAAC,MAAM,EAAE,MAAM,CAAC,CAKlE;AAED,gFAAgF;AAChF,wBAAgB,qBAAqB,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,CAE1D;AAED;;;;GAIG;AACH,wBAAgB,oBAAoB,CAAC,IAAI,EAAE,aAAa,GAAG,MAAM,CAuBhE"}