@distilled.cloud/cloudflare 0.19.2 → 0.20.1

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@distilled.cloud/cloudflare",
3
- "version": "0.19.2",
3
+ "version": "0.20.1",
4
4
  "repository": {
5
5
  "type": "git",
6
6
  "url": "https://github.com/alchemy-run/distilled",
@@ -63,11 +63,11 @@
63
63
  "specs:update": "git -C specs/cloudflare-typescript fetch && git -C specs/cloudflare-typescript checkout main && git -C specs/cloudflare-typescript pull"
64
64
  },
65
65
  "dependencies": {
66
- "@distilled.cloud/core": "0.19.2"
66
+ "@distilled.cloud/core": "0.20.1"
67
67
  },
68
68
  "devDependencies": {
69
- "@effect/platform-node": ">=4.0.0-beta.60 || >=4.0.0",
70
- "@effect/vitest": ">=4.0.0-beta.60 || >=4.0.0",
69
+ "@effect/platform-node": ">=4.0.0-beta.66 || >=4.0.0",
70
+ "@effect/vitest": ">=4.0.0-beta.66 || >=4.0.0",
71
71
  "@types/bun": "^1.3.0",
72
72
  "@types/node": "^25.3.5",
73
73
  "dotenv": "^16.5.0",
@@ -75,6 +75,6 @@
75
75
  "vitest": "^3.2.3"
76
76
  },
77
77
  "peerDependencies": {
78
- "effect": ">=4.0.0-beta.60 || >=4.0.0"
78
+ "effect": ">=4.0.0-beta.66 || >=4.0.0"
79
79
  }
80
80
  }
@@ -1,11 +1,11 @@
1
1
  import { ConfigError } from "@distilled.cloud/core/errors";
2
2
  import * as Config from "effect/Config";
3
+ import * as Context from "effect/Context";
3
4
  import * as Data from "effect/Data";
4
5
  import * as Effect from "effect/Effect";
5
6
  import * as Layer from "effect/Layer";
6
7
  import * as Option from "effect/Option";
7
8
  import * as Redacted from "effect/Redacted";
8
- import * as Context from "effect/Context";
9
9
 
10
10
  export const DEFAULT_API_BASE_URL = "https://api.cloudflare.com/client/v4";
11
11
 
@@ -205,13 +205,11 @@ const envConfig = Config.all({
205
205
 
206
206
  export const resolveFromEnv: Effect.Effect<ResolvedCredentials, ConfigError> =
207
207
  Effect.gen(function* () {
208
- const config = yield* envConfig
209
- .asEffect()
210
- .pipe(
211
- Effect.mapError(
212
- fromConfigError("Failed to load Cloudflare credentials from config"),
213
- ),
214
- );
208
+ const config = yield* envConfig.pipe(
209
+ Effect.mapError(
210
+ fromConfigError("Failed to load Cloudflare credentials from config"),
211
+ ),
212
+ );
215
213
  const apiToken = Option.getOrUndefined(config.apiToken);
216
214
  const apiKey = Option.getOrUndefined(config.apiKey);
217
215
  const email = Option.getOrUndefined(config.email);
@@ -10,7 +10,7 @@ import type * as HttpClient from "effect/unstable/http/HttpClient";
10
10
  import * as API from "../client/api.ts";
11
11
  import * as T from "../traits.ts";
12
12
  import type { Credentials } from "../credentials.ts";
13
- import { type DefaultErrors } from "../errors.ts";
13
+ import { type DefaultErrors, InternalServerError } from "../errors.ts";
14
14
 
15
15
  // =============================================================================
16
16
  // Errors
@@ -22,10 +22,6 @@ export class FiltersRequired extends Schema.TaggedErrorClass<FiltersRequired>()(
22
22
  ) {}
23
23
  T.applyErrorMatchers(FiltersRequired, [{ code: 17103 }]);
24
24
 
25
- export class InternalServerError extends Schema.TaggedErrorClass<InternalServerError>()(
26
- "InternalServerError",
27
- { code: Schema.Number, message: Schema.String },
28
- ) {}
29
25
  T.applyErrorMatchers(InternalServerError, [{ code: 15000 }]);
30
26
 
31
27
  export class InvalidAlertType extends Schema.TaggedErrorClass<InvalidAlertType>()(
@@ -10,7 +10,7 @@ import type * as HttpClient from "effect/unstable/http/HttpClient";
10
10
  import * as API from "../client/api.ts";
11
11
  import * as T from "../traits.ts";
12
12
  import type { Credentials } from "../credentials.ts";
13
- import { type DefaultErrors } from "../errors.ts";
13
+ import { type DefaultErrors, InternalServerError } from "../errors.ts";
14
14
  import { UploadableSchema } from "../schemas.ts";
15
15
 
16
16
  // =============================================================================
@@ -60,6 +60,10 @@ export class HostnameAlreadyInUse extends Schema.TaggedErrorClass<HostnameAlread
60
60
  ) {}
61
61
  T.applyErrorMatchers(HostnameAlreadyInUse, [{ code: 100116 }]);
62
62
 
63
+ T.applyErrorMatchers(InternalServerError, [
64
+ { code: 10002, message: { includes: "An unknown error has occurred" } },
65
+ ]);
66
+
63
67
  export class InvalidRoute extends Schema.TaggedErrorClass<InvalidRoute>()(
64
68
  "InvalidRoute",
65
69
  { code: Schema.Number, message: Schema.String },
@@ -7640,6 +7644,7 @@ export type PutScriptError =
7640
7644
  | DefaultErrors
7641
7645
  | InvalidRoute
7642
7646
  | InvalidWorkerScript
7647
+ | InternalServerError
7643
7648
  | DurableObjectMustBeSqlite
7644
7649
  | DuplicateMigrationTarget
7645
7650
  | ScriptStartupError
@@ -7656,6 +7661,7 @@ export const putScript: API.OperationMethod<
7656
7661
  errors: [
7657
7662
  InvalidRoute,
7658
7663
  InvalidWorkerScript,
7664
+ InternalServerError,
7659
7665
  DurableObjectMustBeSqlite,
7660
7666
  DuplicateMigrationTarget,
7661
7667
  ScriptStartupError,