@bluelibs/runner 4.8.6 → 4.9.0
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/AI.md +8 -0
- package/README.md +39 -4
- package/dist/browser/index.cjs +543 -418
- package/dist/browser/index.cjs.map +1 -1
- package/dist/browser/index.d.mts +2221 -0
- package/dist/browser/index.d.ts +2221 -0
- package/dist/browser/index.mjs +543 -418
- package/dist/browser/index.mjs.map +1 -1
- package/dist/edge/index.cjs +543 -418
- package/dist/edge/index.cjs.map +1 -1
- package/dist/edge/index.d.mts +2221 -0
- package/dist/edge/index.d.ts +2221 -0
- package/dist/edge/index.mjs +543 -418
- package/dist/edge/index.mjs.map +1 -1
- package/dist/node/node.cjs +584 -436
- package/dist/node/node.cjs.map +1 -1
- package/dist/node/node.d.mts +2472 -0
- package/dist/node/node.d.ts +2425 -55
- package/dist/node/node.mjs +584 -436
- package/dist/node/node.mjs.map +1 -1
- package/dist/universal/index.cjs +541 -418
- package/dist/universal/index.cjs.map +1 -1
- package/dist/universal/index.d.mts +2221 -0
- package/dist/universal/index.d.ts +2221 -0
- package/dist/universal/index.mjs +541 -418
- package/dist/universal/index.mjs.map +1 -1
- package/package.json +5 -5
- package/dist/define.d.ts +0 -9
- package/dist/definers/builders/asyncContext.d.ts +0 -13
- package/dist/definers/builders/core.d.ts +0 -30
- package/dist/definers/builders/error.d.ts +0 -15
- package/dist/definers/builders/event.d.ts +0 -12
- package/dist/definers/builders/hook.d.ts +0 -20
- package/dist/definers/builders/middleware.d.ts +0 -39
- package/dist/definers/builders/resource.d.ts +0 -40
- package/dist/definers/builders/tag.d.ts +0 -10
- package/dist/definers/builders/task.d.ts +0 -37
- package/dist/definers/builders/task.phantom.d.ts +0 -27
- package/dist/definers/builders/utils.d.ts +0 -4
- package/dist/definers/defineAsyncContext.d.ts +0 -15
- package/dist/definers/defineError.d.ts +0 -26
- package/dist/definers/defineEvent.d.ts +0 -2
- package/dist/definers/defineHook.d.ts +0 -6
- package/dist/definers/defineOverride.d.ts +0 -17
- package/dist/definers/defineResource.d.ts +0 -2
- package/dist/definers/defineResourceMiddleware.d.ts +0 -2
- package/dist/definers/defineTag.d.ts +0 -12
- package/dist/definers/defineTask.d.ts +0 -18
- package/dist/definers/defineTaskMiddleware.d.ts +0 -2
- package/dist/definers/tools.d.ts +0 -53
- package/dist/defs.d.ts +0 -31
- package/dist/errors.d.ts +0 -62
- package/dist/globals/debug.d.ts +0 -10
- package/dist/globals/globalEvents.d.ts +0 -8
- package/dist/globals/globalMiddleware.d.ts +0 -31
- package/dist/globals/globalResources.d.ts +0 -41
- package/dist/globals/globalTags.d.ts +0 -11
- package/dist/globals/middleware/cache.middleware.d.ts +0 -27
- package/dist/globals/middleware/requireContext.middleware.d.ts +0 -6
- package/dist/globals/middleware/retry.middleware.d.ts +0 -21
- package/dist/globals/middleware/timeout.middleware.d.ts +0 -9
- package/dist/globals/middleware/tunnel.middleware.d.ts +0 -2
- package/dist/globals/resources/debug/debug.resource.d.ts +0 -7
- package/dist/globals/resources/debug/debug.tag.d.ts +0 -2
- package/dist/globals/resources/debug/debugConfig.resource.d.ts +0 -22
- package/dist/globals/resources/debug/executionTracker.middleware.d.ts +0 -50
- package/dist/globals/resources/debug/globalEvent.hook.d.ts +0 -27
- package/dist/globals/resources/debug/hook.hook.d.ts +0 -30
- package/dist/globals/resources/debug/index.d.ts +0 -6
- package/dist/globals/resources/debug/middleware.hook.d.ts +0 -30
- package/dist/globals/resources/debug/types.d.ts +0 -25
- package/dist/globals/resources/debug/utils.d.ts +0 -2
- package/dist/globals/resources/httpClientFactory.resource.d.ts +0 -28
- package/dist/globals/resources/queue.resource.d.ts +0 -10
- package/dist/globals/resources/tunnel/ejson-extensions.d.ts +0 -1
- package/dist/globals/resources/tunnel/error-utils.d.ts +0 -1
- package/dist/globals/resources/tunnel/plan.d.ts +0 -19
- package/dist/globals/resources/tunnel/protocol.d.ts +0 -47
- package/dist/globals/resources/tunnel/serializer.d.ts +0 -9
- package/dist/globals/resources/tunnel/tunnel.policy.tag.d.ts +0 -18
- package/dist/globals/resources/tunnel/tunnel.tag.d.ts +0 -2
- package/dist/globals/resources/tunnel/types.d.ts +0 -42
- package/dist/globals/tunnels/index.d.ts +0 -23
- package/dist/globals/types.d.ts +0 -4
- package/dist/http-client.d.ts +0 -25
- package/dist/http-fetch-tunnel.resource.d.ts +0 -11
- package/dist/index.d.ts +0 -117
- package/dist/models/DependencyProcessor.d.ts +0 -48
- package/dist/models/EventManager.d.ts +0 -153
- package/dist/models/LogPrinter.d.ts +0 -55
- package/dist/models/Logger.d.ts +0 -85
- package/dist/models/MiddlewareManager.d.ts +0 -75
- package/dist/models/OverrideManager.d.ts +0 -13
- package/dist/models/Queue.d.ts +0 -26
- package/dist/models/ResourceInitializer.d.ts +0 -20
- package/dist/models/RunResult.d.ts +0 -35
- package/dist/models/Semaphore.d.ts +0 -61
- package/dist/models/Store.d.ts +0 -73
- package/dist/models/StoreRegistry.d.ts +0 -49
- package/dist/models/StoreValidator.d.ts +0 -8
- package/dist/models/TaskRunner.d.ts +0 -27
- package/dist/models/UnhandledError.d.ts +0 -11
- package/dist/models/index.d.ts +0 -11
- package/dist/models/middleware/InterceptorRegistry.d.ts +0 -56
- package/dist/models/middleware/MiddlewareResolver.d.ts +0 -31
- package/dist/models/middleware/ResourceMiddlewareComposer.d.ts +0 -34
- package/dist/models/middleware/TaskMiddlewareComposer.d.ts +0 -43
- package/dist/models/middleware/ValidationHelper.d.ts +0 -20
- package/dist/models/middleware/index.d.ts +0 -6
- package/dist/models/middleware/types.d.ts +0 -10
- package/dist/models/utils/findCircularDependencies.d.ts +0 -16
- package/dist/models/utils/safeStringify.d.ts +0 -3
- package/dist/node/exposure/allowList.d.ts +0 -3
- package/dist/node/exposure/authenticator.d.ts +0 -6
- package/dist/node/exposure/cors.d.ts +0 -4
- package/dist/node/exposure/createNodeExposure.d.ts +0 -2
- package/dist/node/exposure/exposureServer.d.ts +0 -18
- package/dist/node/exposure/httpResponse.d.ts +0 -10
- package/dist/node/exposure/logging.d.ts +0 -4
- package/dist/node/exposure/multipart.d.ts +0 -27
- package/dist/node/exposure/requestBody.d.ts +0 -11
- package/dist/node/exposure/requestContext.d.ts +0 -17
- package/dist/node/exposure/requestHandlers.d.ts +0 -24
- package/dist/node/exposure/resourceTypes.d.ts +0 -60
- package/dist/node/exposure/router.d.ts +0 -17
- package/dist/node/exposure/serverLifecycle.d.ts +0 -13
- package/dist/node/exposure/types.d.ts +0 -31
- package/dist/node/exposure/utils.d.ts +0 -17
- package/dist/node/exposure.resource.d.ts +0 -12
- package/dist/node/files.d.ts +0 -9
- package/dist/node/http-mixed-client.d.ts +0 -30
- package/dist/node/http-smart-client.model.d.ts +0 -24
- package/dist/node/index.d.ts +0 -1
- package/dist/node/inputFile.model.d.ts +0 -22
- package/dist/node/inputFile.utils.d.ts +0 -14
- package/dist/node/platform/createFile.d.ts +0 -9
- package/dist/node/resources/http-mixed-client.factory.resource.d.ts +0 -17
- package/dist/node/resources/http-smart-client.factory.resource.d.ts +0 -16
- package/dist/node/tunnel.allowlist.d.ts +0 -7
- package/dist/node/upload/manifest.d.ts +0 -22
- package/dist/platform/adapters/browser.d.ts +0 -14
- package/dist/platform/adapters/edge.d.ts +0 -5
- package/dist/platform/adapters/node-als.d.ts +0 -1
- package/dist/platform/adapters/node.d.ts +0 -15
- package/dist/platform/adapters/universal-generic.d.ts +0 -14
- package/dist/platform/adapters/universal.d.ts +0 -17
- package/dist/platform/createFile.d.ts +0 -10
- package/dist/platform/createWebFile.d.ts +0 -11
- package/dist/platform/factory.d.ts +0 -2
- package/dist/platform/index.d.ts +0 -27
- package/dist/platform/types.d.ts +0 -29
- package/dist/processHooks.d.ts +0 -2
- package/dist/run.d.ts +0 -14
- package/dist/testing.d.ts +0 -25
- package/dist/tools/getCallerFile.d.ts +0 -1
- package/dist/tunnels/buildUniversalManifest.d.ts +0 -24
- package/dist/types/asyncContext.d.ts +0 -41
- package/dist/types/contracts.d.ts +0 -63
- package/dist/types/error.d.ts +0 -36
- package/dist/types/event.d.ts +0 -74
- package/dist/types/hook.d.ts +0 -23
- package/dist/types/inputFile.d.ts +0 -34
- package/dist/types/meta.d.ts +0 -22
- package/dist/types/resource.d.ts +0 -87
- package/dist/types/resourceMiddleware.d.ts +0 -47
- package/dist/types/runner.d.ts +0 -68
- package/dist/types/storeTypes.d.ts +0 -40
- package/dist/types/symbols.d.ts +0 -32
- package/dist/types/tag.d.ts +0 -46
- package/dist/types/task.d.ts +0 -54
- package/dist/types/taskMiddleware.d.ts +0 -48
- package/dist/types/utilities.d.ts +0 -113
- package/dist/utils/detectRunnerMode.d.ts +0 -9
|
@@ -1,60 +0,0 @@
|
|
|
1
|
-
import type * as http from "http";
|
|
2
|
-
import type { IncomingMessage, ServerResponse } from "http";
|
|
3
|
-
import { globalResources } from "../../globals/globalResources";
|
|
4
|
-
import type { ResourceDependencyValuesType } from "../../defs";
|
|
5
|
-
import type { NodeExposureHttpAuthConfig } from "./authenticator";
|
|
6
|
-
export type NodeExposureDependencyMap = {
|
|
7
|
-
store: typeof globalResources.store;
|
|
8
|
-
taskRunner: typeof globalResources.taskRunner;
|
|
9
|
-
eventManager: typeof globalResources.eventManager;
|
|
10
|
-
logger: typeof globalResources.logger;
|
|
11
|
-
serializer: typeof globalResources.serializer;
|
|
12
|
-
};
|
|
13
|
-
export type NodeExposureDeps = ResourceDependencyValuesType<NodeExposureDependencyMap>;
|
|
14
|
-
export interface NodeExposureHttpConfig {
|
|
15
|
-
basePath?: string;
|
|
16
|
-
server?: http.Server;
|
|
17
|
-
listen?: {
|
|
18
|
-
port: number;
|
|
19
|
-
host?: string;
|
|
20
|
-
};
|
|
21
|
-
auth?: NodeExposureHttpAuthConfig;
|
|
22
|
-
cors?: NodeExposureHttpCorsConfig;
|
|
23
|
-
}
|
|
24
|
-
export interface NodeExposureConfig {
|
|
25
|
-
http?: NodeExposureHttpConfig;
|
|
26
|
-
}
|
|
27
|
-
export interface NodeExposureHandlers {
|
|
28
|
-
handleRequest: (req: IncomingMessage, res: ServerResponse) => Promise<boolean>;
|
|
29
|
-
handleTask: (req: IncomingMessage, res: ServerResponse) => Promise<void>;
|
|
30
|
-
handleEvent: (req: IncomingMessage, res: ServerResponse) => Promise<void>;
|
|
31
|
-
handleDiscovery: (req: IncomingMessage, res: ServerResponse) => Promise<void>;
|
|
32
|
-
createRequestListener: () => http.RequestListener;
|
|
33
|
-
createServer: () => http.Server;
|
|
34
|
-
attachTo: (server: http.Server) => () => void;
|
|
35
|
-
server?: http.Server | null;
|
|
36
|
-
basePath: string;
|
|
37
|
-
close: () => Promise<void>;
|
|
38
|
-
}
|
|
39
|
-
export interface NodeExposureHttpCorsConfig {
|
|
40
|
-
/**
|
|
41
|
-
* Allowed origin(s). When omitted, defaults to "*".
|
|
42
|
-
* - string: exact origin value to send
|
|
43
|
-
* - string[]: allow-list; request origin must match an item
|
|
44
|
-
* - RegExp: allow when test(origin) is true
|
|
45
|
-
* - function: returns the origin to send or null to disallow
|
|
46
|
-
*/
|
|
47
|
-
origin?: string | string[] | RegExp | ((origin: string | undefined) => string | null | undefined);
|
|
48
|
-
/** Which methods are allowed on preflight; defaults to ["POST", "OPTIONS"]. */
|
|
49
|
-
methods?: string[];
|
|
50
|
-
/** Access-Control-Allow-Headers value. If omitted, echoes Access-Control-Request-Headers. */
|
|
51
|
-
allowedHeaders?: string[];
|
|
52
|
-
/** Expose response headers for actual requests. */
|
|
53
|
-
exposedHeaders?: string[];
|
|
54
|
-
/** Whether to include Access-Control-Allow-Credentials: true. */
|
|
55
|
-
credentials?: boolean;
|
|
56
|
-
/** Max age in seconds for preflight caching. */
|
|
57
|
-
maxAge?: number;
|
|
58
|
-
/** Whether to append Vary: Origin when a specific origin is returned. Default true. */
|
|
59
|
-
varyOrigin?: boolean;
|
|
60
|
-
}
|
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
import type { IncomingMessage } from "http";
|
|
2
|
-
import type { JsonResponse, RequestKind, RequestTarget } from "./types";
|
|
3
|
-
export interface ExposureRouter {
|
|
4
|
-
basePath: string;
|
|
5
|
-
isUnderBase(pathname: string): boolean;
|
|
6
|
-
extract(pathname: string): RequestTarget | null;
|
|
7
|
-
}
|
|
8
|
-
export declare function resolveBasePath(basePath?: string): string;
|
|
9
|
-
export declare function createRouter(basePath: string): ExposureRouter;
|
|
10
|
-
export declare function resolveTargetFromRequest(req: IncomingMessage, router: ExposureRouter, expected: RequestKind): {
|
|
11
|
-
ok: true;
|
|
12
|
-
id: string;
|
|
13
|
-
} | {
|
|
14
|
-
ok: false;
|
|
15
|
-
response: JsonResponse;
|
|
16
|
-
};
|
|
17
|
-
export declare function requestUrl(req: IncomingMessage): URL;
|
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
import * as http from "http";
|
|
2
|
-
import type { RequestHandler } from "./types";
|
|
3
|
-
import type { Logger } from "../../models/Logger";
|
|
4
|
-
export declare function makeRequestListener(options: {
|
|
5
|
-
handler: RequestHandler;
|
|
6
|
-
respondOnMiss: boolean;
|
|
7
|
-
logger: Logger;
|
|
8
|
-
}): http.RequestListener;
|
|
9
|
-
export declare function startHttpServer(server: http.Server, listen: {
|
|
10
|
-
port: number;
|
|
11
|
-
host?: string;
|
|
12
|
-
}): Promise<void>;
|
|
13
|
-
export declare function stopHttpServer(server: http.Server): Promise<void>;
|
|
@@ -1,31 +0,0 @@
|
|
|
1
|
-
import type { IncomingMessage, ServerResponse } from "http";
|
|
2
|
-
export type RequestKind = "task" | "event" | "discovery";
|
|
3
|
-
export interface RequestTarget {
|
|
4
|
-
kind: RequestKind;
|
|
5
|
-
id: string;
|
|
6
|
-
}
|
|
7
|
-
export type JsonBody = {
|
|
8
|
-
ok: boolean;
|
|
9
|
-
[key: string]: unknown;
|
|
10
|
-
};
|
|
11
|
-
export interface JsonResponse {
|
|
12
|
-
status: number;
|
|
13
|
-
body: JsonBody;
|
|
14
|
-
}
|
|
15
|
-
export type RequestHandler = (req: IncomingMessage, res: ServerResponse) => Promise<boolean>;
|
|
16
|
-
export type Authenticator = (req: IncomingMessage) => {
|
|
17
|
-
ok: true;
|
|
18
|
-
} | {
|
|
19
|
-
ok: false;
|
|
20
|
-
response: JsonResponse;
|
|
21
|
-
};
|
|
22
|
-
export interface AllowListGuard {
|
|
23
|
-
ensureTask(id: string): JsonResponse | null;
|
|
24
|
-
ensureEvent(id: string): JsonResponse | null;
|
|
25
|
-
}
|
|
26
|
-
export interface StreamingResponse {
|
|
27
|
-
stream: NodeJS.ReadableStream;
|
|
28
|
-
status?: number;
|
|
29
|
-
contentType?: string;
|
|
30
|
-
headers?: Record<string, string>;
|
|
31
|
-
}
|
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
import type { IncomingHttpHeaders, IncomingMessage, ServerResponse } from "http";
|
|
2
|
-
/**
|
|
3
|
-
* Extract a normalized Content-Type header value from request headers.
|
|
4
|
-
* Returns an empty string if not present. If multiple values are present,
|
|
5
|
-
* the first one is used.
|
|
6
|
-
*/
|
|
7
|
-
export declare function getContentType(headers: IncomingHttpHeaders): string;
|
|
8
|
-
/**
|
|
9
|
-
* Attach an event listener to a Node-style emitter that may expose either
|
|
10
|
-
* `once` or `on`. Returns true if attached, false otherwise.
|
|
11
|
-
*/
|
|
12
|
-
export declare function attachRequestListener(target: unknown, event: string, handler: (...args: unknown[]) => void): boolean;
|
|
13
|
-
/**
|
|
14
|
-
* Wires an AbortController to abort when the client disconnects.
|
|
15
|
-
* Attaches to `req` aborted and `res` close events using robust listener attachment.
|
|
16
|
-
*/
|
|
17
|
-
export declare function createAbortControllerForRequest(req: IncomingMessage, res: ServerResponse): AbortController;
|
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
import type { NodeExposureConfig, NodeExposureHandlers } from "./exposure/resourceTypes";
|
|
2
|
-
export type { NodeExposureHttpAuthConfig } from "./exposure/authenticator";
|
|
3
|
-
export declare const nodeExposure: import("..").IResource<NodeExposureConfig, Promise<NodeExposureHandlers>, {
|
|
4
|
-
store: import("..").IResource<void, Promise<import("..").Store>, {}, any, any, import("..").TagType[], import("..").ResourceMiddlewareAttachmentType[]>;
|
|
5
|
-
taskRunner: import("..").IResource<void, Promise<import("..").TaskRunner>, {}, any, any, import("..").TagType[], import("..").ResourceMiddlewareAttachmentType[]>;
|
|
6
|
-
eventManager: import("..").IResource<void, Promise<import("..").EventManager>, {}, any, any, import("..").TagType[], import("..").ResourceMiddlewareAttachmentType[]>;
|
|
7
|
-
logger: import("..").IResource<void, Promise<import("..").Logger>, {}, any, any, import("..").TagType[], import("..").ResourceMiddlewareAttachmentType[]>;
|
|
8
|
-
serializer: import("..").IResource<void, Promise<import("..").Serializer>, {}, any, any, import("..").TagType[], import("..").ResourceMiddlewareAttachmentType[]>;
|
|
9
|
-
}, any, {
|
|
10
|
-
title: string;
|
|
11
|
-
description: string;
|
|
12
|
-
}, import("..").TagType[], import("..").ResourceMiddlewareAttachmentType[]>;
|
package/dist/node/files.d.ts
DELETED
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
import type { Readable } from "stream";
|
|
2
|
-
import type { InputFileMeta, EjsonFileSentinel } from "../types/inputFile";
|
|
3
|
-
export interface NodeFileSource {
|
|
4
|
-
stream?: Readable;
|
|
5
|
-
buffer?: Buffer;
|
|
6
|
-
}
|
|
7
|
-
export declare function createNodeFile(meta: InputFileMeta, source: NodeFileSource, id?: string): EjsonFileSentinel & {
|
|
8
|
-
_node: NodeFileSource;
|
|
9
|
-
};
|
|
@@ -1,30 +0,0 @@
|
|
|
1
|
-
import type { Readable } from "stream";
|
|
2
|
-
import type { Serializer } from "../globals/resources/tunnel/serializer";
|
|
3
|
-
import type { IAsyncContext } from "../types/asyncContext";
|
|
4
|
-
export interface MixedHttpClientAuthConfig {
|
|
5
|
-
header?: string;
|
|
6
|
-
token: string;
|
|
7
|
-
}
|
|
8
|
-
export interface MixedHttpClientConfig {
|
|
9
|
-
baseUrl: string;
|
|
10
|
-
auth?: MixedHttpClientAuthConfig;
|
|
11
|
-
timeoutMs?: number;
|
|
12
|
-
fetchImpl?: typeof fetch;
|
|
13
|
-
serializer: Serializer;
|
|
14
|
-
onRequest?: (ctx: {
|
|
15
|
-
url: string;
|
|
16
|
-
headers: Record<string, string>;
|
|
17
|
-
}) => void | Promise<void>;
|
|
18
|
-
contexts?: Array<IAsyncContext<any>>;
|
|
19
|
-
errorRegistry?: Map<string, any>;
|
|
20
|
-
}
|
|
21
|
-
export interface MixedHttpClient {
|
|
22
|
-
task<I = unknown, O = unknown>(id: string, input?: I): Promise<O | Readable | ReadableStream<Uint8Array>>;
|
|
23
|
-
event<P = unknown>(id: string, payload?: P): Promise<void>;
|
|
24
|
-
}
|
|
25
|
-
/**
|
|
26
|
-
* Unified Node client that mixes JSON/EJSON fetch for standard calls and
|
|
27
|
-
* Smart client for streaming/multipart. Keeps transport details out of app code.
|
|
28
|
-
*/
|
|
29
|
-
export declare function createHttpMixedClient(cfg: MixedHttpClientConfig): MixedHttpClient;
|
|
30
|
-
export type { Readable };
|
|
@@ -1,24 +0,0 @@
|
|
|
1
|
-
import { Readable } from "stream";
|
|
2
|
-
import type { Serializer } from "../globals/resources/tunnel/serializer";
|
|
3
|
-
import type { IAsyncContext } from "../types/asyncContext";
|
|
4
|
-
export interface HttpSmartClientAuthConfig {
|
|
5
|
-
header?: string;
|
|
6
|
-
token: string;
|
|
7
|
-
}
|
|
8
|
-
export interface HttpSmartClientConfig {
|
|
9
|
-
baseUrl: string;
|
|
10
|
-
auth?: HttpSmartClientAuthConfig;
|
|
11
|
-
timeoutMs?: number;
|
|
12
|
-
serializer: Serializer;
|
|
13
|
-
onRequest?: (ctx: {
|
|
14
|
-
url: string;
|
|
15
|
-
headers: Record<string, string>;
|
|
16
|
-
}) => void | Promise<void>;
|
|
17
|
-
contexts?: Array<IAsyncContext<any>>;
|
|
18
|
-
}
|
|
19
|
-
export interface HttpSmartClient {
|
|
20
|
-
task<I = unknown, O = unknown>(id: string, input?: I): Promise<O | Readable>;
|
|
21
|
-
event<P = unknown>(id: string, payload?: P): Promise<void>;
|
|
22
|
-
}
|
|
23
|
-
export declare function createHttpSmartClient(cfg: HttpSmartClientConfig): HttpSmartClient;
|
|
24
|
-
export type { Readable };
|
package/dist/node/index.d.ts
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export * from "./node";
|
|
@@ -1,22 +0,0 @@
|
|
|
1
|
-
import type { InputFile } from "../types/inputFile";
|
|
2
|
-
import { Readable } from "stream";
|
|
3
|
-
export type NodeReadable = Readable;
|
|
4
|
-
export declare class NodeInputFile implements InputFile<NodeReadable> {
|
|
5
|
-
name: string;
|
|
6
|
-
type?: string | undefined;
|
|
7
|
-
size?: number | undefined;
|
|
8
|
-
lastModified?: number | undefined;
|
|
9
|
-
extra?: Record<string, unknown> | undefined;
|
|
10
|
-
private _stream;
|
|
11
|
-
private _consumed;
|
|
12
|
-
constructor(meta: Omit<InputFile<NodeReadable>, "resolve" | "stream" | "toTempFile">, stream: NodeReadable);
|
|
13
|
-
resolve(): Promise<{
|
|
14
|
-
stream: NodeReadable;
|
|
15
|
-
}>;
|
|
16
|
-
stream(): NodeReadable;
|
|
17
|
-
toTempFile(dir?: string): Promise<{
|
|
18
|
-
path: string;
|
|
19
|
-
bytesWritten: number;
|
|
20
|
-
}>;
|
|
21
|
-
}
|
|
22
|
-
export declare function toPassThrough(stream: NodeReadable): NodeReadable;
|
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
import type { InputFile } from "../types/inputFile";
|
|
2
|
-
import type { Readable } from "stream";
|
|
3
|
-
/**
|
|
4
|
-
* Read an InputFile's contents fully into memory as a Buffer.
|
|
5
|
-
* Note: InputFile streams are single-use; this will consume it.
|
|
6
|
-
*/
|
|
7
|
-
export declare function readInputFileToBuffer(file: InputFile<Readable>): Promise<Buffer>;
|
|
8
|
-
/**
|
|
9
|
-
* Write an InputFile's contents to a specific path, returning bytesWritten.
|
|
10
|
-
* Note: InputFile streams are single-use; this will consume it.
|
|
11
|
-
*/
|
|
12
|
-
export declare function writeInputFileToPath(file: InputFile<Readable>, targetPath: string): Promise<{
|
|
13
|
-
bytesWritten: number;
|
|
14
|
-
}>;
|
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
import type { Readable } from "stream";
|
|
2
|
-
import type { InputFileMeta, EjsonFileSentinel } from "../../types/inputFile";
|
|
3
|
-
export interface NodeFileSource {
|
|
4
|
-
stream?: Readable;
|
|
5
|
-
buffer?: Buffer;
|
|
6
|
-
}
|
|
7
|
-
export declare function createFile(meta: InputFileMeta, source: NodeFileSource, id?: string): EjsonFileSentinel & {
|
|
8
|
-
_node: NodeFileSource;
|
|
9
|
-
};
|
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
import type { MixedHttpClient } from "../http-mixed-client";
|
|
2
|
-
export interface HttpMixedClientFactoryConfig {
|
|
3
|
-
baseUrl: string;
|
|
4
|
-
auth?: {
|
|
5
|
-
header?: string;
|
|
6
|
-
token: string;
|
|
7
|
-
};
|
|
8
|
-
timeoutMs?: number;
|
|
9
|
-
fetchImpl?: typeof fetch;
|
|
10
|
-
onRequest?: (ctx: {
|
|
11
|
-
url: string;
|
|
12
|
-
headers: Record<string, string>;
|
|
13
|
-
}) => void | Promise<void>;
|
|
14
|
-
}
|
|
15
|
-
export type HttpMixedClientFactory = (config: HttpMixedClientFactoryConfig) => MixedHttpClient;
|
|
16
|
-
export declare const httpMixedClientFactory: import("..").IResource<void, Promise<HttpMixedClientFactory>, {}, any, any, import("..").TagType[], import("..").ResourceMiddlewareAttachmentType[]>;
|
|
17
|
-
export type { MixedHttpClient };
|
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
import type { HttpSmartClient } from "../http-smart-client.model";
|
|
2
|
-
export interface HttpSmartClientFactoryConfig {
|
|
3
|
-
baseUrl: string;
|
|
4
|
-
auth?: {
|
|
5
|
-
header?: string;
|
|
6
|
-
token: string;
|
|
7
|
-
};
|
|
8
|
-
timeoutMs?: number;
|
|
9
|
-
onRequest?: (ctx: {
|
|
10
|
-
url: string;
|
|
11
|
-
headers: Record<string, string>;
|
|
12
|
-
}) => void | Promise<void>;
|
|
13
|
-
}
|
|
14
|
-
export type HttpSmartClientFactory = (config: HttpSmartClientFactoryConfig) => HttpSmartClient;
|
|
15
|
-
export declare const httpSmartClientFactory: import("..").IResource<void, Promise<HttpSmartClientFactory>, {}, any, any, import("..").TagType[], import("..").ResourceMiddlewareAttachmentType[]>;
|
|
16
|
-
export type { HttpSmartClient };
|
|
@@ -1,22 +0,0 @@
|
|
|
1
|
-
import type { Readable } from "stream";
|
|
2
|
-
import type { InputFileMeta } from "../../types/inputFile";
|
|
3
|
-
export interface NodeFileSource {
|
|
4
|
-
id: string;
|
|
5
|
-
meta: InputFileMeta;
|
|
6
|
-
source: {
|
|
7
|
-
type: "buffer";
|
|
8
|
-
buffer: Buffer;
|
|
9
|
-
} | {
|
|
10
|
-
type: "stream";
|
|
11
|
-
stream: Readable;
|
|
12
|
-
};
|
|
13
|
-
}
|
|
14
|
-
export interface BuiltManifest<T = any> {
|
|
15
|
-
input: T;
|
|
16
|
-
files: NodeFileSource[];
|
|
17
|
-
}
|
|
18
|
-
/**
|
|
19
|
-
* Walk an input object and collect File sentinels having local Node sources.
|
|
20
|
-
* It returns a shallow-cloned structure where any internal _node fields are removed.
|
|
21
|
-
*/
|
|
22
|
-
export declare function buildNodeManifest<T = any>(input: T): BuiltManifest<T>;
|
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
import type { IAsyncLocalStorage, IPlatformAdapter, PlatformId } from "../types";
|
|
2
|
-
export declare class BrowserPlatformAdapter implements IPlatformAdapter {
|
|
3
|
-
readonly id: PlatformId;
|
|
4
|
-
init(): Promise<void>;
|
|
5
|
-
onUncaughtException(handler: (error: any) => void): () => any;
|
|
6
|
-
onUnhandledRejection(handler: (reason: any) => void): () => any;
|
|
7
|
-
onShutdownSignal(handler: () => void): () => void;
|
|
8
|
-
exit(): void;
|
|
9
|
-
getEnv(key: string): any;
|
|
10
|
-
hasAsyncLocalStorage(): boolean;
|
|
11
|
-
createAsyncLocalStorage<T>(): IAsyncLocalStorage<T>;
|
|
12
|
-
setTimeout: typeof setTimeout;
|
|
13
|
-
clearTimeout: typeof clearTimeout;
|
|
14
|
-
}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export declare function loadAsyncLocalStorageClass(): Promise<any>;
|
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
import type { IAsyncLocalStorage, IPlatformAdapter } from "../types";
|
|
2
|
-
export declare class NodePlatformAdapter implements IPlatformAdapter {
|
|
3
|
-
readonly id: "node";
|
|
4
|
-
private alsClass;
|
|
5
|
-
init(): Promise<void>;
|
|
6
|
-
onUncaughtException(handler: (error: any) => void): () => NodeJS.Process;
|
|
7
|
-
onUnhandledRejection(handler: (reason: any) => void): () => NodeJS.Process;
|
|
8
|
-
onShutdownSignal(handler: () => void): () => void;
|
|
9
|
-
exit(code: number): void;
|
|
10
|
-
getEnv(key: string): string | undefined;
|
|
11
|
-
hasAsyncLocalStorage(): boolean;
|
|
12
|
-
createAsyncLocalStorage<T>(): IAsyncLocalStorage<T>;
|
|
13
|
-
setTimeout: typeof setTimeout;
|
|
14
|
-
clearTimeout: typeof clearTimeout;
|
|
15
|
-
}
|
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
import type { IAsyncLocalStorage, IPlatformAdapter } from "../types";
|
|
2
|
-
export declare class GenericUniversalPlatformAdapter implements IPlatformAdapter {
|
|
3
|
-
readonly id: "universal";
|
|
4
|
-
init(): Promise<void>;
|
|
5
|
-
onUncaughtException(handler: (error: any) => void): () => any;
|
|
6
|
-
onUnhandledRejection(handler: (reason: any) => void): () => any;
|
|
7
|
-
onShutdownSignal(handler: () => void): () => void;
|
|
8
|
-
exit(): void;
|
|
9
|
-
getEnv(key: string): string | undefined;
|
|
10
|
-
hasAsyncLocalStorage(): boolean;
|
|
11
|
-
createAsyncLocalStorage<T>(): IAsyncLocalStorage<T>;
|
|
12
|
-
setTimeout: typeof setTimeout;
|
|
13
|
-
clearTimeout: typeof clearTimeout;
|
|
14
|
-
}
|
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
import type { IPlatformAdapter, PlatformId } from "../types";
|
|
2
|
-
export declare function detectEnvironment(): PlatformId;
|
|
3
|
-
export declare class UniversalPlatformAdapter implements IPlatformAdapter {
|
|
4
|
-
readonly id: PlatformId;
|
|
5
|
-
private inner;
|
|
6
|
-
init(): Promise<void>;
|
|
7
|
-
private get;
|
|
8
|
-
onUncaughtException(handler: (error: Error) => void): () => void;
|
|
9
|
-
onUnhandledRejection(handler: (reason: unknown) => void): () => void;
|
|
10
|
-
onShutdownSignal(handler: () => void): () => void;
|
|
11
|
-
exit(code: number): void;
|
|
12
|
-
getEnv(key: string): string | undefined;
|
|
13
|
-
hasAsyncLocalStorage(): boolean;
|
|
14
|
-
createAsyncLocalStorage<T>(): import("..").IAsyncLocalStorage<T>;
|
|
15
|
-
setTimeout: typeof setTimeout;
|
|
16
|
-
clearTimeout: typeof clearTimeout;
|
|
17
|
-
}
|
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
import type { InputFileMeta, EjsonFileSentinel } from "../types/inputFile";
|
|
2
|
-
/**
|
|
3
|
-
* Universal/browser `createFile` helper. For Node, import from `@bluelibs/runner/node`.
|
|
4
|
-
*/
|
|
5
|
-
export declare function createFile(meta: InputFileMeta, blob: Blob, id?: string): EjsonFileSentinel & {
|
|
6
|
-
_web: {
|
|
7
|
-
blob: Blob;
|
|
8
|
-
};
|
|
9
|
-
};
|
|
10
|
-
export type { EjsonFileSentinel };
|
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
import type { InputFileMeta, EjsonFileSentinel } from "../types/inputFile";
|
|
2
|
-
/**
|
|
3
|
-
* Browser/edge-friendly File sentinel creator.
|
|
4
|
-
* Produces the same public EJSON File shape with a browser sidecar `_web`.
|
|
5
|
-
* The sidecar will be stripped out by the universal manifest walker before upload.
|
|
6
|
-
*/
|
|
7
|
-
export declare function createWebFile(meta: InputFileMeta, blob: Blob, id?: string): EjsonFileSentinel & {
|
|
8
|
-
_web: {
|
|
9
|
-
blob: Blob;
|
|
10
|
-
};
|
|
11
|
-
};
|
package/dist/platform/index.d.ts
DELETED
|
@@ -1,27 +0,0 @@
|
|
|
1
|
-
import type { IPlatformAdapter, IAsyncLocalStorage, PlatformId } from "./types";
|
|
2
|
-
import { detectEnvironment } from "./adapters/universal";
|
|
3
|
-
export { detectEnvironment };
|
|
4
|
-
export declare function getPlatform(): IPlatformAdapter;
|
|
5
|
-
export declare function setPlatform(adapter: IPlatformAdapter): void;
|
|
6
|
-
export declare function resetPlatform(): void;
|
|
7
|
-
export declare function getDetectedEnvironment(): PlatformId;
|
|
8
|
-
export declare function isNode(): boolean;
|
|
9
|
-
export declare function isBrowser(): boolean;
|
|
10
|
-
export declare function isUniversal(): boolean;
|
|
11
|
-
export type { IPlatformAdapter, IAsyncLocalStorage } from "./types";
|
|
12
|
-
export declare class PlatformAdapter implements IPlatformAdapter {
|
|
13
|
-
private inner;
|
|
14
|
-
readonly env: PlatformId;
|
|
15
|
-
readonly id: PlatformId;
|
|
16
|
-
constructor(env?: PlatformId);
|
|
17
|
-
init(): Promise<void>;
|
|
18
|
-
onUncaughtException(handler: (error: any) => void): () => void;
|
|
19
|
-
onUnhandledRejection(handler: (reason: any) => void): () => void;
|
|
20
|
-
onShutdownSignal(handler: () => void): () => void;
|
|
21
|
-
exit(code: number): void;
|
|
22
|
-
getEnv(key: string): string | undefined;
|
|
23
|
-
hasAsyncLocalStorage(): boolean;
|
|
24
|
-
createAsyncLocalStorage<T>(): IAsyncLocalStorage<T>;
|
|
25
|
-
setTimeout: typeof setTimeout;
|
|
26
|
-
clearTimeout: typeof clearTimeout;
|
|
27
|
-
}
|
package/dist/platform/types.d.ts
DELETED
|
@@ -1,29 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Platform abstraction interface for universal compatibility
|
|
3
|
-
* Inspired by Remix's approach to Web APIs and runtime-agnostic design
|
|
4
|
-
*/
|
|
5
|
-
export type PlatformId = "node" | "browser" | "edge" | "universal";
|
|
6
|
-
export interface IPlatformAdapter {
|
|
7
|
-
readonly id: PlatformId;
|
|
8
|
-
onUncaughtException(handler: (error: Error) => void): () => void;
|
|
9
|
-
onUnhandledRejection(handler: (reason: unknown) => void): () => void;
|
|
10
|
-
onShutdownSignal(handler: () => void): () => void;
|
|
11
|
-
exit(code: number): void;
|
|
12
|
-
getEnv(key: string): string | undefined;
|
|
13
|
-
hasAsyncLocalStorage(): boolean;
|
|
14
|
-
createAsyncLocalStorage<T>(): IAsyncLocalStorage<T>;
|
|
15
|
-
setTimeout: typeof globalThis.setTimeout;
|
|
16
|
-
clearTimeout: typeof globalThis.clearTimeout;
|
|
17
|
-
init: () => Promise<void>;
|
|
18
|
-
}
|
|
19
|
-
export interface IAsyncLocalStorage<T> {
|
|
20
|
-
getStore(): T | undefined;
|
|
21
|
-
run<R>(store: T, callback: () => R): R;
|
|
22
|
-
}
|
|
23
|
-
/**
|
|
24
|
-
* Utility functions for environment detection
|
|
25
|
-
*/
|
|
26
|
-
export declare function isNode(): boolean;
|
|
27
|
-
export declare function isBrowser(): boolean;
|
|
28
|
-
export declare function isWebWorker(): boolean;
|
|
29
|
-
export declare function isUniversal(): boolean;
|
package/dist/processHooks.d.ts
DELETED
package/dist/run.d.ts
DELETED
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
import { IResource, IResourceWithConfig } from "./defs";
|
|
2
|
-
import { RunResult } from "./models/RunResult";
|
|
3
|
-
import { RunOptions } from "./types/runner";
|
|
4
|
-
/**
|
|
5
|
-
* This is the central function that kicks off you runner. You can run as many resources as you want in a single process, they will run in complete isolation.
|
|
6
|
-
*
|
|
7
|
-
* @param resourceOrResourceWithConfig - The resource or resource with config to run.
|
|
8
|
-
* @param options - The options for the run.
|
|
9
|
-
* @returns A promise that resolves to the result of the run.
|
|
10
|
-
*/
|
|
11
|
-
export declare function run<C, V extends Promise<any>>(resourceOrResourceWithConfig: IResourceWithConfig<C, V> | IResource<void, V, any, any> | IResource<{
|
|
12
|
-
[K in any]?: any;
|
|
13
|
-
}, V, any, any>, // For optional config
|
|
14
|
-
options?: RunOptions): Promise<RunResult<V extends Promise<infer U> ? U : V>>;
|
package/dist/testing.d.ts
DELETED
|
@@ -1,25 +0,0 @@
|
|
|
1
|
-
import { IResource, IResourceWithConfig, ITaskMiddleware, IResourceMiddleware, ITask, RegisterableItems, DependencyMapType } from "./defs";
|
|
2
|
-
import { EventManager, Logger, Store, TaskRunner } from "./models";
|
|
3
|
-
/**
|
|
4
|
-
* Helper to create a minimal test harness resource that wraps a root app (or any registerable)
|
|
5
|
-
* and exposes convenient testing utilities while running the full ecosystem
|
|
6
|
-
* (registration, overrides, middleware, events) without modifying the core API.
|
|
7
|
-
* @deprecated Use `run` instead with your testResource, as it provides the necessary toolkit.
|
|
8
|
-
*/
|
|
9
|
-
export declare function createTestResource(root: RegisterableItems, options?: {
|
|
10
|
-
overrides?: Array<IResource | ITask | ITaskMiddleware | IResourceMiddleware | IResourceWithConfig>;
|
|
11
|
-
}): IResource<void, Promise<ReturnType<typeof buildTestFacade>>>;
|
|
12
|
-
declare function buildTestFacade(deps: {
|
|
13
|
-
taskRunner: TaskRunner;
|
|
14
|
-
store: Store;
|
|
15
|
-
logger: Logger;
|
|
16
|
-
eventManager: EventManager;
|
|
17
|
-
}): {
|
|
18
|
-
runTask: <I, O extends Promise<any>, D extends DependencyMapType>(task: ITask<I, O, D>, ...args: I extends undefined ? [] : [I]) => Promise<Awaited<O> | undefined>;
|
|
19
|
-
getResource: (id: string) => any;
|
|
20
|
-
taskRunner: TaskRunner;
|
|
21
|
-
store: Store;
|
|
22
|
-
logger: Logger;
|
|
23
|
-
eventManager: EventManager;
|
|
24
|
-
};
|
|
25
|
-
export {};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export declare function getCallerFile(): string;
|
|
@@ -1,24 +0,0 @@
|
|
|
1
|
-
import type { Readable } from "stream";
|
|
2
|
-
import type { InputFileMeta } from "../types/inputFile";
|
|
3
|
-
export interface NodeCollectedFile {
|
|
4
|
-
id: string;
|
|
5
|
-
meta: InputFileMeta;
|
|
6
|
-
source: {
|
|
7
|
-
type: "buffer";
|
|
8
|
-
buffer: Buffer;
|
|
9
|
-
} | {
|
|
10
|
-
type: "stream";
|
|
11
|
-
stream: Readable;
|
|
12
|
-
};
|
|
13
|
-
}
|
|
14
|
-
export interface WebCollectedFile {
|
|
15
|
-
id: string;
|
|
16
|
-
meta: InputFileMeta;
|
|
17
|
-
blob: Blob;
|
|
18
|
-
}
|
|
19
|
-
export interface BuiltUniversalManifest<T = any> {
|
|
20
|
-
input: T;
|
|
21
|
-
nodeFiles: NodeCollectedFile[];
|
|
22
|
-
webFiles: WebCollectedFile[];
|
|
23
|
-
}
|
|
24
|
-
export declare function buildUniversalManifest<T = any>(input: T): BuiltUniversalManifest<T>;
|
|
@@ -1,41 +0,0 @@
|
|
|
1
|
-
export declare const ASYNC_CONTEXT_TYPES_LOADED: true;
|
|
2
|
-
import { symbolAsyncContext } from "./symbols";
|
|
3
|
-
import { ITaskMiddlewareConfigured } from "./taskMiddleware";
|
|
4
|
-
import type { IValidationSchema, IOptionalDependency } from "./utilities";
|
|
5
|
-
import type { IAsyncContextMeta } from "./meta";
|
|
6
|
-
export interface IAsyncContextDefinition<T> {
|
|
7
|
-
id: string;
|
|
8
|
-
serialize?(data: T): string;
|
|
9
|
-
parse?(data: string): T;
|
|
10
|
-
/**
|
|
11
|
-
* When provided, context values will be validated when provide() is called.
|
|
12
|
-
*/
|
|
13
|
-
configSchema?: IValidationSchema<T>;
|
|
14
|
-
meta?: IAsyncContextMeta;
|
|
15
|
-
}
|
|
16
|
-
/**
|
|
17
|
-
* The generic AsyncContext object returned by `defineAsyncContext`.
|
|
18
|
-
*/
|
|
19
|
-
export interface IAsyncContext<T> {
|
|
20
|
-
/** unique symbol used as key in the AsyncLocalStorage map */
|
|
21
|
-
readonly id: string;
|
|
22
|
-
/** Brand marker for registration and runtime checks */
|
|
23
|
-
[symbolAsyncContext]: true;
|
|
24
|
-
/** Retrieve the current context value or throw */
|
|
25
|
-
use(): T;
|
|
26
|
-
/**
|
|
27
|
-
* Provide a value for this context during the lifetime of `fn()`
|
|
28
|
-
*/
|
|
29
|
-
provide<R>(value: T, fn: () => Promise<R> | R): Promise<R> | R;
|
|
30
|
-
/**
|
|
31
|
-
* Generates a middleware that guarantees the context exists (and optionally
|
|
32
|
-
* enforces that certain keys are present on the context object).
|
|
33
|
-
*/
|
|
34
|
-
require<K extends keyof T = never>(keys?: K[]): ITaskMiddlewareConfigured<{
|
|
35
|
-
context: IAsyncContext<T>;
|
|
36
|
-
}>;
|
|
37
|
-
serialize(data: T): string;
|
|
38
|
-
parse(data: string): T;
|
|
39
|
-
/** Return an optional dependency wrapper for this context */
|
|
40
|
-
optional(): IOptionalDependency<IAsyncContext<T>>;
|
|
41
|
-
}
|