@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
@@ -1,14 +1,29 @@
1
+ import type { ApiRoute, DELEGABLE, ListSpec, PERSON } from './api/define.js';
1
2
  import type { AppScope } from './appServer.js';
2
3
  import type { SettingsArea } from './settings.js';
3
- /** 経路の権限の判定の種類(account はログイン中のすべて、own は本人か管理者で持ち主の判定は handle、admin は管理者だけ、settings:<領域> は設定の領域の権限) */
4
- export type AppRoutePolicy = 'account' | 'own' | 'permission' | 'admin' | `settings:${SettingsArea}`;
4
+ /**
5
+ * アプリの経路が受け付ける資格(マスタの PERSON か DELEGABLE の組)
6
+ * - DELEGABLE は委任された主体(人の代理のアプリと MCP の接続)にも開き、PERSON の経路は委任された主体を判定で拒む
7
+ */
8
+ export type AppRouteCredentials = typeof PERSON | typeof DELEGABLE;
9
+ /**
10
+ * 経路の領域(主体の種類で通った呼び出しを、さらに領域の権限で絞る。広げない)
11
+ * - settings:<領域>・admin: 設定の領域と管理の領域の変更の権限
12
+ * - project: プロジェクトの値の読み取り(GET だけ)。MCP の接続はロール ∩ MCP の上限 ∩ 接続の段階でどこかを読めるときだけ
13
+ */
14
+ export type AppRouteArea = `settings:${SettingsArea}` | 'admin' | 'project';
5
15
  /** アプリの経路のメソッド */
6
- export type AppRouteMethod = 'GET' | 'POST' | 'PUT' | 'PATCH' | 'DELETE';
16
+ export type AppRouteMethod = 'GET' | 'POST' | 'PATCH' | 'DELETE';
7
17
  /** 管理の API を呼ぶクライアント(path は /api から、呼んだ人の資格のまま) */
8
18
  export type CmsClient = Readonly<{
9
19
  fetch(path: `/api/${string}`, init?: RequestInit): Promise<Response>;
10
20
  }>;
