ampless 1.0.0-alpha.13 → 1.0.0-alpha.15
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 +28 -6
- package/package.json +1 -1
package/dist/index.d.ts
CHANGED
|
@@ -1,7 +1,20 @@
|
|
|
1
1
|
type ContentEventType = 'content.created' | 'content.updated' | 'content.published' | 'content.unpublished' | 'content.deleted';
|
|
2
2
|
type MediaEventType = 'media.uploaded' | 'media.deleted';
|
|
3
3
|
type SiteSettingsEventType = 'site.settings.updated';
|
|
4
|
-
|
|
4
|
+
/**
|
|
5
|
+
* Emitted on every Post mutation (INSERT / MODIFY / REMOVE) with both
|
|
6
|
+
* the previous and the next projection of the row. Drives index-style
|
|
7
|
+
* derivation: the built-in trusted-processor handler uses it to keep
|
|
8
|
+
* the `PostTag` denormalized index in sync without making every write
|
|
9
|
+
* path (admin, MCP, future REST clients) remember to call a helper.
|
|
10
|
+
*
|
|
11
|
+
* Plugins that maintain their own indexes (custom search, sitemaps
|
|
12
|
+
* with per-tag pages, etc.) can subscribe through the same hook
|
|
13
|
+
* surface as the other event types — the diff payload is already in
|
|
14
|
+
* the right shape for "compute add/remove/update".
|
|
15
|
+
*/
|
|
16
|
+
type PostIndexEventType = 'post.index.refresh';
|
|
17
|
+
type EventType = ContentEventType | MediaEventType | SiteSettingsEventType | PostIndexEventType;
|
|
5
18
|
/** Minimal projection of a Post item carried in events (no body, to keep payloads small). */
|
|
6
19
|
interface ContentEventPayload {
|
|
7
20
|
postId: string;
|
|
@@ -23,7 +36,17 @@ interface MediaEventPayload {
|
|
|
23
36
|
*/
|
|
24
37
|
interface SiteSettingsEventPayload {
|
|
25
38
|
}
|
|
26
|
-
|
|
39
|
+
/**
|
|
40
|
+
* Diff payload for `post.index.refresh`. `previous` is null on INSERT;
|
|
41
|
+
* `next` is null on REMOVE; both populated on MODIFY. Subscribers
|
|
42
|
+
* compute the add / remove / update set from this — see the trusted
|
|
43
|
+
* processor's `rebuildPostTags` handler for the canonical example.
|
|
44
|
+
*/
|
|
45
|
+
interface PostIndexEventPayload {
|
|
46
|
+
previous: ContentEventPayload | null;
|
|
47
|
+
next: ContentEventPayload | null;
|
|
48
|
+
}
|
|
49
|
+
type EventPayloadOf<T extends EventType> = T extends ContentEventType ? ContentEventPayload : T extends MediaEventType ? MediaEventPayload : T extends SiteSettingsEventType ? SiteSettingsEventPayload : T extends PostIndexEventType ? PostIndexEventPayload : never;
|
|
27
50
|
interface AmplessEvent<T extends EventType = EventType> {
|
|
28
51
|
type: T;
|
|
29
52
|
payload: EventPayloadOf<T>;
|
|
@@ -213,9 +236,8 @@ type CacheStrategy = 'auto' | 'deep' | 'hot';
|
|
|
213
236
|
* Well-known keys:
|
|
214
237
|
* - `no_layout`: when true, the public page is served as bare HTML
|
|
215
238
|
* (no theme chrome). Middleware rewrites the request to the
|
|
216
|
-
*
|
|
217
|
-
*
|
|
218
|
-
* theme chrome.
|
|
239
|
+
* internal `/raw/<slug>` handler for such posts and renders the
|
|
240
|
+
* body verbatim — no Next.js root layout, no theme chrome.
|
|
219
241
|
* - `cache`: see `CacheStrategy`. Overrides the default 'auto'
|
|
220
242
|
* cache strategy for this post. Independent of `no_layout` —
|
|
221
243
|
* applies uniformly to themed, no_layout, and static posts.
|
|
@@ -815,4 +837,4 @@ declare function resolveThemeValues(manifest: ThemeManifest, stored: Record<stri
|
|
|
815
837
|
|
|
816
838
|
declare const VERSION = "0.0.1";
|
|
817
839
|
|
|
818
|
-
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 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 };
|
|
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 };
|