@tunasand/sdk 0.7.0 → 0.11.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 (285) hide show
  1. package/CHANGELOG.md +233 -88
  2. package/README.md +296 -273
  3. package/dist/analytics.js +657 -10
  4. package/dist/app.js +323 -96
  5. package/dist/apps-DIxAWBSZ.js +318 -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-Dv4NxGZ7.js +81 -0
  14. package/dist/bridge.js +2 -14
  15. package/dist/build-file-DNi0PHC5.js +31 -0
  16. package/dist/cli.js +6214 -9
  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-nUz1RetA.js +264 -0
  22. package/dist/{declared-C_GvPiGF.js → declared-CE4a61qb.js} +124 -36
  23. package/dist/delivery.js +124 -132
  24. package/dist/dev-operations-Tutwi1On.js +46 -0
  25. package/dist/dev.js +9 -16
  26. package/dist/embeds-B-Dbn64k.js +29 -0
  27. package/dist/end-users.d.ts +1 -0
  28. package/dist/end-users.js +185 -0
  29. package/dist/{customers-C_vJY2_v.js → endUsers-DODfjnv1.js} +31 -38
  30. package/dist/{errorLabels-CPKiPabZ.js → errorLabels-aT2bnMsO.js} +593 -460
  31. package/dist/i18n.js +4 -4
  32. package/dist/ids-DmtIoqBX.js +109 -0
  33. package/dist/integrations.js +95 -49
  34. package/dist/{ja-C6lX0CeJ.js → ja-CrY_72Tn.js} +99 -54
  35. package/dist/{ja-C1HEWWTQ.js → ja-axQPxMJ-.js} +6 -6
  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-E_cYgZx-.js → page-yo1cw1kW.js} +5 -5
  40. package/dist/preview.js +8 -1
  41. package/dist/{profile-D6t1QMQh.js → profile-DBsXLvvI.js} +52 -52
  42. package/dist/rich-text.d.ts +1 -0
  43. package/dist/{body.js → rich-text.js} +20 -21
  44. package/dist/schema-Dcg1ajnW.js +1267 -0
  45. package/dist/schema.js +324 -1
  46. package/dist/types/access/src/handoff.d.ts +22 -17
  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/jwt.d.ts +1 -1
  50. package/dist/types/access/src/oidc.d.ts +11 -3
  51. package/dist/types/access/src/signed.d.ts +0 -2
  52. package/dist/types/adapter-cloudflare/src/eventLog/viewSchema.d.ts +11 -0
  53. package/dist/types/contract/src/accountProfile.d.ts +7 -0
  54. package/dist/types/{cms-contract → contract}/src/apiKeys.d.ts +7 -3
  55. package/dist/types/contract/src/app.d.ts +38 -0
  56. package/dist/types/contract/src/appChannels.d.ts +114 -0
  57. package/dist/types/contract/src/appDefinition.d.ts +133 -0
  58. package/dist/types/{cms-contract → contract}/src/appDependencies.d.ts +91 -35
  59. package/dist/types/contract/src/appIdentities.d.ts +21 -0
  60. package/dist/types/contract/src/appInbound.d.ts +28 -0
  61. package/dist/types/contract/src/appMail.d.ts +106 -0
  62. package/dist/types/contract/src/appSecrets.d.ts +45 -0
  63. package/dist/types/contract/src/appServer.d.ts +501 -0
  64. package/dist/types/contract/src/approvalLabels.d.ts +26 -0
  65. package/dist/types/contract/src/approvals.d.ts +63 -0
  66. package/dist/types/contract/src/apps.d.ts +295 -0
  67. package/dist/types/contract/src/auditActions.d.ts +18 -0
  68. package/dist/types/contract/src/auditLabels.d.ts +223 -0
  69. package/dist/types/contract/src/authorize.d.ts +133 -0
  70. package/dist/types/{cms-contract → contract}/src/bridge.d.ts +39 -40
  71. package/dist/types/{cms-contract → contract}/src/consents.d.ts +32 -25
  72. package/dist/types/contract/src/deletion.d.ts +18 -0
  73. package/dist/types/contract/src/embeds.d.ts +105 -0
  74. package/dist/types/{cms-contract/src/customerLabels.d.ts → contract/src/endUserLabels.d.ts} +6 -9
  75. package/dist/types/contract/src/endUsers.d.ts +241 -0
  76. package/dist/types/{cms-contract → contract}/src/errorLabels.d.ts +76 -47
  77. package/dist/types/{cms-contract → contract}/src/errorLabelsEn.d.ts +52 -36
  78. package/dist/types/contract/src/errors.d.ts +117 -0
  79. package/dist/types/contract/src/eventSchemas.d.ts +70 -0
  80. package/dist/types/contract/src/eventTraces.d.ts +43 -0
  81. package/dist/types/{cms-contract → contract}/src/failureStatus.d.ts +16 -23
  82. package/dist/types/contract/src/fieldAccess.d.ts +45 -0
  83. package/dist/types/contract/src/fieldRules.d.ts +41 -0
  84. package/dist/types/{cms-contract/src/assets.d.ts → contract/src/files.d.ts} +5 -5
  85. package/dist/types/contract/src/formLabels.d.ts +3 -0
  86. package/dist/types/contract/src/forms.d.ts +4 -0
  87. package/dist/types/{cms-contract → contract}/src/functions.d.ts +3 -3
  88. package/dist/types/contract/src/grants.d.ts +26 -0
  89. package/dist/types/contract/src/headers.d.ts +5 -0
  90. package/dist/types/contract/src/hostingRpc.d.ts +149 -0
  91. package/dist/types/contract/src/hostnames.d.ts +30 -0
  92. package/dist/types/contract/src/identifiers.d.ts +148 -0
  93. package/dist/types/contract/src/ids.d.ts +112 -0
  94. package/dist/types/{cms-contract → contract}/src/import.d.ts +20 -19
  95. package/dist/types/contract/src/importLabels.d.ts +3 -0
  96. package/dist/types/contract/src/index.d.ts +92 -0
  97. package/dist/types/contract/src/integrationGraph.d.ts +83 -0
  98. package/dist/types/{cms-contract → contract}/src/issueLabels.d.ts +135 -99
  99. package/dist/types/{cms-contract → contract}/src/issueLabelsEn.d.ts +70 -52
  100. package/dist/types/contract/src/labels.d.ts +11 -0
  101. package/dist/types/contract/src/legacyAuditLabels.d.ts +10 -0
  102. package/dist/types/contract/src/livePeriods.d.ts +18 -0
  103. package/dist/types/contract/src/manage.d.ts +51 -0
  104. package/dist/types/contract/src/manageLabels.d.ts +11 -0
  105. package/dist/types/contract/src/manifestText.d.ts +66 -0
  106. package/dist/types/contract/src/mcpAuth.d.ts +139 -0
  107. package/dist/types/contract/src/mcpLabels.d.ts +5 -0
  108. package/dist/types/contract/src/messagePort.d.ts +208 -0
  109. package/dist/types/{cms-contract → contract}/src/migration.d.ts +3 -3
  110. package/dist/types/contract/src/notices.d.ts +38 -0
  111. package/dist/types/contract/src/operatorOperations.d.ts +640 -0
  112. package/dist/types/contract/src/operators.d.ts +33 -0
  113. package/dist/types/contract/src/outbound.d.ts +29 -0
  114. package/dist/types/contract/src/paths.d.ts +34 -0
  115. package/dist/types/contract/src/pending.d.ts +6 -0
  116. package/dist/types/{cms-contract → contract}/src/permissions.d.ts +9 -11
  117. package/dist/types/contract/src/perspective.d.ts +26 -0
  118. package/dist/types/contract/src/powers.d.ts +5 -0
  119. package/dist/types/contract/src/principal.d.ts +181 -0
  120. package/dist/types/{cms-contract → contract}/src/problems.d.ts +4 -4
  121. package/dist/types/contract/src/projectRole.d.ts +6 -0
  122. package/dist/types/contract/src/recordLabels.d.ts +6 -0
  123. package/dist/types/{cms-contract → contract}/src/roles.d.ts +10 -6
  124. package/dist/types/contract/src/ruleLabels.d.ts +16 -0
  125. package/dist/types/contract/src/ruleProblems.d.ts +16 -0
  126. package/dist/types/contract/src/schemaLabels.d.ts +8 -0
  127. package/dist/types/{cms-contract → contract}/src/settingProblems.d.ts +3 -3
  128. package/dist/types/{cms-contract → contract}/src/settings.d.ts +6 -8
  129. package/dist/types/contract/src/settingsLabels.d.ts +3 -0
  130. package/dist/types/{cms-contract → contract}/src/siteDeclaration.d.ts +7 -7
  131. package/dist/types/contract/src/siteIndex.d.ts +76 -0
  132. package/dist/types/contract/src/slugs.d.ts +6 -0
  133. package/dist/types/{cms-contract → contract}/src/transfer.d.ts +4 -4
  134. package/dist/types/contract/src/trial.d.ts +13 -0
  135. package/dist/types/contract/src/versions.d.ts +7 -0
  136. package/dist/types/{analytics/src/view.d.ts → contract/src/viewEvent.d.ts} +0 -9
  137. package/dist/types/contract/src/webhooks.d.ts +135 -0
  138. package/dist/types/contract/src/workflow.d.ts +43 -0
  139. package/dist/types/contract/src/workspaceItems.d.ts +87 -0
  140. package/dist/types/contract/src/workspacePaths.d.ts +4 -0
  141. package/dist/types/{body → rich-text}/src/declared.d.ts +2 -2
  142. package/dist/types/{body → rich-text}/src/embed.d.ts +1 -1
  143. package/dist/types/{body → rich-text}/src/html.d.ts +1 -1
  144. package/dist/types/{body → rich-text}/src/index.d.ts +8 -7
  145. package/dist/types/{body → rich-text}/src/labels/en.d.ts +1 -1
  146. package/dist/types/{body → rich-text}/src/labels/ja.d.ts +4 -4
  147. package/dist/types/{body → rich-text}/src/library.d.ts +1 -1
  148. package/dist/types/rich-text/src/media.d.ts +2 -0
  149. package/dist/types/{body → rich-text}/src/normalize.d.ts +1 -1
  150. package/dist/types/{body → rich-text}/src/problems.d.ts +5 -5
  151. package/dist/types/{body → rich-text}/src/profile.d.ts +11 -11
  152. package/dist/types/{body → rich-text}/src/render.d.ts +1 -1
  153. package/dist/types/{body → rich-text}/src/schema.d.ts +2 -2
  154. package/dist/types/{body → rich-text}/src/standard.d.ts +4 -4
  155. package/dist/types/{body → rich-text}/src/types.d.ts +2 -2
  156. package/dist/types/schema/src/audience.d.ts +36 -0
  157. package/dist/types/schema/src/brand.d.ts +5 -0
  158. package/dist/types/schema/src/capabilities.d.ts +19 -0
  159. package/dist/types/{model → schema}/src/changes.d.ts +9 -7
  160. package/dist/types/{model → schema}/src/check.d.ts +2 -2
  161. package/dist/types/{model/src/model.d.ts → schema/src/collection.d.ts} +150 -121
  162. package/dist/types/schema/src/defaultSchema.d.ts +15 -0
  163. package/dist/types/schema/src/fieldIds.d.ts +18 -0
  164. package/dist/types/{model/src/asset.d.ts → schema/src/file.d.ts} +36 -25
  165. package/dist/types/schema/src/fileRefs.d.ts +14 -0
  166. package/dist/types/schema/src/fileSignature.d.ts +20 -0
  167. package/dist/types/schema/src/filesCollection.d.ts +7 -0
  168. package/dist/types/schema/src/forms.d.ts +43 -0
  169. package/dist/types/{model → schema}/src/image.d.ts +3 -3
  170. package/dist/types/schema/src/imageMetadata.d.ts +9 -0
  171. package/dist/types/schema/src/index.d.ts +35 -0
  172. package/dist/types/{model → schema}/src/input.d.ts +3 -3
  173. package/dist/types/{model → schema}/src/integrity.d.ts +9 -8
  174. package/dist/types/schema/src/kinds.d.ts +26 -0
  175. package/dist/types/{model → schema}/src/labels/en.d.ts +93 -51
  176. package/dist/types/{model → schema}/src/labels/ja.d.ts +97 -52
  177. package/dist/types/schema/src/mediaUrl.d.ts +60 -0
  178. package/dist/types/{model → schema}/src/page.d.ts +6 -6
  179. package/dist/types/{model → schema}/src/problems.d.ts +95 -53
  180. package/dist/types/{model → schema}/src/refs.d.ts +1 -10
  181. package/dist/types/{model → schema}/src/rules.d.ts +2 -2
  182. package/dist/types/{model → schema}/src/schema.d.ts +25 -20
  183. package/dist/types/schema/src/selfOps.d.ts +31 -0
  184. package/dist/types/{model/src/capabilities.d.ts → schema/src/traits.d.ts} +6 -6
  185. package/dist/types/schema/src/typesSource.d.ts +16 -0
  186. package/dist/types/{model → schema}/src/values.d.ts +7 -4
  187. package/dist/types/schema/src/widening.d.ts +3 -0
  188. package/dist/types/sdk/src/analytics.d.ts +3 -2
  189. package/dist/types/sdk/src/app.d.ts +70 -16
  190. package/dist/types/sdk/src/astro-image.d.ts +19 -0
  191. package/dist/types/sdk/src/astro-response.d.ts +6 -0
  192. package/dist/types/sdk/src/astro-server.d.ts +16 -0
  193. package/dist/types/sdk/src/astro.d.ts +19 -0
  194. package/dist/types/sdk/src/bridge.d.ts +13 -15
  195. package/dist/types/sdk/src/code.d.ts +61 -0
  196. package/dist/types/sdk/src/delegation.d.ts +49 -0
  197. package/dist/types/sdk/src/delivery/changes.d.ts +4 -4
  198. package/dist/types/sdk/src/delivery/client.d.ts +40 -28
  199. package/dist/types/sdk/src/delivery/fields.d.ts +5 -5
  200. package/dist/types/sdk/src/delivery/index.d.ts +3 -3
  201. package/dist/types/sdk/src/delivery/media.d.ts +8 -11
  202. package/dist/types/sdk/src/delivery/query.d.ts +16 -12
  203. package/dist/types/sdk/src/delivery/schema.d.ts +5 -5
  204. package/dist/types/sdk/src/delivery/values.d.ts +16 -20
  205. package/dist/types/sdk/src/delivery.d.ts +3 -3
  206. package/dist/types/sdk/src/dev-operations.d.ts +20 -0
  207. package/dist/types/sdk/src/dev.d.ts +6 -5
  208. package/dist/types/sdk/src/end-users.d.ts +190 -0
  209. package/dist/types/sdk/src/i18n.d.ts +11 -11
  210. package/dist/types/sdk/src/integrations.d.ts +20 -27
  211. package/dist/types/sdk/src/operations.d.ts +17 -0
  212. package/dist/types/sdk/src/preview.d.ts +2 -1
  213. package/dist/types/sdk/src/rich-text.d.ts +2 -0
  214. package/dist/types/sdk/src/schema.d.ts +5 -21
  215. package/dist/types/sdk/src/site/artifact.d.ts +64 -0
  216. package/dist/types/sdk/src/site/build-file.d.ts +30 -0
  217. package/dist/types/sdk/src/site/check-code.d.ts +14 -0
  218. package/dist/types/sdk/src/site/check-text.d.ts +19 -0
  219. package/dist/types/sdk/src/site/cli.d.ts +52 -0
  220. package/dist/types/sdk/src/site/content-type.d.ts +2 -0
  221. package/dist/types/sdk/src/site/labels.d.ts +14 -0
  222. package/dist/types/sdk/src/site.d.ts +1 -1
  223. package/dist/types/sdk/src/types.d.ts +21 -0
  224. package/dist/{schema-BPHL7Qr-.js → types-DkO2N7u2.js} +9 -9
  225. package/dist/types.d.ts +1 -0
  226. package/dist/types.js +1 -0
  227. package/dist/typesSource-VJIxtN9b.js +136 -0
  228. package/dist/workflow-CUpl6hO_.js +148 -0
  229. package/package.json +42 -16
  230. package/dist/apps-9u4XMi7E.js +0 -114
  231. package/dist/body.d.ts +0 -1
  232. package/dist/bridge-DYAYGV7t.js +0 -74
  233. package/dist/customers.d.ts +0 -1
  234. package/dist/customers.js +0 -185
  235. package/dist/embed-R-OvDYAw.js +0 -90
  236. package/dist/model-pmXzGX12.js +0 -152
  237. package/dist/model.d.ts +0 -1
  238. package/dist/model.js +0 -345
  239. package/dist/schema-UQJWRyfJ.js +0 -995
  240. package/dist/src-sazhzYui.js +0 -71
  241. package/dist/types/analytics/src/index.d.ts +0 -5
  242. package/dist/types/analytics/src/schedule.d.ts +0 -2
  243. package/dist/types/analytics/src/shared.d.ts +0 -21
  244. package/dist/types/analytics/src/source.d.ts +0 -19
  245. package/dist/types/analytics/src/store.d.ts +0 -24
  246. package/dist/types/cms-contract/src/app.d.ts +0 -35
  247. package/dist/types/cms-contract/src/apps.d.ts +0 -195
  248. package/dist/types/cms-contract/src/authorize.d.ts +0 -146
  249. package/dist/types/cms-contract/src/customers.d.ts +0 -266
  250. package/dist/types/cms-contract/src/embeds.d.ts +0 -165
  251. package/dist/types/cms-contract/src/errors.d.ts +0 -105
  252. package/dist/types/cms-contract/src/identifiers.d.ts +0 -117
  253. package/dist/types/cms-contract/src/paths.d.ts +0 -23
  254. package/dist/types/cms-contract/src/urlLabel.d.ts +0 -13
  255. package/dist/types/cms-contract/src/webhooks.d.ts +0 -139
  256. package/dist/types/model/src/audience.d.ts +0 -38
  257. package/dist/types/model/src/brand.d.ts +0 -25
  258. package/dist/types/model/src/index.d.ts +0 -26
  259. package/dist/types/model/src/legacy.d.ts +0 -2
  260. package/dist/types/model/src/media.d.ts +0 -5
  261. package/dist/types/model/src/mediaUrl.d.ts +0 -67
  262. package/dist/types/model/src/selfOps.d.ts +0 -30
  263. package/dist/types/model/src/typesSource.d.ts +0 -8
  264. package/dist/types/platform/src/defaultModel.d.ts +0 -8
  265. package/dist/types/sdk/src/body.d.ts +0 -2
  266. package/dist/types/sdk/src/customers.d.ts +0 -190
  267. package/dist/types/sdk/src/model.d.ts +0 -5
  268. package/dist/typesSource-bO0jFw1I.js +0 -88
  269. /package/dist/types/{cms-contract → contract}/src/appProblems.d.ts +0 -0
  270. /package/dist/types/{analytics → contract}/src/day.d.ts +0 -0
  271. /package/dist/types/{cms-contract → contract}/src/functionLabels.d.ts +0 -0
  272. /package/dist/types/{cms-contract → contract}/src/permissionLabels.d.ts +0 -0
  273. /package/dist/types/{cms-contract → contract}/src/siteArtifact.d.ts +0 -0
  274. /package/dist/types/{cms-contract → contract}/src/views.d.ts +0 -0
  275. /package/dist/types/{cms-contract → contract}/src/webhookLabels.d.ts +0 -0
  276. /package/dist/types/{body → rich-text}/src/components.d.ts +0 -0
  277. /package/dist/types/{body → rich-text}/src/derive.d.ts +0 -0
  278. /package/dist/types/{body → rich-text}/src/description.d.ts +0 -0
  279. /package/dist/types/{body → rich-text}/src/href.d.ts +0 -0
  280. /package/dist/types/{body → rich-text}/src/inline.d.ts +0 -0
  281. /package/dist/types/{body → rich-text}/src/markdown.d.ts +0 -0
  282. /package/dist/types/{model → schema}/src/contact.d.ts +0 -0
  283. /package/dist/types/{model → schema}/src/json.d.ts +0 -0
  284. /package/dist/types/{model → schema}/src/screens.d.ts +0 -0
  285. /package/dist/types/{model → schema}/src/time.d.ts +0 -0
