@andpipes/cli 0.1.3 → 0.1.5
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/dist/bin.cjs +1794 -1046
- package/dist/bin.js +1 -1
- package/dist/{chunk-6LTYTSZX.js → chunk-2PG5NEI2.js} +1852 -1072
- package/dist/index.cjs +1806 -1046
- package/dist/index.d.cts +170 -13
- package/dist/index.d.ts +170 -13
- package/dist/index.js +13 -1
- package/package.json +4 -4
package/dist/index.d.cts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { SupportedLocale, CliDevWorkflowMessages, CliInitWorkflowMessages, CliPublishWorkflowMessages } from '@andpipes/localization';
|
|
1
|
+
import { SupportedLocale, CliDevWorkflowMessages, CliInitWorkflowMessages, CliOAuthScopeRegistrationMessages, CliPublishWorkflowMessages, CliPublicationSchemaReviewMessages } from '@andpipes/localization';
|
|
2
2
|
import { Command } from 'commander';
|
|
3
|
-
import { ValidateReport, PublishGateResult, OpenApiImportUpstreamAuthMode, OpenApiImportOperationRiskOverride, OnboardingTemplateOperation, OnboardingTemplateSafeDiffEntry, ExternalSaasTemplateV1, OnboardingTemplateBindings } from '@andpipes/tool-contract';
|
|
3
|
+
import { ValidateReport, PublishGateResult, OpenApiImportUpstreamAuthMode, OpenApiImportOperationRiskOverride, OnboardingTemplateOperation, OnboardingTemplateSafeDiffEntry, ExternalSaasTemplateV1, OnboardingTemplateBindings, OAuthScopeRegistrationResponse, OAuthScopeRegistrationErrorReason } from '@andpipes/tool-contract';
|
|
4
4
|
export { CheckResult, CheckStatus, RISK_LEVELS, RiskLevel, ValidateReport, validateContract } from '@andpipes/tool-contract';
|
|
5
5
|
|
|
6
6
|
/**
|
|
@@ -525,12 +525,40 @@ type NormalizedInitMode = {
|
|
|
525
525
|
readonly yes: boolean;
|
|
526
526
|
};
|
|
527
527
|
declare function normalizeInitOptions(options: InitCommandOptions, messages?: CliInitWorkflowMessages): NormalizedInitMode;
|
|
528
|
-
declare function runInitCommand(options: InitCommandOptions, writer: Writer, cwd: string, runtime: InitCommandRuntime, messages?: CliInitWorkflowMessages): Promise<void>;
|
|
528
|
+
declare function runInitCommand(options: InitCommandOptions, writer: Writer, cwd: string, runtime: InitCommandRuntime, messages?: CliInitWorkflowMessages, scopeRegistrationMessages?: CliOAuthScopeRegistrationMessages): Promise<void>;
|
|
529
529
|
/** CLI登録。production backend adapterはfactoryとして注入し、unit testは実networkを使わない。 */
|
|
530
|
-
declare function registerInit(program: Command, writer: Writer, cwd: () => string, createClient: InitApiFactory, description?: string, runtime?: InitCommandRuntime | undefined, messages?: CliInitWorkflowMessages): void;
|
|
530
|
+
declare function registerInit(program: Command, writer: Writer, cwd: () => string, createClient: InitApiFactory, description?: string, runtime?: InitCommandRuntime | undefined, messages?: CliInitWorkflowMessages, scopeRegistrationMessages?: CliOAuthScopeRegistrationMessages): void;
|
|
531
531
|
|
|
532
|
-
/**
|
|
533
|
-
|
|
532
|
+
/**
|
|
533
|
+
* Publication review profile 2(#730 / ADR-730 §6.2・§6.7)のCLI側transport契約。
|
|
534
|
+
*
|
|
535
|
+
* - CLIはplan / 初回apply / 最終applyへ`Andpipe-Publication-Review-Profile: 2`(扱える最大profile)を送る。
|
|
536
|
+
* - plan応答のheaderはcommand層がexactに検査する。transportは生値(無ければnull)だけを返し、表示しない。
|
|
537
|
+
* - server error detailsの`reason`は、固定allowlistとAP codeの組が一致した場合だけ保持する。
|
|
538
|
+
* server message・未知details・未知reasonはCLIの表示へ転載しない。
|
|
539
|
+
*/
|
|
540
|
+
/** CLI 0.1.5が扱える最大のreview profile。plan / 初回apply / 最終applyのrequest headerへ送る。 */
|
|
541
|
+
declare const CLI_PUBLICATION_REVIEW_PROFILE: 2;
|
|
542
|
+
/** plan / 初回apply / 最終applyへreview profileのrequest headerを付けるときのoption。 */
|
|
543
|
+
interface PublicationReviewProfileRequestOptions {
|
|
544
|
+
readonly reviewProfile: typeof CLI_PUBLICATION_REVIEW_PROFILE;
|
|
545
|
+
}
|
|
546
|
+
/**
|
|
547
|
+
* review profile headerを付けたplanのtransport応答。bodyはexact parse前の値。
|
|
548
|
+
* `reviewProfileHeader`はresponse headerの生値(無ければnull)で、command層が`1` / `2`だけを受理する。
|
|
549
|
+
*/
|
|
550
|
+
interface PublicationPlanTransportResponse {
|
|
551
|
+
readonly body: unknown;
|
|
552
|
+
readonly reviewProfileHeader: string | null;
|
|
553
|
+
}
|
|
554
|
+
/** server error detailsから保持してよいpublication reasonと、そのreasonを返すAP code。 */
|
|
555
|
+
declare const PUBLICATION_ERROR_REASON_CODES: Readonly<{
|
|
556
|
+
readonly publication_plan_stale: "AP_CONFLICT";
|
|
557
|
+
readonly publication_review_profile_invalid: "AP_INPUT_INVALID";
|
|
558
|
+
readonly publication_schema_review_too_large: "AP_INPUT_INVALID";
|
|
559
|
+
readonly schema_review_receipt_mismatch: "AP_CONFLICT";
|
|
560
|
+
}>;
|
|
561
|
+
type PublicationErrorReason = keyof typeof PUBLICATION_ERROR_REASON_CODES;
|
|
534
562
|
|
|
535
563
|
/** Admin bearer credential を送信してよい唯一の production origin。 */
|
|
536
564
|
declare const ADMIN_API_ORIGIN = "https://api.andpipe.com";
|
|
@@ -541,6 +569,19 @@ declare const ADMIN_API_PUBLICATION_RESPONSE_MAX_BYTES: number;
|
|
|
541
569
|
declare const ADMIN_API_OPENAPI_IMPORT_MAX_BYTES: number;
|
|
542
570
|
declare const ADMIN_API_ONBOARDING_TEMPLATE_MAX_BYTES: number;
|
|
543
571
|
declare const ADMIN_API_MAX_GET_ATTEMPTS = 3;
|
|
572
|
+
/**
|
|
573
|
+
* `scopes:register` のrequest上限 (#729 / ADR-729 §3.1)。serverの
|
|
574
|
+
* `OAUTH_SCOPE_REGISTRATION_REQUEST_MAX_BYTES = TOOL_PUBLICATION_REQUEST_MAX_BYTES + 8 KiB` と同じ。
|
|
575
|
+
*/
|
|
576
|
+
declare const ADMIN_API_OAUTH_SCOPE_REGISTRATION_REQUEST_MAX_BYTES: number;
|
|
577
|
+
/**
|
|
578
|
+
* `scopes:register` のresponse上限(仮)。serverは上限を持たず、最大25 draft・512 toolのscope一覧を
|
|
579
|
+
* 返し得るため、publication plan(96 KiB)より広い1 MiBで打ち切る。成功後の過大応答を誤って
|
|
580
|
+
* 未確定扱いにしないための余裕であり、仕様上の上限ではない。
|
|
581
|
+
*/
|
|
582
|
+
declare const ADMIN_API_OAUTH_SCOPE_REGISTRATION_RESPONSE_MAX_BYTES: number;
|
|
583
|
+
/** applyの曖昧な失敗だけ、同じIdempotency-Keyとbodyで再送する総試行回数(publishと同じ)。 */
|
|
584
|
+
declare const ADMIN_API_OAUTH_SCOPE_REGISTRATION_MAX_APPLY_ATTEMPTS = 3;
|
|
544
585
|
type JsonObject = Record<string, unknown>;
|
|
545
586
|
type AdminFetch = (input: string | URL, init?: RequestInit) => Promise<Response>;
|
|
546
587
|
type AdminSleep = (milliseconds: number) => Promise<void>;
|
|
@@ -549,12 +590,31 @@ interface OpenApiImportAuthModeMismatch {
|
|
|
549
590
|
readonly connectorAuthMode: "token_exchange" | "service_account" | "existing_oauth" | "signed_request";
|
|
550
591
|
readonly requestedAuthMode: OpenApiImportUpstreamAuthMode;
|
|
551
592
|
}
|
|
593
|
+
/**
|
|
594
|
+
* server error detailsから取り出してよい安全な値だけ (#729)。server message・未知detailsは保持しない。
|
|
595
|
+
*/
|
|
596
|
+
interface AdminApiClientErrorSafeDetails {
|
|
597
|
+
/** `error.details` がnull/欠落だったか。旧Admin APIのroute未対応判定だけに使い、内容は保持しない。 */
|
|
598
|
+
readonly detailsAbsent?: boolean;
|
|
599
|
+
/** `details.reason` がOAuth scope登録のallowlistに一致した場合だけ保持する固定code。 */
|
|
600
|
+
readonly scopeRegistrationReason?: OAuthScopeRegistrationErrorReason;
|
|
601
|
+
/** publish gate失敗 (`scope_registration_publish_gate_failed`) の厳格検証済みtool名。 */
|
|
602
|
+
readonly publishGateToolNames?: readonly string[];
|
|
603
|
+
/**
|
|
604
|
+
* tool publication (#730) の`details.reason`が固定allowlistとAP codeの組に一致した場合だけ保持する固定code。
|
|
605
|
+
*/
|
|
606
|
+
readonly publicationReason?: PublicationErrorReason;
|
|
607
|
+
}
|
|
552
608
|
declare class AdminApiClientError extends Error {
|
|
553
609
|
readonly code: string;
|
|
554
610
|
readonly status: number | undefined;
|
|
555
611
|
readonly confirmationRequired: PublicationConfirmationRequiredDetails | undefined;
|
|
556
612
|
readonly openApiAuthModeMismatch: OpenApiImportAuthModeMismatch | undefined;
|
|
557
|
-
|
|
613
|
+
readonly detailsAbsent: boolean;
|
|
614
|
+
readonly scopeRegistrationReason: OAuthScopeRegistrationErrorReason | undefined;
|
|
615
|
+
readonly publishGateToolNames: readonly string[] | undefined;
|
|
616
|
+
readonly publicationReason: PublicationErrorReason | undefined;
|
|
617
|
+
constructor(code: string, message: string, status?: number, confirmationRequired?: PublicationConfirmationRequiredDetails, openApiAuthModeMismatch?: OpenApiImportAuthModeMismatch, safeDetails?: AdminApiClientErrorSafeDetails);
|
|
558
618
|
}
|
|
559
619
|
declare function assertProjectId(projectId: string): string;
|
|
560
620
|
declare function assertResourceId(value: string, option: string): string;
|
|
@@ -613,6 +673,10 @@ interface AdminPublicationApplyRequest extends AdminPublicationPlanRequest {
|
|
|
613
673
|
readonly planCommitment: string;
|
|
614
674
|
readonly confirmation: AdminPublicationConfirmation | null;
|
|
615
675
|
}
|
|
676
|
+
/** plan / 初回apply / 最終applyへ`Andpipe-Publication-Review-Profile: 2`を送るoption (#730)。 */
|
|
677
|
+
type AdminPublicationReviewProfileOptions = PublicationReviewProfileRequestOptions;
|
|
678
|
+
/** review profile header付きplanの応答。headerの値はcommand層がexactに検査する (#730)。 */
|
|
679
|
+
type AdminPublicationPlanResponse = PublicationPlanTransportResponse;
|
|
616
680
|
interface OpenApiImportRequest {
|
|
617
681
|
readonly source: string;
|
|
618
682
|
readonly connectorId: string;
|
|
@@ -803,6 +867,38 @@ type OAuthClientScopeMapRequest = {
|
|
|
803
867
|
readonly planCommitment: `sha256:${string}`;
|
|
804
868
|
readonly idempotencyKey?: string;
|
|
805
869
|
};
|
|
870
|
+
/** 保存済みdraftの指定。canonical小文字UUIDで、toolIdのcode point昇順・重複なしで渡す。 */
|
|
871
|
+
interface OAuthScopeRegistrationSavedDraft {
|
|
872
|
+
readonly toolId: string;
|
|
873
|
+
readonly versionId: string;
|
|
874
|
+
}
|
|
875
|
+
/**
|
|
876
|
+
* `scopes:register` のsource (#729 / ADR-729 §3.1)。publication_candidateは
|
|
877
|
+
* `tool-publications:plan` へ送るのと同じcandidateとcommitmentを渡す。
|
|
878
|
+
*/
|
|
879
|
+
type OAuthScopeRegistrationSourceInput = {
|
|
880
|
+
readonly kind: "saved_drafts";
|
|
881
|
+
readonly drafts: readonly OAuthScopeRegistrationSavedDraft[];
|
|
882
|
+
} | {
|
|
883
|
+
readonly kind: "publication_candidate";
|
|
884
|
+
readonly connectorId: string;
|
|
885
|
+
readonly candidateContract: unknown;
|
|
886
|
+
readonly candidateCommitment: string;
|
|
887
|
+
};
|
|
888
|
+
type OAuthScopeRegistrationRequest = {
|
|
889
|
+
readonly projectId: string;
|
|
890
|
+
readonly source: OAuthScopeRegistrationSourceInput;
|
|
891
|
+
readonly apply: false;
|
|
892
|
+
} | {
|
|
893
|
+
readonly projectId: string;
|
|
894
|
+
readonly source: OAuthScopeRegistrationSourceInput;
|
|
895
|
+
readonly apply: true;
|
|
896
|
+
readonly sourceCommitment: string;
|
|
897
|
+
readonly baseRegistryCommitment: string;
|
|
898
|
+
readonly planCommitment: string;
|
|
899
|
+
/** 呼出側が実行ごとに1つ生成し、曖昧な失敗の再送でも同じ値を使う。 */
|
|
900
|
+
readonly idempotencyKey: string;
|
|
901
|
+
};
|
|
806
902
|
interface OAuthTestLoginCheck {
|
|
807
903
|
readonly id: OAuthTestLoginCheckId;
|
|
808
904
|
readonly status: "pass" | "fail" | "deferred";
|
|
@@ -986,8 +1082,18 @@ declare class AdminApiClient {
|
|
|
986
1082
|
readonly config: Readonly<Record<string, unknown>> | null;
|
|
987
1083
|
readonly status: "active" | "disabled";
|
|
988
1084
|
}>;
|
|
1085
|
+
/**
|
|
1086
|
+
* `tool-publications:plan`。optionsなしは従来どおりheaderを送らずbodyだけを返す(v1)。
|
|
1087
|
+
* options付き (#730) は`Andpipe-Publication-Review-Profile`を送り、bodyとresponse headerの生値を返す。
|
|
1088
|
+
* request bodyはどちらもbyte単位で同じにする。
|
|
1089
|
+
*/
|
|
989
1090
|
planPublication(projectId: string, body: AdminPublicationPlanRequest): Promise<unknown>;
|
|
990
|
-
|
|
1091
|
+
planPublication(projectId: string, body: AdminPublicationPlanRequest, options: AdminPublicationReviewProfileOptions): Promise<AdminPublicationPlanResponse>;
|
|
1092
|
+
/**
|
|
1093
|
+
* 初回apply(confirmation=null)と承認済みapply。options付き (#730) だけreview profile headerを送る。
|
|
1094
|
+
* request bodyとIdempotency-Keyはheaderの有無で変えない。
|
|
1095
|
+
*/
|
|
1096
|
+
applyPublication(projectId: string, idempotencyKey: string, body: AdminPublicationApplyRequest, options?: AdminPublicationReviewProfileOptions): Promise<unknown>;
|
|
991
1097
|
planOpenApiImport(projectId: string, input: OpenApiImportRequest): Promise<OpenApiImportPlanResult>;
|
|
992
1098
|
applyOpenApiImport(projectId: string, idempotencyKey: string, input: OpenApiImportRequest): Promise<OpenApiImportDraftResult>;
|
|
993
1099
|
planOnboardingTemplate(projectId: string, manifestInput: unknown, bindingsInput: unknown): Promise<OnboardingTemplatePlanResult>;
|
|
@@ -1018,6 +1124,13 @@ declare class AdminApiClient {
|
|
|
1018
1124
|
idempotencyKey?: string;
|
|
1019
1125
|
}): Promise<OAuthScopesSyncResult>;
|
|
1020
1126
|
mapOAuthClientScopes(input: OAuthClientScopeMapRequest): Promise<OAuthClientScopeMapResult>;
|
|
1127
|
+
/**
|
|
1128
|
+
* `POST /v1/projects/{projectId}/oauth/scopes:register` (#729 / ADR-729)。previewは副作用なしで1回だけ送る。
|
|
1129
|
+
* applyはpreviewの3 commitmentと呼出側のIdempotency-Keyを必須にし、network・timeout・5xx・2xx応答の
|
|
1130
|
+
* 破損という曖昧な失敗だけ、同じkeyとbodyで最大3回まで送る。responseはexact 12 keyと
|
|
1131
|
+
* planCommitmentを再計算して検証し、requestとの束縛が崩れていれば`AP_RESPONSE_INVALID`にする。
|
|
1132
|
+
*/
|
|
1133
|
+
registerOAuthScopes(input: OAuthScopeRegistrationRequest): Promise<OAuthScopeRegistrationResponse>;
|
|
1021
1134
|
testOAuthLogin(projectId: string, clientRegistryId: string): Promise<OAuthTestLoginResult>;
|
|
1022
1135
|
createAuditExport(input: {
|
|
1023
1136
|
projectId: string | null;
|
|
@@ -1042,6 +1155,44 @@ declare function fetchOAuthMetadata(issuer: string, options?: {
|
|
|
1042
1155
|
readonly sleep?: AdminSleep;
|
|
1043
1156
|
}): Promise<unknown>;
|
|
1044
1157
|
|
|
1158
|
+
/** OIDC discovery metadata をローカル検証する。fetch は伴わない。 */
|
|
1159
|
+
declare function validateOAuthMetadata(meta: unknown, locale?: SupportedLocale): ValidateReport;
|
|
1160
|
+
interface OAuthScopeRegisterCommandOptions {
|
|
1161
|
+
readonly project?: string;
|
|
1162
|
+
readonly connector?: string;
|
|
1163
|
+
readonly draft?: readonly string[];
|
|
1164
|
+
readonly apply?: boolean;
|
|
1165
|
+
readonly yes?: boolean;
|
|
1166
|
+
readonly profile?: string;
|
|
1167
|
+
}
|
|
1168
|
+
/** Production backendはこの最小adapterへ閉じ込め、command testはfetch注入またはfakeで検証する。 */
|
|
1169
|
+
interface OAuthScopeRegisterApi {
|
|
1170
|
+
registerOAuthScopes(input: OAuthScopeRegistrationRequest): Promise<OAuthScopeRegistrationResponse>;
|
|
1171
|
+
/** 旧Admin API(route未対応)とproject権限不足を切り分けるread-only確認だけに使う。 */
|
|
1172
|
+
getOAuthSetup(projectId: string): Promise<unknown>;
|
|
1173
|
+
}
|
|
1174
|
+
interface OAuthScopeRegisterRuntime {
|
|
1175
|
+
createClient(profile: string): OAuthScopeRegisterApi;
|
|
1176
|
+
loadProject(cwd: string): LoadedDevProject;
|
|
1177
|
+
randomUuid(): string;
|
|
1178
|
+
}
|
|
1179
|
+
declare function createOAuthScopeRegisterRuntime(createClient?: (profile: string) => OAuthScopeRegisterApi): OAuthScopeRegisterRuntime;
|
|
1180
|
+
/** reason別の利用者向け文言で止める失敗。messageはlocale文言だけで、server messageを含めない。 */
|
|
1181
|
+
declare class OAuthScopeRegistrationCommandError extends Error {
|
|
1182
|
+
readonly code: string;
|
|
1183
|
+
readonly reason: string;
|
|
1184
|
+
readonly status?: number | undefined;
|
|
1185
|
+
constructor(code: string, reason: string, message: string, status?: number | undefined);
|
|
1186
|
+
}
|
|
1187
|
+
/**
|
|
1188
|
+
* `andpipe oauth scopes register` (#729 / ADR-729 §3.6)。previewが既定で、`--apply --yes` は同じ実行の中で
|
|
1189
|
+
* previewを表示してから、そのcommitmentでapplyする。登録はregistryへの名前とriskの追加だけで、
|
|
1190
|
+
* client許可・本人consent・公開は行わない。`ok=false` は登録できない権限名を含むpreviewを表す。
|
|
1191
|
+
*/
|
|
1192
|
+
declare function runOAuthScopeRegisterCommand(options: OAuthScopeRegisterCommandOptions, writer: Writer, cwd: string, runtime: OAuthScopeRegisterRuntime, locale?: SupportedLocale): Promise<{
|
|
1193
|
+
readonly ok: boolean;
|
|
1194
|
+
}>;
|
|
1195
|
+
|
|
1045
1196
|
interface OpenApiImportCommandOptions {
|
|
1046
1197
|
readonly file?: string;
|
|
1047
1198
|
readonly project?: string;
|
|
@@ -1090,10 +1241,16 @@ interface PublicationApplyRequest extends PublicationPlanRequest {
|
|
|
1090
1241
|
readonly planCommitment: string;
|
|
1091
1242
|
readonly confirmation: PublicationConfirmation | null;
|
|
1092
1243
|
}
|
|
1244
|
+
|
|
1093
1245
|
/** Production backendはこの最小adapterへ閉じ込め、状態機械のunit testはnetworkを使わない。 */
|
|
1094
1246
|
interface PublishApiClient {
|
|
1095
|
-
|
|
1096
|
-
|
|
1247
|
+
/**
|
|
1248
|
+
* planは常に`Andpipe-Publication-Review-Profile: 2`を送り (#730)、bodyとresponse headerの生値を返す。
|
|
1249
|
+
* request bodyはheaderの有無で変えない。
|
|
1250
|
+
*/
|
|
1251
|
+
planPublication(projectId: string, body: PublicationPlanRequest, options: PublicationReviewProfileRequestOptions): Promise<PublicationPlanTransportResponse>;
|
|
1252
|
+
/** optionsは新Admin API(plan応答headerが`1` / `2`)のときだけ渡す。旧Admin APIでは渡さない。 */
|
|
1253
|
+
applyPublication(projectId: string, idempotencyKey: string, body: PublicationApplyRequest, options?: PublicationReviewProfileRequestOptions): Promise<unknown>;
|
|
1097
1254
|
getPublication(projectId: string, publicationId: string): Promise<unknown>;
|
|
1098
1255
|
}
|
|
1099
1256
|
type PublishApiFactory = (profile: string) => PublishApiClient;
|
|
@@ -1127,8 +1284,8 @@ declare class PublishCommandError extends Error {
|
|
|
1127
1284
|
}
|
|
1128
1285
|
declare function createPublishCommandRuntime(createClient: PublishApiFactory): PublishCommandRuntime;
|
|
1129
1286
|
declare function normalizePublishOptions(options: PublishCommandOptions, messages?: CliPublishWorkflowMessages): NormalizedPublishOptions;
|
|
1130
|
-
declare function runPublishCommand(options: PublishCommandOptions, writer: Writer, cwd: string, runtime: PublishCommandRuntime, messages?: CliPublishWorkflowMessages): Promise<void>;
|
|
1131
|
-
declare function registerPublish(program: Command, writer: Writer, cwd: () => string, createClient: PublishApiFactory, description?: string, runtime?: PublishCommandRuntime, messages?: CliPublishWorkflowMessages): void;
|
|
1287
|
+
declare function runPublishCommand(options: PublishCommandOptions, writer: Writer, cwd: string, runtime: PublishCommandRuntime, messages?: CliPublishWorkflowMessages, scopeRegistrationMessages?: CliOAuthScopeRegistrationMessages, schemaReviewMessages?: CliPublicationSchemaReviewMessages): Promise<void>;
|
|
1288
|
+
declare function registerPublish(program: Command, writer: Writer, cwd: () => string, createClient: PublishApiFactory, description?: string, runtime?: PublishCommandRuntime, messages?: CliPublishWorkflowMessages, scopeRegistrationMessages?: CliOAuthScopeRegistrationMessages, schemaReviewMessages?: CliPublicationSchemaReviewMessages): void;
|
|
1132
1289
|
|
|
1133
1290
|
interface BoundedFileOptions {
|
|
1134
1291
|
maxBytes: number;
|
|
@@ -1303,4 +1460,4 @@ declare function redactDeep(value: unknown): unknown;
|
|
|
1303
1460
|
/** sibling package 慣習に合わせた package 識別子 (@andpipes/* 複数形)。 */
|
|
1304
1461
|
declare const packageName: "@andpipes/cli";
|
|
1305
1462
|
|
|
1306
|
-
export { ADMIN_API_MAX_GET_ATTEMPTS, ADMIN_API_MAX_RESPONSE_BYTES, ADMIN_API_ONBOARDING_TEMPLATE_MAX_BYTES, ADMIN_API_OPENAPI_IMPORT_MAX_BYTES, ADMIN_API_ORIGIN, ADMIN_API_PUBLICATION_REQUEST_MAX_BYTES, ADMIN_API_PUBLICATION_RESPONSE_MAX_BYTES, ADMIN_API_TIMEOUT_MS, ADMIN_CLI_AUTHORIZATION_SERVER, ADMIN_CLI_CLIENT_ID, ADMIN_CLI_HANDOFF_GRANT, ADMIN_CLI_RESOURCE, ADMIN_CLI_SCOPES, ADMIN_CLI_VERIFICATION_URI_BASE, AdminApiClient, AdminApiClientError, type AdminApiClientOptions, AdminCliHandoffError, type AdminCliHandoffFetch, type AdminCliHandoffRuntime, type AdminCliScope, type AdminFetch, type AdminHealth, type AdminPublicationApplyRequest, type AdminPublicationConfirmation, type AdminPublicationPlanRequest, type AdminSleep, type AuditExportDownloadAuthorization, type AuditExportIntegrity, type AuditExportListResult, type AuditExportManifest, type AuditExportSummary, CLI_NAME, CONFIG_MCP_ENDPOINT, CONFIG_MCP_HANDOFF_GRANT, CONFIG_MCP_RESOURCE, ConfigMcpClientError, type ConfigMcpConnectionConfig, type ConfigMcpCredentialRecord, type ConfigMcpFetch, ConfigMcpHandoffError, type ConfigMcpHandoffRuntime, type ConfigMcpToolSummary, ConfirmationRequiredError, type ConnectConfigMcpInput, type CreateAdminApiClientOptions, type CredentialRecord, type CredentialsFile, type CurrentAdminCredential, DEFAULT_AUTHORIZATION_SERVER, DEFAULT_DEV_PORT, DEFAULT_DEV_TTL_SECONDS, DEFAULT_PROFILE_NAME, DEFAULT_VERIFICATION_URI_BASE, type DevCommandOptions, type DevCommandRuntime, DevPolicyError, DevProjectPreflightError, type DnsRecord, type DnsSetupRecord, type DoctorCheck, type DoctorReport, type DoctorStatus, type DomainCreateResult, type DomainPlan, type HandoffFetch, type InitApiClient, type InitApiFactory, type InitCommandOptions, type InitCommandRuntime, type InitLocalPlan, InitLocalUsageError, type InitManifestCommitment, InitManifestConflictError, type InitManifestRuntime, type InitProject, type InitProjectCreateDiff, type InitProjectList, type InitRootAnchor, type InitRootIdentity, type LoadedOnboardingTemplateArtifact, type LoginAdminCliInput, type LogsResult, type NormalizedPublishOptions, type OAuthClientScopeMapRequest, type OAuthClientScopeMapResult, type OAuthClientSummary, type OAuthReadinessIssue, type OAuthScopeSummary, type OAuthScopesSyncResult, type OAuthSetupResult, type OAuthTestLoginCheck, type OAuthTestLoginResult, type OnboardingTemplateApplyRequest, type OnboardingTemplateApplyResult, type OnboardingTemplateExportResult, type OnboardingTemplatePlanResult, type OpenApiImportApi, type OpenApiImportCommandOptions, type OpenApiImportDraftResult, type OpenApiImportOperationSummary, type OpenApiImportPlanResult, type OpenApiImportRequest, type OpenApiImportRuntime, PACKAGE_NAME, type ProjectListResult, type PublicationApplyRequest, type PublicationConfirmation, type PublicationPlanRequest, type PublishApiClient, type PublishApiFactory, PublishCommandError, type PublishCommandOptions, type PublishCommandRuntime, type RandomBytes, type ReviewPackageCreateRequest, type ReviewPackageCreateResult, type ReviewPackageDownloadResult, type ReviewPackageMetadata, type SafeCustomDomain, type SafeLogEntry, type SafeProject, type TemplateApi, type TemplateCommandRuntime, UsageError, assertProjectId, assertResourceId, buildProgram, captureInitRoot, clearAll, computeDomainPlan, connectConfigMcp, createAdminApiClient, createInitCommandRuntime, createOpenApiImportRuntime, createPublishCommandRuntime, createS256Challenge, createTemplateCommandRuntime, fetchOAuthMetadata, finalizeExistingInitManifest, generateIdempotencyKey, generatePkceVerifier, getConfigDir, getConfigMcpProfile, getCredentialsPath, getProfile, isSensitiveKey, isValidDomain, loadConfigMcpConnectionConfig, loadContract, loadOnboardingTemplateArtifact, loginAdminCli, maskSecrets, maskToken, normalizeConfigMcpScopes, normalizeDevOptions, normalizeInitOptions, normalizePublishOptions, packageName, prepareInitLocal, probeConfigMcpTools, readVersion, redactDeep, registerDev, registerInit, registerOpenApi, registerPublish, registerTemplate, removeConfigMcpProfile, removeProfile, resolveConfigMcpConnection, resolveContractPath, runCli, runDevCommand, runDoctor, runInitCommand, runOpenApiImportCommand, runPublishCommand, runTemplatePlanOrApply, runTemplateRollback, setConfigMcpProfile, setProfile, validateOAuthMetadata, writeInitManifestNoReplace };
|
|
1463
|
+
export { ADMIN_API_MAX_GET_ATTEMPTS, ADMIN_API_MAX_RESPONSE_BYTES, ADMIN_API_OAUTH_SCOPE_REGISTRATION_MAX_APPLY_ATTEMPTS, ADMIN_API_OAUTH_SCOPE_REGISTRATION_REQUEST_MAX_BYTES, ADMIN_API_OAUTH_SCOPE_REGISTRATION_RESPONSE_MAX_BYTES, ADMIN_API_ONBOARDING_TEMPLATE_MAX_BYTES, ADMIN_API_OPENAPI_IMPORT_MAX_BYTES, ADMIN_API_ORIGIN, ADMIN_API_PUBLICATION_REQUEST_MAX_BYTES, ADMIN_API_PUBLICATION_RESPONSE_MAX_BYTES, ADMIN_API_TIMEOUT_MS, ADMIN_CLI_AUTHORIZATION_SERVER, ADMIN_CLI_CLIENT_ID, ADMIN_CLI_HANDOFF_GRANT, ADMIN_CLI_RESOURCE, ADMIN_CLI_SCOPES, ADMIN_CLI_VERIFICATION_URI_BASE, AdminApiClient, AdminApiClientError, type AdminApiClientErrorSafeDetails, type AdminApiClientOptions, AdminCliHandoffError, type AdminCliHandoffFetch, type AdminCliHandoffRuntime, type AdminCliScope, type AdminFetch, type AdminHealth, type AdminPublicationApplyRequest, type AdminPublicationConfirmation, type AdminPublicationPlanRequest, type AdminPublicationPlanResponse, type AdminPublicationReviewProfileOptions, type AdminSleep, type AuditExportDownloadAuthorization, type AuditExportIntegrity, type AuditExportListResult, type AuditExportManifest, type AuditExportSummary, CLI_NAME, CONFIG_MCP_ENDPOINT, CONFIG_MCP_HANDOFF_GRANT, CONFIG_MCP_RESOURCE, ConfigMcpClientError, type ConfigMcpConnectionConfig, type ConfigMcpCredentialRecord, type ConfigMcpFetch, ConfigMcpHandoffError, type ConfigMcpHandoffRuntime, type ConfigMcpToolSummary, ConfirmationRequiredError, type ConnectConfigMcpInput, type CreateAdminApiClientOptions, type CredentialRecord, type CredentialsFile, type CurrentAdminCredential, DEFAULT_AUTHORIZATION_SERVER, DEFAULT_DEV_PORT, DEFAULT_DEV_TTL_SECONDS, DEFAULT_PROFILE_NAME, DEFAULT_VERIFICATION_URI_BASE, type DevCommandOptions, type DevCommandRuntime, DevPolicyError, DevProjectPreflightError, type DnsRecord, type DnsSetupRecord, type DoctorCheck, type DoctorReport, type DoctorStatus, type DomainCreateResult, type DomainPlan, type HandoffFetch, type InitApiClient, type InitApiFactory, type InitCommandOptions, type InitCommandRuntime, type InitLocalPlan, InitLocalUsageError, type InitManifestCommitment, InitManifestConflictError, type InitManifestRuntime, type InitProject, type InitProjectCreateDiff, type InitProjectList, type InitRootAnchor, type InitRootIdentity, type LoadedOnboardingTemplateArtifact, type LoginAdminCliInput, type LogsResult, type NormalizedPublishOptions, type OAuthClientScopeMapRequest, type OAuthClientScopeMapResult, type OAuthClientSummary, type OAuthReadinessIssue, type OAuthScopeRegisterApi, type OAuthScopeRegisterCommandOptions, type OAuthScopeRegisterRuntime, OAuthScopeRegistrationCommandError, type OAuthScopeRegistrationRequest, type OAuthScopeRegistrationSavedDraft, type OAuthScopeRegistrationSourceInput, type OAuthScopeSummary, type OAuthScopesSyncResult, type OAuthSetupResult, type OAuthTestLoginCheck, type OAuthTestLoginResult, type OnboardingTemplateApplyRequest, type OnboardingTemplateApplyResult, type OnboardingTemplateExportResult, type OnboardingTemplatePlanResult, type OpenApiImportApi, type OpenApiImportCommandOptions, type OpenApiImportDraftResult, type OpenApiImportOperationSummary, type OpenApiImportPlanResult, type OpenApiImportRequest, type OpenApiImportRuntime, PACKAGE_NAME, type ProjectListResult, type PublicationApplyRequest, type PublicationConfirmation, type PublicationPlanRequest, type PublicationPlanTransportResponse, type PublicationReviewProfileRequestOptions, type PublishApiClient, type PublishApiFactory, PublishCommandError, type PublishCommandOptions, type PublishCommandRuntime, type RandomBytes, type ReviewPackageCreateRequest, type ReviewPackageCreateResult, type ReviewPackageDownloadResult, type ReviewPackageMetadata, type SafeCustomDomain, type SafeLogEntry, type SafeProject, type TemplateApi, type TemplateCommandRuntime, UsageError, assertProjectId, assertResourceId, buildProgram, captureInitRoot, clearAll, computeDomainPlan, connectConfigMcp, createAdminApiClient, createInitCommandRuntime, createOAuthScopeRegisterRuntime, createOpenApiImportRuntime, createPublishCommandRuntime, createS256Challenge, createTemplateCommandRuntime, fetchOAuthMetadata, finalizeExistingInitManifest, generateIdempotencyKey, generatePkceVerifier, getConfigDir, getConfigMcpProfile, getCredentialsPath, getProfile, isSensitiveKey, isValidDomain, loadConfigMcpConnectionConfig, loadContract, loadOnboardingTemplateArtifact, loginAdminCli, maskSecrets, maskToken, normalizeConfigMcpScopes, normalizeDevOptions, normalizeInitOptions, normalizePublishOptions, packageName, prepareInitLocal, probeConfigMcpTools, readVersion, redactDeep, registerDev, registerInit, registerOpenApi, registerPublish, registerTemplate, removeConfigMcpProfile, removeProfile, resolveConfigMcpConnection, resolveContractPath, runCli, runDevCommand, runDoctor, runInitCommand, runOAuthScopeRegisterCommand, runOpenApiImportCommand, runPublishCommand, runTemplatePlanOrApply, runTemplateRollback, setConfigMcpProfile, setProfile, validateOAuthMetadata, writeInitManifestNoReplace };
|
package/dist/index.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { SupportedLocale, CliDevWorkflowMessages, CliInitWorkflowMessages, CliPublishWorkflowMessages } from '@andpipes/localization';
|
|
1
|
+
import { SupportedLocale, CliDevWorkflowMessages, CliInitWorkflowMessages, CliOAuthScopeRegistrationMessages, CliPublishWorkflowMessages, CliPublicationSchemaReviewMessages } from '@andpipes/localization';
|
|
2
2
|
import { Command } from 'commander';
|
|
3
|
-
import { ValidateReport, PublishGateResult, OpenApiImportUpstreamAuthMode, OpenApiImportOperationRiskOverride, OnboardingTemplateOperation, OnboardingTemplateSafeDiffEntry, ExternalSaasTemplateV1, OnboardingTemplateBindings } from '@andpipes/tool-contract';
|
|
3
|
+
import { ValidateReport, PublishGateResult, OpenApiImportUpstreamAuthMode, OpenApiImportOperationRiskOverride, OnboardingTemplateOperation, OnboardingTemplateSafeDiffEntry, ExternalSaasTemplateV1, OnboardingTemplateBindings, OAuthScopeRegistrationResponse, OAuthScopeRegistrationErrorReason } from '@andpipes/tool-contract';
|
|
4
4
|
export { CheckResult, CheckStatus, RISK_LEVELS, RiskLevel, ValidateReport, validateContract } from '@andpipes/tool-contract';
|
|
5
5
|
|
|
6
6
|
/**
|
|
@@ -525,12 +525,40 @@ type NormalizedInitMode = {
|
|
|
525
525
|
readonly yes: boolean;
|
|
526
526
|
};
|
|
527
527
|
declare function normalizeInitOptions(options: InitCommandOptions, messages?: CliInitWorkflowMessages): NormalizedInitMode;
|
|
528
|
-
declare function runInitCommand(options: InitCommandOptions, writer: Writer, cwd: string, runtime: InitCommandRuntime, messages?: CliInitWorkflowMessages): Promise<void>;
|
|
528
|
+
declare function runInitCommand(options: InitCommandOptions, writer: Writer, cwd: string, runtime: InitCommandRuntime, messages?: CliInitWorkflowMessages, scopeRegistrationMessages?: CliOAuthScopeRegistrationMessages): Promise<void>;
|
|
529
529
|
/** CLI登録。production backend adapterはfactoryとして注入し、unit testは実networkを使わない。 */
|
|
530
|
-
declare function registerInit(program: Command, writer: Writer, cwd: () => string, createClient: InitApiFactory, description?: string, runtime?: InitCommandRuntime | undefined, messages?: CliInitWorkflowMessages): void;
|
|
530
|
+
declare function registerInit(program: Command, writer: Writer, cwd: () => string, createClient: InitApiFactory, description?: string, runtime?: InitCommandRuntime | undefined, messages?: CliInitWorkflowMessages, scopeRegistrationMessages?: CliOAuthScopeRegistrationMessages): void;
|
|
531
531
|
|
|
532
|
-
/**
|
|
533
|
-
|
|
532
|
+
/**
|
|
533
|
+
* Publication review profile 2(#730 / ADR-730 §6.2・§6.7)のCLI側transport契約。
|
|
534
|
+
*
|
|
535
|
+
* - CLIはplan / 初回apply / 最終applyへ`Andpipe-Publication-Review-Profile: 2`(扱える最大profile)を送る。
|
|
536
|
+
* - plan応答のheaderはcommand層がexactに検査する。transportは生値(無ければnull)だけを返し、表示しない。
|
|
537
|
+
* - server error detailsの`reason`は、固定allowlistとAP codeの組が一致した場合だけ保持する。
|
|
538
|
+
* server message・未知details・未知reasonはCLIの表示へ転載しない。
|
|
539
|
+
*/
|
|
540
|
+
/** CLI 0.1.5が扱える最大のreview profile。plan / 初回apply / 最終applyのrequest headerへ送る。 */
|
|
541
|
+
declare const CLI_PUBLICATION_REVIEW_PROFILE: 2;
|
|
542
|
+
/** plan / 初回apply / 最終applyへreview profileのrequest headerを付けるときのoption。 */
|
|
543
|
+
interface PublicationReviewProfileRequestOptions {
|
|
544
|
+
readonly reviewProfile: typeof CLI_PUBLICATION_REVIEW_PROFILE;
|
|
545
|
+
}
|
|
546
|
+
/**
|
|
547
|
+
* review profile headerを付けたplanのtransport応答。bodyはexact parse前の値。
|
|
548
|
+
* `reviewProfileHeader`はresponse headerの生値(無ければnull)で、command層が`1` / `2`だけを受理する。
|
|
549
|
+
*/
|
|
550
|
+
interface PublicationPlanTransportResponse {
|
|
551
|
+
readonly body: unknown;
|
|
552
|
+
readonly reviewProfileHeader: string | null;
|
|
553
|
+
}
|
|
554
|
+
/** server error detailsから保持してよいpublication reasonと、そのreasonを返すAP code。 */
|
|
555
|
+
declare const PUBLICATION_ERROR_REASON_CODES: Readonly<{
|
|
556
|
+
readonly publication_plan_stale: "AP_CONFLICT";
|
|
557
|
+
readonly publication_review_profile_invalid: "AP_INPUT_INVALID";
|
|
558
|
+
readonly publication_schema_review_too_large: "AP_INPUT_INVALID";
|
|
559
|
+
readonly schema_review_receipt_mismatch: "AP_CONFLICT";
|
|
560
|
+
}>;
|
|
561
|
+
type PublicationErrorReason = keyof typeof PUBLICATION_ERROR_REASON_CODES;
|
|
534
562
|
|
|
535
563
|
/** Admin bearer credential を送信してよい唯一の production origin。 */
|
|
536
564
|
declare const ADMIN_API_ORIGIN = "https://api.andpipe.com";
|
|
@@ -541,6 +569,19 @@ declare const ADMIN_API_PUBLICATION_RESPONSE_MAX_BYTES: number;
|
|
|
541
569
|
declare const ADMIN_API_OPENAPI_IMPORT_MAX_BYTES: number;
|
|
542
570
|
declare const ADMIN_API_ONBOARDING_TEMPLATE_MAX_BYTES: number;
|
|
543
571
|
declare const ADMIN_API_MAX_GET_ATTEMPTS = 3;
|
|
572
|
+
/**
|
|
573
|
+
* `scopes:register` のrequest上限 (#729 / ADR-729 §3.1)。serverの
|
|
574
|
+
* `OAUTH_SCOPE_REGISTRATION_REQUEST_MAX_BYTES = TOOL_PUBLICATION_REQUEST_MAX_BYTES + 8 KiB` と同じ。
|
|
575
|
+
*/
|
|
576
|
+
declare const ADMIN_API_OAUTH_SCOPE_REGISTRATION_REQUEST_MAX_BYTES: number;
|
|
577
|
+
/**
|
|
578
|
+
* `scopes:register` のresponse上限(仮)。serverは上限を持たず、最大25 draft・512 toolのscope一覧を
|
|
579
|
+
* 返し得るため、publication plan(96 KiB)より広い1 MiBで打ち切る。成功後の過大応答を誤って
|
|
580
|
+
* 未確定扱いにしないための余裕であり、仕様上の上限ではない。
|
|
581
|
+
*/
|
|
582
|
+
declare const ADMIN_API_OAUTH_SCOPE_REGISTRATION_RESPONSE_MAX_BYTES: number;
|
|
583
|
+
/** applyの曖昧な失敗だけ、同じIdempotency-Keyとbodyで再送する総試行回数(publishと同じ)。 */
|
|
584
|
+
declare const ADMIN_API_OAUTH_SCOPE_REGISTRATION_MAX_APPLY_ATTEMPTS = 3;
|
|
544
585
|
type JsonObject = Record<string, unknown>;
|
|
545
586
|
type AdminFetch = (input: string | URL, init?: RequestInit) => Promise<Response>;
|
|
546
587
|
type AdminSleep = (milliseconds: number) => Promise<void>;
|
|
@@ -549,12 +590,31 @@ interface OpenApiImportAuthModeMismatch {
|
|
|
549
590
|
readonly connectorAuthMode: "token_exchange" | "service_account" | "existing_oauth" | "signed_request";
|
|
550
591
|
readonly requestedAuthMode: OpenApiImportUpstreamAuthMode;
|
|
551
592
|
}
|
|
593
|
+
/**
|
|
594
|
+
* server error detailsから取り出してよい安全な値だけ (#729)。server message・未知detailsは保持しない。
|
|
595
|
+
*/
|
|
596
|
+
interface AdminApiClientErrorSafeDetails {
|
|
597
|
+
/** `error.details` がnull/欠落だったか。旧Admin APIのroute未対応判定だけに使い、内容は保持しない。 */
|
|
598
|
+
readonly detailsAbsent?: boolean;
|
|
599
|
+
/** `details.reason` がOAuth scope登録のallowlistに一致した場合だけ保持する固定code。 */
|
|
600
|
+
readonly scopeRegistrationReason?: OAuthScopeRegistrationErrorReason;
|
|
601
|
+
/** publish gate失敗 (`scope_registration_publish_gate_failed`) の厳格検証済みtool名。 */
|
|
602
|
+
readonly publishGateToolNames?: readonly string[];
|
|
603
|
+
/**
|
|
604
|
+
* tool publication (#730) の`details.reason`が固定allowlistとAP codeの組に一致した場合だけ保持する固定code。
|
|
605
|
+
*/
|
|
606
|
+
readonly publicationReason?: PublicationErrorReason;
|
|
607
|
+
}
|
|
552
608
|
declare class AdminApiClientError extends Error {
|
|
553
609
|
readonly code: string;
|
|
554
610
|
readonly status: number | undefined;
|
|
555
611
|
readonly confirmationRequired: PublicationConfirmationRequiredDetails | undefined;
|
|
556
612
|
readonly openApiAuthModeMismatch: OpenApiImportAuthModeMismatch | undefined;
|
|
557
|
-
|
|
613
|
+
readonly detailsAbsent: boolean;
|
|
614
|
+
readonly scopeRegistrationReason: OAuthScopeRegistrationErrorReason | undefined;
|
|
615
|
+
readonly publishGateToolNames: readonly string[] | undefined;
|
|
616
|
+
readonly publicationReason: PublicationErrorReason | undefined;
|
|
617
|
+
constructor(code: string, message: string, status?: number, confirmationRequired?: PublicationConfirmationRequiredDetails, openApiAuthModeMismatch?: OpenApiImportAuthModeMismatch, safeDetails?: AdminApiClientErrorSafeDetails);
|
|
558
618
|
}
|
|
559
619
|
declare function assertProjectId(projectId: string): string;
|
|
560
620
|
declare function assertResourceId(value: string, option: string): string;
|
|
@@ -613,6 +673,10 @@ interface AdminPublicationApplyRequest extends AdminPublicationPlanRequest {
|
|
|
613
673
|
readonly planCommitment: string;
|
|
614
674
|
readonly confirmation: AdminPublicationConfirmation | null;
|
|
615
675
|
}
|
|
676
|
+
/** plan / 初回apply / 最終applyへ`Andpipe-Publication-Review-Profile: 2`を送るoption (#730)。 */
|
|
677
|
+
type AdminPublicationReviewProfileOptions = PublicationReviewProfileRequestOptions;
|
|
678
|
+
/** review profile header付きplanの応答。headerの値はcommand層がexactに検査する (#730)。 */
|
|
679
|
+
type AdminPublicationPlanResponse = PublicationPlanTransportResponse;
|
|
616
680
|
interface OpenApiImportRequest {
|
|
617
681
|
readonly source: string;
|
|
618
682
|
readonly connectorId: string;
|
|
@@ -803,6 +867,38 @@ type OAuthClientScopeMapRequest = {
|
|
|
803
867
|
readonly planCommitment: `sha256:${string}`;
|
|
804
868
|
readonly idempotencyKey?: string;
|
|
805
869
|
};
|
|
870
|
+
/** 保存済みdraftの指定。canonical小文字UUIDで、toolIdのcode point昇順・重複なしで渡す。 */
|
|
871
|
+
interface OAuthScopeRegistrationSavedDraft {
|
|
872
|
+
readonly toolId: string;
|
|
873
|
+
readonly versionId: string;
|
|
874
|
+
}
|
|
875
|
+
/**
|
|
876
|
+
* `scopes:register` のsource (#729 / ADR-729 §3.1)。publication_candidateは
|
|
877
|
+
* `tool-publications:plan` へ送るのと同じcandidateとcommitmentを渡す。
|
|
878
|
+
*/
|
|
879
|
+
type OAuthScopeRegistrationSourceInput = {
|
|
880
|
+
readonly kind: "saved_drafts";
|
|
881
|
+
readonly drafts: readonly OAuthScopeRegistrationSavedDraft[];
|
|
882
|
+
} | {
|
|
883
|
+
readonly kind: "publication_candidate";
|
|
884
|
+
readonly connectorId: string;
|
|
885
|
+
readonly candidateContract: unknown;
|
|
886
|
+
readonly candidateCommitment: string;
|
|
887
|
+
};
|
|
888
|
+
type OAuthScopeRegistrationRequest = {
|
|
889
|
+
readonly projectId: string;
|
|
890
|
+
readonly source: OAuthScopeRegistrationSourceInput;
|
|
891
|
+
readonly apply: false;
|
|
892
|
+
} | {
|
|
893
|
+
readonly projectId: string;
|
|
894
|
+
readonly source: OAuthScopeRegistrationSourceInput;
|
|
895
|
+
readonly apply: true;
|
|
896
|
+
readonly sourceCommitment: string;
|
|
897
|
+
readonly baseRegistryCommitment: string;
|
|
898
|
+
readonly planCommitment: string;
|
|
899
|
+
/** 呼出側が実行ごとに1つ生成し、曖昧な失敗の再送でも同じ値を使う。 */
|
|
900
|
+
readonly idempotencyKey: string;
|
|
901
|
+
};
|
|
806
902
|
interface OAuthTestLoginCheck {
|
|
807
903
|
readonly id: OAuthTestLoginCheckId;
|
|
808
904
|
readonly status: "pass" | "fail" | "deferred";
|
|
@@ -986,8 +1082,18 @@ declare class AdminApiClient {
|
|
|
986
1082
|
readonly config: Readonly<Record<string, unknown>> | null;
|
|
987
1083
|
readonly status: "active" | "disabled";
|
|
988
1084
|
}>;
|
|
1085
|
+
/**
|
|
1086
|
+
* `tool-publications:plan`。optionsなしは従来どおりheaderを送らずbodyだけを返す(v1)。
|
|
1087
|
+
* options付き (#730) は`Andpipe-Publication-Review-Profile`を送り、bodyとresponse headerの生値を返す。
|
|
1088
|
+
* request bodyはどちらもbyte単位で同じにする。
|
|
1089
|
+
*/
|
|
989
1090
|
planPublication(projectId: string, body: AdminPublicationPlanRequest): Promise<unknown>;
|
|
990
|
-
|
|
1091
|
+
planPublication(projectId: string, body: AdminPublicationPlanRequest, options: AdminPublicationReviewProfileOptions): Promise<AdminPublicationPlanResponse>;
|
|
1092
|
+
/**
|
|
1093
|
+
* 初回apply(confirmation=null)と承認済みapply。options付き (#730) だけreview profile headerを送る。
|
|
1094
|
+
* request bodyとIdempotency-Keyはheaderの有無で変えない。
|
|
1095
|
+
*/
|
|
1096
|
+
applyPublication(projectId: string, idempotencyKey: string, body: AdminPublicationApplyRequest, options?: AdminPublicationReviewProfileOptions): Promise<unknown>;
|
|
991
1097
|
planOpenApiImport(projectId: string, input: OpenApiImportRequest): Promise<OpenApiImportPlanResult>;
|
|
992
1098
|
applyOpenApiImport(projectId: string, idempotencyKey: string, input: OpenApiImportRequest): Promise<OpenApiImportDraftResult>;
|
|
993
1099
|
planOnboardingTemplate(projectId: string, manifestInput: unknown, bindingsInput: unknown): Promise<OnboardingTemplatePlanResult>;
|
|
@@ -1018,6 +1124,13 @@ declare class AdminApiClient {
|
|
|
1018
1124
|
idempotencyKey?: string;
|
|
1019
1125
|
}): Promise<OAuthScopesSyncResult>;
|
|
1020
1126
|
mapOAuthClientScopes(input: OAuthClientScopeMapRequest): Promise<OAuthClientScopeMapResult>;
|
|
1127
|
+
/**
|
|
1128
|
+
* `POST /v1/projects/{projectId}/oauth/scopes:register` (#729 / ADR-729)。previewは副作用なしで1回だけ送る。
|
|
1129
|
+
* applyはpreviewの3 commitmentと呼出側のIdempotency-Keyを必須にし、network・timeout・5xx・2xx応答の
|
|
1130
|
+
* 破損という曖昧な失敗だけ、同じkeyとbodyで最大3回まで送る。responseはexact 12 keyと
|
|
1131
|
+
* planCommitmentを再計算して検証し、requestとの束縛が崩れていれば`AP_RESPONSE_INVALID`にする。
|
|
1132
|
+
*/
|
|
1133
|
+
registerOAuthScopes(input: OAuthScopeRegistrationRequest): Promise<OAuthScopeRegistrationResponse>;
|
|
1021
1134
|
testOAuthLogin(projectId: string, clientRegistryId: string): Promise<OAuthTestLoginResult>;
|
|
1022
1135
|
createAuditExport(input: {
|
|
1023
1136
|
projectId: string | null;
|
|
@@ -1042,6 +1155,44 @@ declare function fetchOAuthMetadata(issuer: string, options?: {
|
|
|
1042
1155
|
readonly sleep?: AdminSleep;
|
|
1043
1156
|
}): Promise<unknown>;
|
|
1044
1157
|
|
|
1158
|
+
/** OIDC discovery metadata をローカル検証する。fetch は伴わない。 */
|
|
1159
|
+
declare function validateOAuthMetadata(meta: unknown, locale?: SupportedLocale): ValidateReport;
|
|
1160
|
+
interface OAuthScopeRegisterCommandOptions {
|
|
1161
|
+
readonly project?: string;
|
|
1162
|
+
readonly connector?: string;
|
|
1163
|
+
readonly draft?: readonly string[];
|
|
1164
|
+
readonly apply?: boolean;
|
|
1165
|
+
readonly yes?: boolean;
|
|
1166
|
+
readonly profile?: string;
|
|
1167
|
+
}
|
|
1168
|
+
/** Production backendはこの最小adapterへ閉じ込め、command testはfetch注入またはfakeで検証する。 */
|
|
1169
|
+
interface OAuthScopeRegisterApi {
|
|
1170
|
+
registerOAuthScopes(input: OAuthScopeRegistrationRequest): Promise<OAuthScopeRegistrationResponse>;
|
|
1171
|
+
/** 旧Admin API(route未対応)とproject権限不足を切り分けるread-only確認だけに使う。 */
|
|
1172
|
+
getOAuthSetup(projectId: string): Promise<unknown>;
|
|
1173
|
+
}
|
|
1174
|
+
interface OAuthScopeRegisterRuntime {
|
|
1175
|
+
createClient(profile: string): OAuthScopeRegisterApi;
|
|
1176
|
+
loadProject(cwd: string): LoadedDevProject;
|
|
1177
|
+
randomUuid(): string;
|
|
1178
|
+
}
|
|
1179
|
+
declare function createOAuthScopeRegisterRuntime(createClient?: (profile: string) => OAuthScopeRegisterApi): OAuthScopeRegisterRuntime;
|
|
1180
|
+
/** reason別の利用者向け文言で止める失敗。messageはlocale文言だけで、server messageを含めない。 */
|
|
1181
|
+
declare class OAuthScopeRegistrationCommandError extends Error {
|
|
1182
|
+
readonly code: string;
|
|
1183
|
+
readonly reason: string;
|
|
1184
|
+
readonly status?: number | undefined;
|
|
1185
|
+
constructor(code: string, reason: string, message: string, status?: number | undefined);
|
|
1186
|
+
}
|
|
1187
|
+
/**
|
|
1188
|
+
* `andpipe oauth scopes register` (#729 / ADR-729 §3.6)。previewが既定で、`--apply --yes` は同じ実行の中で
|
|
1189
|
+
* previewを表示してから、そのcommitmentでapplyする。登録はregistryへの名前とriskの追加だけで、
|
|
1190
|
+
* client許可・本人consent・公開は行わない。`ok=false` は登録できない権限名を含むpreviewを表す。
|
|
1191
|
+
*/
|
|
1192
|
+
declare function runOAuthScopeRegisterCommand(options: OAuthScopeRegisterCommandOptions, writer: Writer, cwd: string, runtime: OAuthScopeRegisterRuntime, locale?: SupportedLocale): Promise<{
|
|
1193
|
+
readonly ok: boolean;
|
|
1194
|
+
}>;
|
|
1195
|
+
|
|
1045
1196
|
interface OpenApiImportCommandOptions {
|
|
1046
1197
|
readonly file?: string;
|
|
1047
1198
|
readonly project?: string;
|
|
@@ -1090,10 +1241,16 @@ interface PublicationApplyRequest extends PublicationPlanRequest {
|
|
|
1090
1241
|
readonly planCommitment: string;
|
|
1091
1242
|
readonly confirmation: PublicationConfirmation | null;
|
|
1092
1243
|
}
|
|
1244
|
+
|
|
1093
1245
|
/** Production backendはこの最小adapterへ閉じ込め、状態機械のunit testはnetworkを使わない。 */
|
|
1094
1246
|
interface PublishApiClient {
|
|
1095
|
-
|
|
1096
|
-
|
|
1247
|
+
/**
|
|
1248
|
+
* planは常に`Andpipe-Publication-Review-Profile: 2`を送り (#730)、bodyとresponse headerの生値を返す。
|
|
1249
|
+
* request bodyはheaderの有無で変えない。
|
|
1250
|
+
*/
|
|
1251
|
+
planPublication(projectId: string, body: PublicationPlanRequest, options: PublicationReviewProfileRequestOptions): Promise<PublicationPlanTransportResponse>;
|
|
1252
|
+
/** optionsは新Admin API(plan応答headerが`1` / `2`)のときだけ渡す。旧Admin APIでは渡さない。 */
|
|
1253
|
+
applyPublication(projectId: string, idempotencyKey: string, body: PublicationApplyRequest, options?: PublicationReviewProfileRequestOptions): Promise<unknown>;
|
|
1097
1254
|
getPublication(projectId: string, publicationId: string): Promise<unknown>;
|
|
1098
1255
|
}
|
|
1099
1256
|
type PublishApiFactory = (profile: string) => PublishApiClient;
|
|
@@ -1127,8 +1284,8 @@ declare class PublishCommandError extends Error {
|
|
|
1127
1284
|
}
|
|
1128
1285
|
declare function createPublishCommandRuntime(createClient: PublishApiFactory): PublishCommandRuntime;
|
|
1129
1286
|
declare function normalizePublishOptions(options: PublishCommandOptions, messages?: CliPublishWorkflowMessages): NormalizedPublishOptions;
|
|
1130
|
-
declare function runPublishCommand(options: PublishCommandOptions, writer: Writer, cwd: string, runtime: PublishCommandRuntime, messages?: CliPublishWorkflowMessages): Promise<void>;
|
|
1131
|
-
declare function registerPublish(program: Command, writer: Writer, cwd: () => string, createClient: PublishApiFactory, description?: string, runtime?: PublishCommandRuntime, messages?: CliPublishWorkflowMessages): void;
|
|
1287
|
+
declare function runPublishCommand(options: PublishCommandOptions, writer: Writer, cwd: string, runtime: PublishCommandRuntime, messages?: CliPublishWorkflowMessages, scopeRegistrationMessages?: CliOAuthScopeRegistrationMessages, schemaReviewMessages?: CliPublicationSchemaReviewMessages): Promise<void>;
|
|
1288
|
+
declare function registerPublish(program: Command, writer: Writer, cwd: () => string, createClient: PublishApiFactory, description?: string, runtime?: PublishCommandRuntime, messages?: CliPublishWorkflowMessages, scopeRegistrationMessages?: CliOAuthScopeRegistrationMessages, schemaReviewMessages?: CliPublicationSchemaReviewMessages): void;
|
|
1132
1289
|
|
|
1133
1290
|
interface BoundedFileOptions {
|
|
1134
1291
|
maxBytes: number;
|
|
@@ -1303,4 +1460,4 @@ declare function redactDeep(value: unknown): unknown;
|
|
|
1303
1460
|
/** sibling package 慣習に合わせた package 識別子 (@andpipes/* 複数形)。 */
|
|
1304
1461
|
declare const packageName: "@andpipes/cli";
|
|
1305
1462
|
|
|
1306
|
-
export { ADMIN_API_MAX_GET_ATTEMPTS, ADMIN_API_MAX_RESPONSE_BYTES, ADMIN_API_ONBOARDING_TEMPLATE_MAX_BYTES, ADMIN_API_OPENAPI_IMPORT_MAX_BYTES, ADMIN_API_ORIGIN, ADMIN_API_PUBLICATION_REQUEST_MAX_BYTES, ADMIN_API_PUBLICATION_RESPONSE_MAX_BYTES, ADMIN_API_TIMEOUT_MS, ADMIN_CLI_AUTHORIZATION_SERVER, ADMIN_CLI_CLIENT_ID, ADMIN_CLI_HANDOFF_GRANT, ADMIN_CLI_RESOURCE, ADMIN_CLI_SCOPES, ADMIN_CLI_VERIFICATION_URI_BASE, AdminApiClient, AdminApiClientError, type AdminApiClientOptions, AdminCliHandoffError, type AdminCliHandoffFetch, type AdminCliHandoffRuntime, type AdminCliScope, type AdminFetch, type AdminHealth, type AdminPublicationApplyRequest, type AdminPublicationConfirmation, type AdminPublicationPlanRequest, type AdminSleep, type AuditExportDownloadAuthorization, type AuditExportIntegrity, type AuditExportListResult, type AuditExportManifest, type AuditExportSummary, CLI_NAME, CONFIG_MCP_ENDPOINT, CONFIG_MCP_HANDOFF_GRANT, CONFIG_MCP_RESOURCE, ConfigMcpClientError, type ConfigMcpConnectionConfig, type ConfigMcpCredentialRecord, type ConfigMcpFetch, ConfigMcpHandoffError, type ConfigMcpHandoffRuntime, type ConfigMcpToolSummary, ConfirmationRequiredError, type ConnectConfigMcpInput, type CreateAdminApiClientOptions, type CredentialRecord, type CredentialsFile, type CurrentAdminCredential, DEFAULT_AUTHORIZATION_SERVER, DEFAULT_DEV_PORT, DEFAULT_DEV_TTL_SECONDS, DEFAULT_PROFILE_NAME, DEFAULT_VERIFICATION_URI_BASE, type DevCommandOptions, type DevCommandRuntime, DevPolicyError, DevProjectPreflightError, type DnsRecord, type DnsSetupRecord, type DoctorCheck, type DoctorReport, type DoctorStatus, type DomainCreateResult, type DomainPlan, type HandoffFetch, type InitApiClient, type InitApiFactory, type InitCommandOptions, type InitCommandRuntime, type InitLocalPlan, InitLocalUsageError, type InitManifestCommitment, InitManifestConflictError, type InitManifestRuntime, type InitProject, type InitProjectCreateDiff, type InitProjectList, type InitRootAnchor, type InitRootIdentity, type LoadedOnboardingTemplateArtifact, type LoginAdminCliInput, type LogsResult, type NormalizedPublishOptions, type OAuthClientScopeMapRequest, type OAuthClientScopeMapResult, type OAuthClientSummary, type OAuthReadinessIssue, type OAuthScopeSummary, type OAuthScopesSyncResult, type OAuthSetupResult, type OAuthTestLoginCheck, type OAuthTestLoginResult, type OnboardingTemplateApplyRequest, type OnboardingTemplateApplyResult, type OnboardingTemplateExportResult, type OnboardingTemplatePlanResult, type OpenApiImportApi, type OpenApiImportCommandOptions, type OpenApiImportDraftResult, type OpenApiImportOperationSummary, type OpenApiImportPlanResult, type OpenApiImportRequest, type OpenApiImportRuntime, PACKAGE_NAME, type ProjectListResult, type PublicationApplyRequest, type PublicationConfirmation, type PublicationPlanRequest, type PublishApiClient, type PublishApiFactory, PublishCommandError, type PublishCommandOptions, type PublishCommandRuntime, type RandomBytes, type ReviewPackageCreateRequest, type ReviewPackageCreateResult, type ReviewPackageDownloadResult, type ReviewPackageMetadata, type SafeCustomDomain, type SafeLogEntry, type SafeProject, type TemplateApi, type TemplateCommandRuntime, UsageError, assertProjectId, assertResourceId, buildProgram, captureInitRoot, clearAll, computeDomainPlan, connectConfigMcp, createAdminApiClient, createInitCommandRuntime, createOpenApiImportRuntime, createPublishCommandRuntime, createS256Challenge, createTemplateCommandRuntime, fetchOAuthMetadata, finalizeExistingInitManifest, generateIdempotencyKey, generatePkceVerifier, getConfigDir, getConfigMcpProfile, getCredentialsPath, getProfile, isSensitiveKey, isValidDomain, loadConfigMcpConnectionConfig, loadContract, loadOnboardingTemplateArtifact, loginAdminCli, maskSecrets, maskToken, normalizeConfigMcpScopes, normalizeDevOptions, normalizeInitOptions, normalizePublishOptions, packageName, prepareInitLocal, probeConfigMcpTools, readVersion, redactDeep, registerDev, registerInit, registerOpenApi, registerPublish, registerTemplate, removeConfigMcpProfile, removeProfile, resolveConfigMcpConnection, resolveContractPath, runCli, runDevCommand, runDoctor, runInitCommand, runOpenApiImportCommand, runPublishCommand, runTemplatePlanOrApply, runTemplateRollback, setConfigMcpProfile, setProfile, validateOAuthMetadata, writeInitManifestNoReplace };
|
|
1463
|
+
export { ADMIN_API_MAX_GET_ATTEMPTS, ADMIN_API_MAX_RESPONSE_BYTES, ADMIN_API_OAUTH_SCOPE_REGISTRATION_MAX_APPLY_ATTEMPTS, ADMIN_API_OAUTH_SCOPE_REGISTRATION_REQUEST_MAX_BYTES, ADMIN_API_OAUTH_SCOPE_REGISTRATION_RESPONSE_MAX_BYTES, ADMIN_API_ONBOARDING_TEMPLATE_MAX_BYTES, ADMIN_API_OPENAPI_IMPORT_MAX_BYTES, ADMIN_API_ORIGIN, ADMIN_API_PUBLICATION_REQUEST_MAX_BYTES, ADMIN_API_PUBLICATION_RESPONSE_MAX_BYTES, ADMIN_API_TIMEOUT_MS, ADMIN_CLI_AUTHORIZATION_SERVER, ADMIN_CLI_CLIENT_ID, ADMIN_CLI_HANDOFF_GRANT, ADMIN_CLI_RESOURCE, ADMIN_CLI_SCOPES, ADMIN_CLI_VERIFICATION_URI_BASE, AdminApiClient, AdminApiClientError, type AdminApiClientErrorSafeDetails, type AdminApiClientOptions, AdminCliHandoffError, type AdminCliHandoffFetch, type AdminCliHandoffRuntime, type AdminCliScope, type AdminFetch, type AdminHealth, type AdminPublicationApplyRequest, type AdminPublicationConfirmation, type AdminPublicationPlanRequest, type AdminPublicationPlanResponse, type AdminPublicationReviewProfileOptions, type AdminSleep, type AuditExportDownloadAuthorization, type AuditExportIntegrity, type AuditExportListResult, type AuditExportManifest, type AuditExportSummary, CLI_NAME, CONFIG_MCP_ENDPOINT, CONFIG_MCP_HANDOFF_GRANT, CONFIG_MCP_RESOURCE, ConfigMcpClientError, type ConfigMcpConnectionConfig, type ConfigMcpCredentialRecord, type ConfigMcpFetch, ConfigMcpHandoffError, type ConfigMcpHandoffRuntime, type ConfigMcpToolSummary, ConfirmationRequiredError, type ConnectConfigMcpInput, type CreateAdminApiClientOptions, type CredentialRecord, type CredentialsFile, type CurrentAdminCredential, DEFAULT_AUTHORIZATION_SERVER, DEFAULT_DEV_PORT, DEFAULT_DEV_TTL_SECONDS, DEFAULT_PROFILE_NAME, DEFAULT_VERIFICATION_URI_BASE, type DevCommandOptions, type DevCommandRuntime, DevPolicyError, DevProjectPreflightError, type DnsRecord, type DnsSetupRecord, type DoctorCheck, type DoctorReport, type DoctorStatus, type DomainCreateResult, type DomainPlan, type HandoffFetch, type InitApiClient, type InitApiFactory, type InitCommandOptions, type InitCommandRuntime, type InitLocalPlan, InitLocalUsageError, type InitManifestCommitment, InitManifestConflictError, type InitManifestRuntime, type InitProject, type InitProjectCreateDiff, type InitProjectList, type InitRootAnchor, type InitRootIdentity, type LoadedOnboardingTemplateArtifact, type LoginAdminCliInput, type LogsResult, type NormalizedPublishOptions, type OAuthClientScopeMapRequest, type OAuthClientScopeMapResult, type OAuthClientSummary, type OAuthReadinessIssue, type OAuthScopeRegisterApi, type OAuthScopeRegisterCommandOptions, type OAuthScopeRegisterRuntime, OAuthScopeRegistrationCommandError, type OAuthScopeRegistrationRequest, type OAuthScopeRegistrationSavedDraft, type OAuthScopeRegistrationSourceInput, type OAuthScopeSummary, type OAuthScopesSyncResult, type OAuthSetupResult, type OAuthTestLoginCheck, type OAuthTestLoginResult, type OnboardingTemplateApplyRequest, type OnboardingTemplateApplyResult, type OnboardingTemplateExportResult, type OnboardingTemplatePlanResult, type OpenApiImportApi, type OpenApiImportCommandOptions, type OpenApiImportDraftResult, type OpenApiImportOperationSummary, type OpenApiImportPlanResult, type OpenApiImportRequest, type OpenApiImportRuntime, PACKAGE_NAME, type ProjectListResult, type PublicationApplyRequest, type PublicationConfirmation, type PublicationPlanRequest, type PublicationPlanTransportResponse, type PublicationReviewProfileRequestOptions, type PublishApiClient, type PublishApiFactory, PublishCommandError, type PublishCommandOptions, type PublishCommandRuntime, type RandomBytes, type ReviewPackageCreateRequest, type ReviewPackageCreateResult, type ReviewPackageDownloadResult, type ReviewPackageMetadata, type SafeCustomDomain, type SafeLogEntry, type SafeProject, type TemplateApi, type TemplateCommandRuntime, UsageError, assertProjectId, assertResourceId, buildProgram, captureInitRoot, clearAll, computeDomainPlan, connectConfigMcp, createAdminApiClient, createInitCommandRuntime, createOAuthScopeRegisterRuntime, createOpenApiImportRuntime, createPublishCommandRuntime, createS256Challenge, createTemplateCommandRuntime, fetchOAuthMetadata, finalizeExistingInitManifest, generateIdempotencyKey, generatePkceVerifier, getConfigDir, getConfigMcpProfile, getCredentialsPath, getProfile, isSensitiveKey, isValidDomain, loadConfigMcpConnectionConfig, loadContract, loadOnboardingTemplateArtifact, loginAdminCli, maskSecrets, maskToken, normalizeConfigMcpScopes, normalizeDevOptions, normalizeInitOptions, normalizePublishOptions, packageName, prepareInitLocal, probeConfigMcpTools, readVersion, redactDeep, registerDev, registerInit, registerOpenApi, registerPublish, registerTemplate, removeConfigMcpProfile, removeProfile, resolveConfigMcpConnection, resolveContractPath, runCli, runDevCommand, runDoctor, runInitCommand, runOAuthScopeRegisterCommand, runOpenApiImportCommand, runPublishCommand, runTemplatePlanOrApply, runTemplateRollback, setConfigMcpProfile, setProfile, validateOAuthMetadata, writeInitManifestNoReplace };
|