11
- /** 経路の処理に渡す文脈(params は経路の名前つきの区間の値、egress はサーバーの宣言の egress の宛先だけへの GET と HEAD、scope は呼び出しのプロジェクトの文脈) */
21
+ /**
22
+ * 管理の API の一覧を、続きのカーソル next_cursor が尽きるまで読む(読めなければその応答)
23
+ * - path は一覧の経路(クエリを含めてよい)。1要求ごとに件数と走査の上限は効く
24
+ */
25
+ export declare function cmsListAll<T>(cms: CmsClient, path: `/api/${string}`): Promise<T[] | Response>;
26
+ /** 経路の処理に渡す文脈(params は経路の名前つきの区間の値、egress はマニフェストの outbound の宣言に当たる要求だけ、scope は呼び出しのプロジェクトの文脈) */
12
27
  export type AppContext = Readonly<{
13
28
  cms: CmsClient;
14
29
  scope: AppScope;
@@ -17,11 +32,21 @@ export type AppContext = Readonly<{
17
32
  /** 応答の後へ回す処理(実行の文脈がない呼び出しではなし) */
18
33
  defer?: (task: Promise<unknown>) => void;
19
34
  }>;
20
- /** アプリの経路(path は /api からの経路、`:<名前>` は1つの区間) */
35
+ /** アプリの経路の管理の API のパス(アプリの経路は /api/apps/<名前空間> の下) */
36
+ export declare const appRoutePathOf: (namespace: string, path: `/${string}`) => `/${string}`;
37
+ /**
38
+ * アプリの経路(path はアプリの名前空間 /api/apps/<名前空間> からの経路、`:<名前>` は1つの区間。組み立ての後は appRoutePathOf のパス)
39
+ * - credentials・summary・response・list はマスタの経路の宣言と同じ意味
40
+ * - list: 応答は { data, next_cursor }。アプリのコレクションを読む一覧の索引の表は c_{<マニフェストのコレクションの名前>}、索引の名前は i_c_{<名前>}_<列>
41
+ */
21
42
  export type AppRoute = Readonly<{
22
43
  method: AppRouteMethod;
23
- path: `/api/${string}`;
24
- policy: AppRoutePolicy;
44
+ path: `/${string}`;
45
+ credentials: AppRouteCredentials;
46
+ area?: AppRouteArea;
47
+ summary: string;
48
+ response: ApiRoute['response'];
49
+ list?: ListSpec;
25
50
  handle: (request: Request, ctx: AppContext) => Promise<Response>;
26
51
  }>;
27
52
  /** 外への読み込みの宛先の宣言に URL が当たるか(宣言は https のオリジン、ホスト名の先頭の `*.` は1つ以上の区間。https だけ、ポートの指定なし) */
@@ -0,0 +1,152 @@
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 } from './appSecrets.js';
5
+ import type { AppPortResult, AppScope } from './appServer.js';
6
+ /** チャネルの能力(送信、受信、決済) */
7
+ export declare const CHANNEL_CAPABILITIES: readonly ["send", "receive", "payment"];
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
+ readonly patternMaxChars: 500;
22
+ };
23
+ /**
24
+ * チャネルの設定の宣言
25
+ * - pattern: text の値(前後の空白を除いた値)の全体が一致する正規表現の本体(Unicode のフラグ。アンカーはコアが付ける)
26
+ * チャネルの値の検査はコアがこの宣言だけで行い、アプリは読んだ値を解釈するだけにする
27
+ */
28
+ export type AppChannelSettingDef = AppSettingDef & Readonly<{
29
+ pattern?: string;
30
+ }>;
31
+ /** 設定の形の正規表現(宣言の pattern の全体の一致。誤った宣言は null) */
32
+ export declare function channelSettingPattern(pattern: string): RegExp | null;
33
+ /** チャネルの値の上限(名前の字数、文字の設定の値の字数、アドレスのローカル部の字数、外部のキーの字数) */
34
+ export declare const APP_CHANNEL_LIMITS: {
35
+ readonly nameMaxChars: 80;
36
+ readonly textSettingMaxChars: 2000;
37
+ readonly localMaxChars: 64;
38
+ readonly externalKeyMaxChars: 255;
39
+ };
40
+ /**
41
+ * マニフェストのチャネルの種類の宣言(channel_kinds の要素)
42
+ * - capabilities: 種類のチャネルが持てる能力。チャネルごとに、この中から使う能力を選ぶ
43
+ * - address: アドレスを持つ種類だけ(形は CHANNEL_ADDRESS_KINDS)
44
+ * - settings、secrets: チャネルごとの設定と秘密値(形はアプリの settings と secrets と同じ)
45
+ * - inbound: 外のサービスから受ける経路(受信の能力が要る)、identities: 本人の証明の発行者
46
+ * - external_key: 種類のチャネルが外部のサービスのアカウントのキーをモード(CHANNEL_MODES)ごとに持つ
47
+ * (1つ以上が要り、種類とモードの中でインスタンスの全体で一意)
48
+ * 1つの URL に全アカウントの分が届く送り手の受信を、このキーでチャネルに振り分ける(アプリの単位の受信、appInbound.ts)
49
+ */
50
+ export type AppChannelKind = Readonly<{
51
+ kind: string;
52
+ label: string;
53
+ capabilities: readonly ChannelCapability[];
54
+ address?: ChannelAddressKind;
55
+ settings?: readonly AppChannelSettingDef[];
56
+ secrets?: readonly AppSecretDeclaration[];
57
+ inbound?: readonly AppInboundDeclaration[];
58
+ identities?: readonly AppIdentityDeclaration[];
59
+ external_key?: true;
60
+ }>;
61
+ /** マニフェストの channel_kinds の誤りの箇所(マニフェストの道) */
62
+ export declare function appChannelKindsProblems(kinds: unknown): string[];
63
+ /** マニフェストの channel_kinds の種類の宣言(なければ null) */
64
+ export declare const channelKindOf: (kinds: readonly AppChannelKind[] | undefined, kind: string) => AppChannelKind | null;
65
+ /** 外部のアカウントのモード(live は本番のアカウント、sandbox は live 以外の環境が繋ぐサンドボックスのアカウント) */
66
+ export declare const CHANNEL_MODES: readonly ["live", "sandbox"];
67
+ export type ChannelMode = (typeof CHANNEL_MODES)[number];
68
+ /** モードごとの外部のアカウントのキー */
69
+ export type ChannelExternalKeys = Readonly<Partial<Record<ChannelMode, string>>>;
70
+ /** チャネルのアドレス(ローカル部とドメインは小文字) */
71
+ export type ChannelAddress = Readonly<{
72
+ local: string;
73
+ domain: string;
74
+ }>;
75
+ /**
76
+ * アプリが読むチャネル
77
+ * - capabilities: このチャネルで使う能力(種類の宣言の能力の部分集合)
78
+ * - isDefault: プロジェクトのこの種類の既定のチャネル(送る側がチャネルを指定しないときに使う。種類ごとに1つまで)
79
+ * - settings: チャネルの設定の値(種類の宣言の settings のキーだけ。未入力のキーは含めない)
80
+ * - externalKeys: モードごとの外部のサービスのアカウントのキー(external_key の種類だけ、ほかは空)
81
+ */
82
+ export type AppChannel = Readonly<{
83
+ id: string;
84
+ kind: string;
85
+ name: string;
86
+ capabilities: readonly ChannelCapability[];
87
+ address: ChannelAddress | null;
88
+ isDefault: boolean;
89
+ settings: Readonly<Record<string, AppSettingValue>>;
90
+ externalKeys: ChannelExternalKeys;
91
+ }>;
92
+ /**
93
+ * チャネルの作成の本文(コアの POST /api/channels)
94
+ * - kind: マニフェストの channel_kinds の種類。installationId は、同じ種類を宣言したインストールが複数あるときだけ要る
95
+ * - capabilities: 種類の宣言の能力の部分集合(省略は種類の全部の能力)
96
+ * - address: registered_domain の種類では必須で、プロジェクトの検証済みのドメインの上のアドレス。ほかの種類は渡さない
97
+ * - settings: 種類の宣言の settings のキーと型と pattern に合う値だけ(空の文字は未入力)
98
+ * - 外部のキー(external_key の種類)は渡さない。運営者が運営者の API で登録する
99
+ */
100
+ export type ChannelCreateBody = Readonly<{
101
+ kind: string;
102
+ installationId?: string;
103
+ name: string;
104
+ capabilities?: readonly ChannelCapability[];
105
+ address?: ChannelAddress;
106
+ isDefault?: boolean;
107
+ settings?: Readonly<Record<string, AppSettingValue>>;
108
+ }>;
109
+ /** チャネルの更新の本文(JSON Merge Patch。settings の null はその設定を消す) */
110
+ export type ChannelPatch = Readonly<{
111
+ name?: string;
112
+ capabilities?: readonly ChannelCapability[];
113
+ address?: ChannelAddress;
114
+ isDefault?: boolean;
115
+ settings?: Readonly<Record<string, AppSettingValue | null>>;
116
+ }>;
117
+ /** チャネルの秘密値の状態(値と末尾は返さない) */
118
+ export type ChannelSecretStatus = Readonly<{
119
+ key: string;
120
+ label: string;
121
+ configured: boolean;
122
+ updatedAt: string | null;
123
+ }>;
124
+ /** コアのチャネルの経路の資源(secrets は種類の宣言の順の秘密値の状態) */
125
+ export type ChannelView = AppChannel & Readonly<{
126
+ secrets: readonly ChannelSecretStatus[];
127
+ }>;
128
+ /**
129
+ * チャネルの口(マニフェストの channel_kinds で宣言した種類の、このアプリのインストールに結んだチャネルだけ)
130
+ * - list: プロジェクトのチャネル(止めたチャネルは含めない)、get: 1つ(ほかのアプリのチャネルと止めたチャネルは null)
131
+ * - channelId がこのインストールに結んだ宣言の種類のチャネルでなければ not_found(target は channel)
132
+ * - verifyHmac、configured: チャネルのこの環境の秘密値(種類の宣言の secrets のキーだけ。ほかは app_secret_undeclared の UsageError)
133
+ * - configuredOf: 結んだすべてのチャネルの秘密値の有無を1回で読む(チャネルの ID ごと)
134
+ * キーを宣言しない種類のチャネルは false、どの種類も宣言しないキーは app_secret_undeclared
135
+ * - egress: マニフェストの outbound の宣言に当たる外への要求で、auth にチャネルのこの環境の秘密値を載せる
136
+ * - inboundUrl: 種類の inbound の name の、このチャネルの受信の URL(外のサービスの管理画面に貼る値)
137
+ * 配信 API の公開の基点がない配置は null、宣言のない name は app_channel_undeclared の UsageError
138
+ * - inboundUrlsOf: 結んだすべてのチャネルの受信の URL(チャネルの ID ごと、name を宣言しない種類のチャネルは含めない。基点がない配置は null)
139
+ * チャネルの作成、変更、削除と秘密値の入力はコアの経路(/api/channels)で行い、口には置かない
140
+ */
141
+ export type AppChannelsPort = Readonly<{
142
+ list: (scope: AppScope) => Promise<readonly AppChannel[]>;
143
+ get: (scope: AppScope, channelId: string) => Promise<AppChannel | null>;
144
+ verifyHmac: (scope: AppScope, channelId: string, key: string, check: AppHmacCheck) => Promise<AppPortResult<boolean>>;
145
+ configured: (scope: AppScope, channelId: string, key: string) => Promise<AppPortResult<boolean>>;
146
+ configuredOf: (scope: AppScope, key: string) => Promise<AppPortResult<Readonly<Record<string, boolean>>>>;
147
+ egress: (scope: AppScope, channelId: string, input: string | URL, init?: RequestInit) => Promise<AppPortResult<Response>>;
148
+ inboundUrl: (scope: AppScope, channelId: string, name: string) => Promise<AppPortResult<string | null>>;
149
+ inboundUrlsOf: (scope: AppScope, name: string) => Promise<AppPortResult<Readonly<Record<string, string>> | null>>;
150
+ }>;
151
+ /** 種類の宣言の秘密値のキー(outbound の auth が指せるキー) */
152
+ export declare const channelSecretKeysOf: (kinds: unknown) => string[];
@@ -1,5 +1,5 @@
1
1
  import type { Collection } from '../../schema/src/index.js';
