@expandai/sdk 0.20.1 → 0.20.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 +11 -0
- package/build/dts/Error.d.ts +25 -1
- package/build/dts/Error.d.ts.map +1 -1
- package/build/dts/Internal.d.ts.map +1 -1
- package/build/dts/RetryAfter.d.ts +2 -0
- package/build/dts/RetryAfter.d.ts.map +1 -1
- package/build/dts/Service.d.ts +9 -2
- package/build/dts/Service.d.ts.map +1 -1
- package/build/dts/Tunnel/Headers.d.ts +2 -0
- package/build/dts/Tunnel/Headers.d.ts.map +1 -0
- package/build/dts/Tunnel/LocalTarget.d.ts +122 -0
- package/build/dts/Tunnel/LocalTarget.d.ts.map +1 -0
- package/build/dts/Tunnel/Protocol.d.ts +160 -0
- package/build/dts/Tunnel/Protocol.d.ts.map +1 -0
- package/build/dts/Tunnel/StaticServer.d.ts +10 -0
- package/build/dts/Tunnel/StaticServer.d.ts.map +1 -0
- package/build/dts/Tunnel/Tunnel.d.ts +40 -0
- package/build/dts/Tunnel/Tunnel.d.ts.map +1 -0
- package/build/dts/index.d.ts +2 -2
- package/build/dts/index.d.ts.map +1 -1
- package/build/esm/Error.js +27 -0
- package/build/esm/Error.js.map +1 -1
- package/build/esm/Internal.js +9 -1
- package/build/esm/Internal.js.map +1 -1
- package/build/esm/RetryAfter.js +3 -1
- package/build/esm/RetryAfter.js.map +1 -1
- package/build/esm/Service.js +23 -7
- package/build/esm/Service.js.map +1 -1
- package/build/esm/Tunnel/Headers.js +18 -0
- package/build/esm/Tunnel/Headers.js.map +1 -0
- package/build/esm/Tunnel/LocalTarget.js +125 -0
- package/build/esm/Tunnel/LocalTarget.js.map +1 -0
- package/build/esm/Tunnel/Protocol.js +73 -0
- package/build/esm/Tunnel/Protocol.js.map +1 -0
- package/build/esm/Tunnel/StaticServer.js +69 -0
- package/build/esm/Tunnel/StaticServer.js.map +1 -0
- package/build/esm/Tunnel/Tunnel.js +302 -0
- package/build/esm/Tunnel/Tunnel.js.map +1 -0
- package/build/esm/index.js +1 -1
- package/build/esm/index.js.map +1 -1
- package/package.json +6 -3
- package/src/Error.ts +53 -1
- package/src/Internal.ts +10 -0
- package/src/RetryAfter.ts +4 -1
- package/src/Service.ts +48 -8
- package/src/Tunnel/Headers.ts +22 -0
- package/src/Tunnel/LocalTarget.ts +153 -0
- package/src/Tunnel/Protocol.ts +99 -0
- package/src/Tunnel/StaticServer.ts +85 -0
- package/src/Tunnel/Tunnel.ts +420 -0
- package/src/index.ts +3 -1
package/README.md
CHANGED
|
@@ -103,6 +103,17 @@ Typed errors in the `Effect` channel:
|
|
|
103
103
|
- `ExpandConnectionError` — network failure
|
|
104
104
|
- `ExpandTimeoutError` — request timed out
|
|
105
105
|
|
|
106
|
+
## Local pages and files
|
|
107
|
+
|
|
108
|
+
In Node.js, pass `{ local: true }` to `fetch()` or `fetchJson()` with a localhost HTTP URL or a file or folder path. The same option works on `ExpandService`.
|
|
109
|
+
|
|
110
|
+
```ts
|
|
111
|
+
const markdown = await expand.fetch({ url: 'http://localhost:3000' }, { local: true })
|
|
112
|
+
const page = await expand.fetchJson({ url: './dist' }, { local: true })
|
|
113
|
+
```
|
|
114
|
+
|
|
115
|
+
Local mode requires an API key and temporarily shares the selected content publicly. Saved Snapshots remain shareable afterward. Never enable it for URLs or paths supplied by untrusted users. See [Local pages and files](https://expand.ai/docs/fetch/fetching-a-url#local-pages-and-files) for setup, folder boundaries, supported inputs, and errors.
|
|
116
|
+
|
|
106
117
|
## Crawl and capture projections
|
|
107
118
|
|
|
108
119
|
Creation and run-command replays require a caller-persisted idempotency key. One-off crawls close permanently when done, failed, or canceled; create a new crawl to run again. Events carry their own resume offset.
|
package/build/dts/Error.d.ts
CHANGED
|
@@ -1,4 +1,18 @@
|
|
|
1
1
|
import { Schema } from 'effect';
|
|
2
|
+
declare const LOCAL_TARGET_ERROR_REASON: Schema.Literal<["InvalidInput", "NotLocal", "UnsupportedProtocol", "NotFound", "PermissionDenied", "UnsupportedFileType", "Unavailable", "UnsafeDirectory"]>;
|
|
3
|
+
export type LocalTargetErrorReason = typeof LOCAL_TARGET_ERROR_REASON.Type;
|
|
4
|
+
declare const ExpandLocalTargetError_base: Schema.TaggedErrorClass<ExpandLocalTargetError, "ExpandLocalTargetError", {
|
|
5
|
+
readonly _tag: Schema.tag<"ExpandLocalTargetError">;
|
|
6
|
+
} & {
|
|
7
|
+
reason: Schema.Literal<["InvalidInput", "NotLocal", "UnsupportedProtocol", "NotFound", "PermissionDenied", "UnsupportedFileType", "Unavailable", "UnsafeDirectory"]>;
|
|
8
|
+
input: typeof Schema.String;
|
|
9
|
+
message: typeof Schema.String;
|
|
10
|
+
cause: Schema.optional<typeof Schema.Defect>;
|
|
11
|
+
}>;
|
|
12
|
+
/** A local input cannot be fetched. Inspect `reason` rather than parsing the message. */
|
|
13
|
+
export declare class ExpandLocalTargetError extends ExpandLocalTargetError_base {
|
|
14
|
+
toPublicError(): ExpandClientLocalTargetError;
|
|
15
|
+
}
|
|
2
16
|
declare const ExpandSdkError_base: Schema.TaggedErrorClass<ExpandSdkError, "ExpandSdkError", {
|
|
3
17
|
readonly _tag: Schema.tag<"ExpandSdkError">;
|
|
4
18
|
} & {
|
|
@@ -53,13 +67,23 @@ export declare class ExpandTimeoutError extends ExpandTimeoutError_base {
|
|
|
53
67
|
/**
|
|
54
68
|
* Union of every error the Effect-side `ExpandService` can fail with.
|
|
55
69
|
*/
|
|
56
|
-
export type ExpandError = ExpandSdkError | ExpandApiError | ExpandConnectionError | ExpandTimeoutError;
|
|
70
|
+
export type ExpandError = ExpandSdkError | ExpandApiError | ExpandConnectionError | ExpandTimeoutError | ExpandLocalTargetError;
|
|
57
71
|
/**
|
|
58
72
|
* Promise-side base class. Catch this to handle any failure thrown by `ExpandClient`.
|
|
59
73
|
*/
|
|
60
74
|
export declare class ExpandClientError extends Error {
|
|
61
75
|
constructor(message: string, options?: ErrorOptions);
|
|
62
76
|
}
|
|
77
|
+
interface LocalTargetErrorOptions extends ErrorOptions {
|
|
78
|
+
readonly reason: LocalTargetErrorReason;
|
|
79
|
+
readonly input: string;
|
|
80
|
+
}
|
|
81
|
+
/** A local input cannot be fetched. Includes the input, stable reason, and original filesystem cause. */
|
|
82
|
+
export declare class ExpandClientLocalTargetError extends ExpandClientError {
|
|
83
|
+
readonly reason: LocalTargetErrorReason;
|
|
84
|
+
readonly input: string;
|
|
85
|
+
constructor(message: string, options: LocalTargetErrorOptions);
|
|
86
|
+
}
|
|
63
87
|
/**
|
|
64
88
|
* Promise-side error for non-2xx API responses. Inspect `status` and `body` for details.
|
|
65
89
|
*/
|
package/build/dts/Error.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Error.d.ts","sourceRoot":"","sources":["../../src/Error.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,MAAM,QAAQ,CAAA
|
|
1
|
+
{"version":3,"file":"Error.d.ts","sourceRoot":"","sources":["../../src/Error.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,MAAM,QAAQ,CAAA;AAE/B,QAAA,MAAM,yBAAyB,8JAS9B,CAAA;AAED,MAAM,MAAM,sBAAsB,GAAG,OAAO,yBAAyB,CAAC,IAAI,CAAA;;;;;;;;;AAE1E,yFAAyF;AACzF,qBAAa,sBAAuB,SAAQ,2BAK1C;IACD,aAAa,iCAMZ;CACD;;;;;;;AAED;;GAEG;AACH,qBAAa,cAAe,SAAQ,mBAGlC;IACD,aAAa,sBAEZ;CACD;;;;;;;;;AAED;;GAEG;AACH,qBAAa,cAAe,SAAQ,mBAKlC;IACD,aAAa,yBAEZ;CACD;;;;;;;AAED;;GAEG;AACH,qBAAa,qBAAsB,SAAQ,0BAGzC;IACD,aAAa,gCAEZ;CACD;;;;;;;;AAED;;GAEG;AACH,qBAAa,kBAAmB,SAAQ,uBAItC;IACD,aAAa,6BAEZ;CACD;AAED;;GAEG;AACH,MAAM,MAAM,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oot":"","sources":["../../src/Internal.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,KAAK,EAAE,MAAM,EAAW,KAAK,EAAyC,MAAM,QAAQ,CAAA;AAC7F,OAAO,EAIN,iBAAiB,
|
|
1
|
+
{"version":3,"file":"Internal.d.ts","sourceRoot":"","sources":["../../src/Internal.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,KAAK,EAAE,MAAM,EAAW,KAAK,EAAyC,MAAM,QAAQ,CAAA;AAC7F,OAAO,EAIN,iBAAiB,EAIjB,KAAK,WAAW,EAEhB,cAAc,EAEd,MAAM,YAAY,CAAA;AAGnB,OAAO,EACN,KAAK,aAAa,EAClB,KAAK,qBAAqB,EAC1B,KAAK,eAAe,EACpB,KAAK,qBAAqB,EAC1B,aAAa,EACb,KAAK,oBAAoB,EACzB,KAAK,eAAe,EACpB,KAAK,iBAAiB,EACtB,KAAK,WAAW,EAChB,KAAK,aAAa,EAClB,KAAK,gBAAgB,EACrB,KAAK,kBAAkB,EACvB,KAAK,cAAc,EACnB,KAAK,eAAe,EACpB,KAAK,iBAAiB,EACtB,KAAK,0BAA0B,EAC/B,MAAM,cAAc,CAAA;AAyErB;;;;GAIG;AACH,wBAAgB,aAAa,CAAC,KAAK,EAAE,OAAO,EAAE,SAAS,EAAE,MAAM,GAAG,WAAW,CA+D5E;AAsCD;;;;;GAKG;AACH,wBAAgB,WAAW,CAAC,KAAK,EAAE,OAAO,EAAE,SAAS,EAAE,MAAM,GAAG,OAAO,CAKtE;;;iCAqEU,WAAW,YACV,cAAc,KACrB,MAAM,CAAC,MAAM,CAAC,aAAa,EAAE,iBAAiB,CAAC;qCAIzC,eAAe,YACd,cAAc,KACrB,MAAM,CAAC,MAAM,CAAC,iBAAiB,EAAE,iBAAiB,CAAC;uCAI7C,iBAAiB,YAChB,cAAc,KACrB,MAAM,CAAC,MAAM,CAAC,eAAe,GAAG,0BAA0B,EAAE,iBAAiB,CAAC;mCAIxE,aAAa,WACZ,qBAAqB,KAC5B,MAAM,CAAC,MAAM,CAAC,eAAe,EAAE,iBAAiB,CAAC;kCAI/C,MAAM,YACD,gBAAgB,GAAG,cAAc,KACxC,MAAM,CAAC,MAAM,CAAC,kBAAkB,EAAE,iBAAiB,CAAC;qCAIlD,MAAM,YACD,cAAc,KACrB,MAAM,CAAC,MAAM,CAAC,qBAAqB,EAAE,iBAAiB,CAAC;;;AA7C5D;;;;;;;GAOG;AACH,qBAAa,cAAe,SAAQ,mBA0ClC;IACD;;;;;OAKG;IACH,MAAM,CAAC,KAAK,CAAC,OAAO,GAAE,oBAAyB,GAAG,KAAK,CAAC,KAAK,CAAC,cAAc,EAAE,cAAc,CAAC,CAE5F;IAED;;;;OAIG;IACH,MAAM,CAAC,cAAc,CAAC,KAAK,EAAE,KAAK,CAAC,KAAK,CAAC,OAAO,CAAC,GAAG,OAAO,CAM1D;IAED,OAAO,CAAC,MAAM,CAAC,wBAAwB;CAQvC"}
|
|
@@ -8,6 +8,8 @@ import { Duration, Effect } from 'effect';
|
|
|
8
8
|
* largest value the API sends and well below any plausible caller patience.
|
|
9
9
|
*/
|
|
10
10
|
export declare const MAX_RETRY_AFTER: Duration.Duration;
|
|
11
|
+
/** Start an attempt with no previous response's delay, including when setup fails before HTTP. */
|
|
12
|
+
export declare const clearRetryAfter: Effect.Effect<void, never, never>;
|
|
11
13
|
/**
|
|
12
14
|
* Records the `Retry-After` of every response the client receives, so {@link retryAfterDelay} can
|
|
13
15
|
* read it back when a failure is about to be retried.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"RetryAfter.d.ts","sourceRoot":"","sources":["../../src/RetryAfter.ts"],"names":[],"mappings":"AAAA,OAAO,EAAW,UAAU,EAAE,MAAM,kBAAkB,CAAA;AACtD,OAAO,EAAE,QAAQ,EAAE,MAAM,EAA4B,MAAM,QAAQ,CAAA;AAKnE;;;;;;GAMG;AACH,eAAO,MAAM,eAAe,mBAAsB,CAAA;
|
|
1
|
+
{"version":3,"file":"RetryAfter.d.ts","sourceRoot":"","sources":["../../src/RetryAfter.ts"],"names":[],"mappings":"AAAA,OAAO,EAAW,UAAU,EAAE,MAAM,kBAAkB,CAAA;AACtD,OAAO,EAAE,QAAQ,EAAE,MAAM,EAA4B,MAAM,QAAQ,CAAA;AAKnE;;;;;;GAMG;AACH,eAAO,MAAM,eAAe,mBAAsB,CAAA;AAclD,kGAAkG;AAClG,eAAO,MAAM,eAAe,mCAAiD,CAAA;AA0B7E;;;GAGG;AACH,eAAO,MAAM,gBAAgB,GAAI,CAAC,EAAE,CAAC,UAAU,UAAU,CAAC,UAAU,CAAC,IAAI,CAAC,CAAC,EAAE,CAAC,CAAC,KAAG,UAAU,CAAC,UAAU,CAAC,IAAI,CAAC,CAAC,EAAE,CAAC,CAY/G,CAAA;AAwBF;;;;;;GAMG;AACH,eAAO,MAAM,gBAAgB,eAAgB,QAAQ,CAAC,QAAQ,KAAG,MAAM,CAAC,MAAM,CAAC,QAAQ,CAAC,QAAQ,CAU9F,CAAA;AAEF;;;GAGG;AACH,eAAO,MAAM,eAAe,UAAW,OAAO,KAAG,MAAM,CAAC,MAAM,CAAC,QAAQ,CAAC,QAAQ,CAM9E,CAAA;AAEF;;;;;;;;;GASG;AACH,eAAO,MAAM,cAAc,UAAW,OAAO,WAAW,QAAQ,CAAC,QAAQ,KAAG,MAAM,CAAC,MAAM,CAAC,QAAQ,CAAC,QAAQ,CAKzG,CAAA"}
|
package/build/dts/Service.d.ts
CHANGED
|
@@ -69,12 +69,19 @@ declare const RequestOptions_base: Schema.Class<RequestOptions, {
|
|
|
69
69
|
*/
|
|
70
70
|
export declare class RequestOptions extends RequestOptions_base {
|
|
71
71
|
}
|
|
72
|
+
interface LocalOptions {
|
|
73
|
+
/**
|
|
74
|
+
* The URL is a localhost server or a file path on this machine: fetch it through a short-lived tunnel
|
|
75
|
+
* (Node.js only). Never set this for user-supplied URLs; it exposes this machine's loopback and files.
|
|
76
|
+
*/
|
|
77
|
+
readonly local?: boolean;
|
|
78
|
+
}
|
|
72
79
|
export type FetchParams = typeof Generated.FetchFetchRequest.Encoded;
|
|
73
80
|
export type FetchResponse = string;
|
|
74
|
-
export type FetchRequestOptions = RequestOptions & typeof Generated.FetchFetchParams.Encoded;
|
|
81
|
+
export type FetchRequestOptions = RequestOptions & typeof Generated.FetchFetchParams.Encoded & LocalOptions;
|
|
75
82
|
export type FetchJsonParams = typeof Generated.FetchFetchJsonRequest.Encoded;
|
|
76
83
|
export type FetchJsonResponse = FetchObjectModeJsonResponse;
|
|
77
|
-
export type FetchJsonRequestOptions = RequestOptions & typeof Generated.FetchFetchJsonParams.Encoded;
|
|
84
|
+
export type FetchJsonRequestOptions = RequestOptions & typeof Generated.FetchFetchJsonParams.Encoded & LocalOptions;
|
|
78
85
|
export interface SnapshotHighlightsParams extends Schema.Schema.Encoded<typeof Generated.SnapshotHighlightsInput> {
|
|
79
86
|
readonly snapshotId: string;
|
|
80
87
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Service.d.ts","sourceRoot":"","sources":["../../src/Service.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAyC,MAAM,kBAAkB,CAAA;AACpF,OAAO,EAAS,OAAO,EAAY,MAAM,EAAQ,KAAK,EAAwC,MAAM,EAAE,MAAM,QAAQ,CAAA;AACpH,OAAO,KAAK,EACX,iBAAiB,EACjB,kBAAkB,EAClB,iBAAiB,EACjB,YAAY,EACZ,eAAe,EACf,WAAW,EACX,eAAe,EACf,MAAM,aAAa,CAAA;AAEpB,OAAO,
|
|
1
|
+
{"version":3,"file":"Service.d.ts","sourceRoot":"","sources":["../../src/Service.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAyC,MAAM,kBAAkB,CAAA;AACpF,OAAO,EAAS,OAAO,EAAY,MAAM,EAAQ,KAAK,EAAwC,MAAM,EAAE,MAAM,QAAQ,CAAA;AACpH,OAAO,KAAK,EACX,iBAAiB,EACjB,kBAAkB,EAClB,iBAAiB,EACjB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yB,qDAM9C;CACD"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Headers.d.ts","sourceRoot":"","sources":["../../../src/Tunnel/Headers.ts"],"names":[],"mappings":"AAWA,wBAAgB,eAAe,CAAC,OAAO,EAAE,QAAQ,CAAC,SAAS,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC,GAAG,KAAK,CAAC,SAAS,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC,CAU9G"}
|
|
@@ -0,0 +1,122 @@
|
|
|
1
|
+
import { FileSystem, Path } from '@effect/platform';
|
|
2
|
+
import { Data, Effect } from 'effect';
|
|
3
|
+
import { ExpandLocalTargetError } from '../Error.js';
|
|
4
|
+
/** Something on this machine the Expand API cannot reach without a tunnel. */
|
|
5
|
+
export type LocalTarget = Data.TaggedEnum<{
|
|
6
|
+
/** A server already listening on a loopback port. `host` is dialled as written; `path` includes the query and fragment for browser navigation. */
|
|
7
|
+
Port: {
|
|
8
|
+
readonly host: string;
|
|
9
|
+
readonly port: number;
|
|
10
|
+
readonly path: string;
|
|
11
|
+
};
|
|
12
|
+
File: {
|
|
13
|
+
readonly path: string;
|
|
14
|
+
};
|
|
15
|
+
Directory: {
|
|
16
|
+
readonly path: string;
|
|
17
|
+
};
|
|
18
|
+
}>;
|
|
19
|
+
export declare const LocalTarget: {
|
|
20
|
+
readonly $is: <Tag extends "Directory" | "File" | "Port">(tag: Tag) => (u: unknown) => u is Extract<{
|
|
21
|
+
readonly _tag: "Directory";
|
|
22
|
+
readonly path: string;
|
|
23
|
+
}, {
|
|
24
|
+
readonly _tag: Tag;
|
|
25
|
+
}> | Extract<{
|
|
26
|
+
readonly _tag: "File";
|
|
27
|
+
readonly path: string;
|
|
28
|
+
}, {
|
|
29
|
+
readonly _tag: Tag;
|
|
30
|
+
}> | Extract<{
|
|
31
|
+
readonly _tag: "Port";
|
|
32
|
+
readonly host: string;
|
|
33
|
+
readonly port: number;
|
|
34
|
+
readonly path: string;
|
|
35
|
+
}, {
|
|
36
|
+
readonly _tag: Tag;
|
|
37
|
+
}>;
|
|
38
|
+
readonly $match: {
|
|
39
|
+
<const Cases extends { readonly [Tag in "Directory" | "File" | "Port"]: (args: Extract<{
|
|
40
|
+
readonly _tag: "Directory";
|
|
41
|
+
readonly path: string;
|
|
42
|
+
} | {
|
|
43
|
+
readonly _tag: "File";
|
|
44
|
+
readonly path: string;
|
|
45
|
+
} | {
|
|
46
|
+
readonly _tag: "Port";
|
|
47
|
+
readonly host: string;
|
|
48
|
+
readonly port: number;
|
|
49
|
+
readonly path: string;
|
|
50
|
+
}, {
|
|
51
|
+
readonly _tag: Tag;
|
|
52
|
+
}>) => any; }>(cases: Cases & { [K in Exclude<keyof Cases, "Directory" | "File" | "Port">]: never; }): (value: {
|
|
53
|
+
readonly _tag: "Directory";
|
|
54
|
+
readonly path: string;
|
|
55
|
+
} | {
|
|
56
|
+
readonly _tag: "File";
|
|
57
|
+
readonly path: string;
|
|
58
|
+
} | {
|
|
59
|
+
readonly _tag: "Port";
|
|
60
|
+
readonly host: string;
|
|
61
|
+
readonly port: number;
|
|
62
|
+
readonly path: string;
|
|
63
|
+
}) => import("effect/Unify").Unify<ReturnType<Cases["Directory" | "File" | "Port"]>>;
|
|
64
|
+
<const Cases extends { readonly [Tag in "Directory" | "File" | "Port"]: (args: Extract<{
|
|
65
|
+
readonly _tag: "Directory";
|
|
66
|
+
readonly path: string;
|
|
67
|
+
} | {
|
|
68
|
+
readonly _tag: "File";
|
|
69
|
+
readonly path: string;
|
|
70
|
+
} | {
|
|
71
|
+
readonly _tag: "Port";
|
|
72
|
+
readonly host: string;
|
|
73
|
+
readonly port: number;
|
|
74
|
+
readonly path: string;
|
|
75
|
+
}, {
|
|
76
|
+
readonly _tag: Tag;
|
|
77
|
+
}>) => any; }>(value: {
|
|
78
|
+
readonly _tag: "Directory";
|
|
79
|
+
readonly path: string;
|
|
80
|
+
} | {
|
|
81
|
+
readonly _tag: "File";
|
|
82
|
+
readonly path: string;
|
|
83
|
+
} | {
|
|
84
|
+
readonly _tag: "Port";
|
|
85
|
+
readonly host: string;
|
|
86
|
+
readonly port: number;
|
|
87
|
+
readonly path: string;
|
|
88
|
+
}, cases: Cases & { [K in Exclude<keyof Cases, "Directory" | "File" | "Port">]: never; }): import("effect/Unify").Unify<ReturnType<Cases["Directory" | "File" | "Port"]>>;
|
|
89
|
+
};
|
|
90
|
+
readonly Directory: Data.Case.Constructor<{
|
|
91
|
+
readonly _tag: "Directory";
|
|
92
|
+
readonly path: string;
|
|
93
|
+
}, "_tag">;
|
|
94
|
+
readonly File: Data.Case.Constructor<{
|
|
95
|
+
readonly _tag: "File";
|
|
96
|
+
readonly path: string;
|
|
97
|
+
}, "_tag">;
|
|
98
|
+
readonly Port: Data.Case.Constructor<{
|
|
99
|
+
readonly _tag: "Port";
|
|
100
|
+
readonly host: string;
|
|
101
|
+
readonly port: number;
|
|
102
|
+
readonly path: string;
|
|
103
|
+
}, "_tag">;
|
|
104
|
+
};
|
|
105
|
+
/** True for `http://localhost…` and friends — input that only a local tunnel can serve. */
|
|
106
|
+
export declare function isLoopbackUrl(input: string): boolean;
|
|
107
|
+
/** Canonicalizes a directory before serving it and refuses anything containing the home folder. */
|
|
108
|
+
export declare const resolveSafeDirectory: (input: string) => Effect.Effect<string, ExpandLocalTargetError, FileSystem.FileSystem | Path.Path>;
|
|
109
|
+
/** Reads an explicitly local input or fails with a specific, actionable error. */
|
|
110
|
+
export declare const resolveLocalTarget: (input: string) => Effect.Effect<{
|
|
111
|
+
readonly _tag: "Directory";
|
|
112
|
+
readonly path: string;
|
|
113
|
+
} | {
|
|
114
|
+
readonly _tag: "File";
|
|
115
|
+
readonly path: string;
|
|
116
|
+
} | {
|
|
117
|
+
readonly _tag: "Port";
|
|
118
|
+
readonly host: string;
|
|
119
|
+
readonly port: number;
|
|
120
|
+
readonly path: string;
|
|
121
|
+
}, ExpandLocalTargetError, FileSystem.FileSystem | Path.Path>;
|
|
122
|
+
//# sourceMappingURL=Loc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B/B,CAAA;AA4DF,kFAAkF;AAClF,eAAO,MAAM,kBAAkB;;mBA9HF,MAAM;;;mBADX,MAAM;;;mBADN,MAAM;mBAAiB,MAAM;mBAAiB,MAAM;6DA+I1E,CAAA"}
|
|
@@ -0,0 +1,160 @@
|
|
|
1
|
+
import { Schema } from 'effect';
|
|
2
|
+
/**
|
|
3
|
+
* Wire protocol between a local tunnel client (CLI / SDK) and the Cloudflare
|
|
4
|
+
* relay (`packages/tunnel-relay`). One WebSocket per tunnel.
|
|
5
|
+
*
|
|
6
|
+
* Control frames are JSON text frames. Body bytes travel as binary frames:
|
|
7
|
+
* the 16-byte request id followed by the chunk. Every control frame carries
|
|
8
|
+
* `v: 1` so either side can reject a peer it does not understand.
|
|
9
|
+
*/
|
|
10
|
+
export declare const PROTOCOL_VERSION = 1;
|
|
11
|
+
/** Upper bound on one binary body frame; larger bodies are split. */
|
|
12
|
+
export declare const MAX_BODY_FRAME_BYTES: number;
|
|
13
|
+
/** Upper bound on each request or response body. */
|
|
14
|
+
export declare const MAX_BODY_BYTES: number;
|
|
15
|
+
/** Bounds both relay requests and local work, including uploads still being buffered. */
|
|
16
|
+
export declare const MAX_INFLIGHT_REQUESTS = 32;
|
|
17
|
+
/** 16-byte request id encoded as 32 lowercase hex characters. */
|
|
18
|
+
export declare const RequestId: Schema.brand<Schema.filter<typeof Schema.String>, "TunnelRequestId">;
|
|
19
|
+
export type RequestId = typeof RequestId.Type;
|
|
20
|
+
/** First frame after the socket opens. `url` is the tunnel's public origin, no trailing slash. */
|
|
21
|
+
export declare const Hello: Schema.TaggedStruct<"Hello", {
|
|
22
|
+
v: Schema.Literal<[1]>;
|
|
23
|
+
} & {
|
|
24
|
+
url: typeof Schema.String;
|
|
25
|
+
}>;
|
|
26
|
+
export declare const RequestStart: Schema.TaggedStruct<"RequestStart", {
|
|
27
|
+
v: Schema.Literal<[1]>;
|
|
28
|
+
} & {
|
|
29
|
+
id: Schema.brand<Schema.filter<typeof Schema.String>, "TunnelRequestId">;
|
|
30
|
+
method: typeof Schema.String;
|
|
31
|
+
/** Path plus query, e.g. `/docs?x=1`. */
|
|
32
|
+
path: typeof Schema.String;
|
|
33
|
+
headers: Schema.Array$<Schema.Tuple2<typeof Schema.String, typeof Schema.String>>;
|
|
34
|
+
/** When true, binary body frames follow until `RequestEnd`. */
|
|
35
|
+
hasBody: typeof Schema.Boolean;
|
|
36
|
+
}>;
|
|
37
|
+
export declare const RelayToClient: Schema.Union<[Schema.TaggedStruct<"Hello", {
|
|
38
|
+
v: Schema.Literal<[1]>;
|
|
39
|
+
} & {
|
|
40
|
+
url: typeof Schema.String;
|
|
41
|
+
}>, Schema.TaggedStruct<"RequestStart", {
|
|
42
|
+
v: Schema.Literal<[1]>;
|
|
43
|
+
} & {
|
|
44
|
+
id: Schema.brand<Schema.filter<typeof Schema.String>, "TunnelRequestId">;
|
|
45
|
+
method: typeof Schema.String;
|
|
46
|
+
/** Path plus query, e.g. `/docs?x=1`. */
|
|
47
|
+
path: typeof Schema.String;
|
|
48
|
+
headers: Schema.Array$<Schema.Tuple2<typeof Schema.String, typeof Schema.String>>;
|
|
49
|
+
/** When true, binary body frames follow until `RequestEnd`. */
|
|
50
|
+
hasBody: typeof Schema.Boolean;
|
|
51
|
+
}>, Schema.TaggedStruct<"RequestEnd", {
|
|
52
|
+
v: Schema.Literal<[1]>;
|
|
53
|
+
} & {
|
|
54
|
+
id: Schema.brand<Schema.filter<typeof Schema.String>, "TunnelRequestId">;
|
|
55
|
+
}>, Schema.TaggedStruct<"RequestCancel", {
|
|
56
|
+
v: Schema.Literal<[1]>;
|
|
57
|
+
} & {
|
|
58
|
+
id: Schema.brand<Schema.filter<typeof Schema.String>, "TunnelRequestId">;
|
|
59
|
+
}>]>;
|
|
60
|
+
export type RelayToClient = typeof RelayToClient.Type;
|
|
61
|
+
export declare const ClientToRelay: Schema.Union<[Schema.TaggedStruct<"ResponseStart", {
|
|
62
|
+
v: Schema.Literal<[1]>;
|
|
63
|
+
} & {
|
|
64
|
+
id: Schema.brand<Schema.filter<typeof Schema.String>, "TunnelRequestId">;
|
|
65
|
+
status: typeof Schema.Number;
|
|
66
|
+
headers: Schema.Array$<Schema.Tuple2<typeof Schema.String, typeof Schema.String>>;
|
|
67
|
+
}>, Schema.TaggedStruct<"ResponseEnd", {
|
|
68
|
+
v: Schema.Literal<[1]>;
|
|
69
|
+
} & {
|
|
70
|
+
id: Schema.brand<Schema.filter<typeof Schema.String>, "TunnelRequestId">;
|
|
71
|
+
}>, Schema.TaggedStruct<"ResponseError", {
|
|
72
|
+
v: Schema.Literal<[1]>;
|
|
73
|
+
} & {
|
|
74
|
+
id: Schema.brand<Schema.filter<typeof Schema.String>, "TunnelRequestId">;
|
|
75
|
+
message: typeof Schema.String;
|
|
76
|
+
}>]>;
|
|
77
|
+
export type ClientToRelay = typeof ClientToRelay.Type;
|
|
78
|
+
export declare const decodeRelayToClient: (u: unknown, overrideOptions?: import("effect/SchemaAST").ParseOptions) => {
|
|
79
|
+
readonly _tag: "Hello";
|
|
80
|
+
readonly v: 1;
|
|
81
|
+
readonly url: string;
|
|
82
|
+
} | {
|
|
83
|
+
readonly _tag: "RequestStart";
|
|
84
|
+
readonly v: 1;
|
|
85
|
+
readonly id: string & import("effect/Brand").Brand<"TunnelRequestId">;
|
|
86
|
+
readonly method: string;
|
|
87
|
+
readonly path: string;
|
|
88
|
+
readonly headers: readonly (readonly [string, string])[];
|
|
89
|
+
readonly hasBody: boolean;
|
|
90
|
+
} | {
|
|
91
|
+
readonly _tag: "RequestEnd";
|
|
92
|
+
readonly v: 1;
|
|
93
|
+
readonly id: string & import("effect/Brand").Brand<"TunnelRequestId">;
|
|
94
|
+
} | {
|
|
95
|
+
readonly _tag: "RequestCancel";
|
|
96
|
+
readonly v: 1;
|
|
97
|
+
readonly id: string & import("effect/Brand").Brand<"TunnelRequestId">;
|
|
98
|
+
};
|
|
99
|
+
export declare const decodeClientToRelay: (u: unknown, overrideOptions?: import("effect/SchemaAST").ParseOptions) => {
|
|
100
|
+
readonly _tag: "ResponseStart";
|
|
101
|
+
readonly v: 1;
|
|
102
|
+
readonly id: string & import("effect/Brand").Brand<"TunnelRequestId">;
|
|
103
|
+
readonly status: number;
|
|
104
|
+
readonly headers: readonly (readonly [string, string])[];
|
|
105
|
+
} | {
|
|
106
|
+
readonly _tag: "ResponseEnd";
|
|
107
|
+
readonly v: 1;
|
|
108
|
+
readonly id: string & import("effect/Brand").Brand<"TunnelRequestId">;
|
|
109
|
+
} | {
|
|
110
|
+
readonly _tag: "ResponseError";
|
|
111
|
+
readonly v: 1;
|
|
112
|
+
readonly id: string & import("effect/Brand").Brand<"TunnelRequestId">;
|
|
113
|
+
readonly message: string;
|
|
114
|
+
};
|
|
115
|
+
export declare const encodeRelayToClient: (a: {
|
|
116
|
+
readonly _tag: "Hello";
|
|
117
|
+
readonly v: 1;
|
|
118
|
+
readonly url: string;
|
|
119
|
+
} | {
|
|
120
|
+
readonly _tag: "RequestStart";
|
|
121
|
+
readonly v: 1;
|
|
122
|
+
readonly id: string & import("effect/Brand").Brand<"TunnelRequestId">;
|
|
123
|
+
readonly method: string;
|
|
124
|
+
readonly path: string;
|
|
125
|
+
readonly headers: readonly (readonly [string, string])[];
|
|
126
|
+
readonly hasBody: boolean;
|
|
127
|
+
} | {
|
|
128
|
+
readonly _tag: "RequestEnd";
|
|
129
|
+
readonly v: 1;
|
|
130
|
+
readonly id: string & import("effect/Brand").Brand<"TunnelRequestId">;
|
|
131
|
+
} | {
|
|
132
|
+
readonly _tag: "RequestCancel";
|
|
133
|
+
readonly v: 1;
|
|
134
|
+
readonly id: string & import("effect/Brand").Brand<"TunnelRequestId">;
|
|
135
|
+
}, overrideOptions?: import("effect/SchemaAST").ParseOptions) => string;
|
|
136
|
+
export declare const encodeClientToRelay: (a: {
|
|
137
|
+
readonly _tag: "ResponseStart";
|
|
138
|
+
readonly v: 1;
|
|
139
|
+
readonly id: string & import("effect/Brand").Brand<"TunnelRequestId">;
|
|
140
|
+
readonly status: number;
|
|
141
|
+
readonly headers: readonly (readonly [string, string])[];
|
|
142
|
+
} | {
|
|
143
|
+
readonly _tag: "ResponseEnd";
|
|
144
|
+
readonly v: 1;
|
|
145
|
+
readonly id: string & import("effect/Brand").Brand<"TunnelRequestId">;
|
|
146
|
+
} | {
|
|
147
|
+
readonly _tag: "ResponseError";
|
|
148
|
+
readonly v: 1;
|
|
149
|
+
readonly id: string & import("effect/Brand").Brand<"TunnelRequestId">;
|
|
150
|
+
readonly message: string;
|
|
151
|
+
}, overrideOptions?: import("effect/SchemaAST").ParseOptions) => string;
|
|
152
|
+
/** Binary frame layout: 16 id bytes, then the chunk. */
|
|
153
|
+
export declare function encodeBodyFrame(id: RequestId, chunk: Uint8Array): Uint8Array;
|
|
154
|
+
export declare function decodeBodyFrame(frameBytes: Uint8Array): {
|
|
155
|
+
readonly id: RequestId;
|
|
156
|
+
readonly chunk: Uint8Array;
|
|
157
|
+
};
|
|
158
|
+
/** Views over a body chunk that fit the protocol's frame-size limit. */
|
|
159
|
+
export declare function splitBodyChunk(chunk: Uint8Array): Uint8Array[];
|
|
160
|
+
//# sourceMappingURL=Protocol.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Protocol.d.ts","sourceRoot":"","sources":["../../../src/Tunnel/Protocol.ts"],"names":[],"mappings":"AAAA,OAAO,EAAmB,MAAM,EAAE,MAAM,QAAQ,CAAA;AAEhD;;;;;;;GAOG;AAEH,eAAO,MAAM,gBAAgB,IAAI,CAAA;AAEjC,qEAAqE;AACrE,eAAO,MAAM,oBAAoB,QAAa,CAAA;AAC9C,oDAAoD;AACpD,eAAO,MAAM,cAAc,QAAmB,CAAA;AAC9C,yFAAyF;AACzF,eAAO,MAAM,qBAAqB,KAAK,CAAA;AAEvC,iEAAiE;AACjE,eAAO,MAAM,SAAS,sEAAyF,CAAA;AAC/G,MAAM,MAAM,SAAS,GAAG,OAAO,SAAS,CAAC,IAAI,CAAA;AAS7C,kGAAkG;AAClG,eAAO,MAAM,KAAK;;;;EAAyC,CAAA;AAE3D,eAAO,MAAM,YAAY;;;;;IAGxB,yCAAyC;;;IAGzC,+DAA+D;;EAE9D,CAAA;AAmBF,eAAO,MAAM,aAAa;;;;;;;;;IAxBzB,yCAAyC;;;IAGzC,+DAA+D;;;;;;;;;;IAqByB,CAAA;AACzF,MAAM,MAAM,aAAa,GAAG,OAAO,aAAa,CAAC,IAAI,CAAA;AAErD,eAAO,MAAM,aAAa;;;;;;;;;;;;;;;IAA0D,CAAA;AACpF,MAAM,MAAM,aAAa,GAAG,OAAO,aAAa,CAAC,IAAI,CAAA;AAErD,eAAO,MAAM,mBAAmB;;;;;;;;;;;;;;;;;;;;CAA4D,CAAA;AAC5F,eAAO,MAAM,mBAAmB;;;;;;;;;;;;;;;CAA4D,CAAA;AAC5F,eAAO,MAAM,mBAAmB;;;;;;;;;;;;;;;;;;;;uEAAqD,CAAA;AACrF,eAAO,MAAM,mBAAmB;;;;;;;;;;;;;;;uEAAqD,CAAA;AAKrF,wDAAwD;AACxD,wBAAgB,eAAe,CAAC,EAAE,EAAE,SAAS,EAAE,KAAK,EAAE,UAAU,GAAG,UAAU,CAK5E;AAED,wBAAgB,eAAe,CAAC,UAAU,EAAE,UAAU,GAAG;IAAE,QAAQ,CAAC,EAAE,EAAE,SAAS,CAAC;IAAC,QAAQ,CAAC,KAAK,EAAE,UAAU,CAAA;CAAE,CAQ9G;AAED,wEAAwE;AACxE,wBAAgB,cAAc,CAAC,KAAK,EAAE,UAAU,GAAG,UAAU,EAAE,CAI9D"}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { FileSystem, HttpServer, HttpServerError, Path } from '@effect/platform';
|
|
2
|
+
import { Effect } from 'effect';
|
|
3
|
+
/** Serves exactly one file at `/<basename>`; nothing else on the machine is reachable. */
|
|
4
|
+
export declare const serveFile: (file: string) => Effect.Effect<number, HttpServerError.ServeError, FileSystem.FileSystem | import("@effect/platform/HttpPlatform").HttpPlatform | HttpServer.HttpServer | Path.Path | import("effect/Scope").Scope>;
|
|
5
|
+
/**
|
|
6
|
+
* Serves `root`; directories answer with their `index.html`. Dotfiles (`.env`, `.git/`) and anything
|
|
7
|
+
* resolving outside `root`, through `..` or a symlink, are a 404.
|
|
8
|
+
*/
|
|
9
|
+
export declare const serveDirectory: (root: string) => Effect.Effect<number, HttpServerError.ServeError, FileSystem.FileSystem | import("@effect/platform/HttpPlatform").HttpPlatform | HttpServer.HttpServer | Path.Path | import("effect/Scope").Scope>;
|
|
10
|
+
//# sourceMappingURL=StaticServer.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"StaticServer.d.ts","sourceRoot":"","sources":["../../../src/Tunnel/StaticServer.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,UAAU,EAAE,eAAe,EAAyC,IAAI,EAAE,MAAM,kBAAkB,CAAA;AACvH,OAAO,EAAE,MAAM,EAAiB,MAAM,QAAQ,CAAA;AA6C9C,0FAA0F;AAC1F,eAAO,MAAM,SAAS,SAAU,MAAM,uMAMpC,CAAA;AAEF;;;GAGG;AACH,eAAO,MAAM,cAAc,SAAU,MAAM,uMAyBzC,CAAA"}
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
import { Effect, Schema } from 'effect';
|
|
2
|
+
import { ExpandLocalTargetError } from '../Error.js';
|
|
3
|
+
declare const TunnelError_base: Schema.TaggedErrorClass<TunnelError, "TunnelError", {
|
|
4
|
+
readonly _tag: Schema.tag<"TunnelError">;
|
|
5
|
+
} & {
|
|
6
|
+
reason: Schema.Literal<["Unauthorized", "Configuration", "RelayUnreachable"]>;
|
|
7
|
+
message: typeof Schema.String;
|
|
8
|
+
cause: Schema.optional<typeof Schema.Defect>;
|
|
9
|
+
}>;
|
|
10
|
+
export declare class TunnelError extends TunnelError_base {
|
|
11
|
+
}
|
|
12
|
+
/** What the relay needs to accept a tunnel: the API base URL it derives from, and the caller's credentials. */
|
|
13
|
+
interface TunnelCredentials {
|
|
14
|
+
readonly baseUrl: string;
|
|
15
|
+
/** `x-expand-api-key`, or the CLI's OAuth `authorization`. */
|
|
16
|
+
readonly headers: Readonly<Record<string, string>>;
|
|
17
|
+
}
|
|
18
|
+
/**
|
|
19
|
+
* Opens a tunnel from the relay to `target` for the lifetime of the scope and returns its public URL.
|
|
20
|
+
* Closing the scope closes the socket and, for file targets, the static server.
|
|
21
|
+
*/
|
|
22
|
+
export declare const openTunnel: (target: {
|
|
23
|
+
readonly _tag: "Directory";
|
|
24
|
+
readonly path: string;
|
|
25
|
+
} | {
|
|
26
|
+
readonly _tag: "File";
|
|
27
|
+
readonly path: string;
|
|
28
|
+
} | {
|
|
29
|
+
readonly _tag: "Port";
|
|
30
|
+
readonly host: string;
|
|
31
|
+
readonly port: number;
|
|
32
|
+
readonly path: string;
|
|
33
|
+
}, relayUrl: string, headers: Readonly<Record<string, string>>) => Effect.Effect<string, ExpandLocalTargetError | TunnelError, import("effect/Scope").Scope>;
|
|
34
|
+
/**
|
|
35
|
+
* Runs `use` with a public URL for `input`, which must be a local target (see `resolveLocalTarget`),
|
|
36
|
+
* and closes the tunnel afterwards.
|
|
37
|
+
*/
|
|
38
|
+
export declare const withLocalTunnel: <A, E, R, CredentialsError>(input: string, credentials: Effect.Effect<TunnelCredentials, CredentialsError>, use: (url: string) => Effect.Effect<A, E, R>) => Effect.Effect<A, E | CredentialsError | TunnelError | ExpandLocalTargetError, R>;
|
|
39
|
+
export {};
|
|
40
|
+
//# sourceMappingURL=Tunnel.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Tunnel.d.ts","sourceRoot":"","sources":["../../../src/Tunnel/Tunnel.ts"],"names":[],"mappings":"AAYA,OAAO,EAA8B,MAAM,EAA4C,MAAM,EAAU,MAAM,QAAQ,CAAA;AAErH,OAAO,EAAE,sBAAsB,EAAE,MAAM,aAAa,CAAA;;;;;;;;AAmBpD,qBAAa,WAAY,SAAQ,gBAI/B;CAAG;AAEL,+GAA+G;AAC/G,UAAU,iBAAiB;IAC1B,QAAQ,CAAC,OAAO,EAAE,MAAM,CAAA;IACxB,8DAA8D;IAC9D,QAAQ,CAAC,OAAO,EAAE,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC,CAAA;CAClD;AAoTD;;;GAGG;AACH,eAAO,MAAM,UAAU;;;;;;;;;;;4JA4BtB,CAAA;AAED;;;GAGG;AACH,eAAO,MAAM,eAAe,EAAE,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,gBAAgB,EACvD,KAAK,EAAE,MAAM,EACb,WAAW,EAAE,MAAM,CAAC,MAAM,CAAC,iBAAiB,EAAE,gBAAgB,CAAC,EAC/D,GAAG,EAAE,CAAC,GAAG,EAAE,MAAM,KAAK,MAAM,CAAC,MAAM,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,CAAC,KACxC,MAAM,CAAC,MAAM,CAAC,CAAC,EAAE,CAAC,GAAG,gBAAgB,GAAG,WAAW,GAAG,sBAAsB,EAAE,CAAC,CAyBnF,CAAA"}
|
package/build/dts/index.d.ts
CHANGED
|
@@ -3,8 +3,8 @@ export { APPENDIX_MARKER_PREFIX, AppendixMarkerLevel, isAppendixMarkerLine, pars
|
|
|
3
3
|
export type { BatchedParams, BatchedRequestOptions, BatchedResponse, CancelBatchedResponse, ExpandClientOptions, FetchJsonParams, FetchJsonRequestOptions, FetchJsonResponse, FetchParams, FetchRequestOptions, FetchResponse, GetBatchedParams, GetBatchedResponse, SnapshotCatalog, SnapshotCatalogParams, SnapshotGetParams, SnapshotHighlightsParams, SnapshotHighlightsResponse, } from './Client.js';
|
|
4
4
|
export { Expand, ExpandClient } from './Client.js';
|
|
5
5
|
export * from './Crawls.js';
|
|
6
|
-
export type { ExpandError } from './Error.js';
|
|
7
|
-
export { ExpandApiError, ExpandClientApiError, ExpandClientConnectionError, ExpandClientError, ExpandClientTimeoutError, ExpandConnectionError, ExpandSdkError, ExpandTimeoutError, } from './Error.js';
|
|
6
|
+
export type { ExpandError, LocalTargetErrorReason } from './Error.js';
|
|
7
|
+
export { ExpandApiError, ExpandClientApiError, ExpandClientConnectionError, ExpandClientError, ExpandClientLocalTargetError, ExpandClientTimeoutError, ExpandConnectionError, ExpandLocalTargetError, ExpandSdkError, ExpandTimeoutError, } from './Error.js';
|
|
8
8
|
export type { FetchOriginErrorResponse } from './FetchJson.js';
|
|
9
9
|
export { isFetchOriginError } from './FetchJson.js';
|
|
10
10
|
export type { SnapshotHandle } from './Playground.js';
|
package/build/dts/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA,YAAY,EAAE,cAAc,EAAE,MAAM,sBAAsB,CAAA;AAC1D,OAAO,EACN,sBAAsB,EACtB,mBAAmB,EACnB,oBAAoB,EACpB,uBAAuB,EACvB,oBAAoB,EACpB,oBAAoB,EACpB,iBAAiB,GACjB,MAAM,sBAAsB,CAAA;AAC7B,YAAY,EACX,aAAa,EACb,qBAAqB,EACrB,eAAe,EACf,qBAAqB,EACrB,mBAAmB,EACnB,eAAe,EACf,uBAAuB,EACvB,iBAAiB,EACjB,WAAW,EACX,mBAAmB,EACnB,aAAa,EACb,gBAAgB,EAChB,kBAAkB,EAClB,eAAe,EACf,qBAAqB,EACrB,iBAAiB,EACjB,wBAAwB,EACxB,0BAA0B,GAC1B,MAAM,aAAa,CAAA;AACpB,OAAO,EAAE,MAAM,EAAE,YAAY,EAAE,MAAM,aAAa,CAAA;AAClD,cAAc,aAAa,CAAA;AAC3B,YAAY,EAAE,WAAW,EAAE,MAAM,YAAY,CAAA;
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA,YAAY,EAAE,cAAc,EAAE,MAAM,sBAAsB,CAAA;AAC1D,OAAO,EACN,sBAAsB,EACtB,mBAAmB,EACnB,oBAAoB,EACpB,uBAAuB,EACvB,oBAAoB,EACpB,oBAAoB,EACpB,iBAAiB,GACjB,MAAM,sBAAsB,CAAA;AAC7B,YAAY,EACX,aAAa,EACb,qBAAqB,EACrB,eAAe,EACf,qBAAqB,EACrB,mBAAmB,EACnB,eAAe,EACf,uBAAuB,EACvB,iBAAiB,EACjB,WAAW,EACX,mBAAmB,EACnB,aAAa,EACb,gBAAgB,EAChB,kBAAkB,EAClB,eAAe,EACf,qBAAqB,EACrB,iBAAiB,EACjB,wBAAwB,EACxB,0BAA0B,GAC1B,MAAM,aAAa,CAAA;AACpB,OAAO,EAAE,MAAM,EAAE,YAAY,EAAE,MAAM,aAAa,CAAA;AAClD,cAAc,aAAa,CAAA;AAC3B,YAAY,EAAE,WAAW,EAAE,sBAAsB,EAAE,MAAM,YAAY,CAAA;AACrE,OAAO,EACN,cAAc,EACd,oBAAoB,EACpB,2BAA2B,EAC3B,iBAAiB,EACjB,4BAA4B,EAC5B,wBAAwB,EACxB,qBAAqB,EACrB,sBAAsB,EACtB,cAAc,EACd,kBAAkB,GAClB,MAAM,YAAY,CAAA;AACnB,YAAY,EAAE,wBAAwB,EAAE,MAAM,gBAAgB,CAAA;AAC9D,OAAO,EAAE,kBAAkB,EAAE,MAAM,gBAAgB,CAAA;AACnD,YAAY,EAAE,cAAc,EAAE,MAAM,iBAAiB,CAAA;AACrD,OAAO,EACN,WAAW,EACX,uBAAuB,EACvB,mBAAmB,EACnB,qBAAqB,EACrB,cAAc,EACd,oBAAoB,EACpB,qBAAqB,GACrB,MAAM,iBAAiB,CAAA;AACxB,OAAO,EAAE,aAAa,EAAE,oBAAoB,EAAE,cAAc,EAAE,MAAM,cAAc,CAAA"}
|
package/build/esm/Error.js
CHANGED
|
@@ -1,4 +1,20 @@
|
|
|
1
1
|
import { Schema } from 'effect';
|
|
2
|
+
const LOCAL_TARGET_ERROR_REASON = Schema.Literal('InvalidInput', 'NotLocal', 'UnsupportedProtocol', 'NotFound', 'PermissionDenied', 'UnsupportedFileType', 'Unavailable', 'UnsafeDirectory');
|
|
3
|
+
/** A local input cannot be fetched. Inspect `reason` rather than parsing the message. */
|
|
4
|
+
export class ExpandLocalTargetError extends Schema.TaggedError()('ExpandLocalTargetError', {
|
|
5
|
+
reason: LOCAL_TARGET_ERROR_REASON,
|
|
6
|
+
input: Schema.String,
|
|
7
|
+
message: Schema.String,
|
|
8
|
+
cause: Schema.optional(Schema.Defect),
|
|
9
|
+
}) {
|
|
10
|
+
toPublicError() {
|
|
11
|
+
return new ExpandClientLocalTargetError(this.message, {
|
|
12
|
+
reason: this.reason,
|
|
13
|
+
input: this.input,
|
|
14
|
+
cause: this.cause,
|
|
15
|
+
});
|
|
16
|
+
}
|
|
17
|
+
}
|
|
2
18
|
/**
|
|
3
19
|
* Effect-side base error. Schema.TaggedError; Effect consumers receive these in the error channel.
|
|
4
20
|
*/
|
|
@@ -55,6 +71,17 @@ export class ExpandClientError extends Error {
|
|
|
55
71
|
this.name = 'ExpandClientError';
|
|
56
72
|
}
|
|
57
73
|
}
|
|
74
|
+
/** A local input cannot be fetched. Includes the input, stable reason, and original filesystem cause. */
|
|
75
|
+
export class ExpandClientLocalTargetError extends ExpandClientError {
|
|
76
|
+
reason;
|
|
77
|
+
input;
|
|
78
|
+
constructor(message, options) {
|
|
79
|
+
super(message, options);
|
|
80
|
+
this.name = 'ExpandClientLocalTargetError';
|
|
81
|
+
this.reason = options.reason;
|
|
82
|
+
this.input = options.input;
|
|
83
|
+
}
|
|
84
|
+
}
|
|
58
85
|
/**
|
|
59
86
|
* Promise-side error for non-2xx API responses. Inspect `status` and `body` for details.
|
|
60
87
|
*/
|
package/build/esm/Error.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Error.js","sourceRoot":"","sources":["../../src/Error.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,MAAM,QAAQ,CAAA;AAE/B;;GAEG;AACH,MAAM,OAAO,cAAe,SAAQ,MAAM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,OAAe,EAAE,OAAO,GAAiB,EAAE;QACtD,KAAK,CAAC,OAAO,EAAE,OAAO,CAAC,CAAA;QACvB,IAAI,CAAC,IAAI,GAAG,6BAA6B,CAAA;IAC1C,CAAC;CACD;AAED;;GAEG;AACH,MAAM,OAAO,wBAAyB,SAAQ,2BAA2B;IAC/D,SAAS,CAAQ;IAE1B,YAAY,OAAe,EAAE,OAAsD;QAClF,KAAK,CAAC,OAAO,EAAE,OAAO,CAAC,CAAA;QACvB,IAAI,CAAC,IAAI,GAAG,0BAA0B,CAAA;QACtC,IAAI,CAAC,SAAS,GAAG,OAAO,CAAC,SAAS,CAAA;IACnC,CAAC;CACD"}
|
package/build/esm/Internal.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { HttpClientError } from '@effect/platform';
|
|
2
2
|
import { Cause, Effect, HashSet, Layer, Match, Option, ParseResult, Predicate } from 'effect';
|
|
3
|
-
import { ExpandApiError, ExpandClientApiError, ExpandClientConnectionError, ExpandClientError, ExpandClientTimeoutError, ExpandConnectionError, ExpandSdkError, ExpandTimeoutError, } from './Error.js';
|
|
3
|
+
import { ExpandApiError, ExpandClientApiError, ExpandClientConnectionError, ExpandClientError, ExpandClientLocalTargetError, ExpandClientTimeoutError, ExpandConnectionError, ExpandLocalTargetError, ExpandSdkError, ExpandTimeoutError, } from './Error.js';
|
|
4
4
|
import { decodedErrorStatus } from './HttpClientHelpers.js';
|
|
5
5
|
import { errorField, parseErrorBody } from './ParseErrorBody.js';
|
|
6
6
|
import { ExpandService, } from './Service.js';
|
|
@@ -77,8 +77,16 @@ export function toExpandError(error, timeoutMs) {
|
|
|
77
77
|
if (error instanceof ExpandApiError ||
|
|
78
78
|
error instanceof ExpandConnectionError ||
|
|
79
79
|
error instanceof ExpandTimeoutError ||
|
|
80
|
+
error instanceof ExpandLocalTargetError ||
|
|
80
81
|
error instanceof ExpandSdkError)
|
|
81
82
|
return error;
|
|
83
|
+
if (error instanceof ExpandClientLocalTargetError)
|
|
84
|
+
return new ExpandLocalTargetError({
|
|
85
|
+
reason: error.reason,
|
|
86
|
+
input: error.input,
|
|
87
|
+
message: error.message,
|
|
88
|
+
cause: error.cause,
|
|
89
|
+
});
|
|
82
90
|
if (error instanceof ExpandClientApiError)
|
|
83
91
|
return new ExpandApiError({ message: error.message, status: error.status, body: error.body, cause: error });
|
|
84
92
|
if (error instanceof ExpandClientTimeoutError)
|