ampless 1.0.0-alpha.15 → 1.0.0-alpha.16

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/dist/index.d.ts CHANGED
@@ -246,9 +246,33 @@ type CacheStrategy = 'auto' | 'deep' | 'hot';
246
246
  * are free to store their own per-post state here (e.g. SEO overrides,
247
247
  * feature flags, A/B variants).
248
248
  */
249
+ /**
250
+ * Per-file metadata recorded on a static post. The static route
251
+ * reads this to decide whether to stream the bytes back through
252
+ * Lambda (small files → cached by CloudFront) or to 302-redirect
253
+ * to a presigned URL (large files → bypass the Lambda response
254
+ * size envelope). Populated by `upload_static_bundle` /
255
+ * `commit_static_post` at upload time so the read path never
256
+ * issues a HEAD round-trip.
257
+ *
258
+ * `body.files` (the manifest's flat list) stays the source of truth
259
+ * for "what's in the bundle"; this map is purely a delivery hint and
260
+ * may be sparse when older bundles predate the migration.
261
+ */
262
+ interface StaticPostFileMeta {
263
+ size: number;
264
+ mimeType: string;
265
+ }
249
266
  interface PostMetadata {
250
267
  no_layout?: boolean;
251
268
  cache?: CacheStrategy;
269
+ /**
270
+ * For `format: 'static'` posts only. Keyed by the bundle-relative
271
+ * path (same shape as `body.files` entries). Older bundles may
272
+ * lack this map — readers MUST treat a missing entry as
273
+ * "fall back to a HEAD lookup".
274
+ */
275
+ files?: Record<string, StaticPostFileMeta>;
252
276
  [key: string]: unknown;
253
277
  }
254
278
  interface Post {
@@ -281,12 +305,25 @@ interface Page {
281
305
  status: PostStatus;
282
306
  publishedAt?: string;
283
307
  }
308
+ /**
309
+ * Asset metadata recorded on the Media row. Currently the only
310
+ * well-known key is `etag` (the S3 object ETag, captured at upload
311
+ * time so the media-proxy route can emit it back to the client
312
+ * without a HEAD round-trip). Free-form by design — themes and
313
+ * plugins can add their own keys (image dimensions, EXIF strip
314
+ * status, etc.) without a schema change.
315
+ */
316
+ interface MediaMetadata {
317
+ etag?: string;
318
+ [key: string]: unknown;
319
+ }
284
320
  interface Media {
285
321
  mediaId: string;
286
322
  src: string;
287
323
  mimeType: string;
288
324
  size: number;
289
325
  delivery: 'nextjs' | 's3-direct';
326
+ metadata?: MediaMetadata;
290
327
  }
291
328
  type ImageDisplay = 'inline' | 'lightbox';
292
329
  /**
@@ -500,9 +537,8 @@ declare function escapeXml(s: string): string;
500
537
  * from DynamoDB (the path used by the trusted processor and the
501
538
  * MCP Lambda).
502
539
  *
503
- * `decodeAwsJson` tolerates both: pass strings through `JSON.parse`,
504
- * everything else as-is, fall back to the raw string on parse errors
505
- * so bare-string rows aren't lost.
540
+ * `decodeAwsJson` handles both: pass strings through `JSON.parse`,
541
+ * everything else as-is.
506
542
  */
507
543
  /**
508
544
  * Serialise a value for an AWSJSON variable. `undefined` / `null` both
@@ -513,7 +549,7 @@ declare function encodeAwsJson(value: unknown): string;
513
549
  /**
514
550
  * Deserialise an AWSJSON value from a GraphQL / DynamoDB read.
515
551
  * Tolerates both the wire-string shape and the auto-unmarshalled
516
- * native value. Returns the raw string when `JSON.parse` rejects it.
552
+ * native value. Throws if the string is not valid JSON.
517
553
  */
518
554
  declare function decodeAwsJson(value: unknown): unknown;
519
555
 
@@ -837,4 +873,4 @@ declare function resolveThemeValues(manifest: ThemeManifest, stored: Record<stri
837
873
 
838
874
  declare const VERSION = "0.0.1";
839
875
 
840
- export { type AmplessEvent, type AmplessPlugin, type AuthContext, type BundleExtractResult, type CacheConfig, type CacheStrategy, type Config, type ContentEventPayload, type ContentEventType, type ContentFormat, type ContentTypeDefinition, type CreatePostInput, DEFAULT_ENTRYPOINT, type DateFormat, type EventPayloadOf, type EventType, type ExtractedFile, type FieldDefinition, type FieldType, type ImageDisplay, type KvItem, type KvStore, type LinkListItem, type ListOptions, type LocalizedString, MAX_BUNDLE_BYTES, type Media, type MediaEventPayload, type MediaEventType, type MediaProcessingDefaults, type OgImageConfig, type OgImageFont, type OgImageRenderContext, type Page, type PluginEventHandler, type PluginMetadata, type PluginRuntimeContext, type Post, type PostIndexEventPayload, type PostIndexEventType, type PostMetadata, type PostStatus, type PostsProvider, type Role, SITE_CONFIG_PK, type SiteSettingsEventPayload, type SiteSettingsEventType, type StaticPostBody, type StreamEventName, TEXT_EXTENSIONS, type ThemeColorField, type ThemeField, type ThemeFieldType, type ThemeFontFamilyField, type ThemeImageField, type ThemeLengthField, type ThemeLinkListField, type ThemeManifest, type ThemeModule, type ThemeRouteContext, type ThemeSelectField, type ThemeTextField, type TrustLevel, VERSION, type ValidationIssue, bundlePrefix, createPost, decodeAwsJson, defineConfig, definePlugin, defineSchema, defineTheme, defineThemeModule, deletePost, deleteSiteSetting, detectContentEvents, encodeAwsJson, escapeXml, extractFirstImageUrl, findAbsolutePathRefs, flattenSettings, formatColorPair, formatDate, formatPublicAssetUrl, getKvStore, getPost, getPostById, getSiteSetting, hasKvStore, hasPostsProvider, isTagListUrl, listPosts, listSiteSettings, mimeTypeFor, parseColorPair, parseLinkList, pickDefaultEntrypoint, resolveLocalized, resolveThemeValues, setKvStore, setPostsProvider, setSiteSetting, stringifyLinkList, stripCommonPrefix, themeSettingKey, unflattenSettings, updatePost, validateBundle, validateBundlePath, validateThemeValue };
876
+ export { type AmplessEvent, type AmplessPlugin, type AuthContext, type BundleExtractResult, type CacheConfig, type CacheStrategy, type Config, type ContentEventPayload, type ContentEventType, type ContentFormat, type ContentTypeDefinition, type CreatePostInput, DEFAULT_ENTRYPOINT, type DateFormat, type EventPayloadOf, type EventType, type ExtractedFile, type FieldDefinition, type FieldType, type ImageDisplay, type KvItem, type KvStore, type LinkListItem, type ListOptions, type LocalizedString, MAX_BUNDLE_BYTES, type Media, type MediaEventPayload, type MediaEventType, type MediaMetadata, type MediaProcessingDefaults, type OgImageConfig, type OgImageFont, type OgImageRenderContext, type Page, type PluginEventHandler, type PluginMetadata, type PluginRuntimeContext, type Post, type PostIndexEventPayload, type PostIndexEventType, type PostMetadata, type PostStatus, type PostsProvider, type Role, SITE_CONFIG_PK, type SiteSettingsEventPayload, type SiteSettingsEventType, type StaticPostBody, type StaticPostFileMeta, type StreamEventName, TEXT_EXTENSIONS, type ThemeColorField, type ThemeField, type ThemeFieldType, type ThemeFontFamilyField, type ThemeImageField, type ThemeLengthField, type ThemeLinkListField, type ThemeManifest, type ThemeModule, type ThemeRouteContext, type ThemeSelectField, type ThemeTextField, type TrustLevel, VERSION, type ValidationIssue, bundlePrefix, createPost, decodeAwsJson, defineConfig, definePlugin, defineSchema, defineTheme, defineThemeModule, deletePost, deleteSiteSetting, detectContentEvents, encodeAwsJson, escapeXml, extractFirstImageUrl, findAbsolutePathRefs, flattenSettings, formatColorPair, formatDate, formatPublicAssetUrl, getKvStore, getPost, getPostById, getSiteSetting, hasKvStore, hasPostsProvider, isTagListUrl, listPosts, listSiteSettings, mimeTypeFor, parseColorPair, parseLinkList, pickDefaultEntrypoint, resolveLocalized, resolveThemeValues, setKvStore, setPostsProvider, setSiteSetting, stringifyLinkList, stripCommonPrefix, themeSettingKey, unflattenSettings, updatePost, validateBundle, validateBundlePath, validateThemeValue };
package/dist/index.js CHANGED
@@ -202,11 +202,7 @@ function encodeAwsJson(value) {
202
202
  }
203
203
  function decodeAwsJson(value) {
204
204
  if (typeof value !== "string") return value;
205
- try {
206
- return JSON.parse(value);
207
- } catch {
208
- return value;
209
- }
205
+ return JSON.parse(value);
210
206
  }
211
207
 
212
208
  // src/storage.ts
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "ampless",
3
- "version": "1.0.0-alpha.15",
3
+ "version": "1.0.0-alpha.16",
4
4
  "description": "Serverless CMS for AWS Amplify",
5
5
  "license": "MIT",
6
6
  "type": "module",