ermes-cli 1.5.1__tar.gz → 1.6.0__tar.gz
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.
- {ermes_cli-1.5.1 → ermes_cli-1.6.0}/PKG-INFO +145 -2
- {ermes_cli-1.5.1 → ermes_cli-1.6.0}/README.md +144 -1
- ermes_cli-1.6.0/ermes_cli/__init__.py +1 -0
- {ermes_cli-1.5.1 → ermes_cli-1.6.0}/ermes_cli/client.py +5 -1
- ermes_cli-1.6.0/ermes_cli/commands/automation.py +787 -0
- ermes_cli-1.6.0/ermes_cli/commands/body_stdin.py +93 -0
- {ermes_cli-1.5.1 → ermes_cli-1.6.0}/ermes_cli/commands/campaigns.py +20 -6
- {ermes_cli-1.5.1 → ermes_cli-1.6.0}/ermes_cli/commands/templates.py +18 -5
- {ermes_cli-1.5.1 → ermes_cli-1.6.0}/ermes_cli/main.py +77 -0
- {ermes_cli-1.5.1 → ermes_cli-1.6.0}/ermes_cli/update.py +5 -2
- {ermes_cli-1.5.1 → ermes_cli-1.6.0}/pyproject.toml +1 -1
- ermes_cli-1.6.0/tests/conftest.py +105 -0
- ermes_cli-1.6.0/tests/test_automation.py +1140 -0
- ermes_cli-1.6.0/tests/test_automation_create.py +485 -0
- {ermes_cli-1.5.1 → ermes_cli-1.6.0}/tests/test_commands/test_campaigns.py +52 -0
- {ermes_cli-1.5.1 → ermes_cli-1.6.0}/tests/test_commands/test_templates.py +48 -0
- {ermes_cli-1.5.1 → ermes_cli-1.6.0}/tests/test_update.py +8 -0
- ermes_cli-1.5.1/ermes_cli/__init__.py +0 -1
- ermes_cli-1.5.1/tests/conftest.py +0 -44
- {ermes_cli-1.5.1 → ermes_cli-1.6.0}/.gitignore +0 -0
- {ermes_cli-1.5.1 → ermes_cli-1.6.0}/ermes_cli/admin_api.py +0 -0
- {ermes_cli-1.5.1 → ermes_cli-1.6.0}/ermes_cli/auth0.py +0 -0
- {ermes_cli-1.5.1 → ermes_cli-1.6.0}/ermes_cli/commands/__init__.py +0 -0
- {ermes_cli-1.5.1 → ermes_cli-1.6.0}/ermes_cli/commands/auth_cmds.py +0 -0
- {ermes_cli-1.5.1 → ermes_cli-1.6.0}/ermes_cli/commands/config_cmd.py +0 -0
- {ermes_cli-1.5.1 → ermes_cli-1.6.0}/ermes_cli/commands/data_paths.py +0 -0
- {ermes_cli-1.5.1 → ermes_cli-1.6.0}/ermes_cli/commands/export.py +0 -0
- {ermes_cli-1.5.1 → ermes_cli-1.6.0}/ermes_cli/commands/ingest.py +0 -0
- {ermes_cli-1.5.1 → ermes_cli-1.6.0}/ermes_cli/commands/journeys.py +0 -0
- {ermes_cli-1.5.1 → ermes_cli-1.6.0}/ermes_cli/commands/keys.py +0 -0
- {ermes_cli-1.5.1 → ermes_cli-1.6.0}/ermes_cli/commands/lists.py +0 -0
- {ermes_cli-1.5.1 → ermes_cli-1.6.0}/ermes_cli/commands/metrics.py +0 -0
- {ermes_cli-1.5.1 → ermes_cli-1.6.0}/ermes_cli/commands/projects.py +0 -0
- {ermes_cli-1.5.1 → ermes_cli-1.6.0}/ermes_cli/commands/providers.py +0 -0
- {ermes_cli-1.5.1 → ermes_cli-1.6.0}/ermes_cli/commands/skill.py +0 -0
- {ermes_cli-1.5.1 → ermes_cli-1.6.0}/ermes_cli/commands/subscriptions.py +0 -0
- {ermes_cli-1.5.1 → ermes_cli-1.6.0}/ermes_cli/commands/tags.py +0 -0
- {ermes_cli-1.5.1 → ermes_cli-1.6.0}/ermes_cli/commands/users.py +0 -0
- {ermes_cli-1.5.1 → ermes_cli-1.6.0}/ermes_cli/commands/write_cmds.py +0 -0
- {ermes_cli-1.5.1 → ermes_cli-1.6.0}/ermes_cli/config.py +0 -0
- {ermes_cli-1.5.1 → ermes_cli-1.6.0}/ermes_cli/errors.py +0 -0
- {ermes_cli-1.5.1 → ermes_cli-1.6.0}/ermes_cli/export_utils.py +0 -0
- {ermes_cli-1.5.1 → ermes_cli-1.6.0}/ermes_cli/keyring_store.py +0 -0
- {ermes_cli-1.5.1 → ermes_cli-1.6.0}/ermes_cli/output.py +0 -0
- {ermes_cli-1.5.1 → ermes_cli-1.6.0}/ermes_cli/rules.py +0 -0
- {ermes_cli-1.5.1 → ermes_cli-1.6.0}/ermes_cli/skill/SKILL.md +0 -0
- {ermes_cli-1.5.1 → ermes_cli-1.6.0}/ermes_cli/write_mode.py +0 -0
- {ermes_cli-1.5.1 → ermes_cli-1.6.0}/scripts/install-cli.sh +0 -0
- {ermes_cli-1.5.1 → ermes_cli-1.6.0}/tests/__init__.py +0 -0
- {ermes_cli-1.5.1 → ermes_cli-1.6.0}/tests/test_admin_api.py +0 -0
- {ermes_cli-1.5.1 → ermes_cli-1.6.0}/tests/test_auth0.py +0 -0
- {ermes_cli-1.5.1 → ermes_cli-1.6.0}/tests/test_auth_cmds.py +0 -0
- {ermes_cli-1.5.1 → ermes_cli-1.6.0}/tests/test_client.py +0 -0
- {ermes_cli-1.5.1 → ermes_cli-1.6.0}/tests/test_commands/__init__.py +0 -0
- {ermes_cli-1.5.1 → ermes_cli-1.6.0}/tests/test_commands/test_data_paths.py +0 -0
- {ermes_cli-1.5.1 → ermes_cli-1.6.0}/tests/test_commands/test_export.py +0 -0
- {ermes_cli-1.5.1 → ermes_cli-1.6.0}/tests/test_commands/test_ingest.py +0 -0
- {ermes_cli-1.5.1 → ermes_cli-1.6.0}/tests/test_commands/test_journeys.py +0 -0
- {ermes_cli-1.5.1 → ermes_cli-1.6.0}/tests/test_commands/test_keys.py +0 -0
- {ermes_cli-1.5.1 → ermes_cli-1.6.0}/tests/test_commands/test_lists.py +0 -0
- {ermes_cli-1.5.1 → ermes_cli-1.6.0}/tests/test_commands/test_metrics.py +0 -0
- {ermes_cli-1.5.1 → ermes_cli-1.6.0}/tests/test_commands/test_projects.py +0 -0
- {ermes_cli-1.5.1 → ermes_cli-1.6.0}/tests/test_commands/test_projects_list.py +0 -0
- {ermes_cli-1.5.1 → ermes_cli-1.6.0}/tests/test_commands/test_providers.py +0 -0
- {ermes_cli-1.5.1 → ermes_cli-1.6.0}/tests/test_commands/test_subscriptions.py +0 -0
- {ermes_cli-1.5.1 → ermes_cli-1.6.0}/tests/test_commands/test_tags.py +0 -0
- {ermes_cli-1.5.1 → ermes_cli-1.6.0}/tests/test_commands/test_users.py +0 -0
- {ermes_cli-1.5.1 → ermes_cli-1.6.0}/tests/test_config.py +0 -0
- {ermes_cli-1.5.1 → ermes_cli-1.6.0}/tests/test_connection_errors.py +0 -0
- {ermes_cli-1.5.1 → ermes_cli-1.6.0}/tests/test_export_utils.py +0 -0
- {ermes_cli-1.5.1 → ermes_cli-1.6.0}/tests/test_keyring_store.py +0 -0
- {ermes_cli-1.5.1 → ermes_cli-1.6.0}/tests/test_output.py +0 -0
- {ermes_cli-1.5.1 → ermes_cli-1.6.0}/tests/test_projects_config.py +0 -0
- {ermes_cli-1.5.1 → ermes_cli-1.6.0}/tests/test_rules.py +0 -0
- {ermes_cli-1.5.1 → ermes_cli-1.6.0}/tests/test_skill_command.py +0 -0
- {ermes_cli-1.5.1 → ermes_cli-1.6.0}/tests/test_version.py +0 -0
- {ermes_cli-1.5.1 → ermes_cli-1.6.0}/tests/test_whoami.py +0 -0
- {ermes_cli-1.5.1 → ermes_cli-1.6.0}/tests/test_write_cmds.py +0 -0
- {ermes_cli-1.5.1 → ermes_cli-1.6.0}/tests/test_write_mode.py +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.5
|
|
2
2
|
Name: ermes-cli
|
|
3
|
-
Version: 1.
|
|
3
|
+
Version: 1.6.0
|
|
4
4
|
Summary: CLI-first access to Ermes marketing automation with Auth0 multi-project auth.
|
|
5
5
|
Project-URL: Homepage, https://ermes.publinker.com
|
|
6
6
|
Project-URL: Repository, https://github.com/Martech-DM/ermes
|
|
@@ -85,7 +85,7 @@ ermes-cli 1.2.0 is available (you have 1.1.0). Update now? [Y]es / [n]ot now / [
|
|
|
85
85
|
|
|
86
86
|
A failed upgrade or Ctrl-C at the prompt prints one line and runs your command on the current
|
|
87
87
|
version. The check never runs with `--json`, when `CI` is set, when stdin/stdout/stderr is not a
|
|
88
|
-
TTY, before `ermes version` / `ermes update`, or with `ERMES_NO_UPDATE_CHECK=1`.
|
|
88
|
+
TTY, before `ermes version` / `ermes update` / `ermes automation`, with `--body-stdin` or `--automation`, or with `ERMES_NO_UPDATE_CHECK=1`.
|
|
89
89
|
|
|
90
90
|
**Manual.**
|
|
91
91
|
|
|
@@ -295,3 +295,146 @@ The `ermes_cli/` package was originally bundled inside the legacy
|
|
|
295
295
|
`ermes-skill`. It now lives here as the single code source of truth. The
|
|
296
296
|
versioned operating skill lives at `martech-mcps/ermes/skills/ermes-ops` and
|
|
297
297
|
invokes this installed package rather than carrying a copy.
|
|
298
|
+
|
|
299
|
+
## Bootstrap automation contract (schema 1)
|
|
300
|
+
|
|
301
|
+
Bootstrap issues [#8](https://github.com/Martech-DM/ermes-bootstrap/issues/8)
|
|
302
|
+
and [#15](https://github.com/Martech-DM/ermes-bootstrap/issues/15) use a
|
|
303
|
+
restricted automation interface whose account is the profile named by global
|
|
304
|
+
`-p`. Install this CLI from this checkout with `cd cli && uv pip install -e .`
|
|
305
|
+
in an isolated environment; the version is 1.6.0. Capability discovery is
|
|
306
|
+
`ermes automation capabilities`: without `-p` it needs no credential or
|
|
307
|
+
network. It reports `schema_version`, `cli_version`, the supported operation
|
|
308
|
+
IDs, and `features: ["account-identity"]`. With `-p` it also reports
|
|
309
|
+
`account: {profile, fingerprint}` (`fingerprint` is the SHA-256 hex of the
|
|
310
|
+
profile key). `-p` currently resolves a legacy `config.yml` profile; looking
|
|
311
|
+
up `ermes login` projects by name or id is an upstream follow-up.
|
|
312
|
+
The companion bootstrap adapter lands in
|
|
313
|
+
[Martech-DM/ermes-bootstrap#14](https://github.com/Martech-DM/ermes-bootstrap/pull/14)
|
|
314
|
+
(`src/ermes_bootstrap/ermes/process_reads.py`).
|
|
315
|
+
Pre-merge candidates 0.6.0–0.10.0 were branch builds with different
|
|
316
|
+
dispatch/write-guard/validation/credential behaviour; do not pin them.
|
|
317
|
+
Release compatibility is certified by the final migration ticket, not this
|
|
318
|
+
local candidate.
|
|
319
|
+
|
|
320
|
+
Every automation call except `capabilities` without `-p` requires
|
|
321
|
+
`ermes -p <profile> ...`. There is no fallback to `ERMES_PROFILE`,
|
|
322
|
+
`ERMES_PROJECT`, the active project, or a default profile; a missing `-p`,
|
|
323
|
+
unknown profile, or profile without a key is a schema 1 `configuration`
|
|
324
|
+
error with `dispatch: "ruled_out"` before any client is built. The profile
|
|
325
|
+
supplies the key and base URL. The URL may be an origin, a custom root, or
|
|
326
|
+
end in `/api/client`; trailing slashes are accepted and the suffix is added
|
|
327
|
+
only once. Any other path is a custom root, so `https://host/api` becomes
|
|
328
|
+
`https://host/api/api/client` — store the origin or the full `/api/client`
|
|
329
|
+
URL on the profile. Plain `http` is accepted only for `localhost`, `127.0.0.1`,
|
|
330
|
+
and `::1`. Each call has a 20-second elapsed-time
|
|
331
|
+
limit, with at most 10 seconds to connect.
|
|
332
|
+
|
|
333
|
+
```sh
|
|
334
|
+
ermes -p dest automation read campaigns.page --page-size 1
|
|
335
|
+
ermes -p dest automation read campaigns.page --page-size 100 --type trigger --cursor TOKEN --page next
|
|
336
|
+
ermes -p dest automation read campaigns.get --id 123
|
|
337
|
+
ermes -p dest automation read templates.get --id 456
|
|
338
|
+
ermes -p dest automation read subscriptions.get --id 789
|
|
339
|
+
ermes -p dest automation read providers.all
|
|
340
|
+
```
|
|
341
|
+
|
|
342
|
+
`--id` must be a positive integer and `--page-size` 1–100 (the campaigns
|
|
343
|
+
route's `maxLimit`). The CLI parses these itself, so a malformed or
|
|
344
|
+
out-of-range value still yields a schema 1 `configuration` result with
|
|
345
|
+
`dispatch: "ruled_out"` and exit 1, never Typer's usage exit 2.
|
|
346
|
+
Any other malformed argv, such as an option missing its value or an extra
|
|
347
|
+
argument, is also a `configuration` result on `read`
|
|
348
|
+
and on creates with `--automation`. A value that starts with `--` must be written
|
|
349
|
+
`--option=value`. A `-p` with no value, and
|
|
350
|
+
any option given twice, are refused the same way; a profile name that starts with
|
|
351
|
+
`--` or `-p` needs `--profile=NAME`. Plain-http calls
|
|
352
|
+
to loopback ignore inherited proxy settings. An unknown option name is Click's to report: it exits 2 with no JSON.
|
|
353
|
+
|
|
354
|
+
Every `read` emits one JSON object on stdout and exits 0 only on success;
|
|
355
|
+
failure emits one JSON object and exits 1. Diagnostics belong on stderr.
|
|
356
|
+
The schema is `{schema_version: 1, ok: boolean, http_status: integer|null,
|
|
357
|
+
body: JSON response or text as received, key redacted, error: null|{type, detail}, dispatch:
|
|
358
|
+
"ruled_out"|"attempted"|"unknown", account: {profile, fingerprint}}`.
|
|
359
|
+
`account` is present once `-p` resolved a profile with a key, including on
|
|
360
|
+
errors; it is absent when resolution failed. A profile whose name contains its
|
|
361
|
+
own key is refused, because the name is emitted as is. Error types are `configuration`,
|
|
362
|
+
`transport`, `http`, and `protocol`. `http_status` is the actual response
|
|
363
|
+
status when received, never an OS exit code. `dispatch` is `attempted` when
|
|
364
|
+
response headers arrived (if the body then fails, `body` is null and the error is
|
|
365
|
+
`protocol` on a 2xx or `http` otherwise; it is not a definitive rejection; a
|
|
366
|
+
create response that is not valid JSON, or any response nested too deeply to emit, over 16 MiB, or compressed (the CLI asks for `identity`),
|
|
367
|
+
is withheld the same way; a create answered with 400 or any 5xx moves the body into `detail`
|
|
368
|
+
(a caller must keep `detail` on uncertain outcomes or the explanation is lost),
|
|
369
|
+
because the API also returns 400 or 503 for a failure after the row was inserted, except
|
|
370
|
+
the exact duplicate-locale template rejection and the invalid-lists campaign
|
|
371
|
+
rejection (code 2002), which precede the insert), `ruled_out` for local validation, client initialization, or
|
|
372
|
+
a connection that never opened (`transport` connect error or connect timeout,
|
|
373
|
+
so no request bytes were written), and `unknown` for any other transport
|
|
374
|
+
failure after request invocation began. Every occurrence of the selected key, in body keys, values, or error detail, is
|
|
375
|
+
replaced with `[REDACTED]`, so a body that echoes the key is not byte-identical
|
|
376
|
+
to the response. The fingerprint is a one-way digest and is never the key.
|
|
377
|
+
A value or body key holding a JSON-, URL- or HTML-escaped copy, however nested, is
|
|
378
|
+
replaced whole. A body with
|
|
379
|
+
duplicate keys counts as non-JSON, and a non-JSON
|
|
380
|
+
body that cannot be decoded or contains `\`, `%`, `&` or NUL is withheld (`body: null`).
|
|
381
|
+
A JSON body is decoded and re-encoded: field values are exact,
|
|
382
|
+
but whitespace and escaping are not the server's bytes.
|
|
383
|
+
`campaigns.page` preserves the API's page envelope and never flattens pages.
|
|
384
|
+
`providers.all` is projected to `id`, `name`, `type`, and `group`.
|
|
385
|
+
A provider body that cannot be projected, error bodies included, is withheld
|
|
386
|
+
(`body: null`); on a 2xx response that is a `protocol` failure.
|
|
387
|
+
The API already returns credential-free providers to an API key
|
|
388
|
+
([ermes#609](https://github.com/Martech-DM/ermes/pull/609)); the projection is
|
|
389
|
+
defence in depth, so still do not log an unprojected body.
|
|
390
|
+
|
|
391
|
+
The candidate also advertises `campaigns.create` and `templates.create`. They
|
|
392
|
+
serve the later apply slice of the parent spec
|
|
393
|
+
([ermes-bootstrap#6](https://github.com/Martech-DM/ermes-bootstrap/issues/6));
|
|
394
|
+
issue #8's diagnostics never invoke them.
|
|
395
|
+
Both resource commands accept a complete UTF-8 JSON body on stdin with
|
|
396
|
+
`--body-stdin`; ordinary profile-based use retains the existing write guard.
|
|
397
|
+
Bootstrap uses `-p <profile> --body-stdin --automation` with
|
|
398
|
+
`ERMES_ALLOW_WRITES=1` (`true`/`yes` also accepted, as for the profile guard).
|
|
399
|
+
The persistent `ermes write allow` window is never consulted:
|
|
400
|
+
|
|
401
|
+
```sh
|
|
402
|
+
ermes -p dest campaigns create --body-stdin --automation < campaign.json
|
|
403
|
+
ermes -p dest templates create --body-stdin --automation < template.json
|
|
404
|
+
```
|
|
405
|
+
|
|
406
|
+
The automation flags emit the same schema 1 envelope and exit 0 on a 2xx JSON
|
|
407
|
+
response or 1 on a local, transport, protocol, or HTTP failure. The caller must
|
|
408
|
+
validate a positive resource ID in a successful body. Each invocation issues
|
|
409
|
+
at most one POST to `/campaigns` or `/templates`; it has no mutation retry or
|
|
410
|
+
idempotency key. A transport failure has `dispatch: "unknown"` unless the
|
|
411
|
+
connection never opened, and a local validation failure or unopened connection
|
|
412
|
+
has `dispatch: "ruled_out"` — the create was certainly not sent. The HTTP client times out after
|
|
413
|
+
20 seconds, allowing bootstrap's longer watchdog to terminate and reap the
|
|
414
|
+
child process group. The entire input object is sent without field projection,
|
|
415
|
+
including MJML/HTML and Unicode strings, up to the platform's 1 MiB JSON limit:
|
|
416
|
+
a larger body is a `configuration` failure, never sent. Stdin must be strict JSON:
|
|
417
|
+
`NaN`, `Infinity`, and numbers that overflow to infinity (such as `1e400`) are
|
|
418
|
+
rejected as a `configuration` failure before any request is built, and so are
|
|
419
|
+
duplicate keys, numbers beyond ±2^53−1 in any notation, which the platform cannot
|
|
420
|
+
hold exactly, and nonzero numbers that underflow to zero. The validated bytes are sent unchanged.
|
|
421
|
+
A trigger `campaigns.create` is live immediately (`state: running`) as soon as
|
|
422
|
+
it is created, before any template exists; the contract has no delete or
|
|
423
|
+
rollback verb. The platform checks less than a send needs, so before the POST
|
|
424
|
+
the CLI reads what the body references, with the account's key and one 5-second
|
|
425
|
+
deadline for all reads. A campaign create reads `/subscriptions/{id}`, which must
|
|
426
|
+
carry that ID and the immutable channel `email` (the platform takes `channel`
|
|
427
|
+
from it), and `/providers/all`, where `provider_id` must be an `email` provider.
|
|
428
|
+
A template create reads `/campaigns/{campaign_id}`, which must carry that ID and
|
|
429
|
+
channel `email`: the platform attaches a template to any campaign ID, even
|
|
430
|
+
another account's. A mismatch or a failed read is a `configuration` failure with
|
|
431
|
+
`dispatch: "ruled_out"`, and `detail` gives the HTTP status or error type of a
|
|
432
|
+
failed read. These GETs are not reported in the result: `dispatch` describes
|
|
433
|
+
only the POST, so a create makes one or two uncounted reads plus at most one POST.
|
|
434
|
+
Each create child resolves `-p` again when it starts. It does not compare the
|
|
435
|
+
account with a fingerprint bootstrap approved earlier, so editing the profile
|
|
436
|
+
between bootstrap's check and the create sends the create to the new account;
|
|
437
|
+
the result's `account` reveals it only afterwards
|
|
438
|
+
([ermes-bootstrap#18](https://github.com/Martech-DM/ermes-bootstrap/issues/18)).
|
|
439
|
+
This 1.6.0 checkout is the
|
|
440
|
+
tested candidate; release installation remains a later migration step.
|
|
@@ -55,7 +55,7 @@ ermes-cli 1.2.0 is available (you have 1.1.0). Update now? [Y]es / [n]ot now / [
|
|
|
55
55
|
|
|
56
56
|
A failed upgrade or Ctrl-C at the prompt prints one line and runs your command on the current
|
|
57
57
|
version. The check never runs with `--json`, when `CI` is set, when stdin/stdout/stderr is not a
|
|
58
|
-
TTY, before `ermes version` / `ermes update`, or with `ERMES_NO_UPDATE_CHECK=1`.
|
|
58
|
+
TTY, before `ermes version` / `ermes update` / `ermes automation`, with `--body-stdin` or `--automation`, or with `ERMES_NO_UPDATE_CHECK=1`.
|
|
59
59
|
|
|
60
60
|
**Manual.**
|
|
61
61
|
|
|
@@ -265,3 +265,146 @@ The `ermes_cli/` package was originally bundled inside the legacy
|
|
|
265
265
|
`ermes-skill`. It now lives here as the single code source of truth. The
|
|
266
266
|
versioned operating skill lives at `martech-mcps/ermes/skills/ermes-ops` and
|
|
267
267
|
invokes this installed package rather than carrying a copy.
|
|
268
|
+
|
|
269
|
+
## Bootstrap automation contract (schema 1)
|
|
270
|
+
|
|
271
|
+
Bootstrap issues [#8](https://github.com/Martech-DM/ermes-bootstrap/issues/8)
|
|
272
|
+
and [#15](https://github.com/Martech-DM/ermes-bootstrap/issues/15) use a
|
|
273
|
+
restricted automation interface whose account is the profile named by global
|
|
274
|
+
`-p`. Install this CLI from this checkout with `cd cli && uv pip install -e .`
|
|
275
|
+
in an isolated environment; the version is 1.6.0. Capability discovery is
|
|
276
|
+
`ermes automation capabilities`: without `-p` it needs no credential or
|
|
277
|
+
network. It reports `schema_version`, `cli_version`, the supported operation
|
|
278
|
+
IDs, and `features: ["account-identity"]`. With `-p` it also reports
|
|
279
|
+
`account: {profile, fingerprint}` (`fingerprint` is the SHA-256 hex of the
|
|
280
|
+
profile key). `-p` currently resolves a legacy `config.yml` profile; looking
|
|
281
|
+
up `ermes login` projects by name or id is an upstream follow-up.
|
|
282
|
+
The companion bootstrap adapter lands in
|
|
283
|
+
[Martech-DM/ermes-bootstrap#14](https://github.com/Martech-DM/ermes-bootstrap/pull/14)
|
|
284
|
+
(`src/ermes_bootstrap/ermes/process_reads.py`).
|
|
285
|
+
Pre-merge candidates 0.6.0–0.10.0 were branch builds with different
|
|
286
|
+
dispatch/write-guard/validation/credential behaviour; do not pin them.
|
|
287
|
+
Release compatibility is certified by the final migration ticket, not this
|
|
288
|
+
local candidate.
|
|
289
|
+
|
|
290
|
+
Every automation call except `capabilities` without `-p` requires
|
|
291
|
+
`ermes -p <profile> ...`. There is no fallback to `ERMES_PROFILE`,
|
|
292
|
+
`ERMES_PROJECT`, the active project, or a default profile; a missing `-p`,
|
|
293
|
+
unknown profile, or profile without a key is a schema 1 `configuration`
|
|
294
|
+
error with `dispatch: "ruled_out"` before any client is built. The profile
|
|
295
|
+
supplies the key and base URL. The URL may be an origin, a custom root, or
|
|
296
|
+
end in `/api/client`; trailing slashes are accepted and the suffix is added
|
|
297
|
+
only once. Any other path is a custom root, so `https://host/api` becomes
|
|
298
|
+
`https://host/api/api/client` — store the origin or the full `/api/client`
|
|
299
|
+
URL on the profile. Plain `http` is accepted only for `localhost`, `127.0.0.1`,
|
|
300
|
+
and `::1`. Each call has a 20-second elapsed-time
|
|
301
|
+
limit, with at most 10 seconds to connect.
|
|
302
|
+
|
|
303
|
+
```sh
|
|
304
|
+
ermes -p dest automation read campaigns.page --page-size 1
|
|
305
|
+
ermes -p dest automation read campaigns.page --page-size 100 --type trigger --cursor TOKEN --page next
|
|
306
|
+
ermes -p dest automation read campaigns.get --id 123
|
|
307
|
+
ermes -p dest automation read templates.get --id 456
|
|
308
|
+
ermes -p dest automation read subscriptions.get --id 789
|
|
309
|
+
ermes -p dest automation read providers.all
|
|
310
|
+
```
|
|
311
|
+
|
|
312
|
+
`--id` must be a positive integer and `--page-size` 1–100 (the campaigns
|
|
313
|
+
route's `maxLimit`). The CLI parses these itself, so a malformed or
|
|
314
|
+
out-of-range value still yields a schema 1 `configuration` result with
|
|
315
|
+
`dispatch: "ruled_out"` and exit 1, never Typer's usage exit 2.
|
|
316
|
+
Any other malformed argv, such as an option missing its value or an extra
|
|
317
|
+
argument, is also a `configuration` result on `read`
|
|
318
|
+
and on creates with `--automation`. A value that starts with `--` must be written
|
|
319
|
+
`--option=value`. A `-p` with no value, and
|
|
320
|
+
any option given twice, are refused the same way; a profile name that starts with
|
|
321
|
+
`--` or `-p` needs `--profile=NAME`. Plain-http calls
|
|
322
|
+
to loopback ignore inherited proxy settings. An unknown option name is Click's to report: it exits 2 with no JSON.
|
|
323
|
+
|
|
324
|
+
Every `read` emits one JSON object on stdout and exits 0 only on success;
|
|
325
|
+
failure emits one JSON object and exits 1. Diagnostics belong on stderr.
|
|
326
|
+
The schema is `{schema_version: 1, ok: boolean, http_status: integer|null,
|
|
327
|
+
body: JSON response or text as received, key redacted, error: null|{type, detail}, dispatch:
|
|
328
|
+
"ruled_out"|"attempted"|"unknown", account: {profile, fingerprint}}`.
|
|
329
|
+
`account` is present once `-p` resolved a profile with a key, including on
|
|
330
|
+
errors; it is absent when resolution failed. A profile whose name contains its
|
|
331
|
+
own key is refused, because the name is emitted as is. Error types are `configuration`,
|
|
332
|
+
`transport`, `http`, and `protocol`. `http_status` is the actual response
|
|
333
|
+
status when received, never an OS exit code. `dispatch` is `attempted` when
|
|
334
|
+
response headers arrived (if the body then fails, `body` is null and the error is
|
|
335
|
+
`protocol` on a 2xx or `http` otherwise; it is not a definitive rejection; a
|
|
336
|
+
create response that is not valid JSON, or any response nested too deeply to emit, over 16 MiB, or compressed (the CLI asks for `identity`),
|
|
337
|
+
is withheld the same way; a create answered with 400 or any 5xx moves the body into `detail`
|
|
338
|
+
(a caller must keep `detail` on uncertain outcomes or the explanation is lost),
|
|
339
|
+
because the API also returns 400 or 503 for a failure after the row was inserted, except
|
|
340
|
+
the exact duplicate-locale template rejection and the invalid-lists campaign
|
|
341
|
+
rejection (code 2002), which precede the insert), `ruled_out` for local validation, client initialization, or
|
|
342
|
+
a connection that never opened (`transport` connect error or connect timeout,
|
|
343
|
+
so no request bytes were written), and `unknown` for any other transport
|
|
344
|
+
failure after request invocation began. Every occurrence of the selected key, in body keys, values, or error detail, is
|
|
345
|
+
replaced with `[REDACTED]`, so a body that echoes the key is not byte-identical
|
|
346
|
+
to the response. The fingerprint is a one-way digest and is never the key.
|
|
347
|
+
A value or body key holding a JSON-, URL- or HTML-escaped copy, however nested, is
|
|
348
|
+
replaced whole. A body with
|
|
349
|
+
duplicate keys counts as non-JSON, and a non-JSON
|
|
350
|
+
body that cannot be decoded or contains `\`, `%`, `&` or NUL is withheld (`body: null`).
|
|
351
|
+
A JSON body is decoded and re-encoded: field values are exact,
|
|
352
|
+
but whitespace and escaping are not the server's bytes.
|
|
353
|
+
`campaigns.page` preserves the API's page envelope and never flattens pages.
|
|
354
|
+
`providers.all` is projected to `id`, `name`, `type`, and `group`.
|
|
355
|
+
A provider body that cannot be projected, error bodies included, is withheld
|
|
356
|
+
(`body: null`); on a 2xx response that is a `protocol` failure.
|
|
357
|
+
The API already returns credential-free providers to an API key
|
|
358
|
+
([ermes#609](https://github.com/Martech-DM/ermes/pull/609)); the projection is
|
|
359
|
+
defence in depth, so still do not log an unprojected body.
|
|
360
|
+
|
|
361
|
+
The candidate also advertises `campaigns.create` and `templates.create`. They
|
|
362
|
+
serve the later apply slice of the parent spec
|
|
363
|
+
([ermes-bootstrap#6](https://github.com/Martech-DM/ermes-bootstrap/issues/6));
|
|
364
|
+
issue #8's diagnostics never invoke them.
|
|
365
|
+
Both resource commands accept a complete UTF-8 JSON body on stdin with
|
|
366
|
+
`--body-stdin`; ordinary profile-based use retains the existing write guard.
|
|
367
|
+
Bootstrap uses `-p <profile> --body-stdin --automation` with
|
|
368
|
+
`ERMES_ALLOW_WRITES=1` (`true`/`yes` also accepted, as for the profile guard).
|
|
369
|
+
The persistent `ermes write allow` window is never consulted:
|
|
370
|
+
|
|
371
|
+
```sh
|
|
372
|
+
ermes -p dest campaigns create --body-stdin --automation < campaign.json
|
|
373
|
+
ermes -p dest templates create --body-stdin --automation < template.json
|
|
374
|
+
```
|
|
375
|
+
|
|
376
|
+
The automation flags emit the same schema 1 envelope and exit 0 on a 2xx JSON
|
|
377
|
+
response or 1 on a local, transport, protocol, or HTTP failure. The caller must
|
|
378
|
+
validate a positive resource ID in a successful body. Each invocation issues
|
|
379
|
+
at most one POST to `/campaigns` or `/templates`; it has no mutation retry or
|
|
380
|
+
idempotency key. A transport failure has `dispatch: "unknown"` unless the
|
|
381
|
+
connection never opened, and a local validation failure or unopened connection
|
|
382
|
+
has `dispatch: "ruled_out"` — the create was certainly not sent. The HTTP client times out after
|
|
383
|
+
20 seconds, allowing bootstrap's longer watchdog to terminate and reap the
|
|
384
|
+
child process group. The entire input object is sent without field projection,
|
|
385
|
+
including MJML/HTML and Unicode strings, up to the platform's 1 MiB JSON limit:
|
|
386
|
+
a larger body is a `configuration` failure, never sent. Stdin must be strict JSON:
|
|
387
|
+
`NaN`, `Infinity`, and numbers that overflow to infinity (such as `1e400`) are
|
|
388
|
+
rejected as a `configuration` failure before any request is built, and so are
|
|
389
|
+
duplicate keys, numbers beyond ±2^53−1 in any notation, which the platform cannot
|
|
390
|
+
hold exactly, and nonzero numbers that underflow to zero. The validated bytes are sent unchanged.
|
|
391
|
+
A trigger `campaigns.create` is live immediately (`state: running`) as soon as
|
|
392
|
+
it is created, before any template exists; the contract has no delete or
|
|
393
|
+
rollback verb. The platform checks less than a send needs, so before the POST
|
|
394
|
+
the CLI reads what the body references, with the account's key and one 5-second
|
|
395
|
+
deadline for all reads. A campaign create reads `/subscriptions/{id}`, which must
|
|
396
|
+
carry that ID and the immutable channel `email` (the platform takes `channel`
|
|
397
|
+
from it), and `/providers/all`, where `provider_id` must be an `email` provider.
|
|
398
|
+
A template create reads `/campaigns/{campaign_id}`, which must carry that ID and
|
|
399
|
+
channel `email`: the platform attaches a template to any campaign ID, even
|
|
400
|
+
another account's. A mismatch or a failed read is a `configuration` failure with
|
|
401
|
+
`dispatch: "ruled_out"`, and `detail` gives the HTTP status or error type of a
|
|
402
|
+
failed read. These GETs are not reported in the result: `dispatch` describes
|
|
403
|
+
only the POST, so a create makes one or two uncounted reads plus at most one POST.
|
|
404
|
+
Each create child resolves `-p` again when it starts. It does not compare the
|
|
405
|
+
account with a fingerprint bootstrap approved earlier, so editing the profile
|
|
406
|
+
between bootstrap's check and the create sends the create to the new account;
|
|
407
|
+
the result's `account` reveals it only afterwards
|
|
408
|
+
([ermes-bootstrap#18](https://github.com/Martech-DM/ermes-bootstrap/issues/18)).
|
|
409
|
+
This 1.6.0 checkout is the
|
|
410
|
+
tested candidate; release installation remains a later migration step.
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
__version__ = "1.6.0"
|
|
@@ -63,11 +63,15 @@ class ErmesClient:
|
|
|
63
63
|
def get(self, path: str, params: dict | None = None) -> Any:
|
|
64
64
|
return self._send("get", path, params=params)
|
|
65
65
|
|
|
66
|
-
def post(
|
|
66
|
+
def post(
|
|
67
|
+
self, path: str, json: dict | None = None, *, content: bytes | None = None, read_only: bool = False
|
|
68
|
+
) -> Any:
|
|
67
69
|
# read_only: a POST the server treats as a pure read (e.g. template preview),
|
|
68
70
|
# so the write guard has nothing to protect.
|
|
69
71
|
if not read_only:
|
|
70
72
|
assert_writes_allowed("POST", path)
|
|
73
|
+
if content is not None: # already-encoded JSON, sent byte for byte
|
|
74
|
+
return self._send("post", path, content=content, headers={"Content-Type": "application/json"})
|
|
71
75
|
return self._send("post", path, json=json)
|
|
72
76
|
|
|
73
77
|
def patch(self, path: str, json: dict | None = None) -> Any:
|