@distilled.cloud/cloudflare 0.9.0 → 0.10.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.9.0",
3
+ "version": "0.10.1",
4
4
  "repository": {
5
5
  "type": "git",
6
6
  "url": "https://github.com/alchemy-run/distilled",
@@ -63,12 +63,12 @@
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.9.0",
67
- "effect": "4.0.0-beta.46"
66
+ "@distilled.cloud/core": "0.10.1",
67
+ "effect": "4.0.0-beta.48"
68
68
  },
69
69
  "devDependencies": {
70
- "@effect/platform-node": "4.0.0-beta.46",
71
- "@effect/vitest": "4.0.0-beta.46",
70
+ "@effect/platform-node": "4.0.0-beta.48",
71
+ "@effect/vitest": "4.0.0-beta.48",
72
72
  "@types/bun": "^1.3.0",
73
73
  "@types/node": "^25.3.5",
74
74
  "dotenv": "^16.5.0",
@@ -77,6 +77,6 @@
77
77
  "vitest": "^3.2.3"
78
78
  },
79
79
  "peerDependencies": {
80
- "effect": "4.0.0-beta.46"
80
+ "effect": "4.0.0-beta.48"
81
81
  }
82
82
  }
@@ -378,7 +378,7 @@ export interface CreateConsumerRequest {
378
378
  retryDelay?: number;
379
379
  };
380
380
  /** Body param: */
381
- type?: "worker";
381
+ type: "worker" | "http_pull";
382
382
  }
383
383
 
384
384
  export const CreateConsumerRequest = /*@__PURE__*/ /*#__PURE__*/ Schema.Struct({
@@ -403,7 +403,7 @@ export const CreateConsumerRequest = /*@__PURE__*/ /*#__PURE__*/ Schema.Struct({
403
403
  }),
404
404
  ),
405
405
  ),
