@apifn/core 0.0.4 → 0.1.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/README.md +23 -5
- package/dist/chunk-NWH3AIKS.js +68 -0
- package/dist/chunk-NWH3AIKS.js.map +1 -0
- package/dist/index.cjs +476 -6016
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +19 -10
- package/dist/index.d.ts +19 -10
- package/dist/index.js +389 -191
- package/dist/index.js.map +1 -1
- package/dist/openapi-reference-context.cjs +92 -0
- package/dist/openapi-reference-context.cjs.map +1 -0
- package/dist/openapi-reference-context.d.cts +24 -0
- package/dist/openapi-reference-context.d.ts +24 -0
- package/dist/openapi-reference-context.js +8 -0
- package/dist/openapi-reference-context.js.map +1 -0
- package/dist/testfn.cjs +6063 -0
- package/dist/testfn.cjs.map +1 -0
- package/dist/testfn.d.cts +18 -0
- package/dist/testfn.d.ts +18 -0
- package/dist/testfn.js +229 -0
- package/dist/testfn.js.map +1 -0
- package/package.json +33 -8
package/dist/index.d.cts
CHANGED
|
@@ -2,7 +2,6 @@ import { IntrospectOptions, IntrospectedRoute, SchemaDescriptor, SchemaInput, Js
|
|
|
2
2
|
export { AuthConfig, ComponentsObject, CorsOptions, EncodingObject, ExampleObject, ExternalDocsObject, HeaderObject, HttpMethod, LinkObject, MediaTypeObject, MockServerOptions, OAuthFlowObject, OAuthFlowsObject, OpenAPIInfoObject, OperationObject, ParameterDescriptor, ParameterObject, PathItemObject, PathsObject, ReferenceObject, RequestBodyDescriptor, RequestBodyObject, ResponseDescriptor, ResponseObject, SchemaDescriptorResponse, SchemaObject, SecurityRequirement, SecuritySchemeObject, ServerObject, SnippetOptions, SnippetTarget, TagObject } from './types.cjs';
|
|
3
3
|
import { Router } from '@superfunctions/http';
|
|
4
4
|
export { Middleware, Route, Router } from '@superfunctions/http';
|
|
5
|
-
import { BaseAdapter, TestCase, RunOptions, TestResult } from '@testfn/core';
|
|
6
5
|
|
|
7
6
|
declare function introspectRouter(router: Router<unknown>, options?: IntrospectOptions): IntrospectedRoute[];
|
|
8
7
|
|
|
@@ -34,7 +33,24 @@ declare function fromRouter(router: Router<unknown>, options: FromRouterOptions)
|
|
|
34
33
|
|
|
35
34
|
declare function parseOpenAPI(input: string | Record<string, unknown>): OpenAPIDocument;
|
|
36
35
|
|
|
37
|
-
|
|
36
|
+
interface OpenAPIValidationOptions {
|
|
37
|
+
/**
|
|
38
|
+
* Preloaded JSON or YAML for external documents, keyed by the resolved URI or
|
|
39
|
+
* absolute file path, without a fragment. Escape literal `%`, `?`, and `\\`
|
|
40
|
+
* within path segments as `%25`, `%3F`, and `%5C`. Within preloaded documents, use slash-delimited
|
|
41
|
+
* `#/` pointers. Validation never reads files or URLs.
|
|
42
|
+
*/
|
|
43
|
+
externalReferences?: ReadonlyMap<string, string>;
|
|
44
|
+
}
|
|
45
|
+
declare function validateOpenAPI(document: OpenAPIDocument, options?: OpenAPIValidationOptions): Promise<ValidationError[]>;
|
|
46
|
+
/** Validates and returns a dereferenced copy for callers that compare or store it. */
|
|
47
|
+
declare function validateAndDereferenceOpenAPI(document: OpenAPIDocument, options?: OpenAPIValidationOptions): Promise<{
|
|
48
|
+
document: OpenAPIDocument;
|
|
49
|
+
errors: [];
|
|
50
|
+
} | {
|
|
51
|
+
document: null;
|
|
52
|
+
errors: ValidationError[];
|
|
53
|
+
}>;
|
|
38
54
|
|
|
39
55
|
declare function upconvertFrom3_0(document: unknown): OpenAPIDocument;
|
|
40
56
|
|
|
@@ -261,11 +277,4 @@ interface CliLoggerOptions {
|
|
|
261
277
|
*/
|
|
262
278
|
declare function createCliLogger(options?: CliLoggerOptions): LogFnClient;
|
|
263
279
|
|
|
264
|
-
|
|
265
|
-
name: string;
|
|
266
|
-
supports(framework: string): boolean;
|
|
267
|
-
discover(patterns: string[]): Promise<TestCase[]>;
|
|
268
|
-
run(tests: TestCase[], options: RunOptions): Promise<TestResult[]>;
|
|
269
|
-
}
|
|
270
|
-
|
|
271
|
-
export { ApifnTestAdapter, type CliLoggerOptions, type CreateWatchFnClientOptions, type DeduplicateSchemaInput, type DeduplicateSchemasResult, DiffEntry, type DiffReportJson, DiffResult, EndpointMetrics, type FetchEndpointMetricsOptions, type FromRouterOptions, IntrospectOptions, IntrospectedRoute, JsonSchema, type MintTestTokenOptions, type MintTestTokenResponse, OpenAPIDocument, OpenAPIGenerateOptions, RateLimitInfo, SchemaDescriptor, SchemaInput, type SchemaType, ValidationError, WatchFnClient, type WatchFnMiddlewareOptions, apiSchema, apifnWatchMiddleware, convertSchema, convertTypeBoxSchema, convertZodSchema, createAuthfnCollectionMiddleware, createCliLogger, createWatchFnClient, deduplicateSchemas, detectSchemaType, diffOpenAPI, fetchEndpointMetrics, fetchRateLimits, formatDiffAsJson, formatDiffAsText, fromRouter, generateOpenAPI, introspectRouter, logfnReporter, mintTestToken, parseOpenAPI, upconvertFrom3_0, validateOpenAPI };
|
|
280
|
+
export { type CliLoggerOptions, type CreateWatchFnClientOptions, type DeduplicateSchemaInput, type DeduplicateSchemasResult, DiffEntry, type DiffReportJson, DiffResult, EndpointMetrics, type FetchEndpointMetricsOptions, type FromRouterOptions, IntrospectOptions, IntrospectedRoute, JsonSchema, type MintTestTokenOptions, type MintTestTokenResponse, OpenAPIDocument, OpenAPIGenerateOptions, type OpenAPIValidationOptions, RateLimitInfo, SchemaDescriptor, SchemaInput, type SchemaType, ValidationError, WatchFnClient, type WatchFnMiddlewareOptions, apiSchema, apifnWatchMiddleware, convertSchema, convertTypeBoxSchema, convertZodSchema, createAuthfnCollectionMiddleware, createCliLogger, createWatchFnClient, deduplicateSchemas, detectSchemaType, diffOpenAPI, fetchEndpointMetrics, fetchRateLimits, formatDiffAsJson, formatDiffAsText, fromRouter, generateOpenAPI, introspectRouter, logfnReporter, mintTestToken, parseOpenAPI, upconvertFrom3_0, validateAndDereferenceOpenAPI, validateOpenAPI };
|
package/dist/index.d.ts
CHANGED
|
@@ -2,7 +2,6 @@ import { IntrospectOptions, IntrospectedRoute, SchemaDescriptor, SchemaInput, Js
|
|
|
2
2
|
export { AuthConfig, ComponentsObject, CorsOptions, EncodingObject, ExampleObject, ExternalDocsObject, HeaderObject, HttpMethod, LinkObject, MediaTypeObject, MockServerOptions, OAuthFlowObject, OAuthFlowsObject, OpenAPIInfoObject, OperationObject, ParameterDescriptor, ParameterObject, PathItemObject, PathsObject, ReferenceObject, RequestBodyDescriptor, RequestBodyObject, ResponseDescriptor, ResponseObject, SchemaDescriptorResponse, SchemaObject, SecurityRequirement, SecuritySchemeObject, ServerObject, SnippetOptions, SnippetTarget, TagObject } from './types.js';
|
|
3
3
|
import { Router } from '@superfunctions/http';
|
|
4
4
|
export { Middleware, Route, Router } from '@superfunctions/http';
|
|
5
|
-
import { BaseAdapter, TestCase, RunOptions, TestResult } from '@testfn/core';
|
|
6
5
|
|
|
7
6
|
declare function introspectRouter(router: Router<unknown>, options?: IntrospectOptions): IntrospectedRoute[];
|
|
8
7
|
|
|
@@ -34,7 +33,24 @@ declare function fromRouter(router: Router<unknown>, options: FromRouterOptions)
|
|
|
34
33
|
|
|
35
34
|
declare function parseOpenAPI(input: string | Record<string, unknown>): OpenAPIDocument;
|
|
36
35
|
|
|
37
|
-
|
|
36
|
+
interface OpenAPIValidationOptions {
|
|
37
|
+
/**
|
|
38
|
+
* Preloaded JSON or YAML for external documents, keyed by the resolved URI or
|
|
39
|
+
* absolute file path, without a fragment. Escape literal `%`, `?`, and `\\`
|
|
40
|
+
* within path segments as `%25`, `%3F`, and `%5C`. Within preloaded documents, use slash-delimited
|
|
41
|
+
* `#/` pointers. Validation never reads files or URLs.
|
|
42
|
+
*/
|
|
43
|
+
externalReferences?: ReadonlyMap<string, string>;
|
|
44
|
+
}
|
|
45
|
+
declare function validateOpenAPI(document: OpenAPIDocument, options?: OpenAPIValidationOptions): Promise<ValidationError[]>;
|
|
46
|
+
/** Validates and returns a dereferenced copy for callers that compare or store it. */
|
|
47
|
+
declare function validateAndDereferenceOpenAPI(document: OpenAPIDocument, options?: OpenAPIValidationOptions): Promise<{
|
|
48
|
+
document: OpenAPIDocument;
|
|
49
|
+
errors: [];
|
|
50
|
+
} | {
|
|
51
|
+
document: null;
|
|
52
|
+
errors: ValidationError[];
|
|
53
|
+
}>;
|
|
38
54
|
|
|
39
55
|
declare function upconvertFrom3_0(document: unknown): OpenAPIDocument;
|
|
40
56
|
|
|
@@ -261,11 +277,4 @@ interface CliLoggerOptions {
|
|
|
261
277
|
*/
|
|
262
278
|
declare function createCliLogger(options?: CliLoggerOptions): LogFnClient;
|
|
263
279
|
|
|
264
|
-
|
|
265
|
-
name: string;
|
|
266
|
-
supports(framework: string): boolean;
|
|
267
|
-
discover(patterns: string[]): Promise<TestCase[]>;
|
|
268
|
-
run(tests: TestCase[], options: RunOptions): Promise<TestResult[]>;
|
|
269
|
-
}
|
|
270
|
-
|
|
271
|
-
export { ApifnTestAdapter, type CliLoggerOptions, type CreateWatchFnClientOptions, type DeduplicateSchemaInput, type DeduplicateSchemasResult, DiffEntry, type DiffReportJson, DiffResult, EndpointMetrics, type FetchEndpointMetricsOptions, type FromRouterOptions, IntrospectOptions, IntrospectedRoute, JsonSchema, type MintTestTokenOptions, type MintTestTokenResponse, OpenAPIDocument, OpenAPIGenerateOptions, RateLimitInfo, SchemaDescriptor, SchemaInput, type SchemaType, ValidationError, WatchFnClient, type WatchFnMiddlewareOptions, apiSchema, apifnWatchMiddleware, convertSchema, convertTypeBoxSchema, convertZodSchema, createAuthfnCollectionMiddleware, createCliLogger, createWatchFnClient, deduplicateSchemas, detectSchemaType, diffOpenAPI, fetchEndpointMetrics, fetchRateLimits, formatDiffAsJson, formatDiffAsText, fromRouter, generateOpenAPI, introspectRouter, logfnReporter, mintTestToken, parseOpenAPI, upconvertFrom3_0, validateOpenAPI };
|
|
280
|
+
export { type CliLoggerOptions, type CreateWatchFnClientOptions, type DeduplicateSchemaInput, type DeduplicateSchemasResult, DiffEntry, type DiffReportJson, DiffResult, EndpointMetrics, type FetchEndpointMetricsOptions, type FromRouterOptions, IntrospectOptions, IntrospectedRoute, JsonSchema, type MintTestTokenOptions, type MintTestTokenResponse, OpenAPIDocument, OpenAPIGenerateOptions, type OpenAPIValidationOptions, RateLimitInfo, SchemaDescriptor, SchemaInput, type SchemaType, ValidationError, WatchFnClient, type WatchFnMiddlewareOptions, apiSchema, apifnWatchMiddleware, convertSchema, convertTypeBoxSchema, convertZodSchema, createAuthfnCollectionMiddleware, createCliLogger, createWatchFnClient, deduplicateSchemas, detectSchemaType, diffOpenAPI, fetchEndpointMetrics, fetchRateLimits, formatDiffAsJson, formatDiffAsText, fromRouter, generateOpenAPI, introspectRouter, logfnReporter, mintTestToken, parseOpenAPI, upconvertFrom3_0, validateAndDereferenceOpenAPI, validateOpenAPI };
|