@prenta/plugin-media 0.2.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 +223 -0
- package/LICENSE +21 -0
- package/README.md +28 -0
- package/dist/__tests__/hooks.test.d.ts +2 -0
- package/dist/__tests__/hooks.test.d.ts.map +1 -0
- package/dist/__tests__/hooks.test.js +101 -0
- package/dist/__tests__/hooks.test.js.map +1 -0
- package/dist/__tests__/index.test.d.ts +2 -0
- package/dist/__tests__/index.test.d.ts.map +1 -0
- package/dist/__tests__/index.test.js +110 -0
- package/dist/__tests__/index.test.js.map +1 -0
- package/dist/__tests__/orphan-detector.test.d.ts +2 -0
- package/dist/__tests__/orphan-detector.test.d.ts.map +1 -0
- package/dist/__tests__/orphan-detector.test.js +49 -0
- package/dist/__tests__/orphan-detector.test.js.map +1 -0
- package/dist/__tests__/presigned.test.d.ts +2 -0
- package/dist/__tests__/presigned.test.d.ts.map +1 -0
- package/dist/__tests__/presigned.test.js +34 -0
- package/dist/__tests__/presigned.test.js.map +1 -0
- package/dist/__tests__/tracker.test.d.ts +2 -0
- package/dist/__tests__/tracker.test.d.ts.map +1 -0
- package/dist/__tests__/tracker.test.js +51 -0
- package/dist/__tests__/tracker.test.js.map +1 -0
- package/dist/__tests__/validation.test.d.ts +2 -0
- package/dist/__tests__/validation.test.d.ts.map +1 -0
- package/dist/__tests__/validation.test.js +156 -0
- package/dist/__tests__/validation.test.js.map +1 -0
- package/dist/admin/MediaDetail.d.ts +11 -0
- package/dist/admin/MediaDetail.d.ts.map +1 -0
- package/dist/admin/MediaDetail.js +56 -0
- package/dist/admin/MediaDetail.js.map +1 -0
- package/dist/admin/MediaGrid.d.ts +22 -0
- package/dist/admin/MediaGrid.d.ts.map +1 -0
- package/dist/admin/MediaGrid.js +69 -0
- package/dist/admin/MediaGrid.js.map +1 -0
- package/dist/admin/MediaPicker.d.ts +11 -0
- package/dist/admin/MediaPicker.d.ts.map +1 -0
- package/dist/admin/MediaPicker.js +98 -0
- package/dist/admin/MediaPicker.js.map +1 -0
- package/dist/collections.d.ts +3 -0
- package/dist/collections.d.ts.map +1 -0
- package/dist/collections.js +2 -0
- package/dist/collections.js.map +1 -0
- package/dist/fields.d.ts +3 -0
- package/dist/fields.d.ts.map +1 -0
- package/dist/fields.js +2 -0
- package/dist/fields.js.map +1 -0
- package/dist/hooks.d.ts +18 -0
- package/dist/hooks.d.ts.map +1 -0
- package/dist/hooks.js +43 -0
- package/dist/hooks.js.map +1 -0
- package/dist/index.d.ts +21 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +25 -0
- package/dist/index.js.map +1 -0
- package/dist/upload/presigned.d.ts +15 -0
- package/dist/upload/presigned.d.ts.map +1 -0
- package/dist/upload/presigned.js +15 -0
- package/dist/upload/presigned.js.map +1 -0
- package/dist/upload/validation.d.ts +16 -0
- package/dist/upload/validation.d.ts.map +1 -0
- package/dist/upload/validation.js +77 -0
- package/dist/upload/validation.js.map +1 -0
- package/dist/usage/orphan-detector.d.ts +20 -0
- package/dist/usage/orphan-detector.d.ts.map +1 -0
- package/dist/usage/orphan-detector.js +24 -0
- package/dist/usage/orphan-detector.js.map +1 -0
- package/dist/usage/tracker.d.ts +12 -0
- package/dist/usage/tracker.d.ts.map +1 -0
- package/dist/usage/tracker.js +36 -0
- package/dist/usage/tracker.js.map +1 -0
- package/package.json +47 -0
package/CHANGELOG.md
ADDED
|
@@ -0,0 +1,223 @@
|
|
|
1
|
+
# @actuate-media/plugin-media
|
|
2
|
+
|
|
3
|
+
## 0.2.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.1.0
|
|
38
|
+
|
|
39
|
+
### Minor Changes
|
|
40
|
+
|
|
41
|
+
- 98a5149: `generateOrphanReport` now computes a real `totalMedia`.
|
|
42
|
+
|
|
43
|
+
It previously took only the orphan ids and hard-coded `totalMedia` to 0, so a
|
|
44
|
+
report could claim more orphans than total media. It now takes the full media-id
|
|
45
|
+
set and the usage records (like `findOrphanMedia`), computes orphans internally,
|
|
46
|
+
and reports `totalMedia = allMediaIds.length` — so `totalOrphans <= totalMedia`
|
|
47
|
+
always holds. The always-`null` `estimatedReclaimable` field is removed from
|
|
48
|
+
`OrphanReport` (it required file-size data the function never had). Breaking:
|
|
49
|
+
call `generateOrphanReport(allMediaIds, usageRecords)` instead of
|
|
50
|
+
`generateOrphanReport(orphanIds)`.
|
|
51
|
+
|
|
52
|
+
## 0.0.15
|
|
53
|
+
|
|
54
|
+
### Patch Changes
|
|
55
|
+
|
|
56
|
+
- e25cd48: Standardize React peer ranges to `^18.0.0 || ^19.0.0`.
|
|
57
|
+
|
|
58
|
+
Plugin React peer ranges were inconsistent: `plugin-ai`, `plugin-commerce`, and
|
|
59
|
+
`plugin-seo` pinned `react: ^19.2.0` (excluding React 18, which `cms-core`
|
|
60
|
+
supports via `react >=18.0.0`), while the others used `^18.0.0 || ^19.2.0`
|
|
61
|
+
(excluding React 19.0/19.1). Either produced an `ERESOLVE` install failure for
|
|
62
|
+
consumers on the excluded versions. All bundled plugins now declare `react`
|
|
63
|
+
(and `react-dom` where already peered) as `^18.0.0 || ^19.0.0`.
|
|
64
|
+
|
|
65
|
+
## 0.0.14
|
|
66
|
+
|
|
67
|
+
### Patch Changes
|
|
68
|
+
|
|
69
|
+
- c231dd0: Add `definePlugin` and migrate all 10 plugins onto the canonical `PluginDefinition` contract.
|
|
70
|
+
|
|
71
|
+
cms-core already exported `PluginDefinition`, but every plugin hand-rolled a
|
|
72
|
+
local `ActuatePlugin` interface — a lossy subset that dropped `version`/`init`
|
|
73
|
+
and, in blocks/email/ai, widened hook payloads to `unknown[]`/`event: string`.
|
|
74
|
+
That's copy-paste drift with no shared source of truth.
|
|
75
|
+
|
|
76
|
+
`cms-core` now exports `definePlugin(plugin: PluginDefinition)` (an identity
|
|
77
|
+
helper like `defineConfig`), and each plugin imports the canonical type instead
|
|
78
|
+
of its own: the local `ActuatePlugin` interfaces are deleted, factory return
|
|
79
|
+
types are `PluginDefinition`, and the widened `hooks.ts` types are retyped as
|
|
80
|
+
`PluginHook[]`. Type-only change — no runtime behavior, plugin `name`, or config
|
|
81
|
+
options changed. Net −69 lines.
|
|
82
|
+
|
|
83
|
+
- 325694f: Import `definePlugin` from the lightweight `@actuate-media/cms-core/config`
|
|
84
|
+
entry instead of the barrel.
|
|
85
|
+
|
|
86
|
+
The plugin-definition migration imported the `definePlugin` **value** from
|
|
87
|
+
`@actuate-media/cms-core`, which pulls the entire cms-core barrel (graphql,
|
|
88
|
+
sharp, sentry, codegen) into every plugin's runtime — bundle bloat for
|
|
89
|
+
consumers and, under parallel test load, a timeout. The `/config` subpath exists
|
|
90
|
+
precisely to avoid the barrel. Types stay as erased `import type`, so nothing
|
|
91
|
+
heavy is loaded. No API or behavior change.
|
|
92
|
+
|
|
93
|
+
## 0.0.13
|
|
94
|
+
|
|
95
|
+
### Patch Changes
|
|
96
|
+
|
|
97
|
+
- 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).
|
|
98
|
+
- de419f2: Give plugin hooks a frozen, typed event contract. cms-core now exports
|
|
99
|
+
`PluginHook`, `PluginHookEvent`, and `PluginHookPayload` (document + upload
|
|
100
|
+
variants) as the single source of truth, and dispatches a complete, consistent
|
|
101
|
+
set of events: `afterCreate` / `afterUpdate` / `afterDelete` — each also in a
|
|
102
|
+
collection-namespaced form (`afterUpdate:navigations`, `afterCreate:orders`) —
|
|
103
|
+
plus `afterUpload` (fired post-upload from the media route). Every handler now
|
|
104
|
+
receives one typed payload; document field values live on `payload.data`.
|
|
105
|
+
|
|
106
|
+
Previously core fired only bare `afterCreate`/`afterUpdate` with the raw row, so
|
|
107
|
+
several shipped plugins' hooks were dead: `plugin-media`'s `afterUpload` never
|
|
108
|
+
fired, `plugin-navigation` read fields that didn't exist, and the namespaced
|
|
109
|
+
events `plugin-forms`/`plugin-commerce` declared were never dispatched. Each
|
|
110
|
+
plugin has been aligned to the shared type and dispatched events (and
|
|
111
|
+
`plugin-redirects`' request-time `onRedirectMatch` hook — which the lifecycle
|
|
112
|
+
bus never dispatched — was removed). Undispatched event names are now a
|
|
113
|
+
compile-time error.
|
|
114
|
+
|
|
115
|
+
## 0.0.12
|
|
116
|
+
|
|
117
|
+
### Patch Changes
|
|
118
|
+
|
|
119
|
+
- 854152d: Developer experience improvements from external-consumer feedback:
|
|
120
|
+
- 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`.
|
|
121
|
+
- 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.
|
|
122
|
+
|
|
123
|
+
## 0.0.11
|
|
124
|
+
|
|
125
|
+
### Patch Changes
|
|
126
|
+
|
|
127
|
+
- b5de8dd: Fix ESM module resolution and dependency duplication issues reported during consumer integration.
|
|
128
|
+
- 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).
|
|
129
|
+
- 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.
|
|
130
|
+
- 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).
|
|
131
|
+
|
|
132
|
+
## 0.0.10
|
|
133
|
+
|
|
134
|
+
### Patch Changes
|
|
135
|
+
|
|
136
|
+
- Updated dependencies [54c7a3b]
|
|
137
|
+
- @actuate-media/cms-core@0.6.0
|
|
138
|
+
|
|
139
|
+
## 0.0.9
|
|
140
|
+
|
|
141
|
+
### Patch Changes
|
|
142
|
+
|
|
143
|
+
- Updated dependencies [c08cf8b]
|
|
144
|
+
- Updated dependencies [80aa939]
|
|
145
|
+
- @actuate-media/cms-core@0.5.0
|
|
146
|
+
|
|
147
|
+
## 0.0.8
|
|
148
|
+
|
|
149
|
+
### Patch Changes
|
|
150
|
+
|
|
151
|
+
- Updated dependencies [f2cf7d7]
|
|
152
|
+
- @actuate-media/cms-core@0.4.0
|
|
153
|
+
|
|
154
|
+
## 0.0.7
|
|
155
|
+
|
|
156
|
+
### Patch Changes
|
|
157
|
+
|
|
158
|
+
- Updated dependencies [0621037]
|
|
159
|
+
- @actuate-media/cms-core@0.3.1
|
|
160
|
+
|
|
161
|
+
## 0.0.6
|
|
162
|
+
|
|
163
|
+
### Patch Changes
|
|
164
|
+
|
|
165
|
+
- Updated dependencies [4e3a5eb]
|
|
166
|
+
- @actuate-media/cms-core@0.3.0
|
|
167
|
+
|
|
168
|
+
## 0.0.5
|
|
169
|
+
|
|
170
|
+
### Patch Changes
|
|
171
|
+
|
|
172
|
+
- Updated dependencies
|
|
173
|
+
- @actuate-media/cms-core@0.2.3
|
|
174
|
+
|
|
175
|
+
## 0.0.4
|
|
176
|
+
|
|
177
|
+
### Patch Changes
|
|
178
|
+
|
|
179
|
+
- Updated dependencies
|
|
180
|
+
- @actuate-media/cms-core@0.2.2
|
|
181
|
+
|
|
182
|
+
## 0.0.3
|
|
183
|
+
|
|
184
|
+
### Patch Changes
|
|
185
|
+
|
|
186
|
+
- Updated dependencies
|
|
187
|
+
- @actuate-media/cms-core@0.2.1
|
|
188
|
+
|
|
189
|
+
## 0.0.2
|
|
190
|
+
|
|
191
|
+
### Patch Changes
|
|
192
|
+
|
|
193
|
+
- 3fd38a2: Fix all 13 integration issues discovered during MaidPro.co deployment
|
|
194
|
+
|
|
195
|
+
**cms-core:**
|
|
196
|
+
- Add .js extensions to all ESM relative imports (58 files)
|
|
197
|
+
- Replace workspace:\* with versioned deps in all packages
|
|
198
|
+
- Add sideEffects:false for proper tree-shaking
|
|
199
|
+
- Subpath exports (/config, /api, /middleware, /next) avoid barrel side effects
|
|
200
|
+
- Stats/search routes use safeCount/safeFindMany for missing Prisma models
|
|
201
|
+
- Ship prisma/cms-schema.prisma with all required CMS models
|
|
202
|
+
- Accept both CMS_SECRET and CMS_SESSION_SECRET with clear error messages
|
|
203
|
+
- Fix hardcoded /admin paths in OAuth flow (now uses getAdminPath())
|
|
204
|
+
- Loosen withActuateCMS and createCMSMiddleware parameter types
|
|
205
|
+
- Auto-inject transpilePackages and serverExternalPackages in withActuateCMS
|
|
206
|
+
- Unify PluginDefinition with ActuatePlugin interface
|
|
207
|
+
|
|
208
|
+
**cms-admin:**
|
|
209
|
+
- Scope all 40+ CSS theme variables to .actuate-admin instead of :root
|
|
210
|
+
- ThemeProvider applies dark class to .actuate-admin, not document.documentElement
|
|
211
|
+
- Scaffold uses (admin)/(site) route groups for full CSS/script isolation
|
|
212
|
+
- Sidebar branding supports custom logo via config.admin.branding
|
|
213
|
+
|
|
214
|
+
**platform-vercel:**
|
|
215
|
+
- Email adapter accepts both `from` and `defaultFrom`
|
|
216
|
+
|
|
217
|
+
**All plugin/platform packages:**
|
|
218
|
+
- Fix ESM .js extensions in compiled output
|
|
219
|
+
- Replace workspace:\* with ^0.1.0 for publishable deps
|
|
220
|
+
|
|
221
|
+
- Updated dependencies [682dac7]
|
|
222
|
+
- Updated dependencies [3fd38a2]
|
|
223
|
+
- @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,28 @@
|
|
|
1
|
+
# @prenta/plugin-media
|
|
2
|
+
|
|
3
|
+
Media enhancements for [Prenta CMS](https://github.com/actuate-media/prenta)
|
|
4
|
+
— folders, focal points, and library tooling.
|
|
5
|
+
|
|
6
|
+
```bash
|
|
7
|
+
npm install @prenta/plugin-media
|
|
8
|
+
```
|
|
9
|
+
|
|
10
|
+
## Usage
|
|
11
|
+
|
|
12
|
+
```ts
|
|
13
|
+
import { mediaPlugin } from '@prenta/plugin-media'
|
|
14
|
+
|
|
15
|
+
export default defineConfig({
|
|
16
|
+
plugins: [mediaPlugin()],
|
|
17
|
+
// ...
|
|
18
|
+
})
|
|
19
|
+
```
|
|
20
|
+
|
|
21
|
+
## Release notes
|
|
22
|
+
|
|
23
|
+
See [CHANGELOG.md](./CHANGELOG.md) (shipped with the package) or the
|
|
24
|
+
[GitHub releases](https://github.com/actuate-media/prenta/releases).
|
|
25
|
+
|
|
26
|
+
## License
|
|
27
|
+
|
|
28
|
+
MIT
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"hooks.test.d.ts","sourceRoot":"","sources":["../../src/__tests__/hooks.test.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,101 @@
|
|
|
1
|
+
import { describe, expect, it, vi } from 'vitest';
|
|
2
|
+
import { createMediaHooks } from '../hooks.js';
|
|
3
|
+
// storageProvider is threaded into the context but never read by the handler,
|
|
4
|
+
// so it has no observable behavior to assert here.
|
|
5
|
+
const baseContext = {
|
|
6
|
+
maxFileSize: 1_000_000_000,
|
|
7
|
+
allowedTypes: ['image/*'],
|
|
8
|
+
storageProvider: 'local',
|
|
9
|
+
};
|
|
10
|
+
/** Invokes the (only) afterUpload hook, tolerating partial upload payloads. */
|
|
11
|
+
async function fire(hook, payload) {
|
|
12
|
+
await hook.handler(payload);
|
|
13
|
+
}
|
|
14
|
+
describe('afterUpload — type policy (isAllowedType)', () => {
|
|
15
|
+
it('warns when contentType is not in allowedTypes', async () => {
|
|
16
|
+
const [hook] = createMediaHooks(baseContext);
|
|
17
|
+
const warn = vi.spyOn(console, 'warn').mockImplementation(() => { });
|
|
18
|
+
try {
|
|
19
|
+
await fire(hook, { id: 'f1', contentType: 'application/zip', size: 10 });
|
|
20
|
+
expect(warn).toHaveBeenCalledWith(expect.stringContaining('not in the allowed list'));
|
|
21
|
+
}
|
|
22
|
+
finally {
|
|
23
|
+
warn.mockRestore();
|
|
24
|
+
}
|
|
25
|
+
});
|
|
26
|
+
it('does not warn when a wildcard prefix matches (image/* covers image/png)', async () => {
|
|
27
|
+
const [hook] = createMediaHooks(baseContext);
|
|
28
|
+
const warn = vi.spyOn(console, 'warn').mockImplementation(() => { });
|
|
29
|
+
try {
|
|
30
|
+
await fire(hook, { id: 'f2', contentType: 'image/png', size: 10 });
|
|
31
|
+
expect(warn).not.toHaveBeenCalled();
|
|
32
|
+
}
|
|
33
|
+
finally {
|
|
34
|
+
warn.mockRestore();
|
|
35
|
+
}
|
|
36
|
+
});
|
|
37
|
+
it('allows every type when allowedTypes is empty (allow-all short-circuit)', async () => {
|
|
38
|
+
const [hook] = createMediaHooks({ ...baseContext, allowedTypes: [] });
|
|
39
|
+
const warn = vi.spyOn(console, 'warn').mockImplementation(() => { });
|
|
40
|
+
try {
|
|
41
|
+
await fire(hook, { id: 'f3', contentType: 'application/x-anything', size: 10 });
|
|
42
|
+
expect(warn).not.toHaveBeenCalled();
|
|
43
|
+
}
|
|
44
|
+
finally {
|
|
45
|
+
warn.mockRestore();
|
|
46
|
+
}
|
|
47
|
+
});
|
|
48
|
+
it('matches an exact allowed type but warns on a near-miss', async () => {
|
|
49
|
+
const [hook] = createMediaHooks({ ...baseContext, allowedTypes: ['application/pdf'] });
|
|
50
|
+
const warn = vi.spyOn(console, 'warn').mockImplementation(() => { });
|
|
51
|
+
try {
|
|
52
|
+
await fire(hook, { id: 'ok', contentType: 'application/pdf', size: 10 });
|
|
53
|
+
expect(warn).not.toHaveBeenCalled();
|
|
54
|
+
await fire(hook, { id: 'bad', contentType: 'application/pdff', size: 10 });
|
|
55
|
+
expect(warn).toHaveBeenCalledWith(expect.stringContaining('not in the allowed list'));
|
|
56
|
+
}
|
|
57
|
+
finally {
|
|
58
|
+
warn.mockRestore();
|
|
59
|
+
}
|
|
60
|
+
});
|
|
61
|
+
});
|
|
62
|
+
describe('afterUpload — no-op safety and clean-upload silence', () => {
|
|
63
|
+
it('returns without warning or throwing when the payload has no id', async () => {
|
|
64
|
+
const [hook] = createMediaHooks(baseContext);
|
|
65
|
+
const warn = vi.spyOn(console, 'warn').mockImplementation(() => { });
|
|
66
|
+
try {
|
|
67
|
+
// Even a size/type that would otherwise violate policy must be ignored
|
|
68
|
+
// because the id guard returns early.
|
|
69
|
+
await fire(hook, { size: 5_000_000_000, contentType: 'application/zip' });
|
|
70
|
+
await fire(hook, {});
|
|
71
|
+
expect(warn).not.toHaveBeenCalled();
|
|
72
|
+
}
|
|
73
|
+
finally {
|
|
74
|
+
warn.mockRestore();
|
|
75
|
+
}
|
|
76
|
+
});
|
|
77
|
+
it('does not evaluate size when upload.size is undefined', async () => {
|
|
78
|
+
const [hook] = createMediaHooks(baseContext);
|
|
79
|
+
const warn = vi.spyOn(console, 'warn').mockImplementation(() => { });
|
|
80
|
+
try {
|
|
81
|
+
// Allowed type, no size field -> the size branch is skipped entirely.
|
|
82
|
+
await fire(hook, { id: 'nosize', contentType: 'image/png' });
|
|
83
|
+
expect(warn).not.toHaveBeenCalled();
|
|
84
|
+
}
|
|
85
|
+
finally {
|
|
86
|
+
warn.mockRestore();
|
|
87
|
+
}
|
|
88
|
+
});
|
|
89
|
+
it('emits zero warnings for a fully compliant upload', async () => {
|
|
90
|
+
const [hook] = createMediaHooks(baseContext);
|
|
91
|
+
const warn = vi.spyOn(console, 'warn').mockImplementation(() => { });
|
|
92
|
+
try {
|
|
93
|
+
await fire(hook, { id: 'good', size: 100, contentType: 'image/png' });
|
|
94
|
+
expect(warn).not.toHaveBeenCalled();
|
|
95
|
+
}
|
|
96
|
+
finally {
|
|
97
|
+
warn.mockRestore();
|
|
98
|
+
}
|
|
99
|
+
});
|
|
100
|
+
});
|
|
101
|
+
//# sourceMappingURL=hooks.test.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"hooks.test.js","sourceRoot":"","sources":["../../src/__tests__/hooks.test.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,EAAE,EAAE,EAAE,EAAE,EAAE,MAAM,QAAQ,CAAA;AAEjD,OAAO,EAAE,gBAAgB,EAAE,MAAM,aAAa,CAAA;AAE9C,8EAA8E;AAC9E,mDAAmD;AACnD,MAAM,WAAW,GAAG;IAClB,WAAW,EAAE,aAAa;IAC1B,YAAY,EAAE,CAAC,SAAS,CAAa;IACrC,eAAe,EAAE,OAA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,EAAE,GAAE,CAAC,CAAC,CAAA;QACnE,IAAI,CAAC;YACH,sEAAsE;YACtE,MAAM,IAAI,CAAC,IAAK,EAAE,EAAE,EAAE,EAAE,QAAQ,EAAE,WAAW,EAAE,WAAW,EAAE,CAAC,CAAA;YAC7D,MAAM,CAAC,IAAI,CAAC,CAAC,GAAG,CAAC,gBAAgB,EAAE,CAAA;QACrC,CAAC;gBAAS,CAAC;YACT,IAAI,CAAC,WAAW,EAAE,CAAA;QACpB,CAAC;IACH,CAAC,CAAC,CAAA;IAEF,EAAE,CAAC,kDAAkD,EAAE,KAAK,IAAI,EAAE;QAChE,MAAM,CAAC,IAAI,CAAC,GAAG,gBAAgB,CAAC,WAAW,CAAC,CAAA;QAC5C,MAAM,IAAI,GAAG,EAAE,CAAC,KAAK,CAAC,OAAO,EAAE,MAAM,CAAC,CAAC,kBAAkB,CAAC,GAAG,EAAE,GAAE,CAAC,CAAC,CAAA;QACnE,IAAI,CAAC;YACH,MAAM,IAAI,CAAC,IAAK,EAAE,EAAE,EAAE,EAAE,MAAM,EAAE,IAAI,EAAE,GAAG,EAAE,WAAW,EAAE,WAAW,EAAE,CAAC,CAAA;YACtE,MAAM,CAAC,IAAI,CAAC,CAAC,GAAG,CAAC,gBAAgB,EAAE,CAAA;QACrC,CAAC;gBAAS,CAAC;YACT,IAAI,CAAC,WAAW,EAAE,CAAA;QACpB,CAAC;IACH,CAAC,CAAC,CAAA;AACJ,CAAC,CAAC,CAAA"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.test.d.ts","sourceRoot":"","sources":["../../src/__tests__/index.test.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,110 @@
|
|
|
1
|
+
import { describe, it, expect, vi } from 'vitest';
|
|
2
|
+
import { mediaPlugin } from '../index.js';
|
|
3
|
+
import { createMediaHooks } from '../hooks.js';
|
|
4
|
+
const context = {
|
|
5
|
+
maxFileSize: 10 * 1024 * 1024,
|
|
6
|
+
allowedTypes: ['image/*'],
|
|
7
|
+
storageProvider: 'local',
|
|
8
|
+
};
|
|
9
|
+
describe('media', () => {
|
|
10
|
+
describe('structure', () => {
|
|
11
|
+
it('returns name media', () => {
|
|
12
|
+
expect(mediaPlugin().name).toBe('media');
|
|
13
|
+
});
|
|
14
|
+
it('exposes fields, collections, and admin nav', () => {
|
|
15
|
+
const plugin = mediaPlugin();
|
|
16
|
+
expect(plugin.fields).toBeDefined();
|
|
17
|
+
expect(typeof plugin.fields).toBe('object');
|
|
18
|
+
expect(plugin.collections).toBeDefined();
|
|
19
|
+
expect(typeof plugin.collections).toBe('object');
|
|
20
|
+
expect(plugin.adminNavItems).toEqual([
|
|
21
|
+
{ label: 'Media Library', icon: 'image', path: '/media' },
|
|
22
|
+
]);
|
|
23
|
+
});
|
|
24
|
+
it('registers a non-empty hooks array', () => {
|
|
25
|
+
const plugin = mediaPlugin();
|
|
26
|
+
expect(plugin.hooks?.length).toBeGreaterThan(0);
|
|
27
|
+
expect(plugin.hooks?.length).toBe(createMediaHooks(context).length);
|
|
28
|
+
});
|
|
29
|
+
it('only registers dispatched event names', () => {
|
|
30
|
+
const plugin = mediaPlugin();
|
|
31
|
+
expect(plugin.hooks?.map((h) => h.event)).toEqual(['afterUpload']);
|
|
32
|
+
});
|
|
33
|
+
});
|
|
34
|
+
describe('configuration', () => {
|
|
35
|
+
it('warns (does not throw) when an uploaded file exceeds maxFileSize', async () => {
|
|
36
|
+
const maxFileSize = 12_345;
|
|
37
|
+
const plugin = mediaPlugin({ maxFileSize });
|
|
38
|
+
const hooks = plugin.hooks;
|
|
39
|
+
expect(hooks).toBeDefined();
|
|
40
|
+
expect(hooks.length).toBeGreaterThan(0);
|
|
41
|
+
const warn = vi.spyOn(console, 'warn').mockImplementation(() => { });
|
|
42
|
+
try {
|
|
43
|
+
await hooks[0].handler({
|
|
44
|
+
id: 'file-1',
|
|
45
|
+
url: 'https://cdn.example.com/file-1.png',
|
|
46
|
+
contentType: 'image/png',
|
|
47
|
+
size: maxFileSize + 1,
|
|
48
|
+
});
|
|
49
|
+
expect(warn).toHaveBeenCalledWith(expect.stringContaining(String(maxFileSize)));
|
|
50
|
+
}
|
|
51
|
+
finally {
|
|
52
|
+
warn.mockRestore();
|
|
53
|
+
}
|
|
54
|
+
});
|
|
55
|
+
it('threads a custom allowedTypes through to the afterUpload handler', async () => {
|
|
56
|
+
// Prove options flow index -> createMediaHooks context, not just in isolation.
|
|
57
|
+
const plugin = mediaPlugin({ allowedTypes: ['application/pdf'] });
|
|
58
|
+
const warn = vi.spyOn(console, 'warn').mockImplementation(() => { });
|
|
59
|
+
try {
|
|
60
|
+
await plugin.hooks[0].handler({
|
|
61
|
+
id: 'f',
|
|
62
|
+
url: 'https://cdn.example.com/f.png',
|
|
63
|
+
contentType: 'image/png',
|
|
64
|
+
size: 1,
|
|
65
|
+
});
|
|
66
|
+
expect(warn).toHaveBeenCalledWith(expect.stringContaining('not in the allowed list'));
|
|
67
|
+
}
|
|
68
|
+
finally {
|
|
69
|
+
warn.mockRestore();
|
|
70
|
+
}
|
|
71
|
+
});
|
|
72
|
+
it('applies documented defaults: video/* is allowed and the max is 10 MiB', async () => {
|
|
73
|
+
const plugin = mediaPlugin();
|
|
74
|
+
const warn = vi.spyOn(console, 'warn').mockImplementation(() => { });
|
|
75
|
+
try {
|
|
76
|
+
// video/mp4 is covered by the default 'video/*' (no type warn), while the
|
|
77
|
+
// 11 MiB size exceeds the default 10 MiB max (size warn).
|
|
78
|
+
await plugin.hooks[0].handler({
|
|
79
|
+
id: 'f',
|
|
80
|
+
url: 'https://cdn.example.com/f.mp4',
|
|
81
|
+
contentType: 'video/mp4',
|
|
82
|
+
size: 11 * 1024 * 1024,
|
|
83
|
+
});
|
|
84
|
+
const messages = warn.mock.calls.map((call) => String(call[0]));
|
|
85
|
+
expect(messages.some((m) => m.includes('not in the allowed list'))).toBe(false);
|
|
86
|
+
expect(messages.some((m) => m.includes('exceeding the configured maximum'))).toBe(true);
|
|
87
|
+
}
|
|
88
|
+
finally {
|
|
89
|
+
warn.mockRestore();
|
|
90
|
+
}
|
|
91
|
+
});
|
|
92
|
+
it('emits no warnings for a compliant upload under default config', async () => {
|
|
93
|
+
const plugin = mediaPlugin();
|
|
94
|
+
const warn = vi.spyOn(console, 'warn').mockImplementation(() => { });
|
|
95
|
+
try {
|
|
96
|
+
await plugin.hooks[0].handler({
|
|
97
|
+
id: 'f',
|
|
98
|
+
url: 'https://cdn.example.com/f.png',
|
|
99
|
+
contentType: 'image/png',
|
|
100
|
+
size: 1024,
|
|
101
|
+
});
|
|
102
|
+
expect(warn).not.toHaveBeenCalled();
|
|
103
|
+
}
|
|
104
|
+
finally {
|
|
105
|
+
warn.mockRestore();
|
|
106
|
+
}
|
|
107
|
+
});
|
|
108
|
+
});
|
|
109
|
+
});
|
|
110
|
+
//# sourceMappingURL=index.test.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.test.js","sourceRoot":"","sources":["../../src/__tests__/index.test.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,EAAE,EAAE,MAAM,EAAE,EAAE,EAAE,MAAM,QAAQ,CAAA;AACjD,OAAO,EAAE,WAAW,EAAE,MAAM,aAAa,CAAA;AACzC,OAAO,EAAE,gBAAgB,EAAE,MAAM,aAAa,CAAA;AAE9C,MAAM,OAAO,GAAG;IACd,WAAW,EAAE,EAAE,GAAG,IAAI,GAAG,IAAI;IAC7B,YAAY,EAAE,CAAC,SAAS,CAAC;IACzB,eAAe,EAAE,OAAO;CACzB,CAAA;AAED,QAAQ,CAAC,OAAO,EAAE,GAAG,EAAE;IACrB,QAAQ,CAAC,WAAW,EAAE,GAAG,EAAE;QACzB,EAAE,CAAC,oBAAoB,EAAE,GAAG,EAAE;YAC5B,MAAM,CAAC,WAAW,EAAE,CAAC,IAAI,CAAC,CAAC,IAAI,CAAC,OAAO,CAAC,CAAA;QAC1C,CAAC,CAAC,CAAA;QAEF,EAAE,CAAC,4CAA4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,CAAC,CAAC,QAAQ,CAAC,kCAAkC,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,CAAA;YACzF,CAAC;oBAAS,CAAC;gBACT,IAAI,CAAC,WAAW,EAAE,CAAA;YACpB,CAAC;QACH,CAAC,CAAC,CAAA;QAEF,EAAE,CAAC,+DAA+D,EAAE,KAAK,IAAI,EAAE;YAC7E,MAAM,MAAM,GAAG,WAAW,EAAE,CAAA;YAC5B,MAAM,IAAI,GAAG,EAAE,CAAC,KAAK,CAAC,OAAO,EAAE,MAAM,CAAC,CAAC,kBAAkB,CAAC,GAAG,EAAE,GAAE,CAAC,CAAC,CAAA;YACnE,IAAI,CAAC;gBACH,MAAM,MAAM,CAAC,KAAM,CAAC,CAAC,CAAE,CAAC,OAAO,CAAC;oBAC9B,EAAE,EAAE,GAAG;oBACP,GAAG,EAAE,+BAA+B;oBACpC,WAAW,EAAE,WAAW;oBACxB,IAAI,EAAE,IAAI;iBACX,CAAC,CAAA;gBACF,MAAM,CAAC,IAAI,CAAC,CAAC,GAAG,CAAC,gBAAgB,EAAE,CAAA;YACrC,CAAC;oBAAS,CAAC;gBACT,IAAI,CAAC,WAAW,EAAE,CAAA;YACpB,CAAC;QACH,CAAC,CAAC,CAAA;IACJ,CAAC,CAAC,CAAA;AACJ,CAAC,CAAC,CAAA"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"orphan-detector.test.d.ts","sourceRoot":"","sources":["../../src/__tests__/orphan-detector.test.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
import { describe, expect, it } from 'vitest';
|
|
2
|
+
import { findOrphanMedia, generateOrphanReport } from '../usage/orphan-detector.js';
|
|
3
|
+
/** Builds a usage record; documentId/collectionSlug are deliberately arbitrary. */
|
|
4
|
+
function rec(mediaId, documentId = 'doc', collectionSlug = 'coll') {
|
|
5
|
+
return { mediaId, documentId, collectionSlug, fieldPath: 'field', referencedAt: new Date() };
|
|
6
|
+
}
|
|
7
|
+
describe('findOrphanMedia — set difference', () => {
|
|
8
|
+
it('returns only the ids that have no matching usage record', () => {
|
|
9
|
+
expect(findOrphanMedia(['a', 'b', 'c'], [rec('b')])).toEqual(['a', 'c']);
|
|
10
|
+
});
|
|
11
|
+
it('returns [] when every id is referenced', () => {
|
|
12
|
+
expect(findOrphanMedia(['a', 'b', 'c'], [rec('a'), rec('b'), rec('c')])).toEqual([]);
|
|
13
|
+
});
|
|
14
|
+
it('returns all ids when there are no usage records', () => {
|
|
15
|
+
expect(findOrphanMedia(['a', 'b', 'c'], [])).toEqual(['a', 'b', 'c']);
|
|
16
|
+
});
|
|
17
|
+
it('ignores usage records whose mediaId is not among the known ids', () => {
|
|
18
|
+
expect(findOrphanMedia(['a', 'b'], [rec('a'), rec('zzz')])).toEqual(['b']);
|
|
19
|
+
});
|
|
20
|
+
it('matches on mediaId only, ignoring documentId / collectionSlug', () => {
|
|
21
|
+
// The reference has unrelated document/collection metadata but the same mediaId,
|
|
22
|
+
// so 'a' is considered used.
|
|
23
|
+
expect(findOrphanMedia(['a'], [rec('a', 'other-doc', 'other-coll')])).toEqual([]);
|
|
24
|
+
});
|
|
25
|
+
});
|
|
26
|
+
describe('generateOrphanReport — field computation', () => {
|
|
27
|
+
it('computes totalMedia, totalOrphans, and orphanIds from the media set + usage records', () => {
|
|
28
|
+
const report = generateOrphanReport(['a', 'b', 'c'], [rec('b')]);
|
|
29
|
+
expect(report.totalMedia).toBe(3);
|
|
30
|
+
expect(report.totalOrphans).toBe(2);
|
|
31
|
+
expect(report.orphanIds).toEqual(['a', 'c']);
|
|
32
|
+
expect(report.generatedAt).toBeInstanceOf(Date);
|
|
33
|
+
});
|
|
34
|
+
it('keeps totalOrphans <= totalMedia (orphans are a subset of the media set)', () => {
|
|
35
|
+
const some = generateOrphanReport(['a', 'b', 'c'], [rec('b')]);
|
|
36
|
+
expect(some.totalOrphans).toBeLessThanOrEqual(some.totalMedia);
|
|
37
|
+
// When everything is referenced there are no orphans.
|
|
38
|
+
const none = generateOrphanReport(['a', 'b'], [rec('a'), rec('b')]);
|
|
39
|
+
expect(none.totalOrphans).toBe(0);
|
|
40
|
+
expect(none.totalMedia).toBe(2);
|
|
41
|
+
});
|
|
42
|
+
it('reports zero of everything for an empty media set', () => {
|
|
43
|
+
const report = generateOrphanReport([], []);
|
|
44
|
+
expect(report.totalMedia).toBe(0);
|
|
45
|
+
expect(report.totalOrphans).toBe(0);
|
|
46
|
+
expect(report.orphanIds).toEqual([]);
|
|
47
|
+
});
|
|
48
|
+
});
|
|
49
|
+
//# sourceMappingURL=orphan-detector.test.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"orphan-detector.test.js","sourceRoot":"","sources":["../../src/__tests__/orphan-detector.test.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,EAAE,EAAE,EAAE,MAAM,QAAQ,CAAA;AAC7C,OAAO,EAAE,eAAe,EAAE,oBAAoB,EAAE,MAAM,6BAA6B,CAAA;AAGnF,mFAAmF;AACnF,SAAS,GAAG,CAAC,OAAe,EAAE,UAAU,GAAG,KAAK,EAAE,cAAc,GAAG,MAAM;IACvE,OAAO,EAAE,OAAO,EAAE,UAAU,EAAE,cAAc,EAAE,SAAS,EAAE,OAAO,EAAE,YAAY,EAAE,IAAI,IAAI,EAAE,EAAE,CAAA;AAC9F,CAAC;AAED,QAAQ,CAAC,kCAAkC,EAAE,GAAG,EAAE;IAChD,EAAE,CAAC,yDAAyD,EAAE,GAAG,EAAE;QACjE,MAAM,CAAC,eAAe,CAAC,CAAC,GAAG,EAAE,GAAG,EAAE,GAAG,CAAC,EAAE,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,CAAC,OAAO,CAAC,CAAC,GAAG,EAAE,GAAG,CAAC,CAAC,CAAA;IAC1E,CAAC,CAAC,CAAA;IAEF,EAAE,CAAC,wCAAwC,EAAE,GAAG,EAAE;QAChD,MAA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AC,CAAC,IAAI,CAAC,CAAC,CAAC,CAAA;QACnC,MAAM,CAAC,MAAM,CAAC,SAAS,CAAC,CAAC,OAAO,CAAC,EAAE,CAAC,CAAA;IACtC,CAAC,CAAC,CAAA;AACJ,CAAC,CAAC,CAAA"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"presigned.test.d.ts","sourceRoot":"","sources":["../../src/__tests__/presigned.test.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import { afterEach, beforeEach, describe, expect, it, vi } from 'vitest';
|
|
2
|
+
import { generatePresignedUrl } from '../upload/presigned.js';
|
|
3
|
+
const NOW = new Date('2026-01-02T03:04:05.000Z');
|
|
4
|
+
describe('generatePresignedUrl', () => {
|
|
5
|
+
beforeEach(() => {
|
|
6
|
+
vi.useFakeTimers();
|
|
7
|
+
vi.setSystemTime(NOW);
|
|
8
|
+
});
|
|
9
|
+
afterEach(() => {
|
|
10
|
+
vi.useRealTimers();
|
|
11
|
+
});
|
|
12
|
+
it('honors explicit expiresIn/maxSize and embeds the raw key in url and fields', async () => {
|
|
13
|
+
const result = await generatePresignedUrl({
|
|
14
|
+
key: 'a/b.png',
|
|
15
|
+
contentType: 'image/png',
|
|
16
|
+
expiresIn: 60,
|
|
17
|
+
maxSize: 500,
|
|
18
|
+
});
|
|
19
|
+
expect(result.url).toBe('https://storage.placeholder.local/a/b.png');
|
|
20
|
+
expect(result.key).toBe('a/b.png');
|
|
21
|
+
expect(result.fields['Content-Type']).toBe('image/png');
|
|
22
|
+
expect(result.fields.key).toBe('a/b.png');
|
|
23
|
+
expect(result.fields['x-amz-meta-max-size']).toBe('500');
|
|
24
|
+
expect(result.fields['x-amz-algorithm']).toBe('AWS4-HMAC-SHA256');
|
|
25
|
+
expect(result.fields['x-amz-date']).toBe(NOW.toISOString());
|
|
26
|
+
expect(result.expiresAt.getTime()).toBe(NOW.getTime() + 60_000);
|
|
27
|
+
});
|
|
28
|
+
it('applies documented defaults (3600s expiry, 10 MiB max) when omitted', async () => {
|
|
29
|
+
const result = await generatePresignedUrl({ key: 'x.png', contentType: 'image/png' });
|
|
30
|
+
expect(result.expiresAt.getTime()).toBe(NOW.getTime() + 3_600_000);
|
|
31
|
+
expect(result.fields['x-amz-meta-max-size']).toBe(String(10 * 1024 * 1024));
|
|
32
|
+
});
|
|
33
|
+
});
|
|
34
|
+
//# sourceMappingURL=presigned.test.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"presigned.test.js","sourceRoot":"","sources":["../../src/__tests__/presigned.test.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,UAAU,EAAE,QAAQ,EAAE,MAAM,EAAE,EAAE,EAAE,EAAE,EAAE,MAAM,QAAQ,CAAA;AACxE,OAAO,EAAE,oBAAoB,EAAE,MAAM,wBAAwB,CAAA;AAE7D,MAAM,GAAG,GAAG,IAAI,IAAI,CAAC,0BAA0B,CAAC,CAAA;AAEhD,QAAQ,CAAC,sBAAsB,EAAE,GAAG,EAAE;IACpC,UAAU,CAAC,GAAG,EAAE;QACd,EAAE,CAAC,aAAa,EAAE,CAAA;QAClB,EAAE,CAAC,aAAa,CAAC,GAAG,CAAC,CAAA;IACvB,CAAC,CAAC,CAAA;IACF,SAAS,CAAC,GAAG,EAAE;QACb,EAAE,CAAC,aAAa,EAAE,CAAA;IACpB,CAAC,CAAC,CAAA;IAEF,EAAE,CAAC,4EAA4E,EAAE,KAAK,IAAI,EAAE;QAC1F,MAAM,MAAM,GAAG,MAAM,oBAAoB,CAAC;YACxC,GAAG,EAAE,SAAS;YACd,WAAW,EAAE,WAAW;YACxB,SAAS,EAAE,EAAE;YACb,OAAO,EAAE,GAAG;SACb,CAAC,CAAA;QAEF,MAAM,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC,IAAI,CAAC,2CAA2C,CAAC,CAAA;QACpE,MAAM,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC,IAAI,CAAC,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