ekwo-os 0.6.0 → 0.8.0
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 +111 -28
- package/dist/assets/expected-objects.json +117 -2
- package/dist/assets/migrations/20260922115309_an_installation_without_a_country.sql +24 -0
- package/dist/assets/migrations/20260922120418_import_already_done_says_what.sql +284 -0
- package/dist/assets/migrations/20260922124012_schema_version_0_7_0.sql +40 -0
- package/dist/assets/migrations/20260922143000_a_version_anybody_signed_in_may_read.sql +52 -0
- package/dist/assets/migrations/20260922144500_a_balance_sheet_without_knowing_the_pack.sql +117 -0
- package/dist/assets/migrations/20260922160000_a_key_reaches_the_api.sql +265 -0
- package/dist/assets/migrations/20260922161500_the_version_answers_a_key_as_well.sql +42 -0
- package/dist/assets/migrations/20260922162500_reference_data_for_a_caller_this_installation_knows.sql +127 -0
- package/dist/assets/migrations/20260922171000_a_key_is_presented_in_a_read_only_transaction.sql +82 -0
- package/dist/assets/migrations/20260923093000_schema_version_0_8_0.sql +42 -0
- package/dist/assets/modules/assets/supabase/migrations/20260922162600_assets_reference_for_a_known_caller.sql +24 -0
- package/dist/auth.d.ts +17 -0
- package/dist/auth.d.ts.map +1 -1
- package/dist/auth.js +24 -6
- package/dist/auth.js.map +1 -1
- package/dist/bootstrap.d.ts +17 -0
- package/dist/bootstrap.d.ts.map +1 -1
- package/dist/bootstrap.js +29 -8
- package/dist/bootstrap.js.map +1 -1
- package/dist/cli.d.ts.map +1 -1
- package/dist/cli.js +26 -6
- package/dist/cli.js.map +1 -1
- package/dist/commands/company.d.ts +14 -2
- package/dist/commands/company.d.ts.map +1 -1
- package/dist/commands/company.js +185 -8
- package/dist/commands/company.js.map +1 -1
- package/dist/commands/import.d.ts.map +1 -1
- package/dist/commands/import.js +25 -6
- package/dist/commands/import.js.map +1 -1
- package/dist/commands/init.d.ts +1 -1
- package/dist/commands/init.d.ts.map +1 -1
- package/dist/commands/init.js +132 -123
- package/dist/commands/init.js.map +1 -1
- package/dist/commands/status.js +1 -1
- package/dist/commands/status.js.map +1 -1
- package/dist/company-choices.d.ts +66 -0
- package/dist/company-choices.d.ts.map +1 -0
- package/dist/company-choices.js +165 -0
- package/dist/company-choices.js.map +1 -0
- package/dist/config.d.ts +11 -5
- package/dist/config.d.ts.map +1 -1
- package/dist/config.js +11 -6
- package/dist/config.js.map +1 -1
- package/dist/doctor.d.ts.map +1 -1
- package/dist/doctor.js +40 -0
- package/dist/doctor.js.map +1 -1
- package/dist/index.d.ts +2 -2
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +2 -2
- package/dist/index.js.map +1 -1
- package/dist/registry.d.ts +3 -2
- package/dist/registry.d.ts.map +1 -1
- package/dist/registry.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 +73 -24
package/README.md
CHANGED
|
@@ -6,13 +6,17 @@ books: the schema, the chart of accounts, the VAT codes, the first
|
|
|
6
6
|
administrator, the first company and its first financial year.
|
|
7
7
|
|
|
8
8
|
```sh
|
|
9
|
-
npx ekwo-os init
|
|
9
|
+
npx -y ekwo-os@latest init
|
|
10
10
|
```
|
|
11
11
|
|
|
12
|
-
The package is `ekwo-os` and the command it installs is `ekwo`:
|
|
13
|
-
<command>` runs it without installing anything, and
|
|
14
|
-
`npm install -g ekwo-os` every example below that starts with `ekwo `
|
|
15
|
-
written.
|
|
12
|
+
The package is `ekwo-os` and the command it installs is `ekwo`:
|
|
13
|
+
`npx -y ekwo-os@latest <command>` runs it without installing anything, and
|
|
14
|
+
after `npm install -g ekwo-os` every example below that starts with `ekwo `
|
|
15
|
+
works as written. Keep the version in the command: run from inside a clone of
|
|
16
|
+
the Ekwo repository, a bare `npx ekwo-os` finds the workspace package of the
|
|
17
|
+
same name, which links no command, and answers `ekwo: command not found`. With
|
|
18
|
+
`@latest`, `npx` fetches the published CLI wherever it is started; the clone's
|
|
19
|
+
own is `node packages/cli/dist/bin.js`, after `npm run build`.
|
|
16
20
|
|
|
17
21
|
You need Node 20 or later. That is the whole list. The Supabase CLI is not
|
|
18
22
|
required — this talks to Postgres directly — and Docker is not required
|
|
@@ -26,9 +30,11 @@ either.
|
|
|
26
30
|
2. **Copy two things** from the dashboard:
|
|
27
31
|
- Project Settings → Database → **Connection string** (URI). It contains
|
|
28
32
|
your database password.
|
|
29
|
-
- Project Settings → API →
|
|
30
|
-
|
|
31
|
-
|
|
33
|
+
- Project Settings → API Keys → the **secret key** (`sb_secret_…`), and the
|
|
34
|
+
**Project URL**. A project created before the new keys has the legacy
|
|
35
|
+
**`service_role` key** instead, and it works the same. These are used
|
|
36
|
+
once, to create the first administrator in your own Supabase Auth, and
|
|
37
|
+
are never written to disk.
|
|
32
38
|
|
|
33
39
|
**Take the pooler string, not the direct one, unless you know you have
|
|
34
40
|
IPv6.** The direct host `db.<ref>.supabase.co` resolves to an IPv6 address
|
|
@@ -48,7 +54,7 @@ either.
|
|
|
48
54
|
3. **Run the installer.**
|
|
49
55
|
|
|
50
56
|
```sh
|
|
51
|
-
npx ekwo-os init
|
|
57
|
+
npx -y ekwo-os@latest init
|
|
52
58
|
```
|
|
53
59
|
|
|
54
60
|
It asks for the connection string, the country, the chart of accounts and
|
|
@@ -71,7 +77,7 @@ either.
|
|
|
71
77
|
Everything above in one non-interactive line:
|
|
72
78
|
|
|
73
79
|
```sh
|
|
74
|
-
npx ekwo-os init \
|
|
80
|
+
npx -y ekwo-os@latest init \
|
|
75
81
|
--db-url "postgresql://postgres.YOURREF:PASSWORD@aws-1-eu-west-3.pooler.supabase.com:5432/postgres" \
|
|
76
82
|
--supabase-url "https://YOURREF.supabase.co" \
|
|
77
83
|
--service-role-key "$SUPABASE_SERVICE_ROLE_KEY" \
|
|
@@ -117,6 +123,52 @@ in `defaults.fiscal_year_default`; one that names none — the United Kingdom's,
|
|
|
117
123
|
where a company's year ends on the accounting reference date it chose — asks
|
|
118
124
|
for the day.
|
|
119
125
|
|
|
126
|
+
`ekwo company new` asks the same questions about every other company, and
|
|
127
|
+
refuses the same way.
|
|
128
|
+
|
|
129
|
+
## Several countries in one installation: `init --no-company`
|
|
130
|
+
|
|
131
|
+
An installation is not in a country; its companies are. `ekwo init` loads every
|
|
132
|
+
pack of the release whatever `--country` says, so one installation keeps the
|
|
133
|
+
books of companies in as many countries as it holds packs. When there is no
|
|
134
|
+
"first company" to name — a group, a firm, a holding with subsidiaries abroad —
|
|
135
|
+
install without one, then create each company in its own country:
|
|
136
|
+
|
|
137
|
+
```sh
|
|
138
|
+
npx -y ekwo-os@latest init --no-company \
|
|
139
|
+
--db-url "$EKWO_DB_URL" --supabase-url "https://YOURREF.supabase.co" \
|
|
140
|
+
--service-role-key "$SUPABASE_SERVICE_ROLE_KEY" \
|
|
141
|
+
--org "My Group" --admin-email "you@example.com" --yes
|
|
142
|
+
|
|
143
|
+
ekwo company new "My Company Belgium" --country BE --chart default --language nl --yes
|
|
144
|
+
ekwo company new "My Company France" --country FR --language fr --yes
|
|
145
|
+
ekwo company list
|
|
146
|
+
```
|
|
147
|
+
|
|
148
|
+
`--no-company` runs the migrations, the seeds of every pack, the modules, the
|
|
149
|
+
first administrator, `init_instance()` and `claim_instance_admin()`, and
|
|
150
|
+
nothing else. The instance row records no country. A flag that only describes
|
|
151
|
+
a company — `--country`, `--company`, `--chart`, `--language`, `--currency`,
|
|
152
|
+
`--fiscal-year`, `--fiscal-year-start`, `--vat-period`, `--filing-period`,
|
|
153
|
+
`--iban`, `--bic`, `--bank-name` — is refused with it, exit code 2, before the
|
|
154
|
+
database is touched: it would describe nothing.
|
|
155
|
+
|
|
156
|
+
**`ekwo company new` is `create_company()`**, the function the `create_company`
|
|
157
|
+
tool of the MCP server calls: the country pack copied in, the first financial
|
|
158
|
+
year opened, the administrator its first owner. It is called as an
|
|
159
|
+
administrator of the installation — `--as-user`, or the only one when there is
|
|
160
|
+
exactly one — so the database judges that person exactly as it judges the tool:
|
|
161
|
+
anybody else is refused, `not_instance_admin`, exit code 3. Before the call,
|
|
162
|
+
the CLI asks what `ekwo init` asks about its first company, from the packs the
|
|
163
|
+
installation holds, and refuses the same way off a terminal: no country without
|
|
164
|
+
`--country`, and `--chart`, `--language` and `--fiscal-year-start` wherever the
|
|
165
|
+
pack offers a choice. `--currency` and `--fiscal-year` override the pack and
|
|
166
|
+
this year.
|
|
167
|
+
|
|
168
|
+
Without `--no-company`, `ekwo init` does what it always did, and the installation
|
|
169
|
+
takes more companies later the same way. Neither writes a country into
|
|
170
|
+
`ekwo.json`: see below.
|
|
171
|
+
|
|
120
172
|
## Where table access comes from
|
|
121
173
|
|
|
122
174
|
**The schema grants its own rights.** Every table, view and function of Ekwo
|
|
@@ -222,7 +274,7 @@ and read by a person.
|
|
|
222
274
|
| 2 | Applies every reference seed of `supabase/seed/`, in file-name order: `00_currencies.sql`, `00_territories.sql`, `05_framework_generic.sql`, then one `<n>_pack_<cc>.sql` per country pack, in the order of the number each pack declares | The currencies, the territories the tax rules name, the country-less financial statements every chart falls back on, and every country pack of the release — so a company in any of them can be created later without installing anything. They are exactly the seeds `supabase/config.toml` lists (a list `ekwo pack build` writes from `packs/`), so `supabase db push` installs the same set; a test compares both paths row by row. `90_demo_company.sql` is sample data and is never applied here |
|
|
223
275
|
| 3 | Creates the first administrator through the Supabase Auth admin API | See below: a database connection cannot be a signed-in user |
|
|
224
276
|
| 4 | `init_instance()`, `claim_instance_admin()`, the company, `company_members` as owner, `install_country_template()`, the first financial year, and the bank account when an IBAN was given | The six steps of the root README, in the same order, plus the one thing nobody can derive |
|
|
225
|
-
| 5 | Writes `ekwo.json` |
|
|
277
|
+
| 5 | Writes `ekwo.json` | The installation: project URL and schema version. Nothing else, ever — no country, since each company carries its own. A file written by 0.6 or earlier also names a country; it is still read, and the key is taken for nothing |
|
|
226
278
|
| 6 | Asks whether to register with Ekwo | The default answer is no, and no is a supported answer forever |
|
|
227
279
|
|
|
228
280
|
Every step checks before it acts. Running `ekwo init` twice on the same
|
|
@@ -250,7 +302,7 @@ instead if the account already exists, and no key is needed.
|
|
|
250
302
|
|
|
251
303
|
| Command | What it does |
|
|
252
304
|
|---|---|
|
|
253
|
-
| `ekwo init` | The whole installation, interactive or not: the socle's migrations, the reference seeds, then the modules', as `ekwo migrate` applies them. |
|
|
305
|
+
| `ekwo init` | The whole installation, interactive or not: the socle's migrations, the reference seeds, then the modules', as `ekwo migrate` applies them. `--no-company` stops before the first company: see [several countries](#several-countries-in-one-installation-init---no-company). |
|
|
254
306
|
| `ekwo migrate` | Applies the migrations this release adds, after showing the gap — the socle's, then the modules'. Re-applies the reference seeds, which are idempotent. `--no-modules` leaves the modules alone. |
|
|
255
307
|
| `ekwo status` | Schema version installed against available, pending migrations, the instance, its administrators, the country packs it holds and, per company, the pack version it copied. Exits 1 when something is pending. |
|
|
256
308
|
| `ekwo doctor` | Every object this release defines and every privilege it grants, against what the database holds; row level security on every table, a policy on every protected table, no pending migration, no membership pointing at a deleted user, every company with a bank account, statements that tie to their lines, posted entries that balance. Exits 1 on a problem, 0 on warnings. |
|
|
@@ -258,7 +310,7 @@ instead if the account already exists, and no key is needed.
|
|
|
258
310
|
| `ekwo unregister` | Opt back out. Clears the address and the date on the instance row. |
|
|
259
311
|
| `ekwo demo` | Loads the sample company. Fictional data, explicit request only. |
|
|
260
312
|
| `ekwo module` | What is installed beside the socle, applies a module's migrations and its country seeds, and turns one on or off for a company. |
|
|
261
|
-
| `ekwo company` | One company leaves an installation with its books — `export` writes an archive anybody can read, as a member under row level security — and arrives in another one alive: `import` takes it in whole or not at all. |
|
|
313
|
+
| `ekwo company` | `new` creates a company in its own country, through `create_company()`, and `list` shows the companies held here. One company leaves an installation with its books — `export` writes an archive anybody can read, as a member under row level security — and arrives in another one alive: `import` takes it in whole or not at all. |
|
|
262
314
|
| `ekwo pack` | Compiles a country pack into its seed, and refuses a seed that is no longer the output of its pack. Runs in a checkout of the repository only. |
|
|
263
315
|
| `ekwo login` | Signs in to an instance as yourself and keeps the session, in your own configuration directory. See [acting as a person](#acting-as-a-person-login-use-whoami). |
|
|
264
316
|
| `ekwo logout` | Ends that session, here and on the instance. |
|
|
@@ -515,7 +567,7 @@ source, and nothing is posted while an account has no answer:
|
|
|
515
567
|
```bash
|
|
516
568
|
ekwo import fec 123456789FEC20251231.txt --dry-run --open-years --save-mapping map.json
|
|
517
569
|
# read, propose a correspondence, rehearse the import in the database, take it back
|
|
518
|
-
$EDITOR map.json # answer what is null
|
|
570
|
+
$EDITOR map.json # answer what is null — read `suggested` — correct what is wrong
|
|
519
571
|
ekwo import fec 123456789FEC20251231.txt --mapping map.json --open-years
|
|
520
572
|
ekwo import trial-balance balance.csv --opening-date 2026-01-01 --dry-run --save-mapping map.json
|
|
521
573
|
ekwo import journal-items items.csv accounts.csv partners.csv --dry-run --save-mapping map.json
|
|
@@ -540,23 +592,33 @@ official page and state.
|
|
|
540
592
|
|
|
541
593
|
**The correspondence is yours.** Every account of the old chart has to become
|
|
542
594
|
an account of the company's chart, and every old journal a journal of the
|
|
543
|
-
company. The
|
|
544
|
-
|
|
545
|
-
|
|
546
|
-
|
|
547
|
-
|
|
595
|
+
company. The codes give a candidate — the same code, the same digits without
|
|
596
|
+
the zeros a chart pads with (`411` and `411000`), or the account whose digits
|
|
597
|
+
are the longest beginning of the old code, three at least (`401ACME` and
|
|
598
|
+
`401000`); a tie is no answer — and what the files say of the old account —
|
|
599
|
+
the type its export gives it, its name, the side of its balance — is held
|
|
600
|
+
against the type of the candidate in the chart, because two charts give the
|
|
601
|
+
same digits to different things. Only the same code, not contradicted, is
|
|
602
|
+
`exact`. Anything else is `suggested`, with its reason, and waits for you; a
|
|
603
|
+
candidate the files contradict is dropped for the one account of the chart of
|
|
604
|
+
the kind they say. `--dry-run` prints the lines to read first, each with its
|
|
605
|
+
reason, and `--save-mapping` writes the correspondence as JSON:
|
|
548
606
|
|
|
549
607
|
```json
|
|
550
608
|
{
|
|
551
609
|
"version": 1,
|
|
552
610
|
"source": "fec",
|
|
553
|
-
"accounts": { "411000": "411000", "401ACME":
|
|
554
|
-
"journals": { "VE": "SAL", "AN": "@opening", "BQ1": "MISC" }
|
|
611
|
+
"accounts": { "411000": "411000", "401ACME": null, "471200": null },
|
|
612
|
+
"journals": { "VE": "SAL", "AN": "@opening", "BQ1": "MISC" },
|
|
613
|
+
"suggested": { "401ACME": { "target": "401000", "reason": "the longest beginning of the code the chart has; …" } }
|
|
555
614
|
}
|
|
556
615
|
```
|
|
557
616
|
|
|
558
617
|
and `--mapping` gives it back: what it answers wins over the proposal, so the
|
|
559
|
-
second run posts what the first one showed. A
|
|
618
|
+
second run posts what the first one showed. A suggestion is confirmed by
|
|
619
|
+
writing its code under `accounts`; `--accept-suggestions` takes all of them
|
|
620
|
+
once you have read them. Nothing is posted while one the books use is only
|
|
621
|
+
suggested. A journal mapped to `@opening`
|
|
560
622
|
becomes the opening entry of its year instead of ordinary entries — the
|
|
561
623
|
*à-nouveaux* of a FEC, typically. A journal whose code is the one the pack
|
|
562
624
|
opens years on is proposed as `@opening` on its own; `*` stands for entries
|
|
@@ -580,7 +642,7 @@ dry run reads the file and asks nothing: a statement books nothing anyway.
|
|
|
580
642
|
What else to know:
|
|
581
643
|
|
|
582
644
|
- **Refused before the database is asked**, and listed under `refusals` by a
|
|
583
|
-
dry run: an account or a journal with no answer, books whose reader found
|
|
645
|
+
dry run: an account or a journal with no answer or only a suggestion, books whose reader found
|
|
584
646
|
something that does not add up (an entry that does not balance, a line of a
|
|
585
647
|
draft entry), a currency the files name that is not the company's.
|
|
586
648
|
- **The numbers** are drawn by the journal each entry goes to; the old number
|
|
@@ -592,7 +654,8 @@ What else to know:
|
|
|
592
654
|
statements, and no box of a VAT return. A period kept elsewhere was declared
|
|
593
655
|
from where it was kept.
|
|
594
656
|
- **The same files twice are refused** (`import_already_done`): `book_imports`
|
|
595
|
-
keeps the checksum of what each import read
|
|
657
|
+
keeps the checksum of what each import read, and the refusal says which
|
|
658
|
+
files, when, and what that import wrote.
|
|
596
659
|
- **Dates and encodings are said, never guessed**: `--encoding` for a file
|
|
597
660
|
that is not UTF-8, `--date-order` for a report that writes dates in digits.
|
|
598
661
|
- **Reconciliation marks are read and not re-applied yet**: the matching of an
|
|
@@ -631,9 +694,23 @@ them as history it has no file for.
|
|
|
631
694
|
|
|
632
695
|
## `ekwo company`
|
|
633
696
|
|
|
634
|
-
A firm keeps several companies in one installation,
|
|
635
|
-
|
|
636
|
-
|
|
697
|
+
A firm keeps several companies in one installation, each in its own country,
|
|
698
|
+
and each of them belongs to somebody. `new` creates one and `list` shows them —
|
|
699
|
+
see [several countries](#several-countries-in-one-installation-init---no-company):
|
|
700
|
+
|
|
701
|
+
```sh
|
|
702
|
+
ekwo company new "My Company Belgium" --country BE --chart default --language fr
|
|
703
|
+
ekwo company new "My Company France" --country FR --language fr
|
|
704
|
+
ekwo company list # name, country, currency, language, chart, pack, members
|
|
705
|
+
```
|
|
706
|
+
|
|
707
|
+
`company new --json` answers the company (`id`, `country`, `currency`,
|
|
708
|
+
`language`, `chart`, `packVersion`), its first financial year and its owner;
|
|
709
|
+
`company list --json` answers `companies`, one per company. Both shapes are
|
|
710
|
+
under `$defs/data` of the output schema, and the exit codes are the ones every
|
|
711
|
+
command has: 2 for a missing answer, 3 when the database refuses.
|
|
712
|
+
|
|
713
|
+
The two commands below are how a company leaves, and arrives somewhere else.
|
|
637
714
|
|
|
638
715
|
```sh
|
|
639
716
|
ekwo company export "My Company" --out ./my-company # manifest.json + data/<schema>.<table>.jsonl
|
|
@@ -810,7 +887,7 @@ Every command takes the connection flags:
|
|
|
810
887
|
| `--db-password <pw>` | Database password. Prompted, masked, when omitted. |
|
|
811
888
|
| `--db-region <region>` | With `--project-ref`, the session pooler in that region. Both generation prefixes are tried and the one that answers is kept. |
|
|
812
889
|
| `--supabase-url <url>` | `https://<ref>.supabase.co`. Needed only to create a user. |
|
|
813
|
-
| `--service-role-key <key>` | Needed only to create a user. |
|
|
890
|
+
| `--service-role-key <key>` | Needed only to create a user. Either form Supabase issues: a secret key, `sb_secret_…`, sent on the `apikey` header alone because it is not a JWT, or the legacy `service_role` JWT, sent on `apikey` and as a Bearer as before. |
|
|
814
891
|
| `--yes`, `-y` | Never ask a question. Everything must come from flags or the environment. |
|
|
815
892
|
|
|
816
893
|
`--project-ref` with `--db-password` and `--db-region` builds the session
|
|
@@ -845,6 +922,12 @@ dashboard under Connect → Session pooler, is the form that is never derived.
|
|
|
845
922
|
| `--register` | Register without being asked. `--register-email` sets the address. |
|
|
846
923
|
| `--registry-url <url>` | Where the registration is announced. |
|
|
847
924
|
| `--no-modules` | Leave the modules out. By default `init` installs them, as `ekwo migrate` does — empty schemas until a company enables one. |
|
|
925
|
+
| `--no-company` | Install without a company: schema, every pack, the modules, the first administrator, and no country on the instance row. The flags that only describe a company are refused with it. Then `ekwo company new`, once per company. |
|
|
926
|
+
|
|
927
|
+
`ekwo company new <name>` takes `--country`, `--chart`, `--language`,
|
|
928
|
+
`--currency`, `--fiscal-year` and `--fiscal-year-start` as `init` does, and
|
|
929
|
+
`--as-user <uuid>`: the administrator of the installation it is created as,
|
|
930
|
+
who becomes its owner — the only one, when there is exactly one.
|
|
848
931
|
|
|
849
932
|
Every command takes `--json`; see [what a command answers](#what-a-command-answers---json-and-the-exit-codes).
|
|
850
933
|
`ekwo migrate` takes `--skip-seeds`.
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
|
-
"schemaVersion": "0.
|
|
3
|
-
"migration": "
|
|
2
|
+
"schemaVersion": "0.8.0",
|
|
3
|
+
"migration": "20260923093000",
|
|
4
4
|
"socle": {
|
|
5
5
|
"schema": "public",
|
|
6
6
|
"tables": [
|
|
@@ -3743,6 +3743,10 @@
|
|
|
3743
3743
|
"name": "amount_text_format",
|
|
3744
3744
|
"arguments": "p_rounding money_rounding"
|
|
3745
3745
|
},
|
|
3746
|
+
{
|
|
3747
|
+
"name": "api_key_company",
|
|
3748
|
+
"arguments": ""
|
|
3749
|
+
},
|
|
3746
3750
|
{
|
|
3747
3751
|
"name": "assert_may_close_year",
|
|
3748
3752
|
"arguments": ""
|
|
@@ -3931,6 +3935,10 @@
|
|
|
3931
3935
|
"name": "declaration_period_start",
|
|
3932
3936
|
"arguments": "p_period declaration_period, p_day date"
|
|
3933
3937
|
},
|
|
3938
|
+
{
|
|
3939
|
+
"name": "default_statement_code",
|
|
3940
|
+
"arguments": "p_company_id uuid, p_kind text, p_at date"
|
|
3941
|
+
},
|
|
3934
3942
|
{
|
|
3935
3943
|
"name": "disable_module",
|
|
3936
3944
|
"arguments": "p_company_id uuid, p_code text"
|
|
@@ -3999,6 +4007,10 @@
|
|
|
3999
4007
|
"name": "ec_sales_list",
|
|
4000
4008
|
"arguments": "p_company_id uuid, p_from date, p_to date, p_report_code text"
|
|
4001
4009
|
},
|
|
4010
|
+
{
|
|
4011
|
+
"name": "ekwo_pre_request",
|
|
4012
|
+
"arguments": ""
|
|
4013
|
+
},
|
|
4002
4014
|
{
|
|
4003
4015
|
"name": "ekwo_schema_version",
|
|
4004
4016
|
"arguments": ""
|
|
@@ -4095,6 +4107,10 @@
|
|
|
4095
4107
|
"name": "financial_statement",
|
|
4096
4108
|
"arguments": "p_company_id uuid, p_statement_code text, p_from date, p_to date"
|
|
4097
4109
|
},
|
|
4110
|
+
{
|
|
4111
|
+
"name": "financial_statement_of_kind",
|
|
4112
|
+
"arguments": "p_company_id uuid, p_kind text, p_from date, p_to date"
|
|
4113
|
+
},
|
|
4098
4114
|
{
|
|
4099
4115
|
"name": "fiscal_year_at",
|
|
4100
4116
|
"arguments": "p_company_id uuid, p_date date"
|
|
@@ -4151,6 +4167,10 @@
|
|
|
4151
4167
|
"name": "install_country_template",
|
|
4152
4168
|
"arguments": "p_company_id uuid, p_country character, p_language character, p_chart_code text"
|
|
4153
4169
|
},
|
|
4170
|
+
{
|
|
4171
|
+
"name": "installed_schema_version",
|
|
4172
|
+
"arguments": ""
|
|
4173
|
+
},
|
|
4154
4174
|
{
|
|
4155
4175
|
"name": "instance_has_no_admin",
|
|
4156
4176
|
"arguments": ""
|
|
@@ -4183,6 +4203,10 @@
|
|
|
4183
4203
|
"name": "is_instance_admin",
|
|
4184
4204
|
"arguments": ""
|
|
4185
4205
|
},
|
|
4206
|
+
{
|
|
4207
|
+
"name": "is_known_caller",
|
|
4208
|
+
"arguments": ""
|
|
4209
|
+
},
|
|
4186
4210
|
{
|
|
4187
4211
|
"name": "label_for",
|
|
4188
4212
|
"arguments": "p_name text, p_i18n jsonb, p_languages text[]"
|
|
@@ -4315,6 +4339,10 @@
|
|
|
4315
4339
|
"name": "prepare_filing",
|
|
4316
4340
|
"arguments": "p_company_id uuid, p_from date, p_to date, p_report_code text"
|
|
4317
4341
|
},
|
|
4342
|
+
{
|
|
4343
|
+
"name": "present_api_key",
|
|
4344
|
+
"arguments": "p_secret text"
|
|
4345
|
+
},
|
|
4318
4346
|
{
|
|
4319
4347
|
"name": "purge_audit_log",
|
|
4320
4348
|
"arguments": "p_before date"
|
|
@@ -6817,6 +6845,19 @@
|
|
|
6817
6845
|
"execute"
|
|
6818
6846
|
]
|
|
6819
6847
|
},
|
|
6848
|
+
{
|
|
6849
|
+
"name": "api_key_company",
|
|
6850
|
+
"arguments": "",
|
|
6851
|
+
"anon": [
|
|
6852
|
+
"execute"
|
|
6853
|
+
],
|
|
6854
|
+
"authenticated": [
|
|
6855
|
+
"execute"
|
|
6856
|
+
],
|
|
6857
|
+
"service_role": [
|
|
6858
|
+
"execute"
|
|
6859
|
+
]
|
|
6860
|
+
},
|
|
6820
6861
|
{
|
|
6821
6862
|
"name": "assert_may_close_year",
|
|
6822
6863
|
"arguments": "",
|
|
@@ -7281,6 +7322,17 @@
|
|
|
7281
7322
|
"execute"
|
|
7282
7323
|
]
|
|
7283
7324
|
},
|
|
7325
|
+
{
|
|
7326
|
+
"name": "default_statement_code",
|
|
7327
|
+
"arguments": "p_company_id uuid, p_kind text, p_at date",
|
|
7328
|
+
"anon": [],
|
|
7329
|
+
"authenticated": [
|
|
7330
|
+
"execute"
|
|
7331
|
+
],
|
|
7332
|
+
"service_role": [
|
|
7333
|
+
"execute"
|
|
7334
|
+
]
|
|
7335
|
+
},
|
|
7284
7336
|
{
|
|
7285
7337
|
"name": "disable_module",
|
|
7286
7338
|
"arguments": "p_company_id uuid, p_code text",
|
|
@@ -7441,6 +7493,19 @@
|
|
|
7441
7493
|
"execute"
|
|
7442
7494
|
]
|
|
7443
7495
|
},
|
|
7496
|
+
{
|
|
7497
|
+
"name": "ekwo_pre_request",
|
|
7498
|
+
"arguments": "",
|
|
7499
|
+
"anon": [
|
|
7500
|
+
"execute"
|
|
7501
|
+
],
|
|
7502
|
+
"authenticated": [
|
|
7503
|
+
"execute"
|
|
7504
|
+
],
|
|
7505
|
+
"service_role": [
|
|
7506
|
+
"execute"
|
|
7507
|
+
]
|
|
7508
|
+
},
|
|
7444
7509
|
{
|
|
7445
7510
|
"name": "ekwo_schema_version",
|
|
7446
7511
|
"arguments": "",
|
|
@@ -7684,6 +7749,17 @@
|
|
|
7684
7749
|
"execute"
|
|
7685
7750
|
]
|
|
7686
7751
|
},
|
|
7752
|
+
{
|
|
7753
|
+
"name": "financial_statement_of_kind",
|
|
7754
|
+
"arguments": "p_company_id uuid, p_kind text, p_from date, p_to date",
|
|
7755
|
+
"anon": [],
|
|
7756
|
+
"authenticated": [
|
|
7757
|
+
"execute"
|
|
7758
|
+
],
|
|
7759
|
+
"service_role": [
|
|
7760
|
+
"execute"
|
|
7761
|
+
]
|
|
7762
|
+
},
|
|
7687
7763
|
{
|
|
7688
7764
|
"name": "fiscal_year_at",
|
|
7689
7765
|
"arguments": "p_company_id uuid, p_date date",
|
|
@@ -7834,6 +7910,19 @@
|
|
|
7834
7910
|
"execute"
|
|
7835
7911
|
]
|
|
7836
7912
|
},
|
|
7913
|
+
{
|
|
7914
|
+
"name": "installed_schema_version",
|
|
7915
|
+
"arguments": "",
|
|
7916
|
+
"anon": [
|
|
7917
|
+
"execute"
|
|
7918
|
+
],
|
|
7919
|
+
"authenticated": [
|
|
7920
|
+
"execute"
|
|
7921
|
+
],
|
|
7922
|
+
"service_role": [
|
|
7923
|
+
"execute"
|
|
7924
|
+
]
|
|
7925
|
+
},
|
|
7837
7926
|
{
|
|
7838
7927
|
"name": "instance_has_no_admin",
|
|
7839
7928
|
"arguments": "",
|
|
@@ -7932,6 +8021,19 @@
|
|
|
7932
8021
|
"execute"
|
|
7933
8022
|
]
|
|
7934
8023
|
},
|
|
8024
|
+
{
|
|
8025
|
+
"name": "is_known_caller",
|
|
8026
|
+
"arguments": "",
|
|
8027
|
+
"anon": [
|
|
8028
|
+
"execute"
|
|
8029
|
+
],
|
|
8030
|
+
"authenticated": [
|
|
8031
|
+
"execute"
|
|
8032
|
+
],
|
|
8033
|
+
"service_role": [
|
|
8034
|
+
"execute"
|
|
8035
|
+
]
|
|
8036
|
+
},
|
|
7935
8037
|
{
|
|
7936
8038
|
"name": "label_for",
|
|
7937
8039
|
"arguments": "p_name text, p_i18n jsonb, p_languages text[]",
|
|
@@ -8294,6 +8396,19 @@
|
|
|
8294
8396
|
"execute"
|
|
8295
8397
|
]
|
|
8296
8398
|
},
|
|
8399
|
+
{
|
|
8400
|
+
"name": "present_api_key",
|
|
8401
|
+
"arguments": "p_secret text",
|
|
8402
|
+
"anon": [
|
|
8403
|
+
"execute"
|
|
8404
|
+
],
|
|
8405
|
+
"authenticated": [
|
|
8406
|
+
"execute"
|
|
8407
|
+
],
|
|
8408
|
+
"service_role": [
|
|
8409
|
+
"execute"
|
|
8410
|
+
]
|
|
8411
|
+
},
|
|
8297
8412
|
{
|
|
8298
8413
|
"name": "purge_audit_log",
|
|
8299
8414
|
"arguments": "p_before date",
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
-- Ekwo OS — an installation is not in a country; its companies are.
|
|
2
|
+
--
|
|
3
|
+
-- `instance.country` was `not null` because the installation used to be set up
|
|
4
|
+
-- *for* one country: `ekwo init` created the first company in the same run and
|
|
5
|
+
-- wrote its country on the instance row. It never meant more than that. The
|
|
6
|
+
-- seeds of every pack are loaded whatever it says, `create_company()` takes a
|
|
7
|
+
-- country per company, and nothing in the schema reads the column — a firm
|
|
8
|
+
-- keeping the books of companies in two countries has had one installation
|
|
9
|
+
-- for both since the first release.
|
|
10
|
+
--
|
|
11
|
+
-- `ekwo init --no-company` installs the schema, the packs and the first
|
|
12
|
+
-- administrator and creates no company, so there is no country to write down,
|
|
13
|
+
-- and inventing one would be a default nobody chose. The column becomes
|
|
14
|
+
-- nullable. The format check stays: a country, when there is one, is still two
|
|
15
|
+
-- capital letters, and a null passes a check by definition.
|
|
16
|
+
--
|
|
17
|
+
-- `init_instance()` is unchanged: `upper(null)` is null, and the row now takes
|
|
18
|
+
-- it. An installation set up with a company keeps the country of that company,
|
|
19
|
+
-- as before.
|
|
20
|
+
|
|
21
|
+
alter table instance alter column country drop not null;
|
|
22
|
+
|
|
23
|
+
comment on column instance.country is
|
|
24
|
+
'The country of the first company, when `ekwo init` created one with the installation. Null for an installation set up without a company. Informative: every company carries its own country, and nothing reads this one to decide anything.';
|