ampless 0.2.0-alpha.4 → 0.2.0-alpha.6
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/README.ja.md +49 -0
- package/README.md +3 -0
- package/dist/index.d.ts +8 -1
- package/dist/index.js +4 -0
- package/package.json +1 -1
package/README.ja.md
ADDED
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
> English: [README.md](./README.md)
|
|
2
|
+
>
|
|
3
|
+
|
|
4
|
+
# ampless
|
|
5
|
+
|
|
6
|
+
AWS Amplify 向け CMS コアライブラリ。
|
|
7
|
+
|
|
8
|
+
> **プレリリース / アルファ版。** v1.0 まではマイナーバージョンでも破壊的変更が入る可能性があります。全文ドキュメントは [ルート README](https://github.com/heavymoons/ampless#readme) を参照してください。
|
|
9
|
+
|
|
10
|
+
## 概要
|
|
11
|
+
|
|
12
|
+
`ampless` は [ampless](https://github.com/heavymoons/ampless) CMS を支えるコアライブラリです。以下を公開しています:
|
|
13
|
+
|
|
14
|
+
- `defineConfig()` — ユーザー向け `cms.config.ts` スキーマ
|
|
15
|
+
- `defineSchema()` — コンテンツタイプ定義(カスタムコンテンツタイプシステムは v0.2 で完成予定)
|
|
16
|
+
- `Post` / `Page` / `Media` / `AuthContext` 共有型
|
|
17
|
+
- プラグインコントラクト(`definePlugin`、`AmplessPlugin`、フック、`PluginRuntimeContext`、イベント型、`escapeXml` / `formatPublicAssetUrl`)
|
|
18
|
+
- DI スタイルの `setPostsProvider()` — テンプレートの Amplify データラッパーが注入します。未設定の場合は API がダミーの投稿を返すため、AWS を接続する前にプロトタイプを作成できます。
|
|
19
|
+
|
|
20
|
+
通常は `ampless` に直接依存する必要はありません — `create-ampless` のブログテンプレートや `@ampless/plugin-*` が依存パッケージとして取り込みます。独自のプラグインやテーマを作成する場合にのみ直接インストールしてください。
|
|
21
|
+
|
|
22
|
+
## インストール
|
|
23
|
+
|
|
24
|
+
```bash
|
|
25
|
+
npm install ampless@alpha
|
|
26
|
+
```
|
|
27
|
+
|
|
28
|
+
## 使い方
|
|
29
|
+
|
|
30
|
+
```ts
|
|
31
|
+
import { defineConfig } from 'ampless'
|
|
32
|
+
|
|
33
|
+
export default defineConfig({
|
|
34
|
+
site: {
|
|
35
|
+
name: 'My Blog',
|
|
36
|
+
url: 'https://example.com',
|
|
37
|
+
},
|
|
38
|
+
plugins: [],
|
|
39
|
+
})
|
|
40
|
+
```
|
|
41
|
+
|
|
42
|
+
## 動作要件
|
|
43
|
+
|
|
44
|
+
- Node.js >= 20
|
|
45
|
+
- AWS Amplify Gen 2
|
|
46
|
+
|
|
47
|
+
## ライセンス
|
|
48
|
+
|
|
49
|
+
[MIT](../../LICENSE)
|
package/README.md
CHANGED
package/dist/index.d.ts
CHANGED
|
@@ -452,6 +452,13 @@ interface KvStore {
|
|
|
452
452
|
}
|
|
453
453
|
declare function setKvStore(s: KvStore): void;
|
|
454
454
|
declare function hasKvStore(): boolean;
|
|
455
|
+
/**
|
|
456
|
+
* Access the injected `KvStore` directly. Use the site-setting helpers
|
|
457
|
+
* (`getSiteSetting` etc.) when storing per-site configuration; reach
|
|
458
|
+
* for this lower-level handle only when you need a different PK
|
|
459
|
+
* namespace (e.g. `mcp-tokens`).
|
|
460
|
+
*/
|
|
461
|
+
declare function getKvStore(): KvStore;
|
|
455
462
|
declare const SITE_CONFIG_PK: (siteId: string) => string;
|
|
456
463
|
declare function getSiteSetting<T = unknown>(siteId: string, key: string): Promise<T | null>;
|
|
457
464
|
declare function setSiteSetting(siteId: string, key: string, value: unknown): Promise<void>;
|
|
@@ -712,4 +719,4 @@ declare function resolveThemeValues(manifest: ThemeManifest, stored: Record<stri
|
|
|
712
719
|
|
|
713
720
|
declare const VERSION = "0.0.1";
|
|
714
721
|
|
|
715
|
-
export { type AmplessEvent, type AmplessPlugin, type AuthContext, type Config, type ContentEventPayload, type ContentEventType, type ContentFormat, type ContentTypeDefinition, type CreatePostInput, DEFAULT_SITE_ID, type DateFormat, type EventPayloadOf, type EventType, type FieldDefinition, type FieldType, type ImageDisplay, type KvItem, type KvStore, type LinkListItem, type ListOptions, type LocalizedString, 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 SiteConfig, type SiteSettingsEventPayload, type SiteSettingsEventType, type StaticPostBody, type StreamEventName, 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, composeSiteIdSlug, composeSiteIdStatus, createPost, defineConfig, definePlugin, defineSchema, defineTheme, defineThemeModule, deletePost, deleteSiteSetting, detectContentEvents, escapeXml, extractFirstImageUrl, flattenSettings, formatColorPair, formatDate, formatPublicAssetUrl, getPost, getPostById, getSiteSetting, hasKvStore, hasPostsProvider, isMultiSite, isTagListUrl, listPosts, listSiteSettings, parseColorPair, parseLinkList, resolveLocalized, resolveSiteId, resolveThemeValues, setKvStore, setPostsProvider, setSiteSetting, siteFor, stringifyLinkList, themeSettingKey, unflattenSettings, updatePost, validateThemeValue };
|
|
722
|
+
export { type AmplessEvent, type AmplessPlugin, type AuthContext, type Config, type ContentEventPayload, type ContentEventType, type ContentFormat, type ContentTypeDefinition, type CreatePostInput, DEFAULT_SITE_ID, type DateFormat, type EventPayloadOf, type EventType, type FieldDefinition, type FieldType, type ImageDisplay, type KvItem, type KvStore, type LinkListItem, type ListOptions, type LocalizedString, 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 SiteConfig, type SiteSettingsEventPayload, type SiteSettingsEventType, type StaticPostBody, type StreamEventName, 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, composeSiteIdSlug, composeSiteIdStatus, createPost, defineConfig, definePlugin, defineSchema, defineTheme, defineThemeModule, deletePost, deleteSiteSetting, detectContentEvents, escapeXml, extractFirstImageUrl, flattenSettings, formatColorPair, formatDate, formatPublicAssetUrl, getKvStore, getPost, getPostById, getSiteSetting, hasKvStore, hasPostsProvider, isMultiSite, isTagListUrl, listPosts, listSiteSettings, parseColorPair, parseLinkList, resolveLocalized, resolveSiteId, resolveThemeValues, setKvStore, setPostsProvider, setSiteSetting, siteFor, stringifyLinkList, themeSettingKey, unflattenSettings, updatePost, validateThemeValue };
|
package/dist/index.js
CHANGED
|
@@ -136,6 +136,9 @@ function requireStore() {
|
|
|
136
136
|
}
|
|
137
137
|
return store;
|
|
138
138
|
}
|
|
139
|
+
function getKvStore() {
|
|
140
|
+
return requireStore();
|
|
141
|
+
}
|
|
139
142
|
var SITE_CONFIG_PK = (siteId) => `siteconfig:${siteId}`;
|
|
140
143
|
async function getSiteSetting(siteId, key) {
|
|
141
144
|
return requireStore().get(SITE_CONFIG_PK(siteId), key);
|
|
@@ -475,6 +478,7 @@ export {
|
|
|
475
478
|
formatColorPair,
|
|
476
479
|
formatDate,
|
|
477
480
|
formatPublicAssetUrl,
|
|
481
|
+
getKvStore,
|
|
478
482
|
getPost,
|
|
479
483
|
getPostById,
|
|
480
484
|
getSiteSetting,
|