@tunasand/sdk 0.0.0-stage → 0.6.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/CHANGELOG.md +106 -0
- package/README.md +506 -2
- package/dist/analytics.d.ts +1 -0
- package/dist/analytics.js +43 -0
- package/dist/app.d.ts +1 -0
- package/dist/app.js +825 -0
- package/dist/apps-9u4XMi7E.js +114 -0
- package/dist/body.d.ts +1 -0
- package/dist/body.js +455 -0
- package/dist/bridge-DYAYGV7t.js +74 -0
- package/dist/bridge.d.ts +1 -0
- package/dist/bridge.js +189 -0
- package/dist/cli.d.ts +1 -0
- package/dist/cli.js +283 -0
- package/dist/client-Derrexwr.js +159 -0
- package/dist/customers-C_vJY2_v.js +84 -0
- package/dist/customers.d.ts +1 -0
- package/dist/customers.js +185 -0
- package/dist/declared-C_GvPiGF.js +397 -0
- package/dist/delivery.d.ts +1 -0
- package/dist/delivery.js +348 -0
- package/dist/dev.d.ts +1 -0
- package/dist/dev.js +93 -0
- package/dist/embed-R-OvDYAw.js +90 -0
- package/dist/errorLabels-BcyRbv_i.js +1510 -0
- package/dist/i18n.d.ts +1 -0
- package/dist/i18n.js +4 -0
- package/dist/integrations.d.ts +1 -0
- package/dist/integrations.js +62 -0
- package/dist/ja-C1HEWWTQ.js +241 -0
- package/dist/ja-C6lX0CeJ.js +213 -0
- package/dist/model-pmXzGX12.js +152 -0
- package/dist/model.d.ts +1 -0
- package/dist/model.js +345 -0
- package/dist/page-E_cYgZx-.js +138 -0
- package/dist/preview.d.ts +1 -0
- package/dist/preview.js +1 -0
- package/dist/profile-D6t1QMQh.js +223 -0
- package/dist/schema-BPHL7Qr-.js +115 -0
- package/dist/schema-UQJWRyfJ.js +995 -0
- package/dist/schema.d.ts +1 -0
- package/dist/schema.js +1 -0
- package/dist/src-sazhzYui.js +71 -0
- package/dist/types/access/src/handoff.d.ts +52 -0
- package/dist/types/access/src/index.d.ts +5 -0
- package/dist/types/access/src/jws.d.ts +5 -0
- package/dist/types/access/src/jwt.d.ts +35 -0
- package/dist/types/access/src/oidc.d.ts +50 -0
- package/dist/types/access/src/signed.d.ts +15 -0
- package/dist/types/analytics/src/day.d.ts +2 -0
- package/dist/types/analytics/src/index.d.ts +5 -0
- package/dist/types/analytics/src/schedule.d.ts +2 -0
- package/dist/types/analytics/src/shared.d.ts +21 -0
- package/dist/types/analytics/src/source.d.ts +19 -0
- package/dist/types/analytics/src/store.d.ts +24 -0
- package/dist/types/analytics/src/view.d.ts +33 -0
- package/dist/types/body/src/components.d.ts +25 -0
- package/dist/types/body/src/declared.d.ts +34 -0
- package/dist/types/body/src/derive.d.ts +13 -0
- package/dist/types/body/src/description.d.ts +8 -0
- package/dist/types/body/src/embed.d.ts +16 -0
- package/dist/types/body/src/href.d.ts +4 -0
- package/dist/types/body/src/html.d.ts +30 -0
- package/dist/types/body/src/index.d.ts +19 -0
- package/dist/types/body/src/inline.d.ts +20 -0
- package/dist/types/body/src/labels/en.d.ts +90 -0
- package/dist/types/body/src/labels/ja.d.ts +153 -0
- package/dist/types/body/src/library.d.ts +113 -0
- package/dist/types/body/src/markdown.d.ts +14 -0
- package/dist/types/body/src/normalize.d.ts +5 -0
- package/dist/types/body/src/problems.d.ts +103 -0
- package/dist/types/body/src/profile.d.ts +80 -0
- package/dist/types/body/src/render.d.ts +29 -0
- package/dist/types/body/src/schema.d.ts +6 -0
- package/dist/types/body/src/standard.d.ts +20 -0
- package/dist/types/body/src/types.d.ts +140 -0
- package/dist/types/cms-contract/src/apiKeys.d.ts +41 -0
- package/dist/types/cms-contract/src/app.d.ts +35 -0
- package/dist/types/cms-contract/src/appDependencies.d.ts +265 -0
- package/dist/types/cms-contract/src/appProblems.d.ts +22 -0
- package/dist/types/cms-contract/src/apps.d.ts +195 -0
- package/dist/types/cms-contract/src/assets.d.ts +12 -0
- package/dist/types/cms-contract/src/authorize.d.ts +146 -0
- package/dist/types/cms-contract/src/bridge.d.ts +318 -0
- package/dist/types/cms-contract/src/consents.d.ts +97 -0
- package/dist/types/cms-contract/src/customerLabels.d.ts +33 -0
- package/dist/types/cms-contract/src/customers.d.ts +266 -0
- package/dist/types/cms-contract/src/embeds.d.ts +165 -0
- package/dist/types/cms-contract/src/errorLabels.d.ts +269 -0
- package/dist/types/cms-contract/src/errorLabelsEn.d.ts +228 -0
- package/dist/types/cms-contract/src/errors.d.ts +105 -0
- package/dist/types/cms-contract/src/failureStatus.d.ts +124 -0
- package/dist/types/cms-contract/src/functionLabels.d.ts +5 -0
- package/dist/types/cms-contract/src/functions.d.ts +144 -0
- package/dist/types/cms-contract/src/identifiers.d.ts +117 -0
- package/dist/types/cms-contract/src/import.d.ts +277 -0
- package/dist/types/cms-contract/src/issueLabels.d.ts +435 -0
- package/dist/types/cms-contract/src/issueLabelsEn.d.ts +217 -0
- package/dist/types/cms-contract/src/migration.d.ts +103 -0
- package/dist/types/cms-contract/src/paths.d.ts +23 -0
- package/dist/types/cms-contract/src/permissionLabels.d.ts +8 -0
- package/dist/types/cms-contract/src/permissions.d.ts +77 -0
- package/dist/types/cms-contract/src/problems.d.ts +34 -0
- package/dist/types/cms-contract/src/roles.d.ts +57 -0
- package/dist/types/cms-contract/src/settingProblems.d.ts +13 -0
- package/dist/types/cms-contract/src/settings.d.ts +19 -0
- package/dist/types/cms-contract/src/siteArtifact.d.ts +45 -0
- package/dist/types/cms-contract/src/siteDeclaration.d.ts +70 -0
- package/dist/types/cms-contract/src/transfer.d.ts +57 -0
- package/dist/types/cms-contract/src/views.d.ts +21 -0
- package/dist/types/cms-contract/src/webhookLabels.d.ts +7 -0
- package/dist/types/cms-contract/src/webhooks.d.ts +139 -0
- package/dist/types/i18n/src/index.d.ts +50 -0
- package/dist/types/i18n/src/problems.d.ts +21 -0
- package/dist/types/model/src/asset.d.ts +111 -0
- package/dist/types/model/src/audience.d.ts +38 -0
- package/dist/types/model/src/brand.d.ts +25 -0
- package/dist/types/model/src/capabilities.d.ts +28 -0
- package/dist/types/model/src/changes.d.ts +34 -0
- package/dist/types/model/src/check.d.ts +15 -0
- package/dist/types/model/src/contact.d.ts +22 -0
- package/dist/types/model/src/image.d.ts +38 -0
- package/dist/types/model/src/index.d.ts +26 -0
- package/dist/types/model/src/input.d.ts +26 -0
- package/dist/types/model/src/integrity.d.ts +79 -0
- package/dist/types/model/src/json.d.ts +2 -0
- package/dist/types/model/src/labels/en.d.ts +169 -0
- package/dist/types/model/src/labels/ja.d.ts +198 -0
- package/dist/types/model/src/legacy.d.ts +2 -0
- package/dist/types/model/src/media.d.ts +5 -0
- package/dist/types/model/src/mediaUrl.d.ts +67 -0
- package/dist/types/model/src/model.d.ts +415 -0
- package/dist/types/model/src/page.d.ts +52 -0
- package/dist/types/model/src/problems.d.ts +184 -0
- package/dist/types/model/src/refs.d.ts +27 -0
- package/dist/types/model/src/rules.d.ts +15 -0
- package/dist/types/model/src/schema.d.ts +58 -0
- package/dist/types/model/src/screens.d.ts +76 -0
- package/dist/types/model/src/selfOps.d.ts +30 -0
- package/dist/types/model/src/time.d.ts +25 -0
- package/dist/types/model/src/typesSource.d.ts +8 -0
- package/dist/types/model/src/values.d.ts +24 -0
- package/dist/types/platform/src/defaultModel.d.ts +8 -0
- package/dist/types/sdk/src/analytics.d.ts +2 -0
- package/dist/types/sdk/src/app.d.ts +20 -0
- package/dist/types/sdk/src/body.d.ts +2 -0
- package/dist/types/sdk/src/bridge.d.ts +92 -0
- package/dist/types/sdk/src/cli.d.ts +2 -0
- package/dist/types/sdk/src/customers.d.ts +190 -0
- package/dist/types/sdk/src/delivery/cache.d.ts +18 -0
- package/dist/types/sdk/src/delivery/changes.d.ts +28 -0
- package/dist/types/sdk/src/delivery/client.d.ts +90 -0
- package/dist/types/sdk/src/delivery/fields.d.ts +48 -0
- package/dist/types/sdk/src/delivery/index.d.ts +9 -0
- package/dist/types/sdk/src/delivery/media.d.ts +14 -0
- package/dist/types/sdk/src/delivery/query.d.ts +85 -0
- package/dist/types/sdk/src/delivery/schema.d.ts +19 -0
- package/dist/types/sdk/src/delivery/values.d.ts +82 -0
- package/dist/types/sdk/src/delivery.d.ts +3 -0
- package/dist/types/sdk/src/dev.d.ts +29 -0
- package/dist/types/sdk/src/i18n.d.ts +12 -0
- package/dist/types/sdk/src/integrations.d.ts +33 -0
- package/dist/types/sdk/src/model.d.ts +5 -0
- package/dist/types/sdk/src/preview.d.ts +1 -0
- package/dist/types/sdk/src/schema.d.ts +21 -0
- package/dist/types/sdk/src/site.d.ts +43 -0
- package/dist/typesSource-bO0jFw1I.js +88 -0
- package/package.json +86 -3
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
/** サイトの資源の種類(D1 と R2) */
|
|
2
|
+
export declare const SITE_RESOURCE_KINDS: readonly ["d1", "r2"];
|
|
3
|
+
export type SiteResourceKind = (typeof SITE_RESOURCE_KINDS)[number];
|
|
4
|
+
/** 宣言の上限(資源の数、Cron の式の数と1つの式の文字数) */
|
|
5
|
+
export declare const SITE_DECLARATION_LIMITS: {
|
|
6
|
+
readonly resources: 8;
|
|
7
|
+
readonly crons: 5;
|
|
8
|
+
readonly cronLength: 64;
|
|
9
|
+
};
|
|
10
|
+
/** bind の名前の形と長さ(R2 のバケットの名前の63文字に、接頭辞と持ち主のハッシュと合わせて収まる長さ) */
|
|
11
|
+
export declare const SITE_BINDING_NAME: {
|
|
12
|
+
readonly pattern: RegExp;
|
|
13
|
+
readonly maxLength: 32;
|
|
14
|
+
};
|
|
15
|
+
/** 静的な資産の bind の名前(資源、変数、秘密の値には使えない) */
|
|
16
|
+
export declare const SITE_ASSETS_BINDING: "ASSETS";
|
|
17
|
+
/** 能力の要素の頭 */
|
|
18
|
+
export declare const SITE_CAPABILITY_PREFIXES: {
|
|
19
|
+
readonly d1: "site_d1:";
|
|
20
|
+
readonly r2: "site_r2:";
|
|
21
|
+
readonly cron: "site_cron:";
|
|
22
|
+
};
|
|
23
|
+
/** マニフェストの `hosting` の宣言の形(`true` は資源も Cron もない宣言) */
|
|
24
|
+
export type SiteHostingManifest = Readonly<{
|
|
25
|
+
d1?: readonly string[];
|
|
26
|
+
r2?: readonly string[];
|
|
27
|
+
crons?: readonly string[];
|
|
28
|
+
}>;
|
|
29
|
+
/** 資源の宣言の1つ */
|
|
30
|
+
export type SiteResourceDeclaration = Readonly<{
|
|
31
|
+
binding: string;
|
|
32
|
+
kind: SiteResourceKind;
|
|
33
|
+
}>;
|
|
34
|
+
/** 同意した宣言(CMS が tunasand-hosting に渡す) */
|
|
35
|
+
export type SiteDeclaration = Readonly<{
|
|
36
|
+
resources: readonly SiteResourceDeclaration[];
|
|
37
|
+
crons: readonly string[];
|
|
38
|
+
}>;
|
|
39
|
+
/** 解析した Cron の式(欄ごとの当たる値の集合。restricted は日と曜日の欄が `*` でないか) */
|
|
40
|
+
export type ParsedCron = Readonly<{
|
|
41
|
+
fields: readonly ReadonlySet<number>[];
|
|
42
|
+
dayRestricted: boolean;
|
|
43
|
+
weekdayRestricted: boolean;
|
|
44
|
+
}>;
|
|
45
|
+
/** 5欄の Cron の式を1回だけ解析する(形の外は null)。検査と毎分の判定がこの結果を使う */
|
|
46
|
+
export declare function parseCron(expr: string): ParsedCron | null;
|
|
47
|
+
/**
|
|
48
|
+
* Cron の式がその時刻(UTC、分の単位)に当たるか。式の形でなければ null
|
|
49
|
+
* 日と曜日をどちらも指定したときは、どちらかに当たれば当たる(普通の cron と同じ)
|
|
50
|
+
*/
|
|
51
|
+
export declare function cronMatches(cron: string | ParsedCron, at: Date): boolean | null;
|
|
52
|
+
/** 宣言に書ける Cron の式か(5欄を1つの空白で区切った形で、長さの上限まで。同意の要素の文字列が式ごとに1つに決まる) */
|
|
53
|
+
export declare const isSiteCron: (expr: unknown) => expr is string;
|
|
54
|
+
/** 資源の bind の名前として書けるか(形と長さ、資産の名前でない) */
|
|
55
|
+
export declare const isSiteBindingName: (name: unknown) => name is string;
|
|
56
|
+
/** マニフェストの `hosting` の宣言の誤り(なければ null) */
|
|
57
|
+
export declare function siteHostingProblem(input: unknown): 'invalid' | 'too_many' | null;
|
|
58
|
+
/** 宣言から能力の要素(`deploy_site` は呼び出し元が足す) */
|
|
59
|
+
export declare function siteDeclarationCapabilities(manifest: SiteHostingManifest): string[];
|
|
60
|
+
/** 能力の要素が宣言の要素か(同意の画面の分類) */
|
|
61
|
+
export declare const isSiteDeclarationCapability: (capability: string) => boolean;
|
|
62
|
+
/**
|
|
63
|
+
* 同意した能力の集合から宣言を読む(宣言の要素の外と形の外の要素は捨てる)。並びは辞書の順で、同じ集合から同じ宣言になる
|
|
64
|
+
* 同意の集合は検査を通ったマニフェストからだけ作られるので、名前の重なりと数の上限は検査が守る
|
|
65
|
+
*/
|
|
66
|
+
export declare function siteDeclarationOf(consented: readonly string[]): SiteDeclaration;
|
|
67
|
+
/** 入口の引数(RPC は型検査を通らない)の宣言を確認する。形の外は null */
|
|
68
|
+
export declare function parseSiteDeclaration(raw: unknown): SiteDeclaration | null;
|
|
69
|
+
/** 宣言を比べる形(並びに依らない) */
|
|
70
|
+
export declare const declarationKey: (d: SiteDeclaration) => string;
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
import type { Permissions } from './permissions.js';
|
|
2
|
+
import type { ViewDefinition } from './views.js';
|
|
3
|
+
/** スキーマと設定の形式の名前 */
|
|
4
|
+
export declare const CONFIG_FORMAT = "cms-config";
|
|
5
|
+
/** スキーマと設定(schema はコンテンツスキーマ ContentModel・screens は画面設定 ScreenSettings の形、roles は管理者以外、views はチームのビュー) */
|
|
6
|
+
export type ConfigBundle = Readonly<{
|
|
7
|
+
format: typeof CONFIG_FORMAT;
|
|
8
|
+
version: 1;
|
|
9
|
+
exported_at: string;
|
|
10
|
+
schema: unknown;
|
|
11
|
+
screens: unknown;
|
|
12
|
+
roles: readonly Readonly<{
|
|
13
|
+
id: string;
|
|
14
|
+
label: string;
|
|
15
|
+
permissions: Permissions;
|
|
16
|
+
}>[];
|
|
17
|
+
views: readonly Readonly<{
|
|
18
|
+
id: string;
|
|
19
|
+
collection: string;
|
|
20
|
+
label: string;
|
|
21
|
+
definition: ViewDefinition;
|
|
22
|
+
roles: readonly string[];
|
|
23
|
+
}>[];
|
|
24
|
+
extensions: readonly Readonly<{
|
|
25
|
+
id: string;
|
|
26
|
+
enabled: boolean;
|
|
27
|
+
settings: Readonly<Record<string, unknown>>;
|
|
28
|
+
}>[];
|
|
29
|
+
}>;
|
|
30
|
+
/** スキーマと設定の読み込みの確認(schema はスキーマの変更、ほかは追加と更新の件数) */
|
|
31
|
+
export type ConfigPreview = Readonly<{
|
|
32
|
+
/**
|
|
33
|
+
* kind は変更の種類、type はコレクションの id、value はコレクションの id の変更の旧の id(コレクションの id の変更の候補の選択に使用)
|
|
34
|
+
* - code・params・message は SchemaChange と同じ
|
|
35
|
+
*/
|
|
36
|
+
schema: readonly Readonly<{
|
|
37
|
+
id: string;
|
|
38
|
+
kind: string;
|
|
39
|
+
collection: string;
|
|
40
|
+
value?: string;
|
|
41
|
+
level: 'safe' | 'confirm' | 'forbidden';
|
|
42
|
+
code: string;
|
|
43
|
+
params?: Readonly<Record<string, string | number>>;
|
|
44
|
+
message: string;
|
|
45
|
+
count: number | null;
|
|
46
|
+
}>[];
|
|
47
|
+
roles: Readonly<{
|
|
48
|
+
added: number;
|
|
49
|
+
updated: number;
|
|
50
|
+
}>;
|
|
51
|
+
views: Readonly<{
|
|
52
|
+
added: number;
|
|
53
|
+
updated: number;
|
|
54
|
+
}>;
|
|
55
|
+
extensions: number;
|
|
56
|
+
screens: boolean;
|
|
57
|
+
}>;
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
/** ビューで許可できる一括操作(名前はレコードの操作 workflow.ts の RecordAction と同じ、assign は担当者の割り当て) */
|
|
2
|
+
export declare const VIEW_ACTIONS: readonly ["assign", "submit", "publish", "unpublish", "delete"];
|
|
3
|
+
/** ビューで許可できる一括操作 */
|
|
4
|
+
export type ViewAction = (typeof VIEW_ACTIONS)[number];
|
|
5
|
+
/** ビューの内容(filters は列の id ごとの絞り込みの値、query は検索の文、columns は表示する列、editable は一覧で編集する列) */
|
|
6
|
+
export type ViewDefinition = Readonly<{
|
|
7
|
+
filters: Readonly<Record<string, string>>;
|
|
8
|
+
query: string;
|
|
9
|
+
columns: readonly string[];
|
|
10
|
+
editable: readonly string[];
|
|
11
|
+
actions: readonly ViewAction[];
|
|
12
|
+
}>;
|
|
13
|
+
/** 保存したビュー(owner がなければチームのビュー、roles は見られるロールの ID で空はすべて) */
|
|
14
|
+
export type SavedView = Readonly<{
|
|
15
|
+
id: string;
|
|
16
|
+
owner: string | null;
|
|
17
|
+
collection: string;
|
|
18
|
+
label: string;
|
|
19
|
+
definition: ViewDefinition;
|
|
20
|
+
roles: readonly string[];
|
|
21
|
+
}>;
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import type { WebhookAction } from './webhooks.js';
|
|
2
|
+
/** 操作の表示名(画面の選択肢と、Slack の文) */
|
|
3
|
+
export declare const WEBHOOK_ACTION_LABELS: Readonly<Record<WebhookAction, string>>;
|
|
4
|
+
/** インストールのイベントの表示名 */
|
|
5
|
+
export declare const INSTALLATION_EVENT_LABELS: Readonly<Record<string, string>>;
|
|
6
|
+
/** コレクションの操作のイベントの表示名(コレクションの表示名と操作の表示名) */
|
|
7
|
+
export declare const WEBHOOK_EVENT_LABEL: (collection: string, action: string) => string;
|
|
@@ -0,0 +1,139 @@
|
|
|
1
|
+
/** 送れる操作(レビューの依頼・公開・非公開・差し戻しと、データの変更の作成・更新・削除) */
|
|
2
|
+
export declare const WEBHOOK_ACTIONS: readonly ["submitted", "published", "unpublished", "rejected", "created", "updated", "deleted"];
|
|
3
|
+
/** データの変更の操作(配信 API の変更の一覧と同じ記録から送る) */
|
|
4
|
+
export declare const WEBHOOK_CHANGE_ACTIONS: readonly ["created", "updated", "deleted"];
|
|
5
|
+
/** データの変更の操作 */
|
|
6
|
+
export type WebhookChangeAction = (typeof WEBHOOK_CHANGE_ACTIONS)[number];
|
|
7
|
+
/** 送れる操作 */
|
|
8
|
+
export type WebhookAction = (typeof WEBHOOK_ACTIONS)[number];
|
|
9
|
+
/** Webhook の契約の版(本文の version) */
|
|
10
|
+
export declare const WEBHOOK_VERSION = 1;
|
|
11
|
+
/** Webhook の契約の版 */
|
|
12
|
+
export type WebhookVersion = typeof WEBHOOK_VERSION;
|
|
13
|
+
/** サーバーの内側のイベントのキー(編集のイベントは <コレクションの id>.<操作>、拡張機能のイベントは宣言の名前) */
|
|
14
|
+
export type WebhookEvent = `${string}.${string}`;
|
|
15
|
+
/** 購読するイベント(操作か拡張機能のイベントの名前) */
|
|
16
|
+
export type WebhookSubscription = WebhookAction | WebhookEvent;
|
|
17
|
+
/** データの変更の操作か */
|
|
18
|
+
export declare const isWebhookChangeAction: (value: string) => value is WebhookChangeAction;
|
|
19
|
+
/**
|
|
20
|
+
* インストールのイベント(購読によらず送る)
|
|
21
|
+
* - uninstalled: アンインストールの最後の知らせ。そのインストールの Webhook(止めた後も、このイベントだけ)と、アプリの削除のエンドポイントへ
|
|
22
|
+
*/
|
|
23
|
+
export declare const INSTALLATION_EVENTS: {
|
|
24
|
+
readonly uninstalled: "app.uninstalled";
|
|
25
|
+
};
|
|
26
|
+
/** アンインストールのイベントの値(インストールの ID と登録簿のアプリの ID、旧い形のインストールは null) */
|
|
27
|
+
export type InstallationUninstalledData = Readonly<{
|
|
28
|
+
installation_id: string;
|
|
29
|
+
app_id: string | null;
|
|
30
|
+
}>;
|
|
31
|
+
/** 送れる操作か */
|
|
32
|
+
export declare const isWebhookAction: (value: string) => value is WebhookAction;
|
|
33
|
+
/** コレクションと操作のイベントのキー */
|
|
34
|
+
export declare const webhookEventOf: (collection: string, action: WebhookAction) => WebhookEvent;
|
|
35
|
+
/** イベントのキーの型と操作(編集のイベントでなければ null) */
|
|
36
|
+
export declare function parseWebhookEvent(event: string): Readonly<{
|
|
37
|
+
collection: string;
|
|
38
|
+
action: WebhookAction;
|
|
39
|
+
}> | null;
|
|
40
|
+
/** イベントのキーの表示名(types はコレクションの id と表示名でコレクションの表示名と操作の表示名、moduleEvents は拡張機能のイベントの表示名) */
|
|
41
|
+
export declare function webhookEventLabel(event: string, collections: Readonly<Record<string, string>>, moduleEvents?: Readonly<Record<string, string>>): string;
|
|
42
|
+
/** 購読するイベントの表示名(操作か拡張機能のイベント) */
|
|
43
|
+
export declare const webhookSubscriptionLabel: (subscription: string, moduleEvents?: Readonly<Record<string, string>>) => string;
|
|
44
|
+
/** Webhook の形式 */
|
|
45
|
+
export type WebhookKind = 'json' | 'slack';
|
|
46
|
+
/**
|
|
47
|
+
* Webhook(url・secret は末尾だけを伏せずに返す、secret の null は署名なし)
|
|
48
|
+
* - installationId: 送り先を持つインストール(チャネルかアプリ)。なしは Webhook だけの旧い形のインストール
|
|
49
|
+
* - events: 購読するイベント(操作と拡張機能のイベント)、collections: 購読するコレクションの id(編集のイベントは events の操作 × collections)
|
|
50
|
+
* - previousSecret: 鍵の移行の期間の古い鍵の末尾、期間の外は null
|
|
51
|
+
* - sendOutsideLive: live 以外の環境でも送るか(既定は記録だけ。合成のデータの環境と、方針の無効な live では印があっても送らない)
|
|
52
|
+
* - lastStatus: 最新の送信で返った HTTP の状態、送れなかったときは0
|
|
53
|
+
*/
|
|
54
|
+
export type Webhook = Readonly<{
|
|
55
|
+
id: string;
|
|
56
|
+
installationId: string | null;
|
|
57
|
+
label: string;
|
|
58
|
+
kind: WebhookKind;
|
|
59
|
+
url: string;
|
|
60
|
+
secret: string | null;
|
|
61
|
+
previousSecret: string | null;
|
|
62
|
+
events: readonly WebhookSubscription[];
|
|
63
|
+
collections: readonly string[];
|
|
64
|
+
enabled: boolean;
|
|
65
|
+
sendOutsideLive: boolean;
|
|
66
|
+
lastStatus: number | null;
|
|
67
|
+
lastAt: string | null;
|
|
68
|
+
}>;
|
|
69
|
+
/**
|
|
70
|
+
* json の形式の本文(編集機能を持つコレクションのイベント、署名は Standard Webhooks で登録ごとの鍵、webhook-id は本文の id)
|
|
71
|
+
* - version: 契約の版(1)
|
|
72
|
+
* - id: イベントの ID(再送しても同じ値、受け手は処理済みの id を捨てて重複を除く)
|
|
73
|
+
* - event: 操作、collection: コレクションの id とスラッグ
|
|
74
|
+
* - item: レコードの id とスラッグと題、by: 操作した人の表示名、at: イベントの日時(ISO 8601、再送しても同じ値)
|
|
75
|
+
* - 受け手の同期と突き合わせは id で(スラッグは変更でき、旧いスラッグを別のレコードが使える)
|
|
76
|
+
*/
|
|
77
|
+
export type WebhookBody = Readonly<{
|
|
78
|
+
version: WebhookVersion;
|
|
79
|
+
id: string;
|
|
80
|
+
event: Exclude<WebhookAction, WebhookChangeAction>;
|
|
81
|
+
collection: Readonly<{
|
|
82
|
+
id: string;
|
|
83
|
+
slug: string;
|
|
84
|
+
}>;
|
|
85
|
+
item: Readonly<{
|
|
86
|
+
id: string;
|
|
87
|
+
slug: string;
|
|
88
|
+
title: string;
|
|
89
|
+
}>;
|
|
90
|
+
by: string;
|
|
91
|
+
at: string;
|
|
92
|
+
}>;
|
|
93
|
+
/**
|
|
94
|
+
* json の形式のデータの変更の本文(レコードの値は持たない。受け手は配信 API で今の値を取り直し、順序の入れ替えに左右されない)
|
|
95
|
+
* - id: イベントの ID(変更の記録1件に1つ、全送り先と再送で同じ)
|
|
96
|
+
* - at: 変更の一覧の記録の日時(ISO 8601)
|
|
97
|
+
* - collection: コレクションの id とスラッグ(消したコレクションのスラッグは null)、item: レコードの id と記録の時点のスラッグ
|
|
98
|
+
* - item.previous_slug: スラッグを変えた記録だけ、変更の前のスラッグ(サイトの旧い URL の転送に使う)
|
|
99
|
+
*/
|
|
100
|
+
export type WebhookChangeBody = Readonly<{
|
|
101
|
+
version: WebhookVersion;
|
|
102
|
+
id: string;
|
|
103
|
+
event: WebhookChangeAction;
|
|
104
|
+
collection: Readonly<{
|
|
105
|
+
id: string;
|
|
106
|
+
slug: string | null;
|
|
107
|
+
}>;
|
|
108
|
+
item: Readonly<{
|
|
109
|
+
id: string;
|
|
110
|
+
slug: string;
|
|
111
|
+
previous_slug?: string;
|
|
112
|
+
}>;
|
|
113
|
+
at: string;
|
|
114
|
+
}>;
|
|
115
|
+
/**
|
|
116
|
+
* json の形式の名前つきのイベントの本文(顧客・取り込み・インストール・拡張機能のイベント。Stripe の Event と同じ並び)
|
|
117
|
+
* - type: イベントの名前(ドットつき、例 customer.status_changed)、created_at: イベントの日時(ISO 8601、再送しても同じ値)
|
|
118
|
+
* - data: イベントの値(顧客のイベントは CustomerEventData)
|
|
119
|
+
*/
|
|
120
|
+
export type WebhookModuleBody = Readonly<{
|
|
121
|
+
version: WebhookVersion;
|
|
122
|
+
id: string;
|
|
123
|
+
type: WebhookEvent;
|
|
124
|
+
created_at: string;
|
|
125
|
+
data: Readonly<Record<string, unknown>>;
|
|
126
|
+
}>;
|
|
127
|
+
/** 送信の記録(event はイベントのキー、attempt は何回目の送信か、retryAt は次の再送の予定の日時、再送なしは null) */
|
|
128
|
+
export type WebhookDelivery = Readonly<{
|
|
129
|
+
id: number;
|
|
130
|
+
source: 'webhook' | 'function';
|
|
131
|
+
event: string;
|
|
132
|
+
status: number;
|
|
133
|
+
error: string | null;
|
|
134
|
+
eventId: string | null;
|
|
135
|
+
attempt: number;
|
|
136
|
+
retryAt: string | null;
|
|
137
|
+
label: string | null;
|
|
138
|
+
created_at: string;
|
|
139
|
+
}>;
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
/** 扱う言語(足すときはここと各アプリの labels/<言語>.ts。en は API・MCP の既定の文) */
|
|
2
|
+
export declare const LOCALES: readonly ["ja", "en"];
|
|
3
|
+
export type Locale = (typeof LOCALES)[number];
|
|
4
|
+
/** 基準の言語(文言の表の形の元で、ほかの言語に無い文言の代わり) */
|
|
5
|
+
export declare const BASE_LOCALE: Locale;
|
|
6
|
+
/** 文言の表(入れ子のグループ、値は ICU MessageFormat の文字列) */
|
|
7
|
+
export type Messages = {
|
|
8
|
+
readonly [key: string]: string | Messages;
|
|
9
|
+
};
|
|
10
|
+
/** 文言の表の形(基準の言語の表 M から、値を任意の文字列にしたもの。ほかの言語の表の型) */
|
|
11
|
+
export type Catalog<M> = {
|
|
12
|
+
readonly [K in keyof M]: M[K] extends string ? string : Catalog<M[K]>;
|
|
13
|
+
};
|
|
14
|
+
/** 文言の表のキー(入れ子をドットでつなぐ) */
|
|
15
|
+
export type MessageKey<M> = {
|
|
16
|
+
[K in keyof M & string]: M[K] extends string ? K : `${K}.${MessageKey<M[K]>}`;
|
|
17
|
+
}[keyof M & string];
|
|
18
|
+
/** キーの文言 */
|
|
19
|
+
export type MessageAt<M, K extends string> = K extends `${infer H}.${infer R}` ? (H extends keyof M ? MessageAt<M[H], R> : never) : K extends keyof M ? M[K] : never;
|
|
20
|
+
type Trim<S extends string> = S extends ` ${infer R}` ? Trim<R> : S extends `${infer R} ` ? Trim<R> : S;
|
|
21
|
+
/** 数を受ける差し込みの種類 */
|
|
22
|
+
type NumericKind = 'number' | 'plural' | 'selectordinal';
|
|
23
|
+
/** 文言の中の差し込み(名前と種類の組)。文字ごとに読み、{ の後が名前(文の中)か選択肢の文(差し込みの選択肢の中)かを積んだ文脈で分ける。'…' の中は文字 */
|
|
24
|
+
type ArgsIn<S extends string, Ctx extends readonly ('m' | 'a')[] = ['m'], Acc = never> = S extends `'${'{' | '}'}${string}'${infer R}` ? ArgsIn<R, Ctx, Acc> : S extends `{${infer R}` ? Ctx extends ['m', ...unknown[]] ? R extends `${infer Head}}${infer Rest}` ? Head extends `${infer Name},${infer Kind},${string}` ? ArgsIn<R extends `${string},${string},${infer After}` ? After : never, ['a', ...Ctx], Acc | [Trim<Name>, Trim<Kind>]> : Head extends `${infer Name},${infer Kind}` ? ArgsIn<Rest, Ctx, Acc | [Trim<Name>, Trim<Kind>]> : ArgsIn<Rest, Ctx, Acc | [Trim<Head>, 'text']> : Acc : ArgsIn<R, ['m', ...Ctx], Acc> : S extends `}${infer R}` ? ArgsIn<R, Ctx extends [unknown, ...infer Up extends ('m' | 'a')[]] ? Up : Ctx, Acc> : S extends `${string}${infer R}` ? ArgsIn<R, Ctx, Acc> : Acc;
|
|
25
|
+
/** 差し込みの値 */
|
|
26
|
+
export type ParamValue = string | number;
|
|
27
|
+
/** 文言の差し込みの値の形(数の種類は number) */
|
|
28
|
+
export type ParamsOf<S> = S extends string ? {
|
|
29
|
+
readonly [A in ArgsIn<S> as A extends [infer N extends string, unknown] ? N : never]: A extends [string, NumericKind] ? number : ParamValue;
|
|
30
|
+
} : never;
|
|
31
|
+
type UnionToIntersection<U> = (U extends unknown ? (u: U) => void : never) extends (i: infer I) => void ? I : never;
|
|
32
|
+
/** 文言の差し込みの値の形(キーが複数の文言の和のときは、どれかが使う差し込みを全部求める) */
|
|
33
|
+
type AllParamsOf<S> = UnionToIntersection<ParamsOf<S>>;
|
|
34
|
+
/** 取り出しの引数(差し込みがなければ省く) */
|
|
35
|
+
export type ParamsArg<S> = keyof AllParamsOf<S> extends never ? [] : [params: {
|
|
36
|
+
readonly [N in keyof AllParamsOf<S>]: AllParamsOf<S>[N];
|
|
37
|
+
}];
|
|
38
|
+
/** キーで文言を取り出す関数(has は実行時に組んだキーが表にあるか。通知の種類など、表の外の値も来るとき) */
|
|
39
|
+
export type Translate<M> = (<K extends MessageKey<M>>(key: K, ...params: ParamsArg<MessageAt<M, K>>) => string) & {
|
|
40
|
+
has: <S extends string>(key: S) => key is S & MessageKey<M>;
|
|
41
|
+
};
|
|
42
|
+
/** 使う言語(ブラウザの言語やアカウントの設定から選ぶ関数。今は ja 固定) */
|
|
43
|
+
export declare function chooseLocale(_preferred?: readonly string[]): Locale;
|
|
44
|
+
/** 文言の表からキーで取り出す関数(catalogs は言語ごとの表、ja は必須。アプリの起動のときに1回作る) */
|
|
45
|
+
export declare function createTranslator<M extends Messages>(catalogs: Readonly<{
|
|
46
|
+
ja: M;
|
|
47
|
+
} & Partial<Record<Locale, Catalog<M>>>>, locale?: Locale): Translate<M>;
|
|
48
|
+
/** 文言を1つ書式にする(表を持たない文言、エラーの既定の文言など) */
|
|
49
|
+
export declare function formatMessage(message: string, params?: Readonly<Record<string, ParamValue>>, locale?: Locale): string;
|
|
50
|
+
export { type Problem, type ProblemFactory, problemFactory, problemMessage, problemOf, problemText, problemTextFactory } from './problems.js';
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { type Locale, type ParamsArg, type ParamValue } from './index.js';
|
|
2
|
+
/** 検査の問題(code は文言の表のキー、params は差し込みの値) */
|
|
3
|
+
export type Problem = Readonly<{
|
|
4
|
+
code: string;
|
|
5
|
+
params: Readonly<Record<string, ParamValue>>;
|
|
6
|
+
}>;
|
|
7
|
+
/** 文言の表に合わせた問題の作り方(code は表のキー、差し込みの不足は型の誤り) */
|
|
8
|
+
export type ProblemFactory<M> = <K extends keyof M & string>(code: K, ...params: ParamsArg<M[K]>) => Problem;
|
|
9
|
+
/** 文言の表 messages のキーと差し込みで問題を作る関数 */
|
|
10
|
+
export declare const problemFactory: <M extends Readonly<Record<string, string>>>(_messages: M) => ProblemFactory<M>;
|
|
11
|
+
/** 問題の英語の既定の文 */
|
|
12
|
+
export declare const problemText: (p: Problem) => string;
|
|
13
|
+
/** 文言の表 messages のキーと差し込みで既定の文を作る関数(zod の message のように文字列で運ぶ所) */
|
|
14
|
+
export declare const problemTextFactory: <M extends Readonly<Record<string, string>>>(messages: M) => (<K extends keyof M & string>(code: K, ...params: ParamsArg<M[K]>) => string);
|
|
15
|
+
/** 既定の文から問題(形が違えば undefined) */
|
|
16
|
+
export declare function problemOf(text: string): Problem | undefined;
|
|
17
|
+
/**
|
|
18
|
+
* 既定の文を文言の表 messages の文に(表に無いコードと、既定の文の形でない文はそのまま)
|
|
19
|
+
* - 差し込みの値が表のコードの既定の文なら、その値も表の文に(ブロックの位置つきの問題など、問題を包む問題)
|
|
20
|
+
*/
|
|
21
|
+
export declare function problemMessage(text: string, messages: Readonly<Record<string, string>>, locale?: Locale): string;
|
|
@@ -0,0 +1,111 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
/**
|
|
3
|
+
* 見せたい点(Sanity の hotspot、値はすべて画像に対する割合の0〜1、左上が0,0)
|
|
4
|
+
* - x・y: 中心(枠に合わせて切り抜くときの中心、なしは中央)
|
|
5
|
+
* - width・height: 範囲の大きさ(今の表示は中心だけを使用)
|
|
6
|
+
* - 切り抜き crop がある画像: CMS で保存する値は元の画像に対する割合、表示の Media では切り抜いた後の画像に対する割合
|
|
7
|
+
*/
|
|
8
|
+
export type Hotspot = Readonly<{
|
|
9
|
+
x: number;
|
|
10
|
+
y: number;
|
|
11
|
+
width?: number;
|
|
12
|
+
height?: number;
|
|
13
|
+
}>;
|
|
14
|
+
/** 切り抜き(Sanity の crop、上下左右の各辺から削る量を画像に対する割合の0〜1で) */
|
|
15
|
+
export type Crop = Readonly<{
|
|
16
|
+
top: number;
|
|
17
|
+
bottom: number;
|
|
18
|
+
left: number;
|
|
19
|
+
right: number;
|
|
20
|
+
}>;
|
|
21
|
+
/** サイトのビルドで読み込んだ画像(Astro の ImageMetadata と同じ形、画像の最適化の対象) */
|
|
22
|
+
export type LocalImage = Readonly<{
|
|
23
|
+
src: string;
|
|
24
|
+
width: number;
|
|
25
|
+
height: number;
|
|
26
|
+
format: string;
|
|
27
|
+
}>;
|
|
28
|
+
/** 実体の共通の項目(ID は UUID で R2 のキーと同じ、sha256 は内容のハッシュで同じ画像の重複を防止、visibility は非公開の実体だけ private) */
|
|
29
|
+
type AssetBase = Readonly<{
|
|
30
|
+
id: string;
|
|
31
|
+
mimeType: string;
|
|
32
|
+
size: number;
|
|
33
|
+
sha256: string | null;
|
|
34
|
+
width: number;
|
|
35
|
+
height: number;
|
|
36
|
+
alt: string;
|
|
37
|
+
hotspot?: Hotspot;
|
|
38
|
+
crop?: Crop;
|
|
39
|
+
createdAt: string;
|
|
40
|
+
visibility?: 'private';
|
|
41
|
+
}>;
|
|
42
|
+
/** 画像の実体(Sanity の sanity.imageAsset、代替テキストと hotspot は画像ごとに1つ) */
|
|
43
|
+
export type ImageAsset = AssetBase & Readonly<{
|
|
44
|
+
kind: 'image';
|
|
45
|
+
}>;
|
|
46
|
+
/** 動画の実体(poster は代わりに表示する画像の実体の ID、配信と再生は最初に使用する場所が決まったときに実装) */
|
|
47
|
+
export type VideoAsset = AssetBase & Readonly<{
|
|
48
|
+
kind: 'video';
|
|
49
|
+
duration?: number;
|
|
50
|
+
poster?: string;
|
|
51
|
+
}>;
|
|
52
|
+
/** ファイルの実体(本文の中のファイル、name は元のファイル名、寸法は0) */
|
|
53
|
+
export type FileAsset = AssetBase & Readonly<{
|
|
54
|
+
kind: 'file';
|
|
55
|
+
name?: string;
|
|
56
|
+
}>;
|
|
57
|
+
/** 実体(CMS のメディアにある1件) */
|
|
58
|
+
export type Asset = ImageAsset | VideoAsset | FileAsset;
|
|
59
|
+
/** 使用する側が保存する実体の参照(Sanity の image の asset、表示のときに実体の寸法・代替テキスト・hotspot を合わせて Media に解決) */
|
|
60
|
+
export type AssetRef = Readonly<{
|
|
61
|
+
asset: string;
|
|
62
|
+
}>;
|
|
63
|
+
/** 配信 API が解決した実体(url は配信 URL で配信のオリジンがある CMS だけ、hotspot・crop は元の画像に対する割合) */
|
|
64
|
+
export type DeliveredAsset = Readonly<{
|
|
65
|
+
id: string;
|
|
66
|
+
kind: 'image' | 'video' | 'file';
|
|
67
|
+
url?: string;
|
|
68
|
+
width: number;
|
|
69
|
+
height: number;
|
|
70
|
+
alt: string;
|
|
71
|
+
hotspot?: Hotspot;
|
|
72
|
+
crop?: Crop;
|
|
73
|
+
poster?: DeliveredAsset | null; /** 非公開の実体(url は署名のない配信 URL、signMediaUrl で署名して渡す) */
|
|
74
|
+
visibility?: 'private'; /** ファイルの元のファイル名・形式・大きさ(バイト) */
|
|
75
|
+
name?: string;
|
|
76
|
+
mimeType?: string;
|
|
77
|
+
size?: number;
|
|
78
|
+
}>;
|
|
79
|
+
/**
|
|
80
|
+
* 表示する素材の共通の項目
|
|
81
|
+
* - src: URL(CMS の実体)か、ビルドで読み込んだ画像
|
|
82
|
+
* - width・height: 元の寸法(表示の比と、読み込み前の場所の確保)
|
|
83
|
+
* - alt: 代替テキスト(飾りの画像は空文字)
|
|
84
|
+
*/
|
|
85
|
+
type MediaBase = Readonly<{
|
|
86
|
+
src: string | LocalImage;
|
|
87
|
+
width: number;
|
|
88
|
+
height: number;
|
|
89
|
+
alt: string;
|
|
90
|
+
hotspot?: Hotspot;
|
|
91
|
+
}>;
|
|
92
|
+
/**
|
|
93
|
+
* 表示の素材(使用する側のコレクションで共通、実体の参照 AssetRef を解決した値)
|
|
94
|
+
* - `image`: 画像
|
|
95
|
+
* - `video`: 動画(poster は読み込み前・動きを抑える設定・OG で代わりに表示する画像、再生の仕方は使用する場所で決定)
|
|
96
|
+
*/
|
|
97
|
+
export type Media = MediaBase & Readonly<{
|
|
98
|
+
kind: 'image';
|
|
99
|
+
} | {
|
|
100
|
+
kind: 'video';
|
|
101
|
+
poster: MediaBase;
|
|
102
|
+
}>;
|
|
103
|
+
/** 見せたい点の検査 */
|
|
104
|
+
export declare const hotspotSchema: z.ZodType<Hotspot>;
|
|
105
|
+
/** 切り抜きの検査(残る幅と高さが画像の1割以上) */
|
|
106
|
+
export declare const cropSchema: z.ZodType<Crop>;
|
|
107
|
+
/** 解決後の素材の検査(src は URL、ビルドで読み込んだ画像は JSON に含めないため対象外) */
|
|
108
|
+
export declare const mediaSchema: z.ZodType<Media>;
|
|
109
|
+
/** 使用する側が保存する実体の参照の検査 */
|
|
110
|
+
export declare const assetRefSchema: z.ZodType<AssetRef>;
|
|
111
|
+
export {};
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
import { type Audience, type ContentModel, type ResolvedModel } from './model.js';
|
|
2
|
+
/** 台帳の1件(コレクションの id × 項目の path、path はまとまりの中を `.` で連結、audience は記録の時点の見える範囲、fieldType は記録の時点の種類) */
|
|
3
|
+
export type AudienceLedgerEntry = Readonly<{
|
|
4
|
+
collection: string;
|
|
5
|
+
path: string;
|
|
6
|
+
fieldType: string;
|
|
7
|
+
audience: Audience;
|
|
8
|
+
}>;
|
|
9
|
+
/** 旧い形の入力か(どの項目にも audience がない、まとまりの中も) */
|
|
10
|
+
export declare function isLegacyInput(json: unknown): boolean;
|
|
11
|
+
/**
|
|
12
|
+
* 読み替えた定義(最上位の項目は見える範囲を必ず持つ、旧い印を外す)
|
|
13
|
+
* - 実行の側(配信、判定、管理の API)と保存の検査が使う。保存の形と GET の応答は読み込んだ値のまま
|
|
14
|
+
*/
|
|
15
|
+
export declare const resolvedModel: (model: ContentModel) => ResolvedModel;
|
|
16
|
+
/**
|
|
17
|
+
* 保存で台帳に足す記録(公開でない項目のうち、台帳にない・台帳より狭い・機密で種類が替わった項目)
|
|
18
|
+
* - 広げた記録は保存の側が変更の一覧の audience-widened から足す
|
|
19
|
+
*/
|
|
20
|
+
export declare function ledgerAdditions(model: ContentModel, ledger: readonly AudienceLedgerEntry[]): AudienceLedgerEntry[];
|
|
21
|
+
/** 広げた項目(from は保存済みの見える範囲か、作り直した key の台帳の最も狭い見える範囲) */
|
|
22
|
+
export type AudienceWidening = AudienceLedgerEntry & Readonly<{
|
|
23
|
+
from: Audience;
|
|
24
|
+
}>;
|
|
25
|
+
/** 機密だった key を別の種類で作り直した項目(previousType は台帳の種類) */
|
|
26
|
+
export type ConfidentialReuse = Readonly<{
|
|
27
|
+
collection: string;
|
|
28
|
+
path: string;
|
|
29
|
+
previousType: string;
|
|
30
|
+
}>;
|
|
31
|
+
/**
|
|
32
|
+
* 保存済みの定義 prev から next への見える範囲の変更(どちらも読み込んだ形、読み替えは audienceOf)
|
|
33
|
+
* - 保存済みの項目は保存済みの見える範囲と、追加の項目(作り直した key とコレクション)は台帳と比べる
|
|
34
|
+
*/
|
|
35
|
+
export declare function audienceFindings(prev: ContentModel, next: ContentModel, ledger: readonly AudienceLedgerEntry[]): {
|
|
36
|
+
widened: AudienceWidening[];
|
|
37
|
+
reused: ConfidentialReuse[];
|
|
38
|
+
};
|
|
@@ -0,0 +1,25 @@
|
|
|
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
|
+
};
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import { type ContentModel, type Collection, type FieldDef } from './model.js';
|
|
2
|
+
/** 出典の項目と、内側の項目の key */
|
|
3
|
+
export declare const SOURCES_FIELD: {
|
|
4
|
+
readonly key: "sources";
|
|
5
|
+
readonly source: "source";
|
|
6
|
+
readonly note: "note";
|
|
7
|
+
};
|
|
8
|
+
/** 出典の項目の定義(参照の項目 source の参照先 to) */
|
|
9
|
+
export type SourcesField = Extract<FieldDef, {
|
|
10
|
+
type: 'group';
|
|
11
|
+
}> & Readonly<{
|
|
12
|
+
to: string;
|
|
13
|
+
}>;
|
|
14
|
+
/** 主のコレクション(スキーマの順で先頭、なければ null) */
|
|
15
|
+
export declare const primaryCollectionOf: (model: ContentModel) => Collection | null;
|
|
16
|
+
/** 主のコレクション(なければ例外: そのコレクションを前提にする画面・処理だけが使用) */
|
|
17
|
+
export declare function requiredPrimaryCollectionOf(model: ContentModel): Collection;
|
|
18
|
+
/** 暦の日付(日付の役割の項目を持つ一覧のコレクションと項目の key、スキーマの順、役割は宣言だけで推測なし) */
|
|
19
|
+
export declare const dateRoleFieldsOf: (model: ContentModel) => {
|
|
20
|
+
collection: string;
|
|
21
|
+
field: string;
|
|
22
|
+
}[];
|
|
23
|
+
/** コレクションの出典の項目(なければ null) */
|
|
24
|
+
export declare function sourcesFieldOf(collection: Pick<Collection, 'fields'>): SourcesField | null;
|
|
25
|
+
/** 出典のコレクション(出典の項目の参照先でスキーマの順で先頭、なければ null) */
|
|
26
|
+
export declare function sourceCollectionOf(model: ContentModel): Collection | null;
|
|
27
|
+
/** 出典の値にある参照の ID(注の順、空と形の誤りは除外) */
|
|
28
|
+
export declare const sourceIdsOf: (value: unknown) => string[];
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import { type AudienceLedgerEntry, type AudienceWidening } from './audience.js';
|
|
2
|
+
import type { Problem } from '../../i18n/src/index.js';
|
|
3
|
+
import { type ContentModel } from './model.js';
|
|
4
|
+
/** 変更の扱い */
|
|
5
|
+
export type ChangeLevel = 'safe' | 'confirm' | 'forbidden';
|
|
6
|
+
/** 変更の種類 */
|
|
7
|
+
export type ChangeKind = 'collection-added' | 'collection-removed' | 'collection-slug-changed' | 'collection-changed' | 'customer-ops-added' | 'retention-shortened' | 'format-changed' | 'publishing-changed' | 'publishing-removed' | 'fixed-changed' | 'field-added' | 'field-removed' | 'field-changed' | 'field-type-changed' | 'field-key-reused' | 'audience-widened' | 'pii-narrowed' | 'confidential-key-reused' | 'required-added' | 'constraint-tightened' | 'option-added' | 'option-removed' | 'component-added' | 'component-changed' | 'component-removed';
|
|
8
|
+
/**
|
|
9
|
+
* スキーマの1つの変更(id は確認と置き換え先の指定で使用する識別子、path は項目の key を `.` で連結、value は削除した選択肢の値・コレクションの旧いスラッグ)
|
|
10
|
+
* - code・params: 文言の表 labels/ja.ts のキーと差し込み(画面はこれで引く)、message は英語の文
|
|
11
|
+
*/
|
|
12
|
+
export type SchemaChange = Readonly<{
|
|
13
|
+
id: string;
|
|
14
|
+
level: ChangeLevel;
|
|
15
|
+
kind: ChangeKind;
|
|
16
|
+
collection: string;
|
|
17
|
+
path?: string;
|
|
18
|
+
value?: string;
|
|
19
|
+
code: string;
|
|
20
|
+
params?: Problem['params'];
|
|
21
|
+
message: string;
|
|
22
|
+
widening?: AudienceWidening;
|
|
23
|
+
}>;
|
|
24
|
+
/**
|
|
25
|
+
* 差分の条件
|
|
26
|
+
* - history: 保存済みの版より古い過去の版
|
|
27
|
+
* - ledger: 見える範囲の台帳(audience.ts)
|
|
28
|
+
*/
|
|
29
|
+
export type DiffOptions = Readonly<{
|
|
30
|
+
history?: readonly ContentModel[];
|
|
31
|
+
ledger?: readonly AudienceLedgerEntry[];
|
|
32
|
+
}>;
|
|
33
|
+
/** 保存済みの版 prev から新しい定義 next への変更(コレクションの順、項目の順) */
|
|
34
|
+
export declare function diffSchema(prev: ContentModel, next: ContentModel, options?: DiffOptions): SchemaChange[];
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import type { DeclaredComponent } from '../../body/src/index.js';
|
|
2
|
+
import type { Collection, FieldDef, FieldProblem } from './model.js';
|
|
3
|
+
/** 項目が値の組に当てはまるか(条件なしは常に当てはまる、values は同じ階層の値) */
|
|
4
|
+
export declare const appliesTo: (field: FieldDef, values: Readonly<Record<string, unknown>>) => boolean;
|
|
5
|
+
/** 値の組に当てはまる項目だけ */
|
|
6
|
+
export declare const fieldsFor: <F extends FieldDef>(fields: readonly F[], values: Readonly<Record<string, unknown>>) => F[];
|
|
7
|
+
/** 値をコレクションの定義で検査(stage は保存か提出、提出は保存の必須も含む、まとまりの中は path を key・行の番号で連結、components はスキーマで宣言した本文の部品) */
|
|
8
|
+
export declare const checkFields: (collection: Collection, values: Readonly<Record<string, unknown>>, stage: "save" | "submit", components?: readonly DeclaredComponent[]) => FieldProblem[];
|
|
9
|
+
/** 配列でないオブジェクトか */
|
|
10
|
+
export declare const isRecord: (v: unknown) => v is Readonly<Record<string, unknown>>;
|
|
11
|
+
/**
|
|
12
|
+
* 値の形だけの検査(項目の種類ごとの JSON の形と長さの上限、keys は対象の最上位の項目の key)
|
|
13
|
+
* - 見ないもの: 必須、条件 when、選択肢、形式 pattern、下限、範囲(保存の差に当てる規則の側)
|
|
14
|
+
*/
|
|
15
|
+
export declare function shapeProblems(collection: Collection, values: Readonly<Record<string, unknown>>, keys: ReadonlySet<string>): FieldProblem[];
|