@ryusenkei/maezae 0.2.0 → 0.3.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 (94) hide show
  1. package/README.md +2 -0
  2. package/dist/analytics.d.ts +1 -0
  3. package/dist/analytics.js +33 -0
  4. package/dist/body.d.ts +1 -24
  5. package/dist/body.js +1 -333
  6. package/dist/declared-9_jI3JXH.js +336 -0
  7. package/dist/delivery.d.ts +1 -211
  8. package/dist/integrations.d.ts +1 -72
  9. package/dist/integrations.js +12 -2
  10. package/dist/model.d.ts +1 -82
  11. package/dist/model.js +338 -1
  12. package/dist/preview.d.ts +1 -2
  13. package/dist/preview.js +1 -1
  14. package/dist/{src-CA_67dWy.js → src-Baj-EC2G.js} +105 -3
  15. package/dist/trace.d.ts +1 -0
  16. package/dist/trace.js +1 -0
  17. package/dist/types/access/src/index.d.ts +5 -0
  18. package/dist/types/access/src/jwt.d.ts +42 -0
  19. package/dist/types/access/src/oidc.d.ts +47 -0
  20. package/dist/types/access/src/signed.d.ts +47 -0
  21. package/dist/types/access/src/span.d.ts +23 -0
  22. package/dist/types/access/src/traceparent.d.ts +21 -0
  23. package/dist/types/analytics/src/day.d.ts +2 -0
  24. package/dist/types/analytics/src/index.d.ts +4 -0
  25. package/dist/types/analytics/src/record.d.ts +22 -0
  26. package/dist/types/analytics/src/schedule.d.ts +2 -0
  27. package/dist/types/analytics/src/source.d.ts +33 -0
  28. package/dist/types/analytics/src/store.d.ts +24 -0
  29. package/dist/types/body/src/components.d.ts +25 -0
  30. package/dist/types/body/src/declared.d.ts +34 -0
  31. package/dist/types/body/src/derive.d.ts +13 -0
  32. package/dist/types/body/src/description.d.ts +8 -0
  33. package/dist/types/body/src/href.d.ts +4 -0
  34. package/dist/types/body/src/index.d.ts +11 -0
  35. package/dist/types/body/src/library.d.ts +94 -0
  36. package/dist/types/body/src/markdown.d.ts +14 -0
  37. package/dist/types/body/src/normalize.d.ts +7 -0
  38. package/dist/types/body/src/profile.d.ts +48 -0
  39. package/dist/types/body/src/schema.d.ts +6 -0
  40. package/dist/types/body/src/standard.d.ts +20 -0
  41. package/dist/types/body/src/types.d.ts +91 -0
  42. package/dist/types/cms-contract/src/apiKeys.d.ts +13 -0
  43. package/dist/types/cms-contract/src/assets.d.ts +10 -0
  44. package/dist/types/cms-contract/src/builtins.d.ts +17 -0
  45. package/dist/types/cms-contract/src/embeds.d.ts +56 -0
  46. package/dist/types/cms-contract/src/errorLabels.d.ts +22 -0
  47. package/dist/types/cms-contract/src/errors.d.ts +97 -0
  48. package/dist/types/cms-contract/src/extensions.d.ts +75 -0
  49. package/dist/types/cms-contract/src/fieldRules.d.ts +37 -0
  50. package/dist/types/cms-contract/src/functions.d.ts +71 -0
  51. package/dist/types/cms-contract/src/index.d.ts +19 -0
  52. package/dist/types/cms-contract/src/labels.d.ts +6 -0
  53. package/dist/types/cms-contract/src/modules.d.ts +144 -0
  54. package/dist/types/cms-contract/src/paths.d.ts +6 -0
  55. package/dist/types/cms-contract/src/pending.d.ts +4 -0
  56. package/dist/types/cms-contract/src/permissions.d.ts +69 -0
  57. package/dist/types/cms-contract/src/roles.d.ts +35 -0
  58. package/dist/types/cms-contract/src/settings.d.ts +19 -0
  59. package/dist/types/cms-contract/src/transfer.d.ts +48 -0
  60. package/dist/types/cms-contract/src/views.d.ts +21 -0
  61. package/dist/types/cms-contract/src/webhooks.d.ts +45 -0
  62. package/dist/types/delivery-client/src/client.d.ts +62 -0
  63. package/dist/types/delivery-client/src/index.d.ts +5 -0
  64. package/dist/types/delivery-client/src/media.d.ts +12 -0
  65. package/dist/types/delivery-client/src/query.d.ts +68 -0
  66. package/dist/types/delivery-client/src/schema.d.ts +19 -0
  67. package/dist/types/delivery-client/src/values.d.ts +63 -0
  68. package/dist/types/model/src/asset.d.ts +89 -0
  69. package/dist/types/model/src/capabilities.d.ts +20 -0
  70. package/dist/types/model/src/changes.d.ts +23 -0
  71. package/dist/types/model/src/check.d.ts +10 -0
  72. package/dist/types/model/src/image.d.ts +38 -0
  73. package/dist/types/model/src/index.d.ts +14 -0
  74. package/dist/types/model/src/input.d.ts +26 -0
  75. package/dist/types/model/src/media.d.ts +5 -0
  76. package/dist/types/model/src/model.d.ts +190 -0
  77. package/dist/types/model/src/page.d.ts +47 -0
  78. package/dist/types/model/src/rules.d.ts +15 -0
  79. package/dist/types/model/src/schema.d.ts +3 -0
  80. package/dist/types/model/src/screens.d.ts +72 -0
  81. package/dist/types/model/src/time.d.ts +25 -0
  82. package/dist/types/model/src/values.d.ts +24 -0
  83. package/dist/types/sdk/src/analytics.d.ts +2 -0
  84. package/dist/types/sdk/src/body.d.ts +2 -0
  85. package/dist/types/sdk/src/defaults.d.ts +5 -0
  86. package/dist/types/sdk/src/delivery.d.ts +2 -0
  87. package/dist/types/sdk/src/integrations.d.ts +4 -0
  88. package/dist/types/sdk/src/model.d.ts +5 -0
  89. package/dist/types/sdk/src/preview.d.ts +2 -0
  90. package/dist/types/sdk/src/trace.d.ts +2 -0
  91. package/package.json +10 -2
  92. package/dist/index-C8duwjns.d.ts +0 -157
  93. package/dist/index-CLDe_wBc.d.ts +0 -340
  94. package/dist/signed-B_58gV21.d.ts +0 -44
