@danielarndt0/cnpj-db-loader 2.4.0-beta.3 → 2.4.0-beta.4

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/docs/commands.md CHANGED
@@ -2,6 +2,10 @@
2
2
 
3
3
  | Command | Purpose |
4
4
  | ------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------- |
5
+ | `federal-revenue config set` | Persist Federal Revenue WebDAV settings such as share token, WebDAV URL, and user agent in the local config file. |
6
+ | `federal-revenue config show` | Show the effective Federal Revenue configuration. |
7
+ | `federal-revenue config test` | Test the configured Federal Revenue WebDAV connection. |
8
+ | `federal-revenue config reset` | Reset one or all persisted Federal Revenue settings. |
5
9
  | `federal-revenue check` | Check the selected or latest Federal Revenue monthly CNPJ reference and list the remote ZIP files. |
6
10
  | `federal-revenue download` | Download the selected Federal Revenue monthly CNPJ ZIP files with retries, `.part` files, and skip-on-existing behavior. |
7
11
  | `federal-revenue status` | Read the local Federal Revenue manifest and report downloaded, failed, partial, and missing files. |
@@ -35,6 +39,8 @@
35
39
  ## Examples
36
40
 
37
41
  ```bash
42
+ cnpj-db-loader federal-revenue config set share-token "<public-share-token>"
43
+ cnpj-db-loader federal-revenue config test
38
44
  cnpj-db-loader federal-revenue check
39
45
  cnpj-db-loader federal-revenue check 2026-05
40
46
  cnpj-db-loader federal-revenue download --output ./downloads --force
@@ -10,9 +10,14 @@ check/download -> extract -> validate -> sanitize -> import
10
10
 
11
11
  The command also has the shorter alias `revenue`.
12
12
 
13
+ The public Federal Revenue share token is no longer embedded in the package. Configure it locally before using remote commands, or pass it with `--share-token` when running a command.
14
+
13
15
  ## Commands
14
16
 
15
17
  ```bash
18
+ cnpj-db-loader federal-revenue config set share-token "<public-share-token>"
19
+ cnpj-db-loader federal-revenue config show
20
+ cnpj-db-loader federal-revenue config test
16
21
  cnpj-db-loader federal-revenue check
17
22
  cnpj-db-loader federal-revenue download --output ./downloads --force
18
23
  cnpj-db-loader federal-revenue status --output ./downloads
@@ -29,6 +34,34 @@ cnpj-db-loader revenue status 2026-05 --output ./downloads
29
34
  cnpj-db-loader revenue retry 2026-05 --output ./downloads --force
30
35
  ```
31
36
 
37
+ ## Configuration
38
+
39
+ Federal Revenue WebDAV settings are stored in the same local CNPJ DB Loader config file used by `database config`. This keeps endpoint-specific values outside the published npm package.
40
+
41
+ ```bash
42
+ cnpj-db-loader federal-revenue config set share-token "<public-share-token>"
43
+ cnpj-db-loader federal-revenue config set webdav-url "https://arquivos.receitafederal.gov.br/public.php/webdav"
44
+ cnpj-db-loader federal-revenue config set user-agent "cnpj-db-loader federal-revenue-client"
45
+ cnpj-db-loader federal-revenue config show
46
+ cnpj-db-loader federal-revenue config test
47
+ cnpj-db-loader federal-revenue config reset share-token --force
48
+ cnpj-db-loader federal-revenue config reset --force
49
+ ```
50
+
51
+ Configuration keys:
52
+
53
+ | Key | Purpose | Default |
54
+ | ------------- | ------------------------------------------------------------------------ | ---------------------------------------------------------------- |
55
+ | `share-token` | Public Federal Revenue share token used for WebDAV Basic authentication. | No default. Must be configured or provided with `--share-token`. |
56
+ | `webdav-url` | Federal Revenue WebDAV endpoint. | `https://arquivos.receitafederal.gov.br/public.php/webdav` |
57
+ | `user-agent` | HTTP user agent used by Federal Revenue requests. | `cnpj-db-loader federal-revenue-client` |
58
+
59
+ Command-line overrides still have priority over persisted configuration:
60
+
61
+ ```bash
62
+ cnpj-db-loader federal-revenue check --share-token "<token>" --base-url "https://arquivos.receitafederal.gov.br/public.php/webdav"
63
+ ```
64
+
32
65
  ## Reference selection
