@ryusenkei/maezae 0.16.0 → 0.17.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 +26 -0
- package/dist/body.js +312 -10
- package/dist/{declared-9_jI3JXH.js → declared-Qo-mWnDd.js} +154 -15
- package/dist/model.js +1 -1
- 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/errors.d.ts +4 -3
- package/dist/types/cms-contract/src/import.d.ts +32 -1
- package/dist/types/cms-contract/src/index.d.ts +5 -4
- 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/index.d.ts +1 -1
- package/dist/types/model/src/model.d.ts +8 -2
- package/dist/types/sdk/src/body.d.ts +2 -2
- package/package.json +1 -1
|
@@ -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,33 @@ 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
|
+
}>;
|
|
111
|
+
/** microCMS の型の変換の注意(path は型の id と項目) */
|
|
112
|
+
export type MicroCmsNote = Readonly<{
|
|
113
|
+
level: 'error' | 'warning';
|
|
114
|
+
path: string;
|
|
115
|
+
message: string;
|
|
116
|
+
}>;
|
|
117
|
+
/** 本文の変換で捨てたもの(what は要素・属性・style の項目・class) */
|
|
118
|
+
export type MicroCmsDropped = Readonly<{
|
|
119
|
+
what: string;
|
|
120
|
+
count: number;
|
|
121
|
+
}>;
|
|
122
|
+
/** microCMS のコンテンツの1ページの取り込みの結果(next は次のページの offset、なしは終わり、tooLarge は大きすぎて残さなかった元の HTML) */
|
|
123
|
+
export type MicroCmsContentResult = Readonly<{
|
|
124
|
+
report: ImportReport;
|
|
125
|
+
total: number;
|
|
126
|
+
next: number | null;
|
|
127
|
+
dropped: readonly MicroCmsDropped[];
|
|
128
|
+
tooLarge: readonly Readonly<{
|
|
129
|
+
id: string;
|
|
130
|
+
field: string;
|
|
131
|
+
}>[];
|
|
132
|
+
}>;
|
|
@@ -1,21 +1,22 @@
|
|
|
1
|
-
export { API_KEY_RATE, type ApiKey } from './apiKeys.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
2
|
export { ASSET_BULK_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 {};
|
|
@@ -8,7 +8,7 @@ export { dateRoleFieldsOf, primaryTypeOf, requiredPrimaryTypeOf, SOURCES_FIELD,
|
|
|
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';
|
|
@@ -178,10 +178,16 @@ export declare const publishingOf: (type: ContentType) => Publishing;
|
|
|
178
178
|
export declare const isListType: (type: ContentType) => boolean;
|
|
179
179
|
/**
|
|
180
180
|
* 編集の機能を持つ型か(公開の管理がある一覧の型)
|
|
181
|
-
* - 機能:
|
|
182
|
-
* -
|
|
181
|
+
* - 機能: 版・楽観ロック・編集中のリース・コメント・公開の前の点検
|
|
182
|
+
* - 提出と差し戻し・担当者: レビューありの型だけ(usesReview)
|
|
183
183
|
*/
|
|
184
184
|
export declare const isEditorial: (type: ContentType) => boolean;
|
|
185
|
+
/**
|
|
186
|
+
* レビューのワークフローを持つ型か(レビューありの一覧の型)
|
|
187
|
+
* - 機能: 提出と差し戻し・担当者(レビューを担当するアカウント)
|
|
188
|
+
* - 下書きと公開の型: 担当者の表示・割り当て・一括の割り当てを出さない
|
|
189
|
+
*/
|
|
190
|
+
export declare const usesReview: (type: ContentType) => boolean;
|
|
185
191
|
/** 型の行を表 entries に保存するか(メディアの型を除くすべて) */
|
|
186
192
|
export declare const isStoredType: (type: ContentType) => boolean;
|
|
187
193
|
/** コンテンツスキーマの型(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';
|