ekwo-os 0.12.0 → 0.12.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +1 -1
- package/dist/assets/expected-objects.json +301 -3
- package/dist/assets/migrations/20261010160429_an_invoice_wears_the_colour_of_its_company.sql +38 -0
- package/dist/assets/migrations/20261010203452_a_filing_file_is_read_as_a_filing.sql +95 -0
- package/dist/assets/migrations/20261011081256_a_balance_sheet_before_the_close.sql +450 -0
- package/dist/assets/migrations/20261011082857_schema_version_0_12_1.sql +38 -0
- package/dist/assets/migrations/20261011120000_the_result_in_progress_under_its_line.sql +429 -0
- package/dist/assets/migrations/20261011154807_a_bank_line_is_settled_by_its_function.sql +273 -0
- package/dist/assets/migrations/20261011155443_a_matching_settles_one_counterparty.sql +422 -0
- package/dist/assets/migrations/20261011155947_a_box_is_written_by_its_posting.sql +109 -0
- package/dist/assets/migrations/20261011160431_a_line_keeps_the_boxes_it_was_posted_in.sql +467 -0
- package/dist/assets/migrations/20261011163457_schema_version_0_12_2.sql +42 -0
- package/dist/assets/modules/corporate-tax/module.json +4 -3
- package/dist/assets/modules/corporate-tax/supabase/migrations/20261010073000_tax_provision_and_prepayments.sql +610 -0
- package/dist/assets/seed/05_framework_generic.sql +7 -4
- package/dist/assets/seed/100_pack_uy.sql +9 -6
- package/dist/assets/seed/101_pack_ec.sql +23 -8
- package/dist/assets/seed/102_pack_bo.sql +9 -6
- package/dist/assets/seed/103_pack_py.sql +38 -23
- package/dist/assets/seed/104_pack_do.sql +9 -6
- package/dist/assets/seed/105_pack_cr.sql +19 -8
- package/dist/assets/seed/106_pack_gt.sql +9 -6
- package/dist/assets/seed/107_pack_pa.sql +17 -6
- package/dist/assets/seed/108_pack_in.sql +8 -5
- package/dist/assets/seed/109_pack_cn.sql +8 -5
- package/dist/assets/seed/10_pack_be.sql +9 -6
- package/dist/assets/seed/110_pack_ge.sql +23 -10
- package/dist/assets/seed/111_pack_md.sql +8 -5
- package/dist/assets/seed/112_pack_rs.sql +8 -5
- package/dist/assets/seed/113_pack_ba.sql +16 -6
- package/dist/assets/seed/114_pack_al.sql +8 -5
- package/dist/assets/seed/115_pack_mk.sql +23 -8
- package/dist/assets/seed/116_pack_me.sql +8 -5
- package/dist/assets/seed/117_pack_bh.sql +8 -5
- package/dist/assets/seed/118_pack_om.sql +8 -5
- package/dist/assets/seed/119_pack_gh.sql +17 -6
- package/dist/assets/seed/11_pack_fr.sql +16 -6
- package/dist/assets/seed/120_pack_tz.sql +8 -5
- package/dist/assets/seed/121_pack_ug.sql +8 -5
- package/dist/assets/seed/122_pack_rw.sql +8 -5
- package/dist/assets/seed/123_pack_xk.sql +8 -5
- package/dist/assets/seed/124_pack_kz.sql +18 -6
- package/dist/assets/seed/125_pack_pk.sql +23 -6
- package/dist/assets/seed/126_pack_bd.sql +8 -5
- package/dist/assets/seed/127_pack_lk.sql +9 -6
- package/dist/assets/seed/128_pack_am.sql +19 -7
- package/dist/assets/seed/129_pack_az.sql +24 -9
- package/dist/assets/seed/12_pack_lu.sql +8 -5
- package/dist/assets/seed/130_pack_hn.sql +9 -6
- package/dist/assets/seed/131_pack_sv.sql +21 -8
- package/dist/assets/seed/132_pack_ni.sql +20 -7
- package/dist/assets/seed/133_pack_et.sql +19 -7
- package/dist/assets/seed/134_pack_mu.sql +8 -5
- package/dist/assets/seed/135_pack_mz.sql +8 -5
- package/dist/assets/seed/136_pack_ao.sql +8 -5
- package/dist/assets/seed/137_pack_zm.sql +8 -5
- package/dist/assets/seed/138_pack_bm.sql +8 -5
- package/dist/assets/seed/139_pack_ky.sql +8 -5
- package/dist/assets/seed/13_pack_ee.sql +8 -5
- package/dist/assets/seed/140_pack_vg.sql +8 -5
- package/dist/assets/seed/141_pack_gg.sql +8 -5
- package/dist/assets/seed/142_pack_qa.sql +8 -5
- package/dist/assets/seed/143_pack_kw.sql +8 -5
- package/dist/assets/seed/144_pack_bn.sql +8 -5
- package/dist/assets/seed/145_pack_mo.sql +8 -5
- package/dist/assets/seed/146_pack_je.sql +8 -5
- package/dist/assets/seed/147_pack_zw.sql +8 -5
- package/dist/assets/seed/14_pack_gb.sql +8 -5
- package/dist/assets/seed/15_pack_us.sql +11 -6
- package/dist/assets/seed/16_pack_ie.sql +8 -5
- package/dist/assets/seed/17_pack_nl.sql +8 -5
- package/dist/assets/seed/18_pack_de.sql +8 -5
- package/dist/assets/seed/19_pack_es.sql +8 -5
- package/dist/assets/seed/20_pack_sn.sql +8 -5
- package/dist/assets/seed/21_pack_ci.sql +8 -5
- package/dist/assets/seed/22_pack_bj.sql +17 -8
- package/dist/assets/seed/23_pack_bf.sql +8 -5
- package/dist/assets/seed/24_pack_cm.sql +16 -7
- package/dist/assets/seed/25_pack_cf.sql +16 -7
- package/dist/assets/seed/26_pack_km.sql +8 -5
- package/dist/assets/seed/27_pack_cg.sql +18 -7
- package/dist/assets/seed/28_pack_ga.sql +8 -5
- package/dist/assets/seed/29_pack_gn.sql +16 -7
- package/dist/assets/seed/30_pack_gw.sql +8 -5
- package/dist/assets/seed/31_pack_gq.sql +8 -5
- package/dist/assets/seed/32_pack_ml.sql +16 -7
- package/dist/assets/seed/33_pack_ne.sql +16 -7
- package/dist/assets/seed/34_pack_cd.sql +16 -7
- package/dist/assets/seed/35_pack_td.sql +18 -7
- package/dist/assets/seed/36_pack_tg.sql +8 -5
- package/dist/assets/seed/37_pack_it.sql +8 -5
- package/dist/assets/seed/38_pack_id.sql +8 -5
- package/dist/assets/seed/39_pack_my.sql +10 -7
- package/dist/assets/seed/40_pack_au.sql +8 -5
- package/dist/assets/seed/41_pack_nz.sql +8 -5
- package/dist/assets/seed/42_pack_mx.sql +16 -6
- package/dist/assets/seed/43_pack_pt.sql +31 -14
- package/dist/assets/seed/44_pack_ph.sql +8 -5
- package/dist/assets/seed/45_pack_ar.sql +8 -5
- package/dist/assets/seed/46_pack_cl.sql +8 -5
- package/dist/assets/seed/47_pack_co.sql +20 -7
- package/dist/assets/seed/48_pack_pe.sql +20 -6
- package/dist/assets/seed/49_pack_ng.sql +20 -7
- package/dist/assets/seed/50_pack_sg.sql +8 -5
- package/dist/assets/seed/51_pack_jp.sql +8 -5
- package/dist/assets/seed/52_pack_hk.sql +8 -5
- package/dist/assets/seed/53_pack_tw.sql +16 -6
- package/dist/assets/seed/54_pack_kr.sql +27 -14
- package/dist/assets/seed/55_pack_vn.sql +18 -6
- package/dist/assets/seed/56_pack_th.sql +8 -5
- package/dist/assets/seed/57_pack_ua.sql +26 -10
- package/dist/assets/seed/58_pack_ca.sql +8 -5
- package/dist/assets/seed/60_pack_ae.sql +8 -5
- package/dist/assets/seed/61_pack_se.sql +8 -5
- package/dist/assets/seed/62_pack_ch.sql +8 -5
- package/dist/assets/seed/63_pack_at.sql +8 -5
- package/dist/assets/seed/64_pack_pl.sql +19 -16
- package/dist/assets/seed/65_pack_dk.sql +8 -5
- package/dist/assets/seed/66_pack_no.sql +31 -26
- package/dist/assets/seed/67_pack_fi.sql +8 -5
- package/dist/assets/seed/68_pack_cz.sql +29 -8
- package/dist/assets/seed/69_pack_sk.sql +8 -5
- package/dist/assets/seed/70_pack_hu.sql +8 -5
- package/dist/assets/seed/71_pack_sa.sql +8 -5
- package/dist/assets/seed/72_pack_ro.sql +8 -5
- package/dist/assets/seed/73_pack_bg.sql +13 -10
- package/dist/assets/seed/74_pack_hr.sql +22 -19
- package/dist/assets/seed/75_pack_si.sql +8 -5
- package/dist/assets/seed/76_pack_gr.sql +29 -8
- package/dist/assets/seed/77_pack_lt.sql +8 -5
- package/dist/assets/seed/78_pack_lv.sql +29 -8
- package/dist/assets/seed/79_pack_cy.sql +8 -5
- package/dist/assets/seed/80_pack_mt.sql +8 -5
- package/dist/assets/seed/81_pack_is.sql +8 -5
- package/dist/assets/seed/82_pack_tr.sql +8 -5
- package/dist/assets/seed/83_pack_eg.sql +8 -5
- package/dist/assets/seed/84_pack_ma.sql +31 -14
- package/dist/assets/seed/85_pack_tn.sql +8 -5
- package/dist/assets/seed/86_pack_dz.sql +18 -8
- package/dist/assets/seed/87_pack_il.sql +8 -5
- package/dist/assets/seed/88_pack_za.sql +8 -5
- package/dist/assets/seed/89_pack_ke.sql +8 -5
- package/dist/assets/seed/90_demo_company.sql +6 -0
- package/dist/assets/seed/modules/corporate_tax/11_pack_fr.sql +3 -2
- package/dist/assets/seed/modules/corporate_tax/15_pack_us.sql +1 -1
- package/dist/assets/seed/modules/corporate_tax/42_pack_mx.sql +1 -1
- package/dist/assets/seed/modules/corporate_tax/49_pack_ng.sql +1 -1
- package/dist/assets/seed/modules/fixed_assets/11_pack_fr.sql +1 -1
- package/dist/assets/seed/modules/fixed_assets/15_pack_us.sql +1 -1
- package/dist/assets/seed/modules/fixed_assets/42_pack_mx.sql +1 -1
- package/dist/assets/seed/modules/fixed_assets/49_pack_ng.sql +1 -1
- package/dist/cli.js +1 -1
- package/dist/cli.js.map +1 -1
- package/dist/commands/import.js +2 -1
- package/dist/commands/import.js.map +1 -1
- package/dist/commands/pack.js +4 -0
- package/dist/commands/pack.js.map +1 -1
- package/dist/pack/compile.d.ts.map +1 -1
- package/dist/pack/compile.js +7 -6
- package/dist/pack/compile.js.map +1 -1
- package/dist/pack/describe.d.ts +5 -0
- package/dist/pack/describe.d.ts.map +1 -1
- package/dist/pack/describe.js +4 -0
- package/dist/pack/describe.js.map +1 -1
- package/dist/pack/read.d.ts +46 -0
- package/dist/pack/read.d.ts.map +1 -1
- package/dist/pack/read.js +253 -0
- package/dist/pack/read.js.map +1 -1
- package/dist/schema.d.ts +1 -1
- package/dist/schema.js +1 -1
- package/package.json +3 -3
- package/schema/output.1.json +1 -0
package/README.md
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
|
-
"schemaVersion": "0.12.
|
|
3
|
-
"migration": "
|
|
2
|
+
"schemaVersion": "0.12.2",
|
|
3
|
+
"migration": "20261011163457",
|
|
4
4
|
"socle": {
|
|
5
5
|
"schema": "public",
|
|
6
6
|
"tables": [
|
|
@@ -793,6 +793,14 @@
|
|
|
793
793
|
"name": "id",
|
|
794
794
|
"type": "uuid"
|
|
795
795
|
},
|
|
796
|
+
{
|
|
797
|
+
"name": "invoice_accent_color",
|
|
798
|
+
"type": "text"
|
|
799
|
+
},
|
|
800
|
+
{
|
|
801
|
+
"name": "invoice_logo_position",
|
|
802
|
+
"type": "text"
|
|
803
|
+
},
|
|
796
804
|
{
|
|
797
805
|
"name": "language",
|
|
798
806
|
"type": "character(2)"
|
|
@@ -2232,6 +2240,10 @@
|
|
|
2232
2240
|
"name": "declaration_box",
|
|
2233
2241
|
"type": "text"
|
|
2234
2242
|
},
|
|
2243
|
+
{
|
|
2244
|
+
"name": "declaration_boxes",
|
|
2245
|
+
"type": "text[]"
|
|
2246
|
+
},
|
|
2235
2247
|
{
|
|
2236
2248
|
"name": "declared_on",
|
|
2237
2249
|
"type": "date"
|
|
@@ -2260,6 +2272,10 @@
|
|
|
2260
2272
|
"name": "posting_type",
|
|
2261
2273
|
"type": "tax_posting_type"
|
|
2262
2274
|
},
|
|
2275
|
+
{
|
|
2276
|
+
"name": "report_code",
|
|
2277
|
+
"type": "text"
|
|
2278
|
+
},
|
|
2263
2279
|
{
|
|
2264
2280
|
"name": "sequence",
|
|
2265
2281
|
"type": "integer"
|
|
@@ -3062,6 +3078,18 @@
|
|
|
3062
3078
|
"name": "name_i18n",
|
|
3063
3079
|
"type": "jsonb"
|
|
3064
3080
|
},
|
|
3081
|
+
{
|
|
3082
|
+
"name": "result_in_progress",
|
|
3083
|
+
"type": "text"
|
|
3084
|
+
},
|
|
3085
|
+
{
|
|
3086
|
+
"name": "result_in_progress_name",
|
|
3087
|
+
"type": "text"
|
|
3088
|
+
},
|
|
3089
|
+
{
|
|
3090
|
+
"name": "result_in_progress_name_i18n",
|
|
3091
|
+
"type": "jsonb"
|
|
3092
|
+
},
|
|
3065
3093
|
{
|
|
3066
3094
|
"name": "source_key",
|
|
3067
3095
|
"type": "text"
|
|
@@ -3905,6 +3933,10 @@
|
|
|
3905
3933
|
"name": "assert_writes_into_known_company",
|
|
3906
3934
|
"arguments": "p_company_id uuid"
|
|
3907
3935
|
},
|
|
3936
|
+
{
|
|
3937
|
+
"name": "attachment_is_filing_deposit_file",
|
|
3938
|
+
"arguments": "p_attachment_id uuid"
|
|
3939
|
+
},
|
|
3908
3940
|
{
|
|
3909
3941
|
"name": "audit_changes",
|
|
3910
3942
|
"arguments": ""
|
|
@@ -3965,6 +3997,10 @@
|
|
|
3965
3997
|
"name": "bank_statements_refresh_balance",
|
|
3966
3998
|
"arguments": ""
|
|
3967
3999
|
},
|
|
4000
|
+
{
|
|
4001
|
+
"name": "bank_transactions_guard",
|
|
4002
|
+
"arguments": ""
|
|
4003
|
+
},
|
|
3968
4004
|
{
|
|
3969
4005
|
"name": "caller_companies",
|
|
3970
4006
|
"arguments": ""
|
|
@@ -4117,6 +4153,10 @@
|
|
|
4117
4153
|
"name": "current_api_key",
|
|
4118
4154
|
"arguments": ""
|
|
4119
4155
|
},
|
|
4156
|
+
{
|
|
4157
|
+
"name": "declaration_boxes_of",
|
|
4158
|
+
"arguments": "p_tax_id uuid, p_box text, p_tax_line boolean, OUT boxes text[], OUT report_code text"
|
|
4159
|
+
},
|
|
4120
4160
|
{
|
|
4121
4161
|
"name": "declaration_period_months",
|
|
4122
4162
|
"arguments": "p_period declaration_period"
|
|
@@ -4245,6 +4285,10 @@
|
|
|
4245
4285
|
"name": "entries_refresh_totals",
|
|
4246
4286
|
"arguments": ""
|
|
4247
4287
|
},
|
|
4288
|
+
{
|
|
4289
|
+
"name": "entry_lines_box_from_posting",
|
|
4290
|
+
"arguments": ""
|
|
4291
|
+
},
|
|
4248
4292
|
{
|
|
4249
4293
|
"name": "entry_lines_guard_period",
|
|
4250
4294
|
"arguments": ""
|
|
@@ -4597,6 +4641,10 @@
|
|
|
4597
4641
|
"name": "reconciliations_guard_cancelled",
|
|
4598
4642
|
"arguments": ""
|
|
4599
4643
|
},
|
|
4644
|
+
{
|
|
4645
|
+
"name": "reconciliations_guard_reconcile",
|
|
4646
|
+
"arguments": ""
|
|
4647
|
+
},
|
|
4600
4648
|
{
|
|
4601
4649
|
"name": "reconciliations_refresh_lines",
|
|
4602
4650
|
"arguments": ""
|
|
@@ -4713,6 +4761,14 @@
|
|
|
4713
4761
|
"name": "statement_account_matches",
|
|
4714
4762
|
"arguments": "p_company_id uuid, p_statement_code text, p_from date, p_to date"
|
|
4715
4763
|
},
|
|
4764
|
+
{
|
|
4765
|
+
"name": "statement_figures",
|
|
4766
|
+
"arguments": "p_company_id uuid, p_statement_code text, p_from date, p_to date"
|
|
4767
|
+
},
|
|
4768
|
+
{
|
|
4769
|
+
"name": "statement_rule_catches",
|
|
4770
|
+
"arguments": "p_rule statement_line_rules, p_code text, p_account_type account_type, p_balance numeric"
|
|
4771
|
+
},
|
|
4716
4772
|
{
|
|
4717
4773
|
"name": "suggest_combination",
|
|
4718
4774
|
"arguments": "p_transaction_id uuid"
|
|
@@ -4832,6 +4888,10 @@
|
|
|
4832
4888
|
{
|
|
4833
4889
|
"name": "version_at_least",
|
|
4834
4890
|
"arguments": "p_version text, p_floor text"
|
|
4891
|
+
},
|
|
4892
|
+
{
|
|
4893
|
+
"name": "year_result_account",
|
|
4894
|
+
"arguments": "p_company_id uuid, p_balance numeric"
|
|
4835
4895
|
}
|
|
4836
4896
|
],
|
|
4837
4897
|
"policies": [
|
|
@@ -5425,6 +5485,10 @@
|
|
|
5425
5485
|
"table": "bank_transactions",
|
|
5426
5486
|
"name": "bank_transactions_currency_of_bank_account"
|
|
5427
5487
|
},
|
|
5488
|
+
{
|
|
5489
|
+
"table": "bank_transactions",
|
|
5490
|
+
"name": "bank_transactions_guard"
|
|
5491
|
+
},
|
|
5428
5492
|
{
|
|
5429
5493
|
"table": "bank_transactions",
|
|
5430
5494
|
"name": "bank_transactions_refresh_balance"
|
|
@@ -5629,6 +5693,10 @@
|
|
|
5629
5693
|
"table": "entries",
|
|
5630
5694
|
"name": "entries_set_updated_at"
|
|
5631
5695
|
},
|
|
5696
|
+
{
|
|
5697
|
+
"table": "entry_lines",
|
|
5698
|
+
"name": "entry_lines_box_from_posting"
|
|
5699
|
+
},
|
|
5632
5700
|
{
|
|
5633
5701
|
"table": "entry_lines",
|
|
5634
5702
|
"name": "entry_lines_guard_period"
|
|
@@ -5741,6 +5809,10 @@
|
|
|
5741
5809
|
"table": "reconciliations",
|
|
5742
5810
|
"name": "reconciliations_guard_cancelled"
|
|
5743
5811
|
},
|
|
5812
|
+
{
|
|
5813
|
+
"table": "reconciliations",
|
|
5814
|
+
"name": "reconciliations_guard_reconcile"
|
|
5815
|
+
},
|
|
5744
5816
|
{
|
|
5745
5817
|
"table": "reconciliations",
|
|
5746
5818
|
"name": "reconciliations_refresh_lines"
|
|
@@ -7312,6 +7384,17 @@
|
|
|
7312
7384
|
"authenticated": [],
|
|
7313
7385
|
"service_role": []
|
|
7314
7386
|
},
|
|
7387
|
+
{
|
|
7388
|
+
"name": "attachment_is_filing_deposit_file",
|
|
7389
|
+
"arguments": "p_attachment_id uuid",
|
|
7390
|
+
"anon": [],
|
|
7391
|
+
"authenticated": [
|
|
7392
|
+
"execute"
|
|
7393
|
+
],
|
|
7394
|
+
"service_role": [
|
|
7395
|
+
"execute"
|
|
7396
|
+
]
|
|
7397
|
+
},
|
|
7315
7398
|
{
|
|
7316
7399
|
"name": "audit_changes",
|
|
7317
7400
|
"arguments": "",
|
|
@@ -7445,6 +7528,14 @@
|
|
|
7445
7528
|
"authenticated": [],
|
|
7446
7529
|
"service_role": []
|
|
7447
7530
|
},
|
|
7531
|
+
{
|
|
7532
|
+
"name": "bank_transactions_guard",
|
|
7533
|
+
"arguments": "",
|
|
7534
|
+
"trigger": true,
|
|
7535
|
+
"anon": [],
|
|
7536
|
+
"authenticated": [],
|
|
7537
|
+
"service_role": []
|
|
7538
|
+
},
|
|
7448
7539
|
{
|
|
7449
7540
|
"name": "caller_companies",
|
|
7450
7541
|
"arguments": "",
|
|
@@ -7828,6 +7919,17 @@
|
|
|
7828
7919
|
"execute"
|
|
7829
7920
|
]
|
|
7830
7921
|
},
|
|
7922
|
+
{
|
|
7923
|
+
"name": "declaration_boxes_of",
|
|
7924
|
+
"arguments": "p_tax_id uuid, p_box text, p_tax_line boolean, OUT boxes text[], OUT report_code text",
|
|
7925
|
+
"anon": [],
|
|
7926
|
+
"authenticated": [
|
|
7927
|
+
"execute"
|
|
7928
|
+
],
|
|
7929
|
+
"service_role": [
|
|
7930
|
+
"execute"
|
|
7931
|
+
]
|
|
7932
|
+
},
|
|
7831
7933
|
{
|
|
7832
7934
|
"name": "declaration_period_months",
|
|
7833
7935
|
"arguments": "p_period declaration_period",
|
|
@@ -8137,6 +8239,14 @@
|
|
|
8137
8239
|
"authenticated": [],
|
|
8138
8240
|
"service_role": []
|
|
8139
8241
|
},
|
|
8242
|
+
{
|
|
8243
|
+
"name": "entry_lines_box_from_posting",
|
|
8244
|
+
"arguments": "",
|
|
8245
|
+
"trigger": true,
|
|
8246
|
+
"anon": [],
|
|
8247
|
+
"authenticated": [],
|
|
8248
|
+
"service_role": []
|
|
8249
|
+
},
|
|
8140
8250
|
{
|
|
8141
8251
|
"name": "entry_lines_guard_period",
|
|
8142
8252
|
"arguments": "",
|
|
@@ -9101,6 +9211,14 @@
|
|
|
9101
9211
|
"authenticated": [],
|
|
9102
9212
|
"service_role": []
|
|
9103
9213
|
},
|
|
9214
|
+
{
|
|
9215
|
+
"name": "reconciliations_guard_reconcile",
|
|
9216
|
+
"arguments": "",
|
|
9217
|
+
"trigger": true,
|
|
9218
|
+
"anon": [],
|
|
9219
|
+
"authenticated": [],
|
|
9220
|
+
"service_role": []
|
|
9221
|
+
},
|
|
9104
9222
|
{
|
|
9105
9223
|
"name": "reconciliations_refresh_lines",
|
|
9106
9224
|
"arguments": "",
|
|
@@ -9412,6 +9530,28 @@
|
|
|
9412
9530
|
"execute"
|
|
9413
9531
|
]
|
|
9414
9532
|
},
|
|
9533
|
+
{
|
|
9534
|
+
"name": "statement_figures",
|
|
9535
|
+
"arguments": "p_company_id uuid, p_statement_code text, p_from date, p_to date",
|
|
9536
|
+
"anon": [],
|
|
9537
|
+
"authenticated": [
|
|
9538
|
+
"execute"
|
|
9539
|
+
],
|
|
9540
|
+
"service_role": [
|
|
9541
|
+
"execute"
|
|
9542
|
+
]
|
|
9543
|
+
},
|
|
9544
|
+
{
|
|
9545
|
+
"name": "statement_rule_catches",
|
|
9546
|
+
"arguments": "p_rule statement_line_rules, p_code text, p_account_type account_type, p_balance numeric",
|
|
9547
|
+
"anon": [],
|
|
9548
|
+
"authenticated": [
|
|
9549
|
+
"execute"
|
|
9550
|
+
],
|
|
9551
|
+
"service_role": [
|
|
9552
|
+
"execute"
|
|
9553
|
+
]
|
|
9554
|
+
},
|
|
9415
9555
|
{
|
|
9416
9556
|
"name": "suggest_combination",
|
|
9417
9557
|
"arguments": "p_transaction_id uuid",
|
|
@@ -9721,6 +9861,17 @@
|
|
|
9721
9861
|
"service_role": [
|
|
9722
9862
|
"execute"
|
|
9723
9863
|
]
|
|
9864
|
+
},
|
|
9865
|
+
{
|
|
9866
|
+
"name": "year_result_account",
|
|
9867
|
+
"arguments": "p_company_id uuid, p_balance numeric",
|
|
9868
|
+
"anon": [],
|
|
9869
|
+
"authenticated": [
|
|
9870
|
+
"execute"
|
|
9871
|
+
],
|
|
9872
|
+
"service_role": [
|
|
9873
|
+
"execute"
|
|
9874
|
+
]
|
|
9724
9875
|
}
|
|
9725
9876
|
],
|
|
9726
9877
|
"defaultPrivileges": []
|
|
@@ -11176,7 +11327,7 @@
|
|
|
11176
11327
|
},
|
|
11177
11328
|
{
|
|
11178
11329
|
"code": "tax",
|
|
11179
|
-
"version": "1.
|
|
11330
|
+
"version": "1.1.0",
|
|
11180
11331
|
"schema": "tax",
|
|
11181
11332
|
"tables": [
|
|
11182
11333
|
{
|
|
@@ -11804,6 +11955,47 @@
|
|
|
11804
11955
|
}
|
|
11805
11956
|
]
|
|
11806
11957
|
},
|
|
11958
|
+
{
|
|
11959
|
+
"name": "prepayments",
|
|
11960
|
+
"columns": [
|
|
11961
|
+
{
|
|
11962
|
+
"name": "amount",
|
|
11963
|
+
"type": "numeric"
|
|
11964
|
+
},
|
|
11965
|
+
{
|
|
11966
|
+
"name": "company_id",
|
|
11967
|
+
"type": "uuid"
|
|
11968
|
+
},
|
|
11969
|
+
{
|
|
11970
|
+
"name": "created_at",
|
|
11971
|
+
"type": "timestamp with time zone"
|
|
11972
|
+
},
|
|
11973
|
+
{
|
|
11974
|
+
"name": "entry_id",
|
|
11975
|
+
"type": "uuid"
|
|
11976
|
+
},
|
|
11977
|
+
{
|
|
11978
|
+
"name": "fiscal_year_id",
|
|
11979
|
+
"type": "uuid"
|
|
11980
|
+
},
|
|
11981
|
+
{
|
|
11982
|
+
"name": "id",
|
|
11983
|
+
"type": "uuid"
|
|
11984
|
+
},
|
|
11985
|
+
{
|
|
11986
|
+
"name": "note",
|
|
11987
|
+
"type": "text"
|
|
11988
|
+
},
|
|
11989
|
+
{
|
|
11990
|
+
"name": "paid_on",
|
|
11991
|
+
"type": "date"
|
|
11992
|
+
},
|
|
11993
|
+
{
|
|
11994
|
+
"name": "updated_at",
|
|
11995
|
+
"type": "timestamp with time zone"
|
|
11996
|
+
}
|
|
11997
|
+
]
|
|
11998
|
+
},
|
|
11807
11999
|
{
|
|
11808
12000
|
"name": "rate_templates",
|
|
11809
12001
|
"columns": [
|
|
@@ -11880,6 +12072,10 @@
|
|
|
11880
12072
|
"name": "archive_tables",
|
|
11881
12073
|
"arguments": ""
|
|
11882
12074
|
},
|
|
12075
|
+
{
|
|
12076
|
+
"name": "book_provision",
|
|
12077
|
+
"arguments": "p_computation_id uuid"
|
|
12078
|
+
},
|
|
11883
12079
|
{
|
|
11884
12080
|
"name": "condition_failure",
|
|
11885
12081
|
"arguments": "p_condition jsonb, p_values jsonb, p_taxable_base numeric"
|
|
@@ -11908,6 +12104,10 @@
|
|
|
11908
12104
|
"name": "in_force",
|
|
11909
12105
|
"arguments": "p_valid_from date, p_valid_to date, p_valid_on tax.validity_basis, p_start date, p_end date"
|
|
11910
12106
|
},
|
|
12107
|
+
{
|
|
12108
|
+
"name": "instalment_date",
|
|
12109
|
+
"arguments": "p_month_basis text, p_month integer, p_day integer, p_start date, p_end date"
|
|
12110
|
+
},
|
|
11911
12111
|
{
|
|
11912
12112
|
"name": "line",
|
|
11913
12113
|
"arguments": "p_kind text, p_code text, p_name text, p_base numeric, p_rate numeric, p_amount numeric, p_legal_reference text, p_source_key text"
|
|
@@ -11916,10 +12116,22 @@
|
|
|
11916
12116
|
"name": "loss_stock",
|
|
11917
12117
|
"arguments": "p_company_id uuid, p_before date"
|
|
11918
12118
|
},
|
|
12119
|
+
{
|
|
12120
|
+
"name": "plan_instalments",
|
|
12121
|
+
"arguments": "p_instalments jsonb"
|
|
12122
|
+
},
|
|
12123
|
+
{
|
|
12124
|
+
"name": "prepayment_plan",
|
|
12125
|
+
"arguments": "p_company_id uuid, p_fiscal_year_id uuid, p_at date, p_tax numeric"
|
|
12126
|
+
},
|
|
11919
12127
|
{
|
|
11920
12128
|
"name": "record_computation",
|
|
11921
12129
|
"arguments": "p_company_id uuid, p_fiscal_year_id uuid, p_at date"
|
|
11922
12130
|
},
|
|
12131
|
+
{
|
|
12132
|
+
"name": "round_prepayment",
|
|
12133
|
+
"arguments": ""
|
|
12134
|
+
},
|
|
11923
12135
|
{
|
|
11924
12136
|
"name": "withdraw_computation",
|
|
11925
12137
|
"arguments": "p_computation_id uuid"
|
|
@@ -12011,6 +12223,16 @@
|
|
|
12011
12223
|
"name": "tax_prepayment_templates_select",
|
|
12012
12224
|
"command": "select"
|
|
12013
12225
|
},
|
|
12226
|
+
{
|
|
12227
|
+
"table": "prepayments",
|
|
12228
|
+
"name": "tax_prepayments_select",
|
|
12229
|
+
"command": "select"
|
|
12230
|
+
},
|
|
12231
|
+
{
|
|
12232
|
+
"table": "prepayments",
|
|
12233
|
+
"name": "tax_prepayments_write",
|
|
12234
|
+
"command": "all"
|
|
12235
|
+
},
|
|
12014
12236
|
{
|
|
12015
12237
|
"table": "rate_templates",
|
|
12016
12238
|
"name": "tax_rate_templates_select",
|
|
@@ -12049,6 +12271,14 @@
|
|
|
12049
12271
|
{
|
|
12050
12272
|
"table": "losses",
|
|
12051
12273
|
"name": "tax_losses_set_updated_at"
|
|
12274
|
+
},
|
|
12275
|
+
{
|
|
12276
|
+
"table": "prepayments",
|
|
12277
|
+
"name": "tax_prepayments_round"
|
|
12278
|
+
},
|
|
12279
|
+
{
|
|
12280
|
+
"table": "prepayments",
|
|
12281
|
+
"name": "tax_prepayments_set_updated_at"
|
|
12052
12282
|
}
|
|
12053
12283
|
],
|
|
12054
12284
|
"types": [
|
|
@@ -12254,6 +12484,22 @@
|
|
|
12254
12484
|
"select"
|
|
12255
12485
|
]
|
|
12256
12486
|
},
|
|
12487
|
+
{
|
|
12488
|
+
"name": "prepayments",
|
|
12489
|
+
"anon": [],
|
|
12490
|
+
"authenticated": [
|
|
12491
|
+
"delete",
|
|
12492
|
+
"insert",
|
|
12493
|
+
"select",
|
|
12494
|
+
"update"
|
|
12495
|
+
],
|
|
12496
|
+
"service_role": [
|
|
12497
|
+
"delete",
|
|
12498
|
+
"insert",
|
|
12499
|
+
"select",
|
|
12500
|
+
"update"
|
|
12501
|
+
]
|
|
12502
|
+
},
|
|
12257
12503
|
{
|
|
12258
12504
|
"name": "rate_templates",
|
|
12259
12505
|
"anon": [],
|
|
@@ -12301,6 +12547,17 @@
|
|
|
12301
12547
|
"execute"
|
|
12302
12548
|
]
|
|
12303
12549
|
},
|
|
12550
|
+
{
|
|
12551
|
+
"name": "book_provision",
|
|
12552
|
+
"arguments": "p_computation_id uuid",
|
|
12553
|
+
"anon": [],
|
|
12554
|
+
"authenticated": [
|
|
12555
|
+
"execute"
|
|
12556
|
+
],
|
|
12557
|
+
"service_role": [
|
|
12558
|
+
"execute"
|
|
12559
|
+
]
|
|
12560
|
+
},
|
|
12304
12561
|
{
|
|
12305
12562
|
"name": "condition_failure",
|
|
12306
12563
|
"arguments": "p_condition jsonb, p_values jsonb, p_taxable_base numeric",
|
|
@@ -12372,6 +12629,17 @@
|
|
|
12372
12629
|
"execute"
|
|
12373
12630
|
]
|
|
12374
12631
|
},
|
|
12632
|
+
{
|
|
12633
|
+
"name": "instalment_date",
|
|
12634
|
+
"arguments": "p_month_basis text, p_month integer, p_day integer, p_start date, p_end date",
|
|
12635
|
+
"anon": [],
|
|
12636
|
+
"authenticated": [
|
|
12637
|
+
"execute"
|
|
12638
|
+
],
|
|
12639
|
+
"service_role": [
|
|
12640
|
+
"execute"
|
|
12641
|
+
]
|
|
12642
|
+
},
|
|
12375
12643
|
{
|
|
12376
12644
|
"name": "line",
|
|
12377
12645
|
"arguments": "p_kind text, p_code text, p_name text, p_base numeric, p_rate numeric, p_amount numeric, p_legal_reference text, p_source_key text",
|
|
@@ -12394,6 +12662,28 @@
|
|
|
12394
12662
|
"execute"
|
|
12395
12663
|
]
|
|
12396
12664
|
},
|
|
12665
|
+
{
|
|
12666
|
+
"name": "plan_instalments",
|
|
12667
|
+
"arguments": "p_instalments jsonb",
|
|
12668
|
+
"anon": [],
|
|
12669
|
+
"authenticated": [
|
|
12670
|
+
"execute"
|
|
12671
|
+
],
|
|
12672
|
+
"service_role": [
|
|
12673
|
+
"execute"
|
|
12674
|
+
]
|
|
12675
|
+
},
|
|
12676
|
+
{
|
|
12677
|
+
"name": "prepayment_plan",
|
|
12678
|
+
"arguments": "p_company_id uuid, p_fiscal_year_id uuid, p_at date, p_tax numeric",
|
|
12679
|
+
"anon": [],
|
|
12680
|
+
"authenticated": [
|
|
12681
|
+
"execute"
|
|
12682
|
+
],
|
|
12683
|
+
"service_role": [
|
|
12684
|
+
"execute"
|
|
12685
|
+
]
|
|
12686
|
+
},
|
|
12397
12687
|
{
|
|
12398
12688
|
"name": "record_computation",
|
|
12399
12689
|
"arguments": "p_company_id uuid, p_fiscal_year_id uuid, p_at date",
|
|
@@ -12405,6 +12695,14 @@
|
|
|
12405
12695
|
"execute"
|
|
12406
12696
|
]
|
|
12407
12697
|
},
|
|
12698
|
+
{
|
|
12699
|
+
"name": "round_prepayment",
|
|
12700
|
+
"arguments": "",
|
|
12701
|
+
"trigger": true,
|
|
12702
|
+
"anon": [],
|
|
12703
|
+
"authenticated": [],
|
|
12704
|
+
"service_role": []
|
|
12705
|
+
},
|
|
12408
12706
|
{
|
|
12409
12707
|
"name": "withdraw_computation",
|
|
12410
12708
|
"arguments": "p_computation_id uuid",
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
-- Ekwo OS — an invoice wears the colour of the company that sends it.
|
|
2
|
+
--
|
|
3
|
+
-- `@ekwo-ai/invoice-pdf` prints every invoice in one layout and takes a small
|
|
4
|
+
-- theme: an accent colour and the side of the logo. Until now only the caller
|
|
5
|
+
-- could hand it one, so the PDF of `ekwo doc pdf`, of the MCP tool
|
|
6
|
+
-- `render_invoice_pdf` and of any other client came out in the brick's default
|
|
7
|
+
-- whoever had sent it. Which colour a company prints in is a fact about that
|
|
8
|
+
-- company, the same for every surface that renders its invoices; it belongs
|
|
9
|
+
-- beside its logo, on `companies`.
|
|
10
|
+
--
|
|
11
|
+
-- **Two columns, both nullable.** Null is the brick's default, which is the
|
|
12
|
+
-- answer for every company that exists today and needs no backfill. The
|
|
13
|
+
-- typeface of the theme stays out: it is a file, and the core keeps none.
|
|
14
|
+
--
|
|
15
|
+
-- **The same constraints the brick applies.** A colour is `#rrggbb` and a side
|
|
16
|
+
-- is `left` or `right`; anything else would be stored here and refused at the
|
|
17
|
+
-- first rendering, so it is refused at the write instead.
|
|
18
|
+
--
|
|
19
|
+
-- **Who may write it** is who may write the company: `companies_update`
|
|
20
|
+
-- judges the row, `company.write`. No grant changes — the table is already
|
|
21
|
+
-- granted, and a column added to it is covered by that grant.
|
|
22
|
+
|
|
23
|
+
alter table companies
|
|
24
|
+
add column if not exists invoice_accent_color text,
|
|
25
|
+
add column if not exists invoice_logo_position text;
|
|
26
|
+
|
|
27
|
+
alter table companies
|
|
28
|
+
add constraint companies_invoice_accent_color_hex
|
|
29
|
+
check (invoice_accent_color ~ '^#[0-9A-Fa-f]{6}$');
|
|
30
|
+
|
|
31
|
+
alter table companies
|
|
32
|
+
add constraint companies_invoice_logo_position_side
|
|
33
|
+
check (invoice_logo_position in ('left', 'right'));
|
|
34
|
+
|
|
35
|
+
comment on column companies.invoice_accent_color is
|
|
36
|
+
'The accent colour of this company''s invoice PDF, written #rrggbb: the title, the rules and the bands of the layout. Null is the default of @ekwo-ai/invoice-pdf.';
|
|
37
|
+
comment on column companies.invoice_logo_position is
|
|
38
|
+
'The side of this company''s invoice PDF its logo is printed on: left or right. Null is the default of @ekwo-ai/invoice-pdf (left).';
|
|
@@ -0,0 +1,95 @@
|
|
|
1
|
+
-- Ekwo OS — the file of a declaration is read as a declaration.
|
|
2
|
+
--
|
|
3
|
+
-- `filings.read` was granted apart from `documents.read` on purpose: what a
|
|
4
|
+
-- company declared is not the same secret as what it books
|
|
5
|
+
-- (`20260917150000`), and the deposits that record each send ask it
|
|
6
|
+
-- (`20260918110000`). The two files of a deposit — what was sent, and the
|
|
7
|
+
-- receipt that came back — are rows of `attachments`, and every row of
|
|
8
|
+
-- `attachments` was read through `documents.read` and written through
|
|
9
|
+
-- `documents.write` (`20260913083216`). So a member whose `filings.read` was
|
|
10
|
+
-- withdrawn and who kept `documents.read` saw no deposit, and still read the
|
|
11
|
+
-- declaration that went and the acknowledgement of the administration.
|
|
12
|
+
-- Decision 0039 left it as an open item; this closes it.
|
|
13
|
+
--
|
|
14
|
+
-- **Which files.** Two kinds, and either is enough:
|
|
15
|
+
--
|
|
16
|
+
-- - an attachment **of a declaration** (`entity_type = 'tax_filing'`), which
|
|
17
|
+
-- is where the two files of a deposit are kept, from the moment they are
|
|
18
|
+
-- uploaded and before the deposit names them;
|
|
19
|
+
-- - an attachment **a deposit names**, as `sent_file_id` or
|
|
20
|
+
-- `acknowledgement_id`, wherever it was pinned: the trigger of
|
|
21
|
+
-- `20261007113412` keeps it in the declaration's company and does not
|
|
22
|
+
-- ask its `entity_type`.
|
|
23
|
+
--
|
|
24
|
+
-- Such a file is read with `filings.read` and written — uploaded, changed,
|
|
25
|
+
-- moved, deleted — with `filings.write`, the capability that writes deposits.
|
|
26
|
+
-- Every other attachment keeps `documents.read` and `documents.write`. The
|
|
27
|
+
-- two policies of a client handing a piece over (`attachments_deposit`,
|
|
28
|
+
-- `attachments_select_own_deposit`, `20260918113807`) are untouched: they
|
|
29
|
+
-- only ever reach a piece on the company itself, or one the caller filed.
|
|
30
|
+
--
|
|
31
|
+
-- **Why a definer function asks about the deposit.** A policy reads other
|
|
32
|
+
-- tables under the caller's own policies, and the deposits ask
|
|
33
|
+
-- `filings.read`: an `exists` written in the policy would find no deposit for
|
|
34
|
+
-- precisely the member this is about, and let the file through as an
|
|
35
|
+
-- ordinary one. `attachment_is_filing_deposit_file()` looks past the
|
|
36
|
+
-- policies of `tax_filing_deposits`, answers about one attachment and nothing
|
|
37
|
+
-- else, and is two probes of the indexes `20260918110000` put on the two
|
|
38
|
+
-- columns. On a shared installation it answers only about a company the
|
|
39
|
+
-- caller may know of (`may_know_of_company()`, decision 0065): an id of
|
|
40
|
+
-- another tenant's file gets the answer an id of nobody gets. The capabilities are compared the way `20260918141627` compares
|
|
41
|
+
-- them — a sub-select run once per statement — and `attachments` is a table
|
|
42
|
+
-- read file by file, never walked by a report.
|
|
43
|
+
|
|
44
|
+
create or replace function attachment_is_filing_deposit_file(p_attachment_id uuid)
|
|
45
|
+
returns boolean
|
|
46
|
+
language sql
|
|
47
|
+
stable
|
|
48
|
+
security definer
|
|
49
|
+
set search_path = public, pg_temp
|
|
50
|
+
as $$
|
|
51
|
+
select exists (select 1 from tax_filing_deposits d join tax_filings f on f.id = d.filing_id
|
|
52
|
+
where d.sent_file_id = p_attachment_id and may_know_of_company(f.company_id))
|
|
53
|
+
or exists (select 1 from tax_filing_deposits d join tax_filings f on f.id = d.filing_id
|
|
54
|
+
where d.acknowledgement_id = p_attachment_id and may_know_of_company(f.company_id));
|
|
55
|
+
$$;
|
|
56
|
+
|
|
57
|
+
comment on function attachment_is_filing_deposit_file(uuid) is
|
|
58
|
+
'Whether a deposit of a declaration names this attachment as the file that was sent or as the receipt. Definer, because the policy of attachments asks it for callers who may not read the deposits — which is the case it exists for; it answers about one id and nothing else, and about a company the caller may not know of as about nobody (decision 0065).';
|
|
59
|
+
|
|
60
|
+
revoke execute on function attachment_is_filing_deposit_file(uuid) from public, anon;
|
|
61
|
+
grant execute on function attachment_is_filing_deposit_file(uuid) to authenticated, service_role;
|
|
62
|
+
|
|
63
|
+
drop policy attachments_select on attachments;
|
|
64
|
+
create policy attachments_select on attachments
|
|
65
|
+
for select using (
|
|
66
|
+
case
|
|
67
|
+
when entity_type = 'tax_filing' or attachment_is_filing_deposit_file(id)
|
|
68
|
+
then company_id = any ((select companies_with_capability('filings.read'))::uuid[])
|
|
69
|
+
else company_id = any ((select companies_with_capability('documents.read'))::uuid[])
|
|
70
|
+
end
|
|
71
|
+
);
|
|
72
|
+
|
|
73
|
+
comment on policy attachments_select on attachments is
|
|
74
|
+
'documents.read, except for the files of a declaration — attached to a tax_filing, or named by a deposit as what was sent or the receipt — which are proof of filing and read with filings.read, like the deposits themselves.';
|
|
75
|
+
|
|
76
|
+
drop policy attachments_write on attachments;
|
|
77
|
+
create policy attachments_write on attachments
|
|
78
|
+
for all using (
|
|
79
|
+
case
|
|
80
|
+
when entity_type = 'tax_filing' or attachment_is_filing_deposit_file(id)
|
|
81
|
+
then company_id = any ((select companies_with_capability('filings.write'))::uuid[])
|
|
82
|
+
else company_id = any ((select companies_with_capability('documents.write'))::uuid[])
|
|
83
|
+
end
|
|
84
|
+
)
|
|
85
|
+
-- A check is asked once per row written, as `20260918141627` leaves it.
|
|
86
|
+
with check (
|
|
87
|
+
case
|
|
88
|
+
when entity_type = 'tax_filing' or attachment_is_filing_deposit_file(id)
|
|
89
|
+
then has_capability(company_id, 'filings.write')
|
|
90
|
+
else has_capability(company_id, 'documents.write')
|
|
91
|
+
end
|
|
92
|
+
);
|
|
93
|
+
|
|
94
|
+
comment on policy attachments_write on attachments is
|
|
95
|
+
'documents.write, except for the files of a declaration — attached to a tax_filing, or named by a deposit — which are written with filings.write, the capability that records a deposit. Moving a file onto a declaration needs both: the old row is asked documents.write, the new one filings.write.';
|