create-ampless 1.0.0-alpha.66 → 1.0.0-alpha.68
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.
|
@@ -139,7 +139,7 @@ analyticsGa4Plugin({ instanceId: 'product' })
|
|
|
139
139
|
| 階層 | IAM | 用途 |
|
|
140
140
|
|---|---|---|
|
|
141
141
|
| `untrusted` | なし (SQS consume のみ) | head/body descriptor、webhook 配送、コンテンツ変換 |
|
|
142
|
-
| `trusted` | 投稿読み出し、`public/plugins/<name>/...` への書き込み | RSS フィード、sitemap、計算済み JSON インデックス |
|
|
142
|
+
| `trusted` | 投稿読み出し、`public/plugins/<instanceId ?? name>/...` への書き込み | RSS フィード、sitemap、計算済み JSON インデックス |
|
|
143
143
|
| `privileged` | 予約 | 将来: SES、secret、private S3 |
|
|
144
144
|
|
|
145
145
|
決め方の目安:
|
|
@@ -273,6 +273,26 @@ hooks: {
|
|
|
273
273
|
}
|
|
274
274
|
```
|
|
275
275
|
|
|
276
|
+
### `writePublicAsset`
|
|
277
|
+
|
|
278
|
+
公開生成ファイルを書き出す trusted plugin は capability を宣言してください:
|
|
279
|
+
|
|
280
|
+
```ts
|
|
281
|
+
capabilities: ['eventHooks', 'writePublicAsset']
|
|
282
|
+
```
|
|
283
|
+
|
|
284
|
+
同じ plugin が `metadata()` または `siteMetadata()` も実装する場合は、`metadata` も宣言します。この capability 名は両方の metadata 関数をまとめて表し、別個の `siteMetadata` capability はありません。
|
|
285
|
+
|
|
286
|
+
trusted processor は次の場所に書き込みます:
|
|
287
|
+
|
|
288
|
+
```txt
|
|
289
|
+
public/plugins/<instanceId ?? name>/<key>
|
|
290
|
+
```
|
|
291
|
+
|
|
292
|
+
`key` は相対 asset key である必要があります。空文字、絶対パス、`.` / `..` path segment、backslash、制御文字、256 文字超の key は S3 呼び出し前に拒否されます。`indexes/posts.json` のような nested path は許可されます。戻り値は書き込まれた object の public URL です。
|
|
293
|
+
|
|
294
|
+
移行期間中、`capabilities` フィールドが無い plugin はそのまま動きます。`capabilities` を宣言しているのに `writePublicAsset` を省いた plugin は、実際に `ctx.writePublicAsset()` を呼んだ時に 1 回だけ warn します。
|
|
295
|
+
|
|
276
296
|
### ベストプラクティス
|
|
277
297
|
|
|
278
298
|
- **冪等にする**。SQS は at-least-once 配送 — 同じイベントが 2 回 fire する可能性があります。同じ入力で同じ出力 (決定論的なフィード等) を生成するようにしてください
|
|
@@ -168,7 +168,7 @@ touch IAM):
|
|
|
168
168
|
| Tier | IAM | Used by |
|
|
169
169
|
|---|---|---|
|
|
170
170
|
| `untrusted` | none (SQS consume only) | head/body descriptors, webhook delivery, content transforms |
|
|
171
|
-
| `trusted` | read posts, write `public/plugins/<name>/...` | RSS feed, sitemap, computed JSON indexes |
|
|
171
|
+
| `trusted` | read posts, write `public/plugins/<instanceId ?? name>/...` | RSS feed, sitemap, computed JSON indexes |
|
|
172
172
|
| `privileged` | reserved | future: SES, secrets, private S3 |
|
|
173
173
|
|
|
174
174
|
Rule of thumb:
|
|
@@ -332,6 +332,36 @@ hooks: {
|
|
|
332
332
|
}
|
|
333
333
|
```
|
|
334
334
|
|
|
335
|
+
### `writePublicAsset`
|
|
336
|
+
|
|
337
|
+
Trusted plugins that write public generated files should declare the
|
|
338
|
+
capability:
|
|
339
|
+
|
|
340
|
+
```ts
|
|
341
|
+
capabilities: ['eventHooks', 'writePublicAsset']
|
|
342
|
+
```
|
|
343
|
+
|
|
344
|
+
If the same plugin implements `metadata()` or `siteMetadata()`, also
|
|
345
|
+
declare `metadata`. That capability name covers both metadata
|
|
346
|
+
functions; there is no separate `siteMetadata` capability.
|
|
347
|
+
|
|
348
|
+
The trusted processor writes under:
|
|
349
|
+
|
|
350
|
+
```txt
|
|
351
|
+
public/plugins/<instanceId ?? name>/<key>
|
|
352
|
+
```
|
|
353
|
+
|
|
354
|
+
`key` must be a relative asset key. Empty strings, absolute paths,
|
|
355
|
+
`.` / `..` path segments, backslashes, control characters, and keys
|
|
356
|
+
over 256 characters are rejected before S3 is called. Nested paths
|
|
357
|
+
such as `indexes/posts.json` are allowed. The return value is the
|
|
358
|
+
public URL for the written object.
|
|
359
|
+
|
|
360
|
+
During the migration period, plugins with no `capabilities` field
|
|
361
|
+
keep working. Plugins that do declare `capabilities` but omit
|
|
362
|
+
`writePublicAsset` warn once when they actually call
|
|
363
|
+
`ctx.writePublicAsset()`.
|
|
364
|
+
|
|
335
365
|
### Best practices
|
|
336
366
|
|
|
337
367
|
- **Be idempotent.** SQS delivery is at-least-once: the same event
|
|
@@ -25,18 +25,18 @@
|
|
|
25
25
|
"@tiptap/pm": "^3.23.6",
|
|
26
26
|
"@tiptap/react": "^3.23.6",
|
|
27
27
|
"@tiptap/starter-kit": "^3.23.6",
|
|
28
|
-
"@ampless/plugin-analytics-ga4": "^0.2.0-alpha.
|
|
29
|
-
"@ampless/plugin-gtm": "^0.1.1-alpha.
|
|
30
|
-
"@ampless/plugin-og-image": "^0.2.0-alpha.
|
|
31
|
-
"@ampless/plugin-plausible": "^0.1.1-alpha.
|
|
32
|
-
"@ampless/plugin-rss": "^0.2.0-alpha.
|
|
33
|
-
"@ampless/plugin-seo": "^0.2.0-alpha.
|
|
34
|
-
"@ampless/plugin-webhook": "^0.2.0-alpha.
|
|
35
|
-
"@ampless/admin": "^1.0.0-alpha.
|
|
36
|
-
"@ampless/backend": "^1.0.0-alpha.
|
|
37
|
-
"@ampless/runtime": "^1.0.0-alpha.
|
|
28
|
+
"@ampless/plugin-analytics-ga4": "^0.2.0-alpha.2",
|
|
29
|
+
"@ampless/plugin-gtm": "^0.1.1-alpha.1",
|
|
30
|
+
"@ampless/plugin-og-image": "^0.2.0-alpha.19",
|
|
31
|
+
"@ampless/plugin-plausible": "^0.1.1-alpha.1",
|
|
32
|
+
"@ampless/plugin-rss": "^0.2.0-alpha.19",
|
|
33
|
+
"@ampless/plugin-seo": "^0.2.0-alpha.19",
|
|
34
|
+
"@ampless/plugin-webhook": "^0.2.0-alpha.19",
|
|
35
|
+
"@ampless/admin": "^1.0.0-alpha.43",
|
|
36
|
+
"@ampless/backend": "^1.0.0-alpha.34",
|
|
37
|
+
"@ampless/runtime": "^1.0.0-alpha.25",
|
|
38
38
|
"@digital-go-jp/tailwind-theme-plugin": "^0.3.4",
|
|
39
|
-
"ampless": "^1.0.0-alpha.
|
|
39
|
+
"ampless": "^1.0.0-alpha.19",
|
|
40
40
|
"aws-amplify": "^6.17.0",
|
|
41
41
|
"class-variance-authority": "^0.7.1",
|
|
42
42
|
"clsx": "^2.1.1",
|