@tunasand/sdk 0.6.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 (186) hide show
  1. package/CHANGELOG.md +116 -84
  2. package/README.md +209 -195
  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 +39 -8
  14. package/dist/embeds-B5V54Zur.js +34 -0
  15. package/dist/{errorLabels-BcyRbv_i.js → errorLabels-BgtQ_zUn.js} +277 -264
  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 +18 -16
  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 +2 -2
  126. package/dist/types/sdk/src/delivery/media.d.ts +17 -3
  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 +3 -3
  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/model/src/brand.d.ts +0 -25
  153. package/dist/types/model/src/legacy.d.ts +0 -2
  154. package/dist/types/model/src/typesSource.d.ts +0 -8
  155. package/dist/types/sdk/src/model.d.ts +0 -5
  156. /package/dist/types/{cms-contract → contract}/src/appProblems.d.ts +0 -0
  157. /package/dist/types/{cms-contract → contract}/src/consents.d.ts +0 -0
  158. /package/dist/types/{cms-contract → contract}/src/customerLabels.d.ts +0 -0
  159. /package/dist/types/{analytics → contract}/src/day.d.ts +0 -0
  160. /package/dist/types/{cms-contract → contract}/src/functionLabels.d.ts +0 -0
  161. /package/dist/types/{cms-contract → contract}/src/permissionLabels.d.ts +0 -0
  162. /package/dist/types/{cms-contract → contract}/src/siteArtifact.d.ts +0 -0
  163. /package/dist/types/{cms-contract → contract}/src/siteDeclaration.d.ts +0 -0
  164. /package/dist/types/{analytics/src/view.d.ts → contract/src/viewEvent.d.ts} +0 -0
  165. /package/dist/types/{cms-contract → contract}/src/views.d.ts +0 -0
  166. /package/dist/types/{cms-contract → contract}/src/webhookLabels.d.ts +0 -0
  167. /package/dist/types/{body → rich-text}/src/components.d.ts +0 -0
  168. /package/dist/types/{body → rich-text}/src/derive.d.ts +0 -0
  169. /package/dist/types/{body → rich-text}/src/description.d.ts +0 -0
  170. /package/dist/types/{body → rich-text}/src/href.d.ts +0 -0
  171. /package/dist/types/{body → rich-text}/src/html.d.ts +0 -0
  172. /package/dist/types/{body → rich-text}/src/index.d.ts +0 -0
  173. /package/dist/types/{body → rich-text}/src/inline.d.ts +0 -0
  174. /package/dist/types/{body → rich-text}/src/labels/en.d.ts +0 -0
  175. /package/dist/types/{body → rich-text}/src/library.d.ts +0 -0
  176. /package/dist/types/{body → rich-text}/src/markdown.d.ts +0 -0
  177. /package/dist/types/{body → rich-text}/src/normalize.d.ts +0 -0
  178. /package/dist/types/{body → rich-text}/src/problems.d.ts +0 -0
  179. /package/dist/types/{body → rich-text}/src/render.d.ts +0 -0
  180. /package/dist/types/{body → rich-text}/src/schema.d.ts +0 -0
  181. /package/dist/types/{body → rich-text}/src/standard.d.ts +0 -0
  182. /package/dist/types/{body → rich-text}/src/types.d.ts +0 -0
  183. /package/dist/types/{model → schema}/src/contact.d.ts +0 -0
  184. /package/dist/types/{model → schema}/src/json.d.ts +0 -0
  185. /package/dist/types/{model → schema}/src/screens.d.ts +0 -0
  186. /package/dist/types/{model → schema}/src/time.d.ts +0 -0
