@apifuse/provider-sdk 2.2.0-beta.63 → 2.2.0-beta.65
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 +107 -0
- package/CHANGELOG.md +8 -0
- package/LICENSE +21 -0
- package/bin/apifuse-check.ts +17 -2
- package/bin/apifuse-submit-check.ts +9 -5
- package/dist/handle-meta.d.ts +36 -1
- package/dist/handle-meta.js +16 -0
- package/dist/handle.d.ts +23 -5
- package/dist/handle.js +54 -8
- package/dist/health-scenario.d.ts +38 -0
- package/dist/index.d.ts +4 -2
- package/dist/index.js +3 -1
- package/dist/lint.d.ts +5 -0
- package/dist/lint.js +582 -33
- package/dist/provider.d.ts +1 -1
- package/dist/provider.js +1 -1
- package/dist/runtime/handle.js +9 -1
- package/dist/runtime/ocr.js +5 -0
- package/dist/runtime-boundary-lint.d.ts +137 -0
- package/dist/runtime-boundary-lint.js +590 -0
- package/dist/types.d.ts +29 -0
- package/dist/typescript-module.d.ts +39 -0
- package/dist/typescript-module.js +72 -0
- package/package.json +1 -1
- package/src/handle-meta.ts +51 -1
- package/src/handle.ts +92 -10
- package/src/health-scenario.ts +38 -0
- package/src/index.ts +14 -0
- package/src/lint.ts +668 -41
- package/src/provider.ts +2 -0
- package/src/runtime/handle.ts +9 -1
- package/src/runtime/ocr.ts +5 -0
- package/src/runtime-boundary-lint.ts +707 -0
- package/src/types.ts +29 -0
- package/src/typescript-module.ts +100 -0
package/src/provider.ts
CHANGED
package/src/runtime/handle.ts
CHANGED
|
@@ -27,7 +27,7 @@ import {
|
|
|
27
27
|
isDraftKind,
|
|
28
28
|
type ResultOf,
|
|
29
29
|
} from "../handle.js";
|
|
30
|
-
import { formatHandleIssuers } from "../handle-meta.js";
|
|
30
|
+
import { formatHandleIssuers, handleHasDirectionalFieldNames } from "../handle-meta.js";
|
|
31
31
|
import type {
|
|
32
32
|
ProviderRequestContext,
|
|
33
33
|
ProviderRuntimeState,
|
|
@@ -248,6 +248,14 @@ export function formatNormalizationClasses(classes: readonly string[]): string {
|
|
|
248
248
|
// ---------------------------------------------------------------------------
|
|
249
249
|
|
|
250
250
|
function publicCollapsedMessage(kind: HandleKind): string {
|
|
251
|
+
// "a new one" is unambiguous only while the kind has one name. When it is
|
|
252
|
+
// issued under `next_cursor` and accepted under `cursor`, the caller has to
|
|
253
|
+
// be told which field to read, so use the full recovery sentence — it names
|
|
254
|
+
// both keys and is identical for invalid / expired / not-found, which is
|
|
255
|
+
// what keeps the public collapse indistinguishable.
|
|
256
|
+
if (handleHasDirectionalFieldNames(kind)) {
|
|
257
|
+
return `\`${kind.fieldName}\` is not valid or has expired. ${handleRecoverySentence(kind)}`;
|
|
258
|
+
}
|
|
251
259
|
const issuers = formatHandleIssuers(kind.issuedBy);
|
|
252
260
|
const again = issuers ? `Call ${issuers} again to get a new one.` : "Request a new one.";
|
|
253
261
|
return `\`${kind.fieldName}\` is not valid or has expired. ${again}`;
|
package/src/runtime/ocr.ts
CHANGED
|
@@ -86,6 +86,10 @@ function createErrorOcrClient(options: ErrorOcrClientOptions): OcrContext {
|
|
|
86
86
|
};
|
|
87
87
|
return tagCapability(
|
|
88
88
|
{
|
|
89
|
+
// Own data property: `bindOcrTelemetry` re-spreads the context, so a
|
|
90
|
+
// getter or prototype member would silently vanish before reaching
|
|
91
|
+
// provider code.
|
|
92
|
+
available: false,
|
|
89
93
|
async recognize() {
|
|
90
94
|
return unavailable();
|
|
91
95
|
},
|
|
@@ -355,6 +359,7 @@ function createOcrClient(
|
|
|
355
359
|
recognize: (request: OcrRecognizeRequest) => Promise<OcrResult>,
|
|
356
360
|
): OcrContext {
|
|
357
361
|
return {
|
|
362
|
+
available: true,
|
|
358
363
|
recognize,
|
|
359
364
|
async extractCaptchaText(image, options = {}): Promise<OcrCaptchaResult> {
|
|
360
365
|
const result = await recognize({ image, hint: "captcha" });
|