2
- import type { AppManifest, AppScreen, ConnectionPoint, PermissionTarget } from './apps.js';
2
+ import type { AppManifest, AppUi, ConnectionPoint, PermissionTarget } from './apps.js';
3
3
  import type { AppSettingDef } from './appDependencies.js';
4
4
  import type { TargetMessages } from './errorLabels.js';
5
5
  /** 導入先に入れたアプリ(キーはアプリの id、値はアプリの設定値) */
@@ -60,7 +60,7 @@ export type AppBase = Readonly<{
60
60
  about: AppAbout;
61
61
  messages: TargetMessages;
62
62
  emits: Readonly<Record<string, string>>;
63
- screens: readonly AppScreen[];
63
+ ui: readonly AppUi[];
64
64
  }>;
65
65
  /** 組み立てたアプリ(共通の定義と、側ごとの内容) */
66
66
  export type AppInstance<P> = AppBase & P;
@@ -83,10 +83,16 @@ export type McpTool = {
83
83
  data: unknown;
84
84
  }>;
85
85
  };
86
- /** MCP のプロンプトと案内の文の材料(projectName はプロジェクトの名前、primary は MCP で書くコレクション) */
86
+ /**
87
+ * MCP のツール、プロンプト、案内の文の材料
88
+ * - primary: MCP で書くコレクション、collections: ツールの対象のコレクション(primary と一覧で管理するコレクション)
89
+ * - source: 出典のコレクション(なしは null)
90
+ */
87
91
  export type McpProjectContext = Readonly<{
88
92
  projectName: string;
89
93
  primary: Collection;
94
+ collections: readonly Collection[];
95
+ source: Collection | null;
90
96
  }>;
