@emdash-cms/cloudflare 0.0.1 → 0.0.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.
@@ -1,17 +1,6 @@
1
1
  import { createRemoteJWKSet, jwtVerify } from "jose";
2
2
 
3
3
  //#region src/auth/cloudflare-access.ts
4
- /**
5
- * Cloudflare Access Authentication - RUNTIME MODULE
6
- *
7
- * When EmDash is deployed behind Cloudflare Access, this module handles
8
- * JWT validation and user provisioning from Access identity.
9
- *
10
- * Uses jose for JWT verification - works in all runtimes.
11
- *
12
- * This is loaded at runtime via the auth provider system.
13
- * Do not import at config time.
14
- */
15
4
  const jwksCache = /* @__PURE__ */ new Map();
16
5
  /** Regex to extract CF_Authorization cookie value */
17
6
  const CF_AUTHORIZATION_COOKIE_REGEX = /CF_Authorization=([^;]+)/;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@emdash-cms/cloudflare",
3
- "version": "0.0.1",
3
+ "version": "0.0.2",
4
4
  "description": "Cloudflare adapters for EmDash - D1, R2, Access, and Worker Loader sandbox",
5
5
  "type": "module",
6
6
  "main": "dist/index.mjs",
@@ -66,7 +66,7 @@
66
66
  "jose": "^6.1.3",
67
67
  "kysely-d1": "^0.4.0",
68
68
  "ulidx": "^2.4.1",
69
- "emdash": "0.0.1"
69
+ "emdash": "0.0.2"
70
70
  },
71
71
  "peerDependencies": {
72
72
  "@cloudflare/workers-types": ">=4.0.0",
@@ -83,10 +83,10 @@
83
83
  },
84
84
  "repository": {
85
85
  "type": "git",
86
- "url": "git+https://github.com/cloudflare/emdash.git",
86
+ "url": "git+https://github.com/emdash-cms/emdash.git",
87
87
  "directory": "packages/cloudflare"
88
88
  },
89
- "homepage": "https://github.com/cloudflare/emdash",
89
+ "homepage": "https://github.com/emdash-cms/emdash",
90
90
  "keywords": [
91
91
  "emdash",
92
92
  "cloudflare",
@@ -10,8 +10,8 @@
10
10
  * Do not import at config time.
11
11
  */
12
12
 
13
- import { createRemoteJWKSet, jwtVerify, type JWTPayload } from "jose";
14
13
  import type { AuthResult } from "emdash";
14
+ import { createRemoteJWKSet, jwtVerify, type JWTPayload } from "jose";
15
15
 
16
16
  /**
17
17
  * Configuration for Cloudflare Access authentication
@@ -22,8 +22,8 @@
22
22
 
23
23
  import type { MiddlewareHandler } from "astro";
24
24
  import { env } from "cloudflare:workers";
25
- import { Kysely } from "kysely";
26
25
  import { runWithContext } from "emdash/request-context";
26
+ import { Kysely } from "kysely";
27
27
  import { ulid } from "ulidx";
28
28
 
29
29
  import type { EmDashPreviewDB } from "./do-class.js";
package/src/storage/r2.ts CHANGED
@@ -61,11 +61,7 @@ export class R2Storage implements Storage {
61
61
  };
62
62
  } catch (error) {
63
63
  if (error instanceof EmDashStorageError) throw error;
64
- throw new EmDashStorageError(
65
- `Failed to upload file: ${options.key}`,
66
- "UPLOAD_FAILED",
67
- error,
68
- );
64
+ throw new EmDashStorageError(`Failed to upload file: ${options.key}`, "UPLOAD_FAILED", error);
69
65
  }
70
66
  }
71
67
 
@@ -107,11 +103,7 @@ export class R2Storage implements Storage {
107
103
  const object = await this.bucket.head(key);
108
104
  return object !== null;
109
105
  } catch (error) {
110
- throw new EmDashStorageError(
111
- `Failed to check file existence: ${key}`,
112
- "HEAD_FAILED",
113
- error,
114
- );
106
+ throw new EmDashStorageError(`Failed to check file existence: ${key}`, "HEAD_FAILED", error);
115
107
  }
116
108
  }
117
109