@apifuse/provider-sdk 2.1.0-beta.9 → 2.2.0-beta.2
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/AUTHORING.md +134 -0
- package/CHANGELOG.md +61 -0
- package/README.md +21 -9
- package/SUBMISSION.md +10 -11
- package/bin/apifuse-pack-check.ts +22 -0
- package/bin/apifuse-submit-check.ts +1747 -388
- package/dist/auth-turn/auth-turn.v1.schema.json +89 -0
- package/dist/auth-turn/fixtures/invalid/empty-kind.json +4 -0
- package/dist/auth-turn/fixtures/invalid/expires-at-not-string.json +5 -0
- package/dist/auth-turn/fixtures/invalid/missing-kind.json +3 -0
- package/dist/auth-turn/fixtures/invalid/missing-turn-id.json +3 -0
- package/dist/auth-turn/fixtures/invalid/timing-unknown-field.json +7 -0
- package/dist/auth-turn/fixtures/invalid/turn-id-snake-case.json +4 -0
- package/dist/auth-turn/fixtures/invalid/unknown-top-level-field.json +5 -0
- package/dist/auth-turn/fixtures/valid/abort.json +8 -0
- package/dist/auth-turn/fixtures/valid/challenge.json +17 -0
- package/dist/auth-turn/fixtures/valid/complete.json +13 -0
- package/dist/auth-turn/fixtures/valid/form.json +14 -0
- package/dist/auth-turn/fixtures/valid/message.json +13 -0
- package/dist/auth-turn/fixtures/valid/multi_choice.json +15 -0
- package/dist/auth-turn/fixtures/valid/pending.json +5 -0
- package/dist/auth-turn/fixtures/valid/poll.json +9 -0
- package/dist/auth-turn/fixtures/valid/redirect.json +16 -0
- package/dist/auth-turn/fixtures/valid/retry.json +8 -0
- package/dist/auth-turn/fixtures/valid/unknown-kind.json +7 -0
- package/dist/auth-turn/index.d.ts +195 -0
- package/dist/auth-turn/index.js +133 -0
- package/dist/auth.d.ts +76 -0
- package/dist/auth.js +436 -0
- package/dist/ceremonies/index.js +7 -31
- package/dist/cli/create.js +45 -30
- package/dist/cli/templates/provider/.dockerignore.tpl +22 -0
- package/dist/cli/templates/provider/.gitignore.tpl +22 -0
- package/dist/cli/templates/provider/AGENTS.md.tpl +87 -0
- package/dist/cli/templates/provider/CLAUDE.md.tpl +1 -0
- package/dist/cli/templates/provider/Dockerfile.tpl +7 -0
- package/dist/cli/templates/provider/README.md.tpl +163 -0
- package/dist/cli/templates/provider/dev.ts.tpl +5 -0
- package/dist/cli/templates/provider/domain/README.md.tpl +3 -0
- package/dist/cli/templates/provider/index.test.ts.tpl +13 -0
- package/dist/cli/templates/provider/index.ts.tpl +15 -0
- package/dist/cli/templates/provider/mappers/README.md.tpl +3 -0
- package/dist/cli/templates/provider/meta.ts.tpl +7 -0
- package/dist/cli/templates/provider/operations/index.ts.tpl +5 -0
- package/dist/cli/templates/provider/operations/ping.ts.tpl +24 -0
- package/dist/cli/templates/provider/schemas/ping.ts.tpl +24 -0
- package/dist/cli/templates/provider/skills/fixtures-and-recording/SKILL.md.tpl +58 -0
- package/dist/cli/templates/provider/skills/health-checks-and-fail-closed/SKILL.md.tpl +65 -0
- package/dist/cli/templates/provider/skills/normalization-standards/SKILL.md.tpl +57 -0
- package/dist/cli/templates/provider/skills/pagination-and-counts/SKILL.md.tpl +52 -0
- package/dist/cli/templates/provider/skills/upstream-contract-verification/SKILL.md.tpl +45 -0
- package/dist/cli/templates/provider/skills/upstream-notes/README.md.tpl +13 -0
- package/dist/cli/templates/provider/start.ts.tpl +5 -0
- package/dist/cli/templates/provider/upstream/README.md.tpl +3 -0
- package/dist/contract.js +1 -0
- package/dist/define.d.ts +6 -1
- package/dist/define.js +140 -70
- package/dist/index.d.ts +3 -2
- package/dist/index.js +2 -1
- package/dist/lint.d.ts +1 -0
- package/dist/lint.js +27 -0
- package/dist/provider.d.ts +4 -2
- package/dist/provider.js +2 -1
- package/dist/runtime/auth-flow.js +2 -0
- package/dist/runtime/browser.js +203 -0
- package/dist/runtime/http.js +46 -336
- package/dist/runtime/proxy-retry-policy.d.ts +40 -0
- package/dist/runtime/proxy-retry-policy.js +326 -0
- package/dist/runtime/stealth.d.ts +5 -2
- package/dist/runtime/stealth.js +206 -206
- package/dist/server/index.d.ts +4 -0
- package/dist/server/index.js +4 -0
- package/dist/server/self-test-input-tokens.d.ts +1 -0
- package/dist/server/self-test-input-tokens.js +37 -0
- package/dist/server/self-test-redaction.d.ts +20 -0
- package/dist/server/self-test-redaction.js +70 -0
- package/dist/server/self-test-token.d.ts +30 -0
- package/dist/server/self-test-token.js +50 -0
- package/dist/server/self-test.d.ts +98 -0
- package/dist/server/self-test.js +555 -0
- package/dist/server/serve.d.ts +6 -0
- package/dist/server/serve.js +38 -10
- package/dist/server/types.d.ts +1 -0
- package/dist/server/types.js +1 -0
- package/dist/testing/run.js +5 -1
- package/dist/types.d.ts +150 -0
- package/package.json +9 -2
- package/src/auth-turn/auth-turn.v1.schema.json +89 -0
- package/src/auth-turn/fixtures/invalid/empty-kind.json +4 -0
- package/src/auth-turn/fixtures/invalid/expires-at-not-string.json +5 -0
- package/src/auth-turn/fixtures/invalid/missing-kind.json +3 -0
- package/src/auth-turn/fixtures/invalid/missing-turn-id.json +3 -0
- package/src/auth-turn/fixtures/invalid/timing-unknown-field.json +7 -0
- package/src/auth-turn/fixtures/invalid/turn-id-snake-case.json +4 -0
- package/src/auth-turn/fixtures/invalid/unknown-top-level-field.json +5 -0
- package/src/auth-turn/fixtures/valid/abort.json +8 -0
- package/src/auth-turn/fixtures/valid/challenge.json +17 -0
- package/src/auth-turn/fixtures/valid/complete.json +13 -0
- package/src/auth-turn/fixtures/valid/form.json +14 -0
- package/src/auth-turn/fixtures/valid/message.json +13 -0
- package/src/auth-turn/fixtures/valid/multi_choice.json +15 -0
- package/src/auth-turn/fixtures/valid/pending.json +5 -0
- package/src/auth-turn/fixtures/valid/poll.json +9 -0
- package/src/auth-turn/fixtures/valid/redirect.json +16 -0
- package/src/auth-turn/fixtures/valid/retry.json +8 -0
- package/src/auth-turn/fixtures/valid/unknown-kind.json +7 -0
- package/src/auth-turn/index.ts +177 -0
- package/src/auth.ts +786 -0
- package/src/ceremonies/index.ts +9 -43
- package/src/cli/create.ts +60 -97
- package/src/cli/templates/provider/AGENTS.md.tpl +87 -0
- package/src/cli/templates/provider/CLAUDE.md.tpl +1 -0
- package/src/cli/templates/provider/README.md.tpl +7 -4
- package/src/cli/templates/provider/skills/fixtures-and-recording/SKILL.md.tpl +58 -0
- package/src/cli/templates/provider/skills/health-checks-and-fail-closed/SKILL.md.tpl +65 -0
- package/src/cli/templates/provider/skills/normalization-standards/SKILL.md.tpl +57 -0
- package/src/cli/templates/provider/skills/pagination-and-counts/SKILL.md.tpl +52 -0
- package/src/cli/templates/provider/skills/upstream-contract-verification/SKILL.md.tpl +45 -0
- package/src/cli/templates/provider/skills/upstream-notes/README.md.tpl +13 -0
- package/src/contract.ts +1 -0
- package/src/define.ts +198 -71
- package/src/index.ts +16 -0
- package/src/lint.ts +33 -0
- package/src/provider.ts +27 -0
- package/src/runtime/auth-flow.ts +2 -0
- package/src/runtime/browser.ts +293 -1
- package/src/runtime/http.ts +84 -530
- package/src/runtime/proxy-retry-policy.ts +469 -0
- package/src/runtime/stealth.ts +269 -353
- package/src/server/index.ts +36 -0
- package/src/server/self-test-input-tokens.ts +46 -0
- package/src/server/self-test-redaction.ts +97 -0
- package/src/server/self-test-token.ts +70 -0
- package/src/server/self-test.ts +725 -0
- package/src/server/serve.ts +75 -6
- package/src/server/types.ts +1 -0
- package/src/testing/run.ts +9 -1
- package/src/types.ts +186 -0
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: health-checks-and-fail-closed
|
|
3
|
+
description: Writing health checks that can actually fail, and fail-closed guards at envelope and row level. Load before writing healthCheck blocks or error handling.
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
# Health checks and fail-closed guards
|
|
7
|
+
|
|
8
|
+
## Health checks that can actually fail
|
|
9
|
+
`Array.isArray(data.items)` alone can never fail. Every list operation's
|
|
10
|
+
health check must be able to detect the zero-rows regression.
|
|
11
|
+
|
|
12
|
+
Assertion contract (per SDK `HealthCheckCase`): THROW to fail the case
|
|
13
|
+
(recorded as `down`); return `{ status: "degraded", label }` to flag without
|
|
14
|
+
failing; return nothing for `ok`. There is no `"down"` return value.
|
|
15
|
+
|
|
16
|
+
```ts
|
|
17
|
+
assertions: ({ status, data }) => {
|
|
18
|
+
if (status !== 200) {
|
|
19
|
+
throw new Error(`<op> request failed with status ${status}`);
|
|
20
|
+
}
|
|
21
|
+
if (!Array.isArray(data.items)) {
|
|
22
|
+
throw new Error("<op> missing items array");
|
|
23
|
+
}
|
|
24
|
+
// Dense query MUST return rows; zero rows = upstream contract drift
|
|
25
|
+
if (data.items.length === 0) {
|
|
26
|
+
return { status: "degraded", label: "<op> dense query returned 0 rows" };
|
|
27
|
+
}
|
|
28
|
+
}
|
|
29
|
+
```
|
|
30
|
+
|
|
31
|
+
- Choose health-check inputs that are guaranteed-dense (major city district,
|
|
32
|
+
a stable well-known entity id). Verify the id still exists when picking it.
|
|
33
|
+
- Also assert one semantic field on the first row (e.g. `items[0].name` is a
|
|
34
|
+
non-empty string) so a mapper regression that empties fields degrades too.
|
|
35
|
+
|
|
36
|
+
## Fail-closed: envelope level
|
|
37
|
+
- Upstream error headers/codes → structured `ProviderError` with a stable
|
|
38
|
+
`code` (`UPSTREAM_AUTH_ERROR`, `UPSTREAM_ERROR`, `NO_DATA`, ...).
|
|
39
|
+
- Non-JSON body, unexpected content type → `UPSTREAM_SCHEMA_ERROR`.
|
|
40
|
+
- HTTP non-2xx → classified error; never a fake empty success envelope.
|
|
41
|
+
Fixture-based tests cannot catch swallowed errors — write an explicit test:
|
|
42
|
+
mock a non-ok response and assert the handler REJECTS.
|
|
43
|
+
|
|
44
|
+
## Fail-closed: row level
|
|
45
|
+
Envelope guards are not enough. The silent killer is: response is valid,
|
|
46
|
+
array is non-empty, but every row normalizes to nothing.
|
|
47
|
+
- If a non-empty upstream collection produces zero normalized rows, throw
|
|
48
|
+
`UPSTREAM_SCHEMA_ERROR` instead of returning `items: []`.
|
|
49
|
+
- Identity fields (id, name) missing on a row → throw, don't skip the row
|
|
50
|
+
silently.
|
|
51
|
+
- Regression-test both layers separately: a bad envelope AND a good envelope
|
|
52
|
+
with unmappable rows.
|
|
53
|
+
|
|
54
|
+
## Error message hygiene
|
|
55
|
+
`ProviderError.message` reaches the tenant verbatim. Never interpolate
|
|
56
|
+
upstream free text that may contain personal data (names, phone numbers,
|
|
57
|
+
addresses); allowlist known code tokens and keep raw bodies in server-side
|
|
58
|
+
details/logs only.
|
|
59
|
+
|
|
60
|
+
## Checklist
|
|
61
|
+
- [ ] Every list op health check flags 0 rows on a dense query
|
|
62
|
+
- [ ] One semantic field asserted on a real row
|
|
63
|
+
- [ ] Swallowed-error test exists (non-ok mock → handler rejects)
|
|
64
|
+
- [ ] Non-empty upstream → zero normalized rows throws
|
|
65
|
+
- [ ] No upstream free text in customer-facing error messages
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: normalization-standards
|
|
3
|
+
description: Public output contract rules — field naming, timestamps, enums, units, nullability. Load before writing or editing any output schema or mapper.
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
# Normalization standards
|
|
7
|
+
|
|
8
|
+
Public output is the product. Apply these to every schema + mapper pair.
|
|
9
|
+
|
|
10
|
+
## Field naming
|
|
11
|
+
- `snake_case`, English, semantic. `emergency_phone`, not `dutyTel3`.
|
|
12
|
+
- Never expose vendor key vocabularies (`hv1`..`hv12`, `MKioskTy*`, `duty*`)
|
|
13
|
+
as public field names OR as dynamic record keys. A
|
|
14
|
+
`z.record(z.string(), ...)` keyed by vendor codes is still a vendor leak —
|
|
15
|
+
map codes to a stable public vocabulary (enum keys or an array of
|
|
16
|
+
`{ code, label, status }` objects with normalized status).
|
|
17
|
+
|
|
18
|
+
## Timestamps and dates
|
|
19
|
+
- Public: ISO 8601 (`2026-07-07T22:28:55+09:00`, dates `2026-07-07`,
|
|
20
|
+
clock times `HH:MM`). Include the upstream's timezone offset; Korean public
|
|
21
|
+
APIs are KST (+09:00) — verify, then encode it.
|
|
22
|
+
- Vendor formats (`YYYYMMDDHHmmss`, `HHmm`, unpadded `900`) are parsed inside
|
|
23
|
+
the mapper. Unparseable → `null`, plus a test for that row shape.
|
|
24
|
+
- Never emit a raw vendor timestamp string in public output, including
|
|
25
|
+
fixtures.
|
|
26
|
+
|
|
27
|
+
## Enums
|
|
28
|
+
- Vendor status values (codes, `Y`/`N`, Korean labels like `불가능`,
|
|
29
|
+
`정보미제공`) → declared `z.enum`. Unknown value → explicit `unknown` member
|
|
30
|
+
or fail closed; never pass raw text through.
|
|
31
|
+
- Map from the OFFICIAL code table, not from guessing what live samples mean.
|
|
32
|
+
Add a regression test per enum member.
|
|
33
|
+
|
|
34
|
+
## Numbers and units
|
|
35
|
+
- Field name states the unit: `distance_meters`, `radius_meters`,
|
|
36
|
+
`price_krw`. Mapper proves the conversion (upstream km → `* 1000`).
|
|
37
|
+
- Verify the upstream unit from spec or live-data sanity check (a "distance"
|
|
38
|
+
of `1.2` from a nearby search is km, not meters). Sibling endpoints of the
|
|
39
|
+
same vendor may differ — verify each one.
|
|
40
|
+
- Value-domain constraints (`nonnegative`, `min`, `max`) must reflect the
|
|
41
|
+
upstream's REAL domain observed in live data, not what seems sensible.
|
|
42
|
+
A wrong `nonnegative()` turns real negative values into `null`/errors
|
|
43
|
+
silently.
|
|
44
|
+
|
|
45
|
+
## Nullability
|
|
46
|
+
- `null` means "upstream did not provide it" — never "parsing failed" and
|
|
47
|
+
never a placeholder for invented data.
|
|
48
|
+
- Required-for-identity fields (ids, names) missing → throw
|
|
49
|
+
`UPSTREAM_SCHEMA_ERROR`; do not emit partial rows.
|
|
50
|
+
|
|
51
|
+
## Checklist before submitting a schema/mapper change
|
|
52
|
+
- [ ] No vendor key visible in any public field name or record key
|
|
53
|
+
- [ ] All timestamps ISO 8601 with timezone; parsing tested for real vendor
|
|
54
|
+
shapes (padded/unpadded, string/number)
|
|
55
|
+
- [ ] All status-like strings are declared enums with official-table mapping
|
|
56
|
+
- [ ] Every numeric field's unit is in its name and conversion is tested
|
|
57
|
+
- [ ] Constraints checked against live data, not intuition
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: pagination-and-counts
|
|
3
|
+
description: total_count semantics, client-side filtering, and paging honesty. Load before implementing any list/search operation.
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
# Pagination and counts
|
|
7
|
+
|
|
8
|
+
A caller uses `total_count`, `page`, and `limit` to plan iteration. If those
|
|
9
|
+
numbers don't describe what the caller can actually page through, the
|
|
10
|
+
operation is lying.
|
|
11
|
+
|
|
12
|
+
## The client-side filtering trap
|
|
13
|
+
If the upstream has no server-side filter for one of your inputs (e.g. no
|
|
14
|
+
radius param) and you filter rows after fetching:
|
|
15
|
+
|
|
16
|
+
- Upstream `totalCount` counts UNFILTERED rows. Returning it as your
|
|
17
|
+
`total_count` while returning filtered rows means: caller sees
|
|
18
|
+
`total_count: 541`, gets 1 row on page 1, and pages 2..28 return rows that
|
|
19
|
+
are outside the filter or empty. This is a contract failure, not a nuance.
|
|
20
|
+
|
|
21
|
+
Acceptable resolutions, in preference order:
|
|
22
|
+
1. **Don't accept the input.** If the upstream can't filter by it and you
|
|
23
|
+
can't enumerate all pages, drop the input from the schema and document the
|
|
24
|
+
upstream's real semantics (e.g. "results are distance-sorted; no radius
|
|
25
|
+
cutoff").
|
|
26
|
+
2. **Expose upstream semantics honestly.** Distance-sorted paging with a
|
|
27
|
+
documented "no radius filter" contract and no fake `radius` input.
|
|
28
|
+
3. **Filter AND fix the metadata.** If you must filter client-side, do not
|
|
29
|
+
return the upstream total. Return only what you can prove (`returned_count`
|
|
30
|
+
plus a `has_more` you can actually compute) and document that totals are
|
|
31
|
+
unavailable.
|
|
32
|
+
|
|
33
|
+
Never combine: accepted filter input + client-side filter + upstream total.
|
|
34
|
+
|
|
35
|
+
## Count integrity
|
|
36
|
+
- Parse failure of `totalCount` → `UPSTREAM_SCHEMA_ERROR`, not `0`.
|
|
37
|
+
A fail-open zero disguises upstream drift as an empty dataset.
|
|
38
|
+
- If `total_count > 0` but the page's row array normalizes to empty on
|
|
39
|
+
page 1, throw — that combination means broken extraction, not empty data.
|
|
40
|
+
|
|
41
|
+
## Page/limit echo
|
|
42
|
+
- Echo the EFFECTIVE values: if you clamp `limit` to the upstream max, return
|
|
43
|
+
the clamped value, not the requested one.
|
|
44
|
+
- `page`/`limit` semantics must match the upstream's paging model
|
|
45
|
+
(1-indexed vs 0-indexed) — verify with two live pages, checking the
|
|
46
|
+
returned rows actually differ.
|
|
47
|
+
|
|
48
|
+
## Checklist
|
|
49
|
+
- [ ] No input is filtered client-side while `total_count` comes from upstream
|
|
50
|
+
- [ ] totalCount parse failure fails closed
|
|
51
|
+
- [ ] Effective (clamped) limit echoed
|
|
52
|
+
- [ ] Two-page live check proves paging advances
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: upstream-contract-verification
|
|
3
|
+
description: How to establish evidence for upstream request params and response fields before coding. Load before wiring any new endpoint or mapping new fields.
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
# Upstream contract verification
|
|
7
|
+
|
|
8
|
+
Most provider P0s come from guessed upstream contracts. Every param name and
|
|
9
|
+
response field needs evidence BEFORE it ships.
|
|
10
|
+
|
|
11
|
+
## Request parameters
|
|
12
|
+
1. Start from the official spec document (data.go.kr 활용가이드, vendor API
|
|
13
|
+
docs). Copy exact names — casing and underscores matter
|
|
14
|
+
(`WGS84_LAT` ≠ `WGS84LAT`; the wrong one is often silently ignored).
|
|
15
|
+
2. Confirm with ONE live call per endpoint. A param being ignored does not
|
|
16
|
+
produce an error — it produces plausible-looking wrong results, so compare:
|
|
17
|
+
- filtered vs unfiltered `totalCount` (identical → param ignored)
|
|
18
|
+
- a dense-area query returning 0 rows (→ param name/format wrong)
|
|
19
|
+
3. Do NOT copy param names from a sibling endpoint or sibling API of the same
|
|
20
|
+
vendor without re-verifying. Same vendor ≠ same contract; endpoints drift.
|
|
21
|
+
4. If a param only works together with another param (district requires
|
|
22
|
+
province), encode that dependency in the input schema with a clear error.
|
|
23
|
+
Test it: dependent-param-alone must be rejected, not silently national.
|
|
24
|
+
|
|
25
|
+
## Response fields
|
|
26
|
+
- Map exactly the field names present in your recorded live fixtures.
|
|
27
|
+
- No speculative fallback chains (`row.distance ?? row.dist ?? row.Distance`).
|
|
28
|
+
If two shapes genuinely exist, you need a recorded fixture proving EACH
|
|
29
|
+
branch plus a row-level test per branch; otherwise map one name only.
|
|
30
|
+
- Field presence varies by endpoint within the same vendor. Detail endpoints
|
|
31
|
+
often return more/differently-named fields than list endpoints — record
|
|
32
|
+
fixtures per endpoint, not per vendor.
|
|
33
|
+
|
|
34
|
+
## When results look wrong
|
|
35
|
+
- Same response body across different request payloads → the upstream is
|
|
36
|
+
ignoring your variation; stop tuning fields and re-check param names/auth.
|
|
37
|
+
- Empty result for a query that must have data (city-center radius search,
|
|
38
|
+
major-district listing) → treat as a request bug. Never record it as a
|
|
39
|
+
fixture and never ship it.
|
|
40
|
+
|
|
41
|
+
## Deliverables per endpoint
|
|
42
|
+
- [ ] Spec reference (URL or doc name + section) noted in the PR/commit
|
|
43
|
+
- [ ] One recorded live fixture proving request params take effect
|
|
44
|
+
- [ ] Negative evidence checked: filtered count differs from unfiltered
|
|
45
|
+
- [ ] Param dependencies enforced in the input schema with tests
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
# Upstream notes
|
|
2
|
+
|
|
3
|
+
Per-vendor / per-API-family pitfalls proven by live evidence. These are the
|
|
4
|
+
highest-value files in this workspace: general principles are knowable, but
|
|
5
|
+
"this API silently ignores param X" is only discoverable by getting burned.
|
|
6
|
+
|
|
7
|
+
- Read EVERY file here before your first upstream call.
|
|
8
|
+
- When you discover a new upstream quirk (silently ignored param, unit
|
|
9
|
+
surprise, undocumented value domain, error-shape oddity), ADD it here in
|
|
10
|
+
the same format — evidence line included. Reviewers treat contributed
|
|
11
|
+
upstream notes as part of submission quality.
|
|
12
|
+
|
|
13
|
+
Format per entry: **Symptom → Cause → Rule → Evidence**.
|
package/dist/contract.js
CHANGED
|
@@ -122,6 +122,7 @@ function extractHealthCheck(value) {
|
|
|
122
122
|
return undefined;
|
|
123
123
|
return compactObject({
|
|
124
124
|
interval: value.interval,
|
|
125
|
+
schedule: toJsonValue(value.schedule),
|
|
125
126
|
timeoutMs: value.timeoutMs,
|
|
126
127
|
degradedThresholdMs: value.degradedThresholdMs,
|
|
127
128
|
requiresConnection: value.requiresConnection,
|
package/dist/define.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { AuthConfig, BrowserEngine, ContextDeclaration, CredentialDeclaration, HealthJourneyDefinition, HealthJourneySchedule, InferSchemaOutput, OperationDefinition, OperationHandlerResult, OperationHttpStreamTransport, OperationSseTransport, OperationWebSocketTransport, ProviderAccessConfig, ProviderDefinition, ProviderHealthMonitorConfig, ProviderProxyConfig, ProviderPublicProfile, ProviderReviewed, ProviderSecretDeclaration, ProviderStreamEvent, ProviderSttConfig, SchemaLike, SmsOtpMatcherDefinition, StealthPlatform } from "./types";
|
|
1
|
+
import type { AuthConfig, BrowserEngine, ContextDeclaration, CredentialDeclaration, HealthJourneyDefinition, HealthJourneySchedule, HealthScheduleRandomization, InferSchemaOutput, OperationDefinition, OperationHandlerResult, OperationHttpStreamTransport, OperationSseTransport, OperationWebSocketTransport, ProviderAccessConfig, ProviderDefinition, ProviderHealthMonitorConfig, ProviderProxyConfig, ProviderPublicProfile, ProviderReviewed, ProviderSecretDeclaration, ProviderStreamEvent, ProviderSttConfig, SchemaLike, SmsOtpMatcherDefinition, StealthPlatform } from "./types";
|
|
2
2
|
type ProviderImplementationSourceAccess = "official_api" | "private_api" | "browser_flow" | "hybrid";
|
|
3
3
|
type ProviderImplementationCredentialStrategy = "apifuse_managed" | "workspace_secret" | "user_oauth" | "user_session" | "none";
|
|
4
4
|
interface ProviderImplementationProfile {
|
|
@@ -80,6 +80,8 @@ export interface ProviderConfig<TOperations extends Record<string, ProviderOpera
|
|
|
80
80
|
};
|
|
81
81
|
operations: OperationMapConfig<TOperations>;
|
|
82
82
|
healthMonitor?: ProviderHealthMonitorConfig;
|
|
83
|
+
/** New name for `healthMonitor` (transitional alias); declaring both is a ValidationError. */
|
|
84
|
+
healthProbe?: ProviderHealthMonitorConfig;
|
|
83
85
|
healthJourneys?: readonly HealthJourneyDefinition[];
|
|
84
86
|
}
|
|
85
87
|
/** Define one provider operation with schema-driven handler inference. */
|
|
@@ -88,7 +90,10 @@ export declare function defineOperation<TInput extends SchemaLike, TOutput exten
|
|
|
88
90
|
export declare function defineStreamOperation<TInput extends SchemaLike, TOutput extends SchemaLike>(operation: StreamOperationConfig<TInput, TOutput>): OperationDefinition<TInput, TOutput>;
|
|
89
91
|
export declare function every(interval: string, options?: {
|
|
90
92
|
jitter?: string;
|
|
93
|
+
randomize?: HealthScheduleRandomization;
|
|
91
94
|
}): HealthJourneySchedule;
|
|
95
|
+
export declare function centered(maxOffset: string): HealthScheduleRandomization;
|
|
96
|
+
export declare function delayed(maxDelay: string): HealthScheduleRandomization;
|
|
92
97
|
export declare function defineSmsOtpMatcher(config: Omit<SmsOtpMatcherDefinition, "extractOtp">): SmsOtpMatcherDefinition;
|
|
93
98
|
export declare function defineHealthJourney(config: HealthJourneyDefinition): HealthJourneyDefinition;
|
|
94
99
|
export declare function defineProvider<TOperations extends Record<string, ProviderOperation>, TConfig extends ProviderConfig<TOperations>>(config: TConfig & AuthStartNoInputGuard<TConfig>): ProviderDefinition & {
|