91
97
  /** MCP のプロンプト(name と arguments の名前はクライアントが保存するため変えない) */
92
98
  export type McpPrompt = Readonly<{
@@ -100,9 +106,9 @@ export type McpPrompt = Readonly<{
100
106
  }>[];
101
107
  text: (ctx: McpProjectContext, args: Readonly<Record<string, string>>) => string;
102
108
  }>;
103
- /** MCP の側の内容(instructions は initialize の案内に足す文) */
109
+ /** MCP の側の内容(tools と prompts の名前は appToolPrefixOf の接頭辞で始める、instructions は initialize の案内に足す文) */
104
110
  export type McpParts = Readonly<{
105
- tools?: readonly McpTool[];
111
+ tools?: (ctx: McpProjectContext) => readonly McpTool[];
106
112
  prompts?: readonly McpPrompt[];
107
113
  instructions?: (ctx: McpProjectContext) => string;
108
114
  }>;
@@ -1,52 +1,91 @@
1
- import { type FieldDef, type SchemaChange } from '../../schema/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
- /** アプリの設定(key はドットで区切ると節の中の項目、requires は設定を使うのに要る任意の依存のアプリの id、min・unit は number の下限と単位) */
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 の一覧(空は全部のチャネル)、accounts: プロジェクトのアカウントの id の一覧
68
+ * repeater: 繰り返しフィールド(各行は fields のキーと文字列の値の組、順序を保持。default は定義できない)
69
+ * - requires: 設定を使うのに要る任意の依存のアプリの id、min・unit: number の下限と単位
70
+ */
40
71
  export type AppSettingDef = Readonly<{
41
72
  key: string;
42
73
  label: string;
43
- type: 'boolean' | 'text' | 'number' | 'select';
74
+ type: 'boolean' | 'text' | 'number' | 'select' | 'collection' | 'collections' | 'channels' | 'accounts' | 'repeater';
44
75
  options?: readonly string[];
76
+ fields?: readonly AppSettingRowField[];
45
77
  default?: AppSettingValue;
46
78
  requires?: string;
47
79
  min?: number;
48
80
  unit?: string;
49
81
  }>;