406
- type: Schema.optional(Schema.Literal("worker")),
406
+ type: Schema.Literals(["worker", "http_pull"]),
407
407
  }).pipe(
408
408
  Schema.encodeKeys({
409
409
  deadLetterQueue: "dead_letter_queue",
@@ -11,6 +11,7 @@ import * as API from "../client/api.ts";
11
11
  import * as T from "../traits.ts";
12
12
  import type { Credentials } from "../credentials.ts";
13
13
  import { type DefaultErrors } from "../errors.ts";
14
+ import { UploadableSchema } from "../schemas.ts";
14
15
  import { SensitiveString } from "../sensitive.ts";
15
16
 
16
17
  // =============================================================================
@@ -2532,8 +2533,149 @@ export const deleteBucketSippy: API.OperationMethod<
2532
2533
  // Object
2533
2534
  // =============================================================================
2534
2535
 
2536
+ export interface GetObjectRequest {
2537
+ /** Name of the R2 bucket. */
2538
+ bucketName: string;
2539
+ /** Key (name) of the object. */
2540
+ objectName: string;
2541
+ /** Account ID. */
2542
+ accountId: string;
2543
+ /** Jurisdiction where objects in this bucket are guaranteed to be stored. */
2544
+ cfR2Jurisdiction?: "default" | "eu" | "fedramp";
2545
+ }
2546
+
2547
+ export const GetObjectRequest = /*@__PURE__*/ /*#__PURE__*/ Schema.Struct({
2548
+ bucketName: Schema.String.pipe(T.HttpPath("bucketName")),
2549
+ objectName: Schema.String.pipe(T.HttpPath("objectName")),
2550
+ accountId: Schema.String.pipe(T.HttpPath("account_id")),
2551
+ cfR2Jurisdiction: Schema.optional(
2552
+ Schema.Literals(["default", "eu", "fedramp"]),
2553
+ ).pipe(T.HttpHeader("cf-r2-jurisdiction")),
2554
+ }).pipe(
2555
+ T.Http({
2556
+ method: "GET",
2557
+ path: "/accounts/{account_id}/r2/buckets/{bucketName}/objects/{objectName}",
2558
+ }),
2559
+ ) as unknown as Schema.Schema<GetObjectRequest>;
2560
+
2561
+ export type GetObjectResponse = File | Blob;
2562
+
2563
+ export const GetObjectResponse =
2564
+ /*@__PURE__*/ /*#__PURE__*/ UploadableSchema.pipe(T.HttpFormDataFile()).pipe(
2565
+ T.ResponsePath("result"),
2566
+ ) as unknown as Schema.Schema<GetObjectResponse>;
2567
+
2568
+ export type GetObjectError =
2569
+ | DefaultErrors
2570
+ | NoSuchBucket
2571
+ | InvalidRoute
2572
+ | NoRoute;
2573
+
2574
+ export const getObject: API.OperationMethod<
2575
+ GetObjectRequest,
2576
+ GetObjectResponse,
2577
+ GetObjectError,
2578
+ Credentials | HttpClient.HttpClient
2579
+ > = /*@__PURE__*/ /*#__PURE__*/ API.make(() => ({
2580
+ input: GetObjectRequest,
2581
+ output: GetObjectResponse,
2582
+ errors: [NoSuchBucket, InvalidRoute, NoRoute],
2583
+ }));
2584
+
2585
+ export interface PutObjectRequest {
2586
+ /** Name of the R2 bucket. */
2587
+ bucketName: string;
2588
+ /** Key (name) of the object. */
2589
+ objectName: string;
2590
+ /** Account ID. */
2591
+ accountId: string;
2592
+ /** Jurisdiction where objects in this bucket are guaranteed to be stored. */
2593
+ cfR2Jurisdiction?: "default" | "eu" | "fedramp";
2594
+ /** MIME type of the object. */
2595
+ contentType?: string;
2596
+ /** Content disposition of the object. */
2597
+ contentDisposition?: string;
2598
+ /** Content encoding of the object. */
2599
+ contentEncoding?: string;
2600
+ /** Content language of the object. */
2601
+ contentLanguage?: string;
2602
+ /** Content length of the object in bytes. */
2603
+ contentLength?: string;
2604
+ /** Cache control directives for the object. */
2605
+ cacheControl?: string;
2606
+ /** Expiration date of the object. */
2607
+ expires?: string;
2608
+ /** Storage class for the object. */
2609
+ cfR2StorageClass?: "Standard" | "InfrequentAccess";
2610
+ body: File | Blob;
2611
+ }
2612
+
2613
+ export const PutObjectRequest = /*@__PURE__*/ /*#__PURE__*/ Schema.Struct({
2614
+ bucketName: Schema.String.pipe(T.HttpPath("bucketName")),
2615
+ objectName: Schema.String.pipe(T.HttpPath("objectName")),
2616
+ accountId: Schema.String.pipe(T.HttpPath("account_id")),
2617
+ cfR2Jurisdiction: Schema.optional(
2618
+ Schema.Literals(["default", "eu", "fedramp"]),
2619
+ ).pipe(T.HttpHeader("cf-r2-jurisdiction")),
2620
+ contentType: Schema.optional(Schema.String).pipe(
2621
+ T.HttpHeader("content-type"),
2622
+ ),
2623
+ contentDisposition: Schema.optional(Schema.String).pipe(
2624
+ T.HttpHeader("content-disposition"),
2625
+ ),
2626
+ contentEncoding: Schema.optional(Schema.String).pipe(
2627
+ T.HttpHeader("content-encoding"),
2628
+ ),
2629
+ contentLanguage: Schema.optional(Schema.String).pipe(
2630
+ T.HttpHeader("content-language"),
2631
+ ),
2632
+ contentLength: Schema.optional(Schema.String).pipe(
2633
+ T.HttpHeader("content-length"),
2634
+ ),
2635
+ cacheControl: Schema.optional(Schema.String).pipe(
2636
+ T.HttpHeader("cache-control"),
2637
+ ),
2638
+ expires: Schema.optional(Schema.String).pipe(T.HttpHeader("expires")),
2639
+ cfR2StorageClass: Schema.optional(
2640
+ Schema.Literals(["Standard", "InfrequentAccess"]),
2641
+ ).pipe(T.HttpHeader("cf-r2-storage-class")),
2642
+ body: UploadableSchema.pipe(T.HttpFormDataFile()).pipe(T.HttpBody()),
2643
+ }).pipe(
2644
+ T.Http({
2645
+ method: "PUT",
2646
+ path: "/accounts/{account_id}/r2/buckets/{bucketName}/objects/{objectName}",
2647
+ contentType: "multipart",
2648
+ }),
2649
+ ) as unknown as Schema.Schema<PutObjectRequest>;
2650
+
2651
+ export type PutObjectResponse = unknown;
2652
+
2653
+ export const PutObjectResponse =
2654
+ /*@__PURE__*/ /*#__PURE__*/ Schema.Unknown.pipe(
2655
+ T.ResponsePath("result"),
2656
+ ) as unknown as Schema.Schema<PutObjectResponse>;
2657
+
2658
+ export type PutObjectError =
2659
+ | DefaultErrors
2660
+ | NoSuchBucket
2661
+ | InvalidRoute
2662
+ | NoRoute;
2663
+
2664
+ export const putObject: API.OperationMethod<
2665
+ PutObjectRequest,
2666
+ PutObjectResponse,
2667
+ PutObjectError,
2668
+ Credentials | HttpClient.HttpClient
2669
+ > = /*@__PURE__*/ /*#__PURE__*/ API.make(() => ({
2670
+ input: PutObjectRequest,
2671
+ output: PutObjectResponse,
2672
+ errors: [NoSuchBucket, InvalidRoute, NoRoute],
2673
+ }));
2674
+
2535
2675
  export interface DeleteObjectRequest {
2676
+ /** Name of the R2 bucket. */
2536
2677
  bucketName: string;
2678
+ /** Key (name) of the object. */
2537
2679
  objectName: string;
2538
2680
  /** Account ID. */
2539
2681
  accountId: string;
@@ -35,6 +35,17 @@ export class DomainNotFound extends Schema.TaggedErrorClass<DomainNotFound>()(
35
35
  ) {}
36
36
  T.applyErrorMatchers(DomainNotFound, [{ code: 100114 }]);
37
37
 
38
+ export class DuplicateMigrationTarget extends Schema.TaggedErrorClass<DuplicateMigrationTarget>()(
39
+ "DuplicateMigrationTarget",
40
+ { code: Schema.Number, message: Schema.String },
41
+ ) {}
42
+ T.applyErrorMatchers(DuplicateMigrationTarget, [
43
+ {
44
+ code: 10074,
45
+ message: { includes: "cannot be the target of more than one migration" },
46
+ },
47
+ ]);
48
+
38
49
  export class DurableObjectMustBeSqlite extends Schema.TaggedErrorClass<DurableObjectMustBeSqlite>()(
39
50
  "DurableObjectMustBeSqlite",
40
51
  { code: Schema.Number, message: Schema.String },
@@ -7470,6 +7481,7 @@ export const PutScriptResponse = /*@__PURE__*/ /*#__PURE__*/ Schema.Struct({
7470
7481
 
7471
7482
  export type PutScriptError =
7472
7483
  | DefaultErrors
7484
+ | DuplicateMigrationTarget
7473
7485
  | InvalidRoute
7474
7486
  | InvalidWorkerScript
7475
7487
  | DurableObjectMustBeSqlite;
@@ -7482,7 +7494,12 @@ export const putScript: API.OperationMethod<
7482
7494
  > = /*@__PURE__*/ /*#__PURE__*/ API.make(() => ({
7483
7495
  input: PutScriptRequest,
7484
7496
  output: PutScriptResponse,
7485
- errors: [InvalidRoute, InvalidWorkerScript, DurableObjectMustBeSqlite],
7497
+ errors: [
7498
+ DuplicateMigrationTarget,
7499
+ InvalidRoute,
7500
+ InvalidWorkerScript,
7501
+ DurableObjectMustBeSqlite,
7502
+ ],
7486
7503
  }));
7487
7504
 
7488
7505
  export interface DeleteScriptRequest {