@oomol-lab/open-flow 0.1.0-beta.22 → 0.1.0-beta.23

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.
Files changed (46) hide show
  1. package/dist/browser/{createResourceDialog-CjuJryCv.js → createResourceDialog-PKbMMpEk.js} +29 -29
  2. package/dist/browser/event-sources.d.ts +30 -0
  3. package/dist/browser/{flowChanges-Tg1duLry.js → flowChanges-BUlMz4iC.js} +4236 -3019
  4. package/dist/browser/{flowWorkspace-CoK10XHY.js → flowWorkspace-DLArN17T.js} +49585 -42617
  5. package/dist/browser/{i18n-CVBh0Ni1.js → input-group-C2frNYAx.js} +1801 -75
  6. package/dist/browser/{inputValues-CDiBMKu8.js → inputValues-CcGVt51C.js} +10 -10
  7. package/dist/browser/licenses.md +60 -0
  8. package/dist/browser/lite-Cy6aeiL6.js +8538 -0
  9. package/dist/browser/{markdownContent-BBgH9ZIV.js → markdownContent-SIlWuHve.js} +17 -17
  10. package/dist/browser/theme.css +45 -5
  11. package/dist/browser/ui.css +1 -1
  12. package/dist/browser/ui.d.ts +23 -1
  13. package/dist/browser/ui.js +59 -27
  14. package/dist/browser/workbench-contract.d.ts +19 -0
  15. package/dist/browser/workbench.css +1 -1
  16. package/dist/browser/workbench.d.ts +1 -0
  17. package/dist/browser/workbench.js +1176 -734
  18. package/dist/browser/workbenchSelect-CPRUXKbf.js +6088 -0
  19. package/dist/common/control-api-conformance.js +273 -232
  20. package/dist/common/control-api-errors.d.ts +20 -0
  21. package/dist/common/control-api.d.ts +50 -10
  22. package/dist/common/control-api.js +899 -661
  23. package/dist/common/control-requests.d.ts +23 -0
  24. package/dist/common/control-requests.js +377 -351
  25. package/dist/common/event-sources.d.ts +50 -0
  26. package/dist/common/feishu-events.d.ts +20 -0
  27. package/dist/common/feishu-subscriptions.d.ts +10 -0
  28. package/dist/common/fr-iv1541dF.js +93 -0
  29. package/dist/common/integration-trigger.d.ts +4 -0
  30. package/dist/common/ja-Bq-ZDOD4.js +93 -0
  31. package/dist/common/ko-Z-k9R2c6.js +93 -0
  32. package/dist/common/localization.d.ts +2 -0
  33. package/dist/common/localization.js +37 -1
  34. package/dist/common/mcp.js +615 -382
  35. package/dist/common/poll-trigger.d.ts +2 -0
  36. package/dist/common/provider-triggers.d.ts +4 -0
  37. package/dist/common/provider-triggers.js +3225 -2692
  38. package/dist/common/ru-B4gFecYZ.js +93 -0
  39. package/dist/common/trigger-catalog.d.ts +17 -0
  40. package/dist/common/trigger-config-options.d.ts +13 -0
  41. package/dist/common/trigger-localization.d.ts +7 -0
  42. package/dist/common/zh-CN-ByQ6nYam.js +93 -0
  43. package/dist/common/zh-TW-QjIarvX9.js +93 -0
  44. package/package.json +1 -1
  45. package/dist/browser/useValueChanged-BY05Usw-.js +0 -2944
  46. package/dist/browser/workbenchSelect-DEmv7SLW.js +0 -11666