82
+ /** 繰り返しフィールド(repeater)の各行のフィールド(long_text は複数行、required は行ごとに必須) */
83
+ export type AppSettingRowField = Readonly<{
84
+ key: string;
85
+ label: string;
86
+ type: 'text' | 'long_text';
87
+ required?: boolean;
88
+ }>;
50
89
  /** 値段(円、usage は従量の説明の文) */
51
90
  export type AppPrice = Readonly<{
52
91
  setup?: number;
@@ -86,24 +125,59 @@ export declare const appDependencyManifestSchema: z.ZodObject<{
86
125
  required: "required";
87
126
  }>;
88
127
  major: z.ZodNumber;
89
- minVersion: z.ZodOptional<z.ZodNumber>;
90
- defaults: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnion<readonly [z.ZodBoolean, z.ZodString, z.ZodNumber]>>>;
128
+ min_version: z.ZodOptional<z.ZodNumber>;
129
+ defaults: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnion<readonly [z.ZodBoolean, z.ZodString, z.ZodNumber, z.ZodArray<z.ZodString>]>>>;
91
130
  expose: z.ZodOptional<z.ZodArray<z.ZodString>>;
92
131
  }, z.core.$strict>>>;
93
132
  uses: z.ZodOptional<z.ZodArray<z.ZodObject<{
94
133
  port: z.ZodString;
95
134
  required: z.ZodBoolean;
135
+ capabilities: z.ZodOptional<z.ZodArray<z.ZodString>>;
96
136
  }, z.core.$strict>>>;
97
137
  provides: z.ZodOptional<z.ZodArray<z.ZodObject<{
98
138
  port: z.ZodString;
99
- route: z.ZodString;
139
+ route: z.ZodOptional<z.ZodString>;
140
+ capabilities: z.ZodOptional<z.ZodArray<z.ZodString>>;
141
+ consent_channel: z.ZodOptional<z.ZodEnum<{
142
+ email: "email";
143
+ sms: "sms";
144
+ }>>;
100
145
  }, z.core.$strict>>>;