33
66
 
34
67
  By default, remote commands list the public share and select the latest available folder in the `YYYY-MM` format.
@@ -215,8 +248,9 @@ cnpj-db-loader federal-revenue sync \
215
248
  | `--load-batch-size <size>` | `sync` | Import load batch size. |
216
249
  | `--materialize-batch-size <size>` | `sync` | Materialization chunk size. |
217
250
  | `--verbose-progress` | `sync` | Show detailed import progress. |
218
- | `--base-url <url>` | `check`, `download`, `retry`, `sync` | Override the WebDAV base URL. |
219
- | `--share-token <token>` | `check`, `download`, `retry`, `sync` | Override the public share token. |
251
+ | `--base-url <url>` | `check`, `download`, `status`, `retry`, `clean`, `sync` | Override the WebDAV base URL. |
252
+ | `--share-token <token>` | `check`, `download`, `status`, `retry`, `clean`, `sync` | Override the public share token. |
253
+ | `--user-agent <value>` | `check`, `download`, `status`, `retry`, `clean`, `sync` | Override the HTTP user agent. |
220
254
  | `--force` | `download`, `retry`, `clean`, `sync` | Skip confirmation prompts. |
221
255
 
222
256
  ## Notes
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@danielarndt0/cnpj-db-loader",
3
- "version": "2.4.0-beta.3",
3
+ "version": "2.4.0-beta.4",
4
4
  "publishConfig": {
5
5
  "access": "public"
6
6
  },
@@ -1,42 +0,0 @@
1
- # v2.4.0-beta.3 — Modular PostgreSQL Direct Import Scripts
2
-
3
- This beta release improves the hybrid PostgreSQL direct import mode with modular SQL generation, transaction mode selection and PostgreSQL monitoring documentation.
4
-
5
- ## Added
6
-
7
- - Added `--transaction-mode single|phase|none` to `postgres generate-script`.
8
- - Added modular SQL output for the PostgreSQL direct import workflow.
9
- - Added `import-postgres-direct.sql` as an orchestrator script.
10
- - Added individual phase scripts:
11
- - `setup.sql`
12
- - `load-domains.sql`
13
- - `load-companies.sql`
14
- - `load-establishments.sql`
15
- - `load-partners.sql`
16
- - `load-simples.sql`
17
- - `materialize.sql`
18
- - `materialize-secondary-cnaes.sql`
19
- - `indexes.sql`
20
- - `analyze.sql`
21
- - Added manifest metadata for generated steps and dependencies.
22
- - Added improved `\echo` progress messages in generated scripts.
23
- - Added `--include <items>` for partial script generation.
24
- - Added `--skip-indexes` and `--skip-analyze`.
25
- - Added PostgreSQL monitoring documentation with SQL snippets for:
26
- - `pg_stat_activity`
27
- - `pg_stat_progress_copy`
28
- - locks
29
- - table sizes
30
- - estimated table rows
31
- - PostgreSQL logs on Windows
32
-
33
- ## Changed
34
-
35
- - The hybrid direct import path now generates multiple SQL files instead of only one large script.
36
- - The default orchestrator still remains `import-postgres-direct.sql`.
37
- - The generated manifest now describes transaction mode, included targets, script files and steps.
38
- - PostgreSQL direct import logs are clearer during long-running loads.
39
-
40
- ## Notes
41
-
42
- This is still a beta release. The goal is to validate the modular script layout and transaction modes with full Receita Federal datasets before stabilizing the hybrid path.