@@ -0,0 +1,50 @@
1
+ export interface CreateEventSource {
2
+ readonly version: 1;
3
+ readonly name: string;
4
+ readonly connectionId: string;
5
+ readonly teamId: string | null;
6
+ readonly verificationToken: string;
7
+ readonly encryptKey: string;
8
+ readonly eventTypes: string[];
9
+ readonly manageSubscriptions: boolean;
10
+ }
11
+ export interface UpdateEventSource {
12
+ readonly version: 1;
13
+ readonly expectedRevision: number;
14
+ readonly name: string;
15
+ readonly enabled: boolean;
16
+ readonly eventTypes: string[];
17
+ readonly verificationToken?: string;
18
+ readonly encryptKey?: string;
19
+ }
20
+ export interface EventSource {
21
+ readonly version: 1;
22
+ readonly sourceId: string;
23
+ readonly revision: number;
24
+ readonly name: string;
25
+ readonly provider: 'feishu' | 'feishu_app_bot';
26
+ readonly appId: string;
27
+ readonly tenantKey: string;
28
+ readonly connectionId: string;
29
+ readonly teamId: string | null;
30
+ readonly enabled: boolean;
31
+ readonly eventTypes: string[];
32
+ readonly manageSubscriptions: boolean;
33
+ readonly verificationTokenConfigured: boolean;
34
+ readonly encryptKeyConfigured: boolean;
35
+ readonly endpointUrl: string | null;
36
+ readonly verifiedAt: string | null;
37
+ readonly lastReceivedAt: string | null;
38
+ readonly updatedAt: string;
39
+ readonly consumers: {
40
+ flowId: string;
41
+ flowName: string;
42
+ triggerNodeId: string;
43
+ }[];
44
+ }
45
+ export declare function decodeEventSource(value: unknown): EventSource;
46
+ export declare function decodeEventSources(value: unknown): {
47
+ readonly version: 1;
48
+ readonly sources: readonly EventSource[];
49
+ readonly teamId?: string | null;
50
+ };
@@ -0,0 +1,20 @@
1
+ import type { JsonValue } from '../browser/flow-change.js';
2
+ export interface FeishuEvent {
3
+ readonly id: string;
4
+ readonly type: string;
5
+ readonly appId: string;
6
+ readonly tenantKey: string;
7
+ readonly occurredAt: string | null;
8
+ readonly body: Readonly<Record<string, JsonValue>>;
9
+ }
10
+ export declare function receiveFeishuEvent(rawBody: Uint8Array, headers: Headers, source: {
11
+ readonly appId: string;
12
+ readonly tenantKey: string;
13
+ readonly verificationToken: string;
14
+ readonly encryptKey: string;
15
+ }, now: number): Promise<{
16
+ readonly challenge: string;
17
+ } | {
18
+ readonly event: FeishuEvent;
19
+ }>;
20
+ export declare function matchesFeishuEvent(config: Readonly<Record<string, JsonValue>>, event: FeishuEvent): boolean;
@@ -0,0 +1,10 @@
1
+ import type { ConnectorProxyRequest, ConnectorProxyResult } from './connector-proxy.js';
2
+ import type { JsonValue } from '../browser/flow-change.js';
3
+ export interface FeishuSubscription {
4
+ readonly key: string;
5
+ readonly subscribe: ConnectorProxyRequest;
6
+ readonly unsubscribe: ConnectorProxyRequest;
7
+ readonly inspect?: ConnectorProxyRequest;
8
+ }
9
+ export declare function feishuSubscriptions(config: Readonly<Record<string, JsonValue>>, provider: string): readonly FeishuSubscription[];
10
+ export declare function feishuResponse(result: ConnectorProxyResult): Readonly<Record<string, JsonValue>>;
@@ -0,0 +1,93 @@
1
+ //#region src/trigger/providers/airtable/locales/fr.json
2
+ var e = { "airtable.on_record_changed": {
3
+ displayName: "Création ou mise à jour d’un enregistrement",
4
+ description: "Interroge périodiquement une table Airtable et se déclenche à la création ou à la mise à jour d’un enregistrement, dans l’ordre d’un champ temporel."
5
+ } }, t = { "feishu_app_bot.on_event": {
6
+ displayName: "Événement d’application",
7
+ description: "Reçoit les événements Feishu sélectionnés via une source partagée."
8
+ } }, n = {
9
+ "github.on_repo_event": {
10
+ displayName: "Événement de dépôt",
11
+ description: "Se déclenche lors des événements webhook GitHub sélectionnés dans un dépôt."
12
+ },
13
+ "github.watch_pull_request": {
14
+ displayName: "Suivi d’une pull request",
15
+ description: "Suit une pull request grâce aux notifications et à des vérifications périodiques. Part de son état actuel et signale les changements observés, sans garantir chaque transition intermédiaire ou événement de revue."
16
+ }
17
+ }, r = { "gitlab.on_project_event": {
18
+ displayName: "Événement de projet",
19
+ description: "Se déclenche lors des événements webhook GitLab sélectionnés dans un projet."
20
+ } }, i = { "gmail.on_message_received": {
21
+ displayName: "Nouveau message reçu",
22
+ description: "Interroge périodiquement la boîte Gmail et se déclenche à la réception d’un nouveau message."
23
+ } }, a = { "googlecalendar.on_event_changed": {
24
+ displayName: "Modification d’un événement",
25
+ description: "Interroge périodiquement un agenda Google et se déclenche à la création, à la modification ou à l’annulation d’un événement."
26
+ } }, o = {
27
+ "googledrive.changes_detected": {
28
+ displayName: "Modifications détectées",
29
+ description: "Utilise un canal Google Drive changes.watch et se déclenche lorsque des modifications Drive sont disponibles."
30
+ },
31
+ "googledrive.watch_changes": {
32
+ displayName: "Suivi des modifications",
33
+ description: "Surveille les modifications Drive grâce aux notifications et à des analyses périodiques du même flux de modifications."
34
+ },
35
+ "googledrive.on_file_change": {
36
+ displayName: "Modification d’un fichier ou dossier dans un dossier",
37
+ description: "Interroge périodiquement un dossier Google Drive et se déclenche à la création ou à la modification d’un fichier ou dossier directement à l’intérieur."
38
+ }
39
+ }, s = { "googlesheets.on_row_added": {
40
+ displayName: "Nouvelle ligne ajoutée",
41
+ description: "Interroge périodiquement une feuille et se déclenche une fois pour chaque nouvelle ligne ajoutée après la dernière ligne déjà observée."
42
+ } }, c = { "linear.on_issue_changed": {
43
+ displayName: "Création ou mise à jour d’un ticket",
44
+ description: "Vérifie périodiquement les tickets nouveaux et modifiés d’une équipe Linear. Commence maintenant, sans déclencher les tickets existants. Signale les états actuels observés, sans couvrir les suppressions ni chaque changement de statut intermédiaire."
45
+ } }, l = { "notion.on_database_page_event": {
46
+ displayName: "Ajout ou mise à jour d’une page de base de données",
47
+ description: "Interroge périodiquement une base Notion et se déclenche à l’ajout d’une page ou à la modification d’une page existante."
48
+ } }, u = { "one_drive.on_item_changed": {
49
+ displayName: "Modification d’un fichier ou dossier",
50
+ description: "Interroge périodiquement le flux de modifications OneDrive et se déclenche à la création, à la modification ou à la suppression d’un fichier ou dossier."
51
+ } }, d = { "outlook.on_message_received": {
52
+ displayName: "Nouveau message reçu",
53
+ description: "Interroge périodiquement un dossier de courrier Microsoft Outlook et se déclenche à l’arrivée d’un nouveau message."
54
+ } }, f = { "shopify.on_shop_event": {
55
+ displayName: "Événement de boutique",
56
+ description: "Se déclenche lors des événements correspondant aux sujets webhook Shopify sélectionnés dans la boutique connectée."
57
+ } }, p = { "slack.on_message_posted": {
58
+ displayName: "Nouveau message de canal",
59
+ description: "Interroge périodiquement une conversation Slack et se déclenche à la publication d’un nouveau message."
60
+ } }, m = { "stripe.on_event": {
61
+ displayName: "Événement de compte",
62
+ description: "Se déclenche lors des événements Stripe sélectionnés sur le compte connecté."
63
+ } }, h = { "telegram.on_update": {
64
+ displayName: "Mise à jour du bot",
65
+ description: "Se déclenche lorsque le bot Telegram connecté reçoit une mise à jour sélectionnée."
66
+ } }, g = { "woocommerce.on_store_event": {
67
+ displayName: "Événement de boutique",
68
+ description: "Se déclenche lors des événements de boutique WooCommerce sélectionnés."
69
+ } }, _ = { "zendesk.on_event": {
70
+ displayName: "Abonnement aux événements",
71
+ description: "Se déclenche lorsque l’un des événements de compte Zendesk sélectionnés se produit."
72
+ } }, v = {
73
+ ...e,
74
+ ...t,
75
+ ...n,
76
+ ...r,
77
+ ...i,
78
+ ...a,
79
+ ...o,
80
+ ...s,
81
+ ...c,
82
+ ...l,
83
+ ...u,
84
+ ...d,
85
+ ...f,
86
+ ...p,
87
+ ...m,
88
+ ...h,
89
+ ...g,
90
+ ..._
91
+ };
92
+ //#endregion
93
+ export { v as default };
@@ -1,5 +1,6 @@
1
1
  import type { ConnectorProxy } from './connector-proxy.js';
