@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
@@ -0,0 +1,114 @@
1
+ import type { AppSettingDef, AppSettingValue } from './appDependencies.js';
2
+ import { type AppIdentityDeclaration } from './appIdentities.js';
3
+ import { type AppInboundDeclaration } from './appInbound.js';
4
+ import { type AppHmacCheck, type AppSecretDeclaration, type AppSecretState } from './appSecrets.js';
5
+ import type { AppPortResult, AppScope } from './appServer.js';
6
+ /** チャネルの能力(送信、受信) */
7
+ export declare const CHANNEL_CAPABILITIES: readonly ["send", "receive"];
8
+ export type ChannelCapability = (typeof CHANNEL_CAPABILITIES)[number];
9
+ /** チャネルのアドレスの形(registered_domain: プロジェクトの登録したドメインの上のローカル部) */
10
+ export declare const CHANNEL_ADDRESS_KINDS: readonly ["registered_domain"];
11
+ export type ChannelAddressKind = (typeof CHANNEL_ADDRESS_KINDS)[number];
12
+ /** チャネルの種類の名前の形 */
13
+ export declare const CHANNEL_KIND: RegExp;
14
+ /** チャネルの設定の型(コレクションの選択はチャネルの設定にしない) */
15
+ export declare const CHANNEL_SETTING_TYPES: readonly ["boolean", "text", "number", "select"];
16
+ /** 宣言の上限(種類の数、見出しの字数、種類ごとの設定の数) */
17
+ export declare const APP_CHANNEL_KIND_LIMITS: {
18
+ readonly kindsMax: 10;
19
+ readonly labelMaxChars: 80;
20
+ readonly settingsMax: 30;
21
+ };
22
+ /** チャネルの値の上限(名前の字数、文字の設定の値の字数、アドレスのローカル部の字数) */
23
+ export declare const APP_CHANNEL_LIMITS: {
24
+ readonly nameMaxChars: 80;
25
+ readonly textSettingMaxChars: 2000;
26
+ readonly localMaxChars: 64;
27
+ };
28
+ /**
29
+ * マニフェストのチャネルの種類の宣言(channel_kinds の要素)
30
+ * - capabilities: 種類のチャネルが持てる能力。チャネルごとに、この中から使う能力を選ぶ
31
+ * - address: アドレスを持つ種類だけ(形は CHANNEL_ADDRESS_KINDS)
32
+ * - settings、secrets: チャネルごとの設定と秘密値(形はアプリの settings と secrets と同じ)
33
+ * - inbound: 外のサービスから受ける経路(受信の能力が要る)、identities: 本人の証明の発行者
34
+ */
35
+ export type AppChannelKind = Readonly<{
36
+ kind: string;
37
+ label: string;
38
+ capabilities: readonly ChannelCapability[];
39
+ address?: ChannelAddressKind;
40
+ settings?: readonly AppSettingDef[];
41
+ secrets?: readonly AppSecretDeclaration[];
42
+ inbound?: readonly AppInboundDeclaration[];
43
+ identities?: readonly AppIdentityDeclaration[];
44
+ }>;
45
+ /** マニフェストの channel_kinds の誤りの箇所(マニフェストの道) */
46
+ export declare function appChannelKindsProblems(kinds: unknown): string[];
47
+ /** マニフェストの channel_kinds の種類の宣言(なければ null) */
48
+ export declare const channelKindOf: (kinds: readonly AppChannelKind[] | undefined, kind: string) => AppChannelKind | null;
49
+ /** チャネルのアドレス(ローカル部とドメインは小文字) */
50
+ export type ChannelAddress = Readonly<{
51
+ local: string;
52
+ domain: string;
53
+ }>;
54
+ /**
55
+ * アプリが読むチャネル
56
+ * - capabilities: このチャネルで使う能力(種類の宣言の能力の部分集合)
57
+ * - isDefault: プロジェクトのこの種類の既定のチャネル(送る側がチャネルを指定しないときに使う。種類ごとに1つまで)
58
+ * - settings: チャネルの設定の値(種類の宣言の settings のキーだけ。未入力のキーは含めない)
59
+ */
60
+ export type AppChannel = Readonly<{
61
+ id: string;
62
+ kind: string;
63
+ name: string;
64
+ capabilities: readonly ChannelCapability[];
65
+ address: ChannelAddress | null;
66
+ isDefault: boolean;
67
+ settings: Readonly<Record<string, AppSettingValue>>;
68
+ }>;
69
+ /**
70
+ * チャネルの作成と変更の値(変更は全部の値を渡す)
71
+ * - capabilities: 種類の宣言の能力の部分集合(1つ以上)
72
+ * - address: registered_domain の種類では必須で、プロジェクトの検証済みのドメインの上のアドレス。ほかの種類は渡さない
73
+ * - settings: 種類の宣言の settings のキーと型の値だけ(未入力のキーは含めない)
74
+ */
75
+ export type AppChannelInput = Readonly<{
76
+ name: string;
77
+ capabilities: readonly ChannelCapability[];
78
+ address?: ChannelAddress;
79
+ isDefault: boolean;
80
+ settings: Readonly<Record<string, AppSettingValue>>;
81
+ }>;
82
+ /**
83
+ * チャネルの口(マニフェストの channel_kinds で宣言した種類の、このアプリのインストールに結んだチャネルだけ)
84
+ * - list: プロジェクトのチャネル(止めたチャネルは含めない)、get: 1つ(ほかのアプリのチャネルと止めたチャネルは null)
85
+ * - channelId がこのインストールに結んだ宣言の種類のチャネルでなければ not_found(target は channel)
86
+ * - verifyHmac、configured: チャネルのこの環境の秘密値(種類の宣言の secrets のキーだけ。ほかは app_secret_undeclared の UsageError)
87
+ * - egress: マニフェストの outbound の宣言に当たる外への要求で、auth にチャネルのこの環境の秘密値を載せる
88
+ * - create、update、remove、secrets、setSecret、deleteSecret: 経路を呼んだ人の操作(主体のない文脈は forbidden)
89
+ * チャネルの作成、変更、削除は設定の領域 integrations の権限、秘密値の入力と削除はそれに加えて連携の秘密値の管理の権限が要り、委任できない
90
+ * 作成と変更と削除はプロジェクトの全部の環境に効き、レジストリを書ける環境だけで行う(ほかは not_live)
91
+ * 値の誤りは invalid_input と issues、アドレスがほかのチャネルにあれば in_use、宣言のない種類は app_channel_undeclared の UsageError
92
+ * remove はチャネルを止め、この環境のチャネルの秘密値を消す(ほかの環境の秘密値は定期の処理が消す)
93
+ * secrets と setSecret は値を返さず、末尾だけを返す
94
+ * - inboundUrl: 種類の inbound の name の、このチャネルの受信の URL(外のサービスの管理画面に貼る値)
95
+ * 配信 API の公開の基点がない配置は null、宣言のない name は app_channel_undeclared の UsageError
96
+ */
97
+ export type AppChannelsPort = Readonly<{
98
+ list: (scope: AppScope) => Promise<readonly AppChannel[]>;
99
+ get: (scope: AppScope, channelId: string) => Promise<AppChannel | null>;
100
+ verifyHmac: (scope: AppScope, channelId: string, key: string, check: AppHmacCheck) => Promise<AppPortResult<boolean>>;
101
+ configured: (scope: AppScope, channelId: string, key: string) => Promise<AppPortResult<boolean>>;
102
+ egress: (scope: AppScope, channelId: string, input: string | URL, init?: RequestInit) => Promise<AppPortResult<Response>>;
103
+ create: (scope: AppScope, kind: string, input: AppChannelInput) => Promise<AppPortResult<AppChannel>>;
104
+ update: (scope: AppScope, channelId: string, input: AppChannelInput) => Promise<AppPortResult<AppChannel>>;
105
+ remove: (scope: AppScope, channelId: string) => Promise<AppPortResult<void>>;
106
+ secrets: (scope: AppScope, channelId: string) => Promise<AppPortResult<readonly AppSecretState[]>>;
107
+ setSecret: (scope: AppScope, channelId: string, key: string, value: string) => Promise<AppPortResult<Readonly<{
108
+ tail: string | null;
109
+ }>>>;
110
+ deleteSecret: (scope: AppScope, channelId: string, key: string) => Promise<AppPortResult<void>>;
111
+ inboundUrl: (scope: AppScope, channelId: string, name: string) => Promise<AppPortResult<string | null>>;
112
+ }>;
113
+ /** 種類の宣言の秘密値のキー(outbound の auth が指せるキー) */
114
+ export declare const channelSecretKeysOf: (kinds: unknown) => string[];
@@ -0,0 +1,133 @@
1
+ import type { Collection } from '../../schema/src/index.js';
2
+ import type { AppManifest, AppUi, ConnectionPoint, PermissionTarget } from './apps.js';
3
+ import type { AppSettingDef } from './appDependencies.js';
4
+ import type { TargetMessages } from './errorLabels.js';
5
+ /** 導入先に入れたアプリ(キーはアプリの id、値はアプリの設定値) */
6
+ export type AppSettingsInput = Readonly<Record<string, Readonly<Record<string, unknown>>>>;
7
+ type SettingsRecord = Readonly<Record<string, unknown>>;
8
+ /** 設定値の項目の値(key はドットで区切った道、例: art.enabled) */
9
+ export declare function settingAt(settings: SettingsRecord, key: string): unknown;
10
+ /** 設定値の項目を置き換えた設定値(key はドットで区切った道、途中の節がなければ作る) */
11
+ export declare function withSettingAt(settings: SettingsRecord, key: string, value: unknown): SettingsRecord;
12
+ /** 導入先の指定に保存した値を重ねた設定値(節は節ごとに重ね、一覧と値は置き換え) */
13
+ export declare function mergedSettings(base: SettingsRecord, stored: SettingsRecord): SettingsRecord;
14
+ /** 設定値の解釈(S はアプリの設定値。メソッドの形で引数を双変にし、AppDefinition<unknown> の一覧に入れられるように) */
15
+ export type AppSettings<S> = Readonly<{
16
+ /** 導入先の指定・画面で保存した値からアプリの設定値(不正な値は SettingProblem の例外) */
17
+ parse(input: Readonly<Record<string, unknown>>): S;
18
+ }>;
19
+ /** コードを持つアプリの定義(id はアプリの名前、manifest は宣言) */
20
+ export type AppDefinition<S = Readonly<Record<string, never>>> = Readonly<{
21
+ id: string;
22
+ manifest: AppManifest;
23
+ settings: AppSettings<S>;
24
+ }>;
25
+ /** 設定値のないアプリの設定値の解釈 */
26
+ export declare const NO_SETTINGS: AppSettings<Readonly<Record<string, never>>>;
27
+ /** アプリの宣言の一覧の部分(アプリの画面に使用) */
28
+ export type AppAbout = Readonly<{
29
+ description: string;
30
+ permissions: readonly PermissionTarget[];
31
+ connections: readonly ConnectionPoint[];
32
+ settings: readonly AppSettingDef[];
33
+ }>;
34
+ /** 各側の create の引数(site は導入先の設定値) */
35
+ export type AppSetupContext<S> = Readonly<{
36
+ settings: S;
37
+ site: Readonly<{
38
+ id: string;
39
+ name: string;
40
+ origin: string;
41
+ timeZone: string;
42
+ }>;
43
+ }>;
44
+ /** 各側のアプリ(P は側ごとの内容、create は組み立ての時点で1回) */
45
+ export type AppSide<S, P> = Readonly<{
46
+ app: AppDefinition<S>;
47
+ create(ctx: AppSetupContext<S>): P;
48
+ }>;
49
+ /** 組み立てたアプリの共通の部分 */
50
+ export type AppBase = Readonly<{
51
+ id: string;
52
+ label: string;
53
+ targets: Readonly<Record<string, string>>;
54
+ auditActions: Readonly<Record<string, string>>;
55
+ problems: Readonly<Record<string, string>>;
56
+ en: Readonly<{
57
+ targets: Readonly<Record<string, string>>;
58
+ problems: Readonly<Record<string, string>>;
59
+ }>;
60
+ about: AppAbout;
61
+ messages: TargetMessages;
62
+ emits: Readonly<Record<string, string>>;
63
+ ui: readonly AppUi[];
64
+ }>;
65
+ /** 組み立てたアプリ(共通の定義と、側ごとの内容) */
66
+ export type AppInstance<P> = AppBase & P;
67
+ /** 定義から組み立てたアプリの共通の部分 */
68
+ export declare function appBaseOf(app: AppDefinition<unknown>): AppBase;
69
+ /** MCP の側から CMS の API の呼び出し(パスと JSON の本文、応答は JSON) */
70
+ export type CallApi = (method: string, path: string, body?: unknown) => Promise<{
71
+ status: number;
72
+ data: unknown;
73
+ }>;
74
+ /** MCP のツール */
75
+ export type McpTool = {
76
+ name: string;
77
+ description: string;
78
+ inputSchema: Record<string, unknown>;
79
+ /** クライアント向けの付加情報(ChatGPT の openai/fileParams など) */
80
+ _meta?: Record<string, unknown>;
81
+ run: (args: Record<string, unknown>, api: CallApi) => Promise<{
82
+ status: number;
83
+ data: unknown;
84
+ }>;
85
+ };
86
+ /**
87
+ * MCP のツール、プロンプト、案内の文の材料
88
+ * - primary: MCP で書くコレクション、collections: ツールの対象のコレクション(primary と一覧で管理するコレクション)
89
+ * - source: 出典のコレクション(なしは null)
90
+ */
91
+ export type McpProjectContext = Readonly<{
92
+ projectName: string;
93
+ primary: Collection;
94
+ collections: readonly Collection[];
95
+ source: Collection | null;
96
+ }>;
97
+ /** MCP のプロンプト(name と arguments の名前はクライアントが保存するため変えない) */
98
+ export type McpPrompt = Readonly<{
99
+ name: string;
100
+ title: (ctx: McpProjectContext) => string;
101
+ description: (ctx: McpProjectContext) => string;
102
+ arguments: readonly Readonly<{
103
+ name: string;
104
+ description: string;
105
+ required: boolean;
106
+ }>[];
107
+ text: (ctx: McpProjectContext, args: Readonly<Record<string, string>>) => string;
108
+ }>;
109
+ /** MCP の側の内容(tools と prompts の名前は appToolPrefixOf の接頭辞で始める、instructions は initialize の案内に足す文) */
110
+ export type McpParts = Readonly<{
111
+ tools?: (ctx: McpProjectContext) => readonly McpTool[];
112
+ prompts?: readonly McpPrompt[];
113
+ instructions?: (ctx: McpProjectContext) => string;
114
+ }>;
115
+ /** MCP の側のアプリ */
116
+ export type McpApp<S = unknown> = AppSide<S, McpParts>;
117
+ /**
118
+ * 登録した側のアプリを導入先の設定で組み立て
119
+ * - 登録は導入先の設定 apps にある id だけ(ない id・重複は例外)
120
+ * - complete: 設定にある id がすべて登録されているか(サーバーの側、DB と migration を持つため)
121
+ */
122
+ export declare function createApps<P>(registered: readonly AppSide<unknown, P>[], config: Readonly<{
123
+ settings: AppSetupContext<unknown>['site'];
124
+ apps?: AppSettingsInput;
125
+ }>, options?: Readonly<{
126
+ complete?: boolean;
127
+ }>): AppInstance<P>[];
128
+ /** アプリの対象の表示名をまとめた表(キーの重複は例外) */
129
+ export declare function appTargetsOf(apps: readonly Readonly<{
130
+ id: string;
131
+ targets: Readonly<Record<string, string>>;
132
+ }>[], core: Readonly<Record<string, string>>): Readonly<Record<string, string>>;
133
+ export {};
@@ -1,49 +1,81 @@
1
- import { type FieldDef, type SchemaChange } from '../../model/src/index.js';
1
+ import { type Collection, type FieldDef, type SchemaChange, type UniqueDef } from '../../schema/src/index.js';
2
2
  import { z } from 'zod';
