@kanmon-hq/tollgate-ui 0.0.5 → 1.1.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +28 -5
- package/dist/api/client.d.ts +20 -3
- package/dist/components/TollgateConsole.ce.vue.d.ts +0 -1
- package/dist/config.d.ts +33 -0
- package/dist/tollgate-ui.js +2906 -2440
- package/dist/tollgate-ui.umd.cjs +64 -34
- package/dist/types/index.d.ts +8 -0
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -113,22 +113,45 @@ export function TollgateAdminPage() {
|
|
|
113
113
|
|
|
114
114
|
## Props (Attributes / Properties)
|
|
115
115
|
|
|
116
|
-
| 属性名 | 型 | 説明 | デフォルト値 |
|
|
116
|
+
| 属性名 | 型 | 説明 | デフォルト値 / 環境変数フォールバック |
|
|
117
117
|
| :--- | :--- | :--- | :--- |
|
|
118
|
-
| `api-base-url` | `string` | Tollgate サーバーの Base URL (例: `http://localhost:8000`) | `""` |
|
|
119
|
-
| `admin-token` | `string` | 管理者認可シークレット / Bearer トークン | `""` |
|
|
118
|
+
| `api-base-url` | `string` | Tollgate サーバーの Base URL (例: `http://localhost:8000`, `/api`) | `""` / `VITE_TOLLGATE_API_BASE_URL` |
|
|
119
|
+
| `admin-token` | `string` | 管理者認可シークレット / Bearer トークン | `""` / `VITE_TOLLGATE_ADMIN_TOKEN` |
|
|
120
120
|
| `tenant-id` | `string` | 特定テナントに限定する場合のテナントID | `""` |
|
|
121
|
-
| `tenants-json` | `string` \| `TenantOption[]` | テナント一覧の配列(またはJSON文字列) | `[]` |
|
|
121
|
+
| `tenants-json` | `string` \| `TenantOption[]` | テナント一覧の配列(またはJSON文字列) | `[]` / `VITE_TOLLGATE_TENANTS` |
|
|
122
122
|
| `embedded` | `boolean` | ヘッダーを非表示にしてコンポーネントのみ埋め込むモード | `false` |
|
|
123
123
|
| `title` | `string` | ヘッダータイトル | `"API Key Gateway (Tollgate) 管理コンソール"` |
|
|
124
124
|
|
|
125
|
+
## 環境変数 (デフォルト設定)
|
|
126
|
+
|
|
127
|
+
ビルド時やローカル開発時、属性が省略された場合のデフォルト値を `.env` 等の環境変数で設定可能です:
|
|
128
|
+
|
|
129
|
+
```env
|
|
130
|
+
# Tollgate UI — Environment Variables
|
|
131
|
+
VITE_TOLLGATE_API_BASE_URL=http://localhost:8000
|
|
132
|
+
VITE_TOLLGATE_ADMIN_TOKEN=admin-secret-key-for-local-dev
|
|
133
|
+
VITE_TOLLGATE_TENANTS=[{"id":"tenant-risk-01","name":"Risk Division"},{"id":"tenant-finance-02","name":"Finance Division"}]
|
|
134
|
+
```
|
|
135
|
+
|
|
136
|
+
## UI 上での動的エンドポイント変更
|
|
137
|
+
|
|
138
|
+
- ヘッダー右上の **エンドポイントバッジ / 接続設定ボタン(⚙️)** をクリックすることで、モーダル上から API Base URL や Admin Token を動的に変更・接続テスト・即時リロードが可能です。
|
|
139
|
+
- UI 上で変更した設定はブラウザの `localStorage` に保持され、リロード後も維持されます。「初期値に戻す」ボタンで環境変数/Props のデフォルト値に戻すことができます。
|
|
140
|
+
|
|
141
|
+
## 解決優先順位 (Resolution Order)
|
|
142
|
+
|
|
143
|
+
1. **UI 手動設定** (`localStorage`)
|
|
144
|
+
2. **Props / Attributes** (`api-base-url`, `admin-token`, `tenants-json`)
|
|
145
|
+
3. **環境変数** (`VITE_TOLLGATE_*`) またはグローバル定義 (`window.__TOLLGATE_CONFIG__`)
|
|
146
|
+
4. **デフォルト値** (同一オリジン / 空文字)
|
|
147
|
+
|
|
125
148
|
## 開発
|
|
126
149
|
|
|
127
150
|
```bash
|
|
128
151
|
# 依存関係インストール
|
|
129
152
|
npm install
|
|
130
153
|
|
|
131
|
-
# 開発サーバー起動
|
|
154
|
+
# 開発サーバー起動 (http://localhost:5173/)
|
|
132
155
|
npm run dev
|
|
133
156
|
|
|
134
157
|
# Web Components ライブラリビルド
|
package/dist/api/client.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { TollgateKey, CreateKeyInput, CreateKeyOutput, UpdateKeyInput, RotateKeyOutput, VerifyKeyResult } from '../types';
|
|
1
|
+
import { TollgateKey, CreateKeyInput, CreateKeyOutput, UpdateKeyInput, RotateKeyOutput, VerifyKeyResult, KeyStats } from '../types';
|
|
2
2
|
export declare class TollgateApiClient {
|
|
3
3
|
private baseUrl;
|
|
4
4
|
private adminToken?;
|
|
@@ -8,17 +8,34 @@ export declare class TollgateApiClient {
|
|
|
8
8
|
adminToken?: string;
|
|
9
9
|
tenantId?: string;
|
|
10
10
|
});
|
|
11
|
+
getBaseUrl(): string;
|
|
11
12
|
setBaseUrl(url: string): void;
|
|
13
|
+
getAdminToken(): string | undefined;
|
|
12
14
|
setAdminToken(token?: string): void;
|
|
15
|
+
getTenantId(): string | undefined;
|
|
13
16
|
setTenantId(id?: string): void;
|
|
17
|
+
checkHealth(): Promise<{
|
|
18
|
+
status: string;
|
|
19
|
+
service?: string;
|
|
20
|
+
}>;
|
|
21
|
+
checkAdminAuth(tenantId?: string): Promise<boolean>;
|
|
14
22
|
private request;
|
|
15
|
-
fetchKeys(
|
|
23
|
+
fetchKeys(options?: string | {
|
|
24
|
+
tenantId?: string;
|
|
25
|
+
serviceId?: string;
|
|
26
|
+
limit?: number;
|
|
27
|
+
cursor?: string;
|
|
28
|
+
}): Promise<{
|
|
29
|
+
keys: TollgateKey[];
|
|
30
|
+
nextCursor?: string;
|
|
31
|
+
}>;
|
|
32
|
+
fetchStats(tenantId?: string, serviceId?: string): Promise<KeyStats>;
|
|
16
33
|
fetchAllKeys(tenantIds: string[]): Promise<TollgateKey[]>;
|
|
17
34
|
createKey(input: CreateKeyInput): Promise<CreateKeyOutput>;
|
|
18
35
|
updateKey(keyId: string, payload: UpdateKeyInput, tenantId?: string): Promise<TollgateKey>;
|
|
19
36
|
suspendKey(keyId: string, tenantId?: string): Promise<void>;
|
|
20
37
|
resumeKey(keyId: string, tenantId?: string): Promise<void>;
|
|
21
|
-
rotateKey(keyId: string,
|
|
38
|
+
rotateKey(keyId: string, gracePeriodHours?: number, tenantId?: string): Promise<RotateKeyOutput>;
|
|
22
39
|
deleteKey(keyId: string, tenantId?: string): Promise<void>;
|
|
23
40
|
verifyKey(rawKey: string, requiredScope?: string): Promise<VerifyKeyResult>;
|
|
24
41
|
}
|
|
@@ -11,7 +11,6 @@ declare const _default: import('vue').DefineComponent<__VLS_Props, {}, {}, {}, {
|
|
|
11
11
|
adminToken: string;
|
|
12
12
|
tenantId: string;
|
|
13
13
|
apiBaseUrl: string;
|
|
14
|
-
tenantsJson: string | TenantOption[];
|
|
15
14
|
embedded: boolean;
|
|
16
15
|
title: string;
|
|
17
16
|
}, {}, {}, {}, string, import('vue').ComponentProvideOptions, false, {}, HTMLDivElement>;
|
package/dist/config.d.ts
ADDED
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* 環境変数およびグローバル設定の安全な取得ユーティリティ
|
|
3
|
+
*/
|
|
4
|
+
declare global {
|
|
5
|
+
interface Window {
|
|
6
|
+
__TOLLGATE_CONFIG__?: {
|
|
7
|
+
apiBaseUrl?: string;
|
|
8
|
+
adminToken?: string;
|
|
9
|
+
tenantId?: string;
|
|
10
|
+
tenantsJson?: string;
|
|
11
|
+
};
|
|
12
|
+
}
|
|
13
|
+
}
|
|
14
|
+
/**
|
|
15
|
+
* デフォルトの API Base URL を取得する
|
|
16
|
+
* 解決優先順位:
|
|
17
|
+
* 1. import.meta.env.VITE_TOLLGATE_API_BASE_URL
|
|
18
|
+
* 2. window.__TOLLGATE_CONFIG__.apiBaseUrl
|
|
19
|
+
* 3. '' (空文字: 同一ホスト / リバースプロキシ経由)
|
|
20
|
+
*/
|
|
21
|
+
export declare function getDefaultApiBaseUrl(): string;
|
|
22
|
+
/**
|
|
23
|
+
* デフォルトの管理者トークンを取得する
|
|
24
|
+
* 解決優先順位:
|
|
25
|
+
* 1. import.meta.env.VITE_TOLLGATE_ADMIN_TOKEN
|
|
26
|
+
* 2. window.__TOLLGATE_CONFIG__.adminToken
|
|
27
|
+
* 3. ''
|
|
28
|
+
*/
|
|
29
|
+
export declare function getDefaultAdminToken(): string;
|
|
30
|
+
/**
|
|
31
|
+
* デフォルトのテナント一覧 (JSON文字列) を取得する
|
|
32
|
+
*/
|
|
33
|
+
export declare function getDefaultTenantsJson(): string;
|