@rivetkit/engine-api-full 25.5.3
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/dist/browser/cjs/core.js +2297 -0
- package/dist/browser/cjs/index.js +3752 -0
- package/dist/browser/cjs/serialization.js +1744 -0
- package/dist/browser/esm/core.js +2271 -0
- package/dist/browser/esm/index.js +3726 -0
- package/dist/browser/esm/serialization.js +1717 -0
- package/dist/node/core.js +2310 -0
- package/dist/node/index.js +3765 -0
- package/dist/node/serialization.js +1782 -0
- package/package.json +59 -0
- package/types/Client.d.ts +241 -0
- package/types/api/client/index.d.ts +1 -0
- package/types/api/client/requests/ActorsCreateRequest.d.ts +22 -0
- package/types/api/client/requests/ActorsDeleteRequest.d.ts +10 -0
- package/types/api/client/requests/ActorsGetByIdRequest.d.ts +16 -0
- package/types/api/client/requests/ActorsGetOrCreateByIdRequest.d.ts +23 -0
- package/types/api/client/requests/ActorsGetOrCreateRequest.d.ts +23 -0
- package/types/api/client/requests/ActorsGetRequest.d.ts +10 -0
- package/types/api/client/requests/ActorsListNamesRequest.d.ts +14 -0
- package/types/api/client/requests/ActorsListRequest.d.ts +18 -0
- package/types/api/client/requests/index.d.ts +8 -0
- package/types/api/index.d.ts +3 -0
- package/types/api/resources/datacenters/client/Client.d.ts +34 -0
- package/types/api/resources/datacenters/client/index.d.ts +1 -0
- package/types/api/resources/datacenters/index.d.ts +1 -0
- package/types/api/resources/index.d.ts +5 -0
- package/types/api/resources/namespaces/client/Client.d.ts +54 -0
- package/types/api/resources/namespaces/client/index.d.ts +1 -0
- package/types/api/resources/namespaces/client/requests/NamespacesCreateRequest.d.ts +14 -0
- package/types/api/resources/namespaces/client/requests/NamespacesListRequest.d.ts +12 -0
- package/types/api/resources/namespaces/client/requests/index.d.ts +2 -0
- package/types/api/resources/namespaces/index.d.ts +1 -0
- package/types/api/resources/runners/client/Client.d.ts +61 -0
- package/types/api/resources/runners/client/index.d.ts +1 -0
- package/types/api/resources/runners/client/requests/RunnersGetRequest.d.ts +10 -0
- package/types/api/resources/runners/client/requests/RunnersListNamesRequest.d.ts +14 -0
- package/types/api/resources/runners/client/requests/RunnersListRequest.d.ts +16 -0
- package/types/api/resources/runners/client/requests/index.d.ts +3 -0
- package/types/api/resources/runners/index.d.ts +1 -0
- package/types/api/types/Actor.d.ts +19 -0
- package/types/api/types/ActorName.d.ts +6 -0
- package/types/api/types/ActorsCreateResponse.d.ts +7 -0
- package/types/api/types/ActorsDeleteResponse.d.ts +4 -0
- package/types/api/types/ActorsGetByIdResponse.d.ts +7 -0
- package/types/api/types/ActorsGetOrCreateByIdResponse.d.ts +8 -0
- package/types/api/types/ActorsGetOrCreateResponse.d.ts +8 -0
- package/types/api/types/ActorsGetResponse.d.ts +7 -0
- package/types/api/types/ActorsListNamesResponse.d.ts +8 -0
- package/types/api/types/ActorsListResponse.d.ts +8 -0
- package/types/api/types/CrashPolicy.d.ts +9 -0
- package/types/api/types/Datacenter.d.ts +8 -0
- package/types/api/types/DatacentersListResponse.d.ts +8 -0
- package/types/api/types/Namespace.d.ts +10 -0
- package/types/api/types/NamespacesCreateResponse.d.ts +7 -0
- package/types/api/types/NamespacesGetResponse.d.ts +7 -0
- package/types/api/types/NamespacesListResponse.d.ts +8 -0
- package/types/api/types/Pagination.d.ts +6 -0
- package/types/api/types/RivetId.d.ts +4 -0
- package/types/api/types/Runner.d.ts +24 -0
- package/types/api/types/RunnersGetResponse.d.ts +7 -0
- package/types/api/types/RunnersListNamesResponse.d.ts +8 -0
- package/types/api/types/RunnersListResponse.d.ts +8 -0
- package/types/api/types/StringHttpAddressHashableMap.d.ts +5 -0
- package/types/api/types/StringHttpAddressHashableMapValue.d.ts +7 -0
- package/types/api/types/StringTcpAddressHashableMap.d.ts +5 -0
- package/types/api/types/StringTcpAddressHashableMapValue.d.ts +7 -0
- package/types/api/types/StringUdpAddressHashableMap.d.ts +5 -0
- package/types/api/types/StringUdpAddressHashableMapValue.d.ts +7 -0
- package/types/api/types/index.d.ts +29 -0
- package/types/core/fetcher/APIResponse.d.ts +10 -0
- package/types/core/fetcher/Fetcher.d.ts +39 -0
- package/types/core/fetcher/Supplier.d.ts +4 -0
- package/types/core/fetcher/createRequestUrl.d.ts +1 -0
- package/types/core/fetcher/getFetchFn.d.ts +4 -0
- package/types/core/fetcher/getHeader.d.ts +1 -0
- package/types/core/fetcher/getRequestBody.d.ts +7 -0
- package/types/core/fetcher/getResponseBody.d.ts +1 -0
- package/types/core/fetcher/index.d.ts +5 -0
- package/types/core/fetcher/makeRequest.d.ts +1 -0
- package/types/core/fetcher/requestWithRetries.d.ts +1 -0
- package/types/core/fetcher/signals.d.ts +11 -0
- package/types/core/fetcher/stream-wrappers/Node18UniversalStreamWrapper.d.ts +30 -0
- package/types/core/fetcher/stream-wrappers/NodePre18StreamWrapper.d.ts +21 -0
- package/types/core/fetcher/stream-wrappers/UndiciStreamWrapper.d.ts +31 -0
- package/types/core/fetcher/stream-wrappers/chooseStreamWrapper.d.ts +18 -0
- package/types/core/index.d.ts +3 -0
- package/types/core/json.d.ts +15 -0
- package/types/core/runtime/index.d.ts +1 -0
- package/types/core/runtime/runtime.d.ts +9 -0
- package/types/core/schemas/Schema.d.ts +87 -0
- package/types/core/schemas/builders/bigint/bigint.d.ts +2 -0
- package/types/core/schemas/builders/bigint/index.d.ts +1 -0
- package/types/core/schemas/builders/date/date.d.ts +2 -0
- package/types/core/schemas/builders/date/index.d.ts +1 -0
- package/types/core/schemas/builders/enum/enum.d.ts +2 -0
- package/types/core/schemas/builders/enum/index.d.ts +1 -0
- package/types/core/schemas/builders/index.d.ts +14 -0
- package/types/core/schemas/builders/lazy/index.d.ts +3 -0
- package/types/core/schemas/builders/lazy/lazy.d.ts +5 -0
- package/types/core/schemas/builders/lazy/lazyObject.d.ts +3 -0
- package/types/core/schemas/builders/list/index.d.ts +1 -0
- package/types/core/schemas/builders/list/list.d.ts +2 -0
- package/types/core/schemas/builders/literals/booleanLiteral.d.ts +2 -0
- package/types/core/schemas/builders/literals/index.d.ts +2 -0
- package/types/core/schemas/builders/literals/stringLiteral.d.ts +2 -0
- package/types/core/schemas/builders/object/index.d.ts +6 -0
- package/types/core/schemas/builders/object/object.d.ts +3 -0
- package/types/core/schemas/builders/object/objectWithoutOptionalProperties.d.ts +6 -0
- package/types/core/schemas/builders/object/property.d.ts +8 -0
- package/types/core/schemas/builders/object/types.d.ts +31 -0
- package/types/core/schemas/builders/object-like/getObjectLikeUtils.d.ts +9 -0
- package/types/core/schemas/builders/object-like/index.d.ts +2 -0
- package/types/core/schemas/builders/object-like/types.d.ts +7 -0
- package/types/core/schemas/builders/primitives/any.d.ts +1 -0
- package/types/core/schemas/builders/primitives/boolean.d.ts +1 -0
- package/types/core/schemas/builders/primitives/index.d.ts +5 -0
- package/types/core/schemas/builders/primitives/number.d.ts +1 -0
- package/types/core/schemas/builders/primitives/string.d.ts +1 -0
- package/types/core/schemas/builders/primitives/unknown.d.ts +1 -0
- package/types/core/schemas/builders/record/index.d.ts +2 -0
- package/types/core/schemas/builders/record/record.d.ts +3 -0
- package/types/core/schemas/builders/record/types.d.ts +4 -0
- package/types/core/schemas/builders/schema-utils/JsonError.d.ts +5 -0
- package/types/core/schemas/builders/schema-utils/ParseError.d.ts +5 -0
- package/types/core/schemas/builders/schema-utils/getSchemaUtils.d.ts +21 -0
- package/types/core/schemas/builders/schema-utils/index.d.ts +4 -0
- package/types/core/schemas/builders/schema-utils/stringifyValidationErrors.d.ts +2 -0
- package/types/core/schemas/builders/set/index.d.ts +1 -0
- package/types/core/schemas/builders/set/set.d.ts +2 -0
- package/types/core/schemas/builders/undiscriminated-union/index.d.ts +2 -0
- package/types/core/schemas/builders/undiscriminated-union/types.d.ts +4 -0
- package/types/core/schemas/builders/undiscriminated-union/undiscriminatedUnion.d.ts +3 -0
- package/types/core/schemas/builders/union/discriminant.d.ts +5 -0
- package/types/core/schemas/builders/union/index.d.ts +4 -0
- package/types/core/schemas/builders/union/types.d.ts +13 -0
- package/types/core/schemas/builders/union/union.d.ts +4 -0
- package/types/core/schemas/index.d.ts +2 -0
- package/types/core/schemas/utils/MaybePromise.d.ts +1 -0
- package/types/core/schemas/utils/addQuestionMarksToNullableProperties.d.ts +7 -0
- package/types/core/schemas/utils/createIdentitySchemaCreator.d.ts +2 -0
- package/types/core/schemas/utils/entries.d.ts +1 -0
- package/types/core/schemas/utils/filterObject.d.ts +1 -0
- package/types/core/schemas/utils/getErrorMessageForIncorrectType.d.ts +1 -0
- package/types/core/schemas/utils/isPlainObject.d.ts +1 -0
- package/types/core/schemas/utils/keys.d.ts +1 -0
- package/types/core/schemas/utils/maybeSkipValidation.d.ts +2 -0
- package/types/core/schemas/utils/partition.d.ts +1 -0
- package/types/errors/RivetError.d.ts +12 -0
- package/types/errors/RivetTimeoutError.d.ts +6 -0
- package/types/errors/index.d.ts +2 -0
- package/types/index.d.ts +4 -0
- package/types/serialization/client/index.d.ts +1 -0
- package/types/serialization/client/requests/ActorsCreateRequest.d.ts +17 -0
- package/types/serialization/client/requests/ActorsGetOrCreateByIdRequest.d.ts +17 -0
- package/types/serialization/client/requests/ActorsGetOrCreateRequest.d.ts +17 -0
- package/types/serialization/client/requests/index.d.ts +3 -0
- package/types/serialization/index.d.ts +3 -0
- package/types/serialization/resources/index.d.ts +2 -0
- package/types/serialization/resources/namespaces/client/index.d.ts +1 -0
- package/types/serialization/resources/namespaces/client/requests/NamespacesCreateRequest.d.ts +13 -0
- package/types/serialization/resources/namespaces/client/requests/index.d.ts +1 -0
- package/types/serialization/resources/namespaces/index.d.ts +1 -0
- package/types/serialization/types/Actor.d.ts +26 -0
- package/types/serialization/types/ActorName.d.ts +12 -0
- package/types/serialization/types/ActorsCreateResponse.d.ts +13 -0
- package/types/serialization/types/ActorsDeleteResponse.d.ts +10 -0
- package/types/serialization/types/ActorsGetByIdResponse.d.ts +13 -0
- package/types/serialization/types/ActorsGetOrCreateByIdResponse.d.ts +14 -0
- package/types/serialization/types/ActorsGetOrCreateResponse.d.ts +14 -0
- package/types/serialization/types/ActorsGetResponse.d.ts +13 -0
- package/types/serialization/types/ActorsListNamesResponse.d.ts +15 -0
- package/types/serialization/types/ActorsListResponse.d.ts +15 -0
- package/types/serialization/types/CrashPolicy.d.ts +10 -0
- package/types/serialization/types/Datacenter.d.ts +14 -0
- package/types/serialization/types/DatacentersListResponse.d.ts +15 -0
- package/types/serialization/types/Namespace.d.ts +16 -0
- package/types/serialization/types/NamespacesCreateResponse.d.ts +13 -0
- package/types/serialization/types/NamespacesGetResponse.d.ts +13 -0
- package/types/serialization/types/NamespacesListResponse.d.ts +15 -0
- package/types/serialization/types/Pagination.d.ts +12 -0
- package/types/serialization/types/RivetId.d.ts +10 -0
- package/types/serialization/types/Runner.d.ts +33 -0
- package/types/serialization/types/RunnersGetResponse.d.ts +13 -0
- package/types/serialization/types/RunnersListNamesResponse.d.ts +14 -0
- package/types/serialization/types/RunnersListResponse.d.ts +15 -0
- package/types/serialization/types/StringHttpAddressHashableMap.d.ts +11 -0
- package/types/serialization/types/StringHttpAddressHashableMapValue.d.ts +13 -0
- package/types/serialization/types/StringTcpAddressHashableMap.d.ts +11 -0
- package/types/serialization/types/StringTcpAddressHashableMapValue.d.ts +13 -0
- package/types/serialization/types/StringUdpAddressHashableMap.d.ts +11 -0
- package/types/serialization/types/StringUdpAddressHashableMapValue.d.ts +13 -0
- package/types/serialization/types/index.d.ts +29 -0
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* This file was auto-generated by Fern from our API Definition.
|
|
3
|
+
*/
|
|
4
|
+
/**
|
|
5
|
+
* @example
|
|
6
|
+
* {
|
|
7
|
+
* namespace: "namespace"
|
|
8
|
+
* }
|
|
9
|
+
*/
|
|
10
|
+
export interface RunnersListRequest {
|
|
11
|
+
namespace: string;
|
|
12
|
+
name?: string;
|
|
13
|
+
includeStopped?: boolean;
|
|
14
|
+
limit?: number;
|
|
15
|
+
cursor?: string;
|
|
16
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from "./client";
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* This file was auto-generated by Fern from our API Definition.
|
|
3
|
+
*/
|
|
4
|
+
import * as Rivet from "../index";
|
|
5
|
+
export interface Actor {
|
|
6
|
+
actorId: Rivet.RivetId;
|
|
7
|
+
connectableTs?: number;
|
|
8
|
+
crashPolicy: Rivet.CrashPolicy;
|
|
9
|
+
createTs: number;
|
|
10
|
+
datacenter: string;
|
|
11
|
+
destroyTs?: number;
|
|
12
|
+
key?: string;
|
|
13
|
+
name: string;
|
|
14
|
+
namespaceId: Rivet.RivetId;
|
|
15
|
+
pendingAllocationTs?: number;
|
|
16
|
+
runnerNameSelector: string;
|
|
17
|
+
sleepTs?: number;
|
|
18
|
+
startTs?: number;
|
|
19
|
+
}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* This file was auto-generated by Fern from our API Definition.
|
|
3
|
+
*/
|
|
4
|
+
export type CrashPolicy = "restart" | "sleep" | "destroy";
|
|
5
|
+
export declare const CrashPolicy: {
|
|
6
|
+
readonly Restart: "restart";
|
|
7
|
+
readonly Sleep: "sleep";
|
|
8
|
+
readonly Destroy: "destroy";
|
|
9
|
+
};
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* This file was auto-generated by Fern from our API Definition.
|
|
3
|
+
*/
|
|
4
|
+
import * as Rivet from "../index";
|
|
5
|
+
export interface Runner {
|
|
6
|
+
addressesHttp: Rivet.StringHttpAddressHashableMap;
|
|
7
|
+
addressesTcp: Rivet.StringTcpAddressHashableMap;
|
|
8
|
+
addressesUdp: Rivet.StringUdpAddressHashableMap;
|
|
9
|
+
createTs: number;
|
|
10
|
+
datacenter: string;
|
|
11
|
+
drainTs?: number;
|
|
12
|
+
key: string;
|
|
13
|
+
lastConnectedTs?: number;
|
|
14
|
+
lastPingTs: number;
|
|
15
|
+
lastRtt: number;
|
|
16
|
+
metadata?: Record<string, unknown>;
|
|
17
|
+
name: string;
|
|
18
|
+
namespaceId: Rivet.RivetId;
|
|
19
|
+
remainingSlots: number;
|
|
20
|
+
runnerId: Rivet.RivetId;
|
|
21
|
+
stopTs?: number;
|
|
22
|
+
totalSlots: number;
|
|
23
|
+
version: number;
|
|
24
|
+
}
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
export * from "./Actor";
|
|
2
|
+
export * from "./ActorName";
|
|
3
|
+
export * from "./ActorsCreateResponse";
|
|
4
|
+
export * from "./ActorsDeleteResponse";
|
|
5
|
+
export * from "./ActorsGetByIdResponse";
|
|
6
|
+
export * from "./ActorsGetOrCreateByIdResponse";
|
|
7
|
+
export * from "./ActorsGetOrCreateResponse";
|
|
8
|
+
export * from "./ActorsGetResponse";
|
|
9
|
+
export * from "./ActorsListNamesResponse";
|
|
10
|
+
export * from "./ActorsListResponse";
|
|
11
|
+
export * from "./CrashPolicy";
|
|
12
|
+
export * from "./Datacenter";
|
|
13
|
+
export * from "./DatacentersListResponse";
|
|
14
|
+
export * from "./Namespace";
|
|
15
|
+
export * from "./NamespacesCreateResponse";
|
|
16
|
+
export * from "./NamespacesGetResponse";
|
|
17
|
+
export * from "./NamespacesListResponse";
|
|
18
|
+
export * from "./Pagination";
|
|
19
|
+
export * from "./RivetId";
|
|
20
|
+
export * from "./Runner";
|
|
21
|
+
export * from "./RunnersGetResponse";
|
|
22
|
+
export * from "./RunnersListNamesResponse";
|
|
23
|
+
export * from "./RunnersListResponse";
|
|
24
|
+
export * from "./StringHttpAddressHashableMapValue";
|
|
25
|
+
export * from "./StringHttpAddressHashableMap";
|
|
26
|
+
export * from "./StringTcpAddressHashableMapValue";
|
|
27
|
+
export * from "./StringTcpAddressHashableMap";
|
|
28
|
+
export * from "./StringUdpAddressHashableMapValue";
|
|
29
|
+
export * from "./StringUdpAddressHashableMap";
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
export type APIResponse<Success, Failure> = SuccessfulResponse<Success> | FailedResponse<Failure>;
|
|
2
|
+
export interface SuccessfulResponse<T> {
|
|
3
|
+
ok: true;
|
|
4
|
+
body: T;
|
|
5
|
+
headers?: Record<string, any>;
|
|
6
|
+
}
|
|
7
|
+
export interface FailedResponse<T> {
|
|
8
|
+
ok: false;
|
|
9
|
+
error: T;
|
|
10
|
+
}
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
import { APIResponse } from "./APIResponse";
|
|
2
|
+
export type FetchFunction = <R = unknown>(args: Fetcher.Args) => Promise<APIResponse<R, Fetcher.Error>>;
|
|
3
|
+
export declare namespace Fetcher {
|
|
4
|
+
interface Args {
|
|
5
|
+
url: string;
|
|
6
|
+
method: string;
|
|
7
|
+
contentType?: string;
|
|
8
|
+
headers?: Record<string, string | undefined>;
|
|
9
|
+
queryParameters?: Record<string, string | string[] | object | object[] | null>;
|
|
10
|
+
body?: unknown;
|
|
11
|
+
timeoutMs?: number;
|
|
12
|
+
maxRetries?: number;
|
|
13
|
+
withCredentials?: boolean;
|
|
14
|
+
abortSignal?: AbortSignal;
|
|
15
|
+
requestType?: "json" | "file" | "bytes";
|
|
16
|
+
responseType?: "json" | "blob" | "sse" | "streaming" | "text" | "arrayBuffer";
|
|
17
|
+
duplex?: "half";
|
|
18
|
+
}
|
|
19
|
+
type Error = FailedStatusCodeError | NonJsonError | TimeoutError | UnknownError;
|
|
20
|
+
interface FailedStatusCodeError {
|
|
21
|
+
reason: "status-code";
|
|
22
|
+
statusCode: number;
|
|
23
|
+
body: unknown;
|
|
24
|
+
}
|
|
25
|
+
interface NonJsonError {
|
|
26
|
+
reason: "non-json";
|
|
27
|
+
statusCode: number;
|
|
28
|
+
rawBody: string;
|
|
29
|
+
}
|
|
30
|
+
interface TimeoutError {
|
|
31
|
+
reason: "timeout";
|
|
32
|
+
}
|
|
33
|
+
interface UnknownError {
|
|
34
|
+
reason: "unknown";
|
|
35
|
+
errorMessage: string;
|
|
36
|
+
}
|
|
37
|
+
}
|
|
38
|
+
export declare function fetcherImpl<R = unknown>(args: Fetcher.Args): Promise<APIResponse<R, Fetcher.Error>>;
|
|
39
|
+
export declare const fetcher: FetchFunction;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare function createRequestUrl(baseUrl: string, queryParameters?: Record<string, string | string[] | object | object[] | null>): string;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare function getHeader(headers: Record<string, any>, header: string): string | undefined;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare function getResponseBody(response: Response, responseType?: string): Promise<unknown>;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const makeRequest: (fetchFn: (url: string, init: RequestInit) => Promise<Response>, url: string, method: string, headers: Record<string, string>, requestBody: BodyInit | undefined, timeoutMs?: number, abortSignal?: AbortSignal, withCredentials?: boolean, duplex?: "half") => Promise<Response>;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare function requestWithRetries(requestFn: () => Promise<Response>, maxRetries?: number): Promise<Response>;
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
export declare function getTimeoutSignal(timeoutMs: number): {
|
|
2
|
+
signal: AbortSignal;
|
|
3
|
+
abortId: NodeJS.Timeout;
|
|
4
|
+
};
|
|
5
|
+
/**
|
|
6
|
+
* Returns an abort signal that is getting aborted when
|
|
7
|
+
* at least one of the specified abort signals is aborted.
|
|
8
|
+
*
|
|
9
|
+
* Requires at least node.js 18.
|
|
10
|
+
*/
|
|
11
|
+
export declare function anySignal(...args: AbortSignal[] | [AbortSignal[]]): AbortSignal;
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import type { Writable } from "readable-stream";
|
|
2
|
+
import { EventCallback, StreamWrapper } from "./chooseStreamWrapper";
|
|
3
|
+
export declare class Node18UniversalStreamWrapper<ReadFormat extends Uint8Array | Uint16Array | Uint32Array> implements StreamWrapper<Node18UniversalStreamWrapper<ReadFormat> | Writable | WritableStream<ReadFormat>, ReadFormat> {
|
|
4
|
+
private readableStream;
|
|
5
|
+
private reader;
|
|
6
|
+
private events;
|
|
7
|
+
private paused;
|
|
8
|
+
private resumeCallback;
|
|
9
|
+
private encoding;
|
|
10
|
+
constructor(readableStream: ReadableStream<ReadFormat>);
|
|
11
|
+
on(event: string, callback: EventCallback): void;
|
|
12
|
+
off(event: string, callback: EventCallback): void;
|
|
13
|
+
pipe(dest: Node18UniversalStreamWrapper<ReadFormat> | Writable | WritableStream<ReadFormat>): Node18UniversalStreamWrapper<ReadFormat> | Writable | WritableStream<ReadFormat>;
|
|
14
|
+
pipeTo(dest: Node18UniversalStreamWrapper<ReadFormat> | Writable | WritableStream<ReadFormat>): Node18UniversalStreamWrapper<ReadFormat> | Writable | WritableStream<ReadFormat>;
|
|
15
|
+
unpipe(dest: Node18UniversalStreamWrapper<ReadFormat> | Writable | WritableStream<ReadFormat>): void;
|
|
16
|
+
destroy(error?: Error): void;
|
|
17
|
+
pause(): void;
|
|
18
|
+
resume(): void;
|
|
19
|
+
get isPaused(): boolean;
|
|
20
|
+
read(): Promise<ReadFormat | undefined>;
|
|
21
|
+
setEncoding(encoding: string): void;
|
|
22
|
+
text(): Promise<string>;
|
|
23
|
+
json<T>(): Promise<T>;
|
|
24
|
+
private _write;
|
|
25
|
+
private _end;
|
|
26
|
+
private _error;
|
|
27
|
+
private _emit;
|
|
28
|
+
private _startReading;
|
|
29
|
+
[Symbol.asyncIterator](): AsyncIterableIterator<ReadFormat>;
|
|
30
|
+
}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import type { Readable, Writable } from "readable-stream";
|
|
2
|
+
import { EventCallback, StreamWrapper } from "./chooseStreamWrapper";
|
|
3
|
+
export declare class NodePre18StreamWrapper implements StreamWrapper<Writable, Buffer> {
|
|
4
|
+
private readableStream;
|
|
5
|
+
private encoding;
|
|
6
|
+
constructor(readableStream: Readable);
|
|
7
|
+
on(event: string, callback: EventCallback): void;
|
|
8
|
+
off(event: string, callback: EventCallback): void;
|
|
9
|
+
pipe(dest: Writable): Writable;
|
|
10
|
+
pipeTo(dest: Writable): Writable;
|
|
11
|
+
unpipe(dest?: Writable): void;
|
|
12
|
+
destroy(error?: Error): void;
|
|
13
|
+
pause(): void;
|
|
14
|
+
resume(): void;
|
|
15
|
+
get isPaused(): boolean;
|
|
16
|
+
read(): Promise<Buffer | undefined>;
|
|
17
|
+
setEncoding(encoding?: string): void;
|
|
18
|
+
text(): Promise<string>;
|
|
19
|
+
json<T>(): Promise<T>;
|
|
20
|
+
[Symbol.asyncIterator](): AsyncIterableIterator<Buffer>;
|
|
21
|
+
}
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import { StreamWrapper } from "./chooseStreamWrapper";
|
|
2
|
+
type EventCallback = (data?: any) => void;
|
|
3
|
+
export declare class UndiciStreamWrapper<ReadFormat extends Uint8Array | Uint16Array | Uint32Array> implements StreamWrapper<UndiciStreamWrapper<ReadFormat> | WritableStream<ReadFormat>, ReadFormat> {
|
|
4
|
+
private readableStream;
|
|
5
|
+
private reader;
|
|
6
|
+
private events;
|
|
7
|
+
private paused;
|
|
8
|
+
private resumeCallback;
|
|
9
|
+
private encoding;
|
|
10
|
+
constructor(readableStream: ReadableStream<ReadFormat>);
|
|
11
|
+
on(event: string, callback: EventCallback): void;
|
|
12
|
+
off(event: string, callback: EventCallback): void;
|
|
13
|
+
pipe(dest: UndiciStreamWrapper<ReadFormat> | WritableStream<ReadFormat>): UndiciStreamWrapper<ReadFormat> | WritableStream<ReadFormat>;
|
|
14
|
+
pipeTo(dest: UndiciStreamWrapper<ReadFormat> | WritableStream<ReadFormat>): UndiciStreamWrapper<ReadFormat> | WritableStream<ReadFormat>;
|
|
15
|
+
unpipe(dest: UndiciStreamWrapper<ReadFormat> | WritableStream): void;
|
|
16
|
+
destroy(error?: Error): void;
|
|
17
|
+
pause(): void;
|
|
18
|
+
resume(): void;
|
|
19
|
+
get isPaused(): boolean;
|
|
20
|
+
read(): Promise<ReadFormat | undefined>;
|
|
21
|
+
setEncoding(encoding: string): void;
|
|
22
|
+
text(): Promise<string>;
|
|
23
|
+
json<T>(): Promise<T>;
|
|
24
|
+
private _write;
|
|
25
|
+
private _end;
|
|
26
|
+
private _error;
|
|
27
|
+
private _emit;
|
|
28
|
+
private _startReading;
|
|
29
|
+
[Symbol.asyncIterator](): AsyncIterableIterator<ReadFormat>;
|
|
30
|
+
}
|
|
31
|
+
export {};
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
export type EventCallback = (data?: any) => void;
|
|
2
|
+
export interface StreamWrapper<WritableStream, ReadFormat> {
|
|
3
|
+
setEncoding(encoding?: string): void;
|
|
4
|
+
on(event: string, callback: EventCallback): void;
|
|
5
|
+
off(event: string, callback: EventCallback): void;
|
|
6
|
+
pipe(dest: WritableStream): WritableStream;
|
|
7
|
+
pipeTo(dest: WritableStream): WritableStream;
|
|
8
|
+
unpipe(dest?: WritableStream): void;
|
|
9
|
+
destroy(error?: Error): void;
|
|
10
|
+
pause(): void;
|
|
11
|
+
resume(): void;
|
|
12
|
+
get isPaused(): boolean;
|
|
13
|
+
read(): Promise<ReadFormat | undefined>;
|
|
14
|
+
text(): Promise<string>;
|
|
15
|
+
json<T>(): Promise<T>;
|
|
16
|
+
[Symbol.asyncIterator](): AsyncIterableIterator<ReadFormat>;
|
|
17
|
+
}
|
|
18
|
+
export declare function chooseStreamWrapper(responseBody: any): Promise<Promise<StreamWrapper<any, any>>>;
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Serialize a value to JSON
|
|
3
|
+
* @param value A JavaScript value, usually an object or array, to be converted.
|
|
4
|
+
* @param replacer A function that transforms the results.
|
|
5
|
+
* @param space Adds indentation, white space, and line break characters to the return-value JSON text to make it easier to read.
|
|
6
|
+
* @returns JSON string
|
|
7
|
+
*/
|
|
8
|
+
export declare const toJson: (value: unknown, replacer?: (this: unknown, key: string, value: unknown) => unknown, space?: string | number) => string;
|
|
9
|
+
/**
|
|
10
|
+
* Parse JSON string to object, array, or other type
|
|
11
|
+
* @param text A valid JSON string.
|
|
12
|
+
* @param reviver A function that transforms the results. This function is called for each member of the object. If a member contains nested objects, the nested objects are transformed before the parent object is.
|
|
13
|
+
* @returns Parsed object, array, or other type
|
|
14
|
+
*/
|
|
15
|
+
export declare function fromJson<T = unknown>(text: string, reviver?: (this: unknown, key: string, value: unknown) => unknown): T;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { RUNTIME } from "./runtime";
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* A constant that indicates which environment and version the SDK is running in.
|
|
3
|
+
*/
|
|
4
|
+
export declare const RUNTIME: Runtime;
|
|
5
|
+
export interface Runtime {
|
|
6
|
+
type: "browser" | "web-worker" | "deno" | "bun" | "node" | "react-native" | "unknown" | "workerd" | "edge-runtime";
|
|
7
|
+
version?: string;
|
|
8
|
+
parsedVersion?: number;
|
|
9
|
+
}
|