101
146
  collections: z.ZodOptional<z.ZodArray<z.ZodObject<{
102
147
  name: z.ZodString;
103
148
  label: z.ZodString;
149
+ existing: z.ZodOptional<z.ZodLiteral<true>>;
104
150
  internal: z.ZodOptional<z.ZodBoolean>;
105
151
  private: z.ZodOptional<z.ZodBoolean>;
106
152
  fields: z.ZodArray<z.ZodType<unknown, unknown, z.core.$ZodTypeInternals<unknown, unknown>>>;
153
+ unique: z.ZodOptional<z.ZodArray<z.ZodObject<{
154
+ key: z.ZodString;
155
+ fields: z.ZodArray<z.ZodString>;
156
+ exact: z.ZodOptional<z.ZodBoolean>;
157
+ }, z.core.$strict>>>;
158
+ kind: z.ZodOptional<z.ZodEnum<{
159
+ standard: "standard";
160
+ timeseries: "timeseries";
161
+ aggregate: "aggregate";
162
+ }>>;
163
+ time: z.ZodOptional<z.ZodString>;
164
+ dimensions: z.ZodOptional<z.ZodArray<z.ZodString>>;
165
+ subject: z.ZodOptional<z.ZodString>;
166
+ bucket: z.ZodOptional<z.ZodEnum<{
167
+ hour: "hour";
168
+ day: "day";
169
+ month: "month";
170
+ }>>;
171
+ measures: z.ZodOptional<z.ZodArray<z.ZodObject<{
172
+ field: z.ZodString;
173
+ op: z.ZodEnum<{
174
+ count: "count";
175
+ min: "min";
176
+ max: "max";
177
+ sum: "sum";
178
+ }>;
179
+ }, z.core.$strict>>>;
180
+ retention_days: z.ZodOptional<z.ZodNumber>;
107
181
  }, z.core.$strict>>>;
108
182
  settings: z.ZodOptional<z.ZodArray<z.ZodObject<{
109
183
  key: z.ZodString;
@@ -113,9 +187,23 @@ export declare const appDependencyManifestSchema: z.ZodObject<{
113
187
  boolean: "boolean";
114
188
  text: "text";
115
189
  select: "select";
190
+ collection: "collection";
191
+ collections: "collections";
192
+ accounts: "accounts";
193
+ channels: "channels";
194
+ repeater: "repeater";
116
195
  }>;
117
196
  options: z.ZodOptional<z.ZodArray<z.ZodString>>;
118
- default: z.ZodOptional<z.ZodUnion<readonly [z.ZodBoolean, z.ZodString, z.ZodNumber]>>;
197
+ fields: z.ZodOptional<z.ZodArray<z.ZodObject<{
198
+ key: z.ZodString;
199
+ label: z.ZodString;
200
+ type: z.ZodEnum<{
201
+ text: "text";
202
+ long_text: "long_text";
203
+ }>;
204
+ required: z.ZodOptional<z.ZodBoolean>;
205
+ }, z.core.$strict>>>;
206
+ default: z.ZodOptional<z.ZodUnion<readonly [z.ZodBoolean, z.ZodString, z.ZodNumber, z.ZodArray<z.ZodString>]>>;
119
207
  requires: z.ZodOptional<z.ZodString>;
120
208
  min: z.ZodOptional<z.ZodNumber>;
121
209
  unit: z.ZodOptional<z.ZodString>;
@@ -152,11 +240,6 @@ export type DependencyTarget = Readonly<{
152
240
  export declare function dependencyTargetProblems(manifest: AppDependencyManifest, self: string | null, targets: ReadonlyMap<string, DependencyTarget>): AppDependencyProblem[];
153
241
  /** マニフェストの世代(major を書かない旧いマニフェストは1) */
154
242
  export declare const appMajorOf: (manifest: AppDependencyManifest) => number;
155
- /**
156
- * アプリのコレクションの名前から導入先のコレクションの id(M3 の installation_collections までの結び付き)
157
- * - 名前空間を持つアプリだけがコレクションを持てる(登録簿の名前空間は一意で再利用されない)
158
- */
159
- export declare const appCollectionIdOf: (namespace: string, name: string) => string;
160
243
  /** 版の互換の外れ(path は値の場所、change はコレクションの互換のない変更) */
161
244
  export type IncompatibleChange = Readonly<{
162
245
  path: string;
@@ -188,12 +271,12 @@ export type PlanNode = Readonly<{
188
271
  reason: PlanReason;
189
272
  /** 増える能力(install は全部、upgrade は前の同意にない分、keep は空) */
190
273
  capabilities: readonly string[];
191
- /** コレクションのスキーマの変更(M3 でインストールがコレクションを作るときに埋める) */
274
+ /** インストールが足すコレクションとフィールドのスキーマの変更(まだ払い出していない id は仮の値) */
192
275
  schemaChanges: readonly SchemaChange[];
193
276
  /** マニフェストの名前 → スラッグ(ぶつかれば候補、導入先が画面で直せる) */
194
277
  slugs: Readonly<Record<string, string>>;
195
- /** マニフェストの名前 → 結ぶ既存のコレクションの id(既存のコレクションを使う、M3) */
196
- adopt: Readonly<Record<string, string>>;
278
+ /** マニフェストの名前 → 当てる既存のコレクションの id(足りないフィールドは schemaChanges が足す) */
279
+ mapped: Readonly<Record<string, string>>;
197
280
  /** 一緒に入れるときに当てる設定(依存元の defaults) */
198
281
  defaults: Readonly<Record<string, AppSettingValue>>;
199
282
  price: AppPrice | null;
@@ -243,7 +326,7 @@ export type PlanConflict = Readonly<{
243
326
  port: string;
244
327
  by: string;
245
328
  }> | Readonly<{
246
- kind: 'slots';
329
+ kind: 'collections';
247
330
  app: string;
248
331
  }> | Readonly<{
249
332
  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,53 @@
1
+ import type { ChannelMode } from './appChannels.js';
2
+ /** 受ける経路の宣言(name は経路の最後の区間、dispatch はアプリの単位の受信) */
3
+ export type AppInboundDeclaration = Readonly<{
4
+ name: string;
5
+ dispatch?: 'app';
6
+ }>;
7
+ /** 経路の名前の形 */
8
+ export declare const APP_INBOUND_NAME: RegExp;
9
+ /** 受信の経路(配信 API の基点からのパス) */
10
+ export declare const appInboundPathOf: (channelId: string, name: string) => string;
11
+ /** チャネルと宣言ごとの受信の URL(url は配信 API の公開の基点がなければ null) */
12
+ export type AppInboundUrl = Readonly<{
13
+ channelId: string;
14
+ channelName: string;
15
+ name: string;
16
+ url: string | null;
17
+ }>;
18
+ /** 上限(宣言の数、本文のバイト数) */
19
+ export declare const APP_INBOUND_LIMITS: {
20
+ readonly entriesMax: 8;
21
+ readonly bodyMaxBytes: 1048576;
22
+ };
23
+ /** 受けた要求(channelId は受けたチャネル、body はパースの前の本文) */
24
+ export type AppInboundRequest = Readonly<{
25
+ channelId: string;
26
+ body: Uint8Array;
27
+ headers: Headers;
28
+ }>;
29
+ /**
30
+ * 受けた要求の処理の結果(refused は受け付けて処理しない理由のコード)
31
+ * 直らない拒否(届け先の人や売り物がない、値が合わない、許可がない)は refused で返し、コアがログに残して受け付けを返す(送り手に再送させない)
32
+ * 一時的な失敗は例外にする(本文なしの500、送り手の再送)
33
+ */
34
+ export type AppInboundOutcome = Readonly<{
35
+ refused: string;
36
+ }> | undefined;
37
+ /** アプリの単位の受信の経路(公開の API のホストのパス。appId は同梱のアプリの名前空間) */
38
+ export declare const appDispatchPathOf: (appId: string, name: string) => string;
39
+ /** アプリの単位の受信の経路の形(1つ目は名前空間、2つ目は name) */
40
+ export declare const APP_DISPATCH_PATH: RegExp;
41
+ /** アプリの単位の受信で受けた要求(チャネルは未定) */
42
+ export type AppDispatchRequest = Readonly<{
43
+ body: Uint8Array;
44
+ headers: Headers;
45
+ }>;
46
+ /** 振り分けの結果(mode と externalKey は届け先のチャネルの外部のキー、environmentId は sandbox のイベントの届け先の環境。null は受け付けて捨てる) */
47
+ export type AppDispatched = Readonly<{
48
+ mode: ChannelMode;
49
+ externalKey: string;
50
+ environmentId: string | null;
51
+ }> | null;
52
+ /** マニフェストのチャネルの種類の inbound の誤りの箇所(種類の宣言の中の道) */
53
+ export declare function appInboundProblems(inbound: unknown): string[];