2
2
  import type { IntegrationEndpointMethod, JsonValue, TriggerKeySnapshot } from '../browser/flow-change.js';
3
+ import type { TriggerConfigOption, TriggerConfigOptionsContext } from './trigger-config-options.js';
3
4
  export declare const maximumIntegrationBodyBytes: number;
4
5
  export declare const maximumIntegrationDeliveryPages = 5;
5
6
  export interface ListenerReadContext {
@@ -47,6 +48,7 @@ export interface IntegrationStateContext {
47
48
  readonly saveSubscription: (subscription: Readonly<Record<string, JsonValue>>, reconcileAt: Date) => Promise<void>;
48
49
  }
49
50
  export interface IntegrationReceiveContext {
51
+ readonly eventSourceId?: string;
50
52
  readonly signal?: AbortSignal;
51
53
  readonly admit: boolean;
52
54
  readonly allow?: () => Promise<boolean>;
@@ -78,6 +80,8 @@ export interface IntegrationReconcileResult {
78
80
  readonly outcome: 'pending' | 'ready';
79
81
  }
80
82
  export interface IntegrationDefinition {
83
+ readonly eventSource?: 'feishu';
84
+ readonly configOptions?: (context: TriggerConfigOptionsContext) => Promise<readonly TriggerConfigOption[]>;
81
85
  readonly listener?: ListenerSource;
82
86
  readonly initialState?: {
83
87
  readonly checkpoint: JsonValue;
@@ -0,0 +1,93 @@
1
+ //#region src/trigger/providers/airtable/locales/ja.json
2
+ var e = { "airtable.on_record_changed": {
3
+ displayName: "レコードの作成・更新",
4
+ description: "Airtable のテーブルを定期的に確認し、時刻フィールド順にレコードの作成や更新を検出すると実行します。"
5
+ } }, t = { "feishu_app_bot.on_event": {
6
+ displayName: "アプリのイベント",
7
+ description: "共有イベントソースで選択した Feishu イベントを受信します。"
8
+ } }, n = {
9
+ "github.on_repo_event": {
10
+ displayName: "リポジトリイベント",
11
+ description: "リポジトリで選択した GitHub webhook イベントが発生すると実行します。"
12
+ },
13
+ "github.watch_pull_request": {
14
+ displayName: "プルリクエストの監視",
15
+ description: "通知と定期チェックで1件のプルリクエストを監視します。現在の状態から開始し、観測した変更を報告します。途中の状態遷移やレビューイベントをすべて報告するとは限りません。"
16
+ }
17
+ }, r = { "gitlab.on_project_event": {
18
+ displayName: "プロジェクトイベント",
19
+ description: "プロジェクトで選択した GitLab webhook イベントが発生すると実行します。"
20
+ } }, i = { "gmail.on_message_received": {
21
+ displayName: "新着メール",
22
+ description: "Gmail のメールボックスを定期的に確認し、新しいメールを受信すると実行します。"
23
+ } }, a = { "googlecalendar.on_event_changed": {
24
+ displayName: "予定の変更",
25
+ description: "Google カレンダーを定期的に確認し、予定が作成、更新、キャンセルされると実行します。"
26
+ } }, o = {
27
+ "googledrive.changes_detected": {
28
+ displayName: "変更の検出",
29
+ description: "Google Drive の changes.watch チャネルを使用し、ドライブの変更を取得できるようになると実行します。"
30
+ },
31
+ "googledrive.watch_changes": {
32
+ displayName: "変更の監視",
33
+ description: "通知と同じ変更ストリームの定期スキャンでドライブの変更を監視します。"
34
+ },
35
+ "googledrive.on_file_change": {
36
+ displayName: "フォルダ直下のファイル・フォルダの変更",
37
+ description: "Google Drive の1つのフォルダを定期的に確認し、直下のファイルやフォルダが作成、更新されると実行します。"
38
+ }
39
+ }, s = { "googlesheets.on_row_added": {
40
+ displayName: "新しい行の追加",
41
+ description: "シートを定期的に確認し、前回確認した最終行の下に追加された新しい行ごとに1回実行します。"
42
+ } }, c = { "linear.on_issue_changed": {
43
+ displayName: "課題の作成・更新",
44
+ description: "Linear チームの課題の作成と更新を定期的に確認します。現在から開始し、既存の課題では実行しません。観測した現在の状態を報告し、削除や途中のすべての状態変化は報告しません。"
45
+ } }, l = { "notion.on_database_page_event": {
46
+ displayName: "データベースページの追加・更新",
47
+ description: "Notion データベースを定期的に確認し、ページの追加や既存ページの編集を検出すると実行します。"
48
+ } }, u = { "one_drive.on_item_changed": {
49
+ displayName: "ファイル・フォルダの変更",
50
+ description: "OneDrive の変更フィードを定期的に確認し、ファイルやフォルダの作成、更新、削除を検出すると実行します。"
51
+ } }, d = { "outlook.on_message_received": {
52
+ displayName: "新着メール",
53
+ description: "Microsoft Outlook のメールフォルダを定期的に確認し、新しいメールが届くと実行します。"
54
+ } }, f = { "shopify.on_shop_event": {
55
+ displayName: "ストアイベント",
56
+ description: "接続したストアで選択した Shopify webhook トピックのイベントが発生すると実行します。"
57
+ } }, p = { "slack.on_message_posted": {
58
+ displayName: "チャンネルの新着メッセージ",
59
+ description: "Slack の1つの会話を定期的に確認し、新しいメッセージが投稿されると実行します。"
60
+ } }, m = { "stripe.on_event": {
61
+ displayName: "アカウントイベント",
62
+ description: "接続したアカウントで選択した Stripe イベントが発生すると実行します。"
63
+ } }, h = { "telegram.on_update": {
64
+ displayName: "ボットの更新",
65
+ description: "接続した Telegram ボットが選択した更新を受信すると実行します。"
66
+ } }, g = { "woocommerce.on_store_event": {
67
+ displayName: "ストアイベント",
68
+ description: "選択した WooCommerce ストアイベントが発生すると実行します。"
69
+ } }, _ = { "zendesk.on_event": {
70
+ displayName: "イベント購読",
71
+ description: "選択した Zendesk アカウントイベントのいずれかが発生すると実行します。"
72
+ } }, v = {
73
+ ...e,
74
+ ...t,
75
+ ...n,
76
+ ...r,
77
+ ...i,
78
+ ...a,
79
+ ...o,
80
+ ...s,
81
+ ...c,
82
+ ...l,
83
+ ...u,
84
+ ...d,
85
+ ...f,
86
+ ...p,
87
+ ...m,
88
+ ...h,
89
+ ...g,
90
+ ..._
91
+ };
92
+ //#endregion
93
+ export { v as default };
@@ -0,0 +1,93 @@
1
+ //#region src/trigger/providers/airtable/locales/ko.json
2
+ var e = { "airtable.on_record_changed": {
3
+ displayName: "레코드 생성 또는 업데이트",
4
+ description: "Airtable 테이블을 주기적으로 확인하고 시간 필드 순서에 따라 레코드가 생성되거나 업데이트되면 실행합니다."
5
+ } }, t = { "feishu_app_bot.on_event": {
6
+ displayName: "앱 이벤트",
7
+ description: "공유 이벤트 소스로 선택한 Feishu 앱 이벤트를 수신합니다."
8
+ } }, n = {
9
+ "github.on_repo_event": {
10
+ displayName: "저장소 이벤트",
11
+ description: "저장소에서 선택한 GitHub webhook 이벤트가 발생하면 실행합니다."
12
+ },
13
+ "github.watch_pull_request": {
14
+ displayName: "풀 리퀘스트 감시",
15
+ description: "알림과 정기 확인으로 풀 리퀘스트 하나를 감시합니다. 현재 상태에서 시작하며 관찰된 변경을 보고합니다. 모든 중간 상태 전환이나 리뷰 이벤트를 보고하지는 않습니다."
16
+ }
17
+ }, r = { "gitlab.on_project_event": {
18
+ displayName: "프로젝트 이벤트",
19
+ description: "프로젝트에서 선택한 GitLab webhook 이벤트가 발생하면 실행합니다."
20
+ } }, i = { "gmail.on_message_received": {
21
+ displayName: "새 메일 수신",
22
+ description: "Gmail 메일함을 주기적으로 확인하고 새 메일을 받으면 실행합니다."
23
+ } }, a = { "googlecalendar.on_event_changed": {
24
+ displayName: "일정 변경",
25
+ description: "Google Calendar를 주기적으로 확인하고 일정이 생성, 업데이트 또는 취소되면 실행합니다."
26
+ } }, o = {
27
+ "googledrive.changes_detected": {
28
+ displayName: "변경 감지",
29
+ description: "Google Drive changes.watch 채널을 사용하여 드라이브 변경을 가져올 수 있을 때 실행합니다."
30
+ },
31
+ "googledrive.watch_changes": {
32
+ displayName: "변경 감시",
33
+ description: "알림과 동일한 변경 스트림의 정기 스캔으로 드라이브 변경을 감시합니다."
34
+ },
35
+ "googledrive.on_file_change": {
36
+ displayName: "폴더 내 파일 또는 폴더 변경",
37
+ description: "Google Drive 폴더 하나를 주기적으로 확인하고 바로 아래의 파일이나 폴더가 생성 또는 업데이트되면 실행합니다."
38
+ }
39
+ }, s = { "googlesheets.on_row_added": {
40
+ displayName: "새 행 추가",
41
+ description: "시트를 주기적으로 확인하고 마지막으로 확인한 행 아래에 추가된 새 행마다 한 번 실행합니다."
42
+ } }, c = { "linear.on_issue_changed": {
43
+ displayName: "이슈 생성 또는 업데이트",
44
+ description: "Linear 팀에서 새로 생성되거나 업데이트된 이슈를 정기적으로 확인합니다. 현재부터 시작하며 기존 이슈는 실행하지 않습니다. 관찰된 현재 상태를 보고하며 삭제나 모든 중간 상태 변경을 보고하지는 않습니다."
45
+ } }, l = { "notion.on_database_page_event": {
46
+ displayName: "데이터베이스 페이지 추가 또는 업데이트",
47
+ description: "Notion 데이터베이스를 주기적으로 확인하고 페이지가 추가되거나 기존 페이지가 편집되면 실행합니다."
48
+ } }, u = { "one_drive.on_item_changed": {
49
+ displayName: "파일 또는 폴더 변경",
50
+ description: "OneDrive 변경 피드를 주기적으로 확인하고 파일이나 폴더가 생성, 업데이트 또는 삭제되면 실행합니다."
51
+ } }, d = { "outlook.on_message_received": {
52
+ displayName: "새 메일 수신",
53
+ description: "Microsoft Outlook 메일 폴더를 주기적으로 확인하고 새 메일이 도착하면 실행합니다."
54
+ } }, f = { "shopify.on_shop_event": {
55
+ displayName: "스토어 이벤트",
56
+ description: "연결된 스토어에서 선택한 Shopify webhook 주제의 이벤트가 발생하면 실행합니다."
57
+ } }, p = { "slack.on_message_posted": {
58
+ displayName: "채널 새 메시지",
59
+ description: "Slack 대화 하나를 주기적으로 확인하고 새 메시지가 게시되면 실행합니다."
60
+ } }, m = { "stripe.on_event": {
61
+ displayName: "계정 이벤트",
62
+ description: "연결된 계정에서 선택한 Stripe 이벤트가 발생하면 실행합니다."
63
+ } }, h = { "telegram.on_update": {
64
+ displayName: "봇 업데이트",
65
+ description: "연결된 Telegram 봇이 선택한 업데이트를 받으면 실행합니다."
66
+ } }, g = { "woocommerce.on_store_event": {
67
+ displayName: "스토어 이벤트",
68
+ description: "선택한 WooCommerce 스토어 이벤트가 발생하면 실행합니다."
69
+ } }, _ = { "zendesk.on_event": {
70
+ displayName: "이벤트 구독",
71
+ description: "선택한 Zendesk 계정 이벤트 중 하나가 발생하면 실행합니다."
72
+ } }, v = {
73
+ ...e,
74
+ ...t,
75
+ ...n,
76
+ ...r,
77
+ ...i,
78
+ ...a,
79
+ ...o,
80
+ ...s,
81
+ ...c,
82
+ ...l,
83
+ ...u,
84
+ ...d,
85
+ ...f,
86
+ ...p,
87
+ ...m,
88
+ ...h,
89
+ ...g,
90
+ ..._
91
+ };
92
+ //#endregion
93
+ export { v as default };
@@ -19,3 +19,5 @@ export declare function isCjkLanguage(language: string): boolean;
19
19
  * language falls back to English first. The chain never repeats a locale.
20
20
  */
21
21
  export declare function userLocaleFallbackChain(language: string): readonly string[];
22
+ /** Resolve metadata query/header preferences using the same language mapping as the UI. */
23
+ export declare function resolveMetadataLanguage(query: string | undefined, acceptLanguage?: string): UiLanguage;
@@ -58,5 +58,41 @@ function u(e) {
58
58
  let a = t.split("-");
59
59
  return a[0] == "zh" ? a.includes("hant") ? "zh-TW" : a.includes("hans") ? "zh-CN" : a.some((e) => i.has(e)) ? "zh-TW" : "zh-CN" : r.get(a[0]);
60
60
  }
61
+ function d(t, n) {
62
+ if (t != null) {
63
+ let e = Intl.getCanonicalLocales(t.trim())[0];
64
+ if (e == null) throw RangeError("locale must be a valid BCP 47 language tag");
65
+ return s([e]);
66
+ }
67
+ let r = (n ?? "").split(",").flatMap((e, t) => {
68
+ let [n, ...r] = e.trim().split(";"), i = r.find((e) => e.trim().startsWith("q="))?.trim().slice(2), a = i == null ? 1 : Number(i);
69
+ if (!n || !Number.isFinite(a) || a < 0 || a > 1) return [];
70
+ if (n == "*") return [{
71
+ tag: n,
72
+ q: a,
73
+ order: t,
74
+ language: void 0
75
+ }];
76
+ try {
77
+ let e = Intl.getCanonicalLocales(n)[0], r = e == null ? void 0 : u(e);
78
+ return r == null ? [] : [{
79
+ tag: n,
80
+ q: a,
81
+ order: t,
82
+ language: r
83
+ }];
84
+ } catch {
85
+ return [];
86
+ }
87
+ });
88
+ return e.flatMap((e) => {
89
+ let t = r.filter((t) => t.tag == "*" || t.language == e).toSorted((e, t) => (t.tag == "*" ? 0 : t.tag.split("-").length) - (e.tag == "*" ? 0 : e.tag.split("-").length) || e.order - t.order)[0];
90
+ return t == null || t.q == 0 ? [] : [{
91
+ language: e,
92
+ q: t.q,
93
+ order: t.order
94
+ }];
95
+ }).toSorted((e, t) => t.q - e.q || e.order - t.order)[0]?.language ?? "en";
96
+ }
61
97
  //#endregion
62
- export { t as defaultUiLanguage, c as isCjkLanguage, o as isUiLanguage, s as resolveUiLanguage, n as uiLanguageNames, e as uiLanguages, l as userLocaleFallbackChain };
98
+ export { t as defaultUiLanguage, c as isCjkLanguage, o as isUiLanguage, d as resolveMetadataLanguage, s as resolveUiLanguage, n as uiLanguageNames, e as uiLanguages, l as userLocaleFallbackChain };