@ryusenkei/maezae 0.16.0 → 0.18.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.
- package/README.md +44 -0
- package/dist/body.js +312 -10
- package/dist/{declared-9_jI3JXH.js → declared-Qo-mWnDd.js} +154 -15
- package/dist/delivery.js +43 -2
- package/dist/model.js +4 -2
- package/dist/types/analytics/src/index.d.ts +1 -0
- package/dist/types/analytics/src/shared.d.ts +21 -0
- package/dist/types/body/src/derive.d.ts +1 -1
- package/dist/types/body/src/embed.d.ts +14 -0
- package/dist/types/body/src/html.d.ts +31 -0
- package/dist/types/body/src/index.d.ts +5 -2
- package/dist/types/body/src/library.d.ts +19 -0
- package/dist/types/body/src/markdown.d.ts +1 -1
- package/dist/types/body/src/normalize.d.ts +1 -1
- package/dist/types/body/src/profile.d.ts +34 -2
- package/dist/types/body/src/render.d.ts +29 -0
- package/dist/types/body/src/types.d.ts +46 -5
- package/dist/types/cms-contract/src/apiKeys.d.ts +27 -0
- package/dist/types/cms-contract/src/assets.d.ts +2 -0
- package/dist/types/cms-contract/src/errors.d.ts +5 -3
- package/dist/types/cms-contract/src/import.d.ts +33 -1
- package/dist/types/cms-contract/src/index.d.ts +6 -5
- package/dist/types/cms-contract/src/labels.d.ts +5 -0
- package/dist/types/cms-contract/src/roles.d.ts +3 -1
- package/dist/types/cms-contract/src/views.d.ts +2 -2
- package/dist/types/cms-contract/src/workflow.d.ts +49 -0
- package/dist/types/model/src/asset.d.ts +8 -2
- package/dist/types/model/src/index.d.ts +2 -2
- package/dist/types/model/src/mediaUrl.d.ts +20 -2
- package/dist/types/model/src/model.d.ts +12 -4
- package/dist/types/sdk/src/body.d.ts +2 -2
- package/dist/types/sdk/src/delivery/index.d.ts +1 -1
- package/dist/types/sdk/src/delivery/values.d.ts +6 -2
- package/dist/types/sdk/src/delivery.d.ts +1 -1
- package/package.json +1 -1
|
@@ -1,16 +1,30 @@
|
|
|
1
|
-
/** インラインの装飾(strong・em・code・s・mark・sup・sub) */
|
|
2
|
-
export type Mark = 'strong' | 'em' | 'code' | 'strike' | 'mark' | 'sup' | 'sub';
|
|
3
|
-
/** リンク(HTML の a の href・title・rel
|
|
1
|
+
/** インラインの装飾(strong・em・code・s・mark・sup・sub・u) */
|
|
2
|
+
export type Mark = 'strong' | 'em' | 'code' | 'strike' | 'mark' | 'sup' | 'sub' | 'underline';
|
|
3
|
+
/** リンク(HTML の a の href・title・rel、target は別のタブ) */
|
|
4
4
|
export type Link = Readonly<{
|
|
5
5
|
href: string;
|
|
6
6
|
title?: string;
|
|
7
7
|
rel?: string;
|
|
8
|
+
target?: '_blank';
|
|
8
9
|
}>;
|
|
9
|
-
/**
|
|
10
|
+
/** 名前のついた値(name は本文の設定で宣言した名前、value は元の CSS の値、どちらか1つ以上) */
|
|
11
|
+
export type Named = Readonly<{
|
|
12
|
+
name?: string;
|
|
13
|
+
value?: string;
|
|
14
|
+
}>;
|
|
15
|
+
/** 文字の見た目(styles は本文の設定で宣言した名前のついた装飾、例: microCMS のカスタム class) */
|
|
16
|
+
export type TextStyle = Readonly<{
|
|
17
|
+
color?: Named;
|
|
18
|
+
background?: Named;
|
|
19
|
+
size?: Named;
|
|
20
|
+
styles?: readonly string[];
|
|
21
|
+
}>;
|
|
22
|
+
/** 装飾・リンク・見た目つきの文字列 */
|
|
10
23
|
export type Text = Readonly<{
|
|
11
24
|
text: string;
|
|
12
25
|
marks?: readonly Mark[];
|
|
13
26
|
link?: Link;
|
|
27
|
+
style?: TextStyle;
|
|
14
28
|
}>;
|
|
15
29
|
/** インラインのコンポーネント(例: 注、属性は文字列だけ、text は中の文字) */
|
|
16
30
|
export type InlineComponent = Readonly<{
|
|
@@ -24,6 +38,20 @@ export type Inline = string | Text | InlineComponent;
|
|
|
24
38
|
export type Rich = readonly Inline[];
|
|
25
39
|
/** 見出しの段階 */
|
|
26
40
|
export type HeadingLevel = 1 | 2 | 3 | 4 | 5 | 6;
|
|
41
|
+
/** 揃え(段落・見出し・表のセル) */
|
|
42
|
+
export type Align = 'left' | 'center' | 'right' | 'justify';
|
|
43
|
+
/** 画像の横の位置 */
|
|
44
|
+
export type ImageAlign = 'left' | 'center' | 'right';
|
|
45
|
+
/** 属性つきの表のセル(content はセルの中の段落、header は見出しのセル、colspan・rowspan は結合) */
|
|
46
|
+
export type TableCell = Readonly<{
|
|
47
|
+
content: readonly Rich[];
|
|
48
|
+
header?: boolean;
|
|
49
|
+
colspan?: number;
|
|
50
|
+
rowspan?: number;
|
|
51
|
+
align?: Align;
|
|
52
|
+
}>;
|
|
53
|
+
/** 表のセル(断片の列だけのセルか、属性つきのセル) */
|
|
54
|
+
export type Cell = Rich | TableCell;
|
|
27
55
|
/** リストの1項目(children は入れ子のリスト) */
|
|
28
56
|
export type ListItem = Readonly<{
|
|
29
57
|
content: Rich;
|
|
@@ -40,12 +68,14 @@ export type List = Readonly<{
|
|
|
40
68
|
export type StandardBlock<M> = Readonly<{
|
|
41
69
|
type: 'paragraph';
|
|
42
70
|
content: Rich;
|
|
71
|
+
align?: Align;
|
|
43
72
|
variant?: string;
|
|
44
73
|
}> | Readonly<{
|
|
45
74
|
type: 'heading';
|
|
46
75
|
level: HeadingLevel;
|
|
47
76
|
content: Rich;
|
|
48
77
|
id?: string;
|
|
78
|
+
align?: Align;
|
|
49
79
|
variant?: string;
|
|
50
80
|
}> | List | Readonly<{
|
|
51
81
|
type: 'quote';
|
|
@@ -60,19 +90,26 @@ export type StandardBlock<M> = Readonly<{
|
|
|
60
90
|
code: string;
|
|
61
91
|
lang?: string;
|
|
62
92
|
caption?: string;
|
|
93
|
+
filename?: string;
|
|
63
94
|
variant?: string;
|
|
64
95
|
}> | Readonly<{
|
|
65
96
|
type: 'image';
|
|
66
97
|
media: M;
|
|
67
98
|
alt?: string;
|
|
68
99
|
caption?: string;
|
|
100
|
+
link?: Link;
|
|
101
|
+
align?: ImageAlign;
|
|
69
102
|
variant?: string;
|
|
70
103
|
}> | Readonly<{
|
|
71
104
|
type: 'table';
|
|
72
105
|
head?: readonly Rich[];
|
|
73
|
-
rows: readonly (readonly
|
|
106
|
+
rows: readonly (readonly Cell[])[];
|
|
74
107
|
caption?: string;
|
|
75
108
|
variant?: string;
|
|
109
|
+
}> | Readonly<{
|
|
110
|
+
type: 'file';
|
|
111
|
+
media: M;
|
|
112
|
+
label?: string;
|
|
76
113
|
}> | Readonly<{
|
|
77
114
|
type: 'divider';
|
|
78
115
|
}> | Readonly<{
|
|
@@ -89,3 +126,7 @@ export type ComponentBlock = Readonly<{
|
|
|
89
126
|
export type Block<M> = StandardBlock<M> | ComponentBlock;
|
|
90
127
|
/** 本文 */
|
|
91
128
|
export type Body<M> = readonly Block<M>[];
|
|
129
|
+
/** 属性つきのセルか */
|
|
130
|
+
export declare const isTableCell: (cell: Cell) => cell is TableCell;
|
|
131
|
+
/** セルの中の段落(断片の列だけのセルは1段落) */
|
|
132
|
+
export declare const cellParagraphs: (cell: Cell) => readonly Rich[];
|
|
@@ -1,7 +1,29 @@
|
|
|
1
|
+
/** 鍵の種類 */
|
|
2
|
+
export declare const API_KEY_KINDS: readonly ["server"];
|
|
3
|
+
/** 鍵の種類 */
|
|
4
|
+
export type ApiKeyKind = (typeof API_KEY_KINDS)[number];
|
|
5
|
+
/** 鍵の操作 */
|
|
6
|
+
export declare const API_KEY_OPERATIONS: readonly ["read", "read_drafts", "create", "update", "publish", "delete"];
|
|
7
|
+
/** 鍵の操作 */
|
|
8
|
+
export type ApiKeyOperation = (typeof API_KEY_OPERATIONS)[number];
|
|
9
|
+
/** 書き込みの操作(書き込みの API(#500)まで画面で選べない) */
|
|
10
|
+
export declare const API_KEY_WRITE_OPERATIONS: readonly ["create", "update", "publish", "delete"];
|
|
11
|
+
/** 権限のキーで、すべての型(後から足す型を含む) */
|
|
12
|
+
export declare const API_KEY_ALL_TYPES = "*";
|
|
13
|
+
/** 鍵の権限(キーは型の id か API_KEY_ALL_TYPES) */
|
|
14
|
+
export type ApiKeyPermissions = Readonly<Record<string, readonly ApiKeyOperation[]>>;
|
|
15
|
+
/** 権限を省略した鍵と既存の鍵の権限 */
|
|
16
|
+
export declare const DEFAULT_API_KEY_PERMISSIONS: {
|
|
17
|
+
readonly "*": readonly ["read"];
|
|
18
|
+
};
|
|
19
|
+
/** 鍵の権限が型の操作を許すか(read は read_drafts でも満たす) */
|
|
20
|
+
export declare function apiKeyAllows(permissions: ApiKeyPermissions, type: string, operation: ApiKeyOperation): boolean;
|
|
1
21
|
/** 一覧に表示する API の鍵(tail は鍵の末尾、revokedAt は失効の日時で有効なら null) */
|
|
2
22
|
export type ApiKey = Readonly<{
|
|
3
23
|
id: string;
|
|
4
24
|
label: string;
|
|
25
|
+
kind: ApiKeyKind;
|
|
26
|
+
permissions: ApiKeyPermissions;
|
|
5
27
|
tail: string;
|
|
6
28
|
createdAt: string;
|
|
7
29
|
revokedAt: string | null;
|
|
@@ -11,3 +33,8 @@ export declare const API_KEY_RATE: {
|
|
|
11
33
|
readonly limit: 600;
|
|
12
34
|
readonly period: 60;
|
|
13
35
|
};
|
|
36
|
+
/** 公開のエンドポイントで鍵や媒体の照合に失敗した要求の、接続元の IP ごとの上限(period 秒で limit 回、超えた IP は照合の前に429、platform#45) */
|
|
37
|
+
export declare const PUBLIC_FAILURE_RATE: {
|
|
38
|
+
readonly limit: 30;
|
|
39
|
+
readonly period: 60;
|
|
40
|
+
};
|
|
@@ -8,3 +8,5 @@ export declare const ASSET_BULK_MAX = 500;
|
|
|
8
8
|
export declare const ASSET_IMAGE_TYPES: readonly ["image/jpeg", "image/png", "image/webp", "image/gif"];
|
|
9
9
|
/** 画像1枚の大きさの上限(バイト、アップロード・取り込みで共通) */
|
|
10
10
|
export declare const ASSET_SIZE_MAX: number;
|
|
11
|
+
/** ファイルの実体の大きさの上限(バイト、本文の中のファイルの取り込み) */
|
|
12
|
+
export declare const ASSET_FILE_SIZE_MAX: number;
|
|
@@ -10,6 +10,7 @@ export declare const ERROR_STATUS: {
|
|
|
10
10
|
readonly file_required: 400;
|
|
11
11
|
readonly file_too_large: 400;
|
|
12
12
|
readonly unsupported_image: 400;
|
|
13
|
+
readonly unsupported_file: 400;
|
|
13
14
|
readonly invalid_dimensions: 400;
|
|
14
15
|
readonly https_required: 400;
|
|
15
16
|
readonly invalid_style: 400;
|
|
@@ -20,6 +21,7 @@ export declare const ERROR_STATUS: {
|
|
|
20
21
|
readonly invalid_api_key: 401;
|
|
21
22
|
readonly account_not_found: 403;
|
|
22
23
|
readonly invalid_preview_token: 403;
|
|
24
|
+
readonly api_key_forbidden: 403;
|
|
23
25
|
readonly mcp_not_allowed: 403;
|
|
24
26
|
readonly admin_only: 403;
|
|
25
27
|
readonly forbidden: 403;
|
|
@@ -62,7 +64,7 @@ export type ErrorTarget = 'request' | 'role' | 'media' | 'entry' | 'asset' | 'mc
|
|
|
62
64
|
/** エラーの補足の値(コードごとに使用する項目だけ) */
|
|
63
65
|
export type ErrorParams = {
|
|
64
66
|
/**
|
|
65
|
-
* 対象: not_found・own_only・forbidden・not_visible・no_linked_entry・editorial_only
|
|
67
|
+
* 対象: not_found・own_only・forbidden・not_visible・no_linked_entry・editorial_only・api_key_forbidden
|
|
66
68
|
* - 文字列: モジュールの対象・コンテンツタイプの id
|
|
67
69
|
*/
|
|
68
70
|
target?: ErrorTarget | (string & {});
|
|
@@ -71,9 +73,9 @@ export type ErrorParams = {
|
|
|
71
73
|
/** 使用先: in_use */
|
|
72
74
|
by?: 'uses' | 'places' | 'outputs' | 'entry' | 'writers' | 'members' | 'accounts';
|
|
73
75
|
/** 状態の不一致の理由: invalid_state */
|
|
74
|
-
reason?: 'not_draft' | 'no_draft' | 'not_in_review' | 'request_handled' | 'deleted' | 'not_deleted' | 'schema_confirm' | 'no_publishing' | 'no_review';
|
|
76
|
+
reason?: 'not_draft' | 'no_draft' | 'not_in_review' | 'request_handled' | 'deleted' | 'not_deleted' | 'schema_confirm' | 'no_publishing' | 'no_review' | 'not_published';
|
|
75
77
|
/** 取得の対象: upstream_failed */
|
|
76
|
-
resource?: 'page' | 'image' | 'webhook';
|
|
78
|
+
resource?: 'page' | 'image' | 'webhook' | 'microcms' | 'file';
|
|
77
79
|
/**
|
|
78
80
|
* 名前
|
|
79
81
|
* - no_linked_entry: 結び付くコンテンツタイプの表示名、account_not_found: メールアドレス
|
|
@@ -36,7 +36,7 @@ export type ImportItemReport = Readonly<{
|
|
|
36
36
|
source: string;
|
|
37
37
|
type: string;
|
|
38
38
|
id: string | null;
|
|
39
|
-
status: 'created' | 'ready' | 'skipped';
|
|
39
|
+
status: 'created' | 'updated' | 'ready' | 'skipped';
|
|
40
40
|
problems: readonly ImportProblem[];
|
|
41
41
|
}>;
|
|
42
42
|
/** 画像の結果(checked は試しの実行で取得できた、asset は保存した画像の ID) */
|
|
@@ -71,6 +71,7 @@ export type ImportReport = Readonly<{
|
|
|
71
71
|
summary: Readonly<{
|
|
72
72
|
items: number;
|
|
73
73
|
created: number;
|
|
74
|
+
updated: number;
|
|
74
75
|
ready: number;
|
|
75
76
|
skipped: number;
|
|
76
77
|
images: Readonly<Record<ImportImage['status'], number>>;
|
|
@@ -99,3 +100,34 @@ export declare const sourceOf: (item: ImportItem, index: number) => string;
|
|
|
99
100
|
export declare function importReportOf(dryRun: boolean, parts: Omit<ImportReport, 'dryRun' | 'summary'>): ImportReport;
|
|
100
101
|
/** 分けて送った取り込みの報告を1つに(同じ URL の画像は先の結果) */
|
|
101
102
|
export declare function mergeImportReports(dryRun: boolean, reports: readonly ImportReport[], extra?: Partial<Omit<ImportReport, 'dryRun' | 'summary'>>): ImportReport;
|
|
103
|
+
/** microCMS から取り込む API(schema は API のスキーマの JSON、relations は関係の項目の fieldId と先のエンドポイント) */
|
|
104
|
+
export type MicroCmsApiInput = Readonly<{
|
|
105
|
+
endpoint: string;
|
|
106
|
+
label: string;
|
|
107
|
+
format: 'list' | 'object';
|
|
108
|
+
schema: unknown;
|
|
109
|
+
relations: Readonly<Record<string, string>>;
|
|
110
|
+
privateMedia?: boolean;
|
|
111
|
+
}>;
|
|
112
|
+
/** microCMS の型の変換の注意(path は型の id と項目) */
|
|
113
|
+
export type MicroCmsNote = Readonly<{
|
|
114
|
+
level: 'error' | 'warning';
|
|
115
|
+
path: string;
|
|
116
|
+
message: string;
|
|
117
|
+
}>;
|
|
118
|
+
/** 本文の変換で捨てたもの(what は要素・属性・style の項目・class) */
|
|
119
|
+
export type MicroCmsDropped = Readonly<{
|
|
120
|
+
what: string;
|
|
121
|
+
count: number;
|
|
122
|
+
}>;
|
|
123
|
+
/** microCMS のコンテンツの1ページの取り込みの結果(next は次のページの offset、なしは終わり、tooLarge は大きすぎて残さなかった元の HTML) */
|
|
124
|
+
export type MicroCmsContentResult = Readonly<{
|
|
125
|
+
report: ImportReport;
|
|
126
|
+
total: number;
|
|
127
|
+
next: number | null;
|
|
128
|
+
dropped: readonly MicroCmsDropped[];
|
|
129
|
+
tooLarge: readonly Readonly<{
|
|
130
|
+
id: string;
|
|
131
|
+
field: string;
|
|
132
|
+
}>[];
|
|
133
|
+
}>;
|
|
@@ -1,21 +1,22 @@
|
|
|
1
|
-
export { API_KEY_RATE, type ApiKey } from './apiKeys.js';
|
|
2
|
-
export { ASSET_BULK_MAX, ASSET_IMAGE_TYPES, ASSET_SIZE_MAX } from './assets.js';
|
|
1
|
+
export { API_KEY_ALL_TYPES, API_KEY_KINDS, API_KEY_OPERATIONS, API_KEY_RATE, API_KEY_WRITE_OPERATIONS, PUBLIC_FAILURE_RATE, apiKeyAllows, type ApiKey, type ApiKeyKind, type ApiKeyOperation, type ApiKeyPermissions, DEFAULT_API_KEY_PERMISSIONS } from './apiKeys.js';
|
|
2
|
+
export { ASSET_BULK_MAX, ASSET_FILE_SIZE_MAX, ASSET_IMAGE_TYPES, ASSET_SIZE_MAX } from './assets.js';
|
|
3
3
|
export { errorLabel, errorTitle, mergeMessages, TARGET_LABELS, targetOf, type TargetMessages } from './errorLabels.js';
|
|
4
4
|
export { ERROR_STATUS, JSON_BODY_MAX, type ErrorBody, type ErrorCode, type ErrorParams, type ErrorTarget } from './errors.js';
|
|
5
|
-
export { STATUS } from './labels.js';
|
|
5
|
+
export { CHANGES_LABELS, STATUS } from './labels.js';
|
|
6
6
|
export { ANALYTICS_MODULE, BUILTIN_MODULES, OG_FONTS, OG_MODULE, type OgFont, type OgSettings } from './builtins.js';
|
|
7
7
|
export { type CalendarField, calendarFieldSource, type CalendarItem, type ExtensionState, type ExtensionUpdate, fieldOwnersOf, type PendingItem, permissionTargetsOf } from './extensions.js';
|
|
8
8
|
export { type CallApi, type ConnectionPoint, type ContentTypePoint, createModules, type FieldRef, type McpModule, type McpModuleContext, type McpParts, type McpTool, type ModuleAbout, type ModuleBase, moduleBaseOf, type ModuleContext, type ModuleInstance, type ModuleManifest, type ModuleSettingsInput, type ModuleSide, moduleTargetsOf, type PermissionTarget, type SettingField } from './modules.js';
|
|
9
9
|
export { applyFieldRules, autoFieldsOf, type FieldRule, hiddenFieldsOf, restrictedChoicesOf, restrictedProblemsOf } from './fieldRules.js';
|
|
10
10
|
export { pendingIds, pendingValue } from './pending.js';
|
|
11
11
|
export { type AccountLink, type Action, ACTION_LEVELS, ACTIONS, allows, ANY_TARGET, canChangeRow, canDeleteContent, canEditContent, canPublishContent, canReadContent, canReadRow, canSubmitContent, checkPermissions, type ContentAccess, type Level, LEVELS, levelOf, ownsContent, ownsRow, type Permissions, type RowAccess } from './permissions.js';
|
|
12
|
-
export { ADMIN_PERMISSIONS, ADMIN_ROLE, isAdmin, rolePermissionsOf, type Role, SYSTEM_ROLES, type User, WRITER_ROLE } from './roles.js';
|
|
12
|
+
export { ADMIN_PERMISSIONS, ADMIN_ROLE, defaultRoleOf, isAdmin, rolePermissionsOf, type Role, SYSTEM_ROLES, type User, WRITER_ROLE } from './roles.js';
|
|
13
13
|
export { isServerPath, OPS_PATHS, SERVER_PATHS } from './paths.js';
|
|
14
14
|
export { CONFIG_FORMAT, type ConfigBundle, type ConfigPreview } from './transfer.js';
|
|
15
|
-
export { IMPORT_ITEMS_MAX, IMPORT_PROBLEM_LABELS, IMPORT_PROBLEMS, type ImportIdChange, type ImportIdConflict, importIdOf, type ImportIdPlan, type ImportImage, type ImportItem, type ImportItemReport, type ImportProblem, type ImportProblemCode, type ImportReport, importReportOf, mergeImportReports, planImportIds, sourceOf } from './import.js';
|
|
15
|
+
export { IMPORT_ITEMS_MAX, IMPORT_PROBLEM_LABELS, IMPORT_PROBLEMS, type ImportIdChange, type ImportIdConflict, importIdOf, type ImportIdPlan, type ImportImage, type ImportItem, type ImportItemReport, type ImportProblem, type ImportProblemCode, type ImportReport, importReportOf, mergeImportReports, type MicroCmsApiInput, type MicroCmsContentResult, type MicroCmsDropped, type MicroCmsNote, planImportIds, sourceOf } from './import.js';
|
|
16
16
|
export { EMBED_CONTEXT_NEXT_PARAM, EMBED_CONTEXT_PARAM, EMBED_CONTEXT_TTL_SEC, EMBED_MESSAGES, EMBED_PLACEMENTS, type EmbedContext, type EmbedEntry, type EmbedMessage, type EmbedPlacement, type ExternalScreen } from './embeds.js';
|
|
17
17
|
export { type ExternalFunction, FUNCTION_HOOK_LABELS, FUNCTION_HOOKS, functionEventLabel, functionEventOf, type FunctionHook, type FunctionOnError, type FunctionRequest, type PublishCheckRequest, type PublishCheckResponse, type SaveCheckRequest, type SaveCheckResponse } from './functions.js';
|
|
18
18
|
export { isWebhookAction, parseWebhookEvent, type Webhook, WEBHOOK_ACTION_LABELS, type WebhookBody, WEBHOOK_ACTIONS, type WebhookAction, type WebhookDelivery, type WebhookEvent, webhookEventLabel, webhookEventOf, type WebhookKind, type WebhookModuleBody, type WebhookSubscription, webhookSubscriptionLabel, WEBHOOK_VERSION, type WebhookVersion } from './webhooks.js';
|
|
19
19
|
export { CONTRACT_VERSION_HEADER, DELIVERY_VERSION } from './versions.js';
|
|
20
20
|
export { type SavedView, VIEW_ACTIONS, type ViewAction, type ViewDefinition } from './views.js';
|
|
21
|
+
export { ENTRY_ACTIONS, ENTRY_STATES, type EntryAction, entryActions, type EntryChanges, entryGuard, type EntryGuard, type EntryGuardInput, type EntryRow, type EntryState, entryStateOf, isLiveState, type WorkflowPublishing } from './workflow.js';
|
|
21
22
|
export { canManageSettings, isSettingsTarget, managedAreasOf, SETTINGS_AREA_LABELS, SETTINGS_AREAS, type SettingsArea, settingsTarget } from './settings.js';
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { type AccountLink, type Permissions } from './permissions.js';
|
|
2
2
|
/** 管理者のロールの ID */
|
|
3
3
|
export declare const ADMIN_ROLE = "admin";
|
|
4
|
-
/** ライターのロールの ID
|
|
4
|
+
/** ライターのロールの ID(あれば新しいアカウントの既定、削除できる) */
|
|
5
5
|
export declare const WRITER_ROLE = "writer";
|
|
6
6
|
/** 管理者の権限の表(すべての対象・操作が可、DB の値より優先) */
|
|
7
7
|
export declare const ADMIN_PERMISSIONS: Permissions;
|
|
@@ -9,6 +9,8 @@ export declare const ADMIN_PERMISSIONS: Permissions;
|
|
|
9
9
|
export declare const rolePermissionsOf: (roleId: string, stored: Permissions) => Permissions;
|
|
10
10
|
/** 削除できないロールの ID */
|
|
11
11
|
export declare const SYSTEM_ROLES: readonly string[];
|
|
12
|
+
/** 新しいアカウントの既定のロール(ライター、なければ管理者以外の最初のロール、それもなければ管理者) */
|
|
13
|
+
export declare const defaultRoleOf: (roles: readonly Pick<Role, "id">[]) => string;
|
|
12
14
|
/** ロール(API /api/roles の行) */
|
|
13
15
|
export type Role = Readonly<{
|
|
14
16
|
id: string;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
/**
|
|
2
|
-
export declare const VIEW_ACTIONS: readonly ["assign", "publish"];
|
|
1
|
+
/** ビューで許可できる一括操作(名前は行の操作 workflow.ts の EntryAction と同じ、assign は担当者の割り当て) */
|
|
2
|
+
export declare const VIEW_ACTIONS: readonly ["assign", "submit", "publish", "unpublish", "delete"];
|
|
3
3
|
/** ビューで許可できる一括操作 */
|
|
4
4
|
export type ViewAction = (typeof VIEW_ACTIONS)[number];
|
|
5
5
|
/** ビューの内容(filters は列の id ごとの絞り込みの値、query は検索の文、columns は表示する列、editable は一覧で編集する列) */
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
import type { ErrorCode, ErrorParams } from './errors.js';
|
|
2
|
+
import { type ContentAccess } from './permissions.js';
|
|
3
|
+
import type { User } from './roles.js';
|
|
4
|
+
/** 型の公開の管理(model の Publishing と同じ値) */
|
|
5
|
+
export type WorkflowPublishing = 'none' | 'draft' | 'review';
|
|
6
|
+
/** 行の派生の状態 */
|
|
7
|
+
export declare const ENTRY_STATES: readonly ["draft", "returned", "review", "scheduled", "published"];
|
|
8
|
+
export type EntryState = (typeof ENTRY_STATES)[number];
|
|
9
|
+
/** 公開中・予約の行の未公開の変更(none はなし、review はレビュー待ち) */
|
|
10
|
+
export type EntryChanges = 'none' | 'draft' | 'review';
|
|
11
|
+
/** 行の操作(publish は公開・予約・再公開・変更の公開、unpublish は下書きに戻す・予約の取り消し、discard は未公開の変更の破棄) */
|
|
12
|
+
export declare const ENTRY_ACTIONS: readonly ["save", "submit", "reject", "publish", "unpublish", "discard", "delete", "assign"];
|
|
13
|
+
export type EntryAction = (typeof ENTRY_ACTIONS)[number];
|
|
14
|
+
/** 判定に使う行の値(API の形: has_draft・draft_status は未公開の変更、持ち主の項目と created_by を含む) */
|
|
15
|
+
export type EntryRow = ContentAccess & Readonly<{
|
|
16
|
+
published_at?: unknown;
|
|
17
|
+
review_note?: unknown;
|
|
18
|
+
has_draft?: unknown;
|
|
19
|
+
draft_status?: unknown;
|
|
20
|
+
}>;
|
|
21
|
+
type Subject = Pick<User, 'permissions' | 'id' | 'entryId' | 'link'>;
|
|
22
|
+
/** 判定の材料(target は型の id、now は ISO の日時) */
|
|
23
|
+
export type EntryGuardInput = Readonly<{
|
|
24
|
+
publishing: WorkflowPublishing;
|
|
25
|
+
user: Subject;
|
|
26
|
+
target: string;
|
|
27
|
+
row: EntryRow;
|
|
28
|
+
now: string;
|
|
29
|
+
}>;
|
|
30
|
+
/** 判定の結果(拒否はエラーのコードと引数) */
|
|
31
|
+
export type EntryGuard = {
|
|
32
|
+
ok: true;
|
|
33
|
+
} | {
|
|
34
|
+
ok: false;
|
|
35
|
+
code: Exclude<ErrorCode, 'network_error'>;
|
|
36
|
+
params?: ErrorParams;
|
|
37
|
+
};
|
|
38
|
+
/** 行の派生の状態と未公開の変更 */
|
|
39
|
+
export declare function entryStateOf(row: EntryRow, now: string): {
|
|
40
|
+
state: EntryState;
|
|
41
|
+
changes: EntryChanges;
|
|
42
|
+
};
|
|
43
|
+
/** 公開中か予約の状態か */
|
|
44
|
+
export declare const isLiveState: (state: EntryState) => boolean;
|
|
45
|
+
/** 行の操作の可否 */
|
|
46
|
+
export declare function entryGuard({ publishing, user, target, row, now }: EntryGuardInput, action: EntryAction): EntryGuard;
|
|
47
|
+
/** 行に許される操作(ENTRY_ACTIONS の順) */
|
|
48
|
+
export declare const entryActions: (input: EntryGuardInput) => EntryAction[];
|
|
49
|
+
export {};
|
|
@@ -25,7 +25,7 @@ export type LocalImage = Readonly<{
|
|
|
25
25
|
height: number;
|
|
26
26
|
format: string;
|
|
27
27
|
}>;
|
|
28
|
-
/** 実体の共通の項目(ID は UUID で R2 のキーと同じ、sha256
|
|
28
|
+
/** 実体の共通の項目(ID は UUID で R2 のキーと同じ、sha256 は内容のハッシュで同じ画像の重複を防止、visibility は非公開の実体だけ private) */
|
|
29
29
|
type AssetBase = Readonly<{
|
|
30
30
|
id: string;
|
|
31
31
|
mimeType: string;
|
|
@@ -37,6 +37,7 @@ type AssetBase = Readonly<{
|
|
|
37
37
|
hotspot?: Hotspot;
|
|
38
38
|
crop?: Crop;
|
|
39
39
|
createdAt: string;
|
|
40
|
+
visibility?: 'private';
|
|
40
41
|
}>;
|
|
41
42
|
/** 画像の実体(Sanity の sanity.imageAsset、代替テキストと hotspot は画像ごとに1つ) */
|
|
42
43
|
export type ImageAsset = AssetBase & Readonly<{
|
|
@@ -48,8 +49,13 @@ export type VideoAsset = AssetBase & Readonly<{
|
|
|
48
49
|
duration?: number;
|
|
49
50
|
poster?: string;
|
|
50
51
|
}>;
|
|
52
|
+
/** ファイルの実体(本文の中のファイル、name は元のファイル名、寸法は0) */
|
|
53
|
+
export type FileAsset = AssetBase & Readonly<{
|
|
54
|
+
kind: 'file';
|
|
55
|
+
name?: string;
|
|
56
|
+
}>;
|
|
51
57
|
/** 実体(CMS のメディアにある1件) */
|
|
52
|
-
export type Asset = ImageAsset | VideoAsset;
|
|
58
|
+
export type Asset = ImageAsset | VideoAsset | FileAsset;
|
|
53
59
|
/** 使用する側が保存する実体の参照(Sanity の image の asset、表示のときに実体の寸法・代替テキスト・hotspot を合わせて Media に解決) */
|
|
54
60
|
export type AssetRef = Readonly<{
|
|
55
61
|
asset: string;
|
|
@@ -2,13 +2,13 @@ export { fieldZod, jsonSchemaOf, normalizeValues, zodOf, type ValueOptions } fro
|
|
|
2
2
|
export { assetRefSchema, cropSchema, hotspotSchema, mediaSchema, type Asset, type AssetRef, type Crop, type Hotspot, type LocalImage, type Media } from './asset.js';
|
|
3
3
|
export { coverPosition, coverStart, cropRect, croppedHotspot, objectPosition, stillOf, type CropRect } from './image.js';
|
|
4
4
|
export { IMAGE_TYPE, VIDEO_TYPE } from './media.js';
|
|
5
|
-
export { IMAGE_SIZE_MAX, imageParamsOf, mediaExtOf, mediaMimeOf, mediaPathOf, parseMediaPath, withImageParams, type ImageParams, type MediaPath } from './mediaUrl.js';
|
|
5
|
+
export { IMAGE_SIZE_MAX, imageParamsOf, MEDIA_SIGNING_KEY_BLOB, mediaBlobKeyOf, mediaExtOf, mediaKindOf, mediaMimeOf, mediaPathOf, parseMediaPath, signMediaUrl, verifyMediaUrl, withImageParams, type ImageParams, type AssetKind, type MediaPath } from './mediaUrl.js';
|
|
6
6
|
export { diffSchema, renameType, type ChangeKind, type ChangeLevel, type DiffOptions, type SchemaChange } from './changes.js';
|
|
7
7
|
export { dateRoleFieldsOf, primaryTypeOf, requiredPrimaryTypeOf, SOURCES_FIELD, sourceIdsOf, sourcesFieldOf, sourceTypeOf, type SourcesField } from './capabilities.js';
|
|
8
8
|
export { appliesTo, checkFields, fieldsFor } from './check.js';
|
|
9
9
|
export { deliveredFields, emptyValues, pickValues, referencedIds, referencesOf, valueFieldsOf } from './values.js';
|
|
10
10
|
export { entryRefsOf, type EntryRef } from './refs.js';
|
|
11
|
-
export { acceptsRole, bodyFieldsOf, computedFieldsOf, FIELD_ROLES, idInputOf, initialValueOf, isEditorial, isInputField, isListType, isMediaType, isSingleton, isStoredType, MEDIA_TYPE_IDS, optionLabelOf, optionsOf, publishingOf, requestReferencesOf, resolvedRolesOf, roleFieldOf, toneOf, typeOf, type ComputedKind, type FieldRole, type FieldRoles, type FieldComputed, type ContentFormat, type ContentModel, type ContentType, type FieldCondition, type FieldDef, type FieldDerive, type FieldFixedBy, type CountDef, type FieldProblem, type MediaKind, type OptionTone, type Publishing, type ReferenceRules, type SelectOption } from './model.js';
|
|
11
|
+
export { acceptsRole, bodyFieldsOf, computedFieldsOf, FIELD_ROLES, idInputOf, initialValueOf, isEditorial, isInputField, isListType, isMediaType, isSingleton, isStoredType, MEDIA_TYPE_IDS, optionLabelOf, optionsOf, publishingOf, requestReferencesOf, resolvedRolesOf, roleFieldOf, toneOf, typeOf, type ComputedKind, type FieldRole, type FieldRoles, type FieldComputed, type ContentFormat, type ContentModel, type ContentType, type FieldCondition, type FieldDef, type FieldDerive, type FieldFixedBy, type CountDef, type FieldProblem, type MediaKind, type OptionTone, type Publishing, type ReferenceRules, type SelectOption, usesReview } from './model.js';
|
|
12
12
|
export { hasPublicPage, imageFrameOf, pagePathOf, publicPathOf, withPagesFrom, type ImageFrame, type ImageFrameDef, type PageDef, type PageEntry, type PageRule } from './page.js';
|
|
13
13
|
export { schemaRulesOf, type SchemaRule } from './rules.js';
|
|
14
14
|
export { parseModel } from './schema.js';
|
|
@@ -1,11 +1,15 @@
|
|
|
1
1
|
import type { CropRect } from './image.js';
|
|
2
|
+
/** 実体の種類 */
|
|
3
|
+
export type AssetKind = 'image' | 'video' | 'file';
|
|
4
|
+
/** 形式の実体の種類 */
|
|
5
|
+
export declare const mediaKindOf: (mimeType: string) => AssetKind;
|
|
2
6
|
/** 形式の拡張子(配信しない形式は null) */
|
|
3
7
|
export declare const mediaExtOf: (mimeType: string) => string | null;
|
|
4
8
|
/** 拡張子の形式(配信しない拡張子は null) */
|
|
5
9
|
export declare const mediaMimeOf: (ext: string) => string | null;
|
|
6
10
|
/** 配信 URL のパスの要素(寸法は画像だけ) */
|
|
7
11
|
export type MediaPath = Readonly<{
|
|
8
|
-
kind:
|
|
12
|
+
kind: AssetKind;
|
|
9
13
|
project: string;
|
|
10
14
|
id: string;
|
|
11
15
|
ext: string;
|
|
@@ -14,7 +18,7 @@ export type MediaPath = Readonly<{
|
|
|
14
18
|
}>;
|
|
15
19
|
/** 配信 URL のパス(媒体・ID の形が不正、配信しない形式なら null) */
|
|
16
20
|
export declare function mediaPathOf({ kind, project, id, mimeType, width, height }: Readonly<{
|
|
17
|
-
kind:
|
|
21
|
+
kind: AssetKind;
|
|
18
22
|
project: string;
|
|
19
23
|
id: string;
|
|
20
24
|
mimeType: string;
|
|
@@ -23,6 +27,20 @@ export declare function mediaPathOf({ kind, project, id, mimeType, width, height
|
|
|
23
27
|
}>): string | null;
|
|
24
28
|
/** 配信 URL のパスを解析(形が違えば null) */
|
|
25
29
|
export declare function parseMediaPath(pathname: string): MediaPath | null;
|
|
30
|
+
/** 保存先のキー(媒体の接頭辞の後、非公開は private/ の下) */
|
|
31
|
+
export declare const mediaBlobKeyOf: (id: string, visibility: "public" | "private") => string;
|
|
32
|
+
/** 非公開のメディアの署名の鍵の保存先のキー(媒体の接頭辞の後、配信 URL の ID の形にない「.」で始め、パスから届かない) */
|
|
33
|
+
export declare const MEDIA_SIGNING_KEY_BLOB = ".media-signing";
|
|
34
|
+
/**
|
|
35
|
+
* 非公開のメディアの署名つきの URL(exp と sig のクエリを付ける、ほかのクエリは残す)
|
|
36
|
+
* - secret: 媒体の非公開のメディアの署名の鍵、expiresInSec: 期限までの秒、now: 今の UNIX ミリ秒
|
|
37
|
+
*/
|
|
38
|
+
export declare function signMediaUrl(url: string, secret: string, options?: Readonly<{
|
|
39
|
+
expiresInSec?: number;
|
|
40
|
+
now?: number;
|
|
41
|
+
}>): Promise<string>;
|
|
42
|
+
/** 署名つきの URL の検査(期限の内で、どれかの鍵の署名と一致すれば期限の UNIX 秒、ほかは null) */
|
|
43
|
+
export declare function verifyMediaUrl(url: URL, secrets: readonly string[], now?: number): Promise<number | null>;
|
|
26
44
|
/** 画像の変換のクエリ(w・h は表示の画素、rect は元の画像の画素での切り抜き、auto=format はブラウザに合わせた形式) */
|
|
27
45
|
export type ImageParams = Readonly<{
|
|
28
46
|
w?: number;
|
|
@@ -112,10 +112,12 @@ export type FieldDef = FieldBase & Readonly<{
|
|
|
112
112
|
type: 'media'; /** 受け付けるメディアの種類(なしはすべて) */
|
|
113
113
|
accept?: readonly MediaKind[];
|
|
114
114
|
multiple?: boolean; /** 画像の枠(先頭から条件に合うもの、page.ts) */
|
|
115
|
-
frames?: readonly ImageFrameDef[];
|
|
115
|
+
frames?: readonly ImageFrameDef[]; /** 非公開のメディアだけ(アップロードと取り込みは非公開、公開の実体は保存で拒否) */
|
|
116
|
+
visibility?: 'private';
|
|
116
117
|
} & Counts) | {
|
|
117
118
|
type: 'body';
|
|
118
|
-
profile: BodyProfile;
|
|
119
|
+
profile: BodyProfile; /** 本文の画像とファイルは非公開のメディアだけ */
|
|
120
|
+
visibility?: 'private';
|
|
119
121
|
} | ({
|
|
120
122
|
type: 'group'; /** まとまりの中の項目(Sanity の object、microCMS のカスタムフィールド) */
|
|
121
123
|
fields: readonly FieldDef[];
|
|
@@ -178,10 +180,16 @@ export declare const publishingOf: (type: ContentType) => Publishing;
|
|
|
178
180
|
export declare const isListType: (type: ContentType) => boolean;
|
|
179
181
|
/**
|
|
180
182
|
* 編集の機能を持つ型か(公開の管理がある一覧の型)
|
|
181
|
-
* - 機能:
|
|
182
|
-
* -
|
|
183
|
+
* - 機能: 版・楽観ロック・編集中のリース・コメント・公開の前の点検
|
|
184
|
+
* - 提出と差し戻し・担当者: レビューありの型だけ(usesReview)
|
|
183
185
|
*/
|
|
184
186
|
export declare const isEditorial: (type: ContentType) => boolean;
|
|
187
|
+
/**
|
|
188
|
+
* レビューのワークフローを持つ型か(レビューありの一覧の型)
|
|
189
|
+
* - 機能: 提出と差し戻し・担当者(レビューを担当するアカウント)
|
|
190
|
+
* - 下書きと公開の型: 担当者の表示・割り当て・一括の割り当てを出さない
|
|
191
|
+
*/
|
|
192
|
+
export declare const usesReview: (type: ContentType) => boolean;
|
|
185
193
|
/** 型の行を表 entries に保存するか(メディアの型を除くすべて) */
|
|
186
194
|
export declare const isStoredType: (type: ContentType) => boolean;
|
|
187
195
|
/** コンテンツスキーマの型(id から、なければ例外: 導入先の設定の誤り) */
|
|
@@ -1,2 +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';
|
|
1
|
+
export { blockSchemaOf, bodyToHtml, cellParagraphs, citesOf, DESCRIPTION_MAX, descriptionOf, EMBED_PROVIDERS, embedOfUrl, embedSrcOf, excerptOf, isSafeCssValue, isSafeHref, isTableCell, linksOf, plainOf, READING_SPEED, readMinOf } from '../../body/src/index.js';
|
|
2
|
+
export type { Align, Block, Body, BodyProfile, Cell, ComponentBlock, DeclaredComponent, EmbedProvider, EmbedTarget, HeadingLevel, ImageAlign, Inline, InlineComponent, Link, List, ListItem, Mark, Named, NamedStyle, NamedValue, PropSchema, PropsSchema, PropType, RenderedImage, RenderOptions, Rich, StandardBlock, TableCell, Text, TextStyle } from '../../body/src/index.js';
|
|
@@ -2,7 +2,7 @@ export { cachedDelivery, memoryDeliveryCache, type DeliveryCache } from './cache
|
|
|
2
2
|
export { readChanges, type Change, type ChangesPage } from './changes.js';
|
|
3
3
|
export { createDeliveryClient, DELIVERY_PATH, DeliveryError, subPath, type BundleResult, type Delivery, type DeliveryClient, type Prefetched } from './client.js';
|
|
4
4
|
export { deliveredImageUrl, mediaOf, type ImageUrl, type MediaOf } from './media.js';
|
|
5
|
-
export { imageParamsOf, parseMediaPath, withImageParams, type ImageParams, type MediaPath } from '../../../model/src/index.js';
|
|
5
|
+
export { imageParamsOf, parseMediaPath, signMediaUrl, withImageParams, type ImageParams, type MediaPath } from '../../../model/src/index.js';
|
|
6
6
|
export type { FieldPath, Selected } from './fields.js';
|
|
7
7
|
export { listParams, type ListFilter, type ListQuery, type Page } from './query.js';
|
|
8
8
|
export { createDeliveryClock, fieldOf, limitOf, optionLabels, pagePath, type DeliveryClock } from './schema.js';
|
|
@@ -5,14 +5,18 @@ export type Item = Readonly<Record<string, unknown>>;
|
|
|
5
5
|
/** 配信 API が解決した実体(url は配信 URL で配信のオリジンがある CMS だけ、hotspot・crop は元の画像に対する割合) */
|
|
6
6
|
export type DeliveredAsset = Readonly<{
|
|
7
7
|
id: string;
|
|
8
|
-
kind: 'image' | 'video';
|
|
8
|
+
kind: 'image' | 'video' | 'file';
|
|
9
9
|
url?: string;
|
|
10
10
|
width: number;
|
|
11
11
|
height: number;
|
|
12
12
|
alt: string;
|
|
13
13
|
hotspot?: Hotspot;
|
|
14
14
|
crop?: Crop;
|
|
15
|
-
poster?: DeliveredAsset | null;
|
|
15
|
+
poster?: DeliveredAsset | null; /** 非公開の実体(url は署名のない配信 URL、signMediaUrl で署名して渡す) */
|
|
16
|
+
visibility?: 'private'; /** ファイルの元のファイル名・形式・大きさ(バイト) */
|
|
17
|
+
name?: string;
|
|
18
|
+
mimeType?: string;
|
|
19
|
+
size?: number;
|
|
16
20
|
}>;
|
|
17
21
|
/** 項目の1つ分の値(複数の値を持つ項目は FieldValue が配列に、query.ts の絞り込みの値と共通) */
|
|
18
22
|
export type SingleValue<F extends FieldDef> = F extends {
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export { cachedDelivery, createDeliveryClient, createDeliveryClock, deliveredImageUrl, DELIVERY_PATH, DeliveryError, fieldOf, imageParamsOf, limitOf, listParams, mediaOf, memoryDeliveryCache, optionLabels, pagePath, parseMediaPath, readChanges, subPath, withImageParams } from './delivery/index.js';
|
|
1
|
+
export { cachedDelivery, createDeliveryClient, createDeliveryClock, deliveredImageUrl, DELIVERY_PATH, DeliveryError, fieldOf, imageParamsOf, limitOf, listParams, mediaOf, memoryDeliveryCache, optionLabels, pagePath, parseMediaPath, readChanges, signMediaUrl, subPath, withImageParams } from './delivery/index.js';
|
|
2
2
|
export type { BundleResult, Change, ChangesPage, DeliveredAsset, Delivery, DeliveryCache, DeliveryClient, DeliveryClock, FieldValue, ImageParams, ImageUrl, Item, ItemMeta, ItemOf, FieldPath, ListFilter, ListQuery, MediaOf, MediaPath, Page, Prefetched, Selected } from './delivery/index.js';
|