@@ -1,8 +1,8 @@
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";
5
- /** スキーマと設定(schema はコンテンツスキーマ ContentModel・screens は画面設定 ScreenSettings の形、roles は管理者以外、views はチームのビュー) */
4
+ export declare const CONFIG_FORMAT = "tunasand-config";
5
+ /** スキーマと設定(schema は CollectionSchema・screens は画面設定 ScreenSettings の形、roles は管理者以外、views はチームのビュー) */
6
6
  export type ConfigBundle = Readonly<{
7
7
  format: typeof CONFIG_FORMAT;
8
8
  version: 1;
@@ -21,7 +21,7 @@ export type ConfigBundle = Readonly<{
21
21
  definition: ViewDefinition;
22
22
  roles: readonly string[];
23
23
  }>[];
24
- extensions: readonly Readonly<{
24
+ apps: readonly Readonly<{
25
25
  id: string;
26
26
  enabled: boolean;
27
27
  settings: Readonly<Record<string, unknown>>;
@@ -52,6 +52,6 @@ export type ConfigPreview = Readonly<{
52
52
  added: number;
53
53
  updated: number;
54
54
  }>;
55
- extensions: number;
55
+ apps: number;
56
56
  screens: boolean;
57
57
  }>;
@@ -0,0 +1,13 @@
1
+ /**
2
+ * 検証用のフラグのプロジェクトの CMS のホスト名の印(先頭のラベルの末尾)
3
+ * Tunasand が振るホスト名は `--` を含み、導入先が選ぶ名前とぶつからない(docs/specs/identifiers.md の「URL とホスト名」)
4
+ */
5
+ export declare const TRIAL_HOST_SUFFIX = "--trial";
6
+ /** 検証用のフラグのプロジェクトの送信が届くホスト名の印(先頭のラベルが `<プロジェクトの ID>--trialsite`。CMS のホスト名と分ける) */
7
+ export declare const TRIAL_SITE_SUFFIX = "--trialsite";
8
+ /** 検証用のフラグのプロジェクトの CMS のホスト名か(先頭のラベルが `<名前>--trial`) */
9
+ export declare const isTrialHost: (host: string) => boolean;
10
+ /** テスト送信が届くホスト名か(先頭のラベルが `<名前>--trialsite`、CMS のホスト名に使えない) */
11
+ export declare const isTrialSiteHost: (host: string) => boolean;
12
+ /** プロジェクトのテスト送信が届くホスト名の先頭のラベル(`<プロジェクトの ID>--trialsite`、ID の base32) */
13
+ export declare const trialSiteLabel: (projectId: string) => string;
@@ -0,0 +1,7 @@
1
+ /** 公開の API の版(パス /v1) */
2
+ export declare const DELIVERY_VERSION = 1;
3
+ /** プロジェクトのデータの書き出しの形(JSON の行とファイルの中身のバンドル、書き出しの目録の format と version。実装は L の後) */
4
+ export declare const EXPORT_FORMAT: {
5
+ readonly name: "tunasand-export";
6
+ readonly version: 1;
7
+ };
@@ -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;
@@ -0,0 +1,135 @@
1
+ import type { ActorKind } from './identifiers.js';
2
+ /** 送れる操作(公開・非公開と、データの変更の作成・更新・削除) */
3
+ export declare const WEBHOOK_ACTIONS: readonly ["published", "unpublished", "created", "updated", "deleted"];
4
+ /** データの変更の操作(配信 API の変更の一覧と同じ記録から送る) */
5
+ export declare const WEBHOOK_CHANGE_ACTIONS: readonly ["created", "updated", "deleted"];
6
+ /** データの変更の操作 */
7
+ export type WebhookChangeAction = (typeof WEBHOOK_CHANGE_ACTIONS)[number];
8
+ /** 送れる操作 */
9
+ export type WebhookAction = (typeof WEBHOOK_ACTIONS)[number];
10
+ /** サーバーの内側のイベントのキー(編集のイベントは <コレクションの id>.<操作>、アプリのイベントは宣言の名前) */
11
+ export type WebhookEvent = `${string}.${string}`;
12
+ /** 購読するイベント(操作かアプリのイベントの名前) */
13
+ export type WebhookSubscription = WebhookAction | WebhookEvent;
14
+ /** データの変更の操作か */
15
+ export declare const isWebhookChangeAction: (value: string) => value is WebhookChangeAction;
16
+ /**
17
+ * インストールのイベント(購読によらず送る)
18
+ * - deleted: アンインストールの最後の知らせ。そのインストールの Webhook(止めた後も、このイベントだけ)と、アプリの削除のエンドポイントへ
19
+ */
20
+ export declare const INSTALLATION_EVENTS: {
21
+ readonly deleted: "installation.deleted";
22
+ };
23
+ /** アンインストールのイベントの値(インストールの ID と登録簿のアプリの ID、旧い形のインストールは null) */
24
+ export type InstallationDeletedData = Readonly<{
25
+ installation_id: string;
26
+ app_id: string | null;
27
+ }>;
28
+ /** 送れる操作か */
29
+ export declare const isWebhookAction: (value: string) => value is WebhookAction;
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
+ }>;
52
+ /** イベントのキーの型と操作(編集のイベントでなければ null) */
53
+ export declare function parseWebhookEvent(event: string): Readonly<{
54
+ collection: string;
55
+ action: WebhookAction;
56
+ }> | null;
57
+ /** イベントのキーの表示名(types はコレクションの id と表示名でコレクションの表示名と操作の表示名、appEvents はアプリのイベントの表示名) */
58
+ export declare function webhookEventLabel(event: string, collections: Readonly<Record<string, string>>, appEvents?: Readonly<Record<string, string>>): string;
59
+ /** 購読するイベントの表示名(操作かアプリのイベント) */
60
+ export declare const webhookSubscriptionLabel: (subscription: string, appEvents?: Readonly<Record<string, string>>) => string;
61
+ /** Webhook の形式 */
62
+ export type WebhookKind = 'json' | 'slack';
63
+ /**
64
+ * Webhook(url・secret は末尾だけを伏せずに返す、secret の null は署名なし)
65
+ * - installationId: 送り先を持つインストール(チャネルかアプリ)。なしは Webhook だけの旧い形のインストール
66
+ * - events: 購読するイベント(操作とアプリのイベント)、collections: 購読するコレクションの id(編集のイベントは events の操作 × collections)
67
+ * - previousSecret: 鍵の移行の期間の古い鍵の末尾、期間の外は null
68
+ * - sendOutsideLive: live 以外の環境でも送るか(既定は記録だけ。合成のデータの環境と、方針の無効な live では印があっても送らない)
69
+ * - lastStatus: 最新の送信で返った HTTP の状態、送れなかったときは0
70
+ */
71
+ export type Webhook = Readonly<{
72
+ id: string;
73
+ installationId: string | null;
74
+ label: string;
75
+ kind: WebhookKind;
76
+ url: string;
77
+ secret: string | null;
78
+ previousSecret: string | null;
79
+ events: readonly WebhookSubscription[];
80
+ collections: readonly string[];
81
+ enabled: boolean;
82
+ sendOutsideLive: boolean;
83
+ lastStatus: number | null;
84
+ lastAt: string | null;
85
+ }>;
86
+ /** レコードのイベントの短い名前(record.<操作>) */
87
+ export type WebhookRecordType = `record.${WebhookAction}`;
88
+ /** レコードのイベントの短い名前 */
89
+ export declare const webhookRecordTypeOf: (action: WebhookAction) => WebhookRecordType;
90
+ /**
91
+ * json の形式の本文(Standard Webhooks の形、署名は登録ごとの鍵)
92
+ * - type: イベントの短い名前、timestamp: イベントの日時(ISO 8601、再送しても同じ値)
93
+ * - 重複の除去はヘッダーの webhook-id(イベントの ID、全送り先と再送で同じ値)で行う
94
+ */
95
+ export type WebhookMessage<T extends string = string, D = Readonly<Record<string, unknown>>> = Readonly<{
96
+ type: T;
97
+ timestamp: string;
98
+ data: D;
99
+ }>;
100
+ /**
101
+ * レコードのイベントの data(編集とデータの変更で同じ形。識別の情報だけで、個人情報とレコードの中身は持たない)
102
+ * - environment: イベントを出した環境の ID(base32)
103
+ * - collection: コレクションの id とスラッグ(消したコレクションのスラッグは null)、record: レコードの id とイベントの時点のスラッグ
104
+ * - record.previous_slug: スラッグを変えた記録だけ、変更の前のスラッグ(サイトの旧い URL の転送に使う)
105
+ * - 受け手は配信 API で今の値を取り直す(順序の入れ替えに左右されない)。同期と突き合わせは id で(スラッグは変更でき、旧いスラッグを別のレコードが使える)
106
+ */
107
+ export type WebhookRecordData = Readonly<{
108
+ environment: string;
109
+ collection: Readonly<{
110
+ id: string;
111
+ slug: string | null;
112
+ }>;
113
+ record: Readonly<{
114
+ id: string;
115
+ slug: string;
116
+ previous_slug?: string;
117
+ }>;
118
+ }>;
119
+ /** レコードのイベントの本文(timestamp はイベントの日時、データの変更は変更の一覧の記録の日時) */
120
+ export type WebhookBody = WebhookMessage<WebhookRecordType, WebhookRecordData>;
121
+ /** 名前つきのイベントの本文(エンドユーザー・取り込み・インストール・アプリのイベント。type は宣言の名前、例 endUser.status_changed) */
122
+ export type WebhookAppBody = WebhookMessage<WebhookEvent>;
123
+ /** 送信の記録(event はイベントのキー、attempt は何回目の送信か、retryAt は次の再送の予定の日時、再送なしは null) */
124
+ export type WebhookDelivery = Readonly<{
125
+ id: number;
126
+ source: 'webhook' | 'function';
127
+ event: string;
128
+ status: number;
129
+ error: string | null;
130
+ eventId: string | null;
131
+ attempt: number;
132
+ retryAt: string | null;
133
+ label: string | null;
134
+ created_at: string;
135
+ }>;
@@ -0,0 +1,43 @@
1
+ import type { ErrorCode, ErrorParams } from './errors.js';
2
+ import { type ContentAccess } from './permissions.js';
3
+ import type { Subject } from './principal.js';
4
+ /** レコードの派生の状態 */
5
+ export declare const RECORD_STATES: readonly ["draft", "scheduled", "published"];
6
+ export type RecordState = (typeof RECORD_STATES)[number];
7
+ /** 公開中・予約のレコードの未公開の変更(none はなし) */
8
+ export type RecordChanges = 'none' | 'draft';
9
+ /** レコードの操作(publish は公開・予約・再公開・変更の公開、unpublish は予約の取り消しか下書きに戻す、discard は未公開の変更の破棄) */
10
+ export declare const RECORD_ACTIONS: readonly ["save", "publish", "unpublish", "discard", "delete"];
11
+ export type RecordAction = (typeof RECORD_ACTIONS)[number];
12
+ /** 判定に使うレコードの値(API の形: has_draft は未公開の変更、持ち主の項目と created_by を含む) */
13
+ export type RecordRow = ContentAccess & Readonly<{
14
+ scheduled_at?: unknown;
15
+ has_draft?: unknown;
16
+ }>;
17
+ /** 判定の材料(publication は公開の管理があるコレクションか、target はコレクションの id、acceptsDrafts は公開が承認の人の、公開中のレコードの編集中の版を受け付けるか) */
18
+ export type RecordGuardInput = Readonly<{
19
+ publication: boolean;
20
+ acceptsDrafts: boolean;
21
+ user: Subject;
22
+ target: string;
23
+ row: RecordRow;
24
+ }>;
25
+ /** 判定の結果(拒否はエラーのコードと引数) */
26
+ export type RecordGuard = {
27
+ ok: true;
28
+ } | {
29
+ ok: false;
30
+ code: Exclude<ErrorCode, 'network_error'>;
31
+ params?: ErrorParams;
32
+ };
33
+ /** レコードの派生の状態と未公開の変更 */
34
+ export declare function recordStateOf(row: RecordRow): {
35
+ state: RecordState;
36
+ changes: RecordChanges;
37
+ };
38
+ /** 公開中か予約の状態か */
39
+ export declare const isLiveState: (state: RecordState) => boolean;
40
+ /** レコードの操作の可否 */
41
+ export declare function recordGuard({ publication, acceptsDrafts, user, target, row }: RecordGuardInput, action: RecordAction): RecordGuard;
42
+ /** レコードに許される操作(RECORD_ACTIONS の順) */
43
+ export declare const recordActions: (input: RecordGuardInput) => RecordAction[];
@@ -0,0 +1,87 @@
1
+ import type { AppBase } from './appDefinition.js';
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<{
8
+ id: string;
9
+ label: string;
10
+ description: string;
11
+ /** 止められない標準の機能(レジストリの standard_apps の required) */
12
+ required: boolean;
13
+ /** この環境に入れたか(入れていなければ追加の候補) */
14
+ installed: boolean;
15
+ /** インストールの ID(入れていなければ null。秘密値の API の経路に使う) */
16
+ installationId: string | null;
17
+ enabled: boolean;
18
+ permissions: readonly PermissionTarget[];
19
+ /** 追加のときと入れた後に当て先を選ぶコレクション(マニフェストの collections) */
20
+ collections: readonly AppCollection[];
21
+ /** 当てたコレクション(入れていないか、当てていなければ空。プロジェクトと環境の作成で入れたアプリは当てずに入る) */
22
+ mapped: CollectionMappings;
23
+ /** 必要な外部の接続と、接続済みか */
24
+ connections: readonly (ConnectionPoint & Readonly<{
25
+ connected: boolean;
26
+ }>)[];
27
+ settingFields: readonly AppSettingDef[];
28
+ /** マニフェストの秘密値の宣言(入力は設定のページの共通のフォーム) */
29
+ secrets: readonly AppSecretDeclaration[];
30
+ /** マニフェストの inbound の宣言ごとの受信の URL(入れていなければ空。外のサービスの管理画面に貼る) */
31
+ inbound: readonly AppInboundUrl[];
32
+ /** 設定のページで編集する項目の現在値(キーは settingFields の key) */
33
+ settings: Readonly<Record<string, unknown>>;
34
+ /** 設定値の入力(画面で保存した値、ワークスペース・MCP が manifest.settings で解釈) */
35
+ settingsInput: Readonly<Record<string, unknown>>;
36
+ /** マニフェストの画面のうち、呼んだ主体に見えるものの key(判定はサーバー) */
37
+ uiVisible: readonly string[];
38
+ /** サーバーの側が追加するもの(定期の処理・記事の規則は表示名) */
39
+ adds: Readonly<{
40
+ jobs: readonly string[];
41
+ rules: readonly string[];
42
+ delivery: boolean;
43
+ }>;
44
+ }>;
45
+ /** 標準の機能の切り替えと設定の保存(PUT /api/standard-apps/:id の本文) */
46
+ export type StandardAppUpdate = Readonly<{
47
+ enabled?: boolean;
48
+ settings?: Readonly<Record<string, unknown>>;
49
+ }>;
50
+ /**
51
+ * カレンダーの予定(API /api/apps/content/calendar の行、at は ISO 8601、path はワークスペースの経路)
52
+ * - source: 記事の公開は core、設定で掲載する日付のフィールドは calendarFieldSource
53
+ */
54
+ export type CalendarItem = Readonly<{
55
+ source: string;
56
+ id: string;
57
+ title: string;
58
+ at: string;
59
+ path: string | null;
60
+ }>;
61
+ /** カレンダーに掲載する日付のフィールド(type はコレクションの id、field は最上位の date・datetime のフィールドのキー) */
62
+ export type CalendarField = Readonly<{
63
+ collection: string;
64
+ field: string;
65
+ }>;
66
+ /** 日付のフィールドの予定が持つ source(`field:<コレクション>.<フィールド>`) */
67
+ export declare const calendarFieldSource: (f: CalendarField) => string;
68
+ /**
69
+ * 対応待ちの行(API /api/inbox の items)
70
+ * - kind: レビュー待ちは review、承認待ちは request、アプリはその id
71
+ * - type: 対象のコレクションの id(件数だけのレコードは null)
72
+ * - title: 対象の名前で件数だけの行は null、count: 件数で1件の行は1
73
+ * - by: 提出・依頼した人、at: 最新の日時(UTC の ISO 8601)、path: ワークスペースの経路
74
+ */
75
+ export type PendingItem = Readonly<{
76
+ kind: string;
77
+ collection: string | null;
78
+ title: string | null;
79
+ count: number;
80
+ by: string | null;
81
+ at: string | null;
82
+ path: string | null;
83
+ }>;
84
+ /** 権限の対象の一覧(アプリの id つき、id の重複は例外) */
85
+ export declare function permissionTargetsOf(apps: readonly Pick<AppBase, 'id' | 'about'>[]): readonly (PermissionTarget & Readonly<{
86
+ app: string;
87
+ }>)[];
@@ -0,0 +1,4 @@
1
+ /** ワークスペースのコレクションの経路(URL はレコードのスラッグ、record を省くと一覧) */
2
+ export declare const workspaceRecordPath: (collection: Readonly<{
3
+ slug: string;
4
+ }>, record?: Readonly<Record<string, unknown>>) => string;
@@ -2,7 +2,7 @@ import { z } from 'zod';
2
2
  import { type ComponentDef } from './components.js';
3
3
  /** 引数の型 */
4
4
  export type PropType = 'string' | 'number' | 'integer' | 'boolean' | 'array' | 'object';
5
- /** 1つの引数の形(title は管理画面の項目名、enum は文字列の選択肢、items は配列の要素、properties・required はオブジェクトの中) */
5
+ /** 1つの引数の形(title はワークスペースの項目名、enum は文字列の選択肢、items は配列の要素、properties・required はオブジェクトの中) */
6
6
  export type PropSchema = Readonly<{
7
7
  type: PropType;
8
8
  title?: string;
@@ -18,7 +18,7 @@ export type PropsSchema = Readonly<{
18
18
  properties: Readonly<Record<string, PropSchema>>;
19
19
  required?: readonly string[];
20
20
  }>;
21
- /** 導入先が宣言する部品(label は管理画面の表示名、inline の省略はブロック) */
21
+ /** 導入先が宣言する部品(label はワークスペースの表示名、inline の省略はブロック) */
22
22
  export type DeclaredComponent = Readonly<{
23
23
  name: string;
24
24
  label: string;
@@ -10,7 +10,7 @@ export type EmbedTarget = Readonly<{
10
10
  }>;
11
11
  /** URL から埋め込み(埋め込めるサービスでなければ null) */
12
12
  export declare function embedOfUrl(raw: string): EmbedTarget | null;
13
- /** 描画の iframe のオリジン(embedSrcOf が組み立てる URL のオリジン、管理画面の CSP の frame-src) */
13
+ /** 描画の iframe のオリジン(embedSrcOf が組み立てる URL のオリジン、ワークスペースの CSP の frame-src) */
14
14
  export declare const EMBED_FRAME_ORIGINS: readonly ["https://www.youtube-nocookie.com", "https://player.vimeo.com", "https://platform.twitter.com", "https://www.instagram.com", "https://open.spotify.com", "https://embed.podcasts.apple.com"];
15
15
  /** 描画の iframe の URL(サービスと ID から組み立てる、X と Instagram は埋め込みのページ) */
16
16
  export declare function embedSrcOf(target: EmbedTarget): `https://${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}";
@@ -127,7 +127,7 @@ export declare const BODY_GUIDE_LABELS: {
127
127
  readonly separator: "・";
128
128
  readonly listSeparator: "、";
129
129
  };
130
- /** 核の部品の説明と例(library.ts、書き手と AI への説明と管理画面の部品の一覧) */
130
+ /** 核の部品の説明と例(library.ts、書き手と AI への説明とワークスペースの部品の一覧) */
131
131
  export declare const CORE_COMPONENT_LABELS: {
132
132
  readonly citeDescription: "注(参考資料の ID を参照、参考資料はコンテンツに結び付けが必要)";
133
133
  readonly citeExample: ":cite'{'#出典の ID'}'";
@@ -140,7 +140,7 @@ export declare const CORE_COMPONENT_LABELS: {
140
140
  readonly diagramDescription: "図(中は Mermaid、alt は図の内容の説明、caption は必須)";
141
141
  readonly diagramExample: ":::diagram'{'alt=\"内容の説明\" caption=\"説明\"'}'\n```mermaid\nflowchart LR\n A --> B\n```\n:::";
142
142
  readonly galleryDescription: "複数の画像を2列で配置(画像は2枚以上)";
143
- readonly galleryExample: ":::gallery\n![](asset/'<'画像の ID'>' \"説明\")\n\n![](asset/'<'画像の ID'>' \"説明\")\n:::";
143
+ readonly galleryExample: ":::gallery\n![](file/'<'画像の ID'>' \"説明\")\n\n![](file/'<'画像の ID'>' \"説明\")\n:::";
144
144
  readonly linkCardDescription: "リンクのカード(外のページは https と題名、site・desc・画像は任意。中のコンテンツは ref=\"コレクションの id/レコードの ID\")";
145
145
  readonly linkCardExample: ":::link-card'{'href=\"https://…\" title=\"ページの題\" site=\"サイト名\" desc=\"説明\"'}'\n:::";
146
146
  readonly embedDescription: "外のサービスの埋め込み(provider は {providers}、id はサービスの中の ID、url は元の URL、start は開始の秒)";
@@ -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<{
@@ -55,7 +55,7 @@ export type BodyProfile = Readonly<{
55
55
  /** 使用できるコンポーネントの名前(ブロック・インライン) */
56
56
  components: readonly string[];
57
57
  }>;
58
- /** 名前のついた値の宣言(label は管理画面の表示名、value はサイトが対応を持たないときの既定の CSS の値) */
58
+ /** 名前のついた値の宣言(label はワークスペースの表示名、value はサイトが対応を持たないときの既定の CSS の値) */
59
59
  export type NamedValue = Readonly<{
60
60
  name: string;
61
61
  label: string;
@@ -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';