@tunasand/sdk 0.8.0 → 0.12.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 +137 -0
- package/README.md +165 -144
- package/dist/analytics.js +183 -109
- package/dist/app.js +276 -166
- package/dist/apps-BysPfMuR.js +408 -0
- package/dist/astro-image.d.ts +1 -0
- package/dist/astro-image.js +33 -0
- package/dist/astro-server-Bwau8F6d.js +99 -0
- package/dist/astro-server.d.ts +1 -0
- package/dist/astro-server.js +1 -0
- package/dist/astro.d.ts +1 -0
- package/dist/astro.js +306 -0
- package/dist/bridge-C2Bl-OAF.js +80 -0
- package/dist/bridge.js +1 -13
- package/dist/build-file-DNi0PHC5.js +31 -0
- package/dist/cli.js +6212 -8
- package/dist/{client-Derrexwr.js → client-C8STAw9T.js} +43 -24
- package/dist/code-N8pBUDbq.js +30 -0
- package/dist/code.d.ts +1 -0
- package/dist/code.js +1 -0
- package/dist/collection-26aglrg6.js +282 -0
- package/dist/{declared-DuNMsdXw.js → declared-CE4a61qb.js} +35 -35
- package/dist/delivery.js +121 -114
- package/dist/dev-operations-Tutwi1On.js +46 -0
- package/dist/dev.js +9 -16
- package/dist/embeds-DY6O5TrJ.js +29 -0
- package/dist/end-users.d.ts +1 -0
- package/dist/end-users.js +189 -0
- package/dist/endUsers-DODfjnv1.js +77 -0
- package/dist/{errorLabels-BgtQ_zUn.js → errorLabels-BK1NJ6Wz.js} +374 -238
- package/dist/i18n.js +4 -4
- package/dist/ids-DmtIoqBX.js +109 -0
- package/dist/integrations.js +95 -24
- package/dist/{ja-Du6ooL6i.js → ja-B3lAaOhZ.js} +91 -45
- package/dist/{ja-CeHU0EaY.js → ja-axQPxMJ-.js} +3 -3
- package/dist/operations-CIB99rIY.js +95 -0
- package/dist/operations.d.ts +1 -0
- package/dist/operations.js +1 -0
- package/dist/{page-Bzrj24sJ.js → page-yo1cw1kW.js} +1 -1
- package/dist/paymentPort-p1jV44Zz.js +203 -0
- package/dist/preview.js +8 -1
- package/dist/{profile-1em_lcxq.js → profile-DBsXLvvI.js} +48 -48
- package/dist/rich-text.js +16 -16
- package/dist/{schema-WnobuwLg.js → schema-Bs_BUUNv.js} +526 -265
- package/dist/schema.js +66 -88
- package/dist/types/access/src/handoff.d.ts +19 -14
- package/dist/types/access/src/index.d.ts +2 -2
- package/dist/types/access/src/jws.d.ts +41 -0
- package/dist/types/access/src/oidc.d.ts +12 -2
- package/dist/types/access/src/signed.d.ts +0 -2
- package/dist/types/adapter-cloudflare/src/eventLog/viewSchema.d.ts +11 -0
- package/dist/types/contract/src/accountProfile.d.ts +7 -0
- package/dist/types/contract/src/api/define.d.ts +165 -0
- package/dist/types/contract/src/apiKeys.d.ts +6 -2
- package/dist/types/contract/src/app.d.ts +32 -7
- package/dist/types/contract/src/appChannels.d.ts +152 -0
- package/dist/types/contract/src/appDefinition.d.ts +11 -5
- package/dist/types/contract/src/appDependencies.d.ts +107 -24
- package/dist/types/contract/src/appIdentities.d.ts +21 -0
- package/dist/types/contract/src/appInbound.d.ts +53 -0
- package/dist/types/contract/src/appMail.d.ts +106 -0
- package/dist/types/contract/src/appSecrets.d.ts +63 -0
- package/dist/types/contract/src/appServer.d.ts +460 -45
- package/dist/types/contract/src/approvals.d.ts +1 -1
- package/dist/types/contract/src/apps.d.ts +126 -60
- package/dist/types/contract/src/auditActions.d.ts +2 -2
- package/dist/types/contract/src/auditLabels.d.ts +120 -15
- package/dist/types/contract/src/authorize.d.ts +42 -14
- package/dist/types/contract/src/bridge.d.ts +35 -36
- package/dist/types/contract/src/consents.d.ts +29 -27
- package/dist/types/contract/src/deletion.d.ts +18 -0
- package/dist/types/contract/src/embeds.d.ts +26 -90
- package/dist/types/contract/src/{customerLabels.d.ts → endUserLabels.d.ts} +6 -9
- package/dist/types/contract/src/endUsers.d.ts +244 -0
- package/dist/types/contract/src/errorLabels.d.ts +67 -37
- package/dist/types/contract/src/errorLabelsEn.d.ts +50 -33
- package/dist/types/contract/src/errors.d.ts +28 -16
- package/dist/types/contract/src/eventSchemas.d.ts +70 -0
- package/dist/types/contract/src/eventTraces.d.ts +41 -0
- package/dist/types/contract/src/failureStatus.d.ts +14 -22
- package/dist/types/contract/src/fieldAccess.d.ts +8 -8
- package/dist/types/contract/src/formLabels.d.ts +3 -0
- package/dist/types/contract/src/forms.d.ts +4 -0
- package/dist/types/contract/src/grants.d.ts +26 -0
- package/dist/types/contract/src/headers.d.ts +5 -0
- package/dist/types/contract/src/hostingRpc.d.ts +44 -19
- package/dist/types/contract/src/identifiers.d.ts +45 -17
- package/dist/types/contract/src/ids.d.ts +18 -10
- package/dist/types/contract/src/import.d.ts +17 -16
- package/dist/types/contract/src/index.d.ts +57 -29
- package/dist/types/contract/src/integrationGraph.d.ts +83 -0
- package/dist/types/contract/src/issueLabels.d.ts +121 -81
- package/dist/types/contract/src/issueLabelsEn.d.ts +61 -41
- package/dist/types/contract/src/manage.d.ts +16 -7
- package/dist/types/contract/src/manageLabels.d.ts +2 -0
- package/dist/types/contract/src/manifestText.d.ts +66 -0
- package/dist/types/contract/src/messagePort.d.ts +208 -0
- package/dist/types/contract/src/migration.d.ts +2 -2
- package/dist/types/contract/src/notices.d.ts +37 -0
- package/dist/types/contract/src/operationEffects.d.ts +39 -0
- package/dist/types/contract/src/operatorOperations.d.ts +104 -110
- package/dist/types/contract/src/outbound.d.ts +29 -0
- package/dist/types/contract/src/paths.d.ts +13 -0
- package/dist/types/contract/src/paymentPort.d.ts +129 -0
- package/dist/types/contract/src/pending.d.ts +2 -0
- package/dist/types/contract/src/permissions.d.ts +7 -11
- package/dist/types/contract/src/perspective.d.ts +26 -0
- package/dist/types/contract/src/powers.d.ts +5 -0
- package/dist/types/contract/src/principal.d.ts +127 -56
- package/dist/types/contract/src/readPages.d.ts +92 -0
- package/dist/types/contract/src/recordLabels.d.ts +6 -0
- package/dist/types/contract/src/roles.d.ts +7 -4
- package/dist/types/contract/src/ruleLabels.d.ts +16 -0
- package/dist/types/contract/src/ruleProblems.d.ts +16 -0
- package/dist/types/contract/src/schemaLabels.d.ts +8 -0
- package/dist/types/contract/src/settingProblems.d.ts +18 -1
- package/dist/types/contract/src/settings.d.ts +5 -7
- package/dist/types/contract/src/siteDeclaration.d.ts +7 -7
- package/dist/types/contract/src/siteIndex.d.ts +76 -0
- package/dist/types/contract/src/transfer.d.ts +1 -1
- package/dist/types/contract/src/trial.d.ts +4 -1
- package/dist/types/contract/src/versions.d.ts +1 -3
- package/dist/types/contract/src/viewEvent.d.ts +0 -9
- package/dist/types/contract/src/webhooks.d.ts +24 -3
- package/dist/types/contract/src/workflow.d.ts +16 -19
- package/dist/types/contract/src/workspaceItems.d.ts +23 -7
- package/dist/types/contract/src/workspacePaths.d.ts +1 -1
- package/dist/types/rich-text/src/html.d.ts +1 -1
- package/dist/types/rich-text/src/index.d.ts +8 -7
- package/dist/types/rich-text/src/labels/en.d.ts +1 -1
- package/dist/types/rich-text/src/labels/ja.d.ts +2 -2
- package/dist/types/rich-text/src/library.d.ts +1 -1
- package/dist/types/rich-text/src/media.d.ts +2 -0
- package/dist/types/rich-text/src/normalize.d.ts +1 -1
- package/dist/types/rich-text/src/problems.d.ts +5 -5
- package/dist/types/rich-text/src/profile.d.ts +10 -10
- package/dist/types/rich-text/src/render.d.ts +1 -1
- package/dist/types/rich-text/src/schema.d.ts +2 -2
- package/dist/types/rich-text/src/standard.d.ts +4 -4
- package/dist/types/rich-text/src/types.d.ts +2 -2
- package/dist/types/schema/src/audience.d.ts +1 -3
- package/dist/types/schema/src/capabilities.d.ts +18 -27
- package/dist/types/schema/src/changes.d.ts +3 -1
- package/dist/types/schema/src/collection.d.ts +142 -111
- package/dist/types/schema/src/defaultSchema.d.ts +8 -2
- package/dist/types/schema/src/fieldIds.d.ts +18 -0
- package/dist/types/schema/src/file.d.ts +24 -11
- package/dist/types/schema/src/fileRefs.d.ts +14 -0
- package/dist/types/schema/src/fileSignature.d.ts +20 -0
- package/dist/types/schema/src/filesCollection.d.ts +7 -0
- package/dist/types/schema/src/forms.d.ts +43 -0
- package/dist/types/schema/src/imageMetadata.d.ts +9 -0
- package/dist/types/schema/src/index.d.ts +19 -10
- package/dist/types/schema/src/indexes.d.ts +11 -0
- package/dist/types/schema/src/input.d.ts +1 -1
- package/dist/types/schema/src/integrity.d.ts +8 -7
- package/dist/types/schema/src/kinds.d.ts +26 -0
- package/dist/types/schema/src/labels/en.d.ts +89 -46
- package/dist/types/schema/src/labels/ja.d.ts +92 -46
- package/dist/types/schema/src/mediaUrl.d.ts +26 -33
- package/dist/types/schema/src/page.d.ts +4 -4
- package/dist/types/schema/src/problems.d.ts +85 -42
- package/dist/types/schema/src/refs.d.ts +0 -9
- package/dist/types/schema/src/schema.d.ts +17 -12
- package/dist/types/schema/src/selfOps.d.ts +20 -19
- package/dist/types/schema/src/traits.d.ts +28 -0
- package/dist/types/schema/src/typesSource.d.ts +1 -1
- package/dist/types/schema/src/values.d.ts +5 -2
- package/dist/types/schema/src/widening.d.ts +3 -0
- package/dist/types/sdk/src/analytics.d.ts +2 -1
- package/dist/types/sdk/src/app.d.ts +43 -14
- package/dist/types/sdk/src/astro-image.d.ts +19 -0
- package/dist/types/sdk/src/astro-response.d.ts +6 -0
- package/dist/types/sdk/src/astro-server.d.ts +16 -0
- package/dist/types/sdk/src/astro.d.ts +19 -0
- package/dist/types/sdk/src/bridge.d.ts +2 -4
- package/dist/types/sdk/src/code.d.ts +61 -0
- package/dist/types/sdk/src/delegation.d.ts +13 -3
- package/dist/types/sdk/src/delivery/changes.d.ts +4 -4
- package/dist/types/sdk/src/delivery/client.d.ts +33 -22
- package/dist/types/sdk/src/delivery/fields.d.ts +3 -3
- package/dist/types/sdk/src/delivery/index.d.ts +3 -3
- package/dist/types/sdk/src/delivery/media.d.ts +5 -8
- package/dist/types/sdk/src/delivery/query.d.ts +15 -11
- package/dist/types/sdk/src/delivery/schema.d.ts +1 -1
- package/dist/types/sdk/src/delivery/values.d.ts +10 -14
- package/dist/types/sdk/src/delivery.d.ts +2 -2
- package/dist/types/sdk/src/dev-operations.d.ts +20 -0
- package/dist/types/sdk/src/dev.d.ts +6 -5
- package/dist/types/sdk/src/end-users.d.ts +187 -0
- package/dist/types/sdk/src/i18n.d.ts +2 -2
- package/dist/types/sdk/src/integrations.d.ts +14 -21
- package/dist/types/sdk/src/operations.d.ts +17 -0
- package/dist/types/sdk/src/preview.d.ts +2 -1
- package/dist/types/sdk/src/rich-text.d.ts +2 -2
- package/dist/types/sdk/src/schema.d.ts +1 -1
- package/dist/types/sdk/src/site/artifact.d.ts +64 -0
- package/dist/types/sdk/src/site/build-file.d.ts +30 -0
- package/dist/types/sdk/src/site/check-code.d.ts +14 -0
- package/dist/types/sdk/src/site/check-text.d.ts +19 -0
- package/dist/types/sdk/src/site/cli.d.ts +52 -0
- package/dist/types/sdk/src/site/content-type.d.ts +2 -0
- package/dist/types/sdk/src/site/labels.d.ts +14 -0
- package/dist/types/sdk/src/types.d.ts +1 -1
- package/dist/{types-B77qvqPJ.js → types-CYnY-63C.js} +5 -6
- package/dist/types.js +1 -1
- package/dist/{typesSource-CWybQYus.js → typesSource-BTA9-rcB.js} +17 -15
- package/package.json +32 -6
- package/dist/apps-BxnJ1RlU.js +0 -435
- package/dist/bridge-DtHw9hS6.js +0 -74
- package/dist/collection-BEOxeISR.js +0 -189
- package/dist/customers-DTbL0qn6.js +0 -86
- package/dist/customers.d.ts +0 -1
- package/dist/customers.js +0 -185
- package/dist/embeds-B5V54Zur.js +0 -34
- package/dist/ids--RF7hGyC.js +0 -36
- package/dist/src-sazhzYui.js +0 -71
- package/dist/types/contract/src/customers.d.ts +0 -266
- package/dist/types/schema/src/legacy.d.ts +0 -2
- package/dist/types/schema/src/media.d.ts +0 -5
- package/dist/types/sdk/src/customers.d.ts +0 -184
|
@@ -0,0 +1,187 @@
|
|
|
1
|
+
import { type SelfApiError, END_USER_EVENTS, type EndUserApiEntitlement, type EndUserApiError, type EndUserApiResult, type EndUserEventData } from '../../contract/src/endUsers.js';
|
|
2
|
+
import type { Issue } from '../../contract/src/errors.js';
|
|
3
|
+
import type { WebhookMessage } from '../../contract/src/webhooks.js';
|
|
4
|
+
import { type Delivery } from './delivery/client.js';
|
|
5
|
+
export { SELF_API_ERRORS, END_USER_API_ERRORS, END_USER_EVENTS, END_USER_STATUSES } from '../../contract/src/endUsers.js';
|
|
6
|
+
export type { Issue, IssueSeverity } from '../../contract/src/errors.js';
|
|
7
|
+
export type { SelfApiError, EndUserApiEntitlement, EndUserApiError, EndUserApiResult, EndUserEnsureResult, EndUserEventData, EndUserStatus } from '../../contract/src/endUsers.js';
|
|
8
|
+
export { entitledKeysOf } from '../../schema/src/index.js';
|
|
9
|
+
/** 業務の失敗の補足(エラーの本文の params と request_id) */
|
|
10
|
+
type FailureDetail = Readonly<{
|
|
11
|
+
params?: Readonly<Record<string, unknown>>;
|
|
12
|
+
requestId?: string;
|
|
13
|
+
}>;
|
|
14
|
+
/** エンドユーザーの API の結果(業務の失敗は error のコード、T は成功の値) */
|
|
15
|
+
export type EndUserCall<T = EndUserApiResult> = Readonly<{
|
|
16
|
+
ok: true;
|
|
17
|
+
value: T;
|
|
18
|
+
}> | (Readonly<{
|
|
19
|
+
ok: false;
|
|
20
|
+
error: EndUserApiError;
|
|
21
|
+
}> & FailureDetail);
|
|
22
|
+
/** 紐付けの入力(招待のコードはワークスペースで発行したもの) */
|
|
23
|
+
export type LinkInput = Readonly<{
|
|
24
|
+
idToken: string;
|
|
25
|
+
inviteCode: string;
|
|
26
|
+
}>;
|
|
27
|
+
/** 本人の特定の入力(issuer と audience は登録した発行者、subject は発行者の sub) */
|
|
28
|
+
export type EnsureInput = Readonly<{
|
|
29
|
+
issuer: string;
|
|
30
|
+
audience: string;
|
|
31
|
+
subject: string;
|
|
32
|
+
}>;
|
|
33
|
+
/** エンドユーザーの API の呼び出し(delivery は配信 API への接続、外のサイトは鍵を付けた fetch) */
|
|
34
|
+
export declare function createEndUsersClient(delivery: Delivery): {
|
|
35
|
+
/** 登録した発行者の ID トークンで照合(紐付けがなければ end_user_not_linked、確認待ちは end_user_pending、検証できなければ invalid_id_token) */
|
|
36
|
+
verify: (idToken: string) => Promise<EndUserCall<Readonly<{
|
|
37
|
+
end_user: Readonly<{
|
|
38
|
+
id: string;
|
|
39
|
+
status: import("../../contract/src/index.js").EndUserStatus;
|
|
40
|
+
version?: number;
|
|
41
|
+
}>;
|
|
42
|
+
entitlements: readonly EndUserApiEntitlement[];
|
|
43
|
+
today: string;
|
|
44
|
+
grace_sec?: number;
|
|
45
|
+
}>>>;
|
|
46
|
+
/** エンドユーザーの ID で状態を取り直す(セッションの照合し直し、エンドユーザーがいなければ not_found) */
|
|
47
|
+
lookup: (endUserId: string) => Promise<EndUserCall<Readonly<{
|
|
48
|
+
end_user: Readonly<{
|
|
49
|
+
id: string;
|
|
50
|
+
status: import("../../contract/src/index.js").EndUserStatus;
|
|
51
|
+
version?: number;
|
|
52
|
+
}>;
|
|
53
|
+
entitlements: readonly EndUserApiEntitlement[];
|
|
54
|
+
today: string;
|
|
55
|
+
grace_sec?: number;
|
|
56
|
+
}>>>;
|
|
57
|
+
/** 招待のコードのエンドユーザーに ID トークンの本人を紐付ける(紐付け済みは already_linked、招待のコードの誤りは invalid_invite) */
|
|
58
|
+
link: ({ idToken, inviteCode }: LinkInput) => Promise<EndUserCall<Readonly<{
|
|
59
|
+
end_user: Readonly<{
|
|
60
|
+
id: string;
|
|
61
|
+
status: import("../../contract/src/index.js").EndUserStatus;
|
|
62
|
+
version?: number;
|
|
63
|
+
}>;
|
|
64
|
+
entitlements: readonly EndUserApiEntitlement[];
|
|
65
|
+
today: string;
|
|
66
|
+
grace_sec?: number;
|
|
67
|
+
}>>>;
|
|
68
|
+
/** 登録した発行者の外部 ID のエンドユーザー(紐付けがなければ作る。登録していない発行者は not_found) */
|
|
69
|
+
ensure: (identity: EnsureInput) => Promise<EndUserCall<Readonly<{
|
|
70
|
+
end_user: Readonly<{
|
|
71
|
+
id: string;
|
|
72
|
+
status: import("../../contract/src/index.js").EndUserStatus;
|
|
73
|
+
}>;
|
|
74
|
+
created: boolean;
|
|
75
|
+
}>>>;
|
|
76
|
+
/** ID トークンの人がフォーム(コレクション、設問の版 version)に回答済みか */
|
|
77
|
+
checkSubmission: (collection: string, idToken: string, version?: string) => Promise<EndUserCall<Readonly<{
|
|
78
|
+
submitted: boolean;
|
|
79
|
+
}>>>;
|
|
80
|
+
};
|
|
81
|
+
/** エンドユーザーの API の呼び出し */
|
|
82
|
+
export type EndUsersClient = ReturnType<typeof createEndUsersClient>;
|
|
83
|
+
/** 本人のレコードの1件(id、本人が見られる項目、_meta の version は更新の版の条件、deleted_at は削除の応答だけ) */
|
|
84
|
+
export type SelfItem = Readonly<{
|
|
85
|
+
id: string;
|
|
86
|
+
_meta: Readonly<{
|
|
87
|
+
created_at: string;
|
|
88
|
+
updated_at: string;
|
|
89
|
+
version: number;
|
|
90
|
+
deleted_at?: string;
|
|
91
|
+
}>;
|
|
92
|
+
}> & Readonly<Record<string, unknown>>;
|
|
93
|
+
/** 本人のレコードの一覧の1ページ(next_cursor は次のページの cursor、最後のページは null) */
|
|
94
|
+
export type SelfPage = Readonly<{
|
|
95
|
+
data: readonly SelfItem[];
|
|
96
|
+
next_cursor: string | null;
|
|
97
|
+
}>;
|
|
98
|
+
/**
|
|
99
|
+
* 本人のレコードのエンドポイントの結果
|
|
100
|
+
* (業務の失敗は error のコード、invalid_input と save_unmet は issues つき、invalid_state は params.reason)
|
|
101
|
+
*/
|
|
102
|
+
export type SelfCall<T> = Readonly<{
|
|
103
|
+
ok: true;
|
|
104
|
+
value: T;
|
|
105
|
+
}> | (Readonly<{
|
|
106
|
+
ok: false;
|
|
107
|
+
error: SelfApiError;
|
|
108
|
+
issues?: readonly Issue[];
|
|
109
|
+
}> & FailureDetail);
|
|
110
|
+
/**
|
|
111
|
+
* 本人のレコードのエンドポイントの呼び出し(#712、<基点>/end-users/me/<コレクション>)
|
|
112
|
+
* - delivery はインストールのトークンを付けた接続(配信 API の鍵では呼べない)。endUserId はサイトが自分で確認した本人で、ヘッダーで送る
|
|
113
|
+
* - query は配信 API の一覧の文法(filter[key]・order・ids・limit・cursor)で、絞れるのは本人が見られる項目だけ
|
|
114
|
+
*/
|
|
115
|
+
export declare function createSelfClient(delivery: Delivery): {
|
|
116
|
+
/** 本人のレコードの一覧(コレクション type、本人 endUserId) */
|
|
117
|
+
list: (collection: string, endUserId: string, query?: Readonly<Record<string, string>>) => Promise<SelfCall<Readonly<{
|
|
118
|
+
data: readonly SelfItem[];
|
|
119
|
+
next_cursor: string | null;
|
|
120
|
+
}>>>;
|
|
121
|
+
/** 作成(作ったレコード。同じ組のレコードがあれば作らずにそのレコード) */
|
|
122
|
+
create: (collection: string, endUserId: string, values: Readonly<Record<string, unknown>>) => Promise<SelfCall<SelfItem>>;
|
|
123
|
+
/**
|
|
124
|
+
* 更新(values を JSON Merge Patch で重ね、null は値を空に。更新後のレコード)
|
|
125
|
+
* - version: 一覧の _meta.version。古ければ version_conflict
|
|
126
|
+
*/
|
|
127
|
+
update: (collection: string, id: string, endUserId: string, version: number, values: Readonly<Record<string, unknown>>) => Promise<SelfCall<SelfItem>>;
|
|
128
|
+
/** 削除(ゴミ箱へ。_meta.deleted_at つきのレコード) */
|
|
129
|
+
delete: (collection: string, id: string, endUserId: string) => Promise<SelfCall<SelfItem>>;
|
|
130
|
+
};
|
|
131
|
+
/** 本人のレコードのエンドポイントの呼び出し */
|
|
132
|
+
export type SelfClient = ReturnType<typeof createSelfClient>;
|
|
133
|
+
/** 権利の時期(今日 today との比較、日付は YYYY-MM-DD で終了日を含む) */
|
|
134
|
+
export type EntitlementPhase = 'active' | 'upcoming' | 'expired';
|
|
135
|
+
/** 権利の時期 */
|
|
136
|
+
export declare const entitlementPhase: (e: Pick<EndUserApiEntitlement, "starts_on" | "ends_on">, today: string) => EntitlementPhase;
|
|
137
|
+
/**
|
|
138
|
+
* 見せてよいかの判定
|
|
139
|
+
* - reason: signed_out(照合の結果なし)・suspended・no_entitlement・unavailable(再照合が失敗し猶予もない)
|
|
140
|
+
* - expired は endsOn に最後の終了日、upcoming は startsOn に最初の開始日(SDK の判定の値、線の上の ends_on・starts_on から)
|
|
141
|
+
*/
|
|
142
|
+
export type EndUserAccess = Readonly<{
|
|
143
|
+
ok: true;
|
|
144
|
+
}> | Readonly<{
|
|
145
|
+
ok: false;
|
|
146
|
+
reason: 'signed_out' | 'suspended' | 'no_entitlement' | 'unavailable';
|
|
147
|
+
}> | Readonly<{
|
|
148
|
+
ok: false;
|
|
149
|
+
reason: 'expired';
|
|
150
|
+
endsOn: string;
|
|
151
|
+
}> | Readonly<{
|
|
152
|
+
ok: false;
|
|
153
|
+
reason: 'upcoming';
|
|
154
|
+
startsOn: string;
|
|
155
|
+
}>;
|
|
156
|
+
/**
|
|
157
|
+
* エンドユーザーだけの項目を見せてよいか
|
|
158
|
+
* - requires: 配信の _meta.requires(undefined はエンドユーザーの出し分けのないコレクションで誰でも可、空は有効な権利を1つでも持つ人)
|
|
159
|
+
* - endUser: 照合か状態の取得の結果(ログインしていなければ null)
|
|
160
|
+
* - today: 判定の基準の日付(既定は応答の today)
|
|
161
|
+
*/
|
|
162
|
+
export declare function endUserAccess(endUser: EndUserApiResult | null, requires: readonly string[] | undefined, today?: string | undefined): EndUserAccess;
|
|
163
|
+
/** 最後に成功した照合(result は照合か状態の取得の結果、checkedAt はその時刻のミリ秒。再照合が失敗しても更新しない) */
|
|
164
|
+
export type EndUserSnapshot = Readonly<{
|
|
165
|
+
result: EndUserApiResult;
|
|
166
|
+
checkedAt: number;
|
|
167
|
+
}>;
|
|
168
|
+
/**
|
|
169
|
+
* 再照合の失敗に猶予が効くか(Tunasand に届かないか 5xx だけ)
|
|
170
|
+
* - failure: エンドユーザーの API の呼び出しが投げた例外か、業務の失敗の結果({ ok: false }、明示の拒否なので効かない)
|
|
171
|
+
* - 届かない: fetch の TypeError と時間切れ(TimeoutError)
|
|
172
|
+
*/
|
|
173
|
+
export declare function isTransientFailure(failure: unknown): boolean;
|
|
174
|
+
/** 猶予の期限のミリ秒(最後に成功した照合の時刻に応答の grace_sec を足す、grace_sec は0から86400に収める) */
|
|
175
|
+
export declare const graceDeadline: (snapshot: EndUserSnapshot) => number;
|
|
176
|
+
/**
|
|
177
|
+
* 再照合が失敗したときのエンドユーザーだけの項目の判定
|
|
178
|
+
* - 猶予の間(isTransientFailure で now が graceDeadline より前)は最後の結果で判定し、権利の expires_at は now で効かせる
|
|
179
|
+
* - それ以外は unavailable(requires が undefined の型は誰でも可)
|
|
180
|
+
*/
|
|
181
|
+
export declare function graceAccess(last: EndUserSnapshot, failure: unknown, requires: readonly string[] | undefined, now?: number): EndUserAccess;
|
|
182
|
+
/** 見せてよくなければアクセス権の項目(keys、entitledKeysOf の値)を除いた1件 */
|
|
183
|
+
export declare function visibleItem<T extends Readonly<Record<string, unknown>>>(item: T, access: EndUserAccess, keys: readonly string[]): T;
|
|
184
|
+
/** エンドユーザーのイベントの Webhook の本文(type はイベントの名前、timestamp はイベントの日時) */
|
|
185
|
+
export type EndUserEvent = WebhookMessage<(typeof END_USER_EVENTS)[keyof typeof END_USER_EVENTS], EndUserEventData>;
|
|
186
|
+
/** 本文がエンドユーザーのイベントか(署名の検証の後に使う) */
|
|
187
|
+
export declare function isEndUserEvent(body: unknown): body is EndUserEvent;
|
|
@@ -8,5 +8,5 @@ export type { ErrorCatalog } from '../../contract/src/errorLabels.js';
|
|
|
8
8
|
export { importProblemLabel, issueLabel, labelTableProblems, PROBLEM_MESSAGES, PROBLEM_MESSAGES_EN, problemEnglish, problemLabel } from '../../contract/src/problems.js';
|
|
9
9
|
export { SCHEMA_PROBLEM_MESSAGES } from '../../schema/src/labels/ja.js';
|
|
10
10
|
export { SCHEMA_PROBLEM_MESSAGES_EN } from '../../schema/src/labels/en.js';
|
|
11
|
-
export {
|
|
12
|
-
export {
|
|
11
|
+
export { RICH_TEXT_PROBLEM_MESSAGES } from '../../rich-text/src/labels/ja.js';
|
|
12
|
+
export { RICH_TEXT_PROBLEM_MESSAGES_EN } from '../../rich-text/src/labels/en.js';
|
|
@@ -1,33 +1,26 @@
|
|
|
1
|
-
import { type SigningSecrets } from '../../access/src/index.js';
|
|
2
1
|
import { type SessionTokenClaims } from '../../contract/src/bridge.js';
|
|
3
|
-
import { type EmbedContext } from '../../contract/src/embeds.js';
|
|
4
|
-
export { openValue } from '../../access/src/index.js';
|
|
5
|
-
export type { SigningSecrets } from '../../access/src/index.js';
|
|
6
2
|
export { SESSION_TOKEN } from '../../contract/src/bridge.js';
|
|
7
|
-
export {
|
|
3
|
+
export { EMBED_PLACEMENTS } from '../../contract/src/embeds.js';
|
|
8
4
|
export { FUNCTION_HOOKS } from '../../contract/src/functions.js';
|
|
9
5
|
export type { SessionTokenClaims } from '../../contract/src/bridge.js';
|
|
10
|
-
export type {
|
|
6
|
+
export type { EmbedPlacement, EmbedUiSlot } from '../../contract/src/embeds.js';
|
|
11
7
|
export type { FunctionHook, FunctionIssue, FunctionRef, FunctionRequest, ListCell, ListCellTone, ListColumnRequest, ListColumnResponse, PublishCheckRequest, PublishCheckResponse, SaveCheckRequest, SaveCheckResponse } from '../../contract/src/functions.js';
|
|
12
8
|
export type { InstallationDeletedData, WebhookAction, WebhookBody, WebhookChangeAction, WebhookEvent, WebhookMessage, WebhookAppBody, WebhookRecordData, WebhookRecordType } from '../../contract/src/webhooks.js';
|
|
13
|
-
/**
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
export declare function openEmbedContext(secret: SigningSecrets, url: string | URL, now?: number, options?: EmbedContextOptions): Promise<EmbedContext | null>;
|
|
19
|
-
/** ワークスペースが取り直して送る context のメッセージの文脈(ctxNext を先に、どちらかが鍵で開けば文脈、なければ null) */
|
|
20
|
-
export declare function openEmbedContextMessage(secret: SigningSecrets, message: Readonly<{
|
|
21
|
-
ctx?: string | null;
|
|
22
|
-
ctxNext?: string | null;
|
|
23
|
-
}>, now?: number, options?: EmbedContextOptions): Promise<EmbedContext | null>;
|
|
24
|
-
/** 画面のトークンの検証の条件(clientId: 自分のクライアントの ID。インストールにつなぐまでは外の画面の登録の ID) */
|
|
9
|
+
/**
|
|
10
|
+
* 画面のトークンの検証の条件
|
|
11
|
+
* - clientId: 自分のインストール済みアプリの ID、issuer: 公開の API のオリジン https://<プロジェクトの ID>--<公開の API のホスト>
|
|
12
|
+
* - fetch: JWKS の取得(省略は globalThis.fetch)
|
|
13
|
+
*/
|
|
25
14
|
export type SessionTokenOptions = Readonly<{
|
|
26
15
|
clientId: string;
|
|
16
|
+
issuer: string;
|
|
17
|
+
fetch?: typeof fetch;
|
|
27
18
|
}>;
|
|
28
19
|
/**
|
|
29
|
-
*
|
|
30
|
-
* - 時計のずれは SESSION_TOKEN.skewSec 秒まで許す。
|
|
20
|
+
* 画面のトークンのクレーム(発行者の JWKS の鍵で署名が合い、typ、発行者、宛先 clientId、期間が合えば値、ほかは null)
|
|
21
|
+
* - 時計のずれは SESSION_TOKEN.skewSec 秒まで許す。env は発行した環境の ID
|
|
31
22
|
* - `Authorization: Bearer <token>` の値は `token` に先頭の `Bearer ` を除いて渡す
|
|
23
|
+
* - JWKS を取得できなければ例外(session_token_jwks_unavailable)
|
|
24
|
+
* - Web Crypto が方式を持たなければ例外(session_token_unsupported)
|
|
32
25
|
*/
|
|
33
|
-
export declare function verifySessionToken(
|
|
26
|
+
export declare function verifySessionToken(token: string, options: SessionTokenOptions, now?: number): Promise<SessionTokenClaims | null>;
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import type { CodeHandlers, CodeOperations } from './code.js';
|
|
2
|
+
/**
|
|
3
|
+
* 処理している呼び出しの操作
|
|
4
|
+
* @throws Error `operations_outside_call`(処理の外)、OperationError `closed`(呼び出しの終わりの後)
|
|
5
|
+
*/
|
|
6
|
+
export declare function operations(): CodeOperations;
|
|
7
|
+
/** given を、work とその中の非同期の処理の `operations()` にする(応答の本文の終わりに閉じる) */
|
|
8
|
+
export declare function provideOperations<T>(given: CodeOperations, work: () => T | Promise<T>): Promise<T>;
|
|
9
|
+
/** 種類ごとの処理の中で `operations()` を使えるようにする(defineCode に渡す) */
|
|
10
|
+
export declare function withOperations(handlers: CodeHandlers): CodeHandlers;
|
|
11
|
+
/** 呼び出しの処理の中だけで使う、サイトの値。同時の呼び出しで混ざらず、モジュールの変数に残らない */
|
|
12
|
+
export type ScopedValue<T> = Readonly<{
|
|
13
|
+
run: <R>(value: T, work: () => R) => R;
|
|
14
|
+
get: () => T | undefined;
|
|
15
|
+
}>;
|
|
16
|
+
/** 値の入れ物を作る(work とその中の非同期の処理だけが、その値を読む) */
|
|
17
|
+
export declare function scopedValue<T>(): ScopedValue<T>;
|
|
@@ -1 +1,2 @@
|
|
|
1
|
-
|
|
1
|
+
/** CMS の転送のチケット(Authorization: Bearer がチケットの形でなければ null。照合は配信 API) */
|
|
2
|
+
export declare function perspectiveTicketOf(request: Request): string | null;
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export { blockSchemaOf,
|
|
2
|
-
export type { Align, Block, Body,
|
|
1
|
+
export { blockSchemaOf, richTextToHtml, cellParagraphs, citesOf, DESCRIPTION_MAX, descriptionOf, EMBED_PROVIDERS, embedOfUrl, embedSrcOf, excerptOf, isSafeCssValue, isSafeHref, isTableCell, linksOf, plainOf, READING_SPEED, readMinOf } from '../../rich-text/src/index.js';
|
|
2
|
+
export type { Align, Block, Body, RichTextProfile, 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 '../../rich-text/src/index.js';
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export { collectionOf, coverPosition, coverStart, createClock, cropRect, croppedHotspot, fileRefSchema,
|
|
1
|
+
export { collectionOf, coverPosition, coverStart, createClock, cropRect, croppedHotspot, fileRefSchema, FILES_COLLECTION, initialValueOf, isDateOnly, isIndexableField, isStoredCollection, mediaSchema, objectPosition, optionLabelOf, optionsOf, pagePathOf, parseSchema, parseScreens, publicPathOf, requiredPrimaryCollectionOf, roleFieldOf, dateRoleFieldsOf, sourcesFieldOf, sourceIdsOf, stillOf, typesSourceOf, valueFieldsOf } from '../../schema/src/index.js';
|
|
2
2
|
export type { File, FileRef, Clock, Collection, CollectionSchema, Crop, CropRect, DateString, FieldDef, Hotspot, LocalImage, Media, PageDef, PageRecord, ScreenSettings } from '../../schema/src/index.js';
|
|
3
3
|
export { CONFIG_FORMAT } from '../../contract/src/transfer.js';
|
|
4
4
|
export type { ConfigBundle } from '../../contract/src/transfer.js';
|
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
import { siteCodeRanges, type SiteIndex } from '../../../contract/src/siteIndex.js';
|
|
2
|
+
import type { Reviewed, SiteBuild } from './build-file.js';
|
|
3
|
+
import { type CodeProblem } from './check-code.js';
|
|
4
|
+
import { type TextProblem, type TextTargets } from './check-text.js';
|
|
5
|
+
export type BuildProblem = CodeProblem | TextProblem | 'missing_dir' | 'unsupported_module' | 'module_path' | 'file_path' | 'unused_file' | 'secret_file' | 'map_file' | 'linked_file' | 'missing_page' | 'unused_review' | 'index';
|
|
6
|
+
export type BuildFinding = Readonly<{
|
|
7
|
+
problem: BuildProblem;
|
|
8
|
+
file: string;
|
|
9
|
+
line: number;
|
|
10
|
+
detail: string;
|
|
11
|
+
}>;
|
|
12
|
+
/** 作った成果物(contents は、ハッシュから中身を読むもの) */
|
|
13
|
+
export type SiteArtifact = Readonly<{
|
|
14
|
+
index: SiteIndex;
|
|
15
|
+
contents: ReadonlyMap<string, () => Uint8Array>;
|
|
16
|
+
bundle: Uint8Array;
|
|
17
|
+
}>;
|
|
18
|
+
export type BuildInput = Readonly<{
|
|
19
|
+
dir: string;
|
|
20
|
+
build: SiteBuild;
|
|
21
|
+
manifestVersion: number;
|
|
22
|
+
targets: Omit<TextTargets, 'origins'>;
|
|
23
|
+
}>;
|
|
24
|
+
/** 確認済みの宣言が通した式(file と line は、通した場所) */
|
|
25
|
+
export type ReviewedCode = Reviewed & Readonly<{
|
|
26
|
+
file: string;
|
|
27
|
+
line: number;
|
|
28
|
+
}>;
|
|
29
|
+
/** reviewed は、宣言で通したものの全部(宣言は、実行環境の境界を変えない) */
|
|
30
|
+
export type BuildResult = Readonly<{
|
|
31
|
+
reviewed: readonly ReviewedCode[];
|
|
32
|
+
} & ({
|
|
33
|
+
artifact: SiteArtifact;
|
|
34
|
+
findings: readonly [];
|
|
35
|
+
} | {
|
|
36
|
+
artifact: null;
|
|
37
|
+
findings: readonly BuildFinding[];
|
|
38
|
+
})>;
|
|
39
|
+
/** ビルドの出力を検査し、成果物にする(1つでも誤りがあれば、成果物を作らない) */
|
|
40
|
+
export declare function buildArtifact({ dir, build, manifestVersion, targets: given }: BuildInput): Promise<BuildResult>;
|
|
41
|
+
/**
|
|
42
|
+
* 成果物を書く(書き終えてから、前のものと替える)
|
|
43
|
+
* @throws Error `out_not_artifact`(成果物でないものがあるディレクトリは替えない)
|
|
44
|
+
*/
|
|
45
|
+
export declare function writeArtifact({ index, contents, bundle }: SiteArtifact, out: string): void;
|
|
46
|
+
/** 読んだ成果物(code は、読む側の実行の索引と束の形) */
|
|
47
|
+
export type ReadArtifact = Readonly<{
|
|
48
|
+
index: SiteIndex;
|
|
49
|
+
code: Readonly<{
|
|
50
|
+
main: string;
|
|
51
|
+
modules: ReturnType<typeof siteCodeRanges>;
|
|
52
|
+
bundle: Readonly<{
|
|
53
|
+
sha256: string;
|
|
54
|
+
bytes: number;
|
|
55
|
+
}>;
|
|
56
|
+
}>;
|
|
57
|
+
bundle: Uint8Array;
|
|
58
|
+
blob: (sha256: string) => Uint8Array;
|
|
59
|
+
}>;
|
|
60
|
+
/**
|
|
61
|
+
* 成果物を読み、索引と全部の実体のハッシュを確かめる
|
|
62
|
+
* @throws Error `invalid_artifact`
|
|
63
|
+
*/
|
|
64
|
+
export declare function readArtifact(dir: string): Promise<ReadArtifact>;
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import type { SiteErrorStatus } from '../../../contract/src/siteIndex.js';
|
|
2
|
+
export declare const BUILD_FILE = "tunasand-build.json";
|
|
3
|
+
/** パスは、すべて tunasand-build.json の場所から。区切りは / */
|
|
4
|
+
export type SiteBuild = Readonly<{
|
|
5
|
+
version: 1;
|
|
6
|
+
/** 入口のモジュール(server からのパス) */
|
|
7
|
+
entry: string;
|
|
8
|
+
/** コードのディレクトリ */
|
|
9
|
+
server: string;
|
|
10
|
+
/** 静的ファイルのディレクトリ(なければ省く) */
|
|
11
|
+
client?: string;
|
|
12
|
+
/** ファイルの名前と違う URL で返す静的ファイル(client からのパスと、URL のパス) */
|
|
13
|
+
pages?: Readonly<Record<string, string>>;
|
|
14
|
+
/** 失敗の応答に使う静的ファイルの URL のパス */
|
|
15
|
+
errors?: Readonly<Partial<Record<SiteErrorStatus, string>>>;
|
|
16
|
+
/** 内容が変わらないファイルの URL のパスの先頭 */
|
|
17
|
+
immutable?: readonly string[];
|
|
18
|
+
/** 成果物に含めてはいけないオリジン(公開の段階で変わるもの。検査のためだけに使い、成果物に入らない) */
|
|
19
|
+
origins?: readonly string[];
|
|
20
|
+
/** 要求の間に通らないことを確かめた式。検査を通すだけで、実行環境の境界を変えない。code は式の文の一部(空白の違いは問わない) */
|
|
21
|
+
reviewed?: readonly Reviewed[];
|
|
22
|
+
}>;
|
|
23
|
+
/** 確認済みの式(problem は eval、wasm_compile、node_import。node_import は動的な import だけ) */
|
|
24
|
+
export type Reviewed = Readonly<{
|
|
25
|
+
problem: string;
|
|
26
|
+
code: string;
|
|
27
|
+
reason: string;
|
|
28
|
+
}>;
|
|
29
|
+
/** 読んだ値(正しくなければ null) */
|
|
30
|
+
export declare function siteBuildOf(value: unknown): SiteBuild | null;
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
export type CodeProblem = 'syntax' | 'platform_import' | 'node_import' | 'remote_import' | 'bare_import' | 'missing_module' | 'dynamic_import' | 'eval' | 'wasm_compile' | 'context_enter' | 'source_map' | 'no_default_export';
|
|
2
|
+
/** code は、見つけた式の文 */
|
|
3
|
+
export type CodeFinding = Readonly<{
|
|
4
|
+
problem: CodeProblem;
|
|
5
|
+
line: number;
|
|
6
|
+
detail: string;
|
|
7
|
+
code: string;
|
|
8
|
+
}>;
|
|
9
|
+
/** 要求の間に通らないことを人が確かめれば、入れてよいもの(読み込みの失敗と、秘密値などの混入は含まない) */
|
|
10
|
+
export declare const REVIEWABLE: readonly CodeProblem[];
|
|
11
|
+
/** 相対の指定の先(モジュールのパス。外に出るものは null) */
|
|
12
|
+
export declare function moduleTargetOf(path: string, specifier: string): string | null;
|
|
13
|
+
/** 1つのモジュールの検査(modules は成果物のモジュールの全部、isEntry は入口か) */
|
|
14
|
+
export declare function checkCode(file: string, code: string, modules: ReadonlySet<string>, isEntry: boolean): readonly CodeFinding[];
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
export type TextProblem = 'private_key' | 'token' | 'environment_value' | 'origin' | 'local_path' | 'local_origin';
|
|
2
|
+
export type TextFinding = Readonly<{
|
|
3
|
+
problem: TextProblem;
|
|
4
|
+
line: number;
|
|
5
|
+
detail: string;
|
|
6
|
+
}>;
|
|
7
|
+
/** 探す値(name は知らせるための名前) */
|
|
8
|
+
export type TextTargets = Readonly<{
|
|
9
|
+
values: readonly Readonly<{
|
|
10
|
+
name: string;
|
|
11
|
+
value: string;
|
|
12
|
+
}>[];
|
|
13
|
+
origins: readonly string[];
|
|
14
|
+
localPaths: readonly string[];
|
|
15
|
+
}>;
|
|
16
|
+
/** 1つのファイルの検査(isPage は、事前に描画したものを含む静的ファイルの文書) */
|
|
17
|
+
export declare function checkText(text: string, { values, origins, localPaths }: TextTargets, isPage: boolean): readonly TextFinding[];
|
|
18
|
+
/** 探す環境の値: .env の全部(画面に出すと宣言した PUBLIC_ を除く)と、環境変数のうち秘密値の名前のもの */
|
|
19
|
+
export declare function environmentValues(dotenv: Readonly<Record<string, string>>, env: Readonly<Record<string, string | undefined>>): TextTargets['values'];
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
import { type ReadArtifact } from './artifact.js';
|
|
2
|
+
export declare const SITE_BUILD_COMMANDS: readonly string[];
|
|
3
|
+
type Env = Readonly<Record<string, string | undefined>>;
|
|
4
|
+
type Preview = Readonly<{
|
|
5
|
+
url: string;
|
|
6
|
+
close: () => Promise<void>;
|
|
7
|
+
}>;
|
|
8
|
+
/** 手元のプレビューの道具(別のパッケージ。渡すものの形は、その previewSite の引数) */
|
|
9
|
+
export type PreviewModule = Readonly<{
|
|
10
|
+
previewSite: (options: unknown) => Promise<Preview>;
|
|
11
|
+
}>;
|
|
12
|
+
/** サイトに入っている道具(入っていなければ null) */
|
|
13
|
+
declare function loadPreview(): Promise<PreviewModule | null>;
|
|
14
|
+
/** ディレクトリの .env の値(名前は「変数(ファイル)」。秘密値の混入の検査だけに使う) */
|
|
15
|
+
export declare function dotenvValues(dir: string): Record<string, string>;
|
|
16
|
+
/** 手元で動かすもの(成果物、静的ファイルの引き方、記録を再生する操作) */
|
|
17
|
+
export declare function previewOptions({ index, code, bundle, blob }: ReadArtifact, fixtures: string | null, port: number): {
|
|
18
|
+
code: Readonly<{
|
|
19
|
+
main: string;
|
|
20
|
+
modules: ReturnType<typeof import("../../../contract/src/siteIndex.js").siteCodeRanges>;
|
|
21
|
+
bundle: Readonly<{
|
|
22
|
+
sha256: string;
|
|
23
|
+
bytes: number;
|
|
24
|
+
}>;
|
|
25
|
+
}>;
|
|
26
|
+
bundle: Uint8Array<ArrayBufferLike>;
|
|
27
|
+
fileOf: (pathname: string) => {
|
|
28
|
+
bytes: Uint8Array<ArrayBufferLike>;
|
|
29
|
+
sha256: string;
|
|
30
|
+
contentType: string;
|
|
31
|
+
immutable: boolean;
|
|
32
|
+
} | null;
|
|
33
|
+
errorPage: {
|
|
34
|
+
bytes: Uint8Array<ArrayBufferLike>;
|
|
35
|
+
sha256: string;
|
|
36
|
+
contentType: string;
|
|
37
|
+
immutable: boolean;
|
|
38
|
+
} | null;
|
|
39
|
+
operations: ({
|
|
40
|
+
name: string;
|
|
41
|
+
returns: "json";
|
|
42
|
+
handle: (input: unknown) => Promise<unknown>;
|
|
43
|
+
} | {
|
|
44
|
+
name: string;
|
|
45
|
+
returns: "bytes";
|
|
46
|
+
handle: (input: unknown) => Promise<Response>;
|
|
47
|
+
})[];
|
|
48
|
+
port: number;
|
|
49
|
+
};
|
|
50
|
+
/** CLI の本体(終了の状態を返す) */
|
|
51
|
+
export declare function runSiteBuildCli([command, ...rest]: readonly string[], env: Env, load?: typeof loadPreview, started?: (running: Preview) => Promise<void>): Promise<number>;
|
|
52
|
+
export {};
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import type { BuildFinding, ReviewedCode } from './artifact.js';
|
|
2
|
+
/** 見つけたものの1行 */
|
|
3
|
+
export declare function findingText({ problem, file, line, detail }: BuildFinding): string;
|
|
4
|
+
export declare const SITE_BUILD_MESSAGES: {
|
|
5
|
+
readonly usage: string;
|
|
6
|
+
readonly noBuild: (file: string) => string;
|
|
7
|
+
readonly invalidBuild: (file: string) => string;
|
|
8
|
+
readonly refused: (count: number) => string;
|
|
9
|
+
readonly reviewed: (list: readonly ReviewedCode[]) => string;
|
|
10
|
+
readonly built: (out: string, digest: string, code: string, files: string) => string;
|
|
11
|
+
readonly noPreview: "手元のプレビューには、別のパッケージ(site-preview)が要る。このパッケージはまだ配布していない(site build は、なくても使える)";
|
|
12
|
+
readonly unsupportedModules: (paths: readonly string[]) => string;
|
|
13
|
+
readonly previewing: (url: string) => string;
|
|
14
|
+
};
|
|
@@ -13,7 +13,7 @@ export declare const TYPES_EXIT_CODES: {
|
|
|
13
13
|
};
|
|
14
14
|
/**
|
|
15
15
|
* 配信 API の型の一覧(/collections、表示名・選択肢・上限・ページの URL の形を含む。実行時に読む値もここから)
|
|
16
|
-
* - 例外: 2xx でなければ `fetch_failed: <状態> <本文>`、本文に
|
|
16
|
+
* - 例外: 2xx でなければ `fetch_failed: <状態> <本文>`、本文に data がなければ `invalid_response`
|
|
17
17
|
* - 接続の失敗は fetcher の例外のまま
|
|
18
18
|
*/
|
|
19
19
|
export declare function fetchDeliveredCollections(url: string, apiKey: string, fetcher?: typeof fetch): Promise<readonly Collection[]>;
|
|
@@ -1,5 +1,4 @@
|
|
|
1
|
-
import { n as typesSourceOf, t as UnknownFieldTypeError } from "./typesSource-
|
|
2
|
-
import { t as DELIVERY_PATH } from "./client-Derrexwr.js";
|
|
1
|
+
import { n as typesSourceOf, t as UnknownFieldTypeError } from "./typesSource-BTA9-rcB.js";
|
|
3
2
|
import { readFileSync, writeFileSync } from "node:fs";
|
|
4
3
|
// src/types.ts
|
|
5
4
|
/**
|
|
@@ -20,7 +19,7 @@ const MESSAGES = {
|
|
|
20
19
|
missingUrl: "missing_url: --url か TUNASAND_DELIVERY_URL に配信 API の URL(例: https://example.com/<プロジェクト>)",
|
|
21
20
|
missingKey: "missing_api_key: 環境変数 TUNASAND_API_KEY",
|
|
22
21
|
fetchFailed: (status, body) => `fetch_failed: ${status} ${body.slice(0, 200)}`,
|
|
23
|
-
invalidResponse: "invalid_response: delivery API /collections response has no
|
|
22
|
+
invalidResponse: "invalid_response: delivery API /collections response has no data",
|
|
24
23
|
unreachable: (url, reason) => `cms_unreachable: ${url} ${reason}`,
|
|
25
24
|
unknownFieldType: (path, type) => `unknown_field_type: ${path} の型 ${type} をこの SDK は生成できない(@tunasand/sdk を上げる)`,
|
|
26
25
|
drift: (file) => `schema_drift: ${file} が CMS のスキーマと違う(tunasand types --out ${file} で生成し直す)`,
|
|
@@ -49,13 +48,13 @@ var TypesResponseError = class extends Error {
|
|
|
49
48
|
};
|
|
50
49
|
/**
|
|
51
50
|
* 配信 API の型の一覧(/collections、表示名・選択肢・上限・ページの URL の形を含む。実行時に読む値もここから)
|
|
52
|
-
* - 例外: 2xx でなければ `fetch_failed: <状態> <本文>`、本文に
|
|
51
|
+
* - 例外: 2xx でなければ `fetch_failed: <状態> <本文>`、本文に data がなければ `invalid_response`
|
|
53
52
|
* - 接続の失敗は fetcher の例外のまま
|
|
54
53
|
*/
|
|
55
54
|
async function fetchDeliveredCollections(url, apiKey, fetcher = fetch) {
|
|
56
|
-
const res = await fetcher(`${url.replace(/\/+$/, "")}
|
|
55
|
+
const res = await fetcher(`${url.replace(/\/+$/, "")}/collections`, { headers: { authorization: `Bearer ${apiKey}` } });
|
|
57
56
|
if (!res.ok) throw new TypesResponseError(MESSAGES.fetchFailed(res.status, await res.text().catch(() => "")), res.status);
|
|
58
|
-
const collections = (await res.json().catch(() => null))?.
|
|
57
|
+
const collections = (await res.json().catch(() => null))?.data;
|
|
59
58
|
if (!Array.isArray(collections)) throw new TypesResponseError(MESSAGES.invalidResponse, res.status);
|
|
60
59
|
return collections;
|
|
61
60
|
}
|
package/dist/types.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export { t as TYPES_EXIT_CODES, n as fetchDeliveredCollections, r as runTypesCli } from "./types-
|
|
1
|
+
export { t as TYPES_EXIT_CODES, n as fetchDeliveredCollections, r as runTypesCli } from "./types-CYnY-63C.js";
|