3
+ import { type AddressChannel } from './consents.js';
4
+ import { type InfraId } from './ids.js';
5
+ /** コードを持つアプリのうち、登録簿の ID が migration で決まっていて、ほかのアプリの依存先になるもの */
6
+ export declare const BUNDLED_APP_IDS: {
7
+ readonly content: InfraId<"app">;
8
+ };
9
+ /** コードを持つアプリの登録簿の ID(決まっていなければ null) */
10
+ export declare const bundledAppIdOf: (namespace: string) => InfraId<"app"> | null;
3
11
  /** ポートの id(`<発行者>:<名前>@<世代>`、例 tunasand:message@1) */
4
12
  export type PortId = `${string}:${string}@${number}`;
5
13
  /** 設定の値 */
6
- export type AppSettingValue = boolean | string | number;
7
- /** アプリの依存(major は依存先の互換の世代、minVersion はその世代の中の下限、なしは世代の最初) */
14
+ export type AppSettingValue = boolean | string | number | readonly string[];
15
+ /** アプリの依存(major は依存先の互換の世代、min_version はその世代の中の下限、なしは世代の最初) */
8
16
  export type AppDependency = Readonly<{
9
17
  /** 登録簿のアプリの id(kind: 'app' だけ。site・theme は書けない) */
10
18
  app: string;
11
19
  kind: 'required' | 'optional';
12
20
  major: number;
13
- minVersion?: number;
21
+ min_version?: number;
14
22
  /** 一緒に入れたときだけ当てる依存先の設定(拡張パック。導入済みの依存の設定は上書きしない) */
15
23
  defaults?: Readonly<Record<string, AppSettingValue>>;
16
24
  /** 自分の設定の画面に並べる依存先の設定の key(展開。保存は依存先の設定へ、正は依存先) */
17
25
  expose?: readonly string[];
18
26
  }>;
