@tunasand/sdk 0.7.0 → 0.8.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 (187) hide show
  1. package/CHANGELOG.md +112 -88
  2. package/README.md +202 -198
  3. package/dist/analytics.js +638 -2
  4. package/dist/app.js +230 -24
  5. package/dist/apps-BxnJ1RlU.js +435 -0
  6. package/dist/{bridge-DYAYGV7t.js → bridge-DtHw9hS6.js} +3 -3
  7. package/dist/bridge.js +2 -2
  8. package/dist/cli.js +5 -4
  9. package/dist/{model-pmXzGX12.js → collection-BEOxeISR.js} +49 -12
  10. package/dist/{customers-C_vJY2_v.js → customers-DTbL0qn6.js} +5 -3
  11. package/dist/customers.js +2 -2
  12. package/dist/{declared-C_GvPiGF.js → declared-DuNMsdXw.js} +93 -5
  13. package/dist/delivery.js +15 -30
  14. package/dist/embeds-B5V54Zur.js +34 -0
  15. package/dist/{errorLabels-CPKiPabZ.js → errorLabels-BgtQ_zUn.js} +276 -263
  16. package/dist/i18n.js +4 -4
  17. package/dist/ids--RF7hGyC.js +36 -0
  18. package/dist/integrations.js +4 -29
  19. package/dist/{ja-C1HEWWTQ.js → ja-CeHU0EaY.js} +3 -3
  20. package/dist/{ja-C6lX0CeJ.js → ja-Du6ooL6i.js} +12 -11
  21. package/dist/{page-E_cYgZx-.js → page-Bzrj24sJ.js} +4 -4
  22. package/dist/{profile-D6t1QMQh.js → profile-1em_lcxq.js} +5 -5
  23. package/dist/rich-text.d.ts +1 -0
  24. package/dist/{body.js → rich-text.js} +6 -7
  25. package/dist/{schema-UQJWRyfJ.js → schema-WnobuwLg.js} +136 -97
  26. package/dist/schema.js +346 -1
  27. package/dist/types/access/src/handoff.d.ts +3 -3
  28. package/dist/types/access/src/jwt.d.ts +1 -1
  29. package/dist/types/access/src/oidc.d.ts +1 -1
  30. package/dist/types/{cms-contract → contract}/src/apiKeys.d.ts +1 -1
  31. package/dist/types/{cms-contract → contract}/src/app.d.ts +8 -15
  32. package/dist/types/contract/src/appDefinition.d.ts +127 -0
  33. package/dist/types/{cms-contract → contract}/src/appDependencies.d.ts +6 -13
  34. package/dist/types/contract/src/appServer.d.ts +136 -0
  35. package/dist/types/contract/src/approvalLabels.d.ts +26 -0
  36. package/dist/types/contract/src/approvals.d.ts +63 -0
  37. package/dist/types/{cms-contract → contract}/src/apps.d.ts +72 -29
  38. package/dist/types/contract/src/auditActions.d.ts +18 -0
  39. package/dist/types/contract/src/auditLabels.d.ts +127 -0
  40. package/dist/types/{cms-contract → contract}/src/authorize.d.ts +22 -63
  41. package/dist/types/{cms-contract → contract}/src/bridge.d.ts +6 -6
  42. package/dist/types/{cms-contract → contract}/src/customers.d.ts +6 -6
  43. package/dist/types/{cms-contract → contract}/src/embeds.d.ts +13 -7
  44. package/dist/types/{cms-contract → contract}/src/errorLabels.d.ts +17 -15
  45. package/dist/types/{cms-contract → contract}/src/errorLabelsEn.d.ts +9 -7
  46. package/dist/types/{cms-contract → contract}/src/errors.d.ts +11 -11
  47. package/dist/types/{cms-contract → contract}/src/failureStatus.d.ts +4 -3
  48. package/dist/types/contract/src/fieldAccess.d.ts +45 -0
  49. package/dist/types/contract/src/fieldRules.d.ts +41 -0
  50. package/dist/types/{cms-contract/src/assets.d.ts → contract/src/files.d.ts} +5 -5
  51. package/dist/types/{cms-contract → contract}/src/functions.d.ts +3 -3
  52. package/dist/types/contract/src/hostingRpc.d.ts +143 -0
  53. package/dist/types/contract/src/hostnames.d.ts +30 -0
  54. package/dist/types/{cms-contract → contract}/src/identifiers.d.ts +31 -28
  55. package/dist/types/contract/src/ids.d.ts +104 -0
  56. package/dist/types/{cms-contract → contract}/src/import.d.ts +3 -3
  57. package/dist/types/contract/src/importLabels.d.ts +3 -0
  58. package/dist/types/contract/src/index.d.ts +67 -0
  59. package/dist/types/{cms-contract → contract}/src/issueLabels.d.ts +27 -23
  60. package/dist/types/{cms-contract → contract}/src/issueLabelsEn.d.ts +15 -13
  61. package/dist/types/contract/src/labels.d.ts +11 -0
  62. package/dist/types/contract/src/legacyAuditLabels.d.ts +10 -0
  63. package/dist/types/contract/src/livePeriods.d.ts +18 -0
  64. package/dist/types/contract/src/manage.d.ts +47 -0
  65. package/dist/types/contract/src/manageLabels.d.ts +9 -0
  66. package/dist/types/contract/src/mcpAuth.d.ts +139 -0
  67. package/dist/types/contract/src/mcpLabels.d.ts +5 -0
  68. package/dist/types/{cms-contract → contract}/src/migration.d.ts +1 -1
  69. package/dist/types/contract/src/operatorOperations.d.ts +703 -0
  70. package/dist/types/contract/src/operators.d.ts +33 -0
  71. package/dist/types/{cms-contract → contract}/src/paths.d.ts +6 -8
  72. package/dist/types/contract/src/pending.d.ts +4 -0
  73. package/dist/types/{cms-contract → contract}/src/permissions.d.ts +2 -0
  74. package/dist/types/contract/src/principal.d.ts +110 -0
  75. package/dist/types/{cms-contract → contract}/src/problems.d.ts +4 -4
  76. package/dist/types/contract/src/projectRole.d.ts +6 -0
  77. package/dist/types/{cms-contract → contract}/src/roles.d.ts +4 -3
  78. package/dist/types/{cms-contract → contract}/src/settingProblems.d.ts +2 -2
  79. package/dist/types/{cms-contract → contract}/src/settings.d.ts +2 -2
  80. package/dist/types/contract/src/settingsLabels.d.ts +3 -0
  81. package/dist/types/contract/src/slugs.d.ts +6 -0
  82. package/dist/types/{cms-contract → contract}/src/transfer.d.ts +3 -3
  83. package/dist/types/contract/src/trial.d.ts +10 -0
  84. package/dist/types/contract/src/versions.d.ts +9 -0
  85. package/dist/types/{cms-contract → contract}/src/webhooks.d.ts +33 -58
  86. package/dist/types/contract/src/workflow.d.ts +49 -0
  87. package/dist/types/contract/src/workspaceItems.d.ts +73 -0
  88. package/dist/types/contract/src/workspacePaths.d.ts +4 -0
  89. package/dist/types/{body → rich-text}/src/declared.d.ts +2 -2
  90. package/dist/types/{body → rich-text}/src/embed.d.ts +1 -1
  91. package/dist/types/{body → rich-text}/src/labels/ja.d.ts +2 -2
  92. package/dist/types/{body → rich-text}/src/profile.d.ts +1 -1
  93. package/dist/types/{model → schema}/src/audience.d.ts +11 -11
  94. package/dist/types/schema/src/brand.d.ts +5 -0
  95. package/dist/types/{model → schema}/src/capabilities.d.ts +5 -5
  96. package/dist/types/{model → schema}/src/changes.d.ts +6 -6
  97. package/dist/types/{model → schema}/src/check.d.ts +2 -2
  98. package/dist/types/{model/src/model.d.ts → schema/src/collection.d.ts} +25 -23
  99. package/dist/types/{platform/src/defaultModel.d.ts → schema/src/defaultSchema.d.ts} +4 -3
  100. package/dist/types/{model/src/asset.d.ts → schema/src/file.d.ts} +16 -16
  101. package/dist/types/{model → schema}/src/image.d.ts +3 -3
  102. package/dist/types/{model → schema}/src/index.d.ts +11 -10
  103. package/dist/types/{model → schema}/src/input.d.ts +3 -3
  104. package/dist/types/{model → schema}/src/integrity.d.ts +1 -1
  105. package/dist/types/{model → schema}/src/labels/en.d.ts +8 -7
  106. package/dist/types/{model → schema}/src/labels/ja.d.ts +9 -8
  107. package/dist/types/schema/src/legacy.d.ts +2 -0
  108. package/dist/types/{model → schema}/src/media.d.ts +1 -1
  109. package/dist/types/{model → schema}/src/mediaUrl.d.ts +5 -5
  110. package/dist/types/{model → schema}/src/page.d.ts +2 -2
  111. package/dist/types/{model → schema}/src/problems.d.ts +14 -13
  112. package/dist/types/{model → schema}/src/refs.d.ts +1 -1
  113. package/dist/types/{model → schema}/src/rules.d.ts +2 -2
  114. package/dist/types/{model → schema}/src/schema.d.ts +10 -10
  115. package/dist/types/{model → schema}/src/selfOps.d.ts +1 -1
  116. package/dist/types/schema/src/typesSource.d.ts +16 -0
  117. package/dist/types/{model → schema}/src/values.d.ts +2 -2
  118. package/dist/types/sdk/src/analytics.d.ts +2 -2
  119. package/dist/types/sdk/src/app.d.ts +44 -16
  120. package/dist/types/sdk/src/bridge.d.ts +12 -12
  121. package/dist/types/sdk/src/customers.d.ts +14 -20
  122. package/dist/types/sdk/src/delegation.d.ts +39 -0
  123. package/dist/types/sdk/src/delivery/client.d.ts +11 -10
  124. package/dist/types/sdk/src/delivery/fields.d.ts +2 -2
  125. package/dist/types/sdk/src/delivery/index.d.ts +1 -1
  126. package/dist/types/sdk/src/delivery/media.d.ts +6 -6
  127. package/dist/types/sdk/src/delivery/query.d.ts +1 -1
  128. package/dist/types/sdk/src/delivery/schema.d.ts +4 -4
  129. package/dist/types/sdk/src/delivery/values.d.ts +6 -6
  130. package/dist/types/sdk/src/delivery.d.ts +2 -2
  131. package/dist/types/sdk/src/i18n.d.ts +11 -11
  132. package/dist/types/sdk/src/integrations.d.ts +10 -10
  133. package/dist/types/sdk/src/{body.d.ts → rich-text.d.ts} +2 -2
  134. package/dist/types/sdk/src/schema.d.ts +5 -21
  135. package/dist/types/sdk/src/site.d.ts +1 -1
  136. package/dist/types/sdk/src/types.d.ts +21 -0
  137. package/dist/{schema-BPHL7Qr-.js → types-B77qvqPJ.js} +5 -4
  138. package/dist/types.d.ts +1 -0
  139. package/dist/types.js +1 -0
  140. package/dist/{typesSource-bO0jFw1I.js → typesSource-CWybQYus.js} +58 -12
  141. package/package.json +12 -12
  142. package/dist/apps-9u4XMi7E.js +0 -114
  143. package/dist/body.d.ts +0 -1
  144. package/dist/embed-R-OvDYAw.js +0 -90
  145. package/dist/model.d.ts +0 -1
  146. package/dist/model.js +0 -345
  147. package/dist/types/analytics/src/index.d.ts +0 -5
  148. package/dist/types/analytics/src/schedule.d.ts +0 -2
  149. package/dist/types/analytics/src/shared.d.ts +0 -21
  150. package/dist/types/analytics/src/source.d.ts +0 -19
  151. package/dist/types/analytics/src/store.d.ts +0 -24
  152. package/dist/types/cms-contract/src/urlLabel.d.ts +0 -13
  153. package/dist/types/model/src/brand.d.ts +0 -25
  154. package/dist/types/model/src/legacy.d.ts +0 -2
  155. package/dist/types/model/src/typesSource.d.ts +0 -8
  156. package/dist/types/sdk/src/model.d.ts +0 -5
  157. /package/dist/types/{cms-contract → contract}/src/appProblems.d.ts +0 -0
  158. /package/dist/types/{cms-contract → contract}/src/consents.d.ts +0 -0
  159. /package/dist/types/{cms-contract → contract}/src/customerLabels.d.ts +0 -0
  160. /package/dist/types/{analytics → contract}/src/day.d.ts +0 -0
  161. /package/dist/types/{cms-contract → contract}/src/functionLabels.d.ts +0 -0
  162. /package/dist/types/{cms-contract → contract}/src/permissionLabels.d.ts +0 -0
  163. /package/dist/types/{cms-contract → contract}/src/siteArtifact.d.ts +0 -0
  164. /package/dist/types/{cms-contract → contract}/src/siteDeclaration.d.ts +0 -0
  165. /package/dist/types/{analytics/src/view.d.ts → contract/src/viewEvent.d.ts} +0 -0
  166. /package/dist/types/{cms-contract → contract}/src/views.d.ts +0 -0
  167. /package/dist/types/{cms-contract → contract}/src/webhookLabels.d.ts +0 -0
  168. /package/dist/types/{body → rich-text}/src/components.d.ts +0 -0
  169. /package/dist/types/{body → rich-text}/src/derive.d.ts +0 -0
  170. /package/dist/types/{body → rich-text}/src/description.d.ts +0 -0
  171. /package/dist/types/{body → rich-text}/src/href.d.ts +0 -0
  172. /package/dist/types/{body → rich-text}/src/html.d.ts +0 -0
  173. /package/dist/types/{body → rich-text}/src/index.d.ts +0 -0
  174. /package/dist/types/{body → rich-text}/src/inline.d.ts +0 -0
  175. /package/dist/types/{body → rich-text}/src/labels/en.d.ts +0 -0
  176. /package/dist/types/{body → rich-text}/src/library.d.ts +0 -0
  177. /package/dist/types/{body → rich-text}/src/markdown.d.ts +0 -0
  178. /package/dist/types/{body → rich-text}/src/normalize.d.ts +0 -0
  179. /package/dist/types/{body → rich-text}/src/problems.d.ts +0 -0
  180. /package/dist/types/{body → rich-text}/src/render.d.ts +0 -0
  181. /package/dist/types/{body → rich-text}/src/schema.d.ts +0 -0
  182. /package/dist/types/{body → rich-text}/src/standard.d.ts +0 -0
  183. /package/dist/types/{body → rich-text}/src/types.d.ts +0 -0
  184. /package/dist/types/{model → schema}/src/contact.d.ts +0 -0
  185. /package/dist/types/{model → schema}/src/json.d.ts +0 -0
  186. /package/dist/types/{model → schema}/src/screens.d.ts +0 -0
  187. /package/dist/types/{model → schema}/src/time.d.ts +0 -0