@@ -1,90 +0,0 @@
1
- import { c as formatMessage, f as problemText, l as problemFactory, n as BODY_PROBLEM_MESSAGES, r as CORE_COMPONENT_LABELS, t as BODY_GUIDE_LABELS } from "./ja-C1HEWWTQ.js";
2
- // ../body/src/problems.ts
3
- /** 本文の検査の問題を作る */
4
- const bodyProblem = problemFactory(BODY_PROBLEM_MESSAGES);
5
- /** 問題の英語の既定の文(zod の message と検査の issues に入れ、problemOf で戻す) */
6
- const bodyProblemText = (code, ...params) => problemText(bodyProblem(code, ...params));
7
- /** Markdown の説明の文言 */
8
- const guideText = (key, ...params) => formatMessage(BODY_GUIDE_LABELS[key], params[0]);
9
- /** 部品の説明の文言(核の部品の説明と、宣言した部品の説明の組み立て) */
10
- const componentText = (key, ...params) => formatMessage(CORE_COMPONENT_LABELS[key], params[0]);
11
- // ../body/src/embed.ts
12
- /** 埋め込めるサービス */
13
- const EMBED_PROVIDERS = [
14
- "youtube",
15
- "vimeo",
16
- "x",
17
- "instagram",
18
- "spotify",
19
- "apple-podcasts"
20
- ];
21
- const ID = /^[\w-]{1,64}$/;
22
- /** 開始の秒(YouTube の t=1m30s・t=90・start=90) */
23
- function startOf(params) {
24
- const raw = params.get("t") ?? params.get("start");
25
- if (!raw) return void 0;
26
- const m = raw.match(/^(?:(\d+)h)?(?:(\d+)m)?(?:(\d+)s?)?$/);
27
- if (!m) return void 0;
28
- const sec = Number(m[1] ?? 0) * 3600 + Number(m[2] ?? 0) * 60 + Number(m[3] ?? 0);
29
- return sec > 0 ? sec : void 0;
30
- }
31
- /** URL から埋め込み(埋め込めるサービスでなければ null) */
32
- function embedOfUrl(raw) {
33
- const url = URL.parse(raw);
34
- if (!url || url.protocol !== "https:") return null;
35
- const host = url.hostname.replace(/^(www|m)\./, "");
36
- const path = url.pathname.split("/").filter(Boolean);
37
- const pick = (provider, id, start) => id && ID.test(id) ? {
38
- provider,
39
- id,
40
- ...start ? { start } : {}
41
- } : null;
42
- switch (host) {
43
- case "youtube.com":
44
- case "youtube-nocookie.com":
45
- if (path[0] === "watch") return pick("youtube", url.searchParams.get("v") ?? void 0, startOf(url.searchParams));
46
- if (path[0] === "embed" || path[0] === "shorts" || path[0] === "live") return pick("youtube", path[1], startOf(url.searchParams));
47
- return null;
48
- case "youtu.be": return pick("youtube", path[0], startOf(url.searchParams));
49
- case "vimeo.com": return pick("vimeo", path.find((p) => /^\d+$/.test(p)));
50
- case "player.vimeo.com": return path[0] === "video" ? pick("vimeo", path[1]) : null;
51
- case "twitter.com":
52
- case "x.com": return path[1] === "status" ? pick("x", path[2]) : null;
53
- case "instagram.com": return path[0] === "p" || path[0] === "reel" ? pick("instagram", path[1]) : null;
54
- case "open.spotify.com": {
55
- const [kind, id] = (path[0] === "embed" ? path.slice(1) : path).filter((p) => !p.startsWith("intl-"));
56
- return kind && [
57
- "track",
58
- "album",
59
- "playlist",
60
- "episode",
61
- "show"
62
- ].includes(kind) && id && ID.test(id) ? {
63
- provider: "spotify",
64
- id: `${kind}/${id}`
65
- } : null;
66
- }
67
- case "podcasts.apple.com": {
68
- const show = path.find((p) => /^id\d+$/.test(p));
69
- const episode = url.searchParams.get("i");
70
- return show ? pick("apple-podcasts", episode ? `${show}-${episode}` : show) : null;
71
- }
72
- default: return null;
73
- }
74
- }
75
- /** 描画の iframe の URL(サービスと ID から組み立てる、X と Instagram は埋め込みのページ) */
76
- function embedSrcOf(target) {
77
- const id = encodeURIComponent(target.id).replaceAll("%2F", "/");
78
- switch (target.provider) {
79
- case "youtube": return `https://www.youtube-nocookie.com/embed/${id}${target.start ? `?start=${target.start}` : ""}`;
80
- case "vimeo": return `https://player.vimeo.com/video/${id}${target.start ? `#t=${target.start}s` : ""}`;
81
- case "x": return `https://platform.twitter.com/embed/Tweet.html?id=${id}`;
82
- case "instagram": return `https://www.instagram.com/p/${id}/embed`;
83
- case "spotify": return `https://open.spotify.com/embed/${id}`;
84
- case "apple-podcasts": {
85
- const [show, episode] = target.id.split("-");
86
- return `https://embed.podcasts.apple.com/podcast/${encodeURIComponent(show ?? "")}${episode ? `?i=${encodeURIComponent(episode)}` : ""}`;
87
- }
88
- }
89
- }
90
- export { componentText as a, bodyProblemText as i, embedOfUrl as n, guideText as o, embedSrcOf as r, EMBED_PROVIDERS as t };
package/dist/model.d.ts DELETED
@@ -1 +0,0 @@
1
- export * from './types/sdk/src/model.js';
package/dist/model.js DELETED
@@ -1,345 +0,0 @@
1
- import { p as collectionOf } from "./model-pmXzGX12.js";
2
- import { a as cropRect, c as stillOf, i as coverStart, l as createClock, n as publicPathOf, o as croppedHotspot, r as coverPosition, s as objectPosition, t as pagePathOf, u as isDateOnly } from "./page-E_cYgZx-.js";
3
- import { n as PRODUCT_FIELD_LABELS } from "./ja-C6lX0CeJ.js";
4
- import { i as modelProblemText, r as parseModel } from "./schema-UQJWRyfJ.js";
5
- import { t as typesSourceOf } from "./typesSource-bO0jFw1I.js";
6
- import { z } from "zod";
7
- // ../model/src/asset.ts
8
- const unit = z.number().min(0).max(1);
9
- /** 見せたい点の検査 */
10
- const hotspotSchema = z.object({
11
- x: unit,
12
- y: unit,
13
- width: unit.optional(),
14
- height: unit.optional()
15
- });
16
- z.object({
17
- top: unit,
18
- bottom: unit,
19
- left: unit,
20
- right: unit
21
- }).refine((c) => c.left + c.right <= .9 && c.top + c.bottom <= .9, modelProblemText("crop_too_large"));
22
- const mediaBase = z.object({
23
- src: z.string().min(1),
24
- width: z.number().int().positive(),
25
- height: z.number().int().positive(),
26
- alt: z.string(),
27
- hotspot: hotspotSchema.optional()
28
- });
29
- /** 解決後の素材の検査(src は URL、ビルドで読み込んだ画像は JSON に含めないため対象外) */
30
- const mediaSchema = z.union([mediaBase.extend({ kind: z.literal("image") }), mediaBase.extend({
31
- kind: z.literal("video"),
32
- poster: mediaBase
33
- })]);
34
- z.object({ asset: z.string().min(1) });
35
- // ../model/src/media.ts
36
- const file = [
37
- {
38
- key: "mime_type",
39
- label: PRODUCT_FIELD_LABELS.mimeType,
40
- type: "text",
41
- required: "save",
42
- description: PRODUCT_FIELD_LABELS.mimeTypeDescription
43
- },
44
- {
45
- key: "size",
46
- label: PRODUCT_FIELD_LABELS.size,
47
- type: "number",
48
- required: "save",
49
- description: PRODUCT_FIELD_LABELS.sizeDescription
50
- },
51
- {
52
- key: "width",
53
- label: PRODUCT_FIELD_LABELS.width,
54
- type: "number",
55
- required: "save",
56
- description: "px"
57
- },
58
- {
59
- key: "height",
60
- label: PRODUCT_FIELD_LABELS.height,
61
- type: "number",
62
- required: "save",
63
- description: "px"
64
- },
65
- {
66
- key: "alt",
67
- label: PRODUCT_FIELD_LABELS.alt,
68
- type: "text",
69
- description: PRODUCT_FIELD_LABELS.altDescription
70
- }
71
- ];
72
- /** 画像のコレクション */
73
- const IMAGE_TYPE = {
74
- id: "image",
75
- slug: "image",
76
- label: PRODUCT_FIELD_LABELS.image,
77
- description: PRODUCT_FIELD_LABELS.imageDescription,
78
- fields: file
79
- };
80
- /** 動画のコレクション(配信と再生は最初に使用する場所が決まったときに実装) */
81
- const VIDEO_TYPE = {
82
- id: "video",
83
- slug: "video",
84
- label: PRODUCT_FIELD_LABELS.video,
85
- fields: [
86
- ...file,
87
- {
88
- key: "duration",
89
- label: PRODUCT_FIELD_LABELS.duration,
90
- type: "number",
91
- description: PRODUCT_FIELD_LABELS.durationDescription
92
- },
93
- {
94
- key: "poster",
95
- label: PRODUCT_FIELD_LABELS.poster,
96
- type: "media",
97
- accept: ["image"],
98
- description: PRODUCT_FIELD_LABELS.posterDescription
99
- }
100
- ]
101
- };
102
- // ../model/src/screens.ts
103
- /** メニューのグループの id(運用のサイドバーのグループはこの1つだけ) */
104
- const MENU_GROUP_ID = "collections";
105
- const COLLECTION_PREFIX = "collection:";
106
- /** メニュー項目の id(コレクション) */
107
- const collectionItem = (collection) => `${COLLECTION_PREFIX}${collection}`;
108
- /** メニューにある全項目の id(グループの中も、上から順) */
109
- const menuItemsOf = (menu) => menu.flatMap((e) => typeof e === "string" ? [e] : e.items);
110
- /** 編集画面に配置した項目の id(セクションの順) */
111
- const placedItemsOf = (layout) => layout.sections.flatMap((s) => s.items);
112
- const id = z.string().regex(/^[a-z][a-z0-9_:-]*$/, modelProblemText("invalid_screen_id"));
113
- const item = z.string().min(1);
114
- const unique = (values) => new Set(values).size === values.length;
115
- const group = z.object({
116
- id: z.literal(MENU_GROUP_ID),
117
- collapsed: z.boolean().optional(),
118
- items: z.array(item)
119
- });
120
- const section = z.object({
121
- id,
122
- label: z.string().trim(),
123
- collapsed: z.boolean().optional(),
124
- items: z.array(item)
125
- });
126
- const layout = z.object({
127
- sections: z.array(section),
128
- hidden: z.array(item).optional()
129
- }).refine((l) => unique(l.sections.map((s) => s.id)), { message: modelProblemText("duplicate_section_id") }).refine((l) => unique([...placedItemsOf(l), ...l.hidden ?? []]), { message: modelProblemText("duplicate_placement") });
130
- const screensSchema = z.object({
131
- menu: z.array(z.union([item, group])).refine((m) => m.filter((e) => typeof e !== "string").length <= 1, { message: modelProblemText("duplicate_menu_group") }).refine((m) => unique(menuItemsOf(m)), { message: modelProblemText("duplicate_menu_item") }),
132
- editors: z.record(z.string(), layout).default({}),
133
- columns: z.record(z.string(), z.array(item).refine(unique, { message: modelProblemText("duplicate_column") })).default({})
134
- });
135
- /** 画面の設定の JSON を検査(形の誤りは ZodError) */
136
- const parseScreens = (json) => screensSchema.parse(json);
137
- // ../cms-contract/src/transfer.ts
138
- /** スキーマと設定の形式の名前 */
139
- const CONFIG_FORMAT = "cms-config";
140
- /** 中立の既定のスキーマ(新しいプロジェクトの作成で適用するコレクション: post・author・tag・image・video、設定の移入の土台) */
141
- const DEFAULT_SCHEMA = { collections: [
142
- {
143
- id: "post",
144
- slug: "post",
145
- label: "投稿",
146
- publishing: "review",
147
- roles: {
148
- title: "title",
149
- image: "image",
150
- body: "body"
151
- },
152
- fields: [
153
- {
154
- key: "title",
155
- label: "タイトル",
156
- type: "text",
157
- required: "save"
158
- },
159
- {
160
- key: "writers",
161
- label: "著者",
162
- type: "reference",
163
- to: "author",
164
- multiple: true
165
- },
166
- {
167
- key: "image",
168
- label: "メインの画像",
169
- type: "media",
170
- accept: ["image"]
171
- },
172
- {
173
- key: "body",
174
- label: "本文",
175
- type: "rich_text",
176
- profile: {
177
- headings: [
178
- 2,
179
- 3,
180
- 4
181
- ],
182
- marks: [
183
- "strong",
184
- "em",
185
- "code",
186
- "strike"
187
- ],
188
- list: {
189
- ordered: true,
190
- nested: true
191
- },
192
- quote: {
193
- multiple: true,
194
- cite: true
195
- },
196
- code: { caption: false },
197
- table: {
198
- head: "optional",
199
- caption: "optional"
200
- },
201
- divider: true,
202
- components: ["gallery", "link-card"]
203
- }
204
- },
205
- {
206
- key: "revised_at",
207
- label: "更新日時",
208
- type: "datetime"
209
- },
210
- {
211
- key: "tags",
212
- label: "タグ",
213
- type: "reference",
214
- to: "tag",
215
- multiple: true
216
- },
217
- {
218
- key: "excerpt",
219
- label: "抜粋",
220
- type: "long_text",
221
- computed: {
222
- kind: "excerpt",
223
- from: "body"
224
- }
225
- },
226
- {
227
- key: "read_min",
228
- label: "読了の分",
229
- type: "number",
230
- computed: {
231
- kind: "read_min",
232
- from: "body"
233
- }
234
- },
235
- {
236
- key: "links",
237
- label: "リンク先",
238
- type: "text",
239
- multiple: true,
240
- computed: {
241
- kind: "links",
242
- from: "body"
243
- }
244
- }
245
- ],
246
- pages: [{
247
- path: "/posts/{slug}",
248
- public: [{
249
- key: "status",
250
- in: ["published"]
251
- }, {
252
- key: "published_at",
253
- notFuture: true
254
- }]
255
- }]
256
- },
257
- {
258
- id: "author",
259
- slug: "author",
260
- label: "著者",
261
- roles: {
262
- title: "name",
263
- image: "portrait"
264
- },
265
- fields: [
266
- {
267
- key: "name",
268
- label: "名前",
269
- type: "text",
270
- required: "save"
271
- },
272
- {
273
- key: "bio",
274
- label: "紹介",
275
- type: "long_text"
276
- },
277
- {
278
- key: "portrait",
279
- label: "顔の画像",
280
- type: "media",
281
- accept: ["image"]
282
- }
283
- ],
284
- pages: [{ path: "/authors/{slug}" }]
285
- },
286
- {
287
- id: "tag",
288
- slug: "tag",
289
- label: "タグ",
290
- roles: { title: "label" },
291
- fields: [{
292
- key: "label",
293
- label: "名前",
294
- type: "text",
295
- required: "save"
296
- }]
297
- },
298
- IMAGE_TYPE,
299
- VIDEO_TYPE
300
- ] };
301
- /** 既定の画面設定(新しいプロジェクトの作成で適用する中立の値、移入する screens の土台) */
302
- const DEFAULT_SCREENS = {
303
- menu: [
304
- "calendar",
305
- {
306
- id: "collections",
307
- items: [
308
- collectionItem("post"),
309
- collectionItem("tag"),
310
- collectionItem("author")
311
- ]
312
- },
313
- "media"
314
- ],
315
- editors: { post: { sections: [
316
- {
317
- id: "classify",
318
- label: "分類",
319
- items: ["writers", "tags"]
320
- },
321
- {
322
- id: "publish",
323
- label: "公開",
324
- items: ["published_at", "revised_at"]
325
- },
326
- {
327
- id: "excerpt",
328
- label: "説明",
329
- items: ["excerpt"]
330
- },
331
- {
332
- id: "image",
333
- label: "メインの画像",
334
- items: ["image"]
335
- }
336
- ] } },
337
- columns: { post: [
338
- "status",
339
- "writers",
340
- "assignee",
341
- "published_at",
342
- "updated_at"
343
- ] }
344
- };
345
- export { CONFIG_FORMAT, DEFAULT_SCHEMA, DEFAULT_SCREENS, IMAGE_TYPE, VIDEO_TYPE, collectionOf, coverPosition, coverStart, createClock, cropRect, croppedHotspot, isDateOnly, mediaSchema, objectPosition, pagePathOf, parseModel, parseScreens, publicPathOf, stillOf, typesSourceOf };
@@ -1,5 +0,0 @@
1
- export { type Classify, VIEW_COLUMNS, VIEW_SCHEMA, type ViewEvent, viewOf, type ViewOptions } from './view.js';
2
- export { syncCron } from './schedule.js';
3
- export { isViewsCron, sharedViews, viewsFor, viewsSince, viewsSyncOf } from './shared.js';
4
- export { type DailyRow, fixedSource, type ProjectSource, renamedSource, type Source } from './source.js';
5
- export { readDaily, syncDaily } from './store.js';
@@ -1,2 +0,0 @@
1
- /** 集計の間隔(分)から Cron の式を算出 */
2
- export declare function syncCron(minutes: number): string;
@@ -1,21 +0,0 @@
1
- import { type DailyRow, type ProjectSource, type Source } from './source.js';
2
- /** 全プロジェクトを問い合わせる範囲の最初の日付(UTC の日付、どの時間帯のプロジェクトの直近3日も含む) */
3
- export declare const viewsSince: (now: number) => string;
4
- /** 全プロジェクトの問い合わせを行う Cron か(minutes は集計の間隔の分) */
5
- export declare const isViewsCron: (minutes: string | undefined, cron: string) => boolean;
6
- /** 全プロジェクトの閲覧数の問い合わせ(対象の Cron で設定があるときだけ、なしは null) */
7
- export declare const viewsSyncOf: (source: ProjectSource | null, minutes: string | undefined, cron: string, scheduledTime: number) => Readonly<{
8
- source: ProjectSource;
9
- since: string;
10
- }> | null;
11
- /** プロジェクトごとの読み込み元の作成 */
12
- type ViewsOf = (projectId: string) => Source | null;
13
- /**
14
- * Queues なしの構成のプロジェクトごとの読み込み元(全プロジェクトの問い合わせ結果の行)
15
- * - 結果にないプロジェクト: 行なし
16
- * - 問い合わせの失敗: 各プロジェクトの集計の処理が失敗として記録(ログ・実行の記録)
17
- */
18
- export declare function sharedViews(source: ProjectSource, since: string): Promise<ViewsOf>;
19
- /** メッセージに載った行の読み込み元(なしはプロジェクトごとの問い合わせ live) */
20
- export declare const viewsFor: (rows: readonly DailyRow[] | undefined, live: ViewsOf) => ViewsOf;
21
- export {};
@@ -1,19 +0,0 @@
1
- /** 日ごと・種類・ID の閲覧数 */
2
- export type DailyRow = {
3
- date: string;
4
- kind: string;
5
- id: string;
6
- views: number;
7
- };
8
- /** 読み込み元の接続のコレクション(since 以降の日付の閲覧数) */
9
- export type Source = {
10
- daily(since: string): Promise<DailyRow[]>;
11
- };
12
- /** 全プロジェクトの読み込み元のコレクション(since 以降の日付の閲覧数をプロジェクトの識別子ごとに) */
13
- export type ProjectSource = {
14
- dailyByProject(since: string): Promise<ReadonlyMap<string, DailyRow[]>>;
15
- };
16
- /** 集計済みの行の読み込み元(定期の集計で全プロジェクトの問い合わせ結果をプロジェクトごとに受け渡し、daily は since 以降の行) */
17
- export declare const fixedSource: (rows: readonly DailyRow[]) => Source;
18
- /** 種類を付け替えた読み込み元(renames は旧の種類 → 今の種類、付け替えで重なった行は閲覧数を合計) */
19
- export declare function renamedSource(source: Source, renames: Readonly<Record<string, string>>): Source;
@@ -1,24 +0,0 @@
1
- import type { DailyRow, Source } from './source.js';
2
- type Statement = {
3
- bind(...values: unknown[]): Statement;
4
- all<T = Record<string, unknown>>(): Promise<{
5
- results: T[];
6
- }>;
7
- };
8
- /** D1 の接続のコレクション(D1Database と互換) */
9
- export type Db = {
10
- prepare(sql: string): Statement;
11
- batch(statements: Statement[]): Promise<unknown>;
12
- };
13
- /** 読み込み元の since 以降の閲覧数を表へ(戻り値は行の数) */
14
- export declare function syncDaily(source: Source, db: Db, since: string): Promise<number>;
15
- /** 日付が after より後の閲覧数(live は今日の行を読み込み元から、失敗は表の値のままで failure に例外) */
16
- export declare function readDaily(db: Db, after: string, live?: {
17
- source: Source;
18
- today: string;
19
- }): Promise<{
20
- rows: DailyRow[];
21
- live: boolean;
22
- failure?: unknown;
23
- }>;
24
- export {};
@@ -1,25 +0,0 @@
1
- /**
2
- * 製品の表示の名前(画面の題、メールの差出人と件名、Access と MCP の表示名)
3
- * - 改名の夜はこの値だけを替える。Terraform の terraform/modules/company/access.tf の brand_name も同じ値(brand.test.ts)
4
- */
5
- export declare const BRAND_NAME = "Tunasand";
6
- /**
7
- * 製品の記号(くさび形のサンド、#769の「4.」)の SVG の形。layers は上から上面と層・帯・帯(隙間で分かれる)
8
- * - 素材の正は docs/brand/tunasand(生成は scripts/brand-assets.ts)。ここは小さい用の mark-small.svg の形(白い線なし)
9
- * - fills は明るい地の色(素材の mark-small.svg と同じ)。1色にするときは使う側が currentColor で塗る
10
- * - LP の apps/lp/src/assets/brand/mark.svg と同じ形(scripts/lib/brand.test.ts)
11
- */
12
- export declare const BRAND_MARK: {
13
- readonly viewBox: "0 0 32 32";
14
- readonly layers: readonly ["M2.8 16.42L2.8 13.7A1.1 1.1 0 0 1 3.35 12.75L18.85 3.72A1.8 1.8 0 0 1 20.94 3.92L28.43 10.46A1.1 1.1 0 0 1 28.8 11.29L28.8 14.33A1.1 1.1 0 0 1 27.8 15.43L4 17.51A1.1 1.1 0 0 1 2.8 16.42Z", "M2.8 21.42L2.8 20.12A1.1 1.1 0 0 1 3.81 19.03L27.61 16.95A1.1 1.1 0 0 1 28.8 18.04L28.8 19.33A1.1 1.1 0 0 1 27.8 20.43L4 22.51A1.1 1.1 0 0 1 2.8 21.42Z", "M2.8 26.42L2.8 25.12A1.1 1.1 0 0 1 3.81 24.03L27.61 21.95A1.1 1.1 0 0 1 28.8 23.04L28.8 24.33A1.1 1.1 0 0 1 27.8 25.43L4 27.51A1.1 1.1 0 0 1 2.8 26.42Z"];
15
- readonly fills: readonly ["#E0703E", "#D64C7C", "#E0703E"];
16
- };
17
- /**
18
- * 製品のワードマーク(先頭が大文字の製品名、書体 Figtree の字形のパス)。fill は明るい地の文字の色(素材の wordmark.svg と同じ)
19
- * - 素材は docs/brand/tunasand/wordmark-mono.svg、LP の apps/lp/src/assets/brand/wordmark.svg と同じ形
20
- */
21
- export declare const BRAND_WORDMARK: {
22
- readonly viewBox: "0.19 -10 60.76 10.17";
23
- readonly fill: "#19120F";
24
- readonly path: "M3.26 0L3.26 -8.48L0.19 -8.48L0.19 -10L7.98 -10L7.98 -8.48L4.92 -8.48L4.92 0L3.26 0ZM11.03 0.17Q10.19 0.17 9.58 -0.17Q8.97 -0.51 8.65 -1.24Q8.32 -1.97 8.32 -3.11L8.32 -7.14L9.91 -7.14L9.91 -3.49Q9.91 -2.64 10.11 -2.17Q10.31 -1.7 10.67 -1.52Q11.02 -1.33 11.47 -1.32Q12.28 -1.32 12.72 -1.86Q13.17 -2.4 13.17 -3.42L13.17 -7.14L14.76 -7.14L14.76 0L13.26 0L13.19 -1.01Q12.84 -0.44 12.29 -0.14Q11.74 0.17 11.03 0.17ZM16.53 0L16.53 -7.14L18.03 -7.14L18.1 -6.13Q18.45 -6.71 19 -7.01Q19.55 -7.31 20.26 -7.31Q21.11 -7.31 21.72 -6.97Q22.32 -6.63 22.65 -5.91Q22.98 -5.19 22.97 -4.03L22.97 0L21.38 0L21.38 -3.66Q21.38 -4.51 21.18 -4.97Q20.98 -5.44 20.63 -5.63Q20.28 -5.81 19.82 -5.82Q19.01 -5.83 18.57 -5.29Q18.12 -4.74 18.12 -3.73L18.12 0L16.53 0ZM26.88 0.17Q25.6 0.17 24.9 -0.4Q24.19 -0.98 24.19 -2.01Q24.19 -3.13 24.94 -3.71Q25.69 -4.29 27.03 -4.29L28.84 -4.29Q28.75 -5.09 28.4 -5.5Q28.04 -5.91 27.34 -5.91Q26.83 -5.91 26.44 -5.7Q26.05 -5.48 25.79 -5.03L24.38 -5.54Q24.61 -6.01 24.99 -6.42Q25.38 -6.82 25.96 -7.07Q26.53 -7.31 27.34 -7.31Q28.39 -7.31 29.09 -6.91Q29.78 -6.5 30.12 -5.75Q30.46 -4.99 30.45 -3.92L30.42 0L28.94 0L28.9 -0.88Q28.61 -0.37 28.1 -0.1Q27.6 0.17 26.88 0.17ZM27.09 -1.18Q27.61 -1.18 28.02 -1.41Q28.42 -1.64 28.65 -2.04Q28.88 -2.44 28.88 -2.93L28.88 -3.07L27.54 -3.07Q26.58 -3.07 26.2 -2.8Q25.81 -2.54 25.81 -2.06Q25.81 -1.64 26.15 -1.41Q26.49 -1.18 27.09 -1.18ZM34.68 0.17Q33.95 0.17 33.36 -0.05Q32.76 -0.26 32.33 -0.65Q31.9 -1.04 31.67 -1.57L33.05 -2.19Q33.27 -1.79 33.69 -1.52Q34.11 -1.25 34.63 -1.25Q35.18 -1.25 35.52 -1.44Q35.85 -1.62 35.85 -1.97Q35.85 -2.3 35.59 -2.48Q35.34 -2.66 34.87 -2.78L34.2 -2.95Q33.19 -3.22 32.62 -3.78Q32.04 -4.35 32.04 -5.07Q32.04 -6.14 32.73 -6.73Q33.42 -7.31 34.73 -7.31Q35.38 -7.31 35.94 -7.12Q36.49 -6.93 36.89 -6.58Q37.28 -6.23 37.45 -5.76L36.11 -5.16Q35.97 -5.52 35.57 -5.71Q35.17 -5.9 34.69 -5.9Q34.2 -5.9 33.93 -5.7Q33.66 -5.49 33.66 -5.12Q33.66 -4.89 33.9 -4.72Q34.14 -4.55 34.61 -4.43L35.45 -4.22Q36.15 -4.05 36.59 -3.69Q37.03 -3.33 37.24 -2.88Q37.46 -2.43 37.46 -1.97Q37.46 -1.32 37.09 -0.84Q36.73 -0.36 36.1 -0.09Q35.48 0.17 34.68 0.17ZM41.02 0.17Q39.75 0.17 39.04 -0.4Q38.33 -0.98 38.33 -2.01Q38.33 -3.13 39.08 -3.71Q39.83 -4.29 41.18 -4.29L42.98 -4.29Q42.9 -5.09 42.54 -5.5Q42.18 -5.91 41.48 -5.91Q40.97 -5.91 40.58 -5.7Q40.2 -5.48 39.93 -5.03L38.52 -5.54Q38.75 -6.01 39.14 -6.42Q39.52 -6.82 40.1 -7.07Q40.68 -7.31 41.48 -7.31Q42.53 -7.31 43.23 -6.91Q43.92 -6.5 44.26 -5.75Q44.6 -4.99 44.59 -3.92L44.56 0L43.08 0L43.04 -0.88Q42.75 -0.37 42.25 -0.1Q41.74 0.17 41.02 0.17ZM41.23 -1.18Q41.75 -1.18 42.16 -1.41Q42.57 -1.64 42.79 -2.04Q43.02 -2.44 43.02 -2.93L43.02 -3.07L41.68 -3.07Q40.72 -3.07 40.34 -2.8Q39.96 -2.54 39.96 -2.06Q39.96 -1.64 40.29 -1.41Q40.63 -1.18 41.23 -1.18ZM46.22 0L46.22 -7.14L47.72 -7.14L47.78 -6.13Q48.13 -6.71 48.68 -7.01Q49.23 -7.31 49.95 -7.31Q50.79 -7.31 51.4 -6.97Q52.01 -6.63 52.34 -5.91Q52.66 -5.19 52.66 -4.03L52.66 0L51.06 0L51.06 -3.66Q51.06 -4.51 50.86 -4.97Q50.66 -5.44 50.31 -5.63Q49.97 -5.81 49.51 -5.82Q48.69 -5.83 48.25 -5.29Q47.81 -4.74 47.81 -3.73L47.81 0L46.22 0ZM57.1 0.17Q56.13 0.17 55.4 -0.29Q54.68 -0.76 54.28 -1.6Q53.88 -2.45 53.88 -3.57Q53.88 -4.71 54.28 -5.55Q54.68 -6.39 55.4 -6.85Q56.13 -7.31 57.1 -7.31Q57.84 -7.31 58.41 -6.99Q58.99 -6.67 59.35 -6.09L59.35 -10L60.95 -10L60.95 0L59.43 0L59.38 -1.09Q59.02 -0.49 58.43 -0.16Q57.85 0.17 57.1 0.17ZM57.5 -1.29Q58.03 -1.29 58.44 -1.57Q58.85 -1.84 59.09 -2.34Q59.34 -2.84 59.35 -3.47L59.35 -3.67Q59.34 -4.31 59.09 -4.8Q58.85 -5.29 58.44 -5.57Q58.02 -5.85 57.48 -5.85Q56.91 -5.85 56.47 -5.56Q56.02 -5.27 55.77 -4.75Q55.52 -4.24 55.52 -3.57Q55.52 -2.9 55.78 -2.39Q56.03 -1.87 56.48 -1.58Q56.93 -1.29 57.5 -1.29Z";
25
- };
@@ -1,2 +0,0 @@
1
- /** 古い形のスキーマの JSON を今の形に(形の分からない値はそのまま、検査は parseModel) */
2
- export declare function normalizeLegacyModel(json: unknown): unknown;
@@ -1,8 +0,0 @@
1
- import { type ContentModel } from './model.js';
2
- /**
3
- * スキーマから配信 API の値の型の定義(TypeScript のモジュールの文)
4
- * - コレクションごとに `export type <PascalCase のコレクションのスラッグ>`
5
- * - 全体の対応 `CmsTypes`(キーはスラッグ)とスラッグの一覧 `COLLECTION_SLUGS`
6
- * - types: 配信するコレクションだけ(メディアのコレクションを除いた一覧、配信 API の `/collections` の値)。非公開のコレクションは渡されても除く
7
- */
8
- export declare function typesSourceOf(model: Pick<ContentModel, 'collections'>): string;
@@ -1,5 +0,0 @@
1
- export { collectionOf, coverPosition, coverStart, createClock, cropRect, croppedHotspot, IMAGE_TYPE, isDateOnly, mediaSchema, objectPosition, pagePathOf, parseModel, parseScreens, publicPathOf, stillOf, typesSourceOf, VIDEO_TYPE } from '../../model/src/index.js';
2
- export type { Asset, AssetRef, Clock, Collection, ContentModel, Crop, CropRect, DateString, FieldDef, Hotspot, LocalImage, Media, PageDef, PageRecord, ScreenSettings } from '../../model/src/index.js';
3
- export { CONFIG_FORMAT } from '../../cms-contract/src/transfer.js';
4
- export type { ConfigBundle } from '../../cms-contract/src/transfer.js';
5
- export { DEFAULT_SCHEMA, DEFAULT_SCREENS } from '../../platform/src/defaultModel.js';
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes