@caitlyn-ai/sdk-core 0.0.1 → 0.1.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/README.md +39 -7
- package/dist-cjs/index.cjs +305 -172
- package/dist-cjs/index.cjs.map +3 -3
- package/dist-es/index.mjs +298 -167
- package/dist-es/index.mjs.map +3 -3
- package/dist-types/index.d.ts +3169 -12
- package/package.json +1 -2
- package/dist-types/auth.d.ts +0 -140
- package/dist-types/aws.d.ts +0 -43
- package/dist-types/client.d.ts +0 -62
- package/dist-types/endpoint.d.ts +0 -4
- package/dist-types/plugin.d.ts +0 -21
- package/dist-types/protocol.d.ts +0 -24
- package/dist-types/retry.d.ts +0 -11
- package/dist-types/sse.d.ts +0 -6
- package/dist-types/stream.d.ts +0 -34
- package/dist-types/telemetry.d.ts +0 -3
- package/dist-types/upload.d.ts +0 -12
- package/dist-types/waiter.d.ts +0 -30
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@caitlyn-ai/sdk-core",
|
|
3
|
-
"version": "0.0
|
|
3
|
+
"version": "0.1.0",
|
|
4
4
|
"description": "The runtime core of the Caitlyn TypeScript SDK: the Caitlyn REST JSON protocol, sign-in, retries, server-sent events, waiters and telemetry.",
|
|
5
5
|
"license": "Apache-2.0",
|
|
6
6
|
"homepage": "https://build.caitlyn.ai",
|
|
@@ -15,7 +15,6 @@
|
|
|
15
15
|
"types": "./dist-types/index.d.ts",
|
|
16
16
|
"exports": {
|
|
17
17
|
".": {
|
|
18
|
-
"caitlyn-source": "./src/index.ts",
|
|
19
18
|
"types": "./dist-types/index.d.ts",
|
|
20
19
|
"import": "./dist-es/index.mjs",
|
|
21
20
|
"require": "./dist-cjs/index.cjs"
|
package/dist-types/auth.d.ts
DELETED
|
@@ -1,140 +0,0 @@
|
|
|
1
|
-
import type { Pluggable, TokenIdentity } from '@smithy/types';
|
|
2
|
-
import type { AwsCredentialSource } from './aws.js';
|
|
3
|
-
/** Tokens the `oauth` mode keeps. `expiresAt` is milliseconds since the epoch. */
|
|
4
|
-
export interface OAuthTokens {
|
|
5
|
-
accessToken: string;
|
|
6
|
-
refreshToken?: string;
|
|
7
|
-
expiresAt?: number;
|
|
8
|
-
scope?: string;
|
|
9
|
-
}
|
|
10
|
-
/** Where the `oauth` mode keeps tokens between processes, for example encrypted on a server. */
|
|
11
|
-
export interface TokenStore {
|
|
12
|
-
load(): Promise<OAuthTokens | undefined> | OAuthTokens | undefined;
|
|
13
|
-
save(tokens: OAuthTokens): Promise<void> | void;
|
|
14
|
-
clear(): Promise<void> | void;
|
|
15
|
-
}
|
|
16
|
-
export type AuthOptions = {
|
|
17
|
-
mode: 'token';
|
|
18
|
-
token: string;
|
|
19
|
-
} | {
|
|
20
|
-
mode: 'clientCredentials';
|
|
21
|
-
clientId: string;
|
|
22
|
-
clientSecret: string;
|
|
23
|
-
scopes?: string[];
|
|
24
|
-
resource?: string;
|
|
25
|
-
} | {
|
|
26
|
-
mode: 'oauth';
|
|
27
|
-
clientId: string;
|
|
28
|
-
/** For a confidential client on a server; omit in a browser. */
|
|
29
|
-
clientSecret?: string;
|
|
30
|
-
redirectUri?: string;
|
|
31
|
-
scopes?: string[];
|
|
32
|
-
resource?: string;
|
|
33
|
-
/** Default: kept in memory for the life of the client. */
|
|
34
|
-
tokenStore?: TokenStore;
|
|
35
|
-
} | {
|
|
36
|
-
mode: 'awsIam';
|
|
37
|
-
/** The regional STS endpoint to use. Default: AWS_REGION, then AWS_DEFAULT_REGION. */
|
|
38
|
-
region?: string;
|
|
39
|
-
/** Default: environment variables, then the container credentials endpoint. Accepts any @aws-sdk provider. */
|
|
40
|
-
credentials?: AwsCredentialSource;
|
|
41
|
-
signingAlgorithm?: 'ES384' | 'RS256';
|
|
42
|
-
/** Lifetime of the AWS-signed token, at most 300 (the default). */
|
|
43
|
-
durationSeconds?: number;
|
|
44
|
-
/** The audience the AWS token is minted for. Default: the workspace resource URL. */
|
|
45
|
-
audience?: string;
|
|
46
|
-
stsEndpoint?: string;
|
|
47
|
-
} | {
|
|
48
|
-
mode: 'workloadIdentity';
|
|
49
|
-
/** Returns the workload's current identity token, for example a GitLab CI id_tokens variable. */
|
|
50
|
-
token: () => string | Promise<string>;
|
|
51
|
-
resource?: string;
|
|
52
|
-
} | {
|
|
53
|
-
mode: 'session';
|
|
54
|
-
/** A session cookie, for server-side use. In a browser leave it out: the browser sends its own. */
|
|
55
|
-
cookie?: string;
|
|
56
|
-
/** Sent as Origin on every write. Default: the workspace URL. */
|
|
57
|
-
origin?: string;
|
|
58
|
-
};
|
|
59
|
-
/** A sign-in failure: the token endpoint's OAuth error, or a failure to get the identity it exchanges. */
|
|
60
|
-
export declare class CaitlynAuthError extends Error {
|
|
61
|
-
/** The OAuth error code (`invalid_client`, `invalid_grant`…), or `sign_in_required`. */
|
|
62
|
-
readonly code: string;
|
|
63
|
-
readonly status?: number | undefined;
|
|
64
|
-
readonly requestId?: string | undefined;
|
|
65
|
-
readonly name = "CaitlynAuthError";
|
|
66
|
-
constructor(message: string,
|
|
67
|
-
/** The OAuth error code (`invalid_client`, `invalid_grant`…), or `sign_in_required`. */
|
|
68
|
-
code: string, status?: number | undefined, requestId?: string | undefined);
|
|
69
|
-
}
|
|
70
|
-
/** The audience of a workspace's tokens: its resource URL, https://<workspace>/api/v3. */
|
|
71
|
-
export declare const workspaceAudience: (workspace: string) => string;
|
|
72
|
-
/** A workspace given as a hostname or a URL, as its bare hostname. */
|
|
73
|
-
export declare const workspaceHost: (workspace: string) => string;
|
|
74
|
-
/** What `client.auth` offers: the current token, and the `oauth` mode's sign-in steps. */
|
|
75
|
-
export declare class AuthSession {
|
|
76
|
-
readonly options: AuthOptions;
|
|
77
|
-
/** Where the token endpoint is: the client's endpoint, which an override may move (a proxy, a local app). */
|
|
78
|
-
readonly endpoint: string;
|
|
79
|
-
/** The workspace hostname. Like an AWS region, it decides the endpoint and the token audience. */
|
|
80
|
-
readonly workspace: string;
|
|
81
|
-
private readonly fetchFn;
|
|
82
|
-
private cached?;
|
|
83
|
-
/** The token the server last refused with a 401, so `oauth` never reloads it from the store. */
|
|
84
|
-
private refused?;
|
|
85
|
-
private inflight?;
|
|
86
|
-
private memoryTokens?;
|
|
87
|
-
readonly tokenEndpoint: string;
|
|
88
|
-
readonly authorizationEndpoint: string;
|
|
89
|
-
/** The workspace's resource URL, https://<workspace>/api/v3: the audience every token is bound to. */
|
|
90
|
-
readonly resource: string;
|
|
91
|
-
/** https://<workspace>: the default Origin for session writes. */
|
|
92
|
-
readonly workspaceUrl: string;
|
|
93
|
-
constructor(options: AuthOptions,
|
|
94
|
-
/** Where the token endpoint is: the client's endpoint, which an override may move (a proxy, a local app). */
|
|
95
|
-
endpoint: string,
|
|
96
|
-
/** The workspace hostname. Like an AWS region, it decides the endpoint and the token audience. */
|
|
97
|
-
workspace: string, fetchFn?: typeof fetch);
|
|
98
|
-
get mode(): "token" | "clientCredentials" | "oauth" | "awsIam" | "workloadIdentity" | "session";
|
|
99
|
-
/** The bearer token for the next request: cached, or fetched once however many calls ask at the same time. */
|
|
100
|
-
token(): Promise<string>;
|
|
101
|
-
/** Forgets the cached token, so the next call signs in again (done once after a 401). */
|
|
102
|
-
invalidate(): void;
|
|
103
|
-
/** Whether a 401 is worth one more try with a new token. */
|
|
104
|
-
get canRefresh(): boolean;
|
|
105
|
-
/** Starts sign-in (`oauth` mode): the URL to send the person to, and the state and PKCE verifier to keep. */
|
|
106
|
-
authorizationUrl(opts?: {
|
|
107
|
-
state?: string;
|
|
108
|
-
scopes?: string[];
|
|
109
|
-
redirectUri?: string;
|
|
110
|
-
}): Promise<{
|
|
111
|
-
url: string;
|
|
112
|
-
state: string;
|
|
113
|
-
codeVerifier: string;
|
|
114
|
-
}>;
|
|
115
|
-
/** Finishes sign-in (`oauth` mode): checks state, exchanges the code and saves the tokens. */
|
|
116
|
-
handleCallback(p: {
|
|
117
|
-
code: string;
|
|
118
|
-
state?: string;
|
|
119
|
-
expectedState?: string;
|
|
120
|
-
codeVerifier: string;
|
|
121
|
-
redirectUri?: string;
|
|
122
|
-
}): Promise<OAuthTokens>;
|
|
123
|
-
/** Signs out (`oauth` mode): revokes the refresh token where possible and clears the store. */
|
|
124
|
-
signOut(): Promise<void>;
|
|
125
|
-
private oauth;
|
|
126
|
-
private clientParams;
|
|
127
|
-
private loadTokens;
|
|
128
|
-
private saveTokens;
|
|
129
|
-
private fetchToken;
|
|
130
|
-
private exchange;
|
|
131
|
-
private requestToken;
|
|
132
|
-
}
|
|
133
|
-
/**
|
|
134
|
-
* The generated client's `token` identity provider. It reports the token as already near expiry, so Smithy's
|
|
135
|
-
* memoisation asks again on every request and AuthSession's own cache (which knows the real expiry, and can
|
|
136
|
-
* be invalidated after a 401) decides.
|
|
137
|
-
*/
|
|
138
|
-
export declare const tokenIdentityProvider: (auth: AuthSession) => () => Promise<TokenIdentity>;
|
|
139
|
-
/** Session headers, and one retry with a new token after a 401. */
|
|
140
|
-
export declare function getCaitlynAuthPlugin(auth: AuthSession): Pluggable<any, any>;
|
package/dist-types/aws.d.ts
DELETED
|
@@ -1,43 +0,0 @@
|
|
|
1
|
-
export interface AwsCredentials {
|
|
2
|
-
accessKeyId: string;
|
|
3
|
-
secretAccessKey: string;
|
|
4
|
-
sessionToken?: string;
|
|
5
|
-
/** When the credentials stop working; the SDK fetches new ones a minute before. */
|
|
6
|
-
expiration?: Date;
|
|
7
|
-
}
|
|
8
|
-
export type AwsCredentialSource = AwsCredentials | (() => Promise<AwsCredentials> | AwsCredentials);
|
|
9
|
-
/** RFC 3986 encoding, as Signature Version 4 requires (encodeURIComponent leaves !'()* alone). */
|
|
10
|
-
export declare const awsEncode: (s: string) => string;
|
|
11
|
-
export interface SignableRequest {
|
|
12
|
-
method: string;
|
|
13
|
-
url: URL;
|
|
14
|
-
headers: Record<string, string>;
|
|
15
|
-
body: string;
|
|
16
|
-
}
|
|
17
|
-
/**
|
|
18
|
-
* Signs a request with AWS Signature Version 4 (header form) and returns the headers to send, including
|
|
19
|
-
* `authorization`, `x-amz-date`, `x-amz-content-sha256` and, for temporary credentials, `x-amz-security-token`.
|
|
20
|
-
*/
|
|
21
|
-
export declare function signV4(req: SignableRequest, creds: AwsCredentials, region: string, service: string, now?: Date): Promise<Record<string, string>>;
|
|
22
|
-
/**
|
|
23
|
-
* The default credential source: AWS_ACCESS_KEY_ID and AWS_SECRET_ACCESS_KEY (with AWS_SESSION_TOKEN), as AWS
|
|
24
|
-
* Lambda and CI runners set them; otherwise the container credentials endpoint
|
|
25
|
-
* (AWS_CONTAINER_CREDENTIALS_FULL_URI or _RELATIVE_URI), as ECS, Fargate and AgentCore runtimes set it.
|
|
26
|
-
*/
|
|
27
|
-
export declare function defaultAwsCredentials(fetchFn?: typeof fetch): Promise<AwsCredentials>;
|
|
28
|
-
export interface WebIdentityTokenRequest {
|
|
29
|
-
region: string;
|
|
30
|
-
audience: string;
|
|
31
|
-
credentials: AwsCredentials;
|
|
32
|
-
signingAlgorithm?: 'ES384' | 'RS256';
|
|
33
|
-
durationSeconds?: number;
|
|
34
|
-
/** Overrides https://sts.{region}.amazonaws.com/ (tests, FIPS or VPC endpoints). */
|
|
35
|
-
stsEndpoint?: string;
|
|
36
|
-
fetch?: typeof fetch;
|
|
37
|
-
signal?: AbortSignal;
|
|
38
|
-
}
|
|
39
|
-
/** Calls STS GetWebIdentityToken (outbound identity federation) on a regional endpoint and returns the JWT. */
|
|
40
|
-
export declare function getWebIdentityToken(r: WebIdentityTokenRequest): Promise<{
|
|
41
|
-
token: string;
|
|
42
|
-
expiration?: Date;
|
|
43
|
-
}>;
|
package/dist-types/client.d.ts
DELETED
|
@@ -1,62 +0,0 @@
|
|
|
1
|
-
import type { TracerProvider } from '@opentelemetry/api';
|
|
2
|
-
import { CaitlynRetryStrategy } from './retry.js';
|
|
3
|
-
import { AuthSession, type AuthOptions } from './auth.js';
|
|
4
|
-
export interface CaitlynOptions {
|
|
5
|
-
/**
|
|
6
|
-
* The workspace hostname, for example "your-company.getcaitlyn.ai". Like an AWS region, it decides where
|
|
7
|
-
* requests go (https://<workspace>/api) and the audience every token is bound to (https://<workspace>/api/v3).
|
|
8
|
-
*/
|
|
9
|
-
workspace: string;
|
|
10
|
-
/** How the client signs in: token, clientCredentials, oauth, awsIam, workloadIdentity or session. */
|
|
11
|
-
auth: AuthOptions;
|
|
12
|
-
/** The fetch the sign-in requests use (token endpoint, STS, container credentials). Default: global fetch. */
|
|
13
|
-
fetch?: typeof fetch;
|
|
14
|
-
/**
|
|
15
|
-
* Overrides the base URL the operation paths (/v3/…) and the token endpoint (/oauth/token) are appended to,
|
|
16
|
-
* for a proxy or a local app. Default: https://{workspace}/api. It never changes the token audience.
|
|
17
|
-
*/
|
|
18
|
-
endpoint?: string;
|
|
19
|
-
maxAttempts?: number;
|
|
20
|
-
/** Longest Retry-After the SDK waits for (default 60 000 ms); above it the call fails at once. */
|
|
21
|
-
maxRetryDelayMs?: number;
|
|
22
|
-
telemetry?: {
|
|
23
|
-
tracerProvider?: TracerProvider;
|
|
24
|
-
enabled?: boolean;
|
|
25
|
-
};
|
|
26
|
-
}
|
|
27
|
-
export interface CallOptions {
|
|
28
|
-
signal?: AbortSignal;
|
|
29
|
-
}
|
|
30
|
-
/** The base URL of a workspace's API: its hostname, over HTTPS, with the /api prefix every Caitlyn route has. */
|
|
31
|
-
export declare function workspaceEndpoint(workspace: string): string;
|
|
32
|
-
/** The sign-in session for a set of options: what `client.auth` is. */
|
|
33
|
-
export declare function createAuth(opts: CaitlynOptions): AuthSession;
|
|
34
|
-
/** The generated client's configuration for a set of options. */
|
|
35
|
-
export declare function clientConfig(opts: CaitlynOptions, auth?: AuthSession): {
|
|
36
|
-
retryStrategy?: CaitlynRetryStrategy | undefined;
|
|
37
|
-
maxAttempts?: number | undefined;
|
|
38
|
-
/** The workspace this client is for; readable as client.config.workspace. */
|
|
39
|
-
workspace: string;
|
|
40
|
-
endpoint: string;
|
|
41
|
-
token: () => Promise<import("@smithy/types").TokenIdentity>;
|
|
42
|
-
};
|
|
43
|
-
/** One problem with one request member or query parameter, on a 400 VALIDATION_FAILED. */
|
|
44
|
-
export interface CaitlynFieldError {
|
|
45
|
-
pointer?: string;
|
|
46
|
-
parameter?: string;
|
|
47
|
-
code: string;
|
|
48
|
-
detail?: string;
|
|
49
|
-
}
|
|
50
|
-
/** The RFC 9457 fields every Caitlyn error carries (PROTOCOL.md 6.3). */
|
|
51
|
-
export interface CaitlynErrorFields {
|
|
52
|
-
status?: number;
|
|
53
|
-
code?: string;
|
|
54
|
-
type?: string;
|
|
55
|
-
title?: string;
|
|
56
|
-
detail?: string;
|
|
57
|
-
requestId?: string;
|
|
58
|
-
retryAfterSeconds?: number;
|
|
59
|
-
errors?: CaitlynFieldError[];
|
|
60
|
-
/** The response body as received, as text: the only view of a body that is not problem details (PROTOCOL.md 6.3). */
|
|
61
|
-
rawBody?: string;
|
|
62
|
-
}
|
package/dist-types/endpoint.d.ts
DELETED
package/dist-types/plugin.d.ts
DELETED
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
import type { Pluggable } from '@smithy/types';
|
|
2
|
-
export declare const CAITLYN_SDK_USER_AGENT_PREFIX = "caitlyn-sdk-ts";
|
|
3
|
-
export declare class NotSupportedByServer extends Error {
|
|
4
|
-
readonly operation: string;
|
|
5
|
-
readonly requires: string;
|
|
6
|
-
readonly server: string;
|
|
7
|
-
constructor(operation: string, requires: string, server: string);
|
|
8
|
-
}
|
|
9
|
-
/**
|
|
10
|
-
* @param options.sdkModel the highest @since in the model: the server release this SDK was generated against
|
|
11
|
-
* @param options.retrySafeOperations operations that are @readonly, @idempotent or have an @idempotencyToken member
|
|
12
|
-
* @param options.since `Operation=5.120.0` and `Operation.member=5.124.0` entries from the model's @since traits
|
|
13
|
-
*/
|
|
14
|
-
export declare function getCaitlynSdkPlugin(config: {
|
|
15
|
-
caitlynSdkVersion?: string;
|
|
16
|
-
customUserAgent?: string;
|
|
17
|
-
}, options: {
|
|
18
|
-
sdkModel: string;
|
|
19
|
-
retrySafeOperations: string[];
|
|
20
|
-
since?: string[];
|
|
21
|
-
}): Pluggable<any, any>;
|
package/dist-types/protocol.d.ts
DELETED
|
@@ -1,24 +0,0 @@
|
|
|
1
|
-
import { HttpBindingProtocol, HttpInterceptingShapeDeserializer, HttpInterceptingShapeSerializer, JsonCodec2 } from '@smithy/core/protocols';
|
|
2
|
-
import { TypeRegistry } from '@smithy/core/schema';
|
|
3
|
-
import type { HandlerExecutionContext, HttpRequest, HttpResponse, MetadataBearer, OperationSchema, ResponseMetadata, SerdeFunctions } from '@smithy/types';
|
|
4
|
-
/** An output with the parsed response body, including fields this SDK version does not model. */
|
|
5
|
-
export type WithRaw<T> = T & {
|
|
6
|
-
readonly raw?: Record<string, unknown>;
|
|
7
|
-
};
|
|
8
|
-
export declare class CaitlynRestJsonProtocol extends HttpBindingProtocol {
|
|
9
|
-
protected serializer: HttpInterceptingShapeSerializer<import("@smithy/types").$ShapeSerializer<Uint8Array<ArrayBufferLike>>>;
|
|
10
|
-
protected deserializer: HttpInterceptingShapeDeserializer<import("@smithy/types").$ShapeDeserializer<string>>;
|
|
11
|
-
private readonly codec;
|
|
12
|
-
constructor({ defaultNamespace, errorTypeRegistries }: {
|
|
13
|
-
defaultNamespace: string;
|
|
14
|
-
errorTypeRegistries?: TypeRegistry[];
|
|
15
|
-
});
|
|
16
|
-
getShapeId(): string;
|
|
17
|
-
getDefaultContentType(): string;
|
|
18
|
-
getPayloadCodec(): JsonCodec2;
|
|
19
|
-
setSerdeContext(serdeContext: SerdeFunctions): void;
|
|
20
|
-
serializeRequest<Input extends object>(operationSchema: OperationSchema, input: Input, context: Parameters<HttpBindingProtocol['serializeRequest']>[2]): Promise<HttpRequest>;
|
|
21
|
-
deserializeResponse<Output extends MetadataBearer>(operationSchema: OperationSchema, context: HandlerExecutionContext & SerdeFunctions, response: HttpResponse): Promise<Output>;
|
|
22
|
-
protected deserializeMetadata(response: HttpResponse): ResponseMetadata;
|
|
23
|
-
protected handleError(_operationSchema: OperationSchema, context: HandlerExecutionContext & SerdeFunctions, response: HttpResponse, dataObject: Record<string, unknown>, metadata: ResponseMetadata): Promise<never>;
|
|
24
|
-
}
|
package/dist-types/retry.d.ts
DELETED
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
import type { Provider, RetryErrorInfo, RetryStrategyV2, RetryToken } from '@smithy/types';
|
|
2
|
-
export declare const NO_RETRY: unique symbol;
|
|
3
|
-
export declare class CaitlynRetryStrategy implements RetryStrategyV2 {
|
|
4
|
-
private readonly maxRetryDelayMs;
|
|
5
|
-
readonly mode = "standard";
|
|
6
|
-
private readonly maxAttempts;
|
|
7
|
-
constructor(maxAttempts?: number | Provider<number>, maxRetryDelayMs?: number);
|
|
8
|
-
acquireInitialRetryToken(): Promise<RetryToken>;
|
|
9
|
-
refreshRetryTokenForRetry(token: RetryToken, info: RetryErrorInfo): Promise<RetryToken>;
|
|
10
|
-
recordSuccess(): void;
|
|
11
|
-
}
|
package/dist-types/sse.d.ts
DELETED
package/dist-types/stream.d.ts
DELETED
|
@@ -1,34 +0,0 @@
|
|
|
1
|
-
export interface SseSpec {
|
|
2
|
-
/** SSE `event:` names this SDK knows (the union members' jsonNames). Others are skipped. */
|
|
3
|
-
readonly known: ReadonlySet<string>;
|
|
4
|
-
/** The event that ends the stream successfully, and the member finalMessage() returns. */
|
|
5
|
-
readonly final?: {
|
|
6
|
-
event: string;
|
|
7
|
-
member: string;
|
|
8
|
-
};
|
|
9
|
-
/** The event carrying RFC 9457 problem details; it ends the stream with a thrown error. */
|
|
10
|
-
readonly errorEvent?: string;
|
|
11
|
-
/** Builds the typed error for an error event. */
|
|
12
|
-
readonly toError: (problem: Record<string, unknown>) => Error;
|
|
13
|
-
}
|
|
14
|
-
type Body = AsyncIterable<Uint8Array>;
|
|
15
|
-
export declare class SseStream<E extends {
|
|
16
|
-
type: string;
|
|
17
|
-
}, F = never> implements AsyncIterable<E> {
|
|
18
|
-
private readonly spec;
|
|
19
|
-
private readonly open;
|
|
20
|
-
private readonly resume;
|
|
21
|
-
private readonly signal?;
|
|
22
|
-
private readonly maxReconnects;
|
|
23
|
-
private finalValue?;
|
|
24
|
-
private consumed;
|
|
25
|
-
private readonly seen;
|
|
26
|
-
lastEventId?: string;
|
|
27
|
-
reconnects: number;
|
|
28
|
-
constructor(spec: SseSpec, open: () => Promise<Body>, resume: ((lastEventId: string | undefined) => Promise<Body>) | undefined, signal?: AbortSignal | undefined, maxReconnects?: number);
|
|
29
|
-
private aborted;
|
|
30
|
-
[Symbol.asyncIterator](): AsyncGenerator<E>;
|
|
31
|
-
/** Drains the stream if needed and returns the final event's member. */
|
|
32
|
-
finalMessage(): Promise<F>;
|
|
33
|
-
}
|
|
34
|
-
export {};
|
package/dist-types/upload.d.ts
DELETED
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
export interface UploadSlot {
|
|
2
|
-
uploadUrl: string;
|
|
3
|
-
uploadMethod: string;
|
|
4
|
-
requiredHeaders: Record<string, string>;
|
|
5
|
-
}
|
|
6
|
-
export interface UploadMeta {
|
|
7
|
-
fileName: string;
|
|
8
|
-
contentType: string;
|
|
9
|
-
byteSize: number;
|
|
10
|
-
sha256: string;
|
|
11
|
-
}
|
|
12
|
-
export declare function uploadFile<S extends UploadSlot>(file: Blob, fileName: string, reserve: (meta: UploadMeta) => Promise<S>, toError: (problem: Record<string, unknown>) => Error, signal?: AbortSignal): Promise<S>;
|
package/dist-types/waiter.d.ts
DELETED
|
@@ -1,30 +0,0 @@
|
|
|
1
|
-
export type WaiterState = 'success' | 'failure' | 'retry';
|
|
2
|
-
export interface WaiterOptions {
|
|
3
|
-
/** Stops waiting and throws the signal's reason (use AbortSignal.timeout() for a deadline). */
|
|
4
|
-
signal?: AbortSignal;
|
|
5
|
-
/** The longest the waiter waits in total, in milliseconds. Default: no limit beyond the signal. */
|
|
6
|
-
maxWaitMs?: number;
|
|
7
|
-
/** Default 2 000 ms (Smithy's default minDelay). */
|
|
8
|
-
minDelayMs?: number;
|
|
9
|
-
/** Default 120 000 ms (Smithy's default maxDelay). */
|
|
10
|
-
maxDelayMs?: number;
|
|
11
|
-
}
|
|
12
|
-
/** A waiter ended in a failure state, or ran out of time. `last` is the last output or error it saw. */
|
|
13
|
-
export declare class WaiterError extends Error {
|
|
14
|
-
readonly reason: 'failure' | 'timeout';
|
|
15
|
-
readonly last: unknown;
|
|
16
|
-
readonly attempts: number;
|
|
17
|
-
readonly name = "WaiterError";
|
|
18
|
-
constructor(message: string, reason: 'failure' | 'timeout', last: unknown, attempts: number);
|
|
19
|
-
}
|
|
20
|
-
/**
|
|
21
|
-
* Calls `read` until `accept` says success (returns the output) or failure (throws WaiterError).
|
|
22
|
-
* `accept` sees either `{output}` or `{error}`; returning undefined for an error rethrows it.
|
|
23
|
-
*/
|
|
24
|
-
export declare function waitUntil<T>(name: string, read: (signal?: AbortSignal) => Promise<T>, accept: (r: {
|
|
25
|
-
output: T;
|
|
26
|
-
error?: undefined;
|
|
27
|
-
} | {
|
|
28
|
-
output?: undefined;
|
|
29
|
-
error: unknown;
|
|
30
|
-
}) => WaiterState | undefined, opts?: WaiterOptions): Promise<T>;
|