@@ -0,0 +1,33 @@
1
+ /** 許可の種類(grant は管理者の許可、emergency は管理者のいないプロジェクトの非常の手順) */
2
+ export declare const SUPPORT_ACCESS_KINDS: readonly ["grant", "emergency"];
3
+ /** 許可の種類 */
4
+ export type SupportAccessKind = (typeof SUPPORT_ACCESS_KINDS)[number];
5
+ /** 許可の操作の範囲(read は閲覧だけ、admin は管理者と同じ。どちらも期限の後に残る入口は作れない) */
6
+ export declare const SUPPORT_ACCESS_SCOPES: readonly ["read", "admin"];
7
+ /** 許可の操作の範囲 */
8
+ export type SupportAccessScope = (typeof SUPPORT_ACCESS_SCOPES)[number];
9
+ /**
10
+ * 許可の値の範囲
11
+ * - maxDays: 期限の最長の日数、purposeMax: 目的の文字数
12
+ * - emergencyDelayHours: 非常の手順が効くまでの時間、emergencyDays: 非常の手順の期限の日数
13
+ */
14
+ export declare const SUPPORT_ACCESS_LIMITS: {
15
+ readonly maxDays: 7;
16
+ readonly purposeMax: 200;
17
+ readonly emergencyDelayHours: 24;
18
+ readonly emergencyDays: 1;
19
+ };
20
+ /** 許可(active は今効いているか) */
21
+ export type SupportAccess = Readonly<{
22
+ id: string;
23
+ operatorEmail: string;
24
+ purpose: string;
25
+ kind: SupportAccessKind;
26
+ scope: SupportAccessScope;
27
+ grantedBy: string;
28
+ createdAt: string;
29
+ startsAt: string;
30
+ expiresAt: string;
31
+ revokedAt: string | null;
32
+ active: boolean;
33
+ }>;
@@ -1,21 +1,19 @@
1
1
  /** サーバーが受け持つパスの頭(API・画像・プレビュー・ログインの入り口) */
