@apifuse/provider-sdk 2.2.0-beta.3 → 2.2.0-beta.30
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 +493 -5
- package/CHANGELOG.md +127 -1
- package/README.md +52 -6
- package/SUBMISSION.md +1 -1
- package/bin/apifuse-check.ts +106 -62
- package/bin/apifuse-create.ts +1 -1
- package/bin/apifuse-dev.ts +63 -55
- package/bin/apifuse-pack-check.ts +22 -2
- package/bin/apifuse-pack-smoke.ts +78 -82
- package/bin/apifuse-pack-types.ts +583 -0
- package/bin/apifuse-perf.ts +59 -140
- package/bin/apifuse-record.ts +698 -113
- package/bin/apifuse-submit-check.ts +517 -44
- package/bin/apifuse-sync-assets.ts +117 -0
- package/bin/apifuse.ts +1 -1
- package/bin/submit-check-delimited-text.ts +50 -0
- package/bin/submit-check-xml.ts +1 -1
- package/dist/auth-turn/index.d.ts +4 -4
- package/dist/auth-turn/index.js +1 -1
- package/dist/auth.d.ts +16 -2
- package/dist/auth.js +76 -18
- package/dist/ceremonies/index.d.ts +9 -1
- package/dist/ceremonies/index.js +117 -29
- package/dist/cli/commands.d.ts +1 -1
- package/dist/cli/commands.js +8 -0
- package/dist/cli/create.d.ts +3 -0
- package/dist/cli/create.js +34 -35
- package/dist/cli/prompt-assets.d.ts +80 -0
- package/dist/cli/prompt-assets.js +743 -0
- package/dist/cli/templates/provider/AGENTS.md.tpl +17 -8
- package/dist/cli/templates/provider/README.md.tpl +4 -4
- package/dist/config/loader.d.ts +176 -17
- package/dist/config/loader.js +434 -161
- package/dist/contract-serialization.d.ts +2 -2
- package/dist/contract-serialization.js +7 -14
- package/dist/contract-types.d.ts +3 -2
- package/dist/contract.d.ts +3 -3
- package/dist/contract.js +6 -6
- package/dist/declaration-validation.d.ts +23 -0
- package/dist/declaration-validation.js +159 -0
- package/dist/define.d.ts +13 -1
- package/dist/define.js +391 -122
- package/dist/dev.d.ts +1 -1
- package/dist/dev.js +1 -1
- package/dist/error-resolution.d.ts +4 -0
- package/dist/error-resolution.js +122 -0
- package/dist/errors.d.ts +19 -1
- package/dist/errors.js +41 -3
- package/dist/fixture-sanitization.d.ts +26 -0
- package/dist/fixture-sanitization.js +216 -0
- package/dist/i18n/catalog.d.ts +2 -2
- package/dist/i18n/catalog.js +4 -10
- package/dist/i18n/index.d.ts +2 -2
- package/dist/i18n/index.js +2 -2
- package/dist/i18n/keys.d.ts +2 -2
- package/dist/index.d.ts +50 -42
- package/dist/index.js +41 -37
- package/dist/lint.d.ts +6 -1
- package/dist/lint.js +370 -18
- package/dist/native-address.d.ts +43 -0
- package/dist/native-address.js +281 -0
- package/dist/native-egress-policy.d.ts +31 -0
- package/dist/native-egress-policy.js +288 -0
- package/dist/observability.d.ts +5 -2
- package/dist/observability.js +48 -1
- package/dist/provider.d.ts +13 -11
- package/dist/provider.js +10 -9
- package/dist/public-schema-field-lint.d.ts +1 -1
- package/dist/recipes/gov-api.js +1 -1
- package/dist/runtime/auth-flow.d.ts +3 -1
- package/dist/runtime/auth-flow.js +8 -3
- package/dist/runtime/browser.d.ts +1 -1
- package/dist/runtime/browser.js +138 -40
- package/dist/runtime/cache.d.ts +2 -1
- package/dist/runtime/cache.js +173 -23
- package/dist/runtime/choice-wordlist.d.ts +9 -0
- package/dist/runtime/choice-wordlist.js +138 -0
- package/dist/runtime/choice.d.ts +13 -1
- package/dist/runtime/choice.js +514 -124
- package/dist/runtime/credential.d.ts +1 -1
- package/dist/runtime/credential.js +1 -1
- package/dist/runtime/env.d.ts +1 -1
- package/dist/runtime/executor.d.ts +1 -1
- package/dist/runtime/executor.js +25 -3
- package/dist/runtime/http.d.ts +3 -2
- package/dist/runtime/http.js +517 -55
- package/dist/runtime/insights.d.ts +1 -1
- package/dist/runtime/insights.js +6 -13
- package/dist/runtime/instrumentation.d.ts +2 -2
- package/dist/runtime/instrumentation.js +371 -23
- package/dist/runtime/keyring.js +1 -1
- package/dist/runtime/namespace.js +1 -1
- package/dist/runtime/native-network-errors.d.ts +33 -0
- package/dist/runtime/native-network-errors.js +69 -0
- package/dist/runtime/native-network.d.ts +96 -0
- package/dist/runtime/native-network.js +1232 -0
- package/dist/runtime/ocr.d.ts +29 -0
- package/dist/runtime/ocr.js +440 -0
- package/dist/runtime/otlp.d.ts +1 -1
- package/dist/runtime/perf.d.ts +1 -1
- package/dist/runtime/provider.d.ts +1 -1
- package/dist/runtime/provider.js +1 -2
- package/dist/runtime/proxy-errors.d.ts +1 -1
- package/dist/runtime/proxy-errors.js +9 -7
- package/dist/runtime/proxy-nodemaven.d.ts +56 -0
- package/dist/runtime/proxy-nodemaven.js +146 -0
- package/dist/runtime/proxy-retry-policy.d.ts +2 -2
- package/dist/runtime/proxy-retry-policy.js +2 -2
- package/dist/runtime/proxy-telemetry.d.ts +2 -1
- package/dist/runtime/proxy-telemetry.js +58 -52
- package/dist/runtime/redirects.d.ts +29 -0
- package/dist/runtime/redirects.js +36 -0
- package/dist/runtime/redis.d.ts +1 -1
- package/dist/runtime/redis.js +5 -5
- package/dist/runtime/request-options.d.ts +68 -1
- package/dist/runtime/request-options.js +548 -0
- package/dist/runtime/resolver-config.d.ts +6 -0
- package/dist/runtime/resolver-config.js +6 -0
- package/dist/runtime/resolver-public.d.ts +1 -0
- package/dist/runtime/resolver-public.js +1 -0
- package/dist/runtime/resolver-shared.d.ts +3 -0
- package/dist/runtime/resolver-shared.js +12 -0
- package/dist/runtime/resolver-vendors/bindings.d.ts +48 -0
- package/dist/runtime/resolver-vendors/bindings.js +40 -0
- package/dist/runtime/resolver-vendors/browser.d.ts +20 -0
- package/dist/runtime/resolver-vendors/browser.js +282 -0
- package/dist/runtime/resolver-vendors/hosts.d.ts +2 -0
- package/dist/runtime/resolver-vendors/hosts.js +33 -0
- package/dist/runtime/resolver-vendors/twocaptcha.d.ts +24 -0
- package/dist/runtime/resolver-vendors/twocaptcha.js +368 -0
- package/dist/runtime/resolver-vendors/types.d.ts +83 -0
- package/dist/runtime/resolver-vendors/types.js +69 -0
- package/dist/runtime/resolver.d.ts +59 -0
- package/dist/runtime/resolver.js +705 -0
- package/dist/runtime/secrets.d.ts +27 -0
- package/dist/runtime/secrets.js +51 -0
- package/dist/runtime/state.d.ts +5 -2
- package/dist/runtime/state.js +280 -74
- package/dist/runtime/stealth-cookies.d.ts +20 -0
- package/dist/runtime/stealth-cookies.js +111 -0
- package/dist/runtime/stealth.d.ts +30 -5
- package/dist/runtime/stealth.js +523 -259
- package/dist/runtime/stt.d.ts +1 -1
- package/dist/runtime/stt.js +12 -27
- package/dist/runtime/timeout.d.ts +5 -0
- package/dist/runtime/timeout.js +12 -0
- package/dist/runtime/trace.d.ts +2 -2
- package/dist/runtime/trace.js +2 -4
- package/dist/runtime/waterfall.d.ts +1 -1
- package/dist/schema.d.ts +1 -1
- package/dist/schema.js +7 -15
- package/dist/serve.d.ts +1 -1
- package/dist/serve.js +1 -1
- package/dist/server/index.d.ts +7 -7
- package/dist/server/index.js +6 -6
- package/dist/server/self-test-input-tokens.d.ts +2 -1
- package/dist/server/self-test-input-tokens.js +18 -14
- package/dist/server/self-test-redaction.d.ts +1 -1
- package/dist/server/self-test-redaction.js +1 -1
- package/dist/server/self-test.d.ts +117 -3
- package/dist/server/self-test.js +787 -151
- package/dist/server/serve-implementation.d.ts +210 -0
- package/dist/server/serve-implementation.js +2077 -0
- package/dist/server/serve.d.ts +1 -70
- package/dist/server/serve.js +1 -1143
- package/dist/server/types.d.ts +34 -9
- package/dist/server/types.js +8 -1
- package/dist/stateful/errors.d.ts +19 -0
- package/dist/stateful/errors.js +24 -0
- package/dist/stateful/http-provider-event-emitter.d.ts +40 -0
- package/dist/stateful/http-provider-event-emitter.js +237 -0
- package/dist/stateful/http-session-owner-registry.d.ts +44 -0
- package/dist/stateful/http-session-owner-registry.js +210 -0
- package/dist/stateful/index.d.ts +18 -0
- package/dist/stateful/index.js +18 -0
- package/dist/stateful/provider-event-delivery-failures.d.ts +32 -0
- package/dist/stateful/provider-event-delivery-failures.js +43 -0
- package/dist/stateful/provider-event-pipeline-metrics.d.ts +46 -0
- package/dist/stateful/provider-event-pipeline-metrics.js +48 -0
- package/dist/stateful/provider-event-pipeline.d.ts +50 -0
- package/dist/stateful/provider-event-pipeline.js +1 -0
- package/dist/stateful/provider-events.d.ts +101 -0
- package/dist/stateful/provider-events.js +289 -0
- package/dist/stateful/session-key.d.ts +15 -0
- package/dist/stateful/session-key.js +86 -0
- package/dist/stateful/stateful-provider-adapter-context.d.ts +5 -0
- package/dist/stateful/stateful-provider-adapter-context.js +42 -0
- package/dist/stateful/stateful-provider-adapter-metrics.d.ts +15 -0
- package/dist/stateful/stateful-provider-adapter-metrics.js +21 -0
- package/dist/stateful/stateful-provider-adapter.d.ts +98 -0
- package/dist/stateful/stateful-provider-adapter.js +287 -0
- package/dist/stateful/stateful-provider-observability.d.ts +62 -0
- package/dist/stateful/stateful-provider-observability.js +161 -0
- package/dist/stateful/stateful-provider-owner-forwarder.d.ts +41 -0
- package/dist/stateful/stateful-provider-owner-forwarder.js +215 -0
- package/dist/stateful/stateful-provider-runtime-context.d.ts +32 -0
- package/dist/stateful/stateful-provider-runtime-context.js +60 -0
- package/dist/stateful/stateful-provider-runtime-executor.d.ts +34 -0
- package/dist/stateful/stateful-provider-runtime-executor.js +52 -0
- package/dist/stateful/stateful-provider-session-routing.d.ts +67 -0
- package/dist/stateful/stateful-provider-session-routing.js +345 -0
- package/dist/stateful/stateful-provider-session-runtime.d.ts +98 -0
- package/dist/stateful/stateful-provider-session-runtime.js +245 -0
- package/dist/stateful-signing.d.ts +18 -0
- package/dist/stateful-signing.js +27 -0
- package/dist/stealth/profiles.d.ts +1 -1
- package/dist/stealth/profiles.js +21 -21
- package/dist/stream-evidence.d.ts +74 -0
- package/dist/stream-evidence.js +785 -0
- package/dist/stream.d.ts +1 -1
- package/dist/stream.js +7 -1
- package/dist/testing/index.d.ts +3 -2
- package/dist/testing/index.js +3 -2
- package/dist/testing/run.d.ts +32 -2
- package/dist/testing/run.js +488 -28
- package/dist/types.d.ts +566 -19
- package/dist/types.js +1 -0
- package/dist/user-input.d.ts +30 -0
- package/dist/user-input.js +66 -0
- package/package.json +42 -7
- package/src/auth-turn/index.ts +2 -2
- package/src/auth.ts +146 -86
- package/src/ceremonies/index.ts +167 -92
- package/src/cli/commands.ts +10 -0
- package/src/cli/create.ts +42 -35
- package/src/cli/prompt-assets.ts +865 -0
- package/src/cli/templates/provider/AGENTS.md.tpl +17 -8
- package/src/cli/templates/provider/README.md.tpl +4 -4
- package/src/config/loader.ts +667 -289
- package/src/contract-serialization.ts +10 -18
- package/src/contract-types.ts +3 -2
- package/src/contract.ts +14 -28
- package/src/declaration-validation.ts +202 -0
- package/src/define.ts +631 -495
- package/src/dev.ts +4 -9
- package/src/error-resolution.ts +127 -0
- package/src/errors.ts +56 -11
- package/src/fixture-sanitization.ts +247 -0
- package/src/i18n/catalog.ts +10 -32
- package/src/i18n/index.ts +2 -2
- package/src/i18n/keys.ts +5 -11
- package/src/index.ts +157 -44
- package/src/lint.ts +488 -154
- package/src/native-address.ts +340 -0
- package/src/native-egress-policy.ts +358 -0
- package/src/observability.ts +51 -1
- package/src/provider.ts +65 -11
- package/src/public-schema-field-lint.ts +7 -33
- package/src/recipes/gov-api.ts +2 -5
- package/src/runtime/auth-flow.ts +13 -7
- package/src/runtime/browser.ts +252 -207
- package/src/runtime/cache.ts +209 -81
- package/src/runtime/choice-wordlist.ts +145 -0
- package/src/runtime/choice.ts +685 -216
- package/src/runtime/credential.ts +2 -2
- package/src/runtime/env.ts +1 -1
- package/src/runtime/executor.ts +37 -19
- package/src/runtime/http.ts +645 -65
- package/src/runtime/insights.ts +15 -53
- package/src/runtime/instrumentation.ts +530 -67
- package/src/runtime/keyring.ts +7 -19
- package/src/runtime/namespace.ts +2 -7
- package/src/runtime/native-network-errors.ts +99 -0
- package/src/runtime/native-network.ts +1605 -0
- package/src/runtime/ocr.ts +523 -0
- package/src/runtime/otlp.ts +12 -23
- package/src/runtime/perf.ts +1 -1
- package/src/runtime/provider.ts +4 -9
- package/src/runtime/proxy-errors.ts +29 -42
- package/src/runtime/proxy-nodemaven.ts +221 -0
- package/src/runtime/proxy-retry-policy.ts +3 -3
- package/src/runtime/proxy-telemetry.ts +84 -77
- package/src/runtime/redirects.ts +66 -0
- package/src/runtime/redis.ts +10 -13
- package/src/runtime/request-options.ts +679 -9
- package/src/runtime/resolver-config.ts +6 -0
- package/src/runtime/resolver-public.ts +18 -0
- package/src/runtime/resolver-shared.ts +17 -0
- package/src/runtime/resolver-vendors/bindings.ts +56 -0
- package/src/runtime/resolver-vendors/browser.ts +408 -0
- package/src/runtime/resolver-vendors/hosts.ts +38 -0
- package/src/runtime/resolver-vendors/twocaptcha.ts +500 -0
- package/src/runtime/resolver-vendors/types.ts +173 -0
- package/src/runtime/resolver.ts +1060 -0
- package/src/runtime/secrets.ts +64 -0
- package/src/runtime/state.ts +399 -161
- package/src/runtime/stealth-cookies.ts +132 -0
- package/src/runtime/stealth.ts +681 -295
- package/src/runtime/stt.ts +39 -113
- package/src/runtime/timeout.ts +18 -0
- package/src/runtime/trace.ts +14 -44
- package/src/runtime/waterfall.ts +5 -18
- package/src/schema.ts +23 -84
- package/src/serve.ts +6 -1
- package/src/server/index.ts +30 -7
- package/src/server/self-test-input-tokens.ts +29 -14
- package/src/server/self-test-redaction.ts +2 -2
- package/src/server/self-test.ts +1030 -180
- package/src/server/serve-implementation.ts +3060 -0
- package/src/server/serve.ts +1 -1781
- package/src/server/types.ts +12 -13
- package/src/stateful/README.md +146 -0
- package/src/stateful/errors.ts +35 -0
- package/src/stateful/http-provider-event-emitter.ts +314 -0
- package/src/stateful/http-session-owner-registry.ts +306 -0
- package/src/stateful/index.ts +18 -0
- package/src/stateful/provider-event-delivery-failures.ts +80 -0
- package/src/stateful/provider-event-pipeline-metrics.ts +95 -0
- package/src/stateful/provider-event-pipeline.ts +61 -0
- package/src/stateful/provider-events.ts +462 -0
- package/src/stateful/session-key.ts +111 -0
- package/src/stateful/stateful-provider-adapter-context.ts +59 -0
- package/src/stateful/stateful-provider-adapter-metrics.ts +48 -0
- package/src/stateful/stateful-provider-adapter.ts +562 -0
- package/src/stateful/stateful-provider-observability.ts +261 -0
- package/src/stateful/stateful-provider-owner-forwarder.ts +287 -0
- package/src/stateful/stateful-provider-runtime-context.ts +92 -0
- package/src/stateful/stateful-provider-runtime-executor.ts +96 -0
- package/src/stateful/stateful-provider-session-routing.ts +546 -0
- package/src/stateful/stateful-provider-session-runtime.ts +403 -0
- package/src/stateful-signing.ts +46 -0
- package/src/stealth/profiles.ts +27 -33
- package/src/stream-evidence.ts +988 -0
- package/src/stream.ts +16 -20
- package/src/testing/index.ts +11 -2
- package/src/testing/run.ts +668 -74
- package/src/types.ts +665 -35
- package/src/user-input.ts +118 -0
- package/dist/cli/templates/provider/CLAUDE.md.tpl +0 -1
- package/src/cli/templates/provider/CLAUDE.md.tpl +0 -1
- /package/dist/cli/templates/provider/{skills → .agents/skills}/fixtures-and-recording/SKILL.md.tpl +0 -0
- /package/dist/cli/templates/provider/{skills → .agents/skills}/health-checks-and-fail-closed/SKILL.md.tpl +0 -0
- /package/dist/cli/templates/provider/{skills → .agents/skills}/normalization-standards/SKILL.md.tpl +0 -0
- /package/dist/cli/templates/provider/{skills → .agents/skills}/pagination-and-counts/SKILL.md.tpl +0 -0
- /package/dist/cli/templates/provider/{skills → .agents/skills}/upstream-contract-verification/SKILL.md.tpl +0 -0
- /package/dist/cli/templates/provider/{skills → .agents/skills}/upstream-notes/README.md.tpl +0 -0
- /package/src/cli/templates/provider/{skills → .agents/skills}/fixtures-and-recording/SKILL.md.tpl +0 -0
- /package/src/cli/templates/provider/{skills → .agents/skills}/health-checks-and-fail-closed/SKILL.md.tpl +0 -0
- /package/src/cli/templates/provider/{skills → .agents/skills}/normalization-standards/SKILL.md.tpl +0 -0
- /package/src/cli/templates/provider/{skills → .agents/skills}/pagination-and-counts/SKILL.md.tpl +0 -0
- /package/src/cli/templates/provider/{skills → .agents/skills}/upstream-contract-verification/SKILL.md.tpl +0 -0
- /package/src/cli/templates/provider/{skills → .agents/skills}/upstream-notes/README.md.tpl +0 -0
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,117 @@
|
|
|
1
1
|
# @apifuse/provider-sdk Changelog
|
|
2
2
|
|
|
3
|
+
## 2.2.0-beta.30
|
|
4
|
+
|
|
5
|
+
- Release candidate for main commit ccf3d56bfcbe9683c6e7ad45dde8e6703467f9e7.
|
|
6
|
+
|
|
7
|
+
## 2.2.0-beta.29
|
|
8
|
+
|
|
9
|
+
- Release candidate for main commit b7243459ab12403e11d7b5b93292f09b734b0a96.
|
|
10
|
+
|
|
11
|
+
## 2.2.0-beta.28
|
|
12
|
+
|
|
13
|
+
- Release candidate for main commit 2936f1891d4e2326502f0585081f8a58060d6dd7.
|
|
14
|
+
|
|
15
|
+
## 2.2.0-beta.27
|
|
16
|
+
|
|
17
|
+
- Release candidate for main commit 579d9e7fd22d8414b151be2b71a43a0990456911.
|
|
18
|
+
|
|
19
|
+
## 2.2.0-beta.26
|
|
20
|
+
|
|
21
|
+
- Release candidate for main commit 924fe13d1101e7840d799a562a7a70174355185d.
|
|
22
|
+
|
|
23
|
+
## 2.2.0-beta.25
|
|
24
|
+
|
|
25
|
+
- Release candidate for main commit e6df658b95c0728b671fd221919ec2f85f82b0b7.
|
|
26
|
+
|
|
27
|
+
## 2.2.0-beta.24
|
|
28
|
+
|
|
29
|
+
- Release candidate for main commit 0f21a2959dcbb9b96fe426259259d0870cfc537f.
|
|
30
|
+
|
|
31
|
+
## 2.2.0-beta.23
|
|
32
|
+
|
|
33
|
+
- Release candidate for main commit 36b3bedc9c14913c4152c4631cc87de71062f21f.
|
|
34
|
+
|
|
35
|
+
## 2.2.0-beta.22
|
|
36
|
+
|
|
37
|
+
- Release candidate for main commit b8bf920b5ca053d1bf43018167fd4eedff01700d.
|
|
38
|
+
|
|
39
|
+
## Unreleased
|
|
40
|
+
|
|
41
|
+
- Added the `thrown-error-code-undeclared` authoring lint (warning level): `apifuse check` now statically flags literal `ProviderError`/`ValidationError` codes that are neither SDK-registered nor declared in any operation's `docs.errorCodes`, surfacing the runtime `unregistered_provider_error_code` signal at check time. The canonical SDK code→status mapping moved to `SDK_STATUS_MAPPED_PROVIDER_ERROR_CODES` in `error-resolution.ts`, shared by the runtime status resolver and the lint.
|
|
42
|
+
|
|
43
|
+
## 2.2.0-beta.21
|
|
44
|
+
|
|
45
|
+
- Release candidate for main commit 00f61024fb18db39711dc5076c4621508baa49f5.
|
|
46
|
+
|
|
47
|
+
## 2.2.0-beta.20
|
|
48
|
+
|
|
49
|
+
- Release candidate for main commit 8043d2ef0047e431aace750d8abca2e1149ec1d6.
|
|
50
|
+
|
|
51
|
+
## 2.2.0-beta.19
|
|
52
|
+
|
|
53
|
+
- Release candidate for main commit fd93ae68d0472fae68d908312249163373ec5d22.
|
|
54
|
+
|
|
55
|
+
## 2.2.0-beta.18
|
|
56
|
+
|
|
57
|
+
- Release candidate for main commit cebaf4b994918d2641c0fe6681fbffd3a3284c5d.
|
|
58
|
+
|
|
59
|
+
## 2.2.0-beta.17
|
|
60
|
+
|
|
61
|
+
- Release candidate for main commit 5a0f9127a5861992d5c144b07ad379a085756544.
|
|
62
|
+
|
|
63
|
+
## 2.2.0-beta.16
|
|
64
|
+
|
|
65
|
+
- Release candidate for main commit c5deb2bc31a4a4a236d27a2ce3d214b533ed358f.
|
|
66
|
+
|
|
67
|
+
## 2.2.0-beta.15
|
|
68
|
+
|
|
69
|
+
- Release candidate for main commit b5ebd25e48f6502e4ddb775d4e0a25f5c8276712.
|
|
70
|
+
|
|
71
|
+
## 2.2.0-beta.14
|
|
72
|
+
|
|
73
|
+
- Release candidate for main commit 3491acd253ca17b517985e8a618f1c2904a664a9.
|
|
74
|
+
|
|
75
|
+
## 2.2.0-beta.13
|
|
76
|
+
|
|
77
|
+
- Release candidate for main commit 75e840d0614aea3b99a1e5cef4f93f8cdccf0507.
|
|
78
|
+
|
|
79
|
+
## 2.2.0-beta.12
|
|
80
|
+
|
|
81
|
+
- Release candidate for main commit c66789c4745c72fc94ad3c10b3e0d7e5ed83fd25.
|
|
82
|
+
|
|
83
|
+
## 2.2.0-beta.11
|
|
84
|
+
|
|
85
|
+
- Release candidate for main commit f6f739bd5265afe714bbace9900edc2695fcf826.
|
|
86
|
+
|
|
87
|
+
## 2.2.0-beta.10
|
|
88
|
+
|
|
89
|
+
- Release candidate for main commit c41bd919739e0293ae8fa4d72a8a32f034cef4b8.
|
|
90
|
+
|
|
91
|
+
## 2.2.0-beta.9
|
|
92
|
+
|
|
93
|
+
- Release candidate for main commit 5c78c8b (bundles #67 nodemaven required-secret + #68 transport vendor-advance).
|
|
94
|
+
|
|
95
|
+
## 2.2.0-beta.8
|
|
96
|
+
|
|
97
|
+
- Release candidate for main commit 9e8a3f028ee78b9cab29d4aa3f5494ac9cffa65f.
|
|
98
|
+
|
|
99
|
+
## 2.2.0-beta.7
|
|
100
|
+
|
|
101
|
+
- Release candidate for main commit 2ce4ea4bd36ce333eba8b3b474bf6e82b5e9216c.
|
|
102
|
+
|
|
103
|
+
## 2.2.0-beta.6
|
|
104
|
+
|
|
105
|
+
- Release candidate for main commit 17f4e41d44efe7c148ef875b950be4f2c7df1294.
|
|
106
|
+
|
|
107
|
+
## 2.2.0-beta.5
|
|
108
|
+
|
|
109
|
+
- Release candidate for main commit 82fa14e99a9af7edd44e3196aa3f4e87b4699edf.
|
|
110
|
+
|
|
111
|
+
## 2.2.0-beta.4
|
|
112
|
+
|
|
113
|
+
- Release candidate for main commit 73f2c6ec429c2fbce8ac458a67111e4844b99178.
|
|
114
|
+
|
|
3
115
|
## 2.2.0-beta.3
|
|
4
116
|
|
|
5
117
|
- Release candidate for main commit 74e8e18b502dd9b02dbf0d3e702f917570312fc0.
|
|
@@ -42,8 +154,22 @@
|
|
|
42
154
|
|
|
43
155
|
## Unreleased
|
|
44
156
|
|
|
157
|
+
- Upstream the platform monorepo's beta.16 dist patch: OAuth2-proxied auth ceremony (`createOAuth2ProxiedStart`, `OAUTH2_PROXIED_PKCE_VERIFIER_KEY`, `APIFUSE__AUTH_PROXY__URL` origin key, proxied redirect/callback turns) and the provider runtime state upgrades it depends on (in-memory compareAndSet with quota-aware write policy, Redis CAS/set Lua scripts with entry quotas and legacy index migration). The monorepo drops `patchedDependencies` once it pins this release.
|
|
158
|
+
- **honest-provider-error-contract (phase 2):** `UPSTREAM_REJECTED` is a registered code family serving HTTP 409 with `retryable: false` — deterministic upstream business refusals are no longer 502s. Operation-declared `docs.errorCodes` may now use 409/410/422. Public error envelopes carry a `source` field (`client` | `upstream_rule` | `upstream_failure` | `apifuse`) derived from the observability category. Taxonomy version bumps to `2026-08-07` with the `upstream_rejected`, `dependency_unavailable`, `unsupported_transport`, and `client_cancelled` categories (409/410/422 map to `upstream_rejected`), matching the platform monorepo SoT. The `unregistered_provider_error_code` signal now carries a `signalFix` pointing at `docs.errorCodes` declaration.
|
|
159
|
+
- **Breaking for custom native gateway adapters:** `NativeGatewayProxySynthesisInput` now includes an injected `credentials` resolver and selected `protocol`; synthesizers may return promises and structured skip reasons, and `resolveNativeGatewayProxy` is async. Default callers retain env-backed behavior. Native transport now supports both HTTP CONNECT and SOCKS5, defaults per vendor with an explicit runtime override, registers smartproxy allocation ahead of nodemaven when declared in that order, and reports every exhausted vendor reason without exposing proxy credentials.
|
|
160
|
+
- Honor operation `docs.errorCodes` at runtime: declared provider-owned statuses and retryability now drive the HTTP envelope, observability header, and structured log; invalid statuses fail `defineProvider`, declared codes no longer emit the unregistered-code signal, and `TransportError` status-preservation workarounds are obsolete.
|
|
161
|
+
- Add an opt-in same-origin redirect hop policy to `ctx.http`, with bounded manual following and typed failures before a refused target is requested.
|
|
162
|
+
- Enforce provider-declared native TCP/TLS egress before proxy or socket setup, with revocable and expiring dynamic grants plus typed authorization failures; providers without a native egress declaration retain legacy behavior.
|
|
163
|
+
- **Breaking:** Provider error `details` is now passed through verbatim; SDK observability fields (`category`, `taxonomyVersion`, `upstreamStatus`, and derived `retryable`) are no longer merged into the public body. Emitted error envelopes now require top-level `retryable`, while inbound stateful forwarding tolerates an older owner response that omits it and defaults it to `false`. The removed observability metadata is available in the new `X-ApiFuse-Error-Observability` response header.
|
|
164
|
+
- Unregistered `ProviderError` codes now default to HTTP 500 instead of 400 and emit an `unregistered_provider_error_code` structured-log signal; registered mappings remain unchanged and take precedence over the HTTP 400 fallback for unregistered input `ValidationError` codes.
|
|
165
|
+
- Add an opt-in native connection idle read timeout with a typed error, independently from TCP/SOCKS/TLS establishment deadlines.
|
|
166
|
+
- Add opt-in `maxBodyBytes` enforcement to stealth fetches and redirect hops, aborting oversized decoded response streams with `response_too_large`.
|
|
167
|
+
- Resolve relative date tokens in fixture requests before input-schema validation, add KST capture-date `fixtures.recordedAt` metadata, and support explicit KST/UTC calendars in the shared health-input resolver.
|
|
168
|
+
- Add opt-in `runStandardTests(provider, { upstreamStub })` real-handler E2E coverage with strict offline transport stubs, output-schema validation, and per-operation warnings when handler E2E is not enabled.
|
|
169
|
+
- Export native-network and request-file TypeScript contracts from the package root and `./provider`, including typed native provider declarations and optional runtime capabilities on provider/auth contexts.
|
|
45
170
|
- Add `arrayBuffer()` and `bytes()` to `HttpResponse` so `ctx.http` consumers can read binary-safe upstream bodies; internal response handling is now byte-first.
|
|
46
171
|
- Preserve identity-only operation `connectionId` values in `ProviderContext` without requiring credential material.
|
|
172
|
+
- Accept and validate `proxy.session.drainLeadSeconds` in `defineProvider`, so providers can actually declare the native sticky-expiry drain lead time the type surface already exposed; a non-positive value, or one that meets or exceeds the sticky lifetime, is rejected at define time.
|
|
47
173
|
|
|
48
174
|
## 2.1.0-beta.15
|
|
49
175
|
|
|
@@ -99,7 +225,7 @@
|
|
|
99
225
|
|
|
100
226
|
## 2.1.0-beta.3
|
|
101
227
|
|
|
102
|
-
- Replace the legacy TypeScript request transport with `ctx.stealth`, backed by
|
|
228
|
+
- Replace the legacy TypeScript request transport with `ctx.stealth`, backed by browser-grade TLS/HTTP2 impersonation without Python runtime dependencies.
|
|
103
229
|
- Add the public `apifuse submit-check` / `apifuse bounty-check` CLI for score-based pre-submission provider quality checks.
|
|
104
230
|
- Ship `SUBMISSION.md` in the npm package so bounty contributors can follow the checklist without access to the private monorepo.
|
|
105
231
|
- Include submit-check in generated provider validation scripts and packed-artifact smoke coverage.
|
package/README.md
CHANGED
|
@@ -119,7 +119,11 @@ the bad request path; provider/runtime failures include `code`, `message`, and
|
|
|
119
119
|
local-only values through `connection.secrets`. Read them in handlers with
|
|
120
120
|
`ctx.credential.get("key")` or `ctx.credential.getAccessToken()`.
|
|
121
121
|
- **Provider env secrets**: declare `secrets[]`, set values in your shell or
|
|
122
|
-
`.env`, and read only those names through `ctx.env.get("NAME")`.
|
|
122
|
+
`.env`, and read only those names through `ctx.env.get("NAME")`. The SDK
|
|
123
|
+
enforces presence of `required: true` declarations before handlers and auth
|
|
124
|
+
flows run, failing the invocation with a structured `MISSING_SECRET` error
|
|
125
|
+
(HTTP 400, category `credential_unavailable`) — do not re-check presence in
|
|
126
|
+
handlers.
|
|
123
127
|
- **Credentials auth flows**: prefer `defineCredentialsAuth()` over hand-written
|
|
124
128
|
`auth.flow`. Declare the form fields and credential keys once, then put the
|
|
125
129
|
upstream login/session creation in `login(ctx, input)`. Return
|
|
@@ -133,15 +137,57 @@ the bad request path; provider/runtime failures include `code`, `message`, and
|
|
|
133
137
|
`context` object.
|
|
134
138
|
- **Stealth-sensitive providers**: use `ctx.http` for normal JSON/REST calls and
|
|
135
139
|
`ctx.stealth.fetch()` when you need browser-like session or cookie control.
|
|
136
|
-
`ctx.stealth.fetch()` uses the
|
|
137
|
-
accepts request controls for `params`, `proxy`, `timeout`, `profile`,
|
|
138
|
-
`redirect`, `throwOnHttpError`, and
|
|
140
|
+
`ctx.stealth.fetch()` uses the `wreq-js`-backed browser stealth transport and
|
|
141
|
+
accepts request controls for `params`, `sensitiveParams`, `proxy`, `timeout`, `profile`,
|
|
142
|
+
`maxBodyBytes`, `redirect`, `throwOnHttpError`, and
|
|
143
|
+
`stealth.insecureSkipVerify`. For login
|
|
139
144
|
flows that must inspect intermediate `Location`/`Set-Cookie` headers, create
|
|
140
145
|
a session with `ctx.stealth.createSession()` and use `session.redirects.run()`;
|
|
141
146
|
inspect accumulated cookies through `session.cookies`. Select an SDK stealth
|
|
142
147
|
`profile` such as `chrome-146`; do not tune JA3, HTTP/2 SETTINGS, or
|
|
143
|
-
pseudo-header order in provider code. Chrome
|
|
144
|
-
supported; use `ctx.browser` when
|
|
148
|
+
pseudo-header order in provider code. Chrome, Firefox, and Safari profiles
|
|
149
|
+
are supported; use `ctx.browser` when the provider needs browser execution.
|
|
150
|
+
- **Query-parameter credentials**: when an upstream requires a credential in
|
|
151
|
+
its URL query, pass it through `sensitiveParams`, not `params` and never a
|
|
152
|
+
hand-built URL. It is sent as a normal query parameter while the SDK redacts
|
|
153
|
+
its value from transport errors, traces, and recorded fixtures:
|
|
154
|
+
|
|
155
|
+
```ts
|
|
156
|
+
const response = await ctx.http.get("/openapi/service", {
|
|
157
|
+
params: { page: 1 },
|
|
158
|
+
sensitiveParams: { serviceKey: ctx.env.get("APIFUSE__PROVIDER__EXAMPLE__API_KEY")! },
|
|
159
|
+
});
|
|
160
|
+
```
|
|
161
|
+
|
|
162
|
+
Use this only when the upstream offers no header or body credential channel.
|
|
163
|
+
Declared query-key positions and exact scalar diagnostics are always redacted.
|
|
164
|
+
Free-text values of four or more characters are redacted as substrings; shorter
|
|
165
|
+
values require token boundaries so low-entropy values do not corrupt unrelated
|
|
166
|
+
words or timestamps. Consequently, a sub-four-character secret embedded in a
|
|
167
|
+
larger alphanumeric token can remain in free text; prefer higher-entropy or
|
|
168
|
+
non-query credentials when possible. `sensitiveParams: {}` is equivalent to
|
|
169
|
+
omitting the option. Redirect results structurally redact declared keys and
|
|
170
|
+
common response-only credential keys from hop URLs; use
|
|
171
|
+
`redirects.run({ stopWhen })` to inspect a real intermediate `Location` during
|
|
172
|
+
the run when a login flow needs a rotated value.
|
|
173
|
+
- **Proxy URLs for non-stealth consumers**: use `resolveProxy()` when a
|
|
174
|
+
provider-owned client outside `ctx.stealth` needs the provider's proxy, such
|
|
175
|
+
as a CAPTCHA solver that must use matching egress. Pass the provider proxy
|
|
176
|
+
policy used by the provider and consume the returned `url`; the SDK owns
|
|
177
|
+
vendor selection, allocation, failover, and URL formats. Never call proxy
|
|
178
|
+
allocator APIs or hardcode proxy vendor hostnames in provider code.
|
|
179
|
+
|
|
180
|
+
```ts
|
|
181
|
+
import { resolveProxy } from "@apifuse/provider-sdk"
|
|
182
|
+
|
|
183
|
+
const resolvedProxy = await resolveProxy({
|
|
184
|
+
proxyPolicy,
|
|
185
|
+
affinityKey: connectionId,
|
|
186
|
+
})
|
|
187
|
+
|
|
188
|
+
if (!resolvedProxy.url) throw new Error("This login requires proxy egress")
|
|
189
|
+
const captchaTask = { proxy: resolvedProxy.url }
|
|
190
|
+
```
|
|
145
191
|
- **Browser providers**: for TypeScript Providers use `runtime: "browser"` plus
|
|
146
192
|
`browser.engine: "playwright-stealth"`; `nodriver` is a Python-runtime path.
|
|
147
193
|
Install local browser assets with `bunx playwright install chromium` when
|
package/SUBMISSION.md
CHANGED
|
@@ -50,7 +50,7 @@ Fix all blockers before submitting:
|
|
|
50
50
|
- High-confidence secret or token material in source, README, package metadata, or fixtures.
|
|
51
51
|
- SDK-native source blockers: prefixed Provider ids, `vendor/` SDK shims or imports, raw `.describe()` prose instead of `describeKey`, raw global `fetch()` calls, and excessive `as Type` assertions.
|
|
52
52
|
|
|
53
|
-
Warnings do not fail the command, but they should be addressed when practical. For example, the generated starter `ping` operation warns because it is not a real upstream-backed bounty Operation. SDK-native warnings also flag moderate `as Type` assertion counts
|
|
53
|
+
Warnings do not fail the command, but they should be addressed when practical. For example, the generated starter `ping` operation warns because it is not a real upstream-backed bounty Operation. SDK-native warnings also flag moderate `as Type` assertion counts, credentialed Providers that never reference `ctx.credential`, and provider-local re-validation of declared env secrets (`sdk-owned-secret-presence`, 0 points): the SDK already rejects invocations with a structured `MISSING_SECRET` error when a declared `required: true` secret is unset, so `requireServiceKey`-style presence guards are deprecated dead weight — delete the guard and read the value directly with `ctx.env.get()`, or acknowledge a deliberate exception with `// @apifuse-allow sdk-owned-secret-presence: <reason>`.
|
|
54
54
|
|
|
55
55
|
## Measured local smoke
|
|
56
56
|
|
package/bin/apifuse-check.ts
CHANGED
|
@@ -6,9 +6,19 @@ import { pathToFileURL } from "node:url";
|
|
|
6
6
|
|
|
7
7
|
import { z } from "zod";
|
|
8
8
|
|
|
9
|
-
import
|
|
10
|
-
|
|
11
|
-
|
|
9
|
+
import {
|
|
10
|
+
formatPromptAssetIssues,
|
|
11
|
+
PROMPT_ASSET_SYNC_REMEDIATION,
|
|
12
|
+
verifyPromptAssets,
|
|
13
|
+
} from "../src/cli/prompt-assets.js";
|
|
14
|
+
import {
|
|
15
|
+
DECLARATION_INVALID_CODE,
|
|
16
|
+
validateFailClosedDeclaration,
|
|
17
|
+
} from "../src/declaration-validation.js";
|
|
18
|
+
import { isProviderError } from "../src/errors.js";
|
|
19
|
+
import type { ProviderDefinition } from "../src/index.js";
|
|
20
|
+
import { lintProvider, type ProviderLintMode } from "../src/lint.js";
|
|
21
|
+
import { safeParseSchemaSync } from "../src/schema.js";
|
|
12
22
|
|
|
13
23
|
const HELP_TEXT = `Usage: apifuse check [path]
|
|
14
24
|
Example: apifuse check providers/korea-air-quality
|
|
@@ -24,9 +34,7 @@ export type RunChecksOptions = {
|
|
|
24
34
|
lintMode?: ProviderLintMode;
|
|
25
35
|
};
|
|
26
36
|
|
|
27
|
-
type SafeParseResult =
|
|
28
|
-
| { success: true; data: unknown }
|
|
29
|
-
| { success: false; error: unknown };
|
|
37
|
+
type SafeParseResult = { success: true; data: unknown } | { success: false; error: unknown };
|
|
30
38
|
|
|
31
39
|
export async function main() {
|
|
32
40
|
const args = normalizeArgs(process.argv.slice(2));
|
|
@@ -63,7 +71,7 @@ function normalizeArgs(argv: string[]): string[] {
|
|
|
63
71
|
return argv[0] === "check" ? argv.slice(1) : argv;
|
|
64
72
|
}
|
|
65
73
|
|
|
66
|
-
function resolveProviderRoot(inputPath: string): string {
|
|
74
|
+
export function resolveProviderRoot(inputPath: string): string {
|
|
67
75
|
const resolvedInput = resolveFromParents(inputPath);
|
|
68
76
|
|
|
69
77
|
if (!existsSync(resolvedInput)) {
|
|
@@ -116,14 +124,25 @@ export async function runChecks(
|
|
|
116
124
|
const dockerfilePath = resolve(providerRoot, "Dockerfile");
|
|
117
125
|
const packageJsonPath = resolve(providerRoot, "package.json");
|
|
118
126
|
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
127
|
+
let providerModule: Record<string, unknown> | undefined;
|
|
128
|
+
let providerImportError: unknown;
|
|
129
|
+
if (existsSync(indexPath)) {
|
|
130
|
+
try {
|
|
131
|
+
providerModule = (await import(pathToFileURL(indexPath).href)) as Record<string, unknown>;
|
|
132
|
+
} catch (error) {
|
|
133
|
+
if (isProviderError(error) && error.code === DECLARATION_INVALID_CODE) {
|
|
134
|
+
providerImportError = error;
|
|
135
|
+
} else {
|
|
136
|
+
throw error;
|
|
137
|
+
}
|
|
138
|
+
}
|
|
139
|
+
}
|
|
122
140
|
const provider = assertProviderDefinition(providerModule?.default);
|
|
123
141
|
const providerSourceFiles = collectProviderSourceFiles(providerRoot);
|
|
124
142
|
|
|
125
143
|
return [
|
|
126
144
|
checkIndex(indexPath, provider),
|
|
145
|
+
checkDeclaration(provider, providerImportError),
|
|
127
146
|
checkOperations(provider),
|
|
128
147
|
checkFixtures(provider),
|
|
129
148
|
checkSchemas(provider),
|
|
@@ -131,9 +150,69 @@ export async function runChecks(
|
|
|
131
150
|
checkProviderMetadata(provider),
|
|
132
151
|
checkDockerfile(dockerfilePath),
|
|
133
152
|
checkPackageJson(packageJsonPath),
|
|
153
|
+
checkPromptAssets(providerRoot),
|
|
134
154
|
];
|
|
135
155
|
}
|
|
136
156
|
|
|
157
|
+
const DECLARATION_CHECK_MESSAGE = "Provider declaration passes fail-closed validation";
|
|
158
|
+
|
|
159
|
+
function checkDeclaration(
|
|
160
|
+
provider: ProviderDefinition | undefined,
|
|
161
|
+
importError: unknown,
|
|
162
|
+
): CheckResult {
|
|
163
|
+
if (importError !== undefined) {
|
|
164
|
+
return {
|
|
165
|
+
message: DECLARATION_CHECK_MESSAGE,
|
|
166
|
+
passed: false,
|
|
167
|
+
details: formatDeclarationError(importError),
|
|
168
|
+
};
|
|
169
|
+
}
|
|
170
|
+
if (!provider) return { message: DECLARATION_CHECK_MESSAGE, passed: false };
|
|
171
|
+
try {
|
|
172
|
+
validateFailClosedDeclaration(provider);
|
|
173
|
+
return { message: DECLARATION_CHECK_MESSAGE, passed: true };
|
|
174
|
+
} catch (error) {
|
|
175
|
+
return {
|
|
176
|
+
message: DECLARATION_CHECK_MESSAGE,
|
|
177
|
+
passed: false,
|
|
178
|
+
details: formatDeclarationError(error),
|
|
179
|
+
};
|
|
180
|
+
}
|
|
181
|
+
}
|
|
182
|
+
|
|
183
|
+
function formatDeclarationError(error: unknown): string[] {
|
|
184
|
+
if (isProviderError(error) && error.code === DECLARATION_INVALID_CODE) {
|
|
185
|
+
const details = error.details;
|
|
186
|
+
if (isRecord(details) && Array.isArray(details.violations)) {
|
|
187
|
+
return details.violations.map((violation) => {
|
|
188
|
+
if (!isRecord(violation)) return String(violation);
|
|
189
|
+
const ruleId = typeof violation.ruleId === "string" ? violation.ruleId : "unknown-rule";
|
|
190
|
+
const path = typeof violation.path === "string" ? violation.path : "unknown-path";
|
|
191
|
+
const message = typeof violation.message === "string" ? `: ${violation.message}` : "";
|
|
192
|
+
const fix = typeof violation.fix === "string" ? ` Fix: ${violation.fix}` : "";
|
|
193
|
+
return `${path} [${ruleId}]${message}${fix}`;
|
|
194
|
+
});
|
|
195
|
+
}
|
|
196
|
+
}
|
|
197
|
+
return [error instanceof Error ? error.message : String(error)];
|
|
198
|
+
}
|
|
199
|
+
|
|
200
|
+
export const PROMPT_ASSETS_CHECK_MESSAGE =
|
|
201
|
+
"Agent prompt assets match the installed SDK version";
|
|
202
|
+
|
|
203
|
+
function checkPromptAssets(providerRoot: string): CheckResult {
|
|
204
|
+
const verification = verifyPromptAssets(providerRoot);
|
|
205
|
+
if (verification.ok) {
|
|
206
|
+
return { message: PROMPT_ASSETS_CHECK_MESSAGE, passed: true };
|
|
207
|
+
}
|
|
208
|
+
|
|
209
|
+
return {
|
|
210
|
+
message: PROMPT_ASSETS_CHECK_MESSAGE,
|
|
211
|
+
passed: false,
|
|
212
|
+
details: [...formatPromptAssetIssues(verification), PROMPT_ASSET_SYNC_REMEDIATION],
|
|
213
|
+
};
|
|
214
|
+
}
|
|
215
|
+
|
|
137
216
|
function isScannableProviderSourceFile(relativePath: string): boolean {
|
|
138
217
|
return (
|
|
139
218
|
/\.(?:ts|tsx|js|jsx|mjs|cjs|sh|bash)$/.test(relativePath) ||
|
|
@@ -142,17 +221,12 @@ function isScannableProviderSourceFile(relativePath: string): boolean {
|
|
|
142
221
|
);
|
|
143
222
|
}
|
|
144
223
|
|
|
145
|
-
function collectProviderSourceFiles(
|
|
146
|
-
providerRoot: string,
|
|
147
|
-
): Record<string, string> {
|
|
224
|
+
function collectProviderSourceFiles(providerRoot: string): Record<string, string> {
|
|
148
225
|
const sources: Record<string, string> = {};
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
"build",
|
|
154
|
-
".next",
|
|
155
|
-
]);
|
|
226
|
+
// `.agents`/`.apifuse` are deliberately not skipped: managed content there
|
|
227
|
+
// is markdown/JSON (never matched by isScannableProviderSourceFile), and a
|
|
228
|
+
// planted `.ts`/`.sh` under those directories must stay in scanner scope.
|
|
229
|
+
const skipDirectories = new Set([".git", "node_modules", "dist", "build", ".next"]);
|
|
156
230
|
const visit = (directory: string) => {
|
|
157
231
|
for (const entry of readdirSync(directory, { withFileTypes: true })) {
|
|
158
232
|
const path = resolve(directory, entry.name);
|
|
@@ -162,10 +236,7 @@ function collectProviderSourceFiles(
|
|
|
162
236
|
}
|
|
163
237
|
continue;
|
|
164
238
|
}
|
|
165
|
-
if (
|
|
166
|
-
!entry.isFile() ||
|
|
167
|
-
!isScannableProviderSourceFile(path.slice(providerRoot.length + 1))
|
|
168
|
-
) {
|
|
239
|
+
if (!entry.isFile() || !isScannableProviderSourceFile(path.slice(providerRoot.length + 1))) {
|
|
169
240
|
continue;
|
|
170
241
|
}
|
|
171
242
|
sources[path.slice(providerRoot.length + 1)] = readFileSync(path, "utf8");
|
|
@@ -175,10 +246,7 @@ function collectProviderSourceFiles(
|
|
|
175
246
|
return sources;
|
|
176
247
|
}
|
|
177
248
|
|
|
178
|
-
function checkIndex(
|
|
179
|
-
indexPath: string,
|
|
180
|
-
provider: ProviderDefinition | undefined,
|
|
181
|
-
): CheckResult {
|
|
249
|
+
function checkIndex(indexPath: string, provider: ProviderDefinition | undefined): CheckResult {
|
|
182
250
|
if (!existsSync(indexPath)) {
|
|
183
251
|
return {
|
|
184
252
|
message: "index.ts exists and exports default defineProvider",
|
|
@@ -200,9 +268,7 @@ function checkIndex(
|
|
|
200
268
|
};
|
|
201
269
|
}
|
|
202
270
|
|
|
203
|
-
function checkOperations(
|
|
204
|
-
provider: ProviderDefinition | undefined,
|
|
205
|
-
): CheckResult {
|
|
271
|
+
function checkOperations(provider: ProviderDefinition | undefined): CheckResult {
|
|
206
272
|
if (!provider) {
|
|
207
273
|
return {
|
|
208
274
|
message: "All operations have handler, input, output",
|
|
@@ -277,20 +343,14 @@ function checkSchemas(provider: ProviderDefinition | undefined): CheckResult {
|
|
|
277
343
|
continue;
|
|
278
344
|
}
|
|
279
345
|
|
|
280
|
-
const requestResult = parseFixture(
|
|
281
|
-
operation.input,
|
|
282
|
-
operation.fixtures.request,
|
|
283
|
-
);
|
|
346
|
+
const requestResult = parseFixture(operation.input, operation.fixtures.request);
|
|
284
347
|
if (!requestResult.success) {
|
|
285
348
|
failures.push(
|
|
286
349
|
`${operationId}: request fixture invalid (${formatSchemaError(requestResult.error)})`,
|
|
287
350
|
);
|
|
288
351
|
}
|
|
289
352
|
|
|
290
|
-
const responseResult = parseFixture(
|
|
291
|
-
operation.output,
|
|
292
|
-
operation.fixtures.response,
|
|
293
|
-
);
|
|
353
|
+
const responseResult = parseFixture(operation.output, operation.fixtures.response);
|
|
294
354
|
if (!responseResult.success) {
|
|
295
355
|
failures.push(
|
|
296
356
|
`${operationId}: response fixture invalid (${formatSchemaError(responseResult.error)})`,
|
|
@@ -317,13 +377,8 @@ function checkAuthoringLint(
|
|
|
317
377
|
};
|
|
318
378
|
}
|
|
319
379
|
|
|
320
|
-
const diagnostics = lintProvider(
|
|
321
|
-
|
|
322
|
-
{ mode: lintMode },
|
|
323
|
-
);
|
|
324
|
-
const errors = diagnostics.filter(
|
|
325
|
-
(diagnostic) => diagnostic.level === "error",
|
|
326
|
-
);
|
|
380
|
+
const diagnostics = lintProvider({ ...provider, providerSourceFiles }, { mode: lintMode });
|
|
381
|
+
const errors = diagnostics.filter((diagnostic) => diagnostic.level === "error");
|
|
327
382
|
const details = diagnostics.map((diagnostic) => {
|
|
328
383
|
const field = diagnostic.field ? `${diagnostic.field}: ` : "";
|
|
329
384
|
return `${diagnostic.level.toUpperCase()} ${diagnostic.rule} ${field}${diagnostic.message}`;
|
|
@@ -336,9 +391,7 @@ function checkAuthoringLint(
|
|
|
336
391
|
};
|
|
337
392
|
}
|
|
338
393
|
|
|
339
|
-
function checkProviderMetadata(
|
|
340
|
-
provider: ProviderDefinition | undefined,
|
|
341
|
-
): CheckResult {
|
|
394
|
+
function checkProviderMetadata(provider: ProviderDefinition | undefined): CheckResult {
|
|
342
395
|
if (!provider) {
|
|
343
396
|
return {
|
|
344
397
|
message: "Provider metadata is declared in defineProvider",
|
|
@@ -425,18 +478,12 @@ function checkPackageJson(packageJsonPath: string): CheckResult {
|
|
|
425
478
|
}
|
|
426
479
|
}
|
|
427
480
|
|
|
428
|
-
function assertProviderDefinition(
|
|
429
|
-
value: unknown,
|
|
430
|
-
): ProviderDefinition | undefined {
|
|
481
|
+
function assertProviderDefinition(value: unknown): ProviderDefinition | undefined {
|
|
431
482
|
return isProviderDefinition(value) ? value : undefined;
|
|
432
483
|
}
|
|
433
484
|
|
|
434
485
|
function isProviderDefinition(value: unknown): value is ProviderDefinition {
|
|
435
|
-
if (
|
|
436
|
-
!isRecord(value) ||
|
|
437
|
-
!isRecord(value.meta) ||
|
|
438
|
-
!isRecord(value.operations)
|
|
439
|
-
) {
|
|
486
|
+
if (!isRecord(value) || !isRecord(value.meta) || !isRecord(value.operations)) {
|
|
440
487
|
return false;
|
|
441
488
|
}
|
|
442
489
|
|
|
@@ -457,8 +504,7 @@ function hasSchemaParser(value: unknown): boolean {
|
|
|
457
504
|
return (
|
|
458
505
|
isRecord(value) &&
|
|
459
506
|
(typeof value.safeParse === "function" ||
|
|
460
|
-
(isRecord(value["~standard"]) &&
|
|
461
|
-
typeof value["~standard"].validate === "function"))
|
|
507
|
+
(isRecord(value["~standard"]) && typeof value["~standard"].validate === "function"))
|
|
462
508
|
);
|
|
463
509
|
}
|
|
464
510
|
|
|
@@ -470,9 +516,7 @@ function formatSchemaError(error: unknown): string {
|
|
|
470
516
|
if (Array.isArray(error)) {
|
|
471
517
|
return error
|
|
472
518
|
.map((issue) =>
|
|
473
|
-
isRecord(issue) && typeof issue.message === "string"
|
|
474
|
-
? issue.message
|
|
475
|
-
: String(issue),
|
|
519
|
+
isRecord(issue) && typeof issue.message === "string" ? issue.message : String(issue),
|
|
476
520
|
)
|
|
477
521
|
.join(", ");
|
|
478
522
|
}
|