@prenta/platform-vercel 0.1.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 ADDED
@@ -0,0 +1,181 @@
1
+ # @actuate-media/platform-vercel
2
+
3
+ ## 0.1.0
4
+
5
+ ### Minor Changes
6
+
7
+ - 5eea995: Product rename: ActuateCMS is now **Prenta**. Every package moves from the
8
+ `@actuate-media/*` scope to `@prenta/*` with simplified names (`@prenta/core`,
9
+ `@prenta/admin`, `create-prenta`), and version numbers continue from where the
10
+ old scope left off.
11
+
12
+ This is a clean break — no backwards-compat aliases:
13
+ - **npm packages**: `@actuate-media/cms-core` → `@prenta/core`,
14
+ `@actuate-media/cms-admin` → `@prenta/admin`, all other packages keep their
15
+ suffix under `@prenta/*`. `create-actuate-cms` → `create-prenta`
16
+ (`npm create prenta`), `create-actuate-astro` → `create-prenta-astro`.
17
+ CLI bins: `actuate`/`actuate-cms` → `prenta`/`prenta-cms`; `actuate-mcp` →
18
+ `prenta-mcp`.
19
+ - **Database**: migration `0012_rename_to_prenta` renames all 36 `actuate_*`
20
+ tables to `prenta_*` in place (plus prefixed constraints, indexes, and
21
+ sequences). Run `prisma migrate deploy` when upgrading.
22
+ - **Runtime identifiers**: `getActuateConfig` → `getPrentaConfig`,
23
+ `handleActuateAPI` → `handlePrentaAPI`, `ActuateClient` → `PrentaClient`,
24
+ `ActuateDB` → `PrentaDB`, config file `actuate.config.ts` →
25
+ `prenta.config.ts`, CSS scopes `.actuate-admin`/`.actuate-canvas` →
26
+ `.prenta-admin`/`.prenta-canvas`, preview protocol `actuate-preview:*` →
27
+ `prenta-preview:*`, webhook headers `X-Actuate-*` → `X-Prenta-*`, session
28
+ cookie `actuate_session` → `prenta_session`, env vars `ACTUATE_*` →
29
+ `PRENTA_*`, purge route `/api/actuate/purge` → `/api/prenta/purge`.
30
+ - **Sessions and webhooks**: all sessions reset on upgrade (cookie + JWT issuer
31
+ changed); webhook consumers must re-verify signatures against the new
32
+ `X-Prenta-*` headers.
33
+
34
+ The old `@actuate-media/*` packages are deprecated on npm and will receive no
35
+ further releases.
36
+
37
+ ## 0.0.16
38
+
39
+ ### Patch Changes
40
+
41
+ - cc6ad93: Form notification defaults and shortcode glossary: Reply-To defaults to submitter email, subject includes site name, emails include attribution, Vercel adapter preserves replyTo, and the admin Notifications panel ships a copy-paste shortcode glossary plus Send test.
42
+
43
+ ## 0.0.15
44
+
45
+ ### Patch Changes
46
+
47
+ - 041a228: Add the MIT `license` field to every published package (previously missing) and correct `repository.url` to `github.com/actuate-media/actuatecms` (13 packages carried the wrong org).
48
+
49
+ ## 0.0.14
50
+
51
+ ### Patch Changes
52
+
53
+ - 7a6a140: Support Vercel Marketplace Blob auth via OIDC (`BLOB_STORE_ID` + `VERCEL_OIDC_TOKEN`) instead of requiring `BLOB_READ_WRITE_TOKEN`. Fix `@vercel/blob` client options to use `oidcToken` + `storeId` (never pass OIDC as `token`). Update env diagnostics, upload errors, and `actuate vercel:blob-link` accordingly.
54
+
55
+ ## 0.0.13
56
+
57
+ ### Patch Changes
58
+
59
+ - 854152d: Developer experience improvements from external-consumer feedback:
60
+ - Every published package now ships its `CHANGELOG.md` in the npm tarball, and packages that were missing a `README.md` (cli, cms-admin, cms-core, import, platform-vercel, all plugins, sections-react) now have one — so release notes and usage docs are visible on npmjs.com and in `node_modules`.
61
+ - New client-safe form validation entry point: `@actuate-media/cms-core/forms/client` exports `validateFormFieldClient()`, `validateFormValuesClient()`, visibility/conditional helpers, and the exact `FORM_EMAIL_RE` / `FORM_PHONE_RE` regexes the server enforces — zero Node dependencies, so public-site forms can mirror server rules without reimplementing them. The server validator now imports the same primitives, so client and server can never drift.
62
+
63
+ ## 0.0.12
64
+
65
+ ### Patch Changes
66
+
67
+ - c091125: Recognise Vercel Marketplace Upstash credentials. The Vercel Upstash (Redis/KV) integration provisions `KV_REST_API_URL` / `KV_REST_API_TOKEN`, not `UPSTASH_REDIS_REST_URL` / `UPSTASH_REDIS_REST_TOKEN`, so a correctly-provisioned store previously fell back to the in-memory rate limiter and the `/health` check kept warning.
68
+
69
+ The rate limiter (`createRateLimiter` / `resolveUpstashCredentials`), the platform-vercel rate-limit adapter, and the env health check now read the `KV_REST_API_*` names as a fallback (native `UPSTASH_*` names still win when both are present). No config change is needed for stores provisioned through the Vercel Marketplace.
70
+
71
+ ## 0.0.11
72
+
73
+ ### Patch Changes
74
+
75
+ - b5de8dd: Fix ESM module resolution and dependency duplication issues reported during consumer integration.
76
+ - Add "default" export condition to all platform and plugin packages so they resolve correctly from require() contexts (fixes ERR_PACKAGE_PATH_NOT_EXPORTED in next.config.ts and serverless functions).
77
+ - Move @actuate-media/cms-core from direct dependencies to peerDependencies across all packages to prevent duplicate installations when consumer version ranges don't exactly match the pinned version.
78
+ - Add "prepack" lifecycle script to create-actuate-cms to guarantee dist/ is built before npm publishes the package (fixes empty dist/ in v0.4.0).
79
+
80
+ ## 0.0.10
81
+
82
+ ### Patch Changes
83
+
84
+ - Updated dependencies [54c7a3b]
85
+ - @actuate-media/cms-core@0.6.0
86
+
87
+ ## 0.0.9
88
+
89
+ ### Patch Changes
90
+
91
+ - Updated dependencies [c08cf8b]
92
+ - Updated dependencies [80aa939]
93
+ - @actuate-media/cms-core@0.5.0
94
+
95
+ ## 0.0.8
96
+
97
+ ### Patch Changes
98
+
99
+ - Updated dependencies [f2cf7d7]
100
+ - @actuate-media/cms-core@0.4.0
101
+
102
+ ## 0.0.7
103
+
104
+ ### Patch Changes
105
+
106
+ - Updated dependencies [0621037]
107
+ - @actuate-media/cms-core@0.3.1
108
+
109
+ ## 0.0.6
110
+
111
+ ### Patch Changes
112
+
113
+ - Updated dependencies [4e3a5eb]
114
+ - @actuate-media/cms-core@0.3.0
115
+
116
+ ## 0.0.5
117
+
118
+ ### Patch Changes
119
+
120
+ - Updated dependencies
121
+ - @actuate-media/cms-core@0.2.3
122
+
123
+ ## 0.0.4
124
+
125
+ ### Patch Changes
126
+
127
+ - Updated dependencies
128
+ - @actuate-media/cms-core@0.2.2
129
+
130
+ ## 0.0.3
131
+
132
+ ### Patch Changes
133
+
134
+ - Updated dependencies
135
+ - @actuate-media/cms-core@0.2.1
136
+
137
+ ## 0.0.2
138
+
139
+ ### Patch Changes
140
+
141
+ - 682dac7: Fix consumer integration issues discovered during MaidPro.co deployment
142
+ - **cms-core**: API handlers gracefully degrade when CMS Prisma models are missing (returns 501 instead of 500)
143
+ - **cms-core**: Accept CMS secret via `actuate.config.ts` (`secret` field) in addition to `CMS_SECRET` env var
144
+ - **cms-core**: `withActuateCMS` now accepts `Partial<ActuateCMSConfig>` (no more forced type casts)
145
+ - **cms-core**: `withActuateCMS` auto-injects all `@actuate-media/*` packages into `transpilePackages`
146
+ - **cms-core**: Expanded Prisma schema fragment with all CMS models for consumer merge
147
+ - **cms-admin**: Removed duplicate Tailwind import from admin styles (consumers already load Tailwind)
148
+ - **platform-vercel**: Email adapter accepts both `defaultFrom` and `from` for sender address
149
+ - **plugin-email**: Email plugin accepts both `defaultFrom` and `from` for consistency
150
+
151
+ - 3fd38a2: Fix all 13 integration issues discovered during MaidPro.co deployment
152
+
153
+ **cms-core:**
154
+ - Add .js extensions to all ESM relative imports (58 files)
155
+ - Replace workspace:\* with versioned deps in all packages
156
+ - Add sideEffects:false for proper tree-shaking
157
+ - Subpath exports (/config, /api, /middleware, /next) avoid barrel side effects
158
+ - Stats/search routes use safeCount/safeFindMany for missing Prisma models
159
+ - Ship prisma/cms-schema.prisma with all required CMS models
160
+ - Accept both CMS_SECRET and CMS_SESSION_SECRET with clear error messages
161
+ - Fix hardcoded /admin paths in OAuth flow (now uses getAdminPath())
162
+ - Loosen withActuateCMS and createCMSMiddleware parameter types
163
+ - Auto-inject transpilePackages and serverExternalPackages in withActuateCMS
164
+ - Unify PluginDefinition with ActuatePlugin interface
165
+
166
+ **cms-admin:**
167
+ - Scope all 40+ CSS theme variables to .actuate-admin instead of :root
168
+ - ThemeProvider applies dark class to .actuate-admin, not document.documentElement
169
+ - Scaffold uses (admin)/(site) route groups for full CSS/script isolation
170
+ - Sidebar branding supports custom logo via config.admin.branding
171
+
172
+ **platform-vercel:**
173
+ - Email adapter accepts both `from` and `defaultFrom`
174
+
175
+ **All plugin/platform packages:**
176
+ - Fix ESM .js extensions in compiled output
177
+ - Replace workspace:\* with ^0.1.0 for publishable deps
178
+
179
+ - Updated dependencies [682dac7]
180
+ - Updated dependencies [3fd38a2]
181
+ - @actuate-media/cms-core@0.2.0
package/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 Actuate Media
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/README.md ADDED
@@ -0,0 +1,32 @@
1
+ # @prenta/platform-vercel
2
+
3
+ Vercel infrastructure adapter for [Prenta CMS](https://github.com/actuate-media/prenta):
4
+ file storage via Vercel Blob, rate limiting via Upstash Redis, and
5
+ transactional email via Resend.
6
+
7
+ ```bash
8
+ npm install @prenta/platform-vercel
9
+ ```
10
+
11
+ ## Usage
12
+
13
+ ```ts
14
+ import { vercelPlatform } from '@prenta/platform-vercel'
15
+
16
+ export default defineConfig({
17
+ platform: vercelPlatform(),
18
+ // ...
19
+ })
20
+ ```
21
+
22
+ Required environment variables: `BLOB_READ_WRITE_TOKEN`,
23
+ `UPSTASH_REDIS_REST_URL`, `UPSTASH_REDIS_REST_TOKEN`, `RESEND_API_KEY`.
24
+
25
+ ## Release notes
26
+
27
+ See [CHANGELOG.md](./CHANGELOG.md) (shipped with the package) or the
28
+ [GitHub releases](https://github.com/actuate-media/prenta/releases).
29
+
30
+ ## License
31
+
32
+ MIT
@@ -0,0 +1,27 @@
1
+ /**
2
+ * Resolve `@vercel/blob` client auth options.
3
+ *
4
+ * Vercel Marketplace Blob provisioning injects `BLOB_STORE_ID` and
5
+ * `BLOB_WEBHOOK_PUBLIC_KEY`. On deployed Vercel functions, `VERCEL_OIDC_TOKEN`
6
+ * is also injected — pair it with `storeId` via `oidcToken` (not `token`).
7
+ * Legacy stores may still use `BLOB_READ_WRITE_TOKEN` as `token`.
8
+ *
9
+ * @see https://vercel.com/docs/vercel-blob/using-blob-sdk#authentication
10
+ */
11
+ export type BlobClientAuthOptions = {
12
+ token?: string;
13
+ oidcToken?: string;
14
+ storeId?: string;
15
+ };
16
+ export type BlobAuthEnv = {
17
+ BLOB_READ_WRITE_TOKEN?: string;
18
+ BLOB_STORE_ID?: string;
19
+ VERCEL_OIDC_TOKEN?: string;
20
+ BLOB_WEBHOOK_PUBLIC_KEY?: string;
21
+ };
22
+ export declare function resolveBlobClientAuthOptions(overrides?: BlobClientAuthOptions, env?: BlobAuthEnv): BlobClientAuthOptions;
23
+ /** True when legacy token or Marketplace OIDC credentials are present. */
24
+ export declare function isBlobStorageConfigured(env?: BlobAuthEnv): boolean;
25
+ /** Operator-facing hint when uploads would fail for missing Blob auth. */
26
+ export declare function blobStorageConfigHint(env?: BlobAuthEnv): string;
27
+ //# sourceMappingURL=blob-auth.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"blob-auth.d.ts","sourceRoot":"","sources":["../src/blob-auth.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AACH,MAAM,MAAM,qBAAqB,GAAG;IAClC,KAAK,CAAC,EAAE,MAAM,CAAA;IACd,SAAS,CAAC,EAAE,MAAM,CAAA;IAClB,OAAO,CAAC,EAAE,MAAM,CAAA;CACjB,CAAA;AAED,MAAM,MAAM,WAAW,GAAG;IACxB,qBAAqB,CAAC,EAAE,MAAM,CAAA;IAC9B,aAAa,CAAC,EAAE,MAAM,CAAA;IACtB,iBAAiB,CAAC,EAAE,MAAM,CAAA;IAC1B,uBAAuB,CAAC,EAAE,MAAM,CAAA;CACjC,CAAA;AAED,wBAAgB,4BAA4B,CAC1C,SAAS,GAAE,qBAA0B,EACrC,GAAG,GAAE,WAAwC,GAC5C,qBAAqB,CASvB;AAED,0EAA0E;AAC1E,wBAAgB,uBAAuB,CAAC,GAAG,GAAE,WAAwC,GAAG,OAAO,CAG9F;AAED,0EAA0E;AAC1E,wBAAgB,qBAAqB,CAAC,GAAG,GAAE,WAAwC,GAAG,MAAM,CAgB3F"}
@@ -0,0 +1,30 @@
1
+ export function resolveBlobClientAuthOptions(overrides = {}, env = process.env) {
2
+ const token = overrides.token ?? env.BLOB_READ_WRITE_TOKEN?.trim();
3
+ if (token)
4
+ return { token };
5
+ const oidcToken = overrides.oidcToken ?? env.VERCEL_OIDC_TOKEN?.trim();
6
+ const storeId = overrides.storeId ?? env.BLOB_STORE_ID?.trim();
7
+ if (oidcToken && storeId)
8
+ return { oidcToken, storeId };
9
+ return {};
10
+ }
11
+ /** True when legacy token or Marketplace OIDC credentials are present. */
12
+ export function isBlobStorageConfigured(env = process.env) {
13
+ if (env.BLOB_READ_WRITE_TOKEN?.trim())
14
+ return true;
15
+ return Boolean(env.BLOB_STORE_ID?.trim() && env.VERCEL_OIDC_TOKEN?.trim());
16
+ }
17
+ /** Operator-facing hint when uploads would fail for missing Blob auth. */
18
+ export function blobStorageConfigHint(env = process.env) {
19
+ if (isBlobStorageConfigured(env))
20
+ return '';
21
+ const storeLinked = Boolean(env.BLOB_STORE_ID?.trim() ?? env.BLOB_WEBHOOK_PUBLIC_KEY?.trim());
22
+ if (storeLinked) {
23
+ return ('A Vercel Blob store is linked (BLOB_STORE_ID) but no upload auth is available in this environment. ' +
24
+ 'On Vercel, redeploy so VERCEL_OIDC_TOKEN is injected automatically. For local dev, run `vercel env pull`. ' +
25
+ 'Legacy stores can set BLOB_READ_WRITE_TOKEN instead.');
26
+ }
27
+ return ('Configure Vercel Blob: connect a store to the project (BLOB_STORE_ID + OIDC on Vercel) ' +
28
+ 'or set BLOB_READ_WRITE_TOKEN for legacy token auth.');
29
+ }
30
+ //# sourceMappingURL=blob-auth.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"blob-auth.js","sourceRoot":"","sources":["../src/blob-auth.ts"],"names":[],"mappings":"AAuBA,MAAM,UAAU,4BAA4B,CAC1C,YAAmC,EAAE,EACrC,MAAmB,OAAO,CAAC,GAAkB;IAE7C,MAAM,KAAK,GAAG,SAAS,CAAC,KAAK,IAAI,GAAG,CAAC,qBAAqB,EAAE,IAAI,EAAE,CAAA;IAClE,IAAI,KAAK;QAAE,OAAO,EAAE,KAAK,EAAE,CAAA;IAE3B,MAAM,SAAS,GAAG,SAAS,CAAC,SAAS,IAAI,GAAG,CAAC,iBAAiB,EAAE,IAAI,EAAE,CAAA;IACtE,MAAM,OAAO,GAAG,SAAS,CAAC,OAAO,IAAI,GAAG,CAAC,aAAa,EAAE,IAAI,EAAE,CAAA;IAC9D,IAAI,SAAS,IAAI,OAAO;QAAE,OAAO,EAAE,SAAS,EAAE,OAAO,EAAE,CAAA;IAEvD,OAAO,EAAE,CAAA;AACX,CAAC;AAED,0EAA0E;AAC1E,MAAM,UAAU,uBAAuB,CAAC,MAAmB,OAAO,CAAC,GAAkB;IACnF,IAAI,GAAG,CAAC,qBAAqB,EAAE,IAAI,EAAE;QAAE,OAAO,IAAI,CAAA;IAClD,OAAO,OAAO,CAAC,GAAG,CAAC,aAAa,EAAE,IAAI,EAAE,IAAI,GAAG,CAAC,iBAAiB,EAAE,IAAI,EAAE,CAAC,CAAA;AAC5E,CAAC;AAED,0EAA0E;AAC1E,MAAM,UAAU,qBAAqB,CAAC,MAAmB,OAAO,CAAC,GAAkB;IACjF,IAAI,uBAAuB,CAAC,GAAG,CAAC;QAAE,OAAO,EAAE,CAAA;IAE3C,MAAM,WAAW,GAAG,OAAO,CAAC,GAAG,CAAC,aAAa,EAAE,IAAI,EAAE,IAAI,GAAG,CAAC,uBAAuB,EAAE,IAAI,EAAE,CAAC,CAAA;IAC7F,IAAI,WAAW,EAAE,CAAC;QAChB,OAAO,CACL,qGAAqG;YACrG,4GAA4G;YAC5G,sDAAsD,CACvD,CAAA;IACH,CAAC;IAED,OAAO,CACL,yFAAyF;QACzF,qDAAqD,CACtD,CAAA;AACH,CAAC"}
@@ -0,0 +1,6 @@
1
+ import type { CacheAdapter } from '@prenta/core';
2
+ export interface CacheAdapterOptions {
3
+ prefix?: string;
4
+ }
5
+ export declare function createCacheAdapter(options?: CacheAdapterOptions): CacheAdapter;
6
+ //# sourceMappingURL=cache.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"cache.d.ts","sourceRoot":"","sources":["../src/cache.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,cAAc,CAAA;AAOhD,MAAM,WAAW,mBAAmB;IAClC,MAAM,CAAC,EAAE,MAAM,CAAA;CAChB;AAID,wBAAgB,kBAAkB,CAAC,OAAO,GAAE,mBAAwB,GAAG,YAAY,CAmClF"}
package/dist/cache.js ADDED
@@ -0,0 +1,34 @@
1
+ const memoryCache = new Map();
2
+ export function createCacheAdapter(options = {}) {
3
+ const prefix = options.prefix ?? 'prenta:';
4
+ function prefixedKey(key) {
5
+ return `${prefix}${key}`;
6
+ }
7
+ return {
8
+ async get(key) {
9
+ const entry = memoryCache.get(prefixedKey(key));
10
+ if (!entry)
11
+ return null;
12
+ if (entry.expiresAt && Date.now() > entry.expiresAt) {
13
+ memoryCache.delete(prefixedKey(key));
14
+ return null;
15
+ }
16
+ return entry.value;
17
+ },
18
+ async set(key, value, ttl) {
19
+ memoryCache.set(prefixedKey(key), {
20
+ value,
21
+ expiresAt: ttl ? Date.now() + ttl * 1000 : undefined,
22
+ });
23
+ },
24
+ async delete(key) {
25
+ memoryCache.delete(prefixedKey(key));
26
+ },
27
+ async invalidateTag(tag) {
28
+ // @ts-ignore optional peer dependency
29
+ const { revalidateTag } = await import('next/cache');
30
+ revalidateTag(tag);
31
+ },
32
+ };
33
+ }
34
+ //# sourceMappingURL=cache.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"cache.js","sourceRoot":"","sources":["../src/cache.ts"],"names":[],"mappings":"AAWA,MAAM,WAAW,GAAG,IAAI,GAAG,EAAkD,CAAA;AAE7E,MAAM,UAAU,kBAAkB,CAAC,UAA+B,EAAE;IAClE,MAAM,MAAM,GAAG,OAAO,CAAC,MAAM,IAAI,SAAS,CAAA;IAE1C,SAAS,WAAW,CAAC,GAAW;QAC9B,OAAO,GAAG,MAAM,GAAG,GAAG,EAAE,CAAA;IAC1B,CAAC;IAED,OAAO;QACL,KAAK,CAAC,GAAG,CAAI,GAAW;YACtB,MAAM,KAAK,GAAG,WAAW,CAAC,GAAG,CAAC,WAAW,CAAC,GAAG,CAAC,CAAC,CAAA;YAC/C,IAAI,CAAC,KAAK;gBAAE,OAAO,IAAI,CAAA;YACvB,IAAI,KAAK,CAAC,SAAS,IAAI,IAAI,CAAC,GAAG,EAAE,GAAG,KAAK,CAAC,SAAS,EAAE,CAAC;gBACpD,WAAW,CAAC,MAAM,CAAC,WAAW,CAAC,GAAG,CAAC,CAAC,CAAA;gBACpC,OAAO,IAAI,CAAA;YACb,CAAC;YACD,OAAO,KAAK,CAAC,KAAU,CAAA;QACzB,CAAC;QAED,KAAK,CAAC,GAAG,CAAI,GAAW,EAAE,KAAQ,EAAE,GAAY;YAC9C,WAAW,CAAC,GAAG,CAAC,WAAW,CAAC,GAAG,CAAC,EAAE;gBAChC,KAAK;gBACL,SAAS,EAAE,GAAG,CAAC,CAAC,CAAC,IAAI,CAAC,GAAG,EAAE,GAAG,GAAG,GAAG,IAAI,CAAC,CAAC,CAAC,SAAS;aACrD,CAAC,CAAA;QACJ,CAAC;QAED,KAAK,CAAC,MAAM,CAAC,GAAW;YACtB,WAAW,CAAC,MAAM,CAAC,WAAW,CAAC,GAAG,CAAC,CAAC,CAAA;QACtC,CAAC;QAED,KAAK,CAAC,aAAa,CAAC,GAAW;YAC7B,sCAAsC;YACtC,MAAM,EAAE,aAAa,EAAE,GAAG,MAAM,MAAM,CAAC,YAAY,CAAC,CAAA;YACpD,aAAa,CAAC,GAAG,CAAC,CAAA;QACpB,CAAC;KACF,CAAA;AACH,CAAC"}
@@ -0,0 +1,6 @@
1
+ import type { DatabaseAdapter } from '@prenta/core';
2
+ export interface NeonAdapterOptions {
3
+ connectionString?: string;
4
+ }
5
+ export declare function createNeonAdapter(options?: NeonAdapterOptions): DatabaseAdapter;
6
+ //# sourceMappingURL=database.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"database.d.ts","sourceRoot":"","sources":["../src/database.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,cAAc,CAAA;AAMnD,MAAM,WAAW,kBAAkB;IACjC,gBAAgB,CAAC,EAAE,MAAM,CAAA;CAC1B;AAED,wBAAgB,iBAAiB,CAAC,OAAO,GAAE,kBAAuB,GAAG,eAAe,CA4BnF"}
@@ -0,0 +1,23 @@
1
+ export function createNeonAdapter(options = {}) {
2
+ const connectionString = options.connectionString ?? process.env.DATABASE_URL ?? '';
3
+ return {
4
+ async connect() {
5
+ const { neon } = await import('@neondatabase/serverless');
6
+ neon(connectionString);
7
+ },
8
+ async disconnect() {
9
+ // Neon serverless driver is stateless — no persistent connection to close.
10
+ },
11
+ async query(sql, params) {
12
+ const { neon } = await import('@neondatabase/serverless');
13
+ const queryFn = neon(connectionString);
14
+ return (await queryFn(sql, params));
15
+ },
16
+ async transaction(fn) {
17
+ // Neon serverless HTTP driver does not support multi-statement transactions.
18
+ // For transactional workloads, use @neondatabase/serverless WebSocket mode.
19
+ return fn();
20
+ },
21
+ };
22
+ }
23
+ //# sourceMappingURL=database.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"database.js","sourceRoot":"","sources":["../src/database.ts"],"names":[],"mappings":"AAUA,MAAM,UAAU,iBAAiB,CAAC,UAA8B,EAAE;IAChE,MAAM,gBAAgB,GAAG,OAAO,CAAC,gBAAgB,IAAI,OAAO,CAAC,GAAG,CAAC,YAAY,IAAI,EAAE,CAAA;IAEnF,OAAO;QACL,KAAK,CAAC,OAAO;YACX,MAAM,EAAE,IAAI,EAAE,GAAG,MAAM,MAAM,CAAC,0BAA0B,CAAC,CAAA;YACzD,IAAI,CAAC,gBAAgB,CAAC,CAAA;QACxB,CAAC;QAED,KAAK,CAAC,UAAU;YACd,2EAA2E;QAC7E,CAAC;QAED,KAAK,CAAC,KAAK,CAAI,GAAW,EAAE,MAAkB;YAC5C,MAAM,EAAE,IAAI,EAAE,GAAG,MAAM,MAAM,CAAC,0BAA0B,CAAC,CAAA;YACzD,MAAM,OAAO,GAAG,IAAI,CAAC,gBAAgB,CAGd,CAAA;YACvB,OAAO,CAAC,MAAM,OAAO,CAAC,GAAG,EAAE,MAAM,CAAC,CAAQ,CAAA;QAC5C,CAAC;QAED,KAAK,CAAC,WAAW,CAAI,EAAoB;YACvC,6EAA6E;YAC7E,4EAA4E;YAC5E,OAAO,EAAE,EAAE,CAAA;QACb,CAAC;KACF,CAAA;AACH,CAAC"}
@@ -0,0 +1,10 @@
1
+ import type { EmailAdapter } from '@prenta/core';
2
+ export interface EmailAdapterOptions {
3
+ apiKey?: string;
4
+ /** Default sender address. */
5
+ defaultFrom?: string;
6
+ /** Default sender address. Alias of `defaultFrom`. */
7
+ from?: string;
8
+ }
9
+ export declare function createEmailAdapter(options?: EmailAdapterOptions): EmailAdapter;
10
+ //# sourceMappingURL=email.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"email.d.ts","sourceRoot":"","sources":["../src/email.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,cAAc,CAAA;AAOhD,MAAM,WAAW,mBAAmB;IAClC,MAAM,CAAC,EAAE,MAAM,CAAA;IACf,8BAA8B;IAC9B,WAAW,CAAC,EAAE,MAAM,CAAA;IACpB,sDAAsD;IACtD,IAAI,CAAC,EAAE,MAAM,CAAA;CACd;AAED,wBAAgB,kBAAkB,CAAC,OAAO,GAAE,mBAAwB,GAAG,YAAY,CA+BlF"}
package/dist/email.js ADDED
@@ -0,0 +1,22 @@
1
+ export function createEmailAdapter(options = {}) {
2
+ const apiKey = options.apiKey ?? process.env.RESEND_API_KEY ?? '';
3
+ const defaultFrom = options.defaultFrom ?? options.from ?? process.env.EMAIL_FROM ?? 'noreply@prentacms.com';
4
+ return {
5
+ async send(message) {
6
+ const { Resend } = await import('resend');
7
+ const resend = new Resend(apiKey);
8
+ const { error } = await resend.emails.send({
9
+ from: message.from ?? defaultFrom,
10
+ to: [message.to],
11
+ subject: message.subject,
12
+ html: message.html,
13
+ text: message.text,
14
+ ...(message.replyTo ? { replyTo: message.replyTo } : {}),
15
+ });
16
+ if (error) {
17
+ throw new Error(`Failed to send email: ${error.message}`);
18
+ }
19
+ },
20
+ };
21
+ }
22
+ //# sourceMappingURL=email.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"email.js","sourceRoot":"","sources":["../src/email.ts"],"names":[],"mappings":"AAeA,MAAM,UAAU,kBAAkB,CAAC,UAA+B,EAAE;IAClE,MAAM,MAAM,GAAG,OAAO,CAAC,MAAM,IAAI,OAAO,CAAC,GAAG,CAAC,cAAc,IAAI,EAAE,CAAA;IACjE,MAAM,WAAW,GACf,OAAO,CAAC,WAAW,IAAI,OAAO,CAAC,IAAI,IAAI,OAAO,CAAC,GAAG,CAAC,UAAU,IAAI,uBAAuB,CAAA;IAE1F,OAAO;QACL,KAAK,CAAC,IAAI,CAAC,OAOV;YACC,MAAM,EAAE,MAAM,EAAE,GAAG,MAAM,MAAM,CAAC,QAAQ,CAAC,CAAA;YACzC,MAAM,MAAM,GAAG,IAAI,MAAM,CAAC,MAAM,CAAC,CAAA;YAEjC,MAAM,EAAE,KAAK,EAAE,GAAG,MAAM,MAAM,CAAC,MAAM,CAAC,IAAI,CAAC;gBACzC,IAAI,EAAE,OAAO,CAAC,IAAI,IAAI,WAAW;gBACjC,EAAE,EAAE,CAAC,OAAO,CAAC,EAAE,CAAC;gBAChB,OAAO,EAAE,OAAO,CAAC,OAAO;gBACxB,IAAI,EAAE,OAAO,CAAC,IAAI;gBAClB,IAAI,EAAE,OAAO,CAAC,IAAI;gBAClB,GAAG,CAAC,OAAO,CAAC,OAAO,CAAC,CAAC,CAAC,EAAE,OAAO,EAAE,OAAO,CAAC,OAAO,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC;aACzD,CAAC,CAAA;YAEF,IAAI,KAAK,EAAE,CAAC;gBACV,MAAM,IAAI,KAAK,CAAC,yBAAyB,KAAK,CAAC,OAAO,EAAE,CAAC,CAAA;YAC3D,CAAC;QACH,CAAC;KACF,CAAA;AACH,CAAC"}
@@ -0,0 +1,39 @@
1
+ import type { DatabaseAdapter, StorageAdapter, CacheAdapter, EmailAdapter, SchedulerAdapter, RateLimitAdapter } from '@prenta/core';
2
+ import { type NeonAdapterOptions } from './database.js';
3
+ import { type BlobAdapterOptions } from './storage.js';
4
+ import { type CacheAdapterOptions } from './cache.js';
5
+ import { type EmailAdapterOptions } from './email.js';
6
+ import { type SchedulerAdapterOptions } from './scheduler.js';
7
+ import { type RateLimitAdapterOptions } from './rate-limit.js';
8
+ export interface PlatformAdapters {
9
+ database: DatabaseAdapter;
10
+ storage: StorageAdapter;
11
+ cache: CacheAdapter;
12
+ email: EmailAdapter;
13
+ scheduler: SchedulerAdapter;
14
+ rateLimit: RateLimitAdapter;
15
+ }
16
+ export interface VercelPlatformOptions {
17
+ database?: NeonAdapterOptions;
18
+ storage?: BlobAdapterOptions;
19
+ cache?: CacheAdapterOptions;
20
+ email?: EmailAdapterOptions;
21
+ scheduler?: SchedulerAdapterOptions;
22
+ rateLimit?: RateLimitAdapterOptions;
23
+ }
24
+ export declare function vercel(options?: VercelPlatformOptions): PlatformAdapters;
25
+ export { createNeonAdapter } from './database.js';
26
+ export { createBlobAdapter } from './storage.js';
27
+ export { blobStorageConfigHint, isBlobStorageConfigured, resolveBlobClientAuthOptions, } from './blob-auth.js';
28
+ export { createCacheAdapter } from './cache.js';
29
+ export { createEmailAdapter } from './email.js';
30
+ export { createSchedulerAdapter, generateCronConfig } from './scheduler.js';
31
+ export { createRateLimitAdapter } from './rate-limit.js';
32
+ export type { NeonAdapterOptions } from './database.js';
33
+ export type { BlobAdapterOptions } from './storage.js';
34
+ export type { BlobAuthEnv, BlobClientAuthOptions } from './blob-auth.js';
35
+ export type { CacheAdapterOptions } from './cache.js';
36
+ export type { EmailAdapterOptions } from './email.js';
37
+ export type { SchedulerAdapterOptions, VercelCronConfig } from './scheduler.js';
38
+ export type { RateLimitAdapterOptions } from './rate-limit.js';
39
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,eAAe,EACf,cAAc,EACd,YAAY,EACZ,YAAY,EACZ,gBAAgB,EAChB,gBAAgB,EACjB,MAAM,cAAc,CAAA;AACrB,OAAO,EAAqB,KAAK,kBAAkB,EAAE,MAAM,eAAe,CAAA;AAC1E,OAAO,EAAqB,KAAK,kBAAkB,EAAE,MAAM,cAAc,CAAA;AACzE,OAAO,EAAsB,KAAK,mBAAmB,EAAE,MAAM,YAAY,CAAA;AACzE,OAAO,EAAsB,KAAK,mBAAmB,EAAE,MAAM,YAAY,CAAA;AACzE,OAAO,EAA0B,KAAK,uBAAuB,EAAE,MAAM,gBAAgB,CAAA;AACrF,OAAO,EAA0B,KAAK,uBAAuB,EAAE,MAAM,iBAAiB,CAAA;AAEtF,MAAM,WAAW,gBAAgB;IAC/B,QAAQ,EAAE,eAAe,CAAA;IACzB,OAAO,EAAE,cAAc,CAAA;IACvB,KAAK,EAAE,YAAY,CAAA;IACnB,KAAK,EAAE,YAAY,CAAA;IACnB,SAAS,EAAE,gBAAgB,CAAA;IAC3B,SAAS,EAAE,gBAAgB,CAAA;CAC5B;AAED,MAAM,WAAW,qBAAqB;IACpC,QAAQ,CAAC,EAAE,kBAAkB,CAAA;IAC7B,OAAO,CAAC,EAAE,kBAAkB,CAAA;IAC5B,KAAK,CAAC,EAAE,mBAAmB,CAAA;IAC3B,KAAK,CAAC,EAAE,mBAAmB,CAAA;IAC3B,SAAS,CAAC,EAAE,uBAAuB,CAAA;IACnC,SAAS,CAAC,EAAE,uBAAuB,CAAA;CACpC;AAED,wBAAgB,MAAM,CAAC,OAAO,GAAE,qBAA0B,GAAG,gBAAgB,CAS5E;AAED,OAAO,EAAE,iBAAiB,EAAE,MAAM,eAAe,CAAA;AACjD,OAAO,EAAE,iBAAiB,EAAE,MAAM,cAAc,CAAA;AAChD,OAAO,EACL,qBAAqB,EACrB,uBAAuB,EACvB,4BAA4B,GAC7B,MAAM,gBAAgB,CAAA;AACvB,OAAO,EAAE,kBAAkB,EAAE,MAAM,YAAY,CAAA;AAC/C,OAAO,EAAE,kBAAkB,EAAE,MAAM,YAAY,CAAA;AAC/C,OAAO,EAAE,sBAAsB,EAAE,kBAAkB,EAAE,MAAM,gBAAgB,CAAA;AAC3E,OAAO,EAAE,sBAAsB,EAAE,MAAM,iBAAiB,CAAA;AAExD,YAAY,EAAE,kBAAkB,EAAE,MAAM,eAAe,CAAA;AACvD,YAAY,EAAE,kBAAkB,EAAE,MAAM,cAAc,CAAA;AACtD,YAAY,EAAE,WAAW,EAAE,qBAAqB,EAAE,MAAM,gBAAgB,CAAA;AACxE,YAAY,EAAE,mBAAmB,EAAE,MAAM,YAAY,CAAA;AACrD,YAAY,EAAE,mBAAmB,EAAE,MAAM,YAAY,CAAA;AACrD,YAAY,EAAE,uBAAuB,EAAE,gBAAgB,EAAE,MAAM,gBAAgB,CAAA;AAC/E,YAAY,EAAE,uBAAuB,EAAE,MAAM,iBAAiB,CAAA"}
package/dist/index.js ADDED
@@ -0,0 +1,24 @@
1
+ import { createNeonAdapter } from './database.js';
2
+ import { createBlobAdapter } from './storage.js';
3
+ import { createCacheAdapter } from './cache.js';
4
+ import { createEmailAdapter } from './email.js';
5
+ import { createSchedulerAdapter } from './scheduler.js';
6
+ import { createRateLimitAdapter } from './rate-limit.js';
7
+ export function vercel(options = {}) {
8
+ return {
9
+ database: createNeonAdapter(options.database),
10
+ storage: createBlobAdapter(options.storage),
11
+ cache: createCacheAdapter(options.cache),
12
+ email: createEmailAdapter(options.email),
13
+ scheduler: createSchedulerAdapter(options.scheduler),
14
+ rateLimit: createRateLimitAdapter(options.rateLimit),
15
+ };
16
+ }
17
+ export { createNeonAdapter } from './database.js';
18
+ export { createBlobAdapter } from './storage.js';
19
+ export { blobStorageConfigHint, isBlobStorageConfigured, resolveBlobClientAuthOptions, } from './blob-auth.js';
20
+ export { createCacheAdapter } from './cache.js';
21
+ export { createEmailAdapter } from './email.js';
22
+ export { createSchedulerAdapter, generateCronConfig } from './scheduler.js';
23
+ export { createRateLimitAdapter } from './rate-limit.js';
24
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAQA,OAAO,EAAE,iBAAiB,EAA2B,MAAM,eAAe,CAAA;AAC1E,OAAO,EAAE,iBAAiB,EAA2B,MAAM,cAAc,CAAA;AACzE,OAAO,EAAE,kBAAkB,EAA4B,MAAM,YAAY,CAAA;AACzE,OAAO,EAAE,kBAAkB,EAA4B,MAAM,YAAY,CAAA;AACzE,OAAO,EAAE,sBAAsB,EAAgC,MAAM,gBAAgB,CAAA;AACrF,OAAO,EAAE,sBAAsB,EAAgC,MAAM,iBAAiB,CAAA;AAoBtF,MAAM,UAAU,MAAM,CAAC,UAAiC,EAAE;IACxD,OAAO;QACL,QAAQ,EAAE,iBAAiB,CAAC,OAAO,CAAC,QAAQ,CAAC;QAC7C,OAAO,EAAE,iBAAiB,CAAC,OAAO,CAAC,OAAO,CAAC;QAC3C,KAAK,EAAE,kBAAkB,CAAC,OAAO,CAAC,KAAK,CAAC;QACxC,KAAK,EAAE,kBAAkB,CAAC,OAAO,CAAC,KAAK,CAAC;QACxC,SAAS,EAAE,sBAAsB,CAAC,OAAO,CAAC,SAAS,CAAC;QACpD,SAAS,EAAE,sBAAsB,CAAC,OAAO,CAAC,SAAS,CAAC;KACrD,CAAA;AACH,CAAC;AAED,OAAO,EAAE,iBAAiB,EAAE,MAAM,eAAe,CAAA;AACjD,OAAO,EAAE,iBAAiB,EAAE,MAAM,cAAc,CAAA;AAChD,OAAO,EACL,qBAAqB,EACrB,uBAAuB,EACvB,4BAA4B,GAC7B,MAAM,gBAAgB,CAAA;AACvB,OAAO,EAAE,kBAAkB,EAAE,MAAM,YAAY,CAAA;AAC/C,OAAO,EAAE,kBAAkB,EAAE,MAAM,YAAY,CAAA;AAC/C,OAAO,EAAE,sBAAsB,EAAE,kBAAkB,EAAE,MAAM,gBAAgB,CAAA;AAC3E,OAAO,EAAE,sBAAsB,EAAE,MAAM,iBAAiB,CAAA"}
@@ -0,0 +1,7 @@
1
+ import type { RateLimitAdapter } from '@prenta/core';
2
+ export interface RateLimitAdapterOptions {
3
+ redisUrl?: string;
4
+ redisToken?: string;
5
+ }
6
+ export declare function createRateLimitAdapter(options?: RateLimitAdapterOptions): RateLimitAdapter;
7
+ //# sourceMappingURL=rate-limit.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"rate-limit.d.ts","sourceRoot":"","sources":["../src/rate-limit.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,cAAc,CAAA;AAOpD,MAAM,WAAW,uBAAuB;IACtC,QAAQ,CAAC,EAAE,MAAM,CAAA;IACjB,UAAU,CAAC,EAAE,MAAM,CAAA;CACpB;AAED,wBAAgB,sBAAsB,CAAC,OAAO,GAAE,uBAA4B,GAAG,gBAAgB,CAsE9F"}
@@ -0,0 +1,48 @@
1
+ export function createRateLimitAdapter(options = {}) {
2
+ // Accept both the Upstash console names and the Vercel Marketplace
3
+ // Upstash/KV names (KV_REST_API_*), which point at the same REST endpoint
4
+ // and token. The Marketplace integration is the recommended provisioning
5
+ // path, so reading its names keeps rate limiting working out of the box.
6
+ const redisUrl = options.redisUrl ?? process.env.UPSTASH_REDIS_REST_URL ?? process.env.KV_REST_API_URL ?? '';
7
+ const redisToken = options.redisToken ??
8
+ process.env.UPSTASH_REDIS_REST_TOKEN ??
9
+ process.env.KV_REST_API_TOKEN ??
10
+ '';
11
+ let limiterCache = null;
12
+ async function getOrCreateLimiter(limit, windowMs) {
13
+ const cacheKey = `${limit}:${windowMs}`;
14
+ if (!limiterCache)
15
+ limiterCache = new Map();
16
+ const cached = limiterCache.get(cacheKey);
17
+ if (cached)
18
+ return cached;
19
+ const { Redis } = await import('@upstash/redis');
20
+ const { Ratelimit } = await import('@upstash/ratelimit');
21
+ const redis = new Redis({ url: redisUrl, token: redisToken });
22
+ const windowSec = `${Math.ceil(windowMs / 1000)} s`;
23
+ const limiter = new Ratelimit({
24
+ redis,
25
+ limiter: Ratelimit.slidingWindow(limit, windowSec),
26
+ analytics: true,
27
+ });
28
+ limiterCache.set(cacheKey, limiter);
29
+ return limiter;
30
+ }
31
+ return {
32
+ async check(key, limit, windowMs) {
33
+ const limiter = (await getOrCreateLimiter(limit, windowMs));
34
+ const result = await limiter.limit(key);
35
+ return {
36
+ allowed: result.success,
37
+ remaining: result.remaining,
38
+ resetAt: new Date(result.reset),
39
+ };
40
+ },
41
+ async reset(key) {
42
+ const { Redis } = await import('@upstash/redis');
43
+ const redis = new Redis({ url: redisUrl, token: redisToken });
44
+ await redis.del(key);
45
+ },
46
+ };
47
+ }
48
+ //# sourceMappingURL=rate-limit.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"rate-limit.js","sourceRoot":"","sources":["../src/rate-limit.ts"],"names":[],"mappings":"AAYA,MAAM,UAAU,sBAAsB,CAAC,UAAmC,EAAE;IAC1E,mEAAmE;IACnE,0EAA0E;IAC1E,yEAAyE;IACzE,yEAAyE;IACzE,MAAM,QAAQ,GACZ,OAAO,CAAC,QAAQ,IAAI,OAAO,CAAC,GAAG,CAAC,sBAAsB,IAAI,OAAO,CAAC,GAAG,CAAC,eAAe,IAAI,EAAE,CAAA;IAC7F,MAAM,UAAU,GACd,OAAO,CAAC,UAAU;QAClB,OAAO,CAAC,GAAG,CAAC,wBAAwB;QACpC,OAAO,CAAC,GAAG,CAAC,iBAAiB;QAC7B,EAAE,CAAA;IAEJ,IAAI,YAAY,GAAgC,IAAI,CAAA;IAEpD,KAAK,UAAU,kBAAkB,CAAC,KAAa,EAAE,QAAgB;QAC/D,MAAM,QAAQ,GAAG,GAAG,KAAK,IAAI,QAAQ,EAAE,CAAA;QACvC,IAAI,CAAC,YAAY;YAAE,YAAY,GAAG,IAAI,GAAG,EAAE,CAAA;QAE3C,MAAM,MAAM,GAAG,YAAY,CAAC,GAAG,CAAC,QAAQ,CAAC,CAAA;QACzC,IAAI,MAAM;YAAE,OAAO,MAAM,CAAA;QAEzB,MAAM,EAAE,KAAK,EAAE,GAAG,MAAM,MAAM,CAAC,gBAAgB,CAAC,CAAA;QAChD,MAAM,EAAE,SAAS,EAAE,GAAG,MAAM,MAAM,CAAC,oBAAoB,CAAC,CAAA;QAExD,MAAM,KAAK,GAAG,IAAI,KAAK,CAAC,EAAE,GAAG,EAAE,QAAQ,EAAE,KAAK,EAAE,UAAU,EAAE,CAAC,CAAA;QAC7D,MAAM,SAAS,GAAG,GAAG,IAAI,CAAC,IAAI,CAAC,QAAQ,GAAG,IAAI,CAAC,IAAI,CAAA;QACnD,MAAM,OAAO,GAAG,IAAI,SAAS,CAAC;YAC5B,KAAK;YACL,OAAO,EAAE,SAAS,CAAC,aAAa,CAC9B,KAAK,EACL,SAA0D,CAC3D;YACD,SAAS,EAAE,IAAI;SAChB,CAAC,CAAA;QAEF,YAAY,CAAC,GAAG,CAAC,QAAQ,EAAE,OAAO,CAAC,CAAA;QACnC,OAAO,OAAO,CAAA;IAChB,CAAC;IAED,OAAO;QACL,KAAK,CAAC,KAAK,CACT,GAAW,EACX,KAAa,EACb,QAAgB;YAEhB,MAAM,OAAO,GAAG,CAAC,MAAM,kBAAkB,CAAC,KAAK,EAAE,QAAQ,CAAC,CAOzD,CAAA;YAED,MAAM,MAAM,GAAG,MAAM,OAAO,CAAC,KAAK,CAAC,GAAG,CAAC,CAAA;YAEvC,OAAO;gBACL,OAAO,EAAE,MAAM,CAAC,OAAO;gBACvB,SAAS,EAAE,MAAM,CAAC,SAAS;gBAC3B,OAAO,EAAE,IAAI,IAAI,CAAC,MAAM,CAAC,KAAK,CAAC;aAChC,CAAA;QACH,CAAC;QAED,KAAK,CAAC,KAAK,CAAC,GAAW;YACrB,MAAM,EAAE,KAAK,EAAE,GAAG,MAAM,MAAM,CAAC,gBAAgB,CAAC,CAAA;YAChD,MAAM,KAAK,GAAG,IAAI,KAAK,CAAC,EAAE,GAAG,EAAE,QAAQ,EAAE,KAAK,EAAE,UAAU,EAAE,CAAC,CAAA;YAC7D,MAAM,KAAK,CAAC,GAAG,CAAC,GAAG,CAAC,CAAA;QACtB,CAAC;KACF,CAAA;AACH,CAAC"}
@@ -0,0 +1,14 @@
1
+ import type { SchedulerAdapter } from '@prenta/core';
2
+ export interface SchedulerAdapterOptions {
3
+ basePath?: string;
4
+ }
5
+ export interface VercelCronConfig {
6
+ path: string;
7
+ schedule: string;
8
+ }
9
+ export declare function createSchedulerAdapter(options?: SchedulerAdapterOptions): SchedulerAdapter;
10
+ export declare function generateCronConfig(jobs: Array<{
11
+ id: string;
12
+ cron: string;
13
+ }>, basePath?: string): VercelCronConfig[];
14
+ //# sourceMappingURL=scheduler.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"scheduler.d.ts","sourceRoot":"","sources":["../src/scheduler.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,cAAc,CAAA;AAOpD,MAAM,WAAW,uBAAuB;IACtC,QAAQ,CAAC,EAAE,MAAM,CAAA;CAClB;AAED,MAAM,WAAW,gBAAgB;IAC/B,IAAI,EAAE,MAAM,CAAA;IACZ,QAAQ,EAAE,MAAM,CAAA;CACjB;AAID,wBAAgB,sBAAsB,CAAC,OAAO,GAAE,uBAA4B,GAAG,gBAAgB,CAgC9F;AAED,wBAAgB,kBAAkB,CAChC,IAAI,EAAE,KAAK,CAAC;IAAE,EAAE,EAAE,MAAM,CAAC;IAAC,IAAI,EAAE,MAAM,CAAA;CAAE,CAAC,EACzC,QAAQ,SAAc,GACrB,gBAAgB,EAAE,CAKpB"}
@@ -0,0 +1,30 @@
1
+ const registeredJobs = new Map();
2
+ export function createSchedulerAdapter(options = {}) {
3
+ const basePath = options.basePath ?? '/api/cron';
4
+ return {
5
+ async schedule(id, cronExpression, handler) {
6
+ registeredJobs.set(id, { expression: cronExpression, handler });
7
+ console.info(`[prenta:scheduler] Registered cron job "${id}".\n` +
8
+ ` Vercel Cron requires static config in vercel.json:\n` +
9
+ ` { "path": "${basePath}/${id}", "schedule": "${cronExpression}" }`);
10
+ },
11
+ async cancel(id) {
12
+ registeredJobs.delete(id);
13
+ console.info(`[prenta:scheduler] Removed cron job "${id}". ` + `Also remove the entry from vercel.json.`);
14
+ },
15
+ async list() {
16
+ return Array.from(registeredJobs.entries()).map(([id, job]) => ({
17
+ id,
18
+ expression: job.expression,
19
+ nextRun: new Date(),
20
+ }));
21
+ },
22
+ };
23
+ }
24
+ export function generateCronConfig(jobs, basePath = '/api/cron') {
25
+ return jobs.map((job) => ({
26
+ path: `${basePath}/${job.id}`,
27
+ schedule: job.cron,
28
+ }));
29
+ }
30
+ //# sourceMappingURL=scheduler.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"scheduler.js","sourceRoot":"","sources":["../src/scheduler.ts"],"names":[],"mappings":"AAgBA,MAAM,cAAc,GAAG,IAAI,GAAG,EAAgE,CAAA;AAE9F,MAAM,UAAU,sBAAsB,CAAC,UAAmC,EAAE;IAC1E,MAAM,QAAQ,GAAG,OAAO,CAAC,QAAQ,IAAI,WAAW,CAAA;IAEhD,OAAO;QACL,KAAK,CAAC,QAAQ,CACZ,EAAU,EACV,cAAsB,EACtB,OAA4B;YAE5B,cAAc,CAAC,GAAG,CAAC,EAAE,EAAE,EAAE,UAAU,EAAE,cAAc,EAAE,OAAO,EAAE,CAAC,CAAA;YAC/D,OAAO,CAAC,IAAI,CACV,2CAA2C,EAAE,MAAM;gBACjD,wDAAwD;gBACxD,gBAAgB,QAAQ,IAAI,EAAE,mBAAmB,cAAc,KAAK,CACvE,CAAA;QACH,CAAC;QAED,KAAK,CAAC,MAAM,CAAC,EAAU;YACrB,cAAc,CAAC,MAAM,CAAC,EAAE,CAAC,CAAA;YACzB,OAAO,CAAC,IAAI,CACV,wCAAwC,EAAE,KAAK,GAAG,yCAAyC,CAC5F,CAAA;QACH,CAAC;QAED,KAAK,CAAC,IAAI;YACR,OAAO,KAAK,CAAC,IAAI,CAAC,cAAc,CAAC,OAAO,EAAE,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,GAAG,CAAC,EAAE,EAAE,CAAC,CAAC;gBAC9D,EAAE;gBACF,UAAU,EAAE,GAAG,CAAC,UAAU;gBAC1B,OAAO,EAAE,IAAI,IAAI,EAAE;aACpB,CAAC,CAAC,CAAA;QACL,CAAC;KACF,CAAA;AACH,CAAC;AAED,MAAM,UAAU,kBAAkB,CAChC,IAAyC,EACzC,QAAQ,GAAG,WAAW;IAEtB,OAAO,IAAI,CAAC,GAAG,CAAC,CAAC,GAAG,EAAE,EAAE,CAAC,CAAC;QACxB,IAAI,EAAE,GAAG,QAAQ,IAAI,GAAG,CAAC,EAAE,EAAE;QAC7B,QAAQ,EAAE,GAAG,CAAC,IAAI;KACnB,CAAC,CAAC,CAAA;AACL,CAAC"}
@@ -0,0 +1,6 @@
1
+ import type { StorageAdapter } from '@prenta/core';
2
+ import { type BlobClientAuthOptions } from './blob-auth.js';
3
+ export interface BlobAdapterOptions extends BlobClientAuthOptions {
4
+ }
5
+ export declare function createBlobAdapter(options?: BlobAdapterOptions): StorageAdapter;
6
+ //# sourceMappingURL=storage.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"storage.d.ts","sourceRoot":"","sources":["../src/storage.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,cAAc,CAAA;AAClD,OAAO,EAIL,KAAK,qBAAqB,EAC3B,MAAM,gBAAgB,CAAA;AAEvB,MAAM,WAAW,kBAAmB,SAAQ,qBAAqB;CAAG;AAOpE,wBAAgB,iBAAiB,CAAC,OAAO,GAAE,kBAAuB,GAAG,cAAc,CAsClF"}
@@ -0,0 +1,42 @@
1
+ import { blobStorageConfigHint, isBlobStorageConfigured, resolveBlobClientAuthOptions, } from './blob-auth.js';
2
+ function assertBlobConfigured() {
3
+ if (isBlobStorageConfigured())
4
+ return;
5
+ throw new Error(blobStorageConfigHint());
6
+ }
7
+ export function createBlobAdapter(options = {}) {
8
+ const authOptions = () => resolveBlobClientAuthOptions(options);
9
+ return {
10
+ async upload(key, data, contentType) {
11
+ assertBlobConfigured();
12
+ const { put } = await import('@vercel/blob');
13
+ const blob = await put(key, data, {
14
+ access: 'public',
15
+ contentType,
16
+ addRandomSuffix: false,
17
+ ...authOptions(),
18
+ });
19
+ return blob.url;
20
+ },
21
+ async download(key) {
22
+ assertBlobConfigured();
23
+ const { head } = await import('@vercel/blob');
24
+ const blob = await head(key, authOptions());
25
+ const response = await fetch(blob.url);
26
+ const arrayBuffer = await response.arrayBuffer();
27
+ return Buffer.from(arrayBuffer);
28
+ },
29
+ async delete(key) {
30
+ assertBlobConfigured();
31
+ const { del } = await import('@vercel/blob');
32
+ await del(key, authOptions());
33
+ },
34
+ async getSignedUrl(key, _expiresIn) {
35
+ assertBlobConfigured();
36
+ const { head } = await import('@vercel/blob');
37
+ const blob = await head(key, authOptions());
38
+ return blob.url;
39
+ },
40
+ };
41
+ }
42
+ //# sourceMappingURL=storage.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"storage.js","sourceRoot":"","sources":["../src/storage.ts"],"names":[],"mappings":"AACA,OAAO,EACL,qBAAqB,EACrB,uBAAuB,EACvB,4BAA4B,GAE7B,MAAM,gBAAgB,CAAA;AAIvB,SAAS,oBAAoB;IAC3B,IAAI,uBAAuB,EAAE;QAAE,OAAM;IACrC,MAAM,IAAI,KAAK,CAAC,qBAAqB,EAAE,CAAC,CAAA;AAC1C,CAAC;AAED,MAAM,UAAU,iBAAiB,CAAC,UAA8B,EAAE;IAChE,MAAM,WAAW,GAAG,GAAG,EAAE,CAAC,4BAA4B,CAAC,OAAO,CAAC,CAAA;IAE/D,OAAO;QACL,KAAK,CAAC,MAAM,CAAC,GAAW,EAAE,IAA6B,EAAE,WAAmB;YAC1E,oBAAoB,EAAE,CAAA;YACtB,MAAM,EAAE,GAAG,EAAE,GAAG,MAAM,MAAM,CAAC,cAAc,CAAC,CAAA;YAC5C,MAAM,IAAI,GAAG,MAAM,GAAG,CAAC,GAAG,EAAE,IAA+B,EAAE;gBAC3D,MAAM,EAAE,QAAQ;gBAChB,WAAW;gBACX,eAAe,EAAE,KAAK;gBACtB,GAAG,WAAW,EAAE;aACjB,CAAC,CAAA;YACF,OAAO,IAAI,CAAC,GAAG,CAAA;QACjB,CAAC;QAED,KAAK,CAAC,QAAQ,CAAC,GAAW;YACxB,oBAAoB,EAAE,CAAA;YACtB,MAAM,EAAE,IAAI,EAAE,GAAG,MAAM,MAAM,CAAC,cAAc,CAAC,CAAA;YAC7C,MAAM,IAAI,GAAG,MAAM,IAAI,CAAC,GAAG,EAAE,WAAW,EAAE,CAAC,CAAA;YAC3C,MAAM,QAAQ,GAAG,MAAM,KAAK,CAAC,IAAI,CAAC,GAAG,CAAC,CAAA;YACtC,MAAM,WAAW,GAAG,MAAM,QAAQ,CAAC,WAAW,EAAE,CAAA;YAChD,OAAO,MAAM,CAAC,IAAI,CAAC,WAAW,CAAC,CAAA;QACjC,CAAC;QAED,KAAK,CAAC,MAAM,CAAC,GAAW;YACtB,oBAAoB,EAAE,CAAA;YACtB,MAAM,EAAE,GAAG,EAAE,GAAG,MAAM,MAAM,CAAC,cAAc,CAAC,CAAA;YAC5C,MAAM,GAAG,CAAC,GAAG,EAAE,WAAW,EAAE,CAAC,CAAA;QAC/B,CAAC;QAED,KAAK,CAAC,YAAY,CAAC,GAAW,EAAE,UAAmB;YACjD,oBAAoB,EAAE,CAAA;YACtB,MAAM,EAAE,IAAI,EAAE,GAAG,MAAM,MAAM,CAAC,cAAc,CAAC,CAAA;YAC7C,MAAM,IAAI,GAAG,MAAM,IAAI,CAAC,GAAG,EAAE,WAAW,EAAE,CAAC,CAAA;YAC3C,OAAO,IAAI,CAAC,GAAG,CAAA;QACjB,CAAC;KACF,CAAA;AACH,CAAC"}
package/package.json ADDED
@@ -0,0 +1,64 @@
1
+ {
2
+ "name": "@prenta/platform-vercel",
3
+ "version": "0.1.0",
4
+ "license": "MIT",
5
+ "repository": {
6
+ "type": "git",
7
+ "url": "https://github.com/actuate-media/prenta.git",
8
+ "directory": "packages/platform-vercel"
9
+ },
10
+ "publishConfig": {
11
+ "access": "public"
12
+ },
13
+ "type": "module",
14
+ "exports": {
15
+ ".": {
16
+ "types": "./dist/index.d.ts",
17
+ "import": "./dist/index.js",
18
+ "default": "./dist/index.js"
19
+ }
20
+ },
21
+ "main": "./dist/index.js",
22
+ "types": "./dist/index.d.ts",
23
+ "files": [
24
+ "dist",
25
+ "CHANGELOG.md"
26
+ ],
27
+ "devDependencies": {
28
+ "typescript": "^5.7.0",
29
+ "vitest": "^4.1.0",
30
+ "@prenta/core": "0.118.0"
31
+ },
32
+ "peerDependencies": {
33
+ "@prenta/core": ">=0.1.0",
34
+ "@neondatabase/serverless": ">=0.9.0",
35
+ "@vercel/blob": ">=0.23.0",
36
+ "@upstash/redis": ">=1.28.0",
37
+ "@upstash/ratelimit": ">=1.0.0",
38
+ "resend": ">=3.0.0"
39
+ },
40
+ "peerDependenciesMeta": {
41
+ "@neondatabase/serverless": {
42
+ "optional": true
43
+ },
44
+ "@vercel/blob": {
45
+ "optional": true
46
+ },
47
+ "@upstash/redis": {
48
+ "optional": true
49
+ },
50
+ "@upstash/ratelimit": {
51
+ "optional": true
52
+ },
53
+ "resend": {
54
+ "optional": true
55
+ }
56
+ },
57
+ "scripts": {
58
+ "build": "tsc -p tsconfig.build.json",
59
+ "type-check": "tsc --noEmit",
60
+ "test": "vitest run",
61
+ "test:watch": "vitest",
62
+ "clean": "rm -rf dist .turbo"
63
+ }
64
+ }