@apifuse/provider-sdk 2.2.0-beta.62 → 2.2.0-beta.63
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 +268 -9
- package/CHANGELOG.md +4 -0
- package/README.md +1 -0
- package/bin/apifuse-check.ts +84 -2
- package/bin/apifuse-dev.ts +11 -31
- package/bin/apifuse-migrate-deployment.ts +200 -0
- package/bin/apifuse-pack-check.ts +11 -4
- package/bin/apifuse-pack-types.ts +187 -4
- package/bin/apifuse-record.ts +44 -32
- package/bin/apifuse-test.ts +3 -1
- package/dist/cli/commands.d.ts +1 -1
- package/dist/cli/commands.js +11 -0
- package/dist/cli/deployment-intent.d.ts +178 -0
- package/dist/cli/deployment-intent.js +277 -0
- package/dist/cli/migrate-deployment-intent.d.ts +132 -0
- package/dist/cli/migrate-deployment-intent.js +1552 -0
- package/dist/cli/migrate-provider-shape.d.ts +5 -1
- package/dist/cli/migrate-provider-shape.js +4 -2
- package/dist/cli/resolver-runtime.d.ts +21 -0
- package/dist/cli/resolver-runtime.js +31 -0
- package/dist/define.d.ts +3 -0
- package/dist/define.js +5 -0
- package/dist/dev.d.ts +3 -1
- package/dist/dev.js +6 -1
- package/dist/engine.d.ts +35 -1
- package/dist/engine.js +21 -2
- package/dist/error-resolution.d.ts +1 -0
- package/dist/error-resolution.js +54 -0
- package/dist/errors.d.ts +39 -1
- package/dist/errors.js +50 -0
- package/dist/i18n/error-messages.d.ts +86 -0
- package/dist/i18n/error-messages.js +192 -0
- package/dist/i18n/index.d.ts +1 -0
- package/dist/i18n/index.js +1 -0
- package/dist/i18n/keys.d.ts +12 -0
- package/dist/i18n/keys.js +76 -5
- package/dist/index.d.ts +7 -1
- package/dist/index.js +6 -0
- package/dist/lint.d.ts +10 -0
- package/dist/lint.js +412 -49
- package/dist/provider.d.ts +5 -5
- package/dist/provider.js +2 -2
- package/dist/runtime/browser-telemetry-binding.d.ts +5 -0
- package/dist/runtime/browser-telemetry-binding.js +83 -0
- package/dist/runtime/browser-telemetry.d.ts +76 -0
- package/dist/runtime/browser-telemetry.js +165 -0
- package/dist/runtime/browser.d.ts +3 -0
- package/dist/runtime/browser.js +208 -47
- package/dist/runtime/cache-telemetry.d.ts +71 -0
- package/dist/runtime/cache-telemetry.js +177 -0
- package/dist/runtime/cache.js +67 -7
- package/dist/runtime/capability-response.d.ts +3 -0
- package/dist/runtime/capability-response.js +56 -0
- package/dist/runtime/capability-telemetry.d.ts +46 -0
- package/dist/runtime/capability-telemetry.js +68 -0
- package/dist/runtime/diagnostic-env.d.ts +3 -0
- package/dist/runtime/diagnostic-env.js +10 -1
- package/dist/runtime/engine-mode.d.ts +74 -0
- package/dist/runtime/engine-mode.js +152 -0
- package/dist/runtime/http-telemetry-guard.d.ts +10 -0
- package/dist/runtime/http-telemetry-guard.js +62 -10
- package/dist/runtime/http.js +141 -35
- package/dist/runtime/instrumentation.js +92 -13
- package/dist/runtime/ocr-telemetry.d.ts +82 -0
- package/dist/runtime/ocr-telemetry.js +192 -0
- package/dist/runtime/ocr.js +30 -8
- package/dist/runtime/request-telemetry.d.ts +2 -0
- package/dist/runtime/request-telemetry.js +2 -1
- package/dist/runtime/resolver-runtime-options.d.ts +14 -0
- package/dist/runtime/resolver-runtime-options.js +33 -0
- package/dist/runtime/resolver-shared.d.ts +3 -2
- package/dist/runtime/resolver-shared.js +4 -4
- package/dist/runtime/resolver-telemetry.d.ts +1 -0
- package/dist/runtime/resolver-telemetry.js +1 -1
- package/dist/runtime/resolver-vendors/browser.d.ts +2 -0
- package/dist/runtime/resolver-vendors/browser.js +46 -0
- package/dist/runtime/resolver-vendors/hosts.d.ts +21 -0
- package/dist/runtime/resolver-vendors/hosts.js +35 -0
- package/dist/runtime/resolver-vendors/hypersolutions.js +2 -2
- package/dist/runtime/resolver-vendors/types.d.ts +5 -4
- package/dist/runtime/resolver.d.ts +4 -1
- package/dist/runtime/resolver.js +46 -13
- package/dist/runtime/state-telemetry.d.ts +79 -0
- package/dist/runtime/state-telemetry.js +194 -0
- package/dist/runtime/state.d.ts +3 -0
- package/dist/runtime/state.js +26 -7
- package/dist/runtime/stealth-cookies.d.ts +5 -1
- package/dist/runtime/stealth-cookies.js +21 -1
- package/dist/runtime/stealth-owned-headers.d.ts +26 -0
- package/dist/runtime/stealth-owned-headers.js +37 -0
- package/dist/runtime/stealth-telemetry.d.ts +92 -0
- package/dist/runtime/stealth-telemetry.js +179 -0
- package/dist/runtime/stealth.d.ts +4 -1
- package/dist/runtime/stealth.js +228 -85
- package/dist/runtime/stt-telemetry.d.ts +77 -0
- package/dist/runtime/stt-telemetry.js +176 -0
- package/dist/runtime/stt.js +15 -6
- package/dist/server/error-stack-frames.d.ts +35 -0
- package/dist/server/error-stack-frames.js +219 -0
- package/dist/server/index.d.ts +7 -0
- package/dist/server/index.js +4 -0
- package/dist/server/sdk-version.d.ts +3 -0
- package/dist/server/sdk-version.js +19 -0
- package/dist/server/self-test.js +1 -18
- package/dist/server/sensitive-values.d.ts +1 -1
- package/dist/server/sensitive-values.js +9 -0
- package/dist/server/serve-implementation.d.ts +51 -2
- package/dist/server/serve-implementation.js +337 -90
- package/dist/server/types.d.ts +1 -0
- package/dist/server/types.js +7 -0
- package/dist/stateful/stateful-provider-owner-forwarder.js +22 -0
- package/dist/stateful/stateful-provider-runtime-context.d.ts +3 -0
- package/dist/stateful/stateful-provider-runtime-context.js +1 -0
- package/dist/types.d.ts +94 -1
- package/package.json +6 -1
- package/src/cli/commands.ts +14 -0
- package/src/cli/deployment-intent.ts +364 -0
- package/src/cli/migrate-deployment-intent.ts +1908 -0
- package/src/cli/migrate-provider-shape.ts +10 -4
- package/src/cli/resolver-runtime.ts +72 -0
- package/src/define.ts +13 -0
- package/src/dev.ts +9 -2
- package/src/engine.ts +38 -2
- package/src/error-resolution.ts +58 -0
- package/src/errors.ts +77 -1
- package/src/i18n/error-messages.ts +255 -0
- package/src/i18n/index.ts +1 -0
- package/src/i18n/keys.ts +80 -6
- package/src/index.ts +72 -0
- package/src/lint.ts +522 -50
- package/src/provider.ts +10 -0
- package/src/runtime/browser-telemetry-binding.ts +92 -0
- package/src/runtime/browser-telemetry.ts +289 -0
- package/src/runtime/browser.ts +249 -65
- package/src/runtime/cache-telemetry.ts +247 -0
- package/src/runtime/cache.ts +68 -17
- package/src/runtime/capability-response.ts +53 -0
- package/src/runtime/capability-telemetry.ts +101 -0
- package/src/runtime/diagnostic-env.ts +11 -1
- package/src/runtime/engine-mode.ts +233 -0
- package/src/runtime/http-telemetry-guard.ts +66 -13
- package/src/runtime/http.ts +168 -37
- package/src/runtime/instrumentation.ts +105 -16
- package/src/runtime/ocr-telemetry.ts +308 -0
- package/src/runtime/ocr.ts +109 -74
- package/src/runtime/request-telemetry.ts +2 -1
- package/src/runtime/resolver-runtime-options.ts +50 -0
- package/src/runtime/resolver-shared.ts +9 -4
- package/src/runtime/resolver-telemetry.ts +1 -1
- package/src/runtime/resolver-vendors/browser.ts +65 -7
- package/src/runtime/resolver-vendors/hosts.ts +43 -0
- package/src/runtime/resolver-vendors/hypersolutions.ts +2 -2
- package/src/runtime/resolver-vendors/types.ts +5 -4
- package/src/runtime/resolver.ts +64 -21
- package/src/runtime/state-telemetry.ts +298 -0
- package/src/runtime/state.ts +46 -45
- package/src/runtime/stealth-cookies.ts +24 -1
- package/src/runtime/stealth-owned-headers.ts +41 -0
- package/src/runtime/stealth-telemetry.ts +304 -0
- package/src/runtime/stealth.ts +355 -150
- package/src/runtime/stt-telemetry.ts +282 -0
- package/src/runtime/stt.ts +93 -71
- package/src/server/error-stack-frames.ts +214 -0
- package/src/server/index.ts +53 -0
- package/src/server/sdk-version.ts +22 -0
- package/src/server/self-test.ts +1 -21
- package/src/server/sensitive-values.ts +14 -0
- package/src/server/serve-implementation.ts +569 -108
- package/src/server/types.ts +7 -0
- package/src/stateful/stateful-provider-owner-forwarder.ts +23 -0
- package/src/stateful/stateful-provider-runtime-context.ts +4 -0
- package/src/types.ts +99 -1
- package/src/cli/__tests__/fixtures/migrate-operation-declaration/approval-override.ts.txt +0 -6
- package/src/cli/__tests__/fixtures/migrate-operation-declaration/codemod-syntax.ts.txt +0 -3
- package/src/cli/__tests__/fixtures/migrate-operation-declaration/connection-precedence.ts.txt +0 -10
- package/src/cli/__tests__/fixtures/migrate-operation-declaration/discovery-ambiguous-a.ts.txt +0 -3
- package/src/cli/__tests__/fixtures/migrate-operation-declaration/discovery-ambiguous-b.ts.txt +0 -3
- package/src/cli/__tests__/fixtures/migrate-operation-declaration/discovery-ambiguous-barrel.ts.txt +0 -2
- package/src/cli/__tests__/fixtures/migrate-operation-declaration/discovery-ambiguous-index.ts.txt +0 -3
- package/src/cli/__tests__/fixtures/migrate-operation-declaration/discovery-computed.ts.txt +0 -6
- package/src/cli/__tests__/fixtures/migrate-operation-declaration/discovery-cycle-a.ts.txt +0 -1
- package/src/cli/__tests__/fixtures/migrate-operation-declaration/discovery-cycle-b.ts.txt +0 -1
- package/src/cli/__tests__/fixtures/migrate-operation-declaration/discovery-cycle-index.ts.txt +0 -3
- package/src/cli/__tests__/fixtures/migrate-operation-declaration/discovery-daiso-barrel.ts.txt +0 -7
- package/src/cli/__tests__/fixtures/migrate-operation-declaration/discovery-daiso-catalog.ts.txt +0 -19
- package/src/cli/__tests__/fixtures/migrate-operation-declaration/discovery-daiso-docs.ts.txt +0 -6
- package/src/cli/__tests__/fixtures/migrate-operation-declaration/discovery-daiso-index.ts.txt +0 -3
- package/src/cli/__tests__/fixtures/migrate-operation-declaration/discovery-daiso-stores.ts.txt +0 -8
- package/src/cli/__tests__/fixtures/migrate-operation-declaration/discovery-indirect-config.ts.txt +0 -5
- package/src/cli/__tests__/fixtures/migrate-operation-declaration/discovery-nonstatic.ts.txt +0 -4
- package/src/cli/__tests__/fixtures/migrate-operation-declaration/discovery-package-index.ts.txt +0 -3
- package/src/cli/__tests__/fixtures/migrate-operation-declaration/discovery-reexport-index.ts.txt +0 -3
- package/src/cli/__tests__/fixtures/migrate-operation-declaration/discovery-reexport-leaf.ts.txt +0 -10
- package/src/cli/__tests__/fixtures/migrate-operation-declaration/discovery-reexport-one.ts.txt +0 -1
- package/src/cli/__tests__/fixtures/migrate-operation-declaration/discovery-reexport-two.ts.txt +0 -1
- package/src/cli/__tests__/fixtures/migrate-operation-declaration/discovery-runtime-composed-index.ts.txt +0 -3
- package/src/cli/__tests__/fixtures/migrate-operation-declaration/discovery-runtime-composed-one.ts.txt +0 -6
- package/src/cli/__tests__/fixtures/migrate-operation-declaration/discovery-runtime-composed-two.ts.txt +0 -6
- package/src/cli/__tests__/fixtures/migrate-operation-declaration/discovery-runtime-mixed-index.ts.txt +0 -14
- package/src/cli/__tests__/fixtures/migrate-operation-declaration/discovery-runtime-registry.ts.txt +0 -3
- package/src/cli/__tests__/fixtures/migrate-operation-declaration/discovery-star-package-barrel.ts.txt +0 -2
- package/src/cli/__tests__/fixtures/migrate-operation-declaration/discovery-star-package-index.ts.txt +0 -3
- package/src/cli/__tests__/fixtures/migrate-operation-declaration/discovery-star-package-leaf.ts.txt +0 -3
- package/src/cli/__tests__/fixtures/migrate-operation-declaration/docs-conflict.ts.txt +0 -8
- package/src/cli/__tests__/fixtures/migrate-operation-declaration/examples-hoisted-array-spread.ts.txt +0 -15
- package/src/cli/__tests__/fixtures/migrate-operation-declaration/examples-imported-array-spread.ts.txt +0 -9
- package/src/cli/__tests__/fixtures/migrate-operation-declaration/examples-kebab-operation-id.ts.txt +0 -17
- package/src/cli/__tests__/fixtures/migrate-operation-declaration/examples-map.ts.txt +0 -5
- package/src/cli/__tests__/fixtures/migrate-operation-declaration/examples-mixed-array-spread.ts.txt +0 -24
- package/src/cli/__tests__/fixtures/migrate-operation-declaration/examples-operation.ts.txt +0 -16
- package/src/cli/__tests__/fixtures/migrate-operation-declaration/examples-snake-operation-id.ts.txt +0 -21
- package/src/cli/__tests__/fixtures/migrate-operation-declaration/factory-duplicate-provider.ts.txt +0 -11
- package/src/cli/__tests__/fixtures/migrate-operation-declaration/factory-id-unresolved.ts.txt +0 -7
- package/src/cli/__tests__/fixtures/migrate-operation-declaration/factory-map.ts.txt +0 -3
- package/src/cli/__tests__/fixtures/migrate-operation-declaration/factory-one-to-many.ts.txt +0 -18
- package/src/cli/__tests__/fixtures/migrate-operation-declaration/factory-one-to-one.ts.txt +0 -13
- package/src/cli/__tests__/fixtures/migrate-operation-declaration/hoist-all.ts.txt +0 -31
- package/src/cli/__tests__/fixtures/migrate-operation-declaration/hoisted-const.ts.txt +0 -11
- package/src/cli/__tests__/fixtures/migrate-operation-declaration/imported-spread.ts.txt +0 -11
- package/src/cli/__tests__/fixtures/migrate-operation-declaration/inline-map.ts.txt +0 -11
- package/src/cli/__tests__/fixtures/migrate-operation-declaration/inline-spread-cast-tail.ts.txt +0 -21
- package/src/cli/__tests__/fixtures/migrate-operation-declaration/inline-spread-ekitan.ts.txt +0 -11
- package/src/cli/__tests__/fixtures/migrate-operation-declaration/inline-spread-override.ts.txt +0 -14
- package/src/cli/__tests__/fixtures/migrate-operation-declaration/locale-canonical-en.json +0 -1
- package/src/cli/__tests__/fixtures/migrate-operation-declaration/locale-canonical-ja.json +0 -1
- package/src/cli/__tests__/fixtures/migrate-operation-declaration/locale-canonical-ko.json +0 -1
- package/src/cli/__tests__/fixtures/migrate-operation-declaration/locale-existing-operation-namespace-en.json +0 -8
- package/src/cli/__tests__/fixtures/migrate-operation-declaration/missing-english-locale.ts.txt +0 -7
- package/src/cli/__tests__/fixtures/migrate-operation-declaration/no-safety.ts.txt +0 -6
- package/src/cli/__tests__/fixtures/migrate-operation-declaration/non-literal.ts.txt +0 -7
- package/src/cli/__tests__/fixtures/migrate-operation-declaration/redundant-approval.ts.txt +0 -6
- package/src/cli/__tests__/fixtures/migrate-operation-declaration/registry-binding-ambiguous.ts.txt +0 -12
- package/src/cli/__tests__/fixtures/migrate-operation-declaration/registry-imported-other.ts.txt +0 -7
- package/src/cli/__tests__/fixtures/migrate-operation-declaration/registry-imported.ts.txt +0 -5
- package/src/cli/__tests__/fixtures/migrate-operation-declaration/registry-key-ambiguous.ts.txt +0 -19
- package/src/cli/__tests__/fixtures/migrate-operation-declaration/registry-shorthand.ts.txt +0 -9
- package/src/cli/__tests__/fixtures/migrate-operation-declaration/registry-typed.ts.txt +0 -11
- package/src/cli/__tests__/fixtures/migrate-operation-declaration/registry-unrelated.ts.txt +0 -13
- package/src/cli/__tests__/fixtures/migrate-operation-declaration/safety-conflict.ts.txt +0 -7
- package/src/cli/__tests__/fixtures/migrate-operation-declaration/stream.ts.txt +0 -7
- package/src/cli/__tests__/fixtures/migrate-operation-declaration/tool-router-spread.ts.txt +0 -15
- package/src/cli/__tests__/fixtures/migrate-operation-declaration/unparseable.ts.txt +0 -4
- package/src/cli/__tests__/fixtures/migrate-operation-declaration/verbatim-template.ts.txt +0 -12
package/src/i18n/keys.ts
CHANGED
|
@@ -2,8 +2,55 @@ import type { ProviderLocaleKey } from "../types.js";
|
|
|
2
2
|
|
|
3
3
|
export type { ProviderLocale, ProviderLocaleKey } from "../types.js";
|
|
4
4
|
|
|
5
|
-
|
|
6
|
-
|
|
5
|
+
/**
|
|
6
|
+
* An ordinary catalog name segment: camelCase, ASCII only.
|
|
7
|
+
*
|
|
8
|
+
* `[A-Z][a-z0-9]+` forces at least one character after each hump, so a
|
|
9
|
+
* screaming acronym (`errorsURL`) is not silently read as camelCase.
|
|
10
|
+
*/
|
|
11
|
+
const NAME_SEGMENT_RE = /^[a-z][a-z0-9]*(?:[A-Z][a-z0-9]+)*$/;
|
|
12
|
+
|
|
13
|
+
/** An array-index segment, e.g. the `0` in `meta.tags.0`. */
|
|
14
|
+
const INDEX_SEGMENT_RE = /^[0-9]+$/;
|
|
15
|
+
|
|
16
|
+
/**
|
|
17
|
+
* An error-code segment: the thrown `code` used verbatim as a catalog key.
|
|
18
|
+
*
|
|
19
|
+
* Single-case underscore words only — `UPSTREAM_SCHEMA_ERROR`, `BLOCKED`,
|
|
20
|
+
* `reauth_required` — matching the shape the SDK registers and the fleet
|
|
21
|
+
* throws (a census of 91 provider repos found 224 distinct codes: 213
|
|
22
|
+
* SCREAMING_SNAKE, 11 lower_snake, none mixed-case, none with a leading digit).
|
|
23
|
+
* A leading letter is mandatory, so no error code can be spelled like the
|
|
24
|
+
* numeric array-index form and the two segment kinds stay disjoint.
|
|
25
|
+
* The lower_snake arm requires an underscore because a bare lowercase word is
|
|
26
|
+
* already a {@link NAME_SEGMENT_RE} segment.
|
|
27
|
+
*/
|
|
28
|
+
const ERROR_CODE_SEGMENT_RE = /^(?:[A-Z][A-Z0-9]*(?:_[A-Z0-9]+)*|[a-z][a-z0-9]*(?:_[a-z0-9]+)+)$/;
|
|
29
|
+
|
|
30
|
+
/**
|
|
31
|
+
* The only parent under which an error-code segment is legal.
|
|
32
|
+
*
|
|
33
|
+
* Must stay equal to `PROVIDER_ERROR_CATALOG_NAMESPACE` in `error-messages.ts`
|
|
34
|
+
* (the derived-path test in `keys.test.ts` fails if they drift). Anchoring the
|
|
35
|
+
* code vocabulary to this one parent is what keeps the grammar from degrading
|
|
36
|
+
* into "any identifier anywhere": everywhere else a segment is still camelCase
|
|
37
|
+
* or an array index.
|
|
38
|
+
*/
|
|
39
|
+
const ERROR_CODE_PARENT_SEGMENT = "errors";
|
|
40
|
+
|
|
41
|
+
/**
|
|
42
|
+
* Validates one segment in position.
|
|
43
|
+
*
|
|
44
|
+
* `parent` is the preceding segment, or `undefined` for the first segment. The
|
|
45
|
+
* first segment is always a plain name: catalogs are rooted in SDK-owned
|
|
46
|
+
* namespaces (`meta`, `operations`, `auth`, `errors`), never in an index or a
|
|
47
|
+
* code.
|
|
48
|
+
*/
|
|
49
|
+
function isValidProviderLocaleSegment(segment: string, parent: string | undefined): boolean {
|
|
50
|
+
if (parent === undefined) return NAME_SEGMENT_RE.test(segment);
|
|
51
|
+
if (NAME_SEGMENT_RE.test(segment) || INDEX_SEGMENT_RE.test(segment)) return true;
|
|
52
|
+
return parent === ERROR_CODE_PARENT_SEGMENT && ERROR_CODE_SEGMENT_RE.test(segment);
|
|
53
|
+
}
|
|
7
54
|
|
|
8
55
|
export function providerLocaleKey(key: string): ProviderLocaleKey {
|
|
9
56
|
assertProviderLocaleKey(key);
|
|
@@ -11,13 +58,21 @@ export function providerLocaleKey(key: string): ProviderLocaleKey {
|
|
|
11
58
|
}
|
|
12
59
|
|
|
13
60
|
export function isProviderLocaleKey(value: unknown): value is ProviderLocaleKey {
|
|
14
|
-
|
|
61
|
+
if (typeof value !== "string" || value.length === 0) return false;
|
|
62
|
+
const segments = value.split(".");
|
|
63
|
+
for (const [index, segment] of segments.entries()) {
|
|
64
|
+
// `split(".")` yields "" for an empty segment ("a..b", ".a", "a."), which
|
|
65
|
+
// no segment pattern matches, so those stay rejected.
|
|
66
|
+
if (!isValidProviderLocaleSegment(segment, index === 0 ? undefined : segments[index - 1]))
|
|
67
|
+
return false;
|
|
68
|
+
}
|
|
69
|
+
return true;
|
|
15
70
|
}
|
|
16
71
|
|
|
17
72
|
export function assertProviderLocaleKey(value: unknown): asserts value is ProviderLocaleKey {
|
|
18
73
|
if (!isProviderLocaleKey(value)) {
|
|
19
74
|
throw new Error(
|
|
20
|
-
`Provider locale key must be a dot path such as "meta.description" or "operations.search.description"; received ${JSON.stringify(value)}`,
|
|
75
|
+
`Provider locale key must be a camelCase dot path such as "meta.description" or "operations.search.description", optionally naming an error code under "${ERROR_CODE_PARENT_SEGMENT}." as in "errors.UPSTREAM_SCHEMA_ERROR.message"; received ${JSON.stringify(value)}`,
|
|
21
76
|
);
|
|
22
77
|
}
|
|
23
78
|
}
|
|
@@ -35,9 +90,28 @@ export function getProviderLocalePath(
|
|
|
35
90
|
key: ProviderLocaleKey | string,
|
|
36
91
|
): ProviderLocaleValue | undefined {
|
|
37
92
|
assertProviderLocaleKey(key);
|
|
93
|
+
return getProviderLocaleSegments(catalog, key.split("."));
|
|
94
|
+
}
|
|
95
|
+
|
|
96
|
+
/**
|
|
97
|
+
* Reads a catalog path from raw segments, bypassing the dot-path grammar.
|
|
98
|
+
*
|
|
99
|
+
* Derived error-message lookups address the catalog by the thrown error code
|
|
100
|
+
* (`errors.<code>.message`). The grammar now accepts the code shapes the SDK
|
|
101
|
+
* registers and the fleet throws, but `code` is provider data: a provider may
|
|
102
|
+
* throw anything, and an unusual code must still resolve its catalog entry
|
|
103
|
+
* rather than be dropped as malformed. Own properties only: a
|
|
104
|
+
* `__proto__`/`constructor` segment must read as a miss, not as the prototype
|
|
105
|
+
* chain.
|
|
106
|
+
*/
|
|
107
|
+
export function getProviderLocaleSegments(
|
|
108
|
+
catalog: ProviderLocaleCatalog,
|
|
109
|
+
segments: readonly string[],
|
|
110
|
+
): ProviderLocaleValue | undefined {
|
|
111
|
+
if (segments.length === 0) return undefined;
|
|
38
112
|
let cursor: unknown = catalog;
|
|
39
|
-
for (const segment of
|
|
40
|
-
if (!isRecord(cursor)) return undefined;
|
|
113
|
+
for (const segment of segments) {
|
|
114
|
+
if (!isRecord(cursor) || !Object.hasOwn(cursor, segment)) return undefined;
|
|
41
115
|
cursor = cursor[segment];
|
|
42
116
|
}
|
|
43
117
|
return isProviderLocaleValue(cursor) ? cursor : undefined;
|
package/src/index.ts
CHANGED
|
@@ -161,6 +161,19 @@ export {
|
|
|
161
161
|
export { createEnvContext } from "./runtime/env.js";
|
|
162
162
|
export { executeOperation } from "./runtime/executor.js";
|
|
163
163
|
export { createHttpClient } from "./runtime/http.js";
|
|
164
|
+
export {
|
|
165
|
+
OcrTelemetryCollector,
|
|
166
|
+
bindOcrTelemetry,
|
|
167
|
+
type OcrTelemetryBackend,
|
|
168
|
+
type OcrTelemetryEngine,
|
|
169
|
+
type OcrTelemetryErrorCode,
|
|
170
|
+
type OcrTelemetryEvent,
|
|
171
|
+
type OcrTelemetryFinishReason,
|
|
172
|
+
type OcrTelemetryHeaderPayload,
|
|
173
|
+
type OcrTelemetryLogPayload,
|
|
174
|
+
type OcrTelemetryModel,
|
|
175
|
+
type OcrTelemetrySink,
|
|
176
|
+
} from "./runtime/ocr-telemetry.js";
|
|
164
177
|
export {
|
|
165
178
|
NativeEgressGrantExpiredError,
|
|
166
179
|
NativeEgressNotDeclaredError,
|
|
@@ -228,6 +241,43 @@ export {
|
|
|
228
241
|
type ResolverTelemetrySink,
|
|
229
242
|
type ResolverVendorAttemptTelemetryEvent,
|
|
230
243
|
} from "./runtime/resolver-telemetry.js";
|
|
244
|
+
export {
|
|
245
|
+
StealthTelemetryCollector,
|
|
246
|
+
type StealthTelemetryAttemptEvent,
|
|
247
|
+
type StealthTelemetryAttemptKind,
|
|
248
|
+
type StealthTelemetryAttemptSample,
|
|
249
|
+
type StealthTelemetryDiagnostics,
|
|
250
|
+
type StealthTelemetryErrorCode,
|
|
251
|
+
type StealthTelemetryHeaderPayload,
|
|
252
|
+
type StealthTelemetryLogPayload,
|
|
253
|
+
type StealthTelemetryRequestClass,
|
|
254
|
+
type StealthTelemetrySbsdEvent,
|
|
255
|
+
type StealthTelemetrySbsdOutcome,
|
|
256
|
+
type StealthTelemetrySink,
|
|
257
|
+
} from "./runtime/stealth-telemetry.js";
|
|
258
|
+
export {
|
|
259
|
+
SttTelemetryCollector,
|
|
260
|
+
bindSttTelemetry,
|
|
261
|
+
type SttTelemetryBackend,
|
|
262
|
+
type SttTelemetryEngine,
|
|
263
|
+
type SttTelemetryModel,
|
|
264
|
+
type SttTelemetryErrorCode,
|
|
265
|
+
type SttTelemetryEvent,
|
|
266
|
+
type SttTelemetryHeaderPayload,
|
|
267
|
+
type SttTelemetryLogPayload,
|
|
268
|
+
type SttTelemetrySink,
|
|
269
|
+
} from "./runtime/stt-telemetry.js";
|
|
270
|
+
|
|
271
|
+
export {
|
|
272
|
+
BrowserTelemetryCollector,
|
|
273
|
+
type BrowserTelemetryErrorCode,
|
|
274
|
+
type BrowserTelemetryHeaderPayload,
|
|
275
|
+
type BrowserTelemetryLogPayload,
|
|
276
|
+
type BrowserTelemetryPoolAcquireOutcome,
|
|
277
|
+
type BrowserTelemetrySink,
|
|
278
|
+
type BrowserTelemetrySampleName,
|
|
279
|
+
type BrowserTelemetryEngine,
|
|
280
|
+
} from "./runtime/browser-telemetry.js";
|
|
231
281
|
export {
|
|
232
282
|
APIFUSE__CDP_POOL__URL,
|
|
233
283
|
APIFUSE__RESOLVER__2CAPTCHA__API_KEY,
|
|
@@ -368,7 +418,9 @@ export type {
|
|
|
368
418
|
HealthScheduleRandomization,
|
|
369
419
|
HealthJourneySmsContext,
|
|
370
420
|
HealthJourneyStep,
|
|
421
|
+
HttpAttemptContext,
|
|
371
422
|
HttpClient,
|
|
423
|
+
HttpHeadersFactory,
|
|
372
424
|
HttpMethod,
|
|
373
425
|
HttpRedirectFailureReason,
|
|
374
426
|
HttpRedirectPolicy,
|
|
@@ -466,6 +518,7 @@ export type {
|
|
|
466
518
|
ProviderRuntimeTarget,
|
|
467
519
|
ProviderRuntimeState,
|
|
468
520
|
ProviderSecretDeclaration,
|
|
521
|
+
ProviderSecretIssuer,
|
|
469
522
|
ProviderStealthConfig,
|
|
470
523
|
ProviderStateDurationString,
|
|
471
524
|
ProviderStateNamespace,
|
|
@@ -572,3 +625,22 @@ export {
|
|
|
572
625
|
type NativeTelemetryVendorSkipReason,
|
|
573
626
|
type NativeVendorSkipTelemetryEvent,
|
|
574
627
|
} from "./runtime/native-telemetry.js";
|
|
628
|
+
export {
|
|
629
|
+
CacheTelemetryCollector,
|
|
630
|
+
type CacheTelemetryHeaderPayload,
|
|
631
|
+
type CacheTelemetryLogPayload,
|
|
632
|
+
type CacheTelemetrySample,
|
|
633
|
+
type CacheTelemetrySink,
|
|
634
|
+
type CacheTelemetrySource,
|
|
635
|
+
} from "./runtime/cache-telemetry.js";
|
|
636
|
+
export {
|
|
637
|
+
StateTelemetryCollector,
|
|
638
|
+
instrumentProviderRuntimeState,
|
|
639
|
+
type StateTelemetryBackend,
|
|
640
|
+
type StateTelemetryHeaderPayload,
|
|
641
|
+
type StateTelemetryLogPayload,
|
|
642
|
+
type StateTelemetryOperation,
|
|
643
|
+
type StateTelemetrySample,
|
|
644
|
+
type StateTelemetrySink,
|
|
645
|
+
type StateTelemetryViolation,
|
|
646
|
+
} from "./runtime/state-telemetry.js";
|