@joymerrevent/porters-connect 0.6.2 → 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/CHANGELOG.md +106 -1
- package/README.md +36 -6
- package/dist/index.d.ts +35 -7
- package/dist/index.js +446 -240
- package/dist/index.js.map +1 -1
- package/package.json +3 -2
package/CHANGELOG.md
CHANGED
|
@@ -5,6 +5,101 @@
|
|
|
5
5
|
|
|
6
6
|
## [Unreleased]
|
|
7
7
|
|
|
8
|
+
## [0.8.0] - 2026-08-14
|
|
9
|
+
|
|
10
|
+
**「0 件」と「届いていない」を区別できるようにした版**です。HTTP 200 を返す中間装置
|
|
11
|
+
(キャプティブポータル・SSO のログイン画面・WAF の通知ページ)の応答が、これまで**正常な空ページ**として
|
|
12
|
+
通っていました。公開 API の形(型・メソッド)は不変で、**正しい PORTERS 応答に対する挙動も変わりません**。
|
|
13
|
+
|
|
14
|
+
### Fixed
|
|
15
|
+
|
|
16
|
+
- **HTTP 200 で返る「PORTERS 以外の応答」を 0 件として扱わなくなりました**([ADR-0051][adr51])。
|
|
17
|
+
Read 応答は**ルート要素名(`<Candidate>` などリソース名)と `<Code>` の両方**で同定します。
|
|
18
|
+
どちらかを欠くボディは `PortersResourceError`(`category: "unknown"` + `httpStatus: 200` + 中間装置を疑う `hint`)で拒否します。
|
|
19
|
+
- 従来は**キャプティブポータル・SSO のログイン画面・WAF の通知ページ**(いずれも HTTP 200)が
|
|
20
|
+
`total: 0` の**正常な空ページ**として返っていました。`get(id)` は `undefined` を返すため、
|
|
21
|
+
**「無ければ作る」コードが重複レコードを作りにいく**状態でした(データが無いのか届いていないのかを区別できない)。
|
|
22
|
+
- メッセージは原因を名指しします — `resource response root is <html>, expected <Candidate>` /
|
|
23
|
+
`resource response has no <Code> (not a PORTERS envelope)`。**観測したルート名**が載るので切り分けできます。
|
|
24
|
+
- **正しい PORTERS 応答に対する挙動は変わりません**([エラーハンドリング ガイド][guide]に判定表を追加)。
|
|
25
|
+
- ⚠️ **`createMockTransport` でモックを手書きしている場合**は、ボディに**リソース名のルート要素と `<Code>`** が
|
|
26
|
+
必要です(例 `<Candidate Total="1" Count="1" Start="0"><Code>0</Code>…</Candidate>`)。
|
|
27
|
+
実際の応答と同じ形にしていれば変更は不要です。
|
|
28
|
+
|
|
29
|
+
## [0.7.0] - 2026-08-13
|
|
30
|
+
|
|
31
|
+
エラーの見え方をまとめて是正した版です。**PORTERS の応答ではない HTTP エラー**が分類されるようになり、
|
|
32
|
+
**例外は常に reject で届き**、**アクセスポイントの設定ミスは接続前に落ちます**。公開 API の形(型・メソッド)は不変で、
|
|
33
|
+
既存コードは原則そのまま動きます(同期 throw を前提にしたテストだけ修正が要ります)。
|
|
34
|
+
|
|
35
|
+
### Added
|
|
36
|
+
|
|
37
|
+
- **アクセスポイントの scheme 設定**([ADR-0047][adr47])。`PortersClient` に **`scheme?: "https" | "http"`**(既定 `"https"`)を追加し、
|
|
38
|
+
型 **`Scheme`** を公開。`host` の意味・`PORTERS_HOST` の運用・`porters.host` は不変です(ポートが要る場合は `host` に含める=`localhost:4010`)。
|
|
39
|
+
- ローカルのフェイクサーバーや信頼できるトンネルへ、**アプリを改造せず**(`transport` 差し替えなしで)向けられます。
|
|
40
|
+
- `scheme: "http"` はトークンを含む全リクエストが**平文**で流れるため、**ループバックを含め毎プロセス 1 回**警告します。
|
|
41
|
+
抑止は専用の環境変数 `PORTERS_SUPPRESS_INSECURE_HTTP_WARNING=1` のみ=**許可(`scheme`)と沈黙(env)は別**です。
|
|
42
|
+
- 既定は従来どおり `https` で、既存コードの挙動は変わりません。
|
|
43
|
+
|
|
44
|
+
### Fixed
|
|
45
|
+
|
|
46
|
+
- **アクセスポイントの書式を構築時に検証**([ADR-0048][adr48]・[ADR-0049][adr49])。`host` は
|
|
47
|
+
**ホスト(+必要ならポート)だけ**を表します。スキーム・パス・userinfo・空白を含む値は、
|
|
48
|
+
**接続を試みる前に** `new PortersClient(...)` が `PortersConfigError`(`category: "config"` + 直し方の `hint`)で拒否します。
|
|
49
|
+
- 従来これらは**例外にならず**、`host: "https://xxxxx.example.com"` は `https` という**別ホスト宛の実リクエスト**に、
|
|
50
|
+
`host: ""` は `v1` 宛になっていました。**App ID / App Secret が意図しない宛先へ送られる**か、
|
|
51
|
+
名前が解決しなければ**設定ミスが `network` エラーとして延々リトライ**される状態でした。
|
|
52
|
+
- **弾かれる例**: `https://a.test`/`""`/`a.test/`/`a.test/gw`/`user@a.test`/`a test`/`//a.test`/
|
|
53
|
+
非 ASCII ホスト(**punycode** で渡してください)。
|
|
54
|
+
- **通る例**: `a.test`/`a.test:8080`/`127.0.0.1:4010`/`[::1]:4010`/大文字ホスト — **既存の正しい設定は
|
|
55
|
+
1 文字も変わりません**。**ポートはどれでも書けます**(冗長な `:443` も通ります)。
|
|
56
|
+
- `scheme` も同じガードで検証します(型は `"https" | "http"` ですが、JS や `as` 越しの値を黙って組み立てないため)。
|
|
57
|
+
|
|
58
|
+
### Changed
|
|
59
|
+
|
|
60
|
+
- **HTTP ステータスをエラーモデルへ配線**([ADR-0044][adr44])。PORTERS の応答**ではない** HTTP エラー
|
|
61
|
+
(ロードバランサ・プロキシ・WAF・メンテナンス画面が返す 4xx/5xx)が `category: "unknown"` に落ちず、
|
|
62
|
+
分類されて表面化するようになりました。
|
|
63
|
+
- **判定順は envelope 優先**: PORTERS の `<Code>` / `<Error>` を持つ応答は従来どおりその分類を採用し、
|
|
64
|
+
`httpStatus` を添えます。envelope が無い場合だけ status から判定します
|
|
65
|
+
(5xx → `server`/429 → `rateLimit`/408 → `network`/401・403 → `permission`/その他 4xx → `config`/
|
|
66
|
+
上記以外 → `unknown`。いずれも `code` は `null`)。
|
|
67
|
+
- **`PortersError.httpStatus` が実際に載る**ようになりました(応答を伴う失敗のみ。送信前ガードや接続失敗では `undefined`)。
|
|
68
|
+
- **`category: "rateLimit"` が初めて produce されます**(HTTP 429 を観測できる環境=プロキシ経由など。
|
|
69
|
+
PORTERS 直結のレート超過は従来どおり強制切断=`network`)。
|
|
70
|
+
- retryable な 3 種(5xx / 429 / 408)は `PortersNetworkError` です。5xx は書き込みが適用されたか不明なため、
|
|
71
|
+
**非冪等な `create` は自動再送しません**(既存の冪等性ガードがそのまま効きます)。
|
|
72
|
+
- **200 以外の応答は、ボディが parse できても値を返しません**(プロキシの HTML エラーページが
|
|
73
|
+
「空ページ」として通り、利用者に「0 件」と見えるのを防ぐため)。
|
|
74
|
+
- 写像は**未確認の仮定**です(実 PORTERS がどの status を返すかは契約後に確認 — LV-9)。
|
|
75
|
+
- **同じ判定が OAuth / Token のやり取りにも効きます**([ADR-0050][adr50])。トークン取得は全リクエストの
|
|
76
|
+
前段なので、そこでゲートウェイの 5xx が起きると従来は `category: "unknown"`・再試行不可として
|
|
77
|
+
**処理全体が止まって**いました。今後は `server`・retryable に分類され、**内蔵リトライで自動回復**しえます。
|
|
78
|
+
認証経路が `PortersNetworkError` / `PortersConfigError` を投げうる点だけ、`catch` の分岐にご注意ください
|
|
79
|
+
(いずれも `porters.auth.*` の JSDoc が挙げている系統です)。
|
|
80
|
+
- **Write 応答のルート `<Code>` を先読み**([ADR-0045][adr45])。**リクエストごと拒否された Write** の Result Code が
|
|
81
|
+
失われなくなりました。
|
|
82
|
+
- 従来は単件 `create` / `update` が **「write returned no result item」**(`category: "unknown"`)、
|
|
83
|
+
`createMany` / `updateMany` が**件数不一致エラー**になり、原因のコードが消えていました。
|
|
84
|
+
- 今後は本当の Result Code(例 `102` → `category: "validation"`)が `PortersResourceError` として表面化します
|
|
85
|
+
(`context.operation: "write"` 付き)。Read(`<Code>`≠0)と同じ写像です。
|
|
86
|
+
- **成功パスは不変**です(成功応答にルート `<Code>` は無く、あっても `0` なら従来どおり `<Item>` を読みます)。
|
|
87
|
+
- エラー時にルート `<Code>` が返ること自体は**未確認の仮定**です(契約後に確認 — LV-11)。
|
|
88
|
+
- **例外の届き方を reject に統一**([ADR-0046][adr46])。**`Promise` を返す公開メソッドは、いかなる理由でも
|
|
89
|
+
同期 throw しなくなりました**。設定ミス(`PortersConfigError`)も含め、すべて **reject** で届きます。
|
|
90
|
+
- これまで **`keywords` 100 字超・`itemstate` の制限違反・Attachment 10MB 超**は Promise を返す**前に**
|
|
91
|
+
同期 throw していたため、**`porters.candidate.search(q).catch(handler)` では捕まえられません**でした。
|
|
92
|
+
今後は `.catch()` でも捕まえられます。
|
|
93
|
+
- **ガードのロジックと実装位置は不変**です(送信前に弾く点・無駄な往復が起きない点は変わりません)。
|
|
94
|
+
変わったのは例外の届き方だけです。
|
|
95
|
+
- `await` + try/catch で書いている場合は**影響ありません**。**同期 throw を前提にしたコード**
|
|
96
|
+
(`expect(() => …).toThrow(…)` など)は `rejects` へ修正が必要です。
|
|
97
|
+
- 対象は データ系(`search` / `get` / `create` / `update` / `createMany` / `updateMany`)・
|
|
98
|
+
Attachment(`search` / `get` / `create` / `update`)・マスタ Read(`search` / `current`)・`auth.*` の Promise 系。
|
|
99
|
+
**`Promise` を返さない API**(`new PortersClient(...)`・`defineFields`・`auth.authorizationUrl` /
|
|
100
|
+
`auth.revokeUrl`)は**同期 throw のまま**です。
|
|
101
|
+
- 内部: `https://{host}/v1/...` を 10 箇所で組み立てていた URL 生成を **1 関数へ集約**(公開される挙動は不変)。
|
|
102
|
+
|
|
8
103
|
## [0.6.2] - 2026-07-19
|
|
9
104
|
|
|
10
105
|
### Changed
|
|
@@ -137,10 +232,20 @@
|
|
|
137
232
|
- **配布**: ESM / Node.js 18+ / 型定義同梱 / MIT。`X-P-ConnectAPI-Version: 2` を既定送信(PORTERS 8.x・9.x 想定)。
|
|
138
233
|
|
|
139
234
|
[guide]: docs/guide/error-handling.md
|
|
235
|
+
[adr44]: docs/adr/0044-http-status-handling.md
|
|
236
|
+
[adr45]: docs/adr/0045-write-response-root-code.md
|
|
237
|
+
[adr46]: docs/adr/0046-guard-error-contract.md
|
|
238
|
+
[adr48]: docs/adr/0048-access-point-host-validation.md
|
|
239
|
+
[adr49]: docs/adr/0049-host-port-roundtrip.md
|
|
240
|
+
[adr50]: docs/adr/0050-auth-http-status-handling.md
|
|
241
|
+
[adr51]: docs/adr/0051-read-envelope-identification.md
|
|
242
|
+
[adr47]: docs/adr/0047-access-point-scheme.md
|
|
140
243
|
[oauth-guide]: docs/guide/oauth.md
|
|
141
244
|
[kac]: https://keepachangelog.com/en/1.1.0/
|
|
142
245
|
[semver]: https://semver.org/
|
|
143
|
-
[unreleased]: https://github.com/Joymerrevent/porters-connect/compare/v0.
|
|
246
|
+
[unreleased]: https://github.com/Joymerrevent/porters-connect/compare/v0.8.0...HEAD
|
|
247
|
+
[0.8.0]: https://github.com/Joymerrevent/porters-connect/compare/v0.7.0...v0.8.0
|
|
248
|
+
[0.7.0]: https://github.com/Joymerrevent/porters-connect/compare/v0.6.2...v0.7.0
|
|
144
249
|
[0.6.2]: https://github.com/Joymerrevent/porters-connect/compare/v0.6.1...v0.6.2
|
|
145
250
|
[0.6.1]: https://github.com/Joymerrevent/porters-connect/compare/v0.6.0...v0.6.1
|
|
146
251
|
[0.6.0]: https://github.com/Joymerrevent/porters-connect/compare/v0.5.0...v0.6.0
|
package/README.md
CHANGED
|
@@ -54,6 +54,8 @@ import { PortersClient } from "@joymerrevent/porters-connect";
|
|
|
54
54
|
|
|
55
55
|
const porters = new PortersClient({
|
|
56
56
|
host: process.env.PORTERS_HOST!, // 契約時に通知される値。ハードコード禁止
|
|
57
|
+
// 既定 https。ローカルのフェイクへ向けるときだけ env で "http" を渡す(不正値は https 側に倒す)
|
|
58
|
+
scheme: process.env.PORTERS_SCHEME === "http" ? "http" : undefined,
|
|
57
59
|
appId: process.env.PORTERS_APP_ID!,
|
|
58
60
|
appSecret: process.env.PORTERS_APP_SECRET!,
|
|
59
61
|
partition: 123, // 既定 Partition(Company DB)Id
|
|
@@ -326,13 +328,21 @@ try {
|
|
|
326
328
|
e.code; // PORTERS のコード(無い場合 null)
|
|
327
329
|
e.retryable; // 再試行可否
|
|
328
330
|
e.hint; // 対処のヒント(あれば)
|
|
331
|
+
e.httpStatus; // 応答の HTTP ステータス(応答を伴わない失敗では undefined)
|
|
329
332
|
}
|
|
330
333
|
}
|
|
331
334
|
```
|
|
332
335
|
|
|
333
|
-
- トークン失効は内側で自動回復します。設定ミスは `PortersConfigError`
|
|
336
|
+
- トークン失効は内側で自動回復します。設定ミスは `PortersConfigError` で早期に落とします。
|
|
337
|
+
- **`Promise` を返す公開メソッドは同期 throw しません**([ADR-0046][adr46])。設定ミスも含め常に **reject** で届くので、
|
|
338
|
+
`porters.candidate.search(q).catch(handler)` でも捕まえられます(`string` を返す `auth.authorizationUrl` や
|
|
339
|
+
コンストラクタなど、Promise を返さない API は同期 throw のままです)。
|
|
334
340
|
- 一時エラー・ネットワークは内蔵リトライ。非冪等な `create` はネットワーク不確実時に握り潰さず表面化します。
|
|
335
|
-
- レート制限超過時、PORTERS は判別可能なコードを返さず接続を切るため、`PortersNetworkError`(category `"network"
|
|
341
|
+
- レート制限超過時、PORTERS は判別可能なコードを返さず接続を切るため、`PortersNetworkError`(category `"network"`)として表面化します。
|
|
342
|
+
- **PORTERS の応答でない HTTP エラー**(LB・プロキシ・メンテナンス画面の 4xx/5xx)も分類されます([ADR-0044][adr44])。
|
|
343
|
+
PORTERS の `<Code>` を持つ応答はそちらが優先され、無い場合だけ status から判定します
|
|
344
|
+
(5xx → `server`・429 → `rateLimit`・408 → `network`・401/403 → `permission`・その他 4xx → `config`)。
|
|
345
|
+
いずれも `code` は `null`、`httpStatus` にステータスが載ります。
|
|
336
346
|
|
|
337
347
|
> 症状別の早見表と 2 系統(認証 / リソース)のコード対応表は [エラーハンドリング ガイド][error-handling]にまとめています。
|
|
338
348
|
|
|
@@ -340,13 +350,30 @@ try {
|
|
|
340
350
|
|
|
341
351
|
- **削除 API は存在しない**(`delete()` は提供しない)。
|
|
342
352
|
- **日時は UTC 前提**。ISO 8601(`...Z`)で入出力し、JST 等の変換はしない(利用側の責務)。
|
|
343
|
-
- **レート制限**:1 分あたり Read 2000 / Write 500
|
|
344
|
-
|
|
353
|
+
- **レート制限**:1 分あたり Read 2000 / Write 500 は**内蔵スロットリングで自制**します(上限の 90% で分散)。
|
|
354
|
+
**月 15 万アクセスは契約条件**で、プロセスをまたぐ累積は本ライブラリでは管理できません(**利用側の運用責務**)。
|
|
355
|
+
- **ホスト名は非公開**:`PORTERS_HOST` で受け取り、ハードコードしない。ポートが要る場合は `host` に含めます(`localhost:4010`)。
|
|
356
|
+
- **アクセスポイントの scheme**([ADR-0047][adr47]):既定は `https`。ローカルのフェイクサーバーや信頼できるトンネルに向けるときだけ
|
|
357
|
+
**`scheme: "http"`** を明示できます。http はトークンを含む全リクエストが**平文**で流れるため、**ループバックでも毎プロセス 1 回**警告します。
|
|
358
|
+
抑止は専用の環境変数 `PORTERS_SUPPRESS_INSECURE_HTTP_WARNING=1` のみ=**許可(`scheme`)と沈黙(env)は別**です。
|
|
359
|
+
|
|
360
|
+
```ts
|
|
361
|
+
new PortersClient({ host: "localhost:4010", scheme: "http" }); // ローカル検証用
|
|
362
|
+
```
|
|
363
|
+
|
|
364
|
+
**ライブラリは `host` / `scheme` を環境変数から読みません**(設定の出所を明示にするため。読むのは上の警告抑止 1 本だけ)。
|
|
365
|
+
env で本番⇔ローカルを切り替えたい場合は、クイックスタートのように**アプリ側で `PORTERS_SCHEME` を `scheme` に渡して**ください
|
|
366
|
+
(`.env.example` に雛形あり)。以後はコードを触らず env の差し替えだけで向き先が変わります。
|
|
367
|
+
|
|
368
|
+
```sh
|
|
369
|
+
PORTERS_HOST=127.0.0.1:4010 PORTERS_SCHEME=http node app.js # ローカルのフェイクへ
|
|
370
|
+
PORTERS_HOST=xxxxx.example.com node app.js # 本番(未設定なら https)
|
|
371
|
+
```
|
|
345
372
|
|
|
346
373
|
## 対応バージョン
|
|
347
374
|
|
|
348
|
-
-
|
|
349
|
-
- PORTERS 8.x / 9.x
|
|
375
|
+
- **契約は Connect API Version 2**:`X-P-ConnectAPI-Version: 2` を既定送信し、**v2 を動作の前提**とします(担当者型・部署型 Link 等は v2 必須)。互換性はこの **API version** で明示します。
|
|
376
|
+
- **PORTERS 製品 8.x / 9.x は参考**:v2 が提供される製品世代です(個別マイナーの動作保証はしません)。**正典は [docs/reference][ref]**(実 API ドキュメントに接地)。
|
|
350
377
|
|
|
351
378
|
## リンク
|
|
352
379
|
|
|
@@ -384,5 +411,8 @@ try {
|
|
|
384
411
|
[bulk-write]: ./docs/guide/bulk-write.md
|
|
385
412
|
[sandbox]: ./examples/offline-sandbox.ts
|
|
386
413
|
[adr]: ./docs/adr/README.md
|
|
414
|
+
[adr44]: ./docs/adr/0044-http-status-handling.md
|
|
415
|
+
[adr46]: ./docs/adr/0046-guard-error-contract.md
|
|
416
|
+
[adr47]: ./docs/adr/0047-access-point-scheme.md
|
|
387
417
|
[design]: ./docs/design/basic-design.md
|
|
388
418
|
[ref]: ./docs/reference/README.md
|
package/dist/index.d.ts
CHANGED
|
@@ -41,6 +41,17 @@ type Transport = {
|
|
|
41
41
|
send(request: TransportRequest): Promise<TransportResponse>;
|
|
42
42
|
};
|
|
43
43
|
|
|
44
|
+
/** OAuth scope string: `<resource>_r` (read) or `<resource>_w` (write). */
|
|
45
|
+
type Scope = `${string}_r` | `${string}_w`;
|
|
46
|
+
/** A PORTERS partition (Company DB) id. */
|
|
47
|
+
type PartitionId = number;
|
|
48
|
+
/**
|
|
49
|
+
* URL scheme of the API access point (ADR-0047). `https` is the default; `http` is opt-in,
|
|
50
|
+
* meant for a local fake server or a trusted tunnel, and always warns (see
|
|
51
|
+
* `PortersClientOptions.scheme`).
|
|
52
|
+
*/
|
|
53
|
+
type Scheme = "https" | "http";
|
|
54
|
+
|
|
44
55
|
/** A mock reply: an XML body string (HTTP 200), or an explicit status + body. */
|
|
45
56
|
type MockReply = string | {
|
|
46
57
|
status?: number;
|
|
@@ -75,11 +86,6 @@ type MockTransportOptions = {
|
|
|
75
86
|
*/
|
|
76
87
|
declare const createMockTransport: (handler: MockHandler, options?: MockTransportOptions) => Transport;
|
|
77
88
|
|
|
78
|
-
/** OAuth scope string: `<resource>_r` (read) or `<resource>_w` (write). */
|
|
79
|
-
type Scope = `${string}_r` | `${string}_w`;
|
|
80
|
-
/** A PORTERS partition (Company DB) id. */
|
|
81
|
-
type PartitionId = number;
|
|
82
|
-
|
|
83
89
|
/** Shared options for the browser `code` / `remove` OAuth URLs (oauth.md). */
|
|
84
90
|
type AuthorizationUrlOptions = {
|
|
85
91
|
/** Registered Redirect URL the browser returns to (required for code/remove). */
|
|
@@ -613,6 +619,10 @@ type UserResource = {
|
|
|
613
619
|
current(): Promise<User | undefined>;
|
|
614
620
|
};
|
|
615
621
|
|
|
622
|
+
/**
|
|
623
|
+
* Field Read's `resource` selector -> Value code (docs/reference resources-list). Exported for
|
|
624
|
+
* in-repo dev tooling: the fake server maps the code back to a resource. Not published.
|
|
625
|
+
*/
|
|
616
626
|
declare const RESOURCE_VALUE: {
|
|
617
627
|
readonly candidate: 1;
|
|
618
628
|
readonly job: 3;
|
|
@@ -746,9 +756,22 @@ declare const defineFields: <D extends FieldDecls>(decls: D) => DefinedFields<De
|
|
|
746
756
|
type PortersClientOptions<C extends DeclaredCatalogs = EmptyCatalog> = {
|
|
747
757
|
/**
|
|
748
758
|
* API host. Required and supplied via `PORTERS_HOST` — never hard-code it.
|
|
749
|
-
* (A representative value lives in docs/reference.)
|
|
759
|
+
* (A representative value lives in docs/reference.) May carry a port — `localhost:4010`.
|
|
760
|
+
*
|
|
761
|
+
* The **host and nothing else**: no scheme, no path, no userinfo, no whitespace. A value like
|
|
762
|
+
* `https://xxxxx.example.com` is rejected at construction with a {@link PortersConfigError}
|
|
763
|
+
* rather than silently addressing a different host (ADR-0048). Any port is fine — including a
|
|
764
|
+
* redundant `:443` (ADR-0049). Write a non-ASCII host in punycode.
|
|
750
765
|
*/
|
|
751
766
|
host: string;
|
|
767
|
+
/**
|
|
768
|
+
* URL scheme of the access point (ADR-0047). Defaults to `"https"`. Set `"http"` only for a
|
|
769
|
+
* local fake server or a trusted tunnel: it sends every request — the OAuth token header
|
|
770
|
+
* included — in cleartext, so the library warns once per process (loopback is not exempt).
|
|
771
|
+
* Silence it only where cleartext is intended, with the env var
|
|
772
|
+
* `PORTERS_SUPPRESS_INSECURE_HTTP_WARNING=1`.
|
|
773
|
+
*/
|
|
774
|
+
scheme?: Scheme;
|
|
752
775
|
appId?: string;
|
|
753
776
|
appSecret?: string;
|
|
754
777
|
scopes?: Scope[];
|
|
@@ -841,6 +864,11 @@ type PortersErrorOptions = {
|
|
|
841
864
|
retryable?: boolean;
|
|
842
865
|
/** Actionable hint (English by default). */
|
|
843
866
|
hint?: string;
|
|
867
|
+
/**
|
|
868
|
+
* HTTP status of the response this error came from (ADR-0044). Set for every error raised while
|
|
869
|
+
* reading a response — including one carrying a PORTERS `<Code>` — and `undefined` for failures
|
|
870
|
+
* with no response at all (send-time guards, connection errors).
|
|
871
|
+
*/
|
|
844
872
|
httpStatus?: number;
|
|
845
873
|
context?: PortersErrorContext;
|
|
846
874
|
cause?: unknown;
|
|
@@ -873,4 +901,4 @@ declare const bytesToBase64: (bytes: Uint8Array) => string;
|
|
|
873
901
|
/** Decode a Base64 string back to raw bytes. */
|
|
874
902
|
declare const base64ToBytes: (b64: string) => Uint8Array;
|
|
875
903
|
|
|
876
|
-
export { type Attachment, type AttachmentCreate, type AttachmentPage, type AttachmentResource, type AttachmentSearchQuery, type AttachmentUpdate, type AuthApi, type AuthorizationUrlOptions, type BulkWriteResult, type BulkWriteResultItem, type Candidate, type CandidateCreateInput, type CandidatePage, type CandidateResource, type CandidateSearchQuery, type CandidateUpdateInput, type Client, type ClientCreateInput, type ClientPage, type ClientResource, type ClientSearchQuery, type ClientUpdateInput, type Condition, type CustomDataType, type DefinedFields, type ErrorCategory, type Field, type FieldBuilder, type FieldDecls, type FieldDef, type FieldPage, type FieldResource, type FieldSearchQuery, type FieldValue, type GetAccessTokenOptions, type ItemState, type Job, type JobCreateInput, type JobPage, type JobResource, type JobSearchQuery, type JobUpdateInput, type MockHandler, type MockReply, type MockTransportOptions, type Option, type OptionResource, type OptionSearchQuery, type Order, type Partition, type PartitionId, type PartitionPage, type PartitionResource, type PartitionSearchQuery, PortersAuthError, PortersClient, type PortersClientOptions, PortersConfigError, PortersError, type PortersErrorContext, type PortersErrorOptions, PortersNetworkError, PortersResourceError, type Process, type ProcessCreateInput, type ProcessPage, type ProcessResource, type ProcessSearchQuery, type ProcessUpdateInput, type ResourceType, type Resume, type ResumeCreateInput, type ResumePage, type ResumeResource, type ResumeSearchQuery, type ResumeUpdateInput, type RevokeUrlOptions, type Scope, type SearchQuery, type StoredTokens, type TenantScope, type TokenProvider, type TokenStore, type Transport, type TransportRequest, type TransportResponse, type User, type UserPage, type UserRef, type UserResource, type UserSearchQuery, base64ToBytes, bytesToBase64, createMockTransport, defineFields };
|
|
904
|
+
export { type Attachment, type AttachmentCreate, type AttachmentPage, type AttachmentResource, type AttachmentSearchQuery, type AttachmentUpdate, type AuthApi, type AuthorizationUrlOptions, type BulkWriteResult, type BulkWriteResultItem, type Candidate, type CandidateCreateInput, type CandidatePage, type CandidateResource, type CandidateSearchQuery, type CandidateUpdateInput, type Client, type ClientCreateInput, type ClientPage, type ClientResource, type ClientSearchQuery, type ClientUpdateInput, type Condition, type CustomDataType, type DefinedFields, type ErrorCategory, type Field, type FieldBuilder, type FieldDecls, type FieldDef, type FieldPage, type FieldResource, type FieldSearchQuery, type FieldValue, type GetAccessTokenOptions, type ItemState, type Job, type JobCreateInput, type JobPage, type JobResource, type JobSearchQuery, type JobUpdateInput, type MockHandler, type MockReply, type MockTransportOptions, type Option, type OptionResource, type OptionSearchQuery, type Order, type Partition, type PartitionId, type PartitionPage, type PartitionResource, type PartitionSearchQuery, PortersAuthError, PortersClient, type PortersClientOptions, PortersConfigError, PortersError, type PortersErrorContext, type PortersErrorOptions, PortersNetworkError, PortersResourceError, type Process, type ProcessCreateInput, type ProcessPage, type ProcessResource, type ProcessSearchQuery, type ProcessUpdateInput, type ResourceType, type Resume, type ResumeCreateInput, type ResumePage, type ResumeResource, type ResumeSearchQuery, type ResumeUpdateInput, type RevokeUrlOptions, type Scheme, type Scope, type SearchQuery, type StoredTokens, type TenantScope, type TokenProvider, type TokenStore, type Transport, type TransportRequest, type TransportResponse, type User, type UserPage, type UserRef, type UserResource, type UserSearchQuery, base64ToBytes, bytesToBase64, createMockTransport, defineFields };
|