2
2
  export declare const SERVER_PATHS: readonly ["/api", "/media", "/preview", "/auth"];
3
- /** サーバーのパスの頭と同じ名前の管理画面の経路(サーバーは頭の下だけを受け持つ。スタジオのメディアの画面 /media、画像は /media/<id>) */
4
- export declare const SCREEN_PATHS: readonly ["/media"];
5
- /** ヘルスチェックのパス(どのホストでもサーバー。運営者の経路は運営者のホストの全部のパスで、管理画面の Worker がホストで振り分ける) */
6
- export declare const OPS_PATHS: readonly ["/healthz"];
7
- /** MCP の認可の窓口の CMS の側(MCP の Worker が service binding でだけ呼ぶ。管理画面の Worker は転送しない) */
3
+ /** ヘルスチェックのパス(どのホストでもサーバー。運営者の経路は運営者のホストの全部のパスで、ワークスペースの Worker がホストで振り分ける) */
4
+ export declare const ADMIN_PATHS: readonly ["/healthz"];
5
+ /** MCP の認可の窓口の CMS の側(MCP の Worker が service binding でだけ呼ぶ。ワークスペースの Worker は転送しない) */
8
6
  export declare const MCP_OAUTH_PATH = "/mcp/oauth";
9
- /** 環境を選ぶパスの頭(/env/<live か環境の URL のラベル>/…)。省略は live。管理画面、API、配信 API で共通 */
7
+ /** 環境を選ぶパスの頭(/env/<live か環境の ID>/…)。省略は live。ワークスペース、API、配信 API で共通 */
10
8
  export declare const ENV_PATH = "/env";
11
- /** 環境を選ぶパスの分解(label は live か環境の URL のラベル、rest は残りのパス、prefix は除いた頭。環境の指定のないパスは null) */
9
+ /** 環境を選ぶパスの分解(label は live か環境の ID、rest は残りのパス、prefix は除いた頭。環境の指定のないパスは null) */
12
10
  export declare function envPathOf(pathname: string): Readonly<{
13
11
  label: string;
14
12
  rest: string;
15
13
  prefix: string;
16
14
  }> | null;
17
15
  /**
18
- * 管理画面のパス(画面の経路、API、画像、プレビュー)に、開いた画面の URL(opened)の環境の頭を付ける(外の URL、// で始まる URL、/auth はそのまま)
16
+ * ワークスペースのパス(画面の経路、API、画像、プレビュー)に、開いた画面の URL(opened)の環境の頭を付ける(外の URL、// で始まる URL、/auth はそのまま)
19
17
  * - 付け済みの頭は開いた画面の頭に置き換える(環境の切り替えはページの読み直しで、この関数からは別の環境へ出ない)
20
18
  */
21
19
  export declare function withEnvPrefix(path: string, opened: string): string;
@@ -0,0 +1,4 @@
1
+ /** 追加の依頼を記事に付ける値 */
2
+ export declare const pendingValue: (requestId: string) => string;
3
+ /** 記事の値のうち、承認待ちの依頼の ID */
4
+ export declare const pendingIds: (values: readonly string[]) => string[];
@@ -13,6 +13,8 @@ export declare const ACTION_LEVELS: Readonly<Record<Action, readonly Level[]>>;
13
13
  export type Permissions = Readonly<Record<string, Readonly<Partial<Record<Action, Level>>>>>;
14
14
  /** 表にない対象の既定のキー */
15
15
  export declare const ANY_TARGET = "*";
16
+ /** 権限の表の和(対象と操作ごとに、LEVELS の並びで先の段階。付与ごとのロールの実効の権限) */
17
+ export declare function permissionsUnion(tables: readonly Permissions[]): Permissions;
16
18
  type Holder = Pick<User, 'permissions'> & Partial<Pick<User, 'role' | 'operator' | 'app' | 'mcp'>>;
17
19
  /** 対象と操作の段階 */
18
20
  export declare const levelOf: (user: Holder, target: string, action: Action) => Level;
@@ -0,0 +1,110 @@
1
+ import type { CustomerProof } from '../../schema/src/index.js';
2
+ import type { ActorKind, AuditVia } from './identifiers.js';
3
+ import type { InfraId } from './ids.js';
4
+ import type { Permissions } from './permissions.js';
5
+ /** アカウントの種類(レジストリの accounts.kind) */
6
+ export declare const ACCOUNT_KINDS: readonly ["person", "agent", "app"];
7
+ /** アカウントの種類 */
8
+ export type AccountKind = (typeof ACCOUNT_KINDS)[number];
9
+ /** 鍵とアプリのアカウントの能力(対象から操作の配列) */
10
+ export type Capabilities = Readonly<Record<string, readonly string[]>>;
11
+ /** 主体のアカウント(null の installationId はインストール済みアプリに属さない主体: service binding の内側の呼び出しと、どこにも属さない Webhook の購読) */
12
+ export type PrincipalAccount = Readonly<{
13
+ kind: Exclude<AccountKind, 'app'>;
14
+ id: string;
15
+ }> | Readonly<{
16
+ kind: 'app';
17
+ installationId: InfraId<'installation'> | null;
18
+ }>;
19
+ /** ロールの表の実効の権限(admin は管理者のロール) */
20
+ export type RoleEffective = Readonly<{
21
+ form: 'roles';
22
+ permissions: Permissions;
23
+ admin: boolean;
24
+ }>;
25
+ /** 能力の実効の権限 */
26
+ export type CapabilityEffective = Readonly<{
27
+ form: 'capabilities';
28
+ capabilities: Capabilities;
29
+ }>;
30
+ /**
31
+ * アカウントの代理(委ねた能力でロールの表を狭める)
32
+ * - app: アプリのアカウントの資格。consented は同意の記録の能力で * を残した形(項目の見える範囲の判定でコレクションの名指しを見る)
33
+ * - mcp_client: MCP の接続。staffCollections は MCP にスタッフの項目を出すコレクション(プロジェクトの設定、ロールの権限は広げない)
34
+ */
35
+ export type AccountDelegation = Readonly<{
36
+ kind: 'app';
37
+ installationId: InfraId<'installation'>;
38
+ capabilities: Capabilities;
39
+ consented: Capabilities;
40
+ }> | Readonly<{
41
+ kind: 'mcp_client';
42
+ capabilities: Capabilities;
43
+ staffCollections: readonly string[];
44
+ }>;
45
+ /** 顧客の代理(customerId は本人の ID、proof は本人の確認の方法。名前と形は tunasand#812) */
46
+ export type CustomerPrincipal = Readonly<{
47
+ kind: 'on_behalf_of_customer';
48
+ capabilities: Capabilities;
49
+ customerId: string;
50
+ proof: CustomerProof;
51
+ }>;
52
+ /** 主体の文脈(ロールの表を持つのは人とエージェント、能力を持つのはアプリのアカウント) */
53
+ export type PrincipalContext = Readonly<{
54
+ account: Extract<PrincipalAccount, {
55
+ kind: 'person' | 'agent';
56
+ }>;
57
+ effective: RoleEffective;
58
+ chain: readonly [] | readonly [AccountDelegation];
59
+ via: AuditVia | null;
60
+ }> | Readonly<{
61
+ account: Extract<PrincipalAccount, {
62
+ kind: 'app';
63
+ }>;
64
+ effective: CapabilityEffective;
65
+ chain: readonly [] | readonly [CustomerPrincipal];
66
+ via: AuditVia | null;
67
+ }>;
68
+ /** アプリのアカウントの主体の文脈 */
69
+ export type AppPrincipal = Extract<PrincipalContext, {
70
+ effective: CapabilityEffective;
71
+ }>;
72
+ /** 顧客の代理の主体の文脈 */
73
+ export type CustomerContext = AppPrincipal & Readonly<{
74
+ chain: readonly [CustomerPrincipal];
75
+ }>;
76
+ /** 判定で主体を絞る種類(操作の記録の主体の種類の値。installation はアプリのアカウントの操作) */
77
+ export type ActingKind = Extract<ActorKind, 'account' | 'installation' | 'on_behalf_of_account' | 'on_behalf_of_customer'>;
78
+ /** 判定で主体を絞る種類(顧客の操作の選べる主体と、判定の観測) */
79
+ export declare const actingKindOf: (principal: PrincipalContext) => ActingKind;
80
+ /** 主体の文脈のアカウントの代理(なければ null) */
81
+ export declare const accountDelegationOf: (principal: PrincipalContext) => AccountDelegation | null;
82
+ /** 主体の文脈の顧客の代理(なければ null) */
83
+ export declare const customerOf: (principal: PrincipalContext) => CustomerPrincipal | null;
84
+ /** ログインしたアカウントの要求の認証情報の種類(アプリのアカウントのトークン、MCP の接続、ログインのセッション) */
85
+ export declare const viaOfUser: (user: Readonly<{
86
+ app?: object;
87
+ mcp?: object;
88
+ }>) => AuditVia;
89
+ /** 主体の文脈を組み立てるアカウントの値(User とその一部) */
90
+ type UserInput = Readonly<{
91
+ id?: string;
92
+ permissions: Permissions;
93
+ role?: string;
94
+ app?: Readonly<{
95
+ installation: InfraId<'installation'>;
96
+ capabilities: Capabilities;
97
+ consented?: Capabilities;
98
+ }>;
99
+ mcp?: Readonly<{
100
+ capabilities: Capabilities;
101
+ staffCollections: readonly string[];
102
+ }>;
103
+ }>;
104
+ /** ログインしたアカウントの主体の文脈(アプリのアカウントの資格と MCP の接続はアカウントの代理で、委ねた能力の外では管理者として扱わない。運営者はアカウントと同じ) */
105
+ export declare function principalOfUser(user: UserInput): PrincipalContext;
106
+ /** アプリのアカウントの主体の文脈(capabilities はアプリのアカウントの実効の能力) */
107
+ export declare const appPrincipalOf: (installationId: InfraId<"installation"> | null, capabilities: Capabilities, via: AuditVia | null) => AppPrincipal;
108
+ /** 顧客の代理の主体の文脈(アプリのアカウントが本人の代わりに操作する。実効の権限は本人の能力) */
109
+ export declare const onBehalfOfCustomer: (app: AppPrincipal, customer: CustomerPrincipal) => CustomerContext;
110
+ export {};
@@ -2,14 +2,14 @@ import { type ParamValue } from '../../i18n/src/index.js';
2
2
  import type { ImportProblem } from './import.js';
3
3
  export declare const PROBLEM_MESSAGES: Readonly<Record<string, string>>;
4
4
  export declare const PROBLEM_MESSAGES_EN: Readonly<Record<string, string>>;
5
- /** 既定の形を日本語の文に(問題でない文はそのまま、差し込みの中の問題も文に。extra はモジュールとアプリの表) */
5
+ /** 既定の形を日本語の文に(問題でない文はそのまま、差し込みの中の問題も文に。extra はアプリの表) */
6
6
  export declare const problemLabel: (text: string, extra?: Readonly<Record<string, string>>) => string;
7
- /** 既定の形を英語の文に(問題でない文はそのまま。extra はモジュールとアプリの英語の表) */
7
+ /** 既定の形を英語の文に(問題でない文はそのまま。extra はアプリの英語の表) */
8
8
  export declare const problemEnglish: (text: string, extra?: Readonly<Record<string, string>>) => string;
9
9
  /**
10
10
  * コードと差し込みを持つ結果の画面の文(issues、スキーマの変更、取り込みの問題)
11
11
  * - コードが表にあり差し込みがそろえば表の文、ほかは message(既定の形なら表の文)
12
- * - extra: モジュールとアプリの表(コードは `<id>_` で始まり、コアの表と重ならない)
12
+ * - extra: アプリの表(コードは `<id>_` で始まり、コアの表と重ならない)
13
13
  */
14
14
  export declare function issueLabel(issue: Readonly<{
15
15
  message: string;
@@ -21,7 +21,7 @@ export declare const importProblemLabel: (p: Pick<ImportProblem, "message" | "pr
21
21
  /** 取り込みの問題の種類の名前(ImportProblem の code) */
22
22
  export declare const importKindLabel: (code: ImportProblem["code"]) => string;
23
23
  type Table = Readonly<Record<string, string>>;
24
- /** モジュールとアプリの文言の表の誤り(問題のコードの接頭辞 `<id>_`、コアの問題の表との重なり、英語の表のキーの過不足) */
24
+ /** アプリの文言の表の誤り(問題のコードの接頭辞 `<id>_`(id の `-` は `_`)、コアの問題の表との重なり、英語の表のキーの過不足) */
25
25
  export declare function labelTableProblems(tables: Readonly<{
26
26
  id: string;
27
27
  targets?: Table;
@@ -0,0 +1,6 @@
1
+ import type { OrganizationRole } from './authorize.js';
2
+ /**
3
+ * プロジェクトの中のロール(組織の owner はプロジェクトの管理者を継ぎ、プロジェクトの側で下げられない。member はプロジェクトのアカウントのロールだけ)
4
+ * - メンバーの表に owner をコピーせず、入口(console の一覧と引き継ぎと同意、CMS のログイン)がこの関数で決める。なしは入れない
5
+ */
6
+ export declare const projectRoleOf: (organizationRole: OrganizationRole | null, accountRole: string | null) => string | null;
@@ -1,4 +1,5 @@
1
- import type { Capabilities } from './authorize.js';
1
+ import type { Capabilities } from './principal.js';
2
+ import type { InfraId } from './ids.js';
2
3
  import { type AccountLink, type Permissions } from './permissions.js';
3
4
  /** 管理者のロールの ID */
4
5
  export declare const ADMIN_ROLE = "admin";
@@ -20,7 +21,7 @@ export type Role = Readonly<{
20
21
  }>;
21
22
  /**
22
23
  * ログイン中のアカウント
23
- * - id: アカウントの ID(操作の履歴・版の作成者・担当者などに保存する値、メールアドレスは表 accounts だけ)
24
+ * - id: アカウントの ID(操作の履歴・版の作成者・担当者などに保存する値、メールアドレスは表 memberships だけ)
24
25
  * - role: ロールの ID、recordId: 結び付くレコード(なしは null)、link: 結び付きの設定
25
26
  * - operator: 運営者のサポートのアクセスの許可で入った運営者(操作の履歴の主体は運営者)
26
27
  * - app: アプリのアカウントの資格(client はクライアントの ID、installation はインストールの ID)
@@ -40,7 +41,7 @@ export type User = Readonly<{
40
41
  operator?: true;
41
42
  app?: Readonly<{
42
43
  client: string;
43
- installation: string;
44
+ installation: InfraId<'installation'>;
44
45
  capabilities: Capabilities;
45
46
  consented?: Capabilities;
46
47
  withheld?: readonly string[];
@@ -1,8 +1,8 @@
1
1
  import { type ParamValue } from '../../i18n/src/index.js';
2
- /** モジュールの設定値の問題のコード */
2
+ /** アプリの設定値の問題のコード */
3
3
  export declare const SETTING_PROBLEMS: readonly ["text", "integer_min", "boolean", "text_list", "choice", "duplicate", "required", "shape"];
4
4
  export type SettingProblemCode = (typeof SETTING_PROBLEMS)[number];
5
- /** モジュールの設定値の問題(key は設定値のキー、params は文に差し込む値) */
5
+ /** アプリの設定値の問題(key は設定値のキー、params は文に差し込む値) */
6
6
  export declare class SettingProblem extends Error {
7
7
  readonly key: string;
8
8
  readonly problem: SettingProblemCode;
@@ -1,10 +1,10 @@
1
1
  import type { User } from './roles.js';
2
2
  /**
3
3
  * 設定の領域
4
- * - general: 一般、content: コレクション・メニュー・画像サイズ、extensions: 拡張機能
4
+ * - general: 一般、content: コレクション・メニュー・画像サイズ、apps: インストール済みアプリと標準の機能
5
5
  * - integrations: 連携・プレビューとデプロイ、data: インポート・エクスポート、customers: 顧客の設定
6
6
  */
7
- export declare const SETTINGS_AREAS: readonly ["general", "content", "extensions", "integrations", "data", "customers"];
7
+ export declare const SETTINGS_AREAS: readonly ["general", "content", "apps", "integrations", "data", "customers"];
8
8
  /** 設定の領域 */
9
9
  export type SettingsArea = (typeof SETTINGS_AREAS)[number];
10
10
  /** 権限の表での設定の領域の id */
@@ -0,0 +1,3 @@
1
+ import type { SettingsArea } from './settings.js';
2
+ /** 設定の領域の表示名 */
3
+ export declare const SETTINGS_AREA_LABELS: Readonly<Record<SettingsArea, string>>;
@@ -0,0 +1,6 @@
1
+ /**
2
+ * スラッグの予約語(プロジェクトとチャネルのスラッグに当てる、1か所の定数)
3
+ * - 製品と会社の名前、Tunasand のホスト名と経路の名前、インフラの名前、運用の名前、デプロイの後の確認のラベル
4
+ */
5
+ export declare const RESERVED_SLUGS: readonly ["tunasand", "ryusenkei", "www", "api", "mcp", "console", "admin", "docs", "status", "app", "apps", "auth", "login", "mail", "cms", "media", "files", "cdn", "edge", "fallback", "static", "sites", "preview", "help", "support", "blog", "news", "ops", "security", "abuse", "postmaster", "hostmaster", "webmaster", "root", "tunasand-deploy-check"];
6
+ export declare const isReservedSlug: (slug: string) => boolean;
@@ -2,7 +2,7 @@ import type { Permissions } from './permissions.js';
2
2
  import type { ViewDefinition } from './views.js';
3
3
  /** スキーマと設定の形式の名前 */
4
4
  export declare const CONFIG_FORMAT = "cms-config";
5
- /** スキーマと設定(schema はコンテンツスキーマ ContentModel・screens は画面設定 ScreenSettings の形、roles は管理者以外、views はチームのビュー) */
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,10 @@
1
+ /** 検証用のフラグのプロジェクトの CMS のホスト名の印(先頭のラベルの末尾。Tunasand が振るホスト名は `--` を含み、導入先が選ぶ名前とぶつからない、docs/domains.md) */
2
+ export declare const TRIAL_HOST_SUFFIX = "--trial";
3
+ /** 検証用のフラグのプロジェクトの送信が届くホスト名の印(先頭のラベルが `<プロジェクトの ID>--trialsite`。CMS のホスト名と分ける) */
4
+ export declare const TRIAL_SITE_SUFFIX = "--trialsite";
5
+ /** 検証用のフラグのプロジェクトの CMS のホスト名か(先頭のラベルが `<名前>--trial`) */
6
+ export declare const isTrialHost: (host: string) => boolean;
7
+ /** テスト送信が届くホスト名か(先頭のラベルが `<名前>--trialsite`、CMS のホスト名に使えない) */
8
+ export declare const isTrialSiteHost: (host: string) => boolean;
9
+ /** プロジェクトのテスト送信が届くホスト名の先頭のラベル(`<プロジェクトの ID>--trialsite`、ID の base32) */
10
+ export declare const trialSiteLabel: (projectId: string) => string;
@@ -0,0 +1,9 @@
1
+ /** 配信 API の版(パス /content/v1) */
2
+ export declare const DELIVERY_VERSION = 1;
3
+ /** 配信 API の応答で契約の版を示すヘッダー */
4
+ export declare const CONTRACT_VERSION_HEADER = "x-cms-version";
5
+ /** プロジェクトのデータの書き出しの形(JSON の行とファイルの中身のバンドル、書き出しの目録の format と version。実装は L の後) */
6
+ export declare const EXPORT_FORMAT: {
7
+ readonly name: "tunasand-export";
8
+ readonly version: 1;
9
+ };
@@ -6,25 +6,21 @@ export declare const WEBHOOK_CHANGE_ACTIONS: readonly ["created", "updated", "de
6
6
  export type WebhookChangeAction = (typeof WEBHOOK_CHANGE_ACTIONS)[number];
7
7
  /** 送れる操作 */
8
8
  export type WebhookAction = (typeof WEBHOOK_ACTIONS)[number];
9
- /** Webhook の契約の版(本文の version) */
10
- export declare const WEBHOOK_VERSION = 1;
11
- /** Webhook の契約の版 */
12
- export type WebhookVersion = typeof WEBHOOK_VERSION;
13
- /** サーバーの内側のイベントのキー(編集のイベントは <コレクションの id>.<操作>、拡張機能のイベントは宣言の名前) */
9
+ /** サーバーの内側のイベントのキー(編集のイベントは <コレクションの id>.<操作>、アプリのイベントは宣言の名前) */
14
10
  export type WebhookEvent = `${string}.${string}`;
15
- /** 購読するイベント(操作か拡張機能のイベントの名前) */
11
+ /** 購読するイベント(操作かアプリのイベントの名前) */
16
12
  export type WebhookSubscription = WebhookAction | WebhookEvent;
17
13
  /** データの変更の操作か */
18
14
  export declare const isWebhookChangeAction: (value: string) => value is WebhookChangeAction;
19
15
  /**
20
16
  * インストールのイベント(購読によらず送る)
21
- * - uninstalled: アンインストールの最後の知らせ。そのインストールの Webhook(止めた後も、このイベントだけ)と、アプリの削除のエンドポイントへ
17
+ * - deleted: アンインストールの最後の知らせ。そのインストールの Webhook(止めた後も、このイベントだけ)と、アプリの削除のエンドポイントへ
22
18
  */
23
19
  export declare const INSTALLATION_EVENTS: {
24
- readonly uninstalled: "app.uninstalled";
20
+ readonly deleted: "installation.deleted";
25
21
  };
26
22
  /** アンインストールのイベントの値(インストールの ID と登録簿のアプリの ID、旧い形のインストールは null) */
27
- export type InstallationUninstalledData = Readonly<{
23
+ export type InstallationDeletedData = Readonly<{
28
24
  installation_id: string;
29
25
  app_id: string | null;
30
26
  }>;
@@ -37,16 +33,16 @@ export declare function parseWebhookEvent(event: string): Readonly<{
37
33
  collection: string;
38
34
  action: WebhookAction;
39
35
  }> | null;
40
- /** イベントのキーの表示名(types はコレクションの id と表示名でコレクションの表示名と操作の表示名、moduleEvents は拡張機能のイベントの表示名) */
41
- export declare function webhookEventLabel(event: string, collections: Readonly<Record<string, string>>, moduleEvents?: Readonly<Record<string, string>>): string;
42
- /** 購読するイベントの表示名(操作か拡張機能のイベント) */
43
- export declare const webhookSubscriptionLabel: (subscription: string, moduleEvents?: Readonly<Record<string, string>>) => string;
36
+ /** イベントのキーの表示名(types はコレクションの id と表示名でコレクションの表示名と操作の表示名、appEvents はアプリのイベントの表示名) */
37
+ export declare function webhookEventLabel(event: string, collections: Readonly<Record<string, string>>, appEvents?: Readonly<Record<string, string>>): string;
38
+ /** 購読するイベントの表示名(操作かアプリのイベント) */
39
+ export declare const webhookSubscriptionLabel: (subscription: string, appEvents?: Readonly<Record<string, string>>) => string;
44
40
  /** Webhook の形式 */
45
41
  export type WebhookKind = 'json' | 'slack';
46
42
  /**
47
43
  * Webhook(url・secret は末尾だけを伏せずに返す、secret の null は署名なし)
48
44
  * - installationId: 送り先を持つインストール(チャネルかアプリ)。なしは Webhook だけの旧い形のインストール
49
- * - events: 購読するイベント(操作と拡張機能のイベント)、collections: 購読するコレクションの id(編集のイベントは events の操作 × collections)
45
+ * - events: 購読するイベント(操作とアプリのイベント)、collections: 購読するコレクションの id(編集のイベントは events の操作 × collections)
50
46
  * - previousSecret: 鍵の移行の期間の古い鍵の末尾、期間の外は null
51
47
  * - sendOutsideLive: live 以外の環境でも送るか(既定は記録だけ。合成のデータの環境と、方針の無効な live では印があっても送らない)
52
48
  * - lastStatus: 最新の送信で返った HTTP の状態、送れなかったときは0
@@ -66,64 +62,43 @@ export type Webhook = Readonly<{
66
62
  lastStatus: number | null;
67
63
  lastAt: string | null;
68
64
  }>;
65
+ /** レコードのイベントの短い名前(record.<操作>) */
66
+ export type WebhookRecordType = `record.${WebhookAction}`;
67
+ /** レコードのイベントの短い名前 */
68
+ export declare const webhookRecordTypeOf: (action: WebhookAction) => WebhookRecordType;
69
69
  /**
70
- * json の形式の本文(編集機能を持つコレクションのイベント、署名は Standard Webhooks で登録ごとの鍵、webhook-id は本文の id)
71
- * - version: 契約の版(1)
72
- * - id: イベントの ID(再送しても同じ値、受け手は処理済みの id を捨てて重複を除く)
73
- * - event: 操作、collection: コレクションの id とスラッグ
74
- * - item: レコードの id とスラッグと題、by: 操作した人の表示名、at: イベントの日時(ISO 8601、再送しても同じ値)
75
- * - 受け手の同期と突き合わせは id で(スラッグは変更でき、旧いスラッグを別のレコードが使える)
70
+ * json の形式の本文(Standard Webhooks の形、署名は登録ごとの鍵)
71
+ * - type: イベントの短い名前、timestamp: イベントの日時(ISO 8601、再送しても同じ値)
72
+ * - 重複の除去はヘッダーの webhook-id(イベントの ID、全送り先と再送で同じ値)で行う
76
73
  */
77
- export type WebhookBody = Readonly<{
78
- version: WebhookVersion;
79
- id: string;
80
- event: Exclude<WebhookAction, WebhookChangeAction>;
81
- collection: Readonly<{
82
- id: string;
83
- slug: string;
84
- }>;
85
- item: Readonly<{
86
- id: string;
87
- slug: string;
88
- title: string;
89
- }>;
90
- by: string;
91
- at: string;
74
+ export type WebhookMessage<T extends string = string, D = Readonly<Record<string, unknown>>> = Readonly<{
75
+ type: T;
76
+ timestamp: string;
77
+ data: D;
92
78
  }>;
93
79
  /**
94
- * json の形式のデータの変更の本文(レコードの値は持たない。受け手は配信 API で今の値を取り直し、順序の入れ替えに左右されない)
95
- * - id: イベントの ID(変更の記録1件に1つ、全送り先と再送で同じ)
96
- * - at: 変更の一覧の記録の日時(ISO 8601)
97
- * - collection: コレクションの id とスラッグ(消したコレクションのスラッグは null)、item: レコードの id と記録の時点のスラッグ
98
- * - item.previous_slug: スラッグを変えた記録だけ、変更の前のスラッグ(サイトの旧い URL の転送に使う)
80
+ * レコードのイベントの data(編集とデータの変更で同じ形。識別の情報だけで、個人情報とレコードの中身は持たない)
81
+ * - environment: イベントを出した環境の ID(base32)
82
+ * - collection: コレクションの id とスラッグ(消したコレクションのスラッグは null)、record: レコードの id とイベントの時点のスラッグ
83
+ * - record.previous_slug: スラッグを変えた記録だけ、変更の前のスラッグ(サイトの旧い URL の転送に使う)
84
+ * - 受け手は配信 API で今の値を取り直す(順序の入れ替えに左右されない)。同期と突き合わせは id で(スラッグは変更でき、旧いスラッグを別のレコードが使える)
99
85
  */
100
- export type WebhookChangeBody = Readonly<{
101
- version: WebhookVersion;
102
- id: string;
103
- event: WebhookChangeAction;
86
+ export type WebhookRecordData = Readonly<{
87
+ environment: string;
104
88
  collection: Readonly<{
105
89
  id: string;
106
90
  slug: string | null;
107
91
  }>;
108
- item: Readonly<{
92
+ record: Readonly<{
109
93
  id: string;
110
94
  slug: string;
111
95
  previous_slug?: string;
112
96
  }>;
113
- at: string;
114
- }>;
115
- /**
116
- * json の形式の名前つきのイベントの本文(顧客・取り込み・インストール・拡張機能のイベント。Stripe の Event と同じ並び)
117
- * - type: イベントの名前(ドットつき、例 customer.status_changed)、created_at: イベントの日時(ISO 8601、再送しても同じ値)
118
- * - data: イベントの値(顧客のイベントは CustomerEventData)
119
- */
120
- export type WebhookModuleBody = Readonly<{
121
- version: WebhookVersion;
122
- id: string;
123
- type: WebhookEvent;
124
- created_at: string;
125
- data: Readonly<Record<string, unknown>>;
126
97
  }>;
98
+ /** レコードのイベントの本文(timestamp はイベントの日時、データの変更は変更の一覧の記録の日時) */
99
+ export type WebhookBody = WebhookMessage<WebhookRecordType, WebhookRecordData>;
100
+ /** 名前つきのイベントの本文(顧客・取り込み・インストール・アプリのイベント。type は宣言の名前、例 customer.status_changed) */
101
+ export type WebhookAppBody = WebhookMessage<WebhookEvent>;
127
102
  /** 送信の記録(event はイベントのキー、attempt は何回目の送信か、retryAt は次の再送の予定の日時、再送なしは null) */
128
103
  export type WebhookDelivery = Readonly<{
129
104
  id: number;
@@ -0,0 +1,49 @@
1
+ import type { ErrorCode, ErrorParams } from './errors.js';
2
+ import { type ContentAccess } from './permissions.js';
3
+ import type { User } from './roles.js';
4
+ /** コレクションの公開の管理(schema の Publishing と同じ値) */
5
+ export type WorkflowPublishing = 'none' | 'draft' | 'review';
6
+ /** レコードの派生の状態 */
7
+ export declare const RECORD_STATES: readonly ["draft", "returned", "review", "scheduled", "published"];
8
+ export type RecordState = (typeof RECORD_STATES)[number];
9
+ /** 公開中・予約のレコードの未公開の変更(none はなし、review はレビュー待ち) */
10
+ export type RecordChanges = 'none' | 'draft' | 'review';
11
+ /** レコードの操作(publish は公開・予約・再公開・変更の公開、unpublish は下書きに戻す・予約の取り消し、discard は未公開の変更の破棄) */
12
+ export declare const RECORD_ACTIONS: readonly ["save", "submit", "reject", "publish", "unpublish", "discard", "delete", "assign"];
13
+ export type RecordAction = (typeof RECORD_ACTIONS)[number];
14
+ /** 判定に使うレコードの値(API の形: has_draft・draft_status は未公開の変更、持ち主の項目と created_by を含む) */
15
+ export type RecordRow = ContentAccess & Readonly<{
16
+ published_at?: unknown;
17
+ review_note?: unknown;
18
+ has_draft?: unknown;
19
+ draft_status?: unknown;
20
+ }>;
21
+ type Subject = Pick<User, 'permissions' | 'id' | 'recordId' | 'link'>;
22
+ /** 判定の材料(target はコレクションの id、now は ISO の日時) */
23
+ export type RecordGuardInput = Readonly<{
24
+ publishing: WorkflowPublishing;
25
+ user: Subject;
26
+ target: string;
27
+ row: RecordRow;
28
+ now: string;
29
+ }>;
30
+ /** 判定の結果(拒否はエラーのコードと引数) */
31
+ export type RecordGuard = {
32
+ ok: true;
33
+ } | {
34
+ ok: false;
35
+ code: Exclude<ErrorCode, 'network_error'>;
36
+ params?: ErrorParams;
37
+ };
38
+ /** レコードの派生の状態と未公開の変更 */
39
+ export declare function recordStateOf(row: RecordRow, now: string): {
40
+ state: RecordState;
41
+ changes: RecordChanges;
42
+ };
43
+ /** 公開中か予約の状態か */
44
+ export declare const isLiveState: (state: RecordState) => boolean;
45
+ /** レコードの操作の可否 */
46
+ export declare function recordGuard({ publishing, user, target, row, now }: RecordGuardInput, action: RecordAction): RecordGuard;
47
+ /** レコードに許される操作(RECORD_ACTIONS の順) */
48
+ export declare const recordActions: (input: RecordGuardInput) => RecordAction[];
49
+ export {};
@@ -0,0 +1,73 @@
1
+ import type { AppBase } from './appDefinition.js';
2
+ import type { AppSettingDef } from './appDependencies.js';
3
+ import type { ConnectionPoint, PermissionTarget } from './apps.js';
4
+ /** 標準の機能の1つの状態(API /api/apps/standard の行、標準の機能の並びの順) */
5
+ export type StandardAppState = Readonly<{
6
+ id: string;
7
+ label: string;
8
+ description: string;
9
+ /** 止められない標準の機能(レジストリの standard_apps の required) */
10
+ required: boolean;
11
+ /** この環境に入れたか(入れていなければ追加の候補) */
12
+ installed: boolean;
13
+ enabled: boolean;
14
+ permissions: readonly PermissionTarget[];
15
+ /** 必要な外部の接続と、接続済みか */
16
+ connections: readonly (ConnectionPoint & Readonly<{
17
+ connected: boolean;
18
+ }>)[];
19
+ settingFields: readonly AppSettingDef[];
20
+ /** 設定のページで編集する項目の現在値(キーは settingFields の key) */
21
+ settings: Readonly<Record<string, unknown>>;
22
+ /** 設定値の入力(画面で保存した値、ワークスペース・MCP が manifest.settings で解釈) */
23
+ settingsInput: Readonly<Record<string, unknown>>;
24
+ /** サーバーの側が追加するもの(定期の処理・記事の規則は表示名) */
25
+ adds: Readonly<{
26
+ jobs: readonly string[];
27
+ rules: readonly string[];
28
+ delivery: boolean;
29
+ }>;
30
+ }>;
31
+ /** 標準の機能の切り替えと設定の保存(PUT /api/apps/standard/:id の本文) */
32
+ export type StandardAppUpdate = Readonly<{
33
+ enabled?: boolean;
34
+ settings?: Readonly<Record<string, unknown>>;
35
+ }>;
36
+ /**
37
+ * カレンダーの予定(API /api/calendar の行、at は ISO 8601、path はワークスペースの経路)
38
+ * - source: 記事の公開は core、設定で掲載する日付のフィールドは calendarFieldSource
39
+ */
40
+ export type CalendarItem = Readonly<{
41
+ source: string;
42
+ id: string;
43
+ title: string;
44
+ at: string;
45
+ path: string | null;
46
+ }>;
47
+ /** カレンダーに掲載する日付のフィールド(type はコレクションの id、field は最上位の date・datetime のフィールドのキー) */
48
+ export type CalendarField = Readonly<{
49
+ collection: string;
50
+ field: string;
51
+ }>;
52
+ /** 日付のフィールドの予定が持つ source(`field:<コレクション>.<フィールド>`) */
53
+ export declare const calendarFieldSource: (f: CalendarField) => string;
54
+ /**
55
+ * 対応待ちの行(API /api/inbox の items)
56
+ * - kind: レビュー待ちは review、承認待ちは request、アプリはその id
57
+ * - type: 対象のコレクションの id(件数だけのレコードは null)
58
+ * - title: 対象の名前で件数だけの行は null、count: 件数で1件の行は1
59
+ * - by: 提出・依頼した人、at: 最新の日時(UTC の ISO 8601)、path: ワークスペースの経路
60
+ */
61
+ export type PendingItem = Readonly<{
62
+ kind: string;
63
+ collection: string | null;
64
+ title: string | null;
65
+ count: number;
66
+ by: string | null;
67
+ at: string | null;
68
+ path: string | null;
69
+ }>;
70
+ /** 権限の対象の一覧(アプリの id つき、id の重複は例外) */
71
+ export declare function permissionTargetsOf(apps: readonly Pick<AppBase, 'id' | 'about'>[]): readonly (PermissionTarget & Readonly<{
72
+ app: string;
73
+ }>)[];
@@ -0,0 +1,4 @@
1
+ /** ワークスペースのコレクションの経路(URL はレコードのスラッグ、record を省くと一覧) */
2
+ export declare const workspaceRecordPath: (collection: Readonly<{
3
+ slug: string;
4
+ }>, record?: Readonly<Record<string, unknown>>) => string;