ampless 1.0.0-alpha.50 → 1.0.0-beta.51
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 +2 -2
- package/README.md +2 -2
- package/dist/index.d.ts +5 -6
- package/docs/plugin-author-guide.ja.md +14 -14
- package/docs/plugin-author-guide.md +18 -19
- package/package.json +1 -1
package/README.ja.md
CHANGED
|
@@ -5,7 +5,7 @@
|
|
|
5
5
|
|
|
6
6
|
AWS Amplify 向け CMS コアライブラリ。
|
|
7
7
|
|
|
8
|
-
> **プレリリース /
|
|
8
|
+
> **プレリリース / ベータ版。** v1.0 まではマイナーバージョンでも破壊的変更が入る可能性があります。全文ドキュメントは [ルート README](https://github.com/heavymoons/ampless#readme) を参照してください。
|
|
9
9
|
|
|
10
10
|
## 概要
|
|
11
11
|
|
|
@@ -22,7 +22,7 @@ AWS Amplify 向け CMS コアライブラリ。
|
|
|
22
22
|
## インストール
|
|
23
23
|
|
|
24
24
|
```bash
|
|
25
|
-
npm install ampless@
|
|
25
|
+
npm install ampless@beta
|
|
26
26
|
```
|
|
27
27
|
|
|
28
28
|
## 使い方
|
package/README.md
CHANGED
|
@@ -5,7 +5,7 @@
|
|
|
5
5
|
|
|
6
6
|
CMS core library for AWS Amplify.
|
|
7
7
|
|
|
8
|
-
> **Pre-release /
|
|
8
|
+
> **Pre-release / beta.** Breaking changes possible in any minor version until v1.0. See the [root README](https://github.com/heavymoons/ampless#readme) for full docs.
|
|
9
9
|
|
|
10
10
|
## Overview
|
|
11
11
|
|
|
@@ -22,7 +22,7 @@ You usually don't depend on `ampless` directly — it's pulled in transitively b
|
|
|
22
22
|
## Installation
|
|
23
23
|
|
|
24
24
|
```bash
|
|
25
|
-
npm install ampless@
|
|
25
|
+
npm install ampless@beta
|
|
26
26
|
```
|
|
27
27
|
|
|
28
28
|
## Usage
|
package/dist/index.d.ts
CHANGED
|
@@ -298,11 +298,10 @@ type TrustLevel = 'untrusted' | 'trusted' | 'privileged';
|
|
|
298
298
|
* `PluginSecret` DynamoDB model. Requires `trust_level: 'trusted'`.
|
|
299
299
|
* Trusted hooks access secrets via `ctx.secret<T>(key)`.
|
|
300
300
|
*
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
* surface for it until the matching phase ships.
|
|
301
|
+
* Reserved capabilities are accepted by the type so that plugins can
|
|
302
|
+
* declare future intent, but the runtime does nothing with them yet.
|
|
303
|
+
* Declaring a reserved capability today is harmless, but the runtime
|
|
304
|
+
* won't expose any new surface for it until the matching phase ships.
|
|
306
305
|
*/
|
|
307
306
|
type PluginCapability = 'publicHead' | 'publicBody' | 'metadata' | 'eventHooks' | 'adminSettings' | 'writePublicAsset' | 'schema' | 'publicHtmlForPost' | 'secretSettings' | 'contentFields' | 'publicPostScript' | 'adminPage' | 'serverRoute' | 'network' | 'scheduler' | 'storageWrite' | 'privilegedSystem' | 'cspReady';
|
|
308
307
|
/**
|
|
@@ -1163,7 +1162,7 @@ interface AmplessPlugin {
|
|
|
1163
1162
|
*
|
|
1164
1163
|
* For external `npm publish` plugins, `packageName` MUST match the
|
|
1165
1164
|
* package's actual `name` and the package's `exports` MUST expose
|
|
1166
|
-
* `./package.json`. The scaffold tool (`npx create-ampless plugin`)
|
|
1165
|
+
* `./package.json`. The scaffold tool (`npx create-ampless@beta plugin`)
|
|
1167
1166
|
* handles both automatically.
|
|
1168
1167
|
*/
|
|
1169
1168
|
packageName?: string;
|
|
@@ -59,7 +59,7 @@ ampless プラグインは 3 つのいずれかの場所に書きます — コ
|
|
|
59
59
|
|
|
60
60
|
3 つの形式はすべて同じ `definePlugin({...})` ファクトリを呼び出し、同じサーフェスを使います。違いはパッケージング・配布方法、および静的 `package.json#amplessPlugin` マニフェストが有効にするインストール時バリデーションのオプトインです(§3 参照)。
|
|
61
61
|
|
|
62
|
-
§14 には一行のスキャフォールドコマンド (`npx create-ampless plugin <name>`) があり、後者 2 つのどちらにも即使えるボイラープレートを生成します。
|
|
62
|
+
§14 には一行のスキャフォールドコマンド (`npx create-ampless@beta plugin <name>`) があり、後者 2 つのどちらにも即使えるボイラープレートを生成します。
|
|
63
63
|
|
|
64
64
|
ampless プラグインは `AmplessPlugin` オブジェクトを返す TypeScript モジュールです。以下のうち 1 つ以上のサーフェスにフックします:
|
|
65
65
|
|
|
@@ -101,10 +101,10 @@ ampless プラグインは `AmplessPlugin` オブジェクトを返す TypeScrip
|
|
|
101
101
|
|
|
102
102
|
```bash
|
|
103
103
|
# サイトローカル (現在の ampless サイトに plugins/<name>/index.ts を生成)
|
|
104
|
-
npx create-ampless@
|
|
104
|
+
npx create-ampless@beta plugin my-thing
|
|
105
105
|
|
|
106
106
|
# スタンドアロン npm パッケージ (`npm publish` 向けの ./<name>/ を生成)
|
|
107
|
-
npx create-ampless@
|
|
107
|
+
npx create-ampless@beta plugin @myscope/ampless-plugin-my-thing --standalone
|
|
108
108
|
```
|
|
109
109
|
|
|
110
110
|
全体の手順は §14 を参照してください。このセクションの残りでは生成されるファイルの意味を説明します — 手書きしたい場合はここを読めば把握できます。
|
|
@@ -813,7 +813,7 @@ export const editorExtension = AmplessYoutubeNode // tiptap Node または Ext
|
|
|
813
813
|
|
|
814
814
|
### プラグインユーザー(サイトエンジニア)向け
|
|
815
815
|
|
|
816
|
-
1. `npm i @ampless/plugin-youtube@
|
|
816
|
+
1. `npm i @ampless/plugin-youtube@beta` — plugin を dependency として追加する。
|
|
817
817
|
2. `cms.config.ts` に登録してサーバーサイド renderer を有効化する。
|
|
818
818
|
3. `npm run update-ampless` — インストール済み plugin の manifest から `_editor-bootstrap.tsx` を自動再生成する。
|
|
819
819
|
|
|
@@ -1251,7 +1251,7 @@ Secret settings を使うと、trusted プラグインが認証情報 (Webhook
|
|
|
1251
1251
|
| 脅威 | 状態 |
|
|
1252
1252
|
|---|---|
|
|
1253
1253
|
| PluginSecret テーブルを閲覧する AWS Console オペレータ | ✓ 対策済み — ciphertext のみ、DDB に鍵なし |
|
|
1254
|
-
| ソースリポジトリ / デプロイアーティファクトへのアクセス | ⚠ 対策なし — 鍵は `amplify/secrets/encryption-key.ts`
|
|
1254
|
+
| ソースリポジトリ / デプロイアーティファクトへのアクセス | ⚠ 対策なし — 鍵は `amplify/secrets/encryption-key.ts` に存在。public repo では `npx create-ampless@beta setup-encryption-key --gitignore` などで鍵を version control から外し、デプロイアーティファクトアクセスを制限すること |
|
|
1255
1255
|
| 同一 Lambda 内の悪意ある trusted plugin | ✗ 対策なし — `process.env.PLUGIN_SECRET_ENCRYPTION_KEY` はプラグインコードから読める。真の分離 = per-plugin Lambda(privileged tier, ロードマップ) |
|
|
1256
1256
|
| S3 mirror 漏洩 | ✓ 対策済み — PluginSecret テーブルは mirror されない |
|
|
1257
1257
|
|
|
@@ -1274,7 +1274,7 @@ Secret settings を使うと、trusted プラグインが認証情報 (Webhook
|
|
|
1274
1274
|
2. `capabilities` に `'secretSettings'` を含める(`capabilities` が定義されているとき省略すると console.warn)。
|
|
1275
1275
|
3. **鍵の初回セットアップ** — プロジェクトルートで実行:
|
|
1276
1276
|
```sh
|
|
1277
|
-
npx create-ampless setup-encryption-key
|
|
1277
|
+
npx create-ampless@beta setup-encryption-key
|
|
1278
1278
|
```
|
|
1279
1279
|
32 バイトのランダムな鍵を生成し、`amplify/secrets/encryption-key.ts` に書き込む。AWS 認証情報不要 — ローカルファイル操作のみ。
|
|
1280
1280
|
|
|
@@ -1629,7 +1629,7 @@ it('admin が空文字保存した場合は空配列', () => {
|
|
|
1629
1629
|
- **パッケージ名**: `@your-scope/plugin-foo`。`@ampless/plugin-*` スコープは本モノレポから ship する公式プラグイン用に予約
|
|
1630
1630
|
- **エントリ**: ESM のみ、default export (factory) + 設定インターフェイス (ユーザの `cms.config.ts` から型付きで引数を渡せるように) を export
|
|
1631
1631
|
- **`apiVersion`**: 現状は `1` を declare してください — 唯一の有効値で、literal type が他の値を compile-time に reject します。`apiVersion` はプラグイン契約の **breaking-change marker** であって semver 風のチャンネルではありません。additive な追加 (optional field、reserved capability など) は `apiVersion: 1` 内に収まり、bump は不要です。詳細は architecture doc の [apiVersion bump policy](https://github.com/heavymoons/ampless/blob/main/docs/architecture/08-plugin-architecture.md#apiversion-bump-policy) を参照
|
|
1632
|
-
- **Dist-tag**: ampless 自体が
|
|
1632
|
+
- **Dist-tag**: ampless 自体が beta のうちは `@beta`。`@latest` は ampless v1.0 まで予約
|
|
1633
1633
|
|
|
1634
1634
|
参考実装:
|
|
1635
1635
|
|
|
@@ -1670,7 +1670,7 @@ it('admin が空文字保存した場合は空配列', () => {
|
|
|
1670
1670
|
```bash
|
|
1671
1671
|
# サイトローカル: 現在の ampless サイトのルートで実行
|
|
1672
1672
|
# plugins/<name>/index.ts を生成する
|
|
1673
|
-
npx create-ampless@
|
|
1673
|
+
npx create-ampless@beta plugin my-thing \
|
|
1674
1674
|
--trust-level untrusted \
|
|
1675
1675
|
--capabilities publicHead,adminSettings
|
|
1676
1676
|
|
|
@@ -1678,7 +1678,7 @@ npx create-ampless@latest plugin my-thing \
|
|
|
1678
1678
|
# package.json / tsconfig.json / tsup.config.ts / README + .ja /
|
|
1679
1679
|
# CHANGELOG / .gitignore / src/index.ts + src/index.test.ts を含む
|
|
1680
1680
|
# 新しいパッケージディレクトリを置きたい場所で実行する
|
|
1681
|
-
npx create-ampless@
|
|
1681
|
+
npx create-ampless@beta plugin @myscope/ampless-plugin-thing \
|
|
1682
1682
|
--standalone \
|
|
1683
1683
|
--trust-level untrusted \
|
|
1684
1684
|
--capabilities publicHead,adminSettings \
|
|
@@ -1687,7 +1687,7 @@ npx create-ampless@latest plugin @myscope/ampless-plugin-thing \
|
|
|
1687
1687
|
|
|
1688
1688
|
スタンドアロンスキャフォールドには Phase 5 のクロスチェックに必要なものがすべて含まれます: `package.json#amplessPlugin`、`./package.json` サブパスエクスポート、`packageName` ファクトリフィールド、`ampless-plugin` 検索キーワード、そして `pnpm install && pnpm test && pnpm build` が生成直後にクリーンに通る最小の vitest サンプル。
|
|
1689
1689
|
|
|
1690
|
-
どちらのモードも、フラグなしの位置引数呼び出し (`npx create-ampless@
|
|
1690
|
+
どちらのモードも、フラグなしの位置引数呼び出し (`npx create-ampless@beta plugin`) で @clack のプロンプト UI を使ったインタラクティブモードに切り替えられます。
|
|
1691
1691
|
|
|
1692
1692
|
### スタンドアロンプラグインの公開
|
|
1693
1693
|
|
|
@@ -1696,12 +1696,12 @@ cd ampless-plugin-thing
|
|
|
1696
1696
|
pnpm install
|
|
1697
1697
|
pnpm test
|
|
1698
1698
|
pnpm build
|
|
1699
|
-
pnpm publish --access public --tag
|
|
1699
|
+
pnpm publish --access public --tag beta
|
|
1700
1700
|
```
|
|
1701
1701
|
|
|
1702
|
-
スコープ付き名前 (`@scope/...`) には `--access public` が必須です。`--tag
|
|
1702
|
+
スコープ付き名前 (`@scope/...`) には `--access public` が必須です。`--tag beta` は現在の ampless プレリリースサイクルに合わせています — 安定 major に達したら外してください。
|
|
1703
1703
|
|
|
1704
|
-
`npm publish` が返った直後に `npm install <pkg>@
|
|
1704
|
+
`npm publish` が返った直後に `npm install <pkg>@beta` で 404 が出ることがあります(CDN とレジストリレプリカの伝播遅延)。その場合は 1〜2 分待ってリトライしてください — `npm view <pkg>@beta version` がレジストリで見えていることは必要条件ですが十分条件ではありません。
|
|
1705
1705
|
|
|
1706
1706
|
### パッケージの命名
|
|
1707
1707
|
|
|
@@ -1744,4 +1744,4 @@ export default defineConfig({
|
|
|
1744
1744
|
- ファーストパーティプラグインの bug → `heavymoons/ampless` にプラグインの package 名つきで issue
|
|
1745
1745
|
- プラグインランタイム / admin form の bug → 同じレポ、ラベル `area:plugins`
|
|
1746
1746
|
|
|
1747
|
-
|
|
1747
|
+
上記の GitHub URL は public beta repo で解決されます。同じ docs は package tarball 内の `node_modules/ampless/docs/` にも同梱されているので、この repo を checkout しなくてもローカルで読めます。
|
|
@@ -77,7 +77,7 @@ same surfaces. The differences are packaging, distribution, and the
|
|
|
77
77
|
opt-in install-time validation that the static `package.json#amplessPlugin`
|
|
78
78
|
manifest enables (see §3 below).
|
|
79
79
|
|
|
80
|
-
§14 below has a one-command scaffold (`npx create-ampless plugin <name>`)
|
|
80
|
+
§14 below has a one-command scaffold (`npx create-ampless@beta plugin <name>`)
|
|
81
81
|
that produces ready-to-use boilerplate for either of the latter two.
|
|
82
82
|
|
|
83
83
|
An ampless plugin is a TypeScript module that returns an
|
|
@@ -123,10 +123,10 @@ The fastest way to create a plugin is to scaffold one:
|
|
|
123
123
|
|
|
124
124
|
```bash
|
|
125
125
|
# Site-local (writes plugins/<name>/index.ts in the current ampless site)
|
|
126
|
-
npx create-ampless@
|
|
126
|
+
npx create-ampless@beta plugin my-thing
|
|
127
127
|
|
|
128
128
|
# Standalone npm package (writes ./<name>/ ready for `npm publish`)
|
|
129
|
-
npx create-ampless@
|
|
129
|
+
npx create-ampless@beta plugin @myscope/ampless-plugin-my-thing --standalone
|
|
130
130
|
```
|
|
131
131
|
|
|
132
132
|
§14 covers the full flow. The rest of this section explains what the
|
|
@@ -1065,7 +1065,7 @@ and the plugin is skipped):
|
|
|
1065
1065
|
|
|
1066
1066
|
### For plugin users (site engineers)
|
|
1067
1067
|
|
|
1068
|
-
1. `npm i @ampless/plugin-youtube@
|
|
1068
|
+
1. `npm i @ampless/plugin-youtube@beta` — add the plugin as a dependency.
|
|
1069
1069
|
2. Register it in `cms.config.ts` for the server-side renderer.
|
|
1070
1070
|
3. `npm run update-ampless` — regenerates `_editor-bootstrap.tsx`
|
|
1071
1071
|
automatically from the installed plugin manifests.
|
|
@@ -1702,7 +1702,7 @@ etc. — but completely wrong for a webhook signing secret.
|
|
|
1702
1702
|
| Threat | Status |
|
|
1703
1703
|
|---|---|
|
|
1704
1704
|
| AWS Console operator browsing PluginSecret table | ✓ defeated — ciphertext only, no key in DDB |
|
|
1705
|
-
| Source repo / deploy artifact access | ⚠ NOT defeated — key is in `amplify/secrets/encryption-key.ts`.
|
|
1705
|
+
| Source repo / deploy artifact access | ⚠ NOT defeated — key is in `amplify/secrets/encryption-key.ts`. For public repos, keep the key out of source control (for example with `npx create-ampless@beta setup-encryption-key --gitignore`) and restrict deploy artifact access. |
|
|
1706
1706
|
| Malicious trusted plugin in same Lambda | ✗ NOT defeated — `process.env.PLUGIN_SECRET_ENCRYPTION_KEY` reachable from plugin code. True isolation = per-plugin Lambda (privileged tier, roadmap). |
|
|
1707
1707
|
| S3 mirror leak | ✓ defeated — PluginSecret table never mirrored. |
|
|
1708
1708
|
|
|
@@ -1735,7 +1735,7 @@ To use `settings.secret`, you also need:
|
|
|
1735
1735
|
2. `'secretSettings'` in `capabilities` (omitting it when `capabilities` is defined produces a console warning).
|
|
1736
1736
|
3. **One-time key setup** — run from your project root:
|
|
1737
1737
|
```sh
|
|
1738
|
-
npx create-ampless setup-encryption-key
|
|
1738
|
+
npx create-ampless@beta setup-encryption-key
|
|
1739
1739
|
```
|
|
1740
1740
|
This generates a cryptographically random 32-byte key and writes
|
|
1741
1741
|
it to `amplify/secrets/encryption-key.ts`. No AWS credentials
|
|
@@ -2239,7 +2239,7 @@ a normal npm package:
|
|
|
2239
2239
|
`apiVersion: 1` and do NOT require a bump. See the [apiVersion
|
|
2240
2240
|
bump policy](https://github.com/heavymoons/ampless/blob/main/docs/architecture/08-plugin-architecture.md#apiversion-bump-policy)
|
|
2241
2241
|
in the architecture doc for the full criteria.
|
|
2242
|
-
- **Dist-tag**: `@
|
|
2242
|
+
- **Dist-tag**: `@beta` while ampless itself is in beta. The
|
|
2243
2243
|
`@latest` tag stays reserved until ampless v1.0.
|
|
2244
2244
|
|
|
2245
2245
|
Worked examples to crib from:
|
|
@@ -2306,7 +2306,7 @@ CLI ships a `plugin <name>` subcommand:
|
|
|
2306
2306
|
```bash
|
|
2307
2307
|
# Site-local: scaffolds plugins/<name>/index.ts inside the current
|
|
2308
2308
|
# ampless site. Run from the site repo root.
|
|
2309
|
-
npx create-ampless@
|
|
2309
|
+
npx create-ampless@beta plugin my-thing \
|
|
2310
2310
|
--trust-level untrusted \
|
|
2311
2311
|
--capabilities publicHead,adminSettings
|
|
2312
2312
|
|
|
@@ -2314,7 +2314,7 @@ npx create-ampless@latest plugin my-thing \
|
|
|
2314
2314
|
# tsconfig.json, tsup.config.ts, README + .ja, CHANGELOG, .gitignore,
|
|
2315
2315
|
# and src/index.ts + src/index.test.ts. Run from wherever you want
|
|
2316
2316
|
# the new package directory to land.
|
|
2317
|
-
npx create-ampless@
|
|
2317
|
+
npx create-ampless@beta plugin @myscope/ampless-plugin-thing \
|
|
2318
2318
|
--standalone \
|
|
2319
2319
|
--trust-level untrusted \
|
|
2320
2320
|
--capabilities publicHead,adminSettings \
|
|
@@ -2328,7 +2328,7 @@ keyword, and a minimal vitest sample so `pnpm install && pnpm test &&
|
|
|
2328
2328
|
pnpm build` runs clean on the freshly generated directory.
|
|
2329
2329
|
|
|
2330
2330
|
Both modes also accept a positional flag-less invocation (`npx
|
|
2331
|
-
create-ampless@
|
|
2331
|
+
create-ampless@beta plugin`) that walks you through the same
|
|
2332
2332
|
questions interactively via the @clack prompt UI.
|
|
2333
2333
|
|
|
2334
2334
|
### Publishing a standalone plugin
|
|
@@ -2338,17 +2338,17 @@ cd ampless-plugin-thing
|
|
|
2338
2338
|
pnpm install
|
|
2339
2339
|
pnpm test
|
|
2340
2340
|
pnpm build
|
|
2341
|
-
pnpm publish --access public --tag
|
|
2341
|
+
pnpm publish --access public --tag beta
|
|
2342
2342
|
```
|
|
2343
2343
|
|
|
2344
2344
|
`--access public` is mandatory for scoped names (`@scope/...`).
|
|
2345
|
-
`--tag
|
|
2345
|
+
`--tag beta` matches the current ampless pre-release cadence — drop
|
|
2346
2346
|
it once the package reaches a stable major.
|
|
2347
2347
|
|
|
2348
2348
|
There's a publish-to-install lag of "seconds to minutes" before
|
|
2349
|
-
`npm install <pkg>@
|
|
2349
|
+
`npm install <pkg>@beta` picks up a fresh publish (CDN + registry
|
|
2350
2350
|
replica propagation). If `npm install` 404s right after `npm publish`
|
|
2351
|
-
returns, wait 1-2 minutes and retry — `npm view <pkg>@
|
|
2351
|
+
returns, wait 1-2 minutes and retry — `npm view <pkg>@beta version`
|
|
2352
2352
|
visible in the registry is necessary but sometimes not sufficient.
|
|
2353
2353
|
|
|
2354
2354
|
### Naming the package
|
|
@@ -2399,8 +2399,7 @@ PROTECTED), so the scaffolded code is safe across ampless upgrades.
|
|
|
2399
2399
|
- Bugs in the plugin runtime / admin form → same repo, label
|
|
2400
2400
|
`area:plugins`.
|
|
2401
2401
|
|
|
2402
|
-
The
|
|
2403
|
-
|
|
2404
|
-
|
|
2405
|
-
|
|
2406
|
-
you can read them locally without browsing GitHub.
|
|
2402
|
+
The GitHub URLs above resolve in the public beta repo. The same docs
|
|
2403
|
+
also live in the package tarball directly under
|
|
2404
|
+
`node_modules/ampless/docs/`, so plugin authors can read them locally
|
|
2405
|
+
without checking out this repo.
|