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,64 @@
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
+ import { bold, dim, heading, line, note } from './ui.js';
19
+ /**
20
+ * Kept as data rather than as four calls to `line()` so that a test can read
21
+ * them, and so the documentation and the terminal cannot drift into saying
22
+ * different things.
23
+ */
24
+ export const OPERATOR_CHECKLIST = [
25
+ {
26
+ instruction: 'Turn off self sign-up on your project.',
27
+ because: 'Supabase dashboard → Authentication → Sign In / Providers → "Allow new users to sign up". ' +
28
+ 'An Ekwo installation is closed: the people who keep the books are invited to it, ' +
29
+ 'and a stranger who signs themselves up is a row in auth.users nobody asked for.',
30
+ },
31
+ {
32
+ instruction: 'Keep two administrators.',
33
+ because: 'An administrator invites the others and claims the instance. One lost account, ' +
34
+ 'one person on holiday, and a set of books has nobody who can let anyone in.',
35
+ },
36
+ {
37
+ instruction: 'Keep the service_role key off every machine that does not need it.',
38
+ because: 'It bypasses row level security completely: it is not an administrator, it is the ' +
39
+ 'absence of a door. This installer reads it from a flag or a prompt, uses it to create ' +
40
+ 'the first account, and writes it nowhere.',
41
+ },
42
+ {
43
+ instruction: 'Read DISCLAIMER.md before you file anything.',
44
+ because: 'A country pack is a reading of a country\'s rules at the date of its version, not a ' +
45
+ 'legal opinion, and the golden test proves that a pack agrees with itself rather than ' +
46
+ 'with the law. The books are yours, in every country where you file.',
47
+ },
48
+ ];
49
+ /**
50
+ * Prints the checklist. Called at the end of a successful installation, and
51
+ * exported so a test can read what it writes.
52
+ */
53
+ export function printOperatorChecklist() {
54
+ heading('Four things on your project, which this installer cannot do for you');
55
+ for (const [index, item] of OPERATOR_CHECKLIST.entries()) {
56
+ line();
57
+ line(` ${bold(`${index + 1}.`)} ${item.instruction}`);
58
+ line(` ${dim(item.because)}`);
59
+ }
60
+ line();
61
+ note(dim('None of these is something Ekwo does to your project. It is your project: ' +
62
+ 'the settings are yours to change and the key is yours to hold.'));
63
+ }
64
+ //# sourceMappingURL=checklist.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"checklist.js","sourceRoot":"","sources":["../src/checklist.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;GAgBG;AAEH,OAAO,EAAE,IAAI,EAAE,GAAG,EAAE,OAAO,EAAE,IAAI,EAAE,IAAI,EAAE,MAAM,SAAS,CAAC;AASzD;;;;GAIG;AACH,MAAM,CAAC,MAAM,kBAAkB,GAAmC;IAChE;QACE,WAAW,EAAE,wCAAwC;QACrD,OAAO,EACL,4FAA4F;YAC5F,mFAAmF;YACnF,iFAAiF;KACpF;IACD;QACE,WAAW,EAAE,0BAA0B;QACvC,OAAO,EACL,iFAAiF;YACjF,6EAA6E;KAChF;IACD;QACE,WAAW,EAAE,oEAAoE;QACjF,OAAO,EACL,mFAAmF;YACnF,wFAAwF;YACxF,2CAA2C;KAC9C;IACD;QACE,WAAW,EAAE,8CAA8C;QAC3D,OAAO,EACL,sFAAsF;YACtF,uFAAuF;YACvF,qEAAqE;KACxE;CACF,CAAC;AAEF;;;GAGG;AACH,MAAM,UAAU,sBAAsB;IACpC,OAAO,CAAC,qEAAqE,CAAC,CAAC;IAC/E,KAAK,MAAM,CAAC,KAAK,EAAE,IAAI,CAAC,IAAI,kBAAkB,CAAC,OAAO,EAAE,EAAE,CAAC;QACzD,IAAI,EAAE,CAAC;QACP,IAAI,CAAC,KAAK,IAAI,CAAC,GAAG,KAAK,GAAG,CAAC,GAAG,CAAC,IAAI,IAAI,CAAC,WAAW,EAAE,CAAC,CAAC;QACvD,IAAI,CAAC,QAAQ,GAAG,CAAC,IAAI,CAAC,OAAO,CAAC,EAAE,CAAC,CAAC;IACpC,CAAC;IACD,IAAI,EAAE,CAAC;IACP,IAAI,CACF,GAAG,CACD,4EAA4E;QAC1E,gEAAgE,CACnE,CACF,CAAC;AACJ,CAAC"}
package/dist/cli.d.ts ADDED
@@ -0,0 +1,14 @@
1
+ /**
2
+ * The command line itself: parse and dispatch. What a command answers and
3
+ * which exit code it ends on is `output.ts`, for every command at once.
4
+ */
5
+ import { type InitDeps } from './commands/init.js';
6
+ import { type LoginDeps } from './commands/login.js';
7
+ import type { BooksDeps } from './books.js';
8
+ export declare function version(): string;
9
+ export declare const COMMANDS: readonly ["init", "migrate", "status", "doctor", "module", "pack", "company", "register", "unregister", "demo", "login", "logout", "use", "whoami", "contact", "invoice", "post", "payment", "match", "doc"];
10
+ /** What a test may hand a command instead of the network, the disk and the environment. */
11
+ export type RunDeps = InitDeps & LoginDeps & BooksDeps;
12
+ export declare function help(): string;
13
+ export declare function run(argv: string[], deps?: RunDeps): Promise<number>;
14
+ //# sourceMappingURL=cli.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"cli.d.ts","sourceRoot":"","sources":["../src/cli.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAUH,OAAO,EAAe,KAAK,QAAQ,EAAE,MAAM,oBAAoB,CAAC;AAChE,OAAO,EAA+B,KAAK,SAAS,EAAE,MAAM,qBAAqB,CAAC;AAQlF,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,YAAY,CAAC;AAI5C,wBAAgB,OAAO,IAAI,MAAM,CAQhC;AAED,eAAO,MAAM,QAAQ,8MAqBX,CAAC;AAEX,2FAA2F;AAC3F,MAAM,MAAM,OAAO,GAAG,QAAQ,GAAG,SAAS,GAAG,SAAS,CAAC;AAEvD,wBAAgB,IAAI,IAAI,MAAM,CAuL7B;AAED,wBAAsB,GAAG,CAAC,IAAI,EAAE,MAAM,EAAE,EAAE,IAAI,GAAE,OAAY,GAAG,OAAO,CAAC,MAAM,CAAC,CA4E7E"}
package/dist/cli.js ADDED
@@ -0,0 +1,318 @@
1
+ /**
2
+ * The command line itself: parse and dispatch. What a command answers and
3
+ * which exit code it ends on is `output.ts`, for every command at once.
4
+ */
5
+ import { readFileSync } from 'node:fs';
6
+ import { fileURLToPath } from 'node:url';
7
+ import { UsageError, boolFlag, parseArgs } from './args.js';
8
+ import { companyCommand } from './commands/company.js';
9
+ import { contactCommand } from './commands/contact.js';
10
+ import { demoCommand } from './commands/demo.js';
11
+ import { docCommand, invoiceCommand, postCommand } from './commands/document.js';
12
+ import { doctorCommand } from './commands/doctor.js';
13
+ import { initCommand } from './commands/init.js';
14
+ import { loginCommand, logoutCommand } from './commands/login.js';
15
+ import { migrateCommand } from './commands/migrate.js';
16
+ import { moduleCommand } from './commands/module.js';
17
+ import { packCommand } from './commands/pack.js';
18
+ import { matchCommand, paymentCommand } from './commands/payment.js';
19
+ import { registerCommand, unregisterCommand } from './commands/register.js';
20
+ import { statusCommand } from './commands/status.js';
21
+ import { useCommand, whoamiCommand } from './commands/whoami.js';
22
+ import { askedForJson, commandLabel, execute, reportFailure, setResult } from './output.js';
23
+ import { bold, cyan, dim, line } from './ui.js';
24
+ export function version() {
25
+ try {
26
+ const path = fileURLToPath(new URL('../package.json', import.meta.url));
27
+ const parsed = JSON.parse(readFileSync(path, 'utf8'));
28
+ return parsed.version ?? '0.0.0';
29
+ }
30
+ catch {
31
+ return '0.0.0';
32
+ }
33
+ }
34
+ export const COMMANDS = [
35
+ 'init',
36
+ 'migrate',
37
+ 'status',
38
+ 'doctor',
39
+ 'module',
40
+ 'pack',
41
+ 'company',
42
+ 'register',
43
+ 'unregister',
44
+ 'demo',
45
+ 'login',
46
+ 'logout',
47
+ 'use',
48
+ 'whoami',
49
+ 'contact',
50
+ 'invoice',
51
+ 'post',
52
+ 'payment',
53
+ 'match',
54
+ 'doc',
55
+ ];
56
+ export function help() {
57
+ return `${bold('ekwo')} — install and operate Ekwo OS on a Supabase project you own.
58
+
59
+ ${bold('Usage')}
60
+ npx ekwo-os <command> [options]
61
+
62
+ ${bold('Commands')}
63
+ ${cyan('init')} Apply the schema, seed the reference data, create the first
64
+ administrator and the first company, on a project you already have.
65
+ ${cyan('migrate')} Apply the migrations this release adds, and show the gap first.
66
+ ${cyan('status')} Schema version installed against available, the instance,
67
+ its administrators and its companies.
68
+ ${cyan('doctor')} Check what the schema cannot enforce on its own: row level
69
+ security everywhere, no pending migration, no membership pointing
70
+ at a deleted user, statements that tie to their lines.
71
+ ${cyan('module')} The modules beside the socle: what is installed, apply their
72
+ migrations, and turn one on or off for a company.
73
+ ${cyan('pack')} Compile a country pack into its seed, check that the committed
74
+ seed is still the exact output of the pack, and move a company
75
+ onto the version an installation holds.
76
+ ${cyan('company')} One company leaves an installation with its books, as an archive
77
+ anybody can read, and arrives in another one alive.
78
+ ${cyan('register')} Opt in to security advisories and release notes. Never required.
79
+ ${cyan('unregister')} Opt back out. Clears the address and the date.
80
+ ${cyan('demo')} Load the sample company. Fictional data; ask for it explicitly.
81
+
82
+ ${cyan('login')} Sign in to an instance as yourself and keep the session, in your
83
+ own configuration directory and never in a repository.
84
+ ${cyan('logout')} End that session, here and on the instance.
85
+ ${cyan('use')} Pick the company the next commands run on.
86
+ ${cyan('whoami')} Who you are on which instance, the companies you can see, and
87
+ what you may do on the one in use.
88
+
89
+ ${bold('Connecting')} ${dim('(every command)')}
90
+ --db-url <url> Postgres connection string. Supabase dashboard →
91
+ Project Settings → Database. The reliable way.
92
+ --project-ref <ref> With --db-password, the host is guessed from the ref.
93
+ --db-password <password> Database password. Prompted, masked, if omitted.
94
+ --db-region <region> Use the pooler in this region, e.g. eu-central-1.
95
+ --supabase-url <url> https://<ref>.supabase.co — needed to create a user.
96
+ --service-role-key <key> Project Settings → API. Needed to create a user.
97
+
98
+ ${cyan('contact')} add <name> | list — the people and companies the books name.
99
+ ${cyan('invoice')} new | line add <document> — a draft and its lines. Any kind of
100
+ document, with --type; a draft books nothing.
101
+ ${cyan('post')} <document> — book it, through post_document(). --dry-run shows
102
+ the entry the database would write, and writes nothing.
103
+ ${cyan('payment')} record — money in or out, booked and matched.
104
+ ${cyan('match')} <bank transaction> <document> — a statement line pays a document.
105
+ ${cyan('doc')} list | show <document> — what exists, and what is still owed.
106
+
107
+ ${bold('Acting as a person')} ${dim('(login … whoami, and every verb that keeps books — never a service_role key)')}
108
+ --profile <name> Which profile: a demo instance, production, one client
109
+ of a firm. Defaults to the one last signed in to.
110
+ --company <name|id> The company for this one command, over the one in use.
111
+ --supabase-url <url> ${dim('login')} https://<ref>.supabase.co. Read from ekwo.json
112
+ when the working directory has one.
113
+ --anon-key <key> ${dim('login')} The publishable key. Project Settings → API.
114
+ --email <address> ${dim('login')} Who signs in.
115
+ --password <password> ${dim('login')} Prompted, masked, if omitted. Sent to the
116
+ instance once and never written to disk.
117
+
118
+ ${bold('Keeping books')} ${dim('(each verb is one function the MCP server calls too; no rule lives here)')}
119
+ --ref <reference> On what creates — contact add, invoice new, payment
120
+ record. Your own reference: the same one a second
121
+ time returns what the first created, and creates
122
+ nothing. Pass it whenever a call might be repeated.
123
+ --stdin Read one JSON document on the standard input, with
124
+ the fields of the MCP tool of the same meaning.
125
+ The form that is authoritative; flags beside it win.
126
+ --line "k=v,k=v" invoice new, repeatable. Keys: name, price, qty,
127
+ account, tax, product, unit, discount, description.
128
+ Codes, never rates; a comma in a value is \\,.
129
+ --dry-run post. Ask the database what it would write.
130
+ <document> Its id, its number, or the --ref it was created under.
131
+ Amounts are decimal strings, in and out: 1500.00. Nothing is computed here.
132
+
133
+ ${bold('Output')} ${dim('(every command)')}
134
+ --json One JSON document on the standard output, and the
135
+ prose on the standard error. Never asks a question.
136
+ The shape is packages/cli/schema/output.1.json.
137
+ --yes, -y Never ask a question, in either form.
138
+
139
+ Exit codes: 0 done · 1 it failed, or a check found something · 2 the command
140
+ was called wrong · 3 the database refused — a locked period, a capability
141
+ you do not hold. The refusal is printed as the database wrote it.
142
+
143
+ ${bold('ekwo init')}
144
+ --country <cc> Which pack: its chart of accounts and its VAT rules.
145
+ Required unless the terminal can ask, which lists
146
+ the packs this installation holds, by name.
147
+ --org <name> Your organisation. Written on the instance row.
148
+ --company <name> The first company. Defaults to --org.
149
+ --admin-email <address> The first administrator, created in your Supabase Auth.
150
+ --admin-password <pw> Their password. Omitted: an invite link is generated.
151
+ --admin-user-id <uuid> Use an account that already exists instead.
152
+ --fiscal-year <year> Calendar year the first financial year opens in.
153
+ Defaults to this year.
154
+ --fiscal-year-start <d> First day of it, as YYYY-MM-DD. Defaults to the
155
+ month the country pack opens a year on; required
156
+ when the pack names none.
157
+ --language <xx> Language of the books. Defaults to the country pack's.
158
+ --vat-period <cadence> How often the company files its VAT return: month,
159
+ quarter or year. Asked when the country's form
160
+ offers several and the law proposes none.
161
+ --filing-period <c>=<p> The same, for any declaration the country files, by
162
+ the code of its form. Repeatable, one per
163
+ declaration: a company files its return and its
164
+ recapitulative statement on cadences of their own.
165
+ --demo Also load the sample company.
166
+ --register Register without being asked. --register-email sets
167
+ the address; otherwise --admin-email is used.
168
+ --yes, -y Never ask a question. Everything must come from
169
+ flags or the environment.
170
+
171
+ ${bold('ekwo module')}
172
+ list What this release carries, and what the database holds.
173
+ migrate [<cc>] Apply the module migrations and their country seeds.
174
+ enable <code> --company Turn a module on for a company. Prints the schema to
175
+ add to the project's exposed schemas, which no
176
+ migration can do.
177
+ disable <code> --company Turn it off. Nothing the module wrote is deleted.
178
+
179
+ ${bold('ekwo pack')} ${dim('(build, check and list need a checkout of the repository)')}
180
+ build <cc> | --all Compile packs/<cc> into supabase/seed/.
181
+ check <cc> | --all Refuse a seed that is not the output of its pack.
182
+ list The packs this checkout carries.
183
+ status What each company copied, against what is loaded on
184
+ the installation this connects to. Read-only.
185
+ upgrade <company> Move it to the version loaded there. An addition and
186
+ a closed validity are applied; everything else is
187
+ listed and left alone until --apply.
188
+
189
+ ${bold('ekwo company')}
190
+ export <company> --out <dir>
191
+ Write the archive of one company: manifest.json and
192
+ one data/<table>.jsonl per table. Read as a member
193
+ who holds company.export (--as-user, an owner by
194
+ default), under row level security.
195
+ import <dir> Take an archive in, whole or not at all. The
196
+ installer or an administrator of the installation
197
+ (--as-user); --owner names the first owner. A
198
+ company already here is refused.
199
+
200
+ ${bold('Environment')}
201
+ EKWO_DB_URL Same as --db-url. SUPABASE_DB_URL also works.
202
+ EKWO_DB_PASSWORD Same as --db-password.
203
+ SUPABASE_URL Same as --supabase-url.
204
+ SUPABASE_SERVICE_ROLE_KEY Same as --service-role-key.
205
+ SUPABASE_ANON_KEY Same as --anon-key.
206
+ EKWO_EMAIL, EKWO_PASSWORD Sign in for this one command. With SUPABASE_URL and
207
+ SUPABASE_ANON_KEY they come before any profile, and
208
+ nothing is read from or written to the disk: a CI job.
209
+ EKWO_ACCESS_TOKEN The same, with a session token already in hand.
210
+ EKWO_PROFILE Same as --profile.
211
+ EKWO_CONFIG_DIR Where profiles and sessions are kept. Defaults to
212
+ $XDG_CONFIG_HOME/ekwo, else ~/.config/ekwo.
213
+ EKWO_REGISTRY_URL Where registrations are announced.
214
+ NO_COLOR Plain output.
215
+
216
+ ${bold('What this CLI does not do')}
217
+ It does not create or pay for a Supabase project. You create one — the free
218
+ plan is enough — and the CLI connects to it. Your data is on your account
219
+ from the first row, and there is nothing for us to hold back.
220
+
221
+ It never writes a password or a key to disk. The database password and the
222
+ service_role key are read from a flag, the environment or a masked prompt,
223
+ used, and forgotten. ${cyan('ekwo.json')} holds the project URL, the country and the
224
+ schema version, and nothing else. The one thing kept is the session
225
+ ${cyan('ekwo login')} obtains, in your own configuration directory, readable by you
226
+ alone, and refused anywhere inside a repository.
227
+
228
+ It never keeps books with a service_role key. ${cyan('init')} and ${cyan('migrate')} install,
229
+ as the owner of the database, and say so; everything else that touches a
230
+ ledger acts as the person signed in, under row level security.
231
+
232
+ There is no ${cyan('eject')} command, because there is nothing to eject from. The
233
+ schema is in your database, the migrations are in this repository under
234
+ AGPL-3.0, and ${cyan('supabase db push')} applies them without this CLI ever running
235
+ again — the migration history is the one the Supabase CLI writes.
236
+
237
+ ${bold('Docs')} https://github.com/Ekwo-ai/ekwo-os
238
+ `;
239
+ }
240
+ export async function run(argv, deps = {}) {
241
+ let args;
242
+ try {
243
+ args = parseArgs(argv);
244
+ }
245
+ catch (error) {
246
+ return reportFailure('ekwo', askedForJson(argv), error);
247
+ }
248
+ let json;
249
+ try {
250
+ json = boolFlag(args, 'json');
251
+ }
252
+ catch (error) {
253
+ return reportFailure(commandLabel(args), false, error);
254
+ }
255
+ return execute(args, json, async () => {
256
+ if (args.flags.get('version') === true && args.command === undefined) {
257
+ setResult({ version: version() });
258
+ line(version());
259
+ return 0;
260
+ }
261
+ if (args.command === undefined || args.command === 'help' || args.flags.get('help') === true) {
262
+ if (args.command !== undefined && args.command !== 'help' && !isKnown(args.command)) {
263
+ throw new UsageError(`unknown command: ${args.command}`);
264
+ }
265
+ setResult({ version: version(), commands: [...COMMANDS] });
266
+ line(help().trimEnd());
267
+ return 0;
268
+ }
269
+ switch (args.command) {
270
+ case 'init':
271
+ return await initCommand(args, deps);
272
+ case 'migrate':
273
+ return await migrateCommand(args, deps);
274
+ case 'status':
275
+ return await statusCommand(args, deps);
276
+ case 'doctor':
277
+ return await doctorCommand(args, deps);
278
+ case 'module':
279
+ return await moduleCommand(args, deps);
280
+ case 'pack':
281
+ return await packCommand(args, deps);
282
+ case 'company':
283
+ return await companyCommand(args, deps);
284
+ case 'register':
285
+ return await registerCommand(args, deps);
286
+ case 'unregister':
287
+ return await unregisterCommand(args, deps);
288
+ case 'demo':
289
+ return await demoCommand(args, deps);
290
+ case 'login':
291
+ return await loginCommand(args, deps);
292
+ case 'logout':
293
+ return await logoutCommand(args, deps);
294
+ case 'use':
295
+ return await useCommand(args, deps);
296
+ case 'whoami':
297
+ return await whoamiCommand(args, deps);
298
+ case 'contact':
299
+ return await contactCommand(args, deps);
300
+ case 'invoice':
301
+ return await invoiceCommand(args, deps);
302
+ case 'post':
303
+ return await postCommand(args, deps);
304
+ case 'payment':
305
+ return await paymentCommand(args, deps);
306
+ case 'match':
307
+ return await matchCommand(args, deps);
308
+ case 'doc':
309
+ return await docCommand(args, deps);
310
+ default:
311
+ throw new UsageError(`unknown command: ${args.command}\nRun \`ekwo --help\` for the list.`);
312
+ }
313
+ });
314
+ }
315
+ function isKnown(command) {
316
+ return COMMANDS.includes(command);
317
+ }
318
+ //# sourceMappingURL=cli.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"cli.js","sourceRoot":"","sources":["../src/cli.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAE,YAAY,EAAE,MAAM,SAAS,CAAC;AACvC,OAAO,EAAE,aAAa,EAAE,MAAM,UAAU,CAAC;AACzC,OAAO,EAAE,UAAU,EAAE,QAAQ,EAAE,SAAS,EAAmB,MAAM,WAAW,CAAC;AAC7E,OAAO,EAAE,cAAc,EAAE,MAAM,uBAAuB,CAAC;AACvD,OAAO,EAAE,cAAc,EAAE,MAAM,uBAAuB,CAAC;AACvD,OAAO,EAAE,WAAW,EAAE,MAAM,oBAAoB,CAAC;AACjD,OAAO,EAAE,UAAU,EAAE,cAAc,EAAE,WAAW,EAAE,MAAM,wBAAwB,CAAC;AACjF,OAAO,EAAE,aAAa,EAAE,MAAM,sB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,IAAI,EAAE,IAAI,CAAC,CAAC;YACtC;gBACE,MAAM,IAAI,UAAU,CAAC,oBAAoB,IAAI,CAAC,OAAO,qCAAqC,CAAC,CAAC;QAChG,CAAC;IACH,CAAC,CAAC,CAAC;AACL,CAAC;AAED,SAAS,OAAO,CAAC,OAAe;IAC9B,OAAQ,QAA8B,CAAC,QAAQ,CAAC,OAAO,CAAC,CAAC;AAC3D,CAAC"}
@@ -0,0 +1,59 @@
1
+ /**
2
+ * `ekwo company` — one company leaves an installation, and arrives in another.
3
+ *
4
+ * ekwo company export <company> --out <dir> write the archive of one company
5
+ * ekwo company import <dir> take an archive into this installation
6
+ *
7
+ * The archive is a directory: `manifest.json`, and one `data/<schema>.<table>.jsonl`
8
+ * per table, one row per line. `docs/company-archive.md` is the format, and it
9
+ * is written to be read without this CLI.
10
+ *
11
+ * **Exporting runs as a person, under row level security.** The connection the
12
+ * CLI holds belongs to the owner of the database, for whom every company is
13
+ * readable at once — which is exactly what `export_company_table()` refuses.
14
+ * So the export happens inside one transaction that steps down to
15
+ * `authenticated` and carries the claim of the member it acts for, the way
16
+ * PostgREST would have: the schema judges that person, and the snapshot is one
17
+ * snapshot, so the manifest and the rows cannot disagree.
18
+ *
19
+ * **The rows are never parsed here.** They are written as the database wrote
20
+ * them and read back the same way, because a JSON parser that meets `1.50`
21
+ * inside a jsonb column hands back `1.5`, and the checksum of a table is the
22
+ * checksum of its bytes.
23
+ *
24
+ * **Importing is one call.** The files are checked against the manifest first —
25
+ * a file damaged on the way is a finding of this CLI, not a refusal of the
26
+ * books — then handed whole to `import_company()`, which takes all of it or
27
+ * none of it.
28
+ */
29
+ import { type ParsedArgs } from '../args.js';
30
+ import { type CommandDeps } from '../context.js';
31
+ export declare const COMPANY_FLAGS: readonly ["db-url", "db-password", "db-region", "project-ref", "supabase-url", "service-role-key", "out", "as-user", "owner", "yes"];
32
+ export interface ArchiveTable {
33
+ name: string;
34
+ file: string;
35
+ rows: number;
36
+ sha256: string;
37
+ }
38
+ export interface ArchiveManifest {
39
+ format: string;
40
+ format_version: number;
41
+ company: {
42
+ id: string;
43
+ name: string;
44
+ };
45
+ tables: ArchiveTable[];
46
+ files?: {
47
+ transported: boolean;
48
+ list: unknown[];
49
+ };
50
+ [key: string]: unknown;
51
+ }
52
+ export declare function companyCommand(args: ParsedArgs, deps?: CommandDeps): Promise<number>;
53
+ /** Reads an archive directory, checks it against its manifest, and returns it as one JSON text. */
54
+ export declare function readArchive(dir: string): Promise<{
55
+ manifest: ArchiveManifest;
56
+ text: string;
57
+ rows: number;
58
+ }>;
59
+ //# sourceMappingURL=company.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"company.d.ts","sourceRoot":"","sources":["../../src/commands/company.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;GA2BG;AAKH,OAAO,EAA8C,KAAK,UAAU,EAAE,MAAM,YAAY,CAAC;AACzF,OAAO,EAAkC,KAAK,WAAW,EAAE,MAAM,eAAe,CAAC;AAMjF,eAAO,MAAM,aAAa,sIAAmE,CAAC;AAK9F,MAAM,WAAW,YAAY;IAC3B,IAAI,EAAE,MAAM,CAAC;IACb,IAAI,EAAE,MAAM,CAAC;IACb,IAAI,EAAE,MAAM,CAAC;IACb,MAAM,EAAE,MAAM,CAAC;CAChB;AAED,MAAM,WAAW,eAAe;IAC9B,MAAM,EAAE,MAAM,CAAC;IACf,cAAc,EAAE,MAAM,CAAC;IACvB,OAAO,EAAE;QAAE,EAAE,EAAE,MAAM,CAAC;QAAC,IAAI,EAAE,MAAM,CAAA;KAAE,CAAC;IACtC,MAAM,EAAE,YAAY,EAAE,CAAC;IACvB,KAAK,CAAC,EAAE;QAAE,WAAW,EAAE,OAAO,CAAC;QAAC,IAAI,EAAE,OAAO,EAAE,CAAA;KAAE,CAAC;IAClD,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAAC;CACxB;AAED,wBAAsB,cAAc,CAAC,IAAI,EAAE,UAAU,EAAE,IAAI,GAAE,WAAgB,GAAG,OAAO,CAAC,MAAM,CAAC,CAmB9F;AAyFD,mGAAmG;AACnG,wBAAsB,WAAW,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAAC;IAAE,QAAQ,EAAE,eAAe,CAAC;IAAC,IAAI,EAAE,MAAM,CAAC;IAAC,IAAI,EAAE,MAAM,CAAA;CAAE,CAAC,CA+BjH"}