19
- /** ポートの利用(required はプロバイダーが1つもなければインストールできない) */
27
+ /** ポートの利用(required はプロバイダーが1つもなければインストールできない、capabilities は使う能力) */
20
28
  export type PortUse = Readonly<{
21
29
  port: PortId;
22
30
  required: boolean;
31
+ capabilities?: readonly string[];
23
32
  }>;
24
- /** ポートの提供(route はアプリの経路) */
33
+ /**
34
+ * ポートの提供(route はコアが人の資格のまま呼ぶアプリの経路。なしはサーバーの側の AppServerParts の provides で受ける)
35
+ * - capabilities: 提供する能力(メッセージのポートの kind など)
36
+ * - consent_channel: メッセージのポートの同意を宛先で確かめるときの宛先の種類(email・sms)。省けば送るチャネルの同意で確かめる
37
+ * (チャネルの種類の宣言が要る)。コアは送信の前にこの同意を確かめる
38
+ */
25
39
  export type PortProvide = Readonly<{
26
40
  port: PortId;
27
- route: `/api/${string}`;
41
+ route?: `/api/${string}`;
42
+ capabilities?: readonly string[];
43
+ consent_channel?: AddressChannel;
28
44
  }>;
29
- /** アプリのコレクション(name はアプリの中の名前でスラッグの既定。fields の key は予約の key と `x_` を使えない) */
45
+ /**
46
+ * アプリのコレクション(name はアプリの中の名前でスラッグの既定、形はスラッグと同じ。fields の key は予約の key と `x_` を使えない)
47
+ * - 導入先はインストールで、作るか既存のコレクションに当てるかを選ぶ。当てたコレクションでアプリが読み書きできるのは、同意の操作と宣言したフィールドだけ
48
+ * - existing: 作らずに既存のコレクションに当てる(当てるまでその名前は解けない)
49
+ */
30
50
  export type AppCollection = Readonly<{
31
51
  name: string;
32
52
  label: string;
53
+ existing?: true;
33
54
  /** アプリの内部のレコード(データを消すの対象) */
34
55
  internal?: boolean;
35
56
  /** 配信しない */
36
57
  private?: boolean;
37
58
  fields: readonly FieldDef[];
38
- }>;
39
- /** アプリの設定(requires は設定を使うのに要る任意の依存のアプリの id) */
59
+ /** 一意の組(fields の key、コレクションの unique と同じ形) */
60
+ unique?: readonly UniqueDef[];
61
+ }> &
62
+ /** 種類と時系列・集計の宣言(コレクションと同じ形、集計はアプリの処理が書くので元のコレクション source を持たない) */
63
+ Pick<Collection, 'kind' | 'time' | 'dimensions' | 'subject' | 'bucket' | 'measures' | 'retention_days'>;
64
+ /**
65
+ * アプリの設定(key はドットで区切ると節の中の項目)
66
+ * - type の collection: 導入先のコレクションの id、空文字は選択なし。collections: コレクションの id の一覧
67
+ * channels: プロジェクトのチャネルの id の一覧(空は全部のチャネル)
68
+ * - requires: 設定を使うのに要る任意の依存のアプリの id、min・unit: number の下限と単位
69
+ */
40
70
  export type AppSettingDef = Readonly<{
41
71
  key: string;
42
72
  label: string;
43
- type: 'boolean' | 'text' | 'number' | 'select';
73
+ type: 'boolean' | 'text' | 'number' | 'select' | 'collection' | 'collections' | 'channels';
44
74
  options?: readonly string[];
45
75
  default?: AppSettingValue;
46
76
  requires?: string;
77
+ min?: number;
78
+ unit?: string;
47
79
  }>;
48
80
  /** 値段(円、usage は従量の説明の文) */
49
81
  export type AppPrice = Readonly<{
@@ -74,17 +106,6 @@ export declare const DEFAULT_APP_MAJOR = 1;
74
106
  export declare const IMPORTER_FIELD_PREFIX = "x_";
75
107
  /** アプリのフィールドに使えない key(予約の key の凍結の一覧。slug はスラッグの導入で予約に入る) */
76
108
  export declare const APP_RESERVED_FIELD_KEYS: readonly string[];
77
- /**
78
- * 最初から入っている自社のアプリの登録簿の識別子(台帳の基準の版 0000_baseline.sql の apps の行と同じ値、Q7)
79
- * - コードはコアと一緒にデプロイされ、全部のプロジェクトで同時に変わる。インストールの行を持たず、計画ではいつも keep
80
- */
81
- export declare const BUILTIN_APP_IDS: {
82
- readonly forms: "01a1e1a7-4c00-7f02-9b4a-2e8c7d6a5f02";
83
- readonly line: "01a1e1a7-4c00-7e13-a6c2-91b0f3d4e803";
84
- readonly newsletter: "01a1e1a7-4c00-7b24-b7d1-0a5e6c8f9d04";
85
- };
86
- /** 自社のアプリか */
87
- export declare const isBuiltinApp: (appId: string) => boolean;
88
109
  /** 依存の宣言の形(zod。マニフェストのほかの項目は apps.ts の appManifestProblems が見る) */
89
110
  export declare const appDependencyManifestSchema: z.ZodObject<{
90
111
  major: z.ZodOptional<z.ZodNumber>;
@@ -95,24 +116,59 @@ export declare const appDependencyManifestSchema: z.ZodObject<{
95
116
  required: "required";
96
117
  }>;
97
118
  major: z.ZodNumber;
98
- minVersion: z.ZodOptional<z.ZodNumber>;
99
- defaults: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnion<readonly [z.ZodBoolean, z.ZodString, z.ZodNumber]>>>;
119
+ min_version: z.ZodOptional<z.ZodNumber>;
120
+ defaults: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnion<readonly [z.ZodBoolean, z.ZodString, z.ZodNumber, z.ZodArray<z.ZodString>]>>>;
100
121
  expose: z.ZodOptional<z.ZodArray<z.ZodString>>;
101
122
  }, z.core.$strict>>>;
102
123
  uses: z.ZodOptional<z.ZodArray<z.ZodObject<{
103
124
  port: z.ZodString;
104
125
  required: z.ZodBoolean;
126
+ capabilities: z.ZodOptional<z.ZodArray<z.ZodString>>;
105
127
  }, z.core.$strict>>>;
106
128
  provides: z.ZodOptional<z.ZodArray<z.ZodObject<{
107
129
  port: z.ZodString;
108
- route: z.ZodString;
130
+ route: z.ZodOptional<z.ZodString>;
131
+ capabilities: z.ZodOptional<z.ZodArray<z.ZodString>>;
132
+ consent_channel: z.ZodOptional<z.ZodEnum<{
133
+ email: "email";
134
+ sms: "sms";
135
+ }>>;
109
136
  }, z.core.$strict>>>;
110
137
  collections: z.ZodOptional<z.ZodArray<z.ZodObject<{
111
138
  name: z.ZodString;
112
139
  label: z.ZodString;
140
+ existing: z.ZodOptional<z.ZodLiteral<true>>;
113
141
  internal: z.ZodOptional<z.ZodBoolean>;
114
142
  private: z.ZodOptional<z.ZodBoolean>;
115
143
  fields: z.ZodArray<z.ZodType<unknown, unknown, z.core.$ZodTypeInternals<unknown, unknown>>>;
144
+ unique: z.ZodOptional<z.ZodArray<z.ZodObject<{
145
+ key: z.ZodString;
146
+ fields: z.ZodArray<z.ZodString>;
147
+ exact: z.ZodOptional<z.ZodBoolean>;
148
+ }, z.core.$strict>>>;
149
+ kind: z.ZodOptional<z.ZodEnum<{
150
+ standard: "standard";
151
+ timeseries: "timeseries";
152
+ aggregate: "aggregate";
153
+ }>>;
154
+ time: z.ZodOptional<z.ZodString>;
155
+ dimensions: z.ZodOptional<z.ZodArray<z.ZodString>>;
156
+ subject: z.ZodOptional<z.ZodString>;
157
+ bucket: z.ZodOptional<z.ZodEnum<{
158
+ hour: "hour";
159
+ day: "day";
160
+ month: "month";
161
+ }>>;
162
+ measures: z.ZodOptional<z.ZodArray<z.ZodObject<{
163
+ field: z.ZodString;
164
+ op: z.ZodEnum<{
165
+ count: "count";
166
+ min: "min";
167
+ max: "max";
168
+ sum: "sum";
169
+ }>;
170
+ }, z.core.$strict>>>;
171
+ retention_days: z.ZodOptional<z.ZodNumber>;
116
172
  }, z.core.$strict>>>;
117
173
  settings: z.ZodOptional<z.ZodArray<z.ZodObject<{
118
174
  key: z.ZodString;
@@ -122,10 +178,15 @@ export declare const appDependencyManifestSchema: z.ZodObject<{
122
178
  boolean: "boolean";
123
179
  text: "text";
124
180
  select: "select";
181
+ collection: "collection";
182
+ collections: "collections";
183
+ channels: "channels";
125
184
  }>;
126
185
  options: z.ZodOptional<z.ZodArray<z.ZodString>>;
127
- default: z.ZodOptional<z.ZodUnion<readonly [z.ZodBoolean, z.ZodString, z.ZodNumber]>>;
186
+ default: z.ZodOptional<z.ZodUnion<readonly [z.ZodBoolean, z.ZodString, z.ZodNumber, z.ZodArray<z.ZodString>]>>;
128
187
  requires: z.ZodOptional<z.ZodString>;
188
+ min: z.ZodOptional<z.ZodNumber>;
189
+ unit: z.ZodOptional<z.ZodString>;
129
190
  }, z.core.$strict>>>;
130
191
  price: z.ZodOptional<z.ZodObject<{
131
192
  setup: z.ZodOptional<z.ZodNumber>;
@@ -159,11 +220,6 @@ export type DependencyTarget = Readonly<{
159
220
  export declare function dependencyTargetProblems(manifest: AppDependencyManifest, self: string | null, targets: ReadonlyMap<string, DependencyTarget>): AppDependencyProblem[];
160
221
  /** マニフェストの世代(major を書かない旧いマニフェストは1) */
161
222
  export declare const appMajorOf: (manifest: AppDependencyManifest) => number;
162
- /**
163
- * アプリのコレクションの名前から導入先のコレクションの id(M3 の installation_collections までの結び付き)
164
- * - 名前空間を持つアプリだけがコレクションを持てる(登録簿の名前空間は一意で再利用されない)
165
- */
166
- export declare const appCollectionIdOf: (namespace: string, name: string) => string;
167
223
  /** 版の互換の外れ(path は値の場所、change はコレクションの互換のない変更) */
168
224
  export type IncompatibleChange = Readonly<{
169
225
  path: string;
@@ -195,12 +251,12 @@ export type PlanNode = Readonly<{
195
251
  reason: PlanReason;
196
252
  /** 増える能力(install は全部、upgrade は前の同意にない分、keep は空) */
197
253
  capabilities: readonly string[];
198
- /** コレクションのスキーマの変更(M3 でインストールがコレクションを作るときに埋める) */
254
+ /** インストールが足すコレクションとフィールドのスキーマの変更(まだ払い出していない id は仮の値) */
199
255
  schemaChanges: readonly SchemaChange[];
200
256
  /** マニフェストの名前 → スラッグ(ぶつかれば候補、導入先が画面で直せる) */
201
257
  slugs: Readonly<Record<string, string>>;
202
- /** マニフェストの名前 → 結ぶ既存のコレクションの id(既存のコレクションを使う、M3) */
203
- adopt: Readonly<Record<string, string>>;
258
+ /** マニフェストの名前 → 当てる既存のコレクションの id(足りないフィールドは schemaChanges が足す) */
259
+ mapped: Readonly<Record<string, string>>;
204
260
  /** 一緒に入れるときに当てる設定(依存元の defaults) */
205
261
  defaults: Readonly<Record<string, AppSettingValue>>;
206
262
  price: AppPrice | null;
@@ -250,7 +306,7 @@ export type PlanConflict = Readonly<{
250
306
  port: string;
251
307
  by: string;
252
308
  }> | Readonly<{
253
- kind: 'slots';
309
+ kind: 'collections';
254
310
  app: string;
255
311
  }> | Readonly<{
256
312
  kind: 'slug';
@@ -0,0 +1,21 @@
1
+ import { type EndUserIdTokenAlgorithm } from './endUsers.js';
2
+ /**
3
+ * 発行者の宣言
4
+ * - issuer: ID トークンの iss(https)、jwks_url: 公開鍵の一覧の URL(https)、algorithms: 署名の方式
5
+ * - audience_setting: audience を入れるチャネルの設定のキー(type text。値が空のあいだは登録しない)
6
+ */
7
+ export type AppIdentityDeclaration = Readonly<{
8
+ issuer: string;
9
+ jwks_url: string;
10
+ algorithms: readonly EndUserIdTokenAlgorithm[];
11
+ audience_setting: string;
12
+ }>;
13
+ /** 宣言の上限(件数、URL の字数) */
14
+ export declare const APP_IDENTITY_LIMITS: {
15
+ readonly entriesMax: 4;
16
+ readonly urlMaxChars: 500;
17
+ };
18
+ /** 登録した発行者の id(設定の発行者の id の形と重ならない) */
19
+ export declare const appProviderId: (channelId: string, issuer: string) => string;
20
+ /** チャネルの種類の identities の誤りの箇所(audience_setting は種類の settings で宣言した text のキーでなければならない) */
21
+ export declare function appIdentitiesProblems(identities: unknown, settings: unknown): string[];
@@ -0,0 +1,28 @@
1
+ /** 受ける経路の宣言(name は経路の最後の区間) */
2
+ export type AppInboundDeclaration = Readonly<{
3
+ name: string;
4
+ }>;
5
+ /** 経路の名前の形 */
6
+ export declare const APP_INBOUND_NAME: RegExp;
7
+ /** 受信の経路(配信 API の基点からのパス) */
8
+ export declare const appInboundPathOf: (channelId: string, name: string) => string;
9
+ /** チャネルと宣言ごとの受信の URL(url は配信 API の公開の基点がなければ null) */
10
+ export type AppInboundUrl = Readonly<{
11
+ channelId: string;
12
+ channelName: string;
13
+ name: string;
14
+ url: string | null;
15
+ }>;
16
+ /** 上限(宣言の数、本文のバイト数) */
17
+ export declare const APP_INBOUND_LIMITS: {
18
+ readonly entriesMax: 8;
19
+ readonly bodyMaxBytes: 1048576;
20
+ };
21
+ /** 受けた要求(channelId は受けたチャネル、body はパースの前の本文) */
22
+ export type AppInboundRequest = Readonly<{
23
+ channelId: string;
24
+ body: Uint8Array;
25
+ headers: Headers;
26
+ }>;
27
+ /** マニフェストのチャネルの種類の inbound の誤りの箇所(種類の宣言の中の道) */
28
+ export declare function appInboundProblems(inbound: unknown): string[];
@@ -0,0 +1,106 @@
1
+ import type { AppPortResult, AppScope } from './appServer.js';
2
+ /** マニフェストのメールの宣言 */
3
+ export type AppMailDeclaration = Readonly<{
4
+ send?: boolean;
5
+ inbound?: boolean;
6
+ }>;
7
+ /** 能力の要素(送信、受信) */
8
+ export declare const MAIL_CAPABILITIES: {
9
+ readonly send: "mail:send";
10
+ readonly inbound: "mail:inbound";
11
+ };
12
+ /** マニフェストの mail の誤りの箇所 */
13
+ export declare function appMailProblems(mail: unknown): string[];
14
+ /** マニフェストの mail の能力の要素 */
15
+ export declare const mailCapabilitiesOf: (mail: AppMailDeclaration | undefined) => string[];
16
+ /** 認証の結果(RFC 8601の結果の語) */
17
+ export declare const MAIL_AUTH_RESULTS: readonly ["pass", "fail", "softfail", "neutral", "none", "temperror", "permerror", "policy"];
18
+ export type MailAuthResult = (typeof MAIL_AUTH_RESULTS)[number];
19
+ /** 受信の基盤が評価した認証の結果(dkim は署名ごとの d= のドメインと結果) */
20
+ export type MailAuthentication = Readonly<{
21
+ spf: MailAuthResult;
22
+ dkim: readonly Readonly<{
23
+ domain: string;
24
+ result: MailAuthResult;
25
+ }>[];
26
+ dmarc: MailAuthResult;
27
+ arc: MailAuthResult;
28
+ }>;
29
+ /**
30
+ * メールの送信の依頼(テキストだけ)
31
+ * - from: 差出人、replyTo: 返信先(どちらもドメインはプロジェクトの検証済みのドメイン)
32
+ * - inReplyTo、references: 返信の元の Message-ID と、スレッドの Message-ID の連なり(山括弧つき)
33
+ * - purpose: 同意の目的(宛先の抑止の一覧と同意をコアが確かめる)、key: 依頼を見分ける鍵(ログに残す。重複を除くのは呼ぶアプリ)
34
+ */
35
+ export type AppMailSendRequest = Readonly<{
36
+ to: string;
37
+ from: Readonly<{
38
+ address: string;
39
+ name?: string;
40
+ }>;
41
+ replyTo?: string;
42
+ subject: string;
43
+ text: string;
44
+ inReplyTo?: string;
45
+ references?: readonly string[];
46
+ purpose: string;
47
+ key: string;
48
+ }>;
49
+ /**
50
+ * 送らなかった理由
51
+ * - suppressed: 抑止の一覧、no_consent: 同意の目的で送れない
52
+ * - domain_unverified: 差出人のドメインが検証されていない、test_environment: live 以外の環境
53
+ */
54
+ export declare const APP_MAIL_SKIP_REASONS: readonly ["suppressed", "no_consent", "domain_unverified", "test_environment"];
55
+ export type AppMailSkipReason = (typeof APP_MAIL_SKIP_REASONS)[number];
56
+ /**
57
+ * 送信の結果(基盤の一時的な失敗は例外)
58
+ * - sent: messageId は送ったメールの Message-ID(山括弧つき、基盤が返さなければ null)
59
+ * - rejected: 依頼の形の誤り(path は誤りの位置)
60
+ */
61
+ export type AppMailSendResult = Readonly<{
62
+ status: 'sent';
63
+ messageId: string | null;
64
+ }> | Readonly<{
65
+ status: 'skipped';
66
+ reason: AppMailSkipReason;
67
+ }> | Readonly<{
68
+ status: 'rejected';
69
+ path: string;
70
+ }>;
71
+ /** プロジェクトのドメイン(送信と受信に使う。records は DNS に置くレコード) */
72
+ export type AppMailDomain = Readonly<{
73
+ domain: string;
74
+ status: 'pending' | 'verified' | 'failed';
75
+ records: readonly Readonly<{
76
+ purpose: string;
77
+ type: string;
78
+ name: string;
79
+ value: string;
80
+ priority?: number;
81
+ }>[];
82
+ }>;
83
+ /**
84
+ * 受けたメール
85
+ * - channelId: 受けたチャネル(アプリのチャネルで、受信の能力を持つ)
86
+ * - recipient: 受けた宛先、tag: 宛先のローカル部の `+` の後ろ(なければ null。返信先にスレッドの ID を載せる用途)
87
+ * - envelopeFrom: 封筒の送り主(不達の通知は空)、raw: 生のメッセージ、auth: 受信の基盤が評価した認証の結果
88
+ */
89
+ export type AppInboundMail = Readonly<{
90
+ channelId: string;
91
+ recipient: string;
92
+ tag: string | null;
93
+ envelopeFrom: string;
94
+ raw: Uint8Array;
95
+ auth: MailAuthentication;
96
+ }>;
97
+ /**
98
+ * メールの口(マニフェストの mail の宣言の範囲だけ。宣言がなければ app_mail_undeclared の UsageError)
99
+ * - send: 送信(mail.send)。コアの関門を通し、例外にしない結果で返す。送信のモードを決められない実行は unavailable(送り直す)
100
+ * - domains: プロジェクトのドメインと検証の状態(mail.send か mail.inbound)
101
+ * - 送信の部品のない配置は not_configured
102
+ */
103
+ export type AppMailPort = Readonly<{
104
+ send: (scope: AppScope, request: AppMailSendRequest) => Promise<AppPortResult<AppMailSendResult>>;
105
+ domains: (scope: AppScope) => Promise<AppPortResult<readonly AppMailDomain[]>>;
106
+ }>;