@tunasand/sdk 0.8.0 → 0.11.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 +121 -0
- package/README.md +162 -143
- package/dist/analytics.js +76 -65
- package/dist/app.js +184 -163
- package/dist/apps-DIxAWBSZ.js +318 -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-Dv4NxGZ7.js +81 -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-nUz1RetA.js +264 -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-B-Dbn64k.js +29 -0
- package/dist/end-users.d.ts +1 -0
- package/dist/end-users.js +185 -0
- package/dist/endUsers-DODfjnv1.js +77 -0
- package/dist/{errorLabels-BgtQ_zUn.js → errorLabels-aT2bnMsO.js} +355 -235
- 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-CrY_72Tn.js} +88 -44
- 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/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-Dcg1ajnW.js} +496 -263
- 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 +10 -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/apiKeys.d.ts +6 -2
- package/dist/types/contract/src/app.d.ts +15 -5
- package/dist/types/contract/src/appChannels.d.ts +114 -0
- package/dist/types/contract/src/appDefinition.d.ts +11 -5
- package/dist/types/contract/src/appDependencies.d.ts +87 -24
- package/dist/types/contract/src/appIdentities.d.ts +21 -0
- package/dist/types/contract/src/appInbound.d.ts +28 -0
- package/dist/types/contract/src/appMail.d.ts +106 -0
- package/dist/types/contract/src/appSecrets.d.ts +45 -0
- package/dist/types/contract/src/appServer.d.ts +408 -43
- package/dist/types/contract/src/approvals.d.ts +1 -1
- package/dist/types/contract/src/apps.d.ts +112 -55
- package/dist/types/contract/src/auditActions.d.ts +2 -2
- package/dist/types/contract/src/auditLabels.d.ts +111 -15
- package/dist/types/contract/src/authorize.d.ts +42 -14
- package/dist/types/contract/src/bridge.d.ts +34 -35
- package/dist/types/contract/src/consents.d.ts +32 -25
- package/dist/types/contract/src/deletion.d.ts +18 -0
- package/dist/types/contract/src/embeds.d.ts +16 -82
- package/dist/types/contract/src/{customerLabels.d.ts → endUserLabels.d.ts} +6 -9
- package/dist/types/contract/src/endUsers.d.ts +241 -0
- package/dist/types/contract/src/errorLabels.d.ts +63 -36
- package/dist/types/contract/src/errorLabelsEn.d.ts +46 -32
- 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 +43 -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 +23 -17
- 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 +52 -27
- package/dist/types/contract/src/integrationGraph.d.ts +83 -0
- package/dist/types/contract/src/issueLabels.d.ts +113 -81
- package/dist/types/contract/src/issueLabelsEn.d.ts +57 -41
- package/dist/types/contract/src/manage.d.ts +11 -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 +38 -0
- package/dist/types/contract/src/operatorOperations.d.ts +0 -63
- 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/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/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 +1 -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 +13 -19
- package/dist/types/contract/src/workspaceItems.d.ts +20 -6
- 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 +138 -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 +22 -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 +18 -10
- 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 +87 -46
- package/dist/types/schema/src/labels/ja.d.ts +89 -45
- 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 +82 -41
- 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 +40 -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 +190 -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-DkO2N7u2.js} +5 -6
- package/dist/types.js +1 -1
- package/dist/{typesSource-CWybQYus.js → typesSource-VJIxtN9b.js} +17 -15
- package/dist/workflow-CUpl6hO_.js +148 -0
- 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
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { Collection } from '../../schema/src/index.js';
|
|
2
|
-
import type { AppManifest,
|
|
2
|
+
import type { AppManifest, AppUi, ConnectionPoint, PermissionTarget } from './apps.js';
|
|
3
3
|
import type { AppSettingDef } from './appDependencies.js';
|
|
4
4
|
import type { TargetMessages } from './errorLabels.js';
|
|
5
5
|
/** 導入先に入れたアプリ(キーはアプリの id、値はアプリの設定値) */
|
|
@@ -60,7 +60,7 @@ export type AppBase = Readonly<{
|
|
|
60
60
|
about: AppAbout;
|
|
61
61
|
messages: TargetMessages;
|
|
62
62
|
emits: Readonly<Record<string, string>>;
|
|
63
|
-
|
|
63
|
+
ui: readonly AppUi[];
|
|
64
64
|
}>;
|
|
65
65
|
/** 組み立てたアプリ(共通の定義と、側ごとの内容) */
|
|
66
66
|
export type AppInstance<P> = AppBase & P;
|
|
@@ -83,10 +83,16 @@ export type McpTool = {
|
|
|
83
83
|
data: unknown;
|
|
84
84
|
}>;
|
|
85
85
|
};
|
|
86
|
-
/**
|
|
86
|
+
/**
|
|
87
|
+
* MCP のツール、プロンプト、案内の文の材料
|
|
88
|
+
* - primary: MCP で書くコレクション、collections: ツールの対象のコレクション(primary と一覧で管理するコレクション)
|
|
89
|
+
* - source: 出典のコレクション(なしは null)
|
|
90
|
+
*/
|
|
87
91
|
export type McpProjectContext = Readonly<{
|
|
88
92
|
projectName: string;
|
|
89
93
|
primary: Collection;
|
|
94
|
+
collections: readonly Collection[];
|
|
95
|
+
source: Collection | null;
|
|
90
96
|
}>;
|
|
91
97
|
/** MCP のプロンプト(name と arguments の名前はクライアントが保存するため変えない) */
|
|
92
98
|
export type McpPrompt = Readonly<{
|
|
@@ -100,9 +106,9 @@ export type McpPrompt = Readonly<{
|
|
|
100
106
|
}>[];
|
|
101
107
|
text: (ctx: McpProjectContext, args: Readonly<Record<string, string>>) => string;
|
|
102
108
|
}>;
|
|
103
|
-
/** MCP の側の内容(instructions は initialize の案内に足す文) */
|
|
109
|
+
/** MCP の側の内容(tools と prompts の名前は appToolPrefixOf の接頭辞で始める、instructions は initialize の案内に足す文) */
|
|
104
110
|
export type McpParts = Readonly<{
|
|
105
|
-
tools?: readonly McpTool[];
|
|
111
|
+
tools?: (ctx: McpProjectContext) => readonly McpTool[];
|
|
106
112
|
prompts?: readonly McpPrompt[];
|
|
107
113
|
instructions?: (ctx: McpProjectContext) => string;
|
|
108
114
|
}>;
|
|
@@ -1,46 +1,76 @@
|
|
|
1
|
-
import { type FieldDef, type SchemaChange } from '../../schema/src/index.js';
|
|
1
|
+
import { type Collection, type FieldDef, type SchemaChange, type UniqueDef } from '../../schema/src/index.js';
|
|
2
2
|
import { z } from 'zod';
|
|
3
|
+
import { type AddressChannel } from './consents.js';
|
|
4
|
+
import { type InfraId } from './ids.js';
|
|
5
|
+
/** コードを持つアプリのうち、登録簿の ID が migration で決まっていて、ほかのアプリの依存先になるもの */
|
|
6
|
+
export declare const BUNDLED_APP_IDS: {
|
|
7
|
+
readonly content: InfraId<"app">;
|
|
8
|
+
};
|
|
9
|
+
/** コードを持つアプリの登録簿の ID(決まっていなければ null) */
|
|
10
|
+
export declare const bundledAppIdOf: (namespace: string) => InfraId<"app"> | null;
|
|
3
11
|
/** ポートの id(`<発行者>:<名前>@<世代>`、例 tunasand:message@1) */
|
|
4
12
|
export type PortId = `${string}:${string}@${number}`;
|
|
5
13
|
/** 設定の値 */
|
|
6
|
-
export type AppSettingValue = boolean | string | number;
|
|
7
|
-
/** アプリの依存(major は依存先の互換の世代、
|
|
14
|
+
export type AppSettingValue = boolean | string | number | readonly string[];
|
|
15
|
+
/** アプリの依存(major は依存先の互換の世代、min_version はその世代の中の下限、なしは世代の最初) */
|
|
8
16
|
export type AppDependency = Readonly<{
|
|
9
17
|
/** 登録簿のアプリの id(kind: 'app' だけ。site・theme は書けない) */
|
|
10
18
|
app: string;
|
|
11
19
|
kind: 'required' | 'optional';
|
|
12
20
|
major: number;
|
|
13
|
-
|
|
21
|
+
min_version?: number;
|
|
14
22
|
/** 一緒に入れたときだけ当てる依存先の設定(拡張パック。導入済みの依存の設定は上書きしない) */
|
|
15
23
|
defaults?: Readonly<Record<string, AppSettingValue>>;
|
|
16
24
|
/** 自分の設定の画面に並べる依存先の設定の key(展開。保存は依存先の設定へ、正は依存先) */
|
|
17
25
|
expose?: readonly string[];
|
|
18
26
|
}>;
|
|
19
|
-
/** ポートの利用(required はプロバイダーが1
|
|
27
|
+
/** ポートの利用(required はプロバイダーが1つもなければインストールできない、capabilities は使う能力) */
|
|
20
28
|
export type PortUse = Readonly<{
|
|
21
29
|
port: PortId;
|
|
22
30
|
required: boolean;
|
|
31
|
+
capabilities?: readonly string[];
|
|
23
32
|
}>;
|
|
24
|
-
/**
|
|
33
|
+
/**
|
|
34
|
+
* ポートの提供(route はコアが人の資格のまま呼ぶアプリの経路。なしはサーバーの側の AppServerParts の provides で受ける)
|
|
35
|
+
* - capabilities: 提供する能力(メッセージのポートの kind など)
|
|
36
|
+
* - consent_channel: メッセージのポートの同意を宛先で確かめるときの宛先の種類(email・sms)。省けば送るチャネルの同意で確かめる
|
|
37
|
+
* (チャネルの種類の宣言が要る)。コアは送信の前にこの同意を確かめる
|
|
38
|
+
*/
|
|
25
39
|
export type PortProvide = Readonly<{
|
|
26
40
|
port: PortId;
|
|
27
|
-
route
|
|
41
|
+
route?: `/api/${string}`;
|
|
42
|
+
capabilities?: readonly string[];
|
|
43
|
+
consent_channel?: AddressChannel;
|
|
28
44
|
}>;
|
|
29
|
-
/**
|
|
45
|
+
/**
|
|
46
|
+
* アプリのコレクション(name はアプリの中の名前でスラッグの既定、形はスラッグと同じ。fields の key は予約の key と `x_` を使えない)
|
|
47
|
+
* - 導入先はインストールで、作るか既存のコレクションに当てるかを選ぶ。当てたコレクションでアプリが読み書きできるのは、同意の操作と宣言したフィールドだけ
|
|
48
|
+
* - existing: 作らずに既存のコレクションに当てる(当てるまでその名前は解けない)
|
|
49
|
+
*/
|
|
30
50
|
export type AppCollection = Readonly<{
|
|
31
51
|
name: string;
|
|
32
52
|
label: string;
|
|
53
|
+
existing?: true;
|
|
33
54
|
/** アプリの内部のレコード(データを消すの対象) */
|
|
34
55
|
internal?: boolean;
|
|
35
56
|
/** 配信しない */
|
|
36
57
|
private?: boolean;
|
|
37
58
|
fields: readonly FieldDef[];
|
|
38
|
-
|
|
39
|
-
|
|
59
|
+
/** 一意の組(fields の key、コレクションの unique と同じ形) */
|
|
60
|
+
unique?: readonly UniqueDef[];
|
|
61
|
+
}> &
|
|
62
|
+
/** 種類と時系列・集計の宣言(コレクションと同じ形、集計はアプリの処理が書くので元のコレクション source を持たない) */
|
|
63
|
+
Pick<Collection, 'kind' | 'time' | 'dimensions' | 'subject' | 'bucket' | 'measures' | 'retention_days'>;
|
|
64
|
+
/**
|
|
65
|
+
* アプリの設定(key はドットで区切ると節の中の項目)
|
|
66
|
+
* - type の collection: 導入先のコレクションの id、空文字は選択なし。collections: コレクションの id の一覧
|
|
67
|
+
* channels: プロジェクトのチャネルの id の一覧(空は全部のチャネル)
|
|
68
|
+
* - requires: 設定を使うのに要る任意の依存のアプリの id、min・unit: number の下限と単位
|
|
69
|
+
*/
|
|
40
70
|
export type AppSettingDef = Readonly<{
|
|
41
71
|
key: string;
|
|
42
72
|
label: string;
|
|
43
|
-
type: 'boolean' | 'text' | 'number' | 'select';
|
|
73
|
+
type: 'boolean' | 'text' | 'number' | 'select' | 'collection' | 'collections' | 'channels';
|
|
44
74
|
options?: readonly string[];
|
|
45
75
|
default?: AppSettingValue;
|
|
46
76
|
requires?: string;
|
|
@@ -86,24 +116,59 @@ export declare const appDependencyManifestSchema: z.ZodObject<{
|
|
|
86
116
|
required: "required";
|
|
87
117
|
}>;
|
|
88
118
|
major: z.ZodNumber;
|
|
89
|
-
|
|
90
|
-
defaults: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnion<readonly [z.ZodBoolean, z.ZodString, z.ZodNumber]>>>;
|
|
119
|
+
min_version: z.ZodOptional<z.ZodNumber>;
|
|
120
|
+
defaults: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnion<readonly [z.ZodBoolean, z.ZodString, z.ZodNumber, z.ZodArray<z.ZodString>]>>>;
|
|
91
121
|
expose: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
92
122
|
}, z.core.$strict>>>;
|
|
93
123
|
uses: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
94
124
|
port: z.ZodString;
|
|
95
125
|
required: z.ZodBoolean;
|
|
126
|
+
capabilities: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
96
127
|
}, z.core.$strict>>>;
|
|
97
128
|
provides: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
98
129
|
port: z.ZodString;
|
|
99
|
-
route: z.ZodString
|
|
130
|
+
route: z.ZodOptional<z.ZodString>;
|
|
131
|
+
capabilities: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
132
|
+
consent_channel: z.ZodOptional<z.ZodEnum<{
|
|
133
|
+
email: "email";
|
|
134
|
+
sms: "sms";
|
|
135
|
+
}>>;
|
|
100
136
|
}, z.core.$strict>>>;
|
|
101
137
|
collections: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
102
138
|
name: z.ZodString;
|
|
103
139
|
label: z.ZodString;
|
|
140
|
+
existing: z.ZodOptional<z.ZodLiteral<true>>;
|
|
104
141
|
internal: z.ZodOptional<z.ZodBoolean>;
|
|
105
142
|
private: z.ZodOptional<z.ZodBoolean>;
|
|
106
143
|
fields: z.ZodArray<z.ZodType<unknown, unknown, z.core.$ZodTypeInternals<unknown, unknown>>>;
|
|
144
|
+
unique: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
145
|
+
key: z.ZodString;
|
|
146
|
+
fields: z.ZodArray<z.ZodString>;
|
|
147
|
+
exact: z.ZodOptional<z.ZodBoolean>;
|
|
148
|
+
}, z.core.$strict>>>;
|
|
149
|
+
kind: z.ZodOptional<z.ZodEnum<{
|
|
150
|
+
standard: "standard";
|
|
151
|
+
timeseries: "timeseries";
|
|
152
|
+
aggregate: "aggregate";
|
|
153
|
+
}>>;
|
|
154
|
+
time: z.ZodOptional<z.ZodString>;
|
|
155
|
+
dimensions: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
156
|
+
subject: z.ZodOptional<z.ZodString>;
|
|
157
|
+
bucket: z.ZodOptional<z.ZodEnum<{
|
|
158
|
+
hour: "hour";
|
|
159
|
+
day: "day";
|
|
160
|
+
month: "month";
|
|
161
|
+
}>>;
|
|
162
|
+
measures: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
163
|
+
field: z.ZodString;
|
|
164
|
+
op: z.ZodEnum<{
|
|
165
|
+
count: "count";
|
|
166
|
+
min: "min";
|
|
167
|
+
max: "max";
|
|
168
|
+
sum: "sum";
|
|
169
|
+
}>;
|
|
170
|
+
}, z.core.$strict>>>;
|
|
171
|
+
retention_days: z.ZodOptional<z.ZodNumber>;
|
|
107
172
|
}, z.core.$strict>>>;
|
|
108
173
|
settings: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
109
174
|
key: z.ZodString;
|
|
@@ -113,9 +178,12 @@ export declare const appDependencyManifestSchema: z.ZodObject<{
|
|
|
113
178
|
boolean: "boolean";
|
|
114
179
|
text: "text";
|
|
115
180
|
select: "select";
|
|
181
|
+
collection: "collection";
|
|
182
|
+
collections: "collections";
|
|
183
|
+
channels: "channels";
|
|
116
184
|
}>;
|
|
117
185
|
options: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
118
|
-
default: z.ZodOptional<z.ZodUnion<readonly [z.ZodBoolean, z.ZodString, z.ZodNumber]>>;
|
|
186
|
+
default: z.ZodOptional<z.ZodUnion<readonly [z.ZodBoolean, z.ZodString, z.ZodNumber, z.ZodArray<z.ZodString>]>>;
|
|
119
187
|
requires: z.ZodOptional<z.ZodString>;
|
|
120
188
|
min: z.ZodOptional<z.ZodNumber>;
|
|
121
189
|
unit: z.ZodOptional<z.ZodString>;
|
|
@@ -152,11 +220,6 @@ export type DependencyTarget = Readonly<{
|
|
|
152
220
|
export declare function dependencyTargetProblems(manifest: AppDependencyManifest, self: string | null, targets: ReadonlyMap<string, DependencyTarget>): AppDependencyProblem[];
|
|
153
221
|
/** マニフェストの世代(major を書かない旧いマニフェストは1) */
|
|
154
222
|
export declare const appMajorOf: (manifest: AppDependencyManifest) => number;
|
|
155
|
-
/**
|
|
156
|
-
* アプリのコレクションの名前から導入先のコレクションの id(M3 の installation_collections までの結び付き)
|
|
157
|
-
* - 名前空間を持つアプリだけがコレクションを持てる(登録簿の名前空間は一意で再利用されない)
|
|
158
|
-
*/
|
|
159
|
-
export declare const appCollectionIdOf: (namespace: string, name: string) => string;
|
|
160
223
|
/** 版の互換の外れ(path は値の場所、change はコレクションの互換のない変更) */
|
|
161
224
|
export type IncompatibleChange = Readonly<{
|
|
162
225
|
path: string;
|
|
@@ -188,12 +251,12 @@ export type PlanNode = Readonly<{
|
|
|
188
251
|
reason: PlanReason;
|
|
189
252
|
/** 増える能力(install は全部、upgrade は前の同意にない分、keep は空) */
|
|
190
253
|
capabilities: readonly string[];
|
|
191
|
-
/**
|
|
254
|
+
/** インストールが足すコレクションとフィールドのスキーマの変更(まだ払い出していない id は仮の値) */
|
|
192
255
|
schemaChanges: readonly SchemaChange[];
|
|
193
256
|
/** マニフェストの名前 → スラッグ(ぶつかれば候補、導入先が画面で直せる) */
|
|
194
257
|
slugs: Readonly<Record<string, string>>;
|
|
195
|
-
/** マニフェストの名前 →
|
|
196
|
-
|
|
258
|
+
/** マニフェストの名前 → 当てる既存のコレクションの id(足りないフィールドは schemaChanges が足す) */
|
|
259
|
+
mapped: Readonly<Record<string, string>>;
|
|
197
260
|
/** 一緒に入れるときに当てる設定(依存元の defaults) */
|
|
198
261
|
defaults: Readonly<Record<string, AppSettingValue>>;
|
|
199
262
|
price: AppPrice | null;
|
|
@@ -243,7 +306,7 @@ export type PlanConflict = Readonly<{
|
|
|
243
306
|
port: string;
|
|
244
307
|
by: string;
|
|
245
308
|
}> | Readonly<{
|
|
246
|
-
kind: '
|
|
309
|
+
kind: 'collections';
|
|
247
310
|
app: string;
|
|
248
311
|
}> | Readonly<{
|
|
249
312
|
kind: 'slug';
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { type EndUserIdTokenAlgorithm } from './endUsers.js';
|
|
2
|
+
/**
|
|
3
|
+
* 発行者の宣言
|
|
4
|
+
* - issuer: ID トークンの iss(https)、jwks_url: 公開鍵の一覧の URL(https)、algorithms: 署名の方式
|
|
5
|
+
* - audience_setting: audience を入れるチャネルの設定のキー(type text。値が空のあいだは登録しない)
|
|
6
|
+
*/
|
|
7
|
+
export type AppIdentityDeclaration = Readonly<{
|
|
8
|
+
issuer: string;
|
|
9
|
+
jwks_url: string;
|
|
10
|
+
algorithms: readonly EndUserIdTokenAlgorithm[];
|
|
11
|
+
audience_setting: string;
|
|
12
|
+
}>;
|
|
13
|
+
/** 宣言の上限(件数、URL の字数) */
|
|
14
|
+
export declare const APP_IDENTITY_LIMITS: {
|
|
15
|
+
readonly entriesMax: 4;
|
|
16
|
+
readonly urlMaxChars: 500;
|
|
17
|
+
};
|
|
18
|
+
/** 登録した発行者の id(設定の発行者の id の形と重ならない) */
|
|
19
|
+
export declare const appProviderId: (channelId: string, issuer: string) => string;
|
|
20
|
+
/** チャネルの種類の identities の誤りの箇所(audience_setting は種類の settings で宣言した text のキーでなければならない) */
|
|
21
|
+
export declare function appIdentitiesProblems(identities: unknown, settings: unknown): string[];
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
/** 受ける経路の宣言(name は経路の最後の区間) */
|
|
2
|
+
export type AppInboundDeclaration = Readonly<{
|
|
3
|
+
name: string;
|
|
4
|
+
}>;
|
|
5
|
+
/** 経路の名前の形 */
|
|
6
|
+
export declare const APP_INBOUND_NAME: RegExp;
|
|
7
|
+
/** 受信の経路(配信 API の基点からのパス) */
|
|
8
|
+
export declare const appInboundPathOf: (channelId: string, name: string) => string;
|
|
9
|
+
/** チャネルと宣言ごとの受信の URL(url は配信 API の公開の基点がなければ null) */
|
|
10
|
+
export type AppInboundUrl = Readonly<{
|
|
11
|
+
channelId: string;
|
|
12
|
+
channelName: string;
|
|
13
|
+
name: string;
|
|
14
|
+
url: string | null;
|
|
15
|
+
}>;
|
|
16
|
+
/** 上限(宣言の数、本文のバイト数) */
|
|
17
|
+
export declare const APP_INBOUND_LIMITS: {
|
|
18
|
+
readonly entriesMax: 8;
|
|
19
|
+
readonly bodyMaxBytes: 1048576;
|
|
20
|
+
};
|
|
21
|
+
/** 受けた要求(channelId は受けたチャネル、body はパースの前の本文) */
|
|
22
|
+
export type AppInboundRequest = Readonly<{
|
|
23
|
+
channelId: string;
|
|
24
|
+
body: Uint8Array;
|
|
25
|
+
headers: Headers;
|
|
26
|
+
}>;
|
|
27
|
+
/** マニフェストのチャネルの種類の inbound の誤りの箇所(種類の宣言の中の道) */
|
|
28
|
+
export declare function appInboundProblems(inbound: unknown): string[];
|
|
@@ -0,0 +1,106 @@
|
|
|
1
|
+
import type { AppPortResult, AppScope } from './appServer.js';
|
|
2
|
+
/** マニフェストのメールの宣言 */
|
|
3
|
+
export type AppMailDeclaration = Readonly<{
|
|
4
|
+
send?: boolean;
|
|
5
|
+
inbound?: boolean;
|
|
6
|
+
}>;
|
|
7
|
+
/** 能力の要素(送信、受信) */
|
|
8
|
+
export declare const MAIL_CAPABILITIES: {
|
|
9
|
+
readonly send: "mail:send";
|
|
10
|
+
readonly inbound: "mail:inbound";
|
|
11
|
+
};
|
|
12
|
+
/** マニフェストの mail の誤りの箇所 */
|
|
13
|
+
export declare function appMailProblems(mail: unknown): string[];
|
|
14
|
+
/** マニフェストの mail の能力の要素 */
|
|
15
|
+
export declare const mailCapabilitiesOf: (mail: AppMailDeclaration | undefined) => string[];
|
|
16
|
+
/** 認証の結果(RFC 8601の結果の語) */
|
|
17
|
+
export declare const MAIL_AUTH_RESULTS: readonly ["pass", "fail", "softfail", "neutral", "none", "temperror", "permerror", "policy"];
|
|
18
|
+
export type MailAuthResult = (typeof MAIL_AUTH_RESULTS)[number];
|
|
19
|
+
/** 受信の基盤が評価した認証の結果(dkim は署名ごとの d= のドメインと結果) */
|
|
20
|
+
export type MailAuthentication = Readonly<{
|
|
21
|
+
spf: MailAuthResult;
|
|
22
|
+
dkim: readonly Readonly<{
|
|
23
|
+
domain: string;
|
|
24
|
+
result: MailAuthResult;
|
|
25
|
+
}>[];
|
|
26
|
+
dmarc: MailAuthResult;
|
|
27
|
+
arc: MailAuthResult;
|
|
28
|
+
}>;
|
|
29
|
+
/**
|
|
30
|
+
* メールの送信の依頼(テキストだけ)
|
|
31
|
+
* - from: 差出人、replyTo: 返信先(どちらもドメインはプロジェクトの検証済みのドメイン)
|
|
32
|
+
* - inReplyTo、references: 返信の元の Message-ID と、スレッドの Message-ID の連なり(山括弧つき)
|
|
33
|
+
* - purpose: 同意の目的(宛先の抑止の一覧と同意をコアが確かめる)、key: 依頼を見分ける鍵(ログに残す。重複を除くのは呼ぶアプリ)
|
|
34
|
+
*/
|
|
35
|
+
export type AppMailSendRequest = Readonly<{
|
|
36
|
+
to: string;
|
|
37
|
+
from: Readonly<{
|
|
38
|
+
address: string;
|
|
39
|
+
name?: string;
|
|
40
|
+
}>;
|
|
41
|
+
replyTo?: string;
|
|
42
|
+
subject: string;
|
|
43
|
+
text: string;
|
|
44
|
+
inReplyTo?: string;
|
|
45
|
+
references?: readonly string[];
|
|
46
|
+
purpose: string;
|
|
47
|
+
key: string;
|
|
48
|
+
}>;
|
|
49
|
+
/**
|
|
50
|
+
* 送らなかった理由
|
|
51
|
+
* - suppressed: 抑止の一覧、no_consent: 同意の目的で送れない
|
|
52
|
+
* - domain_unverified: 差出人のドメインが検証されていない、test_environment: live 以外の環境
|
|
53
|
+
*/
|
|
54
|
+
export declare const APP_MAIL_SKIP_REASONS: readonly ["suppressed", "no_consent", "domain_unverified", "test_environment"];
|
|
55
|
+
export type AppMailSkipReason = (typeof APP_MAIL_SKIP_REASONS)[number];
|
|
56
|
+
/**
|
|
57
|
+
* 送信の結果(基盤の一時的な失敗は例外)
|
|
58
|
+
* - sent: messageId は送ったメールの Message-ID(山括弧つき、基盤が返さなければ null)
|
|
59
|
+
* - rejected: 依頼の形の誤り(path は誤りの位置)
|
|
60
|
+
*/
|
|
61
|
+
export type AppMailSendResult = Readonly<{
|
|
62
|
+
status: 'sent';
|
|
63
|
+
messageId: string | null;
|
|
64
|
+
}> | Readonly<{
|
|
65
|
+
status: 'skipped';
|
|
66
|
+
reason: AppMailSkipReason;
|
|
67
|
+
}> | Readonly<{
|
|
68
|
+
status: 'rejected';
|
|
69
|
+
path: string;
|
|
70
|
+
}>;
|
|
71
|
+
/** プロジェクトのドメイン(送信と受信に使う。records は DNS に置くレコード) */
|
|
72
|
+
export type AppMailDomain = Readonly<{
|
|
73
|
+
domain: string;
|
|
74
|
+
status: 'pending' | 'verified' | 'failed';
|
|
75
|
+
records: readonly Readonly<{
|
|
76
|
+
purpose: string;
|
|
77
|
+
type: string;
|
|
78
|
+
name: string;
|
|
79
|
+
value: string;
|
|
80
|
+
priority?: number;
|
|
81
|
+
}>[];
|
|
82
|
+
}>;
|
|
83
|
+
/**
|
|
84
|
+
* 受けたメール
|
|
85
|
+
* - channelId: 受けたチャネル(アプリのチャネルで、受信の能力を持つ)
|
|
86
|
+
* - recipient: 受けた宛先、tag: 宛先のローカル部の `+` の後ろ(なければ null。返信先にスレッドの ID を載せる用途)
|
|
87
|
+
* - envelopeFrom: 封筒の送り主(不達の通知は空)、raw: 生のメッセージ、auth: 受信の基盤が評価した認証の結果
|
|
88
|
+
*/
|
|
89
|
+
export type AppInboundMail = Readonly<{
|
|
90
|
+
channelId: string;
|
|
91
|
+
recipient: string;
|
|
92
|
+
tag: string | null;
|
|
93
|
+
envelopeFrom: string;
|
|
94
|
+
raw: Uint8Array;
|
|
95
|
+
auth: MailAuthentication;
|
|
96
|
+
}>;
|
|
97
|
+
/**
|
|
98
|
+
* メールの口(マニフェストの mail の宣言の範囲だけ。宣言がなければ app_mail_undeclared の UsageError)
|
|
99
|
+
* - send: 送信(mail.send)。コアの関門を通し、例外にしない結果で返す。送信のモードを決められない実行は unavailable(送り直す)
|
|
100
|
+
* - domains: プロジェクトのドメインと検証の状態(mail.send か mail.inbound)
|
|
101
|
+
* - 送信の部品のない配置は not_configured
|
|
102
|
+
*/
|
|
103
|
+
export type AppMailPort = Readonly<{
|
|
104
|
+
send: (scope: AppScope, request: AppMailSendRequest) => Promise<AppPortResult<AppMailSendResult>>;
|
|
105
|
+
domains: (scope: AppScope) => Promise<AppPortResult<readonly AppMailDomain[]>>;
|
|
106
|
+
}>;
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
/** 秘密値の宣言(key は outbound の auth.secret で指す名前) */
|
|
2
|
+
export type AppSecretDeclaration = Readonly<{
|
|
3
|
+
key: string;
|
|
4
|
+
label: string;
|
|
5
|
+
}>;
|
|
6
|
+
/** 入力した秘密値の状態(tail は末尾、値が短ければ null) */
|
|
7
|
+
export type AppSecretState = Readonly<{
|
|
8
|
+
key: string;
|
|
9
|
+
label: string;
|
|
10
|
+
configured: boolean;
|
|
11
|
+
tail: string | null;
|
|
12
|
+
updatedAt: string | null;
|
|
13
|
+
}>;
|
|
14
|
+
/** 秘密値の上限(値の字数、末尾の字数、末尾を返す値の最小の字数) */
|
|
15
|
+
export declare const APP_SECRET_LIMITS: {
|
|
16
|
+
readonly valueMaxChars: 4096;
|
|
17
|
+
readonly tailChars: 4;
|
|
18
|
+
readonly tailMinChars: 8;
|
|
19
|
+
};
|
|
20
|
+
/** 秘密値のキーの形 */
|
|
21
|
+
export declare const APP_SECRET_KEY: RegExp;
|
|
22
|
+
/** 署名の検証のハッシュと、署名の表記 */
|
|
23
|
+
export declare const APP_HMAC_HASHES: readonly ["SHA-256", "SHA-512"];
|
|
24
|
+
export type AppHmacHash = (typeof APP_HMAC_HASHES)[number];
|
|
25
|
+
export declare const APP_SIGNATURE_ENCODINGS: readonly ["base64", "hex"];
|
|
26
|
+
export type AppSignatureEncoding = (typeof APP_SIGNATURE_ENCODINGS)[number];
|
|
27
|
+
/** 署名の検証の指定(body はパースの前の本文、signature は表記 encoding の署名。既定は SHA-256 と base64) */
|
|
28
|
+
export type AppHmacCheck = Readonly<{
|
|
29
|
+
body: string | Uint8Array;
|
|
30
|
+
signature: string;
|
|
31
|
+
hash?: AppHmacHash;
|
|
32
|
+
encoding?: AppSignatureEncoding;
|
|
33
|
+
}>;
|
|
34
|
+
/** 画面と API に出す末尾(値が tailMinChars 未満なら null) */
|
|
35
|
+
export declare const secretTailOf: (value: string) => string | null;
|
|
36
|
+
/** 宣言の上限(件数、見出しの字数) */
|
|
37
|
+
export declare const APP_SECRET_DECLARATION_LIMITS: {
|
|
38
|
+
readonly entriesMax: 20;
|
|
39
|
+
readonly labelMaxChars: 80;
|
|
40
|
+
};
|
|
41
|
+
/**
|
|
42
|
+
* マニフェストの secrets と、outbound の auth が指す秘密値の誤りの箇所(マニフェストの道)
|
|
43
|
+
* - outbound の auth.secret は secrets で宣言したキーか、channelKeys(チャネルの種類の秘密値のキー)でなければならない
|
|
44
|
+
*/
|
|
45
|
+
export declare function appSecretsProblems(secrets: unknown, outbound: unknown, channelKeys?: readonly string[]): string[];
|