effect-cf 0.46.0 → 0.47.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/CHANGELOG.md +16 -0
- package/README.md +2 -0
- package/dist/AiGateway.d.mts +7 -8
- package/dist/AnalyticsEngine.d.mts +5 -6
- package/dist/Artifacts.d.mts +24 -25
- package/dist/Cache.d.mts +11 -12
- package/dist/DurableObjectRpcWebSocket.mjs +20 -7
- package/dist/Email.d.mts +7 -8
- package/dist/Images.d.mts +53 -54
- package/dist/Kv.d.mts +0 -1
- package/dist/QueueBinding.d.mts +11 -12
- package/dist/R2.d.mts +14 -15
- package/dist/RpcWebSocketClient.d.mts +30 -0
- package/dist/RpcWebSocketClient.mjs +19 -0
- package/dist/Vectorize.d.mts +17 -18
- package/dist/WebTransport.d.mts +0 -1
- package/dist/WebTransport.mjs +31 -0
- package/dist/WorkersAi.d.mts +0 -1
- package/dist/WorkflowBinding.d.mts +14 -15
- package/dist/index.d.mts +2 -1
- package/dist/index.mjs +2 -1
- package/package.json +6 -1
- package/src/AiGateway.ts +2 -3
- package/src/AnalyticsEngine.ts +2 -6
- package/src/Artifacts.ts +8 -16
- package/src/Cache.ts +7 -13
- package/src/DurableObjectRpcWebSocket.ts +25 -2
- package/src/Email.ts +5 -11
- package/src/Images.ts +31 -60
- package/src/Kv.ts +2 -6
- package/src/QueueBinding.ts +8 -17
- package/src/R2.ts +29 -49
- package/src/RpcWebSocketClient.ts +45 -0
- package/src/Vectorize.ts +11 -29
- package/src/WebTransport.ts +2 -4
- package/src/WorkersAi.ts +2 -17
- package/src/WorkflowBinding.ts +14 -26
- package/src/index.ts +1 -0
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,21 @@
|
|
|
1
1
|
# effect-cf
|
|
2
2
|
|
|
3
|
+
## 0.47.0
|
|
4
|
+
|
|
5
|
+
### Minor Changes
|
|
6
|
+
|
|
7
|
+
- [#190](https://github.com/danieljvdm/effect-cf/pull/190) [`a3ae008`](https://github.com/danieljvdm/effect-cf/commit/a3ae008af959d08eec649042edc9309982354a0d) Thanks [@danieljvdm](https://github.com/danieljvdm)! - Add `RpcWebSocketClient.layer` and the browser-safe `effect-cf/rpc-websocket-client` entrypoint. Provide a typed client service and its WebSocket connection for an application or session without requiring callers to wrap client construction in `Effect.scoped`. The layer closes the connection when its lifetime ends.
|
|
8
|
+
|
|
9
|
+
Persist the RPC serializer's content type in Durable Object WebSocket attachments and reset restored connections whose saved content type differs from the server's, preventing incompatible frames from reaching RPC handlers after a deployment. Existing attachments without serializer metadata remain supported.
|
|
10
|
+
|
|
11
|
+
Acknowledge WebSocket close events and ignore late messages on closed connections so client scope cleanup completes the close handshake.
|
|
12
|
+
|
|
13
|
+
## 0.46.1
|
|
14
|
+
|
|
15
|
+
### Patch Changes
|
|
16
|
+
|
|
17
|
+
- [#188](https://github.com/danieljvdm/effect-cf/pull/188) [`731938e`](https://github.com/danieljvdm/effect-cf/commit/731938ec635355c769f451b6153f8eb806ad98c1) Thanks [@limwa](https://github.com/limwa)! - Fix declaration portability by referencing consumer-provided Cloudflare Workers globals instead of importing `@cloudflare/workers-types`.
|
|
18
|
+
|
|
3
19
|
## 0.46.0
|
|
4
20
|
|
|
5
21
|
### Minor Changes
|
package/README.md
CHANGED
|
@@ -10,6 +10,8 @@ The repository tests against workerd `1.20260825.1` and `@cloudflare/workers-typ
|
|
|
10
10
|
|
|
11
11
|
See the [runtime performance guide](https://github.com/danieljvdm/effect-cf/blob/main/docs/runtime-performance.md) for measured alarm batching and telemetry configuration guidance.
|
|
12
12
|
|
|
13
|
+
For typed WebSocket RPC clients whose connection lifetime is owned by an Effect layer, see the [WebSocket RPC guide](https://github.com/danieljvdm/effect-cf/blob/main/docs/websocket-rpc.md).
|
|
14
|
+
|
|
13
15
|
## Worker
|
|
14
16
|
|
|
15
17
|
```ts
|
package/dist/AiGateway.d.mts
CHANGED
|
@@ -3,7 +3,6 @@ import { BindingNotFoundError, BindingValidationError } from "./Binding.mjs";
|
|
|
3
3
|
import { WorkersAiBinding, isWorkersAiBinding } from "./WorkersAi.mjs";
|
|
4
4
|
import * as Context$1 from "effect/Context";
|
|
5
5
|
import * as Effect from "effect/Effect";
|
|
6
|
-
import { AiGateway } from "@cloudflare/workers-types";
|
|
7
6
|
import { Layer } from "effect";
|
|
8
7
|
declare namespace AiGateway_d_exports {
|
|
9
8
|
export { AiGatewayBinding, AiGatewayClient, AiGatewayDefinition, AiGatewayFetchOptions, AiGatewayHeaders, AiGatewayLog, AiGatewayOperationError, AiGatewayPatchLog, AiGatewayProvider, AiGatewayRunOptions, AiGatewayService, AiGatewayUniversalRequest, BindingNotFoundError, BindingValidationError, LayerOptions, Tag, TagClass, isAiGatewayBinding, layer, make, makeClient, makeClientFromAi, makeHttpClient };
|
|
@@ -30,7 +29,7 @@ type AiGatewayLog = Awaited<ReturnType<AiGatewayBinding["getLog"]>>;
|
|
|
30
29
|
type AiGatewayProvider = NonNullable<Parameters<AiGatewayBinding["getUrl"]>[0]>;
|
|
31
30
|
type AiGatewayUniversalRequest = Exclude<AiGatewayRunData, ReadonlyArray<unknown>>;
|
|
32
31
|
type AiGatewayHeaders = NonNullable<AiGatewayUniversalRequest["headers"]>;
|
|
33
|
-
type AiGatewayRunOptions = Parameters<
|
|
32
|
+
type AiGatewayRunOptions = Parameters<AiGatewayBinding["run"]>[1];
|
|
34
33
|
type AiGatewayBindingCandidate = Parameters<typeof isWorkersAiBinding>[0];
|
|
35
34
|
interface AiGatewayFetchOptions {
|
|
36
35
|
readonly provider?: AiGatewayProvider;
|
|
@@ -64,15 +63,15 @@ interface TagClass<Self, Id extends string> extends Context$1.ServiceClass<Self,
|
|
|
64
63
|
declare const isAiGatewayBinding: (value: AiGatewayBindingCandidate) => value is WorkersAiBinding;
|
|
65
64
|
declare const makeClient: (definition: AiGatewayDefinition, gateway: AiGatewayBinding) => {
|
|
66
65
|
definition: AiGatewayDefinition;
|
|
67
|
-
run: (data:
|
|
68
|
-
gateway?:
|
|
66
|
+
run: (data: AIGatewayUniversalRequest | readonly AIGatewayUniversalRequest[], options?: {
|
|
67
|
+
gateway?: UniversalGatewayOptions;
|
|
69
68
|
extraHeaders?: object;
|
|
70
|
-
signal?:
|
|
71
|
-
} | undefined) => Effect.Effect<
|
|
69
|
+
signal?: AbortSignal;
|
|
70
|
+
} | undefined) => Effect.Effect<Response, AiGatewayOperationError, never>;
|
|
72
71
|
getUrl: (provider?: string | undefined) => Effect.Effect<string, AiGatewayOperationError, never>;
|
|
73
72
|
fetch: (options: AiGatewayFetchOptions) => Effect.Effect<Response, AiGatewayOperationError, never>;
|
|
74
|
-
patchLog: (logId: string, data:
|
|
75
|
-
getLog: (logId: string) => Effect.Effect<
|
|
73
|
+
patchLog: (logId: string, data: globalThis.AiGatewayPatchLog) => Effect.Effect<void, AiGatewayOperationError, never>;
|
|
74
|
+
getLog: (logId: string) => Effect.Effect<globalThis.AiGatewayLog, AiGatewayOperationError, never>;
|
|
76
75
|
rawUnsafe: Effect.Effect<AiGateway, never, never>;
|
|
77
76
|
};
|
|
78
77
|
declare const makeClientFromAi: (definition: AiGatewayDefinition, ai: WorkersAiBinding) => AiGatewayClient;
|
|
@@ -7,11 +7,10 @@ import * as Layer$1 from "effect/Layer";
|
|
|
7
7
|
import * as Config$1 from "effect/Config";
|
|
8
8
|
import * as Option from "effect/Option";
|
|
9
9
|
import * as HttpClient from "effect/unstable/http/HttpClient";
|
|
10
|
-
import { AnalyticsEngineDataPoint, AnalyticsEngineDataset } from "@cloudflare/workers-types";
|
|
11
10
|
import { Redacted } from "effect";
|
|
12
11
|
import { Headers, HttpClientResponse } from "effect/unstable/http";
|
|
13
12
|
declare namespace AnalyticsEngine_d_exports {
|
|
14
|
-
export { AnalyticsEngineBinding, AnalyticsEngineClient, AnalyticsEngineDataPoint
|
|
13
|
+
export { AnalyticsEngineBinding, AnalyticsEngineClient, AnalyticsEngineDataPoint, AnalyticsEngineDataPointSchema, AnalyticsEngineDefinition, AnalyticsEngineFieldValue, AnalyticsEngineFieldValueSchema, AnalyticsEngineInvalidWritePolicy, AnalyticsEngineOperationError, AnalyticsEngineQueryClient, AnalyticsEngineQueryColumn, AnalyticsEngineQueryDefinition, AnalyticsEngineQueryError, AnalyticsEngineQueryOptions, AnalyticsEngineQueryResult, AnalyticsEngineQueryRow, AnalyticsEngineQueryService, AnalyticsEngineService, AnalyticsEngineWriteError, AnalyticsEngineWriteOptions, AnalyticsEngineWritePolicy, AnalyticsEngineWriteValidationError, AnalyticsEngineWriteViolation, BindingNotFoundError, BindingValidationError, LayerOptions, QueryConfigOptions, QueryTag, QueryTagClass, Tag, TagClass, isAnalyticsEngineDataset, layer, layerFetch, layerFetchConfig, make, makeClient, makeQuery, makeQueryClient, queryConfig, queryLayer, queryLayerConfig, writeLimits };
|
|
15
14
|
}
|
|
16
15
|
declare const writeLimits: {
|
|
17
16
|
readonly maxBlobs: 20;
|
|
@@ -74,7 +73,7 @@ interface AnalyticsEngineDefinition {
|
|
|
74
73
|
readonly binding: string;
|
|
75
74
|
}
|
|
76
75
|
type AnalyticsEngineBinding = AnalyticsEngineDataset;
|
|
77
|
-
type AnalyticsEngineDataPoint
|
|
76
|
+
type AnalyticsEngineDataPoint = globalThis.AnalyticsEngineDataPoint;
|
|
78
77
|
type AnalyticsEngineFieldValue = ArrayBuffer | string | null;
|
|
79
78
|
type AnalyticsEngineWriteError = AnalyticsEngineOperationError | AnalyticsEngineWriteValidationError;
|
|
80
79
|
type AnalyticsEngineInvalidWritePolicy = "error" | "drop";
|
|
@@ -104,8 +103,8 @@ interface AnalyticsEngineQueryOptions {
|
|
|
104
103
|
readonly headers?: Headers.Input;
|
|
105
104
|
}
|
|
106
105
|
interface AnalyticsEngineClient {
|
|
107
|
-
readonly writeDataPoint: (dataPoint?: AnalyticsEngineDataPoint
|
|
108
|
-
readonly writeDataPoints: (dataPoints: ReadonlyArray<AnalyticsEngineDataPoint
|
|
106
|
+
readonly writeDataPoint: (dataPoint?: AnalyticsEngineDataPoint, options?: AnalyticsEngineWriteOptions) => Effect.Effect<void, AnalyticsEngineWriteError>;
|
|
107
|
+
readonly writeDataPoints: (dataPoints: ReadonlyArray<AnalyticsEngineDataPoint>, options?: AnalyticsEngineWriteOptions) => Effect.Effect<void, AnalyticsEngineWriteError>;
|
|
109
108
|
readonly rawUnsafe: Effect.Effect<AnalyticsEngineBinding>;
|
|
110
109
|
readonly definition: AnalyticsEngineDefinition;
|
|
111
110
|
}
|
|
@@ -168,4 +167,4 @@ declare const makeQuery: <Id extends string>(id: Id) => QueryTagClass<AnalyticsE
|
|
|
168
167
|
declare const Tag: <Self>() => <Id extends string>(id: Id) => TagClass<Self, Id>;
|
|
169
168
|
declare const QueryTag: <Self>() => <Id extends string>(id: Id) => QueryTagClass<Self, Id>;
|
|
170
169
|
//#endregion
|
|
171
|
-
export { AnalyticsEngineBinding, AnalyticsEngineClient, AnalyticsEngineDataPoint
|
|
170
|
+
export { AnalyticsEngineBinding, AnalyticsEngineClient, AnalyticsEngineDataPoint, AnalyticsEngineDataPointSchema, AnalyticsEngineDefinition, AnalyticsEngineFieldValue, AnalyticsEngineFieldValueSchema, AnalyticsEngineInvalidWritePolicy, AnalyticsEngineOperationError, AnalyticsEngineQueryClient, AnalyticsEngineQueryColumn, AnalyticsEngineQueryDefinition, AnalyticsEngineQueryError, AnalyticsEngineQueryOptions, AnalyticsEngineQueryResult, AnalyticsEngineQueryRow, AnalyticsEngineQueryService, AnalyticsEngineService, AnalyticsEngineWriteError, AnalyticsEngineWriteOptions, AnalyticsEngineWritePolicy, AnalyticsEngineWriteValidationError, AnalyticsEngineWriteViolation, AnalyticsEngine_d_exports, type BindingNotFoundError, type BindingValidationError, LayerOptions, QueryConfigOptions, QueryTag, QueryTagClass, Tag, TagClass, isAnalyticsEngineDataset, layer, layerFetch, layerFetchConfig, make, makeClient, makeQuery, makeQueryClient, queryConfig, queryLayer, queryLayerConfig, writeLimits };
|
package/dist/Artifacts.d.mts
CHANGED
|
@@ -2,10 +2,9 @@ import { WorkerEnvironment } from "./Environment.mjs";
|
|
|
2
2
|
import { BindingNotFoundError, BindingValidationError } from "./Binding.mjs";
|
|
3
3
|
import * as Context$1 from "effect/Context";
|
|
4
4
|
import * as Effect from "effect/Effect";
|
|
5
|
-
import { ArtifactsCreateRepoResult, ArtifactsCreateTokenResult, ArtifactsErrorCode, ArtifactsRepoInfo, ArtifactsTokenInfo, ArtifactsTokenListResult } from "@cloudflare/workers-types";
|
|
6
5
|
import { Layer } from "effect";
|
|
7
6
|
declare namespace Artifacts_d_exports {
|
|
8
|
-
export { ArtifactsBinding, ArtifactsClient, ArtifactsCommit, ArtifactsCommitIdentity, ArtifactsCreateOptions, ArtifactsCreateRepoResult
|
|
7
|
+
export { ArtifactsBinding, ArtifactsClient, ArtifactsCommit, ArtifactsCommitIdentity, ArtifactsCreateOptions, ArtifactsCreateRepoResult, ArtifactsCreateTokenResult, ArtifactsDefinition, ArtifactsErrorCode, ArtifactsForkOptions, ArtifactsImportParams, ArtifactsImportSource, ArtifactsImportTarget, ArtifactsImportTargetOptions, ArtifactsListOptions, ArtifactsLogOptions, ArtifactsLogResult, ArtifactsOperation, ArtifactsOperationError, ArtifactsRepoBinding, ArtifactsRepoClient, ArtifactsRepoInfo, ArtifactsRepoListEntry, ArtifactsRepoListResult, ArtifactsRepoStatus, ArtifactsService, ArtifactsTokenInfo, ArtifactsTokenListResult, ArtifactsTokenScope, ArtifactsTokenState, ArtifactsTree, BindingNotFoundError, BindingValidationError, Cursor, LayerOptions, RepoName, Tag, TagClass, artifactsErrorCodes, artifactsErrorNumericCodes, isArtifactsBinding, isArtifactsRepoBinding, layer, make, makeClient };
|
|
9
8
|
}
|
|
10
9
|
type ArtifactsOperation = "createClient" | "create" | "get" | "import" | "list" | "delete" | "createToken" | "listTokens" | "getToken" | "revokeToken" | "fork" | "info" | "log" | "readCommit" | "readTree" | "cli";
|
|
11
10
|
declare const artifactsErrorCodes: readonly ["ALREADY_EXISTS", "NOT_FOUND", "IMPORT_IN_PROGRESS", "FORK_IN_PROGRESS", "INVALID_INPUT", "INVALID_REPO_NAME", "INVALID_TTL", "INVALID_URL", "REMOTE_AUTH_REQUIRED", "UPSTREAM_UNAVAILABLE", "MEMORY_LIMIT", "INTERNAL_ERROR"];
|
|
@@ -23,7 +22,7 @@ declare const artifactsErrorNumericCodes: {
|
|
|
23
22
|
readonly MEMORY_LIMIT: 10402;
|
|
24
23
|
readonly INTERNAL_ERROR: 10400;
|
|
25
24
|
};
|
|
26
|
-
type ArtifactsErrorCode
|
|
25
|
+
type ArtifactsErrorCode = globalThis.ArtifactsErrorCode;
|
|
27
26
|
declare const ArtifactsOperationError_base: new <A extends Record<string, any> = {}>(args: import("effect/Types").VoidIfEmpty<{ readonly [P in keyof A as P extends "_tag" ? never : P]: A[P]; }>) => import("effect/Cause").YieldableError & {
|
|
28
27
|
readonly _tag: "ArtifactsOperationError";
|
|
29
28
|
} & Readonly<A>;
|
|
@@ -31,7 +30,7 @@ declare class ArtifactsOperationError extends ArtifactsOperationError_base<{
|
|
|
31
30
|
readonly binding: string;
|
|
32
31
|
readonly operation: ArtifactsOperation;
|
|
33
32
|
readonly cause: unknown;
|
|
34
|
-
readonly code?: ArtifactsErrorCode
|
|
33
|
+
readonly code?: ArtifactsErrorCode | (string & {});
|
|
35
34
|
readonly numericCode?: number;
|
|
36
35
|
}> {
|
|
37
36
|
get message(): string;
|
|
@@ -46,9 +45,9 @@ type ArtifactsTokenScope = "read" | "write";
|
|
|
46
45
|
/** Lifecycle state of a repository token. */
|
|
47
46
|
type ArtifactsTokenState = "active" | "expired" | "revoked";
|
|
48
47
|
type ArtifactsRepoStatus = "ready" | "importing" | "forking";
|
|
49
|
-
type ArtifactsRepoInfo
|
|
50
|
-
type ArtifactsCreateRepoResult
|
|
51
|
-
interface ArtifactsRepoListEntry extends ArtifactsRepoInfo
|
|
48
|
+
type ArtifactsRepoInfo = globalThis.ArtifactsRepoInfo;
|
|
49
|
+
type ArtifactsCreateRepoResult = Readonly<globalThis.ArtifactsCreateRepoResult>;
|
|
50
|
+
interface ArtifactsRepoListEntry extends ArtifactsRepoInfo {
|
|
52
51
|
readonly status: ArtifactsRepoStatus;
|
|
53
52
|
}
|
|
54
53
|
interface ArtifactsRepoListResult {
|
|
@@ -57,11 +56,11 @@ interface ArtifactsRepoListResult {
|
|
|
57
56
|
readonly cursor?: Cursor;
|
|
58
57
|
}
|
|
59
58
|
/** Result of creating a repository token. */
|
|
60
|
-
type ArtifactsCreateTokenResult
|
|
59
|
+
type ArtifactsCreateTokenResult = globalThis.ArtifactsCreateTokenResult;
|
|
61
60
|
/** Repository token metadata, excluding its plaintext secret. */
|
|
62
|
-
type ArtifactsTokenInfo
|
|
61
|
+
type ArtifactsTokenInfo = globalThis.ArtifactsTokenInfo;
|
|
63
62
|
/** Repository token list result. */
|
|
64
|
-
type ArtifactsTokenListResult
|
|
63
|
+
type ArtifactsTokenListResult = globalThis.ArtifactsTokenListResult;
|
|
65
64
|
/** Identity recorded for a Git commit author or committer. */
|
|
66
65
|
interface ArtifactsCommitIdentity {
|
|
67
66
|
readonly name: string;
|
|
@@ -126,7 +125,7 @@ interface ArtifactsLogOptions {
|
|
|
126
125
|
readonly limit?: number;
|
|
127
126
|
readonly offset?: number;
|
|
128
127
|
}
|
|
129
|
-
interface ArtifactsRepoBinding extends Partial<ArtifactsRepoInfo
|
|
128
|
+
interface ArtifactsRepoBinding extends Partial<ArtifactsRepoInfo> {
|
|
130
129
|
/**
|
|
131
130
|
* Read repository metadata.
|
|
132
131
|
*
|
|
@@ -134,49 +133,49 @@ interface ArtifactsRepoBinding extends Partial<ArtifactsRepoInfo$1> {
|
|
|
134
133
|
* through this method. It is optional solely for compatibility with older
|
|
135
134
|
* local handles that expose metadata as data properties.
|
|
136
135
|
*/
|
|
137
|
-
readonly info?: () => Promise<ArtifactsRepoInfo
|
|
136
|
+
readonly info?: () => Promise<ArtifactsRepoInfo>;
|
|
138
137
|
/**
|
|
139
138
|
* Create a Git token for the repository.
|
|
140
139
|
*
|
|
141
140
|
* Scope defaults to `"write"`. TTL is measured in seconds, defaults to
|
|
142
141
|
* 86,400, and must be between 60 and 31,536,000.
|
|
143
142
|
*/
|
|
144
|
-
readonly createToken: (scope?: ArtifactsTokenScope, ttl?: number) => Promise<ArtifactsCreateTokenResult
|
|
145
|
-
readonly listTokens: () => Promise<ArtifactsTokenListResult
|
|
143
|
+
readonly createToken: (scope?: ArtifactsTokenScope, ttl?: number) => Promise<ArtifactsCreateTokenResult>;
|
|
144
|
+
readonly listTokens: () => Promise<ArtifactsTokenListResult>;
|
|
146
145
|
readonly revokeToken: (tokenOrId: string) => Promise<boolean>;
|
|
147
|
-
readonly fork: (name: RepoName, options?: ArtifactsForkOptions) => Promise<ArtifactsCreateRepoResult
|
|
146
|
+
readonly fork: (name: RepoName, options?: ArtifactsForkOptions) => Promise<ArtifactsCreateRepoResult>;
|
|
148
147
|
readonly log: (options?: ArtifactsLogOptions) => Promise<ArtifactsLogResult>;
|
|
149
148
|
readonly readCommit: (hash: string) => Promise<ArtifactsCommit>;
|
|
150
149
|
readonly readTree: (hash: string) => Promise<ArtifactsTree>;
|
|
151
150
|
}
|
|
152
151
|
interface ArtifactsBinding {
|
|
153
|
-
readonly create: (name: RepoName, options?: ArtifactsCreateOptions) => Promise<ArtifactsCreateRepoResult
|
|
152
|
+
readonly create: (name: RepoName, options?: ArtifactsCreateOptions) => Promise<ArtifactsCreateRepoResult>;
|
|
154
153
|
readonly get: (name: RepoName) => Promise<ArtifactsRepoBinding>;
|
|
155
|
-
readonly import: (params: ArtifactsImportParams) => Promise<ArtifactsCreateRepoResult
|
|
154
|
+
readonly import: (params: ArtifactsImportParams) => Promise<ArtifactsCreateRepoResult>;
|
|
156
155
|
readonly list: (options?: ArtifactsListOptions) => Promise<ArtifactsRepoListResult>;
|
|
157
156
|
readonly delete: (name: RepoName) => Promise<boolean>;
|
|
158
157
|
}
|
|
159
|
-
interface ArtifactsRepoClient extends ArtifactsRepoInfo
|
|
160
|
-
readonly info: () => Effect.Effect<ArtifactsRepoInfo
|
|
158
|
+
interface ArtifactsRepoClient extends ArtifactsRepoInfo {
|
|
159
|
+
readonly info: () => Effect.Effect<ArtifactsRepoInfo, ArtifactsOperationError>;
|
|
161
160
|
/**
|
|
162
161
|
* Create a Git token for the repository.
|
|
163
162
|
*
|
|
164
163
|
* Scope defaults to `"write"`. TTL is measured in seconds, defaults to
|
|
165
164
|
* 86,400, and must be between 60 and 31,536,000.
|
|
166
165
|
*/
|
|
167
|
-
readonly createToken: (scope?: ArtifactsTokenScope, ttl?: number) => Effect.Effect<ArtifactsCreateTokenResult
|
|
168
|
-
readonly listTokens: Effect.Effect<ArtifactsTokenListResult
|
|
166
|
+
readonly createToken: (scope?: ArtifactsTokenScope, ttl?: number) => Effect.Effect<ArtifactsCreateTokenResult, ArtifactsOperationError>;
|
|
167
|
+
readonly listTokens: Effect.Effect<ArtifactsTokenListResult, ArtifactsOperationError>;
|
|
169
168
|
readonly revokeToken: (tokenOrId: string) => Effect.Effect<boolean, ArtifactsOperationError>;
|
|
170
|
-
readonly fork: (name: RepoName, options?: ArtifactsForkOptions) => Effect.Effect<ArtifactsCreateRepoResult
|
|
169
|
+
readonly fork: (name: RepoName, options?: ArtifactsForkOptions) => Effect.Effect<ArtifactsCreateRepoResult, ArtifactsOperationError>;
|
|
171
170
|
readonly log: (options?: ArtifactsLogOptions) => Effect.Effect<ArtifactsLogResult, ArtifactsOperationError>;
|
|
172
171
|
readonly readCommit: (hash: string) => Effect.Effect<ArtifactsCommit, ArtifactsOperationError>;
|
|
173
172
|
readonly readTree: (hash: string) => Effect.Effect<ArtifactsTree, ArtifactsOperationError>;
|
|
174
173
|
readonly raw: ArtifactsRepoBinding;
|
|
175
174
|
}
|
|
176
175
|
interface ArtifactsClient {
|
|
177
|
-
readonly create: (name: RepoName, options?: ArtifactsCreateOptions) => Effect.Effect<ArtifactsCreateRepoResult
|
|
176
|
+
readonly create: (name: RepoName, options?: ArtifactsCreateOptions) => Effect.Effect<ArtifactsCreateRepoResult, ArtifactsOperationError>;
|
|
178
177
|
readonly get: (name: RepoName) => Effect.Effect<ArtifactsRepoClient, ArtifactsOperationError>;
|
|
179
|
-
readonly import: (params: ArtifactsImportParams) => Effect.Effect<ArtifactsCreateRepoResult
|
|
178
|
+
readonly import: (params: ArtifactsImportParams) => Effect.Effect<ArtifactsCreateRepoResult, ArtifactsOperationError>;
|
|
180
179
|
readonly list: (options?: ArtifactsListOptions) => Effect.Effect<ArtifactsRepoListResult, ArtifactsOperationError>;
|
|
181
180
|
readonly delete: (name: RepoName) => Effect.Effect<boolean, ArtifactsOperationError>;
|
|
182
181
|
readonly rawUnsafe: Effect.Effect<ArtifactsBinding>;
|
|
@@ -202,4 +201,4 @@ declare const layer: <Self>(tag: Context$1.Service<Self, ArtifactsClient>, defin
|
|
|
202
201
|
declare const make: <Id extends string>(id: Id) => TagClass<ArtifactsService<Id>, Id>;
|
|
203
202
|
declare const Tag: <Self>() => <Id extends string>(id: Id) => TagClass<Self, Id>;
|
|
204
203
|
//#endregion
|
|
205
|
-
export { ArtifactsBinding, ArtifactsClient, ArtifactsCommit, ArtifactsCommitIdentity, ArtifactsCreateOptions, ArtifactsCreateRepoResult
|
|
204
|
+
export { ArtifactsBinding, ArtifactsClient, ArtifactsCommit, ArtifactsCommitIdentity, ArtifactsCreateOptions, ArtifactsCreateRepoResult, ArtifactsCreateTokenResult, ArtifactsDefinition, ArtifactsErrorCode, ArtifactsForkOptions, ArtifactsImportParams, ArtifactsImportSource, ArtifactsImportTarget, ArtifactsImportTargetOptions, ArtifactsListOptions, ArtifactsLogOptions, ArtifactsLogResult, ArtifactsOperation, ArtifactsOperationError, ArtifactsRepoBinding, ArtifactsRepoClient, ArtifactsRepoInfo, ArtifactsRepoListEntry, ArtifactsRepoListResult, ArtifactsRepoStatus, ArtifactsService, ArtifactsTokenInfo, ArtifactsTokenListResult, ArtifactsTokenScope, ArtifactsTokenState, ArtifactsTree, Artifacts_d_exports, type BindingNotFoundError, type BindingValidationError, Cursor, LayerOptions, RepoName, Tag, TagClass, artifactsErrorCodes, artifactsErrorNumericCodes, isArtifactsBinding, isArtifactsRepoBinding, layer, make, makeClient };
|
package/dist/Cache.d.mts
CHANGED
|
@@ -2,12 +2,11 @@ import * as Context from "effect/Context";
|
|
|
2
2
|
import * as Effect from "effect/Effect";
|
|
3
3
|
import * as Layer from "effect/Layer";
|
|
4
4
|
import * as Option from "effect/Option";
|
|
5
|
-
import { Cache, CacheQueryOptions, CacheStorage, RequestInfo } from "@cloudflare/workers-types";
|
|
6
5
|
declare namespace Cache_d_exports {
|
|
7
|
-
export { CacheClient, CacheOperation, CacheOperationError, CacheQueryOptions
|
|
6
|
+
export { CacheClient, CacheOperation, CacheOperationError, CacheQueryOptions, CacheRequest, CacheStorage, CacheStorageClient, layer, layerFrom, makeCacheClient, makeClient };
|
|
8
7
|
}
|
|
9
8
|
type CacheRequest = RequestInfo | URL;
|
|
10
|
-
type CacheQueryOptions
|
|
9
|
+
type CacheQueryOptions = globalThis.CacheQueryOptions;
|
|
11
10
|
type CacheOperation = "open" | "match" | "put" | "delete";
|
|
12
11
|
declare const CacheOperationError_base: new <A extends Record<string, any> = {}>(args: import("effect/Types").VoidIfEmpty<{ readonly [P in keyof A as P extends "_tag" ? never : P]: A[P]; }>) => import("effect/Cause").YieldableError & {
|
|
13
12
|
readonly _tag: "CacheOperationError";
|
|
@@ -21,21 +20,21 @@ declare class CacheOperationError extends CacheOperationError_base<{
|
|
|
21
20
|
}
|
|
22
21
|
interface CacheClient {
|
|
23
22
|
readonly name: string;
|
|
24
|
-
readonly match: (request: CacheRequest, options?: CacheQueryOptions
|
|
23
|
+
readonly match: (request: CacheRequest, options?: CacheQueryOptions) => Effect.Effect<Option.Option<Response>, CacheOperationError>;
|
|
25
24
|
readonly put: (request: CacheRequest, response: Response) => Effect.Effect<void, CacheOperationError>;
|
|
26
|
-
readonly delete: (request: CacheRequest, options?: CacheQueryOptions
|
|
25
|
+
readonly delete: (request: CacheRequest, options?: CacheQueryOptions) => Effect.Effect<boolean, CacheOperationError>;
|
|
27
26
|
readonly rawUnsafe: Effect.Effect<Cache>;
|
|
28
27
|
}
|
|
29
28
|
interface CacheStorageClient {
|
|
30
29
|
readonly default: CacheClient;
|
|
31
30
|
readonly open: (name: string) => Effect.Effect<CacheClient, CacheOperationError>;
|
|
32
|
-
readonly rawUnsafe: Effect.Effect<CacheStorage>;
|
|
31
|
+
readonly rawUnsafe: Effect.Effect<globalThis.CacheStorage>;
|
|
33
32
|
}
|
|
34
|
-
declare const CacheStorage_base: Context.ServiceClass<CacheStorage
|
|
35
|
-
declare class CacheStorage
|
|
33
|
+
declare const CacheStorage_base: Context.ServiceClass<CacheStorage, "effect-cf/CacheStorage", CacheStorageClient>;
|
|
34
|
+
declare class CacheStorage extends CacheStorage_base {}
|
|
36
35
|
declare const makeCacheClient: (cache: Cache, name?: string) => CacheClient;
|
|
37
|
-
declare const makeClient: (storage: CacheStorage) => CacheStorageClient;
|
|
38
|
-
declare const layerFrom: (storage: CacheStorage) => Layer.Layer<CacheStorage
|
|
39
|
-
declare const layer: Layer.Layer<CacheStorage
|
|
36
|
+
declare const makeClient: (storage: globalThis.CacheStorage) => CacheStorageClient;
|
|
37
|
+
declare const layerFrom: (storage: globalThis.CacheStorage) => Layer.Layer<CacheStorage>;
|
|
38
|
+
declare const layer: Layer.Layer<CacheStorage>;
|
|
40
39
|
//#endregion
|
|
41
|
-
export { CacheClient, CacheOperation, CacheOperationError, CacheQueryOptions
|
|
40
|
+
export { CacheClient, CacheOperation, CacheOperationError, CacheQueryOptions, CacheRequest, CacheStorage, CacheStorageClient, Cache_d_exports, layer, layerFrom, makeCacheClient, makeClient };
|
|
@@ -40,7 +40,8 @@ const ResumableAttachmentMetadataSchema = Schema.Struct({
|
|
|
40
40
|
clientId: Schema.Finite,
|
|
41
41
|
hasPendingRequests: Schema.Boolean,
|
|
42
42
|
hasNonResumableRequests: Schema.Boolean,
|
|
43
|
-
subscriptions: Schema.Array(PersistedSubscriptionSchema)
|
|
43
|
+
subscriptions: Schema.Array(PersistedSubscriptionSchema),
|
|
44
|
+
serialization: Schema.optionalKey(Schema.String)
|
|
44
45
|
});
|
|
45
46
|
const decodeResumableAttachment = Schema.decodeUnknownOption(ResumableAttachmentMetadataSchema);
|
|
46
47
|
var DurableObjectRpcWebSocket = class extends Context.Service()("effect-cf/DurableObjectRpcWebSocket") {};
|
|
@@ -83,7 +84,8 @@ const layer = (options = {}) => Layer.effectContext(Effect.gen(function* () {
|
|
|
83
84
|
const created = {
|
|
84
85
|
version: legacyAttachmentVersion,
|
|
85
86
|
clientId: id,
|
|
86
|
-
hasPendingRequests: false
|
|
87
|
+
hasPendingRequests: false,
|
|
88
|
+
serialization: serialization.contentType
|
|
87
89
|
};
|
|
88
90
|
writeAttachment(socket.raw, attachmentKey, created);
|
|
89
91
|
return created;
|
|
@@ -143,7 +145,8 @@ const layer = (options = {}) => Layer.effectContext(Effect.gen(function* () {
|
|
|
143
145
|
writeAttachment(connection.socket.raw, attachmentKey, {
|
|
144
146
|
version: legacyAttachmentVersion,
|
|
145
147
|
clientId: connection.id,
|
|
146
|
-
hasPendingRequests: connection.requestIds.size > 0
|
|
148
|
+
hasPendingRequests: connection.requestIds.size > 0,
|
|
149
|
+
serialization: serialization.contentType
|
|
147
150
|
});
|
|
148
151
|
return;
|
|
149
152
|
}
|
|
@@ -153,7 +156,8 @@ const layer = (options = {}) => Layer.effectContext(Effect.gen(function* () {
|
|
|
153
156
|
clientId: connection.id,
|
|
154
157
|
hasPendingRequests: connection.requestIds.size > 0,
|
|
155
158
|
hasNonResumableRequests: connection.nonResumableRequestIds.size > 0,
|
|
156
|
-
subscriptions
|
|
159
|
+
subscriptions,
|
|
160
|
+
serialization: serialization.contentType
|
|
157
161
|
});
|
|
158
162
|
},
|
|
159
163
|
catch: (cause) => new DurableWebSocketAttachmentError({
|
|
@@ -249,6 +253,10 @@ const layer = (options = {}) => Layer.effectContext(Effect.gen(function* () {
|
|
|
249
253
|
continue;
|
|
250
254
|
}
|
|
251
255
|
const metadata = attachment.metadata;
|
|
256
|
+
if (metadata.serialization !== void 0 && metadata.serialization !== serialization.contentType) {
|
|
257
|
+
yield* resetSocket(socket);
|
|
258
|
+
continue;
|
|
259
|
+
}
|
|
252
260
|
if (metadata.version === legacyAttachmentVersion) {
|
|
253
261
|
if (metadata.hasPendingRequests) yield* resetSocket(socket);
|
|
254
262
|
else if (connectionsById.has(metadata.clientId)) yield* resetSocket(socket);
|
|
@@ -476,7 +484,10 @@ const layer = (options = {}) => Layer.effectContext(Effect.gen(function* () {
|
|
|
476
484
|
const connection = register(socket);
|
|
477
485
|
return Predicate.isTagged(cause, "MaxBufferSizeExceeded") ? Effect.ignore(connection.socket.close(1009, String(cause))) : send(connection, RpcMessage.ResponseDefectEncoded(encodeDefect(cause)));
|
|
478
486
|
})),
|
|
479
|
-
close:
|
|
487
|
+
close: (socket) => Effect.gen(function* () {
|
|
488
|
+
resetSockets.add(socket.raw);
|
|
489
|
+
yield* socket.close(1e3).pipe(Effect.ignore);
|
|
490
|
+
}).pipe(Effect.ensuring(unregister(socket)), Effect.uninterruptible),
|
|
480
491
|
error: resetSocket,
|
|
481
492
|
checkpoint
|
|
482
493
|
});
|
|
@@ -506,12 +517,14 @@ const readAttachment = (socket, key) => {
|
|
|
506
517
|
} : { _tag: "Invalid" };
|
|
507
518
|
}
|
|
508
519
|
const hasPendingRequests = Predicate.hasProperty(metadata, "hasPendingRequests") ? metadata.hasPendingRequests : false;
|
|
509
|
-
|
|
520
|
+
const serialization = Predicate.hasProperty(metadata, "serialization") ? metadata.serialization : void 0;
|
|
521
|
+
if ((!Predicate.hasProperty(metadata, "version") || metadata.version === legacyAttachmentVersion) && Predicate.hasProperty(metadata, "clientId") && Predicate.isNumber(metadata.clientId) && isClientId(metadata.clientId) && Predicate.isBoolean(hasPendingRequests) && (serialization === void 0 || Predicate.isString(serialization))) return {
|
|
510
522
|
_tag: "Valid",
|
|
511
523
|
metadata: {
|
|
512
524
|
version: legacyAttachmentVersion,
|
|
513
525
|
clientId: metadata.clientId,
|
|
514
|
-
hasPendingRequests
|
|
526
|
+
hasPendingRequests,
|
|
527
|
+
serialization
|
|
515
528
|
}
|
|
516
529
|
};
|
|
517
530
|
return { _tag: "Invalid" };
|
package/dist/Email.d.mts
CHANGED
|
@@ -2,10 +2,9 @@ import { WorkerEnvironment } from "./Environment.mjs";
|
|
|
2
2
|
import { BindingNotFoundError, BindingValidationError } from "./Binding.mjs";
|
|
3
3
|
import * as Context$1 from "effect/Context";
|
|
4
4
|
import * as Effect from "effect/Effect";
|
|
5
|
-
import { EmailAddress, EmailAttachment, EmailSendResult, SendEmail } from "@cloudflare/workers-types";
|
|
6
5
|
import { Layer } from "effect";
|
|
7
6
|
declare namespace Email_d_exports {
|
|
8
|
-
export { BindingNotFoundError, BindingValidationError, EmailAddress
|
|
7
|
+
export { BindingNotFoundError, BindingValidationError, EmailAddress, EmailAttachment, EmailBinding, EmailClient, EmailDefinition, EmailErrorCode, EmailMessageBuilder, EmailOperationError, EmailRecipients, EmailSendError, EmailSendOptions, EmailSendResult, EmailService, EmailValidationError, EmailViolation, LayerOptions, Tag, TagClass, emailErrorCodes, isEmailBinding, layer, make, makeClient, sendLimits, validateMessage };
|
|
9
8
|
}
|
|
10
9
|
declare const sendLimits: {
|
|
11
10
|
readonly maxRecipients: 50;
|
|
@@ -63,18 +62,18 @@ declare class EmailValidationError extends EmailValidationError_base<{
|
|
|
63
62
|
interface EmailDefinition {
|
|
64
63
|
readonly binding: string;
|
|
65
64
|
}
|
|
66
|
-
type EmailAddress
|
|
67
|
-
type EmailAttachment
|
|
65
|
+
type EmailAddress = globalThis.EmailAddress;
|
|
66
|
+
type EmailAttachment = globalThis.EmailAttachment;
|
|
67
|
+
type EmailSendResult = globalThis.EmailSendResult;
|
|
68
68
|
type EmailMessageBuilder = Parameters<SendEmail["send"]>[0];
|
|
69
|
-
type EmailSendResult$1 = EmailSendResult;
|
|
70
69
|
type EmailBinding = SendEmail;
|
|
71
|
-
type EmailRecipients = string | EmailAddress
|
|
70
|
+
type EmailRecipients = string | EmailAddress | ReadonlyArray<string | EmailAddress>;
|
|
72
71
|
type EmailSendError = EmailOperationError | EmailValidationError;
|
|
73
72
|
interface EmailSendOptions {
|
|
74
73
|
readonly validate?: boolean;
|
|
75
74
|
}
|
|
76
75
|
interface EmailClient {
|
|
77
|
-
readonly send: (message: EmailMessageBuilder) => Effect.Effect<EmailSendResult
|
|
76
|
+
readonly send: (message: EmailMessageBuilder) => Effect.Effect<EmailSendResult, EmailSendError>;
|
|
78
77
|
readonly rawUnsafe: Effect.Effect<EmailBinding>;
|
|
79
78
|
readonly definition: EmailDefinition;
|
|
80
79
|
}
|
|
@@ -104,4 +103,4 @@ declare const layer: <Self>(tag: Context$1.Service<Self, EmailClient>, definitio
|
|
|
104
103
|
declare const make: <Id extends string>(id: Id) => TagClass<EmailService<Id>, Id>;
|
|
105
104
|
declare const Tag: <Self>() => <Id extends string>(id: Id) => TagClass<Self, Id>;
|
|
106
105
|
//#endregion
|
|
107
|
-
export { type BindingNotFoundError, type BindingValidationError, EmailAddress
|
|
106
|
+
export { type BindingNotFoundError, type BindingValidationError, EmailAddress, EmailAttachment, EmailBinding, EmailClient, EmailDefinition, EmailErrorCode, EmailMessageBuilder, EmailOperationError, EmailRecipients, EmailSendError, EmailSendOptions, EmailSendResult, EmailService, EmailValidationError, EmailViolation, Email_d_exports, LayerOptions, Tag, TagClass, emailErrorCodes, isEmailBinding, layer, make, makeClient, sendLimits, validateMessage };
|