@@ -0,0 +1,190 @@
1
+ import type { BodyProfile, DeclaredComponent } from '../../body/src/index.js';
2
+ import type { ImageFrameDef, PageDef } from './page.js';
3
+ /** 必須になる時点(page は行のページが公開中になるとき、false は任意) */
4
+ type Requirement = 'save' | 'submit' | 'page' | false;
5
+ type FieldBase = Readonly<{
6
+ key: string;
7
+ label: string;
8
+ /** 書き手と AI への説明(MCP の項目の説明にも使用) */
9
+ description?: string;
10
+ required?: Requirement;
11
+ when?: FieldCondition;
12
+ /** 配信しない項目(CMS の中だけで使用) */
13
+ private?: boolean;
14
+ /** 行のすべてを変更できるアカウントだけが編集(自分のものだけを変更できるアカウントの保存では保存済みの値のまま) */
15
+ adminOnly?: boolean;
16
+ /** 未定の null にできる期限: 型の最上位の項目 key に値が入ると未定なし(方針のページの制定日など) */
17
+ pendingUntil?: string;
18
+ }>;
19
+ /** 項目の対象の条件(同じ階層にある選択肢の項目 key の値が in のいずれか) */
20
+ export type FieldCondition = Readonly<{
21
+ key: string;
22
+ in: readonly string[];
23
+ }>;
24
+ /** 選択肢の値の調子(CMS の札の色、positive は進行中・提供中、caution は途中・注意、neutral は終了・既定) */
25
+ export type OptionTone = 'positive' | 'caution' | 'neutral';
26
+ /** セレクトの選択肢(tone は札の色、なしは neutral、restricted は型の公開が可のアカウントだけが選択し AI は選択不可) */
27
+ export type SelectOption = Readonly<{
28
+ value: string;
29
+ label: string;
30
+ tone?: OptionTone;
31
+ restricted?: boolean;
32
+ }>;
33
+ /** ほかの項目の値で決まる値(同じ階層の選択肢の項目 from の値ごとの値、表にない値は otherwise) */
34
+ export type FieldDerive = Readonly<{
35
+ from: string;
36
+ map: Readonly<Record<string, string>>;
37
+ otherwise: string;
38
+ }>;
39
+ /** 参照先の値で固定する値(同じ階層の参照の項目 ref が指す行の項目 key の値ごとの値、表にない値は固定なし) */
40
+ export type FieldFixedBy = Readonly<{
41
+ ref: string;
42
+ key: string;
43
+ map: Readonly<Record<string, string>>;
44
+ }>;
45
+ /**
46
+ * 被参照の件数: 型 from で公開中の行のうち、参照の項目 field でこの行を指す数
47
+ * - key: 値の名前(ページの公開中の条件などで使用)
48
+ */
49
+ export type CountDef = Readonly<{
50
+ key: string;
51
+ from: string;
52
+ field: string;
53
+ }>;
54
+ /** 値の件数の下限と上限(multiple の項目だけ、空は必須の判定に任せる) */
55
+ export type Counts = Readonly<{
56
+ minItems?: number;
57
+ maxItems?: number;
58
+ }>;
59
+ /**
60
+ * 参照の項目で保存できる条件(参照先の行が満たす条件、DB を参照するため CMS のサーバーが保存のときに検査)
61
+ * - unique: 同じ行を重ねて選択できない(checkFields で検査)
62
+ * - published: 参照先は公開中の行だけ
63
+ * - linkedBy: 参照先の項目 key がこの行を指す行だけ(本人の記事など、参照先の複数の参照は含むかで判定、作成のときは選択不可)
64
+ */
65
+ export type ReferenceRules = Readonly<{
66
+ unique?: boolean;
67
+ published?: boolean;
68
+ linkedBy?: string;
69
+ }>;
70
+ /** メディアの種類(コアの型 image・video の id と同じ) */
71
+ export type MediaKind = 'image' | 'video';
72
+ /** 項目の定義 */
73
+ export type FieldDef = FieldBase & Readonly<{
74
+ type: 'text' | 'textarea';
75
+ maxLength?: number;
76
+ minLength?: number; /** 形式(正規表現、空でない値が全体で一致) */
77
+ pattern?: string; /** 文字数の目安(超えても保存可、画面で表示) */
78
+ guideLength?: number; /** 文字の配列(段落の並びなど) */
79
+ multiple?: boolean;
80
+ } & Counts | {
81
+ type: 'number';
82
+ min?: number;
83
+ max?: number;
84
+ } | {
85
+ type: 'checkbox';
86
+ } | {
87
+ type: 'date' | 'datetime';
88
+ } | ({
89
+ type: 'select';
90
+ options: readonly SelectOption[]; /** 新しい行の初期値(なしは先頭の選択肢) */
91
+ initial?: string;
92
+ multiple?: boolean;
93
+ derive?: FieldDerive;
94
+ fixedBy?: FieldFixedBy;
95
+ } & Counts) | ({
96
+ type: 'reference';
97
+ to: string;
98
+ multiple?: boolean; /** 候補の絞り込み(参照先のコアの項目の key と値、例: 企画の種類が特集) */
99
+ where?: Readonly<Record<string, string>>; /** 候補にない名前を追加の依頼で付けられる(参照先は一覧で管理する汎用の型、承認で行を作成) */
100
+ requests?: boolean; /** 値が空のときの表示名(持ち主のいない行の名義など) */
101
+ emptyLabel?: string;
102
+ } & ReferenceRules & Counts) | ({
103
+ type: 'media'; /** 受け付けるメディアの種類(なしはすべて) */
104
+ accept?: readonly MediaKind[];
105
+ multiple?: boolean; /** 画像の枠(先頭から条件に合うもの、page.ts) */
106
+ frames?: readonly ImageFrameDef[];
107
+ } & Counts) | {
108
+ type: 'body';
109
+ profile: BodyProfile;
110
+ } | ({
111
+ type: 'group'; /** まとまりの中の項目(Sanity の object、microCMS のカスタムフィールド) */
112
+ fields: readonly FieldDef[];
113
+ multiple?: boolean;
114
+ } & Counts)>;
115
+ /** 型の形式(リスト形式は行を複数、オブジェクト形式は行を1つだけ) */
116
+ export type ContentFormat = 'list' | 'object';
117
+ /** 公開の管理(なし・下書きと公開・レビューあり) */
118
+ export type Publishing = 'none' | 'draft' | 'review';
119
+ /**
120
+ * 型の定義
121
+ * - id: コアの型の ID か、追加の型の ID
122
+ * - core: コアで固定の項目、fields: 導入先の追加の項目
123
+ * - format: 形式(なしはリスト形式)、オブジェクト形式はコアの項目なし
124
+ * - publishing: 公開の管理(なしは管理なし)
125
+ * - table: コアの項目を持つ型の表
126
+ * - pages: サイトのページの URL と公開中の条件(なしはページのない型、page.ts)
127
+ */
128
+ /**
129
+ * コンテンツタイプ
130
+ * - counts: 被参照の件数(ページの公開中の条件・ページの公開で必須の判定に使用)
131
+ * - og: サイトの OG 画像のパスの雛形({key} は行の値、管理画面の OG 画像のプレビュー)
132
+ */
133
+ export type ContentType = Readonly<{
134
+ id: string;
135
+ label: string;
136
+ description?: string;
137
+ format?: ContentFormat;
138
+ publishing?: Publishing;
139
+ table?: string;
140
+ core?: readonly FieldDef[];
141
+ fields: readonly FieldDef[];
142
+ pages?: readonly PageDef[];
143
+ counts?: readonly CountDef[];
144
+ og?: string;
145
+ }>;
146
+ /** コンテンツスキーマ(導入先ごとに1つ) */
147
+ export type ContentModel = Readonly<{
148
+ types: readonly ContentType[];
149
+ components?: readonly DeclaredComponent[];
150
+ }>;
151
+ /** 項目の値の問題(path は項目の key) */
152
+ export type FieldProblem = Readonly<{
153
+ path: string;
154
+ message: string;
155
+ }>;
156
+ /** 汎用の表 entries に保存する型か(コアの項目がない型、コアの項目がある型は専用の表) */
157
+ export declare const isEntryType: (type: ContentType) => boolean;
158
+ /** オブジェクト形式の型か(行は表 entries の id が型の id の1行、一覧・作成の対象外) */
159
+ export declare const isSingleton: (type: ContentType) => boolean;
160
+ /** 公開の管理(なしは none) */
161
+ export declare const publishingOf: (type: ContentType) => Publishing;
162
+ /** 一覧で行を追加・管理する汎用の型か(取材相手・トピックなど、オブジェクト形式の型を除く) */
163
+ export declare const isListType: (type: ContentType) => boolean;
164
+ /**
165
+ * 編集の機能を持つ型か(公開の管理がある一覧の型)
166
+ * - 機能: 版・楽観ロック・編集中のリース・コメント・担当者・公開の前の点検
167
+ * - 提出と差し戻し: レビューありの型だけ
168
+ */
169
+ export declare const isEditorial: (type: ContentType) => boolean;
170
+ /** 型の行を保存する表(汎用の型は entries、表を持たない型は null) */
171
+ export declare const tableOf: (type: ContentType) => string | null;
172
+ /** コンテンツスキーマの型(id から、なければ例外: 導入先の設定の誤り) */
173
+ export declare function typeOf(model: ContentModel, id: string): ContentType;
174
+ /** 選択肢の項目の選択肢(コアの項目と追加の項目から、まとまりの中の項目は `links.kind` の形、選択肢の項目でなければ空) */
175
+ export declare function optionsOf(type: ContentType, key: string): readonly SelectOption[];
176
+ /** 新しい行の初期値(セレクトは項目の initial、なければ先頭の選択肢、セレクトでなければ空文字) */
177
+ export declare const initialValueOf: (type: ContentType, key: string) => string;
178
+ /** 選択肢の値の調子(指定のない値は neutral) */
179
+ export declare const toneOf: (type: ContentType, key: string, value: string) => OptionTone;
180
+ /** 選択肢の表示名(なければ値のまま) */
181
+ export declare const optionLabelOf: (type: ContentType, key: string, value: string) => string;
182
+ /** 型の表示名の項目(複数でない文字の項目で先頭、なければ null: 行の表示名に使用) */
183
+ export declare const titleFieldOf: (type: ContentType) => FieldDef | null;
184
+ /** 型のサムネの項目(複数でない画像の項目で先頭、なければ null: 一覧・参照の候補に使用) */
185
+ export declare const imageFieldOf: (type: ContentType) => FieldDef | null;
186
+ /** 追加の依頼ができる参照の項目(コアと追加の項目、参照先が一覧で管理する汎用の型で requests の指定があるもの、タグ・分類など) */
187
+ export declare function requestReferencesOf(model: ContentModel, type: ContentType): Extract<FieldDef, {
188
+ type: 'reference';
189
+ }>[];
190
+ export {};
@@ -0,0 +1,47 @@
1
+ import type { ContentType, FieldCondition } from './model.js';
2
+ /** ページの行の値(項目の key と値、表の列・集計の値も含む) */
3
+ export type PageEntry = Readonly<Record<string, unknown>>;
4
+ /**
5
+ * 公開中の条件の1つ(key は行の値の key)
6
+ * - in・notIn: 値の文字列が一覧にある・ない
7
+ * - truthy: 値が真(公開のチェックなど)
8
+ * - notFuture: 値が空か、今の時刻以前(予約の公開日時)
9
+ */
10
+ export type PageRule = Readonly<{
11
+ key: string;
12
+ } & ({
13
+ in: readonly string[];
14
+ } | {
15
+ notIn: readonly string[];
16
+ } | {
17
+ truthy: true;
18
+ } | {
19
+ notFuture: true;
20
+ })>;
21
+ /** ページの宣言(when は選択肢の項目による条件、path は {key} を含む雛形) */
22
+ export type PageDef = Readonly<{
23
+ when?: FieldCondition;
24
+ path: string;
25
+ public?: readonly PageRule[];
26
+ }>;
27
+ /** 画像の枠(ratio は CSS の aspect-ratio の書式、size は推奨の寸法、label は画像の呼び名) */
28
+ export type ImageFrame = Readonly<{
29
+ ratio: string;
30
+ size: Readonly<{
31
+ width: number;
32
+ height: number;
33
+ }>;
34
+ label: string;
35
+ }>;
36
+ /** 画像の枠の宣言(when は同じ階層にある選択肢の項目による条件) */
37
+ export type ImageFrameDef = ImageFrame & Readonly<{
38
+ when?: FieldCondition;
39
+ }>;
40
+ /** ページのパス(ページのない型・行は null、公開の状態は見ない) */
41
+ export declare function pagePathOf(type: ContentType, entry: PageEntry): string | null;
42
+ /** 行がサイトで公開中のページを持つか(雛形の値は見ない、作成前の入力にも使用、now は今の時刻の ISO 文字列) */
43
+ export declare function hasPublicPage(type: ContentType, entry: PageEntry, now: string): boolean;
44
+ /** 公開中のページのパス(公開前・予約中・ページのない行は null、now は今の時刻の ISO 文字列) */
45
+ export declare function publicPathOf(type: ContentType, entry: PageEntry, now: string): string | null;
46
+ /** 画像の項目 key の枠(コアの項目と追加の項目の最上位から、枠の宣言がなければ null) */
47
+ export declare function imageFrameOf(type: ContentType, key: string, entry: PageEntry): ImageFrame | null;
@@ -0,0 +1,15 @@
1
+ import type { ContentModel, FieldCondition, FieldDerive } from './model.js';
2
+ /** スキーマから作成したフィールドの宣言(type・key の項目に対する規則) */
3
+ export type SchemaRule = Readonly<{
4
+ type: string;
5
+ key: string;
6
+ auto?: boolean;
7
+ derive?: FieldDerive;
8
+ when?: FieldCondition;
9
+ restricted?: Readonly<{
10
+ values: readonly string[];
11
+ message: string;
12
+ }>;
13
+ }>;
14
+ /** スキーマの宣言から作成したフィールドの宣言(宣言のない項目は含まない) */
15
+ export declare function schemaRulesOf(model: ContentModel): SchemaRule[];
@@ -0,0 +1,3 @@
1
+ import type { ContentModel } from './model.js';
2
+ /** コンテンツスキーマの JSON を検査して返却(形が合わなければ例外、理由は zod の issues) */
3
+ export declare const parseModel: (json: unknown) => ContentModel;
@@ -0,0 +1,72 @@
1
+ /** メニューのグループ(collapsed は既定で折りたたむ) */
2
+ export type MenuGroup = Readonly<{
3
+ id: string;
4
+ label: string;
5
+ collapsed?: boolean;
6
+ items: readonly string[];
7
+ }>;
8
+ /** メニューの1段(項目の id かグループ) */
9
+ export type MenuEntry = string | MenuGroup;
10
+ /** 編集画面のセクション(label が空は見出しなし、collapsed は既定で折りたたむ) */
11
+ export type EditorSection = Readonly<{
12
+ id: string;
13
+ label: string;
14
+ collapsed?: boolean;
15
+ items: readonly string[];
16
+ }>;
17
+ /** コンテンツタイプの編集画面の配置(hidden は配置しない項目) */
18
+ export type EditorLayout = Readonly<{
19
+ sections: readonly EditorSection[];
20
+ hidden?: readonly string[];
21
+ }>;
22
+ /** 画面の設定(editors・columns のキーはコンテンツタイプの id) */
23
+ export type ScreenSettings = Readonly<{
24
+ menu: readonly MenuEntry[];
25
+ editors: Readonly<Record<string, EditorLayout>>;
26
+ columns: Readonly<Record<string, readonly string[]>>;
27
+ }>;
28
+ /** メニュー項目の id(コンテンツタイプ) */
29
+ export declare const typeItem: (type: string) => string;
30
+ /** メニュー項目の id(保存したビュー) */
31
+ export declare const viewItem: (id: string) => string;
32
+ /** メニュー項目が指すビュー(ビューの項目でなければ null) */
33
+ export declare const viewOfItem: (item: string) => string | null;
34
+ /** メニュー項目が指すコンテンツタイプ(コンテンツタイプの項目でなければ null) */
35
+ export declare const typeOfItem: (item: string) => string | null;
36
+ /** メニューにある全項目の id(グループの中も、上から順) */
37
+ export declare const menuItemsOf: (menu: readonly MenuEntry[]) => string[];
38
+ /** 編集画面に配置した項目の id(セクションの順) */
39
+ export declare const placedItemsOf: (layout: EditorLayout) => string[];
40
+ /** 解決したメニューの1段(グループは中の項目が空でも残す) */
41
+ export type ResolvedMenuEntry<I> = Readonly<{
42
+ kind: 'item';
43
+ item: I;
44
+ }> | Readonly<{
45
+ kind: 'group';
46
+ id: string;
47
+ label: string;
48
+ collapsed: boolean;
49
+ items: readonly I[];
50
+ }>;
51
+ /**
52
+ * メニューの設定を画面の項目で解決
53
+ * - items: 画面にある項目(group は設定にないときの既定のグループ、null はグループの外)
54
+ * - 設定にない項目: 既定のグループの末尾、そのグループが設定になければ末尾に新しいグループ(名前は groupLabel)、グループの外は末尾
55
+ * - 画面にない項目の id: 除外
56
+ */
57
+ export declare function resolveMenu<I extends Readonly<{
58
+ id: string;
59
+ group: string | null;
60
+ }>>(menu: readonly MenuEntry[], items: readonly I[], groupLabel: (id: string) => string): ResolvedMenuEntry<I>[];
61
+ /**
62
+ * 編集画面の配置を項目の一覧で解決
63
+ * - catalog: 編集画面が描画できる項目の id(フィールドの順)
64
+ * - 指定なし: 見出しなしの1つのセクションにすべて
65
+ * - 一覧にない項目: 除外、どこにもない項目: 最後のセクションの末尾
66
+ */
67
+ export declare function resolveLayout(layout: EditorLayout | undefined, catalog: readonly string[]): {
68
+ sections: EditorSection[];
69
+ hidden: string[];
70
+ };
71
+ /** 画面の設定の JSON を検査(形の誤りは ZodError) */
72
+ export declare const parseScreens: (json: unknown) => ScreenSettings;
@@ -0,0 +1,25 @@
1
+ /** 暦の日付(`YYYY-MM-DD`) */
2
+ export type DateString = `${number}-${number}-${number}`;
3
+ /** 日付だけの値(`YYYY-MM-DD`)か */
4
+ export declare const isDateOnly: (value: string) => boolean;
5
+ /** 日時として解釈できる文字か(日付だけ・SQLite の日時・ISO 8601、Date.parse だけでは任意の英語の日付も通るため形で限定) */
6
+ export declare const isDateTimeText: (value: string) => boolean;
7
+ /** タイムゾーンを固定した日時の変換 */
8
+ export type Clock = Readonly<{
9
+ /** 今の日時 */
10
+ nowIso: () => string;
11
+ /** タイムゾーンの日付と時刻(HH:MM、省略は0時)の日時 */
12
+ fromLocal: (date: string, time?: string) => string;
13
+ /** 日付・日時・SQLite の日時を日時に(解釈できない値は null) */
14
+ toDateTime: (value: string) => string | null;
15
+ /** 日時のタイムゾーンの日付(日付だけの値はそのまま) */
16
+ dateOf: (value: string) => string;
17
+ /** 日時のタイムゾーンの時刻(HH:MM) */
18
+ timeOf: (value: string) => string;
19
+ /** タイムゾーンでその日の最後の時点 */
20
+ endOfDay: (date: string) => string;
21
+ /** タイムゾーンの今日の日付(now は試験用の今のミリ秒) */
22
+ today: (now?: number) => string;
23
+ }>;
24
+ /** タイムゾーンの日時の変換を作成 */
25
+ export declare function createClock(timeZone: string): Clock;
@@ -0,0 +1,24 @@
1
+ import type { ContentType, FieldDef } from './model.js';
2
+ /** 配信する項目(非公開の項目を除く、まとまりの中も) */
3
+ export declare const deliveredFields: (fields: readonly FieldDef[]) => FieldDef[];
4
+ /** 空の値(複数の値は空の配列、まとまりは項目ごとに空の値、ほかは null) */
5
+ export declare const emptyValues: (fields: readonly FieldDef[]) => Record<string, unknown>;
6
+ /**
7
+ * 入力の値の整形(まとまりの中も、形の誤りは checkFields が検出)
8
+ * - 定義の項目だけを残し、文字は前後の空白を除いて空は null
9
+ * - 省略: 複数の値は空の配列、まとまりは項目ごとに空の値
10
+ * - 複数の値の null: そのまま(空の配列と未定を区別する導入先のため)
11
+ * - 項目を定義しないまとまり: 値をそのまま(形は拡張機能が保存前に検査、例: データセットのグラフ)
12
+ */
13
+ export declare function pickValues(fields: readonly FieldDef[], input: unknown): Record<string, unknown>;
14
+ /** 値の中で参照している ID(to の型への参照だけ、まとまりの中も含む、labels は外側のまとまりから参照の項目までの表示名) */
15
+ export declare function referencedIds(fields: readonly FieldDef[], values: unknown, to: string): {
16
+ labels: string[];
17
+ id: string;
18
+ }[];
19
+ /** 型の参照の項目(to を指定すると、その型への参照だけ) */
20
+ export declare const referencesOf: (type: ContentType, to?: string) => Extract<FieldDef, {
21
+ type: "reference";
22
+ }>[];
23
+ /** 型の値の項目(参照の項目を除く) */
24
+ export declare const valueFieldsOf: (type: ContentType) => FieldDef[];
@@ -0,0 +1,2 @@
1
+ export { recordView } from '../../analytics/src/index.js';
2
+ export type { Classify, Dataset } from '../../analytics/src/index.js';
@@ -0,0 +1,2 @@
1
+ export { blockSchemaOf, citesOf, DESCRIPTION_MAX, descriptionOf, excerptOf, isSafeHref, linksOf, plainOf, READING_SPEED, readMinOf } from '../../body/src/index.js';
2
+ export type { Block, Body, BodyProfile, ComponentBlock, DeclaredComponent, HeadingLevel, Inline, InlineComponent, Link, List, ListItem, Mark, PropSchema, PropsSchema, PropType, Rich, StandardBlock, Text } from '../../body/src/index.js';
@@ -0,0 +1,5 @@
1
+ import type { ContentModel, ScreenSettings } from '../../model/src/index.js';
2
+ /** 中立の既定のスキーマ(新しい媒体の作成で適用する型: post・author・tag・image・video、設定の移入の土台) */
3
+ export declare const DEFAULT_SCHEMA: ContentModel;
4
+ /** 既定の画面設定(新しい媒体の作成で適用する中立の値、移入する screens の土台) */
5
+ export declare const DEFAULT_SCREENS: ScreenSettings;
@@ -0,0 +1,2 @@
1
+ export { createDeliveryClient, createDeliveryClock, DELIVERY_PATH, DeliveryError, fieldOf, limitOf, listParams, mediaOf, optionLabels, pagePath, subPath } from '../../delivery-client/src/index.js';
2
+ export type { BundleResult, DeliveredAsset, Delivery, DeliveryClient, DeliveryClock, FieldValue, ImageUrl, Item, ItemOf, ListFilter, ListQuery, MediaOf, Page, Prefetched } from '../../delivery-client/src/index.js';
@@ -0,0 +1,4 @@
1
+ export { openValue, SIGNED_HEADERS, verifyRequest } from '../../access/src/index.js';
2
+ export type { VerifyRequestOptions } from '../../access/src/index.js';
3
+ export { EMBED_CONTEXT_PARAM, EMBED_MESSAGES, FUNCTION_HOOKS } from '../../cms-contract/src/index.js';
4
+ export type { EmbedContext, EmbedMessage, FunctionHook, FunctionRequest, PublishCheckRequest, PublishCheckResponse, SaveCheckRequest, SaveCheckResponse, WebhookAction, WebhookBody, WebhookEvent } from '../../cms-contract/src/index.js';
@@ -0,0 +1,5 @@
1
+ export { coverPosition, coverStart, createClock, cropRect, croppedHotspot, IMAGE_TYPE, isDateOnly, mediaSchema, objectPosition, pagePathOf, parseModel, parseScreens, publicPathOf, stillOf, typeOf, VIDEO_TYPE } from '../../model/src/index.js';
2
+ export type { Asset, AssetRef, Clock, ContentModel, ContentType, Crop, CropRect, DateString, FieldDef, Hotspot, LocalImage, Media, PageDef, PageEntry, ScreenSettings } from '../../model/src/index.js';
3
+ export { CONFIG_FORMAT } from '../../cms-contract/src/index.js';
4
+ export type { ConfigBundle } from '../../cms-contract/src/index.js';
5
+ export { DEFAULT_SCHEMA, DEFAULT_SCREENS } from './defaults.js';
@@ -0,0 +1,2 @@
1
+ export { SIGNED_HEADERS, signedHeaders, signParts, verifyParts, verifyRequest } from '../../access/src/index.js';
2
+ export type { SignedParts, VerifyRequestOptions } from '../../access/src/index.js';
@@ -0,0 +1,2 @@
1
+ export { sampleRateOf, TRACEPARENT_HEADER, withEdgeSpan } from '../../access/src/index.js';
2
+ export type { EdgeSpan, EdgeSpanOptions, EdgeSpanStatus, TraceContext } from '../../access/src/index.js';
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ryusenkei/maezae",
3
- "version": "0.2.0",
3
+ "version": "0.3.0",
4
4
  "description": "maezae の導入先のサイト向けの SDK(配信 API の取得・本文の型・プレビューの署名)",
5
5
  "license": "UNLICENSED",
6
6
  "author": "RYUSENKEI",
@@ -31,6 +31,14 @@
31
31
  "./integrations": {
32
32
  "types": "./dist/integrations.d.ts",
33
33
  "default": "./dist/integrations.js"
34
+ },
35
+ "./analytics": {
36
+ "types": "./dist/analytics.d.ts",
37
+ "default": "./dist/analytics.js"
38
+ },
39
+ "./trace": {
40
+ "types": "./dist/trace.d.ts",
41
+ "default": "./dist/trace.js"
34
42
  }
35
43
  },
36
44
  "files": [
@@ -48,7 +56,7 @@
48
56
  "typescript": "^5.9.3"
49
57
  },
50
58
  "scripts": {
51
- "build": "node --max-old-space-size=6144 scripts/build.ts && node scripts/check-dist.ts",
59
+ "build": "node scripts/build.ts && node scripts/check-dist.ts",
52
60
  "typecheck": "tsc"
53
61
  }
54
62
  }
@@ -1,157 +0,0 @@
1
- import { z } from "zod";
2
- /** インラインの装飾(strong・em・code・s・mark・sup・sub) */
3
- type Mark = 'strong' | 'em' | 'code' | 'strike' | 'mark' | 'sup' | 'sub';
4
- /** リンク(HTML の a の href・title・rel) */
5
- type Link = Readonly<{
6
- href: string;
7
- title?: string;
8
- rel?: string;
9
- }>;
10
- /** 装飾・リンクつきの文字列 */
11
- type Text = Readonly<{
12
- text: string;
13
- marks?: readonly Mark[];
14
- link?: Link;
15
- }>;
16
- /** インラインのコンポーネント(例: 注、属性は文字列だけ、text は中の文字) */
17
- type InlineComponent = Readonly<{
18
- component: string;
19
- props?: Readonly<Record<string, string>>;
20
- text?: string;
21
- }>;
22
- /** インラインの断片(文字列は装飾なし) */
23
- type Inline = string | Text | InlineComponent;
24
- /** インラインの断片の列(1つの段落・見出し・セルの内容) */
25
- type Rich = readonly Inline[];
26
- /** 見出しの段階 */
27
- type HeadingLevel = 1 | 2 | 3 | 4 | 5 | 6;
28
- /** リストの1項目(children は入れ子のリスト) */
29
- type ListItem = Readonly<{
30
- content: Rich;
31
- children?: List;
32
- }>;
33
- /** リスト */
34
- type List = Readonly<{
35
- type: 'list';
36
- ordered?: boolean;
37
- items: readonly ListItem[];
38
- variant?: string;
39
- }>;
40
- /** 標準のブロック */
41
- type StandardBlock<M> = Readonly<{
42
- type: 'paragraph';
43
- content: Rich;
44
- variant?: string;
45
- }> | Readonly<{
46
- type: 'heading';
47
- level: HeadingLevel;
48
- content: Rich;
49
- id?: string;
50
- variant?: string;
51
- }> | List | Readonly<{
52
- type: 'quote';
53
- content: readonly Rich[];
54
- cite?: Readonly<{
55
- label: string;
56
- href?: string;
57
- }>;
58
- variant?: string;
59
- }> | Readonly<{
60
- type: 'code';
61
- code: string;
62
- lang?: string;
63
- caption?: string;
64
- variant?: string;
65
- }> | Readonly<{
66
- type: 'image';
67
- media: M;
68
- alt?: string;
69
- caption?: string;
70
- variant?: string;
71
- }> | Readonly<{
72
- type: 'table';
73
- head?: readonly Rich[];
74
- rows: readonly (readonly Rich[])[];
75
- caption?: string;
76
- variant?: string;
77
- }> | Readonly<{
78
- type: 'divider';
79
- }> | Readonly<{
80
- type: 'html';
81
- html: string;
82
- }>;
83
- /** カスタムコンポーネントのブロック(props は JSON で表せる値) */
84
- type ComponentBlock = Readonly<{
85
- type: 'component';
86
- name: string;
87
- props: unknown;
88
- }>;
89
- /** 本文のブロック */
90
- type Block<M> = StandardBlock<M> | ComponentBlock;
91
- /** 本文 */
92
- type Body<M> = readonly Block<M>[];
93
- /** 引数の型 */
94
- type PropType = 'string' | 'number' | 'integer' | 'boolean' | 'array' | 'object';
95
- /** 1つの引数の形(title は管理画面の項目名、enum は文字列の選択肢、items は配列の要素、properties・required はオブジェクトの中) */
96
- type PropSchema = Readonly<{
97
- type: PropType;
98
- title?: string;
99
- description?: string;
100
- enum?: readonly string[];
101
- items?: PropSchema;
102
- properties?: Readonly<Record<string, PropSchema>>;
103
- required?: readonly string[];
104
- }>;
105
- /** 引数の全体の形(最上位はオブジェクト) */
106
- type PropsSchema = Readonly<{
107
- type: 'object';
108
- properties: Readonly<Record<string, PropSchema>>;
109
- required?: readonly string[];
110
- }>;
111
- /** 導入先が宣言する部品(label は管理画面の表示名、inline の省略はブロック) */
112
- type DeclaredComponent = Readonly<{
113
- name: string;
114
- label: string;
115
- description?: string;
116
- inline?: boolean;
117
- props: PropsSchema;
118
- }>;
119
- /** 本文の設定 */
120
- type BodyProfile = Readonly<{
121
- headings: readonly HeadingLevel[];
122
- marks: readonly Mark[];
123
- /** 装飾の重ね掛けと装飾つきのリンク(既定は可) */
124
- combineMarks?: boolean;
125
- /** リンクの rel(なしは rel なしのリンクだけ) */
126
- linkRels?: readonly string[];
127
- /** 装飾・リンク・インラインのコンポーネントを使用できない場所 */
128
- plain?: readonly ('heading' | 'tableHead')[];
129
- list?: Readonly<{
130
- ordered: boolean;
131
- nested: boolean;
132
- variants?: readonly string[];
133
- }>;
134
- quote?: Readonly<{
135
- multiple: boolean;
136
- cite: boolean;
137
- }>;
138
- /** コード(componentLangs はコンポーネントで書く言語とコンポーネントの名前、例: mermaid は図、その言語のフェンスだけのコードは不可) */
139
- code?: Readonly<{
140
- caption: boolean;
141
- componentLangs?: Readonly<Record<string, string>>;
142
- }>;
143
- image?: Readonly<{
144
- variants?: readonly string[];
145
- }>;
146
- table?: Readonly<{
147
- head: 'required' | 'optional';
148
- caption: 'required' | 'optional' | 'none';
149
- }>;
150
- divider?: true;
151
- html?: true;
152
- /** 使用できるコンポーネントの名前(ブロック・インライン) */
153
- components: readonly string[];
154
- }>;
155
- /** 本文の1ブロックの検査(profile は本文の設定、media は画像の参照の検査、declared は導入先が宣言した部品) */
156
- declare function blockSchemaOf<M>(profile: BodyProfile, media: z.ZodType<M>, declared?: readonly DeclaredComponent[]): z.ZodType<Block<M>>;
157
- export { Rich as _, PropType as a, Body as c, Inline as d, InlineComponent as f, Mark as g, ListItem as h, PropSchema as i, ComponentBlock as l, List as m, BodyProfile as n, PropsSchema as o, Link as p, DeclaredComponent as r, Block as s, blockSchemaOf as t, HeadingLevel as u, StandardBlock as v, Text as y };