@tunasand/sdk 0.8.0 → 0.12.0

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.
Files changed (221) hide show
  1. package/CHANGELOG.md +137 -0
  2. package/README.md +165 -144
  3. package/dist/analytics.js +183 -109
  4. package/dist/app.js +276 -166
  5. package/dist/apps-BysPfMuR.js +408 -0
  6. package/dist/astro-image.d.ts +1 -0
  7. package/dist/astro-image.js +33 -0
  8. package/dist/astro-server-Bwau8F6d.js +99 -0
  9. package/dist/astro-server.d.ts +1 -0
  10. package/dist/astro-server.js +1 -0
  11. package/dist/astro.d.ts +1 -0
  12. package/dist/astro.js +306 -0
  13. package/dist/bridge-C2Bl-OAF.js +80 -0
  14. package/dist/bridge.js +1 -13
  15. package/dist/build-file-DNi0PHC5.js +31 -0
  16. package/dist/cli.js +6212 -8
  17. package/dist/{client-Derrexwr.js → client-C8STAw9T.js} +43 -24
  18. package/dist/code-N8pBUDbq.js +30 -0
  19. package/dist/code.d.ts +1 -0
  20. package/dist/code.js +1 -0
  21. package/dist/collection-26aglrg6.js +282 -0
  22. package/dist/{declared-DuNMsdXw.js → declared-CE4a61qb.js} +35 -35
  23. package/dist/delivery.js +121 -114
  24. package/dist/dev-operations-Tutwi1On.js +46 -0
  25. package/dist/dev.js +9 -16
  26. package/dist/embeds-DY6O5TrJ.js +29 -0
  27. package/dist/end-users.d.ts +1 -0
  28. package/dist/end-users.js +189 -0
  29. package/dist/endUsers-DODfjnv1.js +77 -0
  30. package/dist/{errorLabels-BgtQ_zUn.js → errorLabels-BK1NJ6Wz.js} +374 -238
  31. package/dist/i18n.js +4 -4
  32. package/dist/ids-DmtIoqBX.js +109 -0
  33. package/dist/integrations.js +95 -24
  34. package/dist/{ja-Du6ooL6i.js → ja-B3lAaOhZ.js} +91 -45
  35. package/dist/{ja-CeHU0EaY.js → ja-axQPxMJ-.js} +3 -3
  36. package/dist/operations-CIB99rIY.js +95 -0
  37. package/dist/operations.d.ts +1 -0
  38. package/dist/operations.js +1 -0
  39. package/dist/{page-Bzrj24sJ.js → page-yo1cw1kW.js} +1 -1
  40. package/dist/paymentPort-p1jV44Zz.js +203 -0
  41. package/dist/preview.js +8 -1
  42. package/dist/{profile-1em_lcxq.js → profile-DBsXLvvI.js} +48 -48
  43. package/dist/rich-text.js +16 -16
  44. package/dist/{schema-WnobuwLg.js → schema-Bs_BUUNv.js} +526 -265
  45. package/dist/schema.js +66 -88
  46. package/dist/types/access/src/handoff.d.ts +19 -14
  47. package/dist/types/access/src/index.d.ts +2 -2
  48. package/dist/types/access/src/jws.d.ts +41 -0
  49. package/dist/types/access/src/oidc.d.ts +12 -2
  50. package/dist/types/access/src/signed.d.ts +0 -2
  51. package/dist/types/adapter-cloudflare/src/eventLog/viewSchema.d.ts +11 -0
  52. package/dist/types/contract/src/accountProfile.d.ts +7 -0
  53. package/dist/types/contract/src/api/define.d.ts +165 -0
  54. package/dist/types/contract/src/apiKeys.d.ts +6 -2
  55. package/dist/types/contract/src/app.d.ts +32 -7
  56. package/dist/types/contract/src/appChannels.d.ts +152 -0
  57. package/dist/types/contract/src/appDefinition.d.ts +11 -5
  58. package/dist/types/contract/src/appDependencies.d.ts +107 -24
  59. package/dist/types/contract/src/appIdentities.d.ts +21 -0
  60. package/dist/types/contract/src/appInbound.d.ts +53 -0
  61. package/dist/types/contract/src/appMail.d.ts +106 -0
  62. package/dist/types/contract/src/appSecrets.d.ts +63 -0
  63. package/dist/types/contract/src/appServer.d.ts +460 -45
  64. package/dist/types/contract/src/approvals.d.ts +1 -1
  65. package/dist/types/contract/src/apps.d.ts +126 -60
  66. package/dist/types/contract/src/auditActions.d.ts +2 -2
  67. package/dist/types/contract/src/auditLabels.d.ts +120 -15
  68. package/dist/types/contract/src/authorize.d.ts +42 -14
  69. package/dist/types/contract/src/bridge.d.ts +35 -36
  70. package/dist/types/contract/src/consents.d.ts +29 -27
  71. package/dist/types/contract/src/deletion.d.ts +18 -0
  72. package/dist/types/contract/src/embeds.d.ts +26 -90
  73. package/dist/types/contract/src/{customerLabels.d.ts → endUserLabels.d.ts} +6 -9
  74. package/dist/types/contract/src/endUsers.d.ts +244 -0
  75. package/dist/types/contract/src/errorLabels.d.ts +67 -37
  76. package/dist/types/contract/src/errorLabelsEn.d.ts +50 -33
  77. package/dist/types/contract/src/errors.d.ts +28 -16
  78. package/dist/types/contract/src/eventSchemas.d.ts +70 -0
  79. package/dist/types/contract/src/eventTraces.d.ts +41 -0
  80. package/dist/types/contract/src/failureStatus.d.ts +14 -22
  81. package/dist/types/contract/src/fieldAccess.d.ts +8 -8
  82. package/dist/types/contract/src/formLabels.d.ts +3 -0
  83. package/dist/types/contract/src/forms.d.ts +4 -0
  84. package/dist/types/contract/src/grants.d.ts +26 -0
  85. package/dist/types/contract/src/headers.d.ts +5 -0
  86. package/dist/types/contract/src/hostingRpc.d.ts +44 -19
  87. package/dist/types/contract/src/identifiers.d.ts +45 -17
  88. package/dist/types/contract/src/ids.d.ts +18 -10
  89. package/dist/types/contract/src/import.d.ts +17 -16
  90. package/dist/types/contract/src/index.d.ts +57 -29
  91. package/dist/types/contract/src/integrationGraph.d.ts +83 -0
  92. package/dist/types/contract/src/issueLabels.d.ts +121 -81
  93. package/dist/types/contract/src/issueLabelsEn.d.ts +61 -41
  94. package/dist/types/contract/src/manage.d.ts +16 -7
  95. package/dist/types/contract/src/manageLabels.d.ts +2 -0
  96. package/dist/types/contract/src/manifestText.d.ts +66 -0
  97. package/dist/types/contract/src/messagePort.d.ts +208 -0
  98. package/dist/types/contract/src/migration.d.ts +2 -2
  99. package/dist/types/contract/src/notices.d.ts +37 -0
  100. package/dist/types/contract/src/operationEffects.d.ts +39 -0
  101. package/dist/types/contract/src/operatorOperations.d.ts +104 -110
  102. package/dist/types/contract/src/outbound.d.ts +29 -0
  103. package/dist/types/contract/src/paths.d.ts +13 -0
  104. package/dist/types/contract/src/paymentPort.d.ts +129 -0
  105. package/dist/types/contract/src/pending.d.ts +2 -0
  106. package/dist/types/contract/src/permissions.d.ts +7 -11
  107. package/dist/types/contract/src/perspective.d.ts +26 -0
  108. package/dist/types/contract/src/powers.d.ts +5 -0
  109. package/dist/types/contract/src/principal.d.ts +127 -56
  110. package/dist/types/contract/src/readPages.d.ts +92 -0
  111. package/dist/types/contract/src/recordLabels.d.ts +6 -0
  112. package/dist/types/contract/src/roles.d.ts +7 -4
  113. package/dist/types/contract/src/ruleLabels.d.ts +16 -0
  114. package/dist/types/contract/src/ruleProblems.d.ts +16 -0
  115. package/dist/types/contract/src/schemaLabels.d.ts +8 -0
  116. package/dist/types/contract/src/settingProblems.d.ts +18 -1
  117. package/dist/types/contract/src/settings.d.ts +5 -7
  118. package/dist/types/contract/src/siteDeclaration.d.ts +7 -7
  119. package/dist/types/contract/src/siteIndex.d.ts +76 -0
  120. package/dist/types/contract/src/transfer.d.ts +1 -1
  121. package/dist/types/contract/src/trial.d.ts +4 -1
  122. package/dist/types/contract/src/versions.d.ts +1 -3
  123. package/dist/types/contract/src/viewEvent.d.ts +0 -9
  124. package/dist/types/contract/src/webhooks.d.ts +24 -3
  125. package/dist/types/contract/src/workflow.d.ts +16 -19
  126. package/dist/types/contract/src/workspaceItems.d.ts +23 -7
  127. package/dist/types/contract/src/workspacePaths.d.ts +1 -1
  128. package/dist/types/rich-text/src/html.d.ts +1 -1
  129. package/dist/types/rich-text/src/index.d.ts +8 -7
  130. package/dist/types/rich-text/src/labels/en.d.ts +1 -1
  131. package/dist/types/rich-text/src/labels/ja.d.ts +2 -2
  132. package/dist/types/rich-text/src/library.d.ts +1 -1
  133. package/dist/types/rich-text/src/media.d.ts +2 -0
  134. package/dist/types/rich-text/src/normalize.d.ts +1 -1
  135. package/dist/types/rich-text/src/problems.d.ts +5 -5
  136. package/dist/types/rich-text/src/profile.d.ts +10 -10
  137. package/dist/types/rich-text/src/render.d.ts +1 -1
  138. package/dist/types/rich-text/src/schema.d.ts +2 -2
  139. package/dist/types/rich-text/src/standard.d.ts +4 -4
  140. package/dist/types/rich-text/src/types.d.ts +2 -2
  141. package/dist/types/schema/src/audience.d.ts +1 -3
  142. package/dist/types/schema/src/capabilities.d.ts +18 -27
  143. package/dist/types/schema/src/changes.d.ts +3 -1
  144. package/dist/types/schema/src/collection.d.ts +142 -111
  145. package/dist/types/schema/src/defaultSchema.d.ts +8 -2
  146. package/dist/types/schema/src/fieldIds.d.ts +18 -0
  147. package/dist/types/schema/src/file.d.ts +24 -11
  148. package/dist/types/schema/src/fileRefs.d.ts +14 -0
  149. package/dist/types/schema/src/fileSignature.d.ts +20 -0
  150. package/dist/types/schema/src/filesCollection.d.ts +7 -0
  151. package/dist/types/schema/src/forms.d.ts +43 -0
  152. package/dist/types/schema/src/imageMetadata.d.ts +9 -0
  153. package/dist/types/schema/src/index.d.ts +19 -10
  154. package/dist/types/schema/src/indexes.d.ts +11 -0
  155. package/dist/types/schema/src/input.d.ts +1 -1
  156. package/dist/types/schema/src/integrity.d.ts +8 -7
  157. package/dist/types/schema/src/kinds.d.ts +26 -0
  158. package/dist/types/schema/src/labels/en.d.ts +89 -46
  159. package/dist/types/schema/src/labels/ja.d.ts +92 -46
  160. package/dist/types/schema/src/mediaUrl.d.ts +26 -33
  161. package/dist/types/schema/src/page.d.ts +4 -4
  162. package/dist/types/schema/src/problems.d.ts +85 -42
  163. package/dist/types/schema/src/refs.d.ts +0 -9
  164. package/dist/types/schema/src/schema.d.ts +17 -12
  165. package/dist/types/schema/src/selfOps.d.ts +20 -19
  166. package/dist/types/schema/src/traits.d.ts +28 -0
  167. package/dist/types/schema/src/typesSource.d.ts +1 -1
  168. package/dist/types/schema/src/values.d.ts +5 -2
  169. package/dist/types/schema/src/widening.d.ts +3 -0
  170. package/dist/types/sdk/src/analytics.d.ts +2 -1
  171. package/dist/types/sdk/src/app.d.ts +43 -14
  172. package/dist/types/sdk/src/astro-image.d.ts +19 -0
  173. package/dist/types/sdk/src/astro-response.d.ts +6 -0
  174. package/dist/types/sdk/src/astro-server.d.ts +16 -0
  175. package/dist/types/sdk/src/astro.d.ts +19 -0
  176. package/dist/types/sdk/src/bridge.d.ts +2 -4
  177. package/dist/types/sdk/src/code.d.ts +61 -0
  178. package/dist/types/sdk/src/delegation.d.ts +13 -3
  179. package/dist/types/sdk/src/delivery/changes.d.ts +4 -4
  180. package/dist/types/sdk/src/delivery/client.d.ts +33 -22
  181. package/dist/types/sdk/src/delivery/fields.d.ts +3 -3
  182. package/dist/types/sdk/src/delivery/index.d.ts +3 -3
  183. package/dist/types/sdk/src/delivery/media.d.ts +5 -8
  184. package/dist/types/sdk/src/delivery/query.d.ts +15 -11
  185. package/dist/types/sdk/src/delivery/schema.d.ts +1 -1
  186. package/dist/types/sdk/src/delivery/values.d.ts +10 -14
  187. package/dist/types/sdk/src/delivery.d.ts +2 -2
  188. package/dist/types/sdk/src/dev-operations.d.ts +20 -0
  189. package/dist/types/sdk/src/dev.d.ts +6 -5
  190. package/dist/types/sdk/src/end-users.d.ts +187 -0
  191. package/dist/types/sdk/src/i18n.d.ts +2 -2
  192. package/dist/types/sdk/src/integrations.d.ts +14 -21
  193. package/dist/types/sdk/src/operations.d.ts +17 -0
  194. package/dist/types/sdk/src/preview.d.ts +2 -1
  195. package/dist/types/sdk/src/rich-text.d.ts +2 -2
  196. package/dist/types/sdk/src/schema.d.ts +1 -1
  197. package/dist/types/sdk/src/site/artifact.d.ts +64 -0
  198. package/dist/types/sdk/src/site/build-file.d.ts +30 -0
  199. package/dist/types/sdk/src/site/check-code.d.ts +14 -0
  200. package/dist/types/sdk/src/site/check-text.d.ts +19 -0
  201. package/dist/types/sdk/src/site/cli.d.ts +52 -0
  202. package/dist/types/sdk/src/site/content-type.d.ts +2 -0
  203. package/dist/types/sdk/src/site/labels.d.ts +14 -0
  204. package/dist/types/sdk/src/types.d.ts +1 -1
  205. package/dist/{types-B77qvqPJ.js → types-CYnY-63C.js} +5 -6
  206. package/dist/types.js +1 -1
  207. package/dist/{typesSource-CWybQYus.js → typesSource-BTA9-rcB.js} +17 -15
  208. package/package.json +32 -6
  209. package/dist/apps-BxnJ1RlU.js +0 -435
  210. package/dist/bridge-DtHw9hS6.js +0 -74
  211. package/dist/collection-BEOxeISR.js +0 -189
  212. package/dist/customers-DTbL0qn6.js +0 -86
  213. package/dist/customers.d.ts +0 -1
  214. package/dist/customers.js +0 -185
  215. package/dist/embeds-B5V54Zur.js +0 -34
  216. package/dist/ids--RF7hGyC.js +0 -36
  217. package/dist/src-sazhzYui.js +0 -71
  218. package/dist/types/contract/src/customers.d.ts +0 -266
  219. package/dist/types/schema/src/legacy.d.ts +0 -2
  220. package/dist/types/schema/src/media.d.ts +0 -5
  221. package/dist/types/sdk/src/customers.d.ts +0 -184
@@ -0,0 +1,76 @@
1
+ /** 索引の形のバージョン */
2
+ export declare const SITE_INDEX_VERSION = 1;
3
+ /** 中立の実行環境の版(固有の互換の設定は、アダプターが版から決める) */
4
+ export declare const SITE_RUNTIMES: readonly ["web-1"];
5
+ export type SiteRuntime = (typeof SITE_RUNTIMES)[number];
6
+ export declare const SITE_MODULE_TYPES: readonly ["js", "wasm", "text", "data"];
7
+ /** 失敗の応答に使う静的ファイルを置ける状態コード */
8
+ export declare const SITE_ERROR_STATUSES: readonly ["404", "500"];
9
+ export type SiteErrorStatus = (typeof SITE_ERROR_STATUSES)[number];
10
+ /** 上限(大きさはバイト。modules と codeBytes は、カーネルの束の上限と同じ値) */
11
+ export declare const SITE_INDEX_MAX: {
12
+ readonly indexBytes: number;
13
+ readonly modules: 1000;
14
+ readonly codeBytes: number;
15
+ readonly files: 20000;
16
+ readonly fileBytes: number;
17
+ readonly filesBytes: number;
18
+ readonly pathLength: 1024;
19
+ readonly contentTypeLength: 128;
20
+ };
21
+ /** コードの1つのファイル */
22
+ export type SiteModule = Readonly<{
23
+ path: string;
24
+ type: (typeof SITE_MODULE_TYPES)[number];
25
+ sha256: string;
26
+ bytes: number;
27
+ }>;
28
+ /** 静的ファイル(path は返す URL のパスそのもの。immutable は内容が変わらないもの) */
29
+ export type SiteFile = Readonly<{
30
+ path: string;
31
+ sha256: string;
32
+ bytes: number;
33
+ content_type: string;
34
+ immutable: boolean;
35
+ }>;
36
+ export type SiteIndex = Readonly<{
37
+ version: typeof SITE_INDEX_VERSION;
38
+ runtime: SiteRuntime;
39
+ entry: string;
40
+ modules: readonly SiteModule[];
41
+ files: readonly SiteFile[];
42
+ errors: Readonly<Partial<Record<SiteErrorStatus, string>>>;
43
+ manifest_version: number;
44
+ }>;
45
+ /** 索引の誤り(at は索引の中の場所) */
46
+ export type SiteIndexProblem = 'index_too_large' | 'not_json' | 'not_canonical' | 'invalid_shape' | 'unknown_version' | 'unknown_runtime' | 'invalid_path' | 'duplicate_path' | 'invalid_sha256' | 'invalid_bytes' | 'conflicting_content' | 'invalid_type' | 'too_many_modules' | 'code_too_large' | 'too_many_files' | 'file_too_large' | 'files_too_large' | 'missing_entry' | 'missing_error_file' | 'invalid_manifest_version';
47
+ export type SiteIndexResult = Readonly<{
48
+ ok: true;
49
+ index: SiteIndex;
50
+ } | {
51
+ ok: false;
52
+ problem: SiteIndexProblem;
53
+ at: string;
54
+ }>;
55
+ /** コードのパスか */
56
+ export declare const isSiteModulePath: (path: string) => boolean;
57
+ /** 復号した静的ファイルのパスを、索引に書く形にする(正しくなければ null) */
58
+ export declare function siteFilePathOf(decoded: string): string | null;
59
+ /** 要求の URL のパスを、索引と比べる形にする(復号した文字で比べる。対応するものがなければ null) */
60
+ export declare function siteRequestPathOf(pathname: string): string | null;
61
+ /** キーと、パスを持つものの順によらない、索引の正規形 */
62
+ export declare function siteIndexJson({ version, runtime, entry, modules, files, errors, manifest_version }: SiteIndex): string;
63
+ /** バイトの SHA-256(16進) */
64
+ export declare function sha256Hex(bytes: Uint8Array): Promise<string>;
65
+ /** 成果物のハッシュ(索引の正規形の SHA-256) */
66
+ export declare const siteDigestOf: (index: SiteIndex) => Promise<string>;
67
+ /** 索引の値を確かめる(パスの順に並べて返す) */
68
+ export declare const checkSiteIndex: (value: unknown) => SiteIndexResult;
69
+ /** 受けた索引のバイトを確かめる(正規形のバイトと1つでも違えば拒む) */
70
+ export declare const parseSiteIndex: (bytes: Uint8Array) => SiteIndexResult;
71
+ /** 束の中のコードの範囲(索引の順に隙間なくつなぐ) */
72
+ export type SiteCodeRange = SiteModule & Readonly<{
73
+ start: number;
74
+ }>;
75
+ /** 索引から、束の中の範囲を作る */
76
+ export declare function siteCodeRanges({ modules }: Pick<SiteIndex, 'modules'>): readonly SiteCodeRange[];
@@ -1,7 +1,7 @@
1
1
  import type { Permissions } from './permissions.js';
2
2
  import type { ViewDefinition } from './views.js';
3
3
  /** スキーマと設定の形式の名前 */
4
- export declare const CONFIG_FORMAT = "cms-config";
4
+ export declare const CONFIG_FORMAT = "tunasand-config";
5
5
  /** スキーマと設定(schema は CollectionSchema・screens は画面設定 ScreenSettings の形、roles は管理者以外、views はチームのビュー) */
6
6
  export type ConfigBundle = Readonly<{
7
7
  format: typeof CONFIG_FORMAT;
@@ -1,4 +1,7 @@
1
- /** 検証用のフラグのプロジェクトの CMS のホスト名の印(先頭のラベルの末尾。Tunasand が振るホスト名は `--` を含み、導入先が選ぶ名前とぶつからない、docs/domains.md) */
1
+ /**
2
+ * 検証用のフラグのプロジェクトの CMS のホスト名の印(先頭のラベルの末尾)
3
+ * Tunasand が振るホスト名は `--` を含み、導入先が選ぶ名前とぶつからない(docs/specs/identifiers.md の「URL とホスト名」)
4
+ */
2
5
  export declare const TRIAL_HOST_SUFFIX = "--trial";
3
6
  /** 検証用のフラグのプロジェクトの送信が届くホスト名の印(先頭のラベルが `<プロジェクトの ID>--trialsite`。CMS のホスト名と分ける) */
4
7
  export declare const TRIAL_SITE_SUFFIX = "--trialsite";
@@ -1,7 +1,5 @@
1
- /** 配信 API の版(パス /content/v1) */
1
+ /** 公開の API の版(パス /v1) */
2
2
  export declare const DELIVERY_VERSION = 1;
3
- /** 配信 API の応答で契約の版を示すヘッダー */
4
- export declare const CONTRACT_VERSION_HEADER = "x-cms-version";
5
3
  /** プロジェクトのデータの書き出しの形(JSON の行とファイルの中身のバンドル、書き出しの目録の format と version。実装は L の後) */
6
4
  export declare const EXPORT_FORMAT: {
7
5
  readonly name: "tunasand-export";
@@ -14,15 +14,6 @@ export type ViewEvent = Readonly<{
14
14
  }>;
15
15
  /** 位置で持つ記録先の列の順 */
16
16
  export declare const VIEW_COLUMNS: readonly ["kind", "id", "path", "date", "event", "project"];
17
- /**
18
- * 閲覧のイベントの形(toolkit の analyticsEngineRecorder・analyticsEngineCounts に渡す)
19
- * - index: プロジェクト、指定なしは種類(Analytics Engine は index ごとに標本を抽出するため、共有のデータセットで小さなプロジェクトの記録が間引かれないように)
20
- */
21
- export declare const VIEW_SCHEMA: Readonly<{
22
- blobs: readonly ("id" | "kind" | "date" | "path" | "project" | "event")[];
23
- doubles?: readonly never[] | undefined;
24
- index?: ((event: Readonly<Partial<Record<"id" | "kind" | "date" | "path" | "project" | "event", string>> & Partial<Record<never, number>>>) => string) | undefined;
25
- }>;
26
17
  /** イベントにする設定(project はプロジェクトの識別子) */
27
18
  export type ViewOptions = Readonly<{
28
19
  classify: Classify;
@@ -1,5 +1,6 @@
1
- /** 送れる操作(レビューの依頼・公開・非公開・差し戻しと、データの変更の作成・更新・削除) */
2
- export declare const WEBHOOK_ACTIONS: readonly ["submitted", "published", "unpublished", "rejected", "created", "updated", "deleted"];
1
+ import type { ActorKind } from './identifiers.js';
2
+ /** 送れる操作(公開・非公開と、データの変更の作成・更新・削除) */
3
+ export declare const WEBHOOK_ACTIONS: readonly ["published", "unpublished", "created", "updated", "deleted"];
3
4
  /** データの変更の操作(配信 API の変更の一覧と同じ記録から送る) */
4
5
  export declare const WEBHOOK_CHANGE_ACTIONS: readonly ["created", "updated", "deleted"];
5
6
  /** データの変更の操作 */
@@ -28,6 +29,26 @@ export type InstallationDeletedData = Readonly<{
28
29
  export declare const isWebhookAction: (value: string) => value is WebhookAction;
29
30
  /** コレクションと操作のイベントのキー */
30
31
  export declare const webhookEventOf: (collection: string, action: WebhookAction) => WebhookEvent;
32
+ /** アプリのイベントのキー(namespace は登録簿のアプリの名前空間、name はマニフェストの emits の名前) */
33
+ export declare const appEventOf: (namespace: string, name: string) => WebhookEvent;
34
+ /** アプリのイベントのキーの形か(宣言の有無は見ない) */
35
+ export declare const isAppEventName: (event: string) => boolean;
36
+ /**
37
+ * アプリのイベントの data(対象の ID と主体の種類だけで、レコードの値と、主体の ID とメールアドレスを持たない)
38
+ * - environment: 環境の ID、collection・record: 対象の ID、actor: 起こした主体の種類(アカウント、インストールなど)
39
+ */
40
+ export type AppEventData = Readonly<{
41
+ environment: string;
42
+ collection: Readonly<{
43
+ id: string;
44
+ }>;
45
+ record: Readonly<{
46
+ id: string;
47
+ }>;
48
+ actor: Readonly<{
49
+ kind: ActorKind;
50
+ }>;
51
+ }>;
31
52
  /** イベントのキーの型と操作(編集のイベントでなければ null) */
32
53
  export declare function parseWebhookEvent(event: string): Readonly<{
33
54
  collection: string;
@@ -97,7 +118,7 @@ export type WebhookRecordData = Readonly<{
97
118
  }>;
98
119
  /** レコードのイベントの本文(timestamp はイベントの日時、データの変更は変更の一覧の記録の日時) */
99
120
  export type WebhookBody = WebhookMessage<WebhookRecordType, WebhookRecordData>;
100
- /** 名前つきのイベントの本文(顧客・取り込み・インストール・アプリのイベント。type は宣言の名前、例 customer.status_changed) */
121
+ /** 名前つきのイベントの本文(エンドユーザー・取り込み・インストール・アプリのイベント。type は宣言の名前、例 endUser.status_changed) */
101
122
  export type WebhookAppBody = WebhookMessage<WebhookEvent>;
102
123
  /** 送信の記録(event はイベントのキー、attempt は何回目の送信か、retryAt は次の再送の予定の日時、再送なしは null) */
103
124
  export type WebhookDelivery = Readonly<{
@@ -1,31 +1,29 @@
1
1
  import type { ErrorCode, ErrorParams } from './errors.js';
2
2
  import { type ContentAccess } from './permissions.js';
3
- import type { User } from './roles.js';
4
- /** コレクションの公開の管理(schema の Publishing と同じ値) */
5
- export type WorkflowPublishing = 'none' | 'draft' | 'review';
3
+ import type { Subject } from './principal.js';
6
4
  /** レコードの派生の状態 */
7
- export declare const RECORD_STATES: readonly ["draft", "returned", "review", "scheduled", "published"];
5
+ export declare const RECORD_STATES: readonly ["draft", "scheduled", "published"];
8
6
  export type RecordState = (typeof RECORD_STATES)[number];
9
- /** 公開中・予約のレコードの未公開の変更(none はなし、review はレビュー待ち) */
10
- export type RecordChanges = 'none' | 'draft' | 'review';
11
- /** レコードの操作(publish は公開・予約・再公開・変更の公開、unpublish は下書きに戻す・予約の取り消し、discard は未公開の変更の破棄) */
12
- export declare const RECORD_ACTIONS: readonly ["save", "submit", "reject", "publish", "unpublish", "discard", "delete", "assign"];
7
+ /** 公開中・予約のレコードの未公開の変更(none はなし) */
8
+ export type RecordChanges = 'none' | 'draft';
9
+ /**
10
+ * レコードの操作(edit は編集の画面で値を変えられるか。判定は save と同じ)
11
+ * - publish は公開・予約・再公開・変更の公開、unpublish は予約の取り消しか下書きに戻す、discard は未公開の変更の破棄
12
+ */
13
+ export declare const RECORD_ACTIONS: readonly ["edit", "save", "publish", "unpublish", "discard", "delete"];
13
14
  export type RecordAction = (typeof RECORD_ACTIONS)[number];
14
- /** 判定に使うレコードの値(API の形: has_draft・draft_status は未公開の変更、持ち主の項目と created_by を含む) */
15
+ /** 判定に使うレコードの値(API の形: has_draft は未公開の変更、持ち主の項目と created_by を含む) */
15
16
  export type RecordRow = ContentAccess & Readonly<{
16
- published_at?: unknown;
17
- review_note?: unknown;
17
+ scheduled_at?: unknown;
18
18
  has_draft?: unknown;
19
- draft_status?: unknown;
20
19
  }>;
21
- type Subject = Pick<User, 'permissions' | 'id' | 'recordId' | 'link'>;
22
- /** 判定の材料(target はコレクションの id、now は ISO の日時) */
20
+ /** 判定の材料(publication は公開の管理があるコレクションか、target はコレクションの id、acceptsDrafts は公開が承認の人の、公開中のレコードの編集中の版を受け付けるか) */
23
21
  export type RecordGuardInput = Readonly<{
24
- publishing: WorkflowPublishing;
22
+ publication: boolean;
23
+ acceptsDrafts: boolean;
25
24
  user: Subject;
26
25
  target: string;
27
26
  row: RecordRow;
28
- now: string;
29
27
  }>;
30
28
  /** 判定の結果(拒否はエラーのコードと引数) */
31
29
  export type RecordGuard = {
@@ -36,14 +34,13 @@ export type RecordGuard = {
36
34
  params?: ErrorParams;
37
35
  };
38
36
  /** レコードの派生の状態と未公開の変更 */
39
- export declare function recordStateOf(row: RecordRow, now: string): {
37
+ export declare function recordStateOf(row: RecordRow): {
40
38
  state: RecordState;
41
39
  changes: RecordChanges;
42
40
  };
43
41
  /** 公開中か予約の状態か */
44
42
  export declare const isLiveState: (state: RecordState) => boolean;
45
43
  /** レコードの操作の可否 */
46
- export declare function recordGuard({ publishing, user, target, row, now }: RecordGuardInput, action: RecordAction): RecordGuard;
44
+ export declare function recordGuard({ publication, acceptsDrafts, user, target, row }: RecordGuardInput, action: RecordAction): RecordGuard;
47
45
  /** レコードに許される操作(RECORD_ACTIONS の順) */
48
46
  export declare const recordActions: (input: RecordGuardInput) => RecordAction[];
49
- export {};
@@ -1,8 +1,10 @@
1
1
  import type { AppBase } from './appDefinition.js';
2
- import type { AppSettingDef } from './appDependencies.js';
3
- import type { ConnectionPoint, PermissionTarget } from './apps.js';
4
- /** 標準の機能の1つの状態(API /api/apps/standard の行、標準の機能の並びの順) */
5
- export type StandardAppState = Readonly<{
2
+ import type { AppCollection, AppSettingDef } from './appDependencies.js';
3
+ import type { AppInboundUrl } from './appInbound.js';
4
+ import type { AppSecretDeclaration } from './appSecrets.js';
5
+ import type { CollectionMappings, ConnectionPoint, InstallationRelations, PermissionTarget } from './apps.js';
6
+ /** 標準の機能の1つの状態(API /api/standard-apps の行、標準の機能の並びの順) */
7
+ export type StandardAppState = InstallationRelations & Readonly<{
6
8
  id: string;
7
9
  label: string;
8
10
  description: string;
@@ -10,17 +12,31 @@ export type StandardAppState = Readonly<{
10
12
  required: boolean;
11
13
  /** この環境に入れたか(入れていなければ追加の候補) */
12
14
  installed: boolean;
15
+ /** インストールの ID(入れていなければ null。秘密値の API の経路に使う) */
16
+ installationId: string | null;
13
17
  enabled: boolean;
14
18
  permissions: readonly PermissionTarget[];
19
+ /** 追加のときと入れた後に当て先を選ぶコレクション(マニフェストの collections) */
20
+ collections: readonly AppCollection[];
21
+ /** 当てたコレクション(入れていないか、当てていなければ空。プロジェクトと環境の作成で入れたアプリは当てずに入る) */
22
+ mapped: CollectionMappings;
23
+ /** 当てる宣言(existing)の当て先を選ばないと進めないか(サーバーの判定。追加では任意、入れた後の選び直しでは必須) */
24
+ mappingRequired: boolean;
15
25
  /** 必要な外部の接続と、接続済みか */
16
26
  connections: readonly (ConnectionPoint & Readonly<{
17
27
  connected: boolean;
18
28
  }>)[];
19
29
  settingFields: readonly AppSettingDef[];
30
+ /** マニフェストの秘密値の宣言(入力は設定のページの共通のフォーム) */
31
+ secrets: readonly AppSecretDeclaration[];
32
+ /** マニフェストの inbound の宣言ごとの受信の URL(入れていなければ空。外のサービスの管理画面に貼る) */
33
+ inbound: readonly AppInboundUrl[];
20
34
  /** 設定のページで編集する項目の現在値(キーは settingFields の key) */
21
35
  settings: Readonly<Record<string, unknown>>;
22
36
  /** 設定値の入力(画面で保存した値、ワークスペース・MCP が manifest.settings で解釈) */
23
37
  settingsInput: Readonly<Record<string, unknown>>;
38
+ /** マニフェストの画面のうち、呼んだ主体に見えるものの key(判定はサーバー) */
39
+ uiVisible: readonly string[];
24
40
  /** サーバーの側が追加するもの(定期の処理・記事の規則は表示名) */
25
41
  adds: Readonly<{
26
42
  jobs: readonly string[];
@@ -28,13 +44,13 @@ export type StandardAppState = Readonly<{
28
44
  delivery: boolean;
29
45
  }>;
30
46
  }>;
31
- /** 標準の機能の切り替えと設定の保存(PUT /api/apps/standard/:id の本文) */
47
+ /** 標準の機能の切り替えと設定の保存(PUT /api/standard-apps/:id の本文) */
32
48
  export type StandardAppUpdate = Readonly<{
33
49
  enabled?: boolean;
34
50
  settings?: Readonly<Record<string, unknown>>;
35
51
  }>;
36
52
  /**
37
- * カレンダーの予定(API /api/calendar の行、at は ISO 8601、path はワークスペースの経路)
53
+ * カレンダーの予定(API /api/apps/content/calendar の行、at は ISO 8601、path はワークスペースの経路)
38
54
  * - source: 記事の公開は core、設定で掲載する日付のフィールドは calendarFieldSource
39
55
  */
40
56
  export type CalendarItem = Readonly<{
@@ -52,7 +68,7 @@ export type CalendarField = Readonly<{
52
68
  /** 日付のフィールドの予定が持つ source(`field:<コレクション>.<フィールド>`) */
53
69
  export declare const calendarFieldSource: (f: CalendarField) => string;
54
70
  /**
55
- * 対応待ちの行(API /api/inbox の items)
71
+ * 対応待ちの行(API /api/inbox の data)
56
72
  * - kind: レビュー待ちは review、承認待ちは request、アプリはその id
57
73
  * - type: 対象のコレクションの id(件数だけのレコードは null)
58
74
  * - title: 対象の名前で件数だけの行は null、count: 件数で1件の行は1
@@ -1,4 +1,4 @@
1
- /** ワークスペースのコレクションの経路(URL はレコードのスラッグ、record を省くと一覧) */
1
+ /** ワークスペースのコレクションの経路(コレクションはスラッグ、レコードは UUID、record を省くと一覧) */
2
2
  export declare const workspaceRecordPath: (collection: Readonly<{
3
3
  slug: string;
4
4
  }>, record?: Readonly<Record<string, unknown>>) => string;
@@ -27,4 +27,4 @@ export type HtmlResult<M> = Readonly<{
27
27
  dropped: readonly Dropped[];
28
28
  }>;
29
29
  /** HTML を本文に(コピーできないものは dropped) */
30
- export declare function bodyFromHtml<M>(html: string, options: HtmlOptions<M>): HtmlResult<M>;
30
+ export declare function richTextFromHtml<M>(html: string, options: HtmlOptions<M>): HtmlResult<M>;
@@ -4,16 +4,17 @@ export { DESCRIPTION_MAX, descriptionOf } from './description.js';
4
4
  export { citesOf, excerptOf, linksOf, plainOf, READING_SPEED, readMinOf } from './derive.js';
5
5
  export { CORE_COMPONENTS, coreComponentOf, type Chart, type ChartColor, type ChartDatum, type ComponentName, type ComponentProps, type CoreComponent } from './library.js';
6
6
  export { isSafeHref } from './href.js';
7
- export { bodyFromHtml, type Dropped, type HtmlOptions, type HtmlResult } from './html.js';
7
+ export { richTextFromHtml, type Dropped, type HtmlOptions, type HtmlResult } from './html.js';
8
8
  export { EMBED_FRAME_ORIGINS, EMBED_PROVIDERS, embedOfUrl, embedSrcOf, type EmbedProvider, type EmbedTarget } from './embed.js';
9
9
  export { fromMarkdown, toMarkdown, type MarkdownOptions } from './markdown.js';
10
- export { checkBody, describeMarkdown, isSafeCssValue, type BodyProfile, type NamedStyle, type NamedValue } from './profile.js';
11
- export { bodyToHtml, type RenderedImage, type RenderOptions } from './render.js';
10
+ export { checkRichText, describeMarkdown, isSafeCssValue, type RichTextProfile, type NamedStyle, type NamedValue } from './profile.js';
11
+ export { richTextToHtml, type RenderedImage, type RenderOptions } from './render.js';
12
12
  export { blockSchemaOf } from './schema.js';
13
+ export { mapBodyMedia } from './media.js';
13
14
  export { sortMarks } from './inline.js';
14
15
  export { normalizeRich } from './normalize.js';
15
- export { bodyFromMarkdown, bodyToMarkdown, markdownGuide, type MarkdownResult, type MediaSyntax } from './standard.js';
16
+ export { richTextFromMarkdown, richTextToMarkdown, markdownGuide, type MarkdownResult, type MediaSyntax } from './standard.js';
16
17
  export { ALIGNS, cellParagraphs, IMAGE_ALIGNS, isTableCell, STYLE_KINDS, type StyleKind, type Align, type Block, type Body, type Cell, type ComponentBlock, type HeadingLevel, type ImageAlign, type Inline, type InlineComponent, type Link, type List, type ListItem, type Mark, type Named, type Rich, type StandardBlock, type TableCell, type Text, type TextStyle } from './types.js';
17
- export { BODY_PROBLEM_MESSAGES } from './labels/ja.js';
18
- export { type BodyProblemCode, bodyProblemText } from './problems.js';
19
- export { BODY_PROBLEM_MESSAGES_EN } from './labels/en.js';
18
+ export { RICH_TEXT_PROBLEM_MESSAGES } from './labels/ja.js';
19
+ export { type RichTextProblemCode, richTextProblemText } from './problems.js';
20
+ export { RICH_TEXT_PROBLEM_MESSAGES_EN } from './labels/en.js';
@@ -1,5 +1,5 @@
1
1
  /** 本文の検査の問題の英語の文 */
2
- export declare const BODY_PROBLEM_MESSAGES_EN: {
2
+ export declare const RICH_TEXT_PROBLEM_MESSAGES_EN: {
3
3
  readonly inline_component_here: "Inline components cannot be used here";
4
4
  readonly inline_component_unavailable: "Inline component {name} cannot be used";
5
5
  readonly marks_here: "Marks and links cannot be used here";
@@ -1,5 +1,5 @@
1
1
  /** 本文の検査の問題の文 */
2
- export declare const BODY_PROBLEM_MESSAGES: {
2
+ export declare const RICH_TEXT_PROBLEM_MESSAGES: {
3
3
  readonly drop_attribute: "属性 {name}";
4
4
  readonly drop_style: "style の {key}";
5
5
  readonly drop_style_value: "style の {key} の値";
@@ -116,7 +116,7 @@ export declare const BODY_GUIDE_LABELS: {
116
116
  readonly markSyntax: "{mark, select, strong {**太字**} em {*斜体*} code {`コード`} strike {~~取り消し線~~} mark {:mark[蛍光ペン]} sup {:sup[上付き]} sub {:sub[下付き]} other {:u[下線]}}";
117
117
  readonly styleValue: "{key}=\"CSS の値\"";
118
118
  readonly styleNames: "styles=\"{names}\" のどれか(空白で区切る)";
119
- readonly textStyle: "- 文字の見た目: :span[文字]'{'属性'}'(属性: {attrs})";
119
+ readonly text_style: "- 文字の見た目: :span[文字]'{'属性'}'(属性: {attrs})";
120
120
  readonly link: "- リンク: [文字](https://…){rels, select, none {} other {、rel つきは :link[文字]'{'href=\"https://…\" rel={rels}'}'}}{target, select, yes {、別のタブは :link[文字]'{'href=\"https://…\" target=_blank'}'} other {}}{combine, select, no {(装飾つきは不可)} other {}}";
121
121
  readonly component: "- {inline, select, yes {インラインの} other {}}コンポーネント {name}: {description}";
122
122
  readonly componentExample: " 例: {example}";
@@ -60,7 +60,7 @@ export type ComponentProps<M> = Readonly<{
60
60
  }>;
61
61
  gallery: Readonly<{
62
62
  items: readonly Readonly<{
63
- media: M;
63
+ file: M;
64
64
  caption?: string;
65
65
  }>[];
66
66
  }>;
@@ -0,0 +1,2 @@
1
+ /** 本文の画像とファイルの参照を置き換えた値(形の合わないブロックはそのまま) */
2
+ export declare function mapBodyMedia(body: unknown, map: (media: unknown) => unknown): unknown;
@@ -2,4 +2,4 @@ import { type Body, type Rich } from './types.js';
2
2
  /** インラインの断片の列を正規化 */
3
3
  export declare function normalizeRich(rich: Rich): Rich;
4
4
  /** 本文を正規化 */
5
- export declare function normalizeBody<M>(body: Body<M>): Body<M>;
5
+ export declare function normalizeRichText<M>(body: Body<M>): Body<M>;
@@ -1,9 +1,9 @@
1
1
  import { type ParamsArg } from '../../i18n/src/index.js';
2
- import { BODY_GUIDE_LABELS, BODY_PROBLEM_MESSAGES, CORE_COMPONENT_LABELS } from './labels/ja.js';
3
- type Messages = typeof BODY_PROBLEM_MESSAGES;
4
- export type BodyProblemCode = keyof Messages;
2
+ import { BODY_GUIDE_LABELS, RICH_TEXT_PROBLEM_MESSAGES, CORE_COMPONENT_LABELS } from './labels/ja.js';
3
+ type Messages = typeof RICH_TEXT_PROBLEM_MESSAGES;
4
+ export type RichTextProblemCode = keyof Messages;
5
5
  /** 本文の検査の問題を作る */
6
- export declare const bodyProblem: import("../../i18n/src/index.js").ProblemFactory<{
6
+ export declare const richTextProblem: import("../../i18n/src/index.js").ProblemFactory<{
7
7
  readonly drop_attribute: "属性 {name}";
8
8
  readonly drop_style: "style の {key}";
9
9
  readonly drop_style_value: "style の {key} の値";
@@ -93,7 +93,7 @@ export declare const bodyProblem: import("../../i18n/src/index.js").ProblemFacto
93
93
  readonly block_problem: "{index}番目のブロック: {problem}";
94
94
  }>;
95
95
  /** 問題の英語の既定の文(zod の message と検査の issues に入れ、problemOf で戻す) */
96
- export declare const bodyProblemText: <K extends BodyProblemCode>(code: K, ...params: ParamsArg<Messages[K]>) => string;
96
+ export declare const richTextProblemText: <K extends RichTextProblemCode>(code: K, ...params: ParamsArg<Messages[K]>) => string;
97
97
  type Guide = typeof BODY_GUIDE_LABELS;
98
98
  /** Markdown の説明の文言 */
99
99
  export declare const guideText: <K extends keyof Guide>(key: K, ...params: ParamsArg<Guide[K]>) => string;
@@ -1,19 +1,19 @@
1
1
  import type { ComponentDef } from './components.js';
2
2
  import { type Body, type HeadingLevel, type Mark } from './types.js';
3
3
  /** 本文の設定 */
4
- export type BodyProfile = Readonly<{
4
+ export type RichTextProfile = Readonly<{
5
5
  headings: readonly HeadingLevel[];
6
6
  marks: readonly Mark[];
7
7
  /** 装飾の重ね掛けと装飾つきのリンク(既定は可) */
8
- combineMarks?: boolean;
8
+ combine_marks?: boolean;
9
9
  /** リンクの rel(なしは rel なしのリンクだけ) */
10
- linkRels?: readonly string[];
10
+ link_rels?: readonly string[];
11
11
  /** 装飾・リンク・インラインのコンポーネントを使用できない場所 */
12
- plain?: readonly ('heading' | 'tableHead')[];
12
+ plain?: readonly ('heading' | 'table_head')[];
13
13
  /** リンクを別のタブで開く指定(既定は不可) */
14
- linkTargets?: true;
14
+ link_targets?: true;
15
15
  /** 文字の見た目(色・背景・大きさは名前の宣言、項目がないものは使用不可、styles は名前のついた装飾の宣言) */
16
- textStyle?: Readonly<{
16
+ text_style?: Readonly<{
17
17
  color?: readonly NamedValue[];
18
18
  background?: readonly NamedValue[];
19
19
  size?: readonly NamedValue[];
@@ -34,7 +34,7 @@ export type BodyProfile = Readonly<{
34
34
  code?: Readonly<{
35
35
  caption: boolean;
36
36
  filename?: boolean;
37
- componentLangs?: Readonly<Record<string, string>>;
37
+ component_langs?: Readonly<Record<string, string>>;
38
38
  }>;
39
39
  /** 画像(link は画像のリンク、align は横の位置) */
40
40
  image?: Readonly<{
@@ -67,14 +67,14 @@ export type NamedStyle = Readonly<{
67
67
  label: string;
68
68
  }>;
69
69
  /** 本文の設定に合わない箇所(index は本文のブロックの位置、0から) */
70
- type BodyProblem = Readonly<{
70
+ type RichTextProblem = Readonly<{
71
71
  index: number;
72
72
  message: string;
73
73
  }>;
74
74
  /** 元の CSS の値として描画してよいか(kind は色か大きさ) */
75
75
  export declare const isSafeCssValue: (kind: "color" | "background" | "size", value: string) => boolean;
76
76
  /** 本文を設定で検査(合わない箇所をすべて返却) */
77
- export declare function checkBody<M>(body: Body<M>, profile: BodyProfile): BodyProblem[];
77
+ export declare function checkRichText<M>(body: Body<M>, profile: RichTextProfile): RichTextProblem[];
78
78
  /** 書き手と AI への Markdown の説明(使用できるものを記法の例つきで列挙し、使用できないものは末尾、mediaExample は画像の参照の例) */
79
- export declare function describeMarkdown<M>(profile: BodyProfile, components?: readonly ComponentDef<M>[], mediaExample?: string): string;
79
+ export declare function describeMarkdown<M>(profile: RichTextProfile, components?: readonly ComponentDef<M>[], mediaExample?: string): string;
80
80
  export {};
@@ -26,4 +26,4 @@ export type RenderOptions<M> = Readonly<{
26
26
  allowHtml?: boolean;
27
27
  }>;
28
28
  /** 本文を HTML に */
29
- export declare function bodyToHtml<M>(body: Body<M>, options: RenderOptions<M>): string;
29
+ export declare function richTextToHtml<M>(body: Body<M>, options: RenderOptions<M>): string;
@@ -1,6 +1,6 @@
1
1
  import { z } from 'zod';
2
2
  import { type DeclaredComponent } from './declared.js';
3
- import { type BodyProfile } from './profile.js';
3
+ import { type RichTextProfile } from './profile.js';
4
4
  import { type Block } from './types.js';
5
5
  /** 本文の1ブロックの検査(profile は本文の設定、media は画像の参照の検査、declared は導入先が宣言した部品) */
6
- export declare function blockSchemaOf<M>(profile: BodyProfile, media: z.ZodType<M>, declared?: readonly DeclaredComponent[]): z.ZodType<Block<M>>;
6
+ export declare function blockSchemaOf<M>(profile: RichTextProfile, media: z.ZodType<M>, declared?: readonly DeclaredComponent[]): z.ZodType<Block<M>>;
@@ -1,6 +1,6 @@
1
1
  import { type DeclaredComponent } from './declared.js';
2
2
  import { type MarkdownOptions } from './markdown.js';
3
- import { type BodyProfile } from './profile.js';
3
+ import { type RichTextProfile } from './profile.js';
4
4
  import type { Body } from './types.js';
5
5
  /** 画像の参照と Markdown の文字列の変換(example は説明の例の参照) */
6
6
  export type MediaSyntax<M> = MarkdownOptions<M>['media'] & Readonly<{
@@ -13,8 +13,8 @@ export type MarkdownResult<M> = Readonly<{
13
13
  problems: readonly string[];
14
14
  }>;
15
15
  /** 本文を Markdown に(declared は導入先が宣言した部品) */
16
- export declare const bodyToMarkdown: <M>(body: Body<M>, media: MediaSyntax<M>, declared?: readonly DeclaredComponent[]) => string;
16
+ export declare const richTextToMarkdown: <M>(body: Body<M>, media: MediaSyntax<M>, declared?: readonly DeclaredComponent[]) => string;
17
17
  /** Markdown を本文に(解析できない・設定に合わない内容は problems、declared は導入先が宣言した部品) */
18
- export declare function bodyFromMarkdown<M>(markdown: string, profile: BodyProfile, media: MediaSyntax<M>, declared?: readonly DeclaredComponent[]): MarkdownResult<M>;
18
+ export declare function richTextFromMarkdown<M>(markdown: string, profile: RichTextProfile, media: MediaSyntax<M>, declared?: readonly DeclaredComponent[]): MarkdownResult<M>;
19
19
  /** 書き手と AI へ最初に提示する Markdown の説明(設定と核のコンポーネント・宣言した部品から作成) */
20
- export declare const markdownGuide: (profile: BodyProfile, media: Pick<MediaSyntax<unknown>, "example">, declared?: readonly DeclaredComponent[]) => string;
20
+ export declare const markdownGuide: (profile: RichTextProfile, media: Pick<MediaSyntax<unknown>, "example">, declared?: readonly DeclaredComponent[]) => string;
@@ -102,7 +102,7 @@ export type StandardBlock<M> = Readonly<{
102
102
  variant?: string;
103
103
  }> | Readonly<{
104
104
  type: 'image';
105
- media: M;
105
+ file: M;
106
106
  alt?: string;
107
107
  caption?: string;
108
108
  link?: Link;
@@ -116,7 +116,7 @@ export type StandardBlock<M> = Readonly<{
116
116
  variant?: string;
117
117
  }> | Readonly<{
118
118
  type: 'file';
119
- media: M;
119
+ file: M;
120
120
  label?: string;
121
121
  }> | Readonly<{
122
122
  type: 'divider';
@@ -6,10 +6,8 @@ export type AudienceHistoryEntry = Readonly<{
6
6
  fieldType: string;
7
7
  audience: Audience;
8
8
  }>;
9
- /** 旧い形の入力か(どの項目にも audience がない、まとまりの中も) */
10
- export declare function isLegacyInput(json: unknown): boolean;
11
9
  /**
12
- * 読み替えた定義(最上位の項目は見える範囲を必ず持つ、旧い印を外す)
10
+ * 読み替えた定義(最上位の項目は見える範囲を必ず持つ)
13
11
  * - 実行の側(配信、判定、管理の API)と保存の検査が使う。保存の形と GET の応答は読み込んだ値のまま
14
12
  */
15
13
  export declare const resolvedSchema: (schema: CollectionSchema) => ResolvedSchema;
@@ -1,28 +1,19 @@
1
- import { type CollectionSchema, type Collection, type FieldDef } from './collection.js';
2
- /** 出典の項目と、内側の項目の key */
3
- export declare const SOURCES_FIELD: {
4
- readonly key: "sources";
5
- readonly source: "source";
6
- readonly note: "note";
7
- };
8
- /** 出典の項目の定義(参照の項目 source の参照先 to) */
9
- export type SourcesField = Extract<FieldDef, {
10
- type: 'group';
11
- }> & Readonly<{
12
- to: string;
1
+ import { type Collection, type CollectionSchema } from './collection.js';
2
+ export declare const COLLECTION_CAPABILITIES: readonly ["transactions", "history", "events", "publication", "trash"];
3
+ export type CollectionCapability = (typeof COLLECTION_CAPABILITIES)[number];
4
+ /** コレクションが持つ能力 */
5
+ export declare const capabilitiesOf: (collection: Collection) => CollectionCapability[];
6
+ export declare const hasCapability: (collection: Collection, capability: CollectionCapability) => boolean;
7
+ /** 宣言が頼る能力(宣言はコレクションの key) */
8
+ export type CapabilityNeed = Readonly<{
9
+ capability: CollectionCapability;
10
+ declaration: keyof Collection;
13
11
  }>;
14
- /** 主のコレクション(スキーマの順で先頭、なければ null) */
15
- export declare const primaryCollectionOf: (schema: CollectionSchema) => Collection | null;
16
- /** 主のコレクション(なければ例外: そのコレクションを前提にする画面・処理だけが使用) */
17
- export declare function requiredPrimaryCollectionOf(collectionSchema: CollectionSchema): Collection;
18
- /** 暦の日付(日付の役割の項目を持つ一覧のコレクションと項目の key、スキーマの順、役割は宣言だけで推測なし) */
19
- export declare const dateRoleFieldsOf: (schema: CollectionSchema) => {
20
- collection: string;
21
- field: string;
22
- }[];
23
- /** コレクションの出典の項目(なければ null) */
24
- export declare function sourcesFieldOf(collection: Pick<Collection, 'fields'>): SourcesField | null;
25
- /** 出典のコレクション(出典の項目の参照先でスキーマの順で先頭、なければ null) */
26
- export declare function sourceCollectionOf(schema: CollectionSchema): Collection | null;
27
- /** 出典の値にある参照の ID(注の順、空と形の誤りは除外) */
28
- export declare const sourceIdsOf: (value: unknown) => string[];
12
+ /** コレクションの宣言が頼る能力(公開の前の検査 publish_checks は公開) */
13
+ export declare const requiredCapabilities: (collection: Collection) => CapabilityNeed[];
14
+ /** 能力のないコレクションに頼る宣言(スキーマの順) */
15
+ export type MissingCapability = CapabilityNeed & Readonly<{
16
+ collection: Collection;
17
+ }>;
18
+ /** 宣言が頼るのにコレクションが持たない能力(なければ空) */
19
+ export declare const missingCapabilities: (schema: CollectionSchema) => MissingCapability[];
@@ -4,9 +4,10 @@ import { type CollectionSchema } from './collection.js';
4
4
  /** 変更の扱い */
5
5
  export type ChangeLevel = 'safe' | 'confirm' | 'forbidden';
6
6
  /** 変更の種類 */
7
- export type ChangeKind = 'collection-added' | 'collection-removed' | 'collection-slug-changed' | 'collection-changed' | 'customer-ops-added' | 'retention-shortened' | 'format-changed' | 'publishing-changed' | 'publishing-removed' | 'fixed-changed' | 'field-added' | 'field-removed' | 'field-changed' | 'field-type-changed' | 'field-key-reused' | 'audience-widened' | 'pii-narrowed' | 'confidential-key-reused' | 'required-added' | 'constraint-tightened' | 'option-added' | 'option-removed' | 'component-added' | 'component-changed' | 'component-removed';
7
+ export type ChangeKind = 'collection-added' | 'collection-removed' | 'collection-slug-changed' | 'collection-changed' | 'end-user-ops-added' | 'form-opened' | 'retention-shortened' | 'format-changed' | 'kind-changed' | 'publication-added' | 'publication-removed' | 'fixed-changed' | 'field-added' | 'field-removed' | 'field-changed' | 'field-key-changed' | 'field-managed-changed' | 'field-type-changed' | 'field-key-reused' | 'audience-widened' | 'pii-narrowed' | 'confidential-key-reused' | 'required-added' | 'constraint-tightened' | 'option-added' | 'option-removed' | 'component-added' | 'component-changed' | 'component-removed';
8
8
  /**
9
9
  * スキーマの1つの変更(id は確認と置き換え先の指定で使用する識別子、path は項目の key を `.` で連結、value は削除した選択肢の値・コレクションの旧いスラッグ)
10
+ * - readded: 過去の版にある id のコレクションの追加
10
11
  * - code・params: 文言の表 labels/ja.ts のキーと差し込み(画面はこれで引く)、message は英語の文
11
12
  */
12
13
  export type SchemaChange = Readonly<{
@@ -20,6 +21,7 @@ export type SchemaChange = Readonly<{
20
21
  params?: Problem['params'];
21
22
  message: string;
22
23
  widening?: AudienceWidening;
24
+ readded?: true;
23
25
  }>;
24
26
  /**
25
27
  * 差分の条件