@apifuse/provider-sdk 2.2.0-beta.60 → 2.2.0-beta.62
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 +17 -16
- package/CHANGELOG.md +8 -0
- package/bin/apifuse-dev.ts +5 -7
- package/bin/apifuse-pack-types.ts +26 -0
- package/bin/apifuse-perf.ts +4 -6
- package/bin/apifuse-record.ts +4 -7
- package/bin/apifuse-submit-check.ts +2 -2
- package/dist/define.d.ts +3 -2
- package/dist/define.js +1 -1
- package/dist/dev.js +3 -1
- package/dist/engine.d.ts +7 -6
- package/dist/engine.js +3 -4
- package/dist/error-resolution.js +21 -4
- package/dist/errors.d.ts +3 -0
- package/dist/errors.js +9 -0
- package/dist/handle-meta.d.ts +55 -0
- package/dist/handle-meta.js +57 -0
- package/dist/handle.d.ts +208 -0
- package/dist/handle.js +299 -0
- package/dist/i18n/catalog.js +21 -1
- package/dist/index.d.ts +7 -4
- package/dist/index.js +6 -3
- package/dist/lint.d.ts +3 -0
- package/dist/lint.js +372 -47
- package/dist/provider.d.ts +5 -3
- package/dist/provider.js +4 -2
- package/dist/runtime/handle-wordlist.d.ts +43 -0
- package/dist/runtime/{choice-wordlist.js → handle-wordlist.js} +127 -9
- package/dist/runtime/handle.d.ts +71 -0
- package/dist/runtime/handle.js +900 -0
- package/dist/runtime/http-telemetry-binding.d.ts +10 -0
- package/dist/runtime/http-telemetry-binding.js +152 -0
- package/dist/runtime/http-telemetry-guard.d.ts +6 -0
- package/dist/runtime/http-telemetry-guard.js +150 -0
- package/dist/runtime/http-telemetry.d.ts +104 -0
- package/dist/runtime/http-telemetry.js +190 -0
- package/dist/runtime/http.d.ts +31 -0
- package/dist/runtime/http.js +222 -146
- package/dist/runtime/native-network.d.ts +10 -1
- package/dist/runtime/native-network.js +230 -29
- package/dist/runtime/native-telemetry.d.ts +142 -0
- package/dist/runtime/native-telemetry.js +231 -0
- package/dist/runtime/state.d.ts +4 -1
- package/dist/runtime/state.js +32 -17
- package/dist/server/index.d.ts +3 -0
- package/dist/server/index.js +2 -0
- package/dist/server/sensitive-values.d.ts +1 -1
- package/dist/server/sensitive-values.js +0 -3
- package/dist/server/serve-implementation.d.ts +6 -11
- package/dist/server/serve-implementation.js +119 -52
- package/dist/testing/run.js +10 -7
- package/dist/types.d.ts +4 -107
- package/package.json +1 -1
- package/src/define.ts +4 -3
- package/src/dev.ts +3 -1
- package/src/engine.ts +5 -6
- package/src/error-resolution.ts +21 -4
- package/src/errors.ts +13 -0
- package/src/handle-meta.ts +93 -0
- package/src/handle.ts +612 -0
- package/src/i18n/catalog.ts +23 -1
- package/src/index.ts +45 -13
- package/src/lint.ts +437 -55
- package/src/provider.ts +19 -20
- package/src/runtime/{choice-wordlist.ts → handle-wordlist.ts} +130 -9
- package/src/runtime/handle.ts +1172 -0
- package/src/runtime/http-telemetry-binding.ts +162 -0
- package/src/runtime/http-telemetry-guard.ts +155 -0
- package/src/runtime/http-telemetry.ts +292 -0
- package/src/runtime/http.ts +295 -173
- package/src/runtime/native-network.ts +281 -33
- package/src/runtime/native-telemetry.ts +366 -0
- package/src/runtime/state.ts +44 -16
- package/src/server/index.ts +30 -0
- package/src/server/sensitive-values.ts +0 -3
- package/src/server/serve-implementation.ts +127 -89
- package/src/testing/run.ts +11 -7
- package/src/types.ts +4 -137
- package/dist/choice-token.d.ts +0 -24
- package/dist/choice-token.js +0 -74
- package/dist/runtime/choice-wordlist.d.ts +0 -9
- package/dist/runtime/choice.d.ts +0 -27
- package/dist/runtime/choice.js +0 -801
- package/src/choice-token.ts +0 -165
- package/src/runtime/choice.ts +0 -1197
package/src/i18n/catalog.ts
CHANGED
|
@@ -191,6 +191,28 @@ export function localizeAuthTurn(
|
|
|
191
191
|
};
|
|
192
192
|
}
|
|
193
193
|
|
|
194
|
+
/**
|
|
195
|
+
* Markers that indicate a locale value was scaffolded but never translated.
|
|
196
|
+
*
|
|
197
|
+
* ASCII tokens are matched case-sensitively as whole `\w` tokens so ordinary
|
|
198
|
+
* prose such as "todo list" or identifiers like "TBDx" are not flagged. Locale
|
|
199
|
+
* tags such as `[ko]` are matched literally (the brackets are the boundary), and
|
|
200
|
+
* the Korean/Japanese phrases are matched as-is since CJK text has no `\b`.
|
|
201
|
+
*/
|
|
202
|
+
const PROVIDER_LOCALE_PLACEHOLDER_PATTERNS: readonly RegExp[] = [
|
|
203
|
+
/\b(?:TODO|FIXME|TBD|TRANSLATE)\b/,
|
|
204
|
+
/\[(?:en|ko|ja)\]/i,
|
|
205
|
+
/번역\s*필요/,
|
|
206
|
+
/翻訳が必要/,
|
|
207
|
+
];
|
|
208
|
+
|
|
209
|
+
function isProviderLocalePlaceholderText(text: string): boolean {
|
|
210
|
+
if (text.trim().length === 0) {
|
|
211
|
+
return true;
|
|
212
|
+
}
|
|
213
|
+
return PROVIDER_LOCALE_PLACEHOLDER_PATTERNS.some((pattern) => pattern.test(text));
|
|
214
|
+
}
|
|
215
|
+
|
|
194
216
|
export function validateProviderLocaleCatalogs(options: {
|
|
195
217
|
catalogs: ProviderLocaleCatalogMap;
|
|
196
218
|
requiredLocales: readonly ProviderLocale[];
|
|
@@ -239,7 +261,7 @@ export function validateProviderLocaleCatalogs(options: {
|
|
|
239
261
|
continue;
|
|
240
262
|
}
|
|
241
263
|
for (const text of Array.isArray(value) ? value : [value]) {
|
|
242
|
-
if (
|
|
264
|
+
if (isProviderLocalePlaceholderText(text)) {
|
|
243
265
|
issues.push({
|
|
244
266
|
locale,
|
|
245
267
|
key,
|
package/src/index.ts
CHANGED
|
@@ -2,7 +2,6 @@
|
|
|
2
2
|
|
|
3
3
|
export * from "./auth.js";
|
|
4
4
|
export * from "./ceremonies/index.js";
|
|
5
|
-
export * from "./choice-token.js";
|
|
6
5
|
export type {
|
|
7
6
|
ApiFuseConfig,
|
|
8
7
|
BrowserConfig,
|
|
@@ -139,12 +138,22 @@ export {
|
|
|
139
138
|
createProviderCache,
|
|
140
139
|
type ProviderCacheOptions,
|
|
141
140
|
} from "./runtime/cache.js";
|
|
141
|
+
export * from "./handle.js";
|
|
142
142
|
export {
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
} from "./
|
|
143
|
+
APIFUSE_HANDLE_META_KEY,
|
|
144
|
+
HANDLE_KIND_NAME_PATTERN,
|
|
145
|
+
handleFieldDescription,
|
|
146
|
+
isHandleFieldMeta,
|
|
147
|
+
} from "./handle-meta.js";
|
|
148
|
+
export {
|
|
149
|
+
type CreateHandleContextOptions,
|
|
150
|
+
type CreateTestHandleContextOptions,
|
|
151
|
+
createHandleContext,
|
|
152
|
+
createTestHandleContext,
|
|
153
|
+
type HandleNormalizationClass,
|
|
154
|
+
type NormalizedHandle,
|
|
155
|
+
normalizeHandle,
|
|
156
|
+
} from "./runtime/handle.js";
|
|
148
157
|
export {
|
|
149
158
|
type CreateCredentialContextOptions,
|
|
150
159
|
createCredentialContext,
|
|
@@ -241,6 +250,7 @@ export {
|
|
|
241
250
|
MISSING_SECRET_CODE,
|
|
242
251
|
} from "./runtime/secrets.js";
|
|
243
252
|
export {
|
|
253
|
+
createMemoryProviderRuntimeState,
|
|
244
254
|
createUnsupportedProviderRuntimeState,
|
|
245
255
|
UnsupportedProviderStateError,
|
|
246
256
|
} from "./runtime/state.js";
|
|
@@ -424,13 +434,6 @@ export type {
|
|
|
424
434
|
ProviderCacheLookupMeta,
|
|
425
435
|
ProviderCacheResponseMeta,
|
|
426
436
|
ProviderCacheResult,
|
|
427
|
-
ProviderChoiceBindingOptions,
|
|
428
|
-
ProviderChoiceConsumeMode,
|
|
429
|
-
ProviderChoiceConsumeResult,
|
|
430
|
-
ProviderChoiceContext,
|
|
431
|
-
ProviderChoiceExplicitParseResult,
|
|
432
|
-
ProviderChoiceIssueOptions,
|
|
433
|
-
ProviderChoiceParseOptions,
|
|
434
437
|
ProviderChallenge,
|
|
435
438
|
ProviderChallengeKind,
|
|
436
439
|
ProviderContext,
|
|
@@ -540,3 +543,32 @@ export * from "./utils/date.js";
|
|
|
540
543
|
export * from "./utils/parse.js";
|
|
541
544
|
export * from "./utils/text.js";
|
|
542
545
|
export * from "./utils/transform.js";
|
|
546
|
+
|
|
547
|
+
export {
|
|
548
|
+
HttpTelemetryCollector,
|
|
549
|
+
type HttpTelemetrySink,
|
|
550
|
+
type HttpTelemetryRequestSink,
|
|
551
|
+
type HttpAttemptTelemetryEvent,
|
|
552
|
+
type HttpAttemptSample,
|
|
553
|
+
type HttpTelemetryErrorCode,
|
|
554
|
+
type HttpTelemetryRetryPayload,
|
|
555
|
+
type HttpTelemetryLogPayload,
|
|
556
|
+
type HttpTelemetryHeaderPayload,
|
|
557
|
+
} from "./runtime/http-telemetry.js";
|
|
558
|
+
|
|
559
|
+
export {
|
|
560
|
+
NativeTelemetryCollector,
|
|
561
|
+
type NativeAttemptSample,
|
|
562
|
+
type NativeConnectTelemetryEvent,
|
|
563
|
+
type NativeLifecycleTelemetryEvent,
|
|
564
|
+
type NativeTelemetryDiagnostics,
|
|
565
|
+
type NativeTelemetryErrorCode,
|
|
566
|
+
type NativeTelemetryHeaderPayload,
|
|
567
|
+
type NativeTelemetryKind,
|
|
568
|
+
type NativeTelemetryLifecycleKind,
|
|
569
|
+
type NativeTelemetryLogPayload,
|
|
570
|
+
type NativeTelemetryOutcome,
|
|
571
|
+
type NativeTelemetrySink,
|
|
572
|
+
type NativeTelemetryVendorSkipReason,
|
|
573
|
+
type NativeVendorSkipTelemetryEvent,
|
|
574
|
+
} from "./runtime/native-telemetry.js";
|