@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
package/dist/analytics.js CHANGED
@@ -1,5 +1,611 @@
1
+ import "./errorLabels-aT2bnMsO.js";
2
+ import { l as ACTOR_KINDS } from "./apps-DIxAWBSZ.js";
3
+ import "./embeds-B-Dbn64k.js";
4
+ import "./bridge-Dv4NxGZ7.js";
5
+ import { a as END_USER_STATUSES, i as END_USER_EVENTS } from "./endUsers-DODfjnv1.js";
6
+ import { o as IMPORT_EVENTS } from "./workflow-CUpl6hO_.js";
7
+ import { c as schemaProblemText } from "./schema-Dcg1ajnW.js";
8
+ import { z } from "zod";
1
9
  import { defineEventSchema, isBotUserAgent } from "@ryusenkei/web/analytics";
2
- // ../analytics/src/day.ts
10
+ // ../contract/src/webhooks.ts
11
+ /** 送れる操作(公開・非公開と、データの変更の作成・更新・削除) */
12
+ const WEBHOOK_ACTIONS = [
13
+ "published",
14
+ "unpublished",
15
+ "created",
16
+ "updated",
17
+ "deleted"
18
+ ];
19
+ /**
20
+ * インストールのイベント(購読によらず送る)
21
+ * - deleted: アンインストールの最後の知らせ。そのインストールの Webhook(止めた後も、このイベントだけ)と、アプリの削除のエンドポイントへ
22
+ */
23
+ const INSTALLATION_EVENTS = { deleted: "installation.deleted" };
24
+ /** レコードのイベントの短い名前 */
25
+ const webhookRecordTypeOf = (action) => `record.${action}`;
26
+ // ../contract/src/forms.ts
27
+ /** フォームのイベント(送信の値を持たない薄い本文) */
28
+ const FORM_EVENTS = { submitted: "form.submitted" };
29
+ // ../contract/src/hostingRpc.ts
30
+ const SITE_REF = ["projectId", "assignmentId"];
31
+ /**
32
+ * 運営者の操作ごとの RPC のメソッドと、入力の欄(どれも空でない文字列)
33
+ * method が null の操作はコアのドメインが受ける(tunasand-hosting へは syncHostnames でコピーする)
34
+ */
35
+ const HOSTING_OPERATIONS = {
36
+ stop: {
37
+ method: "stopSite",
38
+ fields: [...SITE_REF, "reason"]
39
+ },
40
+ resume: {
41
+ method: "resumeSite",
42
+ fields: SITE_REF
43
+ },
44
+ reattach: {
45
+ method: "reattachResources",
46
+ fields: SITE_REF
47
+ },
48
+ purge: {
49
+ method: "purgeSiteResources",
50
+ fields: SITE_REF
51
+ },
52
+ hostname_request: {
53
+ method: null,
54
+ fields: [...SITE_REF, "hostname"]
55
+ },
56
+ hostname_verify: {
57
+ method: null,
58
+ fields: [...SITE_REF, "hostname"]
59
+ },
60
+ hostname_status: {
61
+ method: null,
62
+ fields: [...SITE_REF, "hostname"]
63
+ },
64
+ hostname_remove: {
65
+ method: null,
66
+ fields: [...SITE_REF, "hostname"]
67
+ },
68
+ trial_hostname: {
69
+ method: null,
70
+ fields: [...SITE_REF, "name"]
71
+ },
72
+ ack: {
73
+ method: "acknowledgeAlert",
74
+ fields: ["id"]
75
+ }
76
+ };
77
+ Object.keys(HOSTING_OPERATIONS);
78
+ // ../contract/src/legacyAuditLabels.ts
79
+ /** 連携の登録の旧い文の対象の名前(target_type ごと) */
80
+ const LEGACY_REGISTRATION_NAMES = {
81
+ webhook: "Webhook ",
82
+ external_function: "外部関数",
83
+ external_screen: "外の画面"
84
+ };
85
+ const LEGACY_REGISTRATION_SUFFIXES = [
86
+ ["を追加", "integration.create"],
87
+ ["を変更", "integration.update"],
88
+ ["を削除", "integration.delete"],
89
+ ["の署名の鍵を再発行", "integration.rotateSecret"],
90
+ ["の古い署名の鍵を失効", "integration.revokePreviousSecret"]
91
+ ];
92
+ ({ ...Object.fromEntries(Object.values(LEGACY_REGISTRATION_NAMES).flatMap((name) => LEGACY_REGISTRATION_SUFFIXES.map(([suffix, code]) => [`${name}${suffix}`, code]))) });
93
+ // ../contract/src/operatorOperations.ts
94
+ const ov = { screen: "overview" };
95
+ const tab = (t) => ({
96
+ screen: "project",
97
+ tab: t
98
+ });
99
+ /** 操作の全部 */
100
+ const OPERATOR_OPERATIONS = [
101
+ {
102
+ id: "health",
103
+ cli: "health",
104
+ method: "GET",
105
+ path: "/health",
106
+ level: "read",
107
+ place: { screen: "monitoring" },
108
+ available: true
109
+ },
110
+ {
111
+ id: "secrets",
112
+ cli: "secrets",
113
+ method: "GET",
114
+ path: "/secrets",
115
+ level: "read",
116
+ place: { screen: "maintenance" },
117
+ available: true
118
+ },
119
+ {
120
+ id: "migrate",
121
+ cli: "migrate",
122
+ method: "POST",
123
+ path: "/migrate",
124
+ level: "reversible",
125
+ place: { screen: "maintenance" },
126
+ available: true
127
+ },
128
+ {
129
+ id: "session",
130
+ cli: "session",
131
+ method: "GET",
132
+ path: "/session",
133
+ level: "read",
134
+ place: { screen: "account" },
135
+ available: true
136
+ },
137
+ {
138
+ id: "paused",
139
+ cli: "paused",
140
+ method: "GET",
141
+ path: "/paused",
142
+ level: "read",
143
+ place: { screen: "maintenance" },
144
+ available: true
145
+ },
146
+ {
147
+ id: "pause",
148
+ cli: "pause",
149
+ method: "POST",
150
+ path: "/pause",
151
+ level: "heavy",
152
+ place: { screen: "maintenance" },
153
+ available: true
154
+ },
155
+ {
156
+ id: "resume",
157
+ cli: "resume",
158
+ method: "POST",
159
+ path: "/resume",
160
+ level: "reversible",
161
+ place: { screen: "maintenance" },
162
+ available: true
163
+ },
164
+ {
165
+ id: "projects",
166
+ cli: "projects",
167
+ method: "GET",
168
+ path: "/projects",
169
+ level: "read",
170
+ place: { screen: "projects" },
171
+ available: true
172
+ },
173
+ {
174
+ id: "create",
175
+ cli: "create",
176
+ method: "POST",
177
+ path: "/projects",
178
+ level: "reversible",
179
+ place: { screen: "projects" },
180
+ available: true
181
+ },
182
+ {
183
+ id: "hosting",
184
+ cli: "hosting",
185
+ method: "POST",
186
+ path: "/hosting",
187
+ level: "heavy",
188
+ place: { screen: "hosting" },
189
+ available: true
190
+ },
191
+ {
192
+ id: "history",
193
+ cli: "history",
194
+ method: "GET",
195
+ path: "/history",
196
+ level: "read",
197
+ place: { screen: "history" },
198
+ available: true
199
+ },
200
+ {
201
+ id: "standard-apps",
202
+ cli: "standard-apps",
203
+ method: "GET",
204
+ path: "/standard-apps",
205
+ level: "read",
206
+ place: { screen: "apps" },
207
+ available: true
208
+ },
209
+ {
210
+ id: "standard-app-set",
211
+ cli: "standard-app-set",
212
+ method: "POST",
213
+ path: "/standard-apps/{app}",
214
+ level: "heavy",
215
+ place: { screen: "apps" },
216
+ available: true
217
+ },
218
+ {
219
+ id: "standard-app-remove",
220
+ cli: "standard-app-remove",
221
+ method: "POST",
222
+ path: "/standard-apps/{app}/remove",
223
+ level: "heavy",
224
+ place: { screen: "apps" },
225
+ available: true
226
+ },
227
+ {
228
+ id: "apps",
229
+ cli: "apps",
230
+ method: "GET",
231
+ path: "/apps",
232
+ level: "read",
233
+ place: { screen: "apps" },
234
+ available: true
235
+ },
236
+ {
237
+ id: "app-register",
238
+ cli: "app-register",
239
+ method: "POST",
240
+ path: "/apps/{app}",
241
+ level: "heavy",
242
+ place: { screen: "apps" },
243
+ available: true
244
+ },
245
+ {
246
+ id: "app-publish",
247
+ cli: "app-publish",
248
+ method: "POST",
249
+ path: "/apps/{app}/versions",
250
+ level: "heavy",
251
+ place: { screen: "apps" },
252
+ available: true
253
+ },
254
+ {
255
+ id: "app-keys",
256
+ cli: "app-keys",
257
+ method: "POST",
258
+ path: "/apps/{app}/keys",
259
+ level: "heavy",
260
+ place: { screen: "apps" },
261
+ available: true
262
+ },
263
+ {
264
+ id: "registry-backups",
265
+ cli: "backups",
266
+ method: "GET",
267
+ path: "/backups?registry",
268
+ level: "read",
269
+ place: { screen: "maintenance" },
270
+ available: true
271
+ },
272
+ {
273
+ id: "registry-backup",
274
+ cli: "backup",
275
+ method: "POST",
276
+ path: "/backups/registry",
277
+ level: "reversible",
278
+ place: { screen: "maintenance" },
279
+ available: true
280
+ },
281
+ {
282
+ id: "registry-download",
283
+ cli: "backup:download",
284
+ method: "GET",
285
+ path: "/backups/download?registry",
286
+ level: "read",
287
+ place: { screen: "maintenance" },
288
+ available: true
289
+ },
290
+ {
291
+ id: "project",
292
+ cli: "project",
293
+ method: "GET",
294
+ path: "/projects/{project}",
295
+ level: "read",
296
+ place: tab("overview"),
297
+ available: true
298
+ },
299
+ {
300
+ id: "sites",
301
+ method: "GET",
302
+ path: "/projects/{project}/sites",
303
+ level: "read",
304
+ place: tab("hosts"),
305
+ available: true
306
+ },
307
+ {
308
+ id: "project-history",
309
+ cli: "history",
310
+ method: "GET",
311
+ path: "/history?project={project}",
312
+ level: "read",
313
+ place: tab("overview"),
314
+ available: true
315
+ },
316
+ {
317
+ id: "delete-project",
318
+ cli: "delete-project",
319
+ method: "POST",
320
+ path: "/projects/{project}/delete-project",
321
+ level: "irreversible",
322
+ place: tab("overview"),
323
+ available: true
324
+ },
325
+ {
326
+ id: "delete-trial",
327
+ cli: "delete-trial",
328
+ method: "POST",
329
+ path: "/projects/{project}/delete-trial",
330
+ level: "irreversible",
331
+ place: tab("overview"),
332
+ when: "trial",
333
+ available: true
334
+ },
335
+ {
336
+ id: "create-env",
337
+ cli: "create-env",
338
+ method: "POST",
339
+ path: "/projects/{project}/environments",
340
+ level: "reversible",
341
+ place: tab("environments"),
342
+ available: true
343
+ },
344
+ {
345
+ id: "copy-env",
346
+ cli: "copy-env",
347
+ method: "POST",
348
+ path: "/projects/{project}/copy-environment",
349
+ level: "heavy",
350
+ place: tab("environments"),
351
+ available: true
352
+ },
353
+ {
354
+ id: "delete-env",
355
+ cli: "delete-env",
356
+ method: "POST",
357
+ path: "/projects/{project}/delete-environment",
358
+ level: "irreversible",
359
+ place: tab("environments"),
360
+ when: "notLive",
361
+ available: true
362
+ },
363
+ {
364
+ id: "freeze",
365
+ cli: "freeze",
366
+ method: "POST",
367
+ path: "/projects/{project}/freeze",
368
+ level: "heavy",
369
+ place: tab("environments"),
370
+ available: true
371
+ },
372
+ {
373
+ id: "unfreeze",
374
+ cli: "unfreeze",
375
+ method: "POST",
376
+ path: "/projects/{project}/unfreeze",
377
+ level: "reversible",
378
+ place: tab("environments"),
379
+ available: true
380
+ },
381
+ {
382
+ id: "promote-plan",
383
+ cli: "promote-plan",
384
+ method: "POST",
385
+ path: "/projects/{project}/promote-plan",
386
+ level: "read",
387
+ place: tab("environments"),
388
+ when: "notLive",
389
+ available: true
390
+ },
391
+ {
392
+ id: "promote-commit",
393
+ cli: "promote-commit",
394
+ method: "POST",
395
+ path: "/projects/{project}/promote-commit",
396
+ level: "heavy",
397
+ place: tab("environments"),
398
+ when: "notLive",
399
+ available: true
400
+ },
401
+ {
402
+ id: "prune",
403
+ cli: "prune",
404
+ method: "POST",
405
+ path: "/projects/{project}/prune",
406
+ level: "irreversible",
407
+ place: tab("environments"),
408
+ environment: true,
409
+ dryRun: true,
410
+ available: true
411
+ },
412
+ {
413
+ id: "backups",
414
+ cli: "backups",
415
+ method: "GET",
416
+ path: "/backups?project={project}",
417
+ level: "read",
418
+ place: tab("backups"),
419
+ environment: true,
420
+ available: true
421
+ },
422
+ {
423
+ id: "download",
424
+ cli: "backup:download",
425
+ method: "GET",
426
+ path: "/backups/download?project={project}",
427
+ level: "read",
428
+ place: tab("backups"),
429
+ environment: true,
430
+ available: true
431
+ },
432
+ {
433
+ id: "backup",
434
+ cli: "backup",
435
+ method: "POST",
436
+ path: "/projects/{project}/backup",
437
+ level: "reversible",
438
+ place: tab("backups"),
439
+ environment: true,
440
+ available: true
441
+ },
442
+ {
443
+ id: "restore",
444
+ cli: "restore",
445
+ method: "POST",
446
+ path: "/projects/{project}/restore",
447
+ level: "irreversible",
448
+ place: tab("backups"),
449
+ environment: true,
450
+ dryRun: true,
451
+ available: true
452
+ },
453
+ {
454
+ id: "import",
455
+ cli: "import",
456
+ method: "POST",
457
+ path: "/projects/{project}/import",
458
+ level: "irreversible",
459
+ place: tab("backups"),
460
+ environment: true,
461
+ dryRun: true,
462
+ available: true
463
+ },
464
+ {
465
+ id: "switch-host",
466
+ cli: "switch-host",
467
+ method: "POST",
468
+ path: "/projects/{project}/hosts",
469
+ level: "heavy",
470
+ place: tab("hosts"),
471
+ available: true
472
+ },
473
+ {
474
+ id: "set-host",
475
+ cli: "set-host",
476
+ method: "POST",
477
+ path: "/projects/{project}/hosts",
478
+ level: "heavy",
479
+ place: tab("hosts"),
480
+ available: true
481
+ },
482
+ {
483
+ id: "remove-alias",
484
+ cli: "remove-alias",
485
+ method: "POST",
486
+ path: "/projects/{project}/hosts",
487
+ level: "heavy",
488
+ place: tab("hosts"),
489
+ available: true
490
+ },
491
+ {
492
+ id: "emergency",
493
+ cli: "emergency",
494
+ method: "POST",
495
+ path: "/projects/{project}/emergency",
496
+ level: "heavy",
497
+ place: tab("access"),
498
+ available: true
499
+ },
500
+ {
501
+ id: "revoke-grants",
502
+ cli: "revoke-grants",
503
+ method: "POST",
504
+ path: "/projects/{project}/revoke-grants",
505
+ level: "reversible",
506
+ place: tab("access"),
507
+ environment: true,
508
+ available: true
509
+ },
510
+ {
511
+ id: "api-key-create",
512
+ cli: "api-key-create",
513
+ method: "POST",
514
+ path: "/projects/{project}/api-key-create",
515
+ level: "heavy",
516
+ secret: true,
517
+ place: tab("access"),
518
+ available: true
519
+ },
520
+ {
521
+ id: "test-integration",
522
+ cli: "test-integration",
523
+ method: "POST",
524
+ path: "/projects/{project}/integrations/{registration}/test",
525
+ level: "reversible",
526
+ place: tab("access"),
527
+ available: true
528
+ },
529
+ {
530
+ id: "trial-session",
531
+ cli: "trial-session",
532
+ method: "POST",
533
+ path: "/projects/{project}/trial-session",
534
+ level: "reversible",
535
+ secret: true,
536
+ place: tab("trial"),
537
+ when: "trial",
538
+ environment: true,
539
+ available: true
540
+ },
541
+ {
542
+ id: "organization-create",
543
+ level: "reversible",
544
+ place: { screen: "organizations" },
545
+ available: false
546
+ },
547
+ {
548
+ id: "organization-approve",
549
+ level: "reversible",
550
+ place: { screen: "organizations" },
551
+ available: false
552
+ },
553
+ {
554
+ id: "organization-reject",
555
+ level: "reversible",
556
+ place: { screen: "organizations" },
557
+ available: false
558
+ },
559
+ {
560
+ id: "organization-suspend",
561
+ level: "heavy",
562
+ place: { screen: "organization" },
563
+ available: false
564
+ },
565
+ {
566
+ id: "account-search",
567
+ level: "read",
568
+ place: ov,
569
+ available: false
570
+ },
571
+ {
572
+ id: "app-verify",
573
+ level: "reversible",
574
+ place: { screen: "apps" },
575
+ available: false
576
+ },
577
+ {
578
+ id: "app-unverify",
579
+ level: "reversible",
580
+ place: { screen: "apps" },
581
+ available: false
582
+ },
583
+ {
584
+ id: "app-suspend",
585
+ level: "heavy",
586
+ place: { screen: "apps" },
587
+ available: false
588
+ },
589
+ {
590
+ id: "feature-flags",
591
+ level: "reversible",
592
+ place: { screen: "maintenance" },
593
+ available: false
594
+ },
595
+ {
596
+ id: "history-export",
597
+ level: "read",
598
+ place: { screen: "history" },
599
+ available: false
600
+ }
601
+ ];
602
+ new Map(OPERATOR_OPERATIONS.map((o) => [o.id, o]));
603
+ const patternOf = (path) => new RegExp(`^${path.split("?")[0].replace(/\{\w+\}/g, "[^/]+")}$`);
604
+ OPERATOR_OPERATIONS.flatMap((o) => "path" in o && o.method === "POST" ? [{
605
+ op: o,
606
+ pattern: patternOf(o.path)
607
+ }] : []);
608
+ // ../contract/src/day.ts
3
609
  /** 時間帯 timeZone での日付(YYYY-MM-DD、例: timeZone は Asia/Tokyo) */
4
610
  const dayIn = (timeZone, at = /* @__PURE__ */ new Date()) => new Intl.DateTimeFormat("en-CA", {
5
611
  timeZone,
@@ -7,7 +613,7 @@ const dayIn = (timeZone, at = /* @__PURE__ */ new Date()) => new Intl.DateTimeFo
7
613
  month: "2-digit",
8
614
  day: "2-digit"
9
615
  }).format(at);
10
- // ../analytics/src/view.ts
616
+ // ../contract/src/viewEvent.ts
11
617
  /** 位置で持つ記録先の列の順 */
12
618
  const VIEW_COLUMNS = [
13
619
  "kind",
@@ -17,14 +623,6 @@ const VIEW_COLUMNS = [
17
623
  "event",
18
624
  "project"
19
625
  ];
20
- /**
21
- * 閲覧のイベントの形(toolkit の analyticsEngineRecorder・analyticsEngineCounts に渡す)
22
- * - index: プロジェクト、指定なしは種類(Analytics Engine は index ごとに標本を抽出するため、共有のデータセットで小さなプロジェクトの記録が間引かれないように)
23
- */
24
- const VIEW_SCHEMA = defineEventSchema({
25
- blobs: VIEW_COLUMNS,
26
- index: (view) => view.project ?? view.kind ?? ""
27
- });
28
626
  /** 閲覧のイベント(対象: GET で応答が200の HTML・ボット以外、ほかは null) */
29
627
  function viewOf(request, response, { classify, timeZone, project }) {
30
628
  if (request.method !== "GET" || response.status !== 200) return null;
@@ -40,4 +638,53 @@ function viewOf(request, response, { classify, timeZone, project }) {
40
638
  ...project !== void 0 && { project }
41
639
  };
42
640
  }
641
+ schemaProblemText("date_time_invalid");
642
+ // ../contract/src/eventSchemas.ts
643
+ const id = z.string();
644
+ const ref = z.object({ id });
645
+ /** レコードのイベントの data(record.<操作> と form.submitted。説明は WebhookRecordData) */
646
+ const RECORD_EVENT_DATA = z.object({
647
+ environment: id,
648
+ collection: z.object({
649
+ id,
650
+ slug: z.string().nullable()
651
+ }),
652
+ record: z.object({
653
+ id,
654
+ slug: z.string(),
655
+ previous_slug: z.string().optional()
656
+ })
657
+ });
658
+ z.object({
659
+ environment: id,
660
+ collection: ref,
661
+ record: ref,
662
+ actor: z.object({ kind: z.enum(ACTOR_KINDS) })
663
+ });
664
+ z.object({
665
+ end_user_id: id,
666
+ from: z.enum(END_USER_STATUSES).nullable(),
667
+ to: z.enum(END_USER_STATUSES).nullable()
668
+ });
669
+ z.object({
670
+ run_id: id,
671
+ source: z.string(),
672
+ rows: z.record(z.string(), z.number().int())
673
+ });
674
+ z.object({
675
+ installation_id: id,
676
+ app_id: z.string().nullable()
677
+ });
678
+ ({ ...Object.fromEntries(WEBHOOK_ACTIONS.map((action) => [webhookRecordTypeOf(action), RECORD_EVENT_DATA])) }), FORM_EVENTS.submitted, END_USER_EVENTS.statusChanged, END_USER_EVENTS.deleted, IMPORT_EVENTS.completed, INSTALLATION_EVENTS.deleted;
679
+ // ../adapter-cloudflare/src/eventLog/viewSchema.ts
680
+ /**
681
+ * 閲覧のイベントの Analytics Engine の形(toolkit の analyticsEngineRecorder・analyticsEngineCounts に渡す)
682
+ * - blobs: VIEW_COLUMNS の順に blob1〜blob6
683
+ * - index: プロジェクト、指定なしは種類(Analytics Engine は index ごとに標本を抽出するため、共有のデータセットで小さなプロジェクトの記録が間引かれないように)
684
+ * - 公開の SDK の analytics がサイトの記録の側に同じ値を公開する
685
+ */
686
+ const VIEW_SCHEMA = defineEventSchema({
687
+ blobs: VIEW_COLUMNS,
688
+ index: (view) => view.project ?? view.kind ?? ""
689
+ });
43
690
  export { VIEW_COLUMNS, VIEW_SCHEMA, viewOf };