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 @@
1
+ {"version":3,"file":"upgrade.d.ts","sourceRoot":"","sources":["../../src/pack/upgrade.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AAGH,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,WAAW,CAAC;AAE3C,4EAA4E;AAC5E,MAAM,WAAW,iBAAiB;IAChC,SAAS,EAAE,MAAM,CAAC;IAClB,IAAI,EAAE,MAAM,CAAC;IACb,OAAO,EAAE,MAAM,CAAC;IAChB,SAAS,EAAE,MAAM,GAAG,IAAI,CAAC;IACzB,+BAA+B;IAC/B,WAAW,EAAE,MAAM,GAAG,IAAI,CAAC;IAC3B,iFAAiF;IACjF,WAAW,EAAE,MAAM,GAAG,IAAI,CAAC;IAC3B,MAAM,EAAE,OAAO,CAAC;IAChB,gFAAgF;IAChF,WAAW,CAAC,EAAE;QAAE,SAAS,EAAE,MAAM,CAAC;QAAC,QAAQ,EAAE,MAAM,CAAC;QAAC,MAAM,EAAE,MAAM,CAAA;KAAE,CAAC;CACvE;AAED,MAAM,WAAW,gBAAgB;IAC/B,KAAK,EAAE;QAAE,OAAO,EAAE,MAAM,CAAC;QAAC,OAAO,EAAE,MAAM,CAAC;QAAC,IAAI,EAAE,MAAM,CAAA;KAAE,EAAE,CAAC;IAC5D,SAAS,EAAE,iBAAiB,EAAE,CAAC;CAChC;AAED,wCAAwC;AACxC,MAAM,WAAW,UAAU;IACzB,M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
@@ -0,0 +1,76 @@
1
+ /**
2
+ * `ekwo pack status` and `ekwo pack upgrade` — the database half of `pack`.
3
+ *
4
+ * `build`, `check` and `list` read a checkout and touch no database. These two
5
+ * do the opposite: they read an installation and know nothing about `packs/`.
6
+ * The difference between what a company copied and what the installation now
7
+ * holds is computed by the schema — `pack_upgrade_diff()` — and not here, so
8
+ * that an application, a module or an assistant asking the same question gets
9
+ * the same answer.
10
+ */
11
+ import { matchCompany } from '../company.js';
12
+ /**
13
+ * Where every company stands against the packs this installation holds.
14
+ *
15
+ * The differences are counted per company, which is one query each. A company
16
+ * whose country has no pack loaded gets no count rather than a zero: nothing
17
+ * is known about it, and a zero would read as "up to date".
18
+ */
19
+ export async function packStatus(db) {
20
+ const packs = await db.query('select country, version, name from country_packs order by country');
21
+ const companies = await db.query(`select c.id as company_id, c.name, c.country, cp.chart_code,
22
+ cp.version as held_version, p.version as pack_version
23
+ from companies c
24
+ left join company_packs cp on cp.company_id = c.id and cp.country = c.country
25
+ left join country_packs p on p.country = c.country
26
+ order by c.name`);
27
+ const report = [];
28
+ for (const row of companies) {
29
+ const entry = {
30
+ companyId: row.company_id,
31
+ name: row.name,
32
+ country: row.country,
33
+ chartCode: row.chart_code,
34
+ heldVersion: row.held_version,
35
+ packVersion: row.pack_version,
36
+ behind: row.held_version !== null && row.pack_version !== null && row.held_version !== row.pack_version,
37
+ };
38
+ if (row.held_version !== null && row.pack_version !== null) {
39
+ const counts = await db.query(`select rule::text as rule, count(*)::text as count
40
+ from pack_upgrade_diff($1) group by rule`, [row.company_id]);
41
+ const at = (rule) => Number(counts.find((c) => c.rule === rule)?.count ?? '0');
42
+ entry.differences = {
43
+ additions: at('addition'),
44
+ closures: at('closure'),
45
+ review: at('review'),
46
+ };
47
+ }
48
+ report.push(entry);
49
+ }
50
+ return { packs, companies: report };
51
+ }
52
+ /**
53
+ * The company a name or an id refers to.
54
+ *
55
+ * A name is what an operator types and a uuid is what a script passes, so both
56
+ * are accepted; an ambiguous name is refused rather than resolved to the first
57
+ * match, because upgrading the wrong company is not a mistake anybody notices
58
+ * the same day.
59
+ */
60
+ export async function resolveCompany(db, wanted) {
61
+ const companies = await db.query('select id::text as id, name from companies order by name');
62
+ // The matching is in one place, where `ekwo use` reads it too.
63
+ return matchCompany(companies, wanted);
64
+ }
65
+ export async function packUpgrade(db, companyId, options = {}) {
66
+ const rows = await db.query('select pack_upgrade($1, $2, $3) as pack_upgrade', [companyId, options.country ?? null, options.apply === true]);
67
+ const result = rows[0]?.pack_upgrade;
68
+ if (result === undefined)
69
+ throw new Error('pack_upgrade returned nothing');
70
+ return result;
71
+ }
72
+ /** What would change, without changing it. */
73
+ export async function packDiff(db, companyId, country) {
74
+ return db.query('select object, key, change, rule::text as rule, detail from pack_upgrade_diff($1, $2)', [companyId, country ?? null]);
75
+ }
76
+ //# sourceMappingURL=upgrade.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"upgrade.js","sourceRoot":"","sources":["../../src/pack/upgrade.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AAEH,OAAO,EAAE,YAAY,EAAE,MAAM,eAAe,CAAC;AA4C7C;;;;;;GAMG;AACH,MAAM,CAAC,KAAK,UAAU,UAAU,CAAC,EAAa;IAC5C,MAAM,KAAK,GAAG,MAAM,EAAE,CAAC,KAAK,CAC1B,mEAAmE,CACpE,CAAC;IAEF,MAAM,SAAS,GAAG,MAAM,EAAE,CAAC,KAAK,CAQ9B;;;;;sBAKkB,CACnB,CAAC;IAEF,MAAM,MAAM,GAAwB,EAAE,CAAC;IACvC,KAAK,MAAM,GAAG,IAAI,SAAS,EAAE,CAAC;QAC5B,MAAM,KAAK,GAAsB;YAC/B,SAAS,EAAE,GAAG,CAAC,UAAU;YACzB,IAAI,EAAE,GAAG,CAAC,IAAI;YACd,OAAO,EAAE,GAAG,CAAC,OAAO;YACpB,SAAS,EAAE,GAAG,CAAC,UAAU;YACzB,WAAW,EAAE,GAAG,CAAC,YAAY;YAC7B,WAAW,EAA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AC,KAAK,CACzB,iDAAiD,EACjD,CAAC,SAAS,EAAE,OAAO,CAAC,OAAO,IAAI,IAAI,EAAE,OAAO,CAAC,KAAK,KAAK,IAAI,CAAC,CAC7D,CAAC;IACF,MAAM,MAAM,GAAG,IAAI,CAAC,CAAC,CAAC,EAAE,YAAY,CAAC;IACrC,IAAI,MAAM,KAAK,SAAS;QAAE,MAAM,IAAI,KAAK,CAAC,+BAA+B,CAAC,CAAC;IAC3E,OAAO,MAAM,CAAC;AAChB,CAAC;AAED,8CAA8C;AAC9C,MAAM,CAAC,KAAK,UAAU,QAAQ,CAC5B,EAAa,EACb,SAAiB,EACjB,OAAgB;IAEhB,OAAO,EAAE,CAAC,KAAK,CACb,uFAAuF,EACvF,CAAC,SAAS,EAAE,OAAO,IAAI,IAAI,CAAC,CAC7B,CAAC;AACJ,CAAC"}
@@ -0,0 +1,273 @@
1
+ /**
2
+ * What a treatment obliges a tax to say on an invoice, and where.
3
+ *
4
+ * A tax carries three things that are three tellings of one fact: its
5
+ * `treatment`, which is Ekwo's own word for what the operation is; its
6
+ * `vat_category`, which is BT-118 and BT-151 of EN 16931, taken from the
7
+ * UNCL5305 subset the standard publishes; and its `exemption_code`, which is
8
+ * BT-121, taken from the VATEX list. Nothing until now compared them, so a
9
+ * pack could declare an export taxed at the standard rate, or an
10
+ * intra-Community supply with the reverse-charge reason code, and every test
11
+ * in the repository would pass — because neither column is read by the ledger
12
+ * or by the declaration. They are read by whoever renders the invoice, which
13
+ * is the one reader that is not in this repository.
14
+ *
15
+ * The tables below are transcribed, not decided. Three sources say all of it:
16
+ *
17
+ * - **UNCL5305 (UN/CEFACT D.16B, OpenPEPPOL subset)** for what each category
18
+ * code means. `K` is *VAT exempt for EEA intra-community supply of goods and
19
+ * services* — goods **and services**, which is what settles the question the
20
+ * Ekwo vocabulary asks twice; `AE` is *VAT reverse charge*; `G` is *free
21
+ * export item, VAT not charged*; `O` is *services outside scope of tax*.
22
+ * - **Technical guidance for tax codes in EN 16931, version 1** (European
23
+ * Commission, Technical Advisory Group on Electronic Invoicing, use cases
24
+ * dated 1 July 2024), whose six use cases give the pair to use for each
25
+ * case: exemption in general `E` + a VATEX code, intra-Community supply
26
+ * between Member States `K` + `VATEX-EU-IC`, reverse charge **within** a
27
+ * Member State `AE` + `VATEX-EU-AE`, and the case it calls export outside the
28
+ * Union `G` + `VATEX-EU-G` — which is the Union's border because the seller
29
+ * the guidance addresses is established in a Member State. What UNCL5305
30
+ * itself says of `G` is *free export item, VAT not charged*: the goods leave
31
+ * the territory of whoever levies the tax.
32
+ * - **The VATEX code list itself**, which carries the pairing as a remark on
33
+ * eight of its codes: `VATEX-EU-AE` *only use with category code AE*,
34
+ * `VATEX-EU-IC` with `K`, `VATEX-EU-G` with `G`, `VATEX-EU-O` with `O`, and
35
+ * `VATEX-EU-D`, `-F`, `-I`, `-J` with `E`.
36
+ *
37
+ * Four decisions were taken where the sources leave a choice, and all four are
38
+ * written up in `docs/packs.md`.
39
+ *
40
+ * **The table above is the Union's, and it applies where the Union's VAT
41
+ * does.** EN 16931 is a European standard and the VATEX list is published by
42
+ * the European Commission: its own codes name articles of Directive
43
+ * 2006/112/EC and its national codes belong to Member States that publish
44
+ * them. A pack for a country the common system does not reach may therefore
45
+ * carry no code from it — `VATEX-EU-G` on an export from a third country
46
+ * claims an article of the Directive that does not bind the seller — and what
47
+ * an exempt line states there is its own article, in `legal_reference`, with
48
+ * BT-121 left empty. The categories are unaffected: UNCL5305 is a UN/CEFACT
49
+ * list, `E`, `G`, `O` and `AE` keep their meanings, and a pack outside the
50
+ * Union goes on being held to them. The treatments of the common system
51
+ * itself — the five `intracom_*` values — are refused there outright, because
52
+ * an intra-Community supply is an operation of a system the country is not in.
53
+ * Whether it is in it is not a fact this file holds: it is a row of
54
+ * `territories`, read through `./territories.js`, on the day the pack's
55
+ * manifest says it speaks of.
56
+ *
57
+ * **A category is required where a category is read.** The rule above says
58
+ * what a category may be, and it holds everywhere. What does not is the
59
+ * obligation to name one: BT-151 is a term of an invoice governed by EN 16931,
60
+ * and the first pack of a country that levies no value added tax was asked for
61
+ * one on every tax that can reach a sale although no American invoice carries
62
+ * the field, no administration there publishes a category list, and nobody
63
+ * would have read the answer. So the requirement is asked where the invoice
64
+ * exists — inside the common system, or where the pack declares an e-invoicing
65
+ * profile, each of which carries BT-151 — and `readsCategories` is the
66
+ * caller's answer. Outside both, the column is free and everything it may say
67
+ * is unchanged: a value that contradicts the treatment is refused there
68
+ * exactly as it is here. This is the same border ST38-1 drew for the reason
69
+ * code, one field over: the Union's lists reach the packs the Union's law
70
+ * reaches.
71
+ *
72
+ * **A category is a term of the invoice, so on a purchase it is the
73
+ * supplier's.** An Ekwo purchase tax describes how the buyer books and
74
+ * declares somebody else's invoice; BT-151 on that invoice was chosen by the
75
+ * seller. An intra-Community acquisition is therefore `K`, because the
76
+ * supplier made an intra-Community supply and rule BR-IC-10 binds them to `K`
77
+ * and `VATEX-EU-IC` — not `AE`, which is the guidance's case for a reverse
78
+ * charge *within* one Member State. A pack that does not want to record the
79
+ * seller's category may leave it null on a purchase-only tax; a value that
80
+ * contradicts the treatment is refused either way.
81
+ *
82
+ * **Where no invoice governed by the standard exists, the category is
83
+ * absent.** An import of goods is assessed on a customs document, and a
84
+ * service received from a supplier the Union's rules do not reach comes on an
85
+ * invoice the Directive does not govern. There is no seller's category to
86
+ * record, so `import` and `foreign_services_received` carry none: `S` there
87
+ * would claim the supplier levied the standard rate, which is the one thing
88
+ * that certainly did not happen.
89
+ *
90
+ * **A triangular supply is `K`, not `AE`.** The guidance gives `AE` for a
91
+ * reverse charge *within* one Member State, where the supplier is established
92
+ * in the buyer's country and national law moves the liability. The middle
93
+ * supply of a triangular arrangement is the opposite shape: the goods leave
94
+ * the seller's State, article 141 of Directive 2006/112/EC relieves the seller
95
+ * of registering where they arrive, and article 197 puts the tax on a customer
96
+ * in a third State. What the line is, in the words of UNCL5305, is *VAT exempt
97
+ * for EEA intra-community supply of goods and services* — `K`, with
98
+ * `VATEX-EU-IC`, which the VATEX list reserves for it. That the *sentence* on
99
+ * that invoice is the reverse-charge one is a different question in a different
100
+ * vocabulary, and it is answered by `applies_when`.
101
+ *
102
+ * The rate is checked on the sale side only. On a sale the pack's `rate` is
103
+ * the BT-152 the seller prints, and the business rules of EN 16931 fix it per
104
+ * category — BR-S-05 wants a standard-rated line above zero, BR-Z-05,
105
+ * BR-E-05, BR-AE-05, BR-IC-05, BR-G-05 and BR-O-05 want zero everywhere else.
106
+ * On a purchase the rate is the one the buyer self-assesses at, which is
107
+ * 21 % on a line the supplier invoiced at zero, so the same rule applied there
108
+ * would refuse every reverse charge in every pack.
109
+ *
110
+ * What this does **not** do is hold a copy of the VATEX list. The list grows,
111
+ * two published renderings of it already disagree on which codes it holds, and
112
+ * a code this file has not heard of is not a contradiction — it is a code this
113
+ * file has not heard of. So an exemption code is checked for its shape, and
114
+ * for the pairings the list itself states.
115
+ *
116
+ * The same limit applies to the other end. No country outside the Union
117
+ * publishes a list of exemption reason codes today; one may, and PINT is where
118
+ * it would surface. So the field is provided for and the content is not: a pack
119
+ * outside the common system may carry a reason code that is not a VATEX one,
120
+ * on the condition that its register declares a published list — the entry of
121
+ * `certification.sources` that says so of itself, with `reason_codes`. What is
122
+ * checked is that a list is named, not that the code is in it, which is exactly
123
+ * what is checked of a VATEX code inside the Union.
124
+ *
125
+ * That flag is new and it closes a trap. `reasonList` used to be the title of
126
+ * the **first** entry whose `kind` was `standard`, and `standard` means "a
127
+ * technical norm or code list" — which the FASB Accounting Standards
128
+ * Codification and FRS 102 both are. Naming an accounting standard therefore
129
+ * authorised a reason code on any tax of the pack, silently, in declaration
130
+ * order. No pack ever carried one and nothing wrong was emitted; an entry now
131
+ * says which list it is, and `ekwo pack check` refuses a second one.
132
+ */
133
+ /** What one treatment may be declared on, and what its invoice may say. */
134
+ export interface TreatmentCodes {
135
+ /**
136
+ * The sides of a document the treatment exists on. A tax whose `scope` is
137
+ * `both` is never refused here: `both` says the pack has not narrowed it.
138
+ */
139
+ scopes: ('sale' | 'purchase')[];
140
+ /**
141
+ * The categories the invoice may carry. Empty where no invoice governed by
142
+ * EN 16931 exists, in which case the column has to stay null.
143
+ */
144
+ categories: string[];
145
+ /** Why, in the words of the source, for the message. */
146
+ because: string;
147
+ /**
148
+ * True where the treatment is an operation of the common system of VAT and
149
+ * exists nowhere else — the five `intracom_*` values, which name a supply
150
+ * between two Member States. A pack for a country the system does not reach
151
+ * is refused one of these before anything else about it is looked at.
152
+ */
153
+ commonSystem?: true;
154
+ /**
155
+ * True where the operation is a supply or an acquisition of **goods**, and
156
+ * not of services.
157
+ *
158
+ * Only one territory has ever needed the distinction and it is the one the
159
+ * Withdrawal Agreement invented: `eu_vat_scope` of `XI` is `goods`, so the
160
+ * common system reaches a tax applying in Northern Ireland exactly where its
161
+ * treatment is marked here and nowhere else. Everywhere the scope is `full`
162
+ * or `none` this field is not read.
163
+ */
164
+ goods?: true;
165
+ }
166
+ /**
167
+ * Treatment to category, keyed by the values of the `tax_treatment` enum.
168
+ *
169
+ * A treatment missing from here is a gap the check cannot see, so
170
+ * `tests/vat_codes.test.ts` asks the database for the enum and refuses a
171
+ * value this table does not cover.
172
+ */
173
+ export declare const TREATMENT_CODES: Record<string, TreatmentCodes>;
174
+ /** What a category obliges the exemption reason to be. */
175
+ interface CategoryCodes {
176
+ /** The one code the VATEX list reserves for this category, where it does. */
177
+ exemption: string | null;
178
+ /** A reason is required. False where the line is taxed and has none. */
179
+ needsReason: boolean;
180
+ /** The rate a sale of this category carries: above zero, or exactly zero. */
181
+ rate: 'positive' | 'zero';
182
+ /** The business rule of EN 16931 that fixes the rate. */
183
+ rateRule: string;
184
+ }
185
+ /**
186
+ * Category to exemption reason and to rate.
187
+ *
188
+ * The four reserved codes are the pairings the VATEX list publishes as a
189
+ * remark on the code itself. `E` takes any other reason, because the whole
190
+ * point of the general case is that the seller picks the article.
191
+ */
192
+ export declare const CATEGORY_CODES: Record<string, CategoryCodes>;
193
+ /** One tax, as much of it as this check reads. */
194
+ export interface TaxCodes {
195
+ code: string;
196
+ scope: string;
197
+ amount_type: string;
198
+ rate: number;
199
+ treatment: string;
200
+ vat_category: string | null;
201
+ exemption_code: string | null;
202
+ /**
203
+ * The article the tax claims. Outside the common system it is what an exempt
204
+ * line has instead of a reason code, so the check reads it there.
205
+ */
206
+ legal_reference?: string | null;
207
+ }
208
+ /**
209
+ * Which VAT a pack's country levies, as far as these three lists are concerned.
210
+ *
211
+ * Resolved by the caller, because the answer is a row of `territories` and a
212
+ * date out of the manifest, and neither belongs in a table of code lists.
213
+ * `because` is quoted verbatim in every refusal that turns on it, so a reader
214
+ * of the message is told the country, the day and the scope rather than being
215
+ * left to guess why a code they read in the standard was refused.
216
+ */
217
+ export interface VatRegime {
218
+ /** Whether the common system of VAT reached the country on the day the pack speaks of. */
219
+ commonSystem: boolean;
220
+ /** Said in the words of the table, for the message. */
221
+ because: string;
222
+ /**
223
+ * Whether an invoice this country's sellers issue carries BT-151 at all.
224
+ *
225
+ * The categories themselves are UNCL5305, a UN/CEFACT list, and they hold
226
+ * everywhere: an export is `G` in California as in Belgium, and a value that
227
+ * contradicts the treatment is refused wherever the pack is. What does not
228
+ * hold everywhere is the *requirement*. BT-151 is a term of an invoice
229
+ * governed by EN 16931, and a country outside the common system of VAT whose
230
+ * sellers issue no such invoice has no seller's category to demand: the
231
+ * requirement would be a European standard asking a question nobody reads
232
+ * the answer to. So it is asked where a category is read — inside the common
233
+ * system, or where the pack declares an e-invoicing profile, every one of
234
+ * which carries BT-151 — and a pack that issues no standardised invoice may
235
+ * leave the column null, the way a purchase-only tax already may.
236
+ *
237
+ * Resolved by the caller, because the answer is a row of `territories` and a
238
+ * field of the manifest, neither of which belongs in a table of code lists.
239
+ */
240
+ readsCategories: boolean;
241
+ /**
242
+ * The published list of reason codes the pack's register declares — the
243
+ * title of the entry of `certification.sources` that says so of itself, with
244
+ * `reason_codes`. Null where the pack declares none, which outside the Union
245
+ * means BT-121 has no list to come from and stays empty.
246
+ */
247
+ reasonList: string | null;
248
+ }
249
+ /**
250
+ * The regime every pack was held to until a country outside the Union arrived.
251
+ *
252
+ * The default of `taxCodes`, so that a caller with no opinion gets the table as
253
+ * the European Commission publishes it. `readPack` always has an opinion.
254
+ */
255
+ export declare const COMMON_SYSTEM: VatRegime;
256
+ /** A problem, in the shape `readPack` collects. */
257
+ export interface CodeIssue {
258
+ path: string;
259
+ message: string;
260
+ }
261
+ /**
262
+ * The taxes of a pack, against the three code lists.
263
+ *
264
+ * Every refusal names the tax, the treatment, what the tax says, what the
265
+ * source says instead, and the source. A pack author who has never read
266
+ * EN 16931 should be able to fix the line from the message alone.
267
+ *
268
+ * `regime` says whether the Union's own lists reach this pack at all. It
269
+ * defaults to the case every pack was in before a third country arrived.
270
+ */
271
+ export declare function taxCodes(taxes: TaxCodes[], regime?: VatRegime | ((tax: TaxCodes) => VatRegime)): CodeIssue[];
272
+ export {};
273
+ //# sourceMappingURL=vat-codes.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"vat-codes.d.ts","sourceRoot":"","sources":["../../src/pack/vat-codes.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAmIG;AAOH,2EAA2E;AAC3E,MAAM,WAAW,cAAc;IAC7B;;;OAGG;IACH,MAAM,EAAE,CAAC,MAAM,GAAG,UAAU,CAAC,EAAE,CAAC;IAChC;;;OAGG;IACH,UAAU,EAAE,MAAM,EAAE,CAAC;IACrB,wDAAwD;IACxD,OAAO,EAAE,MAAM,CAAC;IAChB;;;;;OAKG;IACH,YAAY,CAAC,EAAE,IAAI,CAAC;IACpB;;;;;;;;;OASG;IACH,KAAK,CAAC,EAAE,IAAI,CAAC;CACd;AAED;;;;;;GAMG;AACH,eAAO,MAAM,eAAe,EAAE,MAAM,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