beliq-sevdesk 0.2.1 → 0.2.3

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 CHANGED
@@ -162,7 +162,7 @@ variable.
162
162
  | `SEVDESK_MAX_RETRIES` | | `4` | Retries on a sevDesk 429 / 5xx / network error. |
163
163
  | `SEVDESK_NOTIFY_WEBHOOK` | `--notify-webhook` | (none) | POST a JSON poll report here. Empty = no notifications. |
164
164
  | `SEVDESK_NOTIFY_ON` | | `failure` | `failure` (only on a failed invoice) or `always` (every poll). |
165
- | `SEVDESK_BASE_URL` | | `https://api.sevdesk.de/api/v1` | Override for a mock or a future version. |
165
+ | `SEVDESK_BASE_URL` | | `https://my.sevdesk.de/api/v1` | Override for a mock or a future version. |
166
166
  | `BELIQ_BASE_URL` | | `https://api.beliq.eu` | Override for a self-hosted beliq. |
167
167
  | `BELIQ_AUTH` | | `header` | How the beliq key is sent: `header` (X-API-Key) or `bearer`. |
168
168
 
package/dist/config.js CHANGED
@@ -1,8 +1,11 @@
1
1
  import { DEFAULT_BASE_URL, LIVE_CONVERT_TARGET_FORMATS, LIVE_PROFILES, } from '@beliq/sdk';
2
2
  import { flagBool, flagStr } from './args.js';
3
3
  import { ConfigError } from './errors.js';
4
- /** sevDesk default REST base. Endpoints hang off /Invoice, /Invoice/{id}/getXml. */
5
- export const DEFAULT_SEVDESK_BASE_URL = 'https://api.sevdesk.de/api/v1';
4
+ /**
5
+ * sevDesk default REST base. Endpoints hang off /Invoice, /Invoice/{id}/getXml.
6
+ * `api.sevdesk.de` serves the API documentation site and 404s every REST path.
7
+ */
8
+ export const DEFAULT_SEVDESK_BASE_URL = 'https://my.sevdesk.de/api/v1';
6
9
  /** sevDesk invoice status codes (Settings dropdown values), keyed by friendly name. */
7
10
  const STATUS_CODES = { draft: '100', open: '200', paid: '1000' };
8
11
  /** Read a non-empty trimmed value; flag wins over env. */
package/dist/sevdesk.js CHANGED
@@ -164,6 +164,12 @@ export class SevDeskClient {
164
164
  await this.#backoff(attempt);
165
165
  continue;
166
166
  }
167
+ // An HTML 404 means the base URL is not the REST API. api.sevdesk.de serves the
168
+ // documentation site and answers every REST path this way.
169
+ if (res.status === 404 && (res.headers.get('content-type') ?? '').includes('text/html')) {
170
+ throw new SevDeskApiError(`sevDesk ${method} ${path} returned an HTML 404: ${this.#baseUrl} is not the REST API. ` +
171
+ 'The REST base is https://my.sevdesk.de/api/v1; check SEVDESK_BASE_URL.', res.status);
172
+ }
167
173
  throw new SevDeskApiError(`sevDesk ${method} ${path} failed with status ${res.status}`, res.status);
168
174
  }
169
175
  // Unreachable: the loop either returns or throws. Satisfies noImplicitReturns.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "beliq-sevdesk",
3
- "version": "0.2.1",
3
+ "version": "0.2.3",
4
4
  "description": "Self-hostable worker that polls sevDesk for e-invoices, converts each to the formats a counterparty needs, and validates them against beliq's authority-pinned, drift-checked rules. The sevDesk token never leaves your environment.",
5
5
  "license": "MIT",
6
6
  "type": "module",
@@ -57,12 +57,12 @@
57
57
  "prepublishOnly": "npm run build"
58
58
  },
59
59
  "dependencies": {
60
- "@beliq/sdk": "^0.3.0"
60
+ "@beliq/sdk": "^0.4.0"
61
61
  },
62
62
  "devDependencies": {
63
63
  "@types/node": "^20.14.0",
64
- "@typescript-eslint/eslint-plugin": "^7.18.0",
65
- "@typescript-eslint/parser": "^7.18.0",
64
+ "@typescript-eslint/eslint-plugin": "^8.0.0",
65
+ "@typescript-eslint/parser": "^8.0.0",
66
66
  "eslint": "^8.57.0",
67
67
  "typescript": "^5.5.4",
68
68
  "